PageSourceSearch

https://tulip.co/assets/FactoryScene-BdKmIzAU.js

js tulip.co collected 2026-09-24 08:55:07 UTC 1,074,165 bytes, 4,597 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7267e0a4-fc0d-5e57-86f9-e932b52a570b")}catch(e){}}();
3var aR=Object.defineProperty;var lR=(s,e,t)=>e in s?aR(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var Cb=(s,e,t)=>lR(s,typeof e!="symbol"?e+"":e,t);import{d as cR,g as xE,R as _E,r as k,j as C}from"./index-lGm5ADjG.js";import{r as uR,u as yE}from"./useTranslation-D-TvcSm8.js";import{c as hR}from"./client-BPzWDtqr.js";import{u as fR}from"./VideoImagePageHeader-BsgRiUEr.js";import{i as wb}from"./navPause-BO_WaWIp.js";import"./DiagonalArrowIcon-miZX70_K.js";import"./GroupLayout-ZoZ942XL.js";import"./index-C2EAi_ow.js";import"./use-media-query-rWiZ89KW.js";import"./VideoImageFrame-Dd5j0DzM.js";import"./index-061AJicP.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"2849f3c44d80a7b4821617312b2b033dde07e9d7"}}catch{}})();function Xl(){return Xl=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},Xl.apply(null,arguments)}/**
4 * @license
5 * Copyright 2010-2026 Three.js Authors
6 * SPDX-License-Identifier: MIT
7 */const Vu="184",dR={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},pR={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},vE=0,px=1,bE=2,mR=3,AE=0,zl=1,_u=2,na=3,Zs=0,_i=1,Vi=2,Ys=0,ha=1,mx=2,gx=3,xx=4,ME=5,gR=6,ao=100,SE=101,EE=102,TE=103,CE=104,wE=200,RE=201,IE=202,BE=203,Td=204,Cd=205,PE=206,LE=207,DE=208,FE=209,NE=210,OE=211,UE=212,GE=213,kE=214,wd=0,Rd=1,Id=2,ga=3,Bd=4,Pd=5,Ld=6,Dd=7,Wu=0,HE=1,zE=2,ns=0,Jx=1,Yx=2,Kx=3,Tp=4,qx=5,Zx=6,Qx=7,_x="attached",VE="detached",Cp=300,Qs=301,po=302,yu=303,vu=304,ac=306,mo=1e3,xi=1001,Jl=1002,bn=1003,wp=1004,xR=1004,ia=1005,_R=1005,nn=1006,Vl=1007,yR=1007,ts=1008,vR=1008,mi=1009,$x=1010,e_=1011,Yl=1012,Rp=1013,is=1014,oi=1015,bs=1016,Ip=1017,Bp=1018,Kl=1020,t_=35902,n_=35899,i_=1021,s_=1022,ai=1023,$s=1026,co=1027,Pp=1028,ju=1029,go=1030,Lp=1031,bR=1032,Dp=1033,bu=33776,Au=33777,Mu=33778,Su=33779,Fd=35840,Nd=35841,Od=35842,Ud=35843,Gd=36196,kd=37492,Hd=37496,zd=37488,Vd=37489,Iu=37490,Wd=37491,jd=37808,Xd=37809,Jd=37810,Yd=37811,Kd=37812,qd=37813,Zd=37814,Qd=37815,$d=37816,ep=37817,tp=37818,np=37819,ip=37820,sp=37821,rp=36492,op=36494,ap=36495,lp=36283,cp=36284,Bu=36285,up=36286,WE=2200,jE=2201,XE=2202,ql=2300,Zl=2301,yd=2302,yx=2303,sa=2400,ra=2401,Pu=2402,Fp=2500,r_=2501,JE=0,o_=1,hp=2,YE=3200,AR=3201,MR=3202,SR=3203,Er=0,KE=1,vr="",ri="srgb",Ql="srgb-linear",Lu="linear",Qt="srgb",ER="",TR="rg",CR="ga",wR=0,$o=7680,RR=7681,IR=7682,BR=7683,PR=34055,LR=34056,DR=5386,FR=512,NR=513,OR=514,UR=515,GR=516,kR=517,HR=518,vx=519,qE=512,ZE=513,QE=514,Np=515,$E=516,e1=517,Op=518,t1=519,Du=35044,zR=35048,VR=35040,WR=35045,jR=35049,XR=35041,JR=35046,YR=35050,KR=35042,qR="100",bx="300 es",Wi=2e3,xa=2001,ZR={COMPUTE:"compute",RENDER:"render"},QR={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},$R={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},eI={TEXTURE_COMPARE:"depthTextureCompare"};function tI(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const nI={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Hl(s,e){return new nI[s](e)}function n1(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Fu(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function i1(){const s=Fu("canvas");return s.style.display="block",s}const Rb={};let xo=null;function iI(s){xo=s}function sI(){return xo}function Nu(...s){const e="THREE."+s.shift();xo?xo("log",e,...s):console.log(e,...s)}function s1(s){const e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function ke(...s){s=s1(s);const e="THREE."+s.shift();if(xo)xo("warn",e,...s);else{const t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function at(...s){s=s1(s);const e="THREE."+s.shift();if(xo)xo("error",e,...s);else{const t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function fp(...s){const e=s.join(" ");e in Rb||(Rb[e]=!0,ke(...s))}function rI(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}const oI={[wd]:Rd,[Id]:Ld,[Bd]:Dd,[ga]:Pd,[Rd]:wd,[Ld]:Id,[Dd]:Bd,[Pd]:ga};class Ss{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 i=n[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,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 i=n.slice(0);for(let r=0,l=i.length;r<l;r++)i[r].call(this,e);e.target=null}}}const ni=["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","5
75","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 Ib=1234567;const fa=Math.PI/180,$l=180/Math.PI;function Xi(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ni[s&255]+ni[s>>8&255]+ni[s>>16&255]+ni[s>>24&255]+"-"+ni[e&255]+ni[e>>8&255]+"-"+ni[e>>16&15|64]+ni[e>>24&255]+"-"+ni[t&63|128]+ni[t>>8&255]+"-"+ni[t>>16&255]+ni[t>>24&255]+ni[n&255]+ni[n>>8&255]+ni[n>>16&255]+ni[n>>24&255]).toLowerCase()}function gt(s,e,t){return Math.max(e,Math.min(t,s))}function a_(s,e){return(s%e+e)%e}function aI(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function lI(s,e,t){return s!==e?(t-s)/(e-s):0}function Eu(s,e,t){return(1-t)*s+t*e}function cI(s,e,t,n){return Eu(s,e,1-Math.exp(-t*n))}function uI(s,e=1){return e-Math.abs(a_(s,e*2)-e)}function hI(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function fI(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function dI(s,e){return s+Math.floor(Math.random()*(e-s+1))}function pI(s,e){return s+Math.random()*(e-s)}function mI(s){return s*(.5-Math.random())}function gI(s){s!==void 0&&(Ib=s);let e=Ib+=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 xI(s){return s*fa}function _I(s){return s*$l}function yI(s){return(s&s-1)===0&&s!==0}function vI(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function bI(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function AI(s,e,t,n,i){const r=Math.cos,l=Math.sin,c=r(t/2),u=l(t/2),h=r((e+n)/2),d=l((e+n)/2),p=r((e-n)/2),m=l((e-n)/2),g=r((n-e)/2),_=l((n-e)/2);switch(i){case"XYX":s.set(c*d,u*p,u*m,c*h);break;case"YZY":s.set(u*m,c*d,u*p,c*h);break;case"ZXZ":s.set(u*p,u*m,c*d,c*h);break;case"XZX":s.set(c*d,u*_,u*g,c*h);break;case"YXY":s.set(u*g,c*d,u*_,c*h);break;case"ZYZ":s.set(u*_,u*g,c*d,c*h);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function gi(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function wt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const l_={DEG2RAD:fa,RAD2DEG:$l,generateUUID:Xi,clamp:gt,euclideanModulo:a_,mapLinear:aI,inverseLerp:lI,lerp:Eu,damp:cI,pingpong:uI,smoothstep:hI,smootherstep:fI,randInt:dI,randFloat:pI,randFloatSpread:mI,seededRandom:gI,degToRad:xI,radToDeg:_I,isPowerOfTwo:yI,ceilPowerOfTwo:vI,floorPowerOfTwo:bI,setQuaternionFromProperEuler:AI,normalize:wt,denormalize:gi},ey=class ey{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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 11,301 bytes, line 7
7sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(gt(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(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,l=this.y-e.y;return this.x=r*n-l*i+e.x,this.y=r*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};ey.prototype.isVector2=!0;let xe=ey;class Qn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,l,c){let u=n[i+0],h=n[i+1],d=n[i+2],p=n[i+3],m=r[l+0],g=r[l+1],_=r[l+2],b=r[l+3];if(p!==b||u!==m||h!==g||d!==_){let v=u*m+h*g+d*_+p*b;v<0&&(m=-m,g=-g,_=-_,b=-b,v=-v);let y=1-c;if(v<.9995){const A=Math.acos(v),S=Math.sin(A);y=Math.sin(y*A)/S,c=Math.sin(c*A)/S,u=u*y+m*c,h=h*y+g*c,d=d*y+_*c,p=p*y+b*c}else{u=u*y+m*c,h=h*y+g*c,d=d*y+_*c,p=p*y+b*c;const A=1/Math.sqrt(u*u+h*h+d*d+p*p);u*=A,h*=A,d*=A,p*=A}}e[t]=u,e[t+1]=h,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,r,l){const c=n[i],u=n[i+1],h=n[i+2],d=n[i+3],p=r[l],m=r[l+1],g=r[l+2],_=r[l+3];return e[t]=c*_+d*p+u*g-h*m,e[t+1]=u*_+d*m+h*p-c*g,e[t+2]=h*_+d*g+c*m-u*p,e[t+3]=d*_-c*p-u*m-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,l=e._order,c=Math.cos,u=Math.sin,h=c(n/2),d=c(i/2),p=c(r/2),m=u(n/2),g=u(i/2),_=u(r/2);switch(l){case"XYZ":this._x=m*d*p+h*g*_,this._y=h*g*p-m*d*_,this._z=h*d*_+m*g*p,this._w=h*d*p-m*g*_;break;case"YXZ":this._x=m*d*p+h*g*_,this._y=h*g*p-m*d*_,this._z=h*d*_-m*g*p,this._w=h*d*p+m*g*_;break;case"ZXY":this._x=m*d*p-h*g*_,this._y=h*g*p+m*d*_,this._z=h*d*_+m*g*p,this._w=h*d*p-m*g*_;break;case"ZYX":this._x=m*d*p-h*g*_,this._y=h*g*p+m*d*_,this._z=h*d*_-m*g*p,this._w=h*d*p+m*g*_;break;case"YZX":this._x=m*d*p+h*g*_,this._y=h*g*p+m*d*_,this._z=h*d*_-m*g*p,this._w=h*d*p-m*g*_;break;case"XZY":this._x=m*d*p-h*g*_,this._y=h*g*p-m*d*_,this._z=h*d*_+m*g*p,this._w=h*d*p+m*g*_;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],l=t[1],c=t[5],u=t[9],h=t[2],d=t[6],p=t[10],m=n+c+p;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-u)*g,this._y=(r-h)*g,this._z=(l-i)*g}else if(n>c&&n>p){const g=2*Math.sqrt(1+n-c-p);this._w=(d-u)/g,this._x=.25*g,this._y=(i+l)/g,this._z=(r+h)/g}else if(c>p){const g=2*Math.sqrt(1+c-n-p);this._w=(r-h)/g,this._x=(i+l)/g,this._y=.25*g,this._z=(u+d)/g}else{const g=2*Math.sqrt(1+p-n-c);this._w=(l-i)/g,this._x=(r+h)/g,this._y=(u+d)/g,this._z=.25*g}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(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,l=e._w,c=t._x,u=t._y,h=t._z,d=t._w;return this._x=n*d+l*c+i*h-r*u,this._y=i*d+l*u+r*c-n*h,this._z=r*d+l*h+n*u-i*c,this._w=l*d-n*c-i*u-r*h,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,r=-r,l=-l,c=-c);let u=1-t;if(c<.9995){const h=Math.acos(c),d=Math.sin(h);u=Math.sin(u*h)/d,t=Math.sin(t*h)/d,this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+r*t,this._w=this._w*u+l*t,this._onChangeCallback()}else this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+r*t,this._w=this._w*u+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(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const ty=class ty{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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Bb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Bb.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,l=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*l,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*l,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,l=e.y,c=e.z,u=e.w,h=2*(l*i-c*n),d=2*(c*t-r*i),p=2*(r*n-l*t);return this.x=t+u*h+l*p-c*d,this.y=n+u*d+c*h-r*p,this.z=i+u*p+r*d-l*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(gt(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}
vendor: 6,259 bytes, line 7
7round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,l=t.x,c=t.y,u=t.z;return this.x=i*u-r*c,this.y=r*l-n*u,this.z=n*c-i*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 Rg.copy(this).projectOnVector(e),this.sub(Rg)}reflect(e){return this.sub(Rg.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(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ty.prototype.isVector3=!0;let G=ty;const Rg=new G,Bb=new Qn,ny=class ny{constructor(e,t,n,i,r,l,c,u,h){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,u,h)}set(e,t,n,i,r,l,c,u,h){const d=this.elements;return d[0]=e,d[1]=i,d[2]=c,d[3]=t,d[4]=r,d[5]=u,d[6]=n,d[7]=l,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[3],u=n[6],h=n[1],d=n[4],p=n[7],m=n[2],g=n[5],_=n[8],b=i[0],v=i[3],y=i[6],A=i[1],S=i[4],T=i[7],B=i[2],R=i[5],L=i[8];return r[0]=l*b+c*A+u*B,r[3]=l*v+c*S+u*R,r[6]=l*y+c*T+u*L,r[1]=h*b+d*A+p*B,r[4]=h*v+d*S+p*R,r[7]=h*y+d*T+p*L,r[2]=m*b+g*A+_*B,r[5]=m*v+g*S+_*R,r[8]=m*y+g*T+_*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],u=e[6],h=e[7],d=e[8];return t*l*d-t*c*h-n*r*d+n*c*u+i*r*h-i*l*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],u=e[6],h=e[7],d=e[8],p=d*l-c*h,m=c*u-d*r,g=h*r-l*u,_=t*p+n*m+i*g;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/_;return e[0]=p*b,e[1]=(i*h-d*n)*b,e[2]=(c*n-i*l)*b,e[3]=m*b,e[4]=(d*t-i*u)*b,e[5]=(i*r-c*t)*b,e[6]=g*b,e[7]=(n*u-h*t)*b,e[8]=(l*t-n*r)*b,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,l,c){const u=Math.cos(r),h=Math.sin(r);return this.set(n*u,n*h,-n*(u*l+h*c)+l+e,-i*h,i*u,-i*(-h*l+u*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(Ig.makeScale(e,t)),this}rotate(e){return this.premultiply(Ig.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ig.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};ny.prototype.isMatrix3=!0;let vt=ny;
vendor: 26,474 bytes, line 7
7const Ig=new vt,Pb=new vt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Lb=new vt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function MI(){const s={enabled:!0,workingColorSpace:Ql,spaces:{},convert:function(i,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===Qt&&(i.r=Mr(i.r),i.g=Mr(i.g),i.b=Mr(i.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Qt&&(i.r=Wl(i.r),i.g=Wl(i.g),i.b=Wl(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===vr?Lu:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,l){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return fp("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return fp("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Ql]:{primaries:e,whitePoint:n,transfer:Lu,toXYZ:Pb,fromXYZ:Lb,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ri},outputColorSpaceConfig:{drawingBufferColorSpace:ri}},[ri]:{primaries:e,whitePoint:n,transfer:Qt,toXYZ:Pb,fromXYZ:Lb,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ri}}}),s}const It=MI();function Mr(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Wl(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let il;class r1{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{il===void 0&&(il=Fu("canvas")),il.width=e.width,il.height=e.height;const i=il.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=il}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=Fu("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let l=0;l<r.length;l++)r[l]=Mr(r[l]/255)*255;return n.putImageData(i,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(Mr(t[n]/255)*255):t[n]=Mr(t[n]);return{data:t,width:e.width,height:e.height}}else return ke("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let SI=0;class uo{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:SI++}),this.uuid=Xi(),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,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let l=0,c=i.length;l<c;l++)i[l].isDataTexture?r.push(Bg(i[l].image)):r.push(Bg(i[l]))}else r=Bg(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function Bg(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?r1.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(ke("Texture: Unable to serialize Texture."),{})}let EI=0;const Pg=new G;class fn extends Ss{constructor(e=fn.DEFAULT_IMAGE,t=fn.DEFAULT_MAPPING,n=xi,i=xi,r=nn,l=ts,c=ai,u=mi,h=fn.DEFAULT_ANISOTROPY,d=vr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:EI++}),this.uuid=Xi(),this.name="",this.source=new uo(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=l,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new xe(0,0),this.repeat=new xe(1,1),this.center=new xe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new vt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Pg).x}get height(){return this.source.getSize(Pg).y}get depth(){return this.source.getSize(Pg).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.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){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,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!==Cp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case mo:e.x=e.x-Math.floor(e.x);break;case xi:e.x=e.x<0?0:1;break;case Jl: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 mo:e.y=e.y-Math.floor(e.y);break;case xi:e.y=e.y<0?0:1;break;case Jl: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++}}fn.DEFAULT_IMAGE=null;fn.DEFAULT_MAPPING=Cp;fn.DEFAULT_ANISOTROPY=1;const iy=class iy{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*r,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*r,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*r,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*r,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,i,r;const u=e.elements,h=u[0],d=u[4],p=u[8],m=u[1],g=u[5],_=u[9],b=u[2],v=u[6],y=u[10];if(Math.abs(d-m)<.01&&Math.abs(p-b)<.01&&Math.abs(_-v)<.01){if(Math.abs(d+m)<.1&&Math.abs(p+b)<.1&&Math.abs(_+v)<.1&&Math.abs(h+g+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(h+1)/2,T=(g+1)/2,B=(y+1)/2,R=(d+m)/4,L=(p+b)/4,w=(_+v)/4;return S>T&&S>B?S<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(S),i=R/n,r=L/n):T>B?T<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(T),n=R/i,r=w/i):B<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(B),n=L/r,i=w/r),this.set(n,i,r,t),this}let A=Math.sqrt((v-_)*(v-_)+(p-b)*(p-b)+(m-d)*(m-d));return Math.abs(A)<.001&&(A=1),this.x=(v-_)/A,this.y=(p-b)/A,this.z=(m-d)/A,this.w=Math.acos((h+g+y-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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(gt(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}};iy.prototype.isVector4=!0;let Ht=iy;class c_ extends Ss{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:nn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Ht(0,0,e,t),this.scissorTest=!1,this.viewport=new Ht(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},r=new fn(i),l=n.count;for(let c=0;c<l;c++)this.textures[c]=r.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:nn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let 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=null),e!==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 i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].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 i=Object.assign({},e.textures[t].image);this.textures[t].source=new uo(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ri extends c_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Up extends fn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=bn,this.minFilter=bn,this.wrapR=xi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class TI extends Ri{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Up(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Gp extends fn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=bn,this.minFilter=bn,this.wrapR=xi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class CI extends Ri{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Gp(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}const Ep=class Ep{constructor(e,t,n,i,r,l,c,u,h,d,p,m,g,_,b,v){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,u,h,d,p,m,g,_,b,v)}set(e,t,n,i,r,l,c,u,h,d,p,m,g,_,b,v){const y=this.elements;return y[0]=e,y[4]=t,y[8]=n,y[12]=i,y[1]=r,y[5]=l,y[9]=c,y[13]=u,y[2]=h,y[6]=d,y[10]=p,y[14]=m,y[3]=g,y[7]=_,y[11]=b,y[15]=v,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 Ep().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.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/sl.setFromMatrixColumn(e,0).length(),r=1/sl.setFromMatrixColumn(e,1).length(),l=1/sl.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*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,i=e.y,r=e.z,l=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),d=Math.cos(r),p=Math.sin(r);if(e.order==="XYZ"){const m=l*d,g=l*p,_=c*d,b=c*p;t[0]=u*d,t[4]=-u*p,t[8]=h,t[1]=g+_*h,t[5]=m-b*h,t[9]=-c*u,t[2]=b-m*h,t[6]=_+g*h,t[10]=l*u}else if(e.order==="YXZ"){const m=u*d,g=u*p,_=h*d,b=h*p;t[0]=m+b*c,t[4]=_*c-g,t[8]=l*h,t[1]=l*p,t[5]=l*d,t[9]=-c,t[2]=g*c-_,t[6]=b+m*c,t[10]=l*u}else if(e.order==="ZXY"){const m=u*d,g=u*p,_=h*d,b=h*p;t[0]=m-b*c,t[4]=-l*p,t[8]=_+g*c,t[1]=g+_*c,t[5]=l*d,t[9]=b-m*c,t[2]=-l*h,t[6]=c,t[10]=l*u}else if(e.order==="ZYX"){const m=l*d,g=l*p,_=c*d,b=c*p;t[0]=u*d,t[4]=_*h-g,t[8]=m*h+b,t[1]=u*p,t[5]=b*h+m,t[9]=g*h-_,t[2]=-h,t[6]=c*u,t[10]=l*u}else if(e.order==="YZX"){const m=l*u,g=l*h,_=c*u,b=c*h;t[0]=u*d,t[4]=b-m*p,t[8]=_*p+g,t[1]=p,t[5]=l*d,t[9]=-c*d,t[2]=-h*d,t[6]=g*p+_,t[10]=m-b*p}else if(e.order==="XZY"){const m=l*u,g=l*h,_=c*u,b=c*h;t[0]=u*d,t[4]=-p,t[8]=h*d,t[1]=m*p+b,t[5]=l*d,t[9]=g*p-_,t[2]=_*p-g,t[6]=c*d,t[10]=b*p+m}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(wI,e,RI)}lookAt(e,t,n){const i=this.elements;return Hi.subVectors(e,t),Hi.lengthSq()===0&&(Hi.z=1),Hi.normalize(),Wr.crossVectors(n,Hi),Wr.lengthSq()===0&&(Math.abs(n.z)===1?Hi.x+=1e-4:Hi.z+=1e-4,Hi.normalize(),Wr.crossVectors(n,Hi)),Wr.normalize(),Wh.crossVectors(Hi,Wr),i[0]=Wr.x,i[4]=Wh.x,i[8]=Hi.x,i[1]=Wr.y,i[5]=Wh.y,i[9]=Hi.y,i[2]=Wr.z,i[6]=Wh.z,i[10]=Hi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[4],u=n[8],h=n[12],d=n[1],p=n[5],m=n[9],g=n[13],_=n[2],b=n[6],v=n[10],y=n[14],A=n[3],S=n[7],T=n[11],B=n[15],R=i[0],L=i[4],w=i[8],I=i[12],O=i[1],D=i[5],z=i[9],X=i[13],Y=i[2],V=i[6],H=i[10],W=i[14],q=i[3],Q=i[7],re=i[11],ae=i[15];return r[0]=l*R+c*O+u*Y+h*q,r[4]=l*L+c*D+u*V+h*Q,r[8]=l*w+c*z+u*H+h*re,r[12]=l*I+c*X+u*W+h*ae,r[1]=d*R+p*O+m*Y+g*q,r[5]=d*L+p*D+m*V+g*Q,r[9]=d*w+p*z+m*H+g*re,r[13]=d*I+p*X+m*W+g*ae,r[2]=_*R+b*O+v*Y+y*q,r[6]=_*L+b*D+v*V+y*Q,r[10]=_*w+b*z+v*H+y*re,r[14]=_*I+b*X+v*W+y*ae,r[3]=A*R+S*O+T*Y+B*q,r[7]=A*L+S*D+T*V+B*Q,r[11]=A*w+S*z+T*H+B*re,r[15]=A*I+S*X+T*W+B*ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],l=e[1],c=e[5],u=e[9],h=e[13],d=e[2],p=e[6],m=e[10],g=e[14],_=e[3],b=e[7],v=e[11],y=e[15],A=u*g-h*m,S=c*g-h*p,T=c*m-u*p,B=l*g-h*d,R=l*m-u*d,L=l*p-c*d;return t*(b*A-v*S+y*T)-n*(_*A-v*B+y*R)+i*(_*S-b*B+y*L)-r*(_*T-b*R+v*L)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],u=e[6],h=e[7],d=e[8],p=e[9],m=e[10],g=e[11],_=e[12],b=e[13],v=e[14],y=e[15],A=t*c-n*l,S=t*u-i*l,T=t*h-r*l,B=n*u-i*c,R=n*h-r*c,L=i*h-r*u,w=d*b-p*_,I=d*v-m*_,O=d*y-g*_,D=p*v-m*b,z=p*y-g*b,X=m*y-g*v,Y=A*X-S*z+T*D+B*O-R*I+L*w;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/Y;return e[0]=(c*X-u*z+h*D)*V,e[1]=(i*z-n*X-r*D)*V,e[2]=(b*L-v*R+y*B)*V,e[3]=(m*R-p*L-g*B)*V,e[4]=(u*O-l*X-h*I)*V,e[5]=(t*X-i*O+r*I)*V,e[6]=(v*T-_*L-y*S)*V,e[7]=(d*L-m*T+g*S)*V,e[8]=(l*z-c*O+h*w)*V,e[9]=(n*O-t*z-r*w)*V,e[10]=(_*R-b*T+y*A)*V,e[11]=(p*T-d*R-g*A)*V,e[12]=(c*I-l*D-u*w)*V,e[13]=(t*D-n*I+i*w)*V,e[14]=(b*S-_*B-v*A)*V,e[15]=(d*B-p*S+m*A)*V,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,l=e.x,c=e.y,u=e.z,h=r*l,d=r*c;return this.set(h*l+n,h*c-i*u,h*u+i*c,0,h*c+i*u,d*c+n,d*u-i*l,0,h*u-i*c,d*u+i*l,r*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,l){return this.set(1,n,r,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,l=t._y,c=t._z,u=t._w,h=r+r,d=l+l,p=c+c,m=r*h,g=r*d,_=r*p,b=l*d,v=l*p,y=c*p,A=u*h,S=u*d,T=u*p,B=n.x,R=n.y,L=n.z;return i[0]=(1-(b+y))*B,i[1]=(g+T)*B,i[2]=(_-S)*B,i[3]=0,i[4]=(g-T)*R,i[5]=(1-(m+y))*R,i[6]=(v+A)*R,i[7]=0,i[8]=(_+S)*L,i[9]=(v-A)*L,i[10]=(1-(m+b))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const r=this.determinant();if(r===0)return n.set(1,1,1),t.identity(),this;let l=sl.set(i[0],i[1],i[2]).length();const c=sl.set(i[4],i[5],i[6]).length(),u=sl.set(i[8],i[9],i[10]).length();r<0&&(l=-l),ps.copy(this);const h=1/l,d=1/c,p=1/u;return ps.elements[0]*=h,ps.elements[1]*=h,ps.elements[2]*=h,ps.elements[4]*=d,ps.elements[5]*=d,ps.elements[6]*=d,ps.elements[8]*=p,ps.elements[9]*=p,ps.elements[10]*=p,t.setFromRotationMatrix(ps),n.x=l,n.y=c,n.z=u,this}makePerspective(e,t,n,i,r,l,c=Wi,u=!1){const h=this.elements,d=2*r/(t-e),p=2*r/(n-i),m=(t+e)/(t-e),g=(n+i)/(n-i);let _,b;if(u)_=r/(l-r),b=l*r/(l-r);else if(c===Wi)_=-(l+r)/(l-r),b=-2*l*r/(l-r);else if(c===xa)_=-l/(l-r),b=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return h[0]=d,h[4]=0,h[8]=m,h[12]=0,h[1]=0,h[5]=p,h[9]=g,h[13]=0,h[2]=0,h[6]=0,h[10]=_,h[14]=b,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}
vendor: 100,769 bytes, line 7
7makeOrthographic(e,t,n,i,r,l,c=Wi,u=!1){const h=this.elements,d=2/(t-e),p=2/(n-i),m=-(t+e)/(t-e),g=-(n+i)/(n-i);let _,b;if(u)_=1/(l-r),b=l/(l-r);else if(c===Wi)_=-2/(l-r),b=-(l+r)/(l-r);else if(c===xa)_=-1/(l-r),b=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return h[0]=d,h[4]=0,h[8]=0,h[12]=m,h[1]=0,h[5]=p,h[9]=0,h[13]=g,h[2]=0,h[6]=0,h[10]=_,h[14]=b,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};Ep.prototype.isMatrix4=!0;let ft=Ep;const sl=new G,ps=new ft,wI=new G(0,0,0),RI=new G(1,1,1),Wr=new G,Wh=new G,Hi=new G,Db=new ft,Fb=new Qn;class As{constructor(e=0,t=0,n=0,i=As.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],l=i[4],c=i[8],u=i[1],h=i[5],d=i[9],p=i[2],m=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(gt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-p,r),this._z=0);break;case"ZXY":this._x=Math.asin(gt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,g),this._z=Math.atan2(-l,h)):(this._y=0,this._z=Math.atan2(u,r));break;case"ZYX":this._y=Math.asin(-gt(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(u,r)):(this._x=0,this._z=Math.atan2(-l,h));break;case"YZX":this._z=Math.asin(gt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-p,r)):(this._x=0,this._y=Math.atan2(c,g));break;case"XZY":this._z=Math.asin(-gt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,r)):(this._x=Math.atan2(-d,g),this._y=0);break;default:ke("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Db.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Db,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Fb.setFromEuler(this),this.setFromQuaternion(Fb,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}}As.DEFAULT_ORDER="XYZ";class ec{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 II=0;const Nb=new G,rl=new Qn,fr=new ft,jh=new G,Gc=new G,BI=new G,PI=new Qn,Ob=new G(1,0,0),Ub=new G(0,1,0),Gb=new G(0,0,1),kb={type:"added"},LI={type:"removed"},ol={type:"childadded",child:null},Lg={type:"childremoved",child:null};class zt extends Ss{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:II++}),this.uuid=Xi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=zt.DEFAULT_UP.clone();const e=new G,t=new As,n=new Qn,i=new G(1,1,1);function r(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),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:i},modelViewMatrix:{value:new ft},normalMatrix:{value:new vt}}),this.matrix=new ft,this.matrixWorld=new ft,this.matrixAutoUpdate=zt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ec,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return rl.setFromAxisAngle(e,t),this.quaternion.multiply(rl),this}rotateOnWorldAxis(e,t){return rl.setFromAxisAngle(e,t),this.quaternion.premultiply(rl),this}rotateX(e){return this.rotateOnAxis(Ob,e)}rotateY(e){return this.rotateOnAxis(Ub,e)}rotateZ(e){return this.rotateOnAxis(Gb,e)}translateOnAxis(e,t){return Nb.copy(e).applyQuaternion(this.quaternion),this.position.add(Nb.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ob,e)}translateY(e){return this.translateOnAxis(Ub,e)}translateZ(e){return this.translateOnAxis(Gb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(fr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?jh.copy(e):jh.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Gc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?fr.lookAt(Gc,jh,this.up):fr.lookAt(jh,Gc,this.up),this.quaternion.setFromRotationMatrix(fr),i&&(fr.extractRotation(i.matrixWorld),rl.setFromRotationMatrix(fr),this.quaternion.premultiply(rl.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(at("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(kb),ol.child=e,this.dispatchEvent(ol),ol.child=null):at("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(LI),Lg.child=e,this.dispatchEvent(Lg),Lg.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),fr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),fr.multiply(e.parent.matrixWorld)),e.applyMatrix4(fr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(kb),ol.child=e,this.dispatchEvent(ol),ol.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){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 i=this.children;for(let r=0,l=i.length;r<l;r++)i[r].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(Gc,e,BI),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gc,PI,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;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,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let r=0,l=i.length;r<l;r++)i[r].updateWorldMatrix(!1,!0)}}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 i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let h=0,d=u.length;h<d;h++){const p=u[h];r(e.shapes,p)}else r(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(r(e.materials,this.material[u]));i.material=c}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];i.animations.push(r(e.animations,u))}}if(t){const c=l(e.geometries),u=l(e.materials),h=l(e.textures),d=l(e.images),p=l(e.shapes),m=l(e.skeletons),g=l(e.animations),_=l(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),d.length>0&&(n.images=d),p.length>0&&(n.shapes=p),m.length>0&&(n.skeletons=m),g.length>0&&(n.animations=g),_.length>0&&(n.nodes=_)}return n.object=i,n;function l(c){const u=[];for(const h in c){const d=c[h];delete d.metadata,u.push(d)}return u}}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 i=e.children[n];this.add(i.clone())}return this}}zt.DEFAULT_UP=new G(0,1,0);zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Ar extends zt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const DI={type:"move"};class vd{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ar,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 Ar,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ar,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G,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 i=null,r=null,l=null;const c=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){l=!0;for(const b of e.hand.values()){const v=t.getJointPose(b,n),y=this._getHandJoint(h,b);v!==null&&(y.matrix.fromArray(v.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=v.radius),y.visible=v!==null}const d=h.joints["index-finger-tip"],p=h.joints["thumb-tip"],m=d.position.distanceTo(p.position),g=.02,_=.005;h.inputState.pinching&&m>g+_?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=g-_&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(u.matrix.fromArray(r.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,r.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(r.linearVelocity)):u.hasLinearVelocity=!1,r.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(r.angularVelocity)):u.hasAngularVelocity=!1,u.eventsEnabled&&u.dispatchEvent({type:"gripUpdated",data:e,target:this})));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(DI)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=r!==null),h!==null&&(h.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Ar;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const o1={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},jr={h:0,s:0,l:0},Xh={h:0,s:0,l:0};function Dg(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class we{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ri){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,It.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=It.workingColorSpace){return this.r=e,this.g=t,this.b=n,It.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=It.workingColorSpace){if(e=a_(e,1),t=gt(t,0,1),n=gt(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,l=2*n-r;this.r=Dg(l,r,e+1/3),this.g=Dg(l,r,e),this.b=Dg(l,r,e-1/3)}return It.colorSpaceToWorking(this,i),this}setStyle(e,t=ri){function n(r){r!==void 0&&parseFloat(r)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(r,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ri){const n=o1[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("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=Mr(e.r),this.g=Mr(e.g),this.b=Mr(e.b),this}copyLinearToSRGB(e){return this.r=Wl(e.r),this.g=Wl(e.g),this.b=Wl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ri){return It.workingToColorSpace(ii.copy(this),e),Math.round(gt(ii.r*255,0,255))*65536+Math.round(gt(ii.g*255,0,255))*256+Math.round(gt(ii.b*255,0,255))}getHexString(e=ri){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=It.workingColorSpace){It.workingToColorSpace(ii.copy(this),t);const n=ii.r,i=ii.g,r=ii.b,l=Math.max(n,i,r),c=Math.min(n,i,r);let u,h;const d=(c+l)/2;if(c===l)u=0,h=0;else{const p=l-c;switch(h=d<=.5?p/(l+c):p/(2-l-c),l){case n:u=(i-r)/p+(i<r?6:0);break;case i:u=(r-n)/p+2;break;case r:u=(n-i)/p+4;break}u/=6}return e.h=u,e.s=h,e.l=d,e}getRGB(e,t=It.workingColorSpace){return It.workingToColorSpace(ii.copy(this),t),e.r=ii.r,e.g=ii.g,e.b=ii.b,e}getStyle(e=ri){It.workingToColorSpace(ii.copy(this),e);const t=ii.r,n=ii.g,i=ii.b;return e!==ri?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(jr),this.setHSL(jr.h+e,jr.s+t,jr.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(jr),e.getHSL(Xh);const n=Eu(jr.h,Xh.h,t),i=Eu(jr.s,Xh.s,t),r=Eu(jr.l,Xh.l,t);return this.setHSL(n,i,r),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,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ii=new we;we.NAMES=o1;class kp{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new we(e),this.density=t}clone(){return new kp(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Hp{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new we(e),this.near=t,this.far=n}clone(){return new Hp(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class u_ extends zt{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 As,this.environmentIntensity=1,this.environmentRotation=new As,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const ms=new G,dr=new G,Fg=new G,pr=new G,al=new G,ll=new G,Hb=new G,Ng=new G,Og=new G,Ug=new G,Gg=new Ht,kg=new Ht,Hg=new Ht;class Ci{constructor(e=new G,t=new G,n=new G){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),ms.subVectors(e,t),i.cross(ms);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){ms.subVectors(i,t),dr.subVectors(n,t),Fg.subVectors(e,t);const l=ms.dot(ms),c=ms.dot(dr),u=ms.dot(Fg),h=dr.dot(dr),d=dr.dot(Fg),p=l*h-c*c;if(p===0)return r.set(0,0,0),null;const m=1/p,g=(h*u-c*d)*m,_=(l*d-c*u)*m;return r.set(1-g-_,_,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,pr)===null?!1:pr.x>=0&&pr.y>=0&&pr.x+pr.y<=1}static getInterpolation(e,t,n,i,r,l,c,u){return this.getBarycoord(e,t,n,i,pr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(r,pr.x),u.addScaledVector(l,pr.y),u.addScaledVector(c,pr.z),u)}static getInterpolatedAttribute(e,t,n,i,r,l){return Gg.setScalar(0),kg.setScalar(0),Hg.setScalar(0),Gg.fromBufferAttribute(e,t),kg.fromBufferAttribute(e,n),Hg.fromBufferAttribute(e,i),l.setScalar(0),l.addScaledVector(Gg,r.x),l.addScaledVector(kg,r.y),l.addScaledVector(Hg,r.z),l}static isFrontFacing(e,t,n,i){return ms.subVectors(n,t),dr.subVectors(e,t),ms.cross(dr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ms.subVectors(this.c,this.b),dr.subVectors(this.a,this.b),ms.cross(dr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ci.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ci.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Ci.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Ci.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ci.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let l,c;al.subVectors(i,n),ll.subVectors(r,n),Ng.subVectors(e,n);const u=al.dot(Ng),h=ll.dot(Ng);if(u<=0&&h<=0)return t.copy(n);Og.subVectors(e,i);const d=al.dot(Og),p=ll.dot(Og);if(d>=0&&p<=d)return t.copy(i);const m=u*p-d*h;if(m<=0&&u>=0&&d<=0)return l=u/(u-d),t.copy(n).addScaledVector(al,l);Ug.subVectors(e,r);const g=al.dot(Ug),_=ll.dot(Ug);if(_>=0&&g<=_)return t.copy(r);const b=g*h-u*_;if(b<=0&&h>=0&&_<=0)return c=h/(h-_),t.copy(n).addScaledVector(ll,c);const v=d*_-g*p;if(v<=0&&p-d>=0&&g-_>=0)return Hb.subVectors(r,i),c=(p-d)/(p-d+(g-_)),t.copy(i).addScaledVector(Hb,c);const y=1/(v+b+m);return l=b*y,c=m*y,t.copy(n).addScaledVector(al,l).addScaledVector(ll,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Ln{constructor(e=new G(1/0,1/0,1/0),t=new G(-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(gs.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(gs.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=gs.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 r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let l=0,c=r.count;l<c;l++)e.isMesh===!0?e.getVertexPosition(l,gs):gs.fromBufferAttribute(r,l),gs.applyMatrix4(e.matrixWorld),this.expandByPoint(gs);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Jh.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Jh.copy(n.boundingBox)),Jh.applyMatrix4(e.matrixWorld),this.union(Jh)}const i=e.children;for(let r=0,l=i.length;r<l;r++)this.expandByObject(i[r],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,gs),gs.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(kc),Yh.subVectors(this.max,kc),cl.subVectors(e.a,kc),ul.subVectors(e.b,kc),hl.subVectors(e.c,kc),Xr.subVectors(ul,cl),Jr.subVectors(hl,ul),Oo.subVectors(cl,hl);let t=[0,-Xr.z,Xr.y,0,-Jr.z,Jr.y,0,-Oo.z,Oo.y,Xr.z,0,-Xr.x,Jr.z,0,-Jr.x,Oo.z,0,-Oo.x,-Xr.y,Xr.x,0,-Jr.y,Jr.x,0,-Oo.y,Oo.x,0];return!zg(t,cl,ul,hl,Yh)||(t=[1,0,0,0,1,0,0,0,1],!zg(t,cl,ul,hl,Yh))?!1:(Kh.crossVectors(Xr,Jr),t=[Kh.x,Kh.y,Kh.z],zg(t,cl,ul,hl,Yh))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,gs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(gs).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:(mr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mr),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 mr=[new G,new G,new G,new G,new G,new G,new G,new G],gs=new G,Jh=new Ln,cl=new G,ul=new G,hl=new G,Xr=new G,Jr=new G,Oo=new G,kc=new G,Yh=new G,Kh=new G,Uo=new G;function zg(s,e,t,n,i){for(let r=0,l=s.length-3;r<=l;r+=3){Uo.fromArray(s,r);const c=i.x*Math.abs(Uo.x)+i.y*Math.abs(Uo.y)+i.z*Math.abs(Uo.z),u=e.dot(Uo),h=t.dot(Uo),d=n.dot(Uo);if(Math.max(-Math.max(u,h,d),Math.min(u,h,d))>c)return!1}return!0}const br=FI();function FI(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const r=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,d=0;for(;(h&8388608)===0;)h<<=1,d-=8388608;h&=-8388609,d+=947912704,r[u]=h|d}for(let u=1024;u<2048;++u)r[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)l[u]=u<<23;l[31]=1199570944,l[32]=2147483648;for(let u=33;u<63;++u)l[u]=2147483648+(u-32<<23);l[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:l,offsetTable:c}}function Ti(s){Math.abs(s)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),s=gt(s,-65504,65504),br.floatView[0]=s;const e=br.uint32View[0],t=e>>23&511;return br.baseTable[t]+((e&8388607)>>br.shiftTable[t])}function uu(s){const e=s>>10;return br.uint32View[0]=br.mantissaTable[br.offsetTable[e]+(s&1023)]+br.exponentTable[e],br.floatView[0]}class NI{static toHalfFloat(e){return Ti(e)}static fromHalfFloat(e){return uu(e)}}const Pn=new G,qh=new xe;let OI=0;class Ut extends Ss{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:OI++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Du,this.updateRanges=[],this.gpuType=oi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)qh.fromBufferAttribute(this,t),qh.applyMatrix3(e),this.setXY(t,qh.x,qh.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Pn.fromBufferAttribute(this,t),Pn.applyMatrix3(e),this.setXYZ(t,Pn.x,Pn.y,Pn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Pn.fromBufferAttribute(this,t),Pn.applyMatrix4(e),this.setXYZ(t,Pn.x,Pn.y,Pn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Pn.fromBufferAttribute(this,t),Pn.applyNormalMatrix(e),this.setXYZ(t,Pn.x,Pn.y,Pn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Pn.fromBufferAttribute(this,t),Pn.transformDirection(e),this.setXYZ(t,Pn.x,Pn.y,Pn.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=gi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=wt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=gi(t,this.array)),t}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=gi(t,this.array)),t}setY(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=gi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=gi(t,this.array)),t}setW(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array),r=wt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Du&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class UI extends Ut{constructor(e,t,n){super(new Int8Array(e),t,n)}}class GI extends Ut{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class kI extends Ut{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class HI extends Ut{constructor(e,t,n){super(new Int16Array(e),t,n)}}class h_ extends Ut{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class zI extends Ut{constructor(e,t,n){super(new Int32Array(e),t,n)}}class f_ extends Ut{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class VI extends Ut{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=uu(this.array[e*this.itemSize]);return this.normalized&&(t=gi(t,this.array)),t}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize]=Ti(t),this}getY(e){let t=uu(this.array[e*this.itemSize+1]);return this.normalized&&(t=gi(t,this.array)),t}setY(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+1]=Ti(t),this}getZ(e){let t=uu(this.array[e*this.itemSize+2]);return this.normalized&&(t=gi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+2]=Ti(t),this}getW(e){let t=uu(this.array[e*this.itemSize+3]);return this.normalized&&(t=gi(t,this.array)),t}setW(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+3]=Ti(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.array[e+0]=Ti(t),this.array[e+1]=Ti(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array)),this.array[e+0]=Ti(t),this.array[e+1]=Ti(n),this.array[e+2]=Ti(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array),r=wt(r,this.array)),this.array[e+0]=Ti(t),this.array[e+1]=Ti(n),this.array[e+2]=Ti(i),this.array[e+3]=Ti(r),this}}class tt extends Ut{constructor(e,t,n){super(new Float32Array(e),t,n)}}const WI=new Ln,Hc=new G,Vg=new G;class Dn{constructor(e=new G,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):WI.setFromPoints(e).getCenter(n);let i=0;for(let r=0,l=e.length;r<l;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){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;Hc.subVectors(e,this.center);const t=Hc.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Hc,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Hc.copy(e.center).add(Vg)),this.expandByPoint(Hc.copy(e.center).sub(Vg))),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 jI=0;const $i=new ft,Wg=new zt,fl=new G,zi=new Ln,zc=new Ln,Vn=new G;class mt extends Ss{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jI++}),this.uuid=Xi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(tI(e)?f_:h_)(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 r=new vt().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return $i.makeRotationFromQuaternion(e),this.applyMatrix4($i),this}rotateX(e){return $i.makeRotationX(e),this.applyMatrix4($i),this}rotateY(e){return $i.makeRotationY(e),this.applyMatrix4($i),this}rotateZ(e){return $i.makeRotationZ(e),this.applyMatrix4($i),this}translate(e,t,n){return $i.makeTranslation(e,t,n),this.applyMatrix4($i),this}scale(e,t,n){return $i.makeScale(e,t,n),this.applyMatrix4($i),this}lookAt(e){return Wg.lookAt(e),Wg.updateMatrix(),this.applyMatrix4(Wg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(fl).negate(),this.translate(fl.x,fl.y,fl.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,r=e.length;i<r;i++){const l=e[i];n.push(l.x,l.y,l.z||0)}this.setAttribute("position",new tt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&ke("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 Ln);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){at("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new G(-1/0,-1/0,-1/0),new G(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];zi.setFromBufferAttribute(r),this.morphTargetsRelative?(Vn.addVectors(this.boundingBox.min,zi.min),this.boundingBox.expandByPoint(Vn),Vn.addVectors(this.boundingBox.max,zi.max),this.boundingBox.expandByPoint(Vn)):(this.boundingBox.expandByPoint(zi.min),this.boundingBox.expandByPoint(zi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&at('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 Dn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){at("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new G,1/0);return}if(e){const n=this.boundingSphere.center;if(zi.setFromBufferAttribute(e),t)for(let r=0,l=t.length;r<l;r++){const c=t[r];zc.setFromBufferAttribute(c),this.morphTargetsRelative?(Vn.addVectors(zi.min,zc.min),zi.expandByPoint(Vn),Vn.addVectors(zi.max,zc.max),zi.expandByPoint(Vn)):(zi.expandByPoint(zc.min),zi.expandByPoint(zc.max))}zi.getCenter(n);let i=0;for(let r=0,l=e.count;r<l;r++)Vn.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Vn));if(t)for(let r=0,l=t.length;r<l;r++){const c=t[r],u=this.morphTargetsRelative;for(let h=0,d=c.count;h<d;h++)Vn.fromBufferAttribute(c,h),u&&(fl.fromBufferAttribute(e,h),Vn.add(fl)),i=Math.max(i,n.distanceToSquared(Vn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&at('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){at("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ut(new Float32Array(4*n.count),4));const l=this.getAttribute("tangent"),c=[],u=[];for(let w=0;w<n.count;w++)c[w]=new G,u[w]=new G;const h=new G,d=new G,p=new G,m=new xe,g=new xe,_=new xe,b=new G,v=new G;function y(w,I,O){h.fromBufferAttribute(n,w),d.fromBufferAttribute(n,I),p.fromBufferAttribute(n,O),m.fromBufferAttribute(r,w),g.fromBufferAttribute(r,I),_.fromBufferAttribute(r,O),d.sub(h),p.sub(h),g.sub(m),_.sub(m);const D=1/(g.x*_.y-_.x*g.y);isFinite(D)&&(b.copy(d).multiplyScalar(_.y).addScaledVector(p,-g.y).multiplyScalar(D),v.copy(p).multiplyScalar(g.x).addScaledVector(d,-_.x).multiplyScalar(D),c[w].add(b),c[I].add(b),c[O].add(b),u[w].add(v),u[I].add(v),u[O].add(v))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let w=0,I=A.length;w<I;++w){const O=A[w],D=O.start,z=O.count;for(let X=D,Y=D+z;X<Y;X+=3)y(e.getX(X+0),e.getX(X+1),e.getX(X+2))}const S=new G,T=new G,B=new G,R=new G;function L(w){B.fromBufferAttribute(i,w),R.copy(B);const I=c[w];S.copy(I),S.sub(B.multiplyScalar(B.dot(I))).normalize(),T.crossVectors(R,I);const D=T.dot(u[w])<0?-1:1;l.setXYZW(w,S.x,S.y,S.z,D)}for(let w=0,I=A.length;w<I;++w){const O=A[w],D=O.start,z=O.count;for(let X=D,Y=D+z;X<Y;X+=3)L(e.getX(X+0)),L(e.getX(X+1)),L(e.getX(X+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ut(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,g=n.count;m<g;m++)n.setXYZ(m,0,0,0);const i=new G,r=new G,l=new G,c=new G,u=new G,h=new G,d=new G,p=new G;if(e)for(let m=0,g=e.count;m<g;m+=3){const _=e.getX(m+0),b=e.getX(m+1),v=e.getX(m+2);i.fromBufferAttribute(t,_),r.fromBufferAttribute(t,b),l.fromBufferAttribute(t,v),d.subVectors(l,r),p.subVectors(i,r),d.cross(p),c.fromBufferAttribute(n,_),u.fromBufferAttribute(n,b),h.fromBufferAttribute(n,v),c.add(d),u.add(d),h.add(d),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(b,u.x,u.y,u.z),n.setXYZ(v,h.x,h.y,h.z)}else for(let m=0,g=t.count;m<g;m+=3)i.fromBufferAttribute(t,m+0),r.fromBufferAttribute(t,m+1),l.fromBufferAttribute(t,m+2),d.subVectors(l,r),p.subVectors(i,r),d.cross(p),n.setXYZ(m+0,d.x,d.y,d.z),n.setXYZ(m+1,d.x,d.y,d.z),n.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Vn.fromBufferAttribute(e,t),Vn.normalize(),e.setXYZ(t,Vn.x,Vn.y,Vn.z)}toNonIndexed(){function e(c,u){const h=c.array,d=c.itemSize,p=c.normalized,m=new h.constructor(u.length*d);let g=0,_=0;for(let b=0,v=u.length;b<v;b++){c.isInterleavedBufferAttribute?g=u[b]*c.data.stride+c.offset:g=u[b]*d;for(let y=0;y<d;y++)m[_++]=h[g++]}return new Ut(m,d,p)}if(this.index===null)return ke("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new mt,n=this.index.array,i=this.attributes;for(const c in i){const u=i[c],h=e(u,n);t.setAttribute(c,h)}const r=this.morphAttributes;for(const c in r){const u=[],h=r[c];for(let d=0,p=h.length;d<p;d++){const m=h[d],g=e(m,n);u.push(g)}t.morphAttributes[c]=u}t.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let c=0,u=l.length;c<u;c++){const h=l[c];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);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 u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let r=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],d=[];for(let p=0,m=h.length;p<m;p++){const g=h[p];d.push(g.toJSON(e.data))}d.length>0&&(i[u]=d,r=!0)}r&&(e.data.morphAttributes=i,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 i=e.attributes;for(const h in i){const d=i[h];this.setAttribute(h,d.clone(t))}const r=e.morphAttributes;for(const h in r){const d=[],p=r[h];for(let m=0,g=p.length;m<g;m++)d.push(p[m].clone(t));this.morphAttributes[h]=d}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let h=0,d=l.length;h<d;h++){const p=l[h];this.addGroup(p.start,p.count,p.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Xu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Du,this.updateRanges=[],this.version=0,this.uuid=Xi()}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 i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Xi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Xi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const fi=new G;class wi{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}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++)fi.fromBufferAttribute(this,t),fi.applyMatrix4(e),this.setXYZ(t,fi.x,fi.y,fi.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fi.fromBufferAttribute(this,t),fi.applyNormalMatrix(e),this.setXYZ(t,fi.x,fi.y,fi.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fi.fromBufferAttribute(this,t),fi.transformDirection(e),this.setXYZ(t,fi.x,fi.y,fi.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=gi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=wt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=wt(t,this.array)),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=gi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=gi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=gi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=gi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array),r=wt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){Nu("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Ut(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 wi(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Nu("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}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}}}let XI=0;class On extends Ss{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:XI++}),this.uuid=Xi(),this.name="",this.type="Material",this.blending=ha,this.side=Zs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Td,this.blendDst=Cd,this.blendEquation=ao,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new we(0,0,0),this.blendAlpha=0,this.depthFunc=ga,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$o,this.stencilZFail=$o,this.stencilZPass=$o,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){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ha&&(n.blending=this.blending),this.side!==Zs&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Td&&(n.blendSrc=this.blendSrc),this.blendDst!==Cd&&(n.blendDst=this.blendDst),this.blendEquation!==ao&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ga&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vx&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==$o&&(n.stencilFail=this.stencilFail),this.stencilZFail!==$o&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==$o&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const l=[];for(const c in r){const u=r[c];delete u.metadata,l.push(u)}return l}if(t){const r=i(e.textures),l=i(e.images);r.length>0&&(n.textures=r),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.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 d_ extends On{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new we(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 dl;const Vc=new G,pl=new G,ml=new G,gl=new xe,Wc=new xe,a1=new ft,Zh=new G,jc=new G,Qh=new G,zb=new xe,jg=new xe,Vb=new xe;class l1 extends zt{constructor(e=new d_){if(super(),this.isSprite=!0,this.type="Sprite",dl===void 0){dl=new mt;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 Xu(t,5);dl.setIndex([0,1,2,0,2,3]),dl.setAttribute("position",new wi(n,3,0,!1)),dl.setAttribute("uv",new wi(n,2,3,!1))}this.geometry=dl,this.material=e,this.center=new xe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&at('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),pl.setFromMatrixScale(this.matrixWorld),a1.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ml.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&pl.multiplyScalar(-ml.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const l=this.center;$h(Zh.set(-.5,-.5,0),ml,l,pl,i,r),$h(jc.set(.5,-.5,0),ml,l,pl,i,r),$h(Qh.set(.5,.5,0),ml,l,pl,i,r),zb.set(0,0),jg.set(1,0),Vb.set(1,1);let c=e.ray.intersectTriangle(Zh,jc,Qh,!1,Vc);if(c===null&&($h(jc.set(-.5,.5,0),ml,l,pl,i,r),jg.set(0,1),c=e.ray.intersectTriangle(Zh,Qh,jc,!1,Vc),c===null))return;const u=e.ray.origin.distanceTo(Vc);u<e.near||u>e.far||t.push({distance:u,point:Vc.clone(),uv:Ci.getInterpolation(Vc,Zh,jc,Qh,zb,jg,Vb,new xe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function $h(s,e,t,n,i,r){gl.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Wc.x=r*gl.x-i*gl.y,Wc.y=i*gl.x+r*gl.y):Wc.copy(gl),s.copy(e),s.x+=Wc.x,s.y+=Wc.y,s.applyMatrix4(a1)}const ef=new G,Wb=new G;class c1 extends zt{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,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,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 i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){ef.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(ef);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ef.setFromMatrixPosition(e.matrixWorld),Wb.setFromMatrixPosition(this.matrixWorld);const n=ef.distanceTo(Wb)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let l=t[i].distance;if(t[i].object.visible&&(l-=l*t[i].hysteresis),n>=l)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const l=n[i];t.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return t}}const gr=new G,Xg=new G,tf=new G,Yr=new G,Jg=new G,nf=new G,Yg=new G;class lc{constructor(e=new G,t=new G(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,gr)),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=gr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(gr.copy(this.origin).addScaledVector(this.direction,t),gr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Xg.copy(e).add(t).multiplyScalar(.5),tf.copy(t).sub(e).normalize(),Yr.copy(this.origin).sub(Xg);const r=e.distanceTo(t)*.5,l=-this.direction.dot(tf),c=Yr.dot(this.direction),u=-Yr.dot(tf),h=Yr.lengthSq(),d=Math.abs(1-l*l);let p,m,g,_;if(d>0)if(p=l*u-c,m=l*c-u,_=r*d,p>=0)if(m>=-_)if(m<=_){const b=1/d;p*=b,m*=b,g=p*(p+l*m+2*c)+m*(l*p+m+2*u)+h}else m=r,p=Math.max(0,-(l*m+c)),g=-p*p+m*(m+2*u)+h;else m=-r,p=Math.max(0,-(l*m+c)),g=-p*p+m*(m+2*u)+h;else m<=-_?(p=Math.max(0,-(-l*r+c)),m=p>0?-r:Math.min(Math.max(-r,-u),r),g=-p*p+m*(m+2*u)+h):m<=_?(p=0,m=Math.min(Math.max(-r,-u),r),g=m*(m+2*u)+h):(p=Math.max(0,-(l*r+c)),m=p>0?r:Math.min(Math.max(-r,-u),r),g=-p*p+m*(m+2*u)+h);else m=l>0?-r:r,p=Math.max(0,-(l*m+c)),g=-p*p+m*(m+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,p),i&&i.copy(Xg).addScaledVector(tf,m),g}intersectSphere(e,t){gr.subVectors(e.center,this.origin);const n=gr.dot(this.direction),i=gr.dot(gr)-n*n,r=e.radius*e.radius;if(i>r)return null;const l=Math.sqrt(r-i),c=n-l,u=n+l;return u<0?null:c<0?this.at(u,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,i,r,l,c,u;const h=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,m=this.origin;return h>=0?(n=(e.min.x-m.x)*h,i=(e.max.x-m.x)*h):(n=(e.max.x-m.x)*h,i=(e.min.x-m.x)*h),d>=0?(r=(e.min.y-m.y)*d,l=(e.max.y-m.y)*d):(r=(e.max.y-m.y)*d,l=(e.min.y-m.y)*d),n>l||r>i||((r>n||isNaN(n))&&(n=r),(l<i||isNaN(i))&&(i=l),p>=0?(c=(e.min.z-m.z)*p,u=(e.max.z-m.z)*p):(c=(e.max.z-m.z)*p,u=(e.min.z-m.z)*p),n>u||c>i)||((c>n||n!==n)&&(n=c),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,gr)!==null}intersectTriangle(e,t,n,i,r){Jg.subVectors(t,e),nf.subVectors(n,e),Yg.crossVectors(Jg,nf);let l=this.direction.dot(Yg),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;Yr.subVectors(this.origin,e);const u=c*this.direction.dot(nf.crossVectors(Yr,nf));if(u<0)return null;const h=c*this.direction.dot(Jg.cross(Yr));if(h<0||u+h>l)return null;const d=-c*Yr.dot(Yg);return d<0?null:this.at(d/l,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ji extends On{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new we(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 As,this.combine=Wu,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 jb=new ft,Go=new lc,sf=new Dn,Xb=new G,rf=new G,of=new G,af=new G,Kg=new G,lf=new G,Jb=new G,cf=new G;class An extends zt{constructor(e=new mt,t=new ji){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=i.length;r<l;r++){const c=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,l=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const c=this.morphTargetInfluences;if(r&&c){lf.set(0,0,0);for(let u=0,h=r.length;u<h;u++){const d=c[u],p=r[u];d!==0&&(Kg.fromBufferAttribute(p,e),l?lf.addScaledVector(Kg,d):lf.addScaledVector(Kg.sub(t),d))}t.add(lf)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),sf.copy(n.boundingSphere),sf.applyMatrix4(r),Go.copy(e.ray).recast(e.near),!(sf.containsPoint(Go.origin)===!1&&(Go.intersectSphere(sf,Xb)===null||Go.origin.distanceToSquared(Xb)>(e.far-e.near)**2))&&(jb.copy(r).invert(),Go.copy(e.ray).applyMatrix4(jb),!(n.boundingBox!==null&&Go.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Go)))}_computeIntersections(e,t,n){let i;const r=this.geometry,l=this.material,c=r.index,u=r.attributes.position,h=r.attributes.uv,d=r.attributes.uv1,p=r.attributes.normal,m=r.groups,g=r.drawRange;if(c!==null)if(Array.isArray(l))for(let _=0,b=m.length;_<b;_++){const v=m[_],y=l[v.materialIndex],A=Math.max(v.start,g.start),S=Math.min(c.count,Math.min(v.start+v.count,g.start+g.count));for(let T=A,B=S;T<B;T+=3){const R=c.getX(T),L=c.getX(T+1),w=c.getX(T+2);i=uf(this,y,e,n,h,d,p,R,L,w),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const _=Math.max(0,g.start),b=Math.min(c.count,g.start+g.count);for(let v=_,y=b;v<y;v+=3){const A=c.getX(v),S=c.getX(v+1),T=c.getX(v+2);i=uf(this,l,e,n,h,d,p,A,S,T),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(l))for(let _=0,b=m.length;_<b;_++){const v=m[_],y=l[v.materialIndex],A=Math.max(v.start,g.start),S=Math.min(u.count,Math.min(v.start+v.count,g.start+g.count));for(let T=A,B=S;T<B;T+=3){const R=T,L=T+1,w=T+2;i=uf(this,y,e,n,h,d,p,R,L,w),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const _=Math.max(0,g.start),b=Math.min(u.count,g.start+g.count);for(let v=_,y=b;v<y;v+=3){const A=v,S=v+1,T=v+2;i=uf(this,l,e,n,h,d,p,A,S,T),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}}}function JI(s,e,t,n,i,r,l,c){let u;if(e.side===_i?u=n.intersectTriangle(l,r,i,!0,c):u=n.intersectTriangle(i,r,l,e.side===Zs,c),u===null)return null;cf.copy(c),cf.applyMatrix4(s.matrixWorld);const h=t.ray.origin.distanceTo(cf);return h<t.near||h>t.far?null:{distance:h,point:cf.clone(),object:s}}function uf(s,e,t,n,i,r,l,c,u,h){s.getVertexPosition(c,rf),s.getVertexPosition(u,of),s.getVertexPosition(h,af);const d=JI(s,e,t,n,rf,of,af,Jb);if(d){const p=new G;Ci.getBarycoord(Jb,rf,of,af,p),i&&(d.uv=Ci.getInterpolatedAttribute(i,c,u,h,p,new xe)),r&&(d.uv1=Ci.getInterpolatedAttribute(r,c,u,h,p,new xe)),l&&(d.normal=Ci.getInterpolatedAttribute(l,c,u,h,p,new G),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const m={a:c,b:u,c:h,normal:new G,materialIndex:0};Ci.getNormal(rf,of,af,m.normal),d.face=m,d.barycoord=p}return d}const Xc=new Ht,Yb=new Ht,Kb=new Ht,YI=new Ht,qb=new ft,hf=new G,qg=new Dn,Zb=new ft,Zg=new lc;class p_ extends An{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=_x,this.bindMatrix=new ft,this.bindMatrixInverse=new ft,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ln),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,hf),this.boundingBox.expandByPoint(hf)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,hf),this.boundingSphere.expandByPoint(hf)}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,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),qg.copy(this.boundingSphere),qg.applyMatrix4(i),e.ray.intersectsSphere(qg)!==!1&&(Zb.copy(i).invert(),Zg.copy(e.ray).applyMatrix4(Zb),!(this.boundingBox!==null&&Zg.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Zg)))}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 Ht,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===_x?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===VE?this.bindMatrixInverse.copy(this.bindMatrix).invert():ke("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Yb.fromBufferAttribute(i.attributes.skinIndex,e),Kb.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4?(Xc.copy(t),t.set(0,0,0,0)):(Xc.set(...t,1),t.set(0,0,0)),Xc.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){const l=Kb.getComponent(r);if(l!==0){const c=Yb.getComponent(r);qb.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(YI.copy(Xc).applyMatrix4(qb),l)}}return t.isVector4&&(t.w=Xc.w),t.applyMatrix4(this.bindMatrixInverse)}}class zp extends zt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class vs extends fn{constructor(e=null,t=1,n=1,i,r,l,c,u,h=bn,d=bn,p,m){super(null,l,c,u,h,d,i,r,p,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Qb=new ft,KI=new ft;class Ju{constructor(e=[],t=[]){this.uuid=Xi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=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){ke("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ft)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new ft;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,i=this.boneTexture;for(let r=0,l=e.length;r<l;r++){const c=e[r]?e[r].matrixWorld:KI;Qb.multiplyMatrices(c,t[r]),Qb.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Ju(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 vs(t,e,e,ai,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 i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let l=t[r];l===void 0&&(ke("Skeleton: No bone found with UUID:",r),l=new zp),this.bones.push(l),this.boneInverses.push(new ft().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 i=0,r=t.length;i<r;i++){const l=t[i];e.bones.push(l.uuid);const c=n[i];e.boneInverses.push(c.toArray())}return e}}class _a extends Ut{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}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 xl=new ft,$b=new ft,ff=[],eA=new Ln,qI=new ft,Jc=new An,Yc=new Dn;class m_ extends An{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new _a(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,qI)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ln),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,xl),eA.copy(e.boundingBox).applyMatrix4(xl),this.boundingBox.union(eA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Dn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,xl),Yc.copy(e.boundingSphere).applyMatrix4(xl),this.boundingSphere.union(Yc)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),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,i=this.morphTexture.source.data.data,r=n.length+1,l=e*r+1;for(let c=0;c<n.length;c++)n[c]=i[l+c]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Jc.geometry=this.geometry,Jc.material=this.material,Jc.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Yc.copy(this.boundingSphere),Yc.applyMatrix4(n),e.ray.intersectsSphere(Yc)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,xl),$b.multiplyMatrices(n,xl),Jc.matrixWorld=$b,Jc.raycast(e,ff);for(let l=0,c=ff.length;l<c;l++){const u=ff[l];u.instanceId=r,u.object=this,t.push(u)}ff.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new _a(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,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new vs(new Float32Array(i*this.count),i,this.count,Pp,oi));const r=this.morphTexture.source.data.data;let l=0;for(let h=0;h<n.length;h++)l+=n[h];const c=this.geometry.morphTargetsRelative?1:1-l,u=i*e;return r[u]=c,r.set(n,u+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Qg=new G,ZI=new G,QI=new vt;class oo{constructor(e=new G(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Qg.subVectors(n,t).cross(ZI.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const i=e.delta(Qg),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const l=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(l<0||l>1)?null:t.copy(e.start).addScaledVector(i,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||QI.getNormalMatrix(e),i=this.coplanarPoint(Qg).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ko=new Dn,$I=new xe(.5,.5),df=new G;class cc{constructor(e=new oo,t=new oo,n=new oo,i=new oo,r=new oo,l=new oo){this.planes=[e,t,n,i,r,l]}set(e,t,n,i,r,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(r),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=Wi,n=!1){const i=this.planes,r=e.elements,l=r[0],c=r[1],u=r[2],h=r[3],d=r[4],p=r[5],m=r[6],g=r[7],_=r[8],b=r[9],v=r[10],y=r[11],A=r[12],S=r[13],T=r[14],B=r[15];if(i[0].setComponents(h-l,g-d,y-_,B-A).normalize(),i[1].setComponents(h+l,g+d,y+_,B+A).normalize(),i[2].setComponents(h+c,g+p,y+b,B+S).normalize(),i[3].setComponents(h-c,g-p,y-b,B-S).normalize(),n)i[4].setComponents(u,m,v,T).normalize(),i[5].setComponents(h-u,g-m,y-v,B-T).normalize();else if(i[4].setComponents(h-u,g-m,y-v,B-T).normalize(),t===Wi)i[5].setComponents(h+u,g+m,y+v,B+T).normalize();else if(t===xa)i[5].setComponents(u,m,v,T).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(),ko.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ko.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ko)}intersectsSprite(e){ko.center.set(0,0,0);const t=$I.distanceTo(e.center);return ko.radius=.7071067811865476+t,ko.applyMatrix4(e.matrixWorld),this.intersectsSphere(ko)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(df.x=i.normal.x>0?e.max.x:e.min.x,df.y=i.normal.y>0?e.max.y:e.min.y,df.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(df)<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 Ns=new ft,Os=new cc;class Vp{constructor(){this.coordinateSystem=Wi}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ns.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Os.setFromProjectionMatrix(Ns,i.coordinateSystem,i.reversedDepth),Os.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ns.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Os.setFromProjectionMatrix(Ns,i.coordinateSystem,i.reversedDepth),Os.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ns.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Os.setFromProjectionMatrix(Ns,i.coordinateSystem,i.reversedDepth),Os.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ns.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Os.setFromProjectionMatrix(Ns,i.coordinateSystem,i.reversedDepth),Os.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ns.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Os.setFromProjectionMatrix(Ns,i.coordinateSystem,i.reversedDepth),Os.containsPoint(e))return!0}return!1}clone(){return new Vp}}function $g(s,e){return s-e}function eB(s,e){return s.z-e.z}function tB(s,e){return e.z-s.z}class nB{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,l=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const c=r[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const Ei=new ft,iB=new we(1,1,1),tA=new cc,sB=new Vp,pf=new Ln,Ho=new Dn,Kc=new G,nA=new G,rB=new G,e0=new nB,si=new An,mf=[];function oB(s,e,t=0){const n=e.itemSize;
7if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let l=0;l<n;l++)e.setComponent(r+t,l,s.getComponent(r,l))}else e.array.set(s.array,t*n);e.needsUpdate=!0}function zo(s,e){if(s.constructor!==e.constructor){const t=Math.min(s.length,e.length);for(let n=0;n<t;n++)e[n]=s[n]}else{const t=Math.min(s.length,e.length);e.set(new s.constructor(s.buffer,0,t))}}class u1 extends An{constructor(e,t,n=t*2,i){super(new mt,i),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._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=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 vs(t,e,e,ai,oi);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new vs(t,e,e,ju,is);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 vs(t,e,e,ai,oi);
7n.colorSpace=It.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const l=e.getAttribute(r),{array:c,itemSize:u,normalized:h}=l,d=new c.constructor(n*u),p=new Ut(d,u,h);t.setAttribute(r,p)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Ut(r,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 i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and 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 Ln);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Ei),this.getBoundingBoxAt(r,pf).applyMatrix4(Ei),e.union(pf)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Ei),this.getBoundingSphereAt(r,Ho).applyMatrix4(Ei),e.union(Ho)}}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 i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort($g),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const r=this._matricesTexture;Ei.identity().toArray(r.image.data,i*16),r.needsUpdate=!0;const l=this._colorsTexture;return l&&(iB.toArray(l.image.data,i*4),l.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?l.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort($g),u=this._availableGeometryIds.shift(),r[u]=i):(u=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(u,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(i&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=c.vertexStart,h=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const d in n.attributes){const p=t.getAttribute(d),m=n.getAttribute(d);oB(p,m,u);const g=p.itemSize;
7for(let _=p.count,b=h;_<b;_++){const v=u+_;for(let y=0;y<g;y++)m.setComponent(v,y,0)}m.needsUpdate=!0,m.addUpdateRange(u*g,h*g)}if(i){const d=c.indexStart,p=c.reservedIndexCount;c.indexCount=t.getIndex().count;for(let m=0;m<l.count;m++)r.setX(d+m,u+l.getX(m));for(let m=l.count,g=p;m<g;m++)r.setX(d+m,u);r.needsUpdate=!0,r.addUpdateRange(d,c.reservedIndexCount)}return c.start=i?c.indexStart:c.vertexStart,c.count=i?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 i=0,r=n.length;i<r;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);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,i=n.map((l,c)=>c).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),r=this.geometry;for(let l=0,c=n.length;l<c;l++){const u=i[l],h=n[u];if(h.active!==!1){if(r.index!==null){if(h.indexStart!==t){const{indexStart:d,vertexStart:p,reservedIndexCount:m}=h,g=r.index,_=g.array,b=e-p;for(let v=d;v<d+m;v++)_[v]=_[v]+b;g.array.copyWithin(t,d,d+m),g.addUpdateRange(t,m),g.needsUpdate=!0,h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:d,reservedVertexCount:p}=h,m=r.attributes;for(const g in m){const _=m[g],{array:b,itemSize:v}=_;b.copyWithin(e*v,d*v,(d+p)*v),_.addUpdateRange(e*v,p*v),_.needsUpdate=!0}h.vertexStart=e}e+=h.reservedVertexCount,h.start=r.index?h.indexStart:h.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,i=this._geometryInfo[e];if(i.boundingBox===null){const r=new Ln,l=n.index,c=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let d=u;l&&(d=l.getX(d)),r.expandByPoint(Kc.fromBufferAttribute(c,d))}i.boundingBox=r}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const r=new Dn;this.getBoundingBoxAt(e,pf),pf.getCenter(r.center);const l=n.index,c=n.attributes.position;let u=0;for(let h=i.start,d=i.start+i.count;h<d;h++){let p=h;l&&(p=l.getX(p)),Kc.fromBufferAttribute(c,p),u=Math.max(u,r.center.distanceToSquared(Kc))}r.radius=Math.sqrt(u),i.boundingSphere=r}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,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}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($g);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),r=new Int32Array(e);zo(this._multiDrawCounts,i),zo(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const l=this._indirectTexture,c=this._matricesTexture,u=this._colorsTexture;l.dispose(),this._initIndirectTexture(),zo(l.image.data,this._indirectTexture.image.data),c.dispose(),this._initMatricesTexture(),zo(c.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),zo(u.image.data,this._colorsTexture.image.data))}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(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new mt,this._initializeGeometry(r));const l=this.geometry;r.index&&zo(r.index.array,l.index.array);for(const c in r.attributes)zo(r.attributes[c].array,l.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,l=this.geometry;si.material=this.material,si.geometry.index=l.index,si.geometry.attributes=l.attributes,si.geometry.boundingBox===null&&(si.geometry.boundingBox=new Ln),si.geometry.boundingSphere===null&&(si.geometry.boundingSphere=new Dn);for(let c=0,u=n.length;c<u;c++){if(!n[c].visible||!n[c].active)continue;const h=n[c].geometryIndex,d=i[h];si.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(c,si.matrixWorld).premultiply(r),this.getBoundingBoxAt(h,si.geometry.boundingBox),this.getBoundingSphereAt(h,si.geometry.boundingSphere),si.raycast(e,mf);for(let p=0,m=mf.length;p<m;p++){const g=mf[p];g.object=this,g.batchId=c,t.push(g)}mf.length=0}si.material=null,si.geometry.index=null,si.geometry.attributes={},si.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._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(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}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)}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=i.getIndex();let c=l===null?1:l.array.BYTES_PER_ELEMENT,u=1;r.wireframe&&(u=2,c=i.attributes.position.count>65535?4:2);const h=this._instanceInfo,d=this._multiDrawStarts,p=this._multiDrawCounts,m=this._geometryInfo,g=this.perObjectFrustumCulled,_=this._indirectTexture,b=_.image.data,v=n.isArrayCamera?sB:tA;g&&!n.isArrayCamera&&(Ei.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),tA.
7setFromProjectionMatrix(Ei,n.coordinateSystem,n.reversedDepth));let y=0;if(this.sortObjects){Ei.copy(this.matrixWorld).invert(),Kc.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ei),nA.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ei);for(let T=0,B=h.length;T<B;T++)if(h[T].visible&&h[T].active){const R=h[T].geometryIndex;this.getMatrixAt(T,Ei),this.getBoundingSphereAt(R,Ho).applyMatrix4(Ei);let L=!1;if(g&&(L=!v.intersectsSphere(Ho,n)),!L){const w=m[R],I=rB.subVectors(Ho.center,Kc).dot(nA);e0.push(w.start,w.count,I,T)}}const A=e0.list,S=this.customSort;S===null?A.sort(r.transparent?tB:eB):S.call(this,A,n);for(let T=0,B=A.length;T<B;T++){const R=A[T];d[y]=R.start*c*u,p[y]=R.count*u,b[y]=R.index,y++}e0.reset()}else for(let A=0,S=h.length;A<S;A++)if(h[A].visible&&h[A].active){const T=h[A].geometryIndex;let B=!1;if(g&&(this.getMatrixAt(A,Ei),this.getBoundingSphereAt(T,Ho).applyMatrix4(Ei),B=!v.intersectsSphere(Ho,n)),!B){const R=m[T];d[y]=R.start*c*u,p[y]=R.count*u,b[y]=A,y++}}_.needsUpdate=!0,this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,l){this.onBeforeRender(e,null,i,r,l)}}class li extends On{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new we(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 dp=new G,pp=new G,iA=new ft,qc=new lc,gf=new Dn,t0=new G,sA=new G;let Tr=class extends zt{constructor(e=new mt,t=new li){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),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 i=1,r=t.count;i<r;i++)dp.fromBufferAttribute(t,i-1),pp.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=dp.distanceTo(pp);e.setAttribute("lineDistance",new tt(n,1))}else ke("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gf.copy(n.boundingSphere),gf.applyMatrix4(i),gf.radius+=r,e.ray.intersectsSphere(gf)===!1)return;iA.copy(i).invert(),qc.copy(e.ray).applyMatrix4(iA);const c=r/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=this.isLineSegments?2:1,d=n.index,m=n.attributes.position;if(d!==null){const g=Math.max(0,l.start),_=Math.min(d.count,l.start+l.count);for(let b=g,v=_-1;b<v;b+=h){const y=d.getX(b),A=d.getX(b+1),S=xf(this,e,qc,u,y,A,b);S&&t.push(S)}if(this.isLineLoop){const b=d.getX(_-1),v=d.getX(g),y=xf(this,e,qc,u,b,v,_-1);y&&t.push(y)}}else{const g=Math.max(0,l.start),_=Math.min(m.count,l.start+l.count);for(let b=g,v=_-1;b<v;b+=h){const y=xf(this,e,qc,u,b,b+1,b);y&&t.push(y)}if(this.isLineLoop){const b=xf(this,e,qc,u,_-1,g,_-1);b&&t.push(b)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=i.length;r<l;r++){const c=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}};function xf(s,e,t,n,i,r,l){const c=s.geometry.attributes.position;if(dp.fromBufferAttribute(c,i),pp.fromBufferAttribute(c,r),t.distanceSqToSegment(dp,pp,t0,sA)>n)return;t0.applyMatrix4(s.matrixWorld);const h=e.ray.origin.distanceTo(t0);if(!(h<e.near||h>e.far))return{distance:h,point:sA.clone().applyMatrix4(s.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:s}}const rA=new G,oA=new G;class Es 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 i=0,r=t.count;i<r;i+=2)rA.fromBufferAttribute(t,i),oA.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+rA.distanceTo(oA);e.setAttribute("lineDistance",new tt(n,1))}else ke("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class g_ extends Tr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Wp extends On{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new we(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 aA=new ft,Ax=new lc,_f=new Dn,yf=new G;class x_ extends zt{constructor(e=new mt,t=new Wp){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),_f.copy(n.boundingSphere),_f.applyM
7atrix4(i),_f.radius+=r,e.ray.intersectsSphere(_f)===!1)return;aA.copy(i).invert(),Ax.copy(e.ray).applyMatrix4(aA);const c=r/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=n.index,p=n.attributes.position;if(h!==null){const m=Math.max(0,l.start),g=Math.min(h.count,l.start+l.count);for(let _=m,b=g;_<b;_++){const v=h.getX(_);yf.fromBufferAttribute(p,v),lA(yf,v,u,i,e,t,this)}}else{const m=Math.max(0,l.start),g=Math.min(p.count,l.start+l.count);for(let _=m,b=g;_<b;_++)yf.fromBufferAttribute(p,_),lA(yf,_,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=i.length;r<l;r++){const c=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}}function lA(s,e,t,n,i,r,l){const c=Ax.distanceSqToPoint(s);if(c<t){const u=new G;Ax.closestPointToPoint(s,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;r.push({distance:h,distanceToRay:Math.sqrt(c),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class h1 extends fn{constructor(e,t,n,i,r=nn,l=nn,c,u,h){super(e,t,n,i,r,l,c,u,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const d=this;function p(){d.needsUpdate=!0,d._requestVideoFrameCallbackId=e.requestVideoFrameCallback(p)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(p))}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 aB extends h1{constructor(e,t,n,i,r,l,c,u){super({},e,t,n,i,r,l,c,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class lB extends fn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=bn,this.minFilter=bn,this.generateMipmaps=!1,this.needsUpdate=!0}}class jp extends fn{constructor(e,t,n,i,r,l,c,u,h,d,p,m){super(null,l,c,u,h,d,i,r,p,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class cB extends jp{constructor(e,t,n,i,r,l){super(e,t,n,r,l),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=xi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class uB extends jp{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Qs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Yu extends fn{constructor(e=[],t=Qs,n,i,r,l,c,u,h,d){super(e,t,n,i,r,l,c,u,h,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class hB extends fn{constructor(e,t,n,i,r,l,c,u,h){super(e,t,n,i,r,l,c,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class fB extends fn{constructor(e,t,n,i,r,l,c,u,h){super(e,t,n,i,r,l,c,u,h),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const d=e?e.parentNode:null;d!==null&&"requestPaint"in d&&(d.onpaint=()=>{this.needsUpdate=!0},d.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class _o extends fn{constructor(e,t,n=is,i,r,l,c=bn,u=bn,h,d=$s,p=1){if(d!==$s&&d!==co)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:p};super(m,i,r,l,c,u,d,n,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new uo(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class f1 extends _o{constructor(e,t=is,n=Qs,i,r,l=bn,c=bn,u,h=$s){const d={width:e,height:e,depth:1},p=[d,d,d,d,d,d];super(e,e,t,n,i,r,l,c,u,h),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class __ extends fn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ms extends mt{constructor(e=1,t=1,n=1,i=1,r=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:l};const c=this;i=Math.floor(i),r=Math.floor(r),l=Math.floor(l);const u=[],h=[],d=[],p=[];let m=0,g=0;_("z","y","x",-1,-1,n,t,e,l,r,0),_("z","y","x",1,-1,n,t,-e,l,r,1),_("x","z","y",1,1,e,n,t,i,l,2),_("x","z","y",1,-1,e,n,-t,i,l,3),_("x","y","z",1,-1,e,t,n,i,r,4),_("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(u),this.setAttribute("position",new tt(h,3)),this.setAttribute("normal",new tt(d,3)),this.setAttribute("uv",new tt(p,2));function _(b,v,y,A,S,T,B,R,L,w,I){const O=T/L,D=B/w,z=T/2,X=B/2,Y=R/2,V=L+1,H=w+1;let W=0,q=0;const Q=new G;for(let re=0;re<H;re++){const ae=re*D-X;for(let pe=0;pe<V;pe++){const Ue=pe*O-z;Q[b]=Ue*A,Q[v]=ae*S,Q[y]=Y,h.push(Q.x,Q.y,Q.z),Q[b]=0,Q[v]=0,Q[y]=R>0?1:-1,d.push(Q.x,Q.y,Q.z),p.push(pe/L),p.push(1-re/w),W+=1}}for(let re=0;re<w;re++)for(let ae=0;ae<L;ae++){const pe=m+ae+V*re,Ue=m+ae+V*(re+1),Pe=m+(ae+1)+V*(re+1),He=m+(ae+1)+V*re;u.push(pe,Ue,He),u.push(Ue,Pe,He),q+=6}c.addGroup(g,q,I),g+=q,m+=W}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ms(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Xp extends mt{constructor(e=1,t=1,n=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
7s:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const l=[],c=[],u=[],h=[],d=t/2,p=Math.PI/2*e,m=t,g=2*p+m,_=n*2+r,b=i+1,v=new G,y=new G;for(let A=0;A<=_;A++){let S=0,T=0,B=0,R=0;if(A<=n){const I=A/n,O=I*Math.PI/2;T=-d-e*Math.cos(O),B=e*Math.sin(O),R=-e*Math.cos(O),S=I*p}else if(A<=n+r){const I=(A-n)/r;T=-d+I*t,B=e,R=0,S=p+I*m}else{const I=(A-n-r)/n,O=I*Math.PI/2;T=d+e*Math.sin(O),B=e*Math.cos(O),R=e*Math.sin(O),S=p+m+I*p}const L=Math.max(0,Math.min(1,S/g));let w=0;A===0?w=.5/i:A===_&&(w=-.5/i);for(let I=0;I<=i;I++){const O=I/i,D=O*Math.PI*2,z=Math.sin(D),X=Math.cos(D);y.x=-B*X,y.y=T,y.z=B*z,c.push(y.x,y.y,y.z),v.set(-B*X,R,B*z),v.normalize(),u.push(v.x,v.y,v.z),h.push(O+w,L)}if(A>0){const I=(A-1)*b;for(let O=0;O<i;O++){const D=I+O,z=I+O+1,X=A*b+O,Y=A*b+O+1;l.push(D,z,X),l.push(z,Y,X)}}}this.setIndex(l),this.setAttribute("position",new tt(c,3)),this.setAttribute("normal",new tt(u,3)),this.setAttribute("uv",new tt(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xp(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Jp extends mt{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],l=[],c=[],u=[],h=new G,d=new xe;l.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let p=0,m=3;p<=t;p++,m+=3){const g=n+p/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),l.push(h.x,h.y,h.z),c.push(0,0,1),d.x=(l[m]/e+1)/2,d.y=(l[m+1]/e+1)/2,u.push(d.x,d.y)}for(let p=1;p<=t;p++)r.push(p,p+1,0);this.setIndex(r),this.setAttribute("position",new tt(l,3)),this.setAttribute("normal",new tt(c,3)),this.setAttribute("uv",new tt(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jp(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ku extends mt{constructor(e=1,t=1,n=1,i=32,r=1,l=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:l,thetaStart:c,thetaLength:u};const h=this;i=Math.floor(i),r=Math.floor(r);const d=[],p=[],m=[],g=[];let _=0;const b=[],v=n/2;let y=0;A(),l===!1&&(e>0&&S(!0),t>0&&S(!1)),this.setIndex(d),this.setAttribute("position",new tt(p,3)),this.setAttribute("normal",new tt(m,3)),this.setAttribute("uv",new tt(g,2));function A(){const T=new G,B=new G;let R=0;const L=(t-e)/n;for(let w=0;w<=r;w++){const I=[],O=w/r,D=O*(t-e)+e;for(let z=0;z<=i;z++){const X=z/i,Y=X*u+c,V=Math.sin(Y),H=Math.cos(Y);B.x=D*V,B.y=-O*n+v,B.z=D*H,p.push(B.x,B.y,B.z),T.set(V,L,H).normalize(),m.push(T.x,T.y,T.z),g.push(X,1-O),I.push(_++)}b.push(I)}for(let w=0;w<i;w++)for(let I=0;I<r;I++){const O=b[I][w],D=b[I+1][w],z=b[I+1][w+1],X=b[I][w+1];(e>0||I!==0)&&(d.push(O,D,X),R+=3),(t>0||I!==r-1)&&(d.push(D,z,X),R+=3)}h.addGroup(y,R,0),y+=R}function S(T){const B=_,R=new xe,L=new G;let w=0;const I=T===!0?e:t,O=T===!0?1:-1;for(let z=1;z<=i;z++)p.push(0,v*O,0),m.push(0,O,0),g.push(.5,.5),_++;const D=_;for(let z=0;z<=i;z++){const Y=z/i*u+c,V=Math.cos(Y),H=Math.sin(Y);L.x=I*H,L.y=v*O,L.z=I*V,p.push(L.x,L.y,L.z),m.push(0,O,0),R.x=V*.5+.5,R.y=H*.5*O+.5,g.push(R.x,R.y),_++}for(let z=0;z<i;z++){const X=B+z,Y=D+z;T===!0?d.push(Y,Y+1,X):d.push(Y+1,Y,X),w+=3}h.addGroup(y,w,T===!0?1:2),y+=w}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ku(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class qu extends Ku{constructor(e=1,t=1,n=32,i=1,r=!1,l=0,c=Math.PI*2){super(0,e,t,n,i,r,l,c),this.type="C
7oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:l,thetaLength:c}}static fromJSON(e){return new qu(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yo extends mt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],l=[];c(i),h(n),d(),this.setAttribute("position",new tt(r,3)),this.setAttribute("normal",new tt(r.slice(),3)),this.setAttribute("uv",new tt(l,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(A){const S=new G,T=new G,B=new G;for(let R=0;R<t.length;R+=3)g(t[R+0],S),g(t[R+1],T),g(t[R+2],B),u(S,T,B,A)}function u(A,S,T,B){const R=B+1,L=[];for(let w=0;w<=R;w++){L[w]=[];const I=A.clone().lerp(T,w/R),O=S.clone().lerp(T,w/R),D=R-w;for(let z=0;z<=D;z++)z===0&&w===R?L[w][z]=I:L[w][z]=I.clone().lerp(O,z/D)}for(let w=0;w<R;w++)for(let I=0;I<2*(R-w)-1;I++){const O=Math.floor(I/2);I%2===0?(m(L[w][O+1]),m(L[w+1][O]),m(L[w][O])):(m(L[w][O+1]),m(L[w+1][O+1]),m(L[w+1][O]))}}function h(A){const S=new G;for(let T=0;T<r.length;T+=3)S.x=r[T+0],S.y=r[T+1],S.z=r[T+2],S.normalize().multiplyScalar(A),r[T+0]=S.x,r[T+1]=S.y,r[T+2]=S.z}function d(){const A=new G;for(let S=0;S<r.length;S+=3){A.x=r[S+0],A.y=r[S+1],A.z=r[S+2];const T=v(A)/2/Math.PI+.5,B=y(A)/Math.PI+.5;l.push(T,1-B)}_(),p()}function p(){for(let A=0;A<l.length;A+=6){const S=l[A+0],T=l[A+2],B=l[A+4],R=Math.max(S,T,B),L=Math.min(S,T,B);R>.9&&L<.1&&(S<.2&&(l[A+0]+=1),T<.2&&(l[A+2]+=1),B<.2&&(l[A+4]+=1))}}function m(A){r.push(A.x,A.y,A.z)}function g(A,S){const T=A*3;S.x=e[T+0],S.y=e[T+1],S.z=e[T+2]}function _(){const A=new G,S=new G,T=new G,B=new G,R=new xe,L=new xe,w=new xe;for(let I=0,O=0;I<r.length;I+=9,O+=6){A.set(r[I+0],r[I+1],r[I+2]),S.set(r[I+3],r[I+4],r[I+5]),T.set(r[I+6],r[I+7],r[I+8]),R.set(l[O+0],l[O+1]),L.set(l[O+2],l[O+3]),w.set(l[O+4],l[O+5]),B.copy(A).add(S).add(T).divideScalar(3);const D=v(B);b(R,O+0,A,D),b(L,O+2,S,D),b(w,O+4,T,D)}}function b(A,S,T,B){B<0&&A.x===1&&(l[S]=A.x-1),T.x===0&&T.z===0&&(l[S]=B/2/Math.PI+.5)}function v(A){return Math.atan2(A.z,-A.x)}function y(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yo(e.vertices,e.indices,e.radius,e.detail)}}class Yp extends yo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,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,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],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,
vendor: 17,724 bytes, line 7
719,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,l,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Yp(e.radius,e.detail)}}const vf=new G,bf=new G,n0=new G,Af=new Ci;class tc extends mt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(fa*t),l=e.getIndex(),c=e.getAttribute("position"),u=l?l.count:c.count,h=[0,0,0],d=["a","b","c"],p=new Array(3),m={},g=[];for(let _=0;_<u;_+=3){l?(h[0]=l.getX(_),h[1]=l.getX(_+1),h[2]=l.getX(_+2)):(h[0]=_,h[1]=_+1,h[2]=_+2);const{a:b,b:v,c:y}=Af;if(b.fromBufferAttribute(c,h[0]),v.fromBufferAttribute(c,h[1]),y.fromBufferAttribute(c,h[2]),Af.getNormal(n0),p[0]=`${Math.round(b.x*i)},${Math.round(b.y*i)},${Math.round(b.z*i)}`,p[1]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,p[2]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,!(p[0]===p[1]||p[1]===p[2]||p[2]===p[0]))for(let A=0;A<3;A++){const S=(A+1)%3,T=p[A],B=p[S],R=Af[d[A]],L=Af[d[S]],w=`${T}_${B}`,I=`${B}_${T}`;I in m&&m[I]?(n0.dot(m[I].normal)<=r&&(g.push(R.x,R.y,R.z),g.push(L.x,L.y,L.z)),m[I]=null):w in m||(m[w]={index0:h[A],index1:h[S],normal:n0.clone()})}}for(const _ in m)if(m[_]){const{index0:b,index1:v}=m[_];vf.fromBufferAttribute(c,b),bf.fromBufferAttribute(c,v),g.push(vf.x,vf.y,vf.z),g.push(bf.x,bf.y,bf.z)}this.setAttribute("position",new tt(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ts{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ke("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,i=this.getPoint(0),r=0;t.push(0);for(let l=1;l<=e;l++)n=this.getPoint(l/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const r=n.length;let l;t?l=t:l=e*n[r-1];let c=0,u=r-1,h;for(;c<=u;)if(i=Math.floor(c+(u-c)/2),h=n[i]-l,h<0)c=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===l)return i/(r-1);const d=n[i],m=n[i+1]-d,g=(l-d)/m;return(i+g)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const l=this.getPoint(i),c=this.getPoint(r),u=t||(l.isVector2?new xe:new G);return u.copy(c).sub(l).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new G,i=[],r=[],l=[],c=new G,u=new ft;for(let g=0;g<=e;g++){const _=g/e;i[g]=this.getTangentAt(_,new G)}r[0]=new G,l[0]=new G;let h=Number.MAX_VALUE;const d=Math.abs(i[0].x),p=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=h&&(h=d,n.set(1,0,0)),p<=h&&(h=p,n.set(0,1,0)),m<=h&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],c),l[0].crossVectors(i[0],r[0]);for(let g=1;g<=e;g++){if(r[g]=r[g-1].clone(),l[g]=l[g-1].clone(),c.crossVectors(i[g-1],i[g]),c.length()>Number.EPSILON){c.normalize();const _=Math.acos(gt(i[g-1].dot(i[g]),-1,1));r[g].applyMatrix4(u.makeRotationAxis(c,_))}l[g].crossVectors(i[g],r[g])}if(t===!0){let g=Math.acos(gt(r[0].dot(r[e]),-1,1));g/=e,i[0].dot(c.crossVectors(r[0],r[e]))>0&&(g=-g);for(let _=1;_<=e;_++)r[_].applyMatrix4(u.makeRotationAxis(i[_],g*_)),l[_].crossVectors(i[_],r[_])}return{tangents:i,normals:r,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,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}}class Kp extends Ts{constructor(e=0,t=0,n=1,i=1,r=0,l=Math.PI*2,c=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=l,this.aClockwise=c,this.aRotation=u}getPoint(e,t=new xe){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const l=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(l?r=0:r=i),this.aClockwise===!0&&!l&&(r===i?r=-i:r=r-i);const c=this.aStartAngle+e*r;let u=this.aX+this.xRadius*Math.cos(c),h=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const d=Math.cos(this.aRotation),p=Math.sin(this.aRotation),m=u-this.aX,g=h-this.aY;u=m*d-g*p+this.aX,h=m*p+g*d+this.aY}return n.set(u,h)}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 d1 extends Kp{constructor(e,t,n,i,r,l){super(e,t,n,n,i,r,l),this.isArcCurve=!0,this.type="ArcCurve"}}function y_(){let s=0,e=0,t=0,n=0;function i(r,l,c,u){s=r,e=c,t=-3*r+3*l-2*c-u,n=2*r-2*l+c+u}return{initCatmullRom:function(r,l,c,u,h){i(l,c,h*(c-r),h*(u-l))},initNonuniformCatmullRom:function(r,l,c,u,h,d,p){let m=(l-r)/h-(c-r)/(h+d)+(c-l)/d,g=(c-l)/d-(u-l)/(d+p)+(u-c)/p;m*=d,g*=d,i(l,c,m,g)},calc:function(r){const l=r*r,c=l*r;return s+e*r+t*l+n*c}}}const cA=new G,uA=new G,i0=new y_,s0=new y_,r0=new y_;class p1 extends Ts{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new G){const n=t,i=this.points,r=i.length,l=(r-(this.closed?0:1))*e;let c=Math.floor(l),u=l-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/r)+1)*r:u===0&&c===r-1&&(c=r-2,u=1);let h,d;this.closed||c>0?h=i[(c-1)%r]:(uA.subVectors(i[0],i[1]).add(i[0]),h=uA);const p=i[c%r],m=i[(c+1)%r];if(this.closed||c+2<r?d=i[(c+2)%r]:(cA.subVectors(i[r-1],i[r-2]).add(i[r-1]),d=cA),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let _=Math.pow(h.distanceToSquared(p),g),b=Math.pow(p.distanceToSquared(m),g),v=Math.pow(m.distanceToSquared(d),g);b<1e-4&&(b=1),_<1e-4&&(_=b),v<1e-4&&(v=b),i0.initNonuniformCatmullRom(h.x,p.x,m.x,d.x,_,b,v),s0.initNonuniformCatmullRom(h.y,p.y,m.y,d.y,_,b,v),r0.initNonuniformCatmullRom(h.z,p.z,m.z,d.z,_,b,v)}else this.curveType==="catmullrom"&&(i0.initCatmullRom(h.x,p.x,m.x,d.x,this.tension),s0.initCatmullRom(h.y,p.y,m.y,d.y,this.tension),r0.initCatmullRom(h.z,p.z,m.z,d.z,this.tension));return n.set(i0.calc(u),s0.calc(u),r0.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.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 i=this.points[t];e.points.push(i.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 i=e.points[t];this.points.push(new G().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function hA(s,e,t,n,i){const r=(n-e)*.5,l=(i-t)*.5,c=s*s,u=s*c;return(2*t-2*n+r+l)*u+(-3*t+3*n-2*r-l)*c+r*s+t}function dB(s,e){const t=1-s;return t*t*e}function pB(s,e){return 2*(1-s)*s*e}function mB(s,e){return s*s*e}function Tu(s,e,t,n){return dB(s,e)+pB(s,t)+mB(s,n)}function gB(s,e){const t=1-s;return t*t*t*e}function xB(s,e){const t=1-s;return 3*t*t*s*e}function _B(s,e){return 3*(1-s)*s*s*e}function yB(s,e){return s*s*s*e}function Cu(s,e,t,n,i){return gB(s,e)+xB(s,t)+_B(s,n)+yB(s,i)}class v_ extends Ts{constructor(e=new xe,t=new xe,n=new xe,i=new xe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new xe){const n=t,i=this.v0,r=this.v1,l=this.v2,c=this.v3;return n.set(Cu(e,i.x,r.x,l.x,c.x),Cu(e,i.y,r.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 m1 extends Ts{constructor(e=new G,t=new G,n=new G,i=new G){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new G){const n=t,i=this.v0,r=this.v1,l=this.v2,c=this.v3;return n.set(Cu(e,i.x,r.x,l.x,c.x),Cu(e,i.y,r.y,l.y,c.y),Cu(e,i.z,r.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 b_ extends Ts{constructor(e=new xe,t=new xe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new xe){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 xe){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 g1 extends Ts{constructor(e=new G,t=new G){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new G){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 G){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 A_ extends Ts{constructor(e=new xe,t=new xe,n=new xe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new xe){const n=t,i=this.v0,r=this.v1,l=this.v2;return n.set(Tu(e,i.x,r.x,l.x),Tu(e,i.y,r.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 M_ extends Ts{constructor(e=new G,t=new G,n=new G){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new G){const n=t,i=this.v0,r=this.v1,l=this.v2;return n.set(Tu(e,i.x,r.x,l.x),Tu(e,i.y,r.y,l.y),Tu(e,i.z,r.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 S_ extends Ts{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new xe){const n=t,i=this.points,r=(i.length-1)*e,l=Math.floor(r),c=r-l,u=i[l===0?l:l-1],h=i[l],d=i[l>i.length-2?i.length-1:l+1],p=i[l>i.length-3?i.length-1:l+2];return n.set(hA(c,u.x,h.x,d.x,p.x),hA(c,u.y,h.y,d.y,p.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new xe().fromArray(i))}return this}}var mp=Object.freeze({__proto__:null,ArcCurve:d1,CatmullRomCurve3:p1,CubicBezierCurve:v_,CubicBezierCurve3:m1,EllipseCurve:Kp,LineCurve:b_,LineCurve3:g1,QuadraticBezierCurve:A_,QuadraticBezierCurve3:M_,SplineCurve:S_});class x1 extends Ts{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}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 mp[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const l=i[r]-n,c=this.curves[r],u=c.getLength(),h=u===0?0:1-l/u;return c.getPointAt(h,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;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 i=0,r=this.curves;i<r.length;i++){const l=r[i],c=l.isEllipseCurve?e*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?e*l.points.length:e,u=l.getPoints(c);for(let h=0;h<u.length;h++){const d=u[h];n&&n.equals(d)||(t.push(d),n=d)}}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 i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.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 i=e.curves[t];this.curves.push(new mp[i.type]().fromJSON(i))}return this}}class gp extends x1{constructor(e){super(),this.type="Path",this.currentPoint=new xe,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 b_(this.currentPoint.clone(),new xe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new A_(this.currentPoint.clone(),new xe(e,t),new xe(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,l){const c=new v_(this.currentPoint.clone(),new xe(e,t),new xe(n,i),new xe(r,l));return this.curves.push(c),this.currentPoint.set(r,l),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new S_(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+c,t+u,n,i,r,l),this}absarc(e,t,n,i,r,l){return this.absellipse(e,t,n,n,i,r,l),this}ellipse(e,t,n,i,r,l,c,u){const h=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+h,t+d,n,i,r,l,c,u),this}absellipse(e,t,n,i,r,l,c,u){const h=new Kp(e,t,n,i,r,l,c,u);if(this.curves.length>0){const p=h.getPoint(0);p.equals(this.currentPoint)||this.lineTo(p.x,p.y)}this.curves.push(h);const d=h.getPoint(1);return this.currentPoint.copy(d),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 da extends gp{constructor(e){super(e),this.uuid=Xi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;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 i=e.holes[t];this.holes.push(i.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 i=this.holes[t];e.holes.push(i.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 i=e.holes[t];this.holes.push(new gp().fromJSON(i))}return this}}function vB(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=_1(s,0,i,t,!0);const l=[];
vendor: 5,216 bytes, line 7
7if(!r||r.next===r.prev)return l;let c,u,h;if(n&&(r=EB(s,e,r,t)),s.length>80*t){c=s[0],u=s[1];let d=c,p=u;for(let m=t;m<i;m+=t){const g=s[m],_=s[m+1];g<c&&(c=g),_<u&&(u=_),g>d&&(d=g),_>p&&(p=_)}h=Math.max(d-c,p-u),h=h!==0?32767/h:0}return Ou(r,l,t,c,u,h,0),l}function _1(s,e,t,n,i){let r;if(i===NB(s,e,t,n)>0)for(let l=e;l<t;l+=n)r=fA(l/n|0,s[l],s[l+1],r);else for(let l=t-n;l>=e;l-=n)r=fA(l/n|0,s[l],s[l+1],r);return r&&nc(r,r.next)&&(Gu(r),r=r.next),r}function ya(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(nc(t,t.next)||xn(t.prev,t,t.next)===0)){if(Gu(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ou(s,e,t,n,i,r,l){if(!s)return;!l&&r&&IB(s,n,i,r);let c=s;for(;s.prev!==s.next;){const u=s.prev,h=s.next;if(r?AB(s,n,i,r):bB(s)){e.push(u.i,s.i,h.i),Gu(s),s=h.next,c=h.next;continue}if(s=h,s===c){l?l===1?(s=MB(ya(s),e),Ou(s,e,t,n,i,r,2)):l===2&&SB(s,e,t,n,i,r):Ou(ya(s),e,t,n,i,r,1);break}}}function bB(s){const e=s.prev,t=s,n=s.next;if(xn(e,t,n)>=0)return!1;const i=e.x,r=t.x,l=n.x,c=e.y,u=t.y,h=n.y,d=Math.min(i,r,l),p=Math.min(c,u,h),m=Math.max(i,r,l),g=Math.max(c,u,h);let _=n.next;for(;_!==e;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&hu(i,c,r,u,l,h,_.x,_.y)&&xn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function AB(s,e,t,n){const i=s.prev,r=s,l=s.next;if(xn(i,r,l)>=0)return!1;const c=i.x,u=r.x,h=l.x,d=i.y,p=r.y,m=l.y,g=Math.min(c,u,h),_=Math.min(d,p,m),b=Math.max(c,u,h),v=Math.max(d,p,m),y=Mx(g,_,e,t,n),A=Mx(b,v,e,t,n);let S=s.prevZ,T=s.nextZ;for(;S&&S.z>=y&&T&&T.z<=A;){if(S.x>=g&&S.x<=b&&S.y>=_&&S.y<=v&&S!==i&&S!==l&&hu(c,d,u,p,h,m,S.x,S.y)&&xn(S.prev,S,S.next)>=0||(S=S.prevZ,T.x>=g&&T.x<=b&&T.y>=_&&T.y<=v&&T!==i&&T!==l&&hu(c,d,u,p,h,m,T.x,T.y)&&xn(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;S&&S.z>=y;){if(S.x>=g&&S.x<=b&&S.y>=_&&S.y<=v&&S!==i&&S!==l&&hu(c,d,u,p,h,m,S.x,S.y)&&xn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;T&&T.z<=A;){if(T.x>=g&&T.x<=b&&T.y>=_&&T.y<=v&&T!==i&&T!==l&&hu(c,d,u,p,h,m,T.x,T.y)&&xn(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function MB(s,e){let t=s;do{const n=t.prev,i=t.next.next;!nc(n,i)&&v1(n,t,t.next,i)&&Uu(n,i)&&Uu(i,n)&&(e.push(n.i,t.i,i.i),Gu(t),Gu(t.next),t=s=i),t=t.next}while(t!==s);return ya(t)}function SB(s,e,t,n,i,r){let l=s;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&LB(l,c)){let u=b1(l,c);l=ya(l,l.next),u=ya(u,u.next),Ou(l,e,t,n,i,r,0),Ou(u,e,t,n,i,r,0);return}c=c.next}l=l.next}while(l!==s)}function EB(s,e,t,n){const i=[];for(let r=0,l=e.length;r<l;r++){const c=e[r]*n,u=r<l-1?e[r+1]*n:s.length,h=_1(s,c,u,n,!1);h===h.next&&(h.steiner=!0),i.push(PB(h))}i.sort(TB);for(let r=0;r<i.length;r++)t=CB(i[r],t);return t}function TB(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function CB(s,e){const t=wB(s,e);if(!t)return e;const n=b1(t,s);return ya(n,n.next),ya(t,t.next)}function wB(s,e){let t=e;const n=s.x,i=s.y;let r=-1/0,l;if(nc(s,t))return t;do{if(nc(s,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const p=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=n&&p>r&&(r=p,l=t.x<t.next.x?t:t.next,p===n))return l}t=t.next}while(t!==e);if(!l)return null;const c=l,u=l.x,h=l.y;let d=1/0;t=l;do{if(n>=t.x&&t.x>=u&&n!==t.x&&y1(i<h?n:r,i,u,h,i<h?r:n,i,t.x,t.y)){const p=Math.abs(i-t.y)/(n-t.x);Uu(t,s)&&(p<d||p===d&&(t.x>l.x||t.x===l.x&&RB(l,t)))&&(l=t,d=p)}t=t.next}while(t!==c);return l}function RB(s,e){return xn(s.prev,s,e.prev)<0&&xn(e.next,s,s.next)<0}function IB(s,e,t,n){let i=s;do i.z===0&&(i.z=Mx(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,BB(i)}function BB(s){let e,t=1;do{let n=s,i;s=null;let r=null;for(e=0;n;){e++;let l=n,c=0;for(let h=0;h<t&&(c++,l=l.nextZ,!!l);h++);let u=t;for(;c>0||u>0&&l;)c!==0&&(u===0||!l||n.z<=l.z)?(i=n,n=n.nextZ,c--):(i=l,l=l.nextZ,u--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;n=l}r.nextZ=null,t*=2}while(e>1);return s}function Mx(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function PB(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function y1(s,e,t,n,i,r,l,c){return(i-l)*(e-c)>=(s-l)*(r-c)&&(s-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(r-c)>=(i-l)*(n-c)}function hu(s,e,t,n,i,r,l,c){return!(s===l&&e===c)&&y1(s,e,t,n,i,r,l,c)}function LB(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!DB(s,e)&&(Uu(s,e)&&Uu(e,s)&&FB(s,e)&&(xn(s.prev,s,e.prev)||xn(s,e.prev,e))||nc(s,e)&&xn(s.prev,s,s.next)>0&&xn(e.prev,e,e.next)>0)}function xn(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function nc(s,e){return s.x===e.x&&s.y===e.y}function v1(s,e,t,n){const i=Sf(xn(s,e,t)),r=Sf(xn(s,e,n)),l=Sf(xn(t,n,s)),c=Sf(xn(t,n,e));return!!(i!==r&&l!==c||i===0&&Mf(s,t,e)||r===0&&Mf(s,n,e)||l===0&&Mf(t,s,n)||c===0&&Mf(t,e,n))}function Mf(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Sf(s){return s>0?1:s<0?-1:0}function DB(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&v1(t,t.next,s,e))return!0;t=t.next}
vendor: 42,088 bytes, lines 7-11
7while(t!==s);return!1}function Uu(s,e){return xn(s.prev,s,s.next)<0?xn(s,e,s.next)>=0&&xn(s,s.prev,e)>=0:xn(s,e,s.prev)<0||xn(s,s.next,e)<0}function FB(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function b1(s,e){const t=Sx(s.i,s.x,s.y),n=Sx(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function fA(s,e,t,n){const i=Sx(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Gu(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Sx(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function NB(s,e,t,n){let i=0;for(let r=e,l=t-n;r<t;r+=n)i+=(s[l]-s[r])*(s[r+1]+s[l+1]),l=r;return i}class OB{static triangulate(e,t,n=2){return vB(e,t,n)}}class ys{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return ys.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];dA(e),pA(n,e);let l=e.length;t.forEach(dA);for(let u=0;u<t.length;u++)i.push(l),l+=t[u].length,pA(n,t[u]);const c=OB.triangulate(n,i);for(let u=0;u<c.length;u+=3)r.push(c.slice(u,u+3));return r}}function dA(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function pA(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class qp extends mt{constructor(e=new da([new xe(.5,.5),new xe(-.5,.5),new xe(-.5,-.5),new xe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];l(h)}this.setAttribute("position",new tt(i,3)),this.setAttribute("uv",new tt(r,2)),this.computeVertexNormals();function l(c){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,p=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,_=t.bevelSize!==void 0?t.bevelSize:g-.1,b=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const y=t.extrudePath,A=t.UVGenerator!==void 0?t.UVGenerator:UB;let S,T=!1,B,R,L,w;if(y){S=y.getSpacedPoints(d),T=!0,m=!1;const de=y.isCatmullRomCurve3?y.closed:!1;B=y.computeFrenetFrames(d,de),R=new G,L=new G,w=new G}m||(v=0,g=0,_=0,b=0);const I=c.extractPoints(h);let O=I.shape;const D=I.holes;if(!ys.isClockWise(O)){O=O.reverse();for(let de=0,_e=D.length;de<_e;de++){const me=D[de];ys.isClockWise(me)&&(D[de]=me.reverse())}}function X(de){const me=10000000000000001e-36;let Te=de[0];for(let Ce=1;Ce<=de.length;Ce++){const rt=Ce%de.length,j=de[rt],ut=j.x-Te.x,Ze=j.y-Te.y,it=ut*ut+Ze*Ze,Me=Math.max(Math.abs(j.x),Math.abs(j.y),Math.abs(Te.x),Math.abs(Te.y)),Gt=me*Me*Me;if(it<=Gt){de.splice(rt,1),Ce--;continue}Te=j}}X(O),D.forEach(X);const Y=D.length,V=O;for(let de=0;de<Y;de++){const _e=D[de];O=O.concat(_e)}function H(de,_e,me){return _e||at("ExtrudeGeometry: vec does not exist"),de.clone().addScaledVector(_e,me)}const W=O.length;function q(de,_e,me){let Te,Ce,rt;const j=de.x-_e.x,ut=de.y-_e.y,Ze=me.x-de.x,it=me.y-de.y,Me=j*j+ut*ut,Gt=j*it-ut*Ze;if(Math.abs(Gt)>Number.EPSILON){const U=Math.sqrt(Me),P=Math.sqrt(Ze*Ze+it*it),ee=_e.x-ut/U,he=_e.y+j/U,ve=me.x-it/P,Re=me.y+Ze/P,Fe=((ve-ee)*it-(Re-he)*Ze)/(j*it-ut*Ze);Te=ee+j*Fe-de.x,Ce=he+ut*Fe-de.y;const ue=Te*Te+Ce*Ce;if(ue<=2)return new xe(Te,Ce);rt=Math.sqrt(ue/2)}else{let U=!1;j>Number.EPSILON?Ze>Number.EPSILON&&(U=!0):j<-Number.EPSILON?Ze<-Number.EPSILON&&(U=!0):Math.sign(ut)===Math.sign(it)&&(U=!0),U?(Te=-ut,Ce=j,rt=Math.sqrt(Me)):(Te=j,Ce=ut,rt=Math.sqrt(Me/2))}return new xe(Te/rt,Ce/rt)}const Q=[];for(let de=0,_e=V.length,me=_e-1,Te=de+1;de<_e;de++,me++,Te++)me===_e&&(me=0),Te===_e&&(Te=0),Q[de]=q(V[de],V[me],V[Te]);const re=[];let ae,pe=Q.concat();for(let de=0,_e=Y;de<_e;de++){const me=D[de];ae=[];for(let Te=0,Ce=me.length,rt=Ce-1,j=Te+1;Te<Ce;Te++,rt++,j++)rt===Ce&&(rt=0),j===Ce&&(j=0),ae[Te]=q(me[Te],me[rt],me[j]);re.push(ae),pe=pe.concat(ae)}let Ue;if(v===0)Ue=ys.triangulateShape(V,D);else{const de=[],_e=[];for(let me=0;me<v;me++){const Te=me/v,Ce=g*Math.cos(Te*Math.PI/2),rt=_*Math.sin(Te*Math.PI/2)+b;for(let j=0,ut=V.length;j<ut;j++){const Ze=H(V[j],Q[j],rt);ze(Ze.x,Ze.y,-Ce),Te===0&&de.push(Ze)}for(let j=0,ut=Y;j<ut;j++){const Ze=D[j];ae=re[j];const it=[];for(let Me=0,Gt=Ze.length;Me<Gt;Me++){const U=H(Ze[Me],ae[Me],rt);ze(U.x,U.y,-Ce),Te===0&&it.push(U)}Te===0&&_e.push(it)}}Ue=ys.triangulateShape(de,_e)}const Pe=Ue.length,He=_+b;for(let de=0;de<W;de++){const _e=m?H(O[de],pe[de],He):O[de];T?(L.copy(B.normals[0]).multiplyScalar(_e.x),R.copy(B.binormals[0]).multiplyScalar(_e.y),w.copy(S[0]).add(L).add(R),ze(w.x,w.y,w.z)):ze(_e.x,_e.y,0)}for(let de=1;de<=d;de++)for(let _e=0;_e<W;_e++){const me=m?H(O[_e],pe[_e],He):O[_e];T?(L.copy(B.normals[de]).multiplyScalar(me.x),R.copy(B.binormals[de]).multiplyScalar(me.y),w.copy(S[de]).add(L).add(R),ze(w.x,w.y,w.z)):ze(me.x,me.y,p/d*de)}for(let de=v-1;de>=0;de--){const _e=de/v,me=g*Math.cos(_e*Math.PI/2),Te=_*Math.sin(_e*Math.PI/2)+b;for(let Ce=0,rt=V.length;Ce<rt;Ce++){const j=H(V[Ce],Q[Ce],Te);ze(j.x,j.y,p+me)}for(let Ce=0,rt=D.length;Ce<rt;Ce++){const j=D[Ce];ae=re[Ce];for(let ut=0,Ze=j.length;ut<Ze;ut++){const it=H(j[ut],ae[ut],Te);T?ze(it.x,it.y+S[d-1].y,S[d-1].x+me):ze(it.x,it.y,p+me)}}}le(),Le();function le(){const de=i.length/3;if(m){let _e=0,me=W*_e;for(let Te=0;Te<Pe;Te++){const Ce=Ue[Te];Je(Ce[2]+me,Ce[1]+me,Ce[0]+me)}_e=d+v*2,me=W*_e;for(let Te=0;Te<Pe;Te++){const Ce=Ue[Te];Je(Ce[0]+me,Ce[1]+me,Ce[2]+me)}}else{for(let _e=0;_e<Pe;_e++){const me=Ue[_e];Je(me[2],me[1],me[0])}for(let _e=0;_e<Pe;_e++){const me=Ue[_e];Je(me[0]+W*d,me[1]+W*d,me[2]+W*d)}}n.addGroup(de,i.length/3-de,0)}function Le(){const de=i.length/3;let _e=0;ye(V,_e),_e+=V.length;for(let me=0,Te=D.length;me<Te;me++){const Ce=D[me];ye(Ce,_e),_e+=Ce.length}n.addGroup(de,i.length/3-de,1)}function ye(de,_e){let me=de.length;for(;--me>=0;){const Te=me;let Ce=me-1;Ce<0&&(Ce=de.length-1);for(let rt=0,j=d+v*2;rt<j;rt++){const ut=W*rt,Ze=W*(rt+1),it=_e+Te+ut,Me=_e+Ce+ut,Gt=_e+Ce+Ze,U=_e+Te+Ze;Ee(it,Me,Gt,U)}}}function ze(de,_e,me){u.push(de),u.push(_e),u.push(me)}function Je(de,_e,me){ht(de),ht(_e),ht(me);const Te=i.length/3,Ce=A.generateTopUV(n,i,Te-3,Te-2,Te-1);qe(Ce[0]),qe(Ce[1]),qe(Ce[2])}function Ee(de,_e,me,Te){ht(de),ht(_e),ht(Te),ht(_e),ht(me),ht(Te);const Ce=i.length/3,rt=A.generateSideWallUV(n,i,Ce-6,Ce-3,Ce-2,Ce-1);qe(rt[0]),qe(rt[1]),qe(rt[3]),qe(rt[1]),qe(rt[2]),qe(rt[3])}function ht(de){i.push(u[de*3+0]),i.push(u[de*3+1]),i.push(u[de*3+2])}function qe(de){r.push(de.x),r.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 GB(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,l=e.shapes.length;r<l;r++){const c=t[e.shapes[r]];n.push(c)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new mp[i.type]().fromJSON(i)),new qp(n,e.options)}}const UB={generateTopUV:function(s,e,t,n,i){const r=e[t*3],l=e[t*3+1],c=e[n*3],u=e[n*3+1],h=e[i*3],d=e[i*3+1];return[new xe(r,l),new xe(c,u),new xe(h,d)]},generateSideWallUV:function(s,e,t,n,i,r){const l=e[t*3],c=e[t*3+1],u=e[t*3+2],h=e[n*3],d=e[n*3+1],p=e[n*3+2],m=e[i*3],g=e[i*3+1],_=e[i*3+2],b=e[r*3],v=e[r*3+1],y=e[r*3+2];return Math.abs(c-d)<Math.abs(l-h)?[new xe(l,1-u),new xe(h,1-p),new xe(m,1-_),new xe(b,1-y)]:[new xe(c,1-u),new xe(d,1-p),new xe(g,1-_),new xe(v,1-y)]}};function GB(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Zp extends yo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-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],r=[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(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zp(e.radius,e.detail)}}class Qp extends mt{constructor(e=[new xe(0,-.5),new xe(.5,0),new xe(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=gt(i,0,Math.PI*2);const r=[],l=[],c=[],u=[],h=[],d=1/t,p=new G,m=new xe,g=new G,_=new G,b=new G;let v=0,y=0;for(let A=0;A<=e.length-1;A++)switch(A){case 0:v=e[A+1].x-e[A].x,y=e[A+1].y-e[A].y,g.x=y*1,g.y=-v,g.z=y*0,b.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(b.x,b.y,b.z);break;default:v=e[A+1].x-e[A].x,y=e[A+1].y-e[A].y,g.x=y*1,g.y=-v,g.z=y*0,_.copy(g),g.x+=b.x,g.y+=b.y,g.z+=b.z,g.normalize(),u.push(g.x,g.y,g.z),b.copy(_)}for(let A=0;A<=t;A++){const S=n+A*d*i,T=Math.sin(S),B=Math.cos(S);for(let R=0;R<=e.length-1;R++){p.x=e[R].x*T,p.y=e[R].y,p.z=e[R].x*B,l.push(p.x,p.y,p.z),m.x=A/t,m.y=R/(e.length-1),c.push(m.x,m.y);const L=u[3*R+0]*T,w=u[3*R+1],I=u[3*R+0]*B;h.push(L,w,I)}}for(let A=0;A<t;A++)for(let S=0;S<e.length-1;S++){const T=S+A*e.length,B=T,R=T+e.length,L=T+e.length+1,w=T+1;r.push(B,R,w),r.push(L,w,R)}this.setIndex(r),this.setAttribute("position",new tt(l,3)),this.setAttribute("uv",new tt(c,2)),this.setAttribute("normal",new tt(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qp(e.points,e.segments,e.phiStart,e.phiLength)}}class Zu extends yo{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],i=[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,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zu(e.radius,e.detail)}}class uc extends mt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,l=t/2,c=Math.floor(n),u=Math.floor(i),h=c+1,d=u+1,p=e/c,m=t/u,g=[],_=[],b=[],v=[];for(let y=0;y<d;y++){const A=y*m-l;for(let S=0;S<h;S++){const T=S*p-r;_.push(T,-A,0),b.push(0,0,1),v.push(S/c),v.push(1-y/u)}}for(let y=0;y<u;y++)for(let A=0;A<c;A++){const S=A+h*y,T=A+h*(y+1),B=A+1+h*(y+1),R=A+1+h*y;g.push(S,T,R),g.push(T,B,R)}this.setIndex(g),this.setAttribute("position",new tt(_,3)),this.setAttribute("normal",new tt(b,3)),this.setAttribute("uv",new tt(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uc(e.width,e.height,e.widthSegments,e.heightSegments)}}class $p extends mt{constructor(e=.5,t=1,n=32,i=1,r=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:l},n=Math.max(3,n),i=Math.max(1,i);const c=[],u=[],h=[],d=[];let p=e;const m=(t-e)/i,g=new G,_=new xe;for(let b=0;b<=i;b++){for(let v=0;v<=n;v++){const y=r+v/n*l;g.x=p*Math.cos(y),g.y=p*Math.sin(y),u.push(g.x,g.y,g.z),h.push(0,0,1),_.x=(g.x/t+1)/2,_.y=(g.y/t+1)/2,d.push(_.x,_.y)}p+=m}for(let b=0;b<i;b++){const v=b*(n+1);for(let y=0;y<n;y++){const A=y+v,S=A,T=A+n+1,B=A+n+2,R=A+1;c.push(S,T,R),c.push(T,B,R)}}this.setIndex(c),this.setAttribute("position",new tt(u,3)),this.setAttribute("normal",new tt(h,3)),this.setAttribute("uv",new tt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $p(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class em extends mt{constructor(e=new da([new xe(0,.5),new xe(-.5,-.5),new xe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],l=[];let c=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let d=0;d<e.length;d++)h(e[d]),this.addGroup(c,u,d),c+=u,u=0;this.setIndex(n),this.setAttribute("position",new tt(i,3)),this.setAttribute("normal",new tt(r,3)),this.setAttribute("uv",new tt(l,2));function h(d){const p=i.length/3,m=d.extractPoints(t);let g=m.shape;const _=m.holes;ys.isClockWise(g)===!1&&(g=g.reverse());for(let v=0,y=_.length;v<y;v++){const A=_[v];ys.isClockWise(A)===!0&&(_[v]=A.reverse())}const b=ys.triangulateShape(g,_);for(let v=0,y=_.length;v<y;v++){const A=_[v];g=g.concat(A)}for(let v=0,y=g.length;v<y;v++){const A=g[v];i.push(A.x,A.y,0),r.push(0,0,1),l.push(A.x,A.y)}for(let v=0,y=b.length;v<y;v++){const A=b[v],S=A[0]+p,T=A[1]+p,B=A[2]+p;n.push(S,T,B),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return kB(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const l=t[e.shapes[i]];n.push(l)}return new em(n,e.curveSegments)}}function kB(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class Qu extends mt{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,l=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:l,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(l+c,Math.PI);let h=0;const d=[],p=new G,m=new G,g=[],_=[],b=[],v=[];for(let y=0;y<=n;y++){const A=[],S=y/n;let T=0;y===0&&l===0?T=.5/t:y===n&&u===Math.PI&&(T=-.5/t);for(let B=0;B<=t;B++){const R=B/t;p.x=-e*Math.cos(i+R*r)*Math.sin(l+S*c),p.y=e*Math.cos(l+S*c),p.z=e*Math.sin(i+R*r)*Math.sin(l+S*c),_.push(p.x,p.y,p.z),m.copy(p).normalize(),b.push(m.x,m.y,m.z),v.push(R+T,1-S),A.push(h++)}d.push(A)}for(let y=0;y<n;y++)for(let A=0;A<t;A++){const S=d[y][A+1],T=d[y][A],B=d[y+1][A],R=d[y+1][A+1];(y!==0||l>0)&&g.push(S,T,R),(y!==n-1||u<Math.PI)&&g.push(T,B,R)}this.setIndex(g),this.setAttribute("position",new tt(_,3)),this.setAttribute("normal",new tt(b,3)),this.setAttribute("uv",new tt(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class tm extends yo{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new tm(e.radius,e.detail)}}class nm extends mt{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2,l=0,c=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r,thetaStart:l,thetaLength:c},n=Math.floor(n),i=Math.floor(i);const u=[],h=[],d=[],p=[],m=new G,g=new G,_=new G;for(let b=0;b<=n;b++){const v=l+b/n*c;for(let y=0;y<=i;y++){const A=y/i*r;g.x=(e+t*Math.cos(v))*Math.cos(A),g.y=(e+t*Math.cos(v))*Math.sin(A),g.z=t*Math.sin(v),h.push(g.x,g.y,g.z),m.x=e*Math.cos(A),m.y=e*Math.sin(A),_.subVectors(g,m).normalize(),d.push(_.x,_.y,_.z),p.push(y/i),p.push(b/n)}}for(let b=1;b<=n;b++)for(let v=1;v<=i;v++){const y=(i+1)*b+v-1,A=(i+1)*(b-1)+v-1,S=(i+1)*(b-1)+v,T=(i+1)*b+v;u.push(y,A,T),u.push(A,S,T)}this.setIndex(u),this.setAttribute("position",new tt(h,3)),this.setAttribute("normal",new tt(d,3)),this.setAttribute("uv",new tt(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nm(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class im extends mt{constructor(e=1,t=.4,n=64,i=8,r=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:l},n=Math.floor(n),i=Math.floor(i);const c=[],u=[],h=[],d=[],p=new G,m=new G,g=new G,_=new G,b=new G,v=new G,y=new G;for(let S=0;S<=n;++S){const T=S/n*r*Math.PI*2;A(T,r,l,e,g),A(T+.01,r,l,e,_),v.subVectors(_,g),y.addVectors(_,g),b.crossVectors(v,y),y.crossVectors(b,v),b.normalize(),y.normalize();for(let B=0;B<=i;++B){const R=B/i*Math.PI*2,L=-t*Math.cos(R),w=t*Math.sin(R);p.x=g.x+(L*y.x+w*b.x),p.y=g.y+(L*y.y+w*b.y),p.z=g.z+(L*y.z+w*b.z),u.push(p.x,p.y,p.z),m.subVectors(p,g).normalize(),h.push(m.x,m.y,m.z),d.push(S/n),d.push(B/i)}}for(let S=1;S<=n;S++)for(let T=1;T<=i;T++){const B=(i+1)*(S-1)+(T-1),R=(i+1)*S+(T-1),L=(i+1)*S+T,w=(i+1)*(S-1)+T;c.push(B,R,w),c.push(R,L,w)}this.setIndex(c),this.setAttribute("position",new tt(u,3)),this.setAttribute("normal",new tt(h,3)),this.setAttribute("uv",new tt(d,2));function A(S,T,B,R,L){const w=Math.cos(S),I=Math.sin(S),O=B/T*S,D=Math.cos(O);L.x=R*(2+D)*.5*w,L.y=R*(2+D)*I*.5,L.z=R*Math.sin(O)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new im(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class sm extends mt{constructor(e=new M_(new G(-1,-1,0),new G(-1,1,0),new G(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const l=e.computeFrenetFrames(t,r);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;const c=new G,u=new G,h=new xe;let d=new G;const p=[],m=[],g=[],_=[];b(),this.setIndex(_),this.setAttribute("position",new tt(p,3)),this.setAttribute("normal",new tt(m,3)),this.setAttribute("uv",new tt(g,2));function b(){for(let S=0;S<t;S++)v(S);v(r===!1?t:0),A(),y()}function v(S){d=e.getPointAt(S/t,d);const T=l.normals[S],B=l.binormals[S];for(let R=0;R<=i;R++){const L=R/i*Math.PI*2,w=Math.sin(L),I=-Math.cos(L);u.x=I*T.x+w*B.x,u.y=I*T.y+w*B.y,u.z=I*T.z+w*B.z,u.normalize(),m.push(u.x,u.y,u.z),c.x=d.x+n*u.x,c.y=d.y+n*u.y,c.z=d.z+n*u.z,p.push(c.x,c.y,c.z)}}function y(){for(let S=1;S<=t;S++)for(let T=1;T<=i;T++){const B=(i+1)*(S-1)+(T-1),R=(i+1)*S+(T-1),L=(i+1)*S+T,w=(i+1)*(S-1)+T;_.push(B,R,w),_.push(R,L,w)}}function A(){for(let S=0;S<=t;S++)for(let T=0;T<=i;T++)h.x=S/t,h.y=T/i,g.push(h.x,h.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 sm(new mp[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class E_ extends mt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new G,r=new G;if(e.index!==null){const l=e.attributes.position,c=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:c.count,materialIndex:0}]);for(let h=0,d=u.length;h<d;++h){const p=u[h],m=p.start,g=p.count;for(let _=m,b=m+g;_<b;_+=3)for(let v=0;v<3;v++){const y=c.getX(_+v),A=c.getX(_+(v+1)%3);i.fromBufferAttribute(l,y),r.fromBufferAttribute(l,A),mA(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const l=e.attributes.position;for(let c=0,u=l.count/3;c<u;c++)for(let h=0;h<3;h++){const d=3*c+h,p=3*c+(h+1)%3;i.fromBufferAttribute(l,d),r.fromBufferAttribute(l,p),mA(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new tt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function mA(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var gA=Object.freeze({__proto__:null,BoxGeometry:Ms,CapsuleGeometry:Xp,CircleGeometry:Jp,ConeGeometry:qu,CylinderGeometry:Ku,DodecahedronGeometry:Yp,EdgesGeometry:tc,ExtrudeGeometry:qp,IcosahedronGeometry:Zp,LatheGeometry:Qp,OctahedronGeometry:Zu,PlaneGeometry:uc,PolyhedronGeometry:yo,RingGeometry:$p,ShapeGeometry:em,SphereGeometry:Qu,TetrahedronGeometry:tm,TorusGeometry:nm,TorusKnotGeometry:im,TubeGeometry:sm,WireframeGeometry:E_});class A1 extends On{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new we(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 ic(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];if(xA(i))i.isRenderTargetTexture?(ke("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(xA(i[0])){const r=[];for(let l=0,c=i.length;l<c;l++)r[l]=i[l].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function di(s){const e={};for(let t=0;t<s.length;t++){const n=ic(s[t]);for(const i in n)e[i]=n[i]}return e}function xA(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function HB(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function M1(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:It.workingColorSpace}const xp={clone:ic,merge:di};var zB=`void main() {
8	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9}`,VB=`void main() {
10	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
11}`;class Ii extends On{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=zB,this.fragmentShader=VB,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=ic(e.uniforms),this.uniformsGroups=HB(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 i in this.uniforms){const l=this.uniforms[i].value;l&&l.isTexture?t.uniforms[i]={type:"t",value:l.toJSON(e).uuid}:l&&l.isColor?t.uniforms[i]={type:"c",value:l.getHex()}:l&&l.isVector2?t.uniforms[i]={type:"v2",value:l.toArray()}:l&&l.isVector3?t.uniforms[i]={type:"v3",value:l.toArray()}:l&&l.isVector4?t.uniforms[i]={type:"v4",value:l.toArray()}:l&&l.isMatrix3?t.uniforms[i]={type:"m3",value:l.toArray()}:l&&l.isMatrix4?t.uniforms[i]={type:"m4",value:l.toArray()}:t.uniforms[i]={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 i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class T_ extends Ii{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class et extends On{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new we(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 we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Er,this.normalScale=new xe(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 As,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 ci extends et{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 xe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return gt(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.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new we(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 we(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new we(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=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 iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class S1 extends On{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new we(16777215),this.specular=new we(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Er,this.normalScale=new xe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new As,this.combine=Wu,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 E1 extends On{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new we(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Er,this.normalScale=new xe(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 T1 extends On{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Er,this.normalScale=new xe(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 xs extends On{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new we(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Er,this.normalScale=new xe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new As,this.combine=Wu,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 C_ extends On{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=YE,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 w_ extends On{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 C1 extends On{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new we(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Er,this.normalScale=new xe(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 w1 extends li{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 oa(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function R1(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Ex(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,l=0;l!==n;++r){const c=t[r]*e;for(let u=0;u!==e;++u)i[l++]=s[c+u]}return i}function R_(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let l=r[n];if(l!==void 0)if(Array.isArray(l))do l=r[n],l!==void 0&&(e.push(r.time),t.push(...l)),r=s[i++];while(r!==void 0);else if(l.toArray!==void 0)do l=r[n],l!==void 0&&(e.push(r.time),l.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do l=r[n],l!==void 0&&(e.push(r.time),t.push(l)),r=s[i++];while(r!==void 0)}function WB(s,e,t,n,i=30){const r=s.clone();r.name=e;const l=[];for(let u=0;u<r.tracks.length;++u){const h=r.tracks[u],d=h.getValueSize(),p=[],m=[];for(let g=0;g<h.times.length;++g){const _=h.times[g]*i;if(!(_<t||_>=n)){p.push(h.times[g]);for(let b=0;b<d;++b)m.push(h.values[g*d+b])}}p.length!==0&&(h.times=oa(p,h.times.constructor),h.values=oa(m,h.values.constructor),l.push(h))}r.tracks=l;let c=1/0;for(let u=0;u<r.tracks.length;++u)c>r.tracks[u].times[0]&&(c=r.tracks[u].times[0]);for(let u=0;u<r.tracks.length;++u)r.tracks[u].shift(-1*c);return r.resetDuration(),r}function jB(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let l=0;l<i;++l){const c=t.tracks[l],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const h=s.tracks.find(function(y){return y.name===c.name&&y.ValueTypeName===u});if(h===void 0)continue;let d=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);let m=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const _=c.times.length-1;let b;if(r<=c.times[0]){const y=d,A=p-d;b=c.values.slice(y,A)}else if(r>=c.times[_]){const y=_*p+d,A=y+p-d;b=c.values.slice(y,A)}else{const y=c.createInterpolant(),A=d,S=p-d;y.evaluate(r),b=y.resultBuffer.slice(A,S)}u==="quaternion"&&new Qn().fromArray(b).normalize().conjugate().toArray(b);const v=h.times.length;for(let y=0;y<v;++y){const A=y*g+m;if(u==="quaternion")Qn.multiplyQuaternionsFlat(h.values,A,b,0,h.values,A);else{const S=g-m*2;for(let T=0;T<S;++T)h.values[A+T]-=b[T]}}}return s.blendMode=r_,s}class XB{static convertArray(e,t){return oa(e,t)}static isTypedArray(e){return n1(e)}static getKeyframeOrder(e){return R1(e)}static sortedArray(e,t,n){return Ex(e,t,n)}static flattenJSON(e,t,n,i){R_(e,t,n,i)}static subclip(e,t,n,i,r=30){return WB(e,t,n,i,r)}static makeClipAdditive(e,t=0,n=e,i=30){return jB(e,t,n,i)}}class Sa{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let l;n:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(r=i,i=t[++n],e<i)break t}l=t.length;break n}if(!(e>=r)){const c=t[1];e<c&&(n=2,r=c);for(let u=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=r,r=t[--n-1],e>=r)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(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let l=0;l!==i;++l)t[l]=n[r+l];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class I1 extends Sa{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:sa,endingEnd:sa}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,l=e+1,c=i[r],u=i[l];if(c===void 0)switch(this.getSettings_().endingStart){case ra:r=e,c=2*t-n;break;case Pu:r=i.length-2,c=t+i[r]-i[r+1];break;default:r=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case ra:l=e,u=2*n-t;break;case Pu:l=1,u=n+i[1]-i[0];break;default:l=e-1,u=t}const h=(n-t)*.5,d=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=r*d,this._offsetNext=l*d}interpolate_(e,t,n,i){const r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this._offsetPrev,p=this._offsetNext,m=this._weightPrev,g=this._weightNext,_=(n-t)/(i-t),b=_*_,v=b*_,y=-m*v+2*m*b-m*_,A=(1+m)*v+(-1.5-2*m)*b+(-.5+m)*_+1,S=(-1-g)*v+(1.5+g)*b+.5*_,T=g*v-g*b;for(let B=0;B!==c;++B)r[B]=y*l[d+B]+A*l[h+B]+S*l[u+B]+T*l[p+B];return r}}class I_ extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=(n-t)/(i-t),p=1-d;for(let m=0;m!==c;++m)r[m]=l[h+m]*p+l[u+m]*d;return r}}class B1 extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class P1 extends Sa{interpolate_(e,t,n,i){const r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this.settings||this.DefaultSettings_,p=d.inTangents,m=d.outTangents;if(!p||!m){const b=(n-t)/(i-t),v=1-b;
11for(let y=0;y!==c;++y)r[y]=l[h+y]*v+l[u+y]*b;return r}const g=c*2,_=e-1;for(let b=0;b!==c;++b){const v=l[h+b],y=l[u+b],A=_*g+b*2,S=m[A],T=m[A+1],B=e*g+b*2,R=p[B],L=p[B+1];let w=(n-t)/(i-t),I,O,D,z,X;for(let Y=0;Y<8;Y++){I=w*w,O=I*w,D=1-w,z=D*D,X=z*D;const H=X*t+3*z*w*S+3*D*I*R+O*i-n;if(Math.abs(H)<1e-10)break;const W=3*z*(S-t)+6*D*w*(R-S)+3*I*(i-R);if(Math.abs(W)<1e-10)break;w=w-H/W,w=Math.max(0,Math.min(1,w))}r[b]=X*v+3*z*w*T+3*D*I*L+O*y}return r}}class ss{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oa(t,this.TimeBufferType),this.values=oa(n,this.ValueBufferType),this.setInterpolation(i||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:oa(e.times,Array),values:oa(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new B1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new I_(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new I1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new P1(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case ql:t=this.InterpolantFactoryMethodDiscrete;break;case Zl:t=this.InterpolantFactoryMethodLinear;break;case yd:t=this.InterpolantFactoryMethodSmooth;break;case yx: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 ke("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ql;case this.InterpolantFactoryMethodLinear:return Zl;case this.InterpolantFactoryMethodSmooth:return yd;case this.InterpolantFactoryMethodBezier:return yx}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,l=i-1;for(;r!==i&&n[r]<e;)++r;for(;l!==-1&&n[l]>t;)--l;if(++l,r!==0||l!==i){r>=l&&(l=Math.max(l,1),r=l-1);const c=this.getValueSize();this.times=n.slice(r,l),this.values=this.values.slice(r*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(at("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(at("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==r;c++){const u=n[c];if(typeof u=="number"&&isNaN(u)){at("KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(l!==null&&l>u){at("KeyframeTrack: Out of order keys.",this,c,u,l),e=!1;break}l=u}if(i!==void 0&&n1(i))for(let c=0,u=i.length;c!==u;++c){const h=i[c];if(isNaN(h)){at("KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===yd,r=e.length-1;let l=1;for(let c=1;c<r;++c){let u=!1;const h=e[c],d=e[c+1];if(h!==d&&(c!==1||h!==e[0]))if(i)u=!0;else{const p=c*n,m=p-n,g=p+n;for(let _=0;_!==n;++_){const b=t[p+_];if(b!==t[m+_]||b!==t[g+_]){u=!0;break}}}if(u){if(c!==l){e[l]=e[c];const p=c*n,m=l*n;for(let g=0;g!==n;++g)t[m+g]=t[p+g]}++l}}if(r>0){e[l]=e[r];for(let c=r*n,u=l*n,h=0;h!==n;++h)t[u+h]=t[c+h];++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,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ss.prototype.ValueTypeName="";ss.prototype.TimeBufferType=Float32Array;ss.prototype.ValueBufferType=Float32Array;ss.prototype.DefaultInterpolation=Zl;
vendor: 50,549 bytes, line 11
11class Ea extends ss{constructor(e,t,n){super(e,t,n)}}Ea.prototype.ValueTypeName="bool";Ea.prototype.ValueBufferType=Array;Ea.prototype.DefaultInterpolation=ql;Ea.prototype.InterpolantFactoryMethodLinear=void 0;Ea.prototype.InterpolantFactoryMethodSmooth=void 0;class B_ extends ss{constructor(e,t,n,i){super(e,t,n,i)}}B_.prototype.ValueTypeName="color";class va extends ss{constructor(e,t,n,i){super(e,t,n,i)}}va.prototype.ValueTypeName="number";class L1 extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t);let h=e*c;for(let d=h+c;h!==d;h+=4)Qn.slerpFlat(r,0,l,h-c,l,h,u);return r}}class ba extends ss{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new L1(this.times,this.values,this.getValueSize(),e)}}ba.prototype.ValueTypeName="quaternion";ba.prototype.InterpolantFactoryMethodSmooth=void 0;class Ta extends ss{constructor(e,t,n){super(e,t,n)}}Ta.prototype.ValueTypeName="string";Ta.prototype.ValueBufferType=Array;Ta.prototype.DefaultInterpolation=ql;Ta.prototype.InterpolantFactoryMethodLinear=void 0;Ta.prototype.InterpolantFactoryMethodSmooth=void 0;class Aa extends ss{constructor(e,t,n,i){super(e,t,n,i)}}Aa.prototype.ValueTypeName="vector";class sc{constructor(e="",t=-1,n=[],i=Fp){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Xi(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(YB(n[l]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,l=n.length;r!==l;++r)t.push(ss.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,l=[];for(let c=0;c<r;c++){let u=[],h=[];u.push((c+r-1)%r,c,(c+1)%r),h.push(0,1,0);const d=R1(u);u=Ex(u,1,d),h=Ex(h,1,d),!i&&u[0]===0&&(u.push(r),h.push(h[0])),l.push(new va(".morphTargetInfluences["+t[c].name+"]",u,h).scale(1/n))}return new this(e,-1,l)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.name.match(r);if(d&&d.length>1){const p=d[1];let m=i[p];m||(i[p]=m=[]),m.push(h)}}const l=[];for(const c in i)l.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return l}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return at("AnimationClip: No animation in JSONLoader data."),null;const n=function(p,m,g,_,b){if(g.length!==0){const v=[],y=[];R_(g,v,y,_),v.length!==0&&b.push(new p(m,v,y))}},i=[],r=e.name||"default",l=e.fps||30,c=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let p=0;p<h.length;p++){const m=h[p].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let _;for(_=0;_<m.length;_++)if(m[_].morphTargets)for(let b=0;b<m[_].morphTargets.length;b++)g[m[_].morphTargets[b]]=-1;for(const b in g){const v=[],y=[];for(let A=0;A!==m[_].morphTargets.length;++A){const S=m[_];v.push(S.time),y.push(S.morphTarget===b?1:0)}i.push(new va(".morphTargetInfluence["+b+"]",v,y))}u=g.length*l}else{const g=".bones["+t[p].name+"]";n(Aa,g+".position",m,"pos",i),n(ba,g+".quaternion",m,"rot",i),n(Aa,g+".scale",m,"scl",i)}}return i.length===0?null:new this(r,u,i,c)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.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 JB(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return va;case"vector":case"vector2":case"vector3":case"vector4":return Aa;case"color":return B_;case"quaternion":return ba;case"bool":case"boolean":return Ea;case"string":return Ta}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function YB(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=JB(s.type);if(s.times===void 0){const t=[],n=[];R_(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Xs={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(_A(s)||(this.files[s]=e))},get:function(s){if(this.enabled!==!1&&!_A(s))return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};function _A(s){try{const e=s.slice(s.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class P_{constructor(e,t,n){const i=this;let r=!1,l=0,c=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(d){c++,r===!1&&i.onStart!==void 0&&i.onStart(d,l,c),r=!0},this.itemEnd=function(d){l++,i.onProgress!==void 0&&i.onProgress(d,l,c),l===c&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return u?u(d):d},this.setURLModifier=function(d){return u=d,this},this.addHandler=function(d,p){return h.push(d,p),this},this.removeHandler=function(d){const p=h.indexOf(d);return p!==-1&&h.splice(p,2),this},this.getHandler=function(d){for(let p=0,m=h.length;p<m;p+=2){const g=h[p],_=h[p+1];if(g.global&&(g.lastIndex=0),g.test(d))return _}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 D1=new P_;class ui{constructor(e){this.manager=e!==void 0?e:D1,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}ui.DEFAULT_MATERIAL_NAME="__DEFAULT";const xr={};class KB extends Error{constructor(e,t){super(e),this.response=t}}class Ji extends ui{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Xs.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(xr[e]!==void 0){xr[e].push({onLoad:t,onProgress:n,onError:i});return}xr[e]=[],xr[e].push({onLoad:t,onProgress:n,onError:i});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,u=this.responseType;fetch(l).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const d=xr[e],p=h.body.getReader(),m=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),g=m?parseInt(m):0,_=g!==0;let b=0;const v=new ReadableStream({start(y){A();function A(){p.read().then(({done:S,value:T})=>{if(S)y.close();else{b+=T.byteLength;const B=new ProgressEvent("progress",{lengthComputable:_,loaded:b,total:g});for(let R=0,L=d.length;R<L;R++){const w=d[R];w.onProgress&&w.onProgress(B)}y.enqueue(T),A()}},S=>{y.error(S)})}}});return new Response(v)}else throw new KB(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(d=>new DOMParser().parseFromString(d,c));case"json":return h.json();default:if(c==="")return h.text();{const p=/charset="?([^;"\s]*)"?/i.exec(c),m=p&&p[1]?p[1].toLowerCase():void 0,g=new TextDecoder(m);return h.arrayBuffer().then(_=>g.decode(_))}}}).then(h=>{Xs.add(`file:${e}`,h);const d=xr[e];delete xr[e];for(let p=0,m=d.length;p<m;p++){const g=d[p];g.onLoad&&g.onLoad(h)}}).catch(h=>{const d=xr[e];if(d===void 0)throw this.manager.itemError(e),h;delete xr[e];for(let p=0,m=d.length;p<m;p++){const g=d[p];g.onError&&g.onError(h)}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 qB extends ui{constructor(e){super(e)}load(e,t,n,i){const r=this,l=new Ji(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(r.parse(JSON.parse(c)))}catch(u){i?i(u):at(u),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=sc.parse(e[n]);t.push(i)}return t}}class ZB extends ui{constructor(e){super(e)}load(e,t,n,i){const r=this,l=[],c=new jp,u=new Ji(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(r.withCredentials);let h=0;function d(p){u.load(e[p],function(m){const g=r.parse(m,!0);l[p]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(c.minFilter=nn),c.image=l,c.format=g.format,c.needsUpdate=!0,t&&t(c))},n,i)}if(Array.isArray(e))for(let p=0,m=e.length;p<m;++p)d(p);else u.load(e,function(p){const m=r.parse(p,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let _=0;_<g;_++){l[_]={mipmaps:[]};for(let b=0;b<m.mipmapCount;b++)l[_].mipmaps.push(m.mipmaps[_*m.mipmapCount+b]),l[_].format=m.format,l[_].width=m.width,l[_].height=m.height}c.image=l}else c.image.width=m.width,c.image.height=m.height,c.mipmaps=m.mipmaps;m.mipmapCount===1&&(c.minFilter=nn),c.format=m.format,c.needsUpdate=!0,t&&t(c)},n,i);return c}}const _l=new WeakMap;class ku extends ui{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,l=Xs.get(`image:${e}`);if(l!==void 0){if(l.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(l),r.manager.itemEnd(e)},0);else{let p=_l.get(l);p===void 0&&(p=[],_l.set(l,p)),p.push({onLoad:t,onError:i})}return l}const c=Fu("img");function u(){d(),t&&t(this);const p=_l.get(this)||[];for(let m=0;m<p.length;m++){const g=p[m];g.onLoad&&g.onLoad(this)}_l.delete(this),r.manager.itemEnd(e)}function h(p){d(),i&&i(p),Xs.remove(`image:${e}`);const m=_l.get(this)||[];for(let g=0;g<m.length;g++){const _=m[g];_.onError&&_.onError(p)}_l.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function d(){c.removeEventListener("load",u,!1),c.removeEventListener("error",h,!1)}return c.addEventListener("load",u,!1),c.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),Xs.add(`image:${e}`,c),r.manager.itemStart(e),c.src=e,c}}class QB extends ui{constructor(e){super(e)}load(e,t,n,i){const r=new Yu;r.colorSpace=ri;const l=new ku(this.manager);l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let c=0;function u(h){l.load(e[h],function(d){r.images[h]=d,c++,c===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return r}}class $B extends ui{constructor(e){super(e)}load(e,t,n,i){const r=this,l=new vs,c=new Ji(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(r.withCredentials),c.load(e,function(u){let h;try{h=r.parse(u)}catch(d){i!==void 0?i(d):at(d);return}h.image!==void 0?l.image=h.image:h.data!==void 0&&(l.image.width=h.width,l.image.height=h.height,l.image.data=h.data),l.wrapS=h.wrapS!==void 0?h.wrapS:xi,l.wrapT=h.wrapT!==void 0?h.wrapT:xi,l.magFilter=h.magFilter!==void 0?h.magFilter:nn,l.minFilter=h.minFilter!==void 0?h.minFilter:nn,l.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(l.colorSpace=h.colorSpace),h.flipY!==void 0&&(l.flipY=h.flipY),h.format!==void 0&&(l.format=h.format),h.type!==void 0&&(l.type=h.type),h.mipmaps!==void 0&&(l.mipmaps=h.mipmaps,l.minFilter=ts),h.mipmapCount===1&&(l.minFilter=nn),h.generateMipmaps!==void 0&&(l.generateMipmaps=h.generateMipmaps),l.needsUpdate=!0,t&&t(l,h)},n,i),l}}class F1 extends ui{constructor(e){super(e)}load(e,t,n,i){const r=new fn,l=new ku(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(e,function(c){r.image=c,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class vo extends zt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new we(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class N1 extends vo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(zt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new we(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 o0=new ft,yA=new G,vA=new G;class L_{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 xe(512,512),this.mapType=mi,this.map=null,this.mapPass=null,this.matrix=new ft,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new cc,this._frameExtents=new xe(1,1),this._viewportCount=1,this._viewports=[new Ht(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;yA.setFromMatrixPosition(e.matrixWorld),t.position.copy(yA),vA.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(vA),t.updateMatrixWorld(),o0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o0,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===xa||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(o0)}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.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Ef=new G,Tf=new Qn,Us=new G;class rm extends zt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ft,this.projectionMatrix=new ft,this.projectionMatrixInverse=new ft,this.coordinateSystem=Wi,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(Ef,Tf,Us),Us.x===1&&Us.y===1&&Us.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ef,Tf,Us.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(Ef,Tf,Us),Us.x===1&&Us.y===1&&Us.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ef,Tf,Us.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Kr=new G,bA=new xe,AA=new xe;class En extends rm{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=$l*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(fa*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return $l*2*Math.atan(Math.tan(fa*.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){Kr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Kr.x,Kr.y).multiplyScalar(-e/Kr.z),Kr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Kr.x,Kr.y).multiplyScalar(-e/Kr.z)}getViewSize(e,t){return this.getViewBounds(e,bA,AA),t.subVectors(AA,bA)}setViewOffset(e,t,n,i,r,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=i,this.view.width=r,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(fa*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const l=this.view;if(this.view!==null&&this.view.enabled){const u=l.fullWidth,h=l.fullHeight;r+=l.offsetX*i/u,t-=l.offsetY*n/h,i*=l.width/u,n*=l.height/h}const c=this.filmOffset;c!==0&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,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 eP extends L_{constructor(){super(new En(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=$l*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class D_ extends vo{constructor(e,t,n=0,i=Math.PI/3,r=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(zt.DEFAULT_UP),this.updateMatrix(),this.target=new zt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=l,this.map=null,this.shadow=new eP}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 tP extends L_{constructor(){super(new En(90,1,.5,500)),this.isPointLightShadow=!0}}class F_ extends vo{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new tP}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}}let Cr=class extends rm{constructor(e=-1,t=1,n=1,i=-1,r=.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=i,this.near=r,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,i,r,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=i,this.view.width=r,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,i=(this.top+this.bottom)/2;let r=n-e,l=n+e,c=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=h*this.view.offsetX,l=r+h*this.view.width,c-=d*this.view.offsetY,u=c-d*this.view.height}this.projectionMatrix.makeOrthographic(r,l,c,u,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 nP extends L_{constructor(){super(new Cr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class N_ extends vo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(zt.DEFAULT_UP),this.updateMatrix(),this.target=new zt,this.shadow=new nP}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 O1 extends vo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class U1 extends vo{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}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 O_{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new G)}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,i=e.y,r=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*i),t.addScaledVector(l[2],.488603*r),t.addScaledVector(l[3],.488603*n),t.addScaledVector(l[4],1.092548*(n*i)),t.addScaledVector(l[5],1.092548*(i*r)),t.addScaledVector(l[6],.315392*(3*r*r-1)),t.addScaledVector(l[7],1.092548*(n*r)),t.addScaledVector(l[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],2*.511664*i),t.addScaledVector(l[2],2*.511664*r),t.addScaledVector(l[3],2*.511664*n),t.addScaledVector(l[4],2*.429043*n*i),t.addScaledVector(l[5],2*.429043*i*r),t.addScaledVector(l[6],.743125*r*r-.247708),t.addScaledVector(l[7],2*.429043*n*r),t.addScaledVector(l[8],.429043*(n*n-i*i)),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 i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class G1 extends vo{constructor(e=new O_,t=1){super(void 0,t),this.isLightProbe=!0,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}}class om extends ui{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,l=new Ji(r.manager);l.setPath(r.path),l.setRequestHeader(r.requestHeader),l.setWithCredentials(r.withCredentials),l.load(e,function(c){try{t(r.parse(JSON.parse(c)))}catch(u){i?i(u):at(u),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&ke("MaterialLoader: Undefined texture",r),t[r]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new we().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const l=e.uniforms[r];switch(i.uniforms[r]={},l.type){case"t":i.uniforms[r].value=n(l.value);break;case"c":i.uniforms[r].value=new we().setHex(l.value);break;case"v2":i.uniforms[r].value=new xe().fromArray(l.value);break;case"v3":i.uniforms[r].value=new G().fromArray(l.value);break;case"v4":i.uniforms[r].value=new Ht().fromArray(l.value);break;case"m3":i.uniforms[r].value=new vt().fromArray(l.value);break;case"m4":i.uniforms[r].value=new ft().fromArray(l.value);break;default:i.uniforms[r].value=l.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new xe().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new xe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return om.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:A1,SpriteMaterial:d_,RawShaderMaterial:T_,ShaderMaterial:Ii,PointsMaterial:Wp,MeshPhysicalMaterial:ci,MeshStandardMaterial:et,MeshPhongMaterial:S1,MeshToonMaterial:E1,MeshNormalMaterial:T1,MeshLambertMaterial:xs,MeshDepthMaterial:C_,MeshDistanceMaterial:w_,MeshBasicMaterial:ji,MeshMatcapMaterial:C1,LineDashedMaterial:w1,LineBasicMaterial:li,Material:On};return new t[e]}}class fo{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 U_ extends mt{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 k1 extends ui{constructor(e){super(e)}load(e,t,n,i){const r=this,l=new Ji(r.manager);l.setPath(r.path),l.setRequestHeader(r.requestHeader),l.setWithCredentials(r.withCredentials),l.load(e,function(c){try{t(r.parse(JSON.parse(c)))}catch(u){i?i(u):at(u),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,_){if(t[_]!==void 0)return t[_];const v=g.interleavedBuffers[_],y=r(g,v.buffer),A=Hl(v.type,y),S=new Xu(A,v.stride);return S.uuid=v.uuid,t[_]=S,S}function r(g,_){if(n[_]!==void 0)return n[_];const v=g.arrayBuffers[_],y=new Uint32Array(v).buffer;return n[_]=y,y}const l=e.isInstancedBufferGeometry?new U_:new mt,c=e.data.index;if(c!==void 0){const g=Hl(c.type,c.array);l.setIndex(new Ut(g,1))}const u=e.data.attributes;for(const g in u){const _=u[g];let b;if(_.isInterleavedBufferAttribute){const v=i(e.data,_.data);b=new wi(v,_.itemSize,_.offset,_.normalized)}else{const v=Hl(_.type,_.array),y=_.isInstancedBufferAttribute?_a:Ut;b=new y(v,_.itemSize,_.normalized)}_.name!==void 0&&(b.name=_.name),_.usage!==void 0&&b.setUsage(_.usage),l.setAttribute(g,b)}const h=e.data.morphAttributes;if(h)for(const g in h){const _=h[g],b=[];for(let v=0,y=_.length;v<y;v++){const A=_[v];let S;if(A.isInterleavedBufferAttribute){const T=i(e.data,A.data);S=new wi(T,A.itemSize,A.offset,A.normalized)}else{const T=Hl(A.type,A.array);S=new Ut(T,A.itemSize,A.normalized)}A.name!==void 0&&(S.name=A.name),b.push(S)}l.morphAttributes[g]=b}e.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);const p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(let g=0,_=p.length;g!==_;++g){const b=p[g];l.addGroup(b.start,b.count,b.materialIndex)}const m=e.data.boundingSphere;return m!==void 0&&(l.boundingSphere=new Dn().fromJSON(m)),e.name&&(l.name=e.name),e.userData&&(l.userData=e.userData),l}}const a0={};class iP extends ui{constructor(e){super(e)}load(e,t,n,i){const r=this,l=this.path===""?fo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||l;const c=new Ji(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(p){i!==void 0&&i(p),at("ObjectLoader: Can't parse "+e+".",p.message);return}const d=h.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),at("ObjectLoader: Can't load "+e);return}r.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?fo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new Ji(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const l=await r.loadAsync(e,t);let c;try{c=JSON.parse(l)}catch(h){throw new Error("ObjectLoader: Can't parse "+e+". "+h.message)}const u=c.metadata;if(u===void 0||u.type===void 0||u.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),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),l=this.parseImages(e.images,function(){t!==void 0&&t(h)}),c=this.parseTextures(e.textures,l),u=this.parseMaterials(e.materials,c),h=this.parseObject(e.object,r,u,c,n),d=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,d),this.bindLightTargets(h),t!==void 0){let p=!1;for(const m in l)if(l[m].data instanceof HTMLImageElement){p=!0;break}p===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),l=this.parseTextures(e.textures,r),c=this.parseMaterials(e.materials,l),u=this.parseObject(e.object,i,c,l,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),this.bindLightTargets(u),u}static registerGeometry(e,t){a0[e]=t}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new da().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,l=e.length;r<l;r++){const c=new Ju().fromJSON(e[r],i);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new k1;for(let r=0,l=e.length;r<l;r++){let c;const u=e[r];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":c=i.parse(u);break;default:u.type in gA?c=gA[u.type].fromJSON(u,t):u.type in a0?c=a0[u.type].fromJSON(u,t):ke(`ObjectLoader: Unknown geometry type "${u.type}". Use .registerGeometry() before starting the deserialization process.`)}c.uuid=u.uuid,u.name!==void 0&&(c.name=u.name),u.userData!==void 0&&(c.userData=u.userData),n[u.uuid]=c}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new om;r.setTextures(t);for(let l=0,c=e.length;l<c;l++){const u=e[l];n[u.uuid]===void 0&&(n[u.uuid]=r.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=sc.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function l(u){return n.manager.itemStart(u),r.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function c(u){if(typeof u=="string"){const h=u,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return l(d)}else return u.data?{data:Hl(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new P_(t);r=new ku(u),r.setCrossOrigin(this.crossOrigin);for(let h=0,d=e.length;h<d;h++){const p=e[h],m=p.url;if(Array.isArray(m)){const g=[];for(let _=0,b=m.length;_<b;_++){const v=m[_],y=c(v);y!==null&&(y instanceof HTMLImageElement?g.push(y):g.push(new vs(y.data,y.width,y.height)))}i[p.uuid]=new uo(g)}else{const g=c(p.url);i[p.uuid]=new uo(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await i.loadAsync(u)}else return l.data?{data:Hl(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){i=new ku(this.manager),i.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l<c;l++){const u=e[l],h=u.url;if(Array.isArray(h)){const d=[];for(let p=0,m=h.length;p<m;p++){const g=h[p],_=await r(g);_!==null&&(_ instanceof HTMLImageElement?d.push(_):d.push(new vs(_.data,_.width,_.height)))}n[u.uuid]=new uo(d)}else{const d=await r(u.url);n[u.uuid]=new uo(d)}}}return n}parseTextures(e,t){function n(r,l){return typeof r=="number"?r:(ke("ObjectLoader.parseTexture: Constant should be in numeric form.",r),l[r])}const i={};if(e!==void 0)for(let r=0,l=e.length;r<l;r++){const c=e[r];c.image===void 0&&ke('ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&ke("ObjectLoader: Undefined image",c.image);const u=t[c.image],h=u.data;let d;Array.isArray(h)?(d=new Yu,h.length===6&&(d.needsUpdate=!0)):(h&&h.data?d=new vs:d=new fn,h&&(d.needsUpdate=!0)),d.source=u,d.uuid=c.uuid,c.name!==void 0&&(d.name=c.name),c.mapping!==void 0&&(d.mapping=n(c.mapping,sP)),c.channel!==void 0&&(d.channel=c.channel),c.offset!==void 0&&d.offset.fromArray(c.offset),c.repeat!==void 0&&d.repeat.fromArray(c.repeat),c.center!==void 0&&d.center.fromArray(c.center),c.rotation!==void 0&&(d.rotation=c.rotation),c.wrap!==void 0&&(d.wrapS=n(c.wrap[0],MA),d.wrapT=n(c.wrap[1],MA)),c.format!==void 0&&(d.format=c.format),c.internalFormat!==void 0&&(d.internalFormat=c.internalFormat),c.type!==void 0&&(d.type=c.type),c.colorSpace!==void 0&&(d.colorSpace=c.colorSpace),c.minFilter!==void 0&&(d.minFilter=n(c.minFilter,SA)),c.magFilter!==void 0&&(d.magFilter=n(c.magFilter,SA)),c.anisotropy!==void 0&&(d.anisotropy=c.anisotropy),c.flipY!==void 0&&(d.flipY=c.flipY),c.generateMipmaps!==void 0&&(d.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(d.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(d.compareFunction=c.compareFunction),c.normalized!==void 0&&(d.normalized=c.normalized),c.userData!==void 0&&(d.userData=c.userData),i[c.uuid]=d}return i}parseObject(e,t,n,i,r){let l;function c(m){return t[m]===void 0&&ke("ObjectLoader: Undefined geometry",m),t[m]}function u(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let _=0,b=m.length;_<b;_++){const v=m[_];n[v]===void 0&&ke("ObjectLoader: Undefined material",v),g.push(n[v])}return g}return n[m]===void 0&&ke("ObjectLoader: Undefined material",m),n[m]}}function h(m){return i[m]===void 0&&ke("ObjectLoader: Undefined texture",m),i[m]}let d,p;switch(e.type){case"Scene":l=new u_,e.background!==void 0&&(Number.isInteger(e.background)?l.background=new we(e.background):l.background=h(e.background)),e.environment!==void 0&&(l.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?l.fog=new Hp(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(l.fog=new kp(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 En(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 Cr(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 O1(e.color,e.intensity);break;case"DirectionalLight":l=new N_(e.color,e.intensity),l.target=e.target||"";break;case"PointLight":l=new F_(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new U1(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new D_(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),l.target=e.target||"";break;case"HemisphereLight":l=new N1(e.color,e.groundColor,e.intensity);break;case"LightProbe":const m=new O_().fromArray(e.sh);l=new G1(m,e.intensity);break;case"SkinnedMesh":d=c(e.geometry),p=u(e.material),l=new p_(d,p),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":d=c(e.geometry),p=u(e.material),l=new An(d,p);break;case"InstancedMesh":d=c(e.geometry),p=u(e.material);const g=e.count,_=e.instanceMatrix,b=e.instanceColor;l=new m_(d,p,g),l.instanceMatrix=new _a(new Float32Array(_.array),16),b!==void 0&&(l.instanceColor=new _a(new Float32Array(b.array),b.itemSize));break;case"BatchedMesh":d=c(e.geometry),p=u(e.material),l=new u1(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,p),l.geometry=d,l.perObjectFrustumCulled=e.perObjectFrustumCulled,l.sortObjects=e.sortObjects,l._drawRanges=e.drawRanges,l._reservedRanges=e.reservedRanges,l._geometryInfo=e.geometryInfo.map(v=>{let y=null,A=null;return v.boundingBox!==void 0&&(y=new Ln().fromJSON(v.boundingBox)),v.boundingSphere!==void 0&&(A=new Dn().fromJSON(v.boundingSphere)),{...v,boundingBox:y,boundingSphere:A}}),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=h(e.matricesTexture.uuid),l._indirectTexture=h(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=h(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new Dn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new Ln().fromJSON(e.boundingBox));break;case"LOD":l=new c1;break;case"Line":l=new Tr(c(e.geometry),u(e.material));break;case"LineLoop":l=new g_(c(e.geometry),u(e.material));break;case"LineSegments":l=new Es(c(e.geometry),u(e.material));break;case"PointCloud":case"Points":l=new x_(c(e.geometry),u(e.material));break;case"Sprite":l=new l1(u(e.material));break;case"Group":l=new Ar;break;case"Bone":l=new zp;break;default:l=new zt}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),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)):(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.pivot!==void 0&&(l.pivot=new G().fromArray(e.pivot)),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.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),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
11),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)l.add(this.parseObject(m[g],t,n,i,r))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const _=m[g];l.animations.push(r[_])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(l.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const _=m[g],b=l.getObjectByProperty("uuid",_.object);b!==void 0&&l.addLevel(b,_.distance,_.hysteresis)}}return l}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?ke("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new zt}})}}const sP={UVMapping:Cp,CubeReflectionMapping:Qs,CubeRefractionMapping:po,EquirectangularReflectionMapping:yu,EquirectangularRefractionMapping:vu,CubeUVReflectionMapping:ac},MA={RepeatWrapping:mo,ClampToEdgeWrapping:xi,MirroredRepeatWrapping:Jl},SA={NearestFilter:bn,NearestMipmapNearestFilter:wp,NearestMipmapLinearFilter:ia,LinearFilter:nn,LinearMipmapNearestFilter:Vl,LinearMipmapLinearFilter:ts},l0=new WeakMap;class H1 extends ui{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,l=Xs.get(`image-bitmap:${e}`);if(l!==void 0){if(r.manager.itemStart(e),l.then){l.then(h=>{l0.has(l)===!0?(i&&i(l0.get(l)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(h),r.manager.itemEnd(e))});return}setTimeout(function(){t&&t(l),r.manager.itemEnd(e)},0);return}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const u=fetch(e,c).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(h){Xs.add(`image-bitmap:${e}`,h),t&&t(h),r.manager.itemEnd(e)}).catch(function(h){i&&i(h),l0.set(u,h),Xs.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});Xs.add(`image-bitmap:${e}`,u),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Cf;class G_{static getContext(){return Cf===void 0&&(Cf=new(window.AudioContext||window.webkitAudioContext)),Cf}static setContext(e){Cf=e}}class rP extends ui{constructor(e){super(e)}load(e,t,n,i){const r=this,l=new Ji(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){try{const h=u.slice(0),d=G_.getContext(),p=e+"#decode";r.manager.itemStart(p),d.decodeAudioData(h,function(m){t(m),r.manager.itemEnd(p)}).catch(function(m){c(m),r.manager.itemEnd(p)})}catch(h){c(h)}},n,i);function c(u){i?i(u):at(u),r.manager.itemError(e)}}}const EA=new ft,TA=new ft,Vo=new ft;class oP{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new En,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new En,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,Vo.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,l=t.near*Math.tan(fa*t.fov*.5)/t.zoom;let c,u;TA.elements[12]=-i,EA.elements[12]=i,c=-l*t.aspect+r,u=l*t.aspect+r,Vo.elements[0]=2*t.near/(u-c),Vo.elements[8]=(u+c)/(u-c),this.cameraL.projectionMatrix.copy(Vo),c=-l*t.aspect-r,u=l*t.aspect-r,Vo.elements[0]=2*t.near/(u-c),Vo.elements[8]=(u+c)/(u-c),this.cameraR.projectionMatrix.copy(Vo)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(TA),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(EA)}}const yl=-90,vl=1;class z1 extends zt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new En(yl,vl,e,t);i.layers=this.layers,this.add(i);const r=new En(yl,vl,e,t);r.layers=this.layers,this.add(r);const l=new En(yl,vl,e,t);l.layers=this.layers,this.add(l);const c=new En(yl,vl,e,t);c.layers=this.layers,this.add(c);const u=new En(yl,vl,e,t);u.layers=this.layers,this.add(u);const h=new En(yl,vl,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,l,c,u]=t;for(const h of t)this.remove(h);if(e===Wi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===xa)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,l,c,u,h,d]=this.children,p=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const b=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let v=!1;e.isWebGLRenderer===!0?v=e.state.buffers.depth.getReversed():v=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),v&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,i),v&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,i),v&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),v&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(n,4,i),v&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),n.texture.generateMipmaps=b,e.setRenderTarget(n,5,i),v&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(p,m,g),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}
11class V1 extends En{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class W1{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=aP.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 aP(){this._document.hidden===!1&&this.reset()}const Wo=new G,c0=new Qn,lP=new G,jo=new G,Xo=new G;class cP extends zt{constructor(){super(),this.type="AudioListener",this.context=G_.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new W1}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(
vendor: 18,559 bytes, line 11
11);const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Wo,c0,lP),jo.set(0,0,-1).applyQuaternion(c0),Xo.set(0,1,0).applyQuaternion(c0),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Wo.x,n),t.positionY.linearRampToValueAtTime(Wo.y,n),t.positionZ.linearRampToValueAtTime(Wo.z,n),t.forwardX.linearRampToValueAtTime(jo.x,n),t.forwardY.linearRampToValueAtTime(jo.y,n),t.forwardZ.linearRampToValueAtTime(jo.z,n),t.upX.linearRampToValueAtTime(Xo.x,n),t.upY.linearRampToValueAtTime(Xo.y,n),t.upZ.linearRampToValueAtTime(Xo.z,n)}else t.setPosition(Wo.x,Wo.y,Wo.z),t.setOrientation(jo.x,jo.y,jo.z,Xo.x,Xo.y,Xo.z)}}class j1 extends zt{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){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("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){ke("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){ke("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){ke("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?(ke("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){ke("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"?(ke("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 Jo=new G,CA=new Qn,uP=new G,Yo=new G;class hP extends j1{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(Jo,CA,uP),Yo.set(0,0,1).applyQuaternion(CA);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Jo.x,n),t.positionY.linearRampToValueAtTime(Jo.y,n),t.positionZ.linearRampToValueAtTime(Jo.z,n),t.orientationX.linearRampToValueAtTime(Yo.x,n),t.orientationY.linearRampToValueAtTime(Yo.y,n),t.orientationZ.linearRampToValueAtTime(Yo.z,n)}else t.setPosition(Jo.x,Jo.y,Jo.z),t.setOrientation(Yo.x,Yo.y,Yo.z)}}class fP{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 X1{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,l;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,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,i=this.valueSize,r=e*i+i;let l=this.cumulativeWeight;if(l===0){for(let c=0;c!==i;++c)n[r+c]=n[c];l=t}else{l+=t;const c=t/l;this._mixBufferRegion(n,r,0,c,i)}this.cumulativeWeight=l}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,l=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-r,t)}l>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,l=i;r!==l;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<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,i,r){if(i>=.5)for(let l=0;l!==r;++l)e[t+l]=e[n+l]}_slerp(e,t,n,i){Qn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const l=this._workIndex*r;Qn.multiplyQuaternionsFlat(e,l,e,t,e,n),Qn.slerpFlat(e,t,e,t,e,l,i)}_lerp(e,t,n,i,r){const l=1-i;for(let c=0;c!==r;++c){const u=t+c;e[u]=e[u]*l+e[n+c]*i}}_lerpAdditive(e,t,n,i,r){for(let l=0;l!==r;++l){const c=t+l;e[c]=e[c]+e[n+l]*i}}}const k_="\\[\\]\\.:\\/",dP=new RegExp("["+k_+"]","g"),H_="[^"+k_+"]",pP="[^"+k_.replace("\\.","")+"]",mP=/((?:WC+[\/:])*)/.source.replace("WC",H_),gP=/(WCOD+)?/.source.replace("WCOD",pP),xP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",H_),_P=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",H_),yP=new RegExp("^"+mP+gP+xP+_P+"$"),vP=["material","materials","bones","map"];class bP{constructor(e,t,n){const i=n||Wt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Wt{constructor(e,t,n){this.path=t,this.parsedPath=n||Wt.parseTrackName(t),this.node=Wt.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 Wt.Composite(e,t,n):new Wt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(dP,"")}static parseTrackName(e){const t=yP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);vP.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let l=0;l<r.length;l++){const c=r[l];if(c.name===t||c.uuid===t)return c;const u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Wt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){ke("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){at("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){at("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){at("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===h){h=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){at("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){at("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){at("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){at("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const l=e[i];if(l===void 0){const h=t.nodeName;at("PropertyBinding: Trying to update property for track: "+h+"."+i+" 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 u=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){at("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){at("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}u=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=r}else l.fromArray!==void 0&&l.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(u=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Wt.Composite=bP;Wt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Wt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Wt.prototype.GetterByBindingType=[Wt.prototype._getValue_direct,Wt.prototype._getValue_array,Wt.prototype._getValue_arrayElement,Wt.prototype._getValue_toArray];Wt.prototype.SetterByBindingTypeAndVersioning=[[Wt.prototype._setValue_direct,Wt.prototype._setValue_direct_setNeedsUpdate,Wt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_array,Wt.prototype._setValue_array_setNeedsUpdate,Wt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_arrayElement,Wt.prototype._setValue_arrayElement_setNeedsUpdate,Wt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_fromArray,Wt.prototype._setValue_fromArray_setNeedsUpdate,Wt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AP{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Xi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++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,i=this._parsedPaths,r=this._bindings,l=r.length;let c,u=e.length,h=this.nCachedObjects_;for(let d=0,p=arguments.length;d!==p;++d){const m=arguments[d],g=m.uuid;let _=t[g];if(_===void 0){_=u++,t[g]=_,e.push(m);for(let b=0,v=l;b!==v;++b)r[b].push(new Wt(m,n[b],i[b]))}else if(_<h){c=e[_];const b=--h,v=e[b];t[v.uuid]=_,e[_]=v,t[g]=b,e[b]=m;for(let y=0,A=l;y!==A;++y){const S=r[y],T=S[b];let B=S[_];S[_]=T,B===void 0&&(B=new Wt(m,n[y],i[y])),S[b]=B}}else e[_]!==c&&at("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
11cture when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let l=0,c=arguments.length;l!==c;++l){const u=arguments[l],h=u.uuid,d=t[h];if(d!==void 0&&d>=r){const p=r++,m=e[p];t[m.uuid]=d,e[d]=m,t[h]=p,e[p]=u;for(let g=0,_=i;g!==_;++g){const b=n[g],v=b[p],y=b[d];b[d]=v,b[p]=y}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,l=e.length;for(let c=0,u=arguments.length;c!==u;++c){const h=arguments[c],d=h.uuid,p=t[d];if(p!==void 0)if(delete t[d],p<r){const m=--r,g=e[m],_=--l,b=e[_];t[g.uuid]=p,e[p]=g,t[b.uuid]=m,e[m]=b,e.pop();for(let v=0,y=i;v!==y;++v){const A=n[v],S=A[m],T=A[_];A[p]=S,A[m]=T,A.pop()}}else{const m=--l,g=e[m];m>0&&(t[g.uuid]=p),e[p]=g,e.pop();for(let _=0,b=i;_!==b;++_){const v=n[_];v[p]=v[m],v.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const l=this._paths,c=this._parsedPaths,u=this._objects,h=u.length,d=this.nCachedObjects_,p=new Array(h);i=r.length,n[e]=i,l.push(e),c.push(t),r.push(p);for(let m=d,g=u.length;m!==g;++m){const _=u[m];p[m]=new Wt(_,e,t)}return p}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,l=this._bindings,c=l.length-1,u=l[c],h=e[c];t[h]=n,l[n]=u,l.pop(),r[n]=r[c],r.pop(),i[n]=i[c],i.pop()}}}class J1{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,l=r.length,c=new Array(l),u={endingStart:sa,endingEnd:sa};for(let h=0;h!==l;++h){const d=r[h].createInterpolant(null);c[h]=d,d.settings&&Object.assign(u,d.settings),d.settings=u}this._interpolantSettings=u,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=jE,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 i=this._clip.duration,r=e._clip.duration,l=r/i,c=i/r;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 i=this._mixer,r=i.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const u=c.parameterPositions,h=c.sampleValues;return u[0]=r,u[1]=r+n,h[0]=e/l,h[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const u=(e-r)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case r_:for(let d=0,p=u.length;d!==p;++d)u[d].evaluate(l),h[d].accumulateAdditive(c);break;case Fp:default:for(let d=0,p=u.length;d!==p;++d)u[d].evaluate(l),h[d].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const l=n===XE;if(e===0)return r===-1?i:l&&(r&1)===1?t-i:i;if(n===WE){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,r+=Math.abs(c);const u=this.repetitions-r;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,l)}else this._setEndings(!1,!1,l);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this._loopCount=r,this.time=i;if(l&&(r&1)===1)return t-i}return i}
vendor: 28,589 bytes, line 11
11_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ra,i.endingEnd=ra):(e?i.endingStart=this.zeroSlopeAtStart?ra:sa:i.endingStart=Pu,t?i.endingEnd=this.zeroSlopeAtEnd?ra:sa:i.endingEnd=Pu)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let l=this._weightInterpolant;l===null&&(l=i._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,u=l.sampleValues;return c[0]=r,u[0]=t,c[1]=r+e,u[1]=n,this}}const MP=new Float32Array(1);class SP extends Ss{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,i=e._clip.tracks,r=i.length,l=e._propertyBindings,c=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let d=h[u];d===void 0&&(d={},h[u]=d);for(let p=0;p!==r;++p){const m=i[p],g=m.name;let _=d[g];if(_!==void 0)++_.referenceCount,l[p]=_;else{if(_=l[p],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,u,g));continue}const b=t&&t._propertyBindings[p].binding.parsedPath;_=new X1(Wt.create(n,g,b),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,u,g),l[p]=_}c[p].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let l=r[t];if(l===void 0)l={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=l;else{const c=l.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=i.length,i.push(e),l.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,l=this._actionsByClip,c=l[r],u=c.knownActions,h=u[u.length-1],d=e._byClipCacheIndex;h._byClipCacheIndex=d,u[d]=h,u.pop(),e._byClipCacheIndex=null;const p=c.actionByRoot,m=(e._localRoot||this._root).uuid;delete p[m],u.length===0&&delete l[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let l=i[t];l===void 0&&(l={},i[t]=l),l[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,l=this._bindingsByRootAndName,c=l[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete c[r],Object.keys(c).length===0&&delete l[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new I_(new Float32Array(2),new Float32Array(2),1,MP),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let l=typeof e=="string"?sc.findByName(i,e):e;const c=l!==null?l.uuid:e,u=this._actionsByClip[c];let h=null;if(n===void 0&&(l!==null?n=l.blendMode:n=Fp),u!==void 0){const p=u.actionByRoot[r];if(p!==void 0&&p.blendMode===n)return p;h=u.knownActions[0],l===null&&(l=h._clip)}if(l===null)return null;const d=new J1(this,l,t,n);return this._bindAction(d,h),this._addInactiveAction(d,c,r),d}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?sc.findByName(n,e):e,l=r?r.uuid:e,c=this._actionsByClip[l];return c!==void 0&&c.actionByRoot[i]||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,i=this.time+=e,r=Math.sign(e),l=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,r,l);const c=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)c[h].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,i=this._actionsByClip,r=i[n];if(r!==void 0){const l=r.knownActions;for(let c=0,u=l.length;c!==u;++c){const h=l[c];this._deactivateAction(h);const d=h._cacheIndex,p=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,p._cacheIndex=d,t[d]=p,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const l in n){const c=n[l].actionByRoot,u=c[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const l in r){const c=r[l];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class EP extends c_{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Gp(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class z_{constructor(e){this.value=e}clone(){return new z_(this.value.clone===void 0?this.value:this.value.clone())}}let TP=0;class CP extends Ss{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:TP++}),this.name="",this.usage=Du,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,i=t.length;n<i;n++){const r=Array.isArray(t[n])?t[n]:[t[n]];for(let l=0;l<r.length;l++)this.uniforms.push(r[l].clone())}return this}clone(){return new this.constructor().copy(this)}}class _p extends Xu{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 wP{constructor(e,t,n,i,r,l=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,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 wA=new ft;class Y1{constructor(e,t,n=0,i=1/0){this.ray=new lc(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new ec,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.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):at("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return wA.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(wA),this}intersectObject(e,t=!0,n=[]){return Tx(e,this,n,t),n.sort(RA),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)Tx(e[i],this,n,t);return n.sort(RA),n}}function RA(s,e){return s.distance-e.distance}function Tx(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let l=0,c=r.length;l<c;l++)Tx(r[l],e,t,!0)}}class K1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,ke("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 RP{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=gt(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(gt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class IP{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 sy=class sy{constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}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,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};sy.prototype.isMatrix2=!0;let Cx=sy;const IA=new xe;class BP{constructor(e=new xe(1/0,1/0),t=new xe(-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=IA.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,IA).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 BA=new G,wf=new G,bl=new G,Al=new G,u0=new G,PP=new G,LP=new G;class q1{constructor(e=new G,t=new G){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){BA.subVectors(e,this.start),wf.subVectors(this.end,this.start);const n=wf.dot(wf);if(n===0)return 0;let r=wf.dot(BA)/n;return t&&(r=gt(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=PP,n=LP){const i=10000000000000001e-32;let r,l;const c=this.start,u=e.start,h=this.end,d=e.end;bl.subVectors(h,c),Al.subVectors(d,u),u0.subVectors(c,u);const p=bl.dot(bl),m=Al.dot(Al),g=Al.dot(u0);if(p<=i&&m<=i)return t.copy(c),n.copy(u),t.sub(n),t.dot(t);if(p<=i)r=0,l=g/m,l=gt(l,0,1);else{const _=bl.dot(u0);if(m<=i)l=0,r=gt(-_/p,0,1);else{const b=bl.dot(Al),v=p*m-b*b;v!==0?r=gt((b*g-_*m)/v,0,1):r=0,l=(b*r+g)/m,l<0?(l=0,r=gt(-_/p,0,1)):l>1&&(l=1,r=gt((b-_)/p,0,1))}}return t.copy(c).addScaledVector(bl,r),n.copy(u).addScaledVector(Al,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 PA=new G;class DP extends zt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new mt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,c=1,u=32;l<u;l++,c++){const h=l/u*Math.PI*2,d=c/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(d),Math.sin(d),1)}n.setAttribute("position",new tt(i,3));const r=new li({fog:!1,toneMapped:!1});this.cone=new Es(n,r),this.add(this.cone),this.update()}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.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),PA.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(PA),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qr=new G,Rf=new ft,h0=new ft;class FP extends Es{constructor(e){const t=Z1(e),n=new mt,i=[],r=[];for(let h=0;h<t.length;h++){const d=t[h];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new tt(i,3)),n.setAttribute("color",new tt(r,3));const l=new li({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 we(255),u=new we(65280);this.setColors(c,u)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");h0.copy(this.root.matrixWorld).invert();for(let r=0,l=0;r<t.length;r++){const c=t[r];c.parent&&c.parent.isBone&&(Rf.multiplyMatrices(h0,c.matrixWorld),qr.setFromMatrixPosition(Rf),i.setXYZ(l,qr.x,qr.y,qr.z),Rf.multiplyMatrices(h0,c.parent.matrixWorld),qr.setFromMatrixPosition(Rf),i.setXYZ(l+1,qr.x,qr.y,qr.z),l+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let r=0;r<i.count;r+=2)i.setXYZ(r,e.r,e.g,e.b),i.setXYZ(r+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function Z1(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push(...Z1(s.children[t]));return e}class NP extends An{constructor(e,t,n){const i=new Qu(t,4,2),r=new ji({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const OP=new G,LA=new we,DA=new we;class UP extends zt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Zu(t);i.rotateY(Math.PI*.5),this.material=new ji({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),l=new Float32Array(r.count*3);i.setAttribute("color",new Ut(l,3)),this.add(new An(i,this.material)),this.update()}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");LA.copy(this.light.color),DA.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?LA:DA;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(OP.setFromMatrixPosition(this.light.matrixWorld).negate())}}class GP extends Es{constructor(e=10,t=10,n=4473924,i=8947848){n=new we(n),i=new we(i);const r=t/2,l=e/t,c=e/2,u=[],h=[];for(let m=0,g=0,_=-c;m<=t;m++,_+=l){u.push(-c,0,_,c,0,_),u.push(_,0,-c,_,0,c);const b=m===r?n:i;b.toArray(h,g),g+=3,b.toArray(h,g),g+=3,b.toArray(h,g),g+=3,b.toArray(h,g),g+=3}const d=new mt;d.setAttribute("position",new tt(u,3)),d.setAttribute("color",new tt(h,3));const p=new li({vertexColors:!0,toneMapped:!1});super(d,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class kP extends Es{constructor(e=10,t=16,n=8,i=64,r=4473924,l=8947848){r=new we(r),l=new we(l);const c=[],u=[];if(t>1)for(let p=0;p<t;p++){const m=p/t*(Math.PI*2),g=Math.sin(m)*e,_=Math.cos(m)*e;c.push(0,0,0),c.push(g,0,_);const b=p&1?r:l;u.push(b.r,b.g,b.b),u.push(b.r,b.g,b.b)}for(let p=0;p<n;p++){const m=p&1?r:l,g=e-e/n*p;for(let _=0;_<i;_++){let b=_/i*(Math.PI*2),v=Math.sin(b)*g,y=Math.cos(b)*g;c.push(v,0,y),u.push(m.r,m.g,m.b),b=(_+1)/i*(Math.PI*2),v=Math.sin(b)*g,y=Math.cos(b)*g,c.push(v,0,y),u.push(m.r,m.g,m.b)}}const h=new mt;h.setAttribute("position",new tt(c,3)),h.setAttribute("color",new tt(u,3));const d=new li({vertexColors:!0,toneMapped:!1});super(h,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const FA=new G,If=new G,NA=new G;class HP extends zt{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 i=new mt;i.setAttribute("position",new tt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new li({fog:!1,toneMapped:!1});this.lightPlane=new Tr(i,r),this.add(this.lightPlane),i=new mt,i.setAttribute("position",new tt([0,0,0,0,0,1],3)),this.targetLine=new Tr(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),FA.setFromMatrixPosition(this.light.matrixWorld),If.setFromMatrixPosition(this.light.target.matrixWorld),NA.subVectors(If,FA),this.lightPlane.lookAt(If),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(If),this.targetLine.scale.z=NA.length()}}const Bf=new G,vn=new rm;class zP extends Es{constructor(e){const t=new mt,n=new li({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],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(_,b){u(_),u(b)}function u(_){i.push(0,0,0),r.push(0,0,0),l[_]===void 0&&(l[_]=[]),l[_].push(i.length/3-1)}t.setAttribute("position",new tt(i,3)),t.setAttribute("color",new tt(r,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 h=new we(16755200),d=new we(16711680),p=new we(43775),m=new we(16777215),g=new we(3355443);this.setColors(h,d,p,m,g)}setColors(e,t,n,i,r){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,i.r,i.g,i.b),c.setXYZ(39,i.r,i.g,i.b),c.setXYZ(40,r.r,r.g,r.b),c.setXYZ(41,r.r,r.g,r.b),c.setXYZ(42,r.r,r.g,r.b),c.setXYZ(43,r.r,r.g,r.b),c.setXYZ(44,r.r,r.g,r.b),c.setXYZ(45,r.r,r.g,r.b),c.setXYZ(46,r.r,r.g,r.b),c.setXYZ(47,r.r,r.g,r.b),c.setXYZ(48,r.r,r.g,r.b),c.setXYZ(49,r.r,r.g,r.b),c.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let r,l;if(vn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)r=1,l=0;else if(this.camera.coordinateSystem===Wi)r=-1,l=1;else if(this.camera.coordinateSystem===xa)r=0,l=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Sn("c",t,e,vn,0,0,r),Sn("t",t,e,vn,0,0,l),Sn("n1",t,e,vn,-n,-i,r),Sn("n2",t,e,vn,n,-i,r),Sn("n3",t,e,vn,-n,i,r),Sn("n4",t,e,vn,n,i,r),Sn("f1",t,e,vn,-n,-i,l),Sn("f2",t,e,vn,n,-i,l),Sn("f3",t,e,vn,-n,i,l),Sn("f4",t,e,vn,n,i,l),Sn("u1",t,e,vn,n*.7,i*1.1,r),Sn("u2",t,e,vn,-n*.7,i*1.1,r),Sn("u3",t,e,vn,0,i*2,r),Sn("cf1",t,e,vn,-n,0,l),Sn("cf2",t,e,vn,n,0,l),Sn("cf3",t,e,vn,0,-i,l),Sn("cf4",t,e,vn,0,i,l),Sn("cn1",t,e,vn,-n,0,r),Sn("cn2",t,e,vn,n,0,r),Sn("cn3",t,e,vn,0,-i,r),Sn("cn4",t,e,vn,0,i,r),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Sn(s,e,t,n,i,r,l){Bf.set(i,r,l).unproject(n);const c=e[s];if(c!==void 0){const u=t.getAttribute("position");for(let h=0,d=c.length;h<d;h++)u.setXYZ(c[h],Bf.x,Bf.y,Bf.z)}}const Pf=new Ln;class VP extends Es{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]),i=new Float32Array(8*3),r=new mt;r.setIndex(new Ut(n,1)),r.setAttribute("position",new Ut(i,3)),super(r,new li({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Pf.setFromObject(this.object),Pf.isEmpty())return;const e=Pf.min,t=Pf.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[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(){this.geometry.dispose(),this.material.dispose()}}class WP extends Es{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]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new mt;r.setIndex(new Ut(n,1)),r.setAttribute("position",new tt(i,3)),super(r,new li({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(){this.geometry.dispose(),this.material.dispose()}}class jP extends Tr{constructor(e,t=1,n=16776960){const i=n,r=[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 mt;l.setAttribute("position",new tt(r,3)),l.computeBoundingSphere(),super(l,new li({color:i,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],u=new mt;u.setAttribute("position",new tt(c,3)),u.computeBoundingSphere(),this.add(new An(u,new ji({color:i,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(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const OA=new G;let Lf,f0;class XP extends zt{constructor(e=new G(0,0,1),t=new G(0,0,0),n=1,i=16776960,r=n*.2,l=r*.2){super(),this.type="ArrowHelper",Lf===void 0&&(Lf=new mt,Lf.setAttribute("position",new tt([0,0,0,0,1,0],3)),f0=new qu(.5,1,5,1),f0.translate(0,-.5,0)),this.position.copy(t),this.line=new Tr(Lf,new li({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new An(f0,new ji({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,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{OA.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(OA,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}
11class JP extends Es{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new mt;i.setAttribute("position",new tt(t,3)),i.setAttribute("color",new tt(n,3));const r=new li({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new we,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class YP{constructor(){this.type="ShapePath",this.color=new we,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new gp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,l){return this.currentPath.bezierCurveTo(e,t,n,i,r,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const A=[];for(let S=0,T=y.length;S<T;S++){const B=y[S],R=new da;R.curves=B.curves,A.push(R)}return A}function n(y,A){const S=A.length;let T=!1;for(let B=S-1,R=0;R<S;B=R++){let L=A[B],w=A[R],I=w.x-L.x,O=w.y-L.y;if(Math.abs(O)>Number.EPSILON){if(O<0&&(L=A[R],I=-I,w=A[B],O=-O),y.y<L.y||y.y>w.y)continue;if(y.y===L.y){if(y.x===L.x)return!0}else{const D=O*(y.x-L.x)-I*(y.y-L.y);if(D===0)return!0;if(D<0)continue;T=!T}}else{if(y.y!==L.y)continue;if(w.x<=y.x&&y.x<=L.x||L.x<=y.x&&y.x<=w.x)return!0}}return T}const i=ys.isClockWise,r=this.subPaths;if(r.length===0)return[];let l,c,u;const h=[];if(r.length===1)return c=r[0],u=new da,u.curves=c.curves,h.push(u),h;let d=!i(r[0].getPoints());d=e?!d:d;const p=[],m=[];let g=[],_=0,b;m[_]=void 0,g[_]=[];for(let y=0,A=r.length;y<A;y++)c=r[y],b=c.getPoints(),l=i(b),l=e?!l:l,l?(!d&&m[_]&&_++,m[_]={s:new da,p:b},m[_].s.curves=c.curves,d&&_++,g[_]=[]):g[_].push({h:c,p:b[0]});if(!m[0])return t(r);if(m.length>1){let y=!1,A=0;for(let S=0,T=m.length;S<T;S++)p[S]=[];for(let S=0,T=m.length;S<T;S++){const B=g[S];for(let R=0;R<B.length;R++){const L=B[R];let w=!0;for(let I=0;I<m.length;I++)n(L.p,m[I].p)&&(S!==I&&A++,w?(w=!1,p[I].push(L)):y=!0);w&&p[S].push(L)}}A>0&&y===!1&&(g=p)}let v;for(let y=0,A=m.length;y<A;y++){u=m[y].s,h.push(u),v=g[y];for(let S=0,T=v.length;S<T;S++)u.holes.push(v[S].h)}return h}}class KP extends Ss{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){if(e===void 0){ke("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function qP(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function ZP(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function QP(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function wx(s,e,t,n){const i=$P(n);switch(t){case i_:return s*e;case Pp:return s*e/i.components*i.byteLength;case ju:return s*e/i.components*i.byteLength;case go:return s*e*2/i.components*i.byteLength;case Lp:return s*e*2/i.components*i.byteLength;case s_:return s*e*3/i.components*i.byteLength;case ai:return s*e*4/i.components*i.byteLength;case Dp:return s*e*4/i.components*i.byteLength;case bu:case Au:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Mu:case Su:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Nd:case Ud:return Math.max(s,16)*Math.max(e,8)/4;case Fd:case Od:return Math.max(s,8)*Math.max(e,8)/2;case Gd:case kd:case zd:case Vd:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Hd:case Iu:case Wd:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case jd:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Xd:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case Jd:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case Yd:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Kd:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case qd:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case Zd:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case Qd:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case $d:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case ep:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case tp:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case np:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case ip:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case sp:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case rp:case op:case ap:return Math.ceil(s/4)*Math.ceil(e/4)*16;case lp:case cp:return Math.ceil(s/4)*Math.ceil(e/4)*8;case Bu:case up:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function $P(s){switch(s){case mi:case $x:return{byteLength:1,components:1};case Yl:case e_:case bs:return{byteLength:2,components:1};case Ip:case Bp:return{byteLength:2,components:4};case is:case Rp:case oi:return{byteLength:4,components:1};case t_:case n_:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class eL{static contain(e,t){return qP(e,t)}static cover(e,t){return ZP(e,t)}static fill(e){return QP(e)}static getByteLength(e,t,n,i){return wx(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vu}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vu);/**
12 * @license
13 * Copyright 2010-2026 Three.js Authors
14 * SPDX-License-Identifier: MIT
15 */function Q1(){let s=null,e=!1,t=null,n=null;function i(r,l){t(r,l),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&s!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s!==null&&s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function tL(s){const e=new WeakMap;function t(c,u){const h=c.array,d=c.usage,p=h.byteLength,m=s.createBuffer();s.bindBuffer(u,m),s.bufferData(u,h,d),c.onUploadCallback();let g;if(h instanceof Float32Array)g=s.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)g=s.HALF_FLOAT;else if(h instanceof Uint16Array)c.isFloat16BufferAttribute?g=s.HALF_FLOAT:g=s.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=s.SHORT;else if(h instanceof Uint32Array)g=s.UNSIGNED_INT;else if(h instanceof Int32Array)g=s.INT;else if(h instanceof Int8Array)g=s.BYTE;else if(h instanceof Uint8Array)g=s.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:p}}function n(c,u,h){const d=u.array,p=u.updateRanges;if(s.bindBuffer(h,c),p.length===0)s.bufferSubData(h,0,d);else{p.sort((g,_)=>g.start-_.start);let m=0;for(let g=1;g<p.length;g++){const _=p[m],b=p[g];b.start<=_.start+_.count+1?_.count=Math.max(_.count,b.start+b.count-_.start):(++m,p[m]=b)}p.length=m+1;for(let g=0,_=p.length;g<_;g++){const b=p[g];s.bufferSubData(h,b.start*d.BYTES_PER_ELEMENT,d,b.start,b.count)}u.clearUpdateRanges()}u.onUploadCallback()}function i(c){return c.isInterleavedBufferAttribute&&(c=c.data),e.get(c)}function r(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=e.get(c);u&&(s.deleteBuffer(u.buffer),e.delete(c))}function l(c,u){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){const d=e.get(c);(!d||d.version<c.version)&&e.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}const h=e.get(c);if(h===void 0)e.set(c,t(c,u));else if(h.version<c.version){if(h.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(h.buffer,c,u),h.version=c.version}}return{get:i,remove:r,update:l}}var nL=`#ifdef USE_ALPHAHASH
16	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
17#endif`,iL=`#ifdef USE_ALPHAHASH
18	const float ALPHA_HASH_SCALE = 0.05;
19	float hash2D( vec2 value ) {
20		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
21	}
22	float hash3D( vec3 value ) {
23		return hash2D( vec2( hash2D( value.xy ), value.z ) );
24	}
25	float getAlphaHashThreshold( vec3 position ) {
26		float maxDeriv = max(
27			length( dFdx( position.xyz ) ),
28			length( dFdy( position.xyz ) )
29		);
30		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
31		vec2 pixScales = vec2(
32			exp2( floor( log2( pixScale ) ) ),
33			exp2( ceil( log2( pixScale ) ) )
34		);
35		vec2 alpha = vec2(
36			hash3D( floor( pixScales.x * position.xyz ) ),
37			hash3D( floor( pixScales.y * position.xyz ) )
38		);
39		float lerpFactor = fract( log2( pixScale ) );
40		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
41		float a = min( lerpFactor, 1.0 - lerpFactor );
42		vec3 cases = vec3(
43			x * x / ( 2.0 * a * ( 1.0 - a ) ),
44			( x - 0.5 * a ) / ( 1.0 - a ),
45			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
46		);
47		float threshold = ( x < ( 1.0 - a ) )
48			? ( ( x < a ) ? cases.x : cases.y )
49			: cases.z;
50		return clamp( threshold , 1.0e-6, 1.0 );
51	}
52#endif`,sL=`#ifdef USE_ALPHAMAP
53	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
54#endif`,rL=`#ifdef USE_ALPHAMAP
55	uniform sampler2D alphaMap;
56#endif`,oL=`#ifdef USE_ALPHATEST
57	#ifdef ALPHA_TO_COVERAGE
58	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
59	if ( diffuseColor.a == 0.0 ) discard;
60	#else
61	if ( diffuseColor.a < alphaTest ) discard;
62	#endif
63#endif`,aL=`#ifdef USE_ALPHATEST
64	uniform float alphaTest;
65#endif`,lL=`#ifdef USE_AOMAP
66	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
67	reflectedLight.indirectDiffuse *= ambientOcclusion;
68	#if defined( USE_CLEARCOAT ) 
69		clearcoatSpecularIndirect *= ambientOcclusion;
70	#endif
71	#if defined( USE_SHEEN ) 
72		sheenSpecularIndirect *= ambientOcclusion;
73	#endif
74	#if defined( USE_ENVMAP ) && defined( STANDARD )
75		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
76		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
77	#endif
78#endif`,cL=`#ifdef USE_AOMAP
79	uniform sampler2D aoMap;
80	uniform float aoMapIntensity;
81#endif`,uL=`#ifdef USE_BATCHING
82	#if ! defined( GL_ANGLE_multi_draw )
83	#define gl_DrawID _gl_DrawID
84	uniform int _gl_DrawID;
85	#endif
86	uniform highp sampler2D batchingTexture;
87	uniform highp usampler2D batchingIdTexture;
88	mat4 getBatchingMatrix( const in float i ) {
89		int size = textureSize( batchingTexture, 0 ).x;
90		int j = int( i ) * 4;
91		int x = j % size;
92		int y = j / size;
93		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
94		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
95		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
96		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
97		return mat4( v1, v2, v3, v4 );
98	}
99	float getIndirectIndex( const in int i ) {
100		int size = textureSize( batchingIdTexture, 0 ).x;
101		int x = i % size;
102		int y = i / size;
103		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
104	}
105#endif
106#ifdef USE_BATCHING_COLOR
107	uniform sampler2D batchingColorTexture;
108	vec4 getBatchingColor( const in float i ) {
109		int size = textureSize( batchingColorTexture, 0 ).x;
110		int j = int( i );
111		int x = j % size;
112		int y = j / size;
113		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
114	}
115#endif`,hL=`#ifdef USE_BATCHING
116	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
117#endif`,fL=`vec3 transformed = vec3( position );
118#ifdef USE_ALPHAHASH
119	vPosition = vec3( position );
120#endif`,dL=`vec3 objectNormal = vec3( normal );
121#ifdef USE_TANGENT
122	vec3 objectTangent = vec3( tangent.xyz );
123#endif`,pL=`float G_BlinnPhong_Implicit( ) {
124	return 0.25;
125}
126float D_BlinnPhong( const in float shininess, const in float dotNH ) {
127	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
128}
129vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
130	vec3 halfDir = normalize( lightDir + viewDir );
131	float dotNH = saturate( dot( normal, halfDir ) );
132	float dotVH = saturate( dot( viewDir, halfDir ) );
133	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
134	float G = G_BlinnPhong_Implicit( );
135	float D = D_BlinnPhong( shininess, dotNH );
136	return F * ( G * D );
137} // validated`,mL=`#ifdef USE_IRIDESCENCE
138	const mat3 XYZ_TO_REC709 = mat3(
139		 3.2404542, -0.9692660,  0.0556434,
140		-1.5371385,  1.8760108, -0.2040259,
141		-0.4985314,  0.0415560,  1.0572252
142	);
143	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
144		vec3 sqrtF0 = sqrt( fresnel0 );
145		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
146	}
147	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
148		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
149	}
150	float IorToFresnel0( float transmittedIor, float incidentIor ) {
151		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
152	}
153	vec3 evalSensitivity( float OPD, vec3 shift ) {
154		float phase = 2.0 * PI * OPD * 1.0e-9;
155		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
156		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
157		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
158		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
159		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 ) );
160		xyz /= 1.0685e-7;
161		vec3 rgb = XYZ_TO_REC709 * xyz;
162		return rgb;
163	}
164	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
165		vec3 I;
166		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
167		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
168		float cosTheta2Sq = 1.0 - sinTheta2Sq;
169		if ( cosTheta2Sq < 0.0 ) {
170			return vec3( 1.0 );
171		}
172		float cosTheta2 = sqrt( cosTheta2Sq );
173		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
174		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
175		float T121 = 1.0 - R12;
176		float phi12 = 0.0;
177		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
178		float phi21 = PI - phi12;
179		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
180		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
181		vec3 phi23 = vec3( 0.0 );
182		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
183		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
184		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
185		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
186		vec3 phi = vec3( phi21 ) + phi23;
187		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
188		vec3 r123 = sqrt( R123 );
189		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
190		vec3 C0 = R12 + Rs;
191		I = C0;
192		vec3 Cm = Rs - T121;
193		for ( int m = 1; m <= 2; ++ m ) {
194			Cm *= r123;
195			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
196			I += Cm * Sm;
197		}
198		return max( I, vec3( 0.0 ) );
199	}
200#endif`,gL=`#ifdef USE_BUMPMAP
201	uniform sampler2D bumpMap;
202	uniform float bumpScale;
203	vec2 dHdxy_fwd() {
204		vec2 dSTdx = dFdx( vBumpMapUv );
205		vec2 dSTdy = dFdy( vBumpMapUv );
206		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
207		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
208		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
209		return vec2( dBx, dBy );
210	}
211	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
212		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
213		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
214		vec3 vN = surf_norm;
215		vec3 R1 = cross( vSigmaY, vN );
216		vec3 R2 = cross( vN, vSigmaX );
217		float fDet = dot( vSigmaX, R1 ) * faceDirection;
218		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
219		return normalize( abs( fDet ) * surf_norm - vGrad );
220	}
221#endif`,xL=`#if NUM_CLIPPING_PLANES > 0
222	vec4 plane;
223	#ifdef ALPHA_TO_COVERAGE
224		float distanceToPlane, distanceGradient;
225		float clipOpacity = 1.0;
226		#pragma unroll_loop_start
227		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
228			plane = clippingPlanes[ i ];
229			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
230			distanceGradient = fwidth( distanceToPlane ) / 2.0;
231			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
232			if ( clipOpacity == 0.0 ) discard;
233		}
234		#pragma unroll_loop_end
235		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
236			float unionClipOpacity = 1.0;
237			#pragma unroll_loop_start
238			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
239				plane = clippingPlanes[ i ];
240				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
241				distanceGradient = fwidth( distanceToPlane ) / 2.0;
242				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
243			}
244			#pragma unroll_loop_end
245			clipOpacity *= 1.0 - unionClipOpacity;
246		#endif
247		diffuseColor.a *= clipOpacity;
248		if ( diffuseColor.a == 0.0 ) discard;
249	#else
250		#pragma unroll_loop_start
251		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
252			plane = clippingPlanes[ i ];
253			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
254		}
255		#pragma unroll_loop_end
256		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
257			bool clipped = true;
258			#pragma unroll_loop_start
259			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
260				plane = clippingPlanes[ i ];
261				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
262			}
263			#pragma unroll_loop_end
264			if ( clipped ) discard;
265		#endif
266	#endif
267#endif`,_L=`#if NUM_CLIPPING_PLANES > 0
268	varying vec3 vClipPosition;
269	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
270#endif`,yL=`#if NUM_CLIPPING_PLANES > 0
271	varying vec3 vClipPosition;
272#endif`,vL=`#if NUM_CLIPPING_PLANES > 0
273	vClipPosition = - mvPosition.xyz;
274#endif`,bL=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
275	diffuseColor *= vColor;
276#endif`,AL=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
277	varying vec4 vColor;
278#endif`,ML=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
279	varying vec4 vColor;
280#endif`,SL=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
281	vColor = vec4( 1.0 );
282#endif
283#ifdef USE_COLOR_ALPHA
284	vColor *= color;
285#elif defined( USE_COLOR )
286	vColor.rgb *= color;
287#endif
288#ifdef USE_INSTANCING_COLOR
289	vColor.rgb *= instanceColor.rgb;
290#endif
291#ifdef USE_BATCHING_COLOR
292	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
293#endif`,EL=`#define PI 3.141592653589793
294#define PI2 6.283185307179586
295#define PI_HALF 1.5707963267948966
296#define RECIPROCAL_PI 0.3183098861837907
297#define RECIPROCAL_PI2 0.15915494309189535
298#define EPSILON 1e-6
299#ifndef saturate
300#define saturate( a ) clamp( a, 0.0, 1.0 )
301#endif
302#define whiteComplement( a ) ( 1.0 - saturate( a ) )
303float pow2( const in float x ) { return x*x; }
304vec3 pow2( const in vec3 x ) { return x*x; }
305float pow3( const in float x ) { return x*x*x; }
306float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
307float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
308float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
309highp float rand( const in vec2 uv ) {
310	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
311	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
312	return fract( sin( sn ) * c );
313}
314#ifdef HIGH_PRECISION
315	float precisionSafeLength( vec3 v ) { return length( v ); }
316#else
317	float precisionSafeLength( vec3 v ) {
318		float maxComponent = max3( abs( v ) );
319		return length( v / maxComponent ) * maxComponent;
320	}
321#endif
322struct IncidentLight {
323	vec3 color;
324	vec3 direction;
325	bool visible;
326};
327struct ReflectedLight {
328	vec3 directDiffuse;
329	vec3 directSpecular;
330	vec3 indirectDiffuse;
331	vec3 indirectSpecular;
332};
333#ifdef USE_ALPHAHASH
334	varying vec3 vPosition;
335#endif
336vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
337	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
338}
339vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
340	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
341}
342bool isPerspectiveMatrix( mat4 m ) {
343	return m[ 2 ][ 3 ] == - 1.0;
344}
345vec2 equirectUv( in vec3 dir ) {
346	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
347	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
348	return vec2( u, v );
349}
350vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
351	return RECIPROCAL_PI * diffuseColor;
352}
353vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
354	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
355	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
356}
357float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
358	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
359	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
360} // validated`,TL=`#ifdef ENVMAP_TYPE_CUBE_UV
361	#define cubeUV_minMipLevel 4.0
362	#define cubeUV_minTileSize 16.0
363	float getFace( vec3 direction ) {
364		vec3 absDirection = abs( direction );
365		float face = - 1.0;
366		if ( absDirection.x > absDirection.z ) {
367			if ( absDirection.x > absDirection.y )
368				face = direction.x > 0.0 ? 0.0 : 3.0;
369			else
370				face = direction.y > 0.0 ? 1.0 : 4.0;
371		} else {
372			if ( absDirection.z > absDirection.y )
373				face = direction.z > 0.0 ? 2.0 : 5.0;
374			else
375				face = direction.y > 0.0 ? 1.0 : 4.0;
376		}
377		return face;
378	}
379	vec2 getUV( vec3 direction, float face ) {
380		vec2 uv;
381		if ( face == 0.0 ) {
382			uv = vec2( direction.z, direction.y ) / abs( direction.x );
383		} else if ( face == 1.0 ) {
384			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
385		} else if ( face == 2.0 ) {
386			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
387		} else if ( face == 3.0 ) {
388			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
389		} else if ( face == 4.0 ) {
390			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
391		} else {
392			uv = vec2( direction.x, direction.y ) / abs( direction.z );
393		}
394		return 0.5 * ( uv + 1.0 );
395	}
396	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
397		float face = getFace( direction );
398		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
399		mipInt = max( mipInt, cubeUV_minMipLevel );
400		float faceSize = exp2( mipInt );
401		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
402		if ( face > 2.0 ) {
403			uv.y += faceSize;
404			face -= 3.0;
405		}
406		uv.x += face * faceSize;
407		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
408		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
409		uv.x *= CUBEUV_TEXEL_WIDTH;
410		uv.y *= CUBEUV_TEXEL_HEIGHT;
411		#ifdef texture2DGradEXT
412			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
413		#else
414			return texture2D( envMap, uv ).rgb;
415		#endif
416	}
417	#define cubeUV_r0 1.0
418	#define cubeUV_m0 - 2.0
419	#define cubeUV_r1 0.8
420	#define cubeUV_m1 - 1.0
421	#define cubeUV_r4 0.4
422	#define cubeUV_m4 2.0
423	#define cubeUV_r5 0.305
424	#define cubeUV_m5 3.0
425	#define cubeUV_r6 0.21
426	#define cubeUV_m6 4.0
427	float roughnessToMip( float roughness ) {
428		float mip = 0.0;
429		if ( roughness >= cubeUV_r1 ) {
430			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
431		} else if ( roughness >= cubeUV_r4 ) {
432			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
433		} else if ( roughness >= cubeUV_r5 ) {
434			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
435		} else if ( roughness >= cubeUV_r6 ) {
436			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
437		} else {
438			mip = - 2.0 * log2( 1.16 * roughness );		}
439		return mip;
440	}
441	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
442		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
443		float mipF = fract( mip );
444		float mipInt = floor( mip );
445		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
446		if ( mipF == 0.0 ) {
447			return vec4( color0, 1.0 );
448		} else {
449			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
450			return vec4( mix( color0, color1, mipF ), 1.0 );
451		}
452	}
453#endif`,CL=`vec3 transformedNormal = objectNormal;
454#ifdef USE_TANGENT
455	vec3 transformedTangent = objectTangent;
456#endif
457#ifdef USE_BATCHING
458	mat3 bm = mat3( batchingMatrix );
459	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
460	transformedNormal = bm * transformedNormal;
461	#ifdef USE_TANGENT
462		transformedTangent = bm * transformedTangent;
463	#endif
464#endif
465#ifdef USE_INSTANCING
466	mat3 im = mat3( instanceMatrix );
467	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
468	transformedNormal = im * transformedNormal;
469	#ifdef USE_TANGENT
470		transformedTangent = im * transformedTangent;
471	#endif
472#endif
473transformedNormal = normalMatrix * transformedNormal;
474#ifdef FLIP_SIDED
475	transformedNormal = - transformedNormal;
476#endif
477#ifdef USE_TANGENT
478	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
479	#ifdef FLIP_SIDED
480		transformedTangent = - transformedTangent;
481	#endif
482#endif`,wL=`#ifdef USE_DISPLACEMENTMAP
483	uniform sampler2D displacementMap;
484	uniform float displacementScale;
485	uniform float displacementBias;
486#endif`,RL=`#ifdef USE_DISPLACEMENTMAP
487	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
487placementBias );
488#endif`,IL=`#ifdef USE_EMISSIVEMAP
489	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
490	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
491		emissiveColor = sRGBTransferEOTF( emissiveColor );
492	#endif
493	totalEmissiveRadiance *= emissiveColor.rgb;
494#endif`,BL=`#ifdef USE_EMISSIVEMAP
495	uniform sampler2D emissiveMap;
496#endif`,PL="gl_FragColor = linearToOutputTexel( gl_FragColor );",LL=`vec4 LinearTransferOETF( in vec4 value ) {
497	return value;
498}
499vec4 sRGBTransferEOTF( in vec4 value ) {
500	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 );
501}
502vec4 sRGBTransferOETF( in vec4 value ) {
503	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 );
504}`,DL=`#ifdef USE_ENVMAP
505	#ifdef ENV_WORLDPOS
506		vec3 cameraToFrag;
507		if ( isOrthographic ) {
508			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
509		} else {
510			cameraToFrag = normalize( vWorldPosition - cameraPosition );
511		}
512		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
513		#ifdef ENVMAP_MODE_REFLECTION
514			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
515		#else
516			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
517		#endif
518	#else
519		vec3 reflectVec = vReflect;
520	#endif
521	#ifdef ENVMAP_TYPE_CUBE
522		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
523		#ifdef ENVMAP_BLENDING_MULTIPLY
524			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
525		#elif defined( ENVMAP_BLENDING_MIX )
526			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
527		#elif defined( ENVMAP_BLENDING_ADD )
528			outgoingLight += envColor.xyz * specularStrength * reflectivity;
529		#endif
530	#endif
531#endif`,FL=`#ifdef USE_ENVMAP
532	uniform float envMapIntensity;
533	uniform mat3 envMapRotation;
534	#ifdef ENVMAP_TYPE_CUBE
535		uniform samplerCube envMap;
536	#else
537		uniform sampler2D envMap;
538	#endif
539#endif`,NL=`#ifdef USE_ENVMAP
540	uniform float reflectivity;
541	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
542		#define ENV_WORLDPOS
543	#endif
544	#ifdef ENV_WORLDPOS
545		varying vec3 vWorldPosition;
546		uniform float refractionRatio;
547	#else
548		varying vec3 vReflect;
549	#endif
550#endif`,OL=`#ifdef USE_ENVMAP
551	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
552		#define ENV_WORLDPOS
553	#endif
554	#ifdef ENV_WORLDPOS
555		
556		varying vec3 vWorldPosition;
557	#else
558		varying vec3 vReflect;
559		uniform float refractionRatio;
560	#endif
561#endif`,UL=`#ifdef USE_ENVMAP
562	#ifdef ENV_WORLDPOS
563		vWorldPosition = worldPosition.xyz;
564	#else
565		vec3 cameraToVertex;
566		if ( isOrthographic ) {
567			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
568		} else {
569			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
570		}
571		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
572		#ifdef ENVMAP_MODE_REFLECTION
573			vReflect = reflect( cameraToVertex, worldNormal );
574		#else
575			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
576		#endif
577	#endif
578#endif`,GL=`#ifdef USE_FOG
579	vFogDepth = - mvPosition.z;
580#endif`,kL=`#ifdef USE_FOG
581	varying float vFogDepth;
582#endif`,HL=`#ifdef USE_FOG
583	#ifdef FOG_EXP2
584		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
585	#else
586		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
587	#endif
588	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
589#endif`,zL=`#ifdef USE_FOG
590	uniform vec3 fogColor;
591	varying float vFogDepth;
592	#ifdef FOG_EXP2
593		uniform float fogDensity;
594	#else
595		uniform float fogNear;
596		uniform float fogFar;
597	#endif
598#endif`,VL=`#ifdef USE_GRADIENTMAP
599	uniform sampler2D gradientMap;
600#endif
601vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
602	float dotNL = dot( normal, lightDirection );
603	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
604	#ifdef USE_GRADIENTMAP
605		return vec3( texture2D( gradientMap, coord ).r );
606	#else
607		vec2 fw = fwidth( coord ) * 0.5;
608		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
609	#endif
610}`,WL=`#ifdef USE_LIGHTMAP
611	uniform sampler2D lightMap;
612	uniform float lightMapIntensity;
613#endif`,jL=`LambertMaterial material;
614material.diffuseColor = diffuseColor.rgb;
615material.specularStrength = specularStrength;`,XL=`varying vec3 vViewPosition;
616struct LambertMaterial {
617	vec3 diffuseColor;
618	float specularStrength;
619};
620void 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 ) {
621	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
622	vec3 irradiance = dotNL * directLight.color;
623	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
624}
625void 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 ) {
626	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
627}
628#define RE_Direct				RE_Direct_Lambert
629#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,JL=`uniform bool receiveShadow;
630uniform vec3 ambientLightColor;
631#if defined( USE_LIGHT_PROBES )
632	uniform vec3 lightProbe[ 9 ];
633#endif
634vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
635	float x = normal.x, y = normal.y, z = normal.z;
636	vec3 result = shCoefficients[ 0 ] * 0.886227;
637	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
638	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
639	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
640	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
641	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
642	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
643	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
644	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
645	return result;
646}
647vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
648	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
649	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
650	return irradiance;
651}
652vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
653	vec3 irradiance = ambientLightColor;
654	return irradiance;
655}
656float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
657	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
658	if ( cutoffDistance > 0.0 ) {
659		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
660	}
661	return distanceFalloff;
662}
663float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
664	return smoothstep( coneCosine, penumbraCosine, angleCosine );
665}
666#if NUM_DIR_LIGHTS > 0
667	struct DirectionalLight {
668		vec3 direction;
669		vec3 color;
670	};
671	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
672	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
673		light.color = directionalLight.color;
674		light.direction = directionalLight.direction;
675		light.visible = true;
676	}
677#endif
678#if NUM_POINT_LIGHTS > 0
679	struct PointLight {
680		vec3 position;
681		vec3 color;
682		float distance;
683		float decay;
684	};
685	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
686	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
687		vec3 lVector = pointLight.position - geometryPosition;
688		light.direction = normalize( lVector );
689		float lightDistance = length( lVector );
690		light.color = pointLight.color;
691		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
692		light.visible = ( light.color != vec3( 0.0 ) );
693	}
694#endif
695#if NUM_SPOT_LIGHTS > 0
696	struct SpotLight {
697		vec3 position;
698		vec3 direction;
699		vec3 color;
700		float distance;
701		float decay;
702		float coneCos;
703		float penumbraCos;
704	};
705	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
706	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
707		vec3 lVector = spotLight.position - geometryPosition;
708		light.direction = normalize( lVector );
709		float angleCos = dot( light.direction, spotLight.direction );
710		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
711		if ( spotAttenuation > 0.0 ) {
712			float lightDistance = length( lVector );
713			light.color = spotLight.color * spotAttenuation;
714			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
715			light.visible = ( light.color != vec3( 0.0 ) );
716		} else {
717			light.color = vec3( 0.0 );
718			light.visible = false;
719		}
720	}
721#endif
722#if NUM_RECT_AREA_LIGHTS > 0
723	struct RectAreaLight {
724		vec3 color;
725		vec3 position;
726		vec3 halfWidth;
727		vec3 halfHeight;
728	};
729	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
730	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
731#endif
732#if NUM_HEMI_LIGHTS > 0
733	struct HemisphereLight {
734		vec3 direction;
735		vec3 skyColor;
736		vec3 groundColor;
737	};
738	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
739	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
740		float dotNL = dot( normal, hemiLight.direction );
741		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
742		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
743		return irradiance;
744	}
745#endif
746#include <lightprobes_pars_fragment>`,YL=`#ifdef USE_ENVMAP
747	vec3 getIBLIrradiance( const in vec3 normal ) {
748		#ifdef ENVMAP_TYPE_CUBE_UV
749			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
750			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
751			return PI * envMapColor.rgb * envMapIntensity;
752		#else
753			return vec3( 0.0 );
754		#endif
755	}
756	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
757		#ifdef ENVMAP_TYPE_CUBE_UV
758			vec3 reflectVec = reflect( - viewDir, normal );
759			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
760			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
761			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
762			return envMapColor.rgb * envMapIntensity;
763		#else
764			return vec3( 0.0 );
765		#endif
766	}
767	#ifdef USE_ANISOTROPY
768		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
769			#ifdef ENVMAP_TYPE_CUBE_UV
770				vec3 bentNormal = cross( bitangent, viewDir );
771				bentNormal = normalize( cross( bentNormal, bitangent ) );
772				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
773				return getIBLRadiance( viewDir, bentNormal, roughness );
774			#else
775				return vec3( 0.0 );
776			#endif
777		}
778	#endif
779#endif`,KL=`ToonMaterial material;
780material.diffuseColor = diffuseColor.rgb;`,qL=`varying vec3 vViewPosition;
781struct ToonMaterial {
782	vec3 diffuseColor;
783};
784void 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 ) {
785	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
786	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
787}
788void 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 ) {
789	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
790}
791#define RE_Direct				RE_Direct_Toon
792#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,ZL=`BlinnPhongMaterial material;
793material.diffuseColor = diffuseColor.rgb;
794material.specularColor = specular;
795material.specularShininess = shininess;
796material.specularStrength = specularStrength;`,QL=`varying vec3 vViewPosition;
797struct BlinnPhongMaterial {
798	vec3 diffuseColor;
799	vec3 specularColor;
800	float specularShininess;
801	float specularStrength;
802};
803void 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 ) {
804	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
805	vec3 irradiance = dotNL * directLight.color;
806	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
807	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
808}
809void 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 ) {
810	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
811}
812#define RE_Direct				RE_Direct_BlinnPhong
813#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,$L=`PhysicalMaterial material;
814material.diffuseColor = diffuseColor.rgb;
815material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
816material.metalness = metalnessFactor;
817vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
818float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
819material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
820material.roughness = min( material.roughness, 1.0 );
821#ifdef IOR
822	material.ior = ior;
823	#ifdef USE_SPECULAR
824		float specularIntensityFactor = specularIntensity;
825		vec3 specularColorFactor = specularColor;
826		#ifdef USE_SPECULAR_COLORMAP
827			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
828		#endif
829		#ifdef USE_SPECULAR_INTENSITYMAP
830			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
831		#endif
832		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
833	#else
834		float specularIntensityFactor = 1.0;
835		vec3 specularColorFactor = vec3( 1.0 );
836		material.specularF90 = 1.0;
837	#endif
838	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
839	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
840#else
841	material.specularColor = vec3( 0.04 );
842	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
843	material.specularF90 = 1.0;
844#endif
845#ifdef USE_CLEARCOAT
846	material.clearcoat = clearcoat;
847	material.clearcoatRoughness = clearcoatRoughness;
848	material.clearcoatF0 = vec3( 0.04 );
849	material.clearcoatF90 = 1.0;
850	#ifdef USE_CLEARCOATMAP
851		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
852	#endif
853	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
854		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
855	#endif
856	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
857	material.clearcoatRoughness += geometryRoughness;
858	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
859#endif
860#ifdef USE_DISPERSION
861	material.dispersion = dispersion;
862#endif
863#ifdef USE_IRIDESCENCE
864	material.iridescence = iridescence;
865	material.iridescenceIOR = iridescenceIOR;
866	#ifdef USE_IRIDESCENCEMAP
867		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
868	#endif
869	#ifdef USE_IRIDESCENCE_THICKNESSMAP
870		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
871	#else
872		material.iridescenceThickness = iridescenceThicknessMaximum;
873	#endif
874#endif
875#ifdef USE_SHEEN
876	material.sheenColor = sheenColor;
877	#ifdef USE_SHEEN_COLORMAP
878		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
879	#endif
880	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
881	#ifdef USE_SHEEN_ROUGHNESSMAP
882		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
883	#endif
884#endif
885#ifdef USE_ANISOTROPY
886	#ifdef USE_ANISOTROPYMAP
887		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
888		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
889		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
890	#else
891		vec2 anisotropyV = anisotropyVector;
892	#endif
893	material.anisotropy = length( anisotropyV );
894	if( material.anisotropy == 0.0 ) {
895		anisotropyV = vec2( 1.0, 0.0 );
896	} else {
897		anisotropyV /= material.anisotropy;
898		material.anisotropy = saturate( material.anisotropy );
899	}
900	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
901	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
902	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
903#endif`,e3=`uniform sampler2D dfgLUT;
904struct PhysicalMaterial {
905	vec3 diffuseColor;
906	vec3 diffuseContribution;
907	vec3 specularColor;
908	vec3 specularColorBlended;
909	float roughness;
910	float metalness;
911	float specularF90;
912	float dispersion;
913	#ifdef USE_CLEARCOAT
914		float clearcoat;
915		float clearcoatRoughness;
916		vec3 clearcoatF0;
917		float clearcoatF90;
918	#endif
919	#ifdef USE_IRIDESCENCE
920		float iridescence;
921		float iridescenceIOR;
922		float iridescenceThickness;
923		vec3 iridescenceFresnel;
924		vec3 iridescenceF0;
925		vec3 iridescenceFresnelDielectric;
926		vec3 iridescenceFresnelMetallic;
927	#endif
928	#ifdef USE_SHEEN
929		vec3 sheenColor;
930		float sheenRoughness;
931	#endif
932	#ifdef IOR
933		float ior;
934	#endif
935	#ifdef USE_TRANSMISSION
936		float transmission;
937		float transmissionAlpha;
938		float thickness;
939		float attenuationDistance;
940		vec3 attenuationColor;
941	#endif
942	#ifdef USE_ANISOTROPY
943		float anisotropy;
944		float alphaT;
945		vec3 anisotropyT;
946		vec3 anisotropyB;
947	#endif
948};
949vec3 clearcoatSpecularDirect = vec3( 0.0 );
950vec3 clearcoatSpecularIndirect = vec3( 0.0 );
951vec3 sheenSpecularDirect = vec3( 0.0 );
952vec3 sheenSpecularIndirect = vec3(0.0 );
953vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
954    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
955    float x2 = x * x;
956    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
957    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
958}
959float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
960	float a2 = pow2( alpha );
961	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
962	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
963	return 0.5 / max( gv + gl, EPSILON );
964}
965float D_GGX( const in float alpha, const in float dotNH ) {
966	float a2 = pow2( alpha );
967	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
968	return RECIPROCAL_PI * a2 / pow2( denom );
969}
970#ifdef USE_ANISOTROPY
971	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 ) {
972		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
973		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
974		return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 974-1133
974;
975	}
976	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
977		float a2 = alphaT * alphaB;
978		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
979		highp float v2 = dot( v, v );
980		float w2 = a2 / v2;
981		return RECIPROCAL_PI * a2 * pow2 ( w2 );
982	}
983#endif
984#ifdef USE_CLEARCOAT
985	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
986		vec3 f0 = material.clearcoatF0;
987		float f90 = material.clearcoatF90;
988		float roughness = material.clearcoatRoughness;
989		float alpha = pow2( roughness );
990		vec3 halfDir = normalize( lightDir + viewDir );
991		float dotNL = saturate( dot( normal, lightDir ) );
992		float dotNV = saturate( dot( normal, viewDir ) );
993		float dotNH = saturate( dot( normal, halfDir ) );
994		float dotVH = saturate( dot( viewDir, halfDir ) );
995		vec3 F = F_Schlick( f0, f90, dotVH );
996		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
997		float D = D_GGX( alpha, dotNH );
998		return F * ( V * D );
999	}
1000#endif
1001vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1002	vec3 f0 = material.specularColorBlended;
1003	float f90 = material.specularF90;
1004	float roughness = material.roughness;
1005	float alpha = pow2( roughness );
1006	vec3 halfDir = normalize( lightDir + viewDir );
1007	float dotNL = saturate( dot( normal, lightDir ) );
1008	float dotNV = saturate( dot( normal, viewDir ) );
1009	float dotNH = saturate( dot( normal, halfDir ) );
1010	float dotVH = saturate( dot( viewDir, halfDir ) );
1011	vec3 F = F_Schlick( f0, f90, dotVH );
1012	#ifdef USE_IRIDESCENCE
1013		F = mix( F, material.iridescenceFresnel, material.iridescence );
1014	#endif
1015	#ifdef USE_ANISOTROPY
1016		float dotTL = dot( material.anisotropyT, lightDir );
1017		float dotTV = dot( material.anisotropyT, viewDir );
1018		float dotTH = dot( material.anisotropyT, halfDir );
1019		float dotBL = dot( material.anisotropyB, lightDir );
1020		float dotBV = dot( material.anisotropyB, viewDir );
1021		float dotBH = dot( material.anisotropyB, halfDir );
1022		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1023		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1024	#else
1025		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1026		float D = D_GGX( alpha, dotNH );
1027	#endif
1028	return F * ( V * D );
1029}
1030vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1031	const float LUT_SIZE = 64.0;
1032	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1033	const float LUT_BIAS = 0.5 / LUT_SIZE;
1034	float dotNV = saturate( dot( N, V ) );
1035	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1036	uv = uv * LUT_SCALE + LUT_BIAS;
1037	return uv;
1038}
1039float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1040	float l = length( f );
1041	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1042}
1043vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1044	float x = dot( v1, v2 );
1045	float y = abs( x );
1046	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1047	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1048	float v = a / b;
1049	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1050	return cross( v1, v2 ) * theta_sintheta;
1051}
1052vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1053	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1054	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1055	vec3 lightNormal = cross( v1, v2 );
1056	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1057	vec3 T1, T2;
1058	T1 = normalize( V - N * dot( V, N ) );
1059	T2 = - cross( N, T1 );
1060	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1061	vec3 coords[ 4 ];
1062	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1063	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1064	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1065	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1066	coords[ 0 ] = normalize( coords[ 0 ] );
1067	coords[ 1 ] = normalize( coords[ 1 ] );
1068	coords[ 2 ] = normalize( coords[ 2 ] );
1069	coords[ 3 ] = normalize( coords[ 3 ] );
1070	vec3 vectorFormFactor = vec3( 0.0 );
1071	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1072	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1073	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1074	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1075	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1076	return vec3( result );
1077}
1078#if defined( USE_SHEEN )
1079float D_Charlie( float roughness, float dotNH ) {
1080	float alpha = pow2( roughness );
1081	float invAlpha = 1.0 / alpha;
1082	float cos2h = dotNH * dotNH;
1083	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1084	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1085}
1086float V_Neubelt( float dotNV, float dotNL ) {
1087	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1088}
1089vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1090	vec3 halfDir = normalize( lightDir + viewDir );
1091	float dotNL = saturate( dot( normal, lightDir ) );
1092	float dotNV = saturate( dot( normal, viewDir ) );
1093	float dotNH = saturate( dot( normal, halfDir ) );
1094	float D = D_Charlie( sheenRoughness, dotNH );
1095	float V = V_Neubelt( dotNV, dotNL );
1096	return sheenColor * ( D * V );
1097}
1098#endif
1099float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1100	float dotNV = saturate( dot( normal, viewDir ) );
1101	float r2 = roughness * roughness;
1102	float rInv = 1.0 / ( roughness + 0.1 );
1103	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1104	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1105	float DG = exp( a * dotNV + b );
1106	return saturate( DG );
1107}
1108vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1109	float dotNV = saturate( dot( normal, viewDir ) );
1110	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1111	return specularColor * fab.x + specularF90 * fab.y;
1112}
1113#ifdef USE_IRIDESCENCE
1114void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1115#else
1116void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1117#endif
1118	float dotNV = saturate( dot( normal, viewDir ) );
1119	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1120	#ifdef USE_IRIDESCENCE
1121		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1122	#else
1123		vec3 Fr = specularColor;
1124	#endif
1125	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1126	float Ess = fab.x + fab.y;
1127	float Ems = 1.0 - Ess;
1128	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1129	singleScatter += FssEss;
1130	multiScatter += Fms * Ems;
1131}
1132vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1133	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1134-1263
1134	float dotNL = saturate( dot( normal, lightDir ) );
1135	float dotNV = saturate( dot( normal, viewDir ) );
1136	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1137	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1138	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1139	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1140	float Ess_V = dfgV.x + dfgV.y;
1141	float Ess_L = dfgL.x + dfgL.y;
1142	float Ems_V = 1.0 - Ess_V;
1143	float Ems_L = 1.0 - Ess_L;
1144	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1145	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1146	float compensationFactor = Ems_V * Ems_L;
1147	vec3 multiScatter = Fms * compensationFactor;
1148	return singleScatter + multiScatter;
1149}
1150#if NUM_RECT_AREA_LIGHTS > 0
1151	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 ) {
1152		vec3 normal = geometryNormal;
1153		vec3 viewDir = geometryViewDir;
1154		vec3 position = geometryPosition;
1155		vec3 lightPos = rectAreaLight.position;
1156		vec3 halfWidth = rectAreaLight.halfWidth;
1157		vec3 halfHeight = rectAreaLight.halfHeight;
1158		vec3 lightColor = rectAreaLight.color;
1159		float roughness = material.roughness;
1160		vec3 rectCoords[ 4 ];
1161		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1162		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1163		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1164		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1165		vec4 t1 = texture2D( ltc_1, uv );
1166		vec4 t2 = texture2D( ltc_2, uv );
1167		mat3 mInv = mat3(
1168			vec3( t1.x, 0, t1.y ),
1169			vec3(    0, 1,    0 ),
1170			vec3( t1.z, 0, t1.w )
1171		);
1172		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1173		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1174		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1175		#ifdef USE_CLEARCOAT
1176			vec3 Ncc = geometryClearcoatNormal;
1177			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1178			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1179			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1180			mat3 mInvClearcoat = mat3(
1181				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1182				vec3(             0, 1,             0 ),
1183				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1184			);
1185			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1186			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1187		#endif
1188	}
1189#endif
1190void 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 ) {
1191	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1192	vec3 irradiance = dotNL * directLight.color;
1193	#ifdef USE_CLEARCOAT
1194		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1195		vec3 ccIrradiance = dotNLcc * directLight.color;
1196		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1197	#endif
1198	#ifdef USE_SHEEN
1199 
1200 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1201 
1202 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1203 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1204 
1205 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1206 
1207 		irradiance *= sheenEnergyComp;
1208 
1209 	#endif
1210	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1211	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1212}
1213void 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 ) {
1214	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1215	#ifdef USE_SHEEN
1216		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1217		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1218		diffuse *= sheenEnergyComp;
1219	#endif
1220	reflectedLight.indirectDiffuse += diffuse;
1221}
1222void 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) {
1223	#ifdef USE_CLEARCOAT
1224		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1225	#endif
1226	#ifdef USE_SHEEN
1227		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1228 	#endif
1229	vec3 singleScatteringDielectric = vec3( 0.0 );
1230	vec3 multiScatteringDielectric = vec3( 0.0 );
1231	vec3 singleScatteringMetallic = vec3( 0.0 );
1232	vec3 multiScatteringMetallic = vec3( 0.0 );
1233	#ifdef USE_IRIDESCENCE
1234		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1235		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1236	#else
1237		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1238		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1239	#endif
1240	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1241	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1242	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1243	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1244	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1245	vec3 indirectSpecular = radiance * singleScattering;
1246	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1247	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1248	#ifdef USE_SHEEN
1249		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1250		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1251		indirectSpecular *= sheenEnergyComp;
1252		indirectDiffuse *= sheenEnergyComp;
1253	#endif
1254	reflectedLight.indirectSpecular += indirectSpecular;
1255	reflectedLight.indirectDiffuse += indirectDiffuse;
1256}
1257#define RE_Direct				RE_Direct_Physical
1258#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1259#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1260#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1261float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1262	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1263}`,
1263t3=`
1264vec3 geometryPosition = - vViewPosition;
1265vec3 geometryNormal = normal;
1266vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1267vec3 geometryClearcoatNormal = vec3( 0.0 );
1268#ifdef USE_CLEARCOAT
1269	geometryClearcoatNormal = clearcoatNormal;
1270#endif
1271#ifdef USE_IRIDESCENCE
1272	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1273	if ( material.iridescenceThickness == 0.0 ) {
1274		material.iridescence = 0.0;
1275	} else {
1276		material.iridescence = saturate( material.iridescence );
1277	}
1278	if ( material.iridescence > 0.0 ) {
1279		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1280		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1281		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1282		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1283	}
1284#endif
1285IncidentLight directLight;
1286#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1287	PointLight pointLight;
1288	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1289	PointLightShadow pointLightShadow;
1290	#endif
1291	#pragma unroll_loop_start
1292	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1293		pointLight = pointLights[ i ];
1294		getPointLightInfo( pointLight, geometryPosition, directLight );
1295		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1296		pointLightShadow = pointLightShadows[ i ];
1297		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1298		#endif
1299		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1300	}
1301	#pragma unroll_loop_end
1302#endif
1303#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1304	SpotLight spotLight;
1305	vec4 spotColor;
1306	vec3 spotLightCoord;
1307	bool inSpotLightMap;
1308	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1309	SpotLightShadow spotLightShadow;
1310	#endif
1311	#pragma unroll_loop_start
1312	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1313		spotLight = spotLights[ i ];
1314		getSpotLightInfo( spotLight, geometryPosition, directLight );
1315		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1316		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1317		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1318		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1319		#else
1320		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1321		#endif
1322		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1323			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1324			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1325			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1326			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1327		#endif
1328		#undef SPOT_LIGHT_MAP_INDEX
1329		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1330		spotLightShadow = spotLightShadows[ i ];
1331		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1332		#endif
1333		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1334	}
1335	#pragma unroll_loop_end
1336#endif
1337#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1338	DirectionalLight directionalLight;
1339	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1340	DirectionalLightShadow directionalLightShadow;
1341	#endif
1342	#pragma unroll_loop_start
1343	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1344		directionalLight = directionalLights[ i ];
1345		getDirectionalLightInfo( directionalLight, directLight );
1346		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1347		directionalLightShadow = directionalLightShadows[ i ];
1348		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1349		#endif
1350		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1351	}
1352	#pragma unroll_loop_end
1353#endif
1354#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1355	RectAreaLight rectAreaLight;
1356	#pragma unroll_loop_start
1357	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1358		rectAreaLight = rectAreaLights[ i ];
1359		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1360	}
1361	#pragma unroll_loop_end
1362#endif
1363#if defined( RE_IndirectDiffuse )
1364	vec3 iblIrradiance = vec3( 0.0 );
1365	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1366	#if defined( USE_LIGHT_PROBES )
1367		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1368	#endif
1369	#if ( NUM_HEMI_LIGHTS > 0 )
1370		#pragma unroll_loop_start
1371		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1372			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1373		}
1374		#pragma unroll_loop_end
1375	#endif
1376	#ifdef USE_LIGHT_PROBES_GRID
1377		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1378		vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );
1379		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1380	#endif
1381#endif
1382#if defined( RE_IndirectSpecular )
1383	vec3 radiance = vec3( 0.0 );
1384	vec3 clearcoatRadiance = vec3( 0.0 );
1385#endif`,n3=`#if defined( RE_IndirectDiffuse )
1386	#ifdef USE_LIGHTMAP
1387		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1388		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1389		irradiance += lightMapIrradiance;
1390	#endif
1391	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1392		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1393			iblIrradiance += getIBLIrradiance( geometryNormal );
1394		#endif
1395	#endif
1396#endif
1397#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1398	#ifdef USE_ANISOTROPY
1399		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1400	#else
1401		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1402	#endif
1403	#ifdef USE_CLEARCOAT
1404		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1405	#endif
1406#endif`,i3=`#if defined( RE_IndirectDiffuse )
1407	#if defined( LAMBERT ) || defined( PHONG )
1408		irradiance += iblIrradiance;
1409	#endif
1410	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1411#endif
1412#if defined( RE_IndirectSpecular )
1413	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1414#endif`,s3=`#ifdef USE_LIGHT_PROBES_GRID
1415uniform highp sampler3D probesSH;
1416uniform vec3 probesMin;
1417uniform vec3 probesMax;
1418uniform vec3 probesResolution;
1419vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1420	vec3 res = probesResolution;
1421	vec3 gridRange = probesMax - probesMin;
1422	vec3 resMinusOne = res - 1.0;
1423	vec3 probeSpacing = gridRange / resMinusOne;
1424	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1425	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1426	uvw = uvw * resMinusOne / res + 0.5 / res;
1427	float nz          = res.z;
1428	float paddedSlices = nz + 2.0;
1429	float atlasDepth  = 7.0 * paddedSlices;
1430	float uvZBase     = uvw.z * nz + 1.0;
1431	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
1432	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
1433	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
1434	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
1435	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
1436	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
1437	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
1438	vec3 c0 = s0.xyz;
1439	vec3 c1 = vec3( s0.w, s1.xy );
1440	vec3 c2 = vec3( s1.zw, s2.x );
1441	vec3 c3 = s2.yzw;
1442	vec3 c4 = s3.xyz;
1443	vec3 c5 = vec3( s3.w, s4.xy );
1444	vec3 c6 = vec3( s4.zw, s5.x );
1445	vec3 c7 = s5.yzw;
1446	vec3 c8 = s6.xyz;
1447	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1448	vec3 result = c0 * 0.886227;
1449	result += c1 * 2.0 * 0.511664 * y;
1450	result += c2 * 2.0 * 0.511664 * z;
1451	result += c3 * 2.0 * 0.511664 * x;
1452	result += c4 * 2.0 * 0.429043 * x * y;
1453	result += c5 * 2.0 * 0.429043 * y * z;
1454	result += c6 * ( 0.743125 * z * z - 0.247708 );
1455	result += c7 * 2.0 * 0.429043 * x * z;
1456	result += c8 * 0.429043 * ( x * x - y * y );
1457	return max( result, vec3( 0.0 ) );
1458}
1459#endif`,r3=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1460	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1461#endif`,o3=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1462	uniform float logDepthBufFC;
1463	varying float vFragDepth;
1464	varying float vIsPerspective;
1465#endif`,a3=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1466	varying float vFragDepth;
1467	varying float vIsPerspective;
1468#endif`,l3=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1469	vFragDepth = 1.0 + gl_Position.w;
1470	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1471#endif`,c3=`#ifdef USE_MAP
1472	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1473	#ifdef DECODE_VIDEO_TEXTURE
1474		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1475	#endif
1476	diffuseColor *= sampledDiffuseColor;
1477#endif`,u3=`#ifdef USE_MAP
1478	uniform sampler2D map;
1479#endif`,h3=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1480	#if defined( USE_POINTS_UV )
1481		vec2 uv = vUv;
1482	#else
1483		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1484	#endif
1485#endif
1486#ifdef USE_MAP
1487	diffuseColor *= texture2D( map, uv );
1488#endif
1489#ifdef USE_ALPHAMAP
1490	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1491#endif`,f3=`#if defined( USE_POINTS_UV )
1492	varying vec2 vUv;
1493#else
1494	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1495		uniform mat3 uvTransform;
1496	#endif
1497#endif
1498#ifdef USE_MAP
1499	uniform sampler2D map;
1500#endif
1501#ifdef USE_ALPHAMAP
1502	uniform sampler2D alphaMap;
1503#endif`,d3=`float metalnessFactor = metalness;
1504#ifdef USE_METALNESSMAP
1505	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1506	metalnessFactor *= texelMetalness.b;
1507#endif`,p3=`#ifdef USE_METALNESSMAP
1508	uniform sampler2D metalnessMap;
1509#endif`,m3=`#ifdef USE_INSTANCING_MORPH
1510	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1511	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1512	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1513		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1514	}
1515#endif`,g3=`#if defined( USE_MORPHCOLORS )
1516	vColor *= morphTargetBaseInfluence;
1517	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1518		#if defined( USE_COLOR_ALPHA )
1519			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1520		#elif defined( USE_COLOR )
1521			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1522		#endif
1523	}
1524#endif`,x3=`#ifdef USE_MORPHNORMALS
1525	objectNormal *= morphTargetBaseInfluence;
1526	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1527		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1528	}
1529#endif`,_3=`#ifdef USE_MORPHTARGETS
1530	#ifndef USE_INSTANCING_MORPH
1531		uniform float morphTargetBaseInfluence;
1532		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1533	#endif
1534	uniform sampler2DArray morphTargetsTexture;
1535	uniform ivec2 morphTargetsTextureSize;
1536	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1537		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1538		int y = texelIndex / morphTargetsTextureSize.x;
1539		int x = texelIndex - y * morphTargetsTextureSize.x;
1540		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1541		return texelFetch( morphTargetsTexture, morphUV, 0 );
1542	}
1543#endif`,y3=`#ifdef USE_MORPHTARGETS
1544	transformed *= morphTargetBaseInfluence;
1545	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1546		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1547	}
1548#endif`,v3=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1549#ifdef FLAT_SHADED
1550	vec3 fdx = dFdx( vViewPosition );
1551	vec3 fdy = dFdy( vViewPosition );
1552	vec3 normal = normalize( cross( fdx, fdy ) );
1553#else
1554	vec3 normal = normalize( vNormal );
1555	#ifdef DOUBLE_SIDED
1556		normal *= faceDirection;
1557	#endif
1558#endif
1559#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1560	#ifdef USE_TANGENT
1561		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1562	#else
1563		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1564		#if defined( USE_NORMALMAP )
1565			vNormalMapUv
1566		#elif defined( USE_CLEARCOAT_NORMALMAP )
1567			vClearcoatNormalMapUv
1568		#else
1569			vUv
1570		#endif
1571		);
1572	#endif
1573	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1574		tbn[0] *= faceDirection;
1575		tbn[1] *= faceDirection;
1576	#endif
1577#endif
1578#ifdef USE_CLEARCOAT_NORMALMAP
1579	#ifdef USE_TANGENT
1580		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1581	#else
1582		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1583	#endif
1584	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1585		tbn2[0] *= faceDirection;
1586		tbn2[1] *= faceDirection;
1587	#endif
1588#endif
1589vec3 nonPerturbedNormal = normal;`,b3=`#ifdef USE_NORMALMAP_OBJECTSPACE
1590	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1591	#ifdef FLIP_SIDED
1592		normal = - normal;
1593	#endif
1594	#ifdef DOUBLE_SIDED
1595		normal = normal * faceDirection;
1596	#endif
1597	normal = normalize( normalMatrix * normal );
1598#elif defined( USE_NORMALMAP_TANGENTSPACE )
1599	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1600	#if defined( USE_PACKED_NORMALMAP )
1601		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1602	#endif
1603	mapN.xy *= normalScale;
1604	normal = normalize( tbn * mapN );
1605#elif defined( USE_BUMPMAP )
1606	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1607#endif`,A3=`#ifndef FLAT_SHADED
1608	varying vec3 vNormal;
1609	#ifdef USE_TANGENT
1610		varying vec3 vTangent;
1611		varying vec3 vBitangent;
1612	#endif
1613#endif`,M3=`#ifndef FLAT_SHADED
1614	varying vec3 vNormal;
1615	#ifdef USE_TANGENT
1616		varying vec3 vTangent;
1617		varying vec3 vBitangent;
1618	#endif
1619#endif`,S3=`#ifndef FLAT_SHADED
1620	vNormal = normalize( transformedNormal );
1621	#ifdef USE_TANGENT
1622		vTangent = normalize( transformedTangent );
1623		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1624	#endif
1625#endif`,E3=`#ifdef USE_NORMALMAP
1626	uniform sampler2D normalMap;
1627	uniform vec2 normalScale;
1628#endif
1629#ifdef USE_NORMALMAP_OBJECTSPACE
1630	uniform mat3 normalMatrix;
1631#endif
1632#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1633	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1634		vec3 q0 = dFdx( eye_pos.xyz );
1635		vec3 q1 = dFdy( eye_pos.xyz );
1636		vec2 st0 = dFdx( uv.st );
1637		vec2 st1 = dFdy( uv.st );
1638		vec3 N = surf_norm;
1639		vec3 q1perp = cross( q1, N );
1640		vec3 q0perp = cross( N, q0 );
1641		vec3 T = q1perp * st0.x + q0perp * st1.x;
1642		vec3 B = q1perp * st0.y + q0perp * st1.y;
1643		float det = max( dot( T, T ), dot( B, B ) );
1644		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1645		return mat3( T * scale, B * scale, N );
1646	}
1647#endif`,T3=`#ifdef USE_CLEARCOAT
1648	vec3 clearcoatNormal = nonPerturbedNormal;
1649#endif`,C3=`#ifdef USE_CLEARCOAT_NORMALMAP
1650	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1651	clearcoatMapN.xy *= clearcoatNormalScale;
1652	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1653#endif`,w3=`#ifdef USE_CLEARCOATMAP
1654	uniform sampler2D clearcoatMap;
1655#endif
1656#ifdef USE_CLEARCOAT_NORMALMAP
1657	uniform sampler2D clearcoatNormalMap;
1658	uniform vec2 clearcoatNormalScale;
1659#endif
1660#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1661	uniform sampler2D clearcoatRoughnessMap;
1662#endif`,R3=`#ifdef USE_IRIDESCENCEMAP
1663	uniform sampler2D iridescenceMap;
1664#endif
1665#ifdef USE_IRIDESCENCE_THICKNESSMAP
1666	uniform sampler2D iridescenceThicknessMap;
1667#endif`,I3=`#ifdef OPAQUE
1668diffuseColor.a = 1.0;
1669#endif
1670#ifdef USE_TRANSMISSION
1671diffuseColor.a *= material.transmissionAlpha;
1672#endif
1673gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,B3=`vec3 packNormalToRGB( const in vec3 normal ) {
1674	return normalize( normal ) * 0.5 + 0.5;
1675}
1676vec3 unpackRGBToNormal( const in vec3 rgb ) {
1677	return 2.0 * rgb.xyz - 1.0;
1678}
1679const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1680const float Inv255 = 1. / 255.;
1681const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1682const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1683const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1684const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1685vec4 packDepthToRGBA( const in float v ) {
1686	if( v <= 0.0 )
1687		return vec4( 0., 0., 0., 0. );
1688	if( v >= 1.0 )
1689		return vec4( 1., 1., 1., 1. );
1690	float vuf;
1691	float af = modf( v * PackFactors.a, vuf );
1692	float bf = modf( vuf * ShiftRight8, vuf );
1693	float gf = modf( vuf * ShiftRight8, vuf );
1694	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1695}
1696vec3 packDepthToRGB( const in float v ) {
1697	if( v <= 0.0 )
1698		return vec3( 0., 0., 0. );
1699	if( v >= 1.0 )
1700		return vec3( 1., 1., 1. );
1701	float vuf;
1702	float bf = modf( v * PackFactors.b, vuf );
1703	float gf = modf( vuf * ShiftRight8, vuf );
1704	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1705}
1706vec2 packDepthToRG( const in float v ) {
1707	if( v <= 0.0 )
1708		return vec2( 0., 0. );
1709	if( v >= 1.0 )
1710		return vec2( 1., 1. );
1711	float vuf;
1712	float gf = modf( v * 256., vuf );
1713	return vec2( vuf * Inv255, gf );
1714}
1715float unpackRGBAToDepth( const in vec4 v ) {
1716	return dot( v, UnpackFactors4 );
1717}
1718float unpackRGBToDepth( const in vec3 v ) {
1719	return dot( v, UnpackFactors3 );
1720}
1721float unpackRGToDepth( const in vec2 v ) {
1722	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1723}
1724vec4 pack2HalfToRGBA( const in vec2 v ) {
1725	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1726	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1727}
1728vec2 unpackRGBATo2Half( const in vec4 v ) {
1729	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1730}
1731float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1732	return ( viewZ + near ) / ( near - far );
1733}
1734float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1735	#ifdef USE_REVERSED_DEPTH_BUFFER
1736	
1737		return depth * ( far - near ) - far;
1738	#else
1739		return depth * ( near - far ) - near;
1740	#endif
1741}
1742float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1743	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1744}
1745float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1746	
1747	#ifdef USE_REVERSED_DEPTH_BUFFER
1748		return ( near * far ) / ( ( near - far ) * depth - near );
1749	#else
1750		return ( near * far ) / ( ( far - near ) * depth - far );
1751	#endif
1752}`,P3=`#ifdef PREMULTIPLIED_ALPHA
1753	gl_FragColor.rgb *= gl_FragColor.a;
1754#endif`,L3=`vec4 mvPosition = vec4( transformed, 1.0 );
1755#ifdef USE_BATCHING
1756	mvPosition = batchingMatrix * mvPosition;
1757#endif
1758#ifdef USE_INSTANCING
1759	mvPosition = instanceMatrix * mvPosition;
1760#endif
1761mvPosition = modelViewMatrix * mvPosition;
1762gl_Position = projectionMatrix * mvPosition;`,D3=`#ifdef DITHERING
1763	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1764#endif`,F3=`#ifdef DITHERING
1765	vec3 dithering( vec3 color ) {
1766		float grid_position = rand( gl_FragCoord.xy );
1767		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1768		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1769		return color + dither_shift_RGB;
1770	}
1771#endif`,N3=`float roughnessFactor = roughness;
1772#ifdef USE_ROUGHNESSMAP
1773	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1774	roughnessFactor *= texelRoughness.g;
1775#endif`,O3=`#ifdef USE_ROUGHNESSMAP
1776	uniform sampler2D roughnessMap;
1777#endif`,U3=`#if NUM_SPOT_LIGHT_COORDS > 0
1778	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1779#endif
1780#if NUM_SPOT_LIGHT_MAPS > 0
1781	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1782#endif
1783#ifdef USE_SHADOWMAP
1784	#if NUM_DIR_LIGHT_SHADOWS > 0
1785		#if defined( SHADOWMAP_TYPE_PCF )
1786			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1787		#else
1788			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1789		#endif
1790		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1791		struct DirectionalLightShadow {
1792			float shadowIntensity;
1793			float shadowBias;
1794			float shadowNormalBias;
1795			float shadowRadius;
1796			vec2 shadowMapSize;
1797		};
1798		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1799	#endif
1800	#if NUM_SPOT_LIGHT_SHADOWS > 0
1801		#if defined( SHADOWMAP_TYPE_PCF )
1802			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1803		#else
1804			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1805		#endif
1806		struct SpotLightShadow {
1807			float shadowIntensity;
1808			float shadowBias;
1809			float shadowNormalBias;
1810			float shadowRadius;
1811			vec2 shadowMapSize;
1812		};
1813		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1814	#endif
1815	#if NUM_POINT_LIGHT_SHADOWS > 0
1816		#if defined( SHADOWMAP_TYPE_PCF )
1817			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1818		#elif defined( SHADOWMAP_TYPE_BASIC )
1819			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1820		#endif
1821		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1822		struct PointLightShadow {
1823			float shadowIntensity;
1824			float shadowBias;
1825			float shadowNormalBias;
1826			float shadowRadius;
1827			vec2 shadowMapSize;
1828			float shadowCameraNear;
1829			float shadowCameraFar;
1830		};
1831		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1832	#endif
1833	#if defined( SHADOWMAP_TYPE_PCF )
1834		float interleavedGradientNoise( vec2 position ) {
1835			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1836		}
1837		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1838			const float goldenAngle = 2.399963229728653;
1839			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1840			float theta = float( sampleIndex ) * goldenAngle + phi;
1841			return vec2( cos( theta ), sin( theta ) ) * r;
1842		}
1843	#endif
1844	#if defined( SHADOWMAP_TYPE_PCF )
1845		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1846			float shadow = 1.0;
1847			shadowCoord.xyz /= shadowCoord.w;
1848			shadowCoord.z += shadowBias;
1849			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1850			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1851			if ( frustumTest ) {
1852				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1853				float radius = shadowRadius * texelSize.x;
1854				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1855				shadow = (
1856					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1857					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1858					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1859					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1860					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1861				) * 0.2;
1862			}
1863			return mix( 1.0, shadow, shadowIntensity );
1864		}
1865	#elif defined( SHADOWMAP_TYPE_VSM )
1866		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1867			float shadow = 1.0;
1868			shadowCoord.xyz /= shadowCoord.w;
1869			#ifdef USE_REVERSED_DEPTH_BUFFER
1870				shadowCoord.z -= shadowBias;
1871			#else
1872				shadowCoord.z += shadowBias;
1873			#endif
1874			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1875			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1876			if ( frustumTest ) {
1877				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1878				float mean = distribution.x;
1879				float variance = distribution.y * distribution.y;
1880				#ifdef USE_REVERSED_DEPTH_BUFFER
1881					float hard_shadow = step( mean, shadowCoord.z );
1882				#else
1883					float hard_shadow = step( shadowCoord.z, mean );
1884				#endif
1885				
1886				if ( hard_shadow == 1.0 ) {
1887					shadow = 1.0;
1888				} else {
1889					variance = max( variance, 0.0000001 );
1890					float d = shadowCoord.z - mean;
1891					float p_max = variance / ( variance + d * d );
1892					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1893					shadow = max( hard_shadow, p_max );
1894				}
1895			}
1896			return mix( 1.0, shadow, shadowIntensity );
1897		}
1898	#else
1899		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1900			float shadow = 1.0;
1901			shadowCoord.xyz /= shadowCoord.w;
1902			#ifdef USE_REVERSED_DEPTH_BUFFER
1903				shadowCoord.z -= shadowBias;
1904			#else
1905				shadowCoord.z += shadowBias;
1906			#endif
1907			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1908			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1909			if ( frustumTest ) {
1910				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1911				#ifdef USE_REVERSED_DEPTH_BUFFER
1912					shadow = step( depth, shadowCoord.z );
1913				#else
1914					shadow = step( shadowCoord.z, depth );
1915				#endif
1916			}
1917			return mix( 1.0, shadow, shadowIntensity );
1918		}
1919	#endif
1920	#if NUM_POINT_LIGHT_SHADOWS > 0
1921	#if defined( SHADOWMAP_TYPE_PCF )
1922	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1923		float shadow = 1.0;
1924		vec3 lightToPosition = shadowCoord.xyz;
1925		vec3 bd3D = normalize( lightToPosition );
1926		vec3 absVec = abs( lightToPosition );
1927		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1928		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1929			#ifdef USE_REVERSED_DEPTH_BUFFER
1930				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1931				dp -= shadowBias;
1932			#else
1933				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1934				dp += shadowBias;
1935			#endif
1936			float texelSize = shadowRadius / shadowMapSize.x;
1937			vec3 absDir = abs( bd3D );
1938			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1939			tangent = normalize( cross( bd3D, tangent ) );
1940			vec3 bitangent = cross( bd3D, tangent );
1941			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1942			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1943			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1944			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1945			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1946			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1947			shadow = (
1948				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1949				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1950				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1951				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1952				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1953			) * 0.2;
1954		}
1955		return mix( 1.0, shadow, shadowIntensity );
1956	}
1957	#elif defined( SHADOWMAP_TYPE_BASIC )
1958	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1959		float shadow = 1.0;
1960		vec3 lightToPosition = shadowCoord.xyz;
1961		vec3 absVec = abs( lightToPosition );
1962		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1963		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1964			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1965			dp += shadowBias;
1966			vec3 bd3D = normalize( lightToPosition );
1967			float depth = textureCube( shadowMap, bd3D ).r;
1968			#ifdef USE_REVERSED_DEPTH_BUFFER
1969				depth = 1.0 - depth;
1970			#endif
1971			shadow = step( dp, depth );
1972		}
1973		return mix( 1.0, shadow, shadowIntensity );
1974	}
1975	#endif
1976	#endif
1977#endif`,G3=`#if NUM_SPOT_LIGHT_COORDS > 0
1978	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1979	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1980#endif
1981#ifdef USE_SHADOWMAP
1982	#if NUM_DIR_LIGHT_SHADOWS > 0
1983		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1984		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1985		struct DirectionalLightShadow {
1986			float shadowIntensity;
1987			float shadowBias;
1988			float shadowNormalBias;
1989			float shadowRadius;
1990			vec2 shadowMapSize;
1991		};
1992		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1993	#endif
1994	#if NUM_SPOT_LIGHT_SHADOWS > 0
1995		struct SpotLightShadow {
1996			float shadowIntensity;
1997			float shadowBias;
1998			float shadowNormalBias;
1999			float shadowRadius;
2000			vec2 shadowMapSize;
2001		};
2002		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2003	#endif
2004	#if NUM_POINT_LIGHT_SHADOWS > 0
2005		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2006		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2007		struct PointLightShadow {
2008			float shadowIntensity;
2009			float shadowBias;
2010			float shadowNormalBias;
2011			float shadowRadius;
2012			vec2 shadowMapSize;
2013			float shadowCameraNear;
2014			float shadowCameraFar;
2015		};
2016		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2017	#endif
2018#endif`,k3=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2019	#ifdef HAS_NORMAL
2020		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2021	#else
2022		vec3 shadowWorldNormal = vec3( 0.0 );
2023	#endif
2024	vec4 shadowWorldPosition;
2025#endif
2026#if defined( USE_SHADOWMAP )
2027	#if NUM_DIR_LIGHT_SHADOWS > 0
2028		#pragma unroll_loop_start
2029		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2030			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2031			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2032		}
2033		#pragma unroll_loop_end
2034	#endif
2035	#if NUM_POINT_LIGHT_SHADOWS > 0
2036		#pragma unroll_loop_start
2037		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2038			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2039			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2040		}
2041		#pragma unroll_loop_end
2042	#endif
2043#endif
2044#if NUM_SPOT_LIGHT_COORDS > 0
2045	#pragma unroll_loop_start
2046	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2047		shadowWorldPosition = worldPosition;
2048		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2049			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2050		#endif
2051		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2052	}
2053	#pragma unroll_loop_end
2054#endif`,H3=`float getShadowMask() {
2055	float shadow = 1.0;
2056	#ifdef USE_SHADOWMAP
2057	#if NUM_DIR_LIGHT_SHADOWS > 0
2058	DirectionalLightShadow directionalLight;
2059	#pragma unroll_loop_start
2060	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2061		directionalLight = directionalLightShadows[ i ];
2062		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2063	}
2064	#pragma unroll_loop_end
2065	#endif
2066	#if NUM_SPOT_LIGHT_SHADOWS > 0
2067	SpotLightShadow spotLight;
2068	#pragma unroll_loop_start
2069	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2070		spotLight = spotLightShadows[ i ];
2071		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2072	}
2073	#pragma unroll_loop_end
2074	#endif
2075	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2076	PointLightShadow pointLight;
2077	#pragma unroll_loop_start
2078	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2079		pointLight = pointLightShadows[ i ];
2080		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2081	}
2082	#pragma unroll_loop_end
2083	#endif
2084	#endif
2085	return shadow;
2086}`,z3=`#ifdef USE_SKINNING
2087	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2088	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2089	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2090	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2091#endif`,V3=`#ifdef USE_SKINNING
2092	uniform mat4 bindMatrix;
2093	uniform mat4 bindMatrixInverse;
2094	uniform highp sampler2D boneTexture;
2095	mat4 getBoneMatrix( const in float i ) {
2096		int size = textureSize( boneTexture, 0 ).x;
2097		int j = int( i ) * 4;
2098		int x = j % size;
2099		int y = j / size;
2100		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2101		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2102		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2103		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2104		return mat4( v1, v2, v3, v4 );
2105	}
2106#endif`,W3=`#ifdef USE_SKINNING
2107	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2108	vec4 skinned = vec4( 0.0 );
2109	skinned += boneMatX * skinVertex * skinWeight.x;
2110	skinned += boneMatY * skinVertex * skinWeight.y;
2111	skinned += boneMatZ * skinVertex * skinWeight.z;
2112	skinned += boneMatW * skinVertex * skinWeight.w;
2113	transformed = ( bindMatrixInverse * skinned ).xyz;
2114#endif`,j3=`#ifdef USE_SKINNING
2115	mat4 skinMatrix = mat4( 0.0 );
2116	skinMatrix += skinWeight.x * boneMatX;
2117	skinMatrix += skinWeight.y * boneMatY;
2118	skinMatrix += skinWeight.z * boneMatZ;
2119	skinMatrix += skinWeight.w * boneMatW;
2120	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2121	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2122	#ifdef USE_TANGENT
2123		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2124	#endif
2125#endif`,X3=`float specularStrength;
2126#ifdef USE_SPECULARMAP
2127	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2128	specularStrength = texelSpecular.r;
2129#else
2130	specularStrength = 1.0;
2131#endif`,J3=`#ifdef USE_SPECULARMAP
2132	uniform sampler2D specularMap;
2133#endif`,Y3=`#if defined( TONE_MAPPING )
2134	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2135#endif`,K3=`#ifndef saturate
2136#define saturate( a ) clamp( a, 0.0, 1.0 )
2137#endif
2138uniform float toneMappingExposure;
2139vec3 LinearToneMapping( vec3 color ) {
2140	return saturate( toneMappingExposure * color );
2141}
2142vec3 ReinhardToneMapping( vec3 color ) {
2143	color *= toneMappingExposure;
2144	return saturate( color / ( vec3( 1.0 ) + color ) );
2145}
2146vec3 CineonToneMapping( vec3 color ) {
2147	color *= toneMappingExposure;
2148	color = max( vec3( 0.0 ), color - 0.004 );
2149	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2150}
2151vec3 RRTAndODTFit( vec3 v ) {
2152	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2153	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2154	return a / b;
2155}
2156vec3 ACESFilmicToneMapping( vec3 color ) {
2157	const mat3 ACESInputMat = mat3(
2158		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2159		vec3( 0.04823, 0.01566, 0.83777 )
2160	);
2161	const mat3 ACESOutputMat = mat3(
2162		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2163		vec3( -0.07367, -0.00605,  1.07602 )
2164	);
2165	color *= toneMappingExposure / 0.6;
2166	color = ACESInputMat * color;
2167	color = RRTAndODTFit( color );
2168	color = ACESOutputMat * color;
2169	return saturate( color );
2170}
2171const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2172	vec3( 1.6605, - 0.1246, - 0.0182 ),
2173	vec3( - 0.5876, 1.1329, - 0.1006 ),
2174	vec3( - 0.0728, - 0.0083, 1.1187 )
2175);
2176const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2177	vec3( 0.6274, 0.0691, 0.0164 ),
2178	vec3( 0.3293, 0.9195, 0.0880 ),
2179	vec3( 0.0433, 0.0113, 0.8956 )
2180);
2181vec3 agxDefaultContrastApprox( vec3 x ) {
2182	vec3 x2 = x * x;
2183	vec3 x4 = x2 * x2;
2184	return + 15.5 * x4 * x2
2185		- 40.14 * x4 * x
2186		+ 31.96 * x4
2187		- 6.868 * x2 * x
2188		+ 0.4298 * x2
2189		+ 0.1191 * x
2190		- 0.00232;
2191}
2192vec3 AgXToneMapping( vec3 color ) {
2193	const mat3 AgXInsetMatrix = mat3(
2194		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2195		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2196		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2197	);
2198	const mat3 AgXOutsetMatrix = mat3(
2199		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2200		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2201		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2202	);
2203	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2204	color *= toneMappingExposure;
2205	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2206	color = AgXInsetMatrix * color;
2207	color = max( color, 1e-10 );	color = log2( color );
2208	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2209	color = clamp( color, 0.0, 1.0 );
2210	color = agxDefaultContrastApprox( color );
2211	color = AgXOutsetMatrix * color;
2212	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2213	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2214	color = clamp( color, 0.0, 1.0 );
2215	return color;
2216}
2217vec3 NeutralToneMapping( vec3 color ) {
2218	const float StartCompression = 0.8 - 0.04;
2219	const float Desaturation = 0.15;
2220	color *= toneMappingExposure;
2221	float x = min( color.r, min( color.g, color.b ) );
2222	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2223	color -= offset;
2224	float peak = max( color.r, max( color.g, color.b ) );
2225	if ( peak < StartCompression ) return color;
2226	float d = 1. - StartCompression;
2227	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2228	color *= newPeak / peak;
2229	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2230	return mix( color, vec3( newPeak ), g );
2231}
2232vec3 CustomToneMapping( vec3 color ) { return color; }`,q3=`#ifdef USE_TRANSMISSION
2233	material.transmission = transmission;
2234	material.transmissionAlpha = 1.0;
2235	material.thickness = thickness;
2236	material.attenuationDistance = attenuationDistance;
2237	material.attenuationColor = attenuationColor;
2238	#ifdef USE_TRANSMISSIONMAP
2239		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2240	#endif
2241	#ifdef USE_THICKNESSMAP
2242		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2243	#endif
2244	vec3 pos = vWorldPosition;
2245	vec3 v = normalize( cameraPosition - pos );
2246	vec3 n = inverseTransformDirection( normal, viewMatrix );
2247	vec4 transmitted = getIBLVolumeRefraction(
2248		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2249		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2250		material.attenuationColor, material.attenuationDistance );
2251	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2252	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2253#endif`,Z3=`#ifdef USE_TRANSMISSION
2254	uniform float transmission;
2255	uniform float thickness;
2256	uniform float attenuationDistance;
2257	uniform vec3 attenuationColor;
2258	#ifdef USE_TRANSMISSIONMAP
2259		uniform sampler2D transmissionMap;
2260	#endif
2261	#ifdef USE_THICKNESSMAP
2262		uniform sampler2D thicknessMap;
2263	#endif
2264	uniform vec2 transmissionSamplerSize;
2265	uniform sampler2D transmissionSamplerMap;
2266	uniform mat4 modelMatrix;
2267	uniform mat4 projectionMatrix;
2268	varying vec3 vWorldPosition;
2269	float w0( float a ) {
2270		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2271	}
2272	float w1( float a ) {
2273		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2274	}
2275	float w2( float a ){
2276		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2277	}
2278	float w3( float a ) {
2279		return ( 1.0 / 6.0 ) * ( a * a * a );
2280	}
2281	float g0( float a ) {
2282		return w0( a ) + w1( a );
2283	}
2284	float g1( float a ) {
2285		return w2( a ) + w3( a );
2286	}
2287	float h0( float a ) {
2288		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2289	}
2290	float h1( float a ) {
2291		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2292	}
2293	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2294		uv = uv * texelSize.zw + 0.5;
2295		vec2 iuv = floor( uv );
2296		vec2 fuv = fract( uv );
2297		float g0x = g0( fuv.x );
2298		float g1x = g1( fuv.x );
2299		float h0x = h0( fuv.x );
2300		float h1x = h1( fuv.x );
2301		float h0y = h0( fuv.y );
2302		float h1y = h1( fuv.y );
2303		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2304		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2305		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2306		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2307		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2308			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2309	}
2310	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2311		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2312		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2313		vec2 fLodSizeInv = 1.0 / fLodSize;
2314		vec2 cLodSizeInv = 1.0 / cLodSize;
2315		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2316		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2317		return mix( fSample, cSample, fract( lod ) );
2318	}
2319	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2320		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2321		vec3 modelScale;
2322		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2323		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2324		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2325		return normalize( refractionVector ) * thickness * modelScale;
2326	}
2327	float applyIorToRoughness( const in float roughness, const in float ior ) {
2328		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2329	}
2330	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2331		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2332		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2333	}
2334	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2335		if ( isinf( attenuationDistance ) ) {
2336			return vec3( 1.0 );
2337		} else {
2338			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2339			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2340		}
2341	}
2342	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2343		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2344		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2345		const in vec3 attenuationColor, const in float attenuationDistance ) {
2346		vec4 transmittedLight;
2347		vec3 transmittance;
2348		#ifdef USE_DISPERSION
2349			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2350			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2351			for ( int i = 0; i < 3; i ++ ) {
2352				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2353				vec3 refractedRayExit = position + transmissionRay;
2354				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2355				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2356				refractionCoords += 1.0;
2357				refractionCoords /= 2.0;
2358				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2359				transmittedLight[ i ] = transmissionSample[ i ];
2360				transmittedLight.a += transmissionSample.a;
2361				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2362			}
2363			transmittedLight.a /= 3.0;
2364		#else
2365			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2366			vec3 refractedRayExit = position + transmissionRay;
2367			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2368			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2369			refractionCoords += 1.0;
2370			refractionCoords /= 2.0;
2371			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2372			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2373		#endif
2374		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2375		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2376		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2377		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2378	}
2379#endif`,Q3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2380	varying vec2 vUv;
2381#endif
2382#ifdef USE_MAP
2383	varying vec2 vMapUv;
2384#endif
2385#ifdef USE_ALPHAMAP
2386	varying vec2 vAlphaMapUv;
2387#endif
2388#ifdef USE_LIGHTMAP
2389	varying vec2 vLightMapUv;
2390#endif
2391#ifdef USE_AOMAP
2392	varying vec2 vAoMapUv;
2393#endif
2394#ifdef USE_BUMPMAP
2395	varying vec2 vBumpMapUv;
2396#endif
2397#ifdef USE_NORMALMAP
2398	varying vec2 vNormalMapUv;
2399#endif
2400#ifdef USE_EMISSIVEMAP
2401	varying vec2 vEmissiveMapUv;
2402#endif
2403#ifdef USE_METALNESSMAP
2404	varying vec2 vMetalnessMapUv;
2405#endif
2406#ifdef USE_ROUGHNESSMAP
2407	varying vec2 vRoughnessMapUv;
2408#endif
2409#ifdef USE_ANISOTROPYMAP
2410	varying vec2 vAnisotropyMapUv;
2411#endif
2412#ifdef USE_CLEARCOATMAP
2413	varying vec2 vClearcoatMapUv;
2414#endif
2415#ifdef USE_CLEARCOAT_NORMALMAP
2416	varying vec2 vClearcoatNormalMapUv;
2417#endif
2418#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2419	varying vec2 vClearcoatRoughnessMapUv;
2420#endif
2421#ifdef USE_IRIDESCENCEMAP
2422	varying vec2 vIridescenceMapUv;
2423#endif
2424#ifdef USE_IRIDESCENCE_THICKNESSMAP
2425	varying vec2 vIridescenceThicknessMapUv;
2426#endif
2427#ifdef USE_SHEEN_COLORMAP
2428	varying vec2 vSheenColorMapUv;
2429#endif
2430#ifdef USE_SHEEN_ROUGHNESSMAP
2431	varying vec2 vSheenRoughnessMapUv;
2432#endif
2433#ifdef USE_SPECULARMAP
2434	varying vec2 vSpecularMapUv;
2435#endif
2436#ifdef USE_SPECULAR_COLORMAP
2437	varying vec2 vSpecularColorMapUv;
2438#endif
2439#ifdef USE_SPECULAR_INTENSITYMAP
2440	varying vec2 vSpecularIntensityMapUv;
2441#endif
2442#ifdef USE_TRANSMISSIONMAP
2443	uniform mat3 transmissionMapTransform;
2444	varying vec2 vTransmissionMapUv;
2445#endif
2446#ifdef USE_THICKNESSMAP
2447	uniform mat3 thicknessMapTransform;
2448	varying vec2 vThicknessMapUv;
2449#endif`,$3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2450	varying vec2 vUv;
2451#endif
2452#ifdef USE_MAP
2453	uniform mat3 mapTransform;
2454	varying vec2 vMapUv;
2455#endif
2456#ifdef USE_ALPHAMAP
2457	uniform mat3 alphaMapTransform;
2458	varying vec2 vAlphaMapUv;
2459#endif
2460#ifdef USE_LIGHTMAP
2461	uniform mat3 lightMapTransform;
2462	varying vec2 vLightMapUv;
2463#endif
2464#ifdef USE_AOMAP
2465	uniform mat3 aoMapTransform;
2466	varying vec2 vAoMapUv;
2467#endif
2468#ifdef USE_BUMPMAP
2469	uniform mat3 bumpMapTransform;
2470	varying vec2 vBumpMapUv;
2471#endif
2472#ifdef USE_NORMALMAP
2473	uniform mat3 normalMapTransform;
2474	varying vec2 vNormalMapUv;
2475#endif
2476#ifdef USE_DISPLACEMENTMAP
2477	uniform mat3 displacementMapTransform;
2478	varying vec2 vDisplacementMapUv;
2479#endif
2480#ifdef USE_EMISSIVEMAP
2481	uniform mat3 emissiveMapTransform;
2482	varying vec2 vEmissiveMapUv;
2483#endif
2484#ifdef USE_METALNESSMAP
2485	uniform mat3 metalnessMapTransform;
2486	varying vec2 vMetalnessMapUv;
2487#endif
2488#ifdef USE_ROUGHNESSMAP
2489	uniform mat3 roughnessMapTransform;
2490	varying vec2 vRoughnessMapUv;
2491#endif
2492#ifdef USE_ANISOTROPYMAP
2493	uniform mat3 anisotropyMapTransform;
2494	varying vec2 vAnisotropyMapUv;
2495#endif
2496#ifdef USE_CLEARCOATMAP
2497	uniform mat3 clearcoatMapTransform;
2498	varying vec2 vClearcoatMapUv;
2499#endif
2500#ifdef USE_CLEARCOAT_NORMALMAP
2501	uniform mat3 clearcoatNormalMapTransform;
2502	varying vec2 vClearcoatNormalMapUv;
2503#endif
2504#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2505	uniform mat3 clearcoatRoughnessMapTransform;
2506	varying vec2 vClearcoatRoughnessMapUv;
2507#endif
2508#ifdef USE_SHEEN_COLORMAP
2509	uniform mat3 sheenColorMapTransform;
2510	varying vec2 vSheenColorMapUv;
2511#endif
2512#ifdef USE_SHEEN_ROUGHNESSMAP
2513	uniform mat3 sheenRoughnessMapTransform;
2514	varying vec2 vSheenRoughnessMapUv;
2515#endif
2516#ifdef USE_IRIDESCENCEMAP
2517	uniform mat3 iridescenceMapTransform;
2518	varying vec2 vIridescenceMapUv;
2519#endif
2520#ifdef USE_IRIDESCENCE_THICKNESSMAP
2521	uniform mat3 iridescenceThicknessMapTransform;
2522	varying vec2 vIridescenceThicknessMapUv;
2523#endif
2524#ifdef USE_SPECULARMAP
2525	uniform mat3 specularMapTransform;
2526	varying vec2 vSpecularMapUv;
2527#endif
2528#ifdef USE_SPECULAR_COLORMAP
2529	uniform mat3 specularColorMapTransform;
2530	varying vec2 vSpecularColorMapUv;
2531#endif
2532#ifdef USE_SPECULAR_INTENSITYMAP
2533	uniform mat3 specularIntensityMapTransform;
2534	varying vec2 vSpecularIntensityMapUv;
2535#endif
2536#ifdef USE_TRANSMISSIONMAP
2537	uniform mat3 transmissionMapTransform;
2538	varying vec2 vTransmissionMapUv;
2539#endif
2540#ifdef USE_THICKNESSMAP
2541	uniform mat3 thicknessMapTransform;
2542	varying vec2 vThicknessMapUv;
2543#endif`,eD=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2544	vUv = vec3( uv, 1 ).xy;
2545#endif
2546#ifdef USE_MAP
2547	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2548#endif
2549#ifdef USE_ALPHAMAP
2550	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2551#endif
2552#ifdef USE_LIGHTMAP
2553	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2554#endif
2555#ifdef USE_AOMAP
2556	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2557#endif
2558#ifdef USE_BUMPMAP
2559	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2560#endif
2561#ifdef USE_NORMALMAP
2562	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2563#endif
2564#ifdef USE_DISPLACEMENTMAP
2565	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2566#endif
2567#ifdef USE_EMISSIVEMAP
2568	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2569#endif
2570#ifdef USE_METALNESSMAP
2571	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2572#endif
2573#ifdef USE_ROUGHNESSMAP
2574	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2575#endif
2576#ifdef USE_ANISOTROPYMAP
2577	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2578#endif
2579#ifdef USE_CLEARCOATMAP
2580	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2581#endif
2582#ifdef USE_CLEARCOAT_NORMALMAP
2583	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2584#endif
2585#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2586	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2587#endif
2588#ifdef USE_IRIDESCENCEMAP
2589	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2590#endif
2591#ifdef USE_IRIDESCENCE_THICKNESSMAP
2592	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2593#endif
2594#ifdef USE_SHEEN_COLORMAP
2595	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2596#endif
2597#ifdef USE_SHEEN_ROUGHNESSMAP
2598	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2599#endif
2600#ifdef USE_SPECULARMAP
2601	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2602#endif
2603#ifdef USE_SPECULAR_COLORMAP
2604	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2605#endif
2606#ifdef USE_SPECULAR_INTENSITYMAP
2607	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2608#endif
2609#ifdef USE_TRANSMISSIONMAP
2610	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2611#endif
2612#ifdef USE_THICKNESSMAP
2613	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2614#endif`,tD=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2615	vec4 worldPosition = vec4( transformed, 1.0 );
2616	#ifdef USE_BATCHING
2617		worldPosition = batchingMatrix * worldPosition;
2618	#endif
2619	#ifdef USE_INSTANCING
2620		worldPosition = instanceMatrix * worldPosition;
2621	#endif
2622	worldPosition = modelMatrix * worldPosition;
2623#endif`;const nD=`varying vec2 vUv;
2624uniform mat3 uvTransform;
2625void main() {
2626	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2627	gl_Position = vec4( position.xy, 1.0, 1.0 );
2628}`,iD=`uniform sampler2D t2D;
2629uniform float backgroundIntensity;
2630varying vec2 vUv;
2631void main() {
2632	vec4 texColor = texture2D( t2D, vUv );
2633	#ifdef DECODE_VIDEO_TEXTURE
2634		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 );
2635	#endif
2636	texColor.rgb *= backgroundIntensity;
2637	gl_FragColor = texColor;
2638	#include <tonemapping_fragment>
2639	#include <colorspace_fragment>
2640}`,sD=`varying vec3 vWorldDirection;
2641#include <common>
2642void main() {
2643	vWorldDirection = transformDirection( position, modelMatrix );
2644	#include <begin_vertex>
2645	#include <project_vertex>
2646	gl_Position.z = gl_Position.w;
2647}`,rD=`#ifdef ENVMAP_TYPE_CUBE
2648	uniform samplerCube envMap;
2649#elif defined( ENVMAP_TYPE_CUBE_UV )
2650	uniform sampler2D envMap;
2651#endif
2652uniform float backgroundBlurriness;
2653uniform float backgroundIntensity;
2654uniform mat3 backgroundRotation;
2655varying vec3 vWorldDirection;
2656#include <cube_uv_reflection_fragment>
2657void main() {
2658	#ifdef ENVMAP_TYPE_CUBE
2659		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2660	#elif defined( ENVMAP_TYPE_CUBE_UV )
2661		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2662	#else
2663		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2664	#endif
2665	texColor.rgb *= backgroundIntensity;
2666	gl_FragColor = texColor;
2667	#include <tonemapping_fragment>
2668	#include <colorspace_fragment>
2669}`,oD=`varying vec3 vWorldDirection;
2670#include <common>
2671void main() {
2672	vWorldDirection = transformDirection( position, modelMatrix );
2673	#include <begin_vertex>
2674	#include <project_vertex>
2675	gl_Position.z = gl_Position.w;
2676}`,aD=`uniform samplerCube tCube;
2677uniform float tFlip;
2678uniform float opacity;
2679varying vec3 vWorldDirection;
2680void main() {
2681	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2682	gl_FragColor = texColor;
2683	gl_FragColor.a *= opacity;
2684	#include <tonemapping_fragment>
2685	#include <colorspace_fragment>
2686}`,lD=`#include <common>
2687#include <batching_pars_vertex>
2688#include <uv_pars_vertex>
2689#include <displacementmap_pars_vertex>
2690#include <morphtarget_pars_vertex>
2691#include <skinning_pars_vertex>
2692#include <logdepthbuf_pars_vertex>
2693#include <clipping_planes_pars_vertex>
2694varying vec2 vHighPrecisionZW;
2695void main() {
2696	#include <uv_vertex>
2697	#include <batching_vertex>
2698	#include <skinbase_vertex>
2699	#include <morphinstance_vertex>
2700	#ifdef USE_DISPLACEMENTMAP
2701		#include <beginnormal_vertex>
2702		#include <morphnormal_vertex>
2703		#include <skinnormal_vertex>
2704	#endif
2705	#include <begin_vertex>
2706	#include <morphtarget_vertex>
2707	#include <skinning_vertex>
2708	#include <displacementmap_vertex>
2709	#include <project_vertex>
2710	#include <logdepthbuf_vertex>
2711	#include <clipping_planes_vertex>
2712	vHighPrecisionZW = gl_Position.zw;
2713}`,cD=`#if DEPTH_PACKING == 3200
2714	uniform float opacity;
2715#endif
2716#include <common>
2717#include <packing>
2718#include <uv_pars_fragment>
2719#include <map_pars_fragment>
2720#include <alphamap_pars_fragment>
2721#include <alphatest_pars_fragment>
2722#include <alphahash_pars_fragment>
2723#include <logdepthbuf_pars_fragment>
2724#include <clipping_planes_pars_fragment>
2725varying vec2 vHighPrecisionZW;
2726void main() {
2727	vec4 diffuseColor = vec4( 1.0 );
2728	#include <clipping_planes_fragment>
2729	#if DEPTH_PACKING == 3200
2730		diffuseColor.a = opacity;
2731	#endif
2732	#include <map_fragment>
2733	#include <alphamap_fragment>
2734	#include <alphatest_fragment>
2735	#include <alphahash_fragment>
2736	#include <logdepthbuf_fragment>
2737	#ifdef USE_REVERSED_DEPTH_BUFFER
2738		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2739	#else
2740		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2741	#endif
2742	#if DEPTH_PACKING == 3200
2743		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2744	#elif DEPTH_PACKING == 3201
2745		gl_FragColor = packDepthToRGBA( fragCoordZ );
2746	#elif DEPTH_PACKING == 3202
2747		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2748	#elif DEPTH_PACKING == 3203
2749		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2750	#endif
2751}`,uD=`#define DISTANCE
2752varying vec3 vWorldPosition;
2753#include <common>
2754#include <batching_pars_vertex>
2755#include <uv_pars_vertex>
2756#include <displacementmap_pars_vertex>
2757#include <morphtarget_pars_vertex>
2758#include <skinning_pars_vertex>
2759#include <clipping_planes_pars_vertex>
2760void main() {
2761	#include <uv_vertex>
2762	#include <batching_vertex>
2763	#include <skinbase_vertex>
2764	#include <morphinstance_vertex>
2765	#ifdef USE_DISPLACEMENTMAP
2766		#include <beginnormal_vertex>
2767		#include <morphnormal_vertex>
2768		#include <skinnormal_vertex>
2769	#endif
2770	#include <begin_vertex>
2771	#include <morphtarget_vertex>
2772	#include <skinning_vertex>
2773	#include <displacementmap_vertex>
2774	#include <project_vertex>
2775	#include <worldpos_vertex>
2776	#include <clipping_planes_vertex>
2777	vWorldPosition = worldPosition.xyz;
2778}`,hD=`#define DISTANCE
2779uniform vec3 referencePosition;
2780uniform float nearDistance;
2781uniform float farDistance;
2782varying vec3 vWorldPosition;
2783#include <common>
2784#include <uv_pars_fragment>
2785#include <map_pars_fragment>
2786#include <alphamap_pars_fragment>
2787#include <alphatest_pars_fragment>
2788#include <alphahash_pars_fragment>
2789#include <clipping_planes_pars_fragment>
2790void main () {
2791	vec4 diffuseColor = vec4( 1.0 );
2792	#include <clipping_planes_fragment>
2793	#include <map_fragment>
2794	#include <alphamap_fragment>
2795	#include <alphatest_fragment>
2796	#include <alphahash_fragment>
2797	float dist = length( vWorldPosition - referencePosition );
2798	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2799	dist = saturate( dist );
2800	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2801}`,fD=`varying vec3 vWorldDirection;
2802#include <common>
2803void main() {
2804	vWorldDirection = transformDirection( position, modelMatrix );
2805	#include <begin_vertex>
2806	#include <project_vertex>
2807}`,dD=`uniform sampler2D tEquirect;
2808varying vec3 vWorldDirection;
2809#include <common>
2810void main() {
2811	vec3 direction = normalize( vWorldDirection );
2812	vec2 sampleUV = equirectUv( direction );
2813	gl_FragColor = texture2D( tEquirect, sampleUV );
2814	#include <tonemapping_fragment>
2815	#include <colorspace_fragment>
2816}`,pD=`uniform float scale;
2817attribute float lineDistance;
2818varying float vLineDistance;
2819#include <common>
2820#include <uv_pars_vertex>
2821#include <color_pars_vertex>
2822#include <fog_pars_vertex>
2823#include <morphtarget_pars_vertex>
2824#include <logdepthbuf_pars_vertex>
2825#include <clipping_planes_pars_vertex>
2826void main() {
2827	vLineDistance = scale * lineDistance;
2828	#include <uv_vertex>
2829	#include <color_vertex>
2830	#include <morphinstance_vertex>
2831	#include <morphcolor_vertex>
2832	#include <begin_vertex>
2833	#include <morphtarget_vertex>
2834	#include <project_vertex>
2835	#include <logdepthbuf_vertex>
2836	#include <clipping_planes_vertex>
2837	#include <fog_vertex>
2838}`,mD=`uniform vec3 diffuse;
2839uniform float opacity;
2840uniform float dashSize;
2841uniform float totalSize;
2842varying float vLineDistance;
2843#include <common>
2844#include <color_pars_fragment>
2845#include <uv_pars_fragment>
2846#include <map_pars_fragment>
2847#include <fog_pars_fragment>
2848#include <logdepthbuf_pars_fragment>
2849#include <clipping_planes_pars_fragment>
2850void main() {
2851	vec4 diffuseColor = vec4( diffuse, opacity );
2852	#include <clipping_planes_fragment>
2853	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2854		discard;
2855	}
2856	vec3 outgoingLight = vec3( 0.0 );
2857	#include <logdepthbuf_fragment>
2858	#include <map_fragment>
2859	#include <color_fragment>
2860	outgoingLight = diffuseColor.rgb;
2861	#include <opaque_fragment>
2862	#include <tonemapping_fragment>
2863	#include <colorspace_fragment>
2864	#include <fog_fragment>
2865	#include <premultiplied_alpha_fragment>
2866}`,gD=`#include <common>
2867#include <batching_pars_vertex>
2868#include <uv_pars_vertex>
2869#include <envmap_pars_vertex>
2870#include <color_pars_vertex>
2871#include <fog_pars_vertex>
2872#include <morphtarget_pars_vertex>
2873#include <skinning_pars_vertex>
2874#include <logdepthbuf_pars_vertex>
2875#include <clipping_planes_pars_vertex>
2876void main() {
2877	#include <uv_vertex>
2878	#include <color_vertex>
2879	#include <morphinstance_vertex>
2880	#include <morphcolor_vertex>
2881	#include <batching_vertex>
2882	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2883		#include <beginnormal_vertex>
2884		#include <morphnormal_vertex>
2885		#include <skinbase_vertex>
2886		#include <skinnormal_vertex>
2887		#include <defaultnormal_vertex>
2888	#endif
2889	#include <begin_vertex>
2890	#include <morphtarget_vertex>
2891	#include <skinning_vertex>
2892	#include <project_vertex>
2893	#include <logdepthbuf_vertex>
2894	#include <clipping_planes_vertex>
2895	#include <worldpos_vertex>
2896	#include <envmap_vertex>
2897	#include <fog_vertex>
2898}`,xD=`uniform vec3 diffuse;
2899uniform float opacity;
2900#ifndef FLAT_SHADED
2901	varying vec3 vNormal;
2902#endif
2903#include <common>
2904#include <dithering_pars_fragment>
2905#include <color_pars_fragment>
2906#include <uv_pars_fragment>
2907#include <map_pars_fragment>
2908#include <alphamap_pars_fragment>
2909#include <alphatest_pars_fragment>
2910#include <alphahash_pars_fragment>
2911#include <aomap_pars_fragment>
2912#include <lightmap_pars_fragment>
2913#include <envmap_common_pars_fragment>
2914#include <envmap_pars_fragment>
2915#include <fog_pars_fragment>
2916#include <specularmap_pars_fragment>
2917#include <logdepthbuf_pars_fragment>
2918#include <clipping_planes_pars_fragment>
2919void main() {
2920	vec4 diffuseColor = vec4( diffuse, opacity );
2921	#include <clipping_planes_fragment>
2922	#include <logdepthbuf_fragment>
2923	#include <map_fragment>
2924	#include <color_fragment>
2925	#include <alphamap_fragment>
2926	#include <alphatest_fragment>
2927	#include <alphahash_fragment>
2928	#include <specularmap_fragment>
2929	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2930	#ifdef USE_LIGHTMAP
2931		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2932		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2933	#else
2934		reflectedLight.indirectDiffuse += vec3( 1.0 );
2935	#endif
2936	#include <aomap_fragment>
2937	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2938	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2939	#include <envmap_fragment>
2940	#include <opaque_fragment>
2941	#include <tonemapping_fragment>
2942	#include <colorspace_fragment>
2943	#include <fog_fragment>
2944	#include <premultiplied_alpha_fragment>
2945	#include <dithering_fragment>
2946}`,_D=`#define LAMBERT
2947varying vec3 vViewPosition;
2948#include <common>
2949#include <batching_pars_vertex>
2950#include <uv_pars_vertex>
2951#include <displacementmap_pars_vertex>
2952#include <envmap_pars_vertex>
2953#include <color_pars_vertex>
2954#include <fog_pars_vertex>
2955#include <normal_pars_vertex>
2956#include <morphtarget_pars_vertex>
2957#include <skinning_pars_vertex>
2958#include <shadowmap_pars_vertex>
2959#include <logdepthbuf_pars_vertex>
2960#include <clipping_planes_pars_vertex>
2961void main() {
2962	#include <uv_vertex>
2963	#include <color_vertex>
2964	#include <morphinstance_vertex>
2965	#include <morphcolor_vertex>
2966	#include <batching_vertex>
2967	#include <beginnormal_vertex>
2968	#include <morphnormal_vertex>
2969	#include <skinbase_vertex>
2970	#include <skinnormal_vertex>
2971	#include <defaultnormal_vertex>
2972	#include <normal_vertex>
2973	#include <begin_vertex>
2974	#include <morphtarget_vertex>
2975	#include <skinning_vertex>
2976	#include <displacementmap_vertex>
2977	#include <project_vertex>
2978	#include <logdepthbuf_vertex>
2979	#include <clipping_planes_vertex>
2980	vViewPosition = - mvPosition.xyz;
2981	#include <worldpos_vertex>
2982	#include <envmap_vertex>
2983	#include <shadowmap_vertex>
2984	#include <fog_vertex>
2985}
2985`,yD=`#define LAMBERT
2986uniform vec3 diffuse;
2987uniform vec3 emissive;
2988uniform float opacity;
2989#include <common>
2990#include <dithering_pars_fragment>
2991#include <color_pars_fragment>
2992#include <uv_pars_fragment>
2993#include <map_pars_fragment>
2994#include <alphamap_pars_fragment>
2995#include <alphatest_pars_fragment>
2996#include <alphahash_pars_fragment>
2997#include <aomap_pars_fragment>
2998#include <lightmap_pars_fragment>
2999#include <emissivemap_pars_fragment>
3000#include <cube_uv_reflection_fragment>
3001#include <envmap_common_pars_fragment>
3002#include <envmap_pars_fragment>
3003#include <envmap_physical_pars_fragment>
3004#include <fog_pars_fragment>
3005#include <bsdfs>
3006#include <lights_pars_begin>
3007#include <normal_pars_fragment>
3008#include <lights_lambert_pars_fragment>
3009#include <shadowmap_pars_fragment>
3010#include <bumpmap_pars_fragment>
3011#include <normalmap_pars_fragment>
3012#include <specularmap_pars_fragment>
3013#include <logdepthbuf_pars_fragment>
3014#include <clipping_planes_pars_fragment>
3015void main() {
3016	vec4 diffuseColor = vec4( diffuse, opacity );
3017	#include <clipping_planes_fragment>
3018	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3019	vec3 totalEmissiveRadiance = emissive;
3020	#include <logdepthbuf_fragment>
3021	#include <map_fragment>
3022	#include <color_fragment>
3023	#include <alphamap_fragment>
3024	#include <alphatest_fragment>
3025	#include <alphahash_fragment>
3026	#include <specularmap_fragment>
3027	#include <normal_fragment_begin>
3028	#include <normal_fragment_maps>
3029	#include <emissivemap_fragment>
3030	#include <lights_lambert_fragment>
3031	#include <lights_fragment_begin>
3032	#include <lights_fragment_maps>
3033	#include <lights_fragment_end>
3034	#include <aomap_fragment>
3035	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3036	#include <envmap_fragment>
3037	#include <opaque_fragment>
3038	#include <tonemapping_fragment>
3039	#include <colorspace_fragment>
3040	#include <fog_fragment>
3041	#include <premultiplied_alpha_fragment>
3042	#include <dithering_fragment>
3043}`,vD=`#define MATCAP
3044varying vec3 vViewPosition;
3045#include <common>
3046#include <batching_pars_vertex>
3047#include <uv_pars_vertex>
3048#include <color_pars_vertex>
3049#include <displacementmap_pars_vertex>
3050#include <fog_pars_vertex>
3051#include <normal_pars_vertex>
3052#include <morphtarget_pars_vertex>
3053#include <skinning_pars_vertex>
3054#include <logdepthbuf_pars_vertex>
3055#include <clipping_planes_pars_vertex>
3056void main() {
3057	#include <uv_vertex>
3058	#include <color_vertex>
3059	#include <morphinstance_vertex>
3060	#include <morphcolor_vertex>
3061	#include <batching_vertex>
3062	#include <beginnormal_vertex>
3063	#include <morphnormal_vertex>
3064	#include <skinbase_vertex>
3065	#include <skinnormal_vertex>
3066	#include <defaultnormal_vertex>
3067	#include <normal_vertex>
3068	#include <begin_vertex>
3069	#include <morphtarget_vertex>
3070	#include <skinning_vertex>
3071	#include <displacementmap_vertex>
3072	#include <project_vertex>
3073	#include <logdepthbuf_vertex>
3074	#include <clipping_planes_vertex>
3075	#include <fog_vertex>
3076	vViewPosition = - mvPosition.xyz;
3077}`,bD=`#define MATCAP
3078uniform vec3 diffuse;
3079uniform float opacity;
3080uniform sampler2D matcap;
3081varying vec3 vViewPosition;
3082#include <common>
3083#include <dithering_pars_fragment>
3084#include <color_pars_fragment>
3085#include <uv_pars_fragment>
3086#include <map_pars_fragment>
3087#include <alphamap_pars_fragment>
3088#include <alphatest_pars_fragment>
3089#include <alphahash_pars_fragment>
3090#include <fog_pars_fragment>
3091#include <normal_pars_fragment>
3092#include <bumpmap_pars_fragment>
3093#include <normalmap_pars_fragment>
3094#include <logdepthbuf_pars_fragment>
3095#include <clipping_planes_pars_fragment>
3096void main() {
3097	vec4 diffuseColor = vec4( diffuse, opacity );
3098	#include <clipping_planes_fragment>
3099	#include <logdepthbuf_fragment>
3100	#include <map_fragment>
3101	#include <color_fragment>
3102	#include <alphamap_fragment>
3103	#include <alphatest_fragment>
3104	#include <alphahash_fragment>
3105	#include <normal_fragment_begin>
3106	#include <normal_fragment_maps>
3107	vec3 viewDir = normalize( vViewPosition );
3108	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3109	vec3 y = cross( viewDir, x );
3110	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3111	#ifdef USE_MATCAP
3112		vec4 matcapColor = texture2D( matcap, uv );
3113	#else
3114		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3115	#endif
3116	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3117	#include <opaque_fragment>
3118	#include <tonemapping_fragment>
3119	#include <colorspace_fragment>
3120	#include <fog_fragment>
3121	#include <premultiplied_alpha_fragment>
3122	#include <dithering_fragment>
3123}`,AD=`#define NORMAL
3124#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3125	varying vec3 vViewPosition;
3126#endif
3127#include <common>
3128#include <batching_pars_vertex>
3129#include <uv_pars_vertex>
3130#include <displacementmap_pars_vertex>
3131#include <normal_pars_vertex>
3132#include <morphtarget_pars_vertex>
3133#include <skinning_pars_vertex>
3134#include <logdepthbuf_pars_vertex>
3135#include <clipping_planes_pars_vertex>
3136void main() {
3137	#include <uv_vertex>
3138	#include <batching_vertex>
3139	#include <beginnormal_vertex>
3140	#include <morphinstance_vertex>
3141	#include <morphnormal_vertex>
3142	#include <skinbase_vertex>
3143	#include <skinnormal_vertex>
3144	#include <defaultnormal_vertex>
3145	#include <normal_vertex>
3146	#include <begin_vertex>
3147	#include <morphtarget_vertex>
3148	#include <skinning_vertex>
3149	#include <displacementmap_vertex>
3150	#include <project_vertex>
3151	#include <logdepthbuf_vertex>
3152	#include <clipping_planes_vertex>
3153#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3154	vViewPosition = - mvPosition.xyz;
3155#endif
3156}`,MD=`#define NORMAL
3157uniform float opacity;
3158#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3159	varying vec3 vViewPosition;
3160#endif
3161#include <uv_pars_fragment>
3162#include <normal_pars_fragment>
3163#include <bumpmap_pars_fragment>
3164#include <normalmap_pars_fragment>
3165#include <logdepthbuf_pars_fragment>
3166#include <clipping_planes_pars_fragment>
3167void main() {
3168	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3169	#include <clipping_planes_fragment>
3170	#include <logdepthbuf_fragment>
3171	#include <normal_fragment_begin>
3172	#include <normal_fragment_maps>
3173	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3174	#ifdef OPAQUE
3175		gl_FragColor.a = 1.0;
3176	#endif
3177}`,SD=`#define PHONG
3178varying vec3 vViewPosition;
3179#include <common>
3180#include <batching_pars_vertex>
3181#include <uv_pars_vertex>
3182#include <displacementmap_pars_vertex>
3183#include <envmap_pars_vertex>
3184#include <color_pars_vertex>
3185#include <fog_pars_vertex>
3186#include <normal_pars_vertex>
3187#include <morphtarget_pars_vertex>
3188#include <skinning_pars_vertex>
3189#include <shadowmap_pars_vertex>
3190#include <logdepthbuf_pars_vertex>
3191#include <clipping_planes_pars_vertex>
3192void main() {
3193	#include <uv_vertex>
3194	#include <color_vertex>
3195	#include <morphcolor_vertex>
3196	#include <batching_vertex>
3197	#include <beginnormal_vertex>
3198	#include <morphinstance_vertex>
3199	#include <morphnormal_vertex>
3200	#include <skinbase_vertex>
3201	#include <skinnormal_vertex>
3202	#include <defaultnormal_vertex>
3203	#include <normal_vertex>
3204	#include <begin_vertex>
3205	#include <morphtarget_vertex>
3206	#include <skinning_vertex>
3207	#include <displacementmap_vertex>
3208	#include <project_vertex>
3209	#include <logdepthbuf_vertex>
3210	#include <clipping_planes_vertex>
3211	vViewPosition = - mvPosition.xyz;
3212	#include <worldpos_vertex>
3213	#include <envmap_vertex>
3214	#include <shadowmap_vertex>
3215	#include <fog_vertex>
3216}`,ED=`#define PHONG
3217uniform vec3 diffuse;
3218uniform vec3 emissive;
3219uniform vec3 specular;
3220uniform float shininess;
3221uniform float opacity;
3222#include <common>
3223#include <dithering_pars_fragment>
3224#include <color_pars_fragment>
3225#include <uv_pars_fragment>
3226#include <map_pars_fragment>
3227#include <alphamap_pars_fragment>
3228#include <alphatest_pars_fragment>
3229#include <alphahash_pars_fragment>
3230#include <aomap_pars_fragment>
3231#include <lightmap_pars_fragment>
3232#include <emissivemap_pars_fragment>
3233#include <cube_uv_reflection_fragment>
3234#include <envmap_common_pars_fragment>
3235#include <envmap_pars_fragment>
3236#include <envmap_physical_pars_fragment>
3237#include <fog_pars_fragment>
3238#include <bsdfs>
3239#include <lights_pars_begin>
3240#include <normal_pars_fragment>
3241#include <lights_phong_pars_fragment>
3242#include <shadowmap_pars_fragment>
3243#include <bumpmap_pars_fragment>
3244#include <normalmap_pars_fragment>
3245#include <specularmap_pars_fragment>
3246#include <logdepthbuf_pars_fragment>
3247#include <clipping_planes_pars_fragment>
3248void main() {
3249	vec4 diffuseColor = vec4( diffuse, opacity );
3250	#include <clipping_planes_fragment>
3251	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3252	vec3 totalEmissiveRadiance = emissive;
3253	#include <logdepthbuf_fragment>
3254	#include <map_fragment>
3255	#include <color_fragment>
3256	#include <alphamap_fragment>
3257	#include <alphatest_fragment>
3258	#include <alphahash_fragment>
3259	#include <specularmap_fragment>
3260	#include <normal_fragment_begin>
3261	#include <normal_fragment_maps>
3262	#include <emissivemap_fragment>
3263	#include <lights_phong_fragment>
3264	#include <lights_fragment_begin>
3265	#include <lights_fragment_maps>
3266	#include <lights_fragment_end>
3267	#include <aomap_fragment>
3268	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3269	#include <envmap_fragment>
3270	#include <opaque_fragment>
3271	#include <tonemapping_fragment>
3272	#include <colorspace_fragment>
3273	#include <fog_fragment>
3274	#include <premultiplied_alpha_fragment>
3275	#include <dithering_fragment>
3276}`,TD=`#define STANDARD
3277varying vec3 vViewPosition;
3278#ifdef USE_TRANSMISSION
3279	varying vec3 vWorldPosition;
3280#endif
3281#include <common>
3282#include <batching_pars_vertex>
3283#include <uv_pars_vertex>
3284#include <displacementmap_pars_vertex>
3285#include <color_pars_vertex>
3286#include <fog_pars_vertex>
3287#include <normal_pars_vertex>
3288#include <morphtarget_pars_vertex>
3289#include <skinning_pars_vertex>
3290#include <shadowmap_pars_vertex>
3291#include <logdepthbuf_pars_vertex>
3292#include <clipping_planes_pars_vertex>
3293void main() {
3294	#include <uv_vertex>
3295	#include <color_vertex>
3296	#include <morphinstance_vertex>
3297	#include <morphcolor_vertex>
3298	#include <batching_vertex>
3299	#include <beginnormal_vertex>
3300	#include <morphnormal_vertex>
3301	#include <skinbase_vertex>
3302	#include <skinnormal_vertex>
3303	#include <defaultnormal_vertex>
3304	#include <normal_vertex>
3305	#include <begin_vertex>
3306	#include <morphtarget_vertex>
3307	#include <skinning_vertex>
3308	#include <displacementmap_vertex>
3309	#include <project_vertex>
3310	#include <logdepthbuf_vertex>
3311	#include <clipping_planes_vertex>
3312	vViewPosition = - mvPosition.xyz;
3313	#include <worldpos_vertex>
3314	#include <shadowmap_vertex>
3315	#include <fog_vertex>
3316#ifdef USE_TRANSMISSION
3317	vWorldPosition = worldPosition.xyz;
3318#endif
3319}`,CD=`#define STANDARD
3320#ifdef PHYSICAL
3321	#define IOR
3322	#define USE_SPECULAR
3323#endif
3324uniform vec3 diffuse;
3325uniform vec3 emissive;
3326uniform float roughness;
3327uniform float metalness;
3328uniform float opacity;
3329#ifdef IOR
3330	uniform float ior;
3331#endif
3332#ifdef USE_SPECULAR
3333	uniform float specularIntensity;
3334	uniform vec3 specularColor;
3335	#ifdef USE_SPECULAR_COLORMAP
3336		uniform sampler2D specularColorMap;
3337	#endif
3338	#ifdef USE_SPECULAR_INTENSITYMAP
3339		uniform sampler2D specularIntensityMap;
3340	#endif
3341#endif
3342#ifdef USE_CLEARCOAT
3343	uniform float clearcoat;
3344	uniform float clearcoatRoughness;
3345#endif
3346#ifdef USE_DISPERSION
3347	uniform float dispersion;
3348#endif
3349#ifdef USE_IRIDESCENCE
3350	uniform float iridescence;
3351	uniform float iridescenceIOR;
3352	uniform float iridescenceThicknessMinimum;
3353	uniform float iridescenceThicknessMaximum;
3354#endif
3355#ifdef USE_SHEEN
3356	uniform vec3 sheenColor;
3357	uniform float sheenRoughness;
3358	#ifdef USE_SHEEN_COLORMAP
3359		uniform sampler2D sheenColorMap;
3360	#endif
3361	#ifdef USE_SHEEN_ROUGHNESSMAP
3362		uniform sampler2D sheenRoughnessMap;
3363	#endif
3364#endif
3365#ifdef USE_ANISOTROPY
3366	uniform vec2 anisotropyVector;
3367	#ifdef USE_ANISOTROPYMAP
3368		uniform sampler2D anisotropyMap;
3369	#endif
3370#endif
3371varying vec3 vViewPosition;
3372#include <common>
3373#include <dithering_pars_fragment>
3374#include <color_pars_fragment>
3375#include <uv_pars_fragment>
3376#include <map_pars_fragment>
3377#include <alphamap_pars_fragment>
3378#include <alphatest_pars_fragment>
3379#include <alphahash_pars_fragment>
3380#include <aomap_pars_fragment>
3381#include <lightmap_pars_fragment>
3382#include <emissivemap_pars_fragment>
3383#include <iridescence_fragment>
3384#include <cube_uv_reflection_fragment>
3385#include <envmap_common_pars_fragment>
3386#include <envmap_physical_pars_fragment>
3387#include <fog_pars_fragment>
3388#include <lights_pars_begin>
3389#include <normal_pars_fragment>
3390#include <lights_physical_pars_fragment>
3391#include <transmission_pars_fragment>
3392#include <shadowmap_pars_fragment>
3393#include <bumpmap_pars_fragment>
3394#include <normalmap_pars_fragment>
3395#include <clearcoat_pars_fragment>
3396#include <iridescence_pars_fragment>
3397#include <roughnessmap_pars_fragment>
3398#include <metalnessmap_pars_fragment>
3399#include <logdepthbuf_pars_fragment>
3400#include <clipping_planes_pars_fragment>
3401void main() {
3402	vec4 diffuseColor = vec4( diffuse, opacity );
3403	#include <clipping_planes_fragment>
3404	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3405	vec3 totalEmissiveRadiance = emissive;
3406	#include <logdepthbuf_fragment>
3407	#include <map_fragment>
3408	#include <color_fragment>
3409	#include <alphamap_fragment>
3410	#include <alphatest_fragment>
3411	#include <alphahash_fragment>
3412	#include <roughnessmap_fragment>
3413	#include <metalnessmap_fragment>
3414	#include <normal_fragment_begin>
3415	#include <normal_fragment_maps>
3416	#include <clearcoat_normal_fragment_begin>
3417	#include <clearcoat_normal_fragment_maps>
3418	#include <emissivemap_fragment>
3419	#include <lights_physical_fragment>
3420	#include <lights_fragment_begin>
3421	#include <lights_fragment_maps>
3422	#include <lights_fragment_end>
3423	#include <aomap_fragment>
3424	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3425	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3426	#include <transmission_fragment>
3427	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3428	#ifdef USE_SHEEN
3429 
3430		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3431 
3432 	#endif
3433	#ifdef USE_CLEARCOAT
3434		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3435		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3436		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3437	#endif
3438	#include <opaque_fragment>
3439	#include <tonemapping_fragment>
3440	#include <colorspace_fragment>
3441	#include <fog_fragment>
3442	#include <premultiplied_alpha_fragment>
3443	#include <dithering_fragment>
3444}`,wD=`#define TOON
3445varying vec3 vViewPosition;
3446#include <common>
3447#include <batching_pars_vertex>
3448#include <uv_pars_vertex>
3449#include <displacementmap_pars_vertex>
3450#include <color_pars_vertex>
3451#include <fog_pars_vertex>
3452#include <normal_pars_vertex>
3453#include <morphtarget_pars_vertex>
3454#include <skinning_pars_vertex>
3455#include <shadowmap_pars_vertex>
3456#include <logdepthbuf_pars_vertex>
3457#include <clipping_planes_pars_vertex>
3458void main() {
3459	#include <uv_vertex>
3460	#include <color_vertex>
3461	#include <morphinstance_vertex>
3462	#include <morphcolor_vertex>
3463	#include <batching_vertex>
3464	#include <beginnormal_vertex>
3465	#include <morphnormal_vertex>
3466	#include <skinbase_vertex>
3467	#include <skinnormal_vertex>
3468	#include <defaultnormal_vertex>
3469	#include <normal_vertex>
3470	#include <begin_vertex>
3471	#include <morphtarget_vertex>
3472	#include <skinning_vertex>
3473	#include <displacementmap_vertex>
3474	#include <project_vertex>
3475	#include <logdepthbuf_vertex>
3476	#include <clipping_planes_vertex>
3477	vViewPosition = - mvPosition.xyz;
3478	#include <worldpos_vertex>
3479	#include <shadowmap_vertex>
3480	#include <fog_vertex>
3481}`,RD=`#define TOON
3482uniform vec3 diffuse;
3483uniform vec3 emissive;
3484uniform float opacity;
3485#include <common>
3486#include <dithering_pars_fragment>
3487#include <color_pars_fragment>
3488#include <uv_pars_fragment>
3489#include <map_pars_fragment>
3490#include <alphamap_pars_fragment>
3491#include <alphatest_pars_fragment>
3492#include <alphahash_pars_fragment>
3493#include <aomap_pars_fragment>
3494#include <lightmap_pars_fragment>
3495#include <emissivemap_pars_fragment>
3496#include <gradientmap_pars_fragment>
3497#include <fog_pars_fragment>
3498#include <bsdfs>
3499#include <lights_pars_begin>
3500#include <normal_pars_fragment>
3501#include <lights_toon_pars_fragment>
3502#include <shadowmap_pars_fragment>
3503#include <bumpmap_pars_fragment>
3504#include <normalmap_pars_fragment>
3505#include <logdepthbuf_pars_fragment>
3506#include <clipping_planes_pars_fragment>
3507void main() {
3508	vec4 diffuseColor = vec4( diffuse, opacity );
3509	#include <clipping_planes_fragment>
3510	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3511	vec3 totalEmissiveRadiance = emissive;
3512	#include <logdepthbuf_fragment>
3513	#include <map_fragment>
3514	#include <color_fragment>
3515	#include <alphamap_fragment>
3516	#include <alphatest_fragment>
3517	#include <alphahash_fragment>
3518	#include <normal_fragment_begin>
3519	#include <normal_fragment_maps>
3520	#include <emissivemap_fragment>
3521	#include <lights_toon_fragment>
3522	#include <lights_fragment_begin>
3523	#include <lights_fragment_maps>
3524	#include <lights_fragment_end>
3525	#include <aomap_fragment>
3526	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3527	#include <opaque_fragment>
3528	#include <tonemapping_fragment>
3529	#include <colorspace_fragment>
3530	#include <fog_fragment>
3531	#include <premultiplied_alpha_fragment>
3532	#include <dithering_fragment>
3533}`,ID=`uniform float size;
3534uniform float scale;
3535#include <common>
3536#include <color_pars_vertex>
3537#include <fog_pars_vertex>
3538#include <morphtarget_pars_vertex>
3539#include <logdepthbuf_pars_vertex>
3540#include <clipping_planes_pars_vertex>
3541#ifdef USE_POINTS_UV
3542	varying vec2 vUv;
3543	uniform mat3 uvTransform;
3544#endif
3545void main() {
3546	#ifdef USE_POINTS_UV
3547		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3548	#endif
3549	#include <color_vertex>
3550	#include <morphinstance_vertex>
3551	#include <morphcolor_vertex>
3552	#include <begin_vertex>
3553	#include <morphtarget_vertex>
3554	#include <project_vertex>
3555	gl_PointSize = size;
3556	#ifdef USE_SIZEATTENUATION
3557		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3558		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3559	#endif
3560	#include <logdepthbuf_vertex>
3561	#include <clipping_planes_vertex>
3562	#include <worldpos_vertex>
3563	#include <fog_vertex>
3564}`,BD=`uniform vec3 diffuse;
3565uniform float opacity;
3566#include <common>
3567#include <color_pars_fragment>
3568#include <map_particle_pars_fragment>
3569#include <alphatest_pars_fragment>
3570#include <alphahash_pars_fragment>
3571#include <fog_pars_fragment>
3572#include <logdepthbuf_pars_fragment>
3573#include <clipping_planes_pars_fragment>
3574void main() {
3575	vec4 diffuseColor = vec4( diffuse, opacity );
3576	#include <clipping_planes_fragment>
3577	vec3 outgoingLight = vec3( 0.0 );
3578	#include <logdepthbuf_fragment>
3579	#include <map_particle_fragment>
3580	#include <color_fragment>
3581	#include <alphatest_fragment>
3582	#include <alphahash_fragment>
3583	outgoingLight = diffuseColor.rgb;
3584	#include <opaque_fragment>
3585	#include <tonemapping_fragment>
3586	#include <colorspace_fragment>
3587	#include <fog_fragment>
3588	#include <premultiplied_alpha_fragment>
3589}`,PD=`#include <common>
3590#include <batching_pars_vertex>
3591#include <fog_pars_vertex>
3592#include <morphtarget_pars_vertex>
3593#include <skinning_pars_vertex>
3594#include <logdepthbuf_pars_vertex>
3595#include <shadowmap_pars_vertex>
3596void main() {
3597	#include <batching_vertex>
3598	#include <beginnormal_vertex>
3599	#include <morphinstance_vertex>
3600	#include <morphnormal_vertex>
3601	#include <skinbase_vertex>
3602	#include <skinnormal_vertex>
3603	#include <defaultnormal_vertex>
3604	#include <begin_vertex>
3605	#include <morphtarget_vertex>
3606	#include <skinning_vertex>
3607	#include <project_vertex>
3608	#include <logdepthbuf_vertex>
3609	#include <worldpos_vertex>
3610	#include <shadowmap_vertex>
3611	#include <fog_vertex>
3612}`,LD=`uniform vec3 color;
3613uniform float opacity;
3614#include <common>
3615#include <fog_pars_fragment>
3616#include <bsdfs>
3617#include <lights_pars_begin>
3618#include <logdepthbuf_pars_fragment>
3619#include <shadowmap_pars_fragment>
3620#include <shadowmask_pars_fragment>
3621void main() {
3622	#include <logdepthbuf_fragment>
3623	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3624	#include <tonemapping_fragment>
3625	#include <colorspace_fragment>
3626	#include <fog_fragment>
3627	#include <premultiplied_alpha_fragment>
3628}`,DD=`uniform float rotation;
3629uniform vec2 center;
3630#include <common>
3631#include <uv_pars_vertex>
3632#include <fog_pars_vertex>
3633#include <logdepthbuf_pars_vertex>
3634#include <clipping_planes_pars_vertex>
3635void main() {
3636	#include <uv_vertex>
3637	vec4 mvPosition = modelViewMatrix[ 3 ];
3638	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3639	#ifndef USE_SIZEATTENUATION
3640		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3641		if ( isPerspective ) scale *= - mvPosition.z;
3642	#endif
3643	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3644	vec2 rotatedPosition;
3645	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3646	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3647	mvPosition.xy += rotatedPosition;
3648	gl_Position = projectionMatrix * mvPosition;
3649	#include <logdepthbuf_vertex>
3650	#include <clipping_planes_vertex>
3651	#include <fog_vertex>
3652}`,FD=`uniform vec3 diffuse;
3653uniform float opacity;
3654#include <common>
3655#include <uv_pars_fragment>
3656#include <map_pars_fragment>
3657#include <alphamap_pars_fragment>
3658#include <alphatest_pars_fragment>
3659#include <alphahash_pars_fragment>
3660#include <fog_pars_fragment>
3661#include <logdepthbuf_pars_fragment>
3662#include <clipping_planes_pars_fragment>
3663void main() {
3664	vec4 diffuseColor = vec4( diffuse, opacity );
3665	#include <clipping_planes_fragment>
3666	vec3 outgoingLight = vec3( 0.0 );
3667	#include <logdepthbuf_fragment>
3668	#include <map_fragment>
3669	#include <alphamap_fragment>
3670	#include <alphatest_fragment>
3671	#include <alphahash_fragment>
3672	outgoingLight = diffuseColor.rgb;
3673	#include <opaque_fragment>
3674	#include <tonemapping_fragment>
3675	#include <colorspace_fragment>
3676	#include <fog_fragment>
3677}`,Rt={alphahash_fragment:nL,alphahash_pars_fragment:iL,alphamap_fragment:sL,alphamap_pars_fragment:rL,alph
vendor: 12,592 bytes, line 3677
3677atest_fragment:oL,alphatest_pars_fragment:aL,aomap_fragment:lL,aomap_pars_fragment:cL,batching_pars_vertex:uL,batching_vertex:hL,begin_vertex:fL,beginnormal_vertex:dL,bsdfs:pL,iridescence_fragment:mL,bumpmap_pars_fragment:gL,clipping_planes_fragment:xL,clipping_planes_pars_fragment:_L,clipping_planes_pars_vertex:yL,clipping_planes_vertex:vL,color_fragment:bL,color_pars_fragment:AL,color_pars_vertex:ML,color_vertex:SL,common:EL,cube_uv_reflection_fragment:TL,defaultnormal_vertex:CL,displacementmap_pars_vertex:wL,displacementmap_vertex:RL,emissivemap_fragment:IL,emissivemap_pars_fragment:BL,colorspace_fragment:PL,colorspace_pars_fragment:LL,envmap_fragment:DL,envmap_common_pars_fragment:FL,envmap_pars_fragment:NL,envmap_pars_vertex:OL,envmap_physical_pars_fragment:YL,envmap_vertex:UL,fog_vertex:GL,fog_pars_vertex:kL,fog_fragment:HL,fog_pars_fragment:zL,gradientmap_pars_fragment:VL,lightmap_pars_fragment:WL,lights_lambert_fragment:jL,lights_lambert_pars_fragment:XL,lights_pars_begin:JL,lights_toon_fragment:KL,lights_toon_pars_fragment:qL,lights_phong_fragment:ZL,lights_phong_pars_fragment:QL,lights_physical_fragment:$L,lights_physical_pars_fragment:e3,lights_fragment_begin:t3,lights_fragment_maps:n3,lights_fragment_end:i3,lightprobes_pars_fragment:s3,logdepthbuf_fragment:r3,logdepthbuf_pars_fragment:o3,logdepthbuf_pars_vertex:a3,logdepthbuf_vertex:l3,map_fragment:c3,map_pars_fragment:u3,map_particle_fragment:h3,map_particle_pars_fragment:f3,metalnessmap_fragment:d3,metalnessmap_pars_fragment:p3,morphinstance_vertex:m3,morphcolor_vertex:g3,morphnormal_vertex:x3,morphtarget_pars_vertex:_3,morphtarget_vertex:y3,normal_fragment_begin:v3,normal_fragment_maps:b3,normal_pars_fragment:A3,normal_pars_vertex:M3,normal_vertex:S3,normalmap_pars_fragment:E3,clearcoat_normal_fragment_begin:T3,clearcoat_normal_fragment_maps:C3,clearcoat_pars_fragment:w3,iridescence_pars_fragment:R3,opaque_fragment:I3,packing:B3,premultiplied_alpha_fragment:P3,project_vertex:L3,dithering_fragment:D3,dithering_pars_fragment:F3,roughnessmap_fragment:N3,roughnessmap_pars_fragment:O3,shadowmap_pars_fragment:U3,shadowmap_pars_vertex:G3,shadowmap_vertex:k3,shadowmask_pars_fragment:H3,skinbase_vertex:z3,skinning_pars_vertex:V3,skinning_vertex:W3,skinnormal_vertex:j3,specularmap_fragment:X3,specularmap_pars_fragment:J3,tonemapping_fragment:Y3,tonemapping_pars_fragment:K3,transmission_fragment:q3,transmission_pars_fragment:Z3,uv_pars_fragment:Q3,uv_pars_vertex:$3,uv_vertex:eD,worldpos_vertex:tD,background_vert:nD,background_frag:iD,backgroundCube_vert:sD,backgroundCube_frag:rD,cube_vert:oD,cube_frag:aD,depth_vert:lD,depth_frag:cD,distance_vert:uD,distance_frag:hD,equirect_vert:fD,equirect_frag:dD,linedashed_vert:pD,linedashed_frag:mD,meshbasic_vert:gD,meshbasic_frag:xD,meshlambert_vert:_D,meshlambert_frag:yD,meshmatcap_vert:vD,meshmatcap_frag:bD,meshnormal_vert:AD,meshnormal_frag:MD,meshphong_vert:SD,meshphong_frag:ED,meshphysical_vert:TD,meshphysical_frag:CD,meshtoon_vert:wD,meshtoon_frag:RD,points_vert:ID,points_frag:BD,shadow_vert:PD,shadow_frag:LD,sprite_vert:DD,sprite_frag:FD},je={common:{diffuse:{value:new we(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new vt},alphaMap:{value:null},alphaMapTransform:{value:new vt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new vt}},envmap:{envMap:{value:null},envMapRotation:{value:new vt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new vt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new vt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new vt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new vt},normalScale:{value:new xe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new vt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new vt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new vt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new vt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new we(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new G},probesMax:{value:new G},probesResolution:{value:new G}},points:{diffuse:{value:new we(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new vt},alphaTest:{value:0},uvTransform:{value:new vt}},sprite:{diffuse:{value:new we(16777215)},opacity:{value:1},center:{value:new xe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new vt},alphaMap:{value:null},alphaMapTransform:{value:new vt},alphaTest:{value:0}}},_s={basic:{uniforms:di([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.fog]),vertexShader:Rt.meshbasic_vert,fragmentShader:Rt.meshbasic_frag},lambert:{uniforms:di([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new we(0)},envMapIntensity:{value:1}}]),vertexShader:Rt.meshlambert_vert,fragmentShader:Rt.meshlambert_frag},phong:{uniforms:di([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new we(0)},specular:{value:new we(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Rt.meshphong_vert,fragmentShader:Rt.meshphong_frag},standard:{uniforms:di([je.common,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.roughnessmap,je.metalnessmap,je.fog,je.lights,{emissive:{value:new we(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Rt.meshphysical_vert,fragmentShader:Rt.meshphysical_frag},toon:{uniforms:di([je.common,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.gradientmap,je.fog,je.lights,{emissive:{value:new we(0)}}]),vertexShader:Rt.meshtoon_vert,fragmentShader:Rt.meshtoon_frag},matcap:{uniforms:di([je.common,je.bumpmap,je.normalmap,je.displacementmap,je.fog,{matcap:{value:null}}]),vertexShader:Rt.meshmatcap_vert,fragmentShader:Rt.meshmatcap_frag},points:{uniforms:di([je.points,je.fog]),vertexShader:Rt.points_vert,fragmentShader:Rt.points_frag},dashed:{uniforms:di([je.common,je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Rt.linedashed_vert,fragmentShader:Rt.linedashed_frag},depth:{uniforms:di([je.common,je.displacementmap]),vertexShader:Rt.depth_vert,fragmentShader:Rt.depth_frag},normal:{uniforms:di([je.common,je.bumpmap,je.normalmap,je.displacementmap,{opacity:{value:1}}]),vertexShader:Rt.meshnormal_vert,fragmentShader:Rt.meshnormal_frag},sprite:{uniforms:di([je.sprite,je.fog]),vertexShader:Rt.sprite_vert,fragmentShader:Rt.sprite_frag},background:{uniforms:{uvTransform:{value:new vt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Rt.background_vert,fragmentShader:Rt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new vt}},vertexShader:Rt.backgroundCube_vert,fragmentShader:Rt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Rt.cube_vert,fragmentShader:Rt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Rt.equirect_vert,fragmentShader:Rt.equirect_frag},distance:{uniforms:di([je.common,je.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Rt.distance_vert,fragmentShader:Rt.distance_frag},shadow:{uniforms:di([je.lights,je.fog,{color:{value:new we(0)},opacity:{value:1}}]),vertexShader:Rt.shadow_vert,fragmentShader:Rt.shadow_frag}};_s.physical={uniforms:di([_s.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new vt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new vt},clearcoatNormalScale:{value:new xe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new vt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new vt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new vt},sheen:{value:0},sheenColor:{value:new we(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new vt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new vt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new vt},transmissionSamplerSize:{value:new xe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new vt},attenuationDistance:{value:0},attenuationColor:{value:new we(0)},specularColor:{value:new we(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new vt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new vt},anisotropyVector:{value:new xe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new vt}}]),vertexShader:Rt.meshphysical_vert,fragmentShader:Rt.meshphysical_frag};const Df={r:0,b:0,g:0},ND=new ft,$1=new vt;$1.set(-1,0,0,0,1,0,0,0,1);function OD(s,e,t,n,i,r){const l=new we(0);let c=i===!0?0:1,u,h,d=null,p=0,m=null;function g(A){let S=A.isScene===!0?A.background:null;if(S&&S.isTexture){const T=A.backgroundBlurriness>0;S=e.get(S,T)}return S}function _(A){let S=!1;const T=g(A);T===null?v(l,c):T&&T.isColor&&(v(T,1),S=!0);const B=s.xr.getEnvironmentBlendMode();B==="additive"?t.buffers.color.setClear(0,0,0,1,r):B==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(s.autoClear||S)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function b(A,S){const T=g(S);T&&(T.isCubeTexture||T.mapping===ac)?(h===void 0&&(h=new An(new Ms(1,1,1),new Ii({name:"BackgroundCubeMaterial",uniforms:ic(_s.backgroundCube.uniforms),vertexShader:_s.backgroundCube.vertexShader,fragmentShader:_s.backgroundCube.fragmentShader,side:_i,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(B,R,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(h)),h.material.uniforms.envMap.value=T,h.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(ND.makeRotationFromEuler(S.backgroundRotation)).transpose(),T.isCubeTexture&&T.isRenderTargetTexture===!1&&h.material.uniforms.backgroundRotation.value.premultiply($1),h.material.toneMapped=It.getTransfer(T.colorSpace)!==Qt,(d!==T||p!==T.version||m!==s.toneMapping)&&(h.material.needsUpdate=!0,d=T,p=T.version,m=s.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null)):T&&T.isTexture&&(u===void 0&&(u=new An(new uc(2,2),new Ii({name:"Backgroun
3677dMaterial",uniforms:ic(_s.background.uniforms),vertexShader:_s.background.vertexShader,fragmentShader:_s.background.fragmentShader,side:Zs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=T,u.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,u.material.toneMapped=It.getTransfer(T.colorSpace)!==Qt,T.matrixAutoUpdate===!0&&T.updateMatrix(),u.material.uniforms.uvTransform.value.copy(T.matrix),(d!==T||p!==T.version||m!==s.toneMapping)&&(u.material.needsUpdate=!0,d=T,p=T.version,m=s.toneMapping),u.layers.enableAll(),A.unshift(u,u.geometry,u.material,0,0,null))}function v(A,S){A.getRGB(Df,M1(s)),t.buffers.color.setClear(Df.r,Df.g,Df.b,S,r)}function y(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0)}return{getClearColor:function(){return l},setClearColor:function(A,S=1){l.set(A),c=S,v(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(A){c=A,v(l,c)},render:_,addToRenderList:b,dispose:y}}function UD(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=m(null);let r=i,l=!1;function c(D,z,X,Y,V){let H=!1;const W=p(D,Y,X,z);r!==W&&(r=W,h(r.object)),H=g(D,Y,X,V),H&&_(D,Y,X,V),V!==null&&e.update(V,s.ELEMENT_ARRAY_BUFFER),(H||l)&&(l=!1,T(D,z,X,Y),V!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function u(){return s.createVertexArray()}function h(D){return s.bindVertexArray(D)}function d(D){return s.deleteVertexArray(D)}function p(D,z,X,Y){const V=Y.wireframe===!0;let H=n[z.id];H===void 0&&(H={},n[z.id]=H);const W=D.isInstancedMesh===!0?D.id:0;let q=H[W];q===void 0&&(q={},H[W]=q);let Q=q[X.id];Q===void 0&&(Q={},q[X.id]=Q);let re=Q[V];return re===void 0&&(re=m(u()),Q[V]=re),re}function m(D){const z=[],X=[],Y=[];for(let V=0;V<t;V++)z[V]=0,X[V]=0,Y[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:X,attributeDivisors:Y,object:D,attributes:{},index:null}}function g(D,z,X,Y){const V=r.attributes,H=z.attributes;let W=0;const q=X.getAttributes();for(const Q in q)if(q[Q].location>=0){const ae=V[Q];let pe=H[Q];if(pe===void 0&&(Q==="instanceMatrix"&&D.instanceMatrix&&(pe=D.instanceMatrix),Q==="instanceColor"&&D.instanceColor&&(pe=D.instanceColor)),ae===void 0||ae.attribute!==pe||pe&&ae.data!==pe.data)return!0;W++}return r.attributesNum!==W||r.index!==Y}function _(D,z,X,Y){const V={},H=z.attributes;let W=0;const q=X.getAttributes();for(const Q in q)if(q[Q].location>=0){let ae=H[Q];ae===void 0&&(Q==="instanceMatrix"&&D.instanceMatrix&&(ae=D.instanceMatrix),Q==="instanceColor"&&D.instanceColor&&(ae=D.instanceColor));const pe={};pe.attribute=ae,ae&&ae.data&&(pe.data=ae.data),V[Q]=pe,W++}r.attributes=V,r.attributesNum=W,r.index=Y}function b(){const D=r.newAttributes;for(let z=0,X=D.length;z<X;z++)D[z]=0}function v(D){y(D,0)}function y(D,z){const X=r.newAttributes,Y=r.enabledAttributes,V=r.attributeDivisors;X[D]=1,Y[D]===0&&(s.enableVertexAttribArray(D),Y[D]=1),V[D]!==z&&(s.vertexAttribDivisor(D,z),V[D]=z)}function A(){const D=r.newAttributes,z=r.enabledAttributes;for(let X=0,Y=z.length;X<Y;X++)z[X]!==D[X]&&(s.disableVertexAttribArray(X),z[X]=0)}function S(D,z,X,Y,V,H,W){W===!0?s.vertexAttribIPointer(D,z,X,V,H):s.vertexAttribPointer(D,z,X,Y,V,H)}function T(D,z,X,Y){b();const V=Y.attributes,H=X.getAttributes(),W=z.defaultAttributeValues;for(const q in H){const Q=H[q];if(Q.location>=0){let re=V[q];if(re===void 0&&(q==="instanceMatrix"&&D.instanceMatrix&&(re=D.instanceMatrix),q==="instanceColor"&&D.instanceColor&&(re=D.instanceColor)),re!==void 0){const ae=re.normalized,pe=re.itemSize,Ue=e.get(re);if(Ue===void 0)continue;const Pe=Ue.buffer,He=Ue.type,le=Ue.bytesPerElement,Le=He===s.INT||He===s.UNSIGNED_INT||re.gpuType===Rp;if(re.isInterleavedBufferAttribute){const ye=re.data,ze=ye.stride,Je=re.offset;if(ye.isInstancedInterleavedBuffer){for(let Ee=0;Ee<Q.locationSize;Ee++)y(Q.location+Ee,ye.meshPerAttribute);D.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=ye.meshPerAttribute*ye.count)}else for(let Ee=0;Ee<Q.locationSize;Ee++)v(Q.location+Ee);s.bindBuffer(s.ARRAY_BUFFER,Pe);for(let Ee=0;Ee<Q.locationSize;Ee++)S(Q.location+Ee,pe/Q.locationSize,He,ae,ze*le,(Je+pe/Q.locationSize*Ee)*le,Le)}else{if(re.isInstancedBufferAttribute){for(let ye=0;ye<Q.locationSize;ye++)y(Q.location+ye,re.meshPerAttribute);D.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let ye=0;ye<Q.locationSize;ye++)v(Q.location+ye);s.bindBuffer(s.ARRAY_BUFFER,Pe);for(let ye=0;ye<Q.locationSize;ye++)S(Q.location+ye,pe/Q.locationSize,He,ae,pe*le,pe/Q.locationSize*ye*le,Le)}}else if(W!==void 0){const ae=W[q];if(ae!==void 0)switch(ae.length){case 2:s.vertexAttrib2fv(Q.location,ae);break;case 3:s.vertexAttrib3fv(Q.location,ae);break;case 4:s.vertexAttrib4fv(Q.location,ae);break;default:s.vertexAttrib1fv(Q.location,ae)}}}}A()}function B(){I();for(const D in n){const z=n[D];for(const X in z){const Y=z[X];for(const V in Y){const H=Y[V];for(const W in H)d(H[W].object),delete H[W];delete Y[V]}}delete n[D]}}function R(D){if(n[D.id]===void 0)return;const z=n[D.id];for(const X in z){const Y=z[X];for(const V in Y){const H=Y[V];for(const W in H)d(H[W].object),delete H[W];delete Y[V]}}delete n[D.id]}function L(D){for(const z in n){const X=n[z];for(const Y in X){const V=X[Y];
vendor: 7,637 bytes, line 3677
3677if(V[D.id]===void 0)continue;const H=V[D.id];for(const W in H)d(H[W].object),delete H[W];delete V[D.id]}}}function w(D){for(const z in n){const X=n[z],Y=D.isInstancedMesh===!0?D.id:0,V=X[Y];if(V!==void 0){for(const H in V){const W=V[H];for(const q in W)d(W[q].object),delete W[q];delete V[H]}delete X[Y],Object.keys(X).length===0&&delete n[z]}}}function I(){O(),l=!0,r!==i&&(r=i,h(r.object))}function O(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:c,reset:I,resetDefaultState:O,dispose:B,releaseStatesOfGeometry:R,releaseStatesOfObject:w,releaseStatesOfProgram:L,initAttributes:b,enableAttribute:v,disableUnusedAttributes:A}}function GD(s,e,t){let n;function i(u){n=u}function r(u,h){s.drawArrays(n,u,h),t.update(h,n,1)}function l(u,h,d){d!==0&&(s.drawArraysInstanced(n,u,h,d),t.update(h,n,d))}function c(u,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,u,0,h,0,d);let m=0;for(let g=0;g<d;g++)m+=h[g];t.update(m,n,1)}this.setMode=i,this.render=r,this.renderInstances=l,this.renderMultiDraw=c}function kD(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function l(L){return!(L!==ai&&n.convert(L)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(L){const w=L===bs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==mi&&n.convert(L)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==oi&&!w)}function u(L){if(L==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const d=u(h);d!==h&&(ke("WebGLRenderer:",h,"not supported, using",d,"instead."),h=d);const p=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&m===!1&&ke("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const g=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),_=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=s.getParameter(s.MAX_TEXTURE_SIZE),v=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),y=s.getParameter(s.MAX_VERTEX_ATTRIBS),A=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),S=s.getParameter(s.MAX_VARYING_VECTORS),T=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),B=s.getParameter(s.MAX_SAMPLES),R=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:u,textureFormatReadable:l,textureTypeReadable:c,precision:h,logarithmicDepthBuffer:p,reversedDepthBuffer:m,maxTextures:g,maxVertexTextures:_,maxTextureSize:b,maxCubemapSize:v,maxAttributes:y,maxVertexUniforms:A,maxVaryings:S,maxFragmentUniforms:T,maxSamples:B,samples:R}}function HD(s){const e=this;let t=null,n=0,i=!1,r=!1;const l=new oo,c=new vt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const g=p.length!==0||m||n!==0||i;return i=m,n=p.length,g},this.beginShadows=function(){r=!0,d(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(p,m){t=d(p,m,0)},this.setState=function(p,m,g){const _=p.clippingPlanes,b=p.clipIntersection,v=p.clipShadows,y=s.get(p);if(!i||_===null||_.length===0||r&&!v)r?d(null):h();else{const A=r?0:n,S=A*4;let T=y.clippingState||null;u.value=T,T=d(_,m,S,g);for(let B=0;B!==S;++B)T[B]=t[B];y.clippingState=T,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=A}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(p,m,g,_){const b=p!==null?p.length:0;let v=null;if(b!==0){if(v=u.value,_!==!0||v===null){const y=g+b*4,A=m.matrixWorldInverse;c.getNormalMatrix(A),(v===null||v.length<y)&&(v=new Float32Array(y));for(let S=0,T=g;S!==b;++S,T+=4)l.copy(p[S]).applyMatrix4(A,c),l.normal.toArray(v,T),v[T+3]=l.constant}u.value=v,u.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,v}}const ho=4,UA=[.125,.215,.35,.446,.526,.582],ta=20,zD=256,Zc=new Cr,GA=new we;let d0=null,p0=0,m0=0,g0=!1;const VD=new G;class Rx{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){const{size:l=256,position:c=VD}=r;d0=this._renderer.getRenderTarget(),p0=this._renderer.getActiveCubeFace(),m0=this._renderer.getActiveMipmapLevel(),g0=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(l);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,c),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=zA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=HA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(d0,p0,m0),this._renderer.xr.enabled=g0,e.scissorTest=!1,Ml(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Qs||e.mapping===po?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),d0=this._renderer.getRenderTarget(),p0=this._renderer.getActiveCubeFace(),m0=this._renderer.getActiveMipmapLevel(),g0=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:nn,minFilter:nn,generateMipmaps:!1,type:bs,format:ai,colorSpace:Ql,depthBuffer:!1},i=kA(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=kA(e,t,n);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=WD(r)),this._blurMaterial=XD(r,e,t),this._ggxMaterial=jD(r,e,t)}return i}_compileMaterial(e){const t=new An(new mt,e);this._renderer.compile(t,Zc)}_sceneToCubeUV(e,t,n,i,r){const u=new En(90,1,t,n),h=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],p=this._renderer,m=p.autoClear,g=p.toneMapping;p.getClearColor(GA),p.toneMapping=ns,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(i),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new An(new Ms,new ji({name:"PMREM.Backgroun
3677d",side:_i,depthWrite:!1,depthTest:!1})));const b=this._backgroundBox,v=b.material;let y=!1;const A=e.background;A?A.isColor&&(v.color.copy(A),e.background=null,y=!0):(v.color.copy(GA),y=!0);for(let S=0;S<6;S++){const T=S%3;T===0?(u.up.set(0,h[S],0),u.position.set(r.x,r.y,r.z),u.lookAt(r.x+d[S],r.y,r.z)):T===1?(u.up.set(0,0,h[S]),u.position.set(r.x,r.y,r.z),u.lookAt(r.x,r.y+d[S],r.z)):(u.up.set(0,h[S],0),u.position.set(r.x,r.y,r.z),u.lookAt(r.x,r.y,r.z+d[S]));const B=this._cubeSize;Ml(i,T*B,S>2?B:0,B,B),p.setRenderTarget(i),y&&p.render(b,u),p.render(e,u)}p.toneMapping=g,p.autoClear=m,e.background=A}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Qs||e.mapping===po;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=zA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=HA());const r=i?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=r;const c=r.uniforms;c.envMap.value=e;const u=this._cubeSize;Ml(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(l,Zc)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,r=this._pingPongRenderTarget,l=this._ggxMaterial,c=this._lodMeshes[n];c.material=l;const u=l.uniforms,h=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),p=Math.sqrt(h*h-d*d),m=0+h*1.25,g=p*m,{_lodMax:_}=this,b=this._sizeLods[n],v=3*b*(n>_-ho?n-_+ho:0),y=4*(this._cubeSize-b);u.envMap.value=e.texture,u.roughness.value=g,u.mipInt.value=_-t,Ml(r,v,y,3*b,2*b),i.setRenderTarget(r),i.render(c,Zc),u.envMap.value=r.texture,u.roughness.value=0,u.mipInt.value=_-n,Ml(e,v,y,3*b,2*b),i.setRenderTarget(e),i.render(c,Zc)}_blur(e,t,n,i,r){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,n,i,"latitudinal",r),this._halfBlur(l,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,l,c){const u=this._renderer,h=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&at("blur direction must be either latitudinal or longitudinal!");const d=3,p=this._lodMeshes[i];p.material=h;const m=h.uniforms,g=this._sizeLods[n]-1,_=isFinite(r)?Math.PI/(2*g):2*Math.PI/(2*ta-1),b=r/_,v=isFinite(r)?1+Math.floor(d*b):ta;v>ta&&ke(`sigmaRadians, ${r}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${ta}`);const y=[];let A=0;for(let L=0;L<ta;++L){const w=L/b,I=Math.exp(-w*w/2);y.push(I),L===0?A+=I:L<v&&(A+=2*I)}for(let L=0;L<y.length;L++)y[L]=y[L]/A;m.envMap.value=e.texture,m.samples.value=v,m.weights.value=y,m.latitudinal.value=l==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:S}=this;m.dTheta.value=_,m.mipInt.value=S-n;const T=this._sizeLods[i],B=3*T*(i>S-ho?i-S+ho:0),R=4*(this._cubeSize-T);Ml(t,B,R,3*T,2*T),u.setRenderTarget(t),u.render(p,Zc)}}function WD(s){const e=[],t=[],n=[];let i=s;const r=s-ho+1+UA.length;for(let l=0;l<r;l++){const c=Math.pow(2,i);e.push(c);let u=1/c;l>s-ho?u=UA[l-s+ho-1]:l===0&&(u=0),t.push(u);const h=1/(c-2),d=-h,p=1+h,m=[d,d,p,d,p,p,d,d,p,p,d,p],g=6,_=6,b=3,v=2,y=1,A=new Float32Array(b*_*g),S=new Float32Array(v*_*g),T=new Float32Array(y*_*g);for(let R=0;R<g;R++){const L=R%3*2/3-1,w=R>2?0:-1,I=[L,w,0,L+2/3,w,0,L+2/3,w+1,0,L,w,0,L+2/3,w+1,0,L,w+1,0];A.set(I,b*_*R),S.set(m,v*_*R);const O=[R,R,R,R,R,R];T.set(O,y*_*R)}const B=new mt;B.setAttribute("position",new Ut(A,b)),B.setAttribute("uv",new Ut(S,v)),B.setAttribute("faceIndex",new Ut(T,y)),n.push(new An(B,null)),i>ho&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function kA(s,e,t){const n=new Ri(s,e,t);return n.texture.mapping=ac,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ml(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function jD(s,e,t){return new Ii({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:zD,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:am(),fragmentShader:`
3678
3679			precision highp float;
3680			precision highp int;
3681
3682			varying vec3 vOutputDirection;
3683
3684			uniform sampler2D envMap;
3685			uniform float roughness;
3686			uniform float mipInt;
3687
3688			#define ENVMAP_TYPE_CUBE_UV
3689			#include <cube_uv_reflection_fragment>
3690
3691			#define PI 3.14159265359
3692
3693			// Van der Corput radical inverse
3694			float radicalInverse_VdC(uint bits) {
3695				bits = (bits << 16u) | (bits >> 16u);
3696				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3697				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3698				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3699				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3700				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3701			}
3702
3703			// Hammersley sequence
3704			vec2 hammersley(uint i, uint N) {
3705				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3706			}
3707
3708			// GGX VNDF importance sampling (Eric Heitz 2018)
3709			// "Sampling the GGX Distribution of Visible Normals"
3710			// https://jcgt.org/published/0007/04/01/
3711			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3712				float alpha = roughness * roughness;
3713
3714				// Section 4.1: Orthonormal basis
3715				vec3 T1 = vec3(1.0, 0.0, 0.0);
3716				vec3 T2 = cross(V, T1);
3717
3718				// Section 4.2: Parameterization of projected area
3719				float r = sqrt(Xi.x);
3720				float phi = 2.0 * PI * Xi.y;
3721				float t1 = r * cos(phi);
3722				float t2 = r * sin(phi);
3723				float s = 0.5 * (1.0 + V.z);
3724				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3725
3726				// Section 4.3: Reprojection onto hemisphere
3727				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3728
3729				// Section 3.4: Transform back to ellipsoid configuration
3730				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3731			}
3732
3733			void main() {
3734				vec3 N = normalize(vOutputDirection);
3735				vec3 V = N; // Assume view direction equals normal for pre-filtering
3736
3737				vec3 prefilteredColor = vec3(0.0);
3738				float totalWeight = 0.0;
3739
3740				// For very low roughness, just sample the environment directly
3741				if (roughness < 0.001) {
3742					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3743					return;
3744				}
3745
3746				// Tangent space basis for VNDF sampling
3747				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3748				vec3 tangent = normalize(cross(up, N));
3749				vec3 bitangent = cross(N, tangent);
3750
3751				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3752					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3753
3754					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3755					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3756
3757					// Transform H back to world space
3758					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3759					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3760
3761					float NdotL = max(dot(N, L), 0.0);
3762
3763					if(NdotL > 0.0) {
3764						// Sample environment at fixed mip level
3765						// VNDF importance sampling handles the distribution filtering
3766						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3767
3768						// Weight by NdotL for the split-sum approximation
3769						// VNDF PDF naturally accounts for the visible microfacet distribution
3770						prefilteredColor += sampleColor * NdotL;
3771						totalWeight += NdotL;
3772					}
3773				}
3774
3775				if (totalWeight > 0.0) {
3776					prefilteredColor = prefilteredColor / totalWeight;
3777				}
3778
3779				gl_FragColor = vec4(prefilteredColor, 1.0);
3780			}
3781		`,blending:Ys,depthTest:!1,depthWrite:!1})}function XD(s,e,t){const n=new Float32Array(ta),i=new G(0,1,0);return new Ii({name:"SphericalGaussianBlur",defines:{n:ta,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:am(),fragmentShader:`
3782
3783			precision mediump float;
3784			precision mediump int;
3785
3786			varying vec3 vOutputDirection;
3787
3788			uniform sampler2D envMap;
3789			uniform int samples;
3790			uniform float weights[ n ];
3791			uniform bool latitudinal;
3792			uniform float dTheta;
3793			uniform float mipInt;
3794			uniform vec3 poleAxis;
3795
3796			#define ENVMAP_TYPE_CUBE_UV
3797			#include <cube_uv_reflection_fragment>
3798
3799			vec3 getSample( float theta, vec3 axis ) {
3800
3801				float cosTheta = cos( theta );
3802				// Rodrigues' axis-angle rotation
3803				vec3 sampleDirection = vOutputDirection * cosTheta
3804					+ cross( axis, vOutputDirection ) * sin( theta )
3805					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3806
3807				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3808
3809			}
3810
3811			void main() {
3812
3813				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3814
3815				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3816
3817					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3818
3819				}
3820
3821				axis = normalize( axis );
3822
3823				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3824				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3825
3826				for ( int i = 1; i < n; i++ ) {
3827
3828					if ( i >= samples ) {
3829
3830						break;
3831
3832					}
3833
3834					float theta = dTheta * float( i );
3835					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3836					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3837
3838				}
3839
3840			}
3841		`,blending:Ys,depthTest:!1,depthWrite:!1})}function HA(){return new Ii({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:am(),fragmentShader:`
3842
3843			precision mediump float;
3844			precision mediump int;
3845
3846			varying vec3 vOutputDirection;
3847
3848			uniform sampler2D envMap;
3849
3850			#include <common>
3851
3852			void main() {
3853
3854				vec3 outputDirection = normalize( vOutputDirection );
3855				vec2 uv = equirectUv( outputDirection );
3856
3857				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3858
3859			}
3860		`,blending:Ys,depthTest:!1,depthWrite:!1})}function zA(){return new Ii({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:am(),fragmentShader:`
3861
3862			precision mediump float;
3863			precision mediump int;
3864
3865			uniform float flipEnvMap;
3866
3867			varying vec3 vOutputDirection;
3868
3869			uniform samplerCube envMap;
3870
3871			void main() {
3872
3873				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3874
3875			}
3876		`,blending:Ys,depthTest:!1,depthWrite:!1})}function am(){return`
3877
3878		precision mediump float;
3879		precision mediump int;
3880
3881		attribute float faceIndex;
3882
3883		varying vec3 vOutputDirection;
3884
3885		// RH coordinate system; PMREM face-indexing convention
3886		vec3 getDirection( vec2 uv, float face ) {
3887
3888			uv = 2.0 * uv - 1.0;
3889
3890			vec3 direction = vec3( uv, 1.0 );
3891
3892			if ( face == 0.0 ) {
3893
3894				direction = direction.zyx; // ( 1, v, u ) pos x
3895
3896			} else if ( face == 1.0 ) {
3897
3898				direction = direction.xzy;
3899				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3900
3901			} else if ( face == 2.0 ) {
3902
3903				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3904
3905			} else if ( face == 3.0 ) {
3906
3907				direction = direction.zyx;
3908				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3909
3910			} else if ( face == 4.0 ) {
3911
3912				direction = direction.xzy;
3913				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3914
3915			} else if ( face == 5.0 ) {
3916
3917				direction.z *= -1.0; // ( u, v, -1 ) neg z
3918
3919			}
3920
3921			return direction;
3922
3923		}
3924
3925		void main() {
3926
3927			vOutputDirection = getDirection( uv, faceIndex );
3928			gl_Position = vec4( position, 1.0 );
3929
3930		}
3931	`}class V_ extends Ri{constructor(e=1,t={}
vendor: 7,822 bytes, lines 3931-3966
3931){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Yu(i),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:`
3932
3933				varying vec3 vWorldDirection;
3934
3935				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3936
3937					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3938
3939				}
3940
3941				void main() {
3942
3943					vWorldDirection = transformDirection( position, modelMatrix );
3944
3945					#include <begin_vertex>
3946					#include <project_vertex>
3947
3948				}
3949			`,fragmentShader:`
3950
3951				uniform sampler2D tEquirect;
3952
3953				varying vec3 vWorldDirection;
3954
3955				#include <common>
3956
3957				void main() {
3958
3959					vec3 direction = normalize( vWorldDirection );
3960
3961					vec2 sampleUV = equirectUv( direction );
3962
3963					gl_FragColor = texture2D( tEquirect, sampleUV );
3964
3965				}
3966			`},i=new Ms(5,5,5),r=new Ii({name:"CubemapFromEquirect",uniforms:ic(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:_i,blending:Ys});r.uniforms.tEquirect.value=t;const l=new An(i,r),c=t.minFilter;return t.minFilter===ts&&(t.minFilter=nn),new z1(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,i);e.setRenderTarget(r)}}function JD(s){let e=new WeakMap,t=new WeakMap,n=null;function i(m,g=!1){return m==null?null:g?l(m):r(m)}function r(m){if(m&&m.isTexture){const g=m.mapping;if(g===yu||g===vu)if(e.has(m)){const _=e.get(m).texture;return c(_,m.mapping)}else{const _=m.image;if(_&&_.height>0){const b=new V_(_.height);return b.fromEquirectangularTexture(s,m),e.set(m,b),m.addEventListener("dispose",h),c(b.texture,m.mapping)}else return null}}return m}function l(m){if(m&&m.isTexture){const g=m.mapping,_=g===yu||g===vu,b=g===Qs||g===po;if(_||b){let v=t.get(m);const y=v!==void 0?v.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==y)return n===null&&(n=new Rx(s)),v=_?n.fromEquirectangular(m,v):n.fromCubemap(m,v),v.texture.pmremVersion=m.pmremVersion,t.set(m,v),v.texture;if(v!==void 0)return v.texture;{const A=m.image;return _&&A&&A.height>0||b&&A&&u(A)?(n===null&&(n=new Rx(s)),v=_?n.fromEquirectangular(m):n.fromCubemap(m),v.texture.pmremVersion=m.pmremVersion,t.set(m,v),m.addEventListener("dispose",d),v.texture):null}}}return m}function c(m,g){return g===yu?m.mapping=Qs:g===vu&&(m.mapping=po),m}function u(m){let g=0;const _=6;for(let b=0;b<_;b++)m[b]!==void 0&&g++;return g===_}function h(m){const g=m.target;g.removeEventListener("dispose",h);const _=e.get(g);_!==void 0&&(e.delete(g),_.dispose())}function d(m){const g=m.target;g.removeEventListener("dispose",d);const _=t.get(g);_!==void 0&&(t.delete(g),_.dispose())}function p(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:p}}function YD(s){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=s.getExtension(n);return e[n]=i,i}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 i=t(n);return i===null&&fp("WebGLRenderer: "+n+" extension not supported."),i}}}function KD(s,e,t,n){const i={},r=new WeakMap;function l(p){const m=p.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);m.removeEventListener("dispose",l),delete i[m.id];const g=r.get(m);g&&(e.remove(g),r.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(p,m){return i[m.id]===!0||(m.addEventListener("dispose",l),i[m.id]=!0,t.memory.geometries++),m}function u(p){const m=p.attributes;for(const g in m)e.update(m[g],s.ARRAY_BUFFER)}function h(p){const m=[],g=p.index,_=p.attributes.position;let b=0;if(_===void 0)return;if(g!==null){const A=g.array;b=g.version;for(let S=0,T=A.length;S<T;S+=3){const B=A[S+0],R=A[S+1],L=A[S+2];m.push(B,R,R,L,L,B)}}else{const A=_.array;b=_.version;for(let S=0,T=A.length/3-1;S<T;S+=3){const B=S+0,R=S+1,L=S+2;m.push(B,R,R,L,L,B)}}const v=new(_.count>=65535?f_:h_)(m,1);v.version=b;const y=r.get(p);y&&e.remove(y),r.set(p,v)}function d(p){const m=r.get(p);if(m){const g=p.index;g!==null&&m.version<g.version&&h(p)}else h(p);return r.get(p)}return{get:c,update:u,getWireframeAttribute:d}}function qD(s,e,t){let n;function i(p){n=p}let r,l;function c(p){r=p.type,l=p.bytesPerElement}function u(p,m){s.drawElements(n,m,r,p*l),t.update(m,n,1)}function h(p,m,g){g!==0&&(s.drawElementsInstanced(n,m,r,p*l,g),t.update(m,n,g))}function d(p,m,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,m,0,r,p,0,g);let b=0;for(let v=0;v<g;v++)b+=m[v];t.update(b,n,1)}this.setMode=i,this.setIndex=c,this.render=u,this.renderInstances=h,this.renderMultiDraw=d}function ZD(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,l,c){switch(t.calls++,l){case s.TRIANGLES:t.triangles+=c*(r/3);break;case s.LINES:t.lines+=c*(r/2);break;case s.LINE_STRIP:t.lines+=c*(r-1);break;case s.LINE_LOOP:t.lines+=c*r;break;case s.POINTS:t.points+=c*r;break;default:at("WebGLInfo: Unknown draw mode:",l);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function QD(s,e,t){const n=new WeakMap,i=new Ht;function r(l,c,u){const h=l.morphTargetInfluences,d=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,p=d!==void 0?d.length:0;let m=n.get(c);if(m===void 0||m.count!==p){let I=function(){L.dispose(),n.delete(c),c.removeEventListener("dispose",I)};m!==void 0&&m.texture.dispose();const g=c.morphAttributes.position!==void 0,_=c.morphAttributes.normal!==void 0,b=c.morphAttributes.color!==void 0,v=c.morphAttributes.position||[],y=c.morphAttributes.normal||[],A=c.morphAttributes.color||[];let S=0;g===!0&&(S=1),_===!0&&(S=2),b===!0&&(S=3);let T=c.attributes.position.count*S,B=1;T>e.maxTextureSize&&(B=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const R=new Float32Array(T*B*4*p),L=new Up(R,T,B,p);L.type=oi,L.needsUpdate=!0;const w=S*4;for(let O=0;O<p;O++){const D=v[O],z=y[O],X=A[O],Y=T*B*4*O;for(let V=0;V<D.count;V++){const H=V*w;g===!0&&(i.fromBufferAttribute(D,V),R[Y+H+0]=i.x,R[Y+H+1]=i.y,R[Y+H+2]=i.z,R[Y+H+3]=0),_===!0&&(i.fromBufferAttribute(z,V),R[Y+H+4]=i.x,R[Y+H+5]=i.y,R[Y+H+6]=i.z,R[Y+H+7]=0),b===!0&&(i.fromBufferAttribute(X,V),R[Y+H+8]=i.x,R[Y+H+9]=i.y,R[Y+H+10]=i.z,R[Y+H+11]=X.itemSize===4?i.w:1)}}m={count:p,texture:L,size:new xe(T,B)},n.set(c,m),c.addEventListener("dispose",I)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)u.getUniforms().setValue(s,"morphTexture",l.morphTexture,t);else{let g=0;for(let b=0;b<h.length;b++)g+=h[b];const _=c.morphTargetsRelative?1:1-g;u.getUniforms().setValue(s,"morphTargetBaseInfluence",_),u.getUniforms().setValue(s,"morphTargetInfluences",h)}u.getUniforms().setValue(s,"morphTargetsTexture",m.texture,t),u.getUniforms().setValue(s,"morphTargetsTextureSize",m.size)}return{update:r}}function $D(s,e,t,n,i){let r=new WeakMap;function l(h){const d=i.render.frame,p=h.geometry,m=e.get(h,p);if(r.get(m)!==d&&(e.update(m),r.set(m,d)),h.isInstancedMesh&&(h.hasEventListener("dispose",u)===!1&&h.addEventListener("dispose",u),r.get(h)!==d&&(t.update(h.instanceMatrix,s.ARRAY_BUFFER),h.instanceColor!==null&&t.update(h.instanceColor,s.ARRAY_BUFFER),r.set(h,d))),h.isSkinnedMesh){const g=h.skeleton;
3966r.get(g)!==d&&(g.update(),r.set(g,d))}return m}function c(){r=new WeakMap}function u(h){const d=h.target;d.removeEventListener("dispose",u),n.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:l,dispose:c}}const eF={[Jx]:"LINEAR_TONE_MAPPING",[Yx]:"REINHARD_TONE_MAPPING",[Kx]:"CINEON_TONE_MAPPING",[Tp]:"ACES_FILMIC_TONE_MAPPING",[Zx]:"AGX_TONE_MAPPING",[Qx]:"NEUTRAL_TONE_MAPPING",[qx]:"CUSTOM_TONE_MAPPING"};function tF(s,e,t,n,i){const r=new Ri(e,t,{type:s,depthBuffer:n,stencilBuffer:i,depthTexture:n?new _o(e,t):void 0}),l=new Ri(e,t,{type:bs,depthBuffer:!1,stencilBuffer:!1}),c=new mt;c.setAttribute("position",new tt([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new tt([0,2,0,0,2,0],2));const u=new T_({uniforms:{tDiffuse:{value:null}},vertexShader:`
3967			precision highp float;
3968
3969			uniform mat4 modelViewMatrix;
3970			uniform mat4 projectionMatrix;
3971
3972			attribute vec3 position;
3973			attribute vec2 uv;
3974
3975			varying vec2 vUv;
3976
3977			void main() {
3978				vUv = uv;
3979				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3980			}`,fragmentShader:`
3981			precision highp float;
3982
3983			uniform sampler2D tDiffuse;
3984
3985			varying vec2 vUv;
3986
3987			#include <tonemapping_pars_fragment>
3988			#include <colorspace_pars_fragment>
3989
3990			void main() {
3991				gl_FragColor = texture2D( tDiffuse, vUv );
3992
3993				#ifdef LINEAR_TONE_MAPPING
3994					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3995				#elif defined( REINHARD_TONE_MAPPING )
3996					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3997				#elif defined( CINEON_TONE_MAPPING )
3998					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3999				#elif defined( ACES_FILMIC_TONE_MAPPING )
4000					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
4001				#elif defined( AGX_TONE_MAPPING )
4002					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4003				#elif defined( NEUTRAL_TONE_MAPPING )
4004					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4005				#elif defined( CUSTOM_TONE_MAPPING )
4006					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4007				#endif
4008
4009				#ifdef SRGB_TRANSFER
4010					gl_FragColor = sRGBTransferOETF( gl_FragColor );
4011				#endif
4012			}`,depthTest:!1,depthWrite:!1}),h=new An(c,u),d=new Cr(-1,1,1,-1,0,1);let p=null,m=null,g=!1,_,b=null,v=[],y=!1;this.setSize=function(A,S){r.setSize(A,S),l.setSize(A,S);for(let T=0;T<v.length;T++){const B=v[T];B.setSize&&B.setSize(A,S)}},this.setEffects=function(A){v=A,y=v.length>0&&v[0].isRenderPass===!0;const S=r.width,T=r.height;for(let B=0;B<v.length;B++){const R=v[B];R.setSize&&R.setSize(S,T)}},this.begin=function(A,S){if(g||A.toneMapping===ns&&v.length===0)return!1;if(b=S,S!==null){const T=S.width,B=S.height;(r.width!==T||r.height!==B)&&this.setSize(T,B)}return y===!1&&A.setRenderTarget(r),_=A.toneMapping,A.toneMapping=ns,!0},this.hasRenderPass=function(){return y},this.end=function(A,S){A.toneMapping=_,g=!0;let T=r,B=l;for(let R=0;R<v.length;R++){const L=v[R];if(L.enabled!==!1&&(L.render(A,B,T,S),L.needsSwap!==!1)){const w=T;T=B,B=w}}if(p!==A.outputColorSpace||m!==A.toneMapping){p=A.outputColorSpace,m=A.toneMapping,u.defines={},It.getTransfer(p)===Qt&&(u.defines.SRGB_TRANSFER="");const R=eF[m];R&&(u.defines[R]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=T.texture,A.setRenderTarget(b),A.render(h,d),b=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){r.depthTexture&&r.depthTexture.dispose(),r.dispose(),l.dispose(),c.dispose(),u.dispose()}}const eT=new fn,Ix=new _o(1,1),tT=new Up,nT=new Gp,iT=new Yu,VA=[],WA=[],jA=new Float32Array(16),XA=new Float32Array(9),JA=new Float32Array(4);function hc(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=VA[i];if(r===void 0&&(r=new Float32Array(i),VA[i]=r),e!==0){n.toArray(r,0);for(let l=1,c=0;l!==e;++l)c+=t,s[l].toArray(r,c)}return r}function Un(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Gn(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function lm(s,e){let t=WA[e];t===void 0&&(t=new Int32Array(e),WA[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function nF(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function iF(s,e){const t=this.cache;
vendor: 6,649 bytes, line 4012
4012if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Un(t,e))return;s.uniform2fv(this.addr,e),Gn(t,e)}}function sF(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Un(t,e))return;s.uniform3fv(this.addr,e),Gn(t,e)}}function rF(s,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)&&(s.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(Un(t,e))return;s.uniform4fv(this.addr,e),Gn(t,e)}}function oF(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Un(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Gn(t,e)}else{if(Un(t,n))return;JA.set(n),s.uniformMatrix2fv(this.addr,!1,JA),Gn(t,n)}}function aF(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Un(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Gn(t,e)}else{if(Un(t,n))return;XA.set(n),s.uniformMatrix3fv(this.addr,!1,XA),Gn(t,n)}}function lF(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Un(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Gn(t,e)}else{if(Un(t,n))return;jA.set(n),s.uniformMatrix4fv(this.addr,!1,jA),Gn(t,n)}}function cF(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function uF(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Un(t,e))return;s.uniform2iv(this.addr,e),Gn(t,e)}}function hF(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Un(t,e))return;s.uniform3iv(this.addr,e),Gn(t,e)}}function fF(s,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)&&(s.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(Un(t,e))return;s.uniform4iv(this.addr,e),Gn(t,e)}}function dF(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function pF(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Un(t,e))return;s.uniform2uiv(this.addr,e),Gn(t,e)}}function mF(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Un(t,e))return;s.uniform3uiv(this.addr,e),Gn(t,e)}}function gF(s,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)&&(s.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(Un(t,e))return;s.uniform4uiv(this.addr,e),Gn(t,e)}}function xF(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(Ix.compareFunction=t.isReversedDepthBuffer()?Op:Np,r=Ix):r=eT,t.setTexture2D(e||r,i)}function _F(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||nT,i)}function yF(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||iT,i)}function vF(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||tT,i)}function bF(s){switch(s){case 5126:return nF;case 35664:return iF;case 35665:return sF;case 35666:return rF;case 35674:return oF;case 35675:return aF;case 35676:return lF;case 5124:case 35670:return cF;case 35667:case 35671:return uF;case 35668:case 35672:return hF;case 35669:case 35673:return fF;case 5125:return dF;case 36294:return pF;case 36295:return mF;case 36296:return gF;case 35678:case 36198:case 36298:case 36306:case 35682:return xF;case 35679:case 36299:case 36307:return _F;case 35680:case 36300:case 36308:case 36293:return yF;case 36289:case 36303:case 36311:case 36292:return vF}}function AF(s,e){s.uniform1fv(this.addr,e)}function MF(s,e){const t=hc(e,this.size,2);s.uniform2fv(this.addr,t)}function SF(s,e){const t=hc(e,this.size,3);s.uniform3fv(this.addr,t)}function EF(s,e){const t=hc(e,this.size,4);s.uniform4fv(this.addr,t)}function TF(s,e){const t=hc(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function CF(s,e){const t=hc(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function wF(s,e){const t=hc(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function RF(s,e){s.uniform1iv(this.addr,e)}function IF(s,e){s.uniform2iv(this.addr,e)}function BF(s,e){s.uniform3iv(this.addr,e)}function PF(s,e){s.uniform4iv(this.addr,e)}function LF(s,e){s.uniform1uiv(this.addr,e)}function DF(s,e){s.uniform2uiv(this.addr,e)}function FF(s,e){s.uniform3uiv(this.addr,e)}function NF(s,e){s.uniform4uiv(this.addr,e)}function OF(s,e,t){const n=this.cache,i=e.length,r=lm(t,i);Un(n,r)||(s.uniform1iv(this.addr,r),Gn(n,r));let l;this.type===s.SAMPLER_2D_SHADOW?l=Ix:l=eT;for(let c=0;c!==i;++c)t.setTexture2D(e[c]||l,r[c])}function UF(s,e,t){const n=this.cache,i=e.length,r=lm(t,i);Un(n,r)||(s.uniform1iv(this.addr,r),Gn(n,r));for(let l=0;l!==i;++l)t.setTexture3D(e[l]||nT,r[l])}function GF(s,e,t){const n=this.cache,i=e.length,r=lm(t,i);Un(n,r)||(s.uniform1iv(this.addr,r),Gn(n,r));for(let l=0;l!==i;++l)t.setTextureCube(e[l]||iT,r[l])}function kF(s,e,t){const n=this.cache,i=e.length,r=lm(t,i);Un(n,r)||(s.uniform1iv(this.addr,r),Gn(n,r));for(let l=0;l!==i;++l)t.setTexture2DArray(e[l]||tT,r[l])}function HF(s){switch(s){case 5126:return AF;case 35664:return MF;case 35665:return SF;case 35666:return EF;case 35674:return TF;case 35675:return CF;case 35676:return wF;case 5124:case 35670:return RF;case 35667:case 35671:return IF;case 35668:case 35672:return BF;case 35669:case 35673:return PF;case 5125:return LF;case 36294:return DF;case 36295:return FF;case 36296:return NF;case 35678:case 36198:case 36298:case 36306:case 35682:return OF;case 35679:case 36299:case 36307:return UF;case 35680:case 36300:case 36308:case 36293:return GF;case 36289:case 36303:case 36311:case 36292:return kF}}class zF{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=bF(t.type)}}class VF{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=HF(t.type)}}class WF{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,l=i.length;r!==l;++r){const c=i[r];c.setValue(e,t[c.id],n)}}}const x0=/(\w+)(\])?(\[|\.)?/g;function YA(s,e){s.seq.push(e),s.map[e.id]=e}function jF(s,e,t){const n=s.name,i=n.length;for(x0.lastIndex=0;;
4012){const r=x0.exec(n),l=x0.lastIndex;let c=r[1];const u=r[2]==="]",h=r[3];if(u&&(c=c|0),h===void 0||h==="["&&l+2===i){YA(t,h===void 0?new zF(c,s,e):new VF(c,s,e));break}else{let p=t.map[c];p===void 0&&(p=new WF(c),YA(t,p)),t=p}}}class bd{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),u=e.getUniformLocation(t,c.name);jF(c,u,this)}const i=[],r=[];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?i.push(l):r.push(l);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,l=t.length;r!==l;++r){const c=t[r],u=n[c.id];u.needsUpdate!==!1&&c.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const l=e[i];l.id in t&&n.push(l)}return n}}function KA(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const XF=37297;let JF=0;function YF(s,e){const t=s.split(`
4013`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let l=i;l<r;l++){const c=l+1;n.push(`${c===e?">":" "} ${c}: ${t[l]}`)}return n.join(`
4014`)}const qA=new vt;function KF(s){It._getMatrix(qA,It.workingColorSpace,s);const e=`mat3( ${qA.elements.map(t=>t.toFixed(4))} )`;switch(It.getTransfer(s)){case Lu:return[e,"LinearTransferOETF"];case Qt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function ZA(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";const l=/ERROR: 0:(\d+)/.exec(r);if(l){const c=parseInt(l[1]);return t.toUpperCase()+`
4015
4016`+r+`
4017
4018`+YF(s.getShaderSource(e),c)}else return r}function qF(s,e){const t=KF(e);return[`vec4 ${s}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4019`)}const ZF={[Jx]:"Linear",[Yx]:"Reinhard",[Kx]:"Cineon",[Tp]:"ACESFilmic",[Zx]:"AgX",[Qx]:"Neutral",[qx]:"Custom"};function QF(s,e){const t=ZF[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ff=new G;function $F(){It.getLuminanceCoefficients(Ff);const s=Ff.x.toFixed(4),e=Ff.y.toFixed(4),t=Ff.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${s}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
4020`)}function eN(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(fu).join(`
4021`)}function tN(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
4022`)}function nN(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),l=r.name;let c=1;r.type===s.FLOAT_MAT2&&(c=2),r.type===s.FLOAT_MAT3&&(c=3),r.type===s.FLOAT_MAT4&&(c=4),t[l]={type:r.type,location:s.getAttribLocation(e,l),locationSize:c}}return t}function fu(s){return s!==""}function QA(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $A(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const iN=/^[ \t]*#include +<([\w\d./]+)>/gm;function Bx(s){return s.replace(iN,rN)}const sN=new Map;function rN(s,e){let t=Rt[e];if(t===void 0){const n=sN.get(e);if(n!==void 0)t=Rt[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Bx(t)}const oN=/#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 eM(s){return s.replace(oN,aN)}function aN(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function tM(s){let e=`precision ${s.precision} float;
4023	precision ${s.precision} int;
4024	precision ${s.precision} sampler2D;
4025	precision ${s.precision} samplerCube;
4026	precision ${s.precision} sampler3D;
4027	precision ${s.precision} sampler2DArray;
4028	precision ${s.precision} sampler2DShadow;
4029	precision ${s.precision} samplerCubeShadow;
4030	precision ${s.precision} sampler2DArrayShadow;
4031	precision ${s.precision} isampler2D;
4032	precision ${s.precision} isampler3D;
4033	precision ${s.precision} isamplerCube;
4034	precision ${s.precision} isampler2DArray;
4035	precision ${s.precision} usampler2D;
4036	precision ${s.precision} usampler3D;
4037	precision ${s.precision} usamplerCube;
4038	precision ${s.precision} usampler2DArray;
4039	`;return s.precision==="highp"?e+=`
4040#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
4041#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
4042#define LOW_PRECISION`),e}const lN={[zl]:"SHADOWMAP_TYPE_PCF",[na]:"SHADOWMAP_TYPE_VSM"};function cN(s){return lN[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const uN={[Qs]:"ENVMAP_TYPE_CUBE",[po]:"ENVMAP_TYPE_CUBE",[ac]:"ENVMAP_TYPE_CUBE_UV"};function hN(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":uN[s.envMapMode]||"ENVMAP_TYPE_CUBE"}const fN={[po]:"ENVMAP_MODE_REFRACTION"};function dN(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":fN[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}const pN={[Wu]:"ENVMAP_BLENDING_MULTIPLY",[HE]:"ENVMAP_BLENDING_MIX",[zE]:"ENVMAP_BLENDING_ADD"};function mN(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":pN[s.combine]||"ENVMAP_BLENDING_NONE"}function gN(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function xN(s,e,t,n){const i=s.getContext(),r=t.defines;let l=t.vertexShader,c=t.fragmentShader;const u=cN(t),h=hN(t),d=dN(t),p=mN(t),m=gN(t),g=eN(t),_=tN(r),b=i.createProgram();let v,y,A=t.glslVersion?"#version "+t.glslVersion+`
4043`:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(fu).join(`
4044`),v.length>0&&(v+=`
4045`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(fu).join(`
4046`),y.length>0&&(y+=`
4047`)):(v=[tM(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionCl
vendor: 6,566 bytes, lines 4047-4049
4047ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.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 "+u:"",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",`
4048`].filter(fu).join(`
4049`),y=[tM(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 "+h:"",t.envMap?"#define "+d:"",t.envMap?"#define "+p:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.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.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4049IDESCENCE":"",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 "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",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!==ns?"#define TONE_MAPPING":"",t.toneMapping!==ns?Rt.tonemapping_pars_fragment:"",t.toneMapping!==ns?QF("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Rt.colorspace_pars_fragment,qF("linearToOutputTexel",t.outputColorSpace),$F(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4050`].filter(fu).join(`
4051`)),l=Bx(l),l=QA(l,t),l=$A(l,t),c=Bx(c),c=QA(c,t),c=$A(c,t),l=eM(l),c=eM(c),t.isRawShaderMaterial!==!0&&(A=`#version 300 es
4052`,v=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4053`)+`
4054`+v,y=["#define varying in",t.glslVersion===bx?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===bx?"":"#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(`
4055`)+`
4056`+y);const S=A+v+l,T=A+y+c,B=KA(i,i.VERTEX_SHADER,S),R=KA(i,i.FRAGMENT_SHADER,T);i.attachShader(b,B),i.attachShader(b,R),t.index0AttributeName!==void 0?i.bindAttribLocation(b,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(b,0,"position"),i.linkProgram(b);function L(D){if(s.debug.checkShaderErrors){const z=i.getProgramInfoLog(b)||"",X=i.getShaderInfoLog(B)||"",Y=i.getShaderInfoLog(R)||"",V=z.trim(),H=X.trim(),W=Y.trim();let q=!0,Q=!0;if(i.getProgramParameter(b,i.LINK_STATUS)===!1)if(q=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,b,B,R);else{const re=ZA(i,B,"vertex"),ae=ZA(i,R,"fragment");at("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(b,i.VALIDATE_STATUS)+`
4057
4058Material Name: `+D.name+`
4059Material Type: `+D.type+`
4060
4061Program Info Log: `+V+`
4062`+re+`
4063`+ae)}else V!==""?ke("WebGLProgram: Program Info Log:",V):(H===""||W==="")&&(Q=!1);Q&&(D.diagnostics={runnable:q,programLog:V,vertexShader:{log:H,prefix:v},fragmentShader:{log:W,prefix:y}})}i.deleteShader(B),i.deleteShader(R),w=new bd(i,b),I=nN(i,b)}let w;this.getUniforms=function(){return w===void 0&&L(this),w};let I;this.getAttributes=function(){return I===void 0&&L(this),I};let O=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return O===!1&&(O=i.getProgramParameter(b,XF)),O},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(b),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=JF++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=B,this.fragmentShader=R,this}let _N=0;class yN{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),l=this._getShaderCacheForMaterial(e);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(r)===!1&&(l.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new vN(e),t.set(e,n)),n}}class vN{constructor(e){this.id=_N++,this.code=e,this.usedTimes=0}}function bN(s){return s===go||s===Iu||s===Bu}function AN(s,e,t,n,i,r){const l=new ec,c=new yN,u=new Set,h=[],d=new Map,p=n.logarithmicDepthBuffer;let m=n.precision;const g={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 _(w){return u.add(w),w===0?"uv":`uv${w}`}function b(w,I,O,D,z,X){const Y=D.fog,V=z.geometry,H=w.isMeshStandardMaterial||w.isMeshLambertMaterial||w.isMeshPhongMaterial?D.environment:null,W=w.isMeshStandardMaterial||w.isMeshLambertMaterial&&!w.envMap||w.isMeshPhongMaterial&&!w.envMap,q=e.get(w.envMap||H,W),Q=q&&q.mapping===ac?q.image.height:null,re=g[w.type];w.precision!==null&&(m=n.getMaxPrecision(w.precision),m!==w.precision&&ke("WebGLProgram.getParameters:",w.precision,"not supported, using",m,"instead."));const ae=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,pe=ae!==void 0?ae.length:0;let Ue=0;V.morphAttributes.position!==void 0&&(Ue=1),V.morphAttributes.normal!==void 0&&(Ue=2),V.morphAttributes.color!==void 0&&(Ue=3);let Pe,He,le,Le;if(re){const yt=_s[re];Pe=yt.vertexShader,He=yt.fragmentShader}else Pe=w.vertexShader,He=w.fragmentShader,c.update(w),le=c.getVertexShaderID(w),Le=c.getFragmentShaderID(w);const ye=s.getRenderTarget(),ze=s.state.buffers.depth.getReversed(),Je=z.isInstancedMesh===!0,Ee=z.isBatchedMesh===!0,ht=!!w.map,qe=!!w.matcap,de=!!q,_e=!!w.aoMap,me=!!w.lightMap,Te=!!w.bumpMap,Ce=!!w.normalMap,rt=!!w.displacementMap,j=!!w.emissiveMap,ut=!!w.metalnessMap,Ze
vendor: 15,013 bytes, line 4063
4063=!!w.roughnessMap,it=w.anisotropy>0,Me=w.clearcoat>0,Gt=w.dispersion>0,U=w.iridescence>0,P=w.sheen>0,ee=w.transmission>0,he=it&&!!w.anisotropyMap,ve=Me&&!!w.clearcoatMap,Re=Me&&!!w.clearcoatNormalMap,Fe=Me&&!!w.clearcoatRoughnessMap,ue=U&&!!w.iridescenceMap,ge=U&&!!w.iridescenceThicknessMap,Xe=P&&!!w.sheenColorMap,$e=P&&!!w.sheenRoughnessMap,Oe=!!w.specularMap,Ne=!!w.specularColorMap,_t=!!w.specularIntensityMap,Mt=ee&&!!w.transmissionMap,Nt=ee&&!!w.thicknessMap,K=!!w.gradientMap,De=!!w.alphaMap,fe=w.alphaTest>0,Ye=!!w.alphaHash,Ge=!!w.extensions;let be=ns;w.toneMapped&&(ye===null||ye.isXRRenderTarget===!0)&&(be=s.toneMapping);const ot={shaderID:re,shaderType:w.type,shaderName:w.name,vertexShader:Pe,fragmentShader:He,defines:w.defines,customVertexShaderID:le,customFragmentShaderID:Le,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:m,batching:Ee,batchingColor:Ee&&z._colorsTexture!==null,instancing:Je,instancingColor:Je&&z.instanceColor!==null,instancingMorph:Je&&z.morphTexture!==null,outputColorSpace:ye===null?s.outputColorSpace:ye.isXRRenderTarget===!0?ye.texture.colorSpace:It.workingColorSpace,alphaToCoverage:!!w.alphaToCoverage,map:ht,matcap:qe,envMap:de,envMapMode:de&&q.mapping,envMapCubeUVHeight:Q,aoMap:_e,lightMap:me,bumpMap:Te,normalMap:Ce,displacementMap:rt,emissiveMap:j,normalMapObjectSpace:Ce&&w.normalMapType===KE,normalMapTangentSpace:Ce&&w.normalMapType===Er,packedNormalMap:Ce&&w.normalMapType===Er&&bN(w.normalMap.format),metalnessMap:ut,roughnessMap:Ze,anisotropy:it,anisotropyMap:he,clearcoat:Me,clearcoatMap:ve,clearcoatNormalMap:Re,clearcoatRoughnessMap:Fe,dispersion:Gt,iridescence:U,iridescenceMap:ue,iridescenceThicknessMap:ge,sheen:P,sheenColorMap:Xe,sheenRoughnessMap:$e,specularMap:Oe,specularColorMap:Ne,specularIntensityMap:_t,transmission:ee,transmissionMap:Mt,thicknessMap:Nt,gradientMap:K,opaque:w.transparent===!1&&w.blending===ha&&w.alphaToCoverage===!1,alphaMap:De,alphaTest:fe,alphaHash:Ye,combine:w.combine,mapUv:ht&&_(w.map.channel),aoMapUv:_e&&_(w.aoMap.channel),lightMapUv:me&&_(w.lightMap.channel),bumpMapUv:Te&&_(w.bumpMap.channel),normalMapUv:Ce&&_(w.normalMap.channel),displacementMapUv:rt&&_(w.displacementMap.channel),emissiveMapUv:j&&_(w.emissiveMap.channel),metalnessMapUv:ut&&_(w.metalnessMap.channel),roughnessMapUv:Ze&&_(w.roughnessMap.channel),anisotropyMapUv:he&&_(w.anisotropyMap.channel),clearcoatMapUv:ve&&_(w.clearcoatMap.channel),clearcoatNormalMapUv:Re&&_(w.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Fe&&_(w.clearcoatRoughnessMap.channel),iridescenceMapUv:ue&&_(w.iridescenceMap.channel),iridescenceThicknessMapUv:ge&&_(w.iridescenceThicknessMap.channel),sheenColorMapUv:Xe&&_(w.sheenColorMap.channel),sheenRoughnessMapUv:$e&&_(w.sheenRoughnessMap.channel),specularMapUv:Oe&&_(w.specularMap.channel),specularColorMapUv:Ne&&_(w.specularColorMap.channel),specularIntensityMapUv:_t&&_(w.specularIntensityMap.channel),transmissionMapUv:Mt&&_(w.transmissionMap.channel),thicknessMapUv:Nt&&_(w.thicknessMap.channel),alphaMapUv:De&&_(w.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(Ce||it),vertexNormals:!!V.attributes.normal,vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!V.attributes.uv&&(ht||De),fog:!!Y,useFog:w.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:w.wireframe===!1&&(w.flatShading===!0||V.attributes.normal===void 0&&Ce===!1&&(w.isMeshLambertMaterial||w.isMeshPhongMaterial||w.isMeshStandardMaterial||w.isMeshPhysicalMaterial)),sizeAttenuation:w.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:ze,skinning:z.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:pe,morphTextureStride:Ue,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numLightProbeGrids:X.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:w.dithering,shadowMapEnabled:s.shadowMap.enabled&&O.length>0,shadowMapType:s.shadowMap.type,toneMapping:be,decodeVideoTexture:ht&&w.map.isVideoTexture===!0&&It.getTransfer(w.map.colorSpace)===Qt,decodeVideoTextureEmissive:j&&w.emissiveMap.isVideoTexture===!0&&It.getTransfer(w.emissiveMap.colorSpace)===Qt,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===Vi,flipSided:w.side===_i,useDepthPacking:w.depthPacking>=0,depthPacking:w.depthPacking||0,index0AttributeName:w.index0AttributeName,extensionClipCullDistance:Ge&&w.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ge&&w.extensions.multiDraw===!0||Ee)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:w.customProgramCacheKey()};return ot.vertexUv1s=u.has(1),ot.vertexUv2s=u.has(2),ot.vertexUv3s=u.has(3),u.clear(),ot}function v(w){const I=[];if(w.shaderID?I.push(w.shaderID):(I.push(w.customVertexShaderID),I.push(w.customFragmentShaderID)),w.defines!==void 0)for(const O in w.defines)I.push(O),I.push(w.defines[O]);return w.isRawShaderMaterial===!1&&(y(I,w),A(I,w),I.push(s.outputColorSpace)),I.push(w.customProgramCacheKey),I.join()}function y(w,I){w.push(I.precision),w.push(I.outputColorSpace),w.push(I.envMapMode),w.push(I.envMapCubeUVHeight),w.push(I.mapUv),w.push(I.alphaMapUv),w.push(I.lightMapUv),w.push(I.aoMapUv),w.push(I.bumpMapUv),w.push(I.normalMapUv),w.push(I.displacementMapUv),w.push(I.emissiveMapUv),w.push(I.metalnessMapUv),w.push(I.roughnessMapUv),w.push(I.anisotropyMapUv),w.push(I.clearcoatMapUv),w.push(I.clearcoatNormalMapUv),w.push(I.clearcoatRoughnessMapUv),w.push(I.iridescenceMapUv),w.push(I.iridescenceThicknessMapUv),w.push(I.sheenColorMapUv),w.push(I.sheenRoughnessMapUv),w.push(I.specularMapUv),w.push(I.specularColorMapUv),w.push(I.specularIntensityMapUv),w.push(I.transmissionMapUv),w.push(I.thicknessMapUv),w.push(I.combine),w.push(I.fogExp2),w.push(I.sizeAttenuation),w.push(I.morphTargetsCount),w.push(I.morphAttributeCount),w.push(I.numDirLights),w.push(I.numPointLights),w.push(I.numSpotLights),w.push(I.numSpotLightMaps),w.push(I.numHemiLights),w.push(I.numRectAreaLights),w.push(I.numDirLightShadows),w.push(I.numPointLightShadows),w.push(I.numSpotLightShadows),w.push(I.numSpotLightShadowsWithMaps),w.push(I.numLightProbes),w.push(I.shadowMapType),w.push(I.toneMapping),w.push(I.numClippingPlanes),w.push(I.numClipIntersection),w.push(I.depthPacking)}function A(w,I){l.disableAll(),I.instancing&&l.enable(0),I.instancingColor&&l.enable(1),I.instancingMorph&&l.enable(2),I.matcap&&l.enable(3),I.envMap&&l.enable(4),I.normalMapObjectSpace&&l.enable(5),I.normalMapTangentSpace&&l.enable(6),I.clearcoat&&l.enable(7),I.iridescence&&l.enable(8),I.alphaTest&&l.enable(9),I.vertexColors&&l.enable(10),I.vertexAlphas&&l.enable(11),I.vertexUv1s&&l.enable(12),I.vertexUv2s&&l.enable(13),I.vertexUv3s&&l.enable(14),I.vertexTangents&&l.enable(15),I.anisotropy&&l.enable(16),I.alphaHash&&l.enable(17),I.batching&&l.enable(18),I.dispersion&&l.enable(19),I.batchingColor&&l.enable(20),I.gradientMap&&l.enable(21),I.packedNormalMap&&l.enable(22),I.vertexNormals&&l.enable(23),w.push(l.mask),l.disableAll(),I.fog&&l.enable(0),I.useFog&&l.enable(1),I.flatShading&&l.enable(2),I.logarithmicDepthBuffer&&l.enable(3),I.reversedDepthBuffer&&l.enable(4),I.skinning&&l.enable(5),I.morphTargets&&l.enable(6),I.morphNormals&&l.enable(7),I.morphColors&&l.enable(8),I.premultipliedAlpha&&l.enable(9),I.shadowMapEnabled&&l.enable(10),I.doubleSided&&l.enable(11),I.flipSided&&l.enable(12),I.useDepthPacking&&l.enable(13),I.dithering&&l.enable(14),I.transmission&&l.enable(15),I.sheen&&l.enable(16),I.opaque&&l.enable(17),I.pointsUvs&&l.enable(18),I.decodeVideoTexture&&l.enable(19),I.decodeVideoTextureEmissive&&l.enable(20),I.alphaToCoverage&&l.enable(21),I.numLightProbeGrids>0&&l.enable(22),w.push(l.mask)}function S(w){const I=g[w.type];let O;if(I){const D=_s[I];O=xp.clone(D.uniforms)}else O=w.uniforms;return O}function T(w,I){let O=d.get(I);return O!==void 0?++O.usedTimes:(O=new xN(s,I,w,i),h.push(O),d.set(I,O)),O}function B(w){if(--w.usedTimes===0){const I=h.indexOf(w);h[I]=h[h.length-1],h.pop(),d.delete(w.cacheKey),w.destroy()}}function R(w){c.remove(w)}function L(){c.dispose()}return{getParameters:b,getProgramCacheKey:v,getUniforms:S,acquireProgram:T,releaseProgram:B,releaseShaderCache:R,programs:h,dispose:L}}function MN(){let s=new WeakMap;function e(l){return s.has(l)}function t(l){let c=s.get(l);return c===void 0&&(c={},s.set(l,c)),c}function n(l){s.delete(l)}function i(l,c,u){s.get(l)[c]=u}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function SN(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.materialVariant!==e.materialVariant?s.materialVariant-e.materialVariant:s.z!==e.z?s.z-e.z:s.id-e.id}function nM(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function iM(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function l(m){let g=0;return m.isInstancedMesh&&(g+=2),m.isSkinnedMesh&&(g+=1),g}function c(m,g,_,b,v,y){let A=s[e];return A===void 0?(A={id:m.id,object:m,geometry:g,material:_,materialVariant:l(m),groupOrder:b,renderOrder:m.renderOrder,z:v,group:y},s[e]=A):(A.id=m.id,A.object=m,A.geometry=g,A.material=_,A.materialVariant=l(m),A.groupOrder=b,A.renderOrder=m.renderOrder,A.z=v,A.group=y),e++,A}function u(m,g,_,b,v,y){const A=c(m,g,_,b,v,y);_.transmission>0?n.push(A):_.transparent===!0?i.push(A):t.push(A)}function h(m,g,_,b,v,y){const A=c(m,g,_,b,v,y);_.transmission>0?n.unshift(A):_.transparent===!0?i.unshift(A):t.unshift(A)}function d(m,g){t.length>1&&t.sort(m||SN),n.length>1&&n.sort(g||nM),i.length>1&&i.sort(g||nM)}function p(){for(let m=e,g=s.length;m<g;m++){const _=s[m];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:u,unshift:h,finish:p,sort:d}}function EN(){let s=new WeakMap;function e(n,i){const r=s.get(n);let l;return r===void 0?(l=new iM,s.set(n,[l])):i>=r.length?(l=new iM,r.push(l)):l=r[i],l}function t(){s=new WeakMap}return{get:e,dispose:t}}function TN(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new we};break;case"SpotLight":t={position:new G,direction:new G,color:new we,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new we,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new we,groundColor:new we};break;case"RectAreaLight":t={color:new we,position:new G,halfWidth:new G,halfHeight:new G};break}return s[e.id]=t,t}}}function CN(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new xe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new xe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new xe,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let wN=0;function RN(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function IN(s){const e=new TN,t=CN(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)n.probe.push(new G);const i=new G,r=new ft,l=new ft;function c(h){let d=0,p=0,m=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let g=0,_=0,b=0,v=0,y=0,A=0,S=0,T=0,B=0,R=0,L=0;h.sort(RN);for(let I=0,O=h.length;I<O;I++){const D=h[I],z=D.color,X=D.intensity,Y=D.distance;let V=null;if(D.shadow&&D.shadow.map&&(D.shadow.map.texture.format===go?V=D.shadow.map.texture:V=D.shadow.map.depthTexture||D.shadow.map.texture),D.isAmbientLight)d+=z.r*X,p+=z.g*X,m+=z.b*X;else if(D.isLightProbe){for(let H=0;H<9;H++)n.probe[H].addScaledVector(D.sh.coefficients[H],X);L++}else if(D.isDirectionalLight){const H=e.get(D);if(H.color.copy(D.color).multiplyScalar(D.intensity),D.castShadow){const W=D.shadow,q=t.get(D);q.shadowIntensity=W.intensity,q.shadowBias=W.bias,q.shadowNormalBias=W.normalBias,q.shadowRadius=W.radius,q.shadowMapSize=W.mapSize,n.directionalShadow[g]=q,n.directionalShadowMap[g]=V,n.directionalShadowMatrix[g]=D.shadow.matrix,A++}n.directional[g]=H,g++}else if(D.isSpotLight){const H=e.get(D);H.position.setFromMatrixPosition(D.matrixWorld),H.color.copy(z).multiplyScalar(X),H.distance=Y,H.coneCos=Math.cos(D.angle),H.penumbraCos=Math.cos(D.angle*(1-D.penumbra)),H.decay=D.decay,n.spot[b]=H;const W=D.shadow;if(D.map&&(n.spotLightMap[B]=D.map,B++,W.updateMatrices(D),D.castShadow&&R++),n.spotLightMatrix[b]=W.matrix,D.castShadow){const q=t.get(D);q.shadowIntensity=W.intensity,q.shadowBias=W.bias,q.shadowNormalBias=W.normalBias,q.shadowRadius=W.radius,q.shadowMapSize=W.mapSize,n.spotShadow[b]=q,n.spotShadowMap[b]=V,T++}b++}else if(D.isRectAreaLight){const H=e.get(D);H.color.copy(z).multiplyScalar(X),H.halfWidth.set(D.width*.5,0,0),H.halfHeight.set(0,D.height*.5,0),n.rectArea[v]=H,v++}else if(D.isPointLight){const H=e.get(D);if(H.color.copy(D.color).multiplyScalar(D.intensity),H.distance=D.distance,H.decay=D.decay,D.castShadow){const W=D.shadow,q=t.get(D);q.shadowIntensity=W.intensity,q.shadowBias=W.bias,q.shadowNormalBias=W.normalBias,q.shadowRadius=W.radius,q.shadowMapSize=W.mapSize,q.shadowCameraNear=W.camera.near,q.shadowCameraFar=W.camera.far,n.pointShadow[_]=q,n.pointShadowMap[_]=V,n.pointShadowMatrix[_]=D.shadow.matrix,S++}n.point[_]=H,_++}else if(D.isHemisphereLight){const H=e.get(D);H.skyColor.copy(D.color).multiplyScalar(X),H.groundColor.copy(D.groundColor).multiplyScalar(X),n.hemi[y]=H,y++}}v>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=je.LTC_FLOAT_1,n.rectAreaLTC2=je.LTC_FLOAT_2):(n.rectAreaLTC1=je.LTC_HA
vendor: 4,224 bytes, lines 4063-4090
4063LF_1,n.rectAreaLTC2=je.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=p,n.ambient[2]=m;const w=n.hash;(w.directionalLength!==g||w.pointLength!==_||w.spotLength!==b||w.rectAreaLength!==v||w.hemiLength!==y||w.numDirectionalShadows!==A||w.numPointShadows!==S||w.numSpotShadows!==T||w.numSpotMaps!==B||w.numLightProbes!==L)&&(n.directional.length=g,n.spot.length=b,n.rectArea.length=v,n.point.length=_,n.hemi.length=y,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=T+B-R,n.spotLightMap.length=B,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=L,w.directionalLength=g,w.pointLength=_,w.spotLength=b,w.rectAreaLength=v,w.hemiLength=y,w.numDirectionalShadows=A,w.numPointShadows=S,w.numSpotShadows=T,w.numSpotMaps=B,w.numLightProbes=L,n.version=wN++)}function u(h,d){let p=0,m=0,g=0,_=0,b=0;const v=d.matrixWorldInverse;for(let y=0,A=h.length;y<A;y++){const S=h[y];if(S.isDirectionalLight){const T=n.directional[p];T.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),T.direction.sub(i),T.direction.transformDirection(v),p++}else if(S.isSpotLight){const T=n.spot[g];T.position.setFromMatrixPosition(S.matrixWorld),T.position.applyMatrix4(v),T.direction.setFromMatrixPosition(S.matrixWorld),i.setFromMatrixPosition(S.target.matrixWorld),T.direction.sub(i),T.direction.transformDirection(v),g++}else if(S.isRectAreaLight){const T=n.rectArea[_];T.position.setFromMatrixPosition(S.matrixWorld),T.position.applyMatrix4(v),l.identity(),r.copy(S.matrixWorld),r.premultiply(v),l.extractRotation(r),T.halfWidth.set(S.width*.5,0,0),T.halfHeight.set(0,S.height*.5,0),T.halfWidth.applyMatrix4(l),T.halfHeight.applyMatrix4(l),_++}else if(S.isPointLight){const T=n.point[m];T.position.setFromMatrixPosition(S.matrixWorld),T.position.applyMatrix4(v),m++}else if(S.isHemisphereLight){const T=n.hemi[b];T.direction.setFromMatrixPosition(S.matrixWorld),T.direction.transformDirection(v),b++}}}return{setup:c,setupView:u,state:n}}function sM(s){const e=new IN(s),t=[],n=[],i=[];function r(m){p.camera=m,t.length=0,n.length=0,i.length=0}function l(m){t.push(m)}function c(m){n.push(m)}function u(m){i.push(m)}function h(){e.setup(t)}function d(m){e.setupView(t,m)}const p={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:p,setupLights:h,setupLightsView:d,pushLight:l,pushShadow:c,pushLightProbeGrid:u}}function BN(s){let e=new WeakMap;function t(i,r=0){const l=e.get(i);let c;return l===void 0?(c=new sM(s),e.set(i,[c])):r>=l.length?(c=new sM(s),l.push(c)):c=l[r],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const PN=`void main() {
4064	gl_Position = vec4( position, 1.0 );
4065}`,LN=`uniform sampler2D shadow_pass;
4066uniform vec2 resolution;
4067uniform float radius;
4068void main() {
4069	const float samples = float( VSM_SAMPLES );
4070	float mean = 0.0;
4071	float squared_mean = 0.0;
4072	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4073	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4074	for ( float i = 0.0; i < samples; i ++ ) {
4075		float uvOffset = uvStart + i * uvStride;
4076		#ifdef HORIZONTAL_PASS
4077			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4078			mean += distribution.x;
4079			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4080		#else
4081			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4082			mean += depth;
4083			squared_mean += depth * depth;
4084		#endif
4085	}
4086	mean = mean / samples;
4087	squared_mean = squared_mean / samples;
4088	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4089	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4090}`,DN=[new G(1,0,0),new G(-1,0,0),new G(0,1,0),new G(0,-1,0),new G(0,0,1),new G(0,0,-1)],FN=[new G(0,-1,0),new G(0,-1,0),new G(0,0,1),new G(0,0,-1),new G(0,-1,0),new G(0,-1,0)],rM=new ft,Qc=new G,_0=new G;function NN(s,e,t){let n=new cc;const i=new xe,r=new xe,l=new Ht,c=new C_,u=new w_,h={},d=t.maxTextureSize,p={[Zs]:_i,[_i]:Zs,[Vi]:Vi}
vendor: 4,930 bytes, line 4090
4090,m=new Ii({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new xe},radius:{value:4}},vertexShader:PN,fragmentShader:LN}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const _=new mt;_.setAttribute("position",new Ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new An(_,m),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zl;let y=this.type;this.render=function(R,L,w){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||R.length===0)return;this.type===_u&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=zl);const I=s.getRenderTarget(),O=s.getActiveCubeFace(),D=s.getActiveMipmapLevel(),z=s.state;z.setBlending(Ys),z.buffers.depth.getReversed()===!0?z.buffers.color.setClear(0,0,0,0):z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const X=y!==this.type;X&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(V=>V.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,V=R.length;Y<V;Y++){const H=R[Y],W=H.shadow;if(W===void 0){ke("WebGLShadowMap:",H,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;i.copy(W.mapSize);const q=W.getFrameExtents();i.multiply(q),r.copy(W.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(r.x=Math.floor(d/q.x),i.x=r.x*q.x,W.mapSize.x=r.x),i.y>d&&(r.y=Math.floor(d/q.y),i.y=r.y*q.y,W.mapSize.y=r.y));const Q=s.state.buffers.depth.getReversed();if(W.camera._reversedDepth=Q,W.map===null||X===!0){if(W.map!==null&&(W.map.depthTexture!==null&&(W.map.depthTexture.dispose(),W.map.depthTexture=null),W.map.dispose()),this.type===na){if(H.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}W.map=new Ri(i.x,i.y,{format:go,type:bs,minFilter:nn,magFilter:nn,generateMipmaps:!1}),W.map.texture.name=H.name+".shadowMap",W.map.depthTexture=new _o(i.x,i.y,oi),W.map.depthTexture.name=H.name+".shadowMapDepth",W.map.depthTexture.format=$s,W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=bn,W.map.depthTexture.magFilter=bn}else H.isPointLight?(W.map=new V_(i.x),W.map.depthTexture=new f1(i.x,is)):(W.map=new Ri(i.x,i.y),W.map.depthTexture=new _o(i.x,i.y,is)),W.map.depthTexture.name=H.name+".shadowMap",W.map.depthTexture.format=$s,this.type===zl?(W.map.depthTexture.compareFunction=Q?Op:Np,W.map.depthTexture.minFilter=nn,W.map.depthTexture.magFilter=nn):(W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=bn,W.map.depthTexture.magFilter=bn);W.camera.updateProjectionMatrix()}const re=W.map.isWebGLCubeRenderTarget?6:1;for(let ae=0;ae<re;ae++){if(W.map.isWebGLCubeRenderTarget)s.setRenderTarget(W.map,ae),s.clear();else{ae===0&&(s.setRenderTarget(W.map),s.clear());const pe=W.getViewport(ae);l.set(r.x*pe.x,r.y*pe.y,r.x*pe.z,r.y*pe.w),z.viewport(l)}if(H.isPointLight){const pe=W.camera,Ue=W.matrix,Pe=H.distance||pe.far;Pe!==pe.far&&(pe.far=Pe,pe.updateProjectionMatrix()),Qc.setFromMatrixPosition(H.matrixWorld),pe.position.copy(Qc),_0.copy(pe.position),_0.add(DN[ae]),pe.up.copy(FN[ae]),pe.lookAt(_0),pe.updateMatrixWorld(),Ue.makeTranslation(-Qc.x,-Qc.y,-Qc.z),rM.multiplyMatrices(pe.projectionMatrix,pe.matrixWorldInverse),W._frustum.setFromProjectionMatrix(rM,pe.coordinateSystem,pe.reversedDepth)}else W.updateMatrices(H);n=W.getFrustum(),T(L,w,W.camera,H,this.type)}W.isPointLightShadow!==!0&&this.type===na&&A(W,w),W.needsUpdate=!1}y=this.type,v.needsUpdate=!1,s.setRenderTarget(I,O,D)};function A(R,L){const w=e.update(b);m.defines.VSM_SAMPLES!==R.blurSamples&&(m.defines.VSM_SAMPLES=R.blurSamples,g.defines.VSM_SAMPLES=R.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ri(i.x,i.y,{format:go,type:bs})),m.uniforms.shadow_pass.value=R.map.depthTexture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,s.setRenderTarget(R.mapPass),s.clear(),s.renderBufferDirect(L,null,w,m,b,null),g.uniforms.shadow_pass.value=R.mapPass.texture,g.uniforms.resolution.value=R.mapSize,g.uniforms.radius.value=R.radius,s.setRenderTarget(R.map),s.clear(),s.renderBufferDirect(L,null,w,g,b,null)}function S(R,L,w,I){let O=null;const D=w.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(D!==void 0)O=D;else if(O=w.isPointLight===!0?u:c,s.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const z=O.uuid,X=L.uuid;let Y=h[z];Y===void 0&&(Y={},h[z]=Y);let V=Y[X];V===void 0&&(V=O.clone(),Y[X]=V,L.addEventListener("dispose",B)),O=V}if(O.visible=L.visible,O.wireframe=L.wireframe,I===na?O.side=L.shadowSide!==null?L.shadowSide:L.side:O.side=L.shadowSide!==null?L.shadowSide:p[L.side],O.alphaMap=L.alphaMap,O.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,O.map=L.map,O.clipSh
vendor: 4,584 bytes, line 4090
4090adows=L.clipShadows,O.clippingPlanes=L.clippingPlanes,O.clipIntersection=L.clipIntersection,O.displacementMap=L.displacementMap,O.displacementScale=L.displacementScale,O.displacementBias=L.displacementBias,O.wireframeLinewidth=L.wireframeLinewidth,O.linewidth=L.linewidth,w.isPointLight===!0&&O.isMeshDistanceMaterial===!0){const z=s.properties.get(O);z.light=w}return O}function T(R,L,w,I,O){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&O===na)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,R.matrixWorld);const X=e.update(R),Y=R.material;if(Array.isArray(Y)){const V=X.groups;for(let H=0,W=V.length;H<W;H++){const q=V[H],Q=Y[q.materialIndex];if(Q&&Q.visible){const re=S(R,Q,I,O);R.onBeforeShadow(s,R,L,w,X,re,q),s.renderBufferDirect(w,null,X,re,R,q),R.onAfterShadow(s,R,L,w,X,re,q)}}}else if(Y.visible){const V=S(R,Y,I,O);R.onBeforeShadow(s,R,L,w,X,V,null),s.renderBufferDirect(w,null,X,V,R,null),R.onAfterShadow(s,R,L,w,X,V,null)}}const z=R.children;for(let X=0,Y=z.length;X<Y;X++)T(z[X],L,w,I,O)}function B(R){R.target.removeEventListener("dispose",B);for(const w in h){const I=h[w],O=R.target.uuid;O in I&&(I[O].dispose(),delete I[O])}}}function ON(s,e){function t(){let K=!1;const De=new Ht;let fe=null;const Ye=new Ht(0,0,0,0);return{setMask:function(Ge){fe!==Ge&&!K&&(s.colorMask(Ge,Ge,Ge,Ge),fe=Ge)},setLocked:function(Ge){K=Ge},setClear:function(Ge,be,ot,yt,cn){cn===!0&&(Ge*=yt,be*=yt,ot*=yt),De.set(Ge,be,ot,yt),Ye.equals(De)===!1&&(s.clearColor(Ge,be,ot,yt),Ye.copy(De))},reset:function(){K=!1,fe=null,Ye.set(-1,0,0,0)}}}function n(){let K=!1,De=!1,fe=null,Ye=null,Ge=null;return{setReversed:function(be){if(De!==be){const ot=e.get("EXT_clip_control");be?ot.clipControlEXT(ot.LOWER_LEFT_EXT,ot.ZERO_TO_ONE_EXT):ot.clipControlEXT(ot.LOWER_LEFT_EXT,ot.NEGATIVE_ONE_TO_ONE_EXT),De=be;const yt=Ge;Ge=null,this.setClear(yt)}},getReversed:function(){return De},setTest:function(be){be?ye(s.DEPTH_TEST):ze(s.DEPTH_TEST)},setMask:function(be){fe!==be&&!K&&(s.depthMask(be),fe=be)},setFunc:function(be){if(De&&(be=oI[be]),Ye!==be){switch(be){case wd:s.depthFunc(s.NEVER);break;case Rd:s.depthFunc(s.ALWAYS);break;case Id:s.depthFunc(s.LESS);break;case ga:s.depthFunc(s.LEQUAL);break;case Bd:s.depthFunc(s.EQUAL);break;case Pd:s.depthFunc(s.GEQUAL);break;case Ld:s.depthFunc(s.GREATER);break;case Dd:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}Ye=be}},setLocked:function(be){K=be},setClear:function(be){Ge!==be&&(Ge=be,De&&(be=1-be),s.clearDepth(be))},reset:function(){K=!1,fe=null,Ye=null,Ge=null,De=!1}}}function i(){let K=!1,De=null,fe=null,Ye=null,Ge=null,be=null,ot=null,yt=null,cn=null;return{setTest:function(Vt){K||(Vt?ye(s.STENCIL_TEST):ze(s.STENCIL_TEST))},setMask:function(Vt){De!==Vt&&!K&&(s.stencilMask(Vt),De=Vt)},setFunc:function(Vt,yi,Bi){(fe!==Vt||Ye!==yi||Ge!==Bi)&&(s.stencilFunc(Vt,yi,Bi),fe=Vt,Ye=yi,Ge=Bi)},setOp:function(Vt,yi,Bi){(be!==Vt||ot!==yi||yt!==Bi)&&(s.stencilOp(Vt,yi,Bi),be=Vt,ot=yi,yt=Bi)},setLocked:function(Vt){K=Vt},setClear:function(Vt){cn!==Vt&&(s.clearStencil(Vt),cn=Vt)},reset:function(){K=!1,De=null,fe=null,Ye=null,Ge=null,be=null,ot=null,yt=null,cn=null}}}const r=new t,l=new n,c=new i,u=new WeakMap,h=new WeakMap;let d={},p={},m={},g=new WeakMap,_=[],b=null,v=!1,y=null,A=null,S=null,T=null,B=null,R=null,L=null,w=new we(0,0,0),I=0,O=!1,D=null,z=null,X=null,Y=null,V=null;const H=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,q=0;const Q=s.getParameter(s.VERSION);Q.indexOf("WebGL")!==-1?(q=parseFloat(/^WebGL (\d)/.exec(Q)[1]),W=q>=1):Q.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),W=q>=2);let re=null,ae={};const pe=s.getParameter(s.SCISSOR_BOX),Ue=s.getParameter(s.VIEWPORT),Pe=new Ht().fromArray(pe),He=new Ht().fromArray(Ue);function le(K,De,fe,Ye){const Ge=new Uint8Array(4),be=s.createTexture();s.bindTexture(K,be),s.texParameteri(K,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(K,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ot=0;ot<fe;ot++)K===s.TEXTURE_3D||K===s.TEXTURE_2D_ARRAY?s.texImage3D(De,0,s.RGBA,1,1,Ye,0,s.RGBA,s.UNSIGNED_BYTE,Ge):s.texImage2D(De+ot,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,Ge);return be}const Le={};Le[s.TEXTURE_2D]=le(s.TEXTURE_2D,s.TEXTURE_2D,1),Le[s.TEXTURE_CUBE_MAP]=le(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),Le[s.TEXTURE_2D_ARRAY]=le(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),Le[s.TEXTURE_3D]=le(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),l.setClear(1),c.setClear(0),ye(s.DEPTH_TEST),l.setFu
vendor: 24,293 bytes, line 4090
4090nc(ga),Te(!1),Ce(px),ye(s.CULL_FACE),_e(Ys);function ye(K){d[K]!==!0&&(s.enable(K),d[K]=!0)}function ze(K){d[K]!==!1&&(s.disable(K),d[K]=!1)}function Je(K,De){return m[K]!==De?(s.bindFramebuffer(K,De),m[K]=De,K===s.DRAW_FRAMEBUFFER&&(m[s.FRAMEBUFFER]=De),K===s.FRAMEBUFFER&&(m[s.DRAW_FRAMEBUFFER]=De),!0):!1}function Ee(K,De){let fe=_,Ye=!1;if(K){fe=g.get(De),fe===void 0&&(fe=[],g.set(De,fe));const Ge=K.textures;if(fe.length!==Ge.length||fe[0]!==s.COLOR_ATTACHMENT0){for(let be=0,ot=Ge.length;be<ot;be++)fe[be]=s.COLOR_ATTACHMENT0+be;fe.length=Ge.length,Ye=!0}}else fe[0]!==s.BACK&&(fe[0]=s.BACK,Ye=!0);Ye&&s.drawBuffers(fe)}function ht(K){return b!==K?(s.useProgram(K),b=K,!0):!1}const qe={[ao]:s.FUNC_ADD,[SE]:s.FUNC_SUBTRACT,[EE]:s.FUNC_REVERSE_SUBTRACT};qe[TE]=s.MIN,qe[CE]=s.MAX;const de={[wE]:s.ZERO,[RE]:s.ONE,[IE]:s.SRC_COLOR,[Td]:s.SRC_ALPHA,[NE]:s.SRC_ALPHA_SATURATE,[DE]:s.DST_COLOR,[PE]:s.DST_ALPHA,[BE]:s.ONE_MINUS_SRC_COLOR,[Cd]:s.ONE_MINUS_SRC_ALPHA,[FE]:s.ONE_MINUS_DST_COLOR,[LE]:s.ONE_MINUS_DST_ALPHA,[OE]:s.CONSTANT_COLOR,[UE]:s.ONE_MINUS_CONSTANT_COLOR,[GE]:s.CONSTANT_ALPHA,[kE]:s.ONE_MINUS_CONSTANT_ALPHA};function _e(K,De,fe,Ye,Ge,be,ot,yt,cn,Vt){if(K===Ys){v===!0&&(ze(s.BLEND),v=!1);return}if(v===!1&&(ye(s.BLEND),v=!0),K!==ME){if(K!==y||Vt!==O){if((A!==ao||B!==ao)&&(s.blendEquation(s.FUNC_ADD),A=ao,B=ao),Vt)switch(K){case ha:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case mx:s.blendFunc(s.ONE,s.ONE);break;case gx:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case xx:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:at("WebGLState: Invalid blending: ",K);break}else switch(K){case ha:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case mx:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case gx:at("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case xx:at("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:at("WebGLState: Invalid blending: ",K);break}S=null,T=null,R=null,L=null,w.set(0,0,0),I=0,y=K,O=Vt}return}Ge=Ge||De,be=be||fe,ot=ot||Ye,(De!==A||Ge!==B)&&(s.blendEquationSeparate(qe[De],qe[Ge]),A=De,B=Ge),(fe!==S||Ye!==T||be!==R||ot!==L)&&(s.blendFuncSeparate(de[fe],de[Ye],de[be],de[ot]),S=fe,T=Ye,R=be,L=ot),(yt.equals(w)===!1||cn!==I)&&(s.blendColor(yt.r,yt.g,yt.b,cn),w.copy(yt),I=cn),y=K,O=!1}function me(K,De){K.side===Vi?ze(s.CULL_FACE):ye(s.CULL_FACE);let fe=K.side===_i;De&&(fe=!fe),Te(fe),K.blending===ha&&K.transparent===!1?_e(Ys):_e(K.blending,K.blendEquation,K.blendSrc,K.blendDst,K.blendEquationAlpha,K.blendSrcAlpha,K.blendDstAlpha,K.blendColor,K.blendAlpha,K.premultipliedAlpha),l.setFunc(K.depthFunc),l.setTest(K.depthTest),l.setMask(K.depthWrite),r.setMask(K.colorWrite);const Ye=K.stencilWrite;c.setTest(Ye),Ye&&(c.setMask(K.stencilWriteMask),c.setFunc(K.stencilFunc,K.stencilRef,K.stencilFuncMask),c.setOp(K.stencilFail,K.stencilZFail,K.stencilZPass)),j(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),K.alphaToCoverage===!0?ye(s.SAMPLE_ALPHA_TO_COVERAGE):ze(s.SAMPLE_ALPHA_TO_COVERAGE)}function Te(K){D!==K&&(K?s.frontFace(s.CW):s.frontFace(s.CCW),D=K)}function Ce(K){K!==vE?(ye(s.CULL_FACE),K!==z&&(K===px?s.cullFace(s.BACK):K===bE?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):ze(s.CULL_FACE),z=K}function rt(K){K!==X&&(W&&s.lineWidth(K),X=K)}function j(K,De,fe){K?(ye(s.POLYGON_OFFSET_FILL),(Y!==De||V!==fe)&&(Y=De,V=fe,l.getReversed()&&(De=-De),s.polygonOffset(De,fe))):ze(s.POLYGON_OFFSET_FILL)}function ut(K){K?ye(s.SCISSOR_TEST):ze(s.SCISSOR_TEST)}function Ze(K){K===void 0&&(K=s.TEXTURE0+H-1),re!==K&&(s.activeTexture(K),re=K)}function it(K,De,fe){fe===void 0&&(re===null?fe=s.TEXTURE0+H-1:fe=re);let Ye=ae[fe];Ye===void 0&&(Ye={type:void 0,texture:void 0},ae[fe]=Ye),(Ye.type!==K||Ye.texture!==De)&&(re!==fe&&(s.activeTexture(fe),re=fe),s.bindTexture(K,De||Le[K]),Ye.type=K,Ye.texture=De)}function Me(){const K=ae[re];K!==void 0&&K.type!==void 0&&(s.bindTexture(K.type,null),K.type=void 0,K.texture=void 0)}function Gt(){try{s.compressedTexImage2D(...arguments)}catch(K){at("WebGLState:",K)}}function U(){try{s.compressedTexImage3D(...arguments)}catch(K){at("WebGLState:",K)}}function P(){try{s.texSubImage2D(...arguments)}catch(K){at("WebGLState:",K)}}function ee(){try{s.texSubImage3D(...arguments)}catch(K){at("WebGLState:",K)}}function he(){try{s.compressedTexSubImage2D(...arguments)}catch(K){at("WebGLState:",K)}}function ve(){try{s.compressedTexSubImage3D(...arguments)}catch(K){at("WebGLState:",K)}}function Re(){try{s.texStorage2D(...arguments)}catch(K){at("WebGLState:",K)}}function Fe(){try{s.texStorage3D(...arguments)}catch(K){at("WebGLState:",K)}}function ue(){try{s.texImage2D(...arguments)}catch(K){at("WebGLState:",K)}}function ge(){try{s.texImage3D(...arguments)}catch(K){at("WebGLState:",K)}}function Xe(K){return p[K]!==void 0?p[K]:s.getParameter(K)}function $e(K,De){p[K]!==De&&(s.pixelStorei(K,De),p[K]=De)}function Oe(K){Pe.equals(K)===!1&&(s.scissor(K.x,K.y,K.z,K.w),Pe.copy(K))}function Ne(K){He.equals(K)===!1&&(s.viewport(K.x,K.y,K.z,K.w),He.copy(K))}function _t(K,De){let fe=h.get(De);fe===void 0&&(fe=new WeakMap,h.set(De,fe));let Ye=fe.get(K);Ye===void 0&&(Ye=s.getUniformBlockIndex(De,K.name),fe.set(K,Ye))}function Mt(K,De){const Ye=h.get(De).get(K);u.get(De)!==Ye&&(s.uniformBlockBinding(De,Ye,K.__bindingPointIndex),u.set(De,Ye))}function Nt(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),l.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),s.pixelStorei(s.PACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.BROWSER_DEFAULT_WEBGL),s.pixelStorei(s.PACK_ROW_LENGTH,0),s.pixelStorei(s.PACK_SKIP_PIXELS,0),s.pixelStorei(s.PACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_ROW_LENGTH,0),s.pixelStorei(s.UNPACK_IMAGE_HEIGHT,0),s.pixelStorei(s.UNPACK_SKIP_PIXELS,0),s.pixelStorei(s.UNPACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_SKIP_IMAGES,0),d={},p={},re=null,ae={},m={},g=new WeakMap,_=[],b=null,v=!1,y=null,A=null,S=null,T=null,B=null,R=null,L=null,w=new we(0,0,0),I=0,O=!1,D=null,z=null,X=null,Y=null,V=null,Pe.set(0,0,s.canvas.width,s.canvas.height),He.set(0,0,s.canvas.width,s.canvas.height),r.reset(),l.reset(),c.reset()}return{buffers:{color:r,depth:l,stencil:c},enable:ye,disable:ze,bindFramebuffer:Je,drawBuffers:Ee,useProgram:ht,setBlending:_e,setMaterial:me,setFlipSided:Te,setCullFace:Ce,setLineWidth:rt,setPolygonOffset:j,setScissorTest:ut,activeTexture:Ze,bindTexture:it,unbindTexture:Me,compressedTexImage2D:Gt,compressedTexImage3D:U,texImage2D:ue,texImage3D:ge,pixelStorei:$e,getParameter:Xe,updateUBOMapping:_t,uniformBlockBinding:Mt,texStorage2D:Re,texStorage3D:Fe,texSubImage2D:P,texSubImage3D:ee,compressedTexSubImage2D:he,compressedTexSubImage3D:ve,scissor:Oe,viewport:Ne,reset:Nt}}function UN(s,e,t,n,i,r,l){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new xe,d=new WeakMap,p=new Set;let m;const g=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(U,P){return _?new OffscreenCanvas(U,P):Fu("canvas")}function v(U,P,ee){let he=1;const ve=Gt(U);if((ve.width>ee||ve.height>ee)&&(he=ee/Math.max(ve.width,ve.height)),he<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 Re=Math.floor(he*ve.width),Fe=Math.floor(he*ve.height);m===void 0&&(m=b(Re,Fe));const ue=P?b(Re,Fe):m;return ue.width=Re,ue.height=Fe,ue.getContext("2d").drawImage(U,0,0,Re,Fe),ke("WebGLRenderer: Texture has been resized from ("+ve.width+"x"+ve.height+") to ("+Re+"x"+Fe+")."),ue}else return"data"in U&&ke("WebGLRenderer: Image in DataTexture is too big ("+ve.width+"x"+ve.height+")."),U;return U}function y(U){return U.generateMipmaps}function A(U){s.generateMipmap(U)}function S(U){return U.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:U.isWebGL3DRenderTarget?s.TEXTURE_3D:U.isWebGLArrayRenderTarget||U.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function T(U,P,ee,he,ve,Re=!1){if(U!==null){if(s[U]!==void 0)return s[U];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let Fe;he&&(Fe=e.get("EXT_texture_norm16"),Fe||ke("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ue=P;if(P===s.RED&&(ee===s.FLOAT&&(ue=s.R32F),ee===s.HALF_FLOAT&&(ue=s.R16F),ee===s.UNSIGNED_BYTE&&(ue=s.R8),ee===s.UNSIGNED_SHORT&&Fe&&(ue=Fe.R16_EXT),ee===s.SHORT&&Fe&&(ue=Fe.R16_SNORM_EXT)),P===s.RED_INTEGER&&(ee===s.UNSIGNED_BYTE&&(ue=s.R8UI),ee===s.UNSIGNED_SHORT&&(ue=s.R16UI),ee===s.UNSIGNED_INT&&(ue=s.R32UI),ee===s.BYTE&&(ue=s.R8I),ee===s.SHORT&&(ue=s.R16I),ee===s.INT&&(ue=s.R32I)),P===s.RG&&(ee===s.FLOAT&&(ue=s.RG32F),ee===s.HALF_FLOAT&&(ue=s.RG16F),ee===s.UNSIGNED_BYTE&&(ue=s.RG8),ee===s.UNSIGNED_SHORT&&Fe&&(ue=Fe.RG16_EXT),ee===s.SHORT&&Fe&&(ue=Fe.RG16_SNORM_EXT)),P===s.RG_INTEGER&&(ee===s.UNSIGNED_BYTE&&(ue=s.RG8UI),ee===s.UNSIGNED_SHORT&&(ue=s.RG16UI),ee===s.UNSIGNED_INT&&(ue=s.RG32UI),ee===s.BYTE&&(ue=s.RG8I),ee===s.SHORT&&(ue=s.RG16I),ee===s.INT&&(ue=s.RG32I)),P===s.RGB_INTEGER&&(ee===s.UNSIGNED_BYTE&&(ue=s.RGB8UI),ee===s.UNSIGNED_SHORT&&(ue=s.RGB16UI),ee===s.UNSIGNED_INT&&(ue=s.RGB32UI),ee===s.BYTE&&(ue=s.RGB8I),ee===s.SHORT&&(ue=s.RGB16I),ee===s.INT&&(ue=s.RGB32I)),P===s.RGBA_INTEGER&&(ee===s.UNSIGNED_BYTE&&(ue=s.RGBA8UI),ee===s.UNSIGNED_SHORT&&(ue=s.RGBA16UI),ee===s.UNSIGNED_INT&&(ue=s.RGBA32UI),ee===s.BYTE&&(ue=s.RGBA8I),ee===s.SHORT&&(ue=s.RGBA16I),ee===s.INT&&(ue=s.RGBA32I)),P===s.RGB&&(ee===s.UNSIGNED_SHORT&&Fe&&(ue=Fe.RGB16_EXT),ee===s.SHORT&&Fe&&(ue=Fe.RGB16_SNORM_EXT),ee===s.UNSIGNED_INT_5_9_9_9_REV&&(ue=s.RGB9_E5),ee===s.UNSIGNED_INT_10F_11F_11F_REV&&(ue=s.R11F_G11F_B10F)),P===s.RGBA){const ge=Re?Lu:It.getTransfer(ve);ee===s.FLOAT&&(ue=s.RGBA32F),ee===s.HALF_FLOAT&&(ue=s.RGBA16F),ee===s.UNSIGNED_BYTE&&(ue=ge===Qt?s.SRGB8_ALPHA8:s.RGBA8),ee===s.UNSIGNED_SHORT&&Fe&&(ue=Fe.RGBA16_EXT),ee===s.SHORT&&Fe&&(ue=Fe.RGBA16_SNORM_EXT),ee===s.UNSIGNED_SHORT_4_4_4_4&&(ue=s.RGBA4),ee===s.UNSIGNED_SHORT_5_5_5_1&&(ue=s.RGB5_A1)}return(ue===s.R16F||ue===s.R32F||ue===s.RG16F||ue===s.RG32F||ue===s.RGBA16F||ue===s.RGBA32F)&&e.get("EXT_color_buffer_float"),ue}function B(U,P){let ee;return U?P===null||P===is||P===Kl?ee=s.DEPTH24_STENCIL8:P===oi?ee=s.DEPTH32F_STENCIL8:P===Yl&&(ee=s.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):P===null||P===is||P===Kl?ee=s.DEPTH_COMPONENT24:P===oi?ee=s.DEPTH_COMPONENT32F:P===Yl&&(ee=s.DEPTH_COMPONENT16),ee}function R(U,P){return y(U)===!0||U.isFramebufferTexture&&U.minFilter!==bn&&U.minFilter!==nn?Math.log2(Math.max(P.width,P.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?P.mipmaps.length:1}function L(U){const P=U.target;P.removeEventListener("dispose",L),I(P),P.isVideoTexture&&d.delete(P),P.isHTMLTexture&&p.delete(P)}function w(U){const P=U.target;P.removeEventListener("dispose",w),D(P)}function I(U){const P=n.get(U);if(P.__webglInit===void 0)return;const ee=U.source,he=g.get(ee);if(he){const ve=he[P.__cacheKey];ve.usedTimes--,ve.usedTimes===0&&O(U),Object.keys(he).length===0&&g.delete(ee)}n.remove(U)}function O(U){const P=n.get(U);s.deleteTexture(P.__webglTexture);const ee=U.source,he=g.get(ee);delete he[P.__cacheKey],l.memory.textures--}function D(U){const P=n.get(U);if(U.depthTexture&&(U.depthTexture.dispose(),n.remove(U.depthTexture)),U.isWebGLCubeRenderTarget)for(let he=0;he<6;he++){if(Array.isArray(P.__webglFramebuffer[he]))for(let ve=0;ve<P.__webglFramebuffer[he].length;ve++)s.deleteFramebuffer(P.__webglFramebuffer[he][ve]);else s.deleteFramebuffer(P.__webglFramebuffer[he]);P.__webglDepthbuffer&&s.deleteRenderbuffer(P.__webglDepthbuffer[he])}else{if(Array.isArray(P.__webglFramebuffer))for(let he=0;he<P.__webglFramebuffer.length;he++)s.deleteFramebuffer(P.__webglFramebuffer[he]);else s.deleteFramebuffer(P.__webglFramebuffer);if(P.__webglDepthbuffer&&s.deleteRenderbuffer(P.__webglDepthbuffer),P.__webglMultisampledFramebuffer&&s.deleteFramebuffer(P.__webglMultisampledFramebuffer),P.__webglColorRenderbuffer)for(let he=0;he<P.__webglColorRenderbuffer.length;he++)P.__webglColorRenderbuffer[he]&&s.deleteRenderbuffer(P.__webglColorRenderbuffer[he]);P.__webglDepthRenderbuffer&&s.deleteRenderbuffer(P.__webglDepthRenderbuffer)}const ee=U.textures;for(let he=0,ve=ee.length;he<ve;he++){const Re=n.get(ee[he]);Re.__webglTexture&&(s.deleteTexture(Re.__webglTexture),l.memory.textures--),n.remove(ee[he])}n.remove(U)}let z=0;function X(){z=0}function Y(){return z}function V(U){z=U}function H(){const U=z;return U>=i.maxTextures&&ke("WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+i.maxTextures),z+=1,U}function W(U){const P=[];return P.push(U.wrapS),P.push(U.wrapT),P.push(U.wrapR||0),P.push(U.magFilter),P.push(U.minFilter),P.push(U.anisotropy),P.push(U.internalFormat),P.push(U.format),P.push(U.type),P.push(U.generateMipmaps),P.push(U.premultiplyAlpha),P.push(U.flipY),P.push(U.unpackAlignment),P.push(U.colorSpace),P.join()}function q(U,P){const ee=n.get(U);if(U.isVideoTexture&&it(U),U.isRenderTargetTexture===!1&&U.isExternalTexture!==!0&&U.version>0&&ee.__version!==U.version){const he=U.image;if(he===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{ze(ee,U,P);return}}else U.isExternalTexture&&(ee.__webglTexture=U.sourceTexture?U.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,ee.__webglTexture,s.TEXTURE0+P)}function Q(U,P){const ee=n.get(U);if(U.isRenderTargetTexture===!1&&U.version>0&&ee.__version!==U.version){ze(ee,U,P);return}else U.isExternalTexture&&(ee.__webglTexture=U.sourceTexture?U.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,ee.__webglTexture,s.TEXTURE0+P)}function re(U,P){const ee=n.get(U);if(U.isRenderTargetTexture===!1&&U.version>0&&ee.__version!==U.version){ze(ee,U,P);return}t.bindTexture(s.TEXTURE_3D,ee.__webglTexture,s.TEXTURE0+P)}function ae(U,P){const ee=n.get(U);if(U.isCubeDepthTexture!==!0&&U.version>0&&ee.__version!==U.version){Je(ee,U,P);return}t.bindTexture(s.TEXTURE_CUBE_MAP,ee.__webglTexture,s.TEXTURE0+P)}const pe={[mo]:s.REPEAT,[xi]:s.CLAMP_TO_EDGE,[Jl]:s.MIRRORED_REPEAT},Ue={[bn]:s.NEAREST,[wp]:s.NEAREST_MIPMAP_NEAREST,[ia]:s.NEAREST_MIPMAP_LINEAR,[nn]:s.LINEAR,[Vl]:s.LINEAR_MIPMAP_NEAREST,[ts]:s.LINEAR_MIPMAP_LINEAR},Pe={[qE]:s.NEVER,[t1]:s.ALWAYS,[ZE]:s.LESS,[Np]:s.LEQUAL,[QE]:s.EQUAL,[Op]:s.GEQUAL,[$E]:s.GREATER,[e1]:s.NOTEQUAL};function He(U,P){if(P.type===oi&&e.has("OES_texture_float_linear")===!1&&(P.magFilter===nn||P.magFilter===Vl||P.magFilter===ia||P.magFilter===ts||P.minFilter===nn||P.minFilter===Vl||P.minFilter===ia||P.minFilter===ts)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(U,s.TEXTURE_WRAP_S,pe[P.wrapS]),s.texParameteri(U,s.TEXTURE_WRAP_T,pe[P.wrapT]),(U===s.TEXTURE_3D||U===s.TEXTURE_2D_ARRAY)&&s.texParameteri(U,s.TEXTURE_WRAP_R,pe[P.wrapR]),s.texParameteri(U,s.TEXTURE_MAG_FILTER,Ue[P.magFilter]),s.texParameteri(U,s.TEXTURE_MIN_FILTER,Ue[P.minFilter]),P.compareFunction&&(s.texParameteri(U,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(U,s.TEXTURE_COMPARE_FUNC,Pe[P.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(P.magFilter===bn||P.minFilter!==ia&&P.minFilter!==ts||P.type===oi&&e.has("OES_texture_float_linear")===!1)return;if(P.anisotropy>1||n.get(P).__currentAnisotropy){const ee=e.get("EXT_texture_filter_anisotropic");s.texParameterf(U,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,i.getMaxAnisotropy())),n.get(P).__currentAnisotropy=P.anisotropy}}}function le(U,P){let ee=!1;U.__webglInit===void 0&&(U.__webglInit=!0,P.addEventListener("dispose",L));const he=P.source;let ve=g.get(he);ve===void 0&&(ve={},g.set(he,ve));const Re=W(P);if(Re!==U.__cacheKey){ve[Re]===void 0&&(ve[Re]={texture:s.createTexture(),usedTimes:0},l.memory.textures++,ee=!0),ve[Re].usedTimes++;const Fe=ve[U.__cacheKey];Fe!==void 0&&(ve[U.__cacheKey].usedTimes--,Fe.usedTimes===0&&O(P)),U.__cacheKey=Re,U.__webglTexture=ve[Re].texture}return ee}function Le(U,P,ee){return Math.floor(Math.floor(U/ee)/P)}function ye(U,P,ee,he){const Re=U.updateRanges;if(Re.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,P.width,P.height,ee,he,P.data);else{Re.sort(($e,Oe)=>$e.start-Oe.start);let Fe=0;for(let $e=1;$e<Re.length;$e++){const Oe=Re[Fe],Ne=Re[$e],_t=Oe.start+Oe.count,Mt=Le(Ne.start,P.width,4),Nt=Le(Oe.start,P.width,4);Ne.start<=_t+1&&Mt===Nt&&Le(Ne.start+Ne.count-1,P.width,4)===Mt?Oe.count=Math.max(Oe.count,Ne.start+Ne.count-Oe.start):(++Fe,Re[Fe]=Ne)}Re.length=Fe+1;const ue=t.getParameter(s.UNPACK_ROW_LENGTH),ge=t.getParameter(s.UNPACK_SKIP_PIXELS),Xe=t.getParameter(s.UNPACK_SKIP_ROWS);t.pixelStorei(s.UNPACK_ROW_LENGTH,P.width);for(let $e=0,Oe=Re.length;$e<Oe;$e++){const Ne=Re[$e],_t=Math.floor(Ne.start/4),Mt=Math.ceil(Ne.count/4),Nt=_t%P.width,K=Math.floor(_t/P.width),De=Mt,fe=1;t.pixelStorei(s.UNPACK_SKIP_PIXELS,Nt),t.pixelStorei(s.UNPACK_SKIP_ROWS,K),t.texSubImage2D(s.TEXTURE_2D,0,Nt,K,De,fe,ee,he,P.data)}U.clearUpdateRanges(),t.pixelStorei(s.UNPACK_ROW_LENGTH,ue),t.pixelStorei(s.UNPACK_SKIP_PIXELS,ge),t.pixelStorei(s.UNPACK_SKIP_ROWS,Xe)}}function ze(U,P,ee){let he=s.TEXTURE_2D;(P.isDataArrayTexture||P.isCompressedArrayTexture)&&(he=s.TEXTURE_2D_ARRAY),P.isData3DTexture&&(he=s.TEXTURE_3D);const ve=le(U,P),Re=P.source;t.bindTexture(he,U.__webglTexture,s.TEXTURE0+ee);const Fe=n.get(Re);if(Re.version!==Fe.__version||ve===!0){if(t.activeTexture(s.TEXTURE0+ee),(typeof ImageBitmap<"u"&&P.image instanceof ImageBitmap)===!1){const fe=It.getPrimaries(It.workingColorSpace),Ye=P.colorSpace===vr?null:It.getPrimaries(P.colorSpace),Ge=P.colorSpace===vr||fe===Ye?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,P.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ge)}t.pixelStorei(s.UNPACK_ALIGNMENT,P.unpackAlignment);let ge=v(P.image,!1,i.maxTextureSize);ge=Me(P,ge);const Xe=r.convert(P.format,P.colorSpace),$e=r.convert(P.type);let Oe=T(P.internalFormat,Xe,$e,P.normalized,P.colorSpace,P.isVideoTexture);He(he,P);let Ne;const _t=P.mipmaps,Mt=P.isVideoTexture!==!0,Nt=Fe.__version===void 0||ve===!0,K=Re.dataReady,De=R(P,ge);if(P.isDepthTexture)Oe=B(P.format===co,P.type),Nt&&(Mt?t.texStorage2D(s.TEXTURE_2D,1,Oe,ge.width,ge.height):t.texImage2D(s.TEXTURE_2D,0,Oe,ge.width,ge.height,0,Xe,$e,null));else if(P.isDataTexture)if(_t.length>0){Mt&&Nt&&t.texStorage2D(s.TEXTURE_2D,De,Oe,_t[0].width,_t[0].height);for(let fe=0,Ye=_t.length;fe<Ye;fe++)Ne=_t[fe],Mt?K&&t.texSubImage2D(s.TEXTURE_2D,fe,0,0,Ne.width,Ne.height,Xe,$e,Ne.data):t.texImage2D(s.TEXTURE_2D,fe,Oe,Ne.width,Ne.height,0,Xe,$e,Ne.data);P.generateMipmaps=!1}else Mt?(Nt&&t.texStorage2D(s.TEXTURE_2D,De,Oe,ge.width,ge.height),K&&ye(P,ge,Xe,$e)):t.texImage2D(s.TEXTURE_2D,0,Oe,ge.width,ge.height,0,Xe,$e,ge.data);else if(P.isCompressedTexture)if(P.isCompressedArrayTexture){Mt&&Nt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,De,Oe,_t[0].width,_t[0].height,ge.depth);for(let fe=0,Ye=_t.length;fe<Ye;fe++)if(Ne=_t[fe],P.format!==ai)if(Xe!==null)if(Mt){if(K)if(P.layerUpdates.size>0){const Ge=wx(Ne.width,Ne.height,P.format,P.type);for(const be of P.layerUpdates){const ot=Ne.data.subarray(be*Ge/Ne.data.BYTES_PER_ELEMENT,(be+1)*Ge/Ne.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,fe,0,0,be,Ne.width,Ne.height,1,Xe,ot)}P.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,fe,0,0,0,Ne.width,Ne.height,ge.depth,Xe,Ne.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,fe,Oe,Ne.width,Ne.height,ge.depth,0,Ne.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Mt?K&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,fe,0,0,0,Ne.width,Ne.height,ge.depth,Xe,$e,Ne.data):t.texImage3D(s.TEXTURE_2D_ARRAY,fe,Oe,Ne.width,Ne.height,ge.depth,0,Xe,$e,Ne.data)}else{Mt&&Nt&&t.texStorage2D(s.TEXTURE_2D,De,Oe,_t[0].width,_t[0].height);for(let fe=0,Ye=_t.length;fe<Ye;fe++)Ne=_t[fe],P.format!==ai?Xe!==null?Mt?K&&t.compressedTexSubImage2D(s.TEXTURE_2D,fe,0,0,Ne.width,Ne.height,Xe,Ne.data):t.compressedTexImage2D(s.TEXTURE_2D,fe,Oe,Ne.width,Ne.height,0,Ne.data):ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Mt?K&&t.texSubImage2D(s.TEXTURE_2D,fe,0,0,Ne.width,Ne.height,Xe,$e,Ne.data):t.texImage2D(s.TEXTURE_2D,fe,Oe,Ne.width,Ne.height,0,Xe,$e,Ne.data)}else if(P.isDataArrayTexture)if(Mt){if(Nt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,De,Oe,ge.width,ge.height,ge.depth),K)if(P.layerUpdates.size>0){const fe=wx(ge.width,ge.height,P.format,P.type);for(const Ye of P.layerUpdates){const Ge=ge.data.subarray(Ye*fe/ge.data.BYTES_PER_ELEMENT,(Ye+1)*fe/ge.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,Ye,ge.width,ge.height,1,Xe,$e,Ge)}P.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,ge.width,ge.height,ge.depth,Xe,$e,ge.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,Oe,ge.width,ge.height,ge.depth,0,Xe,$e,ge.data);else if(P.isData3DTexture)Mt?(Nt&&t.texStorage3D(s.TEXTURE_3D,De,Oe,ge.width,ge.height,ge.depth),K&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,ge.width,ge.height,ge.depth,Xe,$e,ge.data)):t.texImage3D(s.TEXTURE_3D,0,Oe,ge.width,ge.height,ge.depth,0,Xe,$e,ge.data);else if(P.isFramebufferTexture){if(Nt)if(Mt)t.texStorage2D(s.TEXTURE_2D,De,Oe,ge.width,ge.height);else{let fe=ge.width,Ye=ge.height;for(let Ge=0;Ge<De;Ge++)t.texImage2D(s.TEXTURE_2D,Ge,Oe,fe,Ye,0,Xe,$e,null),fe>>=1,Ye>>=1}}else if(P.isHTMLTexture){if("texElementImage2D"in s){const fe=s.canvas;if(fe.hasAttribute("layoutsubtree")||fe.setAttribute("layoutsubtree","true"),ge.parentNode!==fe){fe.appendChild(ge),p.add(P),fe.onpaint=yt=>{const cn=yt.changedElements;for(const Vt of p)cn.includes(Vt.image)&&(Vt.needsUpdate=!0)},fe.requestPaint();return}const Ye=0,Ge=s.RGBA,be=s.RGBA,ot=s.UNSIGNED_BYTE;s.texElementImage2D(s.TEXTURE_2D,Ye,Ge,be,ot,ge),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE)}}else if(_t.length>0){if(Mt&&Nt){const fe=Gt(_t[0]);t.texStorage2D(s.TEXTURE_2D,De,Oe,fe.width,fe.height)}for(let fe=0,Ye=_t.length;fe<Ye;fe++)Ne=_t[fe],Mt?K&&t.texSubImage2D(s.TEXTURE_2D,fe,0,0,Xe,$e,Ne):t.texImage2D(s.TEXTURE_2D,fe,Oe,Xe,$e,Ne);P.generateMipmaps=!1}else if(Mt){if(Nt){const fe=Gt(ge);t.texStorage2D(s.TEXTURE_2D,De,Oe,fe.width,fe.height)}K&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,Xe,$e,ge)}else t.texImage2D(s.TEXTURE_2D,0,Oe,Xe,$e,ge);y(P)&&A(he),Fe.__version=Re.version,P.onUpdate&&P.onUpdate(P)}U.__version=P.version}function Je(U,P,ee){if(P.image.length!==6)return;const he=le(U,P),ve=P.source;t.bindTexture(s.TEXTURE_CUBE_MAP,U.__webglTexture,s.TEXTURE0+ee);const Re=n.get(ve);if(ve.version!==Re.__version||he===!0){t.activeTexture(s.TEXTURE0+ee);
vendor: 4,309 bytes, line 4090
4090const Fe=It.getPrimaries(It.workingColorSpace),ue=P.colorSpace===vr?null:It.getPrimaries(P.colorSpace),ge=P.colorSpace===vr||Fe===ue?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,P.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),t.pixelStorei(s.UNPACK_ALIGNMENT,P.unpackAlignment),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,ge);const Xe=P.isCompressedTexture||P.image[0].isCompressedTexture,$e=P.image[0]&&P.image[0].isDataTexture,Oe=[];for(let be=0;be<6;be++)!Xe&&!$e?Oe[be]=v(P.image[be],!0,i.maxCubemapSize):Oe[be]=$e?P.image[be].image:P.image[be],Oe[be]=Me(P,Oe[be]);const Ne=Oe[0],_t=r.convert(P.format,P.colorSpace),Mt=r.convert(P.type),Nt=T(P.internalFormat,_t,Mt,P.normalized,P.colorSpace),K=P.isVideoTexture!==!0,De=Re.__version===void 0||he===!0,fe=ve.dataReady;let Ye=R(P,Ne);He(s.TEXTURE_CUBE_MAP,P);let Ge;if(Xe){K&&De&&t.texStorage2D(s.TEXTURE_CUBE_MAP,Ye,Nt,Ne.width,Ne.height);for(let be=0;be<6;be++){Ge=Oe[be].mipmaps;for(let ot=0;ot<Ge.length;ot++){const yt=Ge[ot];P.format!==ai?_t!==null?K?fe&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot,0,0,yt.width,yt.height,_t,yt.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot,Nt,yt.width,yt.height,0,yt.data):ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):K?fe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot,0,0,yt.width,yt.height,_t,Mt,yt.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot,Nt,yt.width,yt.height,0,_t,Mt,yt.data)}}}else{if(Ge=P.mipmaps,K&&De){Ge.length>0&&Ye++;const be=Gt(Oe[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,Ye,Nt,be.width,be.height)}for(let be=0;be<6;be++)if($e){K?fe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,0,0,Oe[be].width,Oe[be].height,_t,Mt,Oe[be].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,Nt,Oe[be].width,Oe[be].height,0,_t,Mt,Oe[be].data);for(let ot=0;ot<Ge.length;ot++){const cn=Ge[ot].image[be].image;K?fe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot+1,0,0,cn.width,cn.height,_t,Mt,cn.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot+1,Nt,cn.width,cn.height,0,_t,Mt,cn.data)}}else{K?fe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,0,0,_t,Mt,Oe[be]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,0,Nt,_t,Mt,Oe[be]);for(let ot=0;ot<Ge.length;ot++){const yt=Ge[ot];K?fe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot+1,0,0,_t,Mt,yt.image[be]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+be,ot+1,Nt,_t,Mt,yt.image[be])}}}y(P)&&A(s.TEXTURE_CUBE_MAP),Re.__version=ve.version,P.onUpdate&&P.onUpdate(P)}U.__version=P.version}function Ee(U,P,ee,he,ve,Re){const Fe=r.convert(ee.format,ee.colorSpace),ue=r.convert(ee.type),ge=T(ee.internalFormat,Fe,ue,ee.normalized,ee.colorSpace),Xe=n.get(P),$e=n.get(ee);if($e.__renderTarget=P,!Xe.__hasExternalTextures){const Oe=Math.max(1,P.width>>Re),Ne=Math.max(1,P.height>>Re);ve===s.TEXTURE_3D||ve===s.TEXTURE_2D_ARRAY?t.texImage3D(ve,Re,ge,Oe,Ne,P.depth,0,Fe,ue,null):t.texImage2D(ve,Re,ge,Oe,Ne,0,Fe,ue,null)}t.bindFramebuffer(s.FRAMEBUFFER,U),Ze(P)?c.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,he,ve,$e.__webglTexture,0,ut(P)):(ve===s.TEXTURE_2D||ve>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&ve<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,he,ve,$e.__webglTexture,Re),t.bindFramebuffer(s.FRAMEBUFFER,null)}function ht(U,P,ee){if(s.bindRenderbuffer(s.RENDERBUFFER,U),P.depthBuffer){const he=P.depthTexture,ve=he&&he.isDepthTexture?he.type:null,Re=B(P.stencilBuffer,ve),Fe=P.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;Ze(P)?c.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ut(P),Re,P.width,P.height):ee?s.renderbufferStorageMultisample(s.RENDERBUFFER,ut(P),Re,P.width,P.height):s.renderbufferStorage(s.RENDERBUFFER,Re,P.width,P.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,Fe,s.RENDERBUFFER,U)}else{const he=P.textures;for(let ve=0;ve<he.length;ve++){const Re=he[ve],Fe=r.convert(Re.format,Re.colorSpace),ue=r.convert(Re.type),ge=T(Re.internalFormat,Fe,ue,Re.normalized,Re.colorSpace);Ze(P)?c.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ut(P),ge,P.width,P.height):ee?s.renderbufferStorageMultisample(s.RENDERBUFFER,ut(P),ge,P.width,P.height):s.renderbufferStorage(s.RENDERBUFFER,ge,P.width,P.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}
vendor: 14,044 bytes, line 4090
4090function qe(U,P,ee){const he=P.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,U),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ve=n.get(P.depthTexture);if(ve.__renderTarget=P,(!ve.__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),he){if(ve.__webglInit===void 0&&(ve.__webglInit=!0,P.depthTexture.addEventListener("dispose",L)),ve.__webglTexture===void 0){ve.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,ve.__webglTexture),He(s.TEXTURE_CUBE_MAP,P.depthTexture);const Xe=r.convert(P.depthTexture.format),$e=r.convert(P.depthTexture.type);let Oe;P.depthTexture.format===$s?Oe=s.DEPTH_COMPONENT24:P.depthTexture.format===co&&(Oe=s.DEPTH24_STENCIL8);for(let Ne=0;Ne<6;Ne++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,Oe,P.width,P.height,0,Xe,$e,null)}}else q(P.depthTexture,0);const Re=ve.__webglTexture,Fe=ut(P),ue=he?s.TEXTURE_CUBE_MAP_POSITIVE_X+ee:s.TEXTURE_2D,ge=P.depthTexture.format===co?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(P.depthTexture.format===$s)Ze(P)?c.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,ge,ue,Re,0,Fe):s.framebufferTexture2D(s.FRAMEBUFFER,ge,ue,Re,0);else if(P.depthTexture.format===co)Ze(P)?c.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,ge,ue,Re,0,Fe):s.framebufferTexture2D(s.FRAMEBUFFER,ge,ue,Re,0);else throw new Error("Unknown depthTexture format")}function de(U){const P=n.get(U),ee=U.isWebGLCubeRenderTarget===!0;if(P.__boundDepthTexture!==U.depthTexture){const he=U.depthTexture;if(P.__depthDisposeCallback&&P.__depthDisposeCallback(),he){const ve=()=>{delete P.__boundDepthTexture,delete P.__depthDisposeCallback,he.removeEventListener("dispose",ve)};he.addEventListener("dispose",ve),P.__depthDisposeCallback=ve}P.__boundDepthTexture=he}if(U.depthTexture&&!P.__autoAllocateDepthBuffer)if(ee)for(let he=0;he<6;he++)qe(P.__webglFramebuffer[he],U,he);else{const he=U.texture.mipmaps;he&&he.length>0?qe(P.__webglFramebuffer[0],U,0):qe(P.__webglFramebuffer,U,0)}else if(ee){P.__webglDepthbuffer=[];for(let he=0;he<6;he++)if(t.bindFramebuffer(s.FRAMEBUFFER,P.__webglFramebuffer[he]),P.__webglDepthbuffer[he]===void 0)P.__webglDepthbuffer[he]=s.createRenderbuffer(),ht(P.__webglDepthbuffer[he],U,!1);else{const ve=U.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Re=P.__webglDepthbuffer[he];s.bindRenderbuffer(s.RENDERBUFFER,Re),s.framebufferRenderbuffer(s.FRAMEBUFFER,ve,s.RENDERBUFFER,Re)}}else{const he=U.texture.mipmaps;if(he&&he.length>0?t.bindFramebuffer(s.FRAMEBUFFER,P.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,P.__webglFramebuffer),P.__webglDepthbuffer===void 0)P.__webglDepthbuffer=s.createRenderbuffer(),ht(P.__webglDepthbuffer,U,!1);else{const ve=U.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Re=P.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Re),s.framebufferRenderbuffer(s.FRAMEBUFFER,ve,s.RENDERBUFFER,Re)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function _e(U,P,ee){const he=n.get(U);P!==void 0&&Ee(he.__webglFramebuffer,U,U.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),ee!==void 0&&de(U)}function me(U){const P=U.texture,ee=n.get(U),he=n.get(P);U.addEventListener("dispose",w);const ve=U.textures,Re=U.isWebGLCubeRenderTarget===!0,Fe=ve.length>1;if(Fe||(he.__webglTexture===void 0&&(he.__webglTexture=s.createTexture()),he.__version=P.version,l.memory.textures++),Re){ee.__webglFramebuffer=[];for(let ue=0;ue<6;ue++)if(P.mipmaps&&P.mipmaps.length>0){ee.__webglFramebuffer[ue]=[];for(let ge=0;ge<P.mipmaps.length;ge++)ee.__webglFramebuffer[ue][ge]=s.createFramebuffer()}else ee.__webglFramebuffer[ue]=s.createFramebuffer()}else{if(P.mipmaps&&P.mipmaps.length>0){ee.__webglFramebuffer=[];for(let ue=0;ue<P.mipmaps.length;ue++)ee.__webglFramebuffer[ue]=s.createFramebuffer()}else ee.__webglFramebuffer=s.createFramebuffer();if(Fe)for(let ue=0,ge=ve.length;ue<ge;ue++){const Xe=n.get(ve[ue]);Xe.__webglTexture===void 0&&(Xe.__webglTexture=s.createTexture(),l.memory.textures++)}if(U.samples>0&&Ze(U)===!1){ee.__webglMultisampledFramebuffer=s.createFramebuffer(),ee.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,ee.__webglMultisampledFramebuffer);for(let ue=0;ue<ve.length;ue++){const ge=ve[ue];ee.__webglColorRenderbuffer[ue]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,ee.__webglColorRenderbuffer[ue]);const Xe=r.convert(ge.format,ge.colorSpace),$e=r.convert(ge.type),Oe=T(ge.internalFormat,Xe,$e,ge.normalized,ge.colorSpace,U.isXRRenderTarget===!0),Ne=ut(U);s.renderbufferStorageMultisample(s.RENDERBUFFER,Ne,Oe,U.width,U.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ue,s.RENDERBUFFER,ee.__webglColorRenderbuffer[ue])}s.bindRenderbuffer(s.RENDERBUFFER,null),U.depthBuffer&&(ee.__webglDepthRenderbuffer=s.createRenderbuffer(),ht(ee.__webglDepthRenderbuffer,U,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(Re){t.bindTexture(s.TEXTURE_CUBE_MAP,he.__webglTexture),He(s.TEXTURE_CUBE_MAP,P);for(let ue=0;ue<6;ue++)if(P.mipmaps&&P.mipmaps.length>0)for(let ge=0;ge<P.mipmaps.length;ge++)Ee(ee.__webglFramebuffer[ue][ge],U,P,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ue,ge);else Ee(ee.__webglFramebuffer[ue],U,P,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ue,0);y(P)&&A(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Fe){for(let ue=0,ge=ve.length;ue<ge;ue++){const Xe=ve[ue],$e=n.get(Xe);let Oe=s.TEXTURE_2D;(U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(Oe=U.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(Oe,$e.__webglTexture),He(Oe,Xe),Ee(ee.__webglFramebuffer,U,Xe,s.COLOR_ATTACHMENT0+ue,Oe,0),y(Xe)&&A(Oe)}t.unbindTexture()}else{let ue=s.TEXTURE_2D;if((U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(ue=U.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(ue,he.__webglTexture),He(ue,P),P.mipmaps&&P.mipmaps.length>0)for(let ge=0;ge<P.mipmaps.length;ge++)Ee(ee.__webglFramebuffer[ge],U,P,s.COLOR_ATTACHMENT0,ue,ge);else Ee(ee.__webglFramebuffer,U,P,s.COLOR_ATTACHMENT0,ue,0);y(P)&&A(ue),t.unbindTexture()}U.depthBuffer&&de(U)}function Te(U){const P=U.textures;for(let ee=0,he=P.length;ee<he;ee++){const ve=P[ee];if(y(ve)){const Re=S(U),Fe=n.get(ve).__webglTexture;t.bindTexture(Re,Fe),A(Re),t.unbindTexture()}}}const Ce=[],rt=[];function j(U){if(U.samples>0){if(Ze(U)===!1){const P=U.textures,ee=U.width,he=U.height;let ve=s.COLOR_BUFFER_BIT;const Re=U.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Fe=n.get(U),ue=P.length>1;if(ue)for(let Xe=0;Xe<P.length;Xe++)t.bindFramebuffer(s.FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Xe,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,Fe.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+Xe,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,Fe.__webglMultisampledFramebuffer);const ge=U.texture.mipmaps;ge&&ge.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer);for(let Xe=0;Xe<P.length;Xe++){if(U.resolveDepthBuffer&&(U.depthBuffer&&(ve|=s.DEPTH_BUFFER_BIT),U.stencilBuffer&&U.resolveStencilBuffer&&(ve|=s.STENCIL_BUFFER_BIT)),ue){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,Fe.__webglColorRenderbuffer[Xe]);const $e=n.get(P[Xe]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,$e,0)}s.blitFramebuffer(0,0,ee,he,0,0,ee,he,ve,s.NEAREST),u===!0&&(Ce.length=0,rt.length=0,Ce.push(s.COLOR_ATTACHMENT0+Xe),U.depthBuffer&&U.resolveDepthBuffer===!1&&(Ce.push(Re),rt.push(Re),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,rt)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,Ce))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),ue)for(let Xe=0;Xe<P.length;Xe++){t.bindFramebuffer(s.FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Xe,s.RENDERBUFFER,Fe.__webglColorRenderbuffer[Xe]);const $e=n.get(P[Xe]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,Fe.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+Xe,s.TEXTURE_2D,$e,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Fe.__webglMultisampledFramebuffer)}else if(U.depthBuffer&&U.resolveDepthBuffer===!1&&u){const P=U.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[P])}}}function ut(U){return Math.min(i.maxSamples,U.samples)}function Ze(U){const P=n.get(U);return U.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function it(U){const P=l.render.frame;d.get(U)!==P&&(d.set(U,P),U.update())}function Me(U,P){const ee=U.colorSpace,he=U.format,ve=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||ee!==Ql&&ee!==vr&&(It.getTransfer(ee)===Qt?(he!==ai||ve!==mi)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):at("WebGLTextures: Unsupported texture color space:",ee)),P}function Gt(U){return typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement?(h.width=U.naturalWidth||U.width,h.height=U.naturalHeight||U.height):typeof VideoFrame<"u"&&U instanceof VideoFrame?(h.width=U.displayWidth,h.height=U.displayHeight):(h.width=U.width,h.height=U.height),h}this.allocateTextureUnit=H,this.resetTextureUnits=X,this.getTextureUnits=Y,this.setTextureUnits=V,this.setTexture2D=q,this.setTexture2DArray=Q,this.setTexture3D=re,this.setTextureCube=ae,this.rebindTextures=_e,this.setupRenderTarget=me,this.updateRenderTargetMipmap=Te,this.updateMultisampleRenderTarget=j,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=Ze,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function sT(s,e){function t(n,i=vr){let r;const l=It.getTransfer(i);if(n===mi)return s.UNSIGNED_BYTE;if(n===Ip)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Bp)return s.UNSIGNED_SHORT_5_5_5_1;if(n===t_)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===n_)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===$x)return s.BYTE;if(n===e_)return s.SHORT;if(n===Yl)return s.UNSIGNED_SHORT;if(n===Rp)return s.INT;if(n===is)return s.UNSIGNED_INT;if(n===oi)return s.FLOAT;if(n===bs)return s.HALF_FLOAT;if(n===i_)return s.ALPHA;if(n===s_)return s.RGB;if(n===ai)return s.RGBA;if(n===$s)return s.DEPTH_COMPONENT;if(n===co)return s.DEPTH_STENCIL;if(n===Pp)return s.RED;if(n===ju)return s.RED_INTEGER;if(n===go)return s.RG;if(n===Lp)return s.RG_INTEGER;if(n===Dp)return s.RGBA_INTEGER;if(n===bu||n===Au||n===Mu||n===Su)if(l===Qt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===bu)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Au)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Mu)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Su)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===bu)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Au)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Mu)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Su)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Fd||n===Nd||n===Od||n===Ud)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Fd)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Nd)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Od)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ud)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Gd||n===kd||n===Hd||n===zd||n===Vd||n===Iu||n===Wd)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Gd||n===kd)return l===Qt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Hd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===zd)return r.COMPRESSED_R11_EAC;if(n===Vd)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Iu)return r.COMPRESSED_RG11_EAC;if(n===Wd)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===jd||n===Xd||n===Jd||n===Yd||n===Kd||n===qd||n===Zd||n===Qd||n===$d||n===ep||n===tp||n===np||n===ip||n===sp)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===jd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Xd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Jd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Yd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Kd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===qd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Zd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Qd)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===$d)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ep)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===tp)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===np)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ip)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===sp)return l===Qt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===rp||n===op||n===ap)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===rp)return l===Qt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===op)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ap)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===lp||n===cp||n===Bu||n===up)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===lp)return r.COMPRESSED_RED_RGT
4090C1_EXT;if(n===cp)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Bu)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===up)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Kl?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const GN=`
4091void main() {
4092
4093	gl_Position = vec4( position, 1.0 );
4094
4095}`,kN=`
4096uniform sampler2DArray depthColor;
4097uniform float depthWidth;
4098uniform float depthHeight;
4099
4100void main() {
4101
4102	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4103
4104	if ( coord.x >= 1.0 ) {
4105
4106		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4107
4108	} else {
4109
4110		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4111
4112	}
4113
4114}`;class HN{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new __(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 Ii({vertexShader:GN,fragmentShader:kN,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new An(new uc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class zN extends Ss{constructor(e,t){super();const n=this;let i=null,r=1,l=null,c="local-floor",u=1,h=null,d=null,p=null,m=null,g=null,_=null;const b=typeof XRWebGLBinding<"u",v=new HN,y={},A=t.getContextAttributes();let S=null,T=null;const B=[],R=[],L=new xe;let w=null;const I=new En;I.viewport=new Ht;const O=new En;O.viewport=new Ht;const D=[I,O],z=new V1;let X=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Le=B[le];return Le===void 0&&(Le=new vd,B[le]=Le),Le.getTargetRaySpace()},this.getControllerGrip=function(le){let Le=B[le];return Le===void 0&&(Le=new vd,B[le]=Le),Le.getGripSpace()},this.getHand=function(le){let Le=B[le];return Le===void 0&&(Le=new vd,B[le]=Le),Le.getHandSpace()};function V(le){const Le=R.indexOf(le.inputSource);if(Le===-1)return;const ye=B[Le];ye!==void 0&&(ye.update(le.inputSource,le.frame,h||l),ye.dispatchEvent({type:le.type,data:le.inputSource}))}function H(){i.removeEventListener("select",V),i.removeEventListener("selectstart",V),i.removeEventListener("selectend",V),i.removeEventListener("squeeze",V),i.removeEventListener("squeezestart",V),i.removeEventListener("squeezeend",V),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",W);for(let le=0;le<B.length;le++){const Le=R[le];Le!==null&&(R[le]=null,B[le].disconnect(Le))}X=null,Y=null,v.reset();for(const le in y)delete y[le];e.setRenderTarget(S),g=null,m=null,p=null,i=null,T=null,He.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){r=le,n.isPresenting===!0&&ke("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){c=le,n.isPresenting===!0&&ke("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||l},this.setReferenceSpace=function(le){h=le},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return p===null&&b&&(p=new XRWebGLBinding(i,t)),p},this.getFrame=function(){return _},this.getSession=function(){return i},this.setSession=async function(le){if(i=le,i!==null){if(S=e.getRenderTarget(),i.addEventListener("select",V),i.addEventListener("selectstart",V),i.addEventListener("selectend",V),i.addEventListener("squeeze",V),i.addEventListener("squeezestart",V),i.addEventListener("squeezeend",V),i.addEventListener("end",H),i.addEventListener("inputsourceschange",W),A.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(L),b&&"createProjectionLayer"in XRWebGLBinding.prototype){let ye=null,ze=null,Je=null;A.depth&&(Je=A.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ye=A.stencil?co:$s,ze=A.stencil?Kl:is);const Ee={colorFormat:t.RGBA8,depthFormat:Je,scaleFactor:r};p=this.getBinding(),m=p.createProjectionLayer(Ee),i.updateRenderState({layers:[m]}
vendor: 6,380 bytes, line 4114
4114),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),T=new Ri(m.textureWidth,m.textureHeight,{format:ai,type:mi,depthTexture:new _o(m.textureWidth,m.textureHeight,ze,void 0,void 0,void 0,void 0,void 0,void 0,ye),stencilBuffer:A.stencil,colorSpace:e.outputColorSpace,samples:A.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const ye={antialias:A.antialias,alpha:!0,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:r};g=new XRWebGLLayer(i,t,ye),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),T=new Ri(g.framebufferWidth,g.framebufferHeight,{format:ai,type:mi,colorSpace:e.outputColorSpace,stencilBuffer:A.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(u),h=null,l=await i.requestReferenceSpace(c),He.setContext(i),He.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function W(le){for(let Le=0;Le<le.removed.length;Le++){const ye=le.removed[Le],ze=R.indexOf(ye);ze>=0&&(R[ze]=null,B[ze].disconnect(ye))}for(let Le=0;Le<le.added.length;Le++){const ye=le.added[Le];let ze=R.indexOf(ye);if(ze===-1){for(let Ee=0;Ee<B.length;Ee++)if(Ee>=R.length){R.push(ye),ze=Ee;break}else if(R[Ee]===null){R[Ee]=ye,ze=Ee;break}if(ze===-1)break}const Je=B[ze];Je&&Je.connect(ye)}}const q=new G,Q=new G;function re(le,Le,ye){q.setFromMatrixPosition(Le.matrixWorld),Q.setFromMatrixPosition(ye.matrixWorld);const ze=q.distanceTo(Q),Je=Le.projectionMatrix.elements,Ee=ye.projectionMatrix.elements,ht=Je[14]/(Je[10]-1),qe=Je[14]/(Je[10]+1),de=(Je[9]+1)/Je[5],_e=(Je[9]-1)/Je[5],me=(Je[8]-1)/Je[0],Te=(Ee[8]+1)/Ee[0],Ce=ht*me,rt=ht*Te,j=ze/(-me+Te),ut=j*-me;if(Le.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(ut),le.translateZ(j),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),Je[10]===-1)le.projectionMatrix.copy(Le.projectionMatrix),le.projectionMatrixInverse.copy(Le.projectionMatrixInverse);else{const Ze=ht+j,it=qe+j,Me=Ce-ut,Gt=rt+(ze-ut),U=de*qe/it*Ze,P=_e*qe/it*Ze;le.projectionMatrix.makePerspective(Me,Gt,U,P,Ze,it),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function ae(le,Le){Le===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Le.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Le=le.near,ye=le.far;v.texture!==null&&(v.depthNear>0&&(Le=v.depthNear),v.depthFar>0&&(ye=v.depthFar)),z.near=O.near=I.near=Le,z.far=O.far=I.far=ye,(X!==z.near||Y!==z.far)&&(i.updateRenderState({depthNear:z.near,depthFar:z.far}),X=z.near,Y=z.far),z.layers.mask=le.layers.mask|6,I.layers.mask=z.layers.mask&-5,O.layers.mask=z.layers.mask&-3;const ze=le.parent,Je=z.cameras;ae(z,ze);for(let Ee=0;Ee<Je.length;Ee++)ae(Je[Ee],ze);Je.length===2?re(z,I,O):z.projectionMatrix.copy(I.projectionMatrix),pe(le,z,ze)};function pe(le,Le,ye){ye===null?le.matrix.copy(Le.matrixWorld):(le.matrix.copy(ye.matrixWorld),le.matrix.invert(),le.matrix.multiply(Le.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(Le.projectionMatrix),le.projectionMatrixInverse.copy(Le.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=$l*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return z},this.getFoveation=function(){if(!(m===null&&g===null))return u},this.setFoveation=function(le){u=le,m!==null&&(m.fixedFoveation=le),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=le)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(z)},this.getCameraTexture=function(le){return y[le]};let Ue=null;function Pe(le,Le){if(d=Le.getViewerPose(h||l),_=Le,d!==null){const ye=d.views;g!==null&&(e.setRenderTargetFramebuffer(T,g.framebuffer),e.setRenderTarget(T));let ze=!1;ye.length!==z.cameras.length&&(z.cameras.length=0,ze=!0);for(let qe=0;qe<ye.length;qe++){const de=ye[qe];let _e=null;if(g!==null)_e=g.getViewport(de);else{const Te=p.getViewSubImage(m,de);_e=Te.viewport,qe===0&&(e.setRenderTargetTextures(T,Te.colorTexture,Te.depthStencilTexture),e.setRenderTarget(T))}let me=D[qe];me===void 0&&(me=new En,me.layers.enable(qe),me.viewport=new Ht,D[qe]=me),me.matrix.fromArray(de.transform.matrix),me.matrix.decompose(me.position,me.quaternion,me.scale),me.projectionMatrix.fromArray(de.projectionMatrix),me.projectionMatrixInverse.copy(me.projectionMatrix).invert(),me.viewport.set(_e.x,_e.y,_e.width,_e.height),qe===0&&(z.matrix.copy(me.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale)),ze===!0&&z.cameras.push(me)}const Je=i.enabledFeatures;if(Je&&Je.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&b){p=n.getBinding();const qe=p.getDepthInformation(ye[0]);qe&&qe.isValid&&qe.texture&&v.init(qe,i.renderState)}if(Je&&Je.includes("camera-access")&&b){e.state.unbindTexture(),p=n.getBinding();for(let qe=0;qe<ye.length;qe++){const de=ye[qe].camera;if(de){let _e=y[de];_e||(_e=new __,y[de]=_e);const me=p.getCameraImage(de);_e.sourceTexture=me}}}}for(let ye=0;ye<B.length;ye++){const ze=R[ye],Je=B[ye];ze!==null&&Je!==void 0&&Je.update(ze,Le,h||l)}Ue&&Ue(le,Le),Le.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Le}),_=null}const He=new Q1;He.setAnimationLoop(Pe),this.setAnimationLoop=function(le){Ue=le},this.dispose=function(){}}}const VN=new ft,rT=new vt;rT.set(-1,0,0,0,1,0,0,0,1);function WN(s,e){function t(v,y){v.matrixAutoUpdate===!0&&v.updateMatrix(),y.value.copy(v.matrix)}function n(v,y){y.color.getRGB(v.fogColor.value,M1(s)),y.isFog?(v.fogNear.value=y.near,v.fogFar.value=y.far):y.isFogExp2&&(v.fogDensity.value=y.density)}function i(v,y,A,S,T){y.isNodeMaterial?y.uniformsNeedUpdate=!1:y.isMeshBasicMaterial?r(v,y):y.isMeshLambertMaterial?(r(v,y),y.envMap&&(v.envMapIntensity.value=y.envMapIntensity)):y.isMeshToonMaterial?(r(v,y),p(v,y)):y.isMeshPhongMaterial?(r(v,y),d(v,y),y.envMap&&(v.envMapIntensity.value=y.envMapIntensity)):y.isMeshStandardMaterial?(r(v,y),m(v,y),y.isMeshPhysicalMaterial&&g(v,y,T)):y.isMeshMat
vendor: 5,758 bytes, line 4114
4114capMaterial?(r(v,y),_(v,y)):y.isMeshDepthMaterial?r(v,y):y.isMeshDistanceMaterial?(r(v,y),b(v,y)):y.isMeshNormalMaterial?r(v,y):y.isLineBasicMaterial?(l(v,y),y.isLineDashedMaterial&&c(v,y)):y.isPointsMaterial?u(v,y,A,S):y.isSpriteMaterial?h(v,y):y.isShadowMaterial?(v.color.value.copy(y.color),v.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function r(v,y){v.opacity.value=y.opacity,y.color&&v.diffuse.value.copy(y.color),y.emissive&&v.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(v.map.value=y.map,t(y.map,v.mapTransform)),y.alphaMap&&(v.alphaMap.value=y.alphaMap,t(y.alphaMap,v.alphaMapTransform)),y.bumpMap&&(v.bumpMap.value=y.bumpMap,t(y.bumpMap,v.bumpMapTransform),v.bumpScale.value=y.bumpScale,y.side===_i&&(v.bumpScale.value*=-1)),y.normalMap&&(v.normalMap.value=y.normalMap,t(y.normalMap,v.normalMapTransform),v.normalScale.value.copy(y.normalScale),y.side===_i&&v.normalScale.value.negate()),y.displacementMap&&(v.displacementMap.value=y.displacementMap,t(y.displacementMap,v.displacementMapTransform),v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias),y.emissiveMap&&(v.emissiveMap.value=y.emissiveMap,t(y.emissiveMap,v.emissiveMapTransform)),y.specularMap&&(v.specularMap.value=y.specularMap,t(y.specularMap,v.specularMapTransform)),y.alphaTest>0&&(v.alphaTest.value=y.alphaTest);const A=e.get(y),S=A.envMap,T=A.envMapRotation;S&&(v.envMap.value=S,v.envMapRotation.value.setFromMatrix4(VN.makeRotationFromEuler(T)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&v.envMapRotation.value.premultiply(rT),v.reflectivity.value=y.reflectivity,v.ior.value=y.ior,v.refractionRatio.value=y.refractionRatio),y.lightMap&&(v.lightMap.value=y.lightMap,v.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,v.lightMapTransform)),y.aoMap&&(v.aoMap.value=y.aoMap,v.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,v.aoMapTransform))}function l(v,y){v.diffuse.value.copy(y.color),v.opacity.value=y.opacity,y.map&&(v.map.value=y.map,t(y.map,v.mapTransform))}function c(v,y){v.dashSize.value=y.dashSize,v.totalSize.value=y.dashSize+y.gapSize,v.scale.value=y.scale}function u(v,y,A,S){v.diffuse.value.copy(y.color),v.opacity.value=y.opacity,v.size.value=y.size*A,v.scale.value=S*.5,y.map&&(v.map.value=y.map,t(y.map,v.uvTransform)),y.alphaMap&&(v.alphaMap.value=y.alphaMap,t(y.alphaMap,v.alphaMapTransform)),y.alphaTest>0&&(v.alphaTest.value=y.alphaTest)}function h(v,y){v.diffuse.value.copy(y.color),v.opacity.value=y.opacity,v.rotation.value=y.rotation,y.map&&(v.map.value=y.map,t(y.map,v.mapTransform)),y.alphaMap&&(v.alphaMap.value=y.alphaMap,t(y.alphaMap,v.alphaMapTransform)),y.alphaTest>0&&(v.alphaTest.value=y.alphaTest)}function d(v,y){v.specular.value.copy(y.specular),v.shininess.value=Math.max(y.shininess,1e-4)}function p(v,y){y.gradientMap&&(v.gradientMap.value=y.gradientMap)}function m(v,y){v.metalness.value=y.metalness,y.metalnessMap&&(v.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,v.metalnessMapTransform)),v.roughness.value=y.roughness,y.roughnessMap&&(v.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,v.roughnessMapTransform)),y.envMap&&(v.envMapIntensity.value=y.envMapIntensity)}function g(v,y,A){v.ior.value=y.ior,y.sheen>0&&(v.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),v.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(v.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,v.sheenColorMapTransform)),y.sheenRoughnessMap&&(v.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,v.sheenRoughnessMapTransform))),y.clearcoat>0&&(v.clearcoat.value=y.clearcoat,v.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(v.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,v.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(v.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===_i&&v.clearcoatNormalScale.value.negate())),y.dispersion>0&&(v.dispersion.value=y.dispersion),y.iridescence>0&&(v.iridescence.value=y.iridescence,v.iridescenceIOR.value=y.iridescenceIOR,v.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(v.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,v.iridescenceMapTransform)),y.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),y.transmission>0&&(v.transmission.value=y.transmission,v.transmissionSamplerMap.value=A.texture,v.transmissionSamplerSize.value.set(A.width,A.height),y.transmissionMap&&(v.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,v.transmissionMapTransform)),v.thickness.value=y.thickness,y.thicknessMap&&(v.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=y.attenuationDistance,v.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(v.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(v.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=y.specularIntensity,v.specularColor.value.copy(y.specularColor),y.specularColorMap&&(v.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,v.specularColorMapTransform)),y.specularIntensityMap&&(v.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,v.specularIntensityMapTransform))}
vendor: 4,234 bytes, line 4114
4114function _(v,y){y.matcap&&(v.matcap.value=y.matcap)}function b(v,y){const A=e.get(y).light;v.referencePosition.value.setFromMatrixPosition(A.matrixWorld),v.nearDistance.value=A.shadow.camera.near,v.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function jN(s,e,t,n){let i={},r={},l=[];const c=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function u(A,S){const T=S.program;n.uniformBlockBinding(A,T)}function h(A,S){let T=i[A.id];T===void 0&&(_(A),T=d(A),i[A.id]=T,A.addEventListener("dispose",v));const B=S.program;n.updateUBOMapping(A,B);const R=e.render.frame;r[A.id]!==R&&(m(A),r[A.id]=R)}function d(A){const S=p();A.__bindingPointIndex=S;const T=s.createBuffer(),B=A.__size,R=A.usage;return s.bindBuffer(s.UNIFORM_BUFFER,T),s.bufferData(s.UNIFORM_BUFFER,B,R),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,S,T),T}function p(){for(let A=0;A<c;A++)if(l.indexOf(A)===-1)return l.push(A),A;return at("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(A){const S=i[A.id],T=A.uniforms,B=A.__cache;s.bindBuffer(s.UNIFORM_BUFFER,S);for(let R=0,L=T.length;R<L;R++){const w=Array.isArray(T[R])?T[R]:[T[R]];for(let I=0,O=w.length;I<O;I++){const D=w[I];if(g(D,R,I,B)===!0){const z=D.__offset,X=Array.isArray(D.value)?D.value:[D.value];let Y=0;for(let V=0;V<X.length;V++){const H=X[V],W=b(H);typeof H=="number"||typeof H=="boolean"?(D.__data[0]=H,s.bufferSubData(s.UNIFORM_BUFFER,z+Y,D.__data)):H.isMatrix3?(D.__data[0]=H.elements[0],D.__data[1]=H.elements[1],D.__data[2]=H.elements[2],D.__data[3]=0,D.__data[4]=H.elements[3],D.__data[5]=H.elements[4],D.__data[6]=H.elements[5],D.__data[7]=0,D.__data[8]=H.elements[6],D.__data[9]=H.elements[7],D.__data[10]=H.elements[8],D.__data[11]=0):ArrayBuffer.isView(H)?D.__data.set(new H.constructor(H.buffer,H.byteOffset,D.__data.length)):(H.toArray(D.__data,Y),Y+=W.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,z,D.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function g(A,S,T,B){const R=A.value,L=S+"_"+T;if(B[L]===void 0)return typeof R=="number"||typeof R=="boolean"?B[L]=R:ArrayBuffer.isView(R)?B[L]=R.slice():B[L]=R.clone(),!0;{const w=B[L];if(typeof R=="number"||typeof R=="boolean"){if(w!==R)return B[L]=R,!0}else{if(ArrayBuffer.isView(R))return!0;if(w.equals(R)===!1)return w.copy(R),!0}}return!1}function _(A){const S=A.uniforms;let T=0;const B=16;for(let L=0,w=S.length;L<w;L++){const I=Array.isArray(S[L])?S[L]:[S[L]];for(let O=0,D=I.length;O<D;O++){const z=I[O],X=Array.isArray(z.value)?z.value:[z.value];for(let Y=0,V=X.length;Y<V;Y++){const H=X[Y],W=b(H),q=T%B,Q=q%W.boundary,re=q+Q;T+=Q,re!==0&&B-re<W.storage&&(T+=B-re),z.__data=new Float32Array(W.storage/Float32Array.BYTES_PER_ELEMENT),z.__offset=T,T+=W.storage}}}const R=T%B;return R>0&&(T+=B-R),A.__size=T,A.__cache={},this}function b(A){const S={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(S.boundary=4,S.storage=4):A.isVector2?(S.boundary=8,S.storage=8):A.isVector3||A.isColor?(S.boundary=16,S.storage=12):A.isVector4?(S.boundary=16,S.storage=16):A.isMatrix3?(S.boundary=48,S.storage=48):A.isMatrix4?(S.boundary=64,S.storage=64):A.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(A)?(S.boundary=16,S.storage=A.byteLength):ke("WebGLRenderer: Unsupported uniform value type.",A),S}function v(A){const S=A.target;S.removeEventListener("dispose",v);const T=l.indexOf(S.__bindingPointIndex);l.splice(T,1),s.deleteBuffer(i[S.id]),delete i[S.id],delete r[S.id]}function y(){for(const A in i)s.deleteBuffer(i[A]);l=[],i={},r={}}return{bind:u,update:h,dispose:y}}const XN=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,10
4114751,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 Gs=null;function JN(){return Gs===null&&(Gs=new vs(XN,16,16,go,bs),Gs.name="DFG_LUT",Gs.minFilter=nn,Gs.magFilter=nn,Gs.wrapS=xi,Gs.wrapT=xi,Gs.generateMipmaps=!1,Gs.needsUpdate=!0),Gs}class oT{constructor(e={}){const{canvas:t=i1(),context:n=null,depth:i=!0,stencil:r=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:m=!1,outputBufferType:g=mi}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=l;const b=g,v=new Set([Dp,Lp,ju]),y=new Set([mi,is,Yl,Kl,Ip,Bp]),A=new Uint32Array(4),S=new Int32Array(4),T=new G;let B=null,R=null;const L=[],w=[];let I=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ns,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let D=!1,z=null;this._outputColorSpace=ri;let X=0,Y=0,V=null,H=-1,W=null;const q=new Ht,Q=new Ht;let re=null;const ae=new we(0);let pe=0,Ue=t.width,Pe=t.height,He=1,le=null,Le=null;const ye=new Ht(0,0,Ue,Pe),ze=new Ht(0,0,Ue,Pe);let Je=!1;const Ee=new cc;let ht=!1,qe=!1;const de=new ft,_e=new G,me=new Ht,Te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ce=!1;function rt(){return V===null?He:1}let j=n;function ut(N,Z){return t.getContext(N,Z)}try{const N={alpha:!0,depth:i,stencil:r,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Vu}`),t.addEventListener("webglcontextlost",be,!1),t.addEventListener("webglcontextrestored",ot,!1),t.addEventListener("webglcontextcreationerror",yt,!1),j===null){const Z="webgl2";if(j=ut(Z,N),j===null)throw ut(Z)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw at("WebGLRenderer: "+N.message),N}let Ze,it,Me,Gt,U,P,ee,he,ve,Re,Fe,ue,ge,Xe,$e,Oe,Ne,_t,Mt,Nt,K,De,fe;
vendor: 33,995 bytes, line 4114
4114function Ye(){Ze=new YD(j),Ze.init(),K=new sT(j,Ze),it=new kD(j,Ze,e,K),Me=new ON(j,Ze),it.reversedDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),Gt=new ZD(j),U=new MN,P=new UN(j,Ze,Me,U,it,K,Gt),ee=new JD(O),he=new tL(j),De=new UD(j,he),ve=new KD(j,he,Gt,De),Re=new $D(j,ve,he,De,Gt),_t=new QD(j,it,P),$e=new HD(U),Fe=new AN(O,ee,Ze,it,De,$e),ue=new WN(O,U),ge=new EN,Xe=new BN(Ze),Ne=new OD(O,ee,Me,Re,_,u),Oe=new NN(O,Re,it),fe=new jN(j,Gt,it,Me),Mt=new GD(j,Ze,Gt),Nt=new qD(j,Ze,Gt),Gt.programs=Fe.programs,O.capabilities=it,O.extensions=Ze,O.properties=U,O.renderLists=ge,O.shadowMap=Oe,O.state=Me,O.info=Gt}Ye(),b!==mi&&(I=new tF(b,t.width,t.height,i,r));const Ge=new zN(O,j);this.xr=Ge,this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){const N=Ze.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=Ze.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return He},this.setPixelRatio=function(N){N!==void 0&&(He=N,this.setSize(Ue,Pe,!1))},this.getSize=function(N){return N.set(Ue,Pe)},this.setSize=function(N,Z,ie=!0){if(Ge.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}Ue=N,Pe=Z,t.width=Math.floor(N*He),t.height=Math.floor(Z*He),ie===!0&&(t.style.width=N+"px",t.style.height=Z+"px"),I!==null&&I.setSize(t.width,t.height),this.setViewport(0,0,N,Z)},this.getDrawingBufferSize=function(N){return N.set(Ue*He,Pe*He).floor()},this.setDrawingBufferSize=function(N,Z,ie){Ue=N,Pe=Z,He=ie,t.width=Math.floor(N*ie),t.height=Math.floor(Z*ie),this.setViewport(0,0,N,Z)},this.setEffects=function(N){if(b===mi){at("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(N){for(let Z=0;Z<N.length;Z++)if(N[Z].isOutputPass===!0){ke("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}I.setEffects(N||[])},this.getCurrentViewport=function(N){return N.copy(q)},this.getViewport=function(N){return N.copy(ye)},this.setViewport=function(N,Z,ie,te){N.isVector4?ye.set(N.x,N.y,N.z,N.w):ye.set(N,Z,ie,te),Me.viewport(q.copy(ye).multiplyScalar(He).round())},this.getScissor=function(N){return N.copy(ze)},this.setScissor=function(N,Z,ie,te){N.isVector4?ze.set(N.x,N.y,N.z,N.w):ze.set(N,Z,ie,te),Me.scissor(Q.copy(ze).multiplyScalar(He).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(N){Me.setScissorTest(Je=N)},this.setOpaqueSort=function(N){le=N},this.setTransparentSort=function(N){Le=N},this.getClearColor=function(N){return N.copy(Ne.getClearColor())},this.setClearColor=function(){Ne.setClearColor(...arguments)},this.getClearAlpha=function(){return Ne.getClearAlpha()},this.setClearAlpha=function(){Ne.setClearAlpha(...arguments)},this.clear=function(N=!0,Z=!0,ie=!0){let te=0;if(N){let ne=!1;if(V!==null){const Se=V.texture.format;ne=v.has(Se)}if(ne){const Se=V.texture.type,Qe=y.has(Se),We=Ne.getClearColor(),st=Ne.getClearAlpha(),lt=We.r,bt=We.g,St=We.b;Qe?(A[0]=lt,A[1]=bt,A[2]=St,A[3]=st,j.clearBufferuiv(j.COLOR,0,A)):(S[0]=lt,S[1]=bt,S[2]=St,S[3]=st,j.clearBufferiv(j.COLOR,0,S))}else te|=j.COLOR_BUFFER_BIT}Z&&(te|=j.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ie&&(te|=j.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),te!==0&&j.clear(te)},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(N){N.setRenderer(this),z=N},this.dispose=function(){t.removeEventListener("webglcontextlost",be,!1),t.removeEventListener("webglcontextrestored",ot,!1),t.removeEventListener("webglcontextcreationerror",yt,!1),Ne.dispose(),ge.dispose(),Xe.dispose(),U.dispose(),ee.dispose(),Re.dispose(),De.dispose(),fe.dispose(),Fe.dispose(),Ge.dispose(),Ge.removeEventListener("sessionstart",wa),Ge.removeEventListener("sessionend",Cs),ws.stop()};function be(N){N.preventDefault(),Nu("WebGLRenderer: Context Lost."),D=!0}function ot(){Nu("WebGLRenderer: Context Restored."),D=!1;const N=Gt.autoReset,Z=Oe.enabled,ie=Oe.autoUpdate,te=Oe.needsUpdate,ne=Oe.type;Ye(),Gt.autoReset=N,Oe.enabled=Z,Oe.autoUpdate=ie,Oe.needsUpdate=te,Oe.type=ne}function yt(N){at("WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function cn(N){const Z=N.target;Z.removeEventListener("dispose",cn),Vt(Z)}function Vt(N){yi(N),U.remove(N)}function yi(N){const Z=U.get(N).programs;Z!==void 0&&(Z.forEach(function(ie){Fe.releaseProgram(ie)}),N.isShaderMaterial&&Fe.releaseShaderCache(N))}this.renderBufferDirect=function(N,Z,ie,te,ne,Se){Z===null&&(Z=Te);const Qe=ne.isMesh&&ne.matrixWorld.determinant()<0,We=nh(N,Z,ie,te,ne);Me.setMaterial(te,Qe);let st=ie.index,lt=1;if(te.wireframe===!0){if(st=ve.getWireframeAttribute(ie),st===void 0)return;lt=2}const bt=ie.drawRange,St=ie.attributes.position;let ct=bt.start*lt,Xt=(bt.start+bt.count)*lt;Se!==null&&(ct=Math.max(ct,Se.start*lt),Xt=Math.min(Xt,(Se.start+Se.count)*lt)),st!==null?(ct=Math.max(ct,0),Xt=Math.min(Xt,st.count)):St!=null&&(ct=Math.max(ct,0),Xt=Math.min(Xt,St.count));const Bt=Xt-ct;if(Bt<0||Bt===1/0)return;De.setup(ne,te,We,ie,st);let At,Jt=Mt;if(st!==null&&(At=he.get(st),Jt=Nt,Jt.setIndex(At)),ne.isMesh)te.wireframe===!0?(Me.setLineWidth(te.wireframeLinewidth*rt()),Jt.setMode(j.LINES)):Jt.setMode(j.TRIANGLES);else if(ne.isLine){let _n=te.linewidth;_n===void 0&&(_n=1),Me.setLineWidth(_n*rt()),ne.isLineSegments?Jt.setMode(j.LINES):ne.isLineLoop?Jt.setMode(j.LINE_LOOP):Jt.setMode(j.LINE_STRIP)}else ne.isPoints?Jt.setMode(j.POINTS):ne.isSprite&&Jt.setMode(j.TRIANGLES);if(ne.isBatchedMesh)if(Ze.get("WEBGL_multi_draw"))Jt.renderMultiDraw(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount);else{const _n=ne._multiDrawStarts,Ke=ne._multiDrawCounts,Wn=ne._multiDrawCount,Et=st?he.get(st).bytesPerElement:1,jn=U.get(te).currentProgram.getUniforms();for(let vi=0;vi<Wn;vi++)jn.setValue(j,"_gl_DrawID",vi),Jt.render(_n[vi]/Et,Ke[vi])}else if(ne.isInstancedMesh)Jt.renderInstances(ct,Bt,ne.count);else if(ie.isInstancedBufferGeometry){const _n=ie._maxInstanceCount!==void 0?ie._maxInstanceCount:1/0,Ke=Math.min(ie.instanceCount,_n);Jt.renderInstances(ct,Bt,Ke)}else Jt.render(ct,Bt)};function Bi(N,Z,ie){N.transparent===!0&&N.side===Vi&&N.forceSinglePass===!1?(N.side=_i,N.needsUpdate=!0,Rs(N,Z,ie),N.side=Zs,N.needsUpdate=!0,Rs(N,Z,ie),N.side=Vi):Rs(N,Z,ie)}this.compile=function(N,Z,ie=null){ie===null&&(ie=N),R=Xe.get(ie),R.init(Z),w.push(R),ie.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Z.layers)&&(R.pushLight(ne),ne.castShadow&&R.pushShadow(ne))}),N!==ie&&N.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Z.layers)&&(R.pushLight(ne),ne.castShadow&&R.pushShadow(ne))}),R.setupLights();const te=new Set;return N.traverse(function(ne){if(!(ne.isMesh||ne.isPoints||ne.isLine||ne.isSprite))return;const Se=ne.material;if(Se)if(Array.isArray(Se))for(let Qe=0;Qe<Se.length;Qe++){const We=Se[Qe];Bi(We,ie,ne),te.add(We)}else Bi(Se,ie,ne),te.add(Se)}),R=w.pop(),te},this.compileAsync=function(N,Z,ie=null){const te=this.compile(N,Z,ie);return new Promise(ne=>{function Se(){if(te.forEach(function(Qe){U.get(Qe).currentProgram.isReady()&&te.delete(Qe)}),te.size===0){ne(N);return}setTimeout(Se,10)}Ze.get("KHR_parallel_shader_compile")!==null?Se():setTimeout(Se,10)})};let wr=null;function Ca(N){wr&&wr(N)}function wa(){ws.stop()}function Cs(){ws.start()}const ws=new Q1;ws.setAnimationLoop(Ca),typeof self<"u"&&ws.setContext(self),this.setAnimationLoop=function(N){wr=N,Ge.setAnimationLoop(N),N===null?ws.stop():ws.start()},Ge.addEventListener("sessionstart",wa),Ge.addEventListener("sessionend",Cs),this.render=function(N,Z){if(Z!==void 0&&Z.isCamera!==!0){at("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;z!==null&&z.renderStart(N,Z);const ie=Ge.enabled===!0&&Ge.isPresenting===!0,te=I!==null&&(V===null||ie)&&I.begin(O,V);if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),Z.parent===null&&Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),Ge.enabled===!0&&Ge.isPresenting===!0&&(I===null||I.isCompositing()===!1)&&(Ge.cameraAutoUpdate===!0&&Ge.updateCamera(Z),Z=Ge.getCamera()),N.isScene===!0&&N.onBeforeRender(O,N,Z,V),R=Xe.get(N,w.length),R.init(Z),R.state.textureUnits=P.getTextureUnits(),w.push(R),de.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),Ee.setFromProjectionMatrix(de,Wi,Z.reversedDepth),qe=this.localClippingEnabled,ht=$e.init(this.clippingPlanes,qe),B=ge.get(N,L.length),B.init(),L.push(B),Ge.enabled===!0&&Ge.isPresenting===!0){const Qe=O.xr.getDepthSensingMesh();Qe!==null&&Rr(Qe,Z,-1/0,O.sortObjects)}Rr(N,Z,0,O.sortObjects),B.finish(),O.sortObjects===!0&&B.sort(le,Le),Ce=Ge.enabled===!1||Ge.isPresenting===!1||Ge.hasDepthSensing()===!1,Ce&&Ne.addToRenderList(B,N),this.info.render.frame++,ht===!0&&$e.beginShadows();const ne=R.state.shadowsArray;if(Oe.render(ne,N,Z),ht===!0&&$e.endShadows(),this.info.autoReset===!0&&this.info.reset(),(te&&I.hasRenderPass())===!1){const Qe=B.opaque,We=B.transmissive;if(R.setupLights(),Z.isArrayCamera){const st=Z.cameras;if(We.length>0)for(let lt=0,bt=st.length;lt<bt;lt++){const St=st[lt];Ia(Qe,We,N,St)}Ce&&Ne.render(N);for(let lt=0,bt=st.length;lt<bt;lt++){const St=st[lt];Ra(B,N,St,St.viewport)}}else We.length>0&&Ia(Qe,We,N,Z),Ce&&Ne.render(N),Ra(B,N,Z)}V!==null&&Y===0&&(P.updateMultisampleRenderTarget(V),P.updateRenderTargetMipmap(V)),te&&I.end(O),N.isScene===!0&&N.onAfterRender(O,N,Z),De.resetDefaultState(),H=-1,W=null,w.pop(),w.length>0?(R=w[w.length-1],P.setTextureUnits(R.state.textureUnits),ht===!0&&$e.setGlobalState(O.clippingPlanes,R.state.camera)):R=null,L.pop(),L.length>0?B=L[L.length-1]:B=null,z!==null&&z.renderEnd()};function Rr(N,Z,ie,te){if(N.visible===!1)return;if(N.layers.test(Z.layers)){if(N.isGroup)ie=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(Z);else if(N.isLightProbeGrid)R.pushLightProbeGrid(N);else if(N.isLight)R.pushLight(N),N.castShadow&&R.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||Ee.intersectsSprite(N)){te&&me.setFromMatrixPosition(N.matrixWorld).applyMatrix4(de);const Qe=Re.update(N),We=N.material;We.visible&&B.push(N,Qe,We,ie,me.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||Ee.intersectsObject(N))){const Qe=Re.update(N),We=N.material;if(te&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),me.copy(N.boundingSphere.center)):(Qe.boundingSphere===null&&Qe.computeBoundingSphere(),me.copy(Qe.boundingSphere.center)),me.applyMatrix4(N.matrixWorld).applyMatrix4(de)),Array.isArray(We)){const st=Qe.groups;for(let lt=0,bt=st.length;lt<bt;lt++){const St=st[lt],ct=We[St.materialIndex];ct&&ct.visible&&B.push(N,Qe,ct,ie,me.z,St)}}else We.visible&&B.push(N,Qe,We,ie,me.z,null)}}const Se=N.children;for(let Qe=0,We=Se.length;Qe<We;Qe++)Rr(Se[Qe],Z,ie,te)}function Ra(N,Z,ie,te){const{opaque:ne,transmissive:Se,transparent:Qe}=N;R.setupLightsView(ie),ht===!0&&$e.setGlobalState(O.clippingPlanes,ie),te&&Me.viewport(q.copy(te)),ne.length>0&&Pi(ne,Z,ie),Se.length>0&&Pi(Se,Z,ie),Qe.length>0&&Pi(Qe,Z,ie),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Ia(N,Z,ie,te){if((ie.isScene===!0?ie.overrideMaterial:null)!==null)return;if(R.state.transmissionRenderTarget[te.id]===void 0){const ct=Ze.has("EXT_color_buffer_half_float")||Ze.has("EXT_color_buffer_float");R.state.transmissionRenderTarget[te.id]=new Ri(1,1,{generateMipmaps:!0,type:ct?bs:mi,minFilter:ts,samples:Math.max(4,it.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:It.workingColorSpace})}const Se=R.state.transmissionRenderTarget[te.id],Qe=te.viewport||q;Se.setSize(Qe.z*O.transmissionResolutionScale,Qe.w*O.transmissionResolutionScale);const We=O.getRenderTarget(),st=O.getActiveCubeFace(),lt=O.getActiveMipmapLevel();O.setRenderTarget(Se),O.getClearColor(ae),pe=O.getClearAlpha(),pe<1&&O.setClearColor(16777215,.5),O.clear(),Ce&&Ne.render(ie);const bt=O.toneMapping;O.toneMapping=ns;const St=te.viewport;if(te.viewport!==void 0&&(te.viewport=void 0),R.setupLightsView(te),ht===!0&&$e.setGlobalState(O.clippingPlanes,te),Pi(N,ie,te),P.updateMultisampleRenderTarget(Se),P.updateRenderTargetMipmap(Se),Ze.has("WEBGL_multisampled_render_to_texture")===!1){let ct=!1;for(let Xt=0,Bt=Z.length;Xt<Bt;Xt++){const At=Z[Xt],{object:Jt,geometry:_n,material:Ke,group:Wn}=At;if(Ke.side===Vi&&Jt.layers.test(te.layers)){const Et=Ke.side;Ke.side=_i,Ke.needsUpdate=!0,rs(Jt,ie,te,_n,Ke,Wn),Ke.side=Et,Ke.needsUpdate=!0,ct=!0}}ct===!0&&(P.updateMultisampleRenderTarget(Se),P.updateRenderTargetMipmap(Se))}O.setRenderTarget(We,st,lt),O.setClearColor(ae,pe),St!==void 0&&(te.viewport=St),O.toneMapping=bt}function Pi(N,Z,ie){const te=Z.isScene===!0?Z.overrideMaterial:null;for(let ne=0,Se=N.length;ne<Se;ne++){const Qe=N[ne],{object:We,geometry:st,group:lt}=Qe;let bt=Qe.material;bt.allowOverride===!0&&te!==null&&(bt=te),We.layers.test(ie.layers)&&rs(We,Z,ie,st,bt,lt)}}function rs(N,Z,ie,te,ne,Se){N.onBeforeRender(O,Z,ie,te,ne,Se),N.modelViewMatrix.multiplyMatrices(ie.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),ne.onBeforeRender(O,Z,ie,te,N,Se),ne.transparent===!0&&ne.side===Vi&&ne.forceSinglePass===!1?(ne.side=_i,ne.needsUpdate=!0,O.renderBufferDirect(ie,Z,te,ne,N,Se),ne.side=Zs,ne.needsUpdate=!0,O.renderBufferDirect(ie,Z,te,ne,N,Se),ne.side=Vi):O.renderBufferDirect(ie,Z,te,ne,N,Se),N.onAfterRender(O,Z,ie,te,ne,Se)}function Rs(N,Z,ie){Z.isScene!==!0&&(Z=Te);const te=U.get(N),ne=R.state.lights,Se=R.state.shadowsArray,Qe=ne.state.version,We=Fe.getParameters(N,ne.state,Se,Z,ie,R.state.lightProbeGridArray),st=Fe.getProgramCacheKey(We);let lt=te.programs;te.environment=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?Z.environment:null,te.fog=Z.fog;const bt=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap;te.envMap=ee.get(N.envMap||te.environment,bt),te.envMapRotation=te.environment!==null&&N.envMap===null?Z.environmentRotation:N.envMapRotation,lt===void 0&&(N.addEventListener("dispose",cn),lt=new Map,te.programs=lt);let St=lt.get(st);if(St!==void 0){if(te.currentProgram===St&&te.lightsStateVersion===Qe)return Ir(N,We),St}else We.uniforms=Fe.getUniforms(N),z!==null&&N.isNodeMaterial&&z.build(N,ie,We),N.onBeforeCompile(We,O),St=Fe.acquireProgram(We,st),lt.set(st,St),te.uniforms=We.uniforms;const ct=te.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(ct.clippingPlanes=$e.uniform),Ir(N,We),te.needsLights=sh(N),te.lightsStateVersion=Qe,te.needsLights&&(ct.ambientLightColor.value=ne.state.ambient,ct.lightProbe.value=ne.state.probe,ct.directionalLights.value=ne.state.directional,ct.directionalLightShadows.value=ne.state.directionalShadow,ct.spotLights.value=ne.state.spot,ct.spotLightShadows.value=ne.state.spotShadow,ct.rectAreaLights.value=ne.state.rectArea,ct.ltc_1.value=ne.state.rectAreaLTC1,ct.ltc_2.value=ne.state.rectAreaLTC2,ct.pointLights.value=ne.state.point,ct.pointLightShadows.value=ne.state.pointShadow,ct.hemisphereLights.value=ne.state.hemi,ct.directionalShadowMatrix.value=ne.state.directionalShadowMatrix,ct.spotLightMatrix.value=ne.state.spotLightMatrix,ct.spotLightMap.value=ne.state.spotLightMap,ct.pointShadowMatrix.value=ne.state.pointShadowMatrix),te.lightProbeGrid=R.state.lightProbeGridArray.length>0,te.currentProgram=St,te.uniformsList=null,St}function Ba(N){if(N.uniformsList===null){const Z=N.currentProgram.getUniforms();N.uniformsList=bd.seqWithValue(Z.seq,N.uniforms)}return N.uniformsList}function Ir(N,Z){const ie=U.get(N);ie.outputColorSpace=Z.outputColorSpace,ie.batching=Z.batching,ie.batchingColor=Z.batchingColor,ie.instancing=Z.instancing,ie.instancingColor=Z.instancingColor,ie.instancingMorph=Z.instancingMorph,ie.skinning=Z.skinning,ie.morphTargets=Z.morphTargets,ie.morphNormals=Z.morphNormals,ie.morphColors=Z.morphColors,ie.morphTargetsCount=Z.morphTargetsCount,ie.numClippingPlanes=Z.numClippingPlanes,ie.numIntersection=Z.numClipIntersection,ie.vertexAlphas=Z.vertexAlphas,ie.vertexTangents=Z.vertexTangents,ie.toneMapping=Z.toneMapping}function Ao(N,Z){if(N.length===0)return null;if(N.length===1)return N[0].texture!==null?N[0]:null;T.setFromMatrixPosition(Z.matrixWorld);for(let ie=0,te=N.length;ie<te;ie++){const ne=N[ie];if(ne.texture!==null&&ne.boundingBox.containsPoint(T))return ne}return null}function nh(N,Z,ie,te,ne){Z.isScene!==!0&&(Z=Te),P.resetTextureUnits();const Se=Z.fog,Qe=te.isMeshStandardMaterial||te.isMeshLambertMaterial||te.isMeshPhongMaterial?Z.environment:null,We=V===null?O.outputColorSpace:V.isXRRenderTarget===!0?V.texture.colorSpace:It.workingColorSpace,st=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap,lt=ee.get(te.envMap||Qe,st),bt=te.vertexColors===!0&&!!ie.attributes.color&&ie.attributes.color.itemSize===4,St=!!ie.attributes.tangent&&(!!te.normalMap||te.anisotropy>0),ct=!!ie.morphAttributes.position,Xt=!!ie.morphAttributes.normal,Bt=!!ie.morphAttributes.color;let At=ns;te.toneMapped&&(V===null||V.isXRRenderTarget===!0)&&(At=O.toneMapping);const Jt=ie.morphAttributes.position||ie.morphAttributes.normal||ie.morphAttributes.color,_n=Jt!==void 0?Jt.length:0,Ke=U.get(te),Wn=R.state.lights;if(ht===!0&&(qe===!0||N!==W)){const en=N===W&&te.id===H;$e.setState(te,N,en)}let Et=!1;te.version===Ke.__version?(Ke.needsLights&&Ke.lightsStateVersion!==Wn.state.version||Ke.outputColorSpace!==We||ne.isBatchedMesh&&Ke.batching===!1||!ne.isBatchedMesh&&Ke.batching===!0||ne.isBatchedMesh&&Ke.batchingColor===!0&&ne.colorTexture===null||ne.isBatchedMesh&&Ke.batchingColor===!1&&ne.colorTexture!==null||ne.isInstancedMesh&&Ke.instancing===!1||!ne.isInstancedMesh&&Ke.instancing===!0||ne.isSkinnedMesh&&Ke.skinning===!1||!ne.isSkinnedMesh&&Ke.skinning===!0||ne.isInstancedMesh&&Ke.instancingColor===!0&&ne.instanceColor===null||ne.isInstancedMesh&&Ke.instancingColor===!1&&ne.instanceColor!==null||ne.isInstancedMesh&&Ke.instancingMorph===!0&&ne.morphTexture===null||ne.isInstancedMesh&&Ke.instancingMorph===!1&&ne.morphTexture!==null||Ke.envMap!==lt||te.fog===!0&&Ke.fog!==Se||Ke.numClippingPlanes!==void 0&&(Ke.numClippingPlanes!==$e.numPlanes||Ke.numIntersection!==$e.numIntersection)||Ke.vertexAlphas!==bt||Ke.vertexTangents!==St||Ke.morphTargets!==ct||Ke.morphNormals!==Xt||Ke.morphColors!==Bt||Ke.toneMapping!==At||Ke.morphTargetsCount!==_n||!!Ke.lightProbeGrid!=R.state.lightProbeGridArray.length>0)&&(Et=!0):(Et=!0,Ke.__version=te.version);let jn=Ke.currentProgram;Et===!0&&(jn=Rs(te,Z,ne),z&&te.isNodeMaterial&&z.onUpdateProgram(te,jn,Ke));let vi=!1,Yi=!1,er=!1;const Zt=jn.getUniforms(),dn=Ke.uniforms;if(Me.useProgram(jn.program)&&(vi=!0,Yi=!0,er=!0),te.id!==H&&(H=te.id,Yi=!0),Ke.needsLights){const en=Ao(R.state.lightProbeGridArray,ne);Ke.lightProbeGrid!==en&&(Ke.lightProbeGrid=en,Yi=!0)}if(vi||W!==N){Me.buffers.depth.getReversed()&&N.reversedDepth!==!0&&(N._reversedDepth=!0,N.updateProjectionMatrix()),Zt.setValue(j,"projectionMatrix",N.projectionMatrix),Zt.setValue(j,"viewMatrix",N.matrixWorldInverse);const as=Zt.map.cameraPosition;as!==void 0&&as.setValue(j,_e.setFromMatrixPosition(N.matrixWorld)),it.logarithmicDepthBuffer&&Zt.setValue(j,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(te.isMeshPhongMaterial||te.isMeshToonMaterial||te.isMeshLambertMaterial||te.isMeshBasicMaterial||te.isMeshStandardMaterial||te.isShaderMaterial)&&Zt.setValue(j,"isOrthographic",N.isOrthographicCamera===!0),W!==N&&(W=N,Yi=!0,er=!0)}if(Ke.needsLights&&(Wn.state.directionalShadowMap.length>0&&Zt.setValue(j,"directionalShadowMap",Wn.state.directionalShadowMap,P),Wn.state.spotShadowMap.length>0&&Zt.setValue(j,"spotShadowMap",Wn.state.spotShadowMap,P),Wn.state.pointShadowMap.length>0&&Zt.setValue(j,"pointShadowMap",Wn.state.pointShadowMap,P)),ne.isSkinnedMesh){Zt.setOptional(j,ne,"bindMatrix"),Zt.setOptional(j,ne,"bindMatrixInverse");const en=ne.skeleton;en&&(en.boneTexture===null&&en.computeBoneTexture(),Zt.setValue(j,"boneTexture",en.boneTexture,P))}ne.isBatchedMesh&&(Zt.setOptional(j,ne,"batchingTexture"),Zt.setValue(j,"batchingTexture",ne._matricesTexture,P),Zt.setOptional(j,ne,"batchingIdTexture"),Zt.setValue(j,"batchingIdTexture",ne._indirectTexture,P),Zt.setOptional(j,ne,"batchingColorTexture"),ne._colorsTexture!==null&&Zt.setValue(j,"batchingColorTexture",ne._colorsTexture,P));const os=ie.morphAttributes;if((os.position!==void 0||os.normal!==void 0||os.color!==void 0)&&_t.update(ne,ie,jn),(Yi||Ke.receiveShadow!==ne.receiveShadow)&&(Ke.receiveShadow=ne.receiveShadow,Zt.setValue(j,"receiveShadow",ne.receiveShadow)),(te.isMeshStandardMaterial||te.isMeshLambertMaterial||te.isMeshPhongMaterial)&&te.envMap===null&&Z.environment!==null&&(dn.envMapIntensity.value=Z.environmentIntensity),dn.dfgLUT!==void 0&&(dn.dfgLUT.value=JN()),Yi){if(Zt.setValue(j,"toneMappingExposure",O.toneMappingExposure),Ke.needsLights&&ih(dn,er),Se&&te.fog===!0&&ue.refreshFogUniforms(dn,Se),ue.refreshMaterialUniforms(dn,te,He,Pe,R.state.transmissionRenderTarget[N.id]),Ke.needsLights&&Ke.lightProbeGrid){const en=Ke.lightProbeGrid;dn.probesSH.value=en.texture,dn.probesMin.value.copy(en.boundingBox.min),dn.probesMax.value.copy(en.boundingBox.max),dn.probesResolution.value.copy(en.resolution)}bd.upload(j,Ba(Ke),dn,P)}if(te.isShaderMaterial&&te.uniformsNeedUpdate===!0&&(bd.upload(j,Ba(Ke),dn,P),te.uniformsNeedUpdate=!1),te.isSpriteMaterial&&Zt.setValue(j,"center",ne.center),Zt.setValue(j,"modelViewMatrix",ne.modelViewMatrix),Zt.setValue(j,"normalMatrix",ne.normalMatrix),Zt.setValue(j,"modelMatrix",ne.matrixWorld),te.uniformsGroups!==void 0){const en=te.uniformsGroups;for(let as=0,Bs=en.length;as<Bs;as++){const mc=en[as];fe.update(mc,jn),fe.bind(mc,jn)}}return jn}function ih(N,Z){N.ambientLightColor.needsUpdate=Z,N.lightProbe.needsUpdate=Z,N.directionalLights.needsUpdate=Z,N.directionalLightShadows.needsUpdate=Z,N.pointLights.needsUpdate=Z,N.pointLightShadows.needsUpdate=Z,N.spotLights.needsUpdate=Z,N.spotLightShadows.needsUpdate=Z,N.rectAreaLights.needsUpdate=Z,N.hemisphereLights.needsUpdate=Z}function sh(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return X},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return V},this.setRenderTargetTextures=function(N,Z,ie){const te=U.get(N);te.__autoAllocateDepthBuffer=N.resolveDepthBuffer===!1,te.__autoAllocateDepthBuffer===!1&&(te.__useRenderToTexture=!1),U.get(N.texture).__webglTexture=Z,U.get(N.depthTexture).__webglTexture=te.__autoAllocateDepthBuffer?void 0:ie,te.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(N,Z){const ie=U.get(N);ie.__webglFramebuffer=Z,ie.__useDefaultFramebuffer=Z===void 0};const dc=j.createFramebuffer();this.setRenderTarget=function(N,Z=0,ie=0){V=N,X=Z,Y=ie;let te=null,ne=!1,Se=!1;if(N){const We=U.get(N);if(We.__useDefaultFramebuffer!==void 0){Me.bindFramebuffer(j.FRAMEBUFFER,We.__webglFramebuffer),q.copy(N.viewport),Q.copy(N.scissor),re=N.scissorTest,Me.viewport(q),Me.scissor(Q),Me.setScissorTest(re),H=-1;return}else if(We.__webglFramebuffer===void 0)P.setupRenderTarget(N);else if(We.__hasExternalTextures)P.rebindTextures(N,U.get(N.texture).__webglTexture,U.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const bt=N.depthTexture;if(We.__boundDepthTexture!==bt){if(bt!==null&&U.has(bt)&&(N.width!==bt.image.width||N.height!==bt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");P.setupDepthRenderbuffer(N)}}const st=N.texture;(st.isData3DTexture||st.isDataArrayTexture||st.isCompressedArrayTexture)&&(Se=!0);const lt=U.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(lt[Z])?te=lt[Z][ie]:te=lt[Z],ne=!0):N.samples>0&&P.useMultisampledRTT(N)===!1?te=U.get(N).__webglMultisampledFramebuffer:Array.isArray(lt)?te=lt[ie]:te=lt,q.copy(N.viewport),Q.copy(N.scissor),re=N.scissorTest}else q.copy(ye).multiplyScalar(He).floor(),Q.copy(ze).multiplyScalar(He).floor(),re=Je;if(ie!==0&&(te=dc),Me.bindFramebuffer(j.FRAMEBUFFER,te)&&Me.drawBuffers(N,te),Me.viewport(q),Me.scissor(Q),Me.setScissorTest(re),ne){const We=U.get(N.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_CUBE_MAP_POSITIVE_X+Z,We.__webglTexture,ie)}else if(Se){const We=Z;for(let st=0;st<N.textures.length;st++){const lt=U.get(N.textures[st]);j.framebufferTextureLayer(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0+st,lt.__webglTexture,ie,We)}}else if(N!==null&&ie!==0){const We=U.get(N.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,We.__webglTexture,ie)}H=-1},this.readRenderTargetPixels=function(N,Z,ie,te,ne,Se,Qe,We=0){if(!(N&&N.isWebGLRenderTarget)){at("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=U.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Qe!==void 0&&(st=st[Qe]),st){Me.bindFramebuffer(j.FRAMEBUFFER,st);try{const lt=N.textures[We],bt=lt.format,St=lt.type;if(N.textures.length>1&&j.readBuffer(j.COLOR_ATTACHMENT0+We),!it.textureFormatReadable(bt)){at("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!it.textureTypeReadable(St)){at("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Z>=0&&Z<=N.width-te&&ie>=0&&ie<=N.height-ne&&j.readPixels(Z,ie,te,ne,K.convert(bt),K.convert(St),Se)}finally{const lt=V!==null?U.get(V).__webglFramebuffer:null;Me.bindFramebuffer(j.FRAMEBUFFER,lt)}}},this.readRenderTargetPixelsAsync=async function(N,Z,ie,te,ne,Se,Qe,We=0){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let st=U.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Qe!==void 0&&(st=st[Qe]),st)if(Z>=0&&Z<=N.width-te&&ie>=0&&ie<=N.height-ne){Me.bindFramebuffer(j.FRAMEBUFFER,st);const lt=N.textures[We],bt=lt.format,St=lt.type;if(N.textures.length>1&&j.readBuffer(j.COLOR_ATTACHMENT0+We),!it.textureFormatReadable(bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!it.textureTypeReadable(St))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ct=j.createBuffer();j.bindBuffer(j.PIXEL_PACK_BUFFER,ct),j.bufferData(j.PIXEL_PACK_BUFFER,Se.byteLength,j.STREAM_READ),j.readPixels(Z,ie,te,ne,K.convert(bt),K.convert(St),0);const Xt=V!==null?U.get(V).__webglFramebuffer:null;Me.bindFramebuffer(j.FRAMEBUFFER,Xt);const Bt=j.fenceSync(j.SYNC_GPU_COMMANDS_COMPLETE,0);return j.flush(),await rI(j,Bt,4),j.bindBuffer(j.PIXEL_PACK_BUFFER,ct),j.getBufferSubData(j.PIXEL_PACK_BUFFER,0,Se),j.deleteBuffer(ct),j.deleteSync(Bt),Se}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(N,Z=null,ie=0){const te=Math.pow(2,-ie),ne=Math.floor(N.image.width*te),Se=Math.floor(N.image.height*te),Qe=Z!==null?Z.x:0,We=Z!==null?Z.y:0;P.setTexture2D(N,0),j.copyTexSubImage2D(j.TEXTURE_2D,ie,0,0,Qe,We,ne,Se),Me.unbindTexture()};const pc=j.createFramebuffer(),Is=j.createFramebuffer();this.copyTextureToTexture=function(N,Z,ie=null,te=null,ne=0,Se=0){let Qe,We,st,lt,bt,St,ct,Xt,Bt;const At=N.isCompressedTexture?N.mipmaps[Se]:N.image;if(ie!==null)Qe=ie.max.x-ie.min.x,We=ie.max.y-ie.min.y,st=ie.isBox3?ie.max.z-ie.min.z:1,lt=ie.min.x,bt=ie.min.y,St=ie.isBox3?ie.min.z:0;else{const dn=Math.pow(2,-ne);Qe=Math.floor(At.width*dn),We=Math.floor(At.height*dn),N.isDataArrayTexture?st=At.depth:N.isData3DTexture?st=Math.floor(At.depth*dn):st=1,lt=0,bt=0,St=0}te!==null?(ct=te.x,Xt=te.y,Bt=te.z):(ct=0,Xt=0,Bt=0);const Jt=K.convert(Z.format),_n=K.convert(Z.type);let Ke;Z.isData3DTexture?(P.setTexture3D(Z,0),Ke=j.TEXTURE_3D):Z.isDataArrayTexture||Z.isCompressedArrayTexture?(P.setTexture2DArray(Z,0),Ke=j.TEXTURE_2D_ARRAY):(P.setTexture2D(Z,0),Ke=j.TEXTURE_2D),Me.activeTexture(j.TEXTURE0),Me.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,Z.flipY),Me.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),Me.pixelStorei(j.UNPACK_ALIGNMENT,Z.unpackAlignment);const Wn=Me.getParameter(j.UNPACK_ROW_LENGTH),Et=Me.getParameter(j.UNPACK_IMAGE_HEIGHT),jn=Me.getParameter(j.UNPACK_SKIP_PIXELS),vi=Me.getParameter(j.UNPACK_SKIP_ROWS),Yi=Me.getParameter(j.UNPACK_SKIP_IMAGES);Me.pixelStorei(j.UNPACK_ROW_LENGTH,At.width),Me.pixelStorei(j.UNPACK_IMAGE_HEIGHT,At.height),Me.pixelStorei(j.UNPACK_SKIP_PIXELS,lt),Me.pixelStorei(j.UNPACK_SKIP_ROWS,bt),Me.pixelStorei(j.UNPACK_SKIP_IMAGES,St);const er=N.isDataArrayTexture||N.isData3DTexture,Zt=Z.isDataArrayTexture||Z.isData3DTexture;if(N.isDepthTexture){const dn=U.get(N),os=U.get(Z),en=U.get(dn.__renderTarget),as=U.get(os.__renderTarget);Me.bindFramebuffer(j.READ_FRAMEBUFFER,en.__webglFramebuffer),Me.bindFramebuffer(j.DRAW_FRAMEBUFFER,as.__webglFramebuffer);for(let Bs=0;Bs<st;Bs++)er&&(j.framebufferTextureLayer(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,U.get(N).__webglTexture,ne,St+Bs),j.framebufferTextureLayer(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,U.get(Z).__webglTexture,Se,Bt+Bs)),j.blitFramebuffer(lt,bt,Qe,We,ct,Xt,Qe,We,j.DEPTH_BUFFER_BIT,j.NEAREST);Me.bindFramebuffer(j.READ_FRAMEBUFFER,null),Me.bindFramebuffer(j.DRAW_FRAMEBUFFER,null)}else if(ne!==0||N.isRenderTargetTexture||U.has(N)){const dn=U.get(N),os=U.get(Z);Me.bindFramebuffer(j.READ_FRAMEBUFFER,pc),Me.bindFramebuffer(j.DRAW_FRAMEBUFFER,Is);for(let en=0;en<st;en++)er?j.framebufferTextureLayer(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,dn.__webglTexture,ne,St+en):j.framebufferTexture2D(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,dn.__webglTexture,ne),Zt?j.framebufferTextureLayer(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,os.__webglTexture,Se,Bt+en):j.framebufferTexture2D(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,os.__webglTexture,Se),ne!==0?j.blitFramebuffer(lt,bt,Qe,We,ct,Xt,Qe,We,j.COLOR_BUFFER_BIT,j.NEAREST):Zt?j.copyTexSubImage3D(Ke,Se,ct,Xt,Bt+en,lt,bt,Qe,We):j.copyTexSubImage2D(Ke,Se,ct,Xt,lt,bt,Qe,We);Me.bindFramebuffer(j.READ_FRAMEBUFFER,null),Me.bindFramebuffer(j.DRAW_FRAMEBUFFER,null)}else Zt?N.isDataTexture||N.isData3DTexture?j.texSubImage3D(Ke,Se,ct,Xt,Bt,Qe,We,st,Jt,_n,At.data):Z.isCompressedArrayTexture?j.compressedTexSubImage3D(Ke,Se,ct,Xt,Bt,Qe,We,st,Jt,At.data):j.texSubImage3D(Ke,Se,ct,Xt,Bt,Qe,We,st,Jt,_n,At):N.isDataTexture?j.texSubImage2D(j.TEXTURE_2D,Se,ct,Xt,Qe,We,Jt,_n,At.data):N.isCompressedTexture?j.compressedTexSubImage2D(j.TEXTURE_2D,Se,ct,Xt,At.width,At.height,Jt,At.data):j.texSubImage2D(j.TEXTURE_2D,Se,ct,Xt,Qe,We,Jt,_n,At);Me.pixelStorei(j.UNPACK_ROW_LENGTH,Wn),Me.pixelStorei(j.UNPACK_IMAGE_HEIGHT,Et),Me.pixelStorei(j.UNPACK_SKIP_PIXELS,jn),Me.pixelStorei(j.UNPACK_SKIP_ROWS,vi),Me.pixelStorei(j.UNPACK_SKIP_IMAGES,Yi),Se===0&&Z.generateMipmaps&&j.generateMipmap(Ke),Me.unbindTexture()},this.initRenderTarget=function(N){U.get(N).__webglFramebuffer===void 0&&P.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?P.setTextureCube(N,0):N.isData3DTexture?P.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?P.setTexture2DArray(N,0):P.setTexture2D(N,0),Me.unbindTexture()},this.resetState=function(){X=0,Y=0,V=null,Me.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Wi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=It._getDrawingBufferColorSpace(e),t.unpackColorSpace=It._getUnpackColorSpace()}}const YN=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Tp,AddEquation:ao,AddOperation:zE,AdditiveAnimationBlendMode:r_,AdditiveBlending:mx,AgXToneMapping:Zx,AlphaFormat:i_,AlwaysCompare:t1,AlwaysDepth:Rd,AlwaysStencilFunc:vx,AmbientLight:O1,AnimationAction:J1,AnimationClip:sc,AnimationLoader:qB,AnimationMixer:SP,AnimationObjectGroup:AP,AnimationUtils:XB,ArcCurve:d1,ArrayCamera:V1,ArrowHelper:XP,AttachedBindMode:_x,Audio:j1,AudioAnalyser:fP,AudioContext:G_,AudioListener:cP,AudioLoader:rP,AxesHelper:JP,BackSide:_i,BasicDepthPacking:YE,BasicShadowMap:AE,BatchedMesh:u1,BezierInterpolant:P1,Bone:zp,BooleanKeyframeTrack:Ea,Box2:BP,Box3:Ln,Box3Helper:WP,BoxGeometry:Ms,BoxHelper:VP,BufferAttribute:Ut,BufferGeometry:mt,BufferGeometryLoader:k1,ByteType:$x,Cache:Xs,Camera:rm,CameraHelper:zP,CanvasTexture:hB,CapsuleGeometry:Xp,CatmullRomCurve3:p1,CineonToneMapping:Kx,CircleGeometry:Jp,ClampToEdgeWrapping:xi,Clock:K1,Color:we,ColorKeyframeTrack:B_,ColorManagement:It,Compatibility:eI,CompressedArrayTexture:cB,CompressedCubeTexture:uB,CompressedTexture:jp,CompressedTextureLoader:ZB,ConeGeometry:qu,ConstantAlphaFactor:GE,ConstantColorFactor:OE,Controls:KP,CubeCamera:z1,CubeDepthTexture:f1,CubeReflectionMapping:Qs,CubeRefractionMapping:po,CubeTexture:Yu,CubeTextureLoader:QB,CubeUVReflectionMapping:ac,CubicBezierCurve:v_,CubicBezierCurve3:m1,CubicInterpolant:I1,CullFaceBack:px,CullFaceFront:bE,CullFaceFrontBack:mR,CullFaceNone:vE,Curve:Ts,CurvePath:x1,CustomBlending:ME,CustomToneMapping:qx,CylinderGeometry:Ku,Cylindrical:IP,Data3DTexture:Gp,DataArrayTexture:Up,DataTexture:vs,DataTextureLoader:$B,DataUtils:NI,DecrementStencilOp:BR,DecrementWrapStencilOp:LR,DefaultLoadingManager:D1,DepthFormat:$s,DepthStencilFormat:co,DepthTexture:_o,DetachedBindMode:VE,DirectionalLight:N_,DirectionalLightHelper:HP,DiscreteInterpolant:B1,DodecahedronGeometry:Yp,DoubleSide:Vi,DstAlphaFactor:PE,DstColorFactor:
4114DE,DynamicCopyUsage:YR,DynamicDrawUsage:zR,DynamicReadUsage:jR,EdgesGeometry:tc,EllipseCurve:Kp,EqualCompare:QE,EqualDepth:Bd,EqualStencilFunc:OR,EquirectangularReflectionMapping:yu,EquirectangularRefractionMapping:vu,Euler:As,EventDispatcher:Ss,ExternalTexture:__,ExtrudeGeometry:qp,FileLoader:Ji,Float16BufferAttribute:VI,Float32BufferAttribute:tt,FloatType:oi,Fog:Hp,FogExp2:kp,FramebufferTexture:lB,FrontSide:Zs,Frustum:cc,FrustumArray:Vp,GLBufferAttribute:wP,GLSL1:qR,GLSL3:bx,GreaterCompare:$E,GreaterDepth:Ld,GreaterEqualCompare:Op,GreaterEqualDepth:Pd,GreaterEqualStencilFunc:HR,GreaterStencilFunc:GR,GridHelper:GP,Group:Ar,HTMLTexture:fB,HalfFloatType:bs,HemisphereLight:N1,HemisphereLightHelper:UP,IcosahedronGeometry:Zp,ImageBitmapLoader:H1,ImageLoader:ku,ImageUtils:r1,IncrementStencilOp:IR,IncrementWrapStencilOp:PR,InstancedBufferAttribute:_a,InstancedBufferGeometry:U_,InstancedInterleavedBuffer:_p,InstancedMesh:m_,Int16BufferAttribute:HI,Int32BufferAttribute:zI,Int8BufferAttribute:UI,IntType:Rp,InterleavedBuffer:Xu,InterleavedBufferAttribute:wi,Interpolant:Sa,InterpolateBezier:yx,InterpolateDiscrete:ql,InterpolateLinear:Zl,InterpolateSmooth:yd,InterpolationSamplingMode:$R,InterpolationSamplingType:QR,InvertStencilOp:DR,KeepStencilOp:$o,KeyframeTrack:ss,LOD:c1,LatheGeometry:Qp,Layers:ec,LessCompare:ZE,LessDepth:Id,LessEqualCompare:Np,LessEqualDepth:ga,LessEqualStencilFunc:UR,LessStencilFunc:NR,Light:vo,LightProbe:G1,Line:Tr,Line3:q1,LineBasicMaterial:li,LineCurve:b_,LineCurve3:g1,LineDashedMaterial:w1,LineLoop:g_,LineSegments:Es,LinearFilter:nn,LinearInterpolant:I_,LinearMipMapLinearFilter:vR,LinearMipMapNearestFilter:yR,LinearMipmapLinearFilter:ts,LinearMipmapNearestFilter:Vl,LinearSRGBColorSpace:Ql,LinearToneMapping:Jx,LinearTransfer:Lu,Loader:ui,LoaderUtils:fo,LoadingManager:P_,LoopOnce:WE,LoopPingPong:XE,LoopRepeat:jE,MOUSE:dR,Material:On,MaterialBlending:gR,MaterialLoader:om,MathUtils:l_,Matrix2:Cx,Matrix3:vt,Matrix4:ft,MaxEquation:CE,Mesh:An,MeshBasicMaterial:ji,MeshDepthMaterial:C_,MeshDistanceMaterial:w_,MeshLambertMaterial:xs,MeshMatcapMaterial:C1,MeshNormalMaterial:T1,MeshPhongMaterial:S1,MeshPhysicalMaterial:ci,MeshStandardMaterial:et,MeshToonMaterial:E1,MinEquation:TE,MirroredRepeatWrapping:Jl,MixOperation:HE,MultiplyBlending:xx,MultiplyOperation:Wu,NearestFilter:bn,NearestMipMapLinearFilter:_R,NearestMipMapNearestFilter:xR,NearestMipmapLinearFilter:ia,NearestMipmapNearestFilter:wp,NeutralToneMapping:Qx,NeverCompare:qE,NeverDepth:wd,NeverStencilFunc:FR,NoBlending:Ys,NoColorSpace:vr,NoNormalPacking:ER,NoToneMapping:ns,NormalAnimationBlendMode:Fp,NormalBlending:ha,NormalGAPacking:CR,NormalRGPacking:TR,NotEqualCompare:e1,NotEqualDepth:Dd,NotEqualStencilFunc:kR,NumberKeyframeTrack:va,Object3D:zt,ObjectLoader:iP,ObjectSpaceNormalMap:KE,OctahedronGeometry:Zu,OneFactor:RE,OneMinusConstantAlphaFactor:kE,OneMinusConstantColorFactor:UE,OneMinusDstAlphaFactor:LE,OneMinusDstColorFactor:FE,OneMinusSrcAlphaFactor:Cd,OneMinusSrcColorFactor:BE,OrthographicCamera:Cr,PCFShadowMap:zl,PCFSoftShadowMap:_u,PMREMGenerator:Rx,Path:gp,PerspectiveCamera:En,Plane:oo,PlaneGeometry:uc,PlaneHelper:jP,PointLight:F_,PointLightHelper:NP,Points:x_,PointsMaterial:Wp,PolarGridHelper:kP,PolyhedronGeometry:yo,PositionalAudio:hP,PropertyBinding:Wt,PropertyMixer:X1,QuadraticBezierCurve:A_,QuadraticBezierCurve3:M_,Quaternion:Qn,QuaternionKeyframeTrack:ba,QuaternionLinearInterpolant:L1,R11_EAC_Format:zd,RED_GREEN_RGTC2_Format:Bu,RED_RGTC1_Format:lp,REVISION:Vu,RG11_EAC_Format:Iu,RGBADepthPacking:AR,RGBAFormat:ai,RGBAIntegerFormat:Dp,RGBA_ASTC_10x10_Format:np,RGBA_ASTC_10x5_Format:$d,RGBA_ASTC_10x6_Format:ep,RGBA_ASTC_10x8_Format:tp,RGBA_ASTC_12x10_Format:ip,RGBA_ASTC_12x12_Format:sp,RGBA_ASTC_4x4_Format:jd,RGBA_ASTC_5x4_Format:Xd,RGBA_ASTC_5x5_Format:Jd,RGBA_ASTC_6x5_Format:Yd,RGBA_ASTC_6x6_Format:Kd,RGBA_ASTC_8x5_Format:qd,RGBA_ASTC_8x6_Format:Zd,RGBA_ASTC_8x8_Format:Qd,RGBA_BPTC_Format:rp,RGBA_ETC2_EAC_Format:Hd,RGBA_PVRTC_2BPPV1_Format:Ud,RGBA_PVRTC_4BPPV1_Format:Od,RGBA_S3TC_DXT1_Format:Au,RGBA_S3TC_DXT3_Format:Mu,RGBA_S3TC_DXT5_Format:Su,RGBDepthPacking:MR,RGBFormat:s_,RGBIntegerFormat:bR,RGB_BPTC_SIGNED_Format:op,RGB_BPTC_UNSIGNED_Format:ap,RGB_
4114ETC1_Format:Gd,RGB_ETC2_Format:kd,RGB_PVRTC_2BPPV1_Format:Nd,RGB_PVRTC_4BPPV1_Format:Fd,RGB_S3TC_DXT1_Format:bu,RGDepthPacking:SR,RGFormat:go,RGIntegerFormat:Lp,RawShaderMaterial:T_,Ray:lc,Raycaster:Y1,RectAreaLight:U1,RedFormat:Pp,RedIntegerFormat:ju,ReinhardToneMapping:Yx,RenderTarget:c_,RenderTarget3D:EP,RepeatWrapping:mo,ReplaceStencilOp:RR,ReverseSubtractEquation:EE,RingGeometry:$p,SIGNED_R11_EAC_Format:Vd,SIGNED_RED_GREEN_RGTC2_Format:up,SIGNED_RED_RGTC1_Format:cp,SIGNED_RG11_EAC_Format:Wd,SRGBColorSpace:ri,SRGBTransfer:Qt,Scene:u_,ShaderChunk:Rt,ShaderLib:_s,ShaderMaterial:Ii,ShadowMaterial:A1,Shape:da,ShapeGeometry:em,ShapePath:YP,ShapeUtils:ys,ShortType:e_,Skeleton:Ju,SkeletonHelper:FP,SkinnedMesh:p_,Source:uo,Sphere:Dn,SphereGeometry:Qu,Spherical:RP,SphericalHarmonics3:O_,SplineCurve:S_,SpotLight:D_,SpotLightHelper:DP,Sprite:l1,SpriteMaterial:d_,SrcAlphaFactor:Td,SrcAlphaSaturateFactor:NE,SrcColorFactor:IE,StaticCopyUsage:JR,StaticDrawUsage:Du,StaticReadUsage:WR,StereoCamera:oP,StreamCopyUsage:KR,StreamDrawUsage:VR,StreamReadUsage:XR,StringKeyframeTrack:Ta,SubtractEquation:SE,SubtractiveBlending:gx,TOUCH:pR,TangentSpaceNormalMap:Er,TetrahedronGeometry:tm,Texture:fn,TextureLoader:F1,TextureUtils:eL,Timer:W1,TimestampQuery:ZR,TorusGeometry:nm,TorusKnotGeometry:im,Triangle:Ci,TriangleFanDrawMode:hp,TriangleStripDrawMode:o_,TrianglesDrawMode:JE,TubeGeometry:sm,UVMapping:Cp,Uint16BufferAttribute:h_,Uint32BufferAttribute:f_,Uint8BufferAttribute:GI,Uint8ClampedBufferAttribute:kI,Uniform:z_,UniformsGroup:CP,UniformsLib:je,UniformsUtils:xp,UnsignedByteType:mi,UnsignedInt101111Type:n_,UnsignedInt248Type:Kl,UnsignedInt5999Type:t_,UnsignedIntType:is,UnsignedShort4444Type:Ip,UnsignedShort5551Type:Bp,UnsignedShortType:Yl,VSMShadowMap:na,Vector2:xe,Vector3:G,Vector4:Ht,VectorKeyframeTrack:Aa,VideoFrameTexture:aB,VideoTexture:h1,WebGL3DRenderTarget:CI,WebGLArrayRenderTarget:TI,WebGLCoordinateSystem:Wi,WebGLCubeRenderTarget:V_,WebGLRenderTarget:Ri,WebGLRenderer:oT,WebGLUtils:sT,WebGPUCoordinateSystem:xa,WebXRController:vd,WireframeGeometry:E_,WrapAroundEnding:Pu,ZeroCurvatureEnding:sa,ZeroFactor:wE,ZeroSlopeEnding:ra,ZeroStencilOp:wR,createCanvasElement:i1,error:at,getConsoleFunction:sI,log:Nu,setConsoleFunction:iI,warn:ke,warnOnce:fp},Symbol.toStringTag,{value:"Module"}));var y0={exports:{}},v0={};/**
4115 * @license React
4116 * use-sync-external-store-shim/with-selector.production.js
4117 *
4118 * Copyright (c) Meta Platforms, Inc. and affiliates.
4119 *
4120 * This source code is licensed under the MIT license found in the
4121 * LICENSE file in the root directory of this source tree.
4122 */var oM;function KN(){if(oM)return v0;oM=1;var s=cR(),e=uR();function t(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,r=s.useRef,l=s.useEffect,c=s.useMemo,u=s.useDebugValue;return v0.useSyncExternalStoreWithSelector=function(h,d,p,m,g){var _=r(null);if(_.current===null){var b={hasValue:!1,value:null};_.current=b}else b=_.current;_=c(function(){function y(R){if(!A){if(A=!0,S=R,R=m(R),g!==void 0&&b.hasValue){var L=b.value;if(g(L,R))return T=L}return T=R}if(L=T,n(S,R))return L;var w=m(R);return g!==void 0&&g(L,w)?(S=R,L):(S=R,T=w)}var A=!1,S,T,B=p===void 0?null:p;return[function(){return y(d())},B===null?void 0:function(){return y(B())}]},[d,p,m,g]);var v=i(h,_[0],_[1]);return l(function(){b.hasValue=!0,b.value=v},[v]),u(v),v},v0}var aM;function qN(){return aM||(aM=1,y0.exports=KN()),y0.exports}var ZN=qN();const QN=xE(ZN),lM=s=>{let e;const t=new Set,n=(h,d)=>{const p=typeof h=="function"?h(e):h;if(!Object.is(p,e)){const m=e;e=d??(typeof p!="object"||p===null)?p:Object.assign({},e,p),t.forEach(g=>g(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>u,subscribe:h=>(t.add(h),()=>t.delete(h))},u=e=s(n,i,c);return c},$N=s=>s?lM(s):lM,{useSyncExternalStoreWithSelector:eO}=QN,tO=s=>s;function nO(s,e=tO,t){const n=eO(s.subscribe,s.getState,s.getInitialState,e,t);return _E.useDebugValue(n),n}const cM=(s,e)=>{const t=$N(s),n=(i,r=e)=>nO(t,i,r);return Object.assign(n,t),n},iO=(s,e)=>s?cM(s,e):cM,sO=s=>typeof s=="object"&&typeof s.then=="function",aa=[];function aT(s,e,t=(n,i)=>n===i){if(s===e)return!0;
vendor: 6,017 bytes, lines 4122-4130
4122if(!s||!e)return!1;const n=s.length;if(e.length!==n)return!1;for(let i=0;i<n;i++)if(!t(s[i],e[i]))return!1;return!0}function lT(s,e=null,t=!1,n={}){e===null&&(e=[s]);for(const r of aa)if(aT(e,r.keys,r.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(r,"error"))throw r.error;if(Object.prototype.hasOwnProperty.call(r,"response"))return n.lifespan&&n.lifespan>0&&(r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.remove,n.lifespan)),r.response;if(!t)throw r.promise}const i={keys:e,equal:n.equal,remove:()=>{const r=aa.indexOf(i);r!==-1&&aa.splice(r,1)},promise:(sO(s)?s:s(...e)).then(r=>{i.response=r,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(r=>i.error=r)};if(aa.push(i),!t)throw i.promise}const rO=(s,e,t)=>lT(s,e,!1,t),oO=(s,e,t)=>void lT(s,e,!0,t),aO=s=>{if(s===void 0||s.length===0)aa.splice(0,aa.length);else{const e=aa.find(t=>aT(s,t.keys,t.equal));e&&e.remove()}};var b0={exports:{}},A0={};/**
4123 * @license React
4124 * scheduler.production.js
4125 *
4126 * Copyright (c) Meta Platforms, Inc. and affiliates.
4127 *
4128 * This source code is licensed under the MIT license found in the
4129 * LICENSE file in the root directory of this source tree.
4130 */var uM;function lO(){return uM||(uM=1,function(s){function e(H,W){var q=H.length;H.push(W);e:for(;0<q;){var Q=q-1>>>1,re=H[Q];if(0<i(re,W))H[Q]=W,H[q]=re,q=Q;else break e}}function t(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var W=H[0],q=H.pop();if(q!==W){H[0]=q;e:for(var Q=0,re=H.length,ae=re>>>1;Q<ae;){var pe=2*(Q+1)-1,Ue=H[pe],Pe=pe+1,He=H[Pe];if(0>i(Ue,q))Pe<re&&0>i(He,Ue)?(H[Q]=He,H[Pe]=q,Q=Pe):(H[Q]=Ue,H[pe]=q,Q=pe);else if(Pe<re&&0>i(He,q))H[Q]=He,H[Pe]=q,Q=Pe;else break e}}return W}function i(H,W){var q=H.sortIndex-W.sortIndex;return q!==0?q:H.id-W.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var l=Date,c=l.now();s.unstable_now=function(){return l.now()-c}}var u=[],h=[],d=1,p=null,m=3,g=!1,_=!1,b=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function T(H){for(var W=t(h);W!==null;){if(W.callback===null)n(h);else if(W.startTime<=H)n(h),W.sortIndex=W.expirationTime,e(u,W);else break;W=t(h)}}function B(H){if(b=!1,T(H),!_)if(t(u)!==null)_=!0,R||(R=!0,z());else{var W=t(h);W!==null&&V(B,W.startTime-H)}}var R=!1,L=-1,w=5,I=-1;function O(){return v?!0:!(s.unstable_now()-I<w)}function D(){if(v=!1,R){var H=s.unstable_now();I=H;var W=!0;try{e:{_=!1,b&&(b=!1,A(L),L=-1),g=!0;var q=m;try{t:{for(T(H),p=t(u);p!==null&&!(p.expirationTime>H&&O());){var Q=p.callback;if(typeof Q=="function"){p.callback=null,m=p.priorityLevel;var re=Q(p.expirationTime<=H);if(H=s.unstable_now(),typeof re=="function"){p.callback=re,T(H),W=!0;break t}p===t(u)&&n(u),T(H)}else n(u);p=t(u)}if(p!==null)W=!0;else{var ae=t(h);ae!==null&&V(B,ae.startTime-H),W=!1}}break e}finally{p=null,m=q,g=!1}W=void 0}}finally{W?z():R=!1}}}var z;if(typeof S=="function")z=function(){S(D)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,Y=X.port2;X.port1.onmessage=D,z=function(){Y.postMessage(null)}}else z=function(){y(D,0)};function V(H,W){L=y(function(){H(s.unstable_now())},W)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(H){H.callback=null},s.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<H?Math.floor(1e3/H):5},s.unstable_getCurrentPriorityLevel=function(){return m},s.unstable_next=function(H){switch(m){case 1:case 2:case 3:var W=3;break;default:W=m}var q=m;m=W;try{return H()}finally{m=q}},s.unstable_requestPaint=function(){v=!0},s.unstable_runWithPriority=function(H,W){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var q=m;m=H;try{return W()}finally{m=q}},s.unstable_scheduleCallback=function(H,W,q){var Q=s.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?Q+q:Q):q=Q,H){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=q+re,H={id:d++,callback:W,priorityLevel:H,startTime:q,expirationTime:re,sortIndex:-1},q>Q?(H.sortIndex=q,e(h,H),t(u)===null&&H===t(h)&&(b?(A(L),L=-1):b=!0,V(B,q-Q))):(H.sortIndex=re,e(u,H),_||g||(_=!0,R||(R=!0,z()))),H},s.unstable_shouldYield=O,s.unstable_wrapCallback=function(H){var W=m;return function(){var q=m;m=W;try{return H.apply(this,arguments)}finally{m=q}}}}(A0)),A0}var hM;function cO(){return hM||(hM=1,b0.exports=lO()),b0.exports}var Px=cO();const uO=xE(Px);function W_(s,e,t){if(!s)return;if(t(s)===!0)return s;let n=e?s.return:s.child;for(;n;){const i=W_(n,e,t);if(i)return i;n=e?null:n.sibling}}function cT(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const j_=cT(k.createContext(null));class uT extends k.Component{render(){return k.createElement(j_.Provider,{value:this._reactInternals},this.props.children)}}function hT(){const s=k.useContext(j_);if(s===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=k.useId();return k.useMemo(()=>{for(const t of[s,s==null?void 0:s.alternate]){if(!t)continue;const n=W_(t,!1,i=>{let r=i.memoizedState;for(;r;){if(r.memoizedState===e)return!0;r=r.next}});if(n)return n}},[s,e])}const hO=Symbol.for("react.context"),fO=s=>s!==null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===hO;function dO(){const s=hT(),[e]=k.useState(()=>new Map);e.clear();let t=s;for(;t;){const n=t.type;fO(n)&&n!==j_&&!e.has(n)&&e.set(n,k.use(cT(n))),t=t.return}return e}function pO(){const s=dO();return k.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>
4130n=>k.createElement(e,null,k.createElement(t.Provider,{...n,value:s.get(t)})),e=>k.createElement(uT,{...e})),[s])}function X_(s){let e=s.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const fT=s=>s&&s.isOrthographicCamera,mO=s=>s&&s.hasOwnProperty("current"),gO=s=>s!=null&&(typeof s=="string"||typeof s=="number"||s.isColor),$u=((s,e)=>typeof window<"u"&&(((s=window.document)==null?void 0:s.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?k.useLayoutEffect:k.useEffect;function dT(s){const e=k.useRef(s);return $u(()=>void(e.current=s),[s]),e}function xO(){const s=hT(),e=pO();return k.useMemo(()=>({children:t})=>{const i=!!W_(s,!0,r=>r.type===k.StrictMode)?k.StrictMode:k.Fragment;return C.jsx(i,{children:C.jsx(e,{children:t})})},[s,e])}function _O({set:s}){return $u(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}const yO=(s=>(s=class extends k.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},s.getDerivedStateFromError=()=>({error:!0}),s))();function pT(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}function Sl(s){var e;return(e=s.__r3f)==null?void 0:e.root.getState()}const un={obj:s=>s===Object(s)&&!un.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,nul:s=>s===null,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(un.str(s)||un.num(s)||un.boo(s))return s===e;const r=un.obj(s);if(r&&n==="reference")return s===e;const l=un.arr(s);if(l&&t==="reference")return s===e;if((l||r)&&s===e)return!0;let c;for(c in s)if(!(c in e))return!1;if(r&&t==="shallow"&&n==="shallow"){for(c in i?e:s)if(!un.equ(s[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:s)if(s[c]!==e[c])return!1;if(un.und(c)){if(l&&s.length===0&&e.length===0||r&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function vO(s){const e={nodes:{},materials:{},meshes:{}};return s&&s.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function bO(s){s.type!=="Scene"&&(s.dispose==null||s.dispose());for(const e in s){const t=s[e];(t==null?void 0:t.type)!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const mT=["children","key","ref"];function AO(s){const e={};for(const t in s)mT.includes(t)||(e[t]=s[t]);return e}function yp(s,e,t,n){const i=s;let r=i==null?void 0:i.__r3f;return r||(r={root:e,type:t,parent:null,children:[],props:AO(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=r)),r}function Hu(s,e){if(!e.includes("-"))return{root:s,key:e,target:s[e]};if(e in s)return{root:s,key:e,target:s[e]};let t=s;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const r=n.slice(n.indexOf(i)).join("-");return{root:t,key:r,target:void 0}}return{root:s,key:e,target:void 0}}e=i,s=t,t=t[e]}return{root:s,key:e,target:t}}const fM=/-\d+$/;function vp(s,e){if(un.str(e.props.attach)){if(fM.test(e.props.attach)){const i=e.props.attach.replace(fM,""),{root:r,key:l}=Hu(s.object,i);Array.isArray(r[l])||(r[l]=[])}const{root:t,key:n}=Hu(s.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else un.fun(e.props.attach)&&(e.previousAttach=e.props.attach(s.object,e.object))}function bp(s,e){if(un.str(e.props.attach)){const{root:t,key:n}=Hu(s.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(s.object,e.object);delete e.previousAttach}const Lx=[...mT,"args","dispose","attach","object","onUpdate","dispose"],dM=new Map;function MO(s){let e=dM.get(s.constructor);try{e||(e=new s.constructor,dM.set(s.constructor,e))}catch{}return e}function SO(s,e){const t={};for(const n in e)if(!Lx.includes(n)&&!un.equ(e[n],s.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in s.props){if(Lx.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:r}=Hu(s.object,n);if(i.constructor&&i.constructor.length===0){const l=MO(i);un.und(l)||(t[r]=l[r])}else t[r]=0}return t}const EO=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],TO=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function lo(s,e){var t;
4130const n=s.__r3f,i=n&&X_(n).getState(),r=n==null?void 0:n.eventCount;for(const c in e){let u=e[c];if(Lx.includes(c))continue;if(n&&TO.test(c)){typeof u=="function"?n.handlers[c]=u:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(u===void 0)continue;let{root:h,key:d,target:p}=Hu(s,c);if(p===void 0&&(typeof h!="object"||h===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${d}".`);if(p instanceof ec&&u instanceof ec)p.mask=u.mask;else if(p instanceof we&&gO(u))p.set(u);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&typeof p.copy=="function"&&u!=null&&u.constructor&&p.constructor===u.constructor)p.copy(u);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&Array.isArray(u))typeof p.fromArray=="function"?p.fromArray(u):p.set(...u);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&typeof u=="number")typeof p.setScalar=="function"?p.setScalar(u):p.set(u);else if(h instanceof Ii&&d==="uniforms"&&un.obj(u)){un.obj(h.uniforms)||(h.uniforms={});const m=h.uniforms,g=u;for(const _ in g){const b=g[_],v=m[_];v?Object.assign(v,b):m[_]={...b}}}else{var l;h[d]=u,i&&!i.linear&&EO.includes(d)&&(l=h[d])!=null&&l.isTexture&&h[d].format===ai&&h[d].type===mi&&(h[d].colorSpace
4130=ri)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&r!==n.eventCount){const c=n.object,u=i.internal.interaction.indexOf(c);u>-1&&i.internal.interaction.splice(u,1),n.eventCount&&c.raycast!==null&&i.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&&fc(n),s}function fc(s){var e;if(!s.parent)return;s.props.onUpdate==null||s.props.onUpdate(s.object);const t=(e=s.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function CO(s,e){s.manual||(fT(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix())}const pi=s=>s==null?void 0:s.isObject3D;function du(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function gT(s,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(s.delete(n),i.target.releasePointerCapture(n)))}function wO(s,e,t){const{internal:n}=s.getState();for(let i=0;i<n.interaction.length;i++)n.interaction[i]===e&&(n.interaction[i]=t);for(let i=0;i<n.initialHits.length;i++)n.initialHits[i]===e&&(n.initialHits[i]=t);n.hovered.forEach((i,r)=>{if(i.eventObject===e||i.object===e){n.hovered.delete(r);const l={...i,eventObject:i.eventObject===e?t:i.eventObject,object:i.object===e?t:i.object};n.hovered.set(du(l),l)}}),n.capturedMap.forEach(i=>{const r=i.get(e);r&&(i.delete(e),i.set(t,r))})}function RO(s,e){const{internal:t}=s.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{gT(t.capturedMap,e,n,i)})}function IO(s){function e(u){const{internal:h}=s.getState(),d=u.offsetX-h.initialClick[0],p=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(d*d+p*p))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(d=>{var p;return(p=h.__r3f)==null?void 0:p.handlers["onPointer"+d]}))}function n(u,h){const d=s.getState(),p=new Set,m=[],g=h?h(d.internal.interaction):d.internal.interaction;for(let y=0;y<g.length;y++){const A=Sl(g[y]);A&&(A.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(u,d);function _(y){const A=Sl(y);if(!A||!A.events.enabled||A.raycaster.camera===null)return[];if(A.raycaster.camera===void 0){var S;A.events.compute==null||A.events.compute(u,A,(S=A.previousRoot)==null?void 0:S.getState()),A.raycaster.camera===void 0&&(A.raycaster.camera=null)}return A.raycaster.camera?A.raycaster.intersectObject(y,!0):[]}let b=g.flatMap(_).sort((y,A)=>{const S=Sl(y.object),T=Sl(A.object);return!S||!T?y.distance-A.distance:T.events.priority-S.events.priority||y.distance-A.distance}).filter(y=>{const A=du(y);return p.has(A)?!1:(p.add(A),!0)});d.events.filter&&(b=d.events.filter(b,d));for(const y of b){let A=y.object;for(;A;){var v;(v=A.__r3f)!=null&&v.eventCount&&m.push({...y,eventObject:A}),A=A.parent}}if("pointerId"in u&&d.internal.capturedMap.has(u.pointerId))for(let y of d.internal.capturedMap.get(u.pointerId).values())p.has(du(y.intersection))||m.push(y.intersection);return m}function i(u,h,d,p){if(u.length){const m={stopped:!1};for(const g of u){let _=Sl(g.object);if(_||g.object.traverseAncestors(b=>{const v=Sl(b);if(v)return _=v,!1}),_){const{raycaster:b,pointer:v,camera:y,internal:A}=_,S=new G(v.x,v.y,0).unproject(y),T=I=>{var O,D;return(O=(D=A.capturedMap.get(I))==null?void 0:D.has(g.eventObject))!=null?O:!1},B=I=>{const O={intersection:g,target:h.target};A.capturedMap.has(I)?A.capturedMap.get(I).set(g.eventObject,O):A.capturedMap.set(I,new Map([[g.eventObject,O]])),h.target.setPointerCapture(I)},R=I=>{const O=A.capturedMap.get(I);O&&gT(A.capturedMap,g.eventObject,O,I)};let L={};for(let I in h){let O=h[I];typeof O!="function"&&(L[I]=O)}let w={...g,...L,pointer:v,intersections:u,stopped:m.stopped,delta:d,unprojectedPoint:S,ray:b.ray,camera:y,stopPropagation(){const I="pointerId"in h&&A.capturedMap.get(h.pointerId);if((!I||I.has(g.eventObject))&&(w.stopped=m.stopped=!0,A.hovered.size&&Array.from(A.hovered.values()).find(O=>O.eventObject===g.eventObject))){const O=u.slice(0,u.indexOf(g));r([...O,g])}},target:{hasPointerCapture:T,setPointerCapture:B,releasePointerCapture:R},currentTarget:{hasPointerCapture:T,setPointerCapture:B,releasePointerCapture:R},nativeEvent:h};if(p(w),m.stopped===!0)break}}}return u}function r(u){const{internal:h}=s.getState();for(const d of h.hovered.values())if(!u.length||!u.find(p=>p.object===d.object&&p.index===d.index&&p.instanceId===d.instanceId)){const m=d.eventObject.__r3f;
vendor: 4,818 bytes, line 4130
4130if(h.hovered.delete(du(d)),m!=null&&m.eventCount){const g=m.handlers,_={...d,intersections:u};g.onPointerOut==null||g.onPointerOut(_),g.onPointerLeave==null||g.onPointerLeave(_)}}}function l(u,h){for(let d=0;d<h.length;d++){const p=h[d].__r3f;p==null||p.handlers.onPointerMissed==null||p.handlers.onPointerMissed(u)}}function c(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return h=>{const{internal:d}=s.getState();"pointerId"in h&&d.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(h.pointerId)&&(d.capturedMap.delete(h.pointerId),r([]))})}}return function(d){const{onPointerMissed:p,internal:m}=s.getState();m.lastEvent.current=d;const g=u==="onPointerMove",_=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",v=n(d,g?t:void 0),y=_?e(d):0;u==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=v.map(S=>S.eventObject)),_&&!v.length&&y<=2&&(l(d,m.interaction),p&&p(d)),g&&r(v);function A(S){const T=S.eventObject,B=T.__r3f;if(!(B!=null&&B.eventCount))return;const R=B.handlers;if(g){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const L=du(S),w=m.hovered.get(L);w?w.stopped&&S.stopPropagation():(m.hovered.set(L,S),R.onPointerOver==null||R.onPointerOver(S),R.onPointerEnter==null||R.onPointerEnter(S))}R.onPointerMove==null||R.onPointerMove(S)}else{const L=R[u];L?(!_||m.initialHits.includes(T))&&(l(d,m.interaction.filter(w=>!m.initialHits.includes(w))),L(S)):_&&m.initialHits.includes(T)&&l(d,m.interaction.filter(w=>!m.initialHits.includes(w)))}}i(v,d,y,A)}}return{handlePointer:c}}const pM=s=>!!(s!=null&&s.render),xT=k.createContext(null),BO=(s,e)=>{const t=iO((c,u)=>{const h=new G,d=new G,p=new G;function m(y=u().camera,A=d,S=u().size){const{width:T,height:B,top:R,left:L}=S,w=T/B;A.isVector3?p.copy(A):p.set(...A);const I=y.getWorldPosition(h).distanceTo(p);if(fT(y))return{width:T/y.zoom,height:B/y.zoom,top:R,left:L,factor:1,distance:I,aspect:w};{const O=y.fov*Math.PI/180,D=2*Math.tan(O/2)*I,z=D*(T/B);return{width:z,height:D,top:R,left:L,factor:T/z,distance:I,aspect:w}}}let g;const _=y=>c(A=>({performance:{...A.performance,current:y}})),b=new xe;return{set:c,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>s(u(),y),advance:(y,A)=>e(y,A,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new K1,pointer:b,mouse:b,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=u();g&&clearTimeout(g),y.performance.current!==y.performance.min&&_(y.performance.min),g=setTimeout(()=>_(u().performance.max),y.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:m},setEvents:y=>c(A=>({...A,events:{...A.events,...y}})),setSize:(y,A,S=0,T=0)=>{const B=u().camera,R={width:y,height:A,top:S,left:T};c(L=>({size:R,viewport:{...L.viewport,...m(B,d,R)}}))},setDpr:y=>c(A=>{const S=pT(y);return{viewport:{...A.viewport,dpr:S,initialDpr:A.viewport.initialDpr||S}}}),setFrameloop:(y="always")=>{const A=u().clock;A.stop(),A.elapsedTime=0,y!=="never"&&(A.start(),A.elapsedTime=0),c(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:k.createRef(),active:!1,frames:0,priority:0,subscribe:(y,A,S)=>{const T=u().internal;return T.priority=T.priority+(A>0?1:0),T.subscribers.push({ref:y,priority:A,store:S}),T.subscribers=T.subscribers.sort((B,R)=>B.priority-R.priority),()=>{const B=u().internal;B!=null&&B.subscribers&&(B.priority=B.priority-(A>0?1:0),B.subscribers=B.subscribers.filter(R=>R.ref!==y))}}}}}),n=t.getState();let i=n.size,r=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:u,viewport:h,gl:d,set:p}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==r){i=u,r=h.dpr,CO(c,u),h.dpr>0&&d.setPixelRatio(h.dpr);const m=typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(u.width,u.height,m)}c!==l&&(l=c,p(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>s(c)),t};function _T(){const s=k.useContext(xT);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function Ks(s=t=>t,e){return _T()(s,e)}function jt(s,e=0){const t=_T(),n=t.getState().internal.subscribe,i=dT(s);return $u(()=>n(i,e,t),[e,n,t]),null}const mM=new WeakMap,PO=s=>{var e;return typeof s=="function"&&(s==null||(e=s.prototype)==null?void 0:e.constructor)===s};function yT(s,e){return function(t,...n){let i;return PO(t)?(i=mM.get(t),i||(i=new t,mM.set(t,i))):i=t,s&&s(i),Promise.all(n.map(r=>new Promise((l,c)=>i.load(r,u=>
vendor: 59,681 bytes, lines 4130-4145
4130{pi(u==null?void 0:u.scene)&&Object.assign(u,vO(u.scene)),l(u)},e,u=>c(new Error(`Could not load ${r}: ${u==null?void 0:u.message}`))))))}}function eh(s,e,t,n){const i=Array.isArray(e)?e:[e],r=rO(yT(t,n),[s,...i],{equal:un.equ});return Array.isArray(e)?r:r[0]}eh.preload=function(s,e,t){const n=Array.isArray(e)?e:[e];return oO(yT(t),[s,...n])};eh.clear=function(s,e){const t=Array.isArray(e)?e:[e];return aO([s,...t])};/**
4131 * @license React
4132 * react-reconciler-constants.production.js
4133 *
4134 * Copyright (c) Meta Platforms, Inc. and affiliates.
4135 *
4136 * This source code is licensed under the MIT license found in the
4137 * LICENSE file in the root directory of this source tree.
4138 */const LO=1,DO=8,FO=32,NO=2;var OO={version:"9.6.1"};function UO(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var gM={exports:{}},xM={exports:{}},_M;function GO(){return _M||(_M=1,function(s){s.exports=function(e){function t(o,a,f,x){return new fC(o,a,f,x)}function n(){}function i(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)a+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(o){var a=o,f=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(f=a.return),o=a.return;while(o)}return a.tag===3?f:null}function l(o){if(r(o)!==o)throw Error(i(188))}function c(o){var a=o.alternate;if(!a){if(a=r(o),a===null)throw Error(i(188));return a!==o?null:o}for(var f=o,x=a;;){var M=f.return;if(M===null)break;var E=M.alternate;if(E===null){if(x=M.return,x!==null){f=x;continue}break}if(M.child===E.child){for(E=M.child;E;){if(E===f)return l(M),o;if(E===x)return l(M),a;E=E.sibling}throw Error(i(188))}if(f.return!==x.return)f=M,x=E;else{for(var F=!1,J=M.child;J;){if(J===f){F=!0,f=M,x=E;break}if(J===x){F=!0,x=M,f=E;break}J=J.sibling}if(!F){for(J=E.child;J;){if(J===f){F=!0,f=E,x=M;break}if(J===x){F=!0,x=E,f=M;break}J=J.sibling}if(!F)throw Error(i(189))}}if(f.alternate!==x)throw Error(i(190))}if(f.tag!==3)throw Error(i(188));return f.stateNode.current===f?o:a}function u(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=u(o),a!==null)return a;o=o.sibling}return null}function h(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(o.tag!==4&&(a=h(o),a!==null))return a;o=o.sibling}return null}function d(o){return o===null||typeof o!="object"?null:(o=Xv&&o[Xv]||o["@@iterator"],typeof o=="function"?o:null)}function p(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===xC?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case Oa:return"Fragment";case Km:return"Profiler";case Wv:return"StrictMode";case Zm:return"Suspense";case Qm:return"SuspenseList";case eg:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case Na:return"Portal";case Lr:return o.displayName||"Context";case jv:return(o._context.displayName||"Context")+".Consumer";case qm:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case $m:return a=o.displayName||null,a!==null?a:p(o.type)||"Memo";case Dr:a=o._payload,o=o._init;try{return p(o(a))}catch{}}return null}function m(o){return{current:o}}function g(o){0>ka||(o.current=og[ka],og[ka]=null,ka--)}function _(o,a){ka++,og[ka]=o.current,o.current=a}function b(o){return o>>>=0,o===0?32:31-(jw(o)/Xw|0)|0}function v(o){var a=o&42;if(a!==0)return a;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function y(o,a,f){var x=o.pendingLanes;if(x===0)return 0;var M=0,E=o.suspendedLanes,F=o.pingedLanes;o=o.warmLanes;var J=x&134217727;return J!==0?(x=J&~E,x!==0?M=v(x):(F&=J,F!==0?M=v(F):f||(f=J&~o,f!==0&&(M=v(f))))):(J=x&~E,J!==0?M=v(J):F!==0?M=v(F):f||(f=x&~o,f!==0&&(M=v(f)))),M===0?0:a!==0&&a!==M&&(a&E)===0&&(E=M&-M,f=a&-a,E>=f||E===32&&(f&4194048)!==0)?a:M}function A(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function S(o,a){switch(o){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 T(){var o=Eh;return Eh<<=1,(Eh&62914560)===0&&(Eh=4194304),o}function B(o){for(var a=[],f=0;31>f;f++)a.push(o);return a}function R(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function L(o,a,f,x,M,E){var F=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var J=o.entanglements,ce=o.expirationTimes,Ae=o.hiddenUpdates;for(f=F&~f;0<f;){var Ve=31-Fi(f),Ie=1<<Ve;J[Ve]=0,ce[Ve]=-1;var nt=Ae[Ve];if(nt!==null)for(Ae[Ve]=null,Ve=0;Ve<nt.length;Ve++){var Tt=nt[Ve];Tt!==null&&(Tt.lane&=-536870913)}f&=~Ie}x!==0&&w(o,x,0),E!==0&&M===0&&o.tag!==0&&(o.suspendedLanes|=E&~(F&~a))}function w(o,a,f){o.pendingLanes|=a,o.suspendedLanes&=~a;var x=31-Fi(a);o.entangledLanes|=a,o.entanglements[x]=o.entanglements[x]|1073741824|f&261930}function I(o,a){var f=o.entangledLanes|=a;for(o=o.entanglements;f;){var x=31-Fi(f),M=1<<x;M&a|o[x]&a&&(o[x]|=a),f&=~M}}function O(o,a){var f=a&-a;return f=(f&42)!==0?1:D(f),(f&(o.suspendedLanes|a))!==0?0:f}function D(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function z(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function X(o){if(typeof Zw=="function"&&Qw(o),Ni&&typeof Ni.setStrictMode=="function")try{Ni.setStrictMode(Cc,o)}catch{}}function Y(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}function V(o){if(cg===void 0)try{throw Error()}catch(f){var a=f.stack.trim().match(/\n( *(at )?)/);cg=a&&a[1]||"",_b=-1<f.stack.indexOf(`
4139    at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
4140`+cg+o+_b}function H(o,a){if(!o||ug)return"";ug=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={DetermineComponentFrameRoot:function(){try{if(a){var Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(Tt){var nt=Tt}Reflect.construct(o,[],Ie)}else{try{Ie.call()}catch(Tt){nt=Tt}o.call(Ie.prototype)}}else{try{throw Error()}catch(Tt){nt=Tt}(Ie=o())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(Tt){if(Tt&&nt&&typeof Tt.stack=="string")return[Tt.stack,nt.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var M=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");M&&M.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=x.DetermineComponentFrameRoot(),F=E[0],J=E[1];if(F&&J){var ce=F.split(`
4141`),Ae=J.split(`
4142`);for(M=x=0;x<ce.length&&!ce[x].includes("DetermineComponentFrameRoot");)x++;for(;M<Ae.length&&!Ae[M].includes("DetermineComponentFrameRoot");)M++;if(x===ce.length||M===Ae.length)for(x=ce.length-1,M=Ae.length-1;1<=x&&0<=M&&ce[x]!==Ae[M];)M--;for(;1<=x&&0<=M;x--,M--)if(ce[x]!==Ae[M]){if(x!==1||M!==1)do if(x--,M--,0>M||ce[x]!==Ae[M]){var Ve=`
4143`+ce[x].replace(" at new "," at ");return o.displayName&&Ve.includes("<anonymous>")&&(Ve=Ve.replace("<anonymous>",o.displayName)),Ve}while(1<=x&&0<=M);break}}}finally{ug=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?V(f):""}function W(o,a){switch(o.tag){case 26:case 27:case 5:return V(o.type);case 16:return V("Lazy");case 13:return o.child!==a&&a!==null?V("Suspense Fallback"):V("Suspense");case 19:return V("SuspenseList");case 0:case 15:return H(o.type,!1);case 11:return H(o.type.render,!1);case 1:return H(o.type,!0);case 31:return V("Activity");default:return""}}function q(o){try{var a="",f=null;do a+=W(o,f),f=o,o=o.return;while(o);return a}catch(x){return`
4144Error generating stack: `+x.message+`
4145`+x.stack}}function Q(o,a){if(typeof o=="object"&&o!==null){var f=yb.get(o);return f!==void 0?f:(a={value:o,source:a,stack:q(a)},yb.set(o,a),a)}return{value:o,source:a,stack:q(a)}}function re(o,a){za[Va++]=wc,za[Va++]=Ch,Ch=o,wc=a}function ae(o,a,f){Ki[qi++]=Ds,Ki[qi++]=Fs,Ki[qi++]=Fr,Fr=o;var x=Ds;o=Fs;var M=32-Fi(x)-1;x&=~(1<<M),f+=1;var E=32-Fi(a)+M;if(30<E){var F=M-M%5;E=(x&(1<<F)-1).toString(32),x>>=F,M-=F,Ds=1<<32-Fi(a)+M|f<<M|x,Fs=E+o}else Ds=1<<E|f<<M|x,Fs=o}function pe(o){o.return!==null&&(re(o,1),ae(o,1,0))}function Ue(o){for(;o===Ch;)Ch=za[--Va],za[Va]=null,wc=za[--Va],za[Va]=null;for(;o===Fr;)Fr=Ki[--qi],Ki[qi]=null,Fs=Ki[--qi],Ki[qi]=null,Ds=Ki[--qi],Ki[qi]=null}function Pe(o,a){Ki[qi++]=Ds,Ki[qi++]=Fs,Ki[qi++]=Fr,Ds=a.id,Fs=a.overflow,Fr=o}function He(o,a){_(Nr,a),_(Rc,o),_(Jn,null),o=vC(a),g(Jn),_(Jn,o)}function le(){g(Jn),g(Rc),g(Nr)}function Le(o){o.memoizedState!==null&&_(wh,o);var a=Jn.current,f=bC(a,o.type);a!==f&&(_(Rc,o),_(Jn,f))}function ye(o){Rc.current===o&&(g(Jn),g(Rc)),wh.current===o&&(g(wh),rr?wo._currentValue=Ua:wo._currentValue2=Ua)}function ze(o){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _e(Q(a,o)),hg}function Je(o,a){if(!ti)throw Error(i(175));bw(o.stateNode,o.type,o.memoizedProps,a,o)||ze(o,!0)}function Ee(o){for(Yn=o.return;Yn;)switch(Yn.tag){case 5:case 31:case 13:Zi=!1;return;case 27:case 3:Zi=!0;return;default:Yn=Yn.return}}function ht(o){if(!ti||o!==Yn)return!1;if(!kt)return Ee(o),kt=!0,!1;var a=o.tag;if(Fn?a!==3&&a!==27&&(a!==5||rb(o.type)&&!Ah(o.type,o.memoizedProps))&&pn&&ze(o):a!==3&&(a!==5||rb(o.type)&&!Ah(o.type,o.memoizedProps))&&pn&&ze(o),Ee(o),a===13){if(!ti)throw Error(i(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));pn=Tw(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));pn=Ew(o)}else pn=Fn&&a===27?hw(o.type,pn):Yn?sb(o.stateNode):null;return!0}function qe(){ti&&(pn=Yn=null,kt=!1)}function de(){var o=Or;return o!==null&&(Si===null?Si=o:Si.push.apply(Si,o),Or=null),o}function _e(o){Or===null?Or=[o]:Or.push(o)}function me(o,a,f){rr?(_(Rh,a._currentValue),a._currentValue=f):(_(Rh,a._currentValue2),a._currentValue2=f)}function Te(o){var a=Rh.current;rr?o._currentValue=a:o._currentValue2=a,g(Rh)}function Ce(o,a,f){for(;o!==null;){var x=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,x!==null&&(x.childLanes|=a)):x!==null&&(x.childLanes&a)!==a&&(x.childLanes|=a),o===f)break;o=o.return}}function rt(o,a,f,x){var M=o.child;for(M!==null&&(M.return=o);M!==null;){var E=M.dependencies;if(E!==null){var F=M.child;E=E.firstContext;e:for(;E!==null;){var J=E;E=M;for(var ce=0;ce<a.length;ce++)if(J.context===a[ce]){E.lanes|=f,J=E.alternate,J!==null&&(J.lanes|=f),Ce(E.return,f,o),x||(F=null);break e}E=J.next}}else if(M.tag===18){if(F=M.return,F===null)throw Error(i(341));F.lanes|=f,E=F.alternate,E!==null&&(E.lanes|=f),Ce(F,f,o),F=null}else F=M.child;if(F!==null)F.return=M;else for(F=M;F!==null;){if(F===o){F=null;break}if(M=F.sibling,M!==null){M.return=F.return,F=M;break}F=F.return}M=F}}function j(o,a,f,x){o=null;for(var M=a,E=!1;M!==null;){if(!E){if((M.flags&524288)!==0)E=!0;else if((M.flags&262144)!==0)break}if(M.tag===10){var F=M.alternate;if(F===null)throw Error(i(387));if(F=F.memoizedProps,F!==null){var J=M.type;Oi(M.pendingProps.value,F.value)||(o!==null?o.push(J):o=[J])}}else if(M===wh.current){if(F=M.alternate,F===null)throw Error(i(387));F.memoizedState.memoizedState!==M.memoizedState.memoizedState&&(o!==null?o.push(wo):o=[wo])}M=M.return}o!==null&&rt(a,o,f,x),a.flags|=262144}function ut(o){for(o=o.firstContext;o!==null;){var a=o.context;if(!Oi(rr?a._currentValue:a._currentValue2,o.memoizedValue))return!0;o=o.next}return!1}function Ze(o){Ro=o,ar=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function it(o){return Gt(Ro,o)}function Me(o,a){return Ro===null&&Ze(o),Gt(o,a)}function Gt(o,a){var f=rr?a._currentValue:a._currentValue2;if(a={context:a,memoizedValue:f,next:null},ar===null){if(o===null)throw Error(i(308));ar=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else ar=ar.next=a;return f}function U(){return{controller:new eR,data:new Map,refCount:0}}function P(o){o.refCount--,o.refCount===0&&tR(nR,function(){o.controller.abort()})}function ee(){}function he(o){o!==Wa&&o.next===null&&(Wa===null?Ih=Wa=o:Wa=Wa.next=o),Bh=!0,fg||(fg=!0,$e())}function ve(o,a){if(!dg&&Bh){dg=!0;do for(var f=!1,x=Ih;x!==null;){if(o!==0){var M=x.pendingLanes;if(M===0)var E=0;else{var F=x.suspendedLanes,J=x.pingedLanes;E=(1<<31-Fi(42|o)+1)-1,E&=M&~(F&~J),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(f=!0,Xe(x,E))}else E=Ot,E=y(x,x===ln?E:0,x.cancelPendingCommit!==null||x.timeoutHandle!==Co),(E&3)===0||A(x,E)||(f=!0,Xe(x,E));x=x.next}while(f);dg=!1}}function Re(){Fe()}function Fe(){Bh=fg=!1;var o=0;Io!==0&&IC()&&(o=Io);for(var a=Ai(),f=null,x=Ih;x!==null;){var M=x.next,E=ue(x,a);E===0?(x.next=null,f===null?Ih=M:f.next=M,M===null&&(Wa=f)):(f=x,(o!==0||(E&3)!==0)&&(Bh=!0)),x=M}Nn!==0&&Nn!==5||ve(o),Io!==0&&(Io=0)}function ue(o,a){for(var f=o.suspendedLanes,x=o.pingedLanes,M=o.expirationTimes,E=o.pendingLanes&-62914561;0<E;){var F=31-Fi(E),J=1<<F,ce=M[F];ce===-1?((J&f)===0||(J&x)!==0)&&(M[F]=S(J,a)):ce<=a&&(o.expiredLanes|=J),E&=~J}if(a=ln,f=Ot,f=y(o,o===a?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==Co),x=o.callbackNode,f===0||o===a&&(tn===2||tn===9)||o.cancelPendingCommit!==null)return x!==null&&x!==null&&ag(x),o.callbackNode=null,o.callbackPriority=0;if((f&3)===0||A(o,f)){if(a=f&-f,a===o.callbackPriority)return a;switch(x!==null&&ag(x),z(f)){case 2:case 8:f=Kw;break;case 32:f=lg;break;case 268435456:f=qw;break;default:f=lg}return x=ge.bind(null,o),f=Th(f,x),o.callbackPriority=a,o.callbackNode=f,a}return x!==null&&x!==null&&ag(x),o.callbackPriority=2,o.callbackNode=null,2}function ge(o,a){if(Nn!==0&&Nn!==5)return o.callbackNode=null,o.callbackPriority=0,null;var f=o.callbackNode;if(Mc()&&o.callbackNode!==f)return null;var x=Ot;return x=y(o,o===ln?x:0,o.cancelPendingCommit!==null||o.timeoutHandle!==Co),x===0?null:(yv(o,x,a),ue(o,Ai()),o.callbackNode!=null&&o.callbackNode===f?ge.bind(null,o):null)}function Xe(o,a){if(Mc())return null;yv(o,a,!0)}function $e(){OC?UC(function(){(Lt&6)!==0?Th(gb,Re):Fe()}):Th(gb,Re)}function Oe(){if(Io===0){var o=ja;o===0&&(o=Mh,Mh<<=1,(Mh&261888)===0&&(Mh=256)),Io=o}return Io}function Ne(o,a){if(Ic===null){var f=Ic=[];pg=0,ja=Oe(),Xa={status:"pending",value:void 0,then:function(x){f.push(x)}}}return pg++,a.then(_t,_t),a}function _t(){if(--pg===0&&Ic!==null){Xa!==null&&(Xa.status="fulfilled");var o=Ic;Ic=null,ja=0,Xa=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function Mt(o,a){var f=[],x={status:"pending",value:null,reason:null,then:function(M){f.push(M)}};return o.then(function(){x.status="fulfilled",x.value=a;for(var M=0;M<f.length;M++)(0,f[M])(a)},function(M){for(x.status="rejected",x.reason=M,M=0;M<f.length;M++)(0,f[M])(void 0)}),x}function Nt(){var o=Bo.current;return o!==null?o:ln.pooledCache}function K(o,a){a===null?_(Bo,Bo.current):_(Bo,a.pool)}function De(){var o=Nt();return o===null?null:{parent:rr?mn._currentValue:mn._currentValue2,pool:o}}function fe(o,a){if(Oi(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var f=Object.keys(o),x=Object.keys(a);if(f.length!==x.length)return!1;for(x=0;x<f.length;x++){var M=f[x];if(!$w.call(a,M)||!Oi(o[M],a[M]))return!1}return!0}function Ye(o){return o=o.status,o==="fulfilled"||o==="rejected"}function Ge(o,a,f){switch(f=o[f],f===void 0?o.push(a):f!==a&&(a.then(ee,ee),a=f),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,yt(o),o;default:if(typeof a.status=="string")a.then(ee,ee);else{if(o=ln,o!==null&&100<o.shellSuspendCounter)throw Error(i(482));o=a,o.status="pending",o.then(function(x){if(a.status==="pending"){var M=a;M.status="fulfilled",M.value=x}},function(x){if(a.status==="pending"){var M=a;M.status="rejected",M.reason=x}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,yt(o),o}throw Po=a,Ja}}function be(o){try{var a=o._init;return a(o._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(Po=f,Ja):f}}function ot(){if(Po===null)throw Error(i(459));var o=Po;return Po=null,o}function yt(o){if(o===Ja||o===Ph)throw Error(i(483))}function cn(o){var a=Bc;return Bc+=1,Ya===null&&(Ya=[]),Ge(Ya,o,a)}function Vt(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function yi(o,a){throw a.$$typeof===mC?Error(i(525)):(o=Object.prototype.toString.call(a),Error(i(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function Bi(o){function a(se,$){if(o){var oe=se.deletions;oe===null?(se.deletions=[$],se.flags|=16):oe.push($)}}function f(se,$){if(!o)return null;for(;$!==null;)a(se,$),$=$.sibling;return null}function x(se){for(var $=new Map;se!==null;)se.key!==null?$.set(se.key,se):$.set(se.index,se),se=se.sibling;return $}function M(se,$){return se=sr(se,$),se.index=0,se.sibling=null,se}function E(se,$,oe){return se.index=oe,o?(oe=se.alternate,oe!==null?(oe=oe.index,oe<$?(se.flags|=67108866,$):oe):(se.flags|=67108866,$)):(se.flags|=1048576,$)}function F(se){return o&&se.alternate===null&&(se.flags|=67108866),se}function J(se,$,oe,Be){return $===null||$.tag!==6?($=jm(oe,se.mode,Be),$.return=se,$):($=M($,oe),$.return=se,$)}function ce(se,$,oe,Be){var pt=oe.type;return pt===Oa?Ve(se,$,oe.props.children,Be,oe.key):$!==null&&($.elementType===pt||typeof pt=="object"&&pt!==null&&pt.$$typeof===Dr&&be(pt)===$.type)?($=M($,oe.props),Vt($,oe),$.return=se,$):($=yh(oe.type,oe.key,oe.props,null,se.mode,Be),Vt($,oe),$.return=se,$)}function Ae(se,$,oe,Be){return $===null||$.tag!==4||$.stateNode.containerInfo!==oe.containerInfo||$.stateNode.implementation!==oe.implementation?($=Xm(oe,se.mode,Be),$.return=se,$):($=M($,oe.children||[]),$.return=se,$)}function Ve(se,$,oe,Be,pt){return $===null||$.tag!==7?($=To(oe,se.mode,Be,pt),$.return=se,$):($=M($,oe),$.return=se,$)}function Ie(se,$,oe){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=jm(""+$,se.mode,oe),$.return=se,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case vh:return oe=yh($.type,$.key,$.props,null,se.mode,oe),Vt(oe,$),oe.return=se,oe;case Na:return $=Xm($,se.mode,oe),$.return=se,$;case Dr:return $=be($),Ie(se,$,oe)}if(bh($)||d($))return $=To($,se.mode,oe,null),$.return=se,$;if(typeof $.then=="function")return Ie(se,cn($),oe);if($.$$typeof===Lr)return Ie(se,Me(se,$),oe);yi(se,$)}return null}function nt(se,$,oe,Be){var pt=$!==null?$.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return pt!==null?null:J(se,$,""+oe,Be);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case vh:return oe.key===pt?ce(se,$,oe,Be):null;case Na:return oe.key===pt?Ae(se,$,oe,Be):null;case Dr:return oe=be(oe),nt(se,$,oe,Be)}if(bh(oe)||d(oe))return pt!==null?null:Ve(se,$,oe,Be,null);if(typeof oe.then=="function")return nt(se,$,cn(oe),Be);if(oe.$$typeof===Lr)return nt(se,$,Me(se,oe),Be);yi(se,oe)}return null}function Tt(se,$,oe,Be,pt){if(typeof Be=="string"&&Be!==""||typeof Be=="number"||typeof Be=="bigint")return se=se.get(oe)||null,J($,se,""+Be,pt);if(typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case vh:return se=se.get(Be.key===null?oe:Be.key)||null,ce($,se,Be,pt);case Na:return se=se.get(Be.key===null?oe:Be.key)||null,Ae($,se,Be,pt);case Dr:return Be=be(Be),Tt(se,$,oe,Be,pt)}if(bh(Be)||d(Be))return se=se.get(oe)||null,Ve($,se,Be,pt,null);if(typeof Be.then=="function")return Tt(se,$,oe,cn(Be),pt);if(Be.$$typeof===Lr)return Tt(se,$,oe,Me($,Be),pt);yi($,Be)}return null}function Bn(se,$,oe,Be){for(var pt=null,gn=null,xt=$,Kt=$=0,zn=null;xt!==null&&Kt<oe.length;Kt++){xt.index>Kt?(zn=xt,xt=null):zn=xt.sibling;var qt=nt(se,xt,oe[Kt],Be);if(qt===null){xt===null&&(xt=zn);break}o&&xt&&qt.alternate===null&&a(se,xt),$=E(qt,$,Kt),gn===null?pt=qt:gn.sibling=qt,gn=qt,xt=zn}if(Kt===oe.length)return f(se,xt),kt&&re(se,Kt),pt;if(xt===null){for(;Kt<oe.length;Kt++)xt=Ie(se,oe[Kt],Be),xt!==null&&($=E(xt,$,Kt),gn===null?pt=xt:gn.sibling=xt,gn=xt);return kt&&re(se,Kt),pt}for(xt=x(xt);Kt<oe.length;Kt++)zn=Tt(xt,se,Kt,oe[Kt],Be),zn!==null&&(o&&zn.alternate!==null&&xt.delete(zn.key===null?Kt:zn.key),$=E(zn,$,Kt),gn===null?pt=zn:gn.sibling=zn,gn=zn);return o&&xt.forEach(function(Vr){return a(se,Vr)}),kt&&re(se,Kt),pt}function Uc(se,$,oe,Be){if(oe==null)throw Error(i(151));for(var pt=null,gn=null,xt=$,Kt=$=0,zn=null,qt=oe.next();xt!==null&&!qt.done;Kt++,qt=oe.next()){xt.index>Kt?(zn=xt,xt=null):zn=xt.sibling;var Vr=nt(se,xt,qt.value,Be);if(Vr===null){xt===null&&(xt=zn);break}o&&xt&&Vr.alternate===null&&a(se,xt),$=E(Vr,$,Kt),gn===null?pt=Vr:gn.sibling=Vr,gn=Vr,xt=zn}if(qt.done)return f(se,xt),kt&&re(se,Kt),pt;if(xt===null){for(;!qt.done;Kt++,qt=oe.next())qt=Ie(se,qt.value,Be),qt!==null&&($=E(qt,$,Kt),gn===null?pt=qt:gn.sibling=qt,gn=qt);return kt&&re(se,Kt),pt}for(xt=x(xt);!qt.done;Kt++,qt=oe.next())qt=Tt(xt,se,Kt,qt.value,Be),qt!==null&&(o&&qt.alternate!==null&&xt.delete(qt.key===null?Kt:qt.key),$=E(qt,$,Kt),gn===null?pt=qt:gn.sibling=qt,gn=qt);return o&&xt.forEach(function(oR){return a(se,oR)}),kt&&re(se,Kt),pt}function No(se,$,oe,Be){if(typeof oe=="object"&&oe!==null&&oe.type===Oa&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case vh:e:{for(var pt=oe.key;$!==null;){if($.key===pt){if(pt=oe.type,pt===Oa){if($.tag===7){f(se,$.sibling),Be=M($,oe.props.children),Be.return=se,se=Be;break e}}else if($.elementType===pt||typeof pt=="object"&&pt!==null&&pt.$$typeof===Dr&&be(pt)===$.type){f(se,$.sibling),Be=M($,oe.props),Vt(Be,oe),Be.return=se,se=Be;break e}f(se,$);break}else a(se,$);$=$.sibling}oe.type===Oa?(Be=To(oe.props.children,se.mode,Be,oe.key),Be.return=se,se=Be):(Be=yh(oe.type,oe.key,oe.props,null,se.mode,Be),Vt(Be,oe),Be.return=se,se=Be)}return F(se);case Na:e:{for(pt=oe.key;$!==null;){if($.key===pt)if($.tag===4&&$.stateNode.containerInfo===oe.containerInfo&&$.stateNode.implementation===oe.implementation){f(se,$.sibling),Be=M($,oe.children||[]),Be.return=se,se=Be;break e}else{f(se,$);break}else a(se,$);$=$.sibling}Be=Xm(oe,se.mode,Be),Be.return=se,se=Be}return F(se);case Dr:return oe=be(oe),No(se,$,oe,Be)}if(bh(oe))return Bn(se,$,oe,Be);if(d(oe)){if(pt=d(oe),typeof pt!="function")throw Error(i(150));return oe=pt.call(oe),Uc(se,$,oe,Be)}if(typeof oe.then=="function")return No(se,$,cn(oe),Be);if(oe.$$typeof===Lr)return No(se,$,Me(se,oe),Be);yi(se,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,$!==null&&$.tag===6?(f(se,$.sibling),Be=M($,oe),Be.return=se,se=Be):(f(se,$),Be=jm(oe,se.mode,Be),Be.return=se,se=Be),F(se)):f(se,$)}return function(se,$,oe,Be){try{Bc=0;var pt=No(se,$,oe,Be);return Ya=null,pt}catch(xt){if(xt===Ja||xt===Ph)throw xt;var gn=t(29,xt,null,se.mode);return gn.lanes=Be,gn.return=se,gn}finally{}}}function wr(){for(var o=Ka,a=gg=Ka=0;a<o;){var f=Qi[a];Qi[a++]=null;var x=Qi[a];Qi[a++]=null;var M=Qi[a];Qi[a++]=null;var E=Qi[a];if(Qi[a++]=null,x!==null&&M!==null){var F=x.pending;F===null?M.next=M:(M.next=F.next,F.next=M),x.pending=M}E!==0&&ws(f,M,E)}}function Ca(o,a,f,x){Qi[Ka++]=o,Qi[Ka++]=a,Qi[Ka++]=f,Qi[Ka++]=x,gg|=x,o.lanes|=x,o=o.alternate,o!==null&&(o.lanes|=x)}function wa(o,a,f,x){return Ca(o,a,f,x),Rr(o)}function Cs(o,a){return Ca(o,null,null,a),Rr(o)}function ws(o,a,f){o.lanes|=f;var x=o.alternate;x!==null&&(x.lanes|=f);for(var M=!1,E=o.return;E!==null;)E.childLanes|=f,x=E.alternate,x!==null&&(x.childLanes|=f),E.tag===22&&(o=E.stateNode,o===null||o._visibility&1||(M=!0)),o=E,E=E.return;return o.tag===3?(E=o.stateNode,M&&a!==null&&(M=31-Fi(f),o=E.hiddenUpdates,x=o[M],x===null?o[M]=[a]:x.push(a),a.lane=f|536870912),E):null}function Rr(o){if(50<Oc)throw Oc=0,wg=null,Error(i(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}function Ra(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ia(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Pi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function rs(o,a,f){var x=o.updateQueue;if(x===null)return null;if(x=x.shared,(Lt&2)!==0){var M=x.pending;return M===null?a.next=a:(a.next=M.next,M.next=a),x.pending=a,a=Rr(o),ws(o,null,f),a}return Ca(o,x,a,f),Rr(o)}function Rs(o,a,f){if(a=a.updateQueue,a!==null&&(a=a.shared,(f&4194048)!==0)){var x=a.lanes;x&=o.pendingLanes,f|=x,a.lanes=f,I(o,f)}}function Ba(o,a){var f=o.updateQueue,x=o.alternate;if(x!==null&&(x=x.updateQueue,f===x)){var M=null,E=null;if(f=f.firstBaseUpdate,f!==null){do{var F={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};E===null?M=E=F:E=E.next=F,f=f.next}while(f!==null);E===null?M=E=a:E=E.next=a}else M=E=a;f={baseState:x.baseState,firstBaseUpdate:M,lastBaseUpdate:E,shared:x.shared,callbacks:x.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=a:o.next=a,f.lastBaseUpdate=a}function Ir(){if(xg){var o=Xa;if(o!==null)throw o}}function Ao(o,a,f,x){xg=!1;var M=o.updateQueue;Ur=!1;var E=M.firstBaseUpdate,F=M.lastBaseUpdate,J=M.shared.pending;if(J!==null){M.shared.pending=null;var ce=J,Ae=ce.next;ce.next=null,F===null?E=Ae:F.next=Ae,F=ce;var Ve=o.alternate;Ve!==null&&(Ve=Ve.updateQueue,J=Ve.lastBaseUpdate,J!==F&&(J===null?Ve.firstBaseUpdate=Ae:J.next=Ae,Ve.lastBaseUpdate=ce))}if(E!==null){var Ie=M.baseState;F=0,Ve=Ae=ce=null,J=E;do{var nt=J.lane&-536870913,Tt=nt!==J.lane;if(Tt?(Ot&nt)===nt:(x&nt)===nt){nt!==0&&nt===ja&&(xg=!0),Ve!==null&&(Ve=Ve.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var Bn=o,Uc=J;nt=a;var No=f;switch(Uc.tag){case 1:if(Bn=Uc.payload,typeof Bn=="function"){Ie=Bn.call(No,Ie,nt);break e}Ie=Bn;break e;case 3:Bn.flags=Bn.flags&-65537|128;case 0:if(Bn=Uc.payload,nt=typeof Bn=="function"?Bn.call(No,Ie,nt):Bn,nt==null)break e;Ie=Ym({},Ie,nt);break e;case 2:Ur=!0}}nt=J.callback,nt!==null&&(o.flags|=64,Tt&&(o.flags|=8192),Tt=M.callbacks,Tt===null?M.callbacks=[nt]:Tt.push(nt))}else Tt={lane:nt,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Ve===null?(Ae=Ve=Tt,ce=Ie):Ve=Ve.next=Tt,F|=nt;if(J=J.next,J===null){if(J=M.shared.pending,J===null)break;Tt=J,J=Tt.next,Tt.next=null,M.lastBaseUpdate=Tt,M.shared.pending=null}}while(!0);Ve===null&&(ce=Ie),M.baseState=ce,M.firstBaseUpdate=Ae,M.lastBaseUpdate=Ve,E===null&&(M.shared.lanes=0),kr|=F,o.lanes=F,o.memoizedState=Ie}}function nh(o,a){if(typeof o!="function")throw Error(i(191,o));o.call(a)}function ih(o,a){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;o<f.length;o++)nh(f[o],a)}function sh(o,a){o=ur,_(Dh,o),_(qa,a),ur=o|a.baseLanes}function dc(){_(Dh,ur),_(qa,qa.current)}function pc(){ur=Dh.current,g(qa),g(Dh)}function Is(o){var a=o.alternate;_(Mn,Mn.current&1),_(Ui,o),fs===null&&(a===null||qa.current!==null||a.memoizedState!==null)&&(fs=o)}function N(o){_(Mn,Mn.current),_(Ui,o),fs===null&&(fs=o)}function Z(o){o.tag===22?(_(Mn,Mn.current),_(Ui,o),fs===null&&(fs=o)):ie()}function ie(){_(Mn,Mn.current),_(Ui,Ui.current)}function te(o){g(Ui),fs===o&&(fs=null),g(Mn)}function ne(o){for(var a=o;a!==null;){if(a.tag===13){var f=a.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||ig(f)||sg(f)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}function Se(){throw Error(i(321))}function Qe(o,a){if(a===null)return!1;for(var f=0;f<a.length&&f<o.length;f++)if(!Oi(o[f],a[f]))return!1;return!0}function We(o,a,f,x,M,E){return lr=E,Ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,dt.H=o===null||o.memoizedState===null?Ab:_g,Do=!1,E=f(x,M),Do=!1,Za&&(E=lt(a,f,x,M)),st(o),E}function st(o){dt.H=Lc;var a=rn!==null&&rn.next!==null;if(lr=0,Cn=rn=Ct=null,Fh=!1,Pc=0,Qa=null,a)throw Error(i(300));o===null||wn||(o=o.dependencies,o!==null&&ut(o)&&(wn=!0))}function lt(o,a,f,x){Ct=o;var M=0;do{if(Za&&(Qa=null),Pc=0,Za=!1,25<=M)throw Error(i(301));if(M+=1,Cn=rn=null,o.updateQueue!=null){var E=o.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}dt.H=Mb,E=a(f,x)}while(Za);return E}function bt(){var o=dt.H,a=o.useState()[0];return a=typeof a.then=="function"?_n(a):a,o=o.useState()[0],(rn!==null?rn.memoizedState:null)!==o&&(Ct.flags|=1024),a}function St(){var o=Nh!==0;return Nh=0,o}function ct(o,a,f){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~f}function Xt(o){if(Fh){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}Fh=!1}lr=0,Cn=rn=Ct=null,Za=!1,Pc=Nh=0,Qa=null}function Bt(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?Ct.memoizedState=Cn=o:Cn=Cn.next=o,Cn}function At(){if(rn===null){var o=Ct.alternate;o=o!==null?o.memoizedState:null}else o=rn.next;var a=Cn===null?Ct.memoizedState:Cn.next;if(a!==null)Cn=a,rn=o;else{if(o===null)throw Ct.alternate===null?Error(i(467)):Error(i(310));rn=o,o={memoizedState:rn.memoizedState,baseState:rn.baseState,baseQueue:rn.baseQueue,queue:rn.queue,next:null},Cn===null?Ct.memoizedState=Cn=o:Cn=Cn.next=o}return Cn}function Jt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function _n(o){var a=Pc;return Pc+=1,Qa===null&&(Qa=[]),o=Ge(Qa,o,a),a=Ct,(Cn===null?a.memoizedState:Cn.next)===null&&(a=a.alternate,dt.H=a===null||a.memoizedState===null?Ab:_g),o}function Ke(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return _n(o);if(o.$$typeof===Lr)return it(o)}throw Error(i(438,String(o)))}function Wn(o){var a=null,f=Ct.updateQueue;if(f!==null&&(a=f.memoCache),a==null){var x=Ct.alternate;x!==null&&(x=x.updateQueue,x!==null&&(x=x.memoCache,x!=null&&(a={data:x.data.map(function(M){return M.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),f===null&&(f=Jt(),Ct.updateQueue=f),f.memoCache=a,f=a.data[a.index],f===void 0)for(f=a.data[a.index]=Array(o),x=0;x<o;x++)f[x]=gC;return a.index++,f}function Et(o,a){return typeof a=="function"?a(o):a}function jn(o){var a=At();return vi(a,rn,o)}function vi(o,a,f){var x=o.queue;if(x===null)throw Error(i(311));x.lastRenderedReducer=f;var M=o.baseQueue,E=x.pending;if(E!==null){if(M!==null){var F=M.next;M.next=E.next,E.next=F}a.baseQueue=M=E,x.pending=null}if(E=o.baseState,M===null)o.memoizedState=E;else{a=M.next;var J=F=null,ce=null,Ae=a,Ve=!1;do{var Ie=Ae.lane&-536870913;if(Ie!==Ae.lane?(Ot&Ie)===Ie:(lr&Ie)===Ie){var nt=Ae.revertLane;if(nt===0)ce!==null&&(ce=ce.next={lane:0,revertLane:0,gesture:null,action:Ae.action,hasEagerState:Ae.hasEagerState,eagerState:Ae.eagerState,next:null}),Ie===ja&&(Ve=!0);else if((lr&nt)===nt){Ae=Ae.next,nt===ja&&(Ve=!0);continue}else Ie={lane:0,revertLane:Ae.revertLane,gesture:null,action:Ae.action,hasEagerState:Ae.hasEagerState,eagerState:Ae.eagerState,next:null},ce===null?(J=ce=Ie,F=E):ce=ce.next=Ie,Ct.lanes|=nt,kr|=nt;Ie=Ae.action,Do&&f(E,Ie),E=Ae.hasEagerState?Ae.eagerState:f(E,Ie)}else nt={lane:Ie,revertLane:Ae.revertLane,gesture:Ae.gesture,action:Ae.action,hasEagerState:Ae.hasEagerState,eagerState:Ae.eagerState,next:null},ce===null?(J=ce=nt,F=E):ce=ce.next=nt,Ct.lanes|=Ie,kr|=Ie;Ae=Ae.next}while(Ae!==null&&Ae!==a);if(ce===null?F=E:ce.next=J,!Oi(E,o.memoizedState)&&(wn=!0,Ve&&(f=Xa,f!==null)))throw f;o.memoizedState=E,o.baseState=F,o.baseQueue=ce,x.lastRenderedState=E}return M===null&&(x.lanes=0),[o.memoizedState,x.dispatch]}function Yi(o){var a=At(),f=a.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=o;var x=f.dispatch,M=f.pending,E=a.memoizedState;if(M!==null){f.pending=null;var F=M=M.next;do E=o(E,F.action),F=F.next;while(F!==M);Oi(E,a.memoizedState)||(wn=!0),a.memoizedState=E,a.baseQueue===null&&(a.baseState=E),f.lastRenderedState=E}return[E,x]}function er(o,a,f){var x=Ct,M=At(),E=kt;if(E){if(f===void 0)throw Error(i(407));f=f()}else f=a();var F=!Oi((rn||M).memoizedState,f);if(F&&(M.memoizedState=f,wn=!0),M=M.queue,pm(os.bind(null,x,M,o),[o]),M.getSnapshot!==a||F||Cn!==null&&Cn.memoizedState.tag&1){if(x.flags|=2048,Pa(9,{destroy:void 0},dn.bind(null,x,M,f,a),null),ln===null)throw Error(i(349));E||(lr&127)!==0||Zt(x,a,f)}return f}function Zt(o,a,f){o.flags|=16384,o={getSnapshot:a,value:f},a=Ct.updateQueue,a===null?(a=Jt(),Ct.updateQueue=a,a.stores=[o]):(f=a.stores,f===null?a.stores=[o]:f.push(o))}function dn(o,a,f,x){a.value=f,a.getSnapshot=x,en(a)&&as(o)}function os(o,a,f){return f(function(){en(a)&&as(o)})}function en(o){var a=o.getSnapshot;o=o.value;try{var f=a();return!Oi(o,f)}catch{return!0}}function as(o){var a=Cs(o,2);a!==null&&bi(a,o,2)}function Bs(o){var a=Bt();if(typeof o=="function"){var f=o;if(o=f(),Do){X(!0);try{f()}finally{X(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Et,lastRenderedState:o},a}function mc(o,a,f,x){return o.baseState=f,vi(o,rn,typeof x=="function"?x:Et)}function XT(o,a,f,x,M){if(ah(o))throw Error(i(485));if(o=a.action,o!==null){var E={payload:M,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(F){E.listeners.push(F)}};dt.T!==null?f(!0):E.isTransition=!1,x(E),f=a.pending,f===null?(E.next=a.pending=E,ry(a,E)):(E.next=f.next,a.pending=f.next=E)}}function ry(o,a){var f=a.action,x=a.payload,M=o.state;if(a.isTransition){var E=dt.T,F={};dt.T=F;try{var J=f(M,x),ce=dt.S;ce!==null&&ce(F,J),oy(o,a,J)}catch(Ae){dm(o,a,Ae)}finally{E!==null&&F.types!==null&&(E.types=F.types),dt.T=E}}else try{E=f(M,x),oy(o,a,E)}catch(Ae){dm(o,a,Ae)}}function oy(o,a,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(x){ay(o,a,x)},function(x){return dm(o,a,x)}):ay(o,a,f)}function ay(o,a,f){a.status="fulfilled",a.value=f,ly(a),o.state=f,a=o.pending,a!==null&&(f=a.next,f===a?o.pending=null:(f=f.next,a.next=f,ry(o,f)))}function dm(o,a,f){var x=o.pending;if(o.pending=null,x!==null){x=x.next;do a.status="rejected",a.reason=f,ly(a),a=a.next;while(a!==x)}o.action=null}function ly(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function cy(o,a){return a}function uy(o,a){if(kt){var f=ln.formState;if(f!==null){e:{var x=Ct;if(kt){if(pn){var M=cw(pn,Zi);if(M){pn=sb(M),x=uw(M);break e}}ze(x)}x=!1}x&&(a=f[0])}}f=Bt(),f.memoizedState=f.baseState=a,x={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cy,lastRenderedState:a},f.queue=x,f=wy.bind(null,Ct,x),x.dispatch=f,x=Bs(!1);var E=_m.bind(null,Ct,!1,x.queue);return x=Bt(),M={state:a,dispatch:null,action:o,pending:null},x.queue=M,f=XT.bind(null,Ct,M,E,f),M.dispatch=f,x.memoizedState=o,[a,f,!1]}function hy(o){var a=At();return fy(a,rn,o)}function fy(o,a,f){if(a=vi(o,a,cy)[0],o=jn(Et)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var x=_n(a)}catch(F){throw F===Ja?Ph:F}else x=a;a=At();var M=a.queue,E=M.dispatch;return f!==a.memoizedState&&(Ct.flags|=2048,Pa(9,{destroy:void 0},JT.bind(null,M,f),null)),[x,E,o]}function JT(o,a){o.action=a}function dy(o){var a=At(),f=rn;if(f!==null)return fy(a,f,o);At(),a=a.memoizedState,f=At();var x=f.queue.dispatch;return f.memoizedState=o,[a,x,!1]}function Pa(o,a,f,x){return o={tag:o,create:f,deps:x,inst:a,next:null},a=Ct.updateQueue,a===null&&(a=Jt(),Ct.updateQueue=a),f=a.lastEffect,f===null?a.lastEffect=o.next=o:(x=f.next,f.next=o,o.next=x,a.lastEffect=o),o}function py(){return At().memoizedState}function rh(o,a,f,x){var M=Bt();Ct.flags|=o,M.memoizedState=Pa(1|a,{destroy:void 0},f,x===void 0?null:x)}function oh(o,a,f,x){var M=At();x=x===void 0?null:x;var E=M.memoizedState.inst;rn!==null&&x!==null&&Qe(x,rn.memoizedState.deps)?M.memoizedState=Pa(a,E,f,x):(Ct.flags|=o,M.memoizedState=Pa(1|a,E,f,x))}function my(o,a){rh(8390656,8,o,a)}function pm(o,a){oh(2048,8,o,a)}function YT(o){Ct.flags|=4;var a=Ct.updateQueue;if(a===null)a=Jt(),Ct.updateQueue=a,a.events=[o];else{var f=a.events;f===null?a.events=[o]:f.push(o)}}function gy(o){var a=At().memoizedState;return YT({ref:a,nextImpl:o}),function(){if((Lt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function xy(o,a){return oh(4,2,o,a)}function _y(o,a){return oh(4,4,o,a)}function yy(o,a){if(typeof a=="function"){o=o();var f=a(o);return function(){typeof f=="function"?f():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function vy(o,a,f){f=f!=null?f.concat([o]):null,oh(4,4,yy.bind(null,a,o),f)}function mm(){}function by(o,a){var f=At();a=a===void 0?null:a;var x=f.memoizedState;return a!==null&&Qe(a,x[1])?x[0]:(f.memoizedState=[o,a],o)}function Ay(o,a){var f=At();a=a===void 0?null:a;var x=f.memoizedState;if(a!==null&&Qe(a,x[1]))return x[0];if(x=o(),Do){X(!0);try{o()}finally{X(!1)}}return f.memoizedState=[x,a],x}function gm(o,a,f){return f===void 0||(lr&1073741824)!==0&&(Ot&261930)===0?o.memoizedState=a:(o.memoizedState=f,o=_v(),Ct.lanes|=o,kr|=o,f)}function My(o,a,f,x){return Oi(f,a)?f:qa.current!==null?(o=gm(o,f,x),Oi(o,a)||(wn=!0),o):(lr&42)===0||(lr&1073741824)!==0&&(Ot&261930)===0?(wn=!0,o.memoizedState=f):(o=_v(),Ct.lanes|=o,kr|=o,a)}function Sy(o,a,f,x,M){var E=or();kn(E!==0&&8>E?E:8);var F=dt.T,J={};dt.T=J,_m(o,!1,a,f);try{var ce=M(),Ae=dt.S;if(Ae!==null&&Ae(J,ce),ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var Ve=Mt(ce,x);gc(o,a,Ve,Li(o))}else gc(o,a,x,Li(o))}catch(Ie){gc(o,a,{then:function(){},status:"rejected",reason:Ie},Li())}finally{kn(E),F!==null&&J.types!==null&&(F.types=J.types),dt.T=F}}function Ey(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:Ua,baseState:Ua,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Et,lastRenderedState:Ua},next:null};var f={};return a.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Et,lastRenderedState:f},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function xm(){return it(wo)}function Ty(){return At().memoizedState}function Cy(){return At().memoizedState}function KT(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var f=Li();o=Pi(f);var x=rs(a,o,f);x!==null&&(bi(x,a,f),Rs(x,a,f)),a={cache:U()},o.payload=a;return}a=a.return}}function qT(o,a,f){var x=Li();f={lane:x,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},ah(o)?Ry(a,f):(f=wa(o,a,f,x),f!==null&&(bi(f,o,x),Iy(f,a,x)))}function wy(o,a,f){var x=Li();gc(o,a,f,x)}function gc(o,a,f,x){var M={lane:x,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(ah(o))Ry(a,M);else{var E=o.alternate;if(o.lanes===0&&(E===null||E.lanes===0)&&(E=a.lastRenderedReducer,E!==null))try{var F=a.lastRenderedState,J=E(F,f);if(M.hasEagerState=!0,M.eagerState=J,Oi(J,F))return Ca(o,a,M,0),ln===null&&wr(),!1}catch{}finally{}if(f=wa(o,a,M,x),f!==null)return bi(f,o,x),Iy(f,a,x),!0}return!1}function _m(o,a,f,x){if(x={lane:2,revertLane:Oe(),gesture:null,action:x,hasEagerState:!1,eagerState:null,next:null},ah(o)){if(a)throw Error(i(479))}else a=wa(o,f,x,2),a!==null&&bi(a,o,2)}function ah(o){var a=o.alternate;return o===Ct||a!==null&&a===Ct}function Ry(o,a){Za=Fh=!0;var f=o.pending;f===null?a.next=a:(a.next=f.next,f.next=a),o.pending=a}function Iy(o,a,f){if((f&4194048)!==0){var x=a.lanes;x&=o.pendingLanes,f|=x,a.lanes=f,I(o,f)}}function ym(o,a,f,x){a=o.memoizedState,f=f(x,a),f=f==null?a:Ym({},a,f),o.memoizedState=f,o.lanes===0&&(o.updateQueue.baseState=f)}function By(o,a,f,x,M,E,F){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(x,E,F):a.prototype&&a.prototype.isPureReactComponent?!fe(f,x)||!fe(M,E):!0}function Py(o,a,f,x){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(f,x),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(f,x),a.state!==o&&yg.enqueueReplaceState(a,a.state,null)}function Mo(o,a){var f=a;if("ref"in a){f={};for(var x in a)x!=="ref"&&(f[x]=a[x])}if(o=o.defaultProps){f===a&&(f=Ym({},f));for(var M in o)f[M]===void 0&&(f[M]=o[M])}return f}function lh(o,a){try{var f=o.onUncaughtError;f(a.value,{componentStack:a.stack})}catch(x){setTimeout(function(){throw x})}}function Ly(o,a,f){try{var x=o.onCaughtError;x(f.value,{componentStack:f.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(M){setTimeout(function(){throw M})}}function vm(o,a,f){return f=Pi(f),f.tag=3,f.payload={element:null},f.callback=function(){lh(o,a)},f}function Dy(o){return o=Pi(o),o.tag=3,o}function Fy(o,a,f,x){var M=f.type.getDerivedStateFromError;if(typeof M=="function"){var E=x.value;o.payload=function(){return M(E)},o.callback=function(){Ly(a,f,x)}}var F=f.stateNode;F!==null&&typeof F.componentDidCatch=="function"&&(o.callback=function(){Ly(a,f,x),typeof M!="function"&&(Hr===null?Hr=new Set([this]):Hr.add(this));var J=x.stack;this.componentDidCatch(x.value,{componentStack:J!==null?J:""})})}function ZT(o,a,f,x,M){if(f.flags|=32768,x!==null&&typeof x=="object"&&typeof x.then=="function"){if(a=f.alternate,a!==null&&j(a,f,M,!0),f=Ui.current,f!==null){switch(f.tag){case 31:case 13:return fs===null?xh():f.alternate===null&&yn===0&&(yn=3),f.flags&=-257,f.flags|=65536,f.lanes=M,x===Lh?f.flags|=16384:(a=f.updateQueue,a===null?f.updateQueue=new Set([x]):a.add(x),Vm(o,x,M)),!1;case 22:return f.flags|=65536,x===Lh?f.flags|=16384:(a=f.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([x])},f.updateQueue=a):(f=a.retryQueue,f===null?a.retryQueue=new Set([x]):f.add(x)),Vm(o,x,M)),!1}throw Error(i(435,f.tag))}return Vm(o,x,M),xh(),!1}if(kt)return a=Ui.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=M,x!==hg&&(o=Error(i(422),{cause:x}),_e(Q(o,f)))):(x!==hg&&(a=Error(i(423),{cause:x}),_e(Q(a,f))),o=o.current.alternate,o.flags|=65536,M&=-M,o.lanes|=M,x=Q(x,f),M=vm(o.stateNode,x,M),Ba(o,M),yn!==4&&(yn=2)),!1;var E=Error(i(520),{cause:x});if(E=Q(E,f),Fc===null?Fc=[E]:Fc.push(E),yn!==4&&(yn=2),a===null)return!0;x=Q(x,f),f=a;do{switch(f.tag){case 3:return f.flags|=65536,o=M&-M,f.lanes|=o,o=vm(f.stateNode,x,o),Ba(f,o),!1;case 1:if(a=f.type,E=f.stateNode,(f.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Hr===null||!Hr.has(E))))return f.flags|=65536,M&=-M,f.lanes|=M,M=Dy(M),Fy(M,o,f,x),Ba(f,M),!1}f=f.return}while(f!==null);return!1}function Xn(o,a,f,x){a.child=o===null?bb(a,null,f,x):Lo(a,o.child,f,x)}function Ny(o,a,f,x,M){f=f.render;var E=a.ref;if("ref"in x){var F={};for(var J in x)J!=="ref"&&(F[J]=x[J])}else F=x;return Ze(a),x=We(o,a,f,F,E,M),J=St(),o!==null&&!wn?(ct(o,a,M),tr(o,a,M)):(kt&&J&&pe(a),a.flags|=1,Xn(o,a,x,M),a.child)}function Oy(o,a,f,x,M){if(o===null){var E=f.type;return typeof E=="function"&&!Wm(E)&&E.defaultProps===void 0&&f.compare===null?(a.tag=15,a.type=E,Uy(o,a,E,x,M)):(o=yh(f.type,null,x,a,a.mode,M),o.ref=a.ref,o.return=a,a.child=o)}if(E=o.child,!Cm(o,M)){var F=E.memoizedProps;if(f=f.compare,f=f!==null?f:fe,f(F,x)&&o.ref===a.ref)return tr(o,a,M)}return a.flags|=1,o=sr(E,x),o.ref=a.ref,o.return=a,a.child=o}function Uy(o,a,f,x,M){if(o!==null){var E=o.memoizedProps;if(fe(E,x)&&o.ref===a.ref)if(wn=!1,a.pendingProps=x=E,Cm(o,M))(o.flags&131072)!==0&&(wn=!0);else return a.lanes=o.lanes,tr(o,a,M)}return bm(o,a,f,x,M)}function Gy(o,a,f,x){var M=x.children,E=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),x.mode==="hidden"){if((a.flags&128)!==0){if(E=E!==null?E.baseLanes|f:f,o!==null){for(x=a.child=o.child,M=0;x!==null;)M=M|x.lanes|x.childLanes,x=x.sibling;x=M&~E}else x=0,a.child=null;return ky(o,a,E,f,x)}if((f&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&K(a,E!==null?E.cachePool:null),E!==null?sh(a,E):dc(),Z(a);else return x=a.lanes=536870912,ky(o,a,E!==null?E.baseLanes|f:f,f,x)}else E!==null?(K(a,E.cachePool),sh(a,E),ie(),a.memoizedState=null):(o!==null&&K(a,null),dc(),ie());return Xn(o,a,M,f),a.child}function xc(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function ky(o,a,f,x,M){var E=Nt();return E=E===null?null:{parent:rr?mn._currentValue:mn._currentValue2,pool:E},a.memoizedState={baseLanes:f,cachePool:E},o!==null&&K(a,null),dc(),Z(a),o!==null&&j(o,a,x,!0),a.childLanes=M,null}function ch(o,a){return a=hh({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Hy(o,a,f){return Lo(a,o.child,null,f),o=ch(a,a.pendingProps),o.flags|=2,te(a),a.memoizedState=null,o}function QT(o,a,f){var x=a.pendingProps,M=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(kt){if(x.mode==="hidden")return o=ch(a,x),a.lanes=536870912,xc(null,o);if(N(a),(o=pn)?(o=yw(o,Zi),o!==null&&(a.memoizedState={dehydrated:o,treeContext:Fr!==null?{id:Ds,overflow:Fs}:null,retryLane:536870912,hydrationErrors:null},f=Uv(o),f.return=a,a.child=f,Yn=a,pn=null)):o=null,o===null)throw ze(a);return a.lanes=536870912,null}return ch(a,x)}var E=o.memoizedState;if(E!==null){var F=E.dehydrated;if(N(a),M)if(a.flags&256)a.flags&=-257,a=Hy(o,a,f);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(i(558));else if(wn||j(o,a,f,!1),M=(f&o.childLanes)!==0,wn||M){if(x=ln,x!==null&&(F=O(x,f),F!==0&&F!==E.retryLane))throw E.retryLane=F,Cs(o,F),bi(x,o,F),vg;xh(),a=Hy(o,a,f)}else o=E.treeContext,ti&&(pn=pw(F),Yn=a,kt=!0,Or=null,Zi=!1,o!==null&&Pe(a,o)),a=ch(a,x),a.flags|=4096;return a}return o=sr(o.child,{mode:x.mode,children:x.children}),o.ref=a.ref,a.child=o,o.return=a,o}function uh(o,a){var f=a.ref;if(f===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(i(284));(o===null||o.ref!==f)&&(a.flags|=4194816)}}function bm(o,a,f,x,M){return Ze(a),f=We(o,a,f,x,void 0,M),x=St(),o!==null&&!wn?(ct(o,a,M),tr(o,a,M)):(kt&&x&&pe(a),a.flags|=1,Xn(o,a,f,M),a.child)}function zy(o,a,f,x,M,E){return Ze(a),a.updateQueue=null,f=lt(a,x,f,M),st(o),x=St(),o!==null&&!wn?(ct(o,a,E),tr(o,a,E)):(kt&&x&&pe(a),a.flags|=1,Xn(o,a,f,E),a.child)}function Vy(o,a,f,x,M){if(Ze(a),a.stateNode===null){var E=Ha,F=f.contextType;typeof F=="object"&&F!==null&&(E=it(F)),E=new f(x,E),a.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=yg,a.stateNode=E,E._reactInternals=a,E=a.stateNode,E.props=x,E.state=a.memoizedState,E.refs={},Ra(a),F=f.contextType,E.context=typeof F=="object"&&F!==null?it(F):Ha,E.state=a.memoizedState,F=f.getDerivedStateFromProps,typeof F=="function"&&(ym(a,f,F,x),E.state=a.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(F=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),F!==E.state&&yg.enqueueReplaceState(E,E.state,null),Ao(a,x,E,M),Ir(),E.state=a.memoizedState),typeof E.componentDidMount=="function"&&(a.flags|=4194308),x=!0}else if(o===null){E=a.stateNode;var J=a.memoizedProps,ce=Mo(f,J);E.props=ce;var Ae=E.context,Ve=f.contextType;F=Ha,typeof Ve=="object"&&Ve!==null&&(F=it(Ve));var Ie=f.getDerivedStateFromProps;Ve=typeof Ie=="function"||typeof E.getSnapshotBeforeUpdate=="function",J=a.pendingProps!==J,Ve||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(J||Ae!==F)&&Py(a,E,x,F),Ur=!1;var nt=a.memoizedState;E.state=nt,Ao(a,x,E,M),Ir(),Ae=a.memoizedState,J||nt!==Ae||Ur?(typeof Ie=="function"&&(ym(a,f,Ie,x),Ae=a.memoizedState),(ce=Ur||By(a,f,ce,x,nt,Ae,F))?(Ve||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(a.flags|=4194308)):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=x,a.memoizedState=Ae),E.props=x,E.state=Ae,E.context=F,x=ce):(typeof E.componentDidMount=="function"&&(a.flags|=4194308),x=!1)}else{E=a.stateNode,Ia(o,a),F=a.memoizedProps,Ve=Mo(f,F),E.props=Ve,Ie=a.pendingProps,nt=E.context,Ae=f.contextType,ce=Ha,typeof Ae=="object"&&Ae!==null&&(ce=it(Ae)),J=f.getDerivedStateFromProps,(Ae=typeof J=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(F!==Ie||nt!==ce)&&Py(a,E,x,ce),Ur=!1,nt=a.memoizedState,E.state=nt,Ao(a,x,E,M),Ir();var Tt=a.memoizedState;F!==Ie||nt!==Tt||Ur||o!==null&&o.dependencies!==null&&ut(o.dependencies)?(typeof J=="function"&&(ym(a,f,J,x),Tt=a.memoizedState),(Ve=Ur||By(a,f,Ve,x,nt,Tt,ce)||o!==null&&o.dependencies!==null&&ut(o.dependencies))?(Ae||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(x,Tt,ce),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(x,Tt,ce)),typeof E.componentDidUpdate=="function"&&(a.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof E.componentDidUpdate!="function"||F===o.memoizedProps&&nt===o.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||F===o.memoizedProps&&nt===o.memoizedState||(a.flags|=1024),a.memoizedProps=x,a.memoizedState=Tt),E.props=x,E.state=Tt,E.context=ce,x=Ve):(typeof E.componentDidUpdate!="function"||F===o.memoizedProps&&nt===o.memoizedState||(a.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||F===o.memoizedProps&&nt===o.memoizedState||(a.flags|=1024),x=!1)}return E=x,uh(o,a),x=(a.flags&128)!==0,E||x?(E=a.stateNode,f=x&&typeof f.getDerivedStateFromError!="function"?null:E.render(),a.flags|=1,o!==null&&x?(a.child=Lo(a,o.child,null,M),a.child=Lo(a,null,f,M)):Xn(o,a,f,M),a.memoizedState=E.state,o=a.child):o=tr(o,a,M),o}function Wy(o,a,f,x){return qe(),a.flags|=256,Xn(o,a,f,x),a.child}function Am(o){return{baseLanes:o,cachePool:De()}}function Mm(o,a,f){return o=o!==null?o.childLanes&~f:0,a&&(o|=ki),o}function jy(o,a,f){var x=a.pendingProps,M=!1,E=(a.flags&128)!==0,F;if((F=E)||(F=o!==null&&o.memoizedState===null?!1:(Mn.current&2)!==0),F&&(M=!0,a.flags&=-129),F=(a.flags&32)!==0,a.flags&=-33,o===null){if(kt){if(M?Is(a):ie(),(o=pn)?(o=vw(o,Zi),o!==null&&(a.memoizedState={dehydrated:o,treeContext:Fr!==null?{id:Ds,overflow:Fs}:null,retryLane:536870912,hydrationErrors:null},f=Uv(o),f.return=a,a.child=f,Yn=a,pn=null)):o=null,o===null)throw ze(a);return sg(o)?a.lanes=32:a.lanes=536870912,null}var J=x.children;return x=x.fallback,M?(ie(),M=a.mode,J=hh({mode:"hidden",children:J},M),x=To(x,M,f,null),J.return=a,x.return=a,J.sibling=x,a.child=J,x=a.child,x.memoizedState=Am(f),x.childLanes=Mm(o,F,f),a.memoizedState=bg,xc(null,x)):(Is(a),Sm(a,J))}var ce=o.memoizedState;if(ce!==null&&(J=ce.dehydrated,J!==null)){if(E)a.flags&256?(Is(a),a.flags&=-257,a=Em(o,a,f)):a.memoizedState!==null?(ie(),a.child=o.child,a.flags|=128,a=null):(ie(),J=x.fallback,M=a.mode,x=hh({mode:"visible",children:x.children},M),J=To(J,M,f,null),J.flags|=2,x.return=a,J.return=a,x.sibling=J,a.child=x,Lo(a,o.child,null,f),x=a.child,x.memoizedState=Am(f),x.childLanes=Mm(o,F,f),a.memoizedState=bg,a=xc(null,x));else if(Is(a),sg(J))F=aw(J).digest,x=Error(i(419)),x.stack="",x.digest=F,_e({value:x,source:null,stack:null}),a=Em(o,a,f);else if(wn||j(o,a,f,!1),F=(f&o.childLanes)!==0,wn||F){if(F=ln,F!==null&&(x=O(F,f),x!==0&&x!==ce.retryLane))throw ce.retryLane=x,Cs(o,x),bi(F,o,x),vg;ig(J)||xh(),a=Em(o,a,f)}else ig(J)?(a.flags|=192,a.child=o.child,a=null):(o=ce.treeContext,ti&&(pn=mw(J),Yn=a,kt=!0,Or=null,Zi=!1,o!==null&&Pe(a,o)),a=Sm(a,x.children),a.flags|=4096);return a}return M?(ie(),J=x.fallback,M=a.mode,ce=o.child,E=ce.sibling,x=sr(ce,{mode:"hidden",children:x.children}),x.subtreeFlags=ce.subtreeFlags&65011712,E!==null?J=sr(E,J):(J=To(J,M,f,null),J.flags|=2),J.return=a,x.return=a,x.sibling=J,a.child=x,xc(null,x),x=a.child,J=o.child.memoizedState,J===null?J=Am(f):(M=J.cachePool,M!==null?(ce=rr?mn._currentValue:mn._currentValue2,M=M.parent!==ce?{parent:ce,pool:ce}:M):M=De(),J={baseLanes:J.baseLanes|f,cachePool:M}),x.memoizedState=J,x.childLanes=Mm(o,F,f),a.memoizedState=bg,xc(o.child,x)):(Is(a),f=o.child,o=f.sibling,f=sr(f,{mode:"visible",children:x.children}),f.return=a,f.sibling=null,o!==null&&(F=a.deletions,F===null?(a.deletions=[o],a.flags|=16):F.push(o)),a.child=f,a.memoizedState=null,f)}function Sm(o,a){return a=hh({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function hh(o,a){return o=t(22,o,null,a),o.lanes=0,o}function Em(o,a,f){return Lo(a,o.child,null,f),o=Sm(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Xy(o,a,f){o.lanes|=a;var x=o.alternate;x!==null&&(x.lanes|=a),Ce(o.return,a,f)}function Tm(o,a,f,x,M,E){var F=o.memoizedState;F===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:x,tail:f,tailMode:M,treeForkCount:E}:(F.isBackwards=a,F.rendering=null,F.renderingStartTime=0,F.last=x,F.tail=f,F.tailMode=M,F.treeForkCount=E)}function Jy(o,a,f){var x=a.pendingProps,M=x.revealOrder,E=x.tail;x=x.children;var F=Mn.current,J=(F&2)!==0;if(J?(F=F&1|2,a.flags|=128):F&=1,_(Mn,F),Xn(o,a,x,f),x=kt?wc:0,!J&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Xy(o,f,a);else if(o.tag===19)Xy(o,f,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(M){case"forwards":for(f=a.child,M=null;f!==null;)o=f.alternate,o!==null&&ne(o)===null&&(M=f),f=f.sibling;f=M,f===null?(M=a.child,a.child=null):(M=f.sibling,f.sibling=null),Tm(a,!1,M,f,E,x);break;case"backwards":case"unstable_legacy-backwards":for(f=null,M=a.child,a.child=null;M!==null;){if(o=M.alternate,o!==null&&ne(o)===null){a.child=M;break}o=M.sibling,M.sibling=f,f=M,M=o}Tm(a,!0,f,null,E,x);break;case"together":Tm(a,!1,null,null,void 0,x);break;default:a.memoizedState=null}return a.child}function tr(o,a,f){if(o!==null&&(a.dependencies=o.dependencies),kr|=a.lanes,(f&a.childLanes)===0)if(o!==null){if(j(o,a,f,!1),(f&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(i(153));if(a.child!==null){for(o=a.child,f=sr(o,o.pendingProps),a.child=f,f.return=a;o.sibling!==null;)o=o.sibling,f=f.sibling=sr(o,o.pendingProps),f.return=a;f.sibling=null}return a.child}function Cm(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&ut(o)))}function $T(o,a,f){switch(a.tag){case 3:He(a,a.stateNode.containerInfo),me(a,mn,o.memoizedState.cache),qe();break;case 27:case 5:Le(a);break;case 4:He(a,a.stateNode.containerInfo);break;case 10:me(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,N(a),null;break;case 13:var x=a.memoizedState;if(x!==null)return x.dehydrated!==null?(Is(a),a.flags|=128,null):(f&a.child.childLanes)!==0?jy(o,a,f):(Is(a),o=tr(o,a,f),o!==null?o.sibling:null);Is(a);break;case 19:var M=(o.flags&128)!==0;if(x=(f&a.childLanes)!==0,x||(j(o,a,f,!1),x=(f&a.childLanes)!==0),M){if(x)return Jy(o,a,f);a.flags|=128}if(M=a.memoizedState,M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),_(Mn,Mn.current),x)break;return null;case 22:return a.lanes=0,Gy(o,a,f,a.pendingProps);case 24:me(a,mn,o.memoizedState.cache)}return tr(o,a,f)}function Yy(o,a,f){if(o!==null)if(o.memoizedProps!==a.pendingProps)wn=!0;else{if(!Cm(o,f)&&(a.flags&128)===0)return wn=!1,$T(o,a,f);wn=(o.flags&131072)!==0}else wn=!1,kt&&(a.flags&1048576)!==0&&ae(a,wc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var x=a.pendingProps;if(o=be(a.elementType),a.type=o,typeof o=="function")Wm(o)?(x=Mo(o,x),a.tag=1,a=Vy(null,a,o,x,f)):(a.tag=0,a=bm(null,a,o,x,f));else{if(o!=null){var M=o.$$typeof;if(M===qm){a.tag=11,a=Ny(null,a,o,x,f);break e}else if(M===$m){a.tag=14,a=Oy(null,a,o,x,f);break e}}throw a=p(o)||o,Error(i(306,a,""))}}return a;case 0:return bm(o,a,a.type,a.pendingProps,f);case 1:return x=a.type,M=Mo(x,a.pendingProps),Vy(o,a,x,M,f);case 3:e:{if(He(a,a.stateNode.containerInfo),o===null)throw Error(i(387));var E=a.pendingProps;M=a.memoizedState,x=M.element,Ia(o,a),Ao(a,E,null,f);var F=a.memoizedState;if(E=F.cache,me(a,mn,E),E!==M.cache&&rt(a,[mn],f,!0),Ir(),E=F.element,ti&&M.isDehydrated)if(M={element:E,isDehydrated:!1,cache:F.cache},a.updateQueue.baseState=M,a.memoizedState=M,a.flags&256){a=Wy(o,a,E,f);break e}else if(E!==x){x=Q(Error(i(424)),a),_e(x),a=Wy(o,a,E,f);break e}else for(ti&&(pn=dw(a.stateNode.containerInfo),Yn=a,kt=!0,Or=null,Zi=!0),f=bb(a,null,E,f),a.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(qe(),E===x){a=tr(o,a,f);break e}Xn(o,a,E,f)}a=a.child}return a;case 26:if(hs)return uh(o,a),o===null?(f=ab(a.type,null,a.pendingProps,null))?a.memoizedState=f:kt||(a.stateNode=kw(a.type,a.pendingProps,Nr.current,a)):a.memoizedState=ab(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:if(Fn)return Le(a),o===null&&Fn&&kt&&(x=a.stateNode=db(a.type,a.pendingProps,Nr.current,Jn.current,!1),Yn=a,Zi=!0,pn=gw(a.type,x,pn)),Xn(o,a,a.pendingProps.children,f),uh(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&kt&&(Ow(a.type,a.pendingProps,Jn.current),(M=x=pn)&&(x=xw(x,a.type,a.pendingProps,Zi),x!==null?(a.stateNode=x,Yn=a,pn=fw(x),Zi=!1,M=!0):M=!1),M||ze(a)),Le(a),M=a.type,E=a.pendingProps,F=o!==null?o.memoizedProps:null,x=E.children,Ah(M,E)?x=null:F!==null&&Ah(M,F)&&(a.flags|=32),a.memoizedState!==null&&(M=We(o,a,bt,null,null,f),rr?wo._currentValue=M:wo._currentValue2=M),uh(o,a),Xn(o,a,x,f),a.child;case 6:return o===null&&kt&&(Uw(a.pendingProps,Jn.current),(o=f=pn)&&(f=_w(f,a.pendingProps,Zi),f!==null?(a.stateNode=f,Yn=a,pn=null,o=!0):o=!1),o||ze(a)),null;case 13:return jy(o,a,f);case 4:return He(a,a.stateNode.containerInfo),x=a.pendingProps,o===null?a.child=Lo(a,null,x,f):Xn(o,a,x,f),a.child;case 11:return Ny(o,a,a.type,a.pendingProps,f);case 7:return Xn(o,a,a.pendingProps,f),a.child;case 8:return Xn(o,a,a.pendingProps.children,f),a.child;case 12:return Xn(o,a,a.pendingProps.children,f),a.child;
4145case 10:return x=a.pendingProps,me(a,a.type,x.value),Xn(o,a,x.children,f),a.child;case 9:return M=a.type._context,x=a.pendingProps.children,Ze(a),M=it(M),x=x(M),a.flags|=1,Xn(o,a,x,f),a.child;case 14:return Oy(o,a,a.type,a.pendingProps,f);case 15:return Uy(o,a,a.type,a.pendingProps,f);case 19:return Jy(o,a,f);case 31:return QT(o,a,f);case 22:return Gy(o,a,f,a.pendingProps);case 24:return Ze(a),x=it(mn),o===null?(M=Nt(),M===null&&(M=ln,E=U(),M.pooledCache=E,E.refCount++,E!==null&&(M.pooledCacheLanes|=f),M=E),a.memoizedState={parent:x,cache:M},Ra(a),me(a,mn,M)):((o.lanes&f)!==0&&(Ia(o,a),Ao(a,null,null,f),Ir()),M=o.memoizedState,E=a.memoizedState,M.parent!==x?(M={parent:x,cache:x},a.memoizedState=M,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=M),me(a,mn,x)):(x=E.cache,me(a,mn,x),x!==M.cache&&rt(a,[mn],f,!0))),Xn(o,a,a.pendingProps.children,f),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ls(o){o.flags|=4}function fh(o){Ls&&(o.flags|=8)}function Ky(o,a){if(o!==null&&o.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(o=a.child;o!==null;){if((o.flags&8218)!==0||(o.subtreeFlags&8218)!==0)return!0;o=o.sibling}return!1}function wm(o,a,f,x){if(ei)for(f=a.child;f!==null;){if(f.tag===5||f.tag===6)tg(o,f.stateNode);else if(!(f.tag===4||Fn&&f.tag===27)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===a)break;for(;f.sibling===null;){if(f.return===null||f.return===a)return;f=f.return}f.sibling.return=f.return,f=f.sibling}else if(Ls)for(var M=a.child;M!==null;){if(M.tag===5){var E=M.stateNode;f&&x&&(E=nb(E,M.type,M.memoizedProps)),tg(o,E)}else if(M.tag===6)E=M.stateNode,f&&x&&(E=ib(E,M.memoizedProps)),tg(o,E);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)E=M.child,E!==null&&(E.return=M),wm(o,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 qy(o,a,f,x){var M=!1;if(Ls)for(var E=a.child;E!==null;){if(E.tag===5){var F=E.stateNode;f&&x&&(F=nb(F,E.type,E.memoizedProps)),eb(o,F)}else if(E.tag===6)F=E.stateNode,f&&x&&(F=ib(F,E.memoizedProps)),eb(o,F);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)M=E.child,M!==null&&(M.return=E),qy(o,E,!0,!0),M=!0;else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===a)break;for(;E.sibling===null;){if(E.return===null||E.return===a)return M;E=E.return}E.sibling.return=E.return,E=E.sibling}return M}function Zy(o,a){if(Ls&&Ky(o,a)){o=a.stateNode;var f=o.containerInfo,x=$v();qy(x,a,!1,!1),o.pendingChildren=x,ls(a),ow(f,x)}}function Rm(o,a,f,x){if(ei)o.memoizedProps!==x&&ls(a);else if(Ls){var M=o.stateNode,E=o.memoizedProps;if((o=Ky(o,a))||E!==x){var F=Jn.current;E=rw(M,f,E,x,!o,null),E===M?a.stateNode=M:(fh(a),Yv(E,f,x,F)&&ls(a),a.stateNode=E,o&&wm(E,a,!1,!1))}else a.stateNode=M}}function Im(o,a,f,x,M){if((o.mode&32)!==0&&(f===null?PC(a,x):LC(a,f,x))){if(o.flags|=16777216,(M&335544128)===M||ng(a,x))if(qv(o.stateNode,a,x))o.flags|=8192;else if(Mv())o.flags|=8192;else throw Po=Lh,mg}else o.flags&=-16777217}function Qy(o,a){if(zw(a)){if(o.flags|=16777216,!fb(a))if(Mv())o.flags|=8192;else throw Po=Lh,mg}else o.flags&=-16777217}function dh(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?T():536870912,o.lanes|=a,tl|=a)}function _c(o,a){if(!kt)switch(o.tailMode){case"hidden":a=o.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?o.tail=null:f.sibling=null;break;case"collapsed":f=o.tail;for(var x=null;f!==null;)f.alternate!==null&&(x=f),f=f.sibling;x===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:x.sibling=null}}function hn(o){var a=o.alternate!==null&&o.alternate.child===o.child,f=0,x=0;if(a)for(var M=o.child;M!==null;)f|=M.lanes|M.childLanes,x|=M.subtreeFlags&65011712,x|=M.flags&65011712,M.return=o,M=M.sibling;else for(M=o.child;M!==null;)f|=M.lanes|M.childLanes,x|=M.subtreeFlags,x|=M.flags,M.return=o,M=M.sibling;return o.subtreeFlags|=x,o.childLanes=f,a}function eC(o,a,f){var x=a.pendingProps;switch(Ue(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hn(a),null;case 1:return hn(a),null;case 3:return f=a.stateNode,x=null,o!==null&&(x=o.memoizedState.cache),a.memoizedState.cache!==x&&(a.flags|=2048),Te(mn),le(),f.pendingContext&&(f.context=f.pen
vendor: 6,093 bytes, line 4145
4145dingContext,f.pendingContext=null),(o===null||o.child===null)&&(ht(a)?ls(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,de())),Zy(o,a),hn(a),null;case 26:if(hs){var M=a.type,E=a.memoizedState;return o===null?(ls(a),E!==null?(hn(a),Qy(a,E)):(hn(a),Im(a,M,null,x,f))):E?E!==o.memoizedState?(ls(a),hn(a),Qy(a,E)):(hn(a),a.flags&=-16777217):(E=o.memoizedProps,ei?E!==x&&ls(a):Rm(o,a,M,x),hn(a),Im(a,M,E,x,f)),null}case 27:if(Fn){if(ye(a),f=Nr.current,M=a.type,o!==null&&a.stateNode!=null)ei?o.memoizedProps!==x&&ls(a):Rm(o,a,M,x);else{if(!x){if(a.stateNode===null)throw Error(i(166));return hn(a),null}o=Jn.current,ht(a)?Je(a,o):(o=db(M,x,f,o,!0),a.stateNode=o,ls(a))}return hn(a),null}case 5:if(ye(a),M=a.type,o!==null&&a.stateNode!=null)Rm(o,a,M,x);else{if(!x){if(a.stateNode===null)throw Error(i(166));return hn(a),null}if(E=Jn.current,ht(a))Je(a,E),Bw(a.stateNode,M,x,E)&&(a.flags|=64);else{var F=SC(M,x,Nr.current,E,a);fh(a),wm(F,a,!1,!1),a.stateNode=F,Yv(F,M,x,E)&&ls(a)}}return hn(a),Im(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,f),null;case 6:if(o&&a.stateNode!=null)f=o.memoizedProps,ei?f!==x&&ls(a):Ls&&(f!==x?(o=Nr.current,f=Jn.current,fh(a),a.stateNode=Kv(x,o,f,a)):a.stateNode=o.stateNode);else{if(typeof x!="string"&&a.stateNode===null)throw Error(i(166));if(o=Nr.current,f=Jn.current,ht(a)){if(!ti)throw Error(i(176));if(o=a.stateNode,f=a.memoizedProps,x=null,M=Yn,M!==null)switch(M.tag){case 27:case 5:x=M.memoizedProps}Aw(o,f,a,x)||ze(a,!0)}else fh(a),a.stateNode=Kv(x,o,f,a)}return hn(a),null;case 31:if(f=a.memoizedState,o===null||o.memoizedState!==null){if(x=ht(a),f!==null){if(o===null){if(!x)throw Error(i(318));if(!ti)throw Error(i(556));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));Mw(o,a)}else qe(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;hn(a),o=!1}else f=de(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return a.flags&256?(te(a),a):(te(a),null);if((a.flags&128)!==0)throw Error(i(558))}return hn(a),null;case 13:if(x=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(M=ht(a),x!==null&&x.dehydrated!==null){if(o===null){if(!M)throw Error(i(318));if(!ti)throw Error(i(344));if(M=a.memoizedState,M=M!==null?M.dehydrated:null,!M)throw Error(i(317));Sw(M,a)}else qe(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;hn(a),M=!1}else M=de(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=M),M=!0;if(!M)return a.flags&256?(te(a),a):(te(a),null)}return te(a),(a.flags&128)!==0?(a.lanes=f,a):(f=x!==null,o=o!==null&&o.memoizedState!==null,f&&(x=a.child,M=null,x.alternate!==null&&x.alternate.memoizedState!==null&&x.alternate.memoizedState.cachePool!==null&&(M=x.alternate.memoizedState.cachePool.pool),E=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(E=x.memoizedState.cachePool.pool),E!==M&&(x.flags|=2048)),f!==o&&f&&(a.child.flags|=8192),dh(a,a.updateQueue),hn(a),null);case 4:return le(),Zy(o,a),o===null&&wC(a.stateNode.containerInfo),hn(a),null;case 10:return Te(a.type),hn(a),null;case 19:if(g(Mn),x=a.memoizedState,x===null)return hn(a),null;if(M=(a.flags&128)!==0,E=x.rendering,E===null)if(M)_c(x,!1);else{if(yn!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(E=ne(o),E!==null){for(a.flags|=128,_c(x,!1),o=E.updateQueue,a.updateQueue=o,dh(a,o),a.subtreeFlags=0,o=f,f=a.child;f!==null;)Ov(f,o),f=f.sibling;return _(Mn,Mn.current&1|2),kt&&re(a,x.treeForkCount),a.child}o=o.sibling}x.tail!==null&&Ai()>Nc&&(a.flags|=128,M=!0,_c(x,!1),a.lanes=4194304)}else{if(!M)if(o=ne(E),o!==null){if(a.flags|=128,M=!0,o=o.updateQueue,a.updateQueue=o,dh(a,o),_c(x,!0),x.tail===null&&x.tailMode==="hidden"&&!E.alternate&&!kt)return hn(a),null}else 2*Ai()-x.renderingStartTime>Nc&&f!==536870912&&(a.flags|=128,M=!0,_c(x,!1),a.lanes=4194304);x.isBackwards?(E.sibling=a.child,a.child=E):(o=x.last,o!==null?o.sibling=E:a.child=E,x.last=E)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=Ai(),o.sibling=null,f=Mn.current,_(Mn,M?f&1|2:f&1),kt&&re(a,x.treeForkCount),o):(hn(a),null);case 22:case 23:return te(a),pc(),x=a.memoizedState!==null,o!==null?o.memoizedState!==null!==x&&(a.flags|=8192):x&&(a.flags|=8192),x?(f&536870912)!==0&&(a.flags&128)===0&&(hn(a),a.subtreeFlags&6&&(a.flags|=8192)):hn(a),f=a.updateQueue,f!==null&&dh(a,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),x=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(x=a.memoizedState.cachePool.pool),x!==f&&(a.flags|=2048),o!==null&&g(Bo),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),Te(mn),hn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function tC(o,a){switch(Ue(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Te(mn),le(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return ye(a),null;case 31:if(a.memoizedState!==null){if(te(a),a.alternate===null)throw Error(i(340));qe()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(te(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(i(340));qe()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return g(Mn),null;case 4:return le(),null;case 10:return Te(a.type),null;case 22:case 23:return te(a),pc(),o!==null&&g(Bo),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Te(mn),null;case 25:return null;default:return null}}function $y(o,a){switch(Ue(a),a.tag){case 3:Te(mn),le();break;case 26:case 27:case 5:ye(a);break;case 4:le();break;case 31:a.memoizedState!==null&&te(a);break;case 13:te(a);break;case 19:g(Mn);break;case 10:Te(a.type);break;case 22:case 23:te(a),pc(),o!==null&&g(Bo);break;case 24:Te(mn)}}function yc(o,a){try{var f=a.updateQueue,x=f!==null?f.lastEffect:null;if(x!==null){var M=x.next;f=M;do{if((f.tag&o)===o){x=void 0;var E=f.create,F=f.inst;x=E(),F.destroy=x}f=f.next}
4145while(f!==M)}}catch(J){Yt(a,a.return,J)}}function Br(o,a,f){try{var x=a.updateQueue,M=x!==null?x.lastEffect:null;if(M!==null){var E=M.next;x=E;do{if((x.tag&o)===o){var F=x.inst,J=F.destroy;if(J!==void 0){F.destroy=void 0,M=a;var ce=f,Ae=J;try{Ae()}catch(Ve){Yt(M,ce,Ve)}}}x=x.next}while(x!==E)}}catch(Ve){Yt(a,a.return,Ve)}}function ev(o){var a=o.updateQueue;if(a!==null){var f=o.stateNode;try{ih(a,f)}catch(x){Yt(o,o.return,x)}}}function tv(o,a,f){f.props=Mo(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(x){Yt(o,a,x)}}function vc(o,a){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var x=Sc(o.stateNode);break;case 30:x=o.stateNode;break;default:x=o.stateNode}typeof f=="function"?o.refCleanup=f(x):f.current=x}}catch(M){Yt(o,a,M)}}function Ps(o,a){var f=o.ref,x=o.refCleanup;if(f!==null)if(typeof x=="function")try{x()}catch(M){Yt(o,a,M)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(M){Yt(o,a,M)}else f.current=null}function nv(o){var a=o.type,f=o.memoizedProps,x=o.stateNode;try{YC(x,a,f,o)}catch(M){Yt(o,o.return,M)}}function Bm(o,a,f){try{KC(o.stateNode,o.type,f,a,o)}catch(x){Yt(o,o.return,x)}}function iv(o){return o.tag===5||o.tag===3||(hs?o.tag===26:!1)||(Fn?o.tag===27&&Ga(o.type):!1)||o.tag===4}function Pm(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||iv(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(Fn&&o.tag===27&&Ga(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Lm(o,a,f){var x=o.tag;if(x===5||x===6)o=o.stateNode,a?ZC(f,o,a):XC(f,o);else if(x!==4&&(Fn&&x===27&&Ga(o.type)&&(f=o.stateNode,a=null),o=o.child,o!==null))for(Lm(o,a,f),o=o.sibling;o!==null;)Lm(o,a,f),o=o.sibling}function ph(o,a,f){var x=o.tag;if(x===5||x===6)o=o.stateNode,a?qC(f,o,a):jC(f,o);else if(x!==4&&(Fn&&x===27&&Ga(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(ph(o,a,f),o=o.sibling;o!==null;)ph(o,a,f),o=o.sibling}function sv(o,a,f){o=o.containerInfo;try{tb(o,f)}catch(x){Yt(a,a.return,x)}}function rv(o){var a=o.stateNode,f=o.memoizedProps;try{Ww(o.type,f,a,o)}catch(x){Yt(o,o.return,x)}}function nC(o,a){for(AC(o.containerInfo),Hn=a;Hn!==null;)if(o=Hn,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,Hn=a;else for(;Hn!==null;){o=Hn;var f=o.alternate;switch(a=o.flags,o.tag){case 0:if((a&4)!==0&&(a=o.updateQueue,a=a!==null?a.events:null,a!==null))for(var x=0;x<a.length;x++){var M=a[x];M.ref.impl=M.nextImpl}break;case 11:case 15:break;case 1:if((a&1024)!==0&&f!==null){a=void 0,x=o,M=f.memoizedProps,f=f.memoizedState;var E=x.stateNode;try{var F=Mo(x.type,M);a=E.getSnapshotBeforeUpdate(F,f),E.__reactInternalSnapshotBeforeUpdate=a}catch(J){Yt(x,x.return,J)}}break;case 3:(a&1024)!==0&&ei&&sw(o.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(i(163))}if(a=o.sibling,a!==null){a.return=o.return,Hn=a;break}Hn=o.return}}function ov(o,a,f){var x=f.flags;switch(f.tag){case 0:case 11:case 15:nr(o,f),x&4&&yc(5,f);break;case 1:if(nr(o,f),x&4)if(o=f.stateNode,a===null)try{o.componentDidMount()}catch(F){Yt(f,f.return,F)}else{var M=Mo(f.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(M,a,o.__reactInternalSnapshotBeforeUpdate)}catch(F){Yt(f,f.return,F)}}x&64&&ev(f),x&512&&vc(f,f.return);break;case 3:if(nr(o,f),x&64&&(x=f.updateQueue,x!==null)){if(o=null,f.child!==null)switch(f.child.tag){case 27:case 5:o=Sc(f.child.stateNode);break;case 1:o=f.child.stateNode}try{ih(x,o)}catch(F){Yt(f,f.return,F)}}break;case 27:Fn&&a===null&&x&4&&rv(f);case 26:case 5:if(nr(o,f),a===null){if(x&4)nv(f);else if(x&64){o=f.type,a=f.memoizedProps,M=f.stateNode;try{Cw(M,o,a,f)}catch(F){Yt(f,f.return,F)}}}x&512&&vc(f,f.return);break;case 12:nr(o,f);break;case 31:nr(o,f),x&4&&lv(o,f);break;case 13:nr(o,f),x&4&&cv(o,f),x&64&&(x=f.memoizedState,x!==null&&(x=x.dehydrated,x!==null&&(f=cC.bind(null,f),lw(x,f))));break;case 22:if(x=f.memoizedState!==null||cr,!x){a=a!==null&&a.memoizedState!==null||Rn,M=cr;var E=Rn;cr=x,(Rn=a)&&!E?ir(o,f,(f.subtreeFlags&8772)!==0):nr(o,f),cr=M,Rn=E}break;case 30:break;default:nr(o,f)}}function av(o){var a=o.alternate;a!==null&&(o.alternate=null,av(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&BC(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function cs(o,a,f){for(f=f.child;f!==null;)Dm(o,a,f),f=f.sibling}
4145function Dm(o,a,f){if(Ni&&typeof Ni.onCommitFiberUnmount=="function")try{Ni.onCommitFiberUnmount(Cc,f)}catch{}switch(f.tag){case 26:if(hs){Rn||Ps(f,a),cs(o,a,f),f.memoizedState?cb(f.memoizedState):f.stateNode&&hb(f.stateNode);break}case 27:if(Fn){Rn||Ps(f,a);var x=In,M=Mi;Ga(f.type)&&(In=f.stateNode,Mi=!1),cs(o,a,f),pb(f.stateNode),In=x,Mi=M;break}case 5:Rn||Ps(f,a);case 6:if(ei){if(x=In,M=Mi,In=null,cs(o,a,f),In=x,Mi=M,In!==null)if(Mi)try{$C(In,f.stateNode)}catch(E){Yt(f,a,E)}else try{QC(In,f.stateNode)}catch(E){Yt(f,a,E)}}else cs(o,a,f);break;case 18:ei&&In!==null&&(Mi?Dw(In,f.stateNode):Lw(In,f.stateNode));break;case 4:ei?(x=In,M=Mi,In=f.stateNode.containerInfo,Mi=!0,cs(o,a,f),In=x,Mi=M):(Ls&&sv(f.stateNode,f,$v()),cs(o,a,f));break;case 0:case 11:case 14:case 15:Br(2,f,a),Rn||Br(4,f,a),cs(o,a,f);break;case 1:Rn||(Ps(f,a),x=f.stateNode,typeof x.componentWillUnmount=="function"&&tv(f,a,x)),cs(o,a,f);break;case 21:cs(o,a,f);break;case 22:Rn=(x=Rn)||f.memoizedState!==null,cs(o,a,f),Rn=x;break;default:cs(o,a,f)}}function lv(o,a){if(ti&&a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Rw(o)}catch(f){Yt(a,a.return,f)}}}function cv(o,a){if(ti&&a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Iw(o)}catch(f){Yt(a,a.return,f)}}function iC(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new Sb),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new Sb),a;default:throw Error(i(435,o.tag))}}function mh(o,a){var f=iC(o);a.forEach(function(x){if(!f.has(x)){f.add(x);var M=uC.bind(null,o,x);x.then(M,M)}})}
4145function $n(o,a){var f=a.deletions;if(f!==null)for(var x=0;x<f.length;x++){var M=f[x],E=o,F=a;if(ei){var J=F;e:for(;J!==null;){switch(J.tag){case 27:if(Fn){if(Ga(J.type)){In=J.stateNode,Mi=!1;break e}break}case 5:In=J.stateNode,Mi=!1;break e;case 3:case 4:In=J.stateNode.containerInfo,Mi=!0;break e}J=J.return}if(In===null)throw Error(i(160));Dm(E,F,M),In=null,Mi=!1}else Dm(E,F,M);E=M.alternate,E!==null&&(E.return=null),M.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)uv(a,o),a=a.sibling}function uv(o,a){var f=o.alternate,x=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:$n(a,o),hi(o),x&4&&(Br(3,o,o.return),yc(3,o),Br(5,o,o.return));break;case 1:$n(a,o),hi(o),x&512&&(Rn||f===null||Ps(f,f.return)),x&64&&cr&&(o=o.updateQueue,o!==null&&(x=o.callbacks,x!==null&&(f=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=f===null?x:f.concat(x))));break;case 26:if(hs){var M=ds;if($n(a,o),hi(o),x&512&&(Rn||f===null||Ps(f,f.return)),x&4){x=f!==null?f.memoizedState:null;var E=o.memoizedState;f===null?E===null?o.stateNode===null?o.stateNode=Gw(M,o.type,o.memoizedProps,o):ub(M,o.type,o.stateNode):o.stateNode=lb(M,E,o.memoizedProps):x!==E?(x===null?f.stateNode!==null&&hb(f.stateNode):cb(x),E===null?ub(M,o.type,o.stateNode):lb(M,E,o.memoizedProps)):E===null&&o.stateNode!==null&&Bm(o,o.memoizedProps,f.memoizedProps)}break}case 27:if(Fn){$n(a,o),hi(o),x&512&&(Rn||f===null||Ps(f,f.return)),f!==null&&x&4&&Bm(o,o.memoizedProps,f.memoizedProps);break}case 5:if($n(a,o),hi(o),x&512&&(Rn||f===null||Ps(f,f.return)),ei){if(o.flags&32){M=o.stateNode;try{Qv(M)}catch(Ie){Yt(o,o.return,Ie)}}x&4&&o.stateNode!=null&&(M=o.memoizedProps,Bm(o,M,f!==null?f.memoizedProps:M)),x&1024&&(Ag=!0)}else Ls&&o.alternate!==null&&(o.alternate.stateNode=o.stateNode);break;case 6:if($n(a,o),hi(o),x&4&&ei){if(o.stateNode===null)throw Error(i(162));x=o.memoizedProps,f=f!==null?f.memoizedProps:x,M=o.stateNode;try{JC(M,f,x)}catch(Ie){Yt(o,o.return,Ie)}}break;case 3:if(hs?(Hw(),M=ds,ds=rg(a.containerInfo),$n(a,o),ds=M):$n(a,o),hi(o),x&4){if(ei&&ti&&f!==null&&f.memoizedState.isDehydrated)try{ww(a.containerInfo)}catch(Ie){Yt(o,o.return,Ie)}if(Ls){x=a.containerInfo,f=a.pendingChildren;try{tb(x,f)}catch(Ie){Yt(o,o.return,Ie)}}}Ag&&(Ag=!1,hv(o));break;case 4:hs?(f=ds,ds=rg(o.stateNode.containerInfo),$n(a,o),hi(o),ds=f):($n(a,o),hi(o)),x&4&&Ls&&sv(o.stateNode,o,o.stateNode.pendingChildren);break;case 12:$n(a,o),hi(o);break;case 31:$n(a,o),hi(o),x&4&&(x=o.updateQueue,x!==null&&(o.updateQueue=null,mh(o,x)));break;case 13:$n(a,o),hi(o),o.child.flags&8192&&o.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(zh=Ai()),x&4&&(x=o.updateQueue,x!==null&&(o.updateQueue=null,mh(o,x)));break;case 22:M=o.memoizedState!==null;var F=f!==null&&f.memoizedState!==null,J=cr,ce=Rn;if(cr=J||M,Rn=ce||F,$n(a,o),Rn=ce,cr=J,hi(o),x&8192&&(a=o.stateNode,a._visibility=M?a._visibility&-2:a._visibility|1,M&&(f===null||F||cr||Rn||So(o)),ei)){e:if(f=null,ei)for(a=o;;
vendor: 5,683 bytes, line 4145
4145){if(a.tag===5||hs&&a.tag===26){if(f===null){F=f=a;try{E=F.stateNode,M?ew(E):nw(F.stateNode,F.memoizedProps)}catch(Ie){Yt(F,F.return,Ie)}}}else if(a.tag===6){if(f===null){F=a;try{var Ae=F.stateNode;M?tw(Ae):iw(Ae,F.memoizedProps)}catch(Ie){Yt(F,F.return,Ie)}}}else if(a.tag===18){if(f===null){F=a;try{var Ve=F.stateNode;M?Fw(Ve):Nw(F.stateNode)}catch(Ie){Yt(F,F.return,Ie)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;f===a&&(f=null),a=a.return}f===a&&(f=null),a.sibling.return=a.return,a=a.sibling}}x&4&&(x=o.updateQueue,x!==null&&(f=x.retryQueue,f!==null&&(x.retryQueue=null,mh(o,f))));break;case 19:$n(a,o),hi(o),x&4&&(x=o.updateQueue,x!==null&&(o.updateQueue=null,mh(o,x)));break;case 30:break;case 21:break;default:$n(a,o),hi(o)}}function hi(o){var a=o.flags;if(a&2){try{for(var f,x=o.return;x!==null;){if(iv(x)){f=x;break}x=x.return}if(ei){if(f==null)throw Error(i(160));switch(f.tag){case 27:if(Fn){var M=f.stateNode,E=Pm(o);ph(o,E,M);break}case 5:var F=f.stateNode;f.flags&32&&(Qv(F),f.flags&=-33);var J=Pm(o);ph(o,J,F);break;case 3:case 4:var ce=f.stateNode.containerInfo,Ae=Pm(o);Lm(o,Ae,ce);break;default:throw Error(i(161))}}}catch(Ve){Yt(o,o.return,Ve)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function hv(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;hv(a),a.tag===5&&a.flags&1024&&NC(a.stateNode),o=o.sibling}}function nr(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ov(o,a.alternate,a),a=a.sibling}function So(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:Br(4,a,a.return),So(a);break;case 1:Ps(a,a.return);var f=a.stateNode;typeof f.componentWillUnmount=="function"&&tv(a,a.return,f),So(a);break;case 27:Fn&&pb(a.stateNode);case 26:case 5:Ps(a,a.return),So(a);break;case 22:a.memoizedState===null&&So(a);break;case 30:So(a);break;default:So(a)}o=o.sibling}}function ir(o,a,f){for(f=f&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var x=a.alternate,M=o,E=a,F=E.flags;switch(E.tag){case 0:case 11:case 15:ir(M,E,f),yc(4,E);break;case 1:if(ir(M,E,f),x=E,M=x.stateNode,typeof M.componentDidMount=="function")try{M.componentDidMount()}catch(Ae){Yt(x,x.return,Ae)}if(x=E,M=x.updateQueue,M!==null){var J=x.stateNode;try{var ce=M.shared.hiddenCallbacks;if(ce!==null)for(M.shared.hiddenCallbacks=null,M=0;M<ce.length;M++)nh(ce[M],J)}catch(Ae){Yt(x,x.return,Ae)}}f&&F&64&&ev(E),vc(E,E.return);break;case 27:Fn&&rv(E);case 26:case 5:ir(M,E,f),f&&x===null&&F&4&&nv(E),vc(E,E.return);break;case 12:ir(M,E,f);break;case 31:ir(M,E,f),f&&F&4&&lv(M,E);break;case 13:ir(M,E,f),f&&F&4&&cv(M,E);break;case 22:E.memoizedState===null&&ir(M,E,f),vc(E,E.return);break;case 30:break;default:ir(M,E,f)}a=a.sibling}}function Fm(o,a){var f=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==f&&(o!=null&&o.refCount++,f!=null&&P(f))}function Nm(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&P(o))}function us(o,a,f,x){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)fv(o,a,f,x),a=a.sibling}function fv(o,a,f,x){var M=a.flags;switch(a.tag){case 0:case 11:case 15:us(o,a,f,x),M&2048&&yc(9,a);break;case 1:us(o,a,f,x);break;case 3:us(o,a,f,x),M&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&P(o)));break;case 12:if(M&2048){us(o,a,f,x),o=a.stateNode;try{var E=a.memoizedProps,F=E.id,J=E.onPostCommit;typeof J=="function"&&J(F,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(ce){Yt(a,a.return,ce)}}else us(o,a,f,x);break;case 31:us(o,a,f,x);break;case 13:us(o,a,f,x);break;case 23:break;case 22:E=a.stateNode,F=a.alternate,a.memoizedState!==null?E._visibility&2?us(o,a,f,x):bc(o,a):E._visibility&2?us(o,a,f,x):(E._visibility|=2,La(o,a,f,x,(a.subtreeFlags&10256)!==0||!1)),M&2048&&Fm(F,a);break;case 24:us(o,a,f,x),M&2048&&Nm(a.alternate,a);break;default:us(o,a,f,x)}}function La(o,a,f,x,M){for(M=M&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var E=o,F=a,J=f,ce=x,Ae=F.flags;switch(F.tag){case 0:case 11:case 15:La(E,F,J,ce,M),yc(8,F);break;case 23:break;case 22:var Ve=F.stateNode;F.memoizedState!==null?Ve._visibility&2?La(E,F,J,ce,M):bc(E,F):(Ve._visibility|=2,La(E,F,J,ce,M)),M&&Ae&2048&&Fm(F.alternate,F);break;case 24:La(E,F,J,ce,M),M&&Ae&2048&&Nm(F.alternate,F);break;default:La(E,F,J,ce,M)}a=a.sibling}}function bc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var f=o,x=a,M=x.flags;switch(x.tag){case 22:bc(f,x),M&2048&&Fm(x.alternate,x);break;case 24:bc(f,x),M&2048&&Nm(x.alternate,x);break;default:bc(f,x)}a=a.sibling}}function Eo(o,a,f){if(o.subtreeFlags&$a)for(o=o.child;o!==null;)dv(o,a,f),o=o.sibling}function dv(o,a,f){switch(o.tag){case 26:if(Eo(o,a,f),o.flags&$a)if(o.memoizedState!==null)Vw(f,ds,o.memoizedState,o.memoizedProps);else{var x=o.stateNode,M=o.type;o=o.memoizedProps,((a&335544128)===a||ng(M,o))&&Zv(f,x,M,o)}break;case 5:Eo(o,a,f),o.flags&$a&&(x=o.stateNode,M=o.type,o=o.memoizedProps,((a&335544128)===a||ng(M,o))&&Zv(f,x,M,o));break;case 3:case 4:hs?(x=ds,ds=rg(o.stateNode.containerInfo),Eo(o,a,f),ds=x):Eo(o,a,f);break;case 22:o.memoizedState===null&&(x=o.alternate,x!==null&&x.memoizedState!==null?(x=$a,$a=16777216,Eo(o,a,f),$a=x):Eo(o,a,f));break;default:Eo(o,a,f)}}function pv(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}
4145function Ac(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var f=0;f<a.length;f++){var x=a[f];Hn=x,gv(x,o)}pv(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)mv(o),o=o.sibling}function mv(o){switch(o.tag){case 0:case 11:case 15:Ac(o),o.flags&2048&&Br(9,o,o.return);break;case 3:Ac(o);break;case 12:Ac(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,gh(o)):Ac(o);break;default:Ac(o)}}function gh(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var f=0;f<a.length;f++){var x=a[f];Hn=x,gv(x,o)}pv(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:Br(8,a,a.return),gh(a);break;case 22:f=a.stateNode,f._visibility&2&&(f._visibility&=-3,gh(a));break;default:gh(a)}o=o.sibling}}function gv(o,a){for(;Hn!==null;){var f=Hn;switch(f.tag){case 0:case 11:case 15:Br(8,f,a);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var x=f.memoizedState.cachePool.pool;x!=null&&x.refCount++}break;case 24:P(f.memoizedState.cache)}if(x=f.child,x!==null)x.return=f,Hn=x;else e:for(f=o;Hn!==null;){x=Hn;var M=x.sibling,E=x.return;if(av(x),x===f){Hn=null;break e}if(M!==null){M.return=E,Hn=M;break e}Hn=E}}}function Om(o){var a=CC(o);if(a!=null){if(typeof a.memoizedProps["data-testname"]!="string")throw Error(i(364));return a}if(o=GC(o),o===null)throw Error(i(362));return o.stateNode.current}function Um(o,a){var f=o.tag;switch(a.$$typeof){case Oh:if(o.type===a.value)return!0;break;case Uh:e:{for(a=a.value,o=[o,0],f=0;f<o.length;){var x=o[f++],M=x.tag,E=o[f++],F=a[E];if(M!==5&&M!==26&&M!==27||!Tc(x)){for(;F!=null&&Um(x,F);)E++,F=a[E];if(E===a.length){a=!0;break e}else for(x=x.child;x!==null;)o.push(x,E),x=x.sibling}}a=!1}return a;case Gh:if((f===5||f===26||f===27)&&zC(o.stateNode,a.value))return!0;break;case Hh:if((f===5||f===6||f===26||f===27)&&(o=HC(o),o!==null&&0<=o.indexOf(a.value)))return!0;break;case kh:if((f===5||f===26||f===27)&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===a.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Gm(o){switch(o.$$typeof){case Oh:return"<"+(p(o.value)||"Unknown")+">";case Uh:return":has("+(Gm(o)||"")+")";case Gh:return'[role="'+o.value+'"]';case Hh:return'"'+o.value+'"';case kh:return'[data-testname="'+o.value+'"]';default:throw Error(i(365))}}function xv(o,a){var f=[];o=[o,0];for(var x=0;x<o.length;){var M=o[x++],E=M.tag,F=o[x++],J=a[F];if(E!==5&&E!==26&&E!==27||!Tc(M)){for(;J!=null&&Um(M,J);)F++,J=a[F];if(F===a.length)f.push(M);else for(M=M.child;M!==null;)o.push(M,F),M=M.sibling}}return f}function km(o,a){if(!Ec)throw Error(i(363));o=Om(o),o=xv(o,a),a=[],o=Array.from(o);for(var f=0;f<o.length;){var x=o[f++],M=x.tag;if(M===5||M===26||M===27)Tc(x)||a.push(x.stateNode);else for(x=x.child;x!==null;)o.push(x),x=x.sibling}return a}function Li(){return(Lt&2)!==0&&Ot!==0?Ot&-Ot:dt.T!==null?Oe():RC()}function _v(){if(ki===0)if((Ot&536870912)===0||kt){var o=Sh;Sh<<=1,(Sh&3932160)===0&&(Sh=262144),ki=o}else ki=536870912;return o=Ui.current,o!==null&&(o.flags|=32),ki}function bi(o,a,f){(o===ln&&(tn===2||tn===9)||o.cancelPendingCommit!==null)&&(Da(o,0),Pr(o,Ot,ki,!1)),R(o,f),((Lt&2)===0||o!==ln)&&(o===ln&&((Lt&2)===0&&(Fo|=f),yn===4&&Pr(o,Ot,ki,!1)),he(o))}function yv(o,a,f){if((Lt&6)!==0)throw Error(i(327));var x=!f&&(a&127)===0&&(a&o.expiredLanes)===0||A(o,a),M=x?oC(o,a):zm(o,a,!0),E=x;do{if(M===0){el&&!x&&Pr(o,a,0,!1);break}else{if(f=o.current.alternate,E&&!sC(f)){M=zm(o,a,!1),E=!1;continue}if(M===2){if(E=a,o.errorRecoveryDisabledLanes&E)var F=0;else F=o.pendingLanes&-536870913,F=F!==0?F:F&536870912?536870912:0;if(F!==0){a=F;e:{var J=o;M=Fc;var ce=ti&&J.current.memoizedState.isDehydrated;if(ce&&(Da(J,F).flags|=256),F=zm(J,F,!1),F!==2){if(Mg&&!ce){J.errorRecoveryDisabledLanes|=E,Fo|=E,M=4;break e}E=Si,Si=M,E!==null&&(Si===null?Si=E:Si.push.apply(Si,E))}M=F}if(E=!1,M!==2)continue}}if(M===1){Da(o,0),Pr(o,a,0,!0);break}e:{switch(x=o,E=M,E){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Pr(x,a,ki,!Gr);break e;case 2:Si=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(M=zh+300-Ai(),10<M)){if(Pr(x,a,ki,!Gr),y(x,0,!0)!==0)break e;hr=a,x.timeoutHandle=EC(vv.bind(null,x,f,Si,Vh,Eg,a,ki,Fo,tl,Gr,E,"Throttled",-0,0),M);break e}vv(x,f,Si,Vh,Eg,a,ki,Fo,tl,Gr,E,null,-0,0)}}break}while(!0);he(o)}function vv(o,a,f,x,M,E,F,J,ce,Ae,Ve,Ie,nt,Tt){if(o.timeoutHandle=Co,Ie=a.subtreeFlags,Ie&8192||(Ie&16785408)===16785408){Ie
vendor: 16,773 bytes, line 4145
4145=DC(),dv(a,E,Ie);var Bn=(E&62914560)===E?zh-Ai():(E&4194048)===E?Eb-Ai():0;if(Bn=FC(Ie,Bn),Bn!==null){hr=E,o.cancelPendingCommit=Bn(Rv.bind(null,o,a,E,f,x,M,F,J,ce,Ve,Ie,null,nt,Tt)),Pr(o,E,F,!Ae);return}}Rv(o,a,E,f,x,M,F,J,ce)}function sC(o){for(var a=o;;){var f=a.tag;if((f===0||f===11||f===15)&&a.flags&16384&&(f=a.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var x=0;x<f.length;x++){var M=f[x],E=M.getSnapshot;M=M.value;try{if(!Oi(E(),M))return!1}catch{return!1}}if(f=a.child,a.subtreeFlags&16384&&f!==null)f.return=a,a=f;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Pr(o,a,f,x){a&=~Sg,a&=~Fo,o.suspendedLanes|=a,o.pingedLanes&=~a,x&&(o.warmLanes|=a),x=o.expirationTimes;for(var M=a;0<M;){var E=31-Fi(M),F=1<<E;x[E]=-1,M&=~F}f!==0&&w(o,f,a)}function bv(){return(Lt&6)===0?(ve(0),!1):!0}function Hm(){if(Dt!==null){if(tn===0)var o=Dt.return;else o=Dt,ar=Ro=null,Xt(o),Ya=null,Bc=0,o=Dt;for(;o!==null;)$y(o.alternate,o),o=o.return;Dt=null}}function Da(o,a){var f=o.timeoutHandle;f!==Co&&(o.timeoutHandle=Co,TC(f)),f=o.cancelPendingCommit,f!==null&&(o.cancelPendingCommit=null,f()),hr=0,Hm(),ln=o,Dt=f=sr(o.current,null),Ot=a,tn=0,Gi=null,Gr=!1,el=A(o,a),Mg=!1,tl=ki=Sg=Fo=kr=yn=0,Si=Fc=null,Eg=!1,(a&8)!==0&&(a|=a&32);var x=o.entangledLanes;if(x!==0)for(o=o.entanglements,x&=a;0<x;){var M=31-Fi(x),E=1<<M;a|=o[M],x&=~E}return ur=a,wr(),f}function Av(o,a){Ct=null,dt.H=Lc,a===Ja||a===Ph?(a=ot(),tn=3):a===mg?(a=ot(),tn=4):tn=a===vg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Gi=a,Dt===null&&(yn=1,lh(o,Q(a,o.current)))}function Mv(){var o=Ui.current;return o===null?!0:(Ot&4194048)===Ot?fs===null:(Ot&62914560)===Ot||(Ot&536870912)!==0?o===fs:!1}function Sv(){var o=dt.H;return dt.H=Lc,o===null?Lc:o}function Ev(){var o=dt.A;return dt.A=sR,o}function xh(){yn=4,Gr||(Ot&4194048)!==Ot&&Ui.current!==null||(el=!0),(kr&134217727)===0&&(Fo&134217727)===0||ln===null||Pr(ln,Ot,ki,!1)}function zm(o,a,f){var x=Lt;Lt|=2;var M=Sv(),E=Ev();(ln!==o||Ot!==a)&&(Vh=null,Da(o,a)),a=!1;var F=yn;e:do try{if(tn!==0&&Dt!==null){var J=Dt,ce=Gi;switch(tn){case 8:Hm(),F=6;break e;case 3:case 2:case 9:case 6:Ui.current===null&&(a=!0);var Ae=tn;if(tn=0,Gi=null,Fa(o,J,ce,Ae),f&&el){F=0;break e}break;default:Ae=tn,tn=0,Gi=null,Fa(o,J,ce,Ae)}}rC(),F=yn;break}catch(Ve){Av(o,Ve)}while(!0);return a&&o.shellSuspendCounter++,ar=Ro=null,Lt=x,dt.H=M,dt.A=E,Dt===null&&(ln=null,Ot=0,wr()),F}function rC(){for(;Dt!==null;)Tv(Dt)}function oC(o,a){var f=Lt;Lt|=2;var x=Sv(),M=Ev();ln!==o||Ot!==a?(Vh=null,Nc=Ai()+500,Da(o,a)):el=A(o,a);e:do try{if(tn!==0&&Dt!==null){a=Dt;var E=Gi;t:switch(tn){case 1:tn=0,Gi=null,Fa(o,a,E,1);break;case 2:case 9:if(Ye(E)){tn=0,Gi=null,Cv(a);break}a=function(){tn!==2&&tn!==9||ln!==o||(tn=7),he(o)},E.then(a,a);break e;case 3:tn=7;break e;case 4:tn=5;break e;case 7:Ye(E)?(tn=0,Gi=null,Cv(a)):(tn=0,Gi=null,Fa(o,a,E,7));break;case 5:var F=null;switch(Dt.tag){case 26:F=Dt.memoizedState;case 5:case 27:var J=Dt,ce=J.type,Ae=J.pendingProps;if(F?fb(F):qv(J.stateNode,ce,Ae)){tn=0,Gi=null;var Ve=J.sibling;if(Ve!==null)Dt=Ve;else{var Ie=J.return;Ie!==null?(Dt=Ie,_h(Ie)):Dt=null}break t}}tn=0,Gi=null,Fa(o,a,E,5);break;case 6:tn=0,Gi=null,Fa(o,a,E,6);break;case 8:Hm(),yn=6;break e;default:throw Error(i(462))}}aC();break}catch(nt){Av(o,nt)}while(!0);return ar=Ro=null,dt.H=x,dt.A=M,Lt=f,Dt!==null?0:(ln=null,Ot=0,wr(),yn)}function aC(){for(;Dt!==null&&!Jw();)Tv(Dt)}function Tv(o){var a=Yy(o.alternate,o,ur);o.memoizedProps=o.pendingProps,a===null?_h(o):Dt=a}function Cv(o){var a=o,f=a.alternate;switch(a.tag){case 15:case 0:a=zy(f,a,a.pendingProps,a.type,void 0,Ot);break;case 11:a=zy(f,a,a.pendingProps,a.type.render,a.ref,Ot);break;case 5:Xt(a);default:$y(f,a),a=Dt=Ov(a,ur),a=Yy(f,a,ur)}o.memoizedProps=o.pendingProps,a===null?_h(o):Dt=a}function Fa(o,a,f,x){ar=Ro=null,Xt(a),Ya=null,Bc=0;var M=a.return;try{if(ZT(o,M,a,f,Ot)){yn=1,lh(o,Q(f,o.current)),Dt=null;return}}catch(E){if(M!==null)throw Dt=M,E;yn=1,lh(o,Q(f,o.current)),Dt=null;return}a.flags&32768?(kt||x===1?o=!0:el||(Ot&536870912)!==0?o=!1:(Gr=o=!0,(x===2||x===9||x===3||x===6)&&(x=Ui.current,x!==null&&x.tag===13&&(x.flags|=16384))),wv(a,o)):_h(a)}function _h(o){var a=o;do{if((a.flags&32768)!==0){wv(a,Gr);return}o=a.return;var f=eC(a.alternate,a,ur);if(f!==null){Dt=f;return}if(a=a.sibling,a!==null){Dt=a;return}Dt=a=o}while(a!==null);yn===0&&(yn=5)}function wv(o,a){do{var f=tC(o.alternate,o);if(f!==null){f.flags&=32767,Dt=f;return}if(f=o.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!a&&(o=o.sibling,o!==null)){Dt=o;return}Dt=o=f}while(o!==null);yn=6,Dt=null}function Rv(o,a,f,x,M,E,F,J,ce){o.cancelPendingCommit=null;do Mc();while(Nn!==0);if((Lt&6)!==0)throw Error(i(327));if(a!==null){if(a===o.current)throw Error(i(177));if(E=a.lanes|a.childLanes,E|=gg,L(o,f,E,F,J,ce),o===ln&&(Dt=ln=null,Ot=0),nl=a,zr=o,hr=f,Tg=E,Cg=M,Tb=x,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,hC(lg,function(){return Dv(),null})):(o.callbackNode=null,o.callbackPriority=0),x=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||x){x=dt.T,dt.T=null,M=or(),kn(2),F=Lt,Lt|=4;try{nC(o,a,f)}finally{Lt=F,kn(M),dt.T=x}}Nn=1,Iv(),Bv(),Pv()}}function Iv(){if(Nn===1){Nn=0;var o=zr,a=nl,f=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||f){f=dt.T,dt.T=null;var x=or();kn(2);var M=Lt;Lt|=4;try{uv(a,o),MC(o.containerInfo)}finally{Lt=M,kn(x),dt.T=f}}o.current=a,Nn=2}}function Bv(){if(Nn===2){Nn=0;var o=zr,a=nl,f=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||f){f=dt.T,dt.T=null;var x=or();kn(2);var M=Lt;Lt|=4;try{ov(o,a.alternate,a)}finally{Lt=M,kn(x),dt.T=f}}Nn=3}}function Pv(){if(Nn===4||Nn===3){Nn=0,Yw();var o=zr,a=nl,f=hr,x=Tb;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Nn=5:(Nn=0,nl=zr=null,Lv(o,o.pendingLanes));var M=o.pendingLanes;if(M===0&&(Hr=null),z(f),a=a.stateNode,Ni&&typeof Ni.onCommitFiberRoot=="function")try{Ni.onCommitFiberRoot(Cc,a,void 0,(a.current.flags&128)===128)}catch{}if(x!==null){a=dt.T,M=or(),kn(2),dt.T=null;try{for(var E=o.onRecoverableError,F=0;F<x.length;F++){var J=x[F];E(J.value,{componentStack:J.stack})}}finally{dt.T=a,kn(M)}}(hr&3)!==0&&Mc(),he(o),M=o.pendingLanes,(f&261930)!==0&&(M&42)!==0?o===wg?Oc++:(Oc=0,wg=o):Oc=0,ti&&Pw(),ve(0)}}function Lv(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,P(a)))}function Mc(){return Iv(),Bv(),Pv(),Dv()}function Dv(){if(Nn!==5)return!1;var o=zr,a=Tg;Tg=0;var f=z(hr),x=32>f?32:f;f=dt.T;var M=or();try{kn(x),dt.T=null,x=Cg,Cg=null;var E=zr,F=hr;if(Nn=0,nl=zr=null,hr=0,(Lt&6)!==0)throw Error(i(331));var J=Lt;if(Lt|=4,mv(E.current),fv(E,E.current,F,x),Lt=J,ve(0,!1),Ni&&typeof Ni.onPostCommitFiberRoot=="function")try{Ni.onPostCommitFiberRoot(Cc,E)}catch{}return!0}finally{kn(M),dt.T=f,Lv(o,a)}}function Fv(o,a,f){a=Q(f,a),a=vm(o.stateNode,a,2),o=rs(o,a,2),o!==null&&(R(o,2),he(o))}function Yt(o,a,f){if(o.tag===3)Fv(o,o,f);else for(;a!==null;){if(a.tag===3){Fv(a,o,f);break}else if(a.tag===1){var x=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(Hr===null||!Hr.has(x))){o=Q(f,o),f=Dy(2),x=rs(a,f,2),x!==null&&(Fy(f,x,a,o),R(x,2),he(x));break}}a=a.return}}function Vm(o,a,f){var x=o.pingCache;if(x===null){x=o.pingCache=new rR;var M=new Set;x.set(a,M)}else M=x.get(a),M===void 0&&(M=new Set,x.set(a,M));M.has(f)||(Mg=!0,M.add(f),o=lC.bind(null,o,a,f),a.then(o,o))}function lC(o,a,f){var x=o.pingCache;x!==null&&x.delete(a),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,ln===o&&(Ot&f)===f&&(yn===4||yn===3&&(Ot&62914560)===Ot&&300>Ai()-zh?(Lt&2)===0&&Da(o,0):Sg|=f,tl===Ot&&(tl=0)),he(o)}function Nv(o,a){a===0&&(a=T()),o=Cs(o,a),o!==null&&(R(o,a),he(o))}function cC(o){var a=o.memoizedState,f=0;a!==null&&(f=a.retryLane),Nv(o,f)}function uC(o,a){var f=0;switch(o.tag){case 31:case 13:var x=o.stateNode,M=o.memoizedState;M!==null&&(f=M.retryLane);break;case 19:x=o.stateNode;break;case 22:x=o.stateNode._retryCache;break;default:throw Error(i(314))}x!==null&&x.delete(a),Nv(o,f)}function hC(o,a){return Th(o,a)}function fC(o,a,f,x){this.tag=o,this.key=f,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=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function sr(o,a){var f=o.alternate;return f===null?(f=t(o.tag,a,o.key,o.mode),f.elementType=o.elementType,f.type=o.type,f.stateNode=o.stateNode,f.alternate=o,o.alternate=f):(f.pendingProps=a,f.type=o.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=o.flags&65011712,f.childLanes=o.childLanes,f.lanes=o.lanes,f.child=o.child,f.memoizedProps=o.memoizedProps,f.memoizedState=o.memoizedState,f.updateQueue=o.updateQueue,a=o.dependencies,f.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},f.sibling=o.sibling,f.index=o.index,f.ref=o.ref,f.refCleanup=o.refCleanup,f}function Ov(o,a){o.flags&=65011714;var f=o.alternate;return f===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=f.childLanes,o.lanes=f.lanes,o.child=f.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=f.memoizedProps,o.memoizedState=f.memoizedState,o.updateQueue=f.updateQueue,o.type=f.type,a=f.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function yh(o,a,f,x,M,E){var F=0;if(x=o,typeof o=="function")Wm(o)&&(F=1);else if(typeof o=="string")F=hs&&Fn?ob(o,f,Jn.current)?26:mb(o)?27:5:hs?ob(o,f,Jn.current)?26:5:Fn&&mb(o)?27:5;else e:switch(o){case eg:return o=t(31,f,a,M),o.elementType=eg,o.lanes=E,o;case Oa:return To(f.children,M,E,a);case Wv:F=8,M|=24;break;case Km:return o=t(12,f,a,M|2),o.elementType=Km,o.lanes=E,o;case Zm:return o=t(13,f,a,M),o.elementType=Zm,o.lanes=E,o;case Qm:return o=t(19,f,a,M),o.elementType=Qm,o.lanes=E,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case Lr:F=10;break e;case jv:F=9;break e;case qm:F=11;break e;case $m:F=14;break e;case Dr:F=16,x=null;break e}F=29,f=Error(i(130,o===null?"null":typeof o,"")),x=null}return a=t(F,f,a,M),a.elementType=o,a.type=x,a.lanes=E,a}function To(o,a,f,x){return o=t(7,o,x,a),o.lanes=f,o}function jm(o,a,f){return o=t(6,o,null,a),o.lanes=f,o}function Uv(o){var a=t(18,null,null,0);return a.stateNode=o,a}function Xm(o,a,f){return a=t(4,o.children!==null?o.children:[],o.key,a),a.lanes=f,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function dC(o,a,f,x,M,E,F,J,ce){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Co,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=B(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=B(0),this.hiddenUpdates=B(null),this.identifierPrefix=x,this.onUncaughtError=M,this.onCaughtError=E,this.onRecoverableError=F,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ce,this.incompleteTransitions=new Map}function Gv(o,a,f,x,M,E,F,J,ce,Ae,Ve,Ie){return o=new dC(o,a,f,F,ce,Ae,Ve,Ie,J),a=1,E===!0&&(a|=24),E=t(3,null,null,a),o.current=E,E.stateNode=o,a=U(),a.refCount++,o.pooledCache=a,a.refCount++,E.memoizedState={element:x,isDehydrated:f,cache:a},Ra(E),o}function kv(o){return o?(o=Ha,o):Ha}function Hv(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(i(188)):(o=Object.keys(o).join(","),Error(i(268,o)));return o=c(a),o=o!==null?u(o):null,o===null?null:Sc(o.stateNode)}function zv(o,a,f,x,M,E){M=kv(M),x.context===null?x.context=M:x.pendingContext=M,x=Pi(a),x.payload={element:f},E=E===void 0?null:E,E!==null&&(x.callback=E),f=rs(o,x,a),f!==null&&(bi(f,o,a),Rs(f,o,a))}function Vv(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var f=o.retryLane;o.retryLane=f!==0&&f<a?f:a}}function Jm(o,a){Vv(o,a),(o=o.alternate)&&Vv(o,a)}var Pt={},pC=_E,Di=uO,Ym=Object.assign,mC=Symbol.for("react.element"),vh=Symbol.for("react.transitional.element"),Na=Symbol.for("react.portal"),Oa=Symbol.for("react.fragment"),Wv=Symbol.for("react.strict_mode"),Km=Symbol.for("react.profiler"),jv=Symbol.for("react.consumer"),Lr=Symbol.for("react.context"),qm=Symbol.for("react.forward_ref"),Zm=Symbol.for("react.suspense"),Qm=Symbol.for("react.suspense_list"),$m=Symbol.for("react.memo"),Dr=Symbol.for("react.lazy"),eg=Symbol.for("react.activity"),gC=Symbol.for("react.memo_cache_sentinel"),Xv=Symbol.iterator,xC=Symbol.for("react.client.reference"),bh=Array.isArray,dt=pC.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_C=e.rendererVersion,yC=e.rendererPackageName,Jv=e.extraDevToolsConfig,Sc=e.getPublicInstance,vC=e.getRootHostContext,bC=e.getChildHostContext,AC=e.prepareForCommit,MC=e.resetAfterCommit,SC=e.createInstance;e.cloneMutableInstance;var tg=e.appendInitialChild,Yv=e.finalizeInitialChildren,Ah=e.shouldSetTextContent,Kv=e.createTextInstance;e.cloneMutableTextInstance;var EC=e.scheduleTimeout,TC=e.cancelTimeout,Co=e.noTimeout,rr=e.isPrimaryRenderer;e.warnsIfNotActing;var ei=e.supportsMutation,Ls=e.supportsPersistence,ti=e.supportsHydration,CC=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var wC=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var kn=e.setCurrentUpdatePriority,or=e.getCurrentUpdatePriority,RC=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var IC=e.shouldAttemptEagerTransition,BC=e.detachDeletedInstance;e.requestPostPaintCallback;var PC=e.maySuspendCommit,LC=e.maySuspendCommitOnUpdate,ng=e.maySuspendCommitInSyncRender,qv=e.preloadInstance,DC=e.startSuspendingCommit,Zv=e.suspendInstance;e.suspendOnActiveViewTransition;var FC=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Ua=e.NotPendingTransition,wo=e.HostTransitionContext,NC=e.resetFormInstance;e.bindToConsole;var OC=e.supportsMicrotasks,UC=e.scheduleMicrotask,Ec=e.supportsTestSelectors,GC=e.findFiberRoot,kC=e.getBoundingRect,HC=e.getTextContent,Tc=e.isHiddenSubtree,zC=e.matchAccessibilityRole,VC=e.setFocusIfFocusable,WC=e.setupIntersectionObserver,jC=e.appendChild,XC=e.appendChildToContainer,JC=e.commitTextUpdate,YC=e.commitMount,KC=e.commitUpdate,qC=e.insertBefore,ZC=e.insertInContainerBefore,QC=e.removeChild,$C=e.removeChildFromContainer,Qv=e.resetTextContent,ew=e.hideInstance,tw=e.hideTextInstance,nw=e.unhideInstance,iw=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var sw=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var rw=e.cloneInstance,$v=e.createContainerChildSet,eb=e.appendChildToContainerChildSet,ow=e.finalizeContainerChildren,tb=e.replaceContainerChildren,nb=e.cloneHiddenInstance,ib=e.cloneHiddenTextInstance,ig=e.isSuspenseInstancePending,sg=e.isSuspenseInstanceFallback,aw=e.getSuspenseInstanceFallbackErrorDetails,lw=e.registerSuspenseInstanceRetry,cw=e.canHydrateFormStateMarker,uw=e.isFormStateMarkerMatching,sb=e.getNextHydratableSibling,hw=e.getNextHydratableSiblingAfterSingleton,fw=e.getFirstHydratableChild,dw=e.getFirstHydratableChildWithinContainer,pw=e.getFirstHydratableChildWithinActivityInstance,mw=e.getFirstHydratableChildWithinSuspenseInstance,gw=e.getFirstHydratableChildWithinSingleton,xw=e.canHydrateInstance,_w=e.canHydrateTextInstance,yw=e.canHydrateActivityInstance,vw=e.canHydrateSuspenseInstance,bw=e.hydrateInstance,Aw=e.hydrateTextInstance,Mw=e.hydrateActivityInstance,Sw=e.hydrateSuspenseInstance,Ew=e.getNextHydratableInstanceAfterActivityInstance,Tw=e.getNextHydratableInstanceAfterSuspenseInstance,Cw=e.commitHydratedInstance,ww=e.commitHydratedContainer,Rw=e.commitHydratedActivityInstance,Iw=e.commitHydratedSuspenseInstance,Bw=e.finalizeHydratedChildren,Pw=e.flushHydrationEvents;e.clearActivityBoundary;var Lw=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Dw=e.clearSuspenseBoundaryFromContainer,Fw=e.hideDehydratedBoundary,Nw=e.unhideDehydratedBoundary,rb
4145=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var Ow=e.validateHydratableInstance,Uw=e.validateHydratableTextInstance,hs=e.supportsResources,ob=e.isHostHoistableType,rg=e.getHoistableRoot,ab=e.getResource,lb=e.acquireResource,cb=e.releaseResource,Gw=e.hydrateHoistable,ub=e.mountHoistable,hb=e.unmountHoistable,kw=e.createHoistableInstance,Hw=e.prepareToCommitHoistables,zw=e.mayResourceSuspendCommit,fb=e.preloadResource,Vw=e.suspendResource,Fn=e.supportsSingletons,db=e.resolveSingletonInstance,Ww=e.acquireSingletonInstance,pb=e.releaseSingletonInstance,mb=e.isHostSingletonType,Ga=e.isSingletonScope,og=[],ka=-1,Ha={},Fi=Math.clz32?Math.clz32:b,jw=Math.log,Xw=Math.LN2,Mh=256,Sh=262144,Eh=4194304,Th=Di.unstable_scheduleCallback,ag=Di.unstable_cancelCallback,Jw=Di.unstable_shouldYield,Yw=Di.unstable_requestPaint,Ai=Di.unstable_now,gb=Di.unstable_ImmediatePriority,Kw=Di.unstable_UserBlockingPriority,lg=Di.unstable_NormalPriority,qw=Di.unstable_IdlePriority,Zw=Di.log,Qw=Di.unstable_setDisableYieldValue,Cc=null,Ni=null,Oi=typeof Object.is=="function"?Object.is:Y,xb=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},$w=Object.prototype.hasOwnProperty,cg,_b,ug=!1,yb=new WeakMap,za=[],Va=0,Ch=null,wc=0,Ki=[],qi=0,Fr=null,Ds=1,Fs="",Jn=m(null),Rc=m(null),Nr=m(null),wh=m(null),Yn=null,pn=null,kt=!1,Or=null,Zi=!1,hg=Error(i(519)),Rh=m(null),Ro=null,ar=null,eR=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(f,x){o.push(x)}};this.abort=function(){a.aborted=!0,o.forEach(function(f){return f()})}},tR=Di.unstable_scheduleCallback,nR=Di.unstable_NormalPriority,mn={$$typeof:Lr,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Ih=null,Wa=null,fg=!1,Bh=!1,dg=!1,Io=0,Ic=null,pg=0,ja=0,Xa=null,vb=dt.S;dt.S=function(o,a){Eb=Ai(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Ne(o,a),vb!==null&&vb(o,a)};var Bo=m(null),Ja=Error(i(460)),mg=Error(i(474)),Ph=Error(i(542)),Lh={then:function(){}},Po=null,Ya=null,Bc=0,Lo=Bi(!0),bb=Bi(!1),Qi=[],Ka=0,gg=0,Ur=!1,xg=!1,qa=m(null),Dh=m(0),Ui=m(null),fs=null,Mn=m(0),lr=0,Ct=null,rn=null,Cn=null,Fh=!1,Za=!1,Do=!1,Nh=0,Pc=0,Qa=null,iR=0,Lc={readContext:it,use:Ke,useCallback:Se,useContext:Se,useEffect:Se,useImperativeHandle:Se,useLayoutEffect:Se,useInsertionEffect:Se,useMemo:Se,useReducer:Se,useRef:Se,useState:Se,useDebugValue:Se,useDeferredValue:Se,useTransition:Se,useSyncExternalStore:Se,useId:Se,useHostTransitionStatus:Se,useFormState:Se,useActionState:Se,useOptimistic:Se,useMemoCache:Se,useCacheRefresh:Se};Lc.useEffectEvent=Se;var Ab={readContext:it,use:Ke,useCallback:function(o,a){return Bt().memoizedState=[o,a===void 0?null:a],o},useContext:it,useEffect:my,useImperativeHandle:function(o,a,f){f=f!=null?f.concat([o]):null,rh(4194308,4,yy.bind(null,a,o),f)},useLayoutEffect:function(o,a){return rh(4194308,4,o,a)},useInsertionEffect:function(o,a){rh(4,2,o,a)},useMemo:function(o,a){var f=Bt();a=a===void 0?null:a;var x=o();if(Do){X(!0);try{o()}finally{X(!1)}}return f.memoizedState=[x,a],x},useReducer:function(o,a,f){var x=Bt();if(f!==void 0){var M=f(a);if(Do){X(!0);try{f(a)}finally{X(!1)}}}else M=a;return x.memoizedState=x.baseState=M,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:M},x.queue=o,o=o.dispatch=qT.bind(null,Ct,o),[x.memoizedState,o]}
vendor: 4,182 bytes, line 4145
4145,useRef:function(o){var a=Bt();return o={current:o},a.memoizedState=o},useState:function(o){o=Bs(o);var a=o.queue,f=wy.bind(null,Ct,a);return a.dispatch=f,[o.memoizedState,f]},useDebugValue:mm,useDeferredValue:function(o,a){var f=Bt();return gm(f,o,a)},useTransition:function(){var o=Bs(!1);return o=Sy.bind(null,Ct,o.queue,!0,!1),Bt().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,f){var x=Ct,M=Bt();if(kt){if(f===void 0)throw Error(i(407));f=f()}else{if(f=a(),ln===null)throw Error(i(349));(Ot&127)!==0||Zt(x,a,f)}M.memoizedState=f;var E={value:f,getSnapshot:a};return M.queue=E,my(os.bind(null,x,E,o),[o]),x.flags|=2048,Pa(9,{destroy:void 0},dn.bind(null,x,E,f,a),null),f},useId:function(){var o=Bt(),a=ln.identifierPrefix;if(kt){var f=Fs,x=Ds;f=(x&~(1<<32-Fi(x)-1)).toString(32)+f,a="_"+a+"R_"+f,f=Nh++,0<f&&(a+="H"+f.toString(32)),a+="_"}else f=iR++,a="_"+a+"r_"+f.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:xm,useFormState:uy,useActionState:uy,useOptimistic:function(o){var a=Bt();a.memoizedState=a.baseState=o;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=f,a=_m.bind(null,Ct,!0,f),f.dispatch=a,[o,a]},useMemoCache:Wn,useCacheRefresh:function(){return Bt().memoizedState=KT.bind(null,Ct)},useEffectEvent:function(o){var a=Bt(),f={impl:o};return a.memoizedState=f,function(){if((Lt&2)!==0)throw Error(i(440));return f.impl.apply(void 0,arguments)}}},_g={readContext:it,use:Ke,useCallback:by,useContext:it,useEffect:pm,useImperativeHandle:vy,useInsertionEffect:xy,useLayoutEffect:_y,useMemo:Ay,useReducer:jn,useRef:py,useState:function(){return jn(Et)},useDebugValue:mm,useDeferredValue:function(o,a){var f=At();return My(f,rn.memoizedState,o,a)},useTransition:function(){var o=jn(Et)[0],a=At().memoizedState;return[typeof o=="boolean"?o:_n(o),a]},useSyncExternalStore:er,useId:Ty,useHostTransitionStatus:xm,useFormState:hy,useActionState:hy,useOptimistic:function(o,a){var f=At();return mc(f,rn,o,a)},useMemoCache:Wn,useCacheRefresh:Cy};_g.useEffectEvent=gy;var Mb={readContext:it,use:Ke,useCallback:by,useContext:it,useEffect:pm,useImperativeHandle:vy,useInsertionEffect:xy,useLayoutEffect:_y,useMemo:Ay,useReducer:Yi,useRef:py,useState:function(){return Yi(Et)},useDebugValue:mm,useDeferredValue:function(o,a){var f=At();return rn===null?gm(f,o,a):My(f,rn.memoizedState,o,a)},useTransition:function(){var o=Yi(Et)[0],a=At().memoizedState;return[typeof o=="boolean"?o:_n(o),a]},useSyncExternalStore:er,useId:Ty,useHostTransitionStatus:xm,useFormState:dy,useActionState:dy,useOptimistic:function(o,a){var f=At();return rn!==null?mc(f,rn,o,a):(f.baseState=o,[o,f.queue.dispatch])},useMemoCache:Wn,useCacheRefresh:Cy};Mb.useEffectEvent=gy;var yg={enqueueSetState:function(o,a,f){o=o._reactInternals;var x=Li(),M=Pi(x);M.payload=a,f!=null&&(M.callback=f),a=rs(o,M,x),a!==null&&(bi(a,o,x),Rs(a,o,x))},enqueueReplaceState:function(o,a,f){o=o._reactInternals;var x=Li(),M=Pi(x);M.tag=1,M.payload=a,f!=null&&(M.callback=f),a=rs(o,M,x),a!==null&&(bi(a,o,x),Rs(a,o,x))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var f=Li(),x=Pi(f);x.tag=2,a!=null&&(x.callback=a),a=rs(o,x,f),a!==null&&(bi(a,o,f),Rs(a,o,f))}},vg=Error(i(461)),wn=!1,bg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},cr=!1,Rn=!1,Ag=!1,Sb=typeof WeakSet=="function"?WeakSet:Set,Hn=null,In=null,Mi=!1,ds=null,$a=8192,sR={getCacheForType:function(o){var a=it(mn),f=a.data.get(o);return f===void 0&&(f=o(),a.data.set(o,f)),f},cacheSignal:function(){return it(mn).controller.signal}},Oh=0,Uh=1,Gh=2,kh=3,Hh=4;if(typeof Symbol=="function"&&Symbol.for){var Dc=Symbol.for;Oh=Dc("selector.component"),Uh=Dc("selector.has_pseudo_class"),Gh=Dc("selector.role"),kh=Dc("selector.test_id"),Hh=Dc("selector.text")}var rR=typeof WeakMap=="function"?WeakMap:Map,Lt=0,ln=null,Dt=null,Ot=0,tn=0,Gi=null,Gr=!1,el=!1,Mg=!1,ur=0,yn=0,kr=0,Fo=0,Sg=0,ki=0,tl=0,Fc=null,Si=null,Eg=!1,zh=0,Eb=0,Nc=1/0,Vh=null,Hr=null,Nn=0,zr=null,nl=null,hr=0,Tg=0,Cg=null,Tb=null,Oc=0,wg=null;return Pt.attemptContinuousHydration=function(o){if(o.tag===13||o.tag===31){var a=Cs(o,67108864);a!==null&&bi(a,o,67108864),Jm(o,67108864)}}
4145,Pt.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13||o.tag===31){var a=Li();a=D(a);var f=Cs(o,a);f!==null&&bi(f,o,a),Jm(o,a)}},Pt.attemptSynchronousHydration=function(o){switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var a=v(o.pendingLanes);if(a!==0){for(o.pendingLanes|=2,o.entangledLanes|=2;a;){var f=1<<31-Fi(a);o.entanglements[1]|=f,a&=~f}he(o),(Lt&6)===0&&(Nc=Ai()+500,ve(0))}}break;case 31:case 13:a=Cs(o,2),a!==null&&bi(a,o,2),bv(),Jm(o,2)}},Pt.batchedUpdates=function(o,a){return o(a)},Pt.createComponentSelector=function(o){return{$$typeof:Oh,value:o}},Pt.createContainer=function(o,a,f,x,M,E,F,J,ce,Ae){return Gv(o,a,!1,null,f,x,E,null,F,J,ce,Ae)},Pt.createHasPseudoClassSelector=function(o){return{$$typeof:Uh,value:o}},Pt.createHydrationContainer=function(o,a,f,x,M,E,F,J,ce,Ae,Ve,Ie,nt,Tt){var Bn;return o=Gv(f,x,!0,o,M,E,J,Tt,ce,Ae,Ve,Ie),o.context=kv(null),f=o.current,x=Li(),x=D(x),M=Pi(x),M.callback=(Bn=a)!=null?Bn:null,rs(f,M,x),a=x,o.current.lanes=a,R(o,a),he(o),o},Pt.createPortal=function(o,a,f){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Na,key:x==null?null:""+x,children:o,containerInfo:a,implementation:f}},Pt.createRoleSelector=function(o){return{$$typeof:Gh,value:o}},Pt.createTestNameSelector=function(o){return{$$typeof:kh,value:o}},Pt.createTextSelector=function(o){return{$$typeof:Hh,value:o}},Pt.defaultOnCaughtError=function(o){console.error(o)},Pt.defaultOnRecoverableError=function(o){xb(o)},Pt.defaultOnUncaughtError=function(o){xb(o)},Pt.deferredUpdates=function(o){var a=dt.T,f=or();try{return kn(32),dt.T=null,o()}finally{kn(f),dt.T=a}},Pt.discreteUpdates=function(o,a,f,x,M){var E=dt.T,F=or();try{return kn(2),dt.T=null,o(a,f,x,M)}finally{kn(F),dt.T=E,Lt===0&&(Nc=Ai()+500)}},Pt.findAllNodes=km,Pt.findBoundingRects=function(o,a){if(!Ec)throw Error(i(363));a=km(o,a),o=[];for(var f=0;f<a.length;f++)o.push(kC(a[f]));for(a=o.length-1;0<a;a--){f=o[a];for(var x=f.x,M=x+f.width,E=f.y,F=E+f.height,J=a-1;0<=J;J--)if(a!==J){var ce=o[J],Ae=ce.x,Ve=Ae+ce.width,Ie=ce.y,nt=Ie+ce.height;if(x>=Ae&&E>=Ie&&M<=Ve&&F<=nt){o.splice(a,1);break}else if(x!==Ae||f.width!==ce.width||nt<E||Ie>F){if(!(E!==Ie||f.height!==ce.height||Ve<x||Ae>M)){Ae>x&&(ce.width+=Ae-x,ce.x=x),Ve<M&&(ce.width=M-Ae),o.splice(a,1);break}}else{Ie>E&&(ce.height+=Ie-E,ce.y=E),nt<F&&(ce.height=F-Ie),o.splice(a,1);break}}}return o},Pt.findHostInstance=Hv,Pt.findHostInstanceWithNoPortals=function(o){return o=c(o),o=o!==null?h(o):null,o===null?null:Sc(o.stateNode)},Pt.findHostInstanceWithWarning=function(o){return Hv(o)},Pt.flushPassiveEffects=Mc,Pt.flushSyncFromReconciler=function(o){var a=Lt;Lt|=1;var f=dt.T,x=or();try{if(kn(2),dt.T=null,o)return o()}finally{kn(x),dt.T=f,Lt=a,(Lt&6)===0&&ve(0)}},Pt.flushSyncWork=bv,Pt.focusWithin=function(o,a){if(!Ec)throw Error(i(363));for(o=Om(o),a=xv(o,a),a=Array.from(a),o=0;o<a.length;){var f=a[o++],x=f.tag;if(!Tc(f)){if((x===5||x===26||x===27)&&VC(f.stateNode))return!0;for(f=f.child;f!==null;)a.push(f),f=f.sibling}}return!1},Pt.getFindAllNodesFailureDescription=function(o,a){if(!Ec)throw Error(i(363));var f=0,x=[];o=[Om(o),0];for(var M=0;M<o.length;){var E=o[M++],F=E.tag,J=o[M++],ce=a[J];if((F!==5&&F!==26&&F!==27||!Tc(E))&&(Um(E,ce)&&(x.push(Gm(ce)),J++,J>f&&(f=J)),J<a.length))for(E=E.child;E!==null;)o.push(E,J),E=E.sibling}if(f<a.length){for(o=[];f<a.length;f++)o.push(Gm(a[f]));return`findAllNodes was able to match part of the selector:
4146  `+(x.join(" > ")+`
4147
4148No matching component was found for:
4149  `)+o.join(" > ")}return null},Pt.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 27:case 5:return Sc(o.child.stateNode);default:return o.child.stateNode}},Pt.injectIntoDevTools=function(){var o={bundleType:0,version:_C,rendererPackageName:yC,currentDispatcherRef:dt,reconcilerVersion:"19.2.0"};if(Jv!==null&&(o.rendererConfig=Jv),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)o=!0;else{try{Cc=a.inject(o),Ni=a}catch{}o=!!a.checkDCE}}return o},Pt.isAlreadyRendering=function(){return(Lt&6)!==0},Pt.observeVisibleRects=function(o,a,f,x){if(!Ec)throw Error(i(363));o=km(o,a);var M=WC(o,f,x).disconnect;return{disconnect:function(){M()}}},Pt.shouldError=function(){return null},Pt.shouldSuspend=function(){return!1},Pt.startHostTransition=function(o,a,f,x){if(o.tag!==5)throw Error(i(476));var M=Ey(o).queue;Sy(o,M,a,Ua,f===null?n:function(){var E=Ey(o);return E.next===null&&(E=o.alternate.memoizedState),gc(o,E.next.queue,{},Li()),f(x)})},Pt.updateContainer=function(o,a,f,x){var M=a.current,E=Li();return zv(M,E,o,a,f,x),E},Pt.updateContainerSync=function(o,a,f,x){return zv(a.current,2,o,a,f,x),2},Pt},s.exports.default=s.exports,Object.defineProperty(s.exports,"__esModule",{value:!0})}(xM)),xM.exports}var yM;function kO(){return yM||(yM=1,gM.exports=GO()),gM.exports}var HO=kO();const zO=UO(HO);function VO(s){const e=zO(s);return e.injectIntoDevTools(),e}const vT=0,rc={},WO=/^three(?=[A-Z])/,cm=s=>`${s[0].toUpperCase()}${s.slice(1)}`;let jO=0;const XO=s=>typeof s=="function";function JO(s){if(XO(s)){const e=`${jO++}`;return rc[e]=s,e}else Object.assign(rc,s)}function bT(s,e){const t=cm(s),n=rc[t];if(s!=="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(s==="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 YO(s,e,t){var n;return s=cm(s)in rc?s:s.replace(WO,""),bT(s,e),s==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,
4149yp(e.object,t,s,e)}function KO(s){if(!s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?bp(s.parent,s):pi(s.object)&&(s.object.visible=!1),s.isHidden=!0,fc(s)}}function AT(s){if(s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?vp(s.parent,s):pi(s.object)&&s.props.visible!==!1&&(s.object.visible=!0),s.isHidden=!1,fc(s)}}function J_(s,e,t){const n=e.root.getState();if(!(!s.parent&&s.object!==n.scene)){if(!e.object){var i,r;const l=rc[cm(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(r=e.props.args)!=null?r:[]),e.object.__r3f=e}if(lo(e.object,e.props),e.props.attach)vp(s,e);else if(pi(e.object)&&pi(s.object)){const l=s.object.children.indexOf(t==null?void 0:t.object);if(t&&l!==-1){const c=s.object.children.indexOf(e.object);if(c!==-1){s.object.children.splice(c,1);const u=c<l?l-1:l;s.object.children.splice(u,0,e.object)}else e.object.parent=s.object,s.object.children.splice(l,0,e.object),e.object.dispatchEvent({type:"added"}),s.object.dispatchEvent({type:"childadded",child:e.object})}else s.object.add(e.object)}for(const l of e.children)J_(e,l);fc(e)}}function M0(s,e){e&&(e.parent=s,s.children.push(e),J_(s,e))}function vM(s,e,t){if(!e||!t)return;e.parent=s;const n=s.children.indexOf(t);n!==-1?s.children.splice(n,0,e):s.children.push(e),J_(s,e,t)}function MT(s){if(typeof s.dispose=="function"){const e=()=>{try{s.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Px.unstable_scheduleCallback(Px.unstable_IdlePriority,e)}}function Dx(s,e,t){if(!e)return;e.parent=null;const n=s.children.indexOf(e);n!==-1&&s.children.splice(n,1),e.props.attach?bp(s,e):pi(e.object)&&pi(s.object)&&(s.object.remove(e.object),RO(X_(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let r=e.children.length-1;r>=0;r--){const l=e.children[r];Dx(e,l,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&MT(e.object),t===void 0&&fc(e)}function qO(s,e){for(const t of[s,s.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 Ad=[];function ZO(){for(const[t]of Ad){const n=t.parent;if(n){t.props.attach?bp(n,t):pi(t.object)&&pi(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?bp(t,i):pi(i.object)&&pi(t.object)&&t.object.remove(i.object)}t.isHidden&&AT(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&MT(t.object)}for(const[t,n,i]of Ad){t.props=n;const r=t.parent;if(r){var s,e;const l=rc[cm(t.type)],c=t.object;
4149t.object=(s=t.props.object)!=null?s:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,qO(i,t.object),wO(X_(t),c,t.object),lo(t.object,t.props),t.props.attach?vp(r,t):pi(t.object)&&pi(r.object)&&r.object.add(t.object);for(const u of t.children)u.props.attach?vp(t,u):pi(u.object)&&pi(t.object)&&t.object.add(u.object);fc(t)}}Ad.length=0}const S0=()=>{},bM={};let Nf=vT;const QO=0,$O=4,Fx=VO({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:YO,removeChild:Dx,appendChild:M0,appendInitialChild:M0,insertBefore:vM,appendChildToContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||M0(t,e)},removeChildFromContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||Dx(t,e)},insertInContainerBefore(s,e,t){const n=s.getState().scene.__r3f;!e||!t||!n||vM(n,e,t)},getRootHostContext:()=>bM,getChildHostContext:()=>bM,commitUpdate(s,e,t,n,i){var r,l,c;bT(e,n);let u=!1;if((s.type==="primitive"&&t.object!==n.object||((r=n.args)==null?void 0:r.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((d,p)=>{var m;return d!==((m=t.args)==null?void 0:m[p])}))&&(u=!0),u)Ad.push([s,{...n},i]);else{const d=SO(s,n);Object.keys(d).length&&(Object.assign(s.props,d),lo(s.object,d))}(i.sibling===null||(i.flags&$O)===QO)&&ZO()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:s=>s==null?void 0:s.object,prepareForCommit:()=>null,preparePortalMount:s=>yp(s.getState().scene,s,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:KO,unhideInstance:AT,createTextInstance:S0,hideTextInstance:S0,unhideTextInstance:S0,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:k.createContext(null),setCurrentUpdatePriority(s){Nf=s},getCurrentUpdatePriority(){return Nf},resolveUpdatePriority(){var s;if(Nf!==vT)return Nf;switch(typeof window<"u"&&((s=window.event)==null?void 0:s.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return NO;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return DO;default:return FO}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:OO.version,applyViewTransitionName(s,e,t){},restoreViewTransitionName(s,e){},cancelViewTransitionName(s,e,t){},cancelRootViewTransitionName(s){},restoreRootViewTransitionName(s){},InstanceMeasurement:null,measureInstance:s=>null,wasInstanceInViewport:s=>!0,hasInstanceChanged:(s,e)=>!1,hasInstanceAffectedParent:(s,e)=>!1,suspendOnActiveViewTransition(s,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(s){},createViewTransitionInstance:s=>null,getCurrentGestureOffset(s){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(s,e){return s},cloneMutableTextInstance(s){return s},cloneRootViewTransitionContainer(s){throw new Error("Not implemented.")},removeRootViewTransitionClone(s,e){throw new Error("Not implemented.")},createFragmentInstance:s=>null,updateFragmentInstanceFiber(s,e){},commitNewChildToFragmentInstance(s,e){},deleteChildFromFragmentInstance(s,e){},measureClonedInstance:s=>null,maySuspendCommitOnUpdate:(s,e,t)=>!1,maySuspendCommitInSyncRender:(s,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(s,e)=>null}),Ma=new Map,El={objects:"shallow",strict:!1};function eU(s,e){if(!e&&typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:t,height:n,top:i,left:r}=s.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:r}}else if(!e&&typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function tU(s){const e=Ma.get(s),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 i=typeof reportError=="function"?reportError:console.error,r=n||BO(Ux,MM),l=t||Fx.createContainer(r,LO,null,!1,null,"",i,i,i,null);e||Ma.set(s,{fiber:l,store:r});let c,u,h=!1,d=null;return{async configure(p={}){let m;d=new Promise(ae=>m=ae);let{gl:g,size:_,scene:b,events:v,onCreated:y,shadows:A=!1,linear:S=!1,flat:T=!1,legacy:B=!1,orthographic:R=!1,frameloop:L="always",dpr:w=[1,2],performance:I,raycaster:O,camera:D,onPointerMissed:z}=p,X=r.getState(),Y=X.gl;if(!X.gl){const ae={canvas:s,powerPreference:"high-performance",antialias:!0,alpha:!0},pe=typeof g=="function"?await g(ae):g;pM(pe)?Y=pe:Y=new oT({...ae,...g}),X.set({gl:Y})}let V=X.raycaster;V||X.set({raycaster:V=new Y1});const{params:H,...W}=O||{};if(un.equ(W,V,El)||lo(V,{...W}),un.equ(H,V.params,El)||lo(V,{params:{...V.params,...H}}),!X.camera||X.camera===u&&!un.equ(u,D,El)){u=D;const ae=D==null?void 0:D.isCamera,pe=ae?D:R?new Cr(0,0,0,0,.1,1e3):new En(75,0,.1,1e3);ae||(pe.position.z=5,D&&(lo(pe,D),pe.manual||("aspect"in D||"left"in D||"right"in D||"bottom"in D||"top"in D)&&(pe.manual=!0,pe.updateProjectionMatrix())),!X.camera&&!(D!=null&&D.rotation)&&pe.lookAt(0,0,0)),X.set({camera:pe}),V.camera=pe}if(!X.scene){let ae;b!=null&&b.isScene?(ae=b,yp(ae,r,"",{})):(ae=new u_,yp(ae,r,"",{}),b&&lo(ae,b)),X.set({scene:ae})}v&&!X.events.handlers&&X.set({events:v(r)});const q=eU(s,_);if(un.equ(q,X.size,El)||X.setSize(q.width,q.height,q.top,q.left),w&&X.viewport.dpr!==pT(w)&&X.setDpr(w),X.frameloop!==L&&X.setFrameloop(L),X.onPointerMissed||X.set({onPointerMissed:z}),I&&!un.equ(I,X.performance,El)&&X.set(ae=>({performance:{...ae.performance,...I}})),!X.xr){var Q;const ae=(Pe,He)=>{const le=r.getState();le.frameloop!=="never"&&MM(Pe,!0,le,He)},pe=()=>{const Pe=r.getState();Pe.gl.xr.enabled=Pe.gl.xr.isPresenting,Pe.gl.xr.setAnimationLoop(Pe.gl.xr.isPresenting?ae:null),Pe.gl.xr.isPresenting||Ux(Pe)},Ue={connect(){const Pe=r.getState().gl;Pe.xr.addEventListener("sessionstart",pe),Pe.xr.addEventListener("sessionend",pe)},disconnect(){const Pe=r.getState().gl;Pe.xr.removeEventListener("sessionstart",pe),Pe.xr.removeEventListener("sessionend",pe)}};typeof((Q=Y.xr)==null?void 0:Q.addEventListener)=="function"&&Ue.connect(),X.set({xr:Ue})}if(Y.shadowMap){const ae=Y.shadowMap.enabled,pe=Y.shadowMap.type;if(Y.shadowMap.enabled=!!A,un.boo(A))Y.shadowMap.type=_u;else if(un.str(A)){var re;const Ue={basic:AE,percentage:zl,soft:_u,variance:na};Y.shadowMap.type=(re=Ue[A])!=null?re:_u}else un.obj(A)&&Object.assign(Y.shadowMap,A);(ae!==Y.shadowMap.enabled||pe!==Y.shadowMap.type)&&(Y.shadowMap.needsUpdate=!0)}
4149return It.enabled=!B,h||(Y.outputColorSpace=S?Ql:ri,Y.toneMapping=T?ns:Tp),X.legacy!==B&&X.set(()=>({legacy:B})),X.linear!==S&&X.set(()=>({linear:S})),X.flat!==T&&X.set(()=>({flat:T})),g&&!un.fun(g)&&!pM(g)&&!un.equ(g,Y,El)&&lo(Y,g),c=y,h=!0,m(),this},render(p){return!h&&!d&&this.configure(),d.then(()=>{Fx.updateContainer(C.jsx(nU,{store:r,children:p,onCreated:c,rootElement:s}),l,null,()=>{})}),r},unmount(){ST(s)}}}function nU({store:s,children:e,onCreated:t,rootElement:n}){return $u(()=>{const i=s.getState();i.set(r=>({internal:{...r.internal,active:!0}})),t&&t(i),s.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),C.jsx(xT.Provider,{value:s,children:e})}function ST(s,e){const t=Ma.get(s),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Fx.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var r,l,c,u;i.events.disconnect==null||i.events.disconnect(),(r=i.gl)==null||(l=r.renderLists)==null||l.dispose==null||l.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),bO(i.scene),Ma.delete(s)}catch{}},500)})}}const iU=new Set,sU=new Set,rU=new Set;function E0(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function wu(s,e){switch(s){case"before":return E0(iU,e);case"after":return E0(sU,e);case"tail":return E0(rU,e)}}let T0,C0;function Nx(s,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof s=="number"&&(n=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),T0=e.internal.subscribers;for(let i=0;i<T0.length;i++)C0=T0[i],C0.ref.current(C0.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 Ap=!1,Ox=!1,w0,AM,Tl;function ET(s){AM=requestAnimationFrame(ET),Ap=!0,w0=0,wu("before",s),Ox=!0;for(const t of Ma.values()){var e;Tl=t.store.getState(),Tl.internal.active&&(Tl.frameloop==="always"||Tl.internal.frames>0)&&!((e=Tl.gl.xr)!=null&&e.isPresenting)&&(w0+=Nx(s,Tl))}if(Ox=!1,wu("after",s),w0===0)return wu("tail",s),Ap=!1,cancelAnimationFrame(AM)}function Ux(s,e=1){var t;if(!s)return Ma.forEach(n=>Ux(n.store.getState(),e));(t=s.gl.xr)!=null&&t.isPresenting||!s.internal.active||s.frameloop==="never"||(e>1?s.internal.frames=Math.min(60,s.internal.frames+e):Ox?s.internal.frames=2:s.internal.frames=1,Ap||(Ap=!0,requestAnimationFrame(ET)))}function MM(s,e=!0,t,n){if(e&&wu("before",s),t)Nx(s,t,n);else for(const i of Ma.values())Nx(s,i.store.getState());e&&wu("after",s)}const R0={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 oU(s){const{handlePointer:e}=IO(s);return{priority:1,enabled:!0,compute(t,n,i){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(R0).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=s.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=s.getState();if(i.disconnect==null||i.disconnect(),n(r=>({events:{...r.events,connected:t}})),i.handlers)for(const r in i.handlers){const l=i.handlers[r],[c,u]=R0[r];t.addEventListener(c,l,{passive:u})}},disconnect:()=>{const{set:t,events:n}=s.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const r=n.handlers[i],[l]=R0[i];n.connected.removeEventListener(l,r)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function SM(s,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...n),e)}}function aU({debounce:s,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)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[r,l]=k.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}
vendor: 29,312 bytes, lines 4149-4186
4149),c=k.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:r,orientationHandler:null}),u=s?typeof s=="number"?s:s.scroll:null,h=s?typeof s=="number"?s:s.resize:null,d=k.useRef(!1);k.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,m,g]=k.useMemo(()=>{const y=()=>{if(!c.current.element)return;const{left:A,top:S,width:T,height:B,bottom:R,right:L,x:w,y:I}=c.current.element.getBoundingClientRect(),O={left:A,top:S,width:T,height:B,bottom:R,right:L,x:w,y:I};c.current.element instanceof HTMLElement&&n&&(O.height=c.current.element.offsetHeight,O.width=c.current.element.offsetWidth),Object.freeze(O),d.current&&!hU(c.current.lastBounds,O)&&l(c.current.lastBounds=O)};return[y,h?SM(y,h):y,u?SM(y,u):y]},[l,n,u,h]);function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",g,!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 b(){c.current.element&&(c.current.resizeObserver=new i(g),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(y=>y.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const v=y=>{!y||y===c.current.element||(_(),c.current.element=y,c.current.scrollContainers=TT(y),b())};return cU(g,!!e),lU(m),k.useEffect(()=>{_(),b()},[e,g,m]),k.useEffect(()=>_,[]),[v,r,p]}function lU(s){k.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[s])}function cU(s,e){k.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[s,e])}function TT(s){const e=[];if(!s||s===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(s);return[t,n,i].some(r=>r==="auto"||r==="scroll")&&e.push(s),[...e,...TT(s.parentElement)]}const uU=["x","y","top","bottom","left","right","width","height"],hU=(s,e)=>uU.every(t=>s[t]===e[t]);function fU({ref:s,children:e,fallback:t,resize:n,style:i,gl:r,events:l=oU,eventSource:c,eventPrefix:u,shadows:h,linear:d,flat:p,legacy:m,orthographic:g,frameloop:_,dpr:b,performance:v,raycaster:y,camera:A,scene:S,onPointerMissed:T,onCreated:B,...R}){k.useMemo(()=>JO(YN),[]);const L=xO(),[w,I]=aU({scroll:!0,debounce:{scroll:50,resize:0},...n}),O=k.useRef(null),D=k.useRef(null);k.useImperativeHandle(s,()=>O.current);const z=dT(T),[X,Y]=k.useState(!1),[V,H]=k.useState(!1);if(X)throw X;if(V)throw V;const W=k.useRef(null);$u(()=>{const Q=O.current;if(I.width>0&&I.height>0&&Q){W.current||(W.current=tU(Q));async function re(){await W.current.configure({gl:r,scene:S,events:l,shadows:h,linear:d,flat:p,legacy:m,orthographic:g,frameloop:_,dpr:b,performance:v,raycaster:y,camera:A,size:I,onPointerMissed:(...ae)=>z.current==null?void 0:z.current(...ae),onCreated:ae=>{ae.events.connect==null||ae.events.connect(c?mO(c)?c.current:c:D.current),u&&ae.setEvents({compute:(pe,Ue)=>{const Pe=pe[u+"X"],He=pe[u+"Y"];Ue.pointer.set(Pe/Ue.size.width*2-1,-(He/Ue.size.height)*2+1),Ue.raycaster.setFromCamera(Ue.pointer,Ue.camera)}}),B==null||B(ae)}}),W.current.render(C.jsx(L,{children:C.jsx(yO,{set:H,children:C.jsx(k.Suspense,{fallback:C.jsx(_O,{set:Y}),children:e??null})})}))}re()}}),k.useEffect(()=>{const Q=O.current;if(Q)return()=>ST(Q)},[]);const q=c?"none":"auto";return C.jsx("div",{ref:D,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:q,...i},...R,children:C.jsx("div",{ref:w,style:{width:"100%",height:"100%"},children:C.jsx("canvas",{ref:O,style:{display:"block"},children:t})})})}function dU(s){return C.jsx(uT,{children:C.jsx(fU,{...s})})}const th=new G,Y_=new G,pU=new G,EM=new xe;function mU(s,e,t){const n=th.setFromMatrixPosition(s.matrixWorld);n.project(e);const i=t.width/2,r=t.height/2;return[n.x*i+i,-(n.y*r)+r]}function gU(s,e){const t=th.setFromMatrixPosition(s.matrixWorld),n=Y_.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),r=e.getWorldDirection(pU);return i.angleTo(r)>Math.PI/2}function xU(s,e,t,n){const i=th.setFromMatrixPosition(s.matrixWorld),r=i.clone();r.project(e),EM.set(r.x,r.y),t.setFromCamera(EM,e);const l=t.intersectObjects(n,!0);if(l.length){const c=l[0].distance;return i.distanceTo(t.ray.origin)<c}return!0}function _U(s,e){if(e instanceof Cr)return e.zoom;if(e instanceof En){const t=th.setFromMatrixPosition(s.matrixWorld),n=Y_.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,r=t.distanceTo(n);return 1/(2*Math.tan(i/2)*r)}else return 1}function yU(s,e,t){if(e instanceof En||e instanceof Cr){const n=th.setFromMatrixPosition(s.matrixWorld),i=Y_.setFromMatrixPosition(e.matrixWorld),r=n.distanceTo(i),l=(t[1]-t[0])/(e.far-e.near),c=t[1]-l*e.far;return Math.round(l*r+c)}}const Gx=s=>Math.abs(s)<1e-10?0:s;function CT(s,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Gx(e[i]*s.elements[i])+(i!==15?",":")");return t+n}const vU=(s=>e=>CT(e,s))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),bU=(s=>(e,t)=>CT(e,s(t),"translate(-50%,-50%)"))(s=>[1/s,1/s,1/s,1,-1/s,-1/s,-1/s,-1,1/s,1/s,1/s,1,1,1,1,1]);function AU(s){return s&&typeof s=="object"&&"current"in s}const um=k.forwardRef(({children:s,eps:e=.001,style:t,className:n,prepend:i,center:r,fullscreen:l,portal:c,distanceFactor:u,sprite:h=!1,transform:d=!1,occlude:p,onOcclude:m,castShadow:g,receiveShadow:_,material:b,geometry:v,zIndexRange:y=[16777271,0],calculatePosition:A=mU,as:S="div",wrapperClass:T,pointerEvents:B="auto",...R},L)=>{const{gl:w,camera:I,scene:O,size:D,raycaster:z,events:X,viewport:Y}=Ks(),[V]=k.useState(()=>document.createElement(S)),H=k.useRef(null),W=k.useRef(null),q=k.useRef(0),Q=k.useRef([0,0]),re=k.useRef(null),ae=k.useRef(null),pe=(c==null?void 0:c.current)||X.connected||w.domElement.parentNode,Ue=k.useRef(null),Pe=k.useRef(!1),He=k.useMemo(()=>p&&p!=="blending"||Array.isArray(p)&&p.length&&AU(p[0]),[p]);k.useLayoutEffect(()=>{const Je=w.domElement;p&&p==="blending"?(Je.style.zIndex=`${Math.floor(y[0]/2)}`,Je.style.position="absolute",Je.style.pointerEvents="none"):(Je.style.zIndex=null,Je.style.position=null,Je.style.pointerEvents=null)},[p]),k.useLayoutEffect(()=>{if(W.current){const Je=H.current=hR.createRoot(V);if(O.updateMatrixWorld(),d)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const Ee=A(W.current,I,D);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${Ee[0]}px,${Ee[1]}px,0);transform-origin:0 0;`}return pe&&(i?pe.prepend(V):pe.appendChild(V)),()=>{pe&&pe.removeChild(V),Je.unmount()}}},[pe,d]),k.useLayoutEffect(()=>{T&&(V.className=T)},[T]);const le=k.useMemo(()=>d?{position:"absolute",top:0,left:0,width:D.width,height:D.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:r?"translate3d(-50%,-50%,0)":"none",...l&&{top:-D.height/2,left:-D.width/2,width:D.width,height:D.height},...t},[t,r,l,D,d]),Le=k.useMemo(()=>({position:"absolute",pointerEvents:B}),[B]);k.useLayoutEffect(()=>{if(Pe.current=!1,d){var Je;(Je=H.current)==null||Je.render(k.createElement("div",{ref:re,style:le},k.createElement("div",{ref:ae,style:Le},k.createElement("div",{ref:L,className:n,style:t,children:s}))))}else{var Ee;(Ee=H.current)==null||Ee.render(k.createElement("div",{ref:L,style:le,className:n,children:s}))}});const ye=k.useRef(!0);jt(Je=>{if(W.current){I.updateMatrixWorld(),W.current.updateWorldMatrix(!0,!1);const Ee=d?Q.current:A(W.current,I,D);if(d||Math.abs(q.current-I.zoom)>e||Math.abs(Q.current[0]-Ee[0])>e||Math.abs(Q.current[1]-Ee[1])>e){const ht=gU(W.current,I);let qe=!1;He&&(Array.isArray(p)?qe=p.map(Te=>Te.current):p!=="blending"&&(qe=[O]));const de=ye.current;if(qe){const Te=xU(W.current,I,z,qe);ye.current=Te&&!ht}else ye.current=!ht;de!==ye.current&&(m?m(!ye.current):V.style.display=ye.current?"block":"none");const _e=Math.floor(y[0]/2),me=p?He?[y[0],_e]:[_e-1,0]:y;if(V.style.zIndex=`${yU(W.current,I,me)}`,d){const[Te,Ce]=[D.width/2,D.height/2],rt=I.projectionMatrix.elements[5]*Ce,{isOrthographicCamera:j,top:ut,left:Ze,bottom:it,right:Me}=I,Gt=vU(I.matrixWorldInverse),U=j?`scale(${rt})translate(${Gx(-(Me+Ze)/2)}px,${Gx((ut+it)/2)}px)`:`translateZ(${rt}px)`;let P=W.current.matrixWorld;h&&(P=I.matrixWorldInverse.clone().transpose().copyPosition(P).scale(W.current.scale),P.elements[3]=P.elements[7]=P.elements[11]=0,P.elements[15]=1),V.style.width=D.width+"px",V.style.height=D.height+"px",V.style.perspective=j?"":`${rt}px`,re.current&&ae.current&&(re.current.style.transform=`${U}${Gt}translate(${Te}px,${Ce}px)`,ae.current.style.transform=bU(P,1/((u||10)/400)))}else{const Te=u===void 0?1:_U(W.current,I)*u;V.style.transform=`translate3d(${Ee[0]}px,${Ee[1]}px,0) scale(${Te})`}Q.current=Ee,q.current=I.zoom}}if(!He&&Ue.current&&!Pe.current)if(d){if(re.current){const Ee=re.current.children[0];if(Ee!=null&&Ee.clientWidth&&Ee!=null&&Ee.clientHeight){const{isOrthographicCamera:ht}=I;if(ht||v)R.scale&&(Array.isArray(R.scale)?R.scale instanceof G?Ue.current.scale.copy(R.scale.clone().divideScalar(1)):Ue.current.scale.set(1/R.scale[0],1/R.scale[1],1/R.scale[2]):Ue.current.scale.setScalar(1/R.scale));else{const qe=(u||10)/400,de=Ee.clientWidth*qe,_e=Ee.clientHeight*qe;Ue.current.scale.set(de,_e,1)}Pe.current=!0}}}else{const Ee=V.children[0];if(Ee!=null&&Ee.clientWidth&&Ee!=null&&Ee.clientHeight){const ht=1/Y.factor,qe=Ee.clientWidth*ht,de=Ee.clientHeight*ht;Ue.current.scale.set(qe,de,1),Pe.current=!0}Ue.current.lookAt(Je.camera.position)}});const ze=k.useMemo(()=>({vertexShader:d?void 0:`
4150          /*
4151            This shader is from the THREE's SpriteMaterial.
4152            We need to turn the backing plane into a Sprite
4153            (make it always face the camera) if "transfrom"
4154            is false.
4155          */
4156          #include <common>
4157
4158          void main() {
4159            vec2 center = vec2(0., 1.);
4160            float rotation = 0.0;
4161
4162            // This is somewhat arbitrary, but it seems to work well
4163            // Need to figure out how to derive this dynamically if it even matters
4164            float size = 0.03;
4165
4166            vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
4167            vec2 scale;
4168            scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
4169            scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
4170
4171            bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4172            if ( isPerspective ) scale *= - mvPosition.z;
4173
4174            vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
4175            vec2 rotatedPosition;
4176            rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
4177            rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
4178            mvPosition.xy += rotatedPosition;
4179
4180            gl_Position = projectionMatrix * mvPosition;
4181          }
4182      `,fragmentShader:`
4183        void main() {
4184          gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
4185        }
4186      `}),[d]);return k.createElement("group",Xl({},R,{ref:W}),p&&!He&&k.createElement("mesh",{castShadow:g,receiveShadow:_,ref:Ue},v||k.createElement("planeGeometry",null),b||k.createElement("shaderMaterial",{side:Vi,vertexShader:ze.vertexShader,fragmentShader:ze.fragmentShader})))}),K_=parseInt(Vu.replace(/\D+/g,"")),wT=K_>=125?"uv1":"uv2";function TM(s,e){if(e===JE)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===hp||e===o_){let t=s.getIndex();if(t===null){const l=[],c=s.getAttribute("position");if(c!==void 0){for(let u=0;u<c.count;u++)l.push(u);s.setIndex(l),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(t)if(e===hp)for(let l=1;l<=n;l++)i.push(t.getX(0)),i.push(t.getX(l)),i.push(t.getX(l+1));else for(let l=0;l<n;l++)l%2===0?(i.push(t.getX(l)),i.push(t.getX(l+1)),i.push(t.getX(l+2))):(i.push(t.getX(l+2)),i.push(t.getX(l+1)),i.push(t.getX(l)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}function Mp(s){if(typeof TextDecoder<"u")return new TextDecoder().decode(s);let e="";for(let t=0,n=s.length;t<n;t++)e+=String.fromCharCode(s[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const la="srgb",Sr="srgb-linear",CM=3001,MU=3e3;class q_ extends ui{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new wU(t)}),this.register(function(t){return new RU(t)}),this.register(function(t){return new UU(t)}),this.register(function(t){return new GU(t)}),this.register(function(t){return new kU(t)}),this.register(function(t){return new BU(t)}),this.register(function(t){return new PU(t)}),this.register(function(t){return new LU(t)}),this.register(function(t){return new DU(t)}),this.register(function(t){return new CU(t)}),this.register(function(t){return new FU(t)}),this.register(function(t){return new IU(t)}),this.register(function(t){return new OU(t)}),this.register(function(t){return new NU(t)}),this.register(function(t){return new EU(t)}),this.register(function(t){return new HU(t)}),this.register(function(t){return new zU(t)})}load(e,t,n,i){const r=this;let l;if(this.resourcePath!=="")l=this.resourcePath;else if(this.path!==""){const h=fo.extractUrlBase(e);l=fo.resolveURL(h,this.path)}else l=fo.extractUrlBase(e);this.manager.itemStart(e);const c=function(h){i?i(h):console.error(h),r.manager.itemError(e),r.manager.itemEnd(e)},u=new Ji(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(h){try{r.parse(h,l,function(d){t(d),r.manager.itemEnd(e)},c)}catch(d){c(d)}},n,c)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const l={},c={};if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Mp(new Uint8Array(e.slice(0,4)))===RT){try{l[Ft.KHR_BINARY_GLTF]=new VU(e)}catch(d){i&&i(d);return}r=JSON.parse(l[Ft.KHR_BINARY_GLTF].content)}else r=JSON.parse(Mp(new Uint8Array(e)));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new nG(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const d=this.pluginCallbacks[h](u);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[d.name]=d,l[d.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const d=r.extensionsUsed[h],p=r.extensionsRequired||[];switch(d){case Ft.KHR_MATERIALS_UNLIT:l[d]=new TU;break;case Ft.KHR_DRACO_MESH_COMPRESSION:l[d]=new WU(r,this.dracoLoader);break;case Ft.KHR_TEXTURE_TRANSFORM:l[d]=new jU;break;case Ft.KHR_MESH_QUANTIZATION:l[d]=new XU;break;default:p.indexOf(d)>=0&&c[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(l),u.setPlugins(c),u.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function SU(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const Ft={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class EU{constructor(e){this.parser=e,this.name=Ft.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,u=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let h;const d=new we(16777215);u.color!==void 0&&d.setRGB(u.color[0],u.color[1],u.color[2],Sr);const p=u.range!==void 0?u.range:0;switch(u.type){case"directional":h=new N_(d),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new F_(d),h.distance=p;break;case"spot":h=new D_(d),h.distance=p,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,h.angle=u.spot.outerConeAngle,h.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return h.position.set(0,0,0),h.decay=2,yr(h,u),u.intensity!==void 0&&(h.intensity=u.intensity),h.name=t.createUniqueName(u.name||"light_"+e),i=Promise.resolve(h),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,r=n.json.nodes[e],c=(r.extensions&&r.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(u){return n._getNodeRef(t.cache,c,u)})}}class TU{constructor(){this.name=Ft.KHR_MATERIALS_UNLIT}getMaterialType(){return ji}extendParams(e,t,n){const i=[];e.color=new we(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const l=r.baseColorFactor;e.color.setRGB(l[0],l[1],l[2],Sr),e.opacity=l[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,la))}return Promise.all(i)}}class CU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class wU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];if(l.clearcoatFactor!==void 0&&(t.clearcoat=l.clearcoatFactor),l.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),l.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),l.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),l.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),l.clearcoatNormalTexture.scale!==void 0)){const c=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new xe(c,c)}return Promise.all(r)}}class RU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class IU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];return l.iridescenceFactor!==void 0&&(t.iridescence=l.iridescenceFactor),l.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),l.iridescenceIor!==void 0&&(t.iridescenceIOR=l.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),l.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),l.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),l.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(r)}}class BU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new we(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=i.extensions[this.name];if(l.sheenColorFactor!==void 0){const c=l.sheenColorFactor;t.sheenColor.setRGB(c[0],c[1],c[2],Sr)}return l.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=l.sheenRoughnessFactor),l.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",l.sheenColorTexture,la)),l.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(r)}}class PU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];return l.transmissionFactor!==void 0&&(t.transmission=l.transmissionFactor),l.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(r)}}class LU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];t.thickness=l.thicknessFactor!==void 0?l.thicknessFactor:0,l.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return t.attenuationColor=new we().setRGB(c[0],c[1],c[2],Sr),Promise.all(r)}}class DU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class FU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];t.specularIntensity=l.specularFactor!==void 0?l.specularFactor:1,l.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return t.specularColor=new we().setRGB(c[0],c[1],c[2],Sr),l.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",l.specularColorTexture,la)),Promise.all(r)}}class NU{constructor(e){this.parser=e,this.name=Ft.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];return t.bumpScale=l.bumpFactor!==void 0?l.bumpFactor:1,l.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(r)}}class OU{constructor(e){this.parser=e,this.name=Ft.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:ci}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],l=i.extensions[this.name];return l.anisotropyStrength!==void 0&&(t.anisotropy=l.anisotropyStrength),l.anisotropyRotation!==void 0&&(t.anisotropyRotation=l.anisotropyRotation),l.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(r)}}class UU{constructor(e){this.parser=e,this.name=Ft.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,l)}}class GU{constructor(e){this.parser=e,this.name=Ft.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const l=r.extensions[t],c=i.images[l.source];let u=n.textureLoader;if(c.uri){const h=n.options.manager.getHandler(c.uri);h!==null&&(u=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,l.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class kU{constructor(e){this.parser=e,this.name=Ft.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const l=r.extensions[t],c=i.images[l.source];let u=n.textureLoader;if(c.uri){const h=n.options.manager.getHandler(c.uri);h!==null&&(u=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,l.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
4186FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class HU{constructor(e){this.name=Ft.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),l=this.parser.options.meshoptDecoder;if(!l||!l.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(c){const u=i.byteOffset||0,h=i.byteLength||0,d=i.count,p=i.byteStride,m=new Uint8Array(c,u,h);return l.decodeGltfBufferAsync?l.decodeGltfBufferAsync(d,p,m,i.mode,i.filter).then(function(g){return g.buffer}):l.ready.then(function(){const g=new ArrayBuffer(d*p);return l.decodeGltfBuffer(new Uint8Array(g),d,p,m,i.mode,i.filter),g})})}else return null}}class zU{constructor(e){this.name=Ft.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const h of i.primitives)if(h.mode!==es.TRIANGLES&&h.mode!==es.TRIANGLE_STRIP&&h.mode!==es.TRIANGLE_FAN&&h.mode!==void 0)return null;const l=n.extensions[this.name].attributes,c=[],u={};for(const h in l)c.push(this.parser.getDependency("accessor",l[h]).then(d=>(u[h]=d,u[h])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(h=>{const d=h.pop(),p=d.isGroup?d.children:[d],m=h[0].count,g=[];for(const _ of p){const b=new ft,v=new G,y=new Qn,A=new G(1,1,1),S=new m_(_.geometry,_.material,m);for(let T=0;T<m;T++)u.TRANSLATION&&v.fromBufferAttribute(u.TRANSLATION,T),u.ROTATION&&y.fromBufferAttribute(u.ROTATION,T),u.SCALE&&A.fromBufferAttribute(u.SCALE,T),S.setMatrixAt(T,b.compose(v,y,A));for(const T in u)if(T==="_COLOR_0"){const B=u[T];S.instanceColor=new _a(B.array,B.itemSize,B.normalized)}else T!=="TRANSLATION"&&T!=="ROTATION"&&T!=="SCALE"&&_.geometry.setAttribute(T,u[T]);zt.prototype.copy.call(S,_),this.parser.assignFinalMaterial(S),g.push(S)}return d.isGroup?(d.clear(),d.add(...g),d):g[0]}))}}const RT="glTF",$c=12,wM={JSON:1313821514,BIN:5130562};class VU{constructor(e){this.name=Ft.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,$c);if(this.header={magic:Mp(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==RT)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-$c,i=new DataView(e,$c);let r=0;for(;r<n;){const l=i.getUint32(r,!0);r+=4;const c=i.getUint32(r,!0);if(r+=4,c===wM.JSON){const u=new Uint8Array(e,$c+r,l);this.content=Mp(u)}else if(c===wM.BIN){const u=$c+r;this.body=e.slice(u,u+l)}r+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class WU{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ft.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,c={},u={},h={};for(const d in l){const p=kx[d]||d.toLowerCase();c[p]=l[d]}for(const d in e.attributes){const p=kx[d]||d.toLowerCase();if(l[d]!==void 0){const m=n.accessors[e.attributes[d]],g=jl[m.componentType];h[p]=g.name,u[p]=m.normalized===!0}}return t.getDependency("bufferView",r).then(function(d){return new Promise(function(p,m){i.decodeDracoFile(d,function(g){for(const _ in g.attributes){const b=g.attributes[_],v=u[_];v!==void 0&&(b.normalized=v)}p(g)},c,h,Sr,m)})})}}class jU{constructor(){this.name=Ft.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class XU{constructor(){this.name=Ft.KHR_MESH_QUANTIZATION}}class IT extends Sa{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let l=0;l!==i;l++)t[l]=n[r+l];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=c*2,h=c*3,d=i-t,p=(n-t)/d,m=p*p,g=m*p,_=e*h,b=_-h,v=-2*g+3*m,y=g-m,A=1-v,S=y-m+p;for(let T=0;T!==c;T++){const B=l[b+T+c],R=l[b+T+u]*d,L=l[_+T+c],w=l[_+T]*d;r[T]=A*B+S*R+v*L+y*w}return r}}const JU=new Qn;class YU extends IT{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return JU.fromArray(r).normalize().toArray(r),r}}const es={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},jl={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},RM={9728:bn,9729:nn,9984:wp,9985:Vl,9986:ia,9987:ts},IM={33071:xi,33648:Jl,10497:mo},I0={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},kx={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...K_>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Zr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},KU={CUBICSPLINE:void 0,LINEAR:Zl,STEP:ql},B0={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function qU(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new et({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Zs})),s.DefaultMaterial}function Ko(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function yr(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ZU(s,e,t){let n=!1,i=!1,r=!1;for(let h=0,d=e.length;h<d;h++){const p=e[h];if(p.POSITION!==void 0&&(n=!0),p.NORMAL!==void 0&&(i=!0),p.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);const l=[],c=[],u=[];for(let h=0,d=e.length;h<d;h++){const p=e[h];if(n){const m=p.POSITION!==void 0?t.getDependency("accessor",p.POSITION):s.attributes.position;l.push(m)}if(i){const m=p.NORMAL!==void 0?t.getDependency("accessor",p.NORMAL):s.attributes.normal;c.push(m)}if(r){const m=p.COLOR_0!==void 0?t.getDependency("accessor",p.COLOR_0):s.attributes.color;u.push(m)}}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(u)]).then(function(h){const d=h[0],p=h[1],m=h[2];return n&&(s.morphAttributes.position=d),i&&(s.morphAttributes.normal=p),r&&(s.morphAttributes.color=m),s.morphTargetsRelative=!0,s})}function QU(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $U(s){let e;const t=s.extensions&&s.extensions[Ft.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+P0(t.attributes):e=s.indices+":"+P0(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+P0(s.targets[n]);return e}function P0(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Hx(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function eG(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const tG=new ft;class nG{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new SU,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&r<98?this.textureLoader=new F1(this.options.manager):this.textureLoader=new H1(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ji(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(l){return l._markDefs&&l._markDefs()}),Promise.all(this._invokeAll(function(l){return l.beforeRoot&&l.beforeRoot()}
vendor: 31,565 bytes, lines 4186-4323
4186)).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(l){const c={scene:l[0][i.scene||0],scenes:l[0],animations:l[1],cameras:l[2],asset:i.asset,parser:n,userData:{}};return Ko(r,c,i),yr(c,i),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(c)})).then(function(){for(const u of c.scenes)u.updateMatrixWorld();e(c)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){const l=t[i].joints;for(let c=0,u=l.length;c<u;c++)e[l[c]].isBone=!0}for(let i=0,r=e.length;i<r;i++){const l=e[i];l.mesh!==void 0&&(this._addNodeRef(this.meshCache,l.mesh),l.skin!==void 0&&(n[l.mesh].isSkinnedMesh=!0)),l.camera!==void 0&&this._addNodeRef(this.cameraCache,l.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(l,c)=>{const u=this.associations.get(l);u!=null&&this.associations.set(c,u);for(const[h,d]of l.children.entries())r(d,c.children[h])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,l){return n.getDependency(e,l)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ft.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(r,l){n.load(fo.resolveURL(t.uri,i.path),r,void 0,function(){l(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const l=I0[i.type],c=jl[i.componentType],u=i.normalized===!0,h=new c(i.count*l);return Promise.resolve(new Ut(h,l,u))}const r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(l){const c=l[0],u=I0[i.type],h=jl[i.componentType],d=h.BYTES_PER_ELEMENT,p=d*u,m=i.byteOffset||0,g=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,_=i.normalized===!0;let b,v;if(g&&g!==p){const y=Math.floor(m/g),A="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+y+":"+i.count;let S=t.cache.get(A);S||(b=new h(c,y*g,i.count*g/d),S=new Xu(b,g/d),t.cache.add(A,S)),v=new wi(S,u,m%g/d,_)}else c===null?b=new h(i.count*u):b=new h(c,m,i.count*u),v=new Ut(b,u,_);if(i.sparse!==void 0){const y=I0.SCALAR,A=jl[i.sparse.indices.componentType],S=i.sparse.indices.byteOffset||0,T=i.sparse.values.byteOffset||0,B=new A(l[1],S,i.sparse.count*y),R=new h(l[2],T,i.sparse.count*u);c!==null&&(v=new Ut(v.array.slice(),v.itemSize,v.normalized));for(let L=0,w=B.length;L<w;L++){const I=B[L];if(v.setX(I,R[L*u]),u>=2&&v.setY(I,R[L*u+1]),u>=3&&v.setZ(I,R[L*u+2]),u>=4&&v.setW(I,R[L*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return v})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,l=t.images[r];let c=this.textureLoader;if(l.uri){const u=n.manager.getHandler(l.uri);u!==null&&(c=u)}return this.loadTextureImage(e,r,c)}loadTextureImage(e,t,n){const i=this,r=this.json,l=r.textures[e],c=r.images[t],u=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[u])return this.textureCache[u];const h=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=l.name||c.name||"",d.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(d.name=c.uri);const m=(r.samplers||{})[l.sampler]||{};return d.magFilter=RM[m.magFilter]||nn,d.minFilter=RM[m.minFilter]||ts,d.wrapS=IM[m.wrapS]||mo,d.wrapT=IM[m.wrapT]||mo,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[u]=h,h}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(p=>p.clone());const l=i.images[e],c=self.URL||self.webkitURL;let u=l.uri||"",h=!1;if(l.bufferView!==void 0)u=n.getDependency("bufferView",l.bufferView).then(function(p){h=!0;const m=new Blob([p],{type:l.mimeType});return u=c.createObjectURL(m),u});else if(l.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(u).then(function(p){return new Promise(function(m,g){let _=m;t.isImageBitmapLoader===!0&&(_=function(b){const v=new fn(b);v.needsUpdate=!0,m(v)}),t.load(fo.resolveURL(p,r.path),_,void 0,g)})}).then(function(p){return h===!0&&c.revokeObjectURL(u),yr(p,l),p.userData.mimeType=l.mimeType||eG(l.uri),p}).catch(function(p){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),p});return this.sourceCache[e]=d,d}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(l){if(!l)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(l=l.clone(),l.channel=n.texCoord),r.extensions[Ft.KHR_TEXTURE_TRANSFORM]){const c=n.extensions!==void 0?n.extensions[Ft.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const u=r.associations.get(l);l=r.extensions[Ft.KHR_TEXTURE_TRANSFORM].extendTexture(l,c),r.associations.set(l,u)}}return i!==void 0&&(typeof i=="number"&&(i=i===CM?la:Sr),"colorSpace"in l?l.colorSpace=i:l.encoding=i===la?CM:MU),e[t]=l,l})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,l=t.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new Wp,On.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(c,u)),n=u}else if(e.isLine){const c="LineBasicMaterial:"+n.uuid;let u=this.cache.get(c);u||(u=new li,On.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(c,u)),n=u}if(i||r||l){let c="ClonedMaterial:"+n.uuid+":";i&&(c+="derivative-tangents:"),r&&(c+="vertex-colors:"),l&&(c+="flat-shading:");let u=this.cache.get(c);u||(u=n.clone(),r&&(u.vertexColors=!0),l&&(u.flatShading=!0),i&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(c,u),this.associations.set(u,this.associations.get(n))),n=u}e.material=n}getMaterialType(){return et}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let l;const c={},u=r.extensions||{},h=[];if(u[Ft.KHR_MATERIALS_UNLIT]){const p=i[Ft.KHR_MATERIALS_UNLIT];l=p.getMaterialType(),h.push(p.extendParams(c,r,t))}else{const p=r.pbrMetallicRoughness||{};if(c.color=new we(1,1,1),c.opacity=1,Array.isArray(p.baseColorFactor)){const m=p.baseColorFactor;c.color.setRGB(m[0],m[1],m[2],Sr),c.opacity=m[3]}p.baseColorTexture!==void 0&&h.push(t.assignTexture(c,"map",p.baseColorTexture,la)),c.metalness=p.metallicFactor!==void 0?p.metallicFactor:1,c.roughness=p.roughnessFactor!==void 0?p.roughnessFactor:1,p.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(c,"metalnessMap",p.metallicRoughnessTexture)),h.push(t.assignTexture(c,"roughnessMap",p.metallicRoughnessTexture))),l=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,c)})))}r.doubleSided===!0&&(c.side=Vi);const d=r.alphaMode||B0.OPAQUE;if(d===B0.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,d===B0.MASK&&(c.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&l!==ji&&(h.push(t.assignTexture(c,"normalMap",r.normalTexture)),c.normalScale=new xe(1,1),r.normalTexture.scale!==void 0)){const p=r.normalTexture.scale;c.normalScale.set(p,p)}if(r.occlusionTexture!==void 0&&l!==ji&&(h.push(t.assignTexture(c,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&l!==ji){const p=r.emissiveFactor;c.emissive=new we().setRGB(p[0],p[1],p[2],Sr)}return r.emissiveTexture!==void 0&&l!==ji&&h.push(t.assignTexture(c,"emissiveMap",r.emissiveTexture,la)),Promise.all(h).then(function(){const p=new l(c);return r.name&&(p.name=r.name),yr(p,r),t.associations.set(p,{materials:e}),r.extensions&&Ko(i,p,r),p})}createUniqueName(e){const t=Wt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(c){return n[Ft.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,t).then(function(u){return BM(u,c,t)})}const l=[];for(let c=0,u=e.length;c<u;c++){const h=e[c],d=$U(h),p=i[d];if(p)l.push(p.promise);else{let m;h.extensions&&h.extensions[Ft.KHR_DRACO_MESH_COMPRESSION]?m=r(h):m=BM(new mt,h,t),i[d]={primitive:h,promise:m},l.push(m)}}return Promise.all(l)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],l=r.primitives,c=[];for(let u=0,h=l.length;u<h;u++){const d=l[u].material===void 0?qU(this.cache):this.getDependency("material",l[u].material);c.push(d)}return c.push(t.loadGeometries(l)),Promise.all(c).then(function(u){const h=u.slice(0,u.length-1),d=u[u.length-1],p=[];for(let g=0,_=d.length;g<_;g++){const b=d[g],v=l[g];let y;const A=h[g];if(v.mode===es.TRIANGLES||v.mode===es.TRIANGLE_STRIP||v.mode===es.TRIANGLE_FAN||v.mode===void 0)y=r.isSkinnedMesh===!0?new p_(b,A):new An(b,A),y.isSkinnedMesh===!0&&y.normalizeSkinWeights(),v.mode===es.TRIANGLE_STRIP?y.geometry=TM(y.geometry,o_):v.mode===es.TRIANGLE_FAN&&(y.geometry=TM(y.geometry,hp));else if(v.mode===es.LINES)y=new Es(b,A);else if(v.mode===es.LINE_STRIP)y=new Tr(b,A);else if(v.mode===es.LINE_LOOP)y=new g_(b,A);else if(v.mode===es.POINTS)y=new x_(b,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(y.geometry.morphAttributes).length>0&&QU(y,r),y.name=t.createUniqueName(r.name||"mesh_"+e),yr(y,r),v.extensions&&Ko(i,y,v),t.assignFinalMaterial(y),p.push(y)}for(let g=0,_=p.length;g<_;g++)t.associations.set(p[g],{meshes:e,primitives:g});if(p.length===1)return r.extensions&&Ko(i,p[0],r),p[0];const m=new Ar;r.extensions&&Ko(i,m,r),t.associations.set(m,{meshes:e});for(let g=0,_=p.length;g<_;g++)m.add(p[g]);return m})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new En(l_.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Cr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),yr(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const r=i.pop(),l=i,c=[],u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h];if(p){c.push(p);const m=new ft;r!==null&&m.fromArray(r.array,h*16),u.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new Ju(c,u)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,l=[],c=[],u=[],h=[],d=[];for(let p=0,m=i.channels.length;p<m;p++){const g=i.channels[p],_=i.samplers[g.sampler],b=g.target,v=b.node,y=i.parameters!==void 0?i.parameters[_.input]:_.input,A=i.parameters!==void 0?i.parameters[_.output]:_.output;b.node!==void 0&&(l.push(this.getDependency("node",v)),c.push(this.getDependency("accessor",y)),u.push(this.getDependency("accessor",A)),h.push(_),d.push(b))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(u),Promise.all(h),Promise.all(d)]).then(function(p){const m=p[0],g=p[1],_=p[2],b=p[3],v=p[4],y=[];for(let A=0,S=m.length;A<S;A++){const T=m[A],B=g[A],R=_[A],L=b[A],w=v[A];if(T===void 0)continue;T.updateMatrix&&T.updateMatrix();const I=n._createAnimationTracks(T,B,R,L,w);if(I)for(let O=0;O<I.length;O++)y.push(I[O])}return new sc(r,void 0,y)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){const l=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&l.traverse(function(c){if(c.isMesh)for(let u=0,h=i.weights.length;u<h;u++)c.morphTargetInfluences[u]=i.weights[u]}),l})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),l=[],c=i.children||[];for(let h=0,d=c.length;h<d;h++)l.push(n.getDependency("node",c[h]));const u=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(l),u]).then(function(h){const d=h[0],p=h[1],m=h[2];m!==null&&d.traverse(function(g){g.isSkinnedMesh&&g.bind(m,tG)});for(let g=0,_=p.length;g<_;g++)d.add(p[g]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],l=r.name?i.createUniqueName(r.name):"",c=[],u=i._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return u&&c.push(u),r.camera!==void 0&&c.push(i.getDependency("camera",r.camera).then(function(h){return i._getNodeRef(i.cameraCache,r.camera,h)})),i._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){c.push(h)}),this.nodeCache[e]=Promise.all(c).then(function(h){let d;if(r.isBone===!0?d=new zp:h.length>1?d=new Ar:h.length===1?d=h[0]:d=new zt,d!==h[0])for(let p=0,m=h.length;p<m;p++)d.add(h[p]);if(r.name&&(d.userData.name=r.name,d.name=l),yr(d,r),r.extensions&&Ko(n,d,r),r.matrix!==void 0){const p=new ft;p.fromArray(r.matrix),d.applyMatrix4(p)}else r.translation!==void 0&&d.position.fromArray(r.translation),r.rotation!==void 0&&d.quaternion.fromArray(r.rotation),r.scale!==void 0&&d.scale.fromArray(r.scale);return i.associations.has(d)||i.associations.set(d,{}),i.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Ar;n.name&&(r.name=i.createUniqueName(n.name)),yr(r,n),n.extensions&&Ko(t,r,n);const l=n.nodes||[],c=[];for(let u=0,h=l.length;u<h;u++)c.push(i.getDependency("node",l[u]));return Promise.all(c).then(function(u){for(let d=0,p=u.length;d<p;d++)r.add(u[d]);const h=d=>{const p=new Map;for(const[m,g]of i.associations)(m instanceof On||m instanceof fn)&&p.set(m,g);return d.traverse(m=>{const g=i.associations.get(m);g!=null&&p.set(m,g)}),p};return i.associations=h(r),r})}_createAnimationTracks(e,t,n,i,r){const l=[],c=e.name?e.name:e.uuid,u=[];Zr[r.path]===Zr.weights?e.traverse(function(m){m.morphTargetInfluences&&u.push(m.name?m.name:m.uuid)}):u.push(c);let h;switch(Zr[r.path]){case Zr.weights:h=va;break;case Zr.rotation:h=ba;break;case Zr.position:case Zr.scale:h=Aa;break;default:switch(n.itemSize){case 1:h=va;break;case 2:case 3:default:h=Aa;break}break}const d=i.interpolation!==void 0?KU[i.interpolation]:Zl,p=this._getArrayFromAccessor(n);for(let m=0,g=u.length;m<g;m++){const _=new h(u[m]+"."+Zr[r.path],t.array,p,d);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(_),l.push(_)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Hx(t.constructor),i=new Float32Array(t.length);for(let r=0,l=t.length;r<l;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof ba?YU:IT;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function iG(s,e,t){const n=e.attributes,i=new Ln;if(n.POSITION!==void 0){const c=t.json.accessors[n.POSITION],u=c.min,h=c.max;if(u!==void 0&&h!==void 0){if(i.set(new G(u[0],u[1],u[2]),new G(h[0],h[1],h[2])),c.normalized){const d=Hx(jl[c.componentType]);i.min.multiplyScalar(d),i.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const c=new G,u=new G;for(let h=0,d=r.length;h<d;h++){const p=r[h];if(p.POSITION!==void 0){const m=t.json.accessors[p.POSITION],g=m.min,_=m.max;if(g!==void 0&&_!==void 0){if(u.setX(Math.max(Math.abs(g[0]),Math.abs(_[0]))),u.setY(Math.max(Math.abs(g[1]),Math.abs(_[1]))),u.setZ(Math.max(Math.abs(g[2]),Math.abs(_[2]))),m.normalized){const b=Hx(jl[m.componentType]);u.multiplyScalar(b)}c.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(c)}s.boundingBox=i;const l=new Dn;i.getCenter(l.center),l.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=l}function BM(s,e,t){const n=e.attributes,i=[];function r(l,c){return t.getDependency("accessor",l).then(function(u){s.setAttribute(c,u)})}for(const l in n){const c=kx[l]||l.toLowerCase();c in s.attributes||i.push(r(n[l],c))}if(e.indices!==void 0&&!s.index){const l=t.getDependency("accessor",e.indices).then(function(c){s.setIndex(c)});i.push(l)}return yr(s,e),iG(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?ZU(s,e.targets,t):s})}const L0=new WeakMap;class sG extends ui{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new Ji(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,l=>{const c={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(l,c).then(t).catch(i)},n,i)}decodeDracoFile(e,t,n,i){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const u in t.attributeTypes){const h=t.attributeTypes[u];h.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[u]=h.name)}const n=JSON.stringify(t);if(L0.has(e)){const u=L0.get(e);if(u.key===n)return u.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(r,l).then(u=>(i=u,new Promise((h,d)=>{i._callbacks[r]={resolve:h,reject:d},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(u=>this._createGeometry(u.geometry));return c.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),L0.set(e,{key:n,promise:c}),c}_createGeometry(e){const t=new mt;e.index&&t.setIndex(new Ut(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,l=i.array,c=i.itemSize;t.setAttribute(r,new Ut(l,c))}return t}_loadLibrary(e,t){const n=new Ji(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,r)=>{n.load(e,i,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=rG.toString(),l=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
4187`);this.workerSourceURL=URL.createObjectURL(new Blob([l]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(r){const l=r.data;switch(l.type){case"decode":i._callbacks[l.id].resolve(l);break;case"error":i._callbacks[l.id].reject(l);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+l.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,r){return i._taskLoad>r._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function rG(){let s,e;onmessage=function(l){const c=l.data;switch(c.type){case"init":s=c.decoderConfig,e=new Promise(function(d){s.onModuleLoaded=function(p){d({draco:p})},DracoDecoderModule(s)});break;case"decode":const u=c.buffer,h=c.taskConfig;e.then(d=>{const p=d.draco,m=new p.Decoder,g=new p.DecoderBuffer;g.Init(new Int8Array(u),u.byteLength);try{const _=t(p,m,g,h),b=_.attributes.map(v=>v.array.buffer);_.index&&b.push(_.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:_},b)}catch(_){console.error(_),self.postMessage({type:"error",id:c.id,error:_.message})}finally{p.destroy(g),p.destroy(m)}});break}};function t(l,c,u,h){const d=h.attributeIDs,p=h.attributeTypes;let m,g;const _=c.GetEncodedGeometryType(u);if(_===l.TRIANGULAR_MESH)m=new l.Mesh,g=c.DecodeBufferToMesh(u,m);else if(_===l.POINT_CLOUD)m=new l.PointCloud,g=c.DecodeBufferToPointCloud(u,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const b={index:null,attributes:[]};for(const v in d){const y=self[p[v]];let A,S;if(h.useUniqueIDs)S=d[v],A=c.GetAttributeByUniqueId(m,S);else{if(S=c.GetAttributeId(m,l[d[v]]),S===-1)continue;A=c.GetAttribute(m,S)}b.attributes.push(i(l,c,m,v,y,A))}return _===l.TRIANGULAR_MESH&&(b.index=n(l,c,m)),l.destroy(m),b}function n(l,c,u){const d=u.num_faces()*3,p=d*4,m=l._malloc(p);c.GetTrianglesUInt32Array(u,p,m);const g=new Uint32Array(l.HEAPF32.buffer,m,d).slice();return l._free(m),{array:g,itemSize:1}}function i(l,c,u,h,d,p){const m=p.num_components(),_=u.num_points()*m,b=_*d.BYTES_PER_ELEMENT,v=r(l,d),y=l._malloc(b);c.GetAttributeDataArrayForAllPoints(u,p,v,b,y);const A=new d(l.HEAPF32.buffer,y,_).slice();return l._free(y),{name:h,array:A,itemSize:m}}function r(l,c){switch(c){case Float32Array:return l.DT_FLOAT32;case Int8Array:return l.DT_INT8;case Int16Array:return l.DT_INT16;case Int32Array:return l.DT_INT32;case Uint8Array:return l.DT_UINT8;case Uint16Array:return l.DT_UINT16;case Uint32Array:return l.DT_UINT32}}}const PM=new Ln,Of=new G;class Z_ extends U_{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new tt(e,3)),this.setAttribute("uv",new tt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new _p(t,6,1);return this.setAttribute("instanceStart",new wi(n,3,0)),this.setAttribute("instanceEnd",new wi(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new _p(n,t*2,1);return this.setAttribute("instanceColorStart",new wi(i,t,0)),this.setAttribute("instanceColorEnd",new wi(i,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new E_(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ln);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),PM.setFromBufferAttribute(t),this.boundingBox.union(PM))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let r=0,l=e.count;r<l;r++)Of.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Of)),Of.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(Of));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class BT extends Z_{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e,t=3){const n=e.length-t,i=new Float32Array(2*n);if(t===3)for(let r=0;r<n;r+=t)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];else for(let r=0;r<n;r+=t)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5],i[2*r+6]=e[r+6],i[2*r+7]=e[r+7];return super.setColors(i,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Q_ extends Ii{constructor(e){super({type:"LineMaterial",uniforms:xp.clone(xp.merge([je.common,je.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new xe(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
4188				#include <common>
4189				#include <fog_pars_vertex>
4190				#include <logdepthbuf_pars_vertex>
4191				#include <clipping_planes_pars_vertex>
4192
4193				uniform float linewidth;
4194				uniform vec2 resolution;
4195
4196				attribute vec3 instanceStart;
4197				attribute vec3 instanceEnd;
4198
4199				#ifdef USE_COLOR
4200					#ifdef USE_LINE_COLOR_ALPHA
4201						varying vec4 vLineColor;
4202						attribute vec4 instanceColorStart;
4203						attribute vec4 instanceColorEnd;
4204					#else
4205						varying vec3 vLineColor;
4206						attribute vec3 instanceColorStart;
4207						attribute vec3 instanceColorEnd;
4208					#endif
4209				#endif
4210
4211				#ifdef WORLD_UNITS
4212
4213					varying vec4 worldPos;
4214					varying vec3 worldStart;
4215					varying vec3 worldEnd;
4216
4217					#ifdef USE_DASH
4218
4219						varying vec2 vUv;
4220
4221					#endif
4222
4223				#else
4224
4225					varying vec2 vUv;
4226
4227				#endif
4228
4229				#ifdef USE_DASH
4230
4231					uniform float dashScale;
4232					attribute float instanceDistanceStart;
4233					attribute float instanceDistanceEnd;
4234					varying float vLineDistance;
4235
4236				#endif
4237
4238				void trimSegment( const in vec4 start, inout vec4 end ) {
4239
4240					// trim end segment so it terminates between the camera plane and the near plane
4241
4242					// conservative estimate of the near plane
4243					float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
4244					float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
4245					float nearEstimate = - 0.5 * b / a;
4246
4247					float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
4248
4249					end.xyz = mix( start.xyz, end.xyz, alpha );
4250
4251				}
4252
4253				void main() {
4254
4255					#ifdef USE_COLOR
4256
4257						vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
4258
4259					#endif
4260
4261					#ifdef USE_DASH
4262
4263						vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
4264						vUv = uv;
4265
4266					#endif
4267
4268					float aspect = resolution.x / resolution.y;
4269
4270					// camera space
4271					vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
4272					vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
4273
4274					#ifdef WORLD_UNITS
4275
4276						worldStart = start.xyz;
4277						worldEnd = end.xyz;
4278
4279					#else
4280
4281						vUv = uv;
4282
4283					#endif
4284
4285					// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
4286					// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
4287					// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
4288					// perhaps there is a more elegant solution -- WestLangley
4289
4290					bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
4291
4292					if ( perspective ) {
4293
4294						if ( start.z < 0.0 && end.z >= 0.0 ) {
4295
4296							trimSegment( start, end );
4297
4298						} else if ( end.z < 0.0 && start.z >= 0.0 ) {
4299
4300							trimSegment( end, start );
4301
4302						}
4303
4304					}
4305
4306					// clip space
4307					vec4 clipStart = projectionMatrix * start;
4308					vec4 clipEnd = projectionMatrix * end;
4309
4310					// ndc space
4311					vec3 ndcStart = clipStart.xyz / clipStart.w;
4312					vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
4313
4314					// direction
4315					vec2 dir = ndcEnd.xy - ndcStart.xy;
4316
4317					// account for clip-space aspect ratio
4318					dir.x *= aspect;
4319					dir = normalize( dir );
4320
4321					#ifdef WORLD_UNITS
4322
4323						// get the offset direction as perpendicular to the view vector
4324						vec3 worldDir = normalize( end.xyz - start.xyz );
4325						vec3 offset;
4326						if ( position.y < 0.5 ) {
4327
4328							offset = normalize( cross( start.xyz, worldDir ) );
4329
4330						} else {
4331
4332							offset = normalize( cross( end.xyz, worldDir ) );
4333
4334						}
4335
4336						// sign flip
4337						if ( position.x < 0.0 ) offset *= - 1.0;
4338
4339						float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
4340
4341						// don't extend the line if we're rendering dashes because we
4342						// won't be rendering the endcaps
4343						#ifndef USE_DASH
4344
4345							// extend the line bounds to encompass  endcaps
4346							start.xyz += - worldDir * linewidth * 0.5;
4347							end.xyz += worldDir * linewidth * 0.5;
4348
4349							// shift the position of the quad so it hugs the forward edge of the line
4350							offset.xy -= dir * forwardOffset;
4351							offset.z += 0.5;
4352
4353						#endif
4354
4355						// endcaps
4356						if ( position.y > 1.0 || position.y < 0.0 ) {
4357
4358							offset.xy += dir * 2.0 * forwardOffset;
4359
4360						}
4361
4362						// adjust for linewidth
4363						offset *= linewidth * 0.5;
4364
4365						// set the world position
4366						worldPos = ( position.y < 0.5 ) ? start : end;
4367						worldPos.xyz += offset;
4368
4369						// project the worldpos
4370						vec4 clip = projectionMatrix * worldPos;
4371
4372						// shift the depth of the projected points so the line
4373						// segments overlap neatly
4374						vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
4375						clip.z = clipPose.z * clip.w;
4376
4377					#else
4378
4379						vec2 offset = vec2( dir.y, - dir.x );
4380						// undo aspect ratio adjustment
4381						dir.x /= aspect;
4382						offset.x /= aspect;
4383
4384						// sign flip
4385						if ( position.x < 0.0 ) offset *= - 1.0;
4386
4387						// endcaps
4388						if ( position.y < 0.0 ) {
4389
4390							offset += - dir;
4391
4392						} else if ( position.y > 1.0 ) {
4393
4394							offset += dir;
4395
4396						}
4397
4398						// adjust for linewidth
4399						offset *= linewidth;
4400
4401						// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
4402						offset /= resolution.y;
4403
4404						// select end
4405						vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
4406
4407						// back to clip space
4408						offset *= clip.w;
4409
4410						clip.xy += offset;
4411
4412					#endif
4413
4414					gl_Position = clip;
4415
4416					vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
4417
4418					#include <logdepthbuf_vertex>
4419					#include <clipping_planes_vertex>
4420					#include <fog_vertex>
4421
4422				}
4423			`,fragmentShader:`
4424				uniform vec3 diffuse;
4425				uniform float opacity;
4426				uniform float linewidth;
4427
4428				#ifdef USE_DASH
4429
4430					uniform float dashOffset;
4431					uniform float dashSize;
4432					uniform float gapSize;
4433
4434				#endif
4435
4436				varying float vLineDistance;
4437
4438				#ifdef WORLD_UNITS
4439
4440					varying vec4 worldPos;
4441					varying vec3 worldStart;
4442					varying vec3 worldEnd;
4443
4444					#ifdef USE_DASH
4445
4446						varying vec2 vUv;
4447
4448					#endif
4449
4450				#else
4451
4452					varying vec2 vUv;
4453
4454				#endif
4455
4456				#include <common>
4457				#include <fog_pars_fragment>
4458				#include <logdepthbuf_pars_fragment>
4459				#include <clipping_planes_pars_fragment>
4460
4461				#ifdef USE_COLOR
4462					#ifdef USE_LINE_COLOR_ALPHA
4463						varying vec4 vLineColor;
4464					#else
4465						varying vec3 vLineColor;
4466					#endif
4467				#endif
4468
4469				vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
4470
4471					float mua;
4472					float mub;
4473
4474					vec3 p13 = p1 - p3;
4475					vec3 p43 = p4 - p3;
4476
4477					vec3 p21 = p2 - p1;
4478
4479					float d1343 = dot( p13, p43 );
4480					float d4321 = dot( p43, p21 );
4481					float d1321 = dot( p13, p21 );
4482					float d4343 = dot( p43, p43 );
4483					float d2121 = dot( p21, p21 );
4484
4485					float denom = d2121 * d4343 - d4321 * d4321;
4486
4487					float numer = d1343 * d4321 - d1321 * d4343;
4488
4489					mua = numer / denom;
4490					mua = clamp( mua, 0.0, 1.0 );
4491					mub = ( d1343 + d4321 * ( mua ) ) / d4343;
4492					mub = clamp( mub, 0.0, 1.0 );
4493
4494					return vec2( mua, mub );
4495
4496				}
4497
4498				void main() {
4499
4500					#include <clipping_planes_fragment>
4501
4502					#ifdef USE_DASH
4503
4504						if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
4505
4506						if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
4507
4508					#endif
4509
4510					float alpha = opacity;
4511
4512					#ifdef WORLD_UNITS
4513
4514						// Find the closest points on the view ray and the line segment
4515						vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
4516						vec3 lineDir = worldEnd - worldStart;
4517						vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
4518
4519						vec3 p1 = worldStart + lineDir * params.x;
4520						vec3 p2 = rayEnd * params.y;
4521						vec3 delta = p1 - p2;
4522						float len = length( delta );
4523						float norm = len / linewidth;
4524
4525						#ifndef USE_DASH
4526
4527							#ifdef USE_ALPHA_TO_COVERAGE
4528
4529								float dnorm = fwidth( norm );
4530								alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
4531
4532							#else
4533
4534								if ( norm > 0.5 ) {
4535
4536									discard;
4537
4538								}
4539
4540							#endif
4541
4542						#endif
4543
4544					#else
4545
4546						#ifdef USE_ALPHA_TO_COVERAGE
4547
4548							// artifacts appear on some hardware if a derivative is taken within a conditional
4549							float a = vUv.x;
4550							float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4551							float len2 = a * a + b * b;
4552							float dlen = fwidth( len2 );
4553
4554							if ( abs( vUv.y ) > 1.0 ) {
4555
4556								alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
4557
4558							}
4559
4560						#else
4561
4562							if ( abs( vUv.y ) > 1.0 ) {
4563
4564								float a = vUv.x;
4565								float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4566								float len2 = a * a + b * b;
4567
4568								if ( len2 > 1.0 ) discard;
4569
4570							}
4571
4572						#endif
4573
4574					#endif
4575
4576					vec4 diffuseColor = vec4( diffuse, alpha );
4577					#ifdef USE_COLOR
4578						#ifdef USE_LINE_COLOR_ALPHA
4579							diffuseColor *= vLineColor;
4580						#else
4581							diffuseColor.rgb *= vLineColor;
4582						#endif
4583					#endif
4584
4585					#include <logdepthbuf_fragment>
4586
4587					gl_FragColor = diffuseColor;
4588
4589					#include <tonemapping_fragment>
4590					#include <${K_>=154?"colorspace_fragment":"encodings_fragment"}>
4591					#include <fog_fragment>
4592					#include <premultiplied_alpha_fragment>
4593
4594				}
4595			`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}
4595,alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const D0=new Ht,LM=new G,DM=new G,Kn=new Ht,qn=new Ht,ks=new Ht,F0=new G,N0=new ft,Zn=new q1,FM=new G,Uf=new Ln,Gf=new Dn,Hs=new Ht;let js,pa;function NM(s,e,t){return Hs.set(0,0,-e,1).applyMatrix4(s.projectionMatrix),Hs.multiplyScalar(1/Hs.w),Hs.x=pa/t.width,Hs.y=pa/t.height,Hs.applyMatrix4(s.projectionMatrixInverse),Hs.multiplyScalar(1/Hs.w),Math.abs(Math.max(Hs.x,Hs.y))}function oG(s,e){const t=s.matrixWorld,n=s.geometry,i=n.attributes.instanceStart,r=n.attributes.instanceEnd,l=Math.min(n.instanceCount,i.count);for(let c=0,u=l;c<u;c++){Zn.start.fromBufferAttribute(i,c),Zn.end.fromBufferAttribute(r,c),Zn.applyMatrix4(t);const h=new G,d=new G;js.distanceSqToSegment(Zn.start,Zn.end,d,h),d.distanceTo(h)<pa*.5&&e.push({point:d,pointOnLine:h,distance:js.origin.distanceTo(d),object:s,face:null,faceIndex:c,uv:null,[wT]:null})}}function aG(s,e,t){const n=e.projectionMatrix,r=s.material.resolution,l=s.matrixWorld,c=s.geometry,u=c.attributes.instanceStart,h=c.attributes.instanceEnd,d=Math.min(c.instanceCount,u.count),p=-e.near;js.at(1,ks),ks.w=1,ks.applyMatrix4(e.matrixWorldInverse),ks.applyMatrix4(n),ks.multiplyScalar(1/ks.w),ks.x*=r.x/2,ks.y*=r.y/2,ks.z=0,F0.copy(ks),N0.multiplyMatrices(e.matrixWorldInverse,l);for(let m=0,g=d;m<g;m++){if(Kn.fromBufferAttribute(u,m),qn.fromBufferAttribute(h,m),Kn.w=1,qn.w=1,Kn.applyMatrix4(N0),qn.applyMatrix4(N0),Kn.z>p&&qn.z>p)continue;if(Kn.z>p){const S=Kn.z-qn.z,T=(Kn.z-p)/S;Kn.lerp(qn,T)}else if(qn.z>p){const S=qn.z-Kn.z,T=(qn.z-p)/S;qn.lerp(Kn,T)}Kn.applyMatrix4(n),qn.applyMatrix4(n),Kn.multiplyScalar(1/Kn.w),qn.multiplyScalar(1/qn.w),Kn.x*=r.x/2,Kn.y*=r.y/2,qn.x*=r.x/2,qn.y*=r.y/2,Zn.start.copy(Kn),Zn.start.z=0,Zn.end.copy(qn),Zn.end.z=0;const b=Zn.closestPointToPointParameter(F0,!0);Zn.at(b,FM);const v=l_.lerp(Kn.z,qn.z,b),y=v>=-1&&v<=1,A=F0.distanceTo(FM)<pa*.5;if(y&&A){Zn.start.fromBufferAttribute(u,m),Zn.end.fromBufferAttribute(h,m),Zn.start.applyMatrix4(l),Zn.end.applyMatrix4(l);const S=new G,T=new G;js.distanceSqToSegment(Zn.start,Zn.end,T,S),t.push({point:T,pointOnLine:S,distance:js.origin.distanceTo(T),object:s,face:null,faceIndex:m,uv:null,[wT]:null})}}}class PT extends An{constructor(e=new Z_,t=new Q_({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let l=0,c=0,u=t.count;l<u;l++,c+=2)LM.fromBufferAttribute(t,l),DM.fromBufferAttribute(n,l),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+LM.distanceTo(DM);const r=new _p(i,2,1);return e.setAttribute("instanceDistanceStart",new wi(r,1,0)),e.setAttribute("instanceDistanceEnd",new wi(r,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;js=e.ray;const l=this.matrixWorld,c=this.geometry,u=this.material;pa=u.linewidth+r,c.boundingSphere===null&&c.computeBoundingSphere(),Gf.copy(c.boundingSphere).applyMatrix4(l);let h;if(n)h=pa*.5;else{const p=Math.max(i.near,Gf.distanceToPoint(js.origin));h=NM(i,p,u.resolution)}
4595if(Gf.radius+=h,js.intersectsSphere(Gf)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),Uf.copy(c.boundingBox).applyMatrix4(l);let d;if(n)d=pa*.5;else{const p=Math.max(i.near,Uf.distanceToPoint(js.origin));d=NM(i,p,u.resolution)}Uf.expandByScalar(d),js.intersectsBox(Uf)!==!1&&(n?oG(this,t):aG(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(D0),this.material.uniforms.resolution.value.set(D0.z,D0.w))}}class lG extends PT{constructor(e=new BT,t=new Q_({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}let kf;const O0=()=>{if(kf)return kf;const s="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXG
4595XAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMC
4595FWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9
4595LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let i=s;WebAssembly.validate(t)&&(i=e);let r;const l=WebAssembly.instantiate(c(i),{}).then(p=>
4595{r=p.instance,r.exports.__wasm_call_ctors()});function c(p){const m=new Uint8Array(p.length);for(let _=0;_<p.length;++_){const b=p.charCodeAt(_);m[_]=b>96?b-71:b>64?b-65:b>47?b+4:b>46?63:62}let g=0;for(let _=0;_<p.length;++_)m[g++]=m[_]<60?n[m[_]]:(m[_]-60)*64+m[++_];return m.buffer.slice(0,g)}function u(p,m,g,_,b,v){const y=r.exports.sbrk,A=g+3&-4,S=y(A*_),T=y(b.length),B=new Uint8Array(r.exports.memory.buffer);B.set(b,T);const R=p(S,g,_,T,b.length);if(R===0&&v&&v(S,A,_),m.set(B.subarray(S,S+g*_)),y(S-y(0)),R!==0)throw new Error(`Malformed buffer data: ${R}`)}const h={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},d={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return kf={ready:l,supported:!0,decodeVertexBuffer(p,m,g,_,b){u(r.exports.meshopt_decodeVertexBuffer,p,m,g,_,r.exports[h[b]])},decodeIndexBuffer(p,m,g,_){u(r.exports.meshopt_decodeIndexBuffer,p,m,g,_)},decodeIndexSequence(p,m,g,_){u(r.exports.meshopt_decodeIndexSequence,p,m,g,_)},decodeGltfBuffer(p,m,g,_,b,v){u(r.exports[d[b]],p,m,g,_,r.exports[h[v]])}},kf},cG=k.forwardRef(function({points:e,color:t=16777215,vertexColors:n,linewidth:i,lineWidth:r,segments:l,dashed:c,...u},h){var d,p;const m=Ks(y=>y.size),g=k.useMemo(()=>l?new PT:new lG,[l]),[_]=k.useState(()=>new Q_),b=(n==null||(d=n[0])==null?void 0:d.length)===4?4:3,v=k.useMemo(()=>{const y=l?new Z_:new BT,A=e.map(S=>{const T=Array.isArray(S);return S instanceof G||S instanceof Ht?[S.x,S.y,S.z]:S instanceof xe?[S.x,S.y,0]:T&&S.length===3?[S[0],S[1],S[2]]:T&&S.length===2?[S[0],S[1],0]:S});if(y.setPositions(A.flat()),n){t=16777215;const S=n.map(T=>T instanceof we?T.toArray():T);y.setColors(S.flat(),b)}return y},[e,l,n,b]);return k.useLayoutEffect(()=>{g.computeLineDistances()},[e,g]),k.useLayoutEffect(()=>{c?_.defines.USE_DASH="":delete _.defines.USE_DASH,_.needsUpdate=!0},[c,_]),k.useEffect(()=>()=>{v.dispose(),_.dispose()},[v]),k.createElement("primitive",Xl({object:g,ref:h},u),k.createElement("primitive",{object:v,attach:"geometry"}),k.createElement("primitive",Xl({object:_,attach:"material",color:t,vertexColors:!!n,resolution:[m.width,m.height],linewidth:(p=i??r)!==null&&p!==void 0?p:1,dashed:c,transparent:b===4},u)))});let Hf=null,LT="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function DT(s=!0,e=!0,t){return n=>{t&&t(n),s&&(Hf||(Hf=new sG),Hf.setDecoderPath(typeof s=="string"?s:LT),n.setDRACOLoader(Hf)),e&&n.setMeshoptDecoder(typeof O0=="function"?O0():O0)}}const hm=(s,e,t,n)=>eh(q_,s,DT(e,t,n));hm.preload=(s,e,t,n)=>eh.preload(q_,s,DT(e,t,n));hm.clear=s=>eh.clear(q_,s);hm.setDecoderPath=s=>{LT=s};function uG(s,e,t){const n=Ks(g=>g.size),i=Ks(g=>g.viewport),r=typeof s=="number"?s:n.width*i.dpr,l=n.height*i.dpr,c=(typeof s=="number"?t:s)||{},{samples:u=0,depth:h,...d}=c,p=h??c.depthBuffer,m=k.useMemo(()=>{const g=new Ri(r,l,{minFilter:nn,magFilter:nn,type:bs,...d});return p&&(g.depthTexture=new _o(r,l,oi)),g.samples=u,g},[]);return k.useLayoutEffect(()=>{m.setSize(r,l),u&&(m.samples=u)},[u,m,r,l]),k.useEffect(()=>()=>m.dispose(),[]),m}const hG=s=>typeof s=="function",fG=k.forwardRef(({envMap:s,resolution:e=256,frames:t=1/0,children:n,makeDefault:i,...r},l)=>{const c=Ks(({set:v})=>v),u=Ks(({camera:v})=>v),h=Ks(({size:v})=>v),d=k.useRef(null);k.useImperativeHandle(l,()=>d.current,[]);const p=k.useRef(null),m=uG(e);k.useLayoutEffect(()=>{r.manual||d.current.updateProjectionMatrix()},[h,r]),k.useLayoutEffect(()=>{d.current.updateProjectionMatrix()}),k.useLayoutEffect(()=>{if(i){const v=u;return c(()=>({camera:d.current})),()=>c(()=>({camera:v}))}},[d,i,c]);let g=0,_=null;const b=hG(n);return jt(v=>{b&&(t===1/0||g<t)&&(p.current.visible=!1,v.gl.setRenderTarget(m),_=v.scene.background,s&&(v.scene.background=s),v.gl.render(v.scene,d.current),v.scene.background=_,v.gl.setRenderTarget(null),p.current.visible=!0,g++)}),k.createElement(k.Fragment,null,k.createElement("orthographicCamera",Xl({left:h.width/-2,right:h.width/2,top:h.height/2,bottom:h.height/-2,ref:d},r),!b&&n),k.createElement("group",{ref:p},b&&n(m.texture)))}),dG=[{id:"andon_bioreactor",pos:[-11.5,-17]},{id:"andon_media_prep",pos:[-11.5,-9]},{id:"andon_harvest",pos:[12.5,-17]},{id:"andon_chromatography",pos:[28.5,-17]},{id:"andon_uf_df",pos:[28.5,-9]},{id:"andon_formulation",pos:[12.5,7]},{id:"andon_filling",pos:[32.5,11]},{id:"andon_lyophilization",pos:[32.5,19]},{id:"andon_qc_lab",pos:[-3.5,11]},{id:"andon_stability",pos:[-7.5,19]},{id:"andon_finished",pos:[52.5,11]},{id:"andon_batch_office",pos:[12.5,-1]}],pG="andon_qc_lab",OM=10,mG=4;function gG(s,e){return(s*7919+13)%e}function FT(s,e=dG){if(s<OM)return e.find(n=>n.id===pG)??e[0];const t=Math.floor((s-OM)/mG);return e[gG(t,e.length)]}const NT=s=>s<0?0:s>1?1:s,sn=(s,e,t)=>NT((s-e)/(t-e)),on=s=>1-Math.pow(1-s,3),xG=s=>s<.5?4*s*s*s:1-Math.pow(-2*s+2,3)/2;function $t(s,e){return e?xG(NT((s-e.startSec)/e.durationSec)):0}function _G(s,e,t){return s<e?1:s<t?1-(s-e)/(t-e):0}function an(s,e,t,n,i){if(!i)return{tCycle:s,globalAlpha:1};const r=s%e;return{tCycle:r,globalAlpha:_G(r,t,n)}}const Tn=[.6,1.4],yG=.04,UM=.025,U0=1.4,GM=.09,G0=.06,Qr=.07,qo=.12,k0=.005,vG="#ff3a36",bG="#ffd400",AG="#5cd65c",OT="#15171c",H0=2.4,z0=0;function MG({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=s.variant??"",u=k.useRef(null),h=k.useMemo(()=>new et({color:s.color??"#1f2937",roughness:.6,metalness:.4,transparent:!0,opacity:0}
4595),[s.color]),d=k.useMemo(()=>V0(),[]),p=k.useMemo(()=>V0(),[]),m=k.useMemo(()=>V0(),[]);k.useEffect(()=>()=>{h.dispose(),d.dispose(),p.dispose(),m.dispose()},[h,d,p,m]),jt(v=>{const{tCycle:y,globalAlpha:A}=an(v.clock.elapsedTime,e,t,n,i),S=on(sn(y,l[0],l[1])),T=$t(v.clock.elapsedTime,r),B=1-(1-yG)*T,R=s.fadeOnOrtho?1-T:1,L=u.current;L&&(L.scale.y=S*B,L.visible=A>.001&&S>0);const w=A*S*R;h.opacity=w,d.opacity=w,p.opacity=w,m.opacity=w;const I=v.clock.elapsedTime,D=FT(I).id===s.id?"red":c,z=D===""||D==="red",X=D===""||D==="yellow",Y=D===""||D==="green",V=z?I*1.5%1<.5?1:.18:1,H=z?H0*V:z0,W=X?H0:z0,q=Y?H0:z0;W0(d,z,vG,H*R),W0(p,X,bG,W*R),W0(m,Y,AG,q*R)});const g=U0+qo/2+k0,_=g+qo+k0,b=_+qo+k0;return C.jsxs("group",{ref:u,children:[C.jsx("mesh",{position:[0,G0/2,0],material:h,children:C.jsx("cylinderGeometry",{args:[GM,GM,G0,16]})}),C.jsx("mesh",{position:[0,G0+U0/2,0],material:h,children:C.jsx("cylinderGeometry",{args:[UM,UM,U0,10]})}),C.jsx("mesh",{position:[0,g,0],material:m,children:C.jsx("cylinderGeometry",{args:[Qr,Qr,qo,16]})}),C.jsx("mesh",{position:[0,_,0],material:p,children:C.jsx("cylinderGeometry",{args:[Qr,Qr,qo,16]})}),C.jsx("mesh",{position:[0,b,0],material:d,children:C.jsx("cylinderGeometry",{args:[Qr,Qr,qo,16]})}),C.jsx("mesh",{position:[0,b+qo/2+.01,0],material:h,children:C.jsx("cylinderGeometry",{args:[Qr*.8,Qr*.5,.06,12]})})]})}function V0(){return new et({color:OT,roughness:.35,metalness:0,emissive:new we("#000000"),emissiveIntensity:0,transparent:!0,opacity:0})}function W0(s,e,t,n){e?(s.color.set(t),s.emissive.set(t)):(s.color.set(OT),s.emissive.set("#000000")),s.emissiveIntensity=n}const SG=.04,EG=.9,kM={press:{body:"#3a4048",accent:"#9aa3ac",metalness:.7},vise:{body:"#1f2937",accent:"#6b7280",metalness:.6},drill:{body:"#374151",accent:"#fbbf24",metalness:.6},microscope:{body:"#1f2937",accent:"#9aa3ac",metalness:.4}};function TG({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.variant??"press",c=kM[l]??kM.press,u=s.rise??Tn,h=k.useRef(null),d=k.useMemo(()=>new et({color:s.color??c.body,roughness:.45,metalness:c.metalness,transparent:!0,opacity:0}),[s.color,c]),p=k.useMemo(()=>new et({color:c.accent,roughness:.35,metalness:.7,transparent:!0,opacity:0}),[c.accent]);return k.useEffect(()=>()=>{d.dispose(),p.dispose()},[d,p]),jt(m=>{const{tCycle:g,globalAlpha:_}=an(m.clock.elapsedTime,e,t,n,i),b=on(sn(g,u[0],u[1])),v=$t(m.clock.elapsedTime,r),y=1-(1-SG)*v,A=s.fadeOnOrtho?1-v:1,S=h.current;S&&(S.scale.y=b*y,S.visible=_>.001&&b>0);const T=_*b*A;d.opacity=T,p.opacity=T}),C.jsxs("group",{ref:h,position:[0,EG,0],children:[l==="press"?C.jsx(CG,{body:d,accent:p}):null,l==="vise"?C.jsx(wG,{body:d,accent:p}):null,l==="drill"?C.jsx(RG,{body:d,accent:p}):null,l==="microscope"?C.jsx(IG,{body:d,accent:p}):null]})}function CG({body:s,accent:e}){return C.jsxs(C.Fragment,{children:[C.jsx("mesh",{position:[0,.04,0],material:s,children:C.jsx("boxGeometry",{args:[.32,.08,.32]})}),C.jsx("mesh",{position:[-.1,.32,0],material:s,children:C.jsx("cylinderGeometry",{args:[.04,.04,.5,12]})}),C.jsx("mesh",{position:[.04,.55,0],material:s,children:C.jsx("boxGeometry",{args:[.36,.08,.16]})}),C.jsx("mesh",{position:[.08,.46,0],material:e,children:C.jsx("cylinderGeometry",{args:[.05,.05,.1,12]})})]})}function wG({body:s,accent:e}){return C.jsxs(C.Fragment,{children:[C.jsx("mesh",{position:[0,.03,0],material:s,children:C.jsx("boxGeometry",{args:[.4,.06,.18]})}),C.jsx("mesh",{position:[-.12,.13,0],material:s,children:C.jsx("boxGeometry",{args:[.06,.14,.18]})}),C.jsx("mesh",{position:[.06,.13,0],material:s,children:C.jsx("boxGeometry",{args:[.06,.14,.18]})}),C.jsx("mesh",{position:[.18,.1,0],rotation:[0,0,Math.PI/2],material:e,children:C.jsx("cylinderGeometry",{args:[.018,.018,.18,8]})}),C.jsx("mesh",{position:[.28,.1,0],material:e,children:C.jsx("cylinderGeometry",{args:[.04,.04,.02,12]})})]})}function RG({body:s,accent:e}){return C.jsxs(C.Fragment,{children:[C.jsx("mesh",{position:[0,.025,0],material:s,children:C.jsx("cylinderGeometry",{args:[.18,.2,.05,16]})}),C.jsx("mesh",{position:[0,.34,0],material:s,children:C.jsx("cylinderGeometry",{args:[.035,.035,.6,12]})}),C.jsx("mesh",{position:[.03,.62,0],material:s,children:C.jsx("boxGeometry",{args:[.18,.14,.12]})}),C.jsx("mesh",{position:[.03,.5,0],material:e,children:C.jsx("cylinderGeometry",{args:[.025,.018,.08,10]})})]})}function IG({body:s,accent:e}){return C.jsxs(C.Fragment,{children:[C.jsx("mesh",{position:[0,.025,0],material:s,children:C.jsx("cylinderGeometry",{args:[.14,.16,.05,16]})}),C.jsx("mesh",{position:[-.04,.18,0],material:s,children:C.jsx("boxGeometry",{args:[.05,.26,.08]})}),C.jsx("mesh",{position:[.05,.36,0],rotation:[0,0,-.5],material:s,children:C.jsx("boxGeometry",{args:[.18,.06,.08]})}),C.jsx("mesh",{position:[.13,.32,0],material:e,children:C.jsx("cylinderGeometry",{args:[.025,.025,.15,12]})}),C.jsx("mesh",{position:[.02,.12,0],material:e,children:C.jsx("boxGeometry",{args:[.18,.02,.12]})})]})}const BG={"+x":{offsetAxis:"x",sign:1,rotY:Math.PI/2},"-x":{offsetAxis:"x",sign:-1,rotY:-Math.PI/2},"+z":{offsetAxis:"z",sign:1,rotY:0},"-z":{offsetAxis:"z",sign:-1,rotY:Math.PI}};function PG({position:s=[0,0,0],width:e,height:t,depth:n,screenFace:i="+x",screenWidthFrac:r=.7,screenHeightFrac:l=.5,screenYFrac:c=.55,bodyMaterial:u,screenMaterial:h}){const[d,p,m]=s,g=BG[i],_=(g.offsetAxis==="x"?n:e)*r,b=t*l,v=(g.offsetAxis==="x"?e:n)/2+.002,y=[g.offsetAxis==="x"?g.sign*v:0,t*c,g.offsetAxis==="z"?g.sign*v:0];return C.jsxs("group",{position:[d,p,m],children:[C.jsx("mesh",{position:[0,t/2,0],material:u,children:C.jsx("boxGeometry",{args:[e,t,n]})}),h?C.jsx("mesh",{position:y,rotation:[0,g.rotY,0],material:h,children:C.jsx("planeGeometry",{args:[_,b]})}):null]})}function LG({position:s=[0,0,0],radius:e,height:t,dishDepth:n=.3,shellMaterial:i,band:r,noBottomDish:l=!1,noTopDish:c=!1,segments:u=24}){const[h,d,p]=s;return C.jsxs("group",{position:[h,d,p],children:[l?null:C.jsx("mesh",{position:[0,0,0],scale:[1,n,1],material:i,children:C.jsx("sphereGeometry",{args:[e,u,Math.max(8,u/2),0,Math.PI*2,Math.PI/2,Math.PI/2]})}),C.jsx("mesh",{position:[0,t/2,0],material:i,children:C.jsx("cylinderGeometry",{args:[e,e,t,u]})}),r?C.jsx("mesh",{position:[0,r.y,0],material:r.material,children:C.jsx("cylinderGeometry",{args:[e+(r.radiusOffset??.03),e+(r.radiusOffset??.03),r.thickness??.12,u]})}):null,c?null:C.jsx("mesh",{position:[0,t,0],scale:[1,n,1],material:i,children:C.jsx("sphereGeometry",{args:[e,u,Math.max(8,u/2),0,Math.PI*2,0,Math.PI/2]})})]})}function DG({position:s=[0,0,0],flangeRadius:e,flangeHeight:t,boxWidth:n,boxHeight:i,boxDepth:r,flangeMaterial:l,boxMaterial:c}){const[u,h,d]=s;return C.jsxs("group",{position:[u,h,d],children:[C.jsx("mesh",{position:[0,t/2,0],material:l,children:C.jsx("cylinderGeometry",{args:[e,e,t,16]})}),C.jsx("mesh",{position:[0,t+i/2,0],material:c,children:C.jsx("boxGeometry",{args:[n,i,r]})})]})}function FG({position:s=[0,0,0],vesselRadius:e,ports:t,portRadius:n,portLength:i,material:r}){const[l,c,u]=s;return C.jsx("group",{position:[l,c,u],children:t.map((h,d)=>C.jsx("group",{rotation:[0,h.angle??0,0],children:C.jsx("mesh",{position:[e+i/2,h.y,0],rotation:[0,0,Math.PI/2],material:r,children:C.jsx("cylinderGeometry",{args:[n,n,i,12]})})},d))})}function NG({position:s=[0,0,0],width:e,depth:t,height:n,material:i}
4595){const[r,l,c]=s;return C.jsx("mesh",{position:[r,l+n/2,c],material:i,children:C.jsx("boxGeometry",{args:[e,n,t]})})}const OG=.04,zf=.7,eu=2,UG=.05,HM=.3,GG=.12,kG=.34,HG=.14,zG=.42,VG=.34,WG=.32,jG=.08,XG=.4,zM=1.8,JG=1.6,j0=.12,YG=.5,KG=.55,VM=.2;function qG({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#cdd2d7",roughness:.28,metalness:.85,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.5,metalness:.3,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.5,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose()},[u,h,d]),jt(_=>{const{tCycle:b,globalAlpha:v}=an(_.clock.elapsedTime,e,t,n,i),y=on(sn(b,l[0],l[1])),A=$t(_.clock.elapsedTime,r),S=1-(1-OG)*A,T=s.fadeOnOrtho?1-A:1,B=c.current;B&&(B.scale.y=y*S,B.visible=v>.001&&y>0);const R=v*y*T;u.opacity=R,h.opacity=R,d.opacity=R,d.emissiveIntensity=.5*T});const m=j0+UG,g=m+eu;return C.jsxs("group",{ref:c,children:[C.jsx(NG,{width:zM,depth:JG,height:j0,material:h}),C.jsx(LG,{position:[0,m,0],radius:zf,height:eu,dishDepth:HM,shellMaterial:u,band:{y:eu/2,thickness:GG,material:h}}),C.jsx(DG,{position:[0,g+zf*HM,0],flangeRadius:kG,flangeHeight:HG,boxWidth:zG,boxHeight:VG,boxDepth:WG,flangeMaterial:u,boxMaterial:h}),C.jsx(FG,{position:[0,m+eu/2,0],vesselRadius:zf,portRadius:jG,portLength:XG,ports:[{y:-.4},{y:0},{y:.4}],material:u}),C.jsx("mesh",{position:[zf+.005,m+eu/2+.6,0],rotation:[0,0,-Math.PI/2],material:h,children:C.jsx("cylinderGeometry",{args:[.1,.1,.005,16]})}),C.jsx(PG,{position:[zM/2+VM/2+.05,j0,0],width:VM,depth:YG,height:KG,screenFace:"+x",bodyMaterial:h,screenMaterial:d})]})}const ZG=.04,UT=1.6,WM=.5,X0=1,GT=3,Vf=UT/GT,QG=.015;function $G({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#3f60a8",roughness:.45,metalness:.35,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#cdd2d7",roughness:.3,metalness:.85,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose()},[u,h]);const d=k.useMemo(()=>{const p=[];for(let m=0;m<GT;m++)p.push({x:-UT/2+Vf*(m+.5)});return p},[]);return jt(p=>{const{tCycle:m,globalAlpha:g}=an(p.clock.elapsedTime,e,t,n,i),_=on(sn(m,l[0],l[1])),b=$t(p.clock.elapsedTime,r),v=1-(1-ZG)*b,y=s.fadeOnOrtho?1-b:1,A=c.current;A&&(A.scale.y=_*v,A.visible=g>.001&&_>0);const S=g*_*y;u.opacity=S,h.opacity=S}),C.jsx("group",{ref:c,children:d.map(({x:p},m)=>C.jsxs("group",{position:[p,X0/2,0],children:[C.jsx("mesh",{material:u,children:C.jsx("boxGeometry",{args:[Vf-QG*2,X0,WM]})}),C.jsx("mesh",{position:[Vf/4,X0/4,WM/2+.012],material:h,children:C.jsx("boxGeometry",{args:[Vf*.32,.02,.025]})})]},m))})}const ek=.04,tk=1,nk=1,Cl=.4,Wf=.25,jf=1.6,wl=.32,Zo=.18,ik=.7,Xf=.025,Jf=.6;function sk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:"#5e6b78",roughness:.55,metalness:.55,transparent:!0,opacity:0}),[]),h=k.useMemo(()=>new et({color:"#cdd2d7",roughness:.3,metalness:.85,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new ci({color:"#dde7ee",roughness:.05,metalness:0,transmission:.85,thickness:.05,ior:1.5,transparent:!0,opacity:0}),[]),p=k.useMemo(()=>new et({color:s.color??"#d8b070",roughness:.7,metalness:0,transparent:!0,opacity:0}),[s.color]),m=k.useMemo(()=>new et({color:"#1a1d22",roughness:.7,metalness:.05,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose()},[u,h,d,p,m]),jt(S=>{const{tCycle:T,globalAlpha:B}=an(S.clock.elapsedTime,e,t,n,i),R=on(sn(T,l[0],l[1])),L=$t(S.clock.elapsedTime,r),w=1-(1-ek)*L,I=s.fadeOnOrtho?1-L:1,O=c.current;O&&(O.scale.y=R*w,O.visible=B>.001&&R>0);const D=B*R*I;u.opacity=D,h.opacity=D,d.opacity=D*.55,p.opacity=D,m.opacity=D});const g=Cl/2,_=Cl+Zo/2,b=Cl+Zo+jf/2,v=Cl+Zo+jf+Zo/2,y=jf*ik,A=Cl+Zo+y/2;return C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,g,0],material:u,children:C.jsx("boxGeometry",{args:[tk,Cl,nk]})}),C.jsx("mesh",{position:[0,_,0],material:h,children:C.jsx("cylinderGeometry",{args:[wl,wl,Zo,24]})}),C.jsx("mesh",{position:[0,b,0],material:d,children:C.jsx("cylinderGeometry",{args:[Wf,Wf,jf,24,1,!0]})}),C.jsx("mesh",{position:[0,A,0],material:p,children:C.jsx("cylinderGeometry",{args:[Wf-.005,Wf-.005,y,24]})}),C.jsx("mesh",{position:[0,v,0],material:h,children:C.jsx("cylinderGeometry",{args:[wl,wl,Zo,24]})}),C.jsx("mesh",{position:[wl+.01,v-Jf/2,0],rotation:[0,0,0],material:m,children:C.jsx("cylinderGeometry",{args:[Xf,Xf,Jf,8]})}),C.jsx("mesh",{position:[-wl-.01,_+Jf/2,0],material:m,children:C.jsx("cylinderGeometry",{args:[Xf,Xf,Jf,8]})})]})}const rk=.04,jM=2,XM=1,Yf=.1,Kf=.05,J0=.6,zs=.32,Y0=1.4,qf=.04;function ok({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#cdd2d7",roughness:.3,metalness:.85,transparent:!0,opacity:0}
4595),[s.color]),h=k.useMemo(()=>new et({color:"#3a4048",roughness:.55,metalness:.55,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#1a1d22",roughness:.7,metalness:.05,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose()},[u,h,d]),jt(_=>{const{tCycle:b,globalAlpha:v}=an(_.clock.elapsedTime,e,t,n,i),y=on(sn(b,l[0],l[1])),A=$t(_.clock.elapsedTime,r),S=1-(1-rk)*A,T=s.fadeOnOrtho?1-A:1,B=c.current;B&&(B.scale.y=y*S,B.visible=v>.001&&y>0);const R=v*y*T;u.opacity=R,h.opacity=R,d.opacity=R});const p=Yf+J0+zs,m=jM/2-Kf*1.5,g=XM/2-Kf*1.5;return C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,Yf/2,0],material:h,children:C.jsx("boxGeometry",{args:[jM,Yf,XM]})}),[[-m,-g],[m,-g],[-m,g],[m,g]].map(([_,b],v)=>C.jsx("mesh",{position:[_,Yf+J0/2,b],material:h,children:C.jsx("boxGeometry",{args:[Kf,J0,Kf]})},v)),C.jsx("mesh",{position:[0,p,0],rotation:[0,0,Math.PI/2],material:u,children:C.jsx("cylinderGeometry",{args:[zs,zs,Y0,24]})}),C.jsx("mesh",{position:[Y0/2,p,0],rotation:[0,0,Math.PI/2],material:u,children:C.jsx("cylinderGeometry",{args:[zs+.04,zs+.04,.06,24]})}),C.jsx("mesh",{position:[-Y0/2,p,0],rotation:[0,0,Math.PI/2],material:u,children:C.jsx("cylinderGeometry",{args:[zs+.04,zs+.04,.06,24]})}),C.jsx("mesh",{position:[-.4,p+zs+.25,0],material:d,children:C.jsx("cylinderGeometry",{args:[qf,qf,.5,10]})}),C.jsx("mesh",{position:[.4,p-zs-.2,0],material:d,children:C.jsx("cylinderGeometry",{args:[qf,qf,.4,10]})}),C.jsx("mesh",{position:[.5,p,zs+.005],rotation:[Math.PI/2,0,0],material:h,children:C.jsx("cylinderGeometry",{args:[.08,.08,.01,16]})})]})}const ak=.04;function lk(s){return s.def.glbPath?C.jsx(ck,{children:C.jsx(k.Suspense,{fallback:null,children:C.jsx(uk,{...s})})}):null}class ck extends k.Component{constructor(){super(...arguments);Cb(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){typeof console<"u"&&console.warn&&console.warn("GlbAsset failed to load:",t.message)}render(){return this.state.hasError?null:this.props.children}}function uk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=`/assets/models/${s.glbPath.replace(/^\//,"")}`,c=hm(l),u=s.rise??Tn,h=k.useMemo(()=>c.scene.clone(!0),[c.scene]),d=k.useRef(!1);function p(){h.traverse(g=>{if(!g.isMesh)return;const _=g,b=_.material,y=(Array.isArray(b)?b:[b]).map(A=>{const S=A.clone();return S.transparent=!0,S.opacity=0,S});_.material=Array.isArray(b)?y:y[0]}),d.current=!0}const m=k.useRef(null);return jt(g=>{d.current||p();const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,u[0],u[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-ak)*y,S=s.fadeOnOrtho?1-y:1,T=m.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;h.traverse(R=>{if(!R.isMesh)return;const w=R.material;if(Array.isArray(w))for(const I of w)I.opacity=B;else w&&(w.opacity=B)})}),C.jsx("group",{ref:m,children:C.jsx("primitive",{object:h})})}const hk=.04,fk=.9,Rl=.4,tu=.55,ea=.13,kT=.002,zx=5,JM=.05,YM=.18,dk=4,K0=zx*ea+(zx-1)*kT,pk=["#1d4ed8","#0ea5e9","#22c55e","#f59e0b","#ef4444"];function mk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#e5e7eb",roughness:.55,metalness:.15,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.5,metalness:.3,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>pk.map(g=>new et({color:g,emissive:new we(g),emissiveIntensity:.7,roughness:.3,metalness:0,transparent:!0,opacity:0})),[]),p=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.55,transparent:!0,opacity:0}),[]),m=k.useMemo(()=>new ci({color:"#dde7ee",roughness:.15,metalness:0,transmission:.7,thickness:.05,ior:1.5,transparent:!0,opacity:0}),[]);return k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.forEach(g=>g.dispose()),p.dispose(),m.dispose()},[u,h,d,p,m]),jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,l[0],l[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-hk)*y,S=s.fadeOnOrtho?1-y:1,T=c.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;u.opacity=B,h.opacity=B;for(const R of d)R.opacity=B,R.emissiveIntensity=.7*S;p.opacity=B,p.emissiveIntensity=.55*S,m.opacity=B*.6}),C.jsxs("group",{ref:c,position:[0,fk,0],children:[Array.from({length:zx}
4595).map((g,_)=>{const b=ea/2+_*(ea+kT);return C.jsxs("group",{position:[0,b,0],children:[C.jsx("mesh",{material:u,children:C.jsx("boxGeometry",{args:[Rl,ea,tu]})}),C.jsx("mesh",{position:[0,-ea*.32,tu/2+.001],material:h,children:C.jsx("boxGeometry",{args:[Rl*.94,ea*.18,.005]})}),C.jsx("mesh",{position:[-Rl*.4,ea*.08,tu/2+.003],material:d[_%d.length],children:C.jsx("boxGeometry",{args:[.02,.02,.005]})})]},_)}),C.jsxs("group",{position:[0,K0+.005,0],children:[C.jsx("mesh",{position:[0,.015,0],material:h,children:C.jsx("boxGeometry",{args:[Rl,.03,tu]})}),Array.from({length:dk}).map((g,_)=>{const b=_%2,v=Math.floor(_/2),y=(b-.5)*Rl*.5,A=(v-.5)*tu*.55;return C.jsx("mesh",{position:[y,.03+YM/2,A],material:m,children:C.jsx("cylinderGeometry",{args:[JM,JM,YM,16]})},_)})]}),C.jsxs("group",{position:[Rl/2+.18,K0/2,0],children:[C.jsx("mesh",{position:[-.04,0,0],material:h,children:C.jsx("cylinderGeometry",{args:[.015,.015,K0,8]})}),C.jsx("mesh",{material:h,children:C.jsx("boxGeometry",{args:[.04,.22,.32]})}),C.jsx("mesh",{position:[.022,0,0],material:p,children:C.jsx("planeGeometry",{args:[.3,.2]})})]})]})}const gk=.04,xk=.9,Il=.7,Zf=.25,Bl=.16,_k=.04,KM=.008,yk=.18,vk=.06,qM=.13,ZM=.012,QM=.02,q0=.04;function bk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#dde2e6",roughness:.55,metalness:.1,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.4,metalness:.3,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#7cb342",roughness:.3,metalness:0,emissive:new we("#7cb342"),emissiveIntensity:.7,transparent:!0,opacity:0}),[]),p=k.useMemo(()=>new et({color:"#2a0a0a",roughness:.2,metalness:0,emissive:new we("#e53935"),emissiveIntensity:.55,transparent:!0,opacity:0}),[]),m=k.useMemo(()=>new et({color:"#9aa3ac",roughness:.35,metalness:.7,transparent:!0,opacity:0}),[]);return k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose()},[u,h,d,p,m]),jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,l[0],l[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-gk)*y,S=s.fadeOnOrtho?1-y:1,T=c.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;u.opacity=B,h.opacity=B,d.opacity=B,p.opacity=B,m.opacity=B,d.emissiveIntensity=.7*S,p.emissiveIntensity=.55*S}),C.jsxs("group",{ref:c,position:[0,xk,0],children:[C.jsx("mesh",{position:[0,Bl/2,0],material:u,children:C.jsx("boxGeometry",{args:[Il,Bl,Zf]})}),C.jsx("mesh",{position:[0,.025,Zf/2+.001],material:h,children:C.jsx("boxGeometry",{args:[Il*.96,.05,.005]})}),C.jsx("mesh",{position:[0,Bl*.4,Zf/2+KM/2],material:d,children:C.jsx("boxGeometry",{args:[Il*.86,_k,KM]})}),C.jsx("mesh",{position:[Il*.32,Bl*.7,Zf/2+.003],material:p,children:C.jsx("boxGeometry",{args:[yk,vk,.005]})}),C.jsx("mesh",{position:[-Il*.18,Bl+q0/2,-.02],material:h,children:C.jsx("cylinderGeometry",{args:[QM,QM,q0,12]})}),C.jsx("mesh",{position:[-Il*.18,Bl+q0+ZM/2,-.02],material:m,children:C.jsx("cylinderGeometry",{args:[qM,qM,ZM,24]})})]})}const Ak=.04,Md=2,Pl=1.6,so=2,$M=.04,eS=Md-.18,Mk=so-.18,Qf=.28,tS=.18,Sk=.06,nS=.32,iS=.2,Ll=.45,$f=1.6,sS=.2;function Ek({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#cdd2d7",roughness:.32,metalness:.8,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#dde2e6",roughness:.28,metalness:.85,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.15,metalness:0,transparent:!0,opacity:0}),[]),p=k.useMemo(()=>new et({color:"#1f2937",roughness:.5,metalness:.4,transparent:!0,opacity:0}),[]),m=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.55,transparent:!0,opacity:0}),[]);return k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose()},[u,h,d,p,m]),jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,l[0],l[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-Ak)*y,S=s.fadeOnOrtho?1-y:1,T=c.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;u.opacity=B,h.opacity=B,d.opacity=B,p.opacity=B,m.opacity=B,m.emissiveIntensity=.55*S}
4595),C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,so/2,0],material:u,children:C.jsx("boxGeometry",{args:[Md,so,Pl]})}),C.jsx("mesh",{position:[0,so/2,Pl/2-$M/2+.001],material:h,children:C.jsx("boxGeometry",{args:[eS,Mk,$M]})}),C.jsx("mesh",{position:[0,so/2+.05,Pl/2+.005],material:p,children:C.jsx("cylinderGeometry",{args:[Qf,Qf,.025,32]})}),C.jsx("mesh",{position:[0,so/2+.05,Pl/2+.018],rotation:[Math.PI/2,0,0],material:d,children:C.jsx("cylinderGeometry",{args:[Qf-.04,Qf-.04,.005,32]})}),C.jsx("mesh",{position:[eS/2-tS,so*.35,Pl/2+.04],material:p,children:C.jsx("boxGeometry",{args:[tS,Sk,.05]})}),C.jsx("mesh",{position:[Md/2-nS/2-.08,so-iS,Pl/2+.005],material:m,children:C.jsx("boxGeometry",{args:[nS,iS,.01]})}),C.jsxs("group",{position:[Md/2+sS+Ll,0,0],children:[C.jsx("mesh",{position:[0,.06,0],material:p,children:C.jsx("cylinderGeometry",{args:[Ll+.05,Ll+.05,.12,24]})}),C.jsx("mesh",{position:[0,.12+$f/2,0],material:u,children:C.jsx("cylinderGeometry",{args:[Ll,Ll,$f,24]})}),C.jsx("mesh",{position:[0,.12+$f,0],scale:[1,.3,1],material:u,children:C.jsx("sphereGeometry",{args:[Ll,24,12,0,Math.PI*2,0,Math.PI/2]})}),C.jsx("mesh",{position:[-.55,.12+$f*.85,0],rotation:[0,0,Math.PI/2],material:u,children:C.jsx("cylinderGeometry",{args:[.12,.12,sS,12]})})]})]})}const Tk=.04,ed=1,Z0=.5,Q0=1.7,td=.025,rS=.03,oS=4,nd=3,Ck=["#f3a93f","#3f8ec1","#b04545","#5fa260","#d4c14b","#7a5fa0"];function wk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#5e6b78",roughness:.55,metalness:.55,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#3a4048",roughness:.7,metalness:.3,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>Ck.map(y=>new et({color:y,roughness:.75,metalness:.05,transparent:!0,opacity:0})),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.forEach(y=>y.dispose())},[u,h,d]);const p=k.useMemo(()=>{const y=[];for(let A=0;A<oS;A++)y.push((A+1)/oS*(Q0-.2));return y},[]),m=k.useMemo(()=>{const y=[],A=ed-.1;for(let S=0;S<nd;S++){const T=-A/2+A/nd*(S+.5);y.push({x:T,binIdx:S})}return y},[]),g=k.useMemo(()=>{const y=ed/2-td*1.5,A=Z0/2-td*1.5;return[[-y,-A],[y,-A],[-y,A],[y,A]]},[]);jt(y=>{const{tCycle:A,globalAlpha:S}=an(y.clock.elapsedTime,e,t,n,i),T=on(sn(A,l[0],l[1])),B=$t(y.clock.elapsedTime,r),R=1-(1-Tk)*B,L=s.fadeOnOrtho?1-B:1,w=c.current;w&&(w.scale.y=T*R,w.visible=S>.001&&T>0);const I=S*T*L;u.opacity=I,h.opacity=I;for(const O of d)O.opacity=I});const _=(ed-.1)/nd-.04,b=.18,v=Z0-.08;return C.jsxs("group",{ref:c,children:[g.map(([y,A],S)=>C.jsx("mesh",{position:[y,Q0/2,A],material:u,children:C.jsx("cylinderGeometry",{args:[td,td,Q0,8]})},S)),p.map((y,A)=>C.jsxs("group",{position:[0,y,0],children:[C.jsx("mesh",{position:[0,-rS/2,0],material:h,children:C.jsx("boxGeometry",{args:[ed-.05,rS,Z0-.05]})}),m.map(({x:S,binIdx:T})=>{const B=(A*nd+T)%d.length;return C.jsx("mesh",{position:[S,b/2+.01,0],material:d[B],children:C.jsx("boxGeometry",{args:[_,b,v]})},T)})]},A))]})}const aS=["bioreactor","harvest","chromatography","uf_df","formulation","filling","lyophilization","qc_lab","stability","finished"],lS=20,id=.8;function cS(s){return(s*1103515245+12345>>>0)%2147483648}function uS(s){const e=s+1,t=e*7%3+1,n=new Set;let i=cS(e*13),r=50;for(;n.size<t&&r-- >0;)i=cS(i),n.add(aS[i%aS.length]);return n}function Rk(s,e){if(e<0)return 0;const t=Math.floor(e/lS),n=e-t*lS,i=uS(t).has(s);if(t===0&&n<id)return i?n/id:0;if(n<id){const r=uS(t-1).has(s),l=n/id,c=r?1-l:0;return Math.max(c,i?l:0)}return i?1:0}const Ik={bioreactor:{label:"BATCH 4382",start:8.21,rate:18e-5,format:s=>s.toFixed(3),unit:"OD₆₀₀",accent:"#5e96bc"},harvest:{label:"CLARIFY",start:0,rate:.34,format:s=>s.toFixed(1),unit:"L · clarified",accent:"#5e96bc"},chromatography:{label:"AFFINITY · ELUTE",start:1.41,rate:.0017,format:s=>s.toFixed(2),unit:"AU₂₈₀",accent:"#7cb342"},uf_df:{label:"DIAFILTRATION",start:4.7,rate:.011,format:s=>s.toFixed(1),unit:"DV",accent:"#7cb342"},formulation:{label:"COMPOUND BLEND",start:178,rate:0,format:s=>Math.round(s).toString(),unit:"RPM",accent:"#7cb342"},filling:{label:"ASEPTIC FILL",start:0,rate:5.4,format:s=>
4595Math.round(s).toString(),unit:"vials",accent:"#e66460"},lyophilization:{label:"PRIMARY DRYING",start:-41.8,rate:0,format:s=>s.toFixed(1),unit:"°C · shelf",accent:"#e66460"},qc_lab:{label:"POTENCY ASSAY",start:287,rate:0,format:s=>`RUN ${Math.round(s)}`,unit:"",accent:"#e0c84a"},stability:{label:"ICH Q1A",start:12,rate:0,format:s=>`${Math.round(s)}-month pull`,unit:"",accent:"#e0c84a"},finished:{label:"RELEASE",start:1248,rate:.013,format:s=>Math.round(s).toString(),unit:"units",accent:"#aaa78c"}},Bk={label:"METRIC",start:0,rate:1,format:s=>Math.round(s).toString(),unit:"",accent:"#9aa3ac"};function Pk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useMemo(()=>Ik[s.variant??""]??Bk,[s.variant]),u=k.useRef(null),h=k.useRef(null),d=k.useRef("");return k.useEffect(()=>{d.current=""},[c]),jt(p=>{const{tCycle:m,globalAlpha:g}=an(p.clock.elapsedTime,e,t,n,i),_=on(sn(m,l[0],l[1])),b=$t(p.clock.elapsedTime,r),v=s.fadeOnOrtho===!1?1:1-b,y=Rk(s.variant??"",p.clock.elapsedTime),A=g*_*v*y;if(u.current&&(u.current.style.opacity=String(A)),h.current){const S=c.start+c.rate*p.clock.elapsedTime,T=c.format(S);T!==d.current&&(h.current.textContent=T,d.current=T)}}),C.jsx(um,{position:[0,1.8,0],center:!0,zIndexRange:[8,0],wrapperClass:"factory-scene-metric-badge-wrapper",children:C.jsxs("div",{ref:u,style:{opacity:0,pointerEvents:"none",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",background:"rgba(4, 20, 36, 0.9)",border:`1px solid ${c.accent}66`,borderRadius:4,padding:"5px 9px",color:"rgba(255,255,255,0.92)",fontSize:9,lineHeight:1.1,textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap",boxShadow:`0 0 8px ${c.accent}33`},children:[C.jsx("div",{style:{color:c.accent,fontWeight:600,fontSize:8,opacity:.85},children:c.label}),C.jsxs("div",{style:{marginTop:3,fontSize:13,fontWeight:700,color:"rgba(255,255,255,0.98)",fontFamily:"ui-sans-serif, system-ui, sans-serif"},children:[C.jsx("span",{ref:h,children:c.format(c.start)}),c.unit?C.jsx("span",{style:{marginLeft:4,fontSize:9,fontWeight:500,color:"rgba(255,255,255,0.6)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",textTransform:"none"},children:c.unit}):null]})]})})}const Lk=.04,Qo=.5,$0=1.4,Dk=.05,ex=.3,hS=.15,fS=.18,dS=.05,pS=.3,Fk=1.3,Nk=1.3,tx=.08;function Ok({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#cdd2d7",roughness:.32,metalness:.8,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.5,metalness:.4,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose()},[u,h]),jt(_=>{const{tCycle:b,globalAlpha:v}=an(_.clock.elapsedTime,e,t,n,i),y=on(sn(b,l[0],l[1])),A=$t(_.clock.elapsedTime,r),S=1-(1-Lk)*A,T=s.fadeOnOrtho?1-A:1,B=c.current;B&&(B.scale.y=y*S,B.visible=v>.001&&y>0);const R=v*y*T;u.opacity=R,h.opacity=R});const d=tx+Dk,p=d+$0/2,m=d+$0,g=m+Qo*ex+fS/2;return C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,tx/2,0],material:h,children:C.jsx("boxGeometry",{args:[Fk,tx,Nk]})}),C.jsx("mesh",{position:[0,d,0],scale:[1,ex,1],material:u,children:C.jsx("sphereGeometry",{args:[Qo,20,12,0,Math.PI*2,Math.PI/2,Math.PI/2]})}),C.jsx("mesh",{position:[0,p,0],material:u,children:C.jsx("cylinderGeometry",{args:[Qo,Qo,$0,20]})}),C.jsx("mesh",{position:[0,m,0],scale:[1,ex,1],material:u,children:C.jsx("sphereGeometry",{args:[Qo,20,12,0,Math.PI*2,0,Math.PI/2]})}),C.jsx("mesh",{position:[0,g,0],material:h,children:C.jsx("cylinderGeometry",{args:[hS,hS,fS,14]})}),[.2,-.3].map((_,b)=>C.jsx("mesh",{position:[Qo+pS/2,p+_,0],rotation:[0,0,Math.PI/2],material:u,children:C.jsx("cylinderGeometry",{args:[dS,dS,pS,10]})},b)),C.jsx("mesh",{position:[Qo+.005,p,0],rotation:[0,0,-Math.PI/2],material:h,children:C.jsx("cylinderGeometry",{args:[.08,.08,.005,16]})})]})}const Uk=.04,mS=.7,gS=.5,nx=.06,Vs=.06,xS=1,_S=.025,Gk=.55,kk=.28,Hk=.04,zk=.85,yS=.7,vS=.42,bS=.04,Vk=1.25;function Wk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#3a4048",roughness:.6,metalness:.4,transparent:!0,opacity:0}
4595),[s.color]),h=k.useMemo(()=>new et({color:"#1a1d22",roughness:.85,metalness:.05,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.7,transparent:!0,opacity:0}),[]),p=k.useMemo(()=>new et({color:"#1a1d22",roughness:.5,metalness:.3,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose()},[u,h,d,p]);const m=k.useMemo(()=>{const g=mS/2-Vs*1.2,_=gS/2-Vs*1.2;return[[-g,Vs,-_],[g,Vs,-_],[-g,Vs,_],[g,Vs,_]]},[]);return jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,l[0],l[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-Uk)*y,S=s.fadeOnOrtho?1-y:1,T=c.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;u.opacity=B,h.opacity=B,p.opacity=B,d.opacity=B,d.emissiveIntensity=.7*S}),C.jsxs("group",{ref:c,children:[m.map((g,_)=>C.jsx("mesh",{position:g,rotation:[Math.PI/2,0,0],material:h,children:C.jsx("cylinderGeometry",{args:[Vs,Vs,.04,12]})},_)),C.jsx("mesh",{position:[0,Vs*2+nx/2,0],material:u,children:C.jsx("boxGeometry",{args:[mS,nx,gS]})}),C.jsx("mesh",{position:[-.02,Vs*2+nx+xS/2,0],material:u,children:C.jsx("cylinderGeometry",{args:[_S,_S,xS,10]})}),C.jsx("mesh",{position:[.04,zk,0],material:u,children:C.jsx("boxGeometry",{args:[Gk,Hk,kk]})}),C.jsxs("group",{position:[.04,Vk,0],rotation:[-.18,0,0],children:[C.jsx("mesh",{material:p,children:C.jsx("boxGeometry",{args:[yS,vS,bS]})}),C.jsx("mesh",{position:[0,0,bS/2+.001],material:d,children:C.jsx("planeGeometry",{args:[yS*.92,vS*.86]})})]})]})}const jk=.04,AS=.04,sd=.3,MS=.5,SS=.32,ES=.035,Xk=.035;function Jk({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#2c3340",roughness:.5,metalness:.5,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#1a1d22",roughness:.4,metalness:.3,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.8,transparent:!0,opacity:0}),[]);return k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose()},[u,h,d]),jt(p=>{const{tCycle:m,globalAlpha:g}=an(p.clock.elapsedTime,e,t,n,i),_=on(sn(m,l[0],l[1])),b=$t(p.clock.elapsedTime,r),v=1-(1-jk)*b,y=s.fadeOnOrtho?1-b:1,A=c.current;A&&(A.scale.y=_*v,A.visible=g>.001&&_>0);const S=g*_*y;u.opacity=S,h.opacity=S,d.opacity=S,d.emissiveIntensity=.8*y}),C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,.04,0],material:u,children:C.jsx("boxGeometry",{args:[.12,.08,.08]})}),C.jsx("mesh",{position:[sd/2,.06,0],material:u,children:C.jsx("boxGeometry",{args:[sd,AS,AS]})}),C.jsx("mesh",{position:[sd,.06,0],material:u,children:C.jsx("sphereGeometry",{args:[Xk,12,12]})}),C.jsxs("group",{position:[sd,.06,0],rotation:[-.21,-Math.PI/2,0],children:[C.jsx("mesh",{material:h,children:C.jsx("boxGeometry",{args:[MS,SS,ES]})}),C.jsx("mesh",{position:[0,0,ES/2+.001],material:d,children:C.jsx("planeGeometry",{args:[MS*.92,SS*.86]})})]})]})}const Yk=.04,Kk=.9,qk=.55,Zk=.18,ix=.012,sx=.13,rd=.1,TS=.13,Qk=.04,$k=3,eH=["#1f2937","#b04545","#dde2e6"];function tH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#cdd2d7",roughness:.5,metalness:.2,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#ffffff",roughness:.85,metalness:0,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>eH.map(g=>new et({color:g,roughness:.7,metalness:.05,transparent:!0,opacity:0})),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.forEach(g=>g.dispose())},[u,h,d]),jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,l[0],l[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-Yk)*y,S=s.fadeOnOrtho?1-y:1,T=c.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;u.opacity=B,h.opacity=B;for(const R of d)R.opacity=B});const p=sx+Qk,m=-.34/2;return C.jsxs("group",{ref:c,position:[0,Kk,0],children:[C.jsx("mesh",{position:[0,ix/2,0],material:u,children:C.jsx("boxGeometry",{args:[qk,ix,Zk]})}),Array.from({length:$k}).map((g,_)=>{const b=m+p*_;return C.jsxs("group",{position:[b,ix+rd/2,0],children:[C.jsx("mesh",{material:d[_%d.length],children:C.jsx("boxGeometry",{args:[sx,rd,TS]})}),C.jsx("mesh",{position:[0,-rd*.18,TS/2+.002],material:h,children:C.jsx("boxGeometry",{args:[sx*.45,rd*.36,.003]})})]},_)})]})}const nH=.04,$r=1,eo=.8,rx=2,ox=.32,nu=.04,CS=.05,od=.02,wS=4,RS=.04,IS=.09,BS=5,iH=.32,sH=.16;function rH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#dde2e6",roughness:.5,metalness:.25,transparent:!0,opacity:0}
4595),[s.color]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.5,metalness:.4,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new ci({color:"#dde7ee",roughness:.05,metalness:0,transmission:.85,thickness:.04,ior:1.5,transparent:!0,opacity:0}),[]),p=k.useMemo(()=>new et({color:"#9aa3ac",roughness:.5,metalness:.6,transparent:!0,opacity:0}),[]),m=k.useMemo(()=>new et({color:"#f4f4f5",roughness:.4,metalness:0,transparent:!0,opacity:0}),[]),g=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.55,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),g.dispose()},[u,h,d,p,m,g]),jt(S=>{const{tCycle:T,globalAlpha:B}=an(S.clock.elapsedTime,e,t,n,i),R=on(sn(T,l[0],l[1])),L=$t(S.clock.elapsedTime,r),w=1-(1-nH)*L,I=s.fadeOnOrtho?1-L:1,O=c.current;O&&(O.scale.y=R*w,O.visible=B>.001&&R>0);const D=B*R*I;u.opacity=D,h.opacity=D,d.opacity=D*.55,p.opacity=D,m.opacity=D,g.opacity=D,g.emissiveIntensity=.55*I});const _=rx-ox-.04,b=_/2+.02,v=_+.04+ox/2,y=_+.02,A=k.useMemo(()=>{const S=[],B=y-.05-od;for(let R=0;R<wS;R++)S.push(.05+B/(wS-1)*R);return S},[y]);return C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,rx/2,0],material:u,children:C.jsx("boxGeometry",{args:[$r,rx,eo]})}),C.jsx("mesh",{position:[0,b,eo/2+.001],material:h,children:C.jsx("boxGeometry",{args:[$r-.05,_,nu]})}),C.jsx("mesh",{position:[0,b,eo/2+nu/2+.005],material:d,children:C.jsx("boxGeometry",{args:[$r-.05-CS*2,_-CS*2,.01]})}),C.jsx("mesh",{position:[$r/2-.07,b,eo/2+nu+.015],material:h,children:C.jsx("boxGeometry",{args:[.025,_*.6,.025]})}),C.jsx("mesh",{position:[0,v,eo/2+.001],material:h,children:C.jsx("boxGeometry",{args:[$r-.05,ox,nu]})}),C.jsx("mesh",{position:[0,v,eo/2+nu/2+.005],material:g,children:C.jsx("planeGeometry",{args:[iH,sH]})}),A.map((S,T)=>C.jsxs("group",{position:[0,S,0],children:[C.jsx("mesh",{position:[0,od/2,0],material:p,children:C.jsx("boxGeometry",{args:[$r*.84,od,eo*.7]})}),Array.from({length:BS}).map((B,R)=>{const L=$r*.7,w=L/(BS-1),I=-L/2+w*R;return C.jsx("mesh",{position:[I,od+IS/2,0],material:m,children:C.jsx("cylinderGeometry",{args:[RS,RS,IS,10]})},R)})]},T)),C.jsx("mesh",{position:[0,.025,0],material:h,children:C.jsx("boxGeometry",{args:[$r-.04,.05,eo-.04]})})]})}const oH=.04,Dl=.06,aH=2.1,iu=.05,Fl=.05,lH=2,cH=1;function uH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){var A,S;const l=s.rise??Tn,c=((A=s.footprint)==null?void 0:A.iCells)??lH,u=((S=s.footprint)==null?void 0:S.jCells)??cH,h=aH,d=k.useRef(null),p=k.useMemo(()=>new et({color:s.color??"#1a1d22",roughness:.55,metalness:.65,transparent:!0,opacity:0}),[s.color]);k.useEffect(()=>()=>{p.dispose()},[p]),jt(T=>{const{tCycle:B,globalAlpha:R}=an(T.clock.elapsedTime,e,t,n,i),L=on(sn(B,l[0],l[1])),w=$t(T.clock.elapsedTime,r),I=1-(1-oH)*w,O=s.fadeOnOrtho?1-w:1,D=d.current;D&&(D.scale.y=L*I,D.visible=R>.001&&L>0),p.opacity=R*L*O});const m=c/2-Dl/2,g=u/2-Dl/2,_=[[-m,-g],[m,-g],[-m,g],[m,g]],b=h+Fl/2,v=c-Dl,y=u-Dl;return C.jsxs("group",{ref:d,children:[_.map(([T,B],R)=>C.jsx("mesh",{position:[T,h/2,B],material:p,children:C.jsx("boxGeometry",{args:[Dl,h,Dl]})},R)),C.jsx("mesh",{position:[0,b,-g],material:p,children:C.jsx("boxGeometry",{args:[v,Fl,iu]})}),C.jsx("mesh",{position:[0,b,g],material:p,children:C.jsx("boxGeometry",{args:[v,Fl,iu]})}),C.jsx("mesh",{position:[-m,b,0],material:p,children:C.jsx("boxGeometry",{args:[iu,Fl,y]})}),C.jsx("mesh",{position:[m,b,0],material:p,children:C.jsx("boxGeometry",{args:[iu,Fl,y]})}),C.jsx("mesh",{position:[m,h*.6,0],material:p,children:C.jsx("boxGeometry",{args:[iu,Fl,y]})})]})}const hH=.04,su=1.6,ru=.9,_r=.9,ax=4,ou=.16,lx=.4,cx=.32,ux=.04,Nl=.28,PS=.24,fH=.16;function dH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:s.color??"#cdd2d7",roughness:.32,metalness:.78,transparent:!0,opacity:0}),[s.color]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.5,metalness:.4,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:"#e8e4d4",roughness:.7,metalness:0,transparent:!0,opacity:0}
4595),[]),p=k.useMemo(()=>new et({color:"#1a1d22",roughness:.7,metalness:.05,transparent:!0,opacity:0}),[]),m=k.useMemo(()=>new et({color:"#0b1d2c",roughness:.2,metalness:0,emissive:new we("#5e96bc"),emissiveIntensity:.55,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose()},[u,h,d,p,m]),jt(b=>{const{tCycle:v,globalAlpha:y}=an(b.clock.elapsedTime,e,t,n,i),A=on(sn(v,l[0],l[1])),S=$t(b.clock.elapsedTime,r),T=1-(1-hH)*S,B=s.fadeOnOrtho?1-S:1,R=c.current;R&&(R.scale.y=A*T,R.visible=y>.001&&A>0);const L=y*A*B;u.opacity=L,h.opacity=L,d.opacity=L,p.opacity=L,m.opacity=L,m.emissiveIntensity=.55*B});const g=(ax-1)*(ou+ux),_=-g/2;return C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,_r/2,0],material:u,children:C.jsx("boxGeometry",{args:[su,_r,ru]})}),C.jsx("mesh",{position:[0,_r+.015,0],material:h,children:C.jsx("boxGeometry",{args:[su*.96,.03,ru*.92]})}),Array.from({length:ax}).map((b,v)=>C.jsx("mesh",{position:[_+v*(ou+ux),_r+.03+lx/2,0],material:d,children:C.jsx("boxGeometry",{args:[ou,lx,cx]})},v)),C.jsx("mesh",{position:[0,_r+.03+lx+.04,0],material:h,children:C.jsx("boxGeometry",{args:[g+ou+.06,.06,cx+.04]})}),C.jsx("mesh",{position:[-su/2+Nl/2+.08,_r*.4,ru/2+.005],rotation:[Math.PI/2,0,0],material:h,children:C.jsx("cylinderGeometry",{args:[Nl/2,Nl/2,.1,24]})}),C.jsx("mesh",{position:[-su/2+Nl/2+.08,_r*.4,ru/2+.06],rotation:[Math.PI/2,0,0],material:u,children:C.jsx("cylinderGeometry",{args:[Nl/2-.04,Nl/2-.04,.04,24]})}),C.jsx("mesh",{position:[su/2-PS/2-.08,_r*.65,ru/2+.005],material:m,children:C.jsx("boxGeometry",{args:[PS,fH,.01]})}),Array.from({length:ax}).map((b,v)=>C.jsx("mesh",{position:[_+v*(ou+ux),_r+.04,cx/2+.04],material:p,children:C.jsx("cylinderGeometry",{args:[.02,.02,.08,8]})},v))]})}const pH=.04,Ws=4,Ol=1.4,hx=.9,mH=Ws-.2,LS=.04,to=1.2,no=.05,io=.04,fx=.18,DS=.025,FS=.32,NS=4,OS=.05,US=.13,GS=9,kS=.13,HS=.3;function gH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??Tn,c=k.useRef(null),u=k.useMemo(()=>new et({color:"#cdd2d7",roughness:.32,metalness:.8,transparent:!0,opacity:0}),[]),h=k.useMemo(()=>new et({color:"#1f2937",roughness:.7,metalness:.1,transparent:!0,opacity:0}),[]),d=k.useMemo(()=>new et({color:s.color??"#1a1d22",roughness:.55,metalness:.65,transparent:!0,opacity:0}),[s.color]),p=k.useMemo(()=>new ci({color:"#dde7ee",roughness:.05,metalness:0,transmission:.85,thickness:.04,ior:1.5,transparent:!0,opacity:0}),[]),m=k.useMemo(()=>new et({color:"#f4f4f5",roughness:.4,metalness:0,transparent:!0,opacity:0}),[]),g=k.useMemo(()=>new et({color:"#1e40af",roughness:.7,metalness:0,transparent:!0,opacity:0}),[]);k.useEffect(()=>()=>{u.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),g.dispose()},[u,h,d,p,m,g]),jt(D=>{const{tCycle:z,globalAlpha:X}=an(D.clock.elapsedTime,e,t,n,i),Y=on(sn(z,l[0],l[1])),V=$t(D.clock.elapsedTime,r),H=1-(1-pH)*V,W=s.fadeOnOrtho?1-V:1,q=c.current;q&&(q.scale.y=Y*H,q.visible=X>.001&&Y>0);const Q=X*Y*W;u.opacity=Q,h.opacity=Q,d.opacity=Q,p.opacity=Q*.45,m.opacity=Q,g.opacity=Q});const _=hx,b=_-LS/2+.01,v=_,y=_+to,A=y-fx/2,S=Ws*.55,T=-S/2,B=S/(NS-1),R=Ws*.8,L=-R/2,w=R/(GS-1),I=Ws/2-no/2,O=Ol/2-no/2;return C.jsxs("group",{ref:c,children:[C.jsx("mesh",{position:[0,hx/2,0],material:u,children:C.jsx("boxGeometry",{args:[Ws,hx,Ol]})}),C.jsx("mesh",{position:[0,b,0],material:h,children:C.jsx("boxGeometry",{args:[mH,LS,Ol*.42]})}),Array.from({length:GS}).map((D,z)=>C.jsx("mesh",{position:[L+w*z,_+US/2+.005,0],material:m,children:C.jsx("cylinderGeometry",{args:[OS,OS,US,12]})},z)),[[-I,-O],[I,-O],[-I,O],[I,O]].map(([D,z],X)=>C.jsx("mesh",{position:[D,v+to/2,z],material:d,children:C.jsx("boxGeometry",{args:[no,to,no]})},X)),C.jsx("mesh",{position:[0,y,-O],material:d,children:C.jsx("boxGeometry",{args:[Ws,io,io]})}),C.jsx("mesh",{position:[0,y,O],material:d,children:C.jsx("boxGeometry",{args:[Ws,io,io]})}),C.jsx("mesh",{position:[-I,y,0],material:d,children:C.jsx("boxGeometry",{args:[io,io,Ol]})}),C.jsx("mesh",{position:[I,y,0],material:d,children:C.jsx("boxGeometry",{args:[io,io,Ol]})}),C.jsx("mesh",{position:[0,v+to/2,O],material:p,children:C.jsx("boxGeometry",{args:[Ws-no*2,to-.05,.01]})}),C.jsx("mesh",{position:[0,v+to/2,-O],material:p,children:C.jsx("boxGeometry",{args:[Ws-no*2,to-.05,.01]})}),[-.6,.6].map((D,z)=>C.jsx("mesh",{position:[D,v+to*.4,O+HS/2-.005],rotation:[Math.PI/2,0,0],material:g,children:C.jsx("cylinderGeometry",{args:[kS,kS*.85,HS,16]})},z)),C.jsx("mesh",{position:[0,A,0],material:d,children:C.jsx("boxGeometry",{args:[Ws-no*2-.08,fx,Ol-no*2-.08]})}),Array.from({length:NS}).map((D,z)=>C.jsx("mesh",{position:[T+B*z,A-fx/2-FS/2,0],material:u,children:C.jsx("cylinderGeometry",{args:[DS,DS*.7,FS,12]})},z))]})}const xH=.04,zS=1.6,VS=.8,Vx=.06,HT=.9,ad=.04,au=HT-Vx,WS={wood:{top:"#a87144",frame:"#3b3a37",roughness:.85},steel:{top:"#9aa3ac",frame:"#3a4048",roughness:.55},lab:{top:"#dde2e6",frame:"#5e6b78",roughness:.7}};function _H({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.variant??"steel",c=WS[l]??WS.steel,u=s.rise??Tn,h=k.useRef(null),d=k.useMemo(()=>new et({color:s.color??c.top,roughness:c.roughness,metalness:l==="steel"?.4:.05,transparent:!0,opacity:0}
4595),[s.color,c,l]),p=k.useMemo(()=>new et({color:c.frame,roughness:.5,metalness:.6,transparent:!0,opacity:0}),[c.frame]);k.useEffect(()=>()=>{d.dispose(),p.dispose()},[d,p]);const m=k.useMemo(()=>{const g=zS/2-ad*1.5,_=VS/2-ad*1.5;return[[-g,au/2,-_],[g,au/2,-_],[-g,au/2,_],[g,au/2,_]]},[]);return jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,u[0],u[1])),y=$t(g.clock.elapsedTime,r),A=1-(1-xH)*y,S=s.fadeOnOrtho?1-y:1,T=h.current;T&&(T.scale.y=v*A,T.visible=b>.001&&v>0);const B=b*v*S;d.opacity=B,p.opacity=B}),C.jsxs("group",{ref:h,children:[C.jsx("mesh",{position:[0,HT-Vx/2,0],material:d,children:C.jsx("boxGeometry",{args:[zS,Vx,VS]})}),m.map((g,_)=>C.jsx("mesh",{position:g,material:p,children:C.jsx("cylinderGeometry",{args:[ad,ad,au,8]})},_))]})}const yH={workbench:_H,"bench-tooling":TG,"monitor-cart":Wk,"material-rack":wk,"cabinet-stack":$G,"andon-tower":MG,"mounted-screen":Jk,"lab-balance":bk,"specimen-tray":tH,"station-frame":uH,bioreactor:qG,"chromatography-column":sk,lyophilizer:Ek,"vial-filler":gH,"hplc-stack":mk,"stability-chamber":rH,"mix-tank":Ok,"depth-filter":ok,"tff-skid":dH,"metric-badge":Pk,glb:lk};function vH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=yH[s.kind];if(!l)return null;const c=s.scale??1,u=s.facing??0,h={...s,fadeOnOrtho:s.fadeOnOrtho??!0};return C.jsx("group",{position:[s.i,s.y??0,s.j],rotation:[0,u,0],scale:c,children:C.jsx(l,{def:h,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r})})}function bH({from:s,to:e,color:t,progress:n,cycle:i,holdEnd:r,outEnd:l,loop:c}){const u=k.useRef(null),h=k.useRef(null),d=k.useMemo(()=>{const p=new Float32Array([s[0],0,s[1],e[0],0,e[1]]),m=new mt;return m.setAttribute("position",new Ut(p,3)),m},[s,e]);return jt(p=>{const{tCycle:m,globalAlpha:g}=an(p.clock.elapsedTime,i,r,l,c),_=on(sn(m,n[0],n[1]));h.current&&(h.current.opacity=g*.85*(_>0?1:0));const b=d.getAttribute("position"),v=s[0]+(e[0]-s[0])*_,y=s[1]+(e[1]-s[1])*_;b.setXYZ(1,v,0,y),b.needsUpdate=!0,u.current&&u.current.computeLineDistances()}),C.jsx("lineSegments",{ref:u,geometry:d,children:C.jsx("lineDashedMaterial",{ref:h,color:t,transparent:!0,opacity:0,dashSize:.4,gapSize:.4,linewidth:2})})}const jS=256,AH=1024,lu=(s,e)=>(s+jS)*AH+(e+jS);function MH(s,e=[]){const t=new Set;for(const i of s)for(let r=i.iMin;r<i.iMax;r++)for(let l=i.jMin;l<i.jMax;l++)t.add(lu(r,l));const n=[];for(const i of s)for(let r=i.iMin;r<i.iMax;r++)for(let l=i.jMin;l<i.jMax;l++)t.has(lu(r-1,l))||n.push({i0:r,j0:l,i1:r,j1:l+1}),t.has(lu(r+1,l))||n.push({i0:r+1,j0:l,i1:r+1,j1:l+1}),t.has(lu(r,l-1))||n.push({i0:r,j0:l,i1:r+1,j1:l}),t.has(lu(r,l+1))||n.push({i0:r,j0:l+1,i1:r+1,j1:l+1});return e.length===0?n:n.filter(i=>!e.some(r=>SH(i,r)))}function SH(s,e){const t=i=>i>=e.iMin&&i<=e.iMax,n=i=>i>=e.jMin&&i<=e.jMax;return t(s.i0)&&t(s.i1)&&n(s.j0)&&n(s.j1)}const EH=.02,TH=2,Ru=s=>`${s[0]},${s[1]}`,Ul=(s,e)=>{const t=Ru(s),n=Ru(e);return t<n?`${t}|${n}`:`${n}|${t}`},pu=(s,e)=>s[0]===e[0]&&s[1]===e[1];function CH(s){const e=new Map,t=(r,l)=>{const c=Ru(r),u=e.get(c);u?u.push(l):e.set(c,[l])};for(const r of s)t([r.i0,r.j0],[r.i1,r.j1]),t([r.i1,r.j1],[r.i0,r.j0]);const n=new Set,i=[];for(const r of s){const l=[r.i0,r.j0],c=[r.i1,r.j1];if(n.has(Ul(l,c)))continue;n.add(Ul(l,c));const u=[l,c];for(;;){const h=u[u.length-1],d=u[u.length-2],p=e.get(Ru(h))??[];let m=null;for(const g of p)if(!pu(g,d)&&!n.has(Ul(h,g))){m=g;break}if(!m||(n.add(Ul(h,m)),u.push(m),pu(m,u[0])))break}for(;;){const h=u[0],d=u[1],p=e.get(Ru(h))??[];let m=null;for(const g of p)if(!pu(g,d)&&!n.has(Ul(h,g))){m=g;break}if(!m||(n.add(Ul(h,m)),u.unshift(m),pu(m,u[u.length-1])))break}i.push(u)}return i}function wH(s){if(s.length<3)return s;const e=pu(s[0],s[s.length-1]),t=e?s.slice(0,-1):s,n=t.length,i=[];for(let r=0;r<n;r++){if(!e&&(r===0||r===n-1)){i.push(t[r]);continue}const l=t[(r-1+n)%n],c=t[r],u=t[(r+1)%n];(c[0]-l[0])*(u[1]-c[1])-(c[1]-l[1])*(u[0]-c[0])!==0&&i.push(c)}return e&&i.length>0&&i.push(i[0]),i}function RH({regions:s,perimeterGaps:e,gridCenter:t=[0,0],gridExtent:n=400,gridDivisions:i=200,outlineColor:r="#5e96bc",gridColor:l="#1f3850",orthoTransition:c}){const u=k.useMemo(()=>CH(MH(s,e??[])).map(wH).map(d=>d.map(p=>[p[0],0,p[1]])),[s,e]),h=k.useRef([]);return jt(d=>{const m=.95*(1-$t(d.clock.elapsedTime,c));for(const g of h.current)g!=null&&g.material&&(g.material.opacity=m)}),C.jsxs("group",{children:[C.jsx("gridHelper",{args:[n*2,i,l,l],position:[t[0],0,t[1]]}),u.map((d,p)=>C.jsx(cG,{ref:m=>{h.current[p]=m},points:d,color:r,lineWidth:TH,transparent:!0,opacity:.95,position:[0,EH,0]},p))]})}const IH="#ffffff",BH="#ffffff",zT=1,XS=.35,PH=(()=>{const s=new Float32Array([0,0,zT,-XS,0,0,XS,0,0]),e=new mt;return e.setAttribute("position",new Ut(s,3)),e.setIndex([0,1,2]),e.computeVertexNormals(),e})();function LH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=k.useRef(null),c=k.useRef(null),u=k.useRef(null),h=k.useRef(null),d=k.useMemo(()=>{const _=s.tipAtEdge?0:2.5,b=[new G(s.from[0],0,s.from[1]),...(s.waypoints??[]).map(([S,T])=>new G(S,0,T)),new G(s.to[0],0,s.to[1])];let v=0,y=0;if(b.length>=2){const S=b[b.length-1],T=b[b.length-2],B=S.x-T.x,R=S.z-T.z,L=Math.hypot(B,R);L>0&&(v=B/L,y=R/L),L>_&&(S.x-=v*_,S.z-=y*_)}const A=[0];for(let S=1;S<b.length;S++)A.push(A[S-1]+b[S].distanceTo(b[S-1]));return{pts:b,cum:A,total:A[A.length-1],lastDirX:v,lastDirZ:y}}
4595,[s.from,s.to,s.waypoints,s.tipAtEdge]),p=s.tipAtEdge?0:1.7,m=s.color??(s.kind==="material"?IH:BH),g=k.useMemo(()=>{const _=d.pts.length-1,b=new Float32Array(_*6);for(let y=0;y<_;y++){const A=d.pts[y],S=d.pts[y+1],T=y*6;b[T+0]=A.x,b[T+1]=0,b[T+2]=A.z,b[T+3]=S.x,b[T+4]=0,b[T+5]=S.z}const v=new mt;return v.setAttribute("position",new Ut(b,3)),v},[d]);return jt(_=>{const{tCycle:b,globalAlpha:v}=an(_.clock.elapsedTime,e,t,n,i),y=on(sn(b,s.progress[0],s.progress[1])),A=$t(_.clock.elapsedTime,r),S=s.fadeOnOrtho?1-A:1;c.current&&(c.current.opacity=v*(y>0?.85:0)*S);const B=-(p*A),R=d.pts.length-1,L=d.pts[R],w=L.x-d.lastDirX*B,I=L.z-d.lastDirZ*B,O=d.total-B,D=O*y,z=g.getAttribute("position");let X=d.pts[0].x,Y=d.pts[0].z,V=1,H=0;for(let q=0;q<d.pts.length-1;q++){const Q=d.pts[q],re=q===R-1,ae=re?w:d.pts[q+1].x,pe=re?I:d.pts[q+1].z,Ue=d.cum[q],Pe=re?O:d.cum[q+1],He=q*6;if(D>=Pe)z.setXYZ(q*2+1,ae,0,pe),z.array[He+0]=Q.x,z.array[He+2]=Q.z,X=ae,Y=pe,V=ae-Q.x,H=pe-Q.z;else if(D>Ue){const le=(D-Ue)/(Pe-Ue),Le=Q.x+(ae-Q.x)*le,ye=Q.z+(pe-Q.z)*le;z.array[He+0]=Q.x,z.array[He+2]=Q.z,z.array[He+3]=Le,z.array[He+5]=ye,X=Le,Y=ye,V=ae-Q.x,H=pe-Q.z}else z.array[He+0]=X,z.array[He+2]=Y,z.array[He+3]=X,z.array[He+5]=Y}z.needsUpdate=!0,s.kind==="info"&&l.current&&l.current.computeLineDistances();const W=u.current;if(W){const q=Math.hypot(V,H)||1,Q=V/q,re=H/q,ae=zT;W.position.set(X-Q*ae,.04,Y-re*ae),W.rotation.set(0,Math.atan2(V,H),0),W.visible=!!s.arrow&&y>.02&&v>.001}h.current&&(h.current.opacity=v*(y>0?.9:0)*S)}),C.jsxs("group",{children:[C.jsx("lineSegments",{ref:l,geometry:g,position:[0,.03,0],children:s.kind==="info"?C.jsx("lineDashedMaterial",{ref:c,color:m,transparent:!0,opacity:0,dashSize:.5,gapSize:.4}):C.jsx("lineBasicMaterial",{ref:c,color:m,transparent:!0,opacity:0})}),s.arrow?C.jsx("mesh",{ref:u,geometry:PH,visible:!1,children:C.jsx("meshBasicMaterial",{ref:h,color:m,transparent:!0,opacity:0,side:Vi})}):null]})}const DH=[0,.5];function FH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const{t:l}=yE(),c=s.align??"center",u=s.color??"rgba(255,255,255,0.85)",h=s.appear??DH,d=c==="left"?"0%":c==="right"?"-100%":"-50%",p=k.useRef(null),m=k.useRef(null);return jt(g=>{const{tCycle:_,globalAlpha:b}=an(g.clock.elapsedTime,e,t,n,i),v=on(sn(_,h[0],h[1])),y=$t(g.clock.elapsedTime,r),A=s.fadeOnOrtho?1-y:s.fadeOnIso?y:1;if(p.current&&(p.current.style.opacity=String(b*v*A)),m.current){const S=Math.max(0,Math.min(1,y*1.7));m.current.style.opacity=String(S),m.current.style.maxHeight=`${S*40}px`,m.current.style.marginTop=`${S*2}px`}}),C.jsx(um,{position:[s.i,s.y??.4,s.j],zIndexRange:[4,0],wrapperClass:"factory-scene-region-label-wrapper",children:C.jsxs("div",{ref:p,className:"factory-scene-region-label",style:{opacity:0,transform:`translate(${d}, -50%)`,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:u,textAlign:c,whiteSpace:"nowrap",pointerEvents:"none"},children:[C.jsx("div",{children:l(s.labelKey)}),s.sublabel?C.jsx("div",{ref:m,className:"factory-scene-region-sublabel",style:{opacity:0,maxHeight:0,marginTop:0,fontWeight:400,color:"rgba(255,255,255,0.55)",textTransform:"none",letterSpacing:0,overflow:"hidden"},children:s.sublabel}):null]})})}function NH({def:s,orthoTransition:e}){const{region:t}=s,n=t.iMax-t.iMin,i=t.jMax-t.jMin,r=t.iMin+n/2,l=t.jMin+i/2,c=s.opacity??.18,u=k.useRef(null);return jt(h=>{if(!u.current)return;const d=s.fadeOnOrtho===!1?1:1-$t(h.clock.elapsedTime,e);u.current.opacity=c*d}),C.jsxs("mesh",{position:[r,.01,l],rotation:[-Math.PI/2,0,0],renderOrder:-1,children:[C.jsx("planeGeometry",{args:[n,i]}),C.jsx("meshBasicMaterial",{ref:u,color:s.color,transparent:!0,opacity:c,depthWrite:!1})]})}const OH=.04,UH=3,GH=1.8,JS=5;function kH({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.size??UH,c=s.height??GH*l,u=s.pedestal??!0,h=k.useRef(null),d=k.useRef(null),p=k.useRef(null),m=k.useRef(null),g=k.useRef(null),_=k.useMemo(()=>new tc(new Ms(l,c,l)),[l,c]),b=k.useMemo(()=>new mt().setFromPoints([new G(0,c,0),new G(0,c+JS,0)]),[c]);return jt(v=>{const{tCycle:y,globalAlpha:A}=an(v.clock.elapsedTime,e,t,n,i),S=on(sn(y,s.rise[0],s.rise[1])),T=on(sn(y,s.card[0],s.card[1])),B=$t(v.clock.elapsedTime,r),R=1-(1-OH)*B,L=1-B,w=h.current;w&&(w.scale.y=S*R,w.visible=A>.001&&S>0),d.current&&(d.current.opacity=A*(.55+.35*S)*.8),p.current&&(p.current.opacity=A*S),m.current&&(m.current.opacity=A*T*.18*L);const I=g.current;if(I){I.style.opacity=String(A*T*L);const O=(1-T)*16;I.style.transform=`translate(-50%, calc(-100% - 12px)) translateY(${O}px)`}}),C.jsxs("group",{position:[s.i+l/2,0,s.j+l/2],children:[u?C.jsxs("group",{ref:h,children:[C.jsxs("mesh",{position:[0,c/2,0],children:[C.jsx("boxGeometry",{args:[l,c,l]}),C.jsx("meshLambertMaterial",{ref:p,color:s.color,transparent:!0,opacity:0}
4595)]}),C.jsx("lineSegments",{geometry:_,position:[0,c/2,0],children:C.jsx("lineBasicMaterial",{ref:d,color:"white",transparent:!0,opacity:0})})]}):null,C.jsxs("lineSegments",{children:[C.jsx("primitive",{object:b,attach:"geometry"}),C.jsx("lineDashedMaterial",{ref:m,color:"white",transparent:!0,opacity:0,dashSize:.15,gapSize:.2})]}),C.jsx(um,{position:[0,c+JS,0],center:!0,zIndexRange:[10,0],wrapperClass:"factory-scene-readout-card-wrapper",children:C.jsxs("div",{ref:g,style:{opacity:0,transform:"translate(-50%, calc(-100% - 12px))",pointerEvents:"none",width:180,height:64,background:"rgba(4, 20, 36, 0.88)",border:"1px solid rgba(255, 255, 255, 0.22)",position:"relative",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:"rgba(255, 255, 255, 0.72)",fontSize:10,padding:"8px 12px",boxSizing:"border-box"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[C.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.color,display:"inline-block"}}),C.jsx("span",{style:{color:s.color,fontWeight:600},children:s.label})]}),C.jsx("div",{style:{marginTop:2},children:s.name}),C.jsx("div",{style:{marginTop:6,fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:16,fontWeight:600,color:"rgba(255, 255, 255, 0.98)"},children:s.metric})]})})]})}const HH=.04,mu=4,Sd=2.5,ld=2,zH=.4,Ed=1.5,YS=2,cd=1.3,VH=.4,cu=1.2,ud=.4,WH=.2,hd=.6,dx=.1,jH="#C9C2A8",XH="#7AA3C8",JH="#5F6873",YH="#C9C2A8",KH=[0,.5],qH=mu+Ed,ZH=Sd;function QH(s){switch(s){case"west":return Math.PI;case"north":return-Math.PI/2;case"south":return Math.PI/2;case"east":default:return 0}}function $H({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=s.rise??KH,c=s.bodyColor??jH,u=s.cabColor??XH,h=s.wheelColor??JH,d=s.hubcapColor??YH,p=k.useRef(null),m=k.useRef(null),g=k.useRef(null),_=k.useRef(null),b=k.useRef(null),v=k.useRef([null,null]),y=k.useRef([null,null]),A=k.useMemo(()=>new tc(new Ms(mu,ld,Sd)),[]),S=k.useMemo(()=>new tc(new Ms(Ed,cd,YS)),[]);jt(Y=>{const{tCycle:V,globalAlpha:H}=an(Y.clock.elapsedTime,e,t,n,i),W=on(sn(V,l[0],l[1])),q=$t(Y.clock.elapsedTime,r),Q=1-(1-HH)*q,re=s.fadeOnOrtho?1-q:1,ae=p.current;ae&&(s.slide?(ae.scale.y=Q,ae.position.x=s.slide[0]*(1-W),ae.position.z=s.slide[1]*(1-W),ae.visible=H>.001&&W>0):(ae.scale.y=W*Q,ae.position.x=0,ae.position.z=0,ae.visible=H>.001&&W>0));const pe=H*(.55+.35*W)*.85*re;g.current&&(g.current.opacity=pe),b.current&&(b.current.opacity=pe);const Ue=H*W*re;m.current&&(m.current.opacity=Ue),_.current&&(_.current.opacity=Ue);for(const Pe of v.current)Pe&&(Pe.opacity=Ue);for(const Pe of y.current)Pe&&(Pe.opacity=Ue)});const T=s.i+qH/2,B=s.j+ZH/2,R=QH(s.facing),L=-Ed/2,w=mu/2,I=Sd/2-ud/2+WH,O=L-mu*.2,D=w+.05,z=I+ud/2+dx/2+.05,X=cu/2;return C.jsx("group",{position:[T,0,B],rotation:[0,R,0],children:C.jsxs("group",{ref:p,children:[C.jsxs("group",{position:[L,zH,0],children:[C.jsxs("mesh",{position:[0,ld/2,0],children:[C.jsx("boxGeometry",{args:[mu,ld,Sd]}),C.jsx("meshLambertMaterial",{ref:m,color:c,transparent:!0,opacity:0})]}),C.jsx("lineSegments",{geometry:A,position:[0,ld/2,0],children:C.jsx("lineBasicMaterial",{ref:g,color:c,transparent:!0,opacity:0})})]}),C.jsxs("group",{position:[w,VH,0],children:[C.jsxs("mesh",{position:[0,cd/2,0],children:[C.jsx("boxGeometry",{args:[Ed,cd,YS]}),C.jsx("meshLambertMaterial",{ref:_,color:u,transparent:!0,opacity:0})]}),C.jsx("lineSegments",{geometry:S,position:[0,cd/2,0],children:C.jsx("lineBasicMaterial",{ref:b,color:u,transparent:!0,opacity:0})})]}),C.jsxs("mesh",{position:[O,X,I],rotation:[Math.PI/2,0,0],children:[C.jsx("cylinderGeometry",{args:[cu/2,cu/2,ud,16]}),C.jsx("meshLambertMaterial",{ref:Y=>{v.current[0]=Y},color:h,transparent:!0,opacity:0})]}),C.jsxs("mesh",{position:[D,X,I],rotation:[Math.PI/2,0,0],children:[C.jsx("cylinderGeometry",{args:[cu/2,cu/2,ud,16]}),C.jsx("meshLambertMaterial",{ref:Y=>{v.current[1]=Y},color:h,transparent:!0,opacity:0})]}),C.jsxs("mesh",{position:[O,X,z],rotation:[Math.PI/2,0,0],children:[C.jsx("cylinderGeometry",{args:[hd/2,hd/2,dx,16]}),C.jsx("meshLambertMaterial",{ref:Y=>{y.current[0]=Y},color:d,transparent:!0,opacity:0}
4595)]}),C.jsxs("mesh",{position:[D,X,z],rotation:[Math.PI/2,0,0],children:[C.jsx("cylinderGeometry",{args:[hd/2,hd/2,dx,16]}),C.jsx("meshLambertMaterial",{ref:Y=>{y.current[1]=Y},color:d,transparent:!0,opacity:0})]})]})})}const ez=.04,tz=1,nz=[0,.6],KS="#0a2030",qS=new G,ZS=new G;function iz({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const{t:l}=yE(),c=s.height??tz,u=s.variant??"wire",h=s.color??"rgba(255,255,255,0.9)",d=s.rise??nz,p=k.useRef(null),m=k.useRef(null),g=k.useRef(null),_=k.useRef(null),b=k.useRef(null),v=s.shape==="cylinder",y=k.useMemo(()=>v?null:new tc(new Ms(s.width,c,s.depth)),[s.width,s.depth,c,v]),{isoColor:A,baseColor:S}=k.useMemo(()=>{const B=new we(h);return{isoColor:new we("#b8bec8"),baseColor:B.clone()}},[h]),T=k.useMemo(()=>new we,[]);return jt(B=>{var V,H;const{tCycle:R,globalAlpha:L}=an(B.clock.elapsedTime,e,t,n,i),w=on(sn(R,d[0],d[1])),I=$t(B.clock.elapsedTime,r),O=1-(1-ez)*I,D=s.fadeOnOrtho?1-I:1,z=p.current;z&&(s.slide?(z.scale.y=O,z.position.x=s.slide[0]*(1-w),z.position.z=s.slide[1]*(1-w),z.visible=L>.001&&w>0):(z.scale.y=w*O,z.position.x=0,z.position.z=0,z.visible=L>.001&&w>0));const X=s.autoFadeColor?I:1;if(m.current&&(m.current.opacity=L*(.55+.35*w)*.85*D*X),g.current&&(g.current.opacity=L*w*D*X),s.autoFadeColor&&u==="solid"&&(T.copy(A).lerp(S,I),g.current&&g.current.color.copy(T),m.current&&m.current.color.copy(T)),_.current){const W=s.autoFadeColor?I:1;_.current.style.opacity=String(L*w*D*W);const q=-150+100*I;if(_.current.style.transform=`translate(-50%, ${q}%)`,I>=.5){qS.set(0,0,0).project(B.camera),ZS.set(1,0,0).project(B.camera);const re=Math.abs(ZS.x-qS.x)*B.size.width/2;re>0&&(_.current.style.maxWidth=`${Math.max(20,(s.width-.4)*re)}px`),_.current.style.whiteSpace="pre-line"}else s.maxWidth!=null?(_.current.style.maxWidth=`${s.maxWidth}ch`,_.current.style.whiteSpace="pre-line"):(_.current.style.maxWidth="",_.current.style.whiteSpace="pre")}const Y=b.current;if(Y){const W=((V=s.labelOffset)==null?void 0:V[0])??0,q=c+(s.labelLift??1.7),Q=((H=s.labelOffset)==null?void 0:H[1])??0;Y.position.set(W+(0-W)*I,q+(0-q)*I,Q+(0-Q)*I)}}),C.jsxs("group",{position:[s.i+s.width/2,s.yBase??0,s.j+s.depth/2],children:[C.jsx("group",{ref:p,children:v?C.jsxs("mesh",{position:[0,c/2,0],rotation:[Math.PI/2,0,0],children:[C.jsx("cylinderGeometry",{args:[c/2,c/2,s.depth,16]}),C.jsx("meshLambertMaterial",{ref:g,color:u==="solid"?h:KS,transparent:!0,opacity:0})]}):C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{position:[0,c/2,0],children:[C.jsx("boxGeometry",{args:[s.width,c,s.depth]}),C.jsx("meshLambertMaterial",{ref:g,color:u==="solid"?h:KS,transparent:!0,opacity:0})]}),C.jsx("lineSegments",{geometry:y??void 0,position:[0,c/2,0],children:C.jsx("lineBasicMaterial",{ref:m,color:h,transparent:!0,opacity:0})})]})}),C.jsx("group",{ref:b,children:C.jsx(um,{position:[0,0,0],zIndexRange:[5,0],wrapperClass:"factory-scene-workcenter-label-wrapper",children:C.jsx("div",{ref:_,className:"factory-scene-workcenter-label",style:{opacity:0,pointerEvents:"none",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:600,letterSpacing:"0.04em",color:"rgba(255,255,255,0.85)",textTransform:"uppercase",textAlign:"center",lineHeight:1.15,whiteSpace:"pre",wordBreak:"keep-all",transform:"translate(-50%, -150%)"},children:C.jsx("div",{children:s.labelKey?l(s.labelKey):null})})})})]})}const sz=[0,.6],rz="#1d4ed8",oz="#d9b48a",az="#1f2937",lz="#fbbf24",cz="#bef264",uz=1.4,ca=.55,qs=.7,fm=.35,hz=fm/ca,QS=.13,bo=.16,fz=.14,dz=ca/2,pz=fm/ca,VT=.11,Wx=.
4595065,$_=.1,$S=.2,jx=.08,eE=.28,ua=.7,Gl=ua*.55,tE=ua*.45,ma=.078,gu=.068,nE=.056,oc=.65,kl=oc*.52,iE=oc*.48,Xx=.105,xu=.09,sE=.076,rE=ma*1.12,oE=xu*1.08,aE=gu*1.06,zu=ma*1.28,lE=ua-2*zu,Sp=Xx*1.2,cE=oc-2*Sp,fd=zu*1.18,dd=Sp*1.14,pd=zu*1.12,md=.12,gd=ma*1.1,Js=jx+oc,uE=Js+qs-ma,mz=Js+qs-VT/2,gz=Js+qs+$_/2,xz=Js+qs+$_+bo+.01,_z=bo*1.18,hE=bo-.04,yz=.04,vz=.03,bz=.34,Az=bo+.06,Mz=.08,Sz=Js+qs*.55,fE=.025,Ez=bo*1.13,Tz=bo*1.19,dE=Math.PI/6,pE=Math.PI*2/3,WT=Math.PI*.18,jT=Math.PI*.36,Cz=bo*1.16,wz=WT+jT-.05,Rz=Math.PI*.28,ro=.058,mE=Wx*1.38,Iz=Js+qs+ro/2,Bz=fm/2+.004,Pz=qs*.82,Lz=.022,Dz=.015,Fz=1.4,xd=.42,_d=.4,gE=.045;function Nz({def:s,cycle:e,holdEnd:t,outEnd:n,loop:i,orthoTransition:r}){const l=fR(),c=s.rise??sz,u=s.phase??0,h=s.jumpsuitColor??rz,d=s.skinTone??oz,p=s.bootColor??az,m=s.helmetColor??lz,g=s.hiVisColor??cz,_=s.speed??uz,b=s.regulated??!1,v=s.gloveColor,y=k.useMemo(()=>{if(!s.path||s.path.length<2)return null;const re=[];let ae=0;for(let pe=0;pe<s.path.length;pe++){const Ue=s.path[pe],Pe=s.path[(pe+1)%s.path.length],He=Math.hypot(Pe[0]-Ue[0],Pe[1]-Ue[1]);He>0&&(re.push({from:Ue,to:Pe,len:He}),ae+=He)}return ae===0?null:{segs:re,total:ae}},[s.path]),A=k.useMemo(()=>new xs({color:h,transparent:!0,opacity:0}),[h]),S=k.useMemo(()=>new xs({color:d,transparent:!0,opacity:0}),[d]),T=k.useMemo(()=>new xs({color:p,transparent:!0,opacity:0}),[p]),B=k.useMemo(()=>new xs({color:m,transparent:!0,opacity:0}),[m]),R=k.useMemo(()=>new xs({color:g,transparent:!0,opacity:0}),[g]),L=k.useMemo(()=>new xs({color:"#c8cdd6",transparent:!0,opacity:0}),[]),w=k.useMemo(()=>new xs({color:"#1e3a5f",transparent:!0,opacity:0}),[]),I=k.useMemo(()=>new xs({color:"#60a5fa",transparent:!0,opacity:0}),[]),O=k.useMemo(()=>v?new xs({color:v,transparent:!0,opacity:0}):null,[v]);k.useEffect(()=>()=>{A.dispose(),S.dispose(),T.dispose(),B.dispose(),R.dispose(),L.dispose(),w.dispose(),I.dispose(),O==null||O.dispose()},[A,S,T,B,R,L,w,I,O]);const D=k.useRef(null),z=k.useRef(null),X=k.useRef(null),Y=k.useRef(null),V=k.useRef(null),H=k.useRef(null),W=k.useRef(null),q=k.useRef({x:s.i,z:s.j,t:0});jt(re=>{const{tCycle:ae,globalAlpha:pe}=an(re.clock.elapsedTime,e,t,n,i),Ue=sn(ae,c[0],c[1]),Pe=re.clock.elapsedTime+u,He=1-$t(re.clock.elapsedTime,r),le=pe*Ue*He;if(D.current&&(D.current.visible=le>.001),s.respondToRed){const Le=FT(re.clock.elapsedTime).pos,ye=Math.min(.05,Math.max(0,Pe-q.current.t));q.current.t=Pe;const ze=Le[0]-q.current.x,Je=Le[1]-q.current.z,Ee=Math.hypot(ze,Je),qe=Ee>1.5,de=l?0:_*1.4,_e=l?0:1;let me=0;if(qe){const rt=de*ye,j=ze/Ee,ut=Je/Ee;q.current.x+=j*rt,q.current.z+=ut*rt,me=-Math.atan2(ut,j)}else me=-Math.atan2(Je,ze);D.current&&(D.current.position.set(q.current.x,0,q.current.z),D.current.rotation.y=me);const Te=qe?Pe*de*.7*Math.PI*2:0,Ce=qe?Math.sin(Te):0;H.current&&(H.current.rotation.x=0,H.current.rotation.z=-xd*Ce*_e),W.current&&(W.current.rotation.x=0,W.current.rotation.z=xd*Ce*_e),Y.current&&(Y.current.rotation.x=0,Y.current.rotation.z=_d*Ce*_e),V.current&&(V.current.rotation.x=0,V.current.rotation.z=-_d*Ce*_e),z.current&&(z.current.position.y=qe?gE*Math.abs(Ce)*_e:0),X.current&&(X.current.rotation.y=0);return}if(y){const Le=l?0:_,ye=l?0:1,ze=(Pe*Le%y.total+y.total)%y.total;let Je=0,Ee=y.segs[0],ht=0;for(const j of y.segs){if(ze<Je+j.len){Ee=j,ht=(ze-Je)/j.len;break}Je+=j.len}const qe=Ee.from[0]+(Ee.to[0]-Ee.from[0])*ht,de=Ee.from[1]+(Ee.to[1]-Ee.from[1])*ht,_e=Ee.to[0]-Ee.from[0],me=Ee.to[1]-Ee.from[1],Te=-Math.atan2(me,_e);D.current&&(D.current.position.set(qe,0,de),D.current.rotation.y=Te);const Ce=ze/Fz*Math.PI*2,rt=Math.sin(Ce);H.current&&(H.current.rotation.x=0,H.current.rotation.z=-xd*rt*ye),W.current&&(W.current.rotation.x=0,W.current.rotation.z=xd*rt*ye),Y.current&&(Y.current.rotation.x=0,Y.current.rotation.z=_d*rt*ye),V.current&&(V.current.rotation.x=0,V.current.rotation.z=-_d*rt*ye),z.current&&(z.current.position.y=gE*Math.abs(Math.sin(Ce))*ye),X.current&&(X.current.rotation.y=0)}else D.current&&(D.current.position.set(s.i,0,s.j),D.current.rotation.y=s.facing??0),z.current&&(z.current.position.y=.025*Math.sin(Pe*1.6)),X.current&&(X.current.rotation.y=.25*Math.sin(Pe*.5)),Y.current&&(Y.current.rotation.x=0,Y.current.rotation.z=.18*Math.sin(Pe*1.6)),V.current&&(V.current.rotation.x=0,V.current.rotation.z=-.18*Math.sin(Pe*1.6)),H.current&&(H.current.rotation.x=0,H.
4595current.rotation.z=0),W.current&&(W.current.rotation.x=0,W.current.rotation.z=0);A.opacity=le,S.opacity=le,T.opacity=le,B.opacity=le,R.opacity=le,L.opacity=le,w.opacity=le,I.opacity=le,O&&(O.opacity=le)});const Q=b?[1.08,1,1.08]:[1,1,1];return C.jsx("group",{ref:D,children:C.jsxs("group",{ref:z,scale:Q,children:[C.jsxs("group",{ref:H,position:[0,Js,-QS],children:[b?C.jsxs("mesh",{position:[0,-oc/2,0],children:[C.jsx("capsuleGeometry",{args:[Sp,cE,4,16]}),C.jsx("primitive",{object:A,attach:"material"})]}):C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{position:[0,-kl/2,0],children:[C.jsx("cylinderGeometry",{args:[Xx,xu,kl,16]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-kl,0],children:[C.jsx("sphereGeometry",{args:[oE,12,8]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-.494,0],children:[C.jsx("cylinderGeometry",{args:[xu,sE,iE,16]}),C.jsx("primitive",{object:A,attach:"material"})]})]}),b?C.jsxs("mesh",{position:[0,-.679,0],children:[C.jsx("cylinderGeometry",{args:[dd,dd,ro,14]}),C.jsx("primitive",{object:I,attach:"material"})]}):null,C.jsxs("mesh",{position:[.03,-.6900000000000001,0],children:[C.jsx("boxGeometry",{args:[eE,jx,$S]}),C.jsx("primitive",{object:b?A:T,attach:"material"})]})]}),C.jsxs("group",{ref:W,position:[0,Js,QS],children:[b?C.jsxs("mesh",{position:[0,-oc/2,0],children:[C.jsx("capsuleGeometry",{args:[Sp,cE,4,16]}),C.jsx("primitive",{object:A,attach:"material"})]}):C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{position:[0,-kl/2,0],children:[C.jsx("cylinderGeometry",{args:[Xx,xu,kl,16]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-kl,0],children:[C.jsx("sphereGeometry",{args:[oE,12,8]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-.494,0],children:[C.jsx("cylinderGeometry",{args:[xu,sE,iE,16]}),C.jsx("primitive",{object:A,attach:"material"})]})]}),b?C.jsxs("mesh",{position:[0,-.679,0],children:[C.jsx("cylinderGeometry",{args:[dd,dd,ro,14]}),C.jsx("primitive",{object:I,attach:"material"})]}):null,C.jsxs("mesh",{position:[.03,-.6900000000000001,0],children:[C.jsx("boxGeometry",{args:[eE,jx,$S]}),C.jsx("primitive",{object:b?A:T,attach:"material"})]})]}),C.jsxs("mesh",{position:[0,Js+qs/2,0],scale:[hz,1,1],children:[C.jsx("cylinderGeometry",{args:[ca/2,ca*.46,qs,16]}),C.jsx("primitive",{object:A,attach:"material"})]}),b?C.jsxs("mesh",{position:[Bz,Js+qs/2,0],children:[C.jsx("boxGeometry",{args:[Dz,Pz,Lz]}),C.jsx("primitive",{object:I,attach:"material"})]}):null,C.jsxs("mesh",{position:[0,mz,0],scale:[pz,1,1],children:[C.jsx("cylinderGeometry",{args:[fz,dz,VT,16]}),C.jsx("primitive",{object:A,attach:"material"})]}),b?null:C.jsxs("mesh",{position:[0,Sz,0],children:[C.jsx("boxGeometry",{args:[fm+fE*2,Mz,ca+fE*2]}),C.jsx("primitive",{object:R,attach:"material"})]}),C.jsxs("mesh",{position:[0,gz,0],children:[C.jsx("cylinderGeometry",{args:[Wx,Wx*1.15,$_,14]}),C.jsx("primitive",{object:b?A:S,attach:"material"})]}),b?C.jsxs("mesh",{position:[0,Iz,0],children:[C.jsx("cylinderGeometry",{args:[mE,mE,ro,14]}),C.jsx("primitive",{object:I,attach:"material"})]}):null,C.jsxs("group",{ref:Y,position:[0,uE,-.35300000000000004],children:[b?C.jsxs("mesh",{position:[0,-ua/2,0],children:[C.jsx("capsuleGeometry",{args:[zu,lE,4,12]}),C.jsx("primitive",{object:A,attach:"material"})]}):C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{position:[0,0,0],children:[C.jsx("sphereGeometry",{args:[rE,12,10]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-Gl/2,0],children:[C.jsx("cylinderGeometry",{args:[ma,gu,Gl,16]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-Gl,0],children:[C.jsx("sphereGeometry",{args:[aE,12,8]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-.5425,0],children:[C.jsx("cylinderGeometry",{args:[gu,nE,tE,16]}),C.jsx("primitive",{object:A,attach:"material"})]})]}),b?C.jsxs("mesh",{position:[0,-.729,0],children:[C.jsx("cylinderGeometry",{args:[fd,fd,ro,14]}),C.jsx("primitive",{object:I,attach:"material"})]}):null,O?C.jsxs("mesh",{position:[0,-(ua+(b?ro:0)+md/2),0],children:[C.jsx("cylinderGeometry",{args:[b?pd:gd,b?pd:gd,md,14]}),C.jsx("primitive",{object:O,attach:"material"})]}):null]}),C.jsxs("group",{ref:V,position:[0,uE,ca/2+ma],children:[b?C.jsxs("mesh",{position:[0,-ua/2,0],children:[C.jsx("capsuleGeometry",{args:[zu,lE,4,12]}),C.jsx("primitive",{object:A,attach:"material"})]}):C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{position:[0,0,0],children:[C.jsx("sphereGeometry",{args:[rE,12,10]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-Gl/2,0],children:[C.jsx("cylinderGeometry",{args:[ma,gu,Gl,16]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-Gl,0],children:[C.jsx("sphereGeometry",{args:[aE,12,8]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{position:[0,-.5425,0],children:[C.jsx("cylinderGeometry",{args:[gu,nE,tE,16]}),C.jsx("primitive",{object:A,attach:"material"})]})]}),b?C.jsxs("mesh",{position:[0,-.729,0],children:[C.jsx("cylinderGeometry",{args:[fd,fd,ro,14]}),C.jsx("primitive",{object:I,attach:"material"})]}):null,O?C.jsxs("mesh",{position:[0,-(ua+(b?ro:0)+md/2),0],children:[C.jsx("cylinderGeometry",{args:[b?pd:gd,b?pd:gd,md,14]}),C.jsx("primitive",{object:O,attach:"material"})]}):null]}),C.jsx("group",{ref:X,position:[0,xz,0],children:b?C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{children:[C.jsx("sphereGeometry",{args:[Ez,16,14]}),C.jsx("primitive",{object:A,attach:"material"})]}),C.jsxs("mesh",{children:[C.jsx("sphereGeometry",{args:[Tz,14,10,dE,pE,WT,jT]}),C.jsx("primitive",{object:w,attach:"material"})]}),C.jsxs("mesh",{children:[C.jsx("sphereGeometry",{args:[Cz,12,8,dE,pE,wz,Rz]}),C.jsx("primitive",{object:L,attach:"material"})]})]}):C.jsxs(C.Fragment,{children:[C.jsxs("mesh",{children:[C.jsx("sphereGeometry",{args:[bo,16,14]}),C.jsx("primitive",{object:S,attach:"material"})]}),C.jsxs("mesh",{position:[0,hE,0],children:[C.jsx("sphereGeometry",{args:[_z,16,8,0,Math.PI*2,0,Math.PI/2]}),C.jsx("primitive",{object:B,attach:"material"})]}),C.jsxs("mesh",{position:[Az,hE,0],children:[C.jsx("boxGeometry",{args:[yz,vz,bz]}),C.jsx("primitive",{object:B,attach:"material"})]})]})})]})})}function Oz({handleRef:s}){const e=Ks(t=>t.clock);return k.useEffect(()=>{if(e.autoStart=!1,e.stop(),e.elapsedTime=0,s){const t=n=>{e.elapsedTime=n,e.oldTime=performance.now(),e.running=!0};s.current={rearm:()=>{e.running=!1,e.elapsedTime=0},replay:()=>t(0),seek:n=>t(n),pause:()=>{e.running&&(e.getElapsedTime(),e.running=!1)},resume:()=>{e.running||t(e.elapsedTime)}}}return()=>{s&&(s.current=null)}},[e,s]),null}function Uz({paused:s}){const e=Ks(n=>n.invalidate),t=Ks(n=>n.clock);return jt(()=>{s||e()}),k.useEffect(()=>{s||(t.oldTime=performance.now(),e())},[s,t,e]),null}function Gz(){const[s,e]=k.useState(wb());return k.useEffect(()=>{const t=setInterval(()=>{const n=wb();e(i=>i===n?i:n)},100);return()=>clearInterval(t)},[]),s}function kz(s){var t;const e=(t=s.regions)==null?void 0:t[0];
4595return e?[(e.iMin+e.iMax)/2,(e.jMin+e.jMax)/2]:[0,0]}function Hz({zoom:s,target:e,orthoTransition:t,contentScreenOffsetY:n=0}){const i=k.useRef(null),[r,l]=e;return jt(c=>{const u=i.current;if(!u)return;const h=$t(c.clock.elapsedTime,t),d=-(Math.PI/4)*h,p=Math.cos(d),m=Math.sin(d),g=80*p+80*m,_=-80*m+80*p,b=1-h,v=52+28*h,y=1-h,A=-h,S=Math.hypot(y,A)||1,T=y/S,B=A/S;u.up.set(0,T,B);let R=0,L=0,w=0;if(n>0){const I=g*b,O=v,D=_*b,z=Math.hypot(I,O,D)||1,X=I/z,Y=O/z,V=D/z,H=T*Y+B*V,W=-X*H,q=T-Y*H,Q=B-V*H,re=Math.hypot(W,q,Q)||1,ae=s*(1-.25*h),pe=n/ae/re;R=W*pe,L=q*pe,w=Q*pe}u.position.set(r+g*b+R,v+L,l+_*b+w),u.lookAt(r+R,L,l+w),u.zoom=s*(1-.25*h),u.updateProjectionMatrix()}),C.jsx(fG,{ref:i,makeDefault:!0,position:[r+80,52,l+80],zoom:s,near:.1,far:1e3})}function zz(s){const e=new Map;for(const t of s){const n=t.size??3;e.set(t.id,[t.i+n/2,t.j+n/2])}return e}const s4=k.memo(function({layout:e,className:t,cameraZoom:n=18,cameraTarget:i,clockHandleRef:r,orthoTransition:l,contentScreenOffsetY:c,paused:u=!1}){var v,y,A,S,T,B,R,L,w;const[h,d]=k.useState(!1);k.useEffect(()=>d(!0),[]);const p=Gz(),m=u||p;if(!h)return C.jsx("div",{className:t});const g=zz(e.stations??[]),_=i??kz(e),b=e.loop??!0;return C.jsx("div",{className:t,children:C.jsxs(dU,{gl:{antialias:!0,alpha:!0},dpr:[1,2],frameloop:"demand",style:{background:"transparent"},children:[C.jsx(Uz,{paused:m}),r?C.jsx(Oz,{handleRef:r}):null,C.jsx(Hz,{zoom:n,target:_,orthoTransition:l,contentScreenOffsetY:c}),C.jsx("ambientLight",{intensity:.55}),C.jsx("directionalLight",{position:[10,20,10],intensity:1.4}
4595),e.regions?C.jsx(RH,{regions:e.regions,perimeterGaps:e.perimeterGaps,gridCenter:_,orthoTransition:l}):null,(v=e.shadedZones)==null?void 0:v.map((I,O)=>C.jsx(NH,{def:I,orthoTransition:l},`zone-${O}`)),(y=e.workCenters)==null?void 0:y.map(I=>C.jsx(iz,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},I.id)),(A=e.trucks)==null?void 0:A.map(I=>C.jsx($H,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},I.id)),(S=e.workers)==null?void 0:S.map(I=>C.jsx(Nz,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},I.id)),(T=e.stations)==null?void 0:T.map(I=>C.jsx(kH,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},I.id)),(B=e.assets)!=null&&B.length?C.jsx(k.Suspense,{fallback:null,children:e.assets.map(I=>C.jsx(vH,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},I.id))}):null,(R=e.flows)==null?void 0:R.map((I,O)=>C.jsx(LH,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},I.id??`flow-${O}`)),(L=e.connectors)==null?void 0:L.map((I,O)=>{const D=g.get(I.fromId),z=g.get(I.toId);if(!D||!z)return null;const X=e.stations.find(Y=>Y.id===I.fromId);return C.jsx(bH,{from:D,to:z,color:X.color,progress:I.progress,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b},`connector-${O}`)}),(w=e.regionLabels)==null?void 0:w.map((I,O)=>C.jsx(FH,{def:I,cycle:e.cycle,holdEnd:e.holdEnd,outEnd:e.outEnd,loop:b,orthoTransition:l},`label-${O}`))]})})});export{s4 as FactoryScene};
4596
4597//# debugId=7267e0a4-fc0d-5e57-86f9-e932b52a570b

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.