HomePage-99e33209.js 568 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820
  1. import{_ as _l,u as bl,a as vr,b as wl,d as Ml,e as Sl,o as Gn,f as Vn,g as En,F as Zo,h as Jo,i as Nc,j as Ko,n as Qo,t as $o,k as El,l as Tl}from"./index-ab0329a3.js";import{l as Al,a as Ll,g as Rl,b as Cl,c as Pl,d as Il,e as Nl,f as Dl,h as Ol}from"./login-a6e2698a.js";import{s as lt,h as Fl}from"./tip-a7451ffc.js";import{e as yr}from"./base64-4eed9625.js";import"./index-fdf5788b.js";const Bl="123",un={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},fn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ul=0,ea=1,zl=2,Dc=1,Hl=2,Gi=3,ps=0,$e=1,ms=2,Oc=1,Wi=0,ji=1,ta=2,na=3,ia=4,kl=5,oi=100,Gl=101,Vl=102,ra=103,sa=104,Wl=200,jl=201,ql=202,Xl=203,Fc=204,Bc=205,Yl=206,Zl=207,Jl=208,Kl=209,Ql=210,$l=0,eh=1,th=2,$s=3,nh=4,ih=5,rh=6,sh=7,gs=0,oh=1,ah=2,qi=0,ch=1,lh=2,hh=3,uh=4,fh=5,Uc=300,Fo=301,Bo=302,oa=303,aa=304,Uo=306,zo=307,eo=1e3,pt=1001,to=1002,st=1003,ca=1004,la=1005,it=1006,dh=1007,vs=1008,Ho=1009,ph=1010,mh=1011,es=1012,gh=1013,Qr=1014,dn=1015,ts=1016,vh=1017,yh=1018,xh=1019,Xi=1020,_h=1021,Pn=1022,Pt=1023,bh=1024,wh=1025,pi=1026,Qi=1027,Mh=1028,Sh=1029,Eh=1030,Th=1031,Ah=1032,Lh=1033,ha=33776,ua=33777,fa=33778,da=33779,pa=35840,ma=35841,ga=35842,va=35843,Rh=36196,ya=37492,xa=37496,Ch=37808,Ph=37809,Ih=37810,Nh=37811,Dh=37812,Oh=37813,Fh=37814,Bh=37815,Uh=37816,zh=37817,Hh=37818,kh=37819,Gh=37820,Vh=37821,Wh=36492,jh=37840,qh=37841,Xh=37842,Yh=37843,Zh=37844,Jh=37845,Kh=37846,Qh=37847,$h=37848,eu=37849,tu=37850,nu=37851,iu=37852,ru=37853,su=2200,ou=2201,au=2202,ns=2300,$r=2301,Ms=2302,ai=2400,ci=2401,is=2402,ko=2500,zc=2501,cu=0,dr=3e3,Hc=3001,lu=3007,hu=3002,uu=3003,fu=3004,du=3005,pu=3006,mu=3200,gu=3201,Ti=0,vu=1,Ss=7680,yu=519,ys=35044,$i=35048,_a="300 es";function Nt(){}Object.assign(Nt.prototype,{addEventListener:function(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},hasEventListener:function(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(this._listeners===void 0)return;const i=this._listeners[t];if(i!==void 0){const r=i.indexOf(e);r!==-1&&i.splice(r,1)}},dispatchEvent:function(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const i=n.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,t)}}});const Qe=[];for(let t=0;t<256;t++)Qe[t]=(t<16?"0":"")+t.toString(16);let xr=1234567;const we={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Qe[t&255]+Qe[t>>8&255]+Qe[t>>16&255]+Qe[t>>24&255]+"-"+Qe[e&255]+Qe[e>>8&255]+"-"+Qe[e>>16&15|64]+Qe[e>>24&255]+"-"+Qe[n&63|128]+Qe[n>>8&255]+"-"+Qe[n>>16&255]+Qe[n>>24&255]+Qe[i&255]+Qe[i>>8&255]+Qe[i>>16&255]+Qe[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return t!==void 0&&(xr=t%2147483647),xr=xr*16807%2147483647,(xr-1)/2147483646},degToRad:function(t){return t*we.DEG2RAD},radToDeg:function(t){return t*we.RAD2DEG},isPowerOfTwo:function(t){return(t&t-1)===0&&t!==0},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),c=o(n/2),l=s((e+i)/2),f=o((e+i)/2),h=s((e-i)/2),d=o((e-i)/2),u=s((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":t.set(a*f,c*h,c*d,a*l);break;case"YZY":t.set(c*d,a*f,c*h,a*l);break;case"ZXZ":t.set(c*h,c*d,a*f,a*l);break;case"XZX":t.set(a*f,c*m,c*u,a*l);break;case"YXY":t.set(c*u,a*f,c*m,a*l);break;case"ZYZ":t.set(c*m,c*u,a*f,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};class W{constructor(e=0,n=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return n!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,n)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e,n){return n!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,n)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n,i){return i!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}class ht{constructor(){Object.defineProperty(this,"isMatrix3",{value:!0}),this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,n,i,r,s,o,a,c,l){const f=this.elements;return f[0]=e,f[1]=r,f[2]=a,f[3]=n,f[4]=s,f[5]=c,f[6]=i,f[7]=o,f[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return new this.constructor().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],f=i[4],h=i[7],d=i[2],u=i[5],m=i[8],v=r[0],y=r[3],g=r[6],p=r[1],L=r[4],R=r[7],T=r[2],x=r[5],P=r[8];return s[0]=o*v+a*p+c*T,s[3]=o*y+a*L+c*x,s[6]=o*g+a*R+c*P,s[1]=l*v+f*p+h*T,s[4]=l*y+f*L+h*x,s[7]=l*g+f*R+h*P,s[2]=d*v+u*p+m*T,s[5]=d*y+u*L+m*x,s[8]=d*g+u*R+m*P,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8];return n*o*f-n*a*l-i*s*f+i*a*c+r*s*l-r*o*c}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],h=f*o-a*l,d=a*c-f*s,u=l*s-o*c,m=n*h+i*d+r*u;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return e[0]=h*v,e[1]=(r*l-f*i)*v,e[2]=(a*i-r*o)*v,e[3]=d*v,e[4]=(f*n-r*c)*v,e[5]=(r*s-a*n)*v,e[6]=u*v,e[7]=(i*c-l*n)*v,e[8]=(o*n-i*s)*v,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).copy(this).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,s,o,a){const c=Math.cos(s),l=Math.sin(s);this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-r*l,r*c,-r*(-l*o+c*a)+a+n,0,0,1)}scale(e,n){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=n,i[4]*=n,i[7]*=n,this}rotate(e){const n=Math.cos(e),i=Math.sin(e),r=this.elements,s=r[0],o=r[3],a=r[6],c=r[1],l=r[4],f=r[7];return r[0]=n*s+i*c,r[3]=n*o+i*l,r[6]=n*a+i*f,r[1]=-i*s+n*c,r[4]=-i*o+n*l,r[7]=-i*a+n*f,this}translate(e,n){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=n*i[2],i[4]+=n*i[5],i[7]+=n*i[8],this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}}let Wn;const Ai={getDataURL:function(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Wn===void 0&&(Wn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Wn.width=t.width,Wn.height=t.height;const n=Wn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Wn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};let xu=0;function Ge(t=Ge.DEFAULT_IMAGE,e=Ge.DEFAULT_MAPPING,n=pt,i=pt,r=it,s=vs,o=Pt,a=Ho,c=1,l=dr){Object.defineProperty(this,"id",{value:xu++}),this.uuid=we.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=a,this.offset=new W(0,0),this.repeat=new W(1,1),this.center=new W(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ht,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.version=0,this.onUpdate=null}Ge.DEFAULT_IMAGE=void 0;Ge.DEFAULT_MAPPING=Uc;Ge.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Ge,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const i=this.image;if(i.uuid===void 0&&(i.uuid=we.generateUUID()),!e&&t.images[i.uuid]===void 0){let r;if(Array.isArray(i)){r=[];for(let s=0,o=i.length;s<o;s++)i[s].isDataTexture?r.push(Es(i[s].image)):r.push(Es(i[s]))}else r=Es(i);t.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping!==Uc)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case eo:t.x=t.x-Math.floor(t.x);break;case pt:t.x=t.x<0?0:1;break;case to:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case eo:t.y=t.y-Math.floor(t.y);break;case pt:t.y=t.y<0?0:1;break;case to:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}});Object.defineProperty(Ge.prototype,"needsUpdate",{set:function(t){t===!0&&this.version++}});function Es(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Ai.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class Be{constructor(e=0,n=0,i=0,r=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=e,this.y=n,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,r){return this.x=e,this.y=n,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return n!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,n)):(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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e,n){return n!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,n)):(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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*n+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*n+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*n+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,s;const c=e.elements,l=c[0],f=c[4],h=c[8],d=c[1],u=c[5],m=c[9],v=c[2],y=c[6],g=c[10];if(Math.abs(f-d)<.01&&Math.abs(h-v)<.01&&Math.abs(m-y)<.01){if(Math.abs(f+d)<.1&&Math.abs(h+v)<.1&&Math.abs(m+y)<.1&&Math.abs(l+u+g-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const L=(l+1)/2,R=(u+1)/2,T=(g+1)/2,x=(f+d)/4,P=(h+v)/4,U=(m+y)/4;return L>R&&L>T?L<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(L),r=x/i,s=P/i):R>T?R<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(R),i=x/r,s=U/r):T<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),i=P/s,r=U/s),this.set(i,r,s,n),this}let p=Math.sqrt((y-m)*(y-m)+(h-v)*(h-v)+(d-f)*(d-f));return Math.abs(p)<.001&&(p=1),this.x=(y-m)/p,this.y=(h-v)/p,this.z=(d-f)/p,this.w=Math.acos((l+u+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n,i){return i!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}function It(t,e,n){this.width=t,this.height=e,this.scissor=new Be(0,0,t,e),this.scissorTest=!1,this.viewport=new Be(0,0,t,e),n=n||{},this.texture=new Ge(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:it,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}It.prototype=Object.assign(Object.create(Nt.prototype),{constructor:It,isWebGLRenderTarget:!0,setSize:function(t,e){(this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return new this.constructor().copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function ba(t,e,n){It.call(this,t,e,n),this.samples=4}ba.prototype=Object.assign(Object.create(It.prototype),{constructor:ba,isWebGLMultisampleRenderTarget:!0,copy:function(t){return It.prototype.copy.call(this,t),this.samples=t.samples,this}});class ot{constructor(e=0,n=0,i=0,r=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=e,this._y=n,this._z=i,this._w=r}static slerp(e,n,i,r){return i.copy(e).slerp(n,r)}static slerpFlat(e,n,i,r,s,o,a){let c=i[r+0],l=i[r+1],f=i[r+2],h=i[r+3];const d=s[o+0],u=s[o+1],m=s[o+2],v=s[o+3];if(h!==v||c!==d||l!==u||f!==m){let y=1-a;const g=c*d+l*u+f*m+h*v,p=g>=0?1:-1,L=1-g*g;if(L>Number.EPSILON){const T=Math.sqrt(L),x=Math.atan2(T,g*p);y=Math.sin(y*x)/T,a=Math.sin(a*x)/T}const R=a*p;if(c=c*y+d*R,l=l*y+u*R,f=f*y+m*R,h=h*y+v*R,y===1-a){const T=1/Math.sqrt(c*c+l*l+f*f+h*h);c*=T,l*=T,f*=T,h*=T}}e[n]=c,e[n+1]=l,e[n+2]=f,e[n+3]=h}static multiplyQuaternionsFlat(e,n,i,r,s,o){const a=i[r],c=i[r+1],l=i[r+2],f=i[r+3],h=s[o],d=s[o+1],u=s[o+2],m=s[o+3];return e[n]=a*m+f*h+c*u-l*d,e[n+1]=c*m+f*d+l*h-a*u,e[n+2]=l*m+f*u+a*d-c*h,e[n+3]=f*m-a*h-c*d-l*u,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,n,i,r){return this._x=e,this._y=n,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),f=a(r/2),h=a(s/2),d=c(i/2),u=c(r/2),m=c(s/2);switch(o){case"XYZ":this._x=d*f*h+l*u*m,this._y=l*u*h-d*f*m,this._z=l*f*m+d*u*h,this._w=l*f*h-d*u*m;break;case"YXZ":this._x=d*f*h+l*u*m,this._y=l*u*h-d*f*m,this._z=l*f*m-d*u*h,this._w=l*f*h+d*u*m;break;case"ZXY":this._x=d*f*h-l*u*m,this._y=l*u*h+d*f*m,this._z=l*f*m+d*u*h,this._w=l*f*h-d*u*m;break;case"ZYX":this._x=d*f*h-l*u*m,this._y=l*u*h+d*f*m,this._z=l*f*m-d*u*h,this._w=l*f*h+d*u*m;break;case"YZX":this._x=d*f*h+l*u*m,this._y=l*u*h+d*f*m,this._z=l*f*m-d*u*h,this._w=l*f*h-d*u*m;break;case"XZY":this._x=d*f*h-l*u*m,this._y=l*u*h-d*f*m,this._z=l*f*m+d*u*h,this._w=l*f*h+d*u*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],r=n[4],s=n[8],o=n[1],a=n[5],c=n[9],l=n[2],f=n[6],h=n[10],d=i+a+h;if(d>0){const u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(f-c)*u,this._y=(s-l)*u,this._z=(o-r)*u}else if(i>a&&i>h){const u=2*Math.sqrt(1+i-a-h);this._w=(f-c)/u,this._x=.25*u,this._y=(r+o)/u,this._z=(s+l)/u}else if(a>h){const u=2*Math.sqrt(1+a-i-h);this._w=(s-l)/u,this._x=(r+o)/u,this._y=.25*u,this._z=(c+f)/u}else{const u=2*Math.sqrt(1+h-i-a);this._w=(o-r)/u,this._x=(s+l)/u,this._y=(c+f)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-6?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(we.clamp(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,n){return n!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,n)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const i=e._x,r=e._y,s=e._z,o=e._w,a=n._x,c=n._y,l=n._z,f=n._w;return this._x=i*f+o*a+r*l-s*c,this._y=r*f+o*c+s*a-i*l,this._z=s*f+o*l+i*c-r*a,this._w=o*f-i*a-r*c-s*l,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const c=1-a*a;if(c<=Number.EPSILON){const u=1-n;return this._w=u*o+n*this._w,this._x=u*i+n*this._x,this._y=u*r+n*this._y,this._z=u*s+n*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),f=Math.atan2(l,a),h=Math.sin((1-n)*f)/l,d=Math.sin(n*f)/l;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}class E{constructor(e=0,n=0,i=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return n!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,n)):(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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e,n){return n!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,n)):(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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e,n){return n!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,n)):(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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(wa.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(wa.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=c*n+o*r-a*i,f=c*i+a*n-s*r,h=c*r+s*i-o*n,d=-s*n-o*i-a*r;return this.x=l*c+d*-s+f*-a-h*-o,this.y=f*c+d*-o+h*-s-l*-a,this.z=h*c+d*-a+l*-o-f*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e,n){return n!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,n)):this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,s=e.z,o=n.x,a=n.y,c=n.z;return this.x=r*c-s*a,this.y=s*o-i*c,this.z=i*a-r*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ts.copy(this).projectOnVector(e),this.sub(Ts)}reflect(e){return this.sub(Ts.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(we.clamp(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n,i){return i!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}const Ts=new E,wa=new ot;class wn{constructor(e,n){Object.defineProperty(this,"isBox3",{value:!0}),this.min=e!==void 0?e:new E(1/0,1/0,1/0),this.max=n!==void 0?n:new E(-1/0,-1/0,-1/0)}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){let n=1/0,i=1/0,r=1/0,s=-1/0,o=-1/0,a=-1/0;for(let c=0,l=e.length;c<l;c+=3){const f=e[c],h=e[c+1],d=e[c+2];f<n&&(n=f),h<i&&(i=h),d<r&&(r=d),f>s&&(s=f),h>o&&(o=h),d>a&&(a=d)}return this.min.set(n,i,r),this.max.set(s,o,a),this}setFromBufferAttribute(e){let n=1/0,i=1/0,r=1/0,s=-1/0,o=-1/0,a=-1/0;for(let c=0,l=e.count;c<l;c++){const f=e.getX(c),h=e.getY(c),d=e.getZ(c);f<n&&(n=f),h<i&&(i=h),d<r&&(r=d),f>s&&(s=f),h>o&&(o=h),d>a&&(a=d)}return this.min.set(n,i,r),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Ni.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}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 e===void 0&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return e===void 0&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new E),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){e.updateWorldMatrix(!1,!1);const n=e.geometry;n!==void 0&&(n.boundingBox===null&&n.computeBoundingBox(),Ls.copy(n.boundingBox),Ls.applyMatrix4(e.matrixWorld),this.union(Ls));const i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r]);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,n){return n===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),n=new E),n.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,Ni),Ni.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Di),_r.subVectors(this.max,Di),jn.subVectors(e.a,Di),qn.subVectors(e.b,Di),Xn.subVectors(e.c,Di),nn.subVectors(qn,jn),rn.subVectors(Xn,qn),Tn.subVectors(jn,Xn);let n=[0,-nn.z,nn.y,0,-rn.z,rn.y,0,-Tn.z,Tn.y,nn.z,0,-nn.x,rn.z,0,-rn.x,Tn.z,0,-Tn.x,-nn.y,nn.x,0,-rn.y,rn.x,0,-Tn.y,Tn.x,0];return!As(n,jn,qn,Xn,_r)||(n=[1,0,0,0,1,0,0,0,1],!As(n,jn,qn,Xn,_r))?!1:(br.crossVectors(nn,rn),n=[br.x,br.y,br.z],As(n,jn,qn,Xn,_r))}clampPoint(e,n){return n===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),n=new E),n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ni.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=this.getSize(Ni).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:(jt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),jt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),jt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),jt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),jt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),jt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),jt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),jt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(jt),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)}}function As(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){An.fromArray(t,s);const a=r.x*Math.abs(An.x)+r.y*Math.abs(An.y)+r.z*Math.abs(An.z),c=e.dot(An),l=n.dot(An),f=i.dot(An);if(Math.max(-Math.max(c,l,f),Math.min(c,l,f))>a)return!1}return!0}const jt=[new E,new E,new E,new E,new E,new E,new E,new E],Ni=new E,Ls=new wn,jn=new E,qn=new E,Xn=new E,nn=new E,rn=new E,Tn=new E,Di=new E,_r=new E,br=new E,An=new E,_u=new wn;class Mn{constructor(e,n){this.center=e!==void 0?e:new E,this.radius=n!==void 0?n:-1}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):_u.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}clone(){return new this.constructor().copy(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 n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n===void 0&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),n=new E),n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new wn),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}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}}const qt=new E,Rs=new E,wr=new E,sn=new E,Cs=new E,Mr=new E,Ps=new E;class pr{constructor(e,n){this.origin=e!==void 0?e:new E,this.direction=n!==void 0?n:new E(0,0,-1)}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n===void 0&&(console.warn("THREE.Ray: .at() target is now required"),n=new E),n.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,qt)),this}closestPointToPoint(e,n){n===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),n=new E),n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=qt.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(qt.copy(this.direction).multiplyScalar(n).add(this.origin),qt.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){Rs.copy(e).add(n).multiplyScalar(.5),wr.copy(n).sub(e).normalize(),sn.copy(this.origin).sub(Rs);const s=e.distanceTo(n)*.5,o=-this.direction.dot(wr),a=sn.dot(this.direction),c=-sn.dot(wr),l=sn.lengthSq(),f=Math.abs(1-o*o);let h,d,u,m;if(f>0)if(h=o*c-a,d=o*a-c,m=s*f,h>=0)if(d>=-m)if(d<=m){const v=1/f;h*=v,d*=v,u=h*(h+o*d+2*a)+d*(o*h+d+2*c)+l}else d=s,h=Math.max(0,-(o*d+a)),u=-h*h+d*(d+2*c)+l;else d=-s,h=Math.max(0,-(o*d+a)),u=-h*h+d*(d+2*c)+l;else d<=-m?(h=Math.max(0,-(-o*s+a)),d=h>0?-s:Math.min(Math.max(-s,-c),s),u=-h*h+d*(d+2*c)+l):d<=m?(h=0,d=Math.min(Math.max(-s,-c),s),u=d*(d+2*c)+l):(h=Math.max(0,-(o*s+a)),d=h>0?s:Math.min(Math.max(-s,-c),s),u=-h*h+d*(d+2*c)+l);else d=o>0?-s:s,h=Math.max(0,-(o*d+a)),u=-h*h+d*(d+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(wr).multiplyScalar(d).add(Rs),u}intersectSphere(e,n){qt.subVectors(e.center,this.origin);const i=qt.dot(this.direction),r=qt.dot(qt)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,c=i+o;return a<0&&c<0?null:a<0?this.at(c,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,s,o,a,c;const l=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),f>=0?(s=(e.min.y-d.y)*f,o=(e.max.y-d.y)*f):(s=(e.max.y-d.y)*f,o=(e.min.y-d.y)*f),i>o||s>r||((s>i||i!==i)&&(i=s),(o<r||r!==r)&&(r=o),h>=0?(a=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),i>c||a>r)||((a>i||i!==i)&&(i=a),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,qt)!==null}intersectTriangle(e,n,i,r,s){Cs.subVectors(n,e),Mr.subVectors(i,e),Ps.crossVectors(Cs,Mr);let o=this.direction.dot(Ps),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;sn.subVectors(this.origin,e);const c=a*this.direction.dot(Mr.crossVectors(sn,Mr));if(c<0)return null;const l=a*this.direction.dot(Cs.cross(sn));if(l<0||c+l>o)return null;const f=-a*sn.dot(Ps);return f<0?null:this.at(f/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}class Ee{constructor(){Object.defineProperty(this,"isMatrix4",{value:!0}),this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,n,i,r,s,o,a,c,l,f,h,d,u,m,v,y){const g=this.elements;return g[0]=e,g[4]=n,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=c,g[2]=l,g[6]=f,g[10]=h,g[14]=d,g[3]=u,g[7]=m,g[11]=v,g[15]=y,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 Ee().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,r=1/Yn.setFromMatrixColumn(e,0).length(),s=1/Yn.setFromMatrixColumn(e,1).length(),o=1/Yn.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const n=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(r),l=Math.sin(r),f=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=o*f,u=o*h,m=a*f,v=a*h;n[0]=c*f,n[4]=-c*h,n[8]=l,n[1]=u+m*l,n[5]=d-v*l,n[9]=-a*c,n[2]=v-d*l,n[6]=m+u*l,n[10]=o*c}else if(e.order==="YXZ"){const d=c*f,u=c*h,m=l*f,v=l*h;n[0]=d+v*a,n[4]=m*a-u,n[8]=o*l,n[1]=o*h,n[5]=o*f,n[9]=-a,n[2]=u*a-m,n[6]=v+d*a,n[10]=o*c}else if(e.order==="ZXY"){const d=c*f,u=c*h,m=l*f,v=l*h;n[0]=d-v*a,n[4]=-o*h,n[8]=m+u*a,n[1]=u+m*a,n[5]=o*f,n[9]=v-d*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const d=o*f,u=o*h,m=a*f,v=a*h;n[0]=c*f,n[4]=m*l-u,n[8]=d*l+v,n[1]=c*h,n[5]=v*l+d,n[9]=u*l-m,n[2]=-l,n[6]=a*c,n[10]=o*c}else if(e.order==="YZX"){const d=o*c,u=o*l,m=a*c,v=a*l;n[0]=c*f,n[4]=v-d*h,n[8]=m*h+u,n[1]=h,n[5]=o*f,n[9]=-a*f,n[2]=-l*f,n[6]=u*h+m,n[10]=d-v*h}else if(e.order==="XZY"){const d=o*c,u=o*l,m=a*c,v=a*l;n[0]=c*f,n[4]=-h,n[8]=l*f,n[1]=d*h+v,n[5]=o*f,n[9]=u*h-m,n[2]=m*h-u,n[6]=a*f,n[10]=v*h+d}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(bu,e,wu)}lookAt(e,n,i){const r=this.elements;return ft.subVectors(e,n),ft.lengthSq()===0&&(ft.z=1),ft.normalize(),on.crossVectors(i,ft),on.lengthSq()===0&&(Math.abs(i.z)===1?ft.x+=1e-4:ft.z+=1e-4,ft.normalize(),on.crossVectors(i,ft)),on.normalize(),Sr.crossVectors(ft,on),r[0]=on.x,r[4]=Sr.x,r[8]=ft.x,r[1]=on.y,r[5]=Sr.y,r[9]=ft.y,r[2]=on.z,r[6]=Sr.z,r[10]=ft.z,this}multiply(e,n){return n!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,n)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],f=i[1],h=i[5],d=i[9],u=i[13],m=i[2],v=i[6],y=i[10],g=i[14],p=i[3],L=i[7],R=i[11],T=i[15],x=r[0],P=r[4],U=r[8],K=r[12],ae=r[1],S=r[5],O=r[9],N=r[13],D=r[2],C=r[6],w=r[10],F=r[14],z=r[3],V=r[7],q=r[11],J=r[15];return s[0]=o*x+a*ae+c*D+l*z,s[4]=o*P+a*S+c*C+l*V,s[8]=o*U+a*O+c*w+l*q,s[12]=o*K+a*N+c*F+l*J,s[1]=f*x+h*ae+d*D+u*z,s[5]=f*P+h*S+d*C+u*V,s[9]=f*U+h*O+d*w+u*q,s[13]=f*K+h*N+d*F+u*J,s[2]=m*x+v*ae+y*D+g*z,s[6]=m*P+v*S+y*C+g*V,s[10]=m*U+v*O+y*w+g*q,s[14]=m*K+v*N+y*F+g*J,s[3]=p*x+L*ae+R*D+T*z,s[7]=p*P+L*S+R*C+T*V,s[11]=p*U+L*O+R*w+T*q,s[15]=p*K+L*N+R*F+T*J,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],f=e[2],h=e[6],d=e[10],u=e[14],m=e[3],v=e[7],y=e[11],g=e[15];return m*(+s*c*h-r*l*h-s*a*d+i*l*d+r*a*u-i*c*u)+v*(+n*c*u-n*l*d+s*o*d-r*o*u+r*l*f-s*c*f)+y*(+n*l*h-n*a*u-s*o*h+i*o*u+s*a*f-i*l*f)+g*(-r*a*f-n*c*h+n*a*d+r*o*h-i*o*d+i*c*f)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],h=e[9],d=e[10],u=e[11],m=e[12],v=e[13],y=e[14],g=e[15],p=h*y*l-v*d*l+v*c*u-a*y*u-h*c*g+a*d*g,L=m*d*l-f*y*l-m*c*u+o*y*u+f*c*g-o*d*g,R=f*v*l-m*h*l+m*a*u-o*v*u-f*a*g+o*h*g,T=m*h*c-f*v*c-m*a*d+o*v*d+f*a*y-o*h*y,x=n*p+i*L+r*R+s*T;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/x;return e[0]=p*P,e[1]=(v*d*s-h*y*s-v*r*u+i*y*u+h*r*g-i*d*g)*P,e[2]=(a*y*s-v*c*s+v*r*l-i*y*l-a*r*g+i*c*g)*P,e[3]=(h*c*s-a*d*s-h*r*l+i*d*l+a*r*u-i*c*u)*P,e[4]=L*P,e[5]=(f*y*s-m*d*s+m*r*u-n*y*u-f*r*g+n*d*g)*P,e[6]=(m*c*s-o*y*s-m*r*l+n*y*l+o*r*g-n*c*g)*P,e[7]=(o*d*s-f*c*s+f*r*l-n*d*l-o*r*u+n*c*u)*P,e[8]=R*P,e[9]=(m*h*s-f*v*s-m*i*u+n*v*u+f*i*g-n*h*g)*P,e[10]=(o*v*s-m*a*s+m*i*l-n*v*l-o*i*g+n*a*g)*P,e[11]=(f*a*s-o*h*s-f*i*l+n*h*l+o*i*u-n*a*u)*P,e[12]=T*P,e[13]=(f*v*r-m*h*r+m*i*d-n*v*d-f*i*y+n*h*y)*P,e[14]=(m*a*r-o*v*r-m*i*c+n*v*c+o*i*y-n*a*y)*P,e[15]=(o*h*r-f*a*r+f*i*c-n*h*c-o*i*d+n*a*d)*P,this}scale(e){const n=this.elements,i=e.x,r=e.y,s=e.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,r))}makeTranslation(e,n,i){return this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,o=e.x,a=e.y,c=e.z,l=s*o,f=s*a;return this.set(l*o+i,l*a-r*c,l*c+r*a,0,l*a+r*c,f*a+i,f*c-r*o,0,l*c-r*a,f*c+r*o,s*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i){return this.set(1,n,i,0,e,1,i,0,e,n,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,s=n._x,o=n._y,a=n._z,c=n._w,l=s+s,f=o+o,h=a+a,d=s*l,u=s*f,m=s*h,v=o*f,y=o*h,g=a*h,p=c*l,L=c*f,R=c*h,T=i.x,x=i.y,P=i.z;return r[0]=(1-(v+g))*T,r[1]=(u+R)*T,r[2]=(m-L)*T,r[3]=0,r[4]=(u-R)*x,r[5]=(1-(d+g))*x,r[6]=(y+p)*x,r[7]=0,r[8]=(m+L)*P,r[9]=(y-p)*P,r[10]=(1-(d+v))*P,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;let s=Yn.set(r[0],r[1],r[2]).length();const o=Yn.set(r[4],r[5],r[6]).length(),a=Yn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Tt.copy(this);const l=1/s,f=1/o,h=1/a;return Tt.elements[0]*=l,Tt.elements[1]*=l,Tt.elements[2]*=l,Tt.elements[4]*=f,Tt.elements[5]*=f,Tt.elements[6]*=f,Tt.elements[8]*=h,Tt.elements[9]*=h,Tt.elements[10]*=h,n.setFromRotationMatrix(Tt),i.x=s,i.y=o,i.z=a,this}makePerspective(e,n,i,r,s,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,c=2*s/(n-e),l=2*s/(i-r),f=(n+e)/(n-e),h=(i+r)/(i-r),d=-(o+s)/(o-s),u=-2*o*s/(o-s);return a[0]=c,a[4]=0,a[8]=f,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=u,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,n,i,r,s,o){const a=this.elements,c=1/(n-e),l=1/(i-r),f=1/(o-s),h=(n+e)*c,d=(i+r)*l,u=(o+s)*f;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*f,a[14]=-u,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const Yn=new E,Tt=new Ee,bu=new E(0,0,0),wu=new E(1,1,1),on=new E,Sr=new E,ft=new E;class mr{constructor(e=0,n=0,i=0,r=mr.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=e,this._y=n,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,i,r){return this._x=e,this._y=n,this._z=i,this._order=r||this._order,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,n,i){const r=we.clamp,s=e.elements,o=s[0],a=s[4],c=s[8],l=s[1],f=s[5],h=s[9],d=s[2],u=s[6],m=s[10];switch(n=n||this._order,n){case"XYZ":this._y=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(u,f),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(c,m),this._z=Math.atan2(l,f)):(this._y=Math.atan2(-d,o),this._z=0);break;case"ZXY":this._x=Math.asin(r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-a,f)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,m),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,f));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,f),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(c,m));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,f),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i!==!1&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return Ma.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ma,n,i)}setFromVector3(e,n){return this.set(e.x,e.y,e.z,n||this._order)}reorder(e){return Sa.setFromEuler(this),this.setFromQuaternion(Sa,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new E(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}mr.DefaultOrder="XYZ";mr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const Ma=new Ee,Sa=new ot;class kc{constructor(){this.mask=1}set(e){this.mask=1<<e|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}}let Mu=0;const Ea=new E,Zn=new ot,Xt=new Ee,Er=new E,Oi=new E,Su=new E,Eu=new ot,Ta=new E(1,0,0),Aa=new E(0,1,0),La=new E(0,0,1),Tu={type:"added"},Ra={type:"removed"};function ve(){Object.defineProperty(this,"id",{value:Mu++}),this.uuid=we.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ve.DefaultUp.clone();const t=new E,e=new mr,n=new ot,i=new E(1,1,1);function r(){n.setFromEuler(e,!1)}function s(){e.setFromQuaternion(n,void 0,!1)}e._onChange(r),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ee},normalMatrix:{value:new ht}}),this.matrix=new Ee,this.matrixWorld=new Ee,this.matrixAutoUpdate=ve.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new kc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}ve.DefaultUp=new E(0,1,0);ve.DefaultMatrixAutoUpdate=!0;ve.prototype=Object.assign(Object.create(Nt.prototype),{constructor:ve,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return Zn.setFromAxisAngle(t,e),this.quaternion.multiply(Zn),this},rotateOnWorldAxis:function(t,e){return Zn.setFromAxisAngle(t,e),this.quaternion.premultiply(Zn),this},rotateX:function(t){return this.rotateOnAxis(Ta,t)},rotateY:function(t){return this.rotateOnAxis(Aa,t)},rotateZ:function(t){return this.rotateOnAxis(La,t)},translateOnAxis:function(t,e){return Ea.copy(t).applyQuaternion(this.quaternion),this.position.add(Ea.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(Ta,t)},translateY:function(t){return this.translateOnAxis(Aa,t)},translateZ:function(t){return this.translateOnAxis(La,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Xt.copy(this.matrixWorld).invert())},lookAt:function(t,e,n){t.isVector3?Er.copy(t):Er.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Oi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xt.lookAt(Oi,Er,this.up):Xt.lookAt(Er,Oi,this.up),this.quaternion.setFromRotationMatrix(Xt),i&&(Xt.extractRotation(i.matrixWorld),Zn.setFromRotationMatrix(Xt),this.quaternion.premultiply(Zn.invert()))},add:function(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Tu)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Ra)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Ra)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),Xt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Xt.multiply(t.parent.matrixWorld)),t.applyMatrix4(Xt),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const s=this.children[n].getObjectByProperty(t,e);if(s!==void 0)return s}},getWorldPosition:function(t){return t===void 0&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new E),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return t===void 0&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new ot),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,t,Su),t},getWorldScale:function(t){return t===void 0&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new E),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,Eu,t),t},getWorldDirection:function(t){t===void 0&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new E),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(this.visible===!1)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)},traverseAncestors:function(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,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),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON());function r(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(t)),a.uuid}if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const a=o.shapes;if(Array.isArray(a))for(let c=0,l=a.length;c<l;c++){const f=a[c];r(t.shapes,f)}else r(t.shapes,a)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let a=0,c=this.material.length;a<c;a++)o.push(r(t.materials,this.material[a]));i.material=o}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const a=this.animations[o];i.animations.push(r(t.animations,a))}}if(e){const o=s(t.geometries),a=s(t.materials),c=s(t.textures),l=s(t.images),f=s(t.shapes),h=s(t.skeletons),d=s(t.animations);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),c.length>0&&(n.textures=c),l.length>0&&(n.images=l),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d)}return n.object=i,n;function s(o){const a=[];for(const c in o){const l=o[c];delete l.metadata,a.push(l)}return a}},clone:function(t){return new this.constructor().copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){const i=t.children[n];this.add(i.clone())}return this}});const Is=new E,Au=new E,Lu=new ht;class Jt{constructor(e,n){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=e!==void 0?e:new E(1,0,0),this.constant=n!==void 0?n:0}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=Is.subVectors(i,n).cross(Au.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}clone(){return new this.constructor().copy(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,n){return n===void 0&&(console.warn("THREE.Plane: .projectPoint() target is now required"),n=new E),n.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,n){n===void 0&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new E);const i=e.delta(Is),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):void 0;const s=-(e.start.dot(this.normal)+this.constant)/r;if(!(s<0||s>1))return n.copy(i).multiplyScalar(s).add(e.start)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new E),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const i=n||Lu.getNormalMatrix(e),r=this.coplanarPoint(Is).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}const At=new E,Yt=new E,Ns=new E,Zt=new E,Jn=new E,Kn=new E,Ca=new E,Ds=new E,Os=new E,Fs=new E;class nt{constructor(e,n,i){this.a=e!==void 0?e:new E,this.b=n!==void 0?n:new E,this.c=i!==void 0?i:new E}static getNormal(e,n,i,r){r===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new E),r.subVectors(i,n),At.subVectors(e,n),r.cross(At);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,n,i,r,s){At.subVectors(r,n),Yt.subVectors(i,n),Ns.subVectors(e,n);const o=At.dot(At),a=At.dot(Yt),c=At.dot(Ns),l=Yt.dot(Yt),f=Yt.dot(Ns),h=o*l-a*a;if(s===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),s=new E),h===0)return s.set(-2,-1,-1);const d=1/h,u=(l*c-a*f)*d,m=(o*f-a*c)*d;return s.set(1-u-m,m,u)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Zt),Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getUV(e,n,i,r,s,o,a,c){return this.getBarycoord(e,n,i,r,Zt),c.set(0,0),c.addScaledVector(s,Zt.x),c.addScaledVector(o,Zt.y),c.addScaledVector(a,Zt.z),c}static isFrontFacing(e,n,i,r){return At.subVectors(i,n),Yt.subVectors(e,n),At.cross(Yt).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return At.subVectors(this.c,this.b),Yt.subVectors(this.a,this.b),At.cross(Yt).length()*.5}getMidpoint(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new E),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Jt),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return nt.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,i,r,s){return nt.getUV(e,this.a,this.b,this.c,n,i,r,s)}containsPoint(e){return nt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){n===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),n=new E);const i=this.a,r=this.b,s=this.c;let o,a;Jn.subVectors(r,i),Kn.subVectors(s,i),Ds.subVectors(e,i);const c=Jn.dot(Ds),l=Kn.dot(Ds);if(c<=0&&l<=0)return n.copy(i);Os.subVectors(e,r);const f=Jn.dot(Os),h=Kn.dot(Os);if(f>=0&&h<=f)return n.copy(r);const d=c*h-f*l;if(d<=0&&c>=0&&f<=0)return o=c/(c-f),n.copy(i).addScaledVector(Jn,o);Fs.subVectors(e,s);const u=Jn.dot(Fs),m=Kn.dot(Fs);if(m>=0&&u<=m)return n.copy(s);const v=u*l-c*m;if(v<=0&&l>=0&&m<=0)return a=l/(l-m),n.copy(i).addScaledVector(Kn,a);const y=f*m-u*h;if(y<=0&&h-f>=0&&u-m>=0)return Ca.subVectors(s,r),a=(h-f)/(h-f+(u-m)),n.copy(r).addScaledVector(Ca,a);const g=1/(y+v+d);return o=v*g,a=d*g,n.copy(i).addScaledVector(Jn,o).addScaledVector(Kn,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Gc={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},Lt={h:0,s:0,l:0},Tr={h:0,s:0,l:0};function Bs(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}function Us(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function zs(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}class pe{constructor(e,n,i){return Object.defineProperty(this,"isColor",{value:!0}),n===void 0&&i===void 0?this.set(e):this.setRGB(e,n,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,n,i){return this.r=e,this.g=n,this.b=i,this}setHSL(e,n,i){if(e=we.euclideanModulo(e,1),n=we.clamp(n,0,1),i=we.clamp(i,0,1),n===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+n):i+n-i*n,s=2*i-r;this.r=Bs(s,r,e+1/3),this.g=Bs(s,r,e),this.b=Bs(s,r,e-1/3)}return this}setStyle(e){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,n(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,n(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){const a=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return n(r[5]),this.setHSL(a,c,l)}break}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){const r=i[1],s=r.length;if(s===3)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const n=Gc[e];return n!==void 0?this.setHex(n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,n=2){return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}copyLinearToGamma(e,n=2){const i=n>0?1/n:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Us(e.r),this.g=Us(e.g),this.b=Us(e.b),this}copyLinearToSRGB(e){return this.r=zs(e.r),this.g=zs(e.g),this.b=zs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});const n=this.r,i=this.g,r=this.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,c;const l=(o+s)/2;if(o===s)a=0,c=0;else{const f=s-o;switch(c=l<=.5?f/(s+o):f/(2-s-o),s){case n:a=(i-r)/f+(i<r?6:0);break;case i:a=(r-n)/f+2;break;case r:a=(n-i)/f+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,n,i){return this.getHSL(Lt),Lt.h+=e,Lt.s+=n,Lt.l+=i,this.setHSL(Lt.h,Lt.s,Lt.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.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,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpHSL(e,n){this.getHSL(Lt),e.getHSL(Tr);const i=we.lerp(Lt.h,Tr.h,n),r=we.lerp(Lt.s,Tr.s,n),s=we.lerp(Lt.l,Tr.l,n);return this.setHSL(i,r,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}pe.NAMES=Gc;pe.prototype.r=1;pe.prototype.g=1;pe.prototype.b=1;class no{constructor(e,n,i,r,s,o=0){this.a=e,this.b=n,this.c=i,this.normal=r&&r.isVector3?r:new E,this.vertexNormals=Array.isArray(r)?r:[],this.color=s&&s.isColor?s:new pe,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let n=0,i=e.vertexNormals.length;n<i;n++)this.vertexNormals[n]=e.vertexNormals[n].clone();for(let n=0,i=e.vertexColors.length;n<i;n++)this.vertexColors[n]=e.vertexColors[n].clone();return this}}let Ru=0;function ye(){Object.defineProperty(this,"id",{value:Ru++}),this.uuid=we.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=ji,this.side=ps,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Fc,this.blendDst=Bc,this.blendEquation=oi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=$s,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=yu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ss,this.stencilZFail=Ss,this.stencilZPass=Ss,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}ye.prototype=Object.assign(Object.create(Nt.prototype),{constructor:ye,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if(e==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===Oc;continue}const i=this[e];if(i===void 0){console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}},toJSON:function(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,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&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ji&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==ps&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&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&&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.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(r){const s=[];for(const o in r){const a=r[o];delete a.metadata,s.push(a)}return s}if(e){const r=i(t.textures),s=i(t.images);r.length>0&&(n.textures=r),s.length>0&&(n.images=s)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const i=e.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(ye.prototype,"needsUpdate",{set:function(t){t===!0&&this.version++}});function yn(t){ye.call(this),this.type="MeshBasicMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=gs,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}yn.prototype=Object.create(ye.prototype);yn.prototype.constructor=yn;yn.prototype.isMeshBasicMaterial=!0;yn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};const ke=new E,Ar=new W;function be(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n===!0,this.usage=ys,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(be.prototype,"needsUpdate",{set:function(t){t===!0&&this.version++}});Object.assign(be.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let s=t[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),s=new pe),e[n++]=s.r,e[n++]=s.g,e[n++]=s.b}return this},copyVector2sArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let s=t[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),s=new W),e[n++]=s.x,e[n++]=s.y}return this},copyVector3sArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let s=t[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),s=new E),e[n++]=s.x,e[n++]=s.y,e[n++]=s.z}return this},copyVector4sArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let s=t[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),s=new Be),e[n++]=s.x,e[n++]=s.y,e[n++]=s.z,e[n++]=s.w}return this},applyMatrix3:function(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)Ar.fromBufferAttribute(this,e),Ar.applyMatrix3(t),this.setXY(e,Ar.x,Ar.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)ke.fromBufferAttribute(this,e),ke.applyMatrix3(t),this.setXYZ(e,ke.x,ke.y,ke.z);return this},applyMatrix4:function(t){for(let e=0,n=this.count;e<n;e++)ke.x=this.getX(e),ke.y=this.getY(e),ke.z=this.getZ(e),ke.applyMatrix4(t),this.setXYZ(e,ke.x,ke.y,ke.z);return this},applyNormalMatrix:function(t){for(let e=0,n=this.count;e<n;e++)ke.x=this.getX(e),ke.y=this.getY(e),ke.z=this.getZ(e),ke.applyNormalMatrix(t),this.setXYZ(e,ke.x,ke.y,ke.z);return this},transformDirection:function(t){for(let e=0,n=this.count;e<n;e++)ke.x=this.getX(e),ke.y=this.getY(e),ke.z=this.getZ(e),ke.transformDirection(t),this.setXYZ(e,ke.x,ke.y,ke.z);return this},set:function(t,e=0){return this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});function io(t,e,n){be.call(this,new Int8Array(t),e,n)}io.prototype=Object.create(be.prototype);io.prototype.constructor=io;function ro(t,e,n){be.call(this,new Uint8Array(t),e,n)}ro.prototype=Object.create(be.prototype);ro.prototype.constructor=ro;function so(t,e,n){be.call(this,new Uint8ClampedArray(t),e,n)}so.prototype=Object.create(be.prototype);so.prototype.constructor=so;function oo(t,e,n){be.call(this,new Int16Array(t),e,n)}oo.prototype=Object.create(be.prototype);oo.prototype.constructor=oo;function er(t,e,n){be.call(this,new Uint16Array(t),e,n)}er.prototype=Object.create(be.prototype);er.prototype.constructor=er;function ao(t,e,n){be.call(this,new Int32Array(t),e,n)}ao.prototype=Object.create(be.prototype);ao.prototype.constructor=ao;function tr(t,e,n){be.call(this,new Uint32Array(t),e,n)}tr.prototype=Object.create(be.prototype);tr.prototype.constructor=tr;function rs(t,e,n){be.call(this,new Uint16Array(t),e,n)}rs.prototype=Object.create(be.prototype);rs.prototype.constructor=rs;rs.prototype.isFloat16BufferAttribute=!0;function De(t,e,n){be.call(this,new Float32Array(t),e,n)}De.prototype=Object.create(be.prototype);De.prototype.constructor=De;function co(t,e,n){be.call(this,new Float64Array(t),e,n)}co.prototype=Object.create(be.prototype);co.prototype.constructor=co;class Cu{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const n=[];let i,r,s;const o=e.faces;for(r=0;r<o.length;r++){const a=o[r];a.materialIndex!==s&&(s=a.materialIndex,i!==void 0&&(i.count=r*3-i.start,n.push(i)),i={start:r*3,materialIndex:s})}i!==void 0&&(i.count=r*3-i.start,n.push(i)),this.groups=n}fromGeometry(e){const n=e.faces,i=e.vertices,r=e.faceVertexUvs,s=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,a=e.morphTargets,c=a.length;let l;if(c>0){l=[];for(let g=0;g<c;g++)l[g]={name:a[g].name,data:[]};this.morphTargets.position=l}const f=e.morphNormals,h=f.length;let d;if(h>0){d=[];for(let g=0;g<h;g++)d[g]={name:f[g].name,data:[]};this.morphTargets.normal=d}const u=e.skinIndices,m=e.skinWeights,v=u.length===i.length,y=m.length===i.length;i.length>0&&n.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<n.length;g++){const p=n[g];this.vertices.push(i[p.a],i[p.b],i[p.c]);const L=p.vertexNormals;if(L.length===3)this.normals.push(L[0],L[1],L[2]);else{const T=p.normal;this.normals.push(T,T,T)}const R=p.vertexColors;if(R.length===3)this.colors.push(R[0],R[1],R[2]);else{const T=p.color;this.colors.push(T,T,T)}if(s===!0){const T=r[0][g];T!==void 0?this.uvs.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new W,new W,new W))}if(o===!0){const T=r[1][g];T!==void 0?this.uvs2.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new W,new W,new W))}for(let T=0;T<c;T++){const x=a[T].vertices;l[T].data.push(x[p.a],x[p.b],x[p.c])}for(let T=0;T<h;T++){const x=f[T].vertexNormals[g];d[T].data.push(x.a,x.b,x.c)}v&&this.skinIndices.push(u[p.a],u[p.b],u[p.c]),y&&this.skinWeights.push(m[p.a],m[p.b],m[p.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}function Vc(t){if(t.length===0)return-1/0;let e=t[0];for(let n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}const Pu={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray<"u"?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Lr(t,e){return new Pu[t](e)}let Iu=1;const Dt=new Ee,Hs=new ve,Qn=new E,dt=new wn,Fi=new wn,Je=new E;function Fe(){Object.defineProperty(this,"id",{value:Iu+=2}),this.uuid=we.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Fe.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Fe,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Vc(t)>65535?tr:er)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return this.attributes[t]!==void 0},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new ht().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(t){return Dt.makeRotationX(t),this.applyMatrix4(Dt),this},rotateY:function(t){return Dt.makeRotationY(t),this.applyMatrix4(Dt),this},rotateZ:function(t){return Dt.makeRotationZ(t),this.applyMatrix4(Dt),this},translate:function(t,e,n){return Dt.makeTranslation(t,e,n),this.applyMatrix4(Dt),this},scale:function(t,e,n){return Dt.makeScale(t,e,n),this.applyMatrix4(Dt),this},lookAt:function(t){return Hs.lookAt(t),Hs.updateMatrix(),this.applyMatrix4(Hs.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qn).negate(),this.translate(Qn.x,Qn.y,Qn.z),this},setFromObject:function(t){const e=t.geometry;if(t.isPoints||t.isLine){const n=new De(e.vertices.length*3,3),i=new De(e.colors.length*3,3);if(this.setAttribute("position",n.copyVector3sArray(e.vertices)),this.setAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){const r=new De(e.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(e.lineDistances))}e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new De(e,3)),this},updateFromObject:function(t){let e=t.geometry;if(t.isMesh){let n=e.__directGeometry;if(e.elementsNeedUpdate===!0&&(n=void 0,e.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}if(e.verticesNeedUpdate===!0){const n=this.attributes.position;n!==void 0&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1}if(e.normalsNeedUpdate===!0){const n=this.attributes.normal;n!==void 0&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1}if(e.colorsNeedUpdate===!0){const n=this.attributes.color;n!==void 0&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1}if(e.uvsNeedUpdate){const n=this.attributes.uv;n!==void 0&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1}if(e.lineDistancesNeedUpdate){const n=this.attributes.lineDistance;n!==void 0&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1}return e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=new Cu().fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){const e=new Float32Array(t.vertices.length*3);if(this.setAttribute("position",new be(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){const n=new Float32Array(t.normals.length*3);this.setAttribute("normal",new be(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){const n=new Float32Array(t.colors.length*3);this.setAttribute("color",new be(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){const n=new Float32Array(t.uvs.length*2);this.setAttribute("uv",new be(n,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){const n=new Float32Array(t.uvs2.length*2);this.setAttribute("uv2",new be(n,2).copyVector2sArray(t.uvs2))}this.groups=t.groups;for(const n in t.morphTargets){const i=[],r=t.morphTargets[n];for(let s=0,o=r.length;s<o;s++){const a=r[s],c=new De(a.data.length*3,3);c.name=a.name,i.push(c.copyVector3sArray(a.data))}this.morphAttributes[n]=i}if(t.skinIndices.length>0){const n=new De(t.skinIndices.length*4,4);this.setAttribute("skinIndex",n.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){const n=new De(t.skinWeights.length*4,4);this.setAttribute("skinWeight",n.copyVector4sArray(t.skinWeights))}return t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new wn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new E(-1/0,-1/0,-1/0),new E(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){const r=e[n];dt.setFromBufferAttribute(r),this.morphTargetsRelative?(Je.addVectors(this.boundingBox.min,dt.min),this.boundingBox.expandByPoint(Je),Je.addVectors(this.boundingBox.max,dt.max),this.boundingBox.expandByPoint(Je)):(this.boundingBox.expandByPoint(dt.min),this.boundingBox.expandByPoint(dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new Mn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new E,1/0);return}if(t){const n=this.boundingSphere.center;if(dt.setFromBufferAttribute(t),e)for(let r=0,s=e.length;r<s;r++){const o=e[r];Fi.setFromBufferAttribute(o),this.morphTargetsRelative?(Je.addVectors(dt.min,Fi.min),dt.expandByPoint(Je),Je.addVectors(dt.max,Fi.max),dt.expandByPoint(Je)):(dt.expandByPoint(Fi.min),dt.expandByPoint(Fi.max))}dt.getCenter(n);let i=0;for(let r=0,s=t.count;r<s;r++)Je.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(Je));if(e)for(let r=0,s=e.length;r<s;r++){const o=e[r],a=this.morphTargetsRelative;for(let c=0,l=o.count;c<l;c++)Je.fromBufferAttribute(o,c),a&&(Qn.fromBufferAttribute(t,c),Je.add(Qn)),i=Math.max(i,n.distanceToSquared(Je))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new be(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);const i=new E,r=new E,s=new E,o=new E,a=new E,c=new E,l=new E,f=new E;if(t)for(let h=0,d=t.count;h<d;h+=3){const u=t.getX(h+0),m=t.getX(h+1),v=t.getX(h+2);i.fromBufferAttribute(e,u),r.fromBufferAttribute(e,m),s.fromBufferAttribute(e,v),l.subVectors(s,r),f.subVectors(i,r),l.cross(f),o.fromBufferAttribute(n,u),a.fromBufferAttribute(n,m),c.fromBufferAttribute(n,v),o.add(l),a.add(l),c.add(l),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let h=0,d=e.count;h<d;h+=3)i.fromBufferAttribute(e,h+0),r.fromBufferAttribute(e,h+1),s.fromBufferAttribute(e,h+2),l.subVectors(s,r),f.subVectors(i,r),l.cross(f),n.setXYZ(h+0,l.x,l.y,l.z),n.setXYZ(h+1,l.x,l.y,l.z),n.setXYZ(h+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(t,e){if(!(t&&t.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);return}e===void 0&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(t.attributes[i]===void 0)continue;const s=n[i].array,o=t.attributes[i],a=o.array,c=o.itemSize*e,l=Math.min(a.length,s.length-c);for(let f=0,h=c;f<l;f++,h++)s[h]=a[f]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Je.fromBufferAttribute(t,e),Je.normalize(),t.setXYZ(e,Je.x,Je.y,Je.z)},toNonIndexed:function(){function t(o,a){const c=o.array,l=o.itemSize,f=o.normalized,h=new c.constructor(a.length*l);let d=0,u=0;for(let m=0,v=a.length;m<v;m++){d=a[m]*l;for(let y=0;y<l;y++)h[u++]=c[d++]}return new be(h,l,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;const e=new Fe,n=this.index.array,i=this.attributes;for(const o in i){const a=i[o],c=t(a,n);e.setAttribute(o,c)}const r=this.morphAttributes;for(const o in r){const a=[],c=r[o];for(let l=0,f=c.length;l<f;l++){const h=c[l],d=t(h,n);a.push(d)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,a=s.length;o<a;o++){const c=s[o];e.addGroup(c.start,c.count,c.materialIndex)}return e},toJSON:function(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const a=this.parameters;for(const c in a)a[c]!==void 0&&(t[c]=a[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const c=n[a],l=c.toJSON(t.data);c.name!==""&&(l.name=c.name),t.data.attributes[a]=l}const i={};let r=!1;for(const a in this.morphAttributes){const c=this.morphAttributes[a],l=[];for(let f=0,h=c.length;f<h;f++){const d=c[f],u=d.toJSON(t.data);d.name!==""&&(u.name=d.name),l.push(u)}l.length>0&&(i[a]=l,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return new Fe().copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const i=t.attributes;for(const c in i){const l=i[c];this.setAttribute(c,l.clone(e))}const r=t.morphAttributes;for(const c in r){const l=[],f=r[c];for(let h=0,d=f.length;h<d;h++)l.push(f[h].clone(e));this.morphAttributes[c]=l}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let c=0,l=s.length;c<l;c++){const f=s[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());const a=t.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const Pa=new Ee,Ln=new pr,ks=new Mn,an=new E,cn=new E,ln=new E,Gs=new E,Vs=new E,Ws=new E,Rr=new E,Cr=new E,Pr=new E,li=new W,hi=new W,ui=new W,Yi=new E,Ir=new E;function et(t,e){ve.call(this),this.type="Mesh",this.geometry=t!==void 0?t:new Fe,this.material=e!==void 0?e:new yn,this.updateMorphTargets()}et.prototype=Object.assign(Object.create(ve.prototype),{constructor:et,isMesh:!0,copy:function(t){return ve.prototype.copy.call(this,t),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}else{const e=t.morphTargets;e!==void 0&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),ks.copy(n.boundingSphere),ks.applyMatrix4(r),t.ray.intersectsSphere(ks)===!1)||(Pa.copy(r).invert(),Ln.copy(t.ray).applyMatrix4(Pa),n.boundingBox!==null&&Ln.intersectsBox(n.boundingBox)===!1))return;let s;if(n.isBufferGeometry){const o=n.index,a=n.attributes.position,c=n.morphAttributes.position,l=n.morphTargetsRelative,f=n.attributes.uv,h=n.attributes.uv2,d=n.groups,u=n.drawRange;if(o!==null)if(Array.isArray(i))for(let m=0,v=d.length;m<v;m++){const y=d[m],g=i[y.materialIndex],p=Math.max(y.start,u.start),L=Math.min(y.start+y.count,u.start+u.count);for(let R=p,T=L;R<T;R+=3){const x=o.getX(R),P=o.getX(R+1),U=o.getX(R+2);s=Nr(this,g,t,Ln,a,c,l,f,h,x,P,U),s&&(s.faceIndex=Math.floor(R/3),s.face.materialIndex=y.materialIndex,e.push(s))}}else{const m=Math.max(0,u.start),v=Math.min(o.count,u.start+u.count);for(let y=m,g=v;y<g;y+=3){const p=o.getX(y),L=o.getX(y+1),R=o.getX(y+2);s=Nr(this,i,t,Ln,a,c,l,f,h,p,L,R),s&&(s.faceIndex=Math.floor(y/3),e.push(s))}}else if(a!==void 0)if(Array.isArray(i))for(let m=0,v=d.length;m<v;m++){const y=d[m],g=i[y.materialIndex],p=Math.max(y.start,u.start),L=Math.min(y.start+y.count,u.start+u.count);for(let R=p,T=L;R<T;R+=3){const x=R,P=R+1,U=R+2;s=Nr(this,g,t,Ln,a,c,l,f,h,x,P,U),s&&(s.faceIndex=Math.floor(R/3),s.face.materialIndex=y.materialIndex,e.push(s))}}else{const m=Math.max(0,u.start),v=Math.min(a.count,u.start+u.count);for(let y=m,g=v;y<g;y+=3){const p=y,L=y+1,R=y+2;s=Nr(this,i,t,Ln,a,c,l,f,h,p,L,R),s&&(s.faceIndex=Math.floor(y/3),e.push(s))}}}else if(n.isGeometry){const o=Array.isArray(i),a=n.vertices,c=n.faces;let l;const f=n.faceVertexUvs[0];f.length>0&&(l=f);for(let h=0,d=c.length;h<d;h++){const u=c[h],m=o?i[u.materialIndex]:i;if(m===void 0)continue;const v=a[u.a],y=a[u.b],g=a[u.c];if(s=Wc(this,m,t,Ln,v,y,g,Yi),s){if(l&&l[h]){const p=l[h];li.copy(p[0]),hi.copy(p[1]),ui.copy(p[2]),s.uv=nt.getUV(Yi,v,y,g,li,hi,ui,new W)}s.face=u,s.faceIndex=h,e.push(s)}}}}});function Wc(t,e,n,i,r,s,o,a){let c;if(e.side===$e?c=i.intersectTriangle(o,s,r,!0,a):c=i.intersectTriangle(r,s,o,e.side!==ms,a),c===null)return null;Ir.copy(a),Ir.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(Ir);return l<n.near||l>n.far?null:{distance:l,point:Ir.clone(),object:t}}function Nr(t,e,n,i,r,s,o,a,c,l,f,h){an.fromBufferAttribute(r,l),cn.fromBufferAttribute(r,f),ln.fromBufferAttribute(r,h);const d=t.morphTargetInfluences;if(e.morphTargets&&s&&d){Rr.set(0,0,0),Cr.set(0,0,0),Pr.set(0,0,0);for(let m=0,v=s.length;m<v;m++){const y=d[m],g=s[m];y!==0&&(Gs.fromBufferAttribute(g,l),Vs.fromBufferAttribute(g,f),Ws.fromBufferAttribute(g,h),o?(Rr.addScaledVector(Gs,y),Cr.addScaledVector(Vs,y),Pr.addScaledVector(Ws,y)):(Rr.addScaledVector(Gs.sub(an),y),Cr.addScaledVector(Vs.sub(cn),y),Pr.addScaledVector(Ws.sub(ln),y)))}an.add(Rr),cn.add(Cr),ln.add(Pr)}t.isSkinnedMesh&&(t.boneTransform(l,an),t.boneTransform(f,cn),t.boneTransform(h,ln));const u=Wc(t,e,n,i,an,cn,ln,Yi);if(u){a&&(li.fromBufferAttribute(a,l),hi.fromBufferAttribute(a,f),ui.fromBufferAttribute(a,h),u.uv=nt.getUV(Yi,an,cn,ln,li,hi,ui,new W)),c&&(li.fromBufferAttribute(c,l),hi.fromBufferAttribute(c,f),ui.fromBufferAttribute(c,h),u.uv2=nt.getUV(Yi,an,cn,ln,li,hi,ui,new W));const m=new no(l,f,h);nt.getNormal(an,cn,ln,m.normal),u.face=m}return u}class jc extends Fe{constructor(e=1,n=1,i=1,r=1,s=1,o=1){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const c=[],l=[],f=[],h=[];let d=0,u=0;m("z","y","x",-1,-1,i,n,e,o,s,0),m("z","y","x",1,-1,i,n,-e,o,s,1),m("x","z","y",1,1,e,i,n,r,o,2),m("x","z","y",1,-1,e,i,-n,r,o,3),m("x","y","z",1,-1,e,n,i,r,s,4),m("x","y","z",-1,-1,e,n,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new De(l,3)),this.setAttribute("normal",new De(f,3)),this.setAttribute("uv",new De(h,2));function m(v,y,g,p,L,R,T,x,P,U,K){const ae=R/P,S=T/U,O=R/2,N=T/2,D=x/2,C=P+1,w=U+1;let F=0,z=0;const V=new E;for(let q=0;q<w;q++){const J=q*S-N;for(let le=0;le<C;le++){const ge=le*ae-O;V[v]=ge*p,V[y]=J*L,V[g]=D,l.push(V.x,V.y,V.z),V[v]=0,V[y]=0,V[g]=x>0?1:-1,f.push(V.x,V.y,V.z),h.push(le/P),h.push(1-q/U),F+=1}}for(let q=0;q<U;q++)for(let J=0;J<P;J++){const le=d+J+C*q,ge=d+J+C*(q+1),Re=d+(J+1)+C*(q+1),k=d+(J+1)+C*q;c.push(le,ge,k),c.push(ge,Re,k),z+=6}a.addGroup(u,z,K),u+=z,d+=F}}}function gi(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function tt(t){const e={};for(let n=0;n<t.length;n++){const i=gi(t[n]);for(const r in i)e[r]=i[r]}return e}const Nu={clone:gi,merge:tt};var Du=`void main() {
  2. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  3. }`,Ou=`void main() {
  4. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  5. }`;function ut(t){ye.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Du,this.fragmentShader=Ou,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&(t.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}ut.prototype=Object.create(ye.prototype);ut.prototype.constructor=ut;ut.prototype.isShaderMaterial=!0;ut.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=gi(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this};ut.prototype.toJSON=function(t){const e=ye.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const s=this.uniforms[i].value;s&&s.isTexture?e.uniforms[i]={type:"t",value:s.toJSON(t).uuid}:s&&s.isColor?e.uniforms[i]={type:"c",value:s.getHex()}:s&&s.isVector2?e.uniforms[i]={type:"v2",value:s.toArray()}:s&&s.isVector3?e.uniforms[i]={type:"v3",value:s.toArray()}:s&&s.isVector4?e.uniforms[i]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?e.uniforms[i]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?e.uniforms[i]={type:"m4",value:s.toArray()}:e.uniforms[i]={value:s}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e};function xn(){ve.call(this),this.type="Camera",this.matrixWorldInverse=new Ee,this.projectionMatrix=new Ee,this.projectionMatrixInverse=new Ee}xn.prototype=Object.assign(Object.create(ve.prototype),{constructor:xn,isCamera:!0,copy:function(t,e){return ve.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){t===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new E),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){ve.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){ve.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return new this.constructor().copy(this)}});function Ke(t=50,e=1,n=.1,i=2e3){xn.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Ke.prototype=Object.assign(Object.create(xn.prototype),{constructor:Ke,isPerspectiveCamera:!0,copy:function(t,e){return xn.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=we.RAD2DEG*2*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(we.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/t},getEffectiveFOV:function(){return we.RAD2DEG*2*Math.atan(Math.tan(we.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,s){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(we.DEG2RAD*.5*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(this.view!==null&&this.view.enabled){const a=s.fullWidth,c=s.fullHeight;r+=s.offsetX*i/a,e-=s.offsetY*n/c,i*=s.width/a,n*=s.height/c}const o=this.filmOffset;o!==0&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=ve.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const $n=90,ei=1;function vi(t,e,n){if(ve.call(this),this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;const i=new Ke($n,ei,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new E(1,0,0)),this.add(i);const r=new Ke($n,ei,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(-1,0,0)),this.add(r);const s=new Ke($n,ei,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new E(0,1,0)),this.add(s);const o=new Ke($n,ei,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new E(0,-1,0)),this.add(o);const a=new Ke($n,ei,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new E(0,0,1)),this.add(a);const c=new Ke($n,ei,t,e);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new E(0,0,-1)),this.add(c),this.update=function(l,f){this.parent===null&&this.updateMatrixWorld();const h=l.xr.enabled,d=l.getRenderTarget();l.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,l.setRenderTarget(n,0),l.render(f,i),l.setRenderTarget(n,1),l.render(f,r),l.setRenderTarget(n,2),l.render(f,s),l.setRenderTarget(n,3),l.render(f,o),l.setRenderTarget(n,4),l.render(f,a),n.texture.generateMipmaps=u,l.setRenderTarget(n,5),l.render(f,c),l.setRenderTarget(d),l.xr.enabled=h}}vi.prototype=Object.create(ve.prototype);vi.prototype.constructor=vi;function _n(t,e,n,i,r,s,o,a,c,l){t=t!==void 0?t:[],e=e!==void 0?e:Fo,o=o!==void 0?o:Pn,Ge.call(this,t,e,n,i,r,s,o,a,c,l),this.flipY=!1,this._needsFlipEnvMap=!0}_n.prototype=Object.create(Ge.prototype);_n.prototype.constructor=_n;_n.prototype.isCubeTexture=!0;Object.defineProperty(_n.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});function In(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),It.call(this,t,t,e),e=e||{},this.texture=new _n(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture._needsFlipEnvMap=!1}In.prototype=Object.create(It.prototype);In.prototype.constructor=In;In.prototype.isWebGLCubeRenderTarget=!0;In.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=Pt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
  6. varying vec3 vWorldDirection;
  7. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  8. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  9. }
  10. void main() {
  11. vWorldDirection = transformDirection( position, modelMatrix );
  12. #include <begin_vertex>
  13. #include <project_vertex>
  14. }
  15. `,fragmentShader:`
  16. uniform sampler2D tEquirect;
  17. varying vec3 vWorldDirection;
  18. #include <common>
  19. void main() {
  20. vec3 direction = normalize( vWorldDirection );
  21. vec2 sampleUV = equirectUv( direction );
  22. gl_FragColor = texture2D( tEquirect, sampleUV );
  23. }
  24. `},i=new jc(5,5,5),r=new ut({name:"CubemapFromEquirect",uniforms:gi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:$e,blending:Wi});r.uniforms.tEquirect.value=e;const s=new et(i,r),o=e.minFilter;return e.minFilter===vs&&(e.minFilter=it),new vi(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this};In.prototype.clear=function(t,e,n,i){const r=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,i);t.setRenderTarget(r)};function yi(t,e,n,i,r,s,o,a,c,l,f,h){Ge.call(this,null,s,o,a,c,l,i,r,f,h),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=c!==void 0?c:st,this.minFilter=l!==void 0?l:st,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}yi.prototype=Object.create(Ge.prototype);yi.prototype.constructor=yi;yi.prototype.isDataTexture=!0;const ti=new Mn,Dr=new E;class xs{constructor(e,n,i,r,s,o){this.planes=[e!==void 0?e:new Jt,n!==void 0?n:new Jt,i!==void 0?i:new Jt,r!==void 0?r:new Jt,s!==void 0?s:new Jt,o!==void 0?o:new Jt]}set(e,n,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}clone(){return new this.constructor().copy(this)}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const n=this.planes,i=e.elements,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],l=i[5],f=i[6],h=i[7],d=i[8],u=i[9],m=i[10],v=i[11],y=i[12],g=i[13],p=i[14],L=i[15];return n[0].setComponents(a-r,h-c,v-d,L-y).normalize(),n[1].setComponents(a+r,h+c,v+d,L+y).normalize(),n[2].setComponents(a+s,h+l,v+u,L+g).normalize(),n[3].setComponents(a-s,h-l,v-u,L-g).normalize(),n[4].setComponents(a-o,h-f,v-m,L-p).normalize(),n[5].setComponents(a+o,h+f,v+m,L+p).normalize(),this}intersectsObject(e){const n=e.geometry;return n.boundingSphere===null&&n.computeBoundingSphere(),ti.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ti)}intersectsSprite(e){return ti.center.set(0,0,0),ti.radius=.7071067811865476,ti.applyMatrix4(e.matrixWorld),this.intersectsSphere(ti)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const r=n[i];if(Dr.x=r.normal.x>0?e.max.x:e.min.x,Dr.y=r.normal.y>0?e.max.y:e.min.y,Dr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Dr)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}}function qc(){let t=null,e=!1,n=null,i=null;function r(s,o){n(s,o),i=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function Fu(t,e){const n=e.isWebGL2,i=new WeakMap;function r(l,f){const h=l.array,d=l.usage,u=t.createBuffer();t.bindBuffer(f,u),t.bufferData(f,h,d),l.onUploadCallback();let m=5126;return h instanceof Float32Array?m=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?l.isFloat16BufferAttribute?n?m=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):m=5123:h instanceof Int16Array?m=5122:h instanceof Uint32Array?m=5125:h instanceof Int32Array?m=5124:h instanceof Int8Array?m=5120:h instanceof Uint8Array&&(m=5121),{buffer:u,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function s(l,f,h){const d=f.array,u=f.updateRange;t.bindBuffer(h,l),u.count===-1?t.bufferSubData(h,0,d):(n?t.bufferSubData(h,u.offset*d.BYTES_PER_ELEMENT,d,u.offset,u.count):t.bufferSubData(h,u.offset*d.BYTES_PER_ELEMENT,d.subarray(u.offset,u.offset+u.count)),u.count=-1)}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const f=i.get(l);f&&(t.deleteBuffer(f.buffer),i.delete(l))}function c(l,f){if(l.isGLBufferAttribute){const d=i.get(l);(!d||d.version<l.version)&&i.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);const h=i.get(l);h===void 0?i.set(l,r(l,f)):h.version<l.version&&(s(h.buffer,l,f),h.version=l.version)}return{get:o,remove:a,update:c}}class Bu extends Fe{constructor(e=1,n=1,i=1,r=1){super(),this.type="PlaneBufferGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:r};const s=e/2,o=n/2,a=Math.floor(i),c=Math.floor(r),l=a+1,f=c+1,h=e/a,d=n/c,u=[],m=[],v=[],y=[];for(let g=0;g<f;g++){const p=g*d-o;for(let L=0;L<l;L++){const R=L*h-s;m.push(R,-p,0),v.push(0,0,1),y.push(L/a),y.push(1-g/c)}}for(let g=0;g<c;g++)for(let p=0;p<a;p++){const L=p+l*g,R=p+l*(g+1),T=p+1+l*(g+1),x=p+1+l*g;u.push(L,R,x),u.push(R,T,x)}this.setIndex(u),this.setAttribute("position",new De(m,3)),this.setAttribute("normal",new De(v,3)),this.setAttribute("uv",new De(y,2))}}var Uu=`#ifdef USE_ALPHAMAP
  25. diffuseColor.a *= texture2D( alphaMap, vUv ).g;
  26. #endif`,zu=`#ifdef USE_ALPHAMAP
  27. uniform sampler2D alphaMap;
  28. #endif`,Hu=`#ifdef ALPHATEST
  29. if ( diffuseColor.a < ALPHATEST ) discard;
  30. #endif`,ku=`#ifdef USE_AOMAP
  31. float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
  32. reflectedLight.indirectDiffuse *= ambientOcclusion;
  33. #if defined( USE_ENVMAP ) && defined( STANDARD )
  34. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  35. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
  36. #endif
  37. #endif`,Gu=`#ifdef USE_AOMAP
  38. uniform sampler2D aoMap;
  39. uniform float aoMapIntensity;
  40. #endif`,Vu="vec3 transformed = vec3( position );",Wu=`vec3 objectNormal = vec3( normal );
  41. #ifdef USE_TANGENT
  42. vec3 objectTangent = vec3( tangent.xyz );
  43. #endif`,ju=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
  44. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  45. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  46. vec4 r = roughness * c0 + c1;
  47. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  48. return vec2( -1.04, 1.04 ) * a004 + r.zw;
  49. }
  50. float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  51. #if defined ( PHYSICALLY_CORRECT_LIGHTS )
  52. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  53. if( cutoffDistance > 0.0 ) {
  54. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  55. }
  56. return distanceFalloff;
  57. #else
  58. if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  59. return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
  60. }
  61. return 1.0;
  62. #endif
  63. }
  64. vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
  65. return RECIPROCAL_PI * diffuseColor;
  66. }
  67. vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
  68. float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
  69. return ( 1.0 - specularColor ) * fresnel + specularColor;
  70. }
  71. vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
  72. float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
  73. vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
  74. return Fr * fresnel + F0;
  75. }
  76. float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
  77. float a2 = pow2( alpha );
  78. float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  79. float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  80. return 1.0 / ( gl * gv );
  81. }
  82. float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  83. float a2 = pow2( alpha );
  84. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  85. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  86. return 0.5 / max( gv + gl, EPSILON );
  87. }
  88. float D_GGX( const in float alpha, const in float dotNH ) {
  89. float a2 = pow2( alpha );
  90. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  91. return RECIPROCAL_PI * a2 / pow2( denom );
  92. }
  93. vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
  94. float alpha = pow2( roughness );
  95. vec3 halfDir = normalize( incidentLight.direction + viewDir );
  96. float dotNL = saturate( dot( normal, incidentLight.direction ) );
  97. float dotNV = saturate( dot( normal, viewDir ) );
  98. float dotNH = saturate( dot( normal, halfDir ) );
  99. float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
  100. vec3 F = F_Schlick( specularColor, dotLH );
  101. float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  102. float D = D_GGX( alpha, dotNH );
  103. return F * ( G * D );
  104. }
  105. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  106. const float LUT_SIZE = 64.0;
  107. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  108. const float LUT_BIAS = 0.5 / LUT_SIZE;
  109. float dotNV = saturate( dot( N, V ) );
  110. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  111. uv = uv * LUT_SCALE + LUT_BIAS;
  112. return uv;
  113. }
  114. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  115. float l = length( f );
  116. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  117. }
  118. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  119. float x = dot( v1, v2 );
  120. float y = abs( x );
  121. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  122. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  123. float v = a / b;
  124. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  125. return cross( v1, v2 ) * theta_sintheta;
  126. }
  127. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  128. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  129. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  130. vec3 lightNormal = cross( v1, v2 );
  131. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  132. vec3 T1, T2;
  133. T1 = normalize( V - N * dot( V, N ) );
  134. T2 = - cross( N, T1 );
  135. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  136. vec3 coords[ 4 ];
  137. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  138. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  139. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  140. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  141. coords[ 0 ] = normalize( coords[ 0 ] );
  142. coords[ 1 ] = normalize( coords[ 1 ] );
  143. coords[ 2 ] = normalize( coords[ 2 ] );
  144. coords[ 3 ] = normalize( coords[ 3 ] );
  145. vec3 vectorFormFactor = vec3( 0.0 );
  146. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  147. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  148. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  149. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  150. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  151. return vec3( result );
  152. }
  153. vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
  154. float dotNV = saturate( dot( normal, viewDir ) );
  155. vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
  156. return specularColor * brdf.x + brdf.y;
  157. }
  158. void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  159. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  160. vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
  161. vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
  162. vec3 FssEss = F * brdf.x + brdf.y;
  163. float Ess = brdf.x + brdf.y;
  164. float Ems = 1.0 - Ess;
  165. vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  166. singleScatter += FssEss;
  167. multiScatter += Fms * Ems;
  168. }
  169. float G_BlinnPhong_Implicit( ) {
  170. return 0.25;
  171. }
  172. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  173. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  174. }
  175. vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
  176. vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
  177. float dotNH = saturate( dot( geometry.normal, halfDir ) );
  178. float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
  179. vec3 F = F_Schlick( specularColor, dotLH );
  180. float G = G_BlinnPhong_Implicit( );
  181. float D = D_BlinnPhong( shininess, dotNH );
  182. return F * ( G * D );
  183. }
  184. float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
  185. return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
  186. }
  187. float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
  188. return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
  189. }
  190. #if defined( USE_SHEEN )
  191. float D_Charlie(float roughness, float NoH) {
  192. float invAlpha = 1.0 / roughness;
  193. float cos2h = NoH * NoH;
  194. float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
  195. }
  196. float V_Neubelt(float NoV, float NoL) {
  197. return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
  198. }
  199. vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
  200. vec3 N = geometry.normal;
  201. vec3 V = geometry.viewDir;
  202. vec3 H = normalize( V + L );
  203. float dotNH = saturate( dot( N, H ) );
  204. return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
  205. }
  206. #endif`,qu=`#ifdef USE_BUMPMAP
  207. uniform sampler2D bumpMap;
  208. uniform float bumpScale;
  209. vec2 dHdxy_fwd() {
  210. vec2 dSTdx = dFdx( vUv );
  211. vec2 dSTdy = dFdy( vUv );
  212. float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
  213. float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
  214. float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
  215. return vec2( dBx, dBy );
  216. }
  217. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
  218. vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
  219. vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
  220. vec3 vN = surf_norm;
  221. vec3 R1 = cross( vSigmaY, vN );
  222. vec3 R2 = cross( vN, vSigmaX );
  223. float fDet = dot( vSigmaX, R1 );
  224. fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  225. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  226. return normalize( abs( fDet ) * surf_norm - vGrad );
  227. }
  228. #endif`,Xu=`#if NUM_CLIPPING_PLANES > 0
  229. vec4 plane;
  230. #pragma unroll_loop_start
  231. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  232. plane = clippingPlanes[ i ];
  233. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  234. }
  235. #pragma unroll_loop_end
  236. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  237. bool clipped = true;
  238. #pragma unroll_loop_start
  239. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  240. plane = clippingPlanes[ i ];
  241. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  242. }
  243. #pragma unroll_loop_end
  244. if ( clipped ) discard;
  245. #endif
  246. #endif`,Yu=`#if NUM_CLIPPING_PLANES > 0
  247. varying vec3 vClipPosition;
  248. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  249. #endif`,Zu=`#if NUM_CLIPPING_PLANES > 0
  250. varying vec3 vClipPosition;
  251. #endif`,Ju=`#if NUM_CLIPPING_PLANES > 0
  252. vClipPosition = - mvPosition.xyz;
  253. #endif`,Ku=`#ifdef USE_COLOR
  254. diffuseColor.rgb *= vColor;
  255. #endif`,Qu=`#ifdef USE_COLOR
  256. varying vec3 vColor;
  257. #endif`,$u=`#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  258. varying vec3 vColor;
  259. #endif`,ef=`#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  260. vColor = vec3( 1.0 );
  261. #endif
  262. #ifdef USE_COLOR
  263. vColor.xyz *= color.xyz;
  264. #endif
  265. #ifdef USE_INSTANCING_COLOR
  266. vColor.xyz *= instanceColor.xyz;
  267. #endif`,tf=`#define PI 3.141592653589793
  268. #define PI2 6.283185307179586
  269. #define PI_HALF 1.5707963267948966
  270. #define RECIPROCAL_PI 0.3183098861837907
  271. #define RECIPROCAL_PI2 0.15915494309189535
  272. #define EPSILON 1e-6
  273. #ifndef saturate
  274. #define saturate(a) clamp( a, 0.0, 1.0 )
  275. #endif
  276. #define whiteComplement(a) ( 1.0 - saturate( a ) )
  277. float pow2( const in float x ) { return x*x; }
  278. float pow3( const in float x ) { return x*x*x; }
  279. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  280. float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
  281. highp float rand( const in vec2 uv ) {
  282. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  283. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  284. return fract(sin(sn) * c);
  285. }
  286. #ifdef HIGH_PRECISION
  287. float precisionSafeLength( vec3 v ) { return length( v ); }
  288. #else
  289. float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  290. float precisionSafeLength( vec3 v ) {
  291. float maxComponent = max3( abs( v ) );
  292. return length( v / maxComponent ) * maxComponent;
  293. }
  294. #endif
  295. struct IncidentLight {
  296. vec3 color;
  297. vec3 direction;
  298. bool visible;
  299. };
  300. struct ReflectedLight {
  301. vec3 directDiffuse;
  302. vec3 directSpecular;
  303. vec3 indirectDiffuse;
  304. vec3 indirectSpecular;
  305. };
  306. struct GeometricContext {
  307. vec3 position;
  308. vec3 normal;
  309. vec3 viewDir;
  310. #ifdef CLEARCOAT
  311. vec3 clearcoatNormal;
  312. #endif
  313. };
  314. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  315. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  316. }
  317. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  318. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  319. }
  320. vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  321. float distance = dot( planeNormal, point - pointOnPlane );
  322. return - distance * planeNormal + point;
  323. }
  324. float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  325. return sign( dot( point - pointOnPlane, planeNormal ) );
  326. }
  327. vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
  328. return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
  329. }
  330. mat3 transposeMat3( const in mat3 m ) {
  331. mat3 tmp;
  332. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  333. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  334. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  335. return tmp;
  336. }
  337. float linearToRelativeLuminance( const in vec3 color ) {
  338. vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
  339. return dot( weights, color.rgb );
  340. }
  341. bool isPerspectiveMatrix( mat4 m ) {
  342. return m[ 2 ][ 3 ] == - 1.0;
  343. }
  344. vec2 equirectUv( in vec3 dir ) {
  345. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  346. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  347. return vec2( u, v );
  348. }`,nf=`#ifdef ENVMAP_TYPE_CUBE_UV
  349. #define cubeUV_maxMipLevel 8.0
  350. #define cubeUV_minMipLevel 4.0
  351. #define cubeUV_maxTileSize 256.0
  352. #define cubeUV_minTileSize 16.0
  353. float getFace( vec3 direction ) {
  354. vec3 absDirection = abs( direction );
  355. float face = - 1.0;
  356. if ( absDirection.x > absDirection.z ) {
  357. if ( absDirection.x > absDirection.y )
  358. face = direction.x > 0.0 ? 0.0 : 3.0;
  359. else
  360. face = direction.y > 0.0 ? 1.0 : 4.0;
  361. } else {
  362. if ( absDirection.z > absDirection.y )
  363. face = direction.z > 0.0 ? 2.0 : 5.0;
  364. else
  365. face = direction.y > 0.0 ? 1.0 : 4.0;
  366. }
  367. return face;
  368. }
  369. vec2 getUV( vec3 direction, float face ) {
  370. vec2 uv;
  371. if ( face == 0.0 ) {
  372. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  373. } else if ( face == 1.0 ) {
  374. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  375. } else if ( face == 2.0 ) {
  376. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  377. } else if ( face == 3.0 ) {
  378. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  379. } else if ( face == 4.0 ) {
  380. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  381. } else {
  382. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  383. }
  384. return 0.5 * ( uv + 1.0 );
  385. }
  386. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  387. float face = getFace( direction );
  388. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  389. mipInt = max( mipInt, cubeUV_minMipLevel );
  390. float faceSize = exp2( mipInt );
  391. float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
  392. vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );
  393. vec2 f = fract( uv );
  394. uv += 0.5 - f;
  395. if ( face > 2.0 ) {
  396. uv.y += faceSize;
  397. face -= 3.0;
  398. }
  399. uv.x += face * faceSize;
  400. if ( mipInt < cubeUV_maxMipLevel ) {
  401. uv.y += 2.0 * cubeUV_maxTileSize;
  402. }
  403. uv.y += filterInt * 2.0 * cubeUV_minTileSize;
  404. uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
  405. uv *= texelSize;
  406. vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
  407. uv.x += texelSize;
  408. vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
  409. uv.y += texelSize;
  410. vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
  411. uv.x -= texelSize;
  412. vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
  413. vec3 tm = mix( tl, tr, f.x );
  414. vec3 bm = mix( bl, br, f.x );
  415. return mix( tm, bm, f.y );
  416. }
  417. #define r0 1.0
  418. #define v0 0.339
  419. #define m0 - 2.0
  420. #define r1 0.8
  421. #define v1 0.276
  422. #define m1 - 1.0
  423. #define r4 0.4
  424. #define v4 0.046
  425. #define m4 2.0
  426. #define r5 0.305
  427. #define v5 0.016
  428. #define m5 3.0
  429. #define r6 0.21
  430. #define v6 0.0038
  431. #define m6 4.0
  432. float roughnessToMip( float roughness ) {
  433. float mip = 0.0;
  434. if ( roughness >= r1 ) {
  435. mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
  436. } else if ( roughness >= r4 ) {
  437. mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
  438. } else if ( roughness >= r5 ) {
  439. mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
  440. } else if ( roughness >= r6 ) {
  441. mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
  442. } else {
  443. mip = - 2.0 * log2( 1.16 * roughness ); }
  444. return mip;
  445. }
  446. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  447. float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
  448. float mipF = fract( mip );
  449. float mipInt = floor( mip );
  450. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  451. if ( mipF == 0.0 ) {
  452. return vec4( color0, 1.0 );
  453. } else {
  454. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  455. return vec4( mix( color0, color1, mipF ), 1.0 );
  456. }
  457. }
  458. #endif`,rf=`vec3 transformedNormal = objectNormal;
  459. #ifdef USE_INSTANCING
  460. mat3 m = mat3( instanceMatrix );
  461. transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
  462. transformedNormal = m * transformedNormal;
  463. #endif
  464. transformedNormal = normalMatrix * transformedNormal;
  465. #ifdef FLIP_SIDED
  466. transformedNormal = - transformedNormal;
  467. #endif
  468. #ifdef USE_TANGENT
  469. vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  470. #ifdef FLIP_SIDED
  471. transformedTangent = - transformedTangent;
  472. #endif
  473. #endif`,sf=`#ifdef USE_DISPLACEMENTMAP
  474. uniform sampler2D displacementMap;
  475. uniform float displacementScale;
  476. uniform float displacementBias;
  477. #endif`,of=`#ifdef USE_DISPLACEMENTMAP
  478. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
  479. #endif`,af=`#ifdef USE_EMISSIVEMAP
  480. vec4 emissiveColor = texture2D( emissiveMap, vUv );
  481. emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
  482. totalEmissiveRadiance *= emissiveColor.rgb;
  483. #endif`,cf=`#ifdef USE_EMISSIVEMAP
  484. uniform sampler2D emissiveMap;
  485. #endif`,lf="gl_FragColor = linearToOutputTexel( gl_FragColor );",hf=`
  486. vec4 LinearToLinear( in vec4 value ) {
  487. return value;
  488. }
  489. vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
  490. return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
  491. }
  492. vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
  493. return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
  494. }
  495. vec4 sRGBToLinear( in vec4 value ) {
  496. 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 );
  497. }
  498. vec4 LinearTosRGB( in vec4 value ) {
  499. 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 );
  500. }
  501. vec4 RGBEToLinear( in vec4 value ) {
  502. return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
  503. }
  504. vec4 LinearToRGBE( in vec4 value ) {
  505. float maxComponent = max( max( value.r, value.g ), value.b );
  506. float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
  507. return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
  508. }
  509. vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
  510. return vec4( value.rgb * value.a * maxRange, 1.0 );
  511. }
  512. vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
  513. float maxRGB = max( value.r, max( value.g, value.b ) );
  514. float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
  515. M = ceil( M * 255.0 ) / 255.0;
  516. return vec4( value.rgb / ( M * maxRange ), M );
  517. }
  518. vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
  519. return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
  520. }
  521. vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
  522. float maxRGB = max( value.r, max( value.g, value.b ) );
  523. float D = max( maxRange / maxRGB, 1.0 );
  524. D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
  525. return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
  526. }
  527. const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
  528. vec4 LinearToLogLuv( in vec4 value ) {
  529. vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
  530. Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
  531. vec4 vResult;
  532. vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
  533. float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
  534. vResult.w = fract( Le );
  535. vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
  536. return vResult;
  537. }
  538. const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
  539. vec4 LogLuvToLinear( in vec4 value ) {
  540. float Le = value.z * 255.0 + value.w;
  541. vec3 Xp_Y_XYZp;
  542. Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
  543. Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
  544. Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
  545. vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
  546. return vec4( max( vRGB, 0.0 ), 1.0 );
  547. }`,uf=`#ifdef USE_ENVMAP
  548. #ifdef ENV_WORLDPOS
  549. vec3 cameraToFrag;
  550. if ( isOrthographic ) {
  551. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  552. } else {
  553. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  554. }
  555. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  556. #ifdef ENVMAP_MODE_REFLECTION
  557. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  558. #else
  559. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  560. #endif
  561. #else
  562. vec3 reflectVec = vReflect;
  563. #endif
  564. #ifdef ENVMAP_TYPE_CUBE
  565. vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  566. #elif defined( ENVMAP_TYPE_CUBE_UV )
  567. vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
  568. #else
  569. vec4 envColor = vec4( 0.0 );
  570. #endif
  571. #ifndef ENVMAP_TYPE_CUBE_UV
  572. envColor = envMapTexelToLinear( envColor );
  573. #endif
  574. #ifdef ENVMAP_BLENDING_MULTIPLY
  575. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  576. #elif defined( ENVMAP_BLENDING_MIX )
  577. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  578. #elif defined( ENVMAP_BLENDING_ADD )
  579. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  580. #endif
  581. #endif`,ff=`#ifdef USE_ENVMAP
  582. uniform float envMapIntensity;
  583. uniform float flipEnvMap;
  584. uniform int maxMipLevel;
  585. #ifdef ENVMAP_TYPE_CUBE
  586. uniform samplerCube envMap;
  587. #else
  588. uniform sampler2D envMap;
  589. #endif
  590. #endif`,df=`#ifdef USE_ENVMAP
  591. uniform float reflectivity;
  592. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  593. #define ENV_WORLDPOS
  594. #endif
  595. #ifdef ENV_WORLDPOS
  596. varying vec3 vWorldPosition;
  597. uniform float refractionRatio;
  598. #else
  599. varying vec3 vReflect;
  600. #endif
  601. #endif`,pf=`#ifdef USE_ENVMAP
  602. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
  603. #define ENV_WORLDPOS
  604. #endif
  605. #ifdef ENV_WORLDPOS
  606. varying vec3 vWorldPosition;
  607. #else
  608. varying vec3 vReflect;
  609. uniform float refractionRatio;
  610. #endif
  611. #endif`,mf=`#ifdef USE_ENVMAP
  612. #ifdef ENV_WORLDPOS
  613. vWorldPosition = worldPosition.xyz;
  614. #else
  615. vec3 cameraToVertex;
  616. if ( isOrthographic ) {
  617. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  618. } else {
  619. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  620. }
  621. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  622. #ifdef ENVMAP_MODE_REFLECTION
  623. vReflect = reflect( cameraToVertex, worldNormal );
  624. #else
  625. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  626. #endif
  627. #endif
  628. #endif`,gf=`#ifdef USE_FOG
  629. fogDepth = - mvPosition.z;
  630. #endif`,vf=`#ifdef USE_FOG
  631. varying float fogDepth;
  632. #endif`,yf=`#ifdef USE_FOG
  633. #ifdef FOG_EXP2
  634. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
  635. #else
  636. float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
  637. #endif
  638. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  639. #endif`,xf=`#ifdef USE_FOG
  640. uniform vec3 fogColor;
  641. varying float fogDepth;
  642. #ifdef FOG_EXP2
  643. uniform float fogDensity;
  644. #else
  645. uniform float fogNear;
  646. uniform float fogFar;
  647. #endif
  648. #endif`,_f=`#ifdef USE_GRADIENTMAP
  649. uniform sampler2D gradientMap;
  650. #endif
  651. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  652. float dotNL = dot( normal, lightDirection );
  653. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  654. #ifdef USE_GRADIENTMAP
  655. return texture2D( gradientMap, coord ).rgb;
  656. #else
  657. return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
  658. #endif
  659. }`,bf=`#ifdef USE_LIGHTMAP
  660. vec4 lightMapTexel= texture2D( lightMap, vUv2 );
  661. reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
  662. #endif`,wf=`#ifdef USE_LIGHTMAP
  663. uniform sampler2D lightMap;
  664. uniform float lightMapIntensity;
  665. #endif`,Mf=`vec3 diffuse = vec3( 1.0 );
  666. GeometricContext geometry;
  667. geometry.position = mvPosition.xyz;
  668. geometry.normal = normalize( transformedNormal );
  669. geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
  670. GeometricContext backGeometry;
  671. backGeometry.position = geometry.position;
  672. backGeometry.normal = -geometry.normal;
  673. backGeometry.viewDir = geometry.viewDir;
  674. vLightFront = vec3( 0.0 );
  675. vIndirectFront = vec3( 0.0 );
  676. #ifdef DOUBLE_SIDED
  677. vLightBack = vec3( 0.0 );
  678. vIndirectBack = vec3( 0.0 );
  679. #endif
  680. IncidentLight directLight;
  681. float dotNL;
  682. vec3 directLightColor_Diffuse;
  683. vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
  684. vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
  685. #ifdef DOUBLE_SIDED
  686. vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
  687. vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
  688. #endif
  689. #if NUM_POINT_LIGHTS > 0
  690. #pragma unroll_loop_start
  691. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  692. getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
  693. dotNL = dot( geometry.normal, directLight.direction );
  694. directLightColor_Diffuse = PI * directLight.color;
  695. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  696. #ifdef DOUBLE_SIDED
  697. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  698. #endif
  699. }
  700. #pragma unroll_loop_end
  701. #endif
  702. #if NUM_SPOT_LIGHTS > 0
  703. #pragma unroll_loop_start
  704. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  705. getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
  706. dotNL = dot( geometry.normal, directLight.direction );
  707. directLightColor_Diffuse = PI * directLight.color;
  708. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  709. #ifdef DOUBLE_SIDED
  710. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  711. #endif
  712. }
  713. #pragma unroll_loop_end
  714. #endif
  715. #if NUM_DIR_LIGHTS > 0
  716. #pragma unroll_loop_start
  717. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  718. getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
  719. dotNL = dot( geometry.normal, directLight.direction );
  720. directLightColor_Diffuse = PI * directLight.color;
  721. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  722. #ifdef DOUBLE_SIDED
  723. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  724. #endif
  725. }
  726. #pragma unroll_loop_end
  727. #endif
  728. #if NUM_HEMI_LIGHTS > 0
  729. #pragma unroll_loop_start
  730. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  731. vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
  732. #ifdef DOUBLE_SIDED
  733. vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
  734. #endif
  735. }
  736. #pragma unroll_loop_end
  737. #endif`,Sf=`uniform bool receiveShadow;
  738. uniform vec3 ambientLightColor;
  739. uniform vec3 lightProbe[ 9 ];
  740. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  741. float x = normal.x, y = normal.y, z = normal.z;
  742. vec3 result = shCoefficients[ 0 ] * 0.886227;
  743. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  744. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  745. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  746. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  747. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  748. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  749. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  750. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  751. return result;
  752. }
  753. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
  754. vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
  755. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  756. return irradiance;
  757. }
  758. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  759. vec3 irradiance = ambientLightColor;
  760. #ifndef PHYSICALLY_CORRECT_LIGHTS
  761. irradiance *= PI;
  762. #endif
  763. return irradiance;
  764. }
  765. #if NUM_DIR_LIGHTS > 0
  766. struct DirectionalLight {
  767. vec3 direction;
  768. vec3 color;
  769. };
  770. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  771. void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  772. directLight.color = directionalLight.color;
  773. directLight.direction = directionalLight.direction;
  774. directLight.visible = true;
  775. }
  776. #endif
  777. #if NUM_POINT_LIGHTS > 0
  778. struct PointLight {
  779. vec3 position;
  780. vec3 color;
  781. float distance;
  782. float decay;
  783. };
  784. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  785. void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  786. vec3 lVector = pointLight.position - geometry.position;
  787. directLight.direction = normalize( lVector );
  788. float lightDistance = length( lVector );
  789. directLight.color = pointLight.color;
  790. directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
  791. directLight.visible = ( directLight.color != vec3( 0.0 ) );
  792. }
  793. #endif
  794. #if NUM_SPOT_LIGHTS > 0
  795. struct SpotLight {
  796. vec3 position;
  797. vec3 direction;
  798. vec3 color;
  799. float distance;
  800. float decay;
  801. float coneCos;
  802. float penumbraCos;
  803. };
  804. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  805. void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  806. vec3 lVector = spotLight.position - geometry.position;
  807. directLight.direction = normalize( lVector );
  808. float lightDistance = length( lVector );
  809. float angleCos = dot( directLight.direction, spotLight.direction );
  810. if ( angleCos > spotLight.coneCos ) {
  811. float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  812. directLight.color = spotLight.color;
  813. directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
  814. directLight.visible = true;
  815. } else {
  816. directLight.color = vec3( 0.0 );
  817. directLight.visible = false;
  818. }
  819. }
  820. #endif
  821. #if NUM_RECT_AREA_LIGHTS > 0
  822. struct RectAreaLight {
  823. vec3 color;
  824. vec3 position;
  825. vec3 halfWidth;
  826. vec3 halfHeight;
  827. };
  828. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  829. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  830. #endif
  831. #if NUM_HEMI_LIGHTS > 0
  832. struct HemisphereLight {
  833. vec3 direction;
  834. vec3 skyColor;
  835. vec3 groundColor;
  836. };
  837. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  838. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
  839. float dotNL = dot( geometry.normal, hemiLight.direction );
  840. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  841. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  842. #ifndef PHYSICALLY_CORRECT_LIGHTS
  843. irradiance *= PI;
  844. #endif
  845. return irradiance;
  846. }
  847. #endif`,Ef=`#if defined( USE_ENVMAP )
  848. #ifdef ENVMAP_MODE_REFRACTION
  849. uniform float refractionRatio;
  850. #endif
  851. vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
  852. vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
  853. #ifdef ENVMAP_TYPE_CUBE
  854. vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
  855. #ifdef TEXTURE_LOD_EXT
  856. vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
  857. #else
  858. vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
  859. #endif
  860. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  861. #elif defined( ENVMAP_TYPE_CUBE_UV )
  862. vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
  863. #else
  864. vec4 envMapColor = vec4( 0.0 );
  865. #endif
  866. return PI * envMapColor.rgb * envMapIntensity;
  867. }
  868. float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
  869. float maxMIPLevelScalar = float( maxMIPLevel );
  870. float sigma = PI * roughness * roughness / ( 1.0 + roughness );
  871. float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
  872. return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
  873. }
  874. vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
  875. #ifdef ENVMAP_MODE_REFLECTION
  876. vec3 reflectVec = reflect( -viewDir, normal );
  877. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  878. #else
  879. vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
  880. #endif
  881. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  882. float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
  883. #ifdef ENVMAP_TYPE_CUBE
  884. vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
  885. #ifdef TEXTURE_LOD_EXT
  886. vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
  887. #else
  888. vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
  889. #endif
  890. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  891. #elif defined( ENVMAP_TYPE_CUBE_UV )
  892. vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
  893. #endif
  894. return envMapColor.rgb * envMapIntensity;
  895. }
  896. #endif`,Tf=`ToonMaterial material;
  897. material.diffuseColor = diffuseColor.rgb;`,Af=`varying vec3 vViewPosition;
  898. #ifndef FLAT_SHADED
  899. varying vec3 vNormal;
  900. #endif
  901. struct ToonMaterial {
  902. vec3 diffuseColor;
  903. };
  904. void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  905. vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
  906. #ifndef PHYSICALLY_CORRECT_LIGHTS
  907. irradiance *= PI;
  908. #endif
  909. reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  910. }
  911. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  912. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  913. }
  914. #define RE_Direct RE_Direct_Toon
  915. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
  916. #define Material_LightProbeLOD( material ) (0)`,Lf=`BlinnPhongMaterial material;
  917. material.diffuseColor = diffuseColor.rgb;
  918. material.specularColor = specular;
  919. material.specularShininess = shininess;
  920. material.specularStrength = specularStrength;`,Rf=`varying vec3 vViewPosition;
  921. #ifndef FLAT_SHADED
  922. varying vec3 vNormal;
  923. #endif
  924. struct BlinnPhongMaterial {
  925. vec3 diffuseColor;
  926. vec3 specularColor;
  927. float specularShininess;
  928. float specularStrength;
  929. };
  930. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  931. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  932. vec3 irradiance = dotNL * directLight.color;
  933. #ifndef PHYSICALLY_CORRECT_LIGHTS
  934. irradiance *= PI;
  935. #endif
  936. reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  937. reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
  938. }
  939. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  940. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  941. }
  942. #define RE_Direct RE_Direct_BlinnPhong
  943. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
  944. #define Material_LightProbeLOD( material ) (0)`,Cf=`PhysicalMaterial material;
  945. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  946. vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
  947. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  948. material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
  949. material.specularRoughness = min( material.specularRoughness, 1.0 );
  950. #ifdef REFLECTIVITY
  951. material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
  952. #else
  953. material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
  954. #endif
  955. #ifdef CLEARCOAT
  956. material.clearcoat = clearcoat;
  957. material.clearcoatRoughness = clearcoatRoughness;
  958. #ifdef USE_CLEARCOATMAP
  959. material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
  960. #endif
  961. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  962. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
  963. #endif
  964. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  965. material.clearcoatRoughness += geometryRoughness;
  966. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  967. #endif
  968. #ifdef USE_SHEEN
  969. material.sheenColor = sheen;
  970. #endif`,Pf=`struct PhysicalMaterial {
  971. vec3 diffuseColor;
  972. float specularRoughness;
  973. vec3 specularColor;
  974. #ifdef CLEARCOAT
  975. float clearcoat;
  976. float clearcoatRoughness;
  977. #endif
  978. #ifdef USE_SHEEN
  979. vec3 sheenColor;
  980. #endif
  981. };
  982. #define MAXIMUM_SPECULAR_COEFFICIENT 0.16
  983. #define DEFAULT_SPECULAR_COEFFICIENT 0.04
  984. float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
  985. return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
  986. }
  987. #if NUM_RECT_AREA_LIGHTS > 0
  988. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  989. vec3 normal = geometry.normal;
  990. vec3 viewDir = geometry.viewDir;
  991. vec3 position = geometry.position;
  992. vec3 lightPos = rectAreaLight.position;
  993. vec3 halfWidth = rectAreaLight.halfWidth;
  994. vec3 halfHeight = rectAreaLight.halfHeight;
  995. vec3 lightColor = rectAreaLight.color;
  996. float roughness = material.specularRoughness;
  997. vec3 rectCoords[ 4 ];
  998. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  999. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  1000. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  1001. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  1002. vec4 t1 = texture2D( ltc_1, uv );
  1003. vec4 t2 = texture2D( ltc_2, uv );
  1004. mat3 mInv = mat3(
  1005. vec3( t1.x, 0, t1.y ),
  1006. vec3( 0, 1, 0 ),
  1007. vec3( t1.z, 0, t1.w )
  1008. );
  1009. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  1010. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  1011. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  1012. }
  1013. #endif
  1014. void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1015. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  1016. vec3 irradiance = dotNL * directLight.color;
  1017. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1018. irradiance *= PI;
  1019. #endif
  1020. #ifdef CLEARCOAT
  1021. float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
  1022. vec3 ccIrradiance = ccDotNL * directLight.color;
  1023. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1024. ccIrradiance *= PI;
  1025. #endif
  1026. float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
  1027. reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
  1028. #else
  1029. float clearcoatDHR = 0.0;
  1030. #endif
  1031. #ifdef USE_SHEEN
  1032. reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
  1033. material.specularRoughness,
  1034. directLight.direction,
  1035. geometry,
  1036. material.sheenColor
  1037. );
  1038. #else
  1039. reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
  1040. #endif
  1041. reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  1042. }
  1043. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1044. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  1045. }
  1046. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  1047. #ifdef CLEARCOAT
  1048. float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
  1049. reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
  1050. float ccDotNL = ccDotNV;
  1051. float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
  1052. #else
  1053. float clearcoatDHR = 0.0;
  1054. #endif
  1055. float clearcoatInv = 1.0 - clearcoatDHR;
  1056. vec3 singleScattering = vec3( 0.0 );
  1057. vec3 multiScattering = vec3( 0.0 );
  1058. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  1059. BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
  1060. vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
  1061. reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
  1062. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  1063. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  1064. }
  1065. #define RE_Direct RE_Direct_Physical
  1066. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  1067. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  1068. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  1069. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  1070. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  1071. }`,If=`
  1072. GeometricContext geometry;
  1073. geometry.position = - vViewPosition;
  1074. geometry.normal = normal;
  1075. geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  1076. #ifdef CLEARCOAT
  1077. geometry.clearcoatNormal = clearcoatNormal;
  1078. #endif
  1079. IncidentLight directLight;
  1080. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  1081. PointLight pointLight;
  1082. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  1083. PointLightShadow pointLightShadow;
  1084. #endif
  1085. #pragma unroll_loop_start
  1086. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1087. pointLight = pointLights[ i ];
  1088. getPointDirectLightIrradiance( pointLight, geometry, directLight );
  1089. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  1090. pointLightShadow = pointLightShadows[ i ];
  1091. directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  1092. #endif
  1093. RE_Direct( directLight, geometry, material, reflectedLight );
  1094. }
  1095. #pragma unroll_loop_end
  1096. #endif
  1097. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  1098. SpotLight spotLight;
  1099. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  1100. SpotLightShadow spotLightShadow;
  1101. #endif
  1102. #pragma unroll_loop_start
  1103. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1104. spotLight = spotLights[ i ];
  1105. getSpotDirectLightIrradiance( spotLight, geometry, directLight );
  1106. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1107. spotLightShadow = spotLightShadows[ i ];
  1108. directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
  1109. #endif
  1110. RE_Direct( directLight, geometry, material, reflectedLight );
  1111. }
  1112. #pragma unroll_loop_end
  1113. #endif
  1114. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  1115. DirectionalLight directionalLight;
  1116. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  1117. DirectionalLightShadow directionalLightShadow;
  1118. #endif
  1119. #pragma unroll_loop_start
  1120. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1121. directionalLight = directionalLights[ i ];
  1122. getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
  1123. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  1124. directionalLightShadow = directionalLightShadows[ i ];
  1125. directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1126. #endif
  1127. RE_Direct( directLight, geometry, material, reflectedLight );
  1128. }
  1129. #pragma unroll_loop_end
  1130. #endif
  1131. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  1132. RectAreaLight rectAreaLight;
  1133. #pragma unroll_loop_start
  1134. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  1135. rectAreaLight = rectAreaLights[ i ];
  1136. RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
  1137. }
  1138. #pragma unroll_loop_end
  1139. #endif
  1140. #if defined( RE_IndirectDiffuse )
  1141. vec3 iblIrradiance = vec3( 0.0 );
  1142. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  1143. irradiance += getLightProbeIrradiance( lightProbe, geometry );
  1144. #if ( NUM_HEMI_LIGHTS > 0 )
  1145. #pragma unroll_loop_start
  1146. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  1147. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
  1148. }
  1149. #pragma unroll_loop_end
  1150. #endif
  1151. #endif
  1152. #if defined( RE_IndirectSpecular )
  1153. vec3 radiance = vec3( 0.0 );
  1154. vec3 clearcoatRadiance = vec3( 0.0 );
  1155. #endif`,Nf=`#if defined( RE_IndirectDiffuse )
  1156. #ifdef USE_LIGHTMAP
  1157. vec4 lightMapTexel= texture2D( lightMap, vUv2 );
  1158. vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
  1159. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1160. lightMapIrradiance *= PI;
  1161. #endif
  1162. irradiance += lightMapIrradiance;
  1163. #endif
  1164. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  1165. iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
  1166. #endif
  1167. #endif
  1168. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  1169. radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
  1170. #ifdef CLEARCOAT
  1171. clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
  1172. #endif
  1173. #endif`,Df=`#if defined( RE_IndirectDiffuse )
  1174. RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
  1175. #endif
  1176. #if defined( RE_IndirectSpecular )
  1177. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
  1178. #endif`,Of=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  1179. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  1180. #endif`,Ff=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  1181. uniform float logDepthBufFC;
  1182. varying float vFragDepth;
  1183. varying float vIsPerspective;
  1184. #endif`,Bf=`#ifdef USE_LOGDEPTHBUF
  1185. #ifdef USE_LOGDEPTHBUF_EXT
  1186. varying float vFragDepth;
  1187. varying float vIsPerspective;
  1188. #else
  1189. uniform float logDepthBufFC;
  1190. #endif
  1191. #endif`,Uf=`#ifdef USE_LOGDEPTHBUF
  1192. #ifdef USE_LOGDEPTHBUF_EXT
  1193. vFragDepth = 1.0 + gl_Position.w;
  1194. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  1195. #else
  1196. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  1197. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  1198. gl_Position.z *= gl_Position.w;
  1199. }
  1200. #endif
  1201. #endif`,zf=`#ifdef USE_MAP
  1202. vec4 texelColor = texture2D( map, vUv );
  1203. texelColor = mapTexelToLinear( texelColor );
  1204. diffuseColor *= texelColor;
  1205. #endif`,Hf=`#ifdef USE_MAP
  1206. uniform sampler2D map;
  1207. #endif`,kf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1208. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  1209. #endif
  1210. #ifdef USE_MAP
  1211. vec4 mapTexel = texture2D( map, uv );
  1212. diffuseColor *= mapTexelToLinear( mapTexel );
  1213. #endif
  1214. #ifdef USE_ALPHAMAP
  1215. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  1216. #endif`,Gf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1217. uniform mat3 uvTransform;
  1218. #endif
  1219. #ifdef USE_MAP
  1220. uniform sampler2D map;
  1221. #endif
  1222. #ifdef USE_ALPHAMAP
  1223. uniform sampler2D alphaMap;
  1224. #endif`,Vf=`float metalnessFactor = metalness;
  1225. #ifdef USE_METALNESSMAP
  1226. vec4 texelMetalness = texture2D( metalnessMap, vUv );
  1227. metalnessFactor *= texelMetalness.b;
  1228. #endif`,Wf=`#ifdef USE_METALNESSMAP
  1229. uniform sampler2D metalnessMap;
  1230. #endif`,jf=`#ifdef USE_MORPHNORMALS
  1231. objectNormal *= morphTargetBaseInfluence;
  1232. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  1233. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  1234. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  1235. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  1236. #endif`,qf=`#ifdef USE_MORPHTARGETS
  1237. uniform float morphTargetBaseInfluence;
  1238. #ifndef USE_MORPHNORMALS
  1239. uniform float morphTargetInfluences[ 8 ];
  1240. #else
  1241. uniform float morphTargetInfluences[ 4 ];
  1242. #endif
  1243. #endif`,Xf=`#ifdef USE_MORPHTARGETS
  1244. transformed *= morphTargetBaseInfluence;
  1245. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  1246. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  1247. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  1248. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  1249. #ifndef USE_MORPHNORMALS
  1250. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  1251. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  1252. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  1253. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  1254. #endif
  1255. #endif`,Yf=`#ifdef FLAT_SHADED
  1256. vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
  1257. vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
  1258. vec3 normal = normalize( cross( fdx, fdy ) );
  1259. #else
  1260. vec3 normal = normalize( vNormal );
  1261. #ifdef DOUBLE_SIDED
  1262. normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1263. #endif
  1264. #ifdef USE_TANGENT
  1265. vec3 tangent = normalize( vTangent );
  1266. vec3 bitangent = normalize( vBitangent );
  1267. #ifdef DOUBLE_SIDED
  1268. tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1269. bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1270. #endif
  1271. #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
  1272. mat3 vTBN = mat3( tangent, bitangent, normal );
  1273. #endif
  1274. #endif
  1275. #endif
  1276. vec3 geometryNormal = normal;`,Zf=`#ifdef OBJECTSPACE_NORMALMAP
  1277. normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
  1278. #ifdef FLIP_SIDED
  1279. normal = - normal;
  1280. #endif
  1281. #ifdef DOUBLE_SIDED
  1282. normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1283. #endif
  1284. normal = normalize( normalMatrix * normal );
  1285. #elif defined( TANGENTSPACE_NORMALMAP )
  1286. vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
  1287. mapN.xy *= normalScale;
  1288. #ifdef USE_TANGENT
  1289. normal = normalize( vTBN * mapN );
  1290. #else
  1291. normal = perturbNormal2Arb( -vViewPosition, normal, mapN );
  1292. #endif
  1293. #elif defined( USE_BUMPMAP )
  1294. normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
  1295. #endif`,Jf=`#ifdef USE_NORMALMAP
  1296. uniform sampler2D normalMap;
  1297. uniform vec2 normalScale;
  1298. #endif
  1299. #ifdef OBJECTSPACE_NORMALMAP
  1300. uniform mat3 normalMatrix;
  1301. #endif
  1302. #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
  1303. vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {
  1304. vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
  1305. vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
  1306. vec2 st0 = dFdx( vUv.st );
  1307. vec2 st1 = dFdy( vUv.st );
  1308. float scale = sign( st1.t * st0.s - st0.t * st1.s );
  1309. vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
  1310. vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
  1311. vec3 N = normalize( surf_norm );
  1312. mat3 tsn = mat3( S, T, N );
  1313. mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1314. return normalize( tsn * mapN );
  1315. }
  1316. #endif`,Kf=`#ifdef CLEARCOAT
  1317. vec3 clearcoatNormal = geometryNormal;
  1318. #endif`,Qf=`#ifdef USE_CLEARCOAT_NORMALMAP
  1319. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
  1320. clearcoatMapN.xy *= clearcoatNormalScale;
  1321. #ifdef USE_TANGENT
  1322. clearcoatNormal = normalize( vTBN * clearcoatMapN );
  1323. #else
  1324. clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );
  1325. #endif
  1326. #endif`,$f=`#ifdef USE_CLEARCOATMAP
  1327. uniform sampler2D clearcoatMap;
  1328. #endif
  1329. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  1330. uniform sampler2D clearcoatRoughnessMap;
  1331. #endif
  1332. #ifdef USE_CLEARCOAT_NORMALMAP
  1333. uniform sampler2D clearcoatNormalMap;
  1334. uniform vec2 clearcoatNormalScale;
  1335. #endif`,ed=`vec3 packNormalToRGB( const in vec3 normal ) {
  1336. return normalize( normal ) * 0.5 + 0.5;
  1337. }
  1338. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  1339. return 2.0 * rgb.xyz - 1.0;
  1340. }
  1341. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  1342. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  1343. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  1344. const float ShiftRight8 = 1. / 256.;
  1345. vec4 packDepthToRGBA( const in float v ) {
  1346. vec4 r = vec4( fract( v * PackFactors ), v );
  1347. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  1348. }
  1349. float unpackRGBAToDepth( const in vec4 v ) {
  1350. return dot( v, UnpackFactors );
  1351. }
  1352. vec4 pack2HalfToRGBA( vec2 v ) {
  1353. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
  1354. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
  1355. }
  1356. vec2 unpackRGBATo2Half( vec4 v ) {
  1357. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  1358. }
  1359. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  1360. return ( viewZ + near ) / ( near - far );
  1361. }
  1362. float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
  1363. return linearClipZ * ( near - far ) - near;
  1364. }
  1365. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  1366. return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
  1367. }
  1368. float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
  1369. return ( near * far ) / ( ( far - near ) * invClipZ - far );
  1370. }`,td=`#ifdef PREMULTIPLIED_ALPHA
  1371. gl_FragColor.rgb *= gl_FragColor.a;
  1372. #endif`,nd=`vec4 mvPosition = vec4( transformed, 1.0 );
  1373. #ifdef USE_INSTANCING
  1374. mvPosition = instanceMatrix * mvPosition;
  1375. #endif
  1376. mvPosition = modelViewMatrix * mvPosition;
  1377. gl_Position = projectionMatrix * mvPosition;`,id=`#ifdef DITHERING
  1378. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  1379. #endif`,rd=`#ifdef DITHERING
  1380. vec3 dithering( vec3 color ) {
  1381. float grid_position = rand( gl_FragCoord.xy );
  1382. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  1383. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  1384. return color + dither_shift_RGB;
  1385. }
  1386. #endif`,sd=`float roughnessFactor = roughness;
  1387. #ifdef USE_ROUGHNESSMAP
  1388. vec4 texelRoughness = texture2D( roughnessMap, vUv );
  1389. roughnessFactor *= texelRoughness.g;
  1390. #endif`,od=`#ifdef USE_ROUGHNESSMAP
  1391. uniform sampler2D roughnessMap;
  1392. #endif`,ad=`#ifdef USE_SHADOWMAP
  1393. #if NUM_DIR_LIGHT_SHADOWS > 0
  1394. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  1395. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  1396. struct DirectionalLightShadow {
  1397. float shadowBias;
  1398. float shadowNormalBias;
  1399. float shadowRadius;
  1400. vec2 shadowMapSize;
  1401. };
  1402. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  1403. #endif
  1404. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1405. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  1406. varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
  1407. struct SpotLightShadow {
  1408. float shadowBias;
  1409. float shadowNormalBias;
  1410. float shadowRadius;
  1411. vec2 shadowMapSize;
  1412. };
  1413. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  1414. #endif
  1415. #if NUM_POINT_LIGHT_SHADOWS > 0
  1416. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  1417. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  1418. struct PointLightShadow {
  1419. float shadowBias;
  1420. float shadowNormalBias;
  1421. float shadowRadius;
  1422. vec2 shadowMapSize;
  1423. float shadowCameraNear;
  1424. float shadowCameraFar;
  1425. };
  1426. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  1427. #endif
  1428. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  1429. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  1430. }
  1431. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  1432. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  1433. }
  1434. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  1435. float occlusion = 1.0;
  1436. vec2 distribution = texture2DDistribution( shadow, uv );
  1437. float hard_shadow = step( compare , distribution.x );
  1438. if (hard_shadow != 1.0 ) {
  1439. float distance = compare - distribution.x ;
  1440. float variance = max( 0.00000, distribution.y * distribution.y );
  1441. float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
  1442. }
  1443. return occlusion;
  1444. }
  1445. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1446. float shadow = 1.0;
  1447. shadowCoord.xyz /= shadowCoord.w;
  1448. shadowCoord.z += shadowBias;
  1449. bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
  1450. bool inFrustum = all( inFrustumVec );
  1451. bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
  1452. bool frustumTest = all( frustumTestVec );
  1453. if ( frustumTest ) {
  1454. #if defined( SHADOWMAP_TYPE_PCF )
  1455. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1456. float dx0 = - texelSize.x * shadowRadius;
  1457. float dy0 = - texelSize.y * shadowRadius;
  1458. float dx1 = + texelSize.x * shadowRadius;
  1459. float dy1 = + texelSize.y * shadowRadius;
  1460. float dx2 = dx0 / 2.0;
  1461. float dy2 = dy0 / 2.0;
  1462. float dx3 = dx1 / 2.0;
  1463. float dy3 = dy1 / 2.0;
  1464. shadow = (
  1465. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1466. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1467. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1468. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  1469. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  1470. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  1471. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1472. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  1473. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  1474. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  1475. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1476. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  1477. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  1478. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  1479. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1480. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1481. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1482. ) * ( 1.0 / 17.0 );
  1483. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  1484. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1485. float dx = texelSize.x;
  1486. float dy = texelSize.y;
  1487. vec2 uv = shadowCoord.xy;
  1488. vec2 f = fract( uv * shadowMapSize + 0.5 );
  1489. uv -= f * texelSize;
  1490. shadow = (
  1491. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  1492. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  1493. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  1494. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  1495. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  1496. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  1497. f.x ) +
  1498. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  1499. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  1500. f.x ) +
  1501. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  1502. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  1503. f.y ) +
  1504. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  1505. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  1506. f.y ) +
  1507. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  1508. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  1509. f.x ),
  1510. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  1511. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  1512. f.x ),
  1513. f.y )
  1514. ) * ( 1.0 / 9.0 );
  1515. #elif defined( SHADOWMAP_TYPE_VSM )
  1516. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  1517. #else
  1518. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  1519. #endif
  1520. }
  1521. return shadow;
  1522. }
  1523. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  1524. vec3 absV = abs( v );
  1525. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  1526. absV *= scaleToCube;
  1527. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  1528. vec2 planar = v.xy;
  1529. float almostATexel = 1.5 * texelSizeY;
  1530. float almostOne = 1.0 - almostATexel;
  1531. if ( absV.z >= almostOne ) {
  1532. if ( v.z > 0.0 )
  1533. planar.x = 4.0 - v.x;
  1534. } else if ( absV.x >= almostOne ) {
  1535. float signX = sign( v.x );
  1536. planar.x = v.z * signX + 2.0 * signX;
  1537. } else if ( absV.y >= almostOne ) {
  1538. float signY = sign( v.y );
  1539. planar.x = v.x + 2.0 * signY + 2.0;
  1540. planar.y = v.z * signY - 2.0;
  1541. }
  1542. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  1543. }
  1544. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  1545. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  1546. vec3 lightToPosition = shadowCoord.xyz;
  1547. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  1548. vec3 bd3D = normalize( lightToPosition );
  1549. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  1550. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  1551. return (
  1552. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  1553. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  1554. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  1555. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  1556. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  1557. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  1558. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  1559. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  1560. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  1561. ) * ( 1.0 / 9.0 );
  1562. #else
  1563. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  1564. #endif
  1565. }
  1566. #endif`,cd=`#ifdef USE_SHADOWMAP
  1567. #if NUM_DIR_LIGHT_SHADOWS > 0
  1568. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  1569. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  1570. struct DirectionalLightShadow {
  1571. float shadowBias;
  1572. float shadowNormalBias;
  1573. float shadowRadius;
  1574. vec2 shadowMapSize;
  1575. };
  1576. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  1577. #endif
  1578. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1579. uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
  1580. varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
  1581. struct SpotLightShadow {
  1582. float shadowBias;
  1583. float shadowNormalBias;
  1584. float shadowRadius;
  1585. vec2 shadowMapSize;
  1586. };
  1587. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  1588. #endif
  1589. #if NUM_POINT_LIGHT_SHADOWS > 0
  1590. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  1591. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  1592. struct PointLightShadow {
  1593. float shadowBias;
  1594. float shadowNormalBias;
  1595. float shadowRadius;
  1596. vec2 shadowMapSize;
  1597. float shadowCameraNear;
  1598. float shadowCameraFar;
  1599. };
  1600. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  1601. #endif
  1602. #endif`,ld=`#ifdef USE_SHADOWMAP
  1603. #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
  1604. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  1605. vec4 shadowWorldPosition;
  1606. #endif
  1607. #if NUM_DIR_LIGHT_SHADOWS > 0
  1608. #pragma unroll_loop_start
  1609. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  1610. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  1611. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  1612. }
  1613. #pragma unroll_loop_end
  1614. #endif
  1615. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1616. #pragma unroll_loop_start
  1617. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  1618. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
  1619. vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
  1620. }
  1621. #pragma unroll_loop_end
  1622. #endif
  1623. #if NUM_POINT_LIGHT_SHADOWS > 0
  1624. #pragma unroll_loop_start
  1625. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  1626. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  1627. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  1628. }
  1629. #pragma unroll_loop_end
  1630. #endif
  1631. #endif`,hd=`float getShadowMask() {
  1632. float shadow = 1.0;
  1633. #ifdef USE_SHADOWMAP
  1634. #if NUM_DIR_LIGHT_SHADOWS > 0
  1635. DirectionalLightShadow directionalLight;
  1636. #pragma unroll_loop_start
  1637. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  1638. directionalLight = directionalLightShadows[ i ];
  1639. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1640. }
  1641. #pragma unroll_loop_end
  1642. #endif
  1643. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1644. SpotLightShadow spotLight;
  1645. #pragma unroll_loop_start
  1646. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  1647. spotLight = spotLightShadows[ i ];
  1648. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
  1649. }
  1650. #pragma unroll_loop_end
  1651. #endif
  1652. #if NUM_POINT_LIGHT_SHADOWS > 0
  1653. PointLightShadow pointLight;
  1654. #pragma unroll_loop_start
  1655. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  1656. pointLight = pointLightShadows[ i ];
  1657. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  1658. }
  1659. #pragma unroll_loop_end
  1660. #endif
  1661. #endif
  1662. return shadow;
  1663. }`,ud=`#ifdef USE_SKINNING
  1664. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  1665. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  1666. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  1667. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  1668. #endif`,fd=`#ifdef USE_SKINNING
  1669. uniform mat4 bindMatrix;
  1670. uniform mat4 bindMatrixInverse;
  1671. #ifdef BONE_TEXTURE
  1672. uniform highp sampler2D boneTexture;
  1673. uniform int boneTextureSize;
  1674. mat4 getBoneMatrix( const in float i ) {
  1675. float j = i * 4.0;
  1676. float x = mod( j, float( boneTextureSize ) );
  1677. float y = floor( j / float( boneTextureSize ) );
  1678. float dx = 1.0 / float( boneTextureSize );
  1679. float dy = 1.0 / float( boneTextureSize );
  1680. y = dy * ( y + 0.5 );
  1681. vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
  1682. vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
  1683. vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
  1684. vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
  1685. mat4 bone = mat4( v1, v2, v3, v4 );
  1686. return bone;
  1687. }
  1688. #else
  1689. uniform mat4 boneMatrices[ MAX_BONES ];
  1690. mat4 getBoneMatrix( const in float i ) {
  1691. mat4 bone = boneMatrices[ int(i) ];
  1692. return bone;
  1693. }
  1694. #endif
  1695. #endif`,dd=`#ifdef USE_SKINNING
  1696. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  1697. vec4 skinned = vec4( 0.0 );
  1698. skinned += boneMatX * skinVertex * skinWeight.x;
  1699. skinned += boneMatY * skinVertex * skinWeight.y;
  1700. skinned += boneMatZ * skinVertex * skinWeight.z;
  1701. skinned += boneMatW * skinVertex * skinWeight.w;
  1702. transformed = ( bindMatrixInverse * skinned ).xyz;
  1703. #endif`,pd=`#ifdef USE_SKINNING
  1704. mat4 skinMatrix = mat4( 0.0 );
  1705. skinMatrix += skinWeight.x * boneMatX;
  1706. skinMatrix += skinWeight.y * boneMatY;
  1707. skinMatrix += skinWeight.z * boneMatZ;
  1708. skinMatrix += skinWeight.w * boneMatW;
  1709. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  1710. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  1711. #ifdef USE_TANGENT
  1712. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  1713. #endif
  1714. #endif`,md=`float specularStrength;
  1715. #ifdef USE_SPECULARMAP
  1716. vec4 texelSpecular = texture2D( specularMap, vUv );
  1717. specularStrength = texelSpecular.r;
  1718. #else
  1719. specularStrength = 1.0;
  1720. #endif`,gd=`#ifdef USE_SPECULARMAP
  1721. uniform sampler2D specularMap;
  1722. #endif`,vd=`#if defined( TONE_MAPPING )
  1723. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  1724. #endif`,yd=`#ifndef saturate
  1725. #define saturate(a) clamp( a, 0.0, 1.0 )
  1726. #endif
  1727. uniform float toneMappingExposure;
  1728. vec3 LinearToneMapping( vec3 color ) {
  1729. return toneMappingExposure * color;
  1730. }
  1731. vec3 ReinhardToneMapping( vec3 color ) {
  1732. color *= toneMappingExposure;
  1733. return saturate( color / ( vec3( 1.0 ) + color ) );
  1734. }
  1735. vec3 OptimizedCineonToneMapping( vec3 color ) {
  1736. color *= toneMappingExposure;
  1737. color = max( vec3( 0.0 ), color - 0.004 );
  1738. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  1739. }
  1740. vec3 RRTAndODTFit( vec3 v ) {
  1741. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  1742. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  1743. return a / b;
  1744. }
  1745. vec3 ACESFilmicToneMapping( vec3 color ) {
  1746. const mat3 ACESInputMat = mat3(
  1747. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  1748. vec3( 0.04823, 0.01566, 0.83777 )
  1749. );
  1750. const mat3 ACESOutputMat = mat3(
  1751. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  1752. vec3( -0.07367, -0.00605, 1.07602 )
  1753. );
  1754. color *= toneMappingExposure / 0.6;
  1755. color = ACESInputMat * color;
  1756. color = RRTAndODTFit( color );
  1757. color = ACESOutputMat * color;
  1758. return saturate( color );
  1759. }
  1760. vec3 CustomToneMapping( vec3 color ) { return color; }`,xd=`#ifdef USE_TRANSMISSIONMAP
  1761. totalTransmission *= texture2D( transmissionMap, vUv ).r;
  1762. #endif`,_d=`#ifdef USE_TRANSMISSIONMAP
  1763. uniform sampler2D transmissionMap;
  1764. #endif`,bd=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
  1765. varying vec2 vUv;
  1766. #endif`,wd=`#ifdef USE_UV
  1767. #ifdef UVS_VERTEX_ONLY
  1768. vec2 vUv;
  1769. #else
  1770. varying vec2 vUv;
  1771. #endif
  1772. uniform mat3 uvTransform;
  1773. #endif`,Md=`#ifdef USE_UV
  1774. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  1775. #endif`,Sd=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1776. varying vec2 vUv2;
  1777. #endif`,Ed=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1778. attribute vec2 uv2;
  1779. varying vec2 vUv2;
  1780. uniform mat3 uv2Transform;
  1781. #endif`,Td=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1782. vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
  1783. #endif`,Ad=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
  1784. vec4 worldPosition = vec4( transformed, 1.0 );
  1785. #ifdef USE_INSTANCING
  1786. worldPosition = instanceMatrix * worldPosition;
  1787. #endif
  1788. worldPosition = modelMatrix * worldPosition;
  1789. #endif`,Ld=`uniform sampler2D t2D;
  1790. varying vec2 vUv;
  1791. void main() {
  1792. vec4 texColor = texture2D( t2D, vUv );
  1793. gl_FragColor = mapTexelToLinear( texColor );
  1794. #include <tonemapping_fragment>
  1795. #include <encodings_fragment>
  1796. }`,Rd=`varying vec2 vUv;
  1797. uniform mat3 uvTransform;
  1798. void main() {
  1799. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  1800. gl_Position = vec4( position.xy, 1.0, 1.0 );
  1801. }`,Cd=`#include <envmap_common_pars_fragment>
  1802. uniform float opacity;
  1803. varying vec3 vWorldDirection;
  1804. #include <cube_uv_reflection_fragment>
  1805. void main() {
  1806. vec3 vReflect = vWorldDirection;
  1807. #include <envmap_fragment>
  1808. gl_FragColor = envColor;
  1809. gl_FragColor.a *= opacity;
  1810. #include <tonemapping_fragment>
  1811. #include <encodings_fragment>
  1812. }`,Pd=`varying vec3 vWorldDirection;
  1813. #include <common>
  1814. void main() {
  1815. vWorldDirection = transformDirection( position, modelMatrix );
  1816. #include <begin_vertex>
  1817. #include <project_vertex>
  1818. gl_Position.z = gl_Position.w;
  1819. }`,Id=`#if DEPTH_PACKING == 3200
  1820. uniform float opacity;
  1821. #endif
  1822. #include <common>
  1823. #include <packing>
  1824. #include <uv_pars_fragment>
  1825. #include <map_pars_fragment>
  1826. #include <alphamap_pars_fragment>
  1827. #include <logdepthbuf_pars_fragment>
  1828. #include <clipping_planes_pars_fragment>
  1829. varying vec2 vHighPrecisionZW;
  1830. void main() {
  1831. #include <clipping_planes_fragment>
  1832. vec4 diffuseColor = vec4( 1.0 );
  1833. #if DEPTH_PACKING == 3200
  1834. diffuseColor.a = opacity;
  1835. #endif
  1836. #include <map_fragment>
  1837. #include <alphamap_fragment>
  1838. #include <alphatest_fragment>
  1839. #include <logdepthbuf_fragment>
  1840. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  1841. #if DEPTH_PACKING == 3200
  1842. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  1843. #elif DEPTH_PACKING == 3201
  1844. gl_FragColor = packDepthToRGBA( fragCoordZ );
  1845. #endif
  1846. }`,Nd=`#include <common>
  1847. #include <uv_pars_vertex>
  1848. #include <displacementmap_pars_vertex>
  1849. #include <morphtarget_pars_vertex>
  1850. #include <skinning_pars_vertex>
  1851. #include <logdepthbuf_pars_vertex>
  1852. #include <clipping_planes_pars_vertex>
  1853. varying vec2 vHighPrecisionZW;
  1854. void main() {
  1855. #include <uv_vertex>
  1856. #include <skinbase_vertex>
  1857. #ifdef USE_DISPLACEMENTMAP
  1858. #include <beginnormal_vertex>
  1859. #include <morphnormal_vertex>
  1860. #include <skinnormal_vertex>
  1861. #endif
  1862. #include <begin_vertex>
  1863. #include <morphtarget_vertex>
  1864. #include <skinning_vertex>
  1865. #include <displacementmap_vertex>
  1866. #include <project_vertex>
  1867. #include <logdepthbuf_vertex>
  1868. #include <clipping_planes_vertex>
  1869. vHighPrecisionZW = gl_Position.zw;
  1870. }`,Dd=`#define DISTANCE
  1871. uniform vec3 referencePosition;
  1872. uniform float nearDistance;
  1873. uniform float farDistance;
  1874. varying vec3 vWorldPosition;
  1875. #include <common>
  1876. #include <packing>
  1877. #include <uv_pars_fragment>
  1878. #include <map_pars_fragment>
  1879. #include <alphamap_pars_fragment>
  1880. #include <clipping_planes_pars_fragment>
  1881. void main () {
  1882. #include <clipping_planes_fragment>
  1883. vec4 diffuseColor = vec4( 1.0 );
  1884. #include <map_fragment>
  1885. #include <alphamap_fragment>
  1886. #include <alphatest_fragment>
  1887. float dist = length( vWorldPosition - referencePosition );
  1888. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  1889. dist = saturate( dist );
  1890. gl_FragColor = packDepthToRGBA( dist );
  1891. }`,Od=`#define DISTANCE
  1892. varying vec3 vWorldPosition;
  1893. #include <common>
  1894. #include <uv_pars_vertex>
  1895. #include <displacementmap_pars_vertex>
  1896. #include <morphtarget_pars_vertex>
  1897. #include <skinning_pars_vertex>
  1898. #include <clipping_planes_pars_vertex>
  1899. void main() {
  1900. #include <uv_vertex>
  1901. #include <skinbase_vertex>
  1902. #ifdef USE_DISPLACEMENTMAP
  1903. #include <beginnormal_vertex>
  1904. #include <morphnormal_vertex>
  1905. #include <skinnormal_vertex>
  1906. #endif
  1907. #include <begin_vertex>
  1908. #include <morphtarget_vertex>
  1909. #include <skinning_vertex>
  1910. #include <displacementmap_vertex>
  1911. #include <project_vertex>
  1912. #include <worldpos_vertex>
  1913. #include <clipping_planes_vertex>
  1914. vWorldPosition = worldPosition.xyz;
  1915. }`,Fd=`uniform sampler2D tEquirect;
  1916. varying vec3 vWorldDirection;
  1917. #include <common>
  1918. void main() {
  1919. vec3 direction = normalize( vWorldDirection );
  1920. vec2 sampleUV = equirectUv( direction );
  1921. vec4 texColor = texture2D( tEquirect, sampleUV );
  1922. gl_FragColor = mapTexelToLinear( texColor );
  1923. #include <tonemapping_fragment>
  1924. #include <encodings_fragment>
  1925. }`,Bd=`varying vec3 vWorldDirection;
  1926. #include <common>
  1927. void main() {
  1928. vWorldDirection = transformDirection( position, modelMatrix );
  1929. #include <begin_vertex>
  1930. #include <project_vertex>
  1931. }`,Ud=`uniform vec3 diffuse;
  1932. uniform float opacity;
  1933. uniform float dashSize;
  1934. uniform float totalSize;
  1935. varying float vLineDistance;
  1936. #include <common>
  1937. #include <color_pars_fragment>
  1938. #include <fog_pars_fragment>
  1939. #include <logdepthbuf_pars_fragment>
  1940. #include <clipping_planes_pars_fragment>
  1941. void main() {
  1942. #include <clipping_planes_fragment>
  1943. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  1944. discard;
  1945. }
  1946. vec3 outgoingLight = vec3( 0.0 );
  1947. vec4 diffuseColor = vec4( diffuse, opacity );
  1948. #include <logdepthbuf_fragment>
  1949. #include <color_fragment>
  1950. outgoingLight = diffuseColor.rgb;
  1951. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1952. #include <tonemapping_fragment>
  1953. #include <encodings_fragment>
  1954. #include <fog_fragment>
  1955. #include <premultiplied_alpha_fragment>
  1956. }`,zd=`uniform float scale;
  1957. attribute float lineDistance;
  1958. varying float vLineDistance;
  1959. #include <common>
  1960. #include <color_pars_vertex>
  1961. #include <fog_pars_vertex>
  1962. #include <morphtarget_pars_vertex>
  1963. #include <logdepthbuf_pars_vertex>
  1964. #include <clipping_planes_pars_vertex>
  1965. void main() {
  1966. vLineDistance = scale * lineDistance;
  1967. #include <color_vertex>
  1968. #include <begin_vertex>
  1969. #include <morphtarget_vertex>
  1970. #include <project_vertex>
  1971. #include <logdepthbuf_vertex>
  1972. #include <clipping_planes_vertex>
  1973. #include <fog_vertex>
  1974. }`,Hd=`uniform vec3 diffuse;
  1975. uniform float opacity;
  1976. #ifndef FLAT_SHADED
  1977. varying vec3 vNormal;
  1978. #endif
  1979. #include <common>
  1980. #include <dithering_pars_fragment>
  1981. #include <color_pars_fragment>
  1982. #include <uv_pars_fragment>
  1983. #include <uv2_pars_fragment>
  1984. #include <map_pars_fragment>
  1985. #include <alphamap_pars_fragment>
  1986. #include <aomap_pars_fragment>
  1987. #include <lightmap_pars_fragment>
  1988. #include <envmap_common_pars_fragment>
  1989. #include <envmap_pars_fragment>
  1990. #include <cube_uv_reflection_fragment>
  1991. #include <fog_pars_fragment>
  1992. #include <specularmap_pars_fragment>
  1993. #include <logdepthbuf_pars_fragment>
  1994. #include <clipping_planes_pars_fragment>
  1995. void main() {
  1996. #include <clipping_planes_fragment>
  1997. vec4 diffuseColor = vec4( diffuse, opacity );
  1998. #include <logdepthbuf_fragment>
  1999. #include <map_fragment>
  2000. #include <color_fragment>
  2001. #include <alphamap_fragment>
  2002. #include <alphatest_fragment>
  2003. #include <specularmap_fragment>
  2004. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2005. #ifdef USE_LIGHTMAP
  2006. vec4 lightMapTexel= texture2D( lightMap, vUv2 );
  2007. reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
  2008. #else
  2009. reflectedLight.indirectDiffuse += vec3( 1.0 );
  2010. #endif
  2011. #include <aomap_fragment>
  2012. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  2013. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  2014. #include <envmap_fragment>
  2015. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2016. #include <tonemapping_fragment>
  2017. #include <encodings_fragment>
  2018. #include <fog_fragment>
  2019. #include <premultiplied_alpha_fragment>
  2020. #include <dithering_fragment>
  2021. }`,kd=`#include <common>
  2022. #include <uv_pars_vertex>
  2023. #include <uv2_pars_vertex>
  2024. #include <envmap_pars_vertex>
  2025. #include <color_pars_vertex>
  2026. #include <fog_pars_vertex>
  2027. #include <morphtarget_pars_vertex>
  2028. #include <skinning_pars_vertex>
  2029. #include <logdepthbuf_pars_vertex>
  2030. #include <clipping_planes_pars_vertex>
  2031. void main() {
  2032. #include <uv_vertex>
  2033. #include <uv2_vertex>
  2034. #include <color_vertex>
  2035. #include <skinbase_vertex>
  2036. #ifdef USE_ENVMAP
  2037. #include <beginnormal_vertex>
  2038. #include <morphnormal_vertex>
  2039. #include <skinnormal_vertex>
  2040. #include <defaultnormal_vertex>
  2041. #endif
  2042. #include <begin_vertex>
  2043. #include <morphtarget_vertex>
  2044. #include <skinning_vertex>
  2045. #include <project_vertex>
  2046. #include <logdepthbuf_vertex>
  2047. #include <worldpos_vertex>
  2048. #include <clipping_planes_vertex>
  2049. #include <envmap_vertex>
  2050. #include <fog_vertex>
  2051. }`,Gd=`uniform vec3 diffuse;
  2052. uniform vec3 emissive;
  2053. uniform float opacity;
  2054. varying vec3 vLightFront;
  2055. varying vec3 vIndirectFront;
  2056. #ifdef DOUBLE_SIDED
  2057. varying vec3 vLightBack;
  2058. varying vec3 vIndirectBack;
  2059. #endif
  2060. #include <common>
  2061. #include <packing>
  2062. #include <dithering_pars_fragment>
  2063. #include <color_pars_fragment>
  2064. #include <uv_pars_fragment>
  2065. #include <uv2_pars_fragment>
  2066. #include <map_pars_fragment>
  2067. #include <alphamap_pars_fragment>
  2068. #include <aomap_pars_fragment>
  2069. #include <lightmap_pars_fragment>
  2070. #include <emissivemap_pars_fragment>
  2071. #include <envmap_common_pars_fragment>
  2072. #include <envmap_pars_fragment>
  2073. #include <cube_uv_reflection_fragment>
  2074. #include <bsdfs>
  2075. #include <lights_pars_begin>
  2076. #include <fog_pars_fragment>
  2077. #include <shadowmap_pars_fragment>
  2078. #include <shadowmask_pars_fragment>
  2079. #include <specularmap_pars_fragment>
  2080. #include <logdepthbuf_pars_fragment>
  2081. #include <clipping_planes_pars_fragment>
  2082. void main() {
  2083. #include <clipping_planes_fragment>
  2084. vec4 diffuseColor = vec4( diffuse, opacity );
  2085. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2086. vec3 totalEmissiveRadiance = emissive;
  2087. #include <logdepthbuf_fragment>
  2088. #include <map_fragment>
  2089. #include <color_fragment>
  2090. #include <alphamap_fragment>
  2091. #include <alphatest_fragment>
  2092. #include <specularmap_fragment>
  2093. #include <emissivemap_fragment>
  2094. #ifdef DOUBLE_SIDED
  2095. reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
  2096. #else
  2097. reflectedLight.indirectDiffuse += vIndirectFront;
  2098. #endif
  2099. #include <lightmap_fragment>
  2100. reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
  2101. #ifdef DOUBLE_SIDED
  2102. reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
  2103. #else
  2104. reflectedLight.directDiffuse = vLightFront;
  2105. #endif
  2106. reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
  2107. #include <aomap_fragment>
  2108. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  2109. #include <envmap_fragment>
  2110. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2111. #include <tonemapping_fragment>
  2112. #include <encodings_fragment>
  2113. #include <fog_fragment>
  2114. #include <premultiplied_alpha_fragment>
  2115. #include <dithering_fragment>
  2116. }`,Vd=`#define LAMBERT
  2117. varying vec3 vLightFront;
  2118. varying vec3 vIndirectFront;
  2119. #ifdef DOUBLE_SIDED
  2120. varying vec3 vLightBack;
  2121. varying vec3 vIndirectBack;
  2122. #endif
  2123. #include <common>
  2124. #include <uv_pars_vertex>
  2125. #include <uv2_pars_vertex>
  2126. #include <envmap_pars_vertex>
  2127. #include <bsdfs>
  2128. #include <lights_pars_begin>
  2129. #include <color_pars_vertex>
  2130. #include <fog_pars_vertex>
  2131. #include <morphtarget_pars_vertex>
  2132. #include <skinning_pars_vertex>
  2133. #include <shadowmap_pars_vertex>
  2134. #include <logdepthbuf_pars_vertex>
  2135. #include <clipping_planes_pars_vertex>
  2136. void main() {
  2137. #include <uv_vertex>
  2138. #include <uv2_vertex>
  2139. #include <color_vertex>
  2140. #include <beginnormal_vertex>
  2141. #include <morphnormal_vertex>
  2142. #include <skinbase_vertex>
  2143. #include <skinnormal_vertex>
  2144. #include <defaultnormal_vertex>
  2145. #include <begin_vertex>
  2146. #include <morphtarget_vertex>
  2147. #include <skinning_vertex>
  2148. #include <project_vertex>
  2149. #include <logdepthbuf_vertex>
  2150. #include <clipping_planes_vertex>
  2151. #include <worldpos_vertex>
  2152. #include <envmap_vertex>
  2153. #include <lights_lambert_vertex>
  2154. #include <shadowmap_vertex>
  2155. #include <fog_vertex>
  2156. }`,Wd=`#define MATCAP
  2157. uniform vec3 diffuse;
  2158. uniform float opacity;
  2159. uniform sampler2D matcap;
  2160. varying vec3 vViewPosition;
  2161. #ifndef FLAT_SHADED
  2162. varying vec3 vNormal;
  2163. #endif
  2164. #include <common>
  2165. #include <dithering_pars_fragment>
  2166. #include <color_pars_fragment>
  2167. #include <uv_pars_fragment>
  2168. #include <map_pars_fragment>
  2169. #include <alphamap_pars_fragment>
  2170. #include <fog_pars_fragment>
  2171. #include <bumpmap_pars_fragment>
  2172. #include <normalmap_pars_fragment>
  2173. #include <logdepthbuf_pars_fragment>
  2174. #include <clipping_planes_pars_fragment>
  2175. void main() {
  2176. #include <clipping_planes_fragment>
  2177. vec4 diffuseColor = vec4( diffuse, opacity );
  2178. #include <logdepthbuf_fragment>
  2179. #include <map_fragment>
  2180. #include <color_fragment>
  2181. #include <alphamap_fragment>
  2182. #include <alphatest_fragment>
  2183. #include <normal_fragment_begin>
  2184. #include <normal_fragment_maps>
  2185. vec3 viewDir = normalize( vViewPosition );
  2186. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  2187. vec3 y = cross( viewDir, x );
  2188. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  2189. #ifdef USE_MATCAP
  2190. vec4 matcapColor = texture2D( matcap, uv );
  2191. matcapColor = matcapTexelToLinear( matcapColor );
  2192. #else
  2193. vec4 matcapColor = vec4( 1.0 );
  2194. #endif
  2195. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  2196. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2197. #include <tonemapping_fragment>
  2198. #include <encodings_fragment>
  2199. #include <fog_fragment>
  2200. #include <premultiplied_alpha_fragment>
  2201. #include <dithering_fragment>
  2202. }`,jd=`#define MATCAP
  2203. varying vec3 vViewPosition;
  2204. #ifndef FLAT_SHADED
  2205. varying vec3 vNormal;
  2206. #endif
  2207. #include <common>
  2208. #include <uv_pars_vertex>
  2209. #include <color_pars_vertex>
  2210. #include <displacementmap_pars_vertex>
  2211. #include <fog_pars_vertex>
  2212. #include <morphtarget_pars_vertex>
  2213. #include <skinning_pars_vertex>
  2214. #include <logdepthbuf_pars_vertex>
  2215. #include <clipping_planes_pars_vertex>
  2216. void main() {
  2217. #include <uv_vertex>
  2218. #include <color_vertex>
  2219. #include <beginnormal_vertex>
  2220. #include <morphnormal_vertex>
  2221. #include <skinbase_vertex>
  2222. #include <skinnormal_vertex>
  2223. #include <defaultnormal_vertex>
  2224. #ifndef FLAT_SHADED
  2225. vNormal = normalize( transformedNormal );
  2226. #endif
  2227. #include <begin_vertex>
  2228. #include <morphtarget_vertex>
  2229. #include <skinning_vertex>
  2230. #include <displacementmap_vertex>
  2231. #include <project_vertex>
  2232. #include <logdepthbuf_vertex>
  2233. #include <clipping_planes_vertex>
  2234. #include <fog_vertex>
  2235. vViewPosition = - mvPosition.xyz;
  2236. }`,qd=`#define TOON
  2237. uniform vec3 diffuse;
  2238. uniform vec3 emissive;
  2239. uniform float opacity;
  2240. #include <common>
  2241. #include <packing>
  2242. #include <dithering_pars_fragment>
  2243. #include <color_pars_fragment>
  2244. #include <uv_pars_fragment>
  2245. #include <uv2_pars_fragment>
  2246. #include <map_pars_fragment>
  2247. #include <alphamap_pars_fragment>
  2248. #include <aomap_pars_fragment>
  2249. #include <lightmap_pars_fragment>
  2250. #include <emissivemap_pars_fragment>
  2251. #include <gradientmap_pars_fragment>
  2252. #include <fog_pars_fragment>
  2253. #include <bsdfs>
  2254. #include <lights_pars_begin>
  2255. #include <lights_toon_pars_fragment>
  2256. #include <shadowmap_pars_fragment>
  2257. #include <bumpmap_pars_fragment>
  2258. #include <normalmap_pars_fragment>
  2259. #include <logdepthbuf_pars_fragment>
  2260. #include <clipping_planes_pars_fragment>
  2261. void main() {
  2262. #include <clipping_planes_fragment>
  2263. vec4 diffuseColor = vec4( diffuse, opacity );
  2264. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2265. vec3 totalEmissiveRadiance = emissive;
  2266. #include <logdepthbuf_fragment>
  2267. #include <map_fragment>
  2268. #include <color_fragment>
  2269. #include <alphamap_fragment>
  2270. #include <alphatest_fragment>
  2271. #include <normal_fragment_begin>
  2272. #include <normal_fragment_maps>
  2273. #include <emissivemap_fragment>
  2274. #include <lights_toon_fragment>
  2275. #include <lights_fragment_begin>
  2276. #include <lights_fragment_maps>
  2277. #include <lights_fragment_end>
  2278. #include <aomap_fragment>
  2279. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  2280. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2281. #include <tonemapping_fragment>
  2282. #include <encodings_fragment>
  2283. #include <fog_fragment>
  2284. #include <premultiplied_alpha_fragment>
  2285. #include <dithering_fragment>
  2286. }`,Xd=`#define TOON
  2287. varying vec3 vViewPosition;
  2288. #ifndef FLAT_SHADED
  2289. varying vec3 vNormal;
  2290. #endif
  2291. #include <common>
  2292. #include <uv_pars_vertex>
  2293. #include <uv2_pars_vertex>
  2294. #include <displacementmap_pars_vertex>
  2295. #include <color_pars_vertex>
  2296. #include <fog_pars_vertex>
  2297. #include <morphtarget_pars_vertex>
  2298. #include <skinning_pars_vertex>
  2299. #include <shadowmap_pars_vertex>
  2300. #include <logdepthbuf_pars_vertex>
  2301. #include <clipping_planes_pars_vertex>
  2302. void main() {
  2303. #include <uv_vertex>
  2304. #include <uv2_vertex>
  2305. #include <color_vertex>
  2306. #include <beginnormal_vertex>
  2307. #include <morphnormal_vertex>
  2308. #include <skinbase_vertex>
  2309. #include <skinnormal_vertex>
  2310. #include <defaultnormal_vertex>
  2311. #ifndef FLAT_SHADED
  2312. vNormal = normalize( transformedNormal );
  2313. #endif
  2314. #include <begin_vertex>
  2315. #include <morphtarget_vertex>
  2316. #include <skinning_vertex>
  2317. #include <displacementmap_vertex>
  2318. #include <project_vertex>
  2319. #include <logdepthbuf_vertex>
  2320. #include <clipping_planes_vertex>
  2321. vViewPosition = - mvPosition.xyz;
  2322. #include <worldpos_vertex>
  2323. #include <shadowmap_vertex>
  2324. #include <fog_vertex>
  2325. }`,Yd=`#define PHONG
  2326. uniform vec3 diffuse;
  2327. uniform vec3 emissive;
  2328. uniform vec3 specular;
  2329. uniform float shininess;
  2330. uniform float opacity;
  2331. #include <common>
  2332. #include <packing>
  2333. #include <dithering_pars_fragment>
  2334. #include <color_pars_fragment>
  2335. #include <uv_pars_fragment>
  2336. #include <uv2_pars_fragment>
  2337. #include <map_pars_fragment>
  2338. #include <alphamap_pars_fragment>
  2339. #include <aomap_pars_fragment>
  2340. #include <lightmap_pars_fragment>
  2341. #include <emissivemap_pars_fragment>
  2342. #include <envmap_common_pars_fragment>
  2343. #include <envmap_pars_fragment>
  2344. #include <cube_uv_reflection_fragment>
  2345. #include <fog_pars_fragment>
  2346. #include <bsdfs>
  2347. #include <lights_pars_begin>
  2348. #include <lights_phong_pars_fragment>
  2349. #include <shadowmap_pars_fragment>
  2350. #include <bumpmap_pars_fragment>
  2351. #include <normalmap_pars_fragment>
  2352. #include <specularmap_pars_fragment>
  2353. #include <logdepthbuf_pars_fragment>
  2354. #include <clipping_planes_pars_fragment>
  2355. void main() {
  2356. #include <clipping_planes_fragment>
  2357. vec4 diffuseColor = vec4( diffuse, opacity );
  2358. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2359. vec3 totalEmissiveRadiance = emissive;
  2360. #include <logdepthbuf_fragment>
  2361. #include <map_fragment>
  2362. #include <color_fragment>
  2363. #include <alphamap_fragment>
  2364. #include <alphatest_fragment>
  2365. #include <specularmap_fragment>
  2366. #include <normal_fragment_begin>
  2367. #include <normal_fragment_maps>
  2368. #include <emissivemap_fragment>
  2369. #include <lights_phong_fragment>
  2370. #include <lights_fragment_begin>
  2371. #include <lights_fragment_maps>
  2372. #include <lights_fragment_end>
  2373. #include <aomap_fragment>
  2374. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  2375. #include <envmap_fragment>
  2376. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2377. #include <tonemapping_fragment>
  2378. #include <encodings_fragment>
  2379. #include <fog_fragment>
  2380. #include <premultiplied_alpha_fragment>
  2381. #include <dithering_fragment>
  2382. }`,Zd=`#define PHONG
  2383. varying vec3 vViewPosition;
  2384. #ifndef FLAT_SHADED
  2385. varying vec3 vNormal;
  2386. #endif
  2387. #include <common>
  2388. #include <uv_pars_vertex>
  2389. #include <uv2_pars_vertex>
  2390. #include <displacementmap_pars_vertex>
  2391. #include <envmap_pars_vertex>
  2392. #include <color_pars_vertex>
  2393. #include <fog_pars_vertex>
  2394. #include <morphtarget_pars_vertex>
  2395. #include <skinning_pars_vertex>
  2396. #include <shadowmap_pars_vertex>
  2397. #include <logdepthbuf_pars_vertex>
  2398. #include <clipping_planes_pars_vertex>
  2399. void main() {
  2400. #include <uv_vertex>
  2401. #include <uv2_vertex>
  2402. #include <color_vertex>
  2403. #include <beginnormal_vertex>
  2404. #include <morphnormal_vertex>
  2405. #include <skinbase_vertex>
  2406. #include <skinnormal_vertex>
  2407. #include <defaultnormal_vertex>
  2408. #ifndef FLAT_SHADED
  2409. vNormal = normalize( transformedNormal );
  2410. #endif
  2411. #include <begin_vertex>
  2412. #include <morphtarget_vertex>
  2413. #include <skinning_vertex>
  2414. #include <displacementmap_vertex>
  2415. #include <project_vertex>
  2416. #include <logdepthbuf_vertex>
  2417. #include <clipping_planes_vertex>
  2418. vViewPosition = - mvPosition.xyz;
  2419. #include <worldpos_vertex>
  2420. #include <envmap_vertex>
  2421. #include <shadowmap_vertex>
  2422. #include <fog_vertex>
  2423. }`,Jd=`#define STANDARD
  2424. #ifdef PHYSICAL
  2425. #define REFLECTIVITY
  2426. #define CLEARCOAT
  2427. #define TRANSMISSION
  2428. #endif
  2429. uniform vec3 diffuse;
  2430. uniform vec3 emissive;
  2431. uniform float roughness;
  2432. uniform float metalness;
  2433. uniform float opacity;
  2434. #ifdef TRANSMISSION
  2435. uniform float transmission;
  2436. #endif
  2437. #ifdef REFLECTIVITY
  2438. uniform float reflectivity;
  2439. #endif
  2440. #ifdef CLEARCOAT
  2441. uniform float clearcoat;
  2442. uniform float clearcoatRoughness;
  2443. #endif
  2444. #ifdef USE_SHEEN
  2445. uniform vec3 sheen;
  2446. #endif
  2447. varying vec3 vViewPosition;
  2448. #ifndef FLAT_SHADED
  2449. varying vec3 vNormal;
  2450. #ifdef USE_TANGENT
  2451. varying vec3 vTangent;
  2452. varying vec3 vBitangent;
  2453. #endif
  2454. #endif
  2455. #include <common>
  2456. #include <packing>
  2457. #include <dithering_pars_fragment>
  2458. #include <color_pars_fragment>
  2459. #include <uv_pars_fragment>
  2460. #include <uv2_pars_fragment>
  2461. #include <map_pars_fragment>
  2462. #include <alphamap_pars_fragment>
  2463. #include <aomap_pars_fragment>
  2464. #include <lightmap_pars_fragment>
  2465. #include <emissivemap_pars_fragment>
  2466. #include <transmissionmap_pars_fragment>
  2467. #include <bsdfs>
  2468. #include <cube_uv_reflection_fragment>
  2469. #include <envmap_common_pars_fragment>
  2470. #include <envmap_physical_pars_fragment>
  2471. #include <fog_pars_fragment>
  2472. #include <lights_pars_begin>
  2473. #include <lights_physical_pars_fragment>
  2474. #include <shadowmap_pars_fragment>
  2475. #include <bumpmap_pars_fragment>
  2476. #include <normalmap_pars_fragment>
  2477. #include <clearcoat_pars_fragment>
  2478. #include <roughnessmap_pars_fragment>
  2479. #include <metalnessmap_pars_fragment>
  2480. #include <logdepthbuf_pars_fragment>
  2481. #include <clipping_planes_pars_fragment>
  2482. void main() {
  2483. #include <clipping_planes_fragment>
  2484. vec4 diffuseColor = vec4( diffuse, opacity );
  2485. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2486. vec3 totalEmissiveRadiance = emissive;
  2487. #ifdef TRANSMISSION
  2488. float totalTransmission = transmission;
  2489. #endif
  2490. #include <logdepthbuf_fragment>
  2491. #include <map_fragment>
  2492. #include <color_fragment>
  2493. #include <alphamap_fragment>
  2494. #include <alphatest_fragment>
  2495. #include <roughnessmap_fragment>
  2496. #include <metalnessmap_fragment>
  2497. #include <normal_fragment_begin>
  2498. #include <normal_fragment_maps>
  2499. #include <clearcoat_normal_fragment_begin>
  2500. #include <clearcoat_normal_fragment_maps>
  2501. #include <emissivemap_fragment>
  2502. #include <transmissionmap_fragment>
  2503. #include <lights_physical_fragment>
  2504. #include <lights_fragment_begin>
  2505. #include <lights_fragment_maps>
  2506. #include <lights_fragment_end>
  2507. #include <aomap_fragment>
  2508. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  2509. #ifdef TRANSMISSION
  2510. diffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );
  2511. #endif
  2512. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2513. #include <tonemapping_fragment>
  2514. #include <encodings_fragment>
  2515. #include <fog_fragment>
  2516. #include <premultiplied_alpha_fragment>
  2517. #include <dithering_fragment>
  2518. }`,Kd=`#define STANDARD
  2519. varying vec3 vViewPosition;
  2520. #ifndef FLAT_SHADED
  2521. varying vec3 vNormal;
  2522. #ifdef USE_TANGENT
  2523. varying vec3 vTangent;
  2524. varying vec3 vBitangent;
  2525. #endif
  2526. #endif
  2527. #include <common>
  2528. #include <uv_pars_vertex>
  2529. #include <uv2_pars_vertex>
  2530. #include <displacementmap_pars_vertex>
  2531. #include <color_pars_vertex>
  2532. #include <fog_pars_vertex>
  2533. #include <morphtarget_pars_vertex>
  2534. #include <skinning_pars_vertex>
  2535. #include <shadowmap_pars_vertex>
  2536. #include <logdepthbuf_pars_vertex>
  2537. #include <clipping_planes_pars_vertex>
  2538. void main() {
  2539. #include <uv_vertex>
  2540. #include <uv2_vertex>
  2541. #include <color_vertex>
  2542. #include <beginnormal_vertex>
  2543. #include <morphnormal_vertex>
  2544. #include <skinbase_vertex>
  2545. #include <skinnormal_vertex>
  2546. #include <defaultnormal_vertex>
  2547. #ifndef FLAT_SHADED
  2548. vNormal = normalize( transformedNormal );
  2549. #ifdef USE_TANGENT
  2550. vTangent = normalize( transformedTangent );
  2551. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  2552. #endif
  2553. #endif
  2554. #include <begin_vertex>
  2555. #include <morphtarget_vertex>
  2556. #include <skinning_vertex>
  2557. #include <displacementmap_vertex>
  2558. #include <project_vertex>
  2559. #include <logdepthbuf_vertex>
  2560. #include <clipping_planes_vertex>
  2561. vViewPosition = - mvPosition.xyz;
  2562. #include <worldpos_vertex>
  2563. #include <shadowmap_vertex>
  2564. #include <fog_vertex>
  2565. }`,Qd=`#define NORMAL
  2566. uniform float opacity;
  2567. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
  2568. varying vec3 vViewPosition;
  2569. #endif
  2570. #ifndef FLAT_SHADED
  2571. varying vec3 vNormal;
  2572. #ifdef USE_TANGENT
  2573. varying vec3 vTangent;
  2574. varying vec3 vBitangent;
  2575. #endif
  2576. #endif
  2577. #include <packing>
  2578. #include <uv_pars_fragment>
  2579. #include <bumpmap_pars_fragment>
  2580. #include <normalmap_pars_fragment>
  2581. #include <logdepthbuf_pars_fragment>
  2582. #include <clipping_planes_pars_fragment>
  2583. void main() {
  2584. #include <clipping_planes_fragment>
  2585. #include <logdepthbuf_fragment>
  2586. #include <normal_fragment_begin>
  2587. #include <normal_fragment_maps>
  2588. gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
  2589. }`,$d=`#define NORMAL
  2590. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
  2591. varying vec3 vViewPosition;
  2592. #endif
  2593. #ifndef FLAT_SHADED
  2594. varying vec3 vNormal;
  2595. #ifdef USE_TANGENT
  2596. varying vec3 vTangent;
  2597. varying vec3 vBitangent;
  2598. #endif
  2599. #endif
  2600. #include <common>
  2601. #include <uv_pars_vertex>
  2602. #include <displacementmap_pars_vertex>
  2603. #include <morphtarget_pars_vertex>
  2604. #include <skinning_pars_vertex>
  2605. #include <logdepthbuf_pars_vertex>
  2606. #include <clipping_planes_pars_vertex>
  2607. void main() {
  2608. #include <uv_vertex>
  2609. #include <beginnormal_vertex>
  2610. #include <morphnormal_vertex>
  2611. #include <skinbase_vertex>
  2612. #include <skinnormal_vertex>
  2613. #include <defaultnormal_vertex>
  2614. #ifndef FLAT_SHADED
  2615. vNormal = normalize( transformedNormal );
  2616. #ifdef USE_TANGENT
  2617. vTangent = normalize( transformedTangent );
  2618. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  2619. #endif
  2620. #endif
  2621. #include <begin_vertex>
  2622. #include <morphtarget_vertex>
  2623. #include <skinning_vertex>
  2624. #include <displacementmap_vertex>
  2625. #include <project_vertex>
  2626. #include <logdepthbuf_vertex>
  2627. #include <clipping_planes_vertex>
  2628. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
  2629. vViewPosition = - mvPosition.xyz;
  2630. #endif
  2631. }`,ep=`uniform vec3 diffuse;
  2632. uniform float opacity;
  2633. #include <common>
  2634. #include <color_pars_fragment>
  2635. #include <map_particle_pars_fragment>
  2636. #include <fog_pars_fragment>
  2637. #include <logdepthbuf_pars_fragment>
  2638. #include <clipping_planes_pars_fragment>
  2639. void main() {
  2640. #include <clipping_planes_fragment>
  2641. vec3 outgoingLight = vec3( 0.0 );
  2642. vec4 diffuseColor = vec4( diffuse, opacity );
  2643. #include <logdepthbuf_fragment>
  2644. #include <map_particle_fragment>
  2645. #include <color_fragment>
  2646. #include <alphatest_fragment>
  2647. outgoingLight = diffuseColor.rgb;
  2648. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2649. #include <tonemapping_fragment>
  2650. #include <encodings_fragment>
  2651. #include <fog_fragment>
  2652. #include <premultiplied_alpha_fragment>
  2653. }`,tp=`uniform float size;
  2654. uniform float scale;
  2655. #include <common>
  2656. #include <color_pars_vertex>
  2657. #include <fog_pars_vertex>
  2658. #include <morphtarget_pars_vertex>
  2659. #include <logdepthbuf_pars_vertex>
  2660. #include <clipping_planes_pars_vertex>
  2661. void main() {
  2662. #include <color_vertex>
  2663. #include <begin_vertex>
  2664. #include <morphtarget_vertex>
  2665. #include <project_vertex>
  2666. gl_PointSize = size;
  2667. #ifdef USE_SIZEATTENUATION
  2668. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  2669. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  2670. #endif
  2671. #include <logdepthbuf_vertex>
  2672. #include <clipping_planes_vertex>
  2673. #include <worldpos_vertex>
  2674. #include <fog_vertex>
  2675. }`,np=`uniform vec3 color;
  2676. uniform float opacity;
  2677. #include <common>
  2678. #include <packing>
  2679. #include <fog_pars_fragment>
  2680. #include <bsdfs>
  2681. #include <lights_pars_begin>
  2682. #include <shadowmap_pars_fragment>
  2683. #include <shadowmask_pars_fragment>
  2684. void main() {
  2685. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  2686. #include <tonemapping_fragment>
  2687. #include <encodings_fragment>
  2688. #include <fog_fragment>
  2689. }`,ip=`#include <common>
  2690. #include <fog_pars_vertex>
  2691. #include <shadowmap_pars_vertex>
  2692. void main() {
  2693. #include <begin_vertex>
  2694. #include <project_vertex>
  2695. #include <worldpos_vertex>
  2696. #include <beginnormal_vertex>
  2697. #include <morphnormal_vertex>
  2698. #include <skinbase_vertex>
  2699. #include <skinnormal_vertex>
  2700. #include <defaultnormal_vertex>
  2701. #include <shadowmap_vertex>
  2702. #include <fog_vertex>
  2703. }`,rp=`uniform vec3 diffuse;
  2704. uniform float opacity;
  2705. #include <common>
  2706. #include <uv_pars_fragment>
  2707. #include <map_pars_fragment>
  2708. #include <alphamap_pars_fragment>
  2709. #include <fog_pars_fragment>
  2710. #include <logdepthbuf_pars_fragment>
  2711. #include <clipping_planes_pars_fragment>
  2712. void main() {
  2713. #include <clipping_planes_fragment>
  2714. vec3 outgoingLight = vec3( 0.0 );
  2715. vec4 diffuseColor = vec4( diffuse, opacity );
  2716. #include <logdepthbuf_fragment>
  2717. #include <map_fragment>
  2718. #include <alphamap_fragment>
  2719. #include <alphatest_fragment>
  2720. outgoingLight = diffuseColor.rgb;
  2721. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2722. #include <tonemapping_fragment>
  2723. #include <encodings_fragment>
  2724. #include <fog_fragment>
  2725. }`,sp=`uniform float rotation;
  2726. uniform vec2 center;
  2727. #include <common>
  2728. #include <uv_pars_vertex>
  2729. #include <fog_pars_vertex>
  2730. #include <logdepthbuf_pars_vertex>
  2731. #include <clipping_planes_pars_vertex>
  2732. void main() {
  2733. #include <uv_vertex>
  2734. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  2735. vec2 scale;
  2736. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  2737. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  2738. #ifndef USE_SIZEATTENUATION
  2739. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  2740. if ( isPerspective ) scale *= - mvPosition.z;
  2741. #endif
  2742. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  2743. vec2 rotatedPosition;
  2744. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  2745. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  2746. mvPosition.xy += rotatedPosition;
  2747. gl_Position = projectionMatrix * mvPosition;
  2748. #include <logdepthbuf_vertex>
  2749. #include <clipping_planes_vertex>
  2750. #include <fog_vertex>
  2751. }`;const Ce={alphamap_fragment:Uu,alphamap_pars_fragment:zu,alphatest_fragment:Hu,aomap_fragment:ku,aomap_pars_fragment:Gu,begin_vertex:Vu,beginnormal_vertex:Wu,bsdfs:ju,bumpmap_pars_fragment:qu,clipping_planes_fragment:Xu,clipping_planes_pars_fragment:Yu,clipping_planes_pars_vertex:Zu,clipping_planes_vertex:Ju,color_fragment:Ku,color_pars_fragment:Qu,color_pars_vertex:$u,color_vertex:ef,common:tf,cube_uv_reflection_fragment:nf,defaultnormal_vertex:rf,displacementmap_pars_vertex:sf,displacementmap_vertex:of,emissivemap_fragment:af,emissivemap_pars_fragment:cf,encodings_fragment:lf,encodings_pars_fragment:hf,envmap_fragment:uf,envmap_common_pars_fragment:ff,envmap_pars_fragment:df,envmap_pars_vertex:pf,envmap_physical_pars_fragment:Ef,envmap_vertex:mf,fog_vertex:gf,fog_pars_vertex:vf,fog_fragment:yf,fog_pars_fragment:xf,gradientmap_pars_fragment:_f,lightmap_fragment:bf,lightmap_pars_fragment:wf,lights_lambert_vertex:Mf,lights_pars_begin:Sf,lights_toon_fragment:Tf,lights_toon_pars_fragment:Af,lights_phong_fragment:Lf,lights_phong_pars_fragment:Rf,lights_physical_fragment:Cf,lights_physical_pars_fragment:Pf,lights_fragment_begin:If,lights_fragment_maps:Nf,lights_fragment_end:Df,logdepthbuf_fragment:Of,logdepthbuf_pars_fragment:Ff,logdepthbuf_pars_vertex:Bf,logdepthbuf_vertex:Uf,map_fragment:zf,map_pars_fragment:Hf,map_particle_fragment:kf,map_particle_pars_fragment:Gf,metalnessmap_fragment:Vf,metalnessmap_pars_fragment:Wf,morphnormal_vertex:jf,morphtarget_pars_vertex:qf,morphtarget_vertex:Xf,normal_fragment_begin:Yf,normal_fragment_maps:Zf,normalmap_pars_fragment:Jf,clearcoat_normal_fragment_begin:Kf,clearcoat_normal_fragment_maps:Qf,clearcoat_pars_fragment:$f,packing:ed,premultiplied_alpha_fragment:td,project_vertex:nd,dithering_fragment:id,dithering_pars_fragment:rd,roughnessmap_fragment:sd,roughnessmap_pars_fragment:od,shadowmap_pars_fragment:ad,shadowmap_pars_vertex:cd,shadowmap_vertex:ld,shadowmask_pars_fragment:hd,skinbase_vertex:ud,skinning_pars_vertex:fd,skinning_vertex:dd,skinnormal_vertex:pd,specularmap_fragment:md,specularmap_pars_fragment:gd,tonemapping_fragment:vd,tonemapping_pars_fragment:yd,transmissionmap_fragment:xd,transmissionmap_pars_fragment:_d,uv_pars_fragment:bd,uv_pars_vertex:wd,uv_vertex:Md,uv2_pars_fragment:Sd,uv2_pars_vertex:Ed,uv2_vertex:Td,worldpos_vertex:Ad,background_frag:Ld,background_vert:Rd,cube_frag:Cd,cube_vert:Pd,depth_frag:Id,depth_vert:Nd,distanceRGBA_frag:Dd,distanceRGBA_vert:Od,equirect_frag:Fd,equirect_vert:Bd,linedashed_frag:Ud,linedashed_vert:zd,meshbasic_frag:Hd,meshbasic_vert:kd,meshlambert_frag:Gd,meshlambert_vert:Vd,meshmatcap_frag:Wd,meshmatcap_vert:jd,meshtoon_frag:qd,meshtoon_vert:Xd,meshphong_frag:Yd,meshphong_vert:Zd,meshphysical_frag:Jd,meshphysical_vert:Kd,normal_frag:Qd,normal_vert:$d,points_frag:ep,points_vert:tp,shadow_frag:np,shadow_vert:ip,sprite_frag:rp,sprite_vert:sp},ie={common:{diffuse:{value:new pe(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new ht},uv2Transform:{value:new ht},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new W(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new pe(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ht}},sprite:{diffuse:{value:new pe(15658734)},opacity:{value:1},center:{value:new W(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ht}}},Ft={basic:{uniforms:tt([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.fog]),vertexShader:Ce.meshbasic_vert,fragmentShader:Ce.meshbasic_frag},lambert:{uniforms:tt([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.fog,ie.lights,{emissive:{value:new pe(0)}}]),vertexShader:Ce.meshlambert_vert,fragmentShader:Ce.meshlambert_frag},phong:{uniforms:tt([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new pe(0)},specular:{value:new pe(1118481)},shininess:{value:30}}]),vertexShader:Ce.meshphong_vert,fragmentShader:Ce.meshphong_frag},standard:{uniforms:tt([ie.common,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.roughnessmap,ie.metalnessmap,ie.fog,ie.lights,{emissive:{value:new pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ce.meshphysical_vert,fragmentShader:Ce.meshphysical_frag},toon:{uniforms:tt([ie.common,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.gradientmap,ie.fog,ie.lights,{emissive:{value:new pe(0)}}]),vertexShader:Ce.meshtoon_vert,fragmentShader:Ce.meshtoon_frag},matcap:{uniforms:tt([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,{matcap:{value:null}}]),vertexShader:Ce.meshmatcap_vert,fragmentShader:Ce.meshmatcap_frag},points:{uniforms:tt([ie.points,ie.fog]),vertexShader:Ce.points_vert,fragmentShader:Ce.points_frag},dashed:{uniforms:tt([ie.common,ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ce.linedashed_vert,fragmentShader:Ce.linedashed_frag},depth:{uniforms:tt([ie.common,ie.displacementmap]),vertexShader:Ce.depth_vert,fragmentShader:Ce.depth_frag},normal:{uniforms:tt([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,{opacity:{value:1}}]),vertexShader:Ce.normal_vert,fragmentShader:Ce.normal_frag},sprite:{uniforms:tt([ie.sprite,ie.fog]),vertexShader:Ce.sprite_vert,fragmentShader:Ce.sprite_frag},background:{uniforms:{uvTransform:{value:new ht},t2D:{value:null}},vertexShader:Ce.background_vert,fragmentShader:Ce.background_frag},cube:{uniforms:tt([ie.envmap,{opacity:{value:1}}]),vertexShader:Ce.cube_vert,fragmentShader:Ce.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ce.equirect_vert,fragmentShader:Ce.equirect_frag},distanceRGBA:{uniforms:tt([ie.common,ie.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ce.distanceRGBA_vert,fragmentShader:Ce.distanceRGBA_frag},shadow:{uniforms:tt([ie.lights,ie.fog,{color:{value:new pe(0)},opacity:{value:1}}]),vertexShader:Ce.shadow_vert,fragmentShader:Ce.shadow_frag}};Ft.physical={uniforms:tt([Ft.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new W(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new pe(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Ce.meshphysical_vert,fragmentShader:Ce.meshphysical_frag};function op(t,e,n,i,r){const s=new pe(0);let o=0,a,c,l=null,f=0,h=null;function d(m,v,y,g){let p=v.isScene===!0?v.background:null;p&&p.isTexture&&(p=e.get(p));const L=t.xr,R=L.getSession&&L.getSession();R&&R.environmentBlendMode==="additive"&&(p=null),p===null?u(s,o):p&&p.isColor&&(u(p,1),g=!0),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&(p.isCubeTexture||p.isWebGLCubeRenderTarget||p.mapping===Uo)?(c===void 0&&(c=new et(new jc(1,1,1),new ut({name:"BackgroundCubeMaterial",uniforms:gi(Ft.cube.uniforms),vertexShader:Ft.cube.vertexShader,fragmentShader:Ft.cube.fragmentShader,side:$e,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(T,x,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),p.isWebGLCubeRenderTarget&&(p=p.texture),c.material.uniforms.envMap.value=p,c.material.uniforms.flipEnvMap.value=p.isCubeTexture&&p._needsFlipEnvMap?-1:1,(l!==p||f!==p.version||h!==t.toneMapping)&&(c.material.needsUpdate=!0,l=p,f=p.version,h=t.toneMapping),m.unshift(c,c.geometry,c.material,0,0,null)):p&&p.isTexture&&(a===void 0&&(a=new et(new Bu(2,2),new ut({name:"BackgroundMaterial",uniforms:gi(Ft.background.uniforms),vertexShader:Ft.background.vertexShader,fragmentShader:Ft.background.fragmentShader,side:ps,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=p,p.matrixAutoUpdate===!0&&p.updateMatrix(),a.material.uniforms.uvTransform.value.copy(p.matrix),(l!==p||f!==p.version||h!==t.toneMapping)&&(a.material.needsUpdate=!0,l=p,f=p.version,h=t.toneMapping),m.unshift(a,a.geometry,a.material,0,0,null))}function u(m,v){n.buffers.color.setClear(m.r,m.g,m.b,v,r)}return{getClearColor:function(){return s},setClearColor:function(m,v=1){s.set(m),o=v,u(s,o)},getClearAlpha:function(){return o},setClearAlpha:function(m){o=m,u(s,o)},render:d}}function ap(t,e,n,i){const r=t.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},c=v(null);let l=c;function f(N,D,C,w,F){let z=!1;if(o){const V=m(w,C,D);l!==V&&(l=V,d(l.object)),z=y(w,F),z&&g(w,F)}else{const V=D.wireframe===!0;(l.geometry!==w.id||l.program!==C.id||l.wireframe!==V)&&(l.geometry=w.id,l.program=C.id,l.wireframe=V,z=!0)}N.isInstancedMesh===!0&&(z=!0),F!==null&&n.update(F,34963),z&&(P(N,D,C,w),F!==null&&t.bindBuffer(34963,n.get(F).buffer))}function h(){return i.isWebGL2?t.createVertexArray():s.createVertexArrayOES()}function d(N){return i.isWebGL2?t.bindVertexArray(N):s.bindVertexArrayOES(N)}function u(N){return i.isWebGL2?t.deleteVertexArray(N):s.deleteVertexArrayOES(N)}function m(N,D,C){const w=C.wireframe===!0;let F=a[N.id];F===void 0&&(F={},a[N.id]=F);let z=F[D.id];z===void 0&&(z={},F[D.id]=z);let V=z[w];return V===void 0&&(V=v(h()),z[w]=V),V}function v(N){const D=[],C=[],w=[];for(let F=0;F<r;F++)D[F]=0,C[F]=0,w[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:C,attributeDivisors:w,object:N,attributes:{},index:null}}function y(N,D){const C=l.attributes,w=N.attributes;let F=0;for(const z in w){const V=C[z],q=w[z];if(V===void 0||V.attribute!==q||V.data!==q.data)return!0;F++}return l.attributesNum!==F||l.index!==D}function g(N,D){const C={},w=N.attributes;let F=0;for(const z in w){const V=w[z],q={};q.attribute=V,V.data&&(q.data=V.data),C[z]=q,F++}l.attributes=C,l.attributesNum=F,l.index=D}function p(){const N=l.newAttributes;for(let D=0,C=N.length;D<C;D++)N[D]=0}function L(N){R(N,0)}function R(N,D){const C=l.newAttributes,w=l.enabledAttributes,F=l.attributeDivisors;C[N]=1,w[N]===0&&(t.enableVertexAttribArray(N),w[N]=1),F[N]!==D&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](N,D),F[N]=D)}function T(){const N=l.newAttributes,D=l.enabledAttributes;for(let C=0,w=D.length;C<w;C++)D[C]!==N[C]&&(t.disableVertexAttribArray(C),D[C]=0)}function x(N,D,C,w,F,z){i.isWebGL2===!0&&(C===5124||C===5125)?t.vertexAttribIPointer(N,D,C,F,z):t.vertexAttribPointer(N,D,C,w,F,z)}function P(N,D,C,w){if(i.isWebGL2===!1&&(N.isInstancedMesh||w.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;p();const F=w.attributes,z=C.getAttributes(),V=D.defaultAttributeValues;for(const q in z){const J=z[q];if(J>=0){const le=F[q];if(le!==void 0){const ge=le.normalized,Re=le.itemSize,k=n.get(le);if(k===void 0)continue;const Le=k.buffer,ue=k.type,Se=k.bytesPerElement;if(le.isInterleavedBufferAttribute){const xe=le.data,Pe=xe.stride,_e=le.offset;xe&&xe.isInstancedInterleavedBuffer?(R(J,xe.meshPerAttribute),w._maxInstanceCount===void 0&&(w._maxInstanceCount=xe.meshPerAttribute*xe.count)):L(J),t.bindBuffer(34962,Le),x(J,Re,ue,ge,Pe*Se,_e*Se)}else le.isInstancedBufferAttribute?(R(J,le.meshPerAttribute),w._maxInstanceCount===void 0&&(w._maxInstanceCount=le.meshPerAttribute*le.count)):L(J),t.bindBuffer(34962,Le),x(J,Re,ue,ge,0,0)}else if(q==="instanceMatrix"){const ge=n.get(N.instanceMatrix);if(ge===void 0)continue;const Re=ge.buffer,k=ge.type;R(J+0,1),R(J+1,1),R(J+2,1),R(J+3,1),t.bindBuffer(34962,Re),t.vertexAttribPointer(J+0,4,k,!1,64,0),t.vertexAttribPointer(J+1,4,k,!1,64,16),t.vertexAttribPointer(J+2,4,k,!1,64,32),t.vertexAttribPointer(J+3,4,k,!1,64,48)}else if(q==="instanceColor"){const ge=n.get(N.instanceColor);if(ge===void 0)continue;const Re=ge.buffer,k=ge.type;R(J,1),t.bindBuffer(34962,Re),t.vertexAttribPointer(J,3,k,!1,12,0)}else if(V!==void 0){const ge=V[q];if(ge!==void 0)switch(ge.length){case 2:t.vertexAttrib2fv(J,ge);break;case 3:t.vertexAttrib3fv(J,ge);break;case 4:t.vertexAttrib4fv(J,ge);break;default:t.vertexAttrib1fv(J,ge)}}}}T()}function U(){S();for(const N in a){const D=a[N];for(const C in D){const w=D[C];for(const F in w)u(w[F].object),delete w[F];delete D[C]}delete a[N]}}function K(N){if(a[N.id]===void 0)return;const D=a[N.id];for(const C in D){const w=D[C];for(const F in w)u(w[F].object),delete w[F];delete D[C]}delete a[N.id]}function ae(N){for(const D in a){const C=a[D];if(C[N.id]===void 0)continue;const w=C[N.id];for(const F in w)u(w[F].object),delete w[F];delete C[N.id]}}function S(){O(),l!==c&&(l=c,d(l.object))}function O(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:f,reset:S,resetDefaultState:O,dispose:U,releaseStatesOfGeometry:K,releaseStatesOfProgram:ae,initAttributes:p,enableAttribute:L,disableUnusedAttributes:T}}function cp(t,e,n,i){const r=i.isWebGL2;let s;function o(l){s=l}function a(l,f){t.drawArrays(s,l,f),n.update(f,s,1)}function c(l,f,h){if(h===0)return;let d,u;if(r)d=t,u="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),u="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[u](s,l,f,h),n.update(f,s,h)}this.setMode=o,this.render=a,this.renderInstances=c}function lp(t,e,n){let i;function r(){if(i!==void 0)return i;const x=e.get("EXT_texture_filter_anisotropic");return x!==null?i=t.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT):i=0,i}function s(x){if(x==="highp"){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";x="mediump"}return x==="mediump"&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&t instanceof WebGL2ComputeRenderingContext;let a=n.precision!==void 0?n.precision:"highp";const c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=n.logarithmicDepthBuffer===!0,f=t.getParameter(34930),h=t.getParameter(35660),d=t.getParameter(3379),u=t.getParameter(34076),m=t.getParameter(34921),v=t.getParameter(36347),y=t.getParameter(36348),g=t.getParameter(36349),p=h>0,L=o||!!e.get("OES_texture_float"),R=p&&L,T=o?t.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:f,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:u,maxAttributes:m,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:g,vertexTextures:p,floatFragmentTextures:L,floatVertexTextures:R,maxSamples:T}}function hp(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new Jt,a=new ht,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d,u){const m=h.length!==0||d||i!==0||r;return r=d,n=f(h,u,0),i=h.length,m},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1,l()},this.setState=function(h,d,u){const m=h.clippingPlanes,v=h.clipIntersection,y=h.clipShadows,g=t.get(h);if(!r||m===null||m.length===0||s&&!y)s?f(null):l();else{const p=s?0:i,L=p*4;let R=g.clippingState||null;c.value=R,R=f(m,d,L,u);for(let T=0;T!==L;++T)R[T]=n[T];g.clippingState=R,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=p}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(h,d,u,m){const v=h!==null?h.length:0;let y=null;if(v!==0){if(y=c.value,m!==!0||y===null){const g=u+v*4,p=d.matrixWorldInverse;a.getNormalMatrix(p),(y===null||y.length<g)&&(y=new Float32Array(g));for(let L=0,R=u;L!==v;++L,R+=4)o.copy(h[L]).applyMatrix4(p,a),o.normal.toArray(y,R),y[R+3]=o.constant}c.value=y,c.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,y}}function up(t){let e=new WeakMap;function n(o,a){return a===oa?o.mapping=Fo:a===aa&&(o.mapping=Bo),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===oa||a===aa)if(e.has(o)){const c=e.get(o).texture;return n(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const l=t.getRenderList(),f=t.getRenderTarget(),h=t.getRenderState(),d=new In(c.height/2);return d.fromEquirectangularTexture(t,o),e.set(o,d),t.setRenderTarget(f),t.setRenderList(l),t.setRenderState(h),o.addEventListener("dispose",r),n(d.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}function fp(t){const e={};return{has:function(n){if(e[n]!==void 0)return e[n]!==null;let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i!==null},get:function(n){return this.has(n)||console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]}}}function dp(t,e,n,i){const r=new WeakMap,s=new WeakMap;function o(h){const d=h.target,u=r.get(d);u.index!==null&&e.remove(u.index);for(const v in u.attributes)e.remove(u.attributes[v]);d.removeEventListener("dispose",o),r.delete(d);const m=s.get(u);m&&(e.remove(m),s.delete(u)),i.releaseStatesOfGeometry(u),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,n.memory.geometries--}function a(h,d){let u=r.get(d);return u||(d.addEventListener("dispose",o),d.isBufferGeometry?u=d:d.isGeometry&&(d._bufferGeometry===void 0&&(d._bufferGeometry=new Fe().setFromObject(h)),u=d._bufferGeometry),r.set(d,u),n.memory.geometries++,u)}function c(h){const d=h.attributes;for(const m in d)e.update(d[m],34962);const u=h.morphAttributes;for(const m in u){const v=u[m];for(let y=0,g=v.length;y<g;y++)e.update(v[y],34962)}}function l(h){const d=[],u=h.index,m=h.attributes.position;let v=0;if(u!==null){const p=u.array;v=u.version;for(let L=0,R=p.length;L<R;L+=3){const T=p[L+0],x=p[L+1],P=p[L+2];d.push(T,x,x,P,P,T)}}else{const p=m.array;v=m.version;for(let L=0,R=p.length/3-1;L<R;L+=3){const T=L+0,x=L+1,P=L+2;d.push(T,x,x,P,P,T)}}const y=new(Vc(d)>65535?tr:er)(d,1);y.version=v;const g=s.get(h);g&&e.remove(g),s.set(h,y)}function f(h){const d=s.get(h);if(d){const u=h.index;u!==null&&d.version<u.version&&l(h)}else l(h);return s.get(h)}return{get:a,update:c,getWireframeAttribute:f}}function pp(t,e,n,i){const r=i.isWebGL2;let s;function o(d){s=d}let a,c;function l(d){a=d.type,c=d.bytesPerElement}function f(d,u){t.drawElements(s,u,a,d*c),n.update(u,s,1)}function h(d,u,m){if(m===0)return;let v,y;if(r)v=t,y="drawElementsInstanced";else if(v=e.get("ANGLE_instanced_arrays"),y="drawElementsInstancedANGLE",v===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}v[y](s,u,a,d*c,m),n.update(u,s,m)}this.setMode=o,this.setIndex=l,this.render=f,this.renderInstances=h}function mp(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(n.calls++,o){case 4:n.triangles+=a*(s/3);break;case 1:n.lines+=a*(s/2);break;case 3:n.lines+=a*(s-1);break;case 2:n.lines+=a*s;break;case 0:n.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function gp(t,e){return t[0]-e[0]}function vp(t,e){return Math.abs(e[1])-Math.abs(t[1])}function yp(t){const e={},n=new Float32Array(8),i=[];for(let s=0;s<8;s++)i[s]=[s,0];function r(s,o,a,c){const l=s.morphTargetInfluences,f=l===void 0?0:l.length;let h=e[o.id];if(h===void 0){h=[];for(let y=0;y<f;y++)h[y]=[y,0];e[o.id]=h}for(let y=0;y<f;y++){const g=h[y];g[0]=y,g[1]=l[y]}h.sort(vp);for(let y=0;y<8;y++)y<f&&h[y][1]?(i[y][0]=h[y][0],i[y][1]=h[y][1]):(i[y][0]=Number.MAX_SAFE_INTEGER,i[y][1]=0);i.sort(gp);const d=a.morphTargets&&o.morphAttributes.position,u=a.morphNormals&&o.morphAttributes.normal;let m=0;for(let y=0;y<8;y++){const g=i[y],p=g[0],L=g[1];p!==Number.MAX_SAFE_INTEGER&&L?(d&&o.getAttribute("morphTarget"+y)!==d[p]&&o.setAttribute("morphTarget"+y,d[p]),u&&o.getAttribute("morphNormal"+y)!==u[p]&&o.setAttribute("morphNormal"+y,u[p]),n[y]=L,m+=L):(d&&o.hasAttribute("morphTarget"+y)===!0&&o.deleteAttribute("morphTarget"+y),u&&o.hasAttribute("morphNormal"+y)===!0&&o.deleteAttribute("morphNormal"+y),n[y]=0)}const v=o.morphTargetsRelative?1:1-m;c.getUniforms().setValue(t,"morphTargetBaseInfluence",v),c.getUniforms().setValue(t,"morphTargetInfluences",n)}return{update:r}}function xp(t,e,n,i){let r=new WeakMap;function s(a){const c=i.render.frame,l=a.geometry,f=e.get(a,l);return r.get(f)!==c&&(l.isGeometry&&f.updateFromObject(a),e.update(f),r.set(f,c)),a.isInstancedMesh&&(n.update(a.instanceMatrix,34962),a.instanceColor!==null&&n.update(a.instanceColor,34962)),f}function o(){r=new WeakMap}return{update:s,dispose:o}}function nr(t=null,e=1,n=1,i=1){Ge.call(this,null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=st,this.minFilter=st,this.wrapR=pt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}nr.prototype=Object.create(Ge.prototype);nr.prototype.constructor=nr;nr.prototype.isDataTexture2DArray=!0;function ir(t=null,e=1,n=1,i=1){Ge.call(this,null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=st,this.minFilter=st,this.wrapR=pt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}ir.prototype=Object.create(Ge.prototype);ir.prototype.constructor=ir;ir.prototype.isDataTexture3D=!0;const Xc=new Ge,_p=new nr,bp=new ir,Yc=new _n,Ia=[],Na=[],Da=new Float32Array(16),Oa=new Float32Array(9),Fa=new Float32Array(4);function Li(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=Ia[r];if(s===void 0&&(s=new Float32Array(r),Ia[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function wt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function mt(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Zc(t,e){let n=Na[e];n===void 0&&(n=new Int32Array(e),Na[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function wp(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Mp(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(wt(n,e))return;t.uniform2fv(this.addr,e),mt(n,e)}}function Sp(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(wt(n,e))return;t.uniform3fv(this.addr,e),mt(n,e)}}function Ep(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(wt(n,e))return;t.uniform4fv(this.addr,e),mt(n,e)}}function Tp(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(wt(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),mt(n,e)}else{if(wt(n,i))return;Fa.set(i),t.uniformMatrix2fv(this.addr,!1,Fa),mt(n,i)}}function Ap(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(wt(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),mt(n,e)}else{if(wt(n,i))return;Oa.set(i),t.uniformMatrix3fv(this.addr,!1,Oa),mt(n,i)}}function Lp(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(wt(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),mt(n,e)}else{if(wt(n,i))return;Da.set(i),t.uniformMatrix4fv(this.addr,!1,Da),mt(n,i)}}function Rp(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||Xc,r)}function Cp(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||_p,r)}function Pp(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||bp,r)}function Ip(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||Yc,r)}function Np(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Dp(t,e){const n=this.cache;wt(n,e)||(t.uniform2iv(this.addr,e),mt(n,e))}function Op(t,e){const n=this.cache;wt(n,e)||(t.uniform3iv(this.addr,e),mt(n,e))}function Fp(t,e){const n=this.cache;wt(n,e)||(t.uniform4iv(this.addr,e),mt(n,e))}function Bp(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Up(t){switch(t){case 5126:return wp;case 35664:return Mp;case 35665:return Sp;case 35666:return Ep;case 35674:return Tp;case 35675:return Ap;case 35676:return Lp;case 5124:case 35670:return Np;case 35667:case 35671:return Dp;case 35668:case 35672:return Op;case 35669:case 35673:return Fp;case 5125:return Bp;case 35678:case 36198:case 36298:case 36306:case 35682:return Rp;case 35679:case 36299:case 36307:return Pp;case 35680:case 36300:case 36308:case 36293:return Ip;case 36289:case 36303:case 36311:case 36292:return Cp}}function zp(t,e){t.uniform1fv(this.addr,e)}function Hp(t,e){t.uniform1iv(this.addr,e)}function kp(t,e){t.uniform2iv(this.addr,e)}function Gp(t,e){t.uniform3iv(this.addr,e)}function Vp(t,e){t.uniform4iv(this.addr,e)}function Wp(t,e){const n=Li(e,this.size,2);t.uniform2fv(this.addr,n)}function jp(t,e){const n=Li(e,this.size,3);t.uniform3fv(this.addr,n)}function qp(t,e){const n=Li(e,this.size,4);t.uniform4fv(this.addr,n)}function Xp(t,e){const n=Li(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Yp(t,e){const n=Li(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Zp(t,e){const n=Li(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Jp(t,e,n){const i=e.length,r=Zc(n,i);t.uniform1iv(this.addr,r);for(let s=0;s!==i;++s)n.safeSetTexture2D(e[s]||Xc,r[s])}function Kp(t,e,n){const i=e.length,r=Zc(n,i);t.uniform1iv(this.addr,r);for(let s=0;s!==i;++s)n.safeSetTextureCube(e[s]||Yc,r[s])}function Qp(t){switch(t){case 5126:return zp;case 35664:return Wp;case 35665:return jp;case 35666:return qp;case 35674:return Xp;case 35675:return Yp;case 35676:return Zp;case 5124:case 35670:return Hp;case 35667:case 35671:return kp;case 35668:case 35672:return Gp;case 35669:case 35673:return Vp;case 35678:case 36198:case 36298:case 36306:case 35682:return Jp;case 35680:case 36300:case 36308:case 36293:return Kp}}function $p(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=Up(e.type)}function Jc(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=Qp(e.type)}Jc.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),mt(e,t)};function Kc(t){this.id=t,this.seq=[],this.map={}}Kc.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const o=i[r];o.setValue(t,e[o.id],n)}};const js=/([\w\d_]+)(\])?(\[|\.)?/g;function Ba(t,e){t.seq.push(e),t.map[e.id]=e}function em(t,e,n){const i=t.name,r=i.length;for(js.lastIndex=0;;){const s=js.exec(i),o=js.lastIndex;let a=s[1];const c=s[2]==="]",l=s[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===r){Ba(n,l===void 0?new $p(a,t,e):new Jc(a,t,e));break}else{let h=n.map[a];h===void 0&&(h=new Kc(a),Ba(n,h)),n=h}}}function gn(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const r=t.getActiveUniform(e,i),s=t.getUniformLocation(e,r.name);em(r,s,this)}}gn.prototype.setValue=function(t,e,n,i){const r=this.map[e];r!==void 0&&r.setValue(t,n,i)};gn.prototype.setOptional=function(t,e,n){const i=e[n];i!==void 0&&this.setValue(t,n,i)};gn.upload=function(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const o=e[r],a=n[o.id];a.needsUpdate!==!1&&o.setValue(t,a.value,i)}};gn.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.id in e&&n.push(s)}return n};function Ua(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let tm=0;function nm(t){const e=t.split(`
  2752. `);for(let n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join(`
  2753. `)}function Qc(t){switch(t){case dr:return["Linear","( value )"];case Hc:return["sRGB","( value )"];case hu:return["RGBE","( value )"];case fu:return["RGBM","( value, 7.0 )"];case du:return["RGBM","( value, 16.0 )"];case pu:return["RGBD","( value, 256.0 )"];case lu:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case uu:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function za(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=t.getShaderSource(e);return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+`
  2754. `+r+nm(s)}function Bi(t,e){const n=Qc(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function im(t,e){const n=Qc(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function rm(t,e){let n;switch(e){case ch:n="Linear";break;case lh:n="Reinhard";break;case hh:n="OptimizedCineon";break;case uh:n="ACESFilmic";break;case fh:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function sm(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Vi).join(`
  2755. `)}function om(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  2756. `)}function am(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const o=t.getActiveAttrib(e,r).name;n[o]=t.getAttribLocation(e,o)}return n}function Vi(t){return t!==""}function Ha(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).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/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ka(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const cm=/^[ \t]*#include +<([\w\d./]+)>/gm;function lo(t){return t.replace(cm,lm)}function lm(t,e){const n=Ce[e];if(n===void 0)throw new Error("Can not resolve #include <"+e+">");return lo(n)}const hm=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,um=/#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 Ga(t){return t.replace(um,$c).replace(hm,fm)}function fm(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),$c(t,e,n,i)}function $c(t,e,n,i){let r="";for(let s=parseInt(e);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Va(t){let e="precision "+t.precision+` float;
  2757. precision `+t.precision+" int;";return t.precision==="highp"?e+=`
  2758. #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
  2759. #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
  2760. #define LOW_PRECISION`),e}function dm(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Dc?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Hl?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Gi&&(e="SHADOWMAP_TYPE_VSM"),e}function pm(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Fo:case Bo:e="ENVMAP_TYPE_CUBE";break;case Uo:case zo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function mm(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Bo:case zo:e="ENVMAP_MODE_REFRACTION";break}return e}function gm(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case gs:e="ENVMAP_BLENDING_MULTIPLY";break;case oh:e="ENVMAP_BLENDING_MIX";break;case ah:e="ENVMAP_BLENDING_ADD";break}return e}function vm(t,e,n,i){const r=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const c=dm(n),l=pm(n),f=mm(n),h=gm(n),d=t.gammaFactor>0?t.gammaFactor:1,u=n.isWebGL2?"":sm(n),m=om(s),v=r.createProgram();let y,g,p=n.glslVersion?"#version "+n.glslVersion+`
  2761. `:"";n.isRawShaderMaterial?(y=[m].filter(Vi).join(`
  2762. `),y.length>0&&(y+=`
  2763. `),g=[u,m].filter(Vi).join(`
  2764. `),g.length>0&&(g+=`
  2765. `)):(y=[Va(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  2766. `].filter(Vi).join(`
  2767. `),g=[u,Va(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+f:"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==qi?"#define TONE_MAPPING":"",n.toneMapping!==qi?Ce.tonemapping_pars_fragment:"",n.toneMapping!==qi?rm("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ce.encodings_pars_fragment,n.map?Bi("mapTexelToLinear",n.mapEncoding):"",n.matcap?Bi("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Bi("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Bi("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Bi("lightMapTexelToLinear",n.lightMapEncoding):"",im("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  2768. `].filter(Vi).join(`
  2769. `)),o=lo(o),o=Ha(o,n),o=ka(o,n),a=lo(a),a=Ha(a,n),a=ka(a,n),o=Ga(o),a=Ga(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(p=`#version 300 es
  2770. `,y=["#define attribute in","#define varying out","#define texture2D texture"].join(`
  2771. `)+`
  2772. `+y,g=["#define varying in",n.glslVersion===_a?"":"out highp vec4 pc_fragColor;",n.glslVersion===_a?"":"#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(`
  2773. `)+`
  2774. `+g);const L=p+y+o,R=p+g+a,T=Ua(r,35633,L),x=Ua(r,35632,R);if(r.attachShader(v,T),r.attachShader(v,x),n.index0AttributeName!==void 0?r.bindAttribLocation(v,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v),t.debug.checkShaderErrors){const K=r.getProgramInfoLog(v).trim(),ae=r.getShaderInfoLog(T).trim(),S=r.getShaderInfoLog(x).trim();let O=!0,N=!0;if(r.getProgramParameter(v,35714)===!1){O=!1;const D=za(r,T,"vertex"),C=za(r,x,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(v,35715),"gl.getProgramInfoLog",K,D,C)}else K!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",K):(ae===""||S==="")&&(N=!1);N&&(this.diagnostics={runnable:O,programLog:K,vertexShader:{log:ae,prefix:y},fragmentShader:{log:S,prefix:g}})}r.deleteShader(T),r.deleteShader(x);let P;this.getUniforms=function(){return P===void 0&&(P=new gn(r,v)),P};let U;return this.getAttributes=function(){return U===void 0&&(U=am(r,v)),U},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.name=n.shaderName,this.id=tm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=T,this.fragmentShader=x,this}function ym(t,e,n,i,r,s){const o=[],a=i.isWebGL2,c=i.logarithmicDepthBuffer,l=i.floatVertexTextures,f=i.maxVertexUniforms,h=i.vertexTextures;let d=i.precision;const u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function v(x){const U=x.skeleton.bones;if(l)return 1024;{const ae=Math.floor((f-20)/4),S=Math.min(ae,U.length);return S<U.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+U.length+" bones. This GPU supports "+S+"."),0):S}}function y(x){let P;return x?x.isTexture?P=x.encoding:x.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),P=x.texture.encoding):P=dr,P}function g(x,P,U,K,ae){const S=K.fog,O=x.isMeshStandardMaterial?K.environment:null,N=e.get(x.envMap||O),D=u[x.type],C=ae.isSkinnedMesh?v(ae):0;x.precision!==null&&(d=i.getMaxPrecision(x.precision),d!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",d,"instead."));let w,F;if(D){const q=Ft[D];w=q.vertexShader,F=q.fragmentShader}else w=x.vertexShader,F=x.fragmentShader;const z=t.getRenderTarget();return{isWebGL2:a,shaderID:D,shaderName:x.type,vertexShader:w,fragmentShader:F,defines:x.defines,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,instancing:ae.isInstancedMesh===!0,instancingColor:ae.isInstancedMesh===!0&&ae.instanceColor!==null,supportsVertexTextures:h,outputEncoding:z!==null?y(z.texture):t.outputEncoding,map:!!x.map,mapEncoding:y(x.map),matcap:!!x.matcap,matcapEncoding:y(x.matcap),envMap:!!N,envMapMode:N&&N.mapping,envMapEncoding:y(N),envMapCubeUV:!!N&&(N.mapping===Uo||N.mapping===zo),lightMap:!!x.lightMap,lightMapEncoding:y(x.lightMap),aoMap:!!x.aoMap,emissiveMap:!!x.emissiveMap,emissiveMapEncoding:y(x.emissiveMap),bumpMap:!!x.bumpMap,normalMap:!!x.normalMap,objectSpaceNormalMap:x.normalMapType===vu,tangentSpaceNormalMap:x.normalMapType===Ti,clearcoatMap:!!x.clearcoatMap,clearcoatRoughnessMap:!!x.clearcoatRoughnessMap,clearcoatNormalMap:!!x.clearcoatNormalMap,displacementMap:!!x.displacementMap,roughnessMap:!!x.roughnessMap,metalnessMap:!!x.metalnessMap,specularMap:!!x.specularMap,alphaMap:!!x.alphaMap,gradientMap:!!x.gradientMap,sheen:!!x.sheen,transmissionMap:!!x.transmissionMap,combine:x.combine,vertexTangents:x.normalMap&&x.vertexTangents,vertexColors:x.vertexColors,vertexUvs:!!x.map||!!x.bumpMap||!!x.normalMap||!!x.specularMap||!!x.alphaMap||!!x.emissiveMap||!!x.roughnessMap||!!x.metalnessMap||!!x.clearcoatMap||!!x.clearcoatRoughnessMap||!!x.clearcoatNormalMap||!!x.displacementMap||!!x.transmissionMap,uvsVertexOnly:!(x.map||x.bumpMap||x.normalMap||x.specularMap||x.alphaMap||x.emissiveMap||x.roughnessMap||x.metalnessMap||x.clearcoatNormalMap||x.transmissionMap)&&!!x.displacementMap,fog:!!S,useFog:x.fog,fogExp2:S&&S.isFogExp2,flatShading:x.flatShading,sizeAttenuation:x.sizeAttenuation,logarithmicDepthBuffer:c,skinning:x.skinning&&C>0,maxBones:C,useVertexTexture:l,morphTargets:x.morphTargets,morphNormals:x.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:x.dithering,shadowMapEnabled:t.shadowMap.enabled&&U.length>0,shadowMapType:t.shadowMap.type,toneMapping:x.toneMapped?t.toneMapping:qi,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:x.premultipliedAlpha,alphaTest:x.alphaTest,doubleSided:x.side===ms,flipSided:x.side===$e,depthPacking:x.depthPacking!==void 0?x.depthPacking:!1,index0AttributeName:x.index0AttributeName,extensionDerivatives:x.extensions&&x.extensions.derivatives,extensionFragDepth:x.extensions&&x.extensions.fragDepth,extensionDrawBuffers:x.extensions&&x.extensions.drawBuffers,extensionShaderTextureLOD:x.extensions&&x.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:x.customProgramCacheKey()}}function p(x){const P=[];if(x.shaderID?P.push(x.shaderID):(P.push(x.fragmentShader),P.push(x.vertexShader)),x.defines!==void 0)for(const U in x.defines)P.push(U),P.push(x.defines[U]);if(x.isRawShaderMaterial===!1){for(let U=0;U<m.length;U++)P.push(x[m[U]]);P.push(t.outputEncoding),P.push(t.gammaFactor)}return P.push(x.customProgramCacheKey),P.join()}function L(x){const P=u[x.type];let U;if(P){const K=Ft[P];U=Nu.clone(K.uniforms)}else U=x.uniforms;return U}function R(x,P){let U;for(let K=0,ae=o.length;K<ae;K++){const S=o[K];if(S.cacheKey===P){U=S,++U.usedTimes;break}}return U===void 0&&(U=new vm(t,P,x,r),o.push(U)),U}function T(x){if(--x.usedTimes===0){const P=o.indexOf(x);o[P]=o[o.length-1],o.pop(),x.destroy()}}return{getParameters:g,getProgramCacheKey:p,getUniforms:L,acquireProgram:R,releaseProgram:T,programs:o}}function xm(){let t=new WeakMap;function e(s){let o=t.get(s);return o===void 0&&(o={},t.set(s,o)),o}function n(s){t.delete(s)}function i(s,o,a){t.get(s)[o]=a}function r(){t=new WeakMap}return{get:e,remove:n,update:i,dispose:r}}function _m(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function bm(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Wa(t){const e=[];let n=0;const i=[],r=[],s={id:-1};function o(){n=0,i.length=0,r.length=0}function a(d,u,m,v,y,g){let p=e[n];const L=t.get(m);return p===void 0?(p={id:d.id,object:d,geometry:u,material:m,program:L.program||s,groupOrder:v,renderOrder:d.renderOrder,z:y,group:g},e[n]=p):(p.id=d.id,p.object=d,p.geometry=u,p.material=m,p.program=L.program||s,p.groupOrder=v,p.renderOrder=d.renderOrder,p.z=y,p.group=g),n++,p}function c(d,u,m,v,y,g){const p=a(d,u,m,v,y,g);(m.transparent===!0?r:i).push(p)}function l(d,u,m,v,y,g){const p=a(d,u,m,v,y,g);(m.transparent===!0?r:i).unshift(p)}function f(d,u){i.length>1&&i.sort(d||_m),r.length>1&&r.sort(u||bm)}function h(){for(let d=n,u=e.length;d<u;d++){const m=e[d];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.program=null,m.group=null}}return{opaque:i,transparent:r,init:o,push:c,unshift:l,finish:h,sort:f}}function wm(t){let e=new WeakMap;function n(r,s){const o=e.get(r);let a;return o===void 0?(a=new Wa(t),e.set(r,new WeakMap),e.get(r).set(s,a)):(a=o.get(s),a===void 0&&(a=new Wa(t),o.set(s,a))),a}function i(){e=new WeakMap}return{get:n,dispose:i}}function Mm(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new E,color:new pe};break;case"SpotLight":n={position:new E,direction:new E,color:new pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new E,color:new pe,distance:0,decay:0};break;case"HemisphereLight":n={direction:new E,skyColor:new pe,groundColor:new pe};break;case"RectAreaLight":n={color:new pe,position:new E,halfWidth:new E,halfHeight:new E};break}return t[e.id]=n,n}}}function Sm(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new W};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new W};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new W,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Em=0;function Tm(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Am(t,e){const n=new Mm,i=Sm(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)r.probe.push(new E);const s=new E,o=new Ee,a=new Ee;function c(l,f,h){let d=0,u=0,m=0;for(let K=0;K<9;K++)r.probe[K].set(0,0,0);let v=0,y=0,g=0,p=0,L=0,R=0,T=0,x=0;const P=h.matrixWorldInverse;l.sort(Tm);for(let K=0,ae=l.length;K<ae;K++){const S=l[K],O=S.color,N=S.intensity,D=S.distance,C=S.shadow&&S.shadow.map?S.shadow.map.texture:null;if(S.isAmbientLight)d+=O.r*N,u+=O.g*N,m+=O.b*N;else if(S.isLightProbe)for(let w=0;w<9;w++)r.probe[w].addScaledVector(S.sh.coefficients[w],N);else if(S.isDirectionalLight){const w=n.get(S);if(w.color.copy(S.color).multiplyScalar(S.intensity),w.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(P),S.castShadow){const F=S.shadow,z=i.get(S);z.shadowBias=F.bias,z.shadowNormalBias=F.normalBias,z.shadowRadius=F.radius,z.shadowMapSize=F.mapSize,r.directionalShadow[v]=z,r.directionalShadowMap[v]=C,r.directionalShadowMatrix[v]=S.shadow.matrix,R++}r.directional[v]=w,v++}else if(S.isSpotLight){const w=n.get(S);if(w.position.setFromMatrixPosition(S.matrixWorld),w.position.applyMatrix4(P),w.color.copy(O).multiplyScalar(N),w.distance=D,w.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(P),w.coneCos=Math.cos(S.angle),w.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),w.decay=S.decay,S.castShadow){const F=S.shadow,z=i.get(S);z.shadowBias=F.bias,z.shadowNormalBias=F.normalBias,z.shadowRadius=F.radius,z.shadowMapSize=F.mapSize,r.spotShadow[g]=z,r.spotShadowMap[g]=C,r.spotShadowMatrix[g]=S.shadow.matrix,x++}r.spot[g]=w,g++}else if(S.isRectAreaLight){const w=n.get(S);w.color.copy(O).multiplyScalar(N),w.position.setFromMatrixPosition(S.matrixWorld),w.position.applyMatrix4(P),a.identity(),o.copy(S.matrixWorld),o.premultiply(P),a.extractRotation(o),w.halfWidth.set(S.width*.5,0,0),w.halfHeight.set(0,S.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),r.rectArea[p]=w,p++}else if(S.isPointLight){const w=n.get(S);if(w.position.setFromMatrixPosition(S.matrixWorld),w.position.applyMatrix4(P),w.color.copy(S.color).multiplyScalar(S.intensity),w.distance=S.distance,w.decay=S.decay,S.castShadow){const F=S.shadow,z=i.get(S);z.shadowBias=F.bias,z.shadowNormalBias=F.normalBias,z.shadowRadius=F.radius,z.shadowMapSize=F.mapSize,z.shadowCameraNear=F.camera.near,z.shadowCameraFar=F.camera.far,r.pointShadow[y]=z,r.pointShadowMap[y]=C,r.pointShadowMatrix[y]=S.shadow.matrix,T++}r.point[y]=w,y++}else if(S.isHemisphereLight){const w=n.get(S);w.direction.setFromMatrixPosition(S.matrixWorld),w.direction.transformDirection(P),w.direction.normalize(),w.skyColor.copy(S.color).multiplyScalar(N),w.groundColor.copy(S.groundColor).multiplyScalar(N),r.hemi[L]=w,L++}}p>0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ie.LTC_FLOAT_1,r.rectAreaLTC2=ie.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ie.LTC_HALF_1,r.rectAreaLTC2=ie.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=d,r.ambient[1]=u,r.ambient[2]=m;const U=r.hash;(U.directionalLength!==v||U.pointLength!==y||U.spotLength!==g||U.rectAreaLength!==p||U.hemiLength!==L||U.numDirectionalShadows!==R||U.numPointShadows!==T||U.numSpotShadows!==x)&&(r.directional.length=v,r.spot.length=g,r.rectArea.length=p,r.point.length=y,r.hemi.length=L,r.directionalShadow.length=R,r.directionalShadowMap.length=R,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=x,r.spotShadowMap.length=x,r.directionalShadowMatrix.length=R,r.pointShadowMatrix.length=T,r.spotShadowMatrix.length=x,U.directionalLength=v,U.pointLength=y,U.spotLength=g,U.rectAreaLength=p,U.hemiLength=L,U.numDirectionalShadows=R,U.numPointShadows=T,U.numSpotShadows=x,r.version=Em++)}return{setup:c,state:r}}function ja(t,e){const n=new Am(t,e),i=[],r=[];function s(){i.length=0,r.length=0}function o(f){i.push(f)}function a(f){r.push(f)}function c(f){n.setup(i,r,f)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:c,pushLight:o,pushShadow:a}}function Lm(t,e){let n=new WeakMap;function i(s,o){let a;return n.has(s)===!1?(a=new ja(t,e),n.set(s,new WeakMap),n.get(s).set(o,a)):n.get(s).has(o)===!1?(a=new ja(t,e),n.get(s).set(o,a)):a=n.get(s).get(o),a}function r(){n=new WeakMap}return{get:i,dispose:r}}function Nn(t){ye.call(this),this.type="MeshDepthMaterial",this.depthPacking=mu,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}Nn.prototype=Object.create(ye.prototype);Nn.prototype.constructor=Nn;Nn.prototype.isMeshDepthMaterial=!0;Nn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this};function Dn(t){ye.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}Dn.prototype=Object.create(ye.prototype);Dn.prototype.constructor=Dn;Dn.prototype.isMeshDistanceMaterial=!0;Dn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var Rm=`uniform sampler2D shadow_pass;
  2775. uniform vec2 resolution;
  2776. uniform float radius;
  2777. #include <packing>
  2778. void main() {
  2779. float mean = 0.0;
  2780. float squared_mean = 0.0;
  2781. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
  2782. for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
  2783. #ifdef HORIZONAL_PASS
  2784. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
  2785. mean += distribution.x;
  2786. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  2787. #else
  2788. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
  2789. mean += depth;
  2790. squared_mean += depth * depth;
  2791. #endif
  2792. }
  2793. mean = mean * HALF_SAMPLE_RATE;
  2794. squared_mean = squared_mean * HALF_SAMPLE_RATE;
  2795. float std_dev = sqrt( squared_mean - mean * mean );
  2796. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  2797. }`,Cm=`void main() {
  2798. gl_Position = vec4( position, 1.0 );
  2799. }`;function el(t,e,n){let i=new xs;const r=new W,s=new W,o=new Be,a=[],c=[],l={},f={0:$e,1:ps,2:ms},h=new ut({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new W},radius:{value:4}},vertexShader:Cm,fragmentShader:Rm}),d=h.clone();d.defines.HORIZONAL_PASS=1;const u=new Fe;u.setAttribute("position",new be(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new et(u,h),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Dc,this.render=function(T,x,P){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||T.length===0)return;const U=t.getRenderTarget(),K=t.getActiveCubeFace(),ae=t.getActiveMipmapLevel(),S=t.state;S.setBlending(Wi),S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);for(let O=0,N=T.length;O<N;O++){const D=T[O],C=D.shadow;if(C===void 0){console.warn("THREE.WebGLShadowMap:",D,"has no shadow.");continue}if(C.autoUpdate===!1&&C.needsUpdate===!1)continue;r.copy(C.mapSize);const w=C.getFrameExtents();if(r.multiply(w),s.copy(C.mapSize),(r.x>n||r.y>n)&&(r.x>n&&(s.x=Math.floor(n/w.x),r.x=s.x*w.x,C.mapSize.x=s.x),r.y>n&&(s.y=Math.floor(n/w.y),r.y=s.y*w.y,C.mapSize.y=s.y)),C.map===null&&!C.isPointLightShadow&&this.type===Gi){const z={minFilter:it,magFilter:it,format:Pt};C.map=new It(r.x,r.y,z),C.map.texture.name=D.name+".shadowMap",C.mapPass=new It(r.x,r.y,z),C.camera.updateProjectionMatrix()}if(C.map===null){const z={minFilter:st,magFilter:st,format:Pt};C.map=new It(r.x,r.y,z),C.map.texture.name=D.name+".shadowMap",C.camera.updateProjectionMatrix()}t.setRenderTarget(C.map),t.clear();const F=C.getViewportCount();for(let z=0;z<F;z++){const V=C.getViewport(z);o.set(s.x*V.x,s.y*V.y,s.x*V.z,s.y*V.w),S.viewport(o),C.updateMatrices(D,z),i=C.getFrustum(),R(x,P,C.camera,D,this.type)}!C.isPointLightShadow&&this.type===Gi&&y(C,P),C.needsUpdate=!1}v.needsUpdate=!1,t.setRenderTarget(U,K,ae)};function y(T,x){const P=e.update(m);h.uniforms.shadow_pass.value=T.map.texture,h.uniforms.resolution.value=T.mapSize,h.uniforms.radius.value=T.radius,t.setRenderTarget(T.mapPass),t.clear(),t.renderBufferDirect(x,null,P,h,m,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,t.setRenderTarget(T.map),t.clear(),t.renderBufferDirect(x,null,P,d,m,null)}function g(T,x,P){const U=T<<0|x<<1|P<<2;let K=a[U];return K===void 0&&(K=new Nn({depthPacking:gu,morphTargets:T,skinning:x}),a[U]=K),K}function p(T,x,P){const U=T<<0|x<<1|P<<2;let K=c[U];return K===void 0&&(K=new Dn({morphTargets:T,skinning:x}),c[U]=K),K}function L(T,x,P,U,K,ae,S){let O=null,N=g,D=T.customDepthMaterial;if(U.isPointLight===!0&&(N=p,D=T.customDistanceMaterial),D===void 0){let C=!1;P.morphTargets===!0&&(C=x.morphAttributes&&x.morphAttributes.position&&x.morphAttributes.position.length>0);let w=!1;T.isSkinnedMesh===!0&&(P.skinning===!0?w=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",T));const F=T.isInstancedMesh===!0;O=N(C,w,F)}else O=D;if(t.localClippingEnabled&&P.clipShadows===!0&&P.clippingPlanes.length!==0){const C=O.uuid,w=P.uuid;let F=l[C];F===void 0&&(F={},l[C]=F);let z=F[w];z===void 0&&(z=O.clone(),F[w]=z),O=z}return O.visible=P.visible,O.wireframe=P.wireframe,S===Gi?O.side=P.shadowSide!==null?P.shadowSide:P.side:O.side=P.shadowSide!==null?P.shadowSide:f[P.side],O.clipShadows=P.clipShadows,O.clippingPlanes=P.clippingPlanes,O.clipIntersection=P.clipIntersection,O.wireframeLinewidth=P.wireframeLinewidth,O.linewidth=P.linewidth,U.isPointLight===!0&&O.isMeshDistanceMaterial===!0&&(O.referencePosition.setFromMatrixPosition(U.matrixWorld),O.nearDistance=K,O.farDistance=ae),O}function R(T,x,P,U,K){if(T.visible===!1)return;if(T.layers.test(x.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&K===Gi)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const O=e.update(T),N=T.material;if(Array.isArray(N)){const D=O.groups;for(let C=0,w=D.length;C<w;C++){const F=D[C],z=N[F.materialIndex];if(z&&z.visible){const V=L(T,O,z,U,P.near,P.far,K);t.renderBufferDirect(P,null,O,V,T,F)}}}else if(N.visible){const D=L(T,O,N,U,P.near,P.far,K);t.renderBufferDirect(P,null,O,D,T,null)}}const S=T.children;for(let O=0,N=S.length;O<N;O++)R(S[O],x,P,U,K)}}function Pm(t,e,n){const i=n.isWebGL2;function r(){let I=!1;const Z=new Be;let re=null;const he=new Be(0,0,0,0);return{setMask:function(ee){re!==ee&&!I&&(t.colorMask(ee,ee,ee,ee),re=ee)},setLocked:function(ee){I=ee},setClear:function(ee,A,Q,ce,ne){ne===!0&&(ee*=ce,A*=ce,Q*=ce),Z.set(ee,A,Q,ce),he.equals(Z)===!1&&(t.clearColor(ee,A,Q,ce),he.copy(Z))},reset:function(){I=!1,re=null,he.set(-1,0,0,0)}}}function s(){let I=!1,Z=null,re=null,he=null;return{setTest:function(ee){ee?q(2929):J(2929)},setMask:function(ee){Z!==ee&&!I&&(t.depthMask(ee),Z=ee)},setFunc:function(ee){if(re!==ee){if(ee)switch(ee){case $l:t.depthFunc(512);break;case eh:t.depthFunc(519);break;case th:t.depthFunc(513);break;case $s:t.depthFunc(515);break;case nh:t.depthFunc(514);break;case ih:t.depthFunc(518);break;case rh:t.depthFunc(516);break;case sh:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);re=ee}},setLocked:function(ee){I=ee},setClear:function(ee){he!==ee&&(t.clearDepth(ee),he=ee)},reset:function(){I=!1,Z=null,re=null,he=null}}}function o(){let I=!1,Z=null,re=null,he=null,ee=null,A=null,Q=null,ce=null,ne=null;return{setTest:function(de){I||(de?q(2960):J(2960))},setMask:function(de){Z!==de&&!I&&(t.stencilMask(de),Z=de)},setFunc:function(de,Oe,Ye){(re!==de||he!==Oe||ee!==Ye)&&(t.stencilFunc(de,Oe,Ye),re=de,he=Oe,ee=Ye)},setOp:function(de,Oe,Ye){(A!==de||Q!==Oe||ce!==Ye)&&(t.stencilOp(de,Oe,Ye),A=de,Q=Oe,ce=Ye)},setLocked:function(de){I=de},setClear:function(de){ne!==de&&(t.clearStencil(de),ne=de)},reset:function(){I=!1,Z=null,re=null,he=null,ee=null,A=null,Q=null,ce=null,ne=null}}}const a=new r,c=new s,l=new o;let f={},h=null,d=null,u=null,m=null,v=null,y=null,g=null,p=null,L=null,R=!1,T=null,x=null,P=null,U=null,K=null;const ae=t.getParameter(35661);let S=!1,O=0;const N=t.getParameter(7938);N.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL\ ([0-9])/.exec(N)[1]),S=O>=1):N.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(N)[1]),S=O>=2);let D=null,C={};const w=new Be,F=new Be;function z(I,Z,re){const he=new Uint8Array(4),ee=t.createTexture();t.bindTexture(I,ee),t.texParameteri(I,10241,9728),t.texParameteri(I,10240,9728);for(let A=0;A<re;A++)t.texImage2D(Z+A,0,6408,1,1,0,6408,5121,he);return ee}const V={};V[3553]=z(3553,3553,1),V[34067]=z(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),l.setClear(0),q(2929),c.setFunc($s),ue(!1),Se(ea),q(2884),k(Wi);function q(I){f[I]!==!0&&(t.enable(I),f[I]=!0)}function J(I){f[I]!==!1&&(t.disable(I),f[I]=!1)}function le(I){return h!==I?(t.useProgram(I),h=I,!0):!1}const ge={[oi]:32774,[Gl]:32778,[Vl]:32779};if(i)ge[ra]=32775,ge[sa]=32776;else{const I=e.get("EXT_blend_minmax");I!==null&&(ge[ra]=I.MIN_EXT,ge[sa]=I.MAX_EXT)}const Re={[Wl]:0,[jl]:1,[ql]:768,[Fc]:770,[Ql]:776,[Jl]:774,[Yl]:772,[Xl]:769,[Bc]:771,[Kl]:775,[Zl]:773};function k(I,Z,re,he,ee,A,Q,ce){if(I===Wi){d&&(J(3042),d=!1);return}if(d||(q(3042),d=!0),I!==kl){if(I!==u||ce!==R){if((m!==oi||g!==oi)&&(t.blendEquation(32774),m=oi,g=oi),ce)switch(I){case ji:t.blendFuncSeparate(1,771,1,771);break;case ta:t.blendFunc(1,1);break;case na:t.blendFuncSeparate(0,0,769,771);break;case ia:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}else switch(I){case ji:t.blendFuncSeparate(770,771,1,771);break;case ta:t.blendFunc(770,1);break;case na:t.blendFunc(0,769);break;case ia:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}v=null,y=null,p=null,L=null,u=I,R=ce}return}ee=ee||Z,A=A||re,Q=Q||he,(Z!==m||ee!==g)&&(t.blendEquationSeparate(ge[Z],ge[ee]),m=Z,g=ee),(re!==v||he!==y||A!==p||Q!==L)&&(t.blendFuncSeparate(Re[re],Re[he],Re[A],Re[Q]),v=re,y=he,p=A,L=Q),u=I,R=null}function Le(I,Z){I.side===ms?J(2884):q(2884);let re=I.side===$e;Z&&(re=!re),ue(re),I.blending===ji&&I.transparent===!1?k(Wi):k(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.premultipliedAlpha),c.setFunc(I.depthFunc),c.setTest(I.depthTest),c.setMask(I.depthWrite),a.setMask(I.colorWrite);const he=I.stencilWrite;l.setTest(he),he&&(l.setMask(I.stencilWriteMask),l.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),l.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),Pe(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits)}function ue(I){T!==I&&(I?t.frontFace(2304):t.frontFace(2305),T=I)}function Se(I){I!==Ul?(q(2884),I!==x&&(I===ea?t.cullFace(1029):I===zl?t.cullFace(1028):t.cullFace(1032))):J(2884),x=I}function xe(I){I!==P&&(S&&t.lineWidth(I),P=I)}function Pe(I,Z,re){I?(q(32823),(U!==Z||K!==re)&&(t.polygonOffset(Z,re),U=Z,K=re)):J(32823)}function _e(I){I?q(3089):J(3089)}function X(I){I===void 0&&(I=33984+ae-1),D!==I&&(t.activeTexture(I),D=I)}function $(I,Z){D===null&&X();let re=C[D];re===void 0&&(re={type:void 0,texture:void 0},C[D]=re),(re.type!==I||re.texture!==Z)&&(t.bindTexture(I,Z||V[I]),re.type=I,re.texture=Z)}function te(){const I=C[D];I!==void 0&&I.type!==void 0&&(t.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function fe(){try{t.compressedTexImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function se(){try{t.texImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function M(){try{t.texImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function _(I){w.equals(I)===!1&&(t.scissor(I.x,I.y,I.z,I.w),w.copy(I))}function Y(I){F.equals(I)===!1&&(t.viewport(I.x,I.y,I.z,I.w),F.copy(I))}function j(){f={},D=null,C={},h=null,d=null,u=null,m=null,v=null,y=null,g=null,p=null,L=null,R=!1,T=null,x=null,P=null,U=null,K=null,a.reset(),c.reset(),l.reset()}return{buffers:{color:a,depth:c,stencil:l},enable:q,disable:J,useProgram:le,setBlending:k,setMaterial:Le,setFlipSided:ue,setCullFace:Se,setLineWidth:xe,setPolygonOffset:Pe,setScissorTest:_e,activeTexture:X,bindTexture:$,unbindTexture:te,compressedTexImage2D:fe,texImage2D:se,texImage3D:M,scissor:_,viewport:Y,reset:j}}function Im(t,e,n,i,r,s,o){const a=r.isWebGL2,c=r.maxTextures,l=r.maxCubemapSize,f=r.maxTextureSize,h=r.maxSamples,d=new WeakMap;let u,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(M,_){return m?new OffscreenCanvas(M,_):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(M,_,Y,j){let I=1;if((M.width>j||M.height>j)&&(I=j/Math.max(M.width,M.height)),I<1||_===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const Z=_?we.floorPowerOfTwo:Math.floor,re=Z(I*M.width),he=Z(I*M.height);u===void 0&&(u=v(re,he));const ee=Y?v(re,he):u;return ee.width=re,ee.height=he,ee.getContext("2d").drawImage(M,0,0,re,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+re+"x"+he+")."),ee}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function g(M){return we.isPowerOfTwo(M.width)&&we.isPowerOfTwo(M.height)}function p(M){return a?!1:M.wrapS!==pt||M.wrapT!==pt||M.minFilter!==st&&M.minFilter!==it}function L(M,_){return M.generateMipmaps&&_&&M.minFilter!==st&&M.minFilter!==it}function R(M,_,Y,j){t.generateMipmap(M);const I=i.get(_);I.__maxMipLevel=Math.log(Math.max(Y,j))*Math.LOG2E}function T(M,_,Y){if(a===!1)return _;if(M!==null){if(t[M]!==void 0)return t[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let j=_;return _===6403&&(Y===5126&&(j=33326),Y===5131&&(j=33325),Y===5121&&(j=33321)),_===6407&&(Y===5126&&(j=34837),Y===5131&&(j=34843),Y===5121&&(j=32849)),_===6408&&(Y===5126&&(j=34836),Y===5131&&(j=34842),Y===5121&&(j=32856)),(j===33325||j===33326||j===34842||j===34836)&&e.get("EXT_color_buffer_float"),j}function x(M){return M===st||M===ca||M===la?9728:9729}function P(M){const _=M.target;_.removeEventListener("dispose",P),K(_),_.isVideoTexture&&d.delete(_),o.memory.textures--}function U(M){const _=M.target;_.removeEventListener("dispose",U),ae(_),o.memory.textures--}function K(M){const _=i.get(M);_.__webglInit!==void 0&&(t.deleteTexture(_.__webglTexture),i.remove(M))}function ae(M){const _=i.get(M),Y=i.get(M.texture);if(M){if(Y.__webglTexture!==void 0&&t.deleteTexture(Y.__webglTexture),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let j=0;j<6;j++)t.deleteFramebuffer(_.__webglFramebuffer[j]),_.__webglDepthbuffer&&t.deleteRenderbuffer(_.__webglDepthbuffer[j]);else t.deleteFramebuffer(_.__webglFramebuffer),_.__webglDepthbuffer&&t.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&t.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer&&t.deleteRenderbuffer(_.__webglColorRenderbuffer),_.__webglDepthRenderbuffer&&t.deleteRenderbuffer(_.__webglDepthRenderbuffer);i.remove(M.texture),i.remove(M)}}let S=0;function O(){S=0}function N(){const M=S;return M>=c&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+c),S+=1,M}function D(M,_){const Y=i.get(M);if(M.isVideoTexture&&X(M),M.version>0&&Y.__version!==M.version){const j=M.image;if(j===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(j.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(Y,M,_);return}}n.activeTexture(33984+_),n.bindTexture(3553,Y.__webglTexture)}function C(M,_){const Y=i.get(M);if(M.version>0&&Y.__version!==M.version){le(Y,M,_);return}n.activeTexture(33984+_),n.bindTexture(35866,Y.__webglTexture)}function w(M,_){const Y=i.get(M);if(M.version>0&&Y.__version!==M.version){le(Y,M,_);return}n.activeTexture(33984+_),n.bindTexture(32879,Y.__webglTexture)}function F(M,_){const Y=i.get(M);if(M.version>0&&Y.__version!==M.version){ge(Y,M,_);return}n.activeTexture(33984+_),n.bindTexture(34067,Y.__webglTexture)}const z={[eo]:10497,[pt]:33071,[to]:33648},V={[st]:9728,[ca]:9984,[la]:9986,[it]:9729,[dh]:9985,[vs]:9987};function q(M,_,Y){Y?(t.texParameteri(M,10242,z[_.wrapS]),t.texParameteri(M,10243,z[_.wrapT]),(M===32879||M===35866)&&t.texParameteri(M,32882,z[_.wrapR]),t.texParameteri(M,10240,V[_.magFilter]),t.texParameteri(M,10241,V[_.minFilter])):(t.texParameteri(M,10242,33071),t.texParameteri(M,10243,33071),(M===32879||M===35866)&&t.texParameteri(M,32882,33071),(_.wrapS!==pt||_.wrapT!==pt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(M,10240,x(_.magFilter)),t.texParameteri(M,10241,x(_.minFilter)),_.minFilter!==st&&_.minFilter!==it&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));const j=e.get("EXT_texture_filter_anisotropic");if(j){if(_.type===dn&&e.get("OES_texture_float_linear")===null||_.type===ts&&(a||e.get("OES_texture_half_float_linear"))===null)return;(_.anisotropy>1||i.get(_).__currentAnisotropy)&&(t.texParameterf(M,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy)}}function J(M,_){M.__webglInit===void 0&&(M.__webglInit=!0,_.addEventListener("dispose",P),M.__webglTexture=t.createTexture(),o.memory.textures++)}function le(M,_,Y){let j=3553;_.isDataTexture2DArray&&(j=35866),_.isDataTexture3D&&(j=32879),J(M,_),n.activeTexture(33984+Y),n.bindTexture(j,M.__webglTexture),t.pixelStorei(37440,_.flipY),t.pixelStorei(37441,_.premultiplyAlpha),t.pixelStorei(3317,_.unpackAlignment);const I=p(_)&&g(_.image)===!1,Z=y(_.image,I,!1,f),re=g(Z)||a,he=s.convert(_.format);let ee=s.convert(_.type),A=T(_.internalFormat,he,ee);q(j,_,re);let Q;const ce=_.mipmaps;if(_.isDepthTexture)A=6402,a?_.type===dn?A=36012:_.type===Qr?A=33190:_.type===Xi?A=35056:A=33189:_.type===dn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),_.format===pi&&A===6402&&_.type!==es&&_.type!==Qr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),_.type=es,ee=s.convert(_.type)),_.format===Qi&&A===6402&&(A=34041,_.type!==Xi&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),_.type=Xi,ee=s.convert(_.type))),n.texImage2D(3553,0,A,Z.width,Z.height,0,he,ee,null);else if(_.isDataTexture)if(ce.length>0&&re){for(let ne=0,de=ce.length;ne<de;ne++)Q=ce[ne],n.texImage2D(3553,ne,A,Q.width,Q.height,0,he,ee,Q.data);_.generateMipmaps=!1,M.__maxMipLevel=ce.length-1}else n.texImage2D(3553,0,A,Z.width,Z.height,0,he,ee,Z.data),M.__maxMipLevel=0;else if(_.isCompressedTexture){for(let ne=0,de=ce.length;ne<de;ne++)Q=ce[ne],_.format!==Pt&&_.format!==Pn?he!==null?n.compressedTexImage2D(3553,ne,A,Q.width,Q.height,0,Q.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,ne,A,Q.width,Q.height,0,he,ee,Q.data);M.__maxMipLevel=ce.length-1}else if(_.isDataTexture2DArray)n.texImage3D(35866,0,A,Z.width,Z.height,Z.depth,0,he,ee,Z.data),M.__maxMipLevel=0;else if(_.isDataTexture3D)n.texImage3D(32879,0,A,Z.width,Z.height,Z.depth,0,he,ee,Z.data),M.__maxMipLevel=0;else if(ce.length>0&&re){for(let ne=0,de=ce.length;ne<de;ne++)Q=ce[ne],n.texImage2D(3553,ne,A,he,ee,Q);_.generateMipmaps=!1,M.__maxMipLevel=ce.length-1}else n.texImage2D(3553,0,A,he,ee,Z),M.__maxMipLevel=0;L(_,re)&&R(j,_,Z.width,Z.height),M.__version=_.version,_.onUpdate&&_.onUpdate(_)}function ge(M,_,Y){if(_.image.length!==6)return;J(M,_),n.activeTexture(33984+Y),n.bindTexture(34067,M.__webglTexture),t.pixelStorei(37440,_.flipY);const j=_&&(_.isCompressedTexture||_.image[0].isCompressedTexture),I=_.image[0]&&_.image[0].isDataTexture,Z=[];for(let ne=0;ne<6;ne++)!j&&!I?Z[ne]=y(_.image[ne],!1,!0,l):Z[ne]=I?_.image[ne].image:_.image[ne];const re=Z[0],he=g(re)||a,ee=s.convert(_.format),A=s.convert(_.type),Q=T(_.internalFormat,ee,A);q(34067,_,he);let ce;if(j){for(let ne=0;ne<6;ne++){ce=Z[ne].mipmaps;for(let de=0;de<ce.length;de++){const Oe=ce[de];_.format!==Pt&&_.format!==Pn?ee!==null?n.compressedTexImage2D(34069+ne,de,Q,Oe.width,Oe.height,0,Oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+ne,de,Q,Oe.width,Oe.height,0,ee,A,Oe.data)}}M.__maxMipLevel=ce.length-1}else{ce=_.mipmaps;for(let ne=0;ne<6;ne++)if(I){n.texImage2D(34069+ne,0,Q,Z[ne].width,Z[ne].height,0,ee,A,Z[ne].data);for(let de=0;de<ce.length;de++){const Ye=ce[de].image[ne].image;n.texImage2D(34069+ne,de+1,Q,Ye.width,Ye.height,0,ee,A,Ye.data)}}else{n.texImage2D(34069+ne,0,Q,ee,A,Z[ne]);for(let de=0;de<ce.length;de++){const Oe=ce[de];n.texImage2D(34069+ne,de+1,Q,ee,A,Oe.image[ne])}}M.__maxMipLevel=ce.length}L(_,he)&&R(34067,_,re.width,re.height),M.__version=_.version,_.onUpdate&&_.onUpdate(_)}function Re(M,_,Y,j){const I=s.convert(_.texture.format),Z=s.convert(_.texture.type),re=T(_.texture.internalFormat,I,Z);n.texImage2D(j,0,re,_.width,_.height,0,I,Z,null),t.bindFramebuffer(36160,M),t.framebufferTexture2D(36160,Y,j,i.get(_.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function k(M,_,Y){if(t.bindRenderbuffer(36161,M),_.depthBuffer&&!_.stencilBuffer){let j=33189;if(Y){const I=_.depthTexture;I&&I.isDepthTexture&&(I.type===dn?j=36012:I.type===Qr&&(j=33190));const Z=_e(_);t.renderbufferStorageMultisample(36161,Z,j,_.width,_.height)}else t.renderbufferStorage(36161,j,_.width,_.height);t.framebufferRenderbuffer(36160,36096,36161,M)}else if(_.depthBuffer&&_.stencilBuffer){if(Y){const j=_e(_);t.renderbufferStorageMultisample(36161,j,35056,_.width,_.height)}else t.renderbufferStorage(36161,34041,_.width,_.height);t.framebufferRenderbuffer(36160,33306,36161,M)}else{const j=s.convert(_.texture.format),I=s.convert(_.texture.type),Z=T(_.texture.internalFormat,j,I);if(Y){const re=_e(_);t.renderbufferStorageMultisample(36161,re,Z,_.width,_.height)}else t.renderbufferStorage(36161,Z,_.width,_.height)}t.bindRenderbuffer(36161,null)}function Le(M,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,M),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(_.depthTexture).__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),D(_.depthTexture,0);const j=i.get(_.depthTexture).__webglTexture;if(_.depthTexture.format===pi)t.framebufferTexture2D(36160,36096,3553,j,0);else if(_.depthTexture.format===Qi)t.framebufferTexture2D(36160,33306,3553,j,0);else throw new Error("Unknown depthTexture format")}function ue(M){const _=i.get(M),Y=M.isWebGLCubeRenderTarget===!0;if(M.depthTexture){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");Le(_.__webglFramebuffer,M)}else if(Y){_.__webglDepthbuffer=[];for(let j=0;j<6;j++)t.bindFramebuffer(36160,_.__webglFramebuffer[j]),_.__webglDepthbuffer[j]=t.createRenderbuffer(),k(_.__webglDepthbuffer[j],M,!1)}else t.bindFramebuffer(36160,_.__webglFramebuffer),_.__webglDepthbuffer=t.createRenderbuffer(),k(_.__webglDepthbuffer,M,!1);t.bindFramebuffer(36160,null)}function Se(M){const _=i.get(M),Y=i.get(M.texture);M.addEventListener("dispose",U),Y.__webglTexture=t.createTexture(),o.memory.textures++;const j=M.isWebGLCubeRenderTarget===!0,I=M.isWebGLMultisampleRenderTarget===!0,Z=g(M)||a;if(a&&M.texture.format===Pn&&(M.texture.type===dn||M.texture.type===ts)&&(M.texture.format=Pt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),j){_.__webglFramebuffer=[];for(let re=0;re<6;re++)_.__webglFramebuffer[re]=t.createFramebuffer()}else if(_.__webglFramebuffer=t.createFramebuffer(),I)if(a){_.__webglMultisampledFramebuffer=t.createFramebuffer(),_.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,_.__webglColorRenderbuffer);const re=s.convert(M.texture.format),he=s.convert(M.texture.type),ee=T(M.texture.internalFormat,re,he),A=_e(M);t.renderbufferStorageMultisample(36161,A,ee,M.width,M.height),t.bindFramebuffer(36160,_.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,_.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),M.depthBuffer&&(_.__webglDepthRenderbuffer=t.createRenderbuffer(),k(_.__webglDepthRenderbuffer,M,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(j){n.bindTexture(34067,Y.__webglTexture),q(34067,M.texture,Z);for(let re=0;re<6;re++)Re(_.__webglFramebuffer[re],M,36064,34069+re);L(M.texture,Z)&&R(34067,M.texture,M.width,M.height),n.bindTexture(34067,null)}else n.bindTexture(3553,Y.__webglTexture),q(3553,M.texture,Z),Re(_.__webglFramebuffer,M,36064,3553),L(M.texture,Z)&&R(3553,M.texture,M.width,M.height),n.bindTexture(3553,null);M.depthBuffer&&ue(M)}function xe(M){const _=M.texture,Y=g(M)||a;if(L(_,Y)){const j=M.isWebGLCubeRenderTarget?34067:3553,I=i.get(_).__webglTexture;n.bindTexture(j,I),R(j,_,M.width,M.height),n.bindTexture(j,null)}}function Pe(M){if(M.isWebGLMultisampleRenderTarget)if(a){const _=i.get(M);t.bindFramebuffer(36008,_.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,_.__webglFramebuffer);const Y=M.width,j=M.height;let I=16384;M.depthBuffer&&(I|=256),M.stencilBuffer&&(I|=1024),t.blitFramebuffer(0,0,Y,j,0,0,Y,j,I,9728),t.bindFramebuffer(36160,_.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function _e(M){return a&&M.isWebGLMultisampleRenderTarget?Math.min(h,M.samples):0}function X(M){const _=o.render.frame;d.get(M)!==_&&(d.set(M,_),M.update())}let $=!1,te=!1;function fe(M,_){M&&M.isWebGLRenderTarget&&($===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),$=!0),M=M.texture),D(M,_)}function se(M,_){M&&M.isWebGLCubeRenderTarget&&(te===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),te=!0),M=M.texture),F(M,_)}this.allocateTextureUnit=N,this.resetTextureUnits=O,this.setTexture2D=D,this.setTexture2DArray=C,this.setTexture3D=w,this.setTextureCube=F,this.setupRenderTarget=Se,this.updateRenderTargetMipmap=xe,this.updateMultisampleRenderTarget=Pe,this.safeSetTexture2D=fe,this.safeSetTextureCube=se}function Nm(t,e,n){const i=n.isWebGL2;function r(s){let o;if(s===Ho)return 5121;if(s===vh)return 32819;if(s===yh)return 32820;if(s===xh)return 33635;if(s===ph)return 5120;if(s===mh)return 5122;if(s===es)return 5123;if(s===gh)return 5124;if(s===Qr)return 5125;if(s===dn)return 5126;if(s===ts)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===_h)return 6406;if(s===Pn)return 6407;if(s===Pt)return 6408;if(s===bh)return 6409;if(s===wh)return 6410;if(s===pi)return 6402;if(s===Qi)return 34041;if(s===Mh)return 6403;if(s===Sh)return 36244;if(s===Eh)return 33319;if(s===Th)return 33320;if(s===Ah)return 36248;if(s===Lh)return 36249;if(s===ha||s===ua||s===fa||s===da)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===ha)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===ua)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===fa)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===da)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===pa||s===ma||s===ga||s===va)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===pa)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ma)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ga)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===va)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Rh)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===ya||s===xa)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===ya)return o.COMPRESSED_RGB8_ETC2;if(s===xa)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===Ch||s===Ph||s===Ih||s===Nh||s===Dh||s===Oh||s===Fh||s===Bh||s===Uh||s===zh||s===Hh||s===kh||s===Gh||s===Vh||s===jh||s===qh||s===Xh||s===Yh||s===Zh||s===Jh||s===Kh||s===Qh||s===$h||s===eu||s===tu||s===nu||s===iu||s===ru)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===Wh)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===Xi)return i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:r}}function ho(t=[]){Ke.call(this),this.cameras=t}ho.prototype=Object.assign(Object.create(Ke.prototype),{constructor:ho,isArrayCamera:!0});function fi(){ve.call(this),this.type="Group"}fi.prototype=Object.assign(Object.create(ve.prototype),{constructor:fi,isGroup:!0});function Zi(){this._targetRay=null,this._grip=null,this._hand=null}Object.assign(Zi.prototype,{constructor:Zi,getHandSpace:function(){if(this._hand===null&&(this._hand=new fi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let t=0;t<=window.XRHand.LITTLE_PHALANX_TIP;t++){const e=new fi;e.matrixAutoUpdate=!1,e.visible=!1,this._hand.joints.push(e),this._hand.add(e)}return this._hand},getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new fi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new fi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this},update:function(t,e,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred")if(c&&t.hand){s=!0;for(let l=0;l<=window.XRHand.LITTLE_PHALANX_TIP;l++)if(t.hand[l]){const f=e.getJointPose(t.hand[l],n),h=c.joints[l];f!==null&&(h.matrix.fromArray(f.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.jointRadius=f.radius),h.visible=f!==null;const d=c.joints[window.XRHand.INDEX_PHALANX_TIP],u=c.joints[window.XRHand.THUMB_PHALANX_TIP],m=d.position.distanceTo(u.position),v=.02,y=.005;c.inputState.pinching&&m>v+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&m<=v-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}}else o!==null&&(i=e.getPose(t.targetRaySpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),a!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return o!==null&&(o.visible=i!==null),a!==null&&(a.visible=r!==null),c!==null&&(c.visible=s!==null),this}});function tl(t,e){const n=this;let i=null,r=1,s=null,o="local-floor",a=null;const c=[],l=new Map,f=new Ke;f.layers.enable(1),f.viewport=new Be;const h=new Ke;h.layers.enable(2),h.viewport=new Be;const d=[f,h],u=new ho;u.layers.enable(1),u.layers.enable(2);let m=null,v=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(S){let O=c[S];return O===void 0&&(O=new Zi,c[S]=O),O.getTargetRaySpace()},this.getControllerGrip=function(S){let O=c[S];return O===void 0&&(O=new Zi,c[S]=O),O.getGripSpace()},this.getHand=function(S){let O=c[S];return O===void 0&&(O=new Zi,c[S]=O),O.getHandSpace()};function y(S){const O=l.get(S.inputSource);O&&O.dispatchEvent({type:S.type,data:S.inputSource})}function g(){l.forEach(function(S,O){S.disconnect(O)}),l.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),ae.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function p(S){s=S,ae.setContext(i),ae.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}this.setFramebufferScaleFactor=function(S){r=S,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(S){o=S,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return i},this.setSession=function(S){if(i=S,i!==null){i.addEventListener("select",y),i.addEventListener("selectstart",y),i.addEventListener("selectend",y),i.addEventListener("squeeze",y),i.addEventListener("squeezestart",y),i.addEventListener("squeezeend",y),i.addEventListener("end",g);const O=e.getContextAttributes();O.xrCompatible!==!0&&e.makeXRCompatible();const N={antialias:O.antialias,alpha:O.alpha,depth:O.depth,stencil:O.stencil,framebufferScaleFactor:r},D=new XRWebGLLayer(i,e,N);i.updateRenderState({baseLayer:D}),i.requestReferenceSpace(o).then(p),i.addEventListener("inputsourceschange",L)}};function L(S){const O=i.inputSources;for(let N=0;N<c.length;N++)l.set(O[N],c[N]);for(let N=0;N<S.removed.length;N++){const D=S.removed[N],C=l.get(D);C&&(C.dispatchEvent({type:"disconnected",data:D}),l.delete(D))}for(let N=0;N<S.added.length;N++){const D=S.added[N],C=l.get(D);C&&C.dispatchEvent({type:"connected",data:D})}}const R=new E,T=new E;function x(S,O,N){R.setFromMatrixPosition(O.matrixWorld),T.setFromMatrixPosition(N.matrixWorld);const D=R.distanceTo(T),C=O.projectionMatrix.elements,w=N.projectionMatrix.elements,F=C[14]/(C[10]-1),z=C[14]/(C[10]+1),V=(C[9]+1)/C[5],q=(C[9]-1)/C[5],J=(C[8]-1)/C[0],le=(w[8]+1)/w[0],ge=F*J,Re=F*le,k=D/(-J+le),Le=k*-J;O.matrixWorld.decompose(S.position,S.quaternion,S.scale),S.translateX(Le),S.translateZ(k),S.matrixWorld.compose(S.position,S.quaternion,S.scale),S.matrixWorldInverse.copy(S.matrixWorld).invert();const ue=F+k,Se=z+k,xe=ge-Le,Pe=Re+(D-Le),_e=V*z/Se*ue,X=q*z/Se*ue;S.projectionMatrix.makePerspective(xe,Pe,_e,X,ue,Se)}function P(S,O){O===null?S.matrixWorld.copy(S.matrix):S.matrixWorld.multiplyMatrices(O.matrixWorld,S.matrix),S.matrixWorldInverse.copy(S.matrixWorld).invert()}this.getCamera=function(S){u.near=h.near=f.near=S.near,u.far=h.far=f.far=S.far,(m!==u.near||v!==u.far)&&(i.updateRenderState({depthNear:u.near,depthFar:u.far}),m=u.near,v=u.far);const O=S.parent,N=u.cameras;P(u,O);for(let C=0;C<N.length;C++)P(N[C],O);S.matrixWorld.copy(u.matrixWorld);const D=S.children;for(let C=0,w=D.length;C<w;C++)D[C].updateMatrixWorld(!0);return N.length===2?x(u,f,h):u.projectionMatrix.copy(f.projectionMatrix),u};let U=null;function K(S,O){if(a=O.getViewerPose(s),a!==null){const D=a.views,C=i.renderState.baseLayer;t.setFramebuffer(C.framebuffer);let w=!1;D.length!==u.cameras.length&&(u.cameras.length=0,w=!0);for(let F=0;F<D.length;F++){const z=D[F],V=C.getViewport(z),q=d[F];q.matrix.fromArray(z.transform.matrix),q.projectionMatrix.fromArray(z.projectionMatrix),q.viewport.set(V.x,V.y,V.width,V.height),F===0&&u.matrix.copy(q.matrix),w===!0&&u.cameras.push(q)}}const N=i.inputSources;for(let D=0;D<c.length;D++){const C=c[D],w=N[D];C.update(w,O,s)}U&&U(S,O)}const ae=new qc;ae.setAnimationLoop(K),this.setAnimationLoop=function(S){U=S},this.dispose=function(){}}Object.assign(tl.prototype,Nt.prototype);function Dm(t){function e(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function n(g,p,L,R){p.isMeshBasicMaterial?i(g,p):p.isMeshLambertMaterial?(i(g,p),c(g,p)):p.isMeshToonMaterial?(i(g,p),f(g,p)):p.isMeshPhongMaterial?(i(g,p),l(g,p)):p.isMeshStandardMaterial?(i(g,p),p.isMeshPhysicalMaterial?d(g,p):h(g,p)):p.isMeshMatcapMaterial?(i(g,p),u(g,p)):p.isMeshDepthMaterial?(i(g,p),m(g,p)):p.isMeshDistanceMaterial?(i(g,p),v(g,p)):p.isMeshNormalMaterial?(i(g,p),y(g,p)):p.isLineBasicMaterial?(r(g,p),p.isLineDashedMaterial&&s(g,p)):p.isPointsMaterial?o(g,p,L,R):p.isSpriteMaterial?a(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function i(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.specularMap&&(g.specularMap.value=p.specularMap);const L=t.get(p).envMap;if(L){g.envMap.value=L,g.flipEnvMap.value=L.isCubeTexture&&L._needsFlipEnvMap?-1:1,g.reflectivity.value=p.reflectivity,g.refractionRatio.value=p.refractionRatio;const x=t.get(L).__maxMipLevel;x!==void 0&&(g.maxMipLevel.value=x)}p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let R;p.map?R=p.map:p.specularMap?R=p.specularMap:p.displacementMap?R=p.displacementMap:p.normalMap?R=p.normalMap:p.bumpMap?R=p.bumpMap:p.roughnessMap?R=p.roughnessMap:p.metalnessMap?R=p.metalnessMap:p.alphaMap?R=p.alphaMap:p.emissiveMap?R=p.emissiveMap:p.clearcoatMap?R=p.clearcoatMap:p.clearcoatNormalMap?R=p.clearcoatNormalMap:p.clearcoatRoughnessMap&&(R=p.clearcoatRoughnessMap),R!==void 0&&(R.isWebGLRenderTarget&&(R=R.texture),R.matrixAutoUpdate===!0&&R.updateMatrix(),g.uvTransform.value.copy(R.matrix));let T;p.aoMap?T=p.aoMap:p.lightMap&&(T=p.lightMap),T!==void 0&&(T.isWebGLRenderTarget&&(T=T.texture),T.matrixAutoUpdate===!0&&T.updateMatrix(),g.uv2Transform.value.copy(T.matrix))}function r(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function s(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function o(g,p,L,R){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*L,g.scale.value=R*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap);let T;p.map?T=p.map:p.alphaMap&&(T=p.alphaMap),T!==void 0&&(T.matrixAutoUpdate===!0&&T.updateMatrix(),g.uvTransform.value.copy(T.matrix))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap);let L;p.map?L=p.map:p.alphaMap&&(L=p.alphaMap),L!==void 0&&(L.matrixAutoUpdate===!0&&L.updateMatrix(),g.uvTransform.value.copy(L.matrix))}function c(g,p){p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap)}function l(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===$e&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===$e&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function f(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===$e&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===$e&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function h(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===$e&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===$e&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),t.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function d(g,p){h(g,p),g.reflectivity.value=p.reflectivity,g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.sheen&&g.sheen.value.copy(p.sheen),p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===$e&&g.clearcoatNormalScale.value.negate()),g.transmission.value=p.transmission,p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap)}function u(g,p){p.matcap&&(g.matcap.value=p.matcap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===$e&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===$e&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function m(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function v(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}function y(g,p){p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===$e&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===$e&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:n}}function Om(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}function gr(t){t=t||{};const e=t.canvas!==void 0?t.canvas:Om(),n=t.context!==void 0?t.context:null,i=t.alpha!==void 0?t.alpha:!1,r=t.depth!==void 0?t.depth:!0,s=t.stencil!==void 0?t.stencil:!0,o=t.antialias!==void 0?t.antialias:!1,a=t.premultipliedAlpha!==void 0?t.premultipliedAlpha:!0,c=t.preserveDrawingBuffer!==void 0?t.preserveDrawingBuffer:!1,l=t.powerPreference!==void 0?t.powerPreference:"default",f=t.failIfMajorPerformanceCaveat!==void 0?t.failIfMajorPerformanceCaveat:!1;let h=null,d=null;this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=dr,this.physicallyCorrectLights=!1,this.toneMapping=qi,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const u=this;let m=!1,v=null,y=0,g=0,p=null,L=null,R=-1,T=null,x=null;const P=new Be,U=new Be;let K=null,ae=e.width,S=e.height,O=1,N=null,D=null;const C=new Be(0,0,ae,S),w=new Be(0,0,ae,S);let F=!1;const z=new xs;let V=!1,q=!1;const J=new Ee,le=new E,ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Re(){return p===null?O:1}let k=n;function Le(b,H){for(let B=0;B<b.length;B++){const G=b[B],oe=e.getContext(G,H);if(oe!==null)return oe}return null}try{const b={alpha:i,depth:r,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:f};if(e.addEventListener("webglcontextlost",Oe,!1),e.addEventListener("webglcontextrestored",Ye,!1),k===null){const H=["webgl2","webgl","experimental-webgl"];if(u.isWebGL1Renderer===!0&&H.shift(),k=Le(H,b),k===null)throw Le(H)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}k.getShaderPrecisionFormat===void 0&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(b){throw console.error("THREE.WebGLRenderer: "+b.message),b}let ue,Se,xe,Pe,_e,X,$,te,fe,se,M,_,Y,j,I,Z,re,he,ee,A,Q;function ce(){ue=new fp(k),Se=new lp(k,ue,t),Se.isWebGL2===!1&&(ue.get("WEBGL_depth_texture"),ue.get("OES_texture_float"),ue.get("OES_texture_half_float"),ue.get("OES_texture_half_float_linear"),ue.get("OES_standard_derivatives"),ue.get("OES_element_index_uint"),ue.get("OES_vertex_array_object"),ue.get("ANGLE_instanced_arrays")),ue.get("OES_texture_float_linear"),A=new Nm(k,ue,Se),xe=new Pm(k,ue,Se),xe.scissor(U.copy(w).multiplyScalar(O).floor()),xe.viewport(P.copy(C).multiplyScalar(O).floor()),Pe=new mp,_e=new xm,X=new Im(k,ue,xe,_e,Se,A,Pe),$=new up(u),te=new Fu(k,Se),Q=new ap(k,ue,te,Se),fe=new dp(k,te,Pe,Q),se=new xp(k,fe,te,Pe),re=new yp(k),I=new hp(_e),M=new ym(u,$,ue,Se,Q,I),_=new Dm(_e),Y=new wm(_e),j=new Lm(ue,Se),Z=new op(u,$,xe,se,a),he=new cp(k,ue,Pe,Se),ee=new pp(k,ue,Pe,Se),Pe.programs=M.programs,u.capabilities=Se,u.extensions=ue,u.properties=_e,u.renderLists=Y,u.state=xe,u.info=Pe}ce();const ne=new tl(u,k);this.xr=ne;const de=new el(u,se,Se.maxTextureSize);this.shadowMap=de,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const b=ue.get("WEBGL_lose_context");b&&b.loseContext()},this.forceContextRestore=function(){const b=ue.get("WEBGL_lose_context");b&&b.restoreContext()},this.getPixelRatio=function(){return O},this.setPixelRatio=function(b){b!==void 0&&(O=b,this.setSize(ae,S,!1))},this.getSize=function(b){return b===void 0&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),b=new W),b.set(ae,S)},this.setSize=function(b,H,B){if(ne.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ae=b,S=H,e.width=Math.floor(b*O),e.height=Math.floor(H*O),B!==!1&&(e.style.width=b+"px",e.style.height=H+"px"),this.setViewport(0,0,b,H)},this.getDrawingBufferSize=function(b){return b===void 0&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),b=new W),b.set(ae*O,S*O).floor()},this.setDrawingBufferSize=function(b,H,B){ae=b,S=H,O=B,e.width=Math.floor(b*B),e.height=Math.floor(H*B),this.setViewport(0,0,b,H)},this.getCurrentViewport=function(b){return b===void 0&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),b=new Be),b.copy(P)},this.getViewport=function(b){return b.copy(C)},this.setViewport=function(b,H,B,G){b.isVector4?C.set(b.x,b.y,b.z,b.w):C.set(b,H,B,G),xe.viewport(P.copy(C).multiplyScalar(O).floor())},this.getScissor=function(b){return b.copy(w)},this.setScissor=function(b,H,B,G){b.isVector4?w.set(b.x,b.y,b.z,b.w):w.set(b,H,B,G),xe.scissor(U.copy(w).multiplyScalar(O).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(b){xe.setScissorTest(F=b)},this.setOpaqueSort=function(b){N=b},this.setTransparentSort=function(b){D=b},this.getClearColor=function(){return Z.getClearColor()},this.setClearColor=function(){Z.setClearColor.apply(Z,arguments)},this.getClearAlpha=function(){return Z.getClearAlpha()},this.setClearAlpha=function(){Z.setClearAlpha.apply(Z,arguments)},this.clear=function(b,H,B){let G=0;(b===void 0||b)&&(G|=16384),(H===void 0||H)&&(G|=256),(B===void 0||B)&&(G|=1024),k.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Oe,!1),e.removeEventListener("webglcontextrestored",Ye,!1),Y.dispose(),j.dispose(),_e.dispose(),$.dispose(),se.dispose(),Q.dispose(),ne.dispose(),Ci.stop()};function Oe(b){b.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function Ye(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1,ce()}function Ri(b){const H=b.target;H.removeEventListener("dispose",Ri),Et(H)}function Et(b){yt(b),_e.remove(b)}function yt(b){const H=_e.get(b).program;H!==void 0&&M.releaseProgram(H)}function gl(b,H){b.render(function(B){u.renderBufferImmediate(B,H)})}this.renderBufferImmediate=function(b,H){Q.initAttributes();const B=_e.get(b);b.hasPositions&&!B.position&&(B.position=k.createBuffer()),b.hasNormals&&!B.normal&&(B.normal=k.createBuffer()),b.hasUvs&&!B.uv&&(B.uv=k.createBuffer()),b.hasColors&&!B.color&&(B.color=k.createBuffer());const G=H.getAttributes();b.hasPositions&&(k.bindBuffer(34962,B.position),k.bufferData(34962,b.positionArray,35048),Q.enableAttribute(G.position),k.vertexAttribPointer(G.position,3,5126,!1,0,0)),b.hasNormals&&(k.bindBuffer(34962,B.normal),k.bufferData(34962,b.normalArray,35048),Q.enableAttribute(G.normal),k.vertexAttribPointer(G.normal,3,5126,!1,0,0)),b.hasUvs&&(k.bindBuffer(34962,B.uv),k.bufferData(34962,b.uvArray,35048),Q.enableAttribute(G.uv),k.vertexAttribPointer(G.uv,2,5126,!1,0,0)),b.hasColors&&(k.bindBuffer(34962,B.color),k.bufferData(34962,b.colorArray,35048),Q.enableAttribute(G.color),k.vertexAttribPointer(G.color,3,5126,!1,0,0)),Q.disableUnusedAttributes(),k.drawArrays(4,0,b.count),b.count=0},this.renderBufferDirect=function(b,H,B,G,oe,Ie){H===null&&(H=ge);const Te=oe.isMesh&&oe.matrixWorld.determinant()<0,Ne=Yo(b,H,G,oe);xe.setMaterial(G,Te);let Ae=B.index;const Xe=B.attributes.position;if(Ae===null){if(Xe===void 0||Xe.count===0)return}else if(Ae.count===0)return;let qe=1;G.wireframe===!0&&(Ae=fe.getWireframeAttribute(B),qe=2),(G.morphTargets||G.morphNormals)&&re.update(oe,B,G,Ne),Q.setup(oe,G,Ne,B,Ae);let Me,ze=he;Ae!==null&&(Me=te.get(Ae),ze=ee,ze.setIndex(Me));const Wt=Ae!==null?Ae.count:Xe.count,He=B.drawRange.start*qe,Sn=B.drawRange.count*qe,Ze=Ie!==null?Ie.start*qe:0,ws=Ie!==null?Ie.count*qe:1/0,ct=Math.max(He,Ze),Pi=Math.min(Wt,He+Sn,Ze+ws)-1,kn=Math.max(0,Pi-ct+1);if(kn!==0){if(oe.isMesh)G.wireframe===!0?(xe.setLineWidth(G.wireframeLinewidth*Re()),ze.setMode(1)):ze.setMode(4);else if(oe.isLine){let Ii=G.linewidth;Ii===void 0&&(Ii=1),xe.setLineWidth(Ii*Re()),oe.isLineSegments?ze.setMode(1):oe.isLineLoop?ze.setMode(2):ze.setMode(3)}else oe.isPoints?ze.setMode(0):oe.isSprite&&ze.setMode(4);if(oe.isInstancedMesh)ze.renderInstances(ct,kn,oe.count);else if(B.isInstancedBufferGeometry){const Ii=Math.min(B.instanceCount,B._maxInstanceCount);ze.renderInstances(ct,kn,Ii)}else ze.render(ct,kn)}},this.compile=function(b,H){d=j.get(b,H),d.init(),b.traverseVisible(function(G){G.isLight&&G.layers.test(H.layers)&&(d.pushLight(G),G.castShadow&&d.pushShadow(G))}),d.setupLights(H);const B=new WeakMap;b.traverse(function(G){const oe=G.material;if(oe)if(Array.isArray(oe))for(let Ie=0;Ie<oe.length;Ie++){const Te=oe[Ie];B.has(Te)===!1&&(Vt(Te,b,G),B.set(Te))}else B.has(oe)===!1&&(Vt(oe,b,G),B.set(oe))})};let bs=null;function vl(b){ne.isPresenting||bs&&bs(b)}const Ci=new qc;Ci.setAnimationLoop(vl),typeof window<"u"&&Ci.setContext(window),this.setAnimationLoop=function(b){bs=b,ne.setAnimationLoop(b),b===null?Ci.stop():Ci.start()},this.render=function(b,H){let B,G;if(arguments[2]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),B=arguments[2]),arguments[3]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),G=arguments[3]),H!==void 0&&H.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(m===!0)return;Q.resetDefaultState(),R=-1,T=null,b.autoUpdate===!0&&b.updateMatrixWorld(),H.parent===null&&H.updateMatrixWorld(),ne.enabled===!0&&ne.isPresenting===!0&&(H=ne.getCamera(H)),b.isScene===!0&&b.onBeforeRender(u,b,H,B||p),d=j.get(b,H),d.init(),J.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),z.setFromProjectionMatrix(J),q=this.localClippingEnabled,V=I.init(this.clippingPlanes,q,H),h=Y.get(b,H),h.init(),jo(b,H,0,u.sortObjects),h.finish(),u.sortObjects===!0&&h.sort(N,D),V===!0&&I.beginShadows();const oe=d.state.shadowsArray;de.render(oe,b,H),d.setupLights(H),V===!0&&I.endShadows(),this.info.autoReset===!0&&this.info.reset(),B!==void 0&&this.setRenderTarget(B),Z.render(h,b,H,G);const Ie=h.opaque,Te=h.transparent;Ie.length>0&&qo(Ie,b,H),Te.length>0&&qo(Te,b,H),b.isScene===!0&&b.onAfterRender(u,b,H),p!==null&&(X.updateRenderTargetMipmap(p),X.updateMultisampleRenderTarget(p)),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1),h=null,d=null};function jo(b,H,B,G){if(b.visible===!1)return;if(b.layers.test(H.layers)){if(b.isGroup)B=b.renderOrder;else if(b.isLOD)b.autoUpdate===!0&&b.update(H);else if(b.isLight)d.pushLight(b),b.castShadow&&d.pushShadow(b);else if(b.isSprite){if(!b.frustumCulled||z.intersectsSprite(b)){G&&le.setFromMatrixPosition(b.matrixWorld).applyMatrix4(J);const Te=se.update(b),Ne=b.material;Ne.visible&&h.push(b,Te,Ne,B,le.z,null)}}else if(b.isImmediateRenderObject)G&&le.setFromMatrixPosition(b.matrixWorld).applyMatrix4(J),h.push(b,null,b.material,B,le.z,null);else if((b.isMesh||b.isLine||b.isPoints)&&(b.isSkinnedMesh&&b.skeleton.frame!==Pe.render.frame&&(b.skeleton.update(),b.skeleton.frame=Pe.render.frame),!b.frustumCulled||z.intersectsObject(b))){G&&le.setFromMatrixPosition(b.matrixWorld).applyMatrix4(J);const Te=se.update(b),Ne=b.material;if(Array.isArray(Ne)){const Ae=Te.groups;for(let Xe=0,qe=Ae.length;Xe<qe;Xe++){const Me=Ae[Xe],ze=Ne[Me.materialIndex];ze&&ze.visible&&h.push(b,Te,ze,B,le.z,Me)}}else Ne.visible&&h.push(b,Te,Ne,B,le.z,null)}}const Ie=b.children;for(let Te=0,Ne=Ie.length;Te<Ne;Te++)jo(Ie[Te],H,B,G)}function qo(b,H,B){const G=H.isScene===!0?H.overrideMaterial:null;for(let oe=0,Ie=b.length;oe<Ie;oe++){const Te=b[oe],Ne=Te.object,Ae=Te.geometry,Xe=G===null?Te.material:G,qe=Te.group;if(B.isArrayCamera){x=B;const Me=B.cameras;for(let ze=0,Wt=Me.length;ze<Wt;ze++){const He=Me[ze];Ne.layers.test(He.layers)&&(xe.viewport(P.copy(He.viewport)),d.setupLights(He),Xo(Ne,H,He,Ae,Xe,qe))}}else x=null,Xo(Ne,H,B,Ae,Xe,qe)}}function Xo(b,H,B,G,oe,Ie){if(b.onBeforeRender(u,H,B,G,oe,Ie),d=j.get(H,x||B),b.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,b.matrixWorld),b.normalMatrix.getNormalMatrix(b.modelViewMatrix),b.isImmediateRenderObject){const Te=Yo(B,H,oe,b);xe.setMaterial(oe),Q.reset(),gl(b,Te)}else u.renderBufferDirect(B,H,G,oe,b,Ie);b.onAfterRender(u,H,B,G,oe,Ie),d=j.get(H,x||B)}function Vt(b,H,B){H.isScene!==!0&&(H=ge);const G=_e.get(b),oe=d.state.lights,Ie=d.state.shadowsArray,Te=oe.state.version,Ne=M.getParameters(b,oe.state,Ie,H,B),Ae=M.getProgramCacheKey(Ne);let Xe=G.program,qe=!0;if(Xe===void 0)b.addEventListener("dispose",Ri);else if(Xe.cacheKey!==Ae)yt(b);else if(G.lightsStateVersion!==Te)qe=!1;else if(Ne.shaderID!==void 0){const He=b.isMeshStandardMaterial?H.environment:null;G.envMap=$.get(b.envMap||He);return}else qe=!1;qe&&(Ne.uniforms=M.getUniforms(b),b.onBeforeCompile(Ne,u),Xe=M.acquireProgram(Ne,Ae),G.program=Xe,G.uniforms=Ne.uniforms,G.outputEncoding=Ne.outputEncoding);const Me=G.uniforms;(!b.isShaderMaterial&&!b.isRawShaderMaterial||b.clipping===!0)&&(G.numClippingPlanes=I.numPlanes,G.numIntersection=I.numIntersection,Me.clippingPlanes=I.uniform),G.environment=b.isMeshStandardMaterial?H.environment:null,G.fog=H.fog,G.envMap=$.get(b.envMap||G.environment),G.needsLights=xl(b),G.lightsStateVersion=Te,G.needsLights&&(Me.ambientLightColor.value=oe.state.ambient,Me.lightProbe.value=oe.state.probe,Me.directionalLights.value=oe.state.directional,Me.directionalLightShadows.value=oe.state.directionalShadow,Me.spotLights.value=oe.state.spot,Me.spotLightShadows.value=oe.state.spotShadow,Me.rectAreaLights.value=oe.state.rectArea,Me.ltc_1.value=oe.state.rectAreaLTC1,Me.ltc_2.value=oe.state.rectAreaLTC2,Me.pointLights.value=oe.state.point,Me.pointLightShadows.value=oe.state.pointShadow,Me.hemisphereLights.value=oe.state.hemi,Me.directionalShadowMap.value=oe.state.directionalShadowMap,Me.directionalShadowMatrix.value=oe.state.directionalShadowMatrix,Me.spotShadowMap.value=oe.state.spotShadowMap,Me.spotShadowMatrix.value=oe.state.spotShadowMatrix,Me.pointShadowMap.value=oe.state.pointShadowMap,Me.pointShadowMatrix.value=oe.state.pointShadowMatrix);const ze=G.program.getUniforms(),Wt=gn.seqWithValue(ze.seq,Me);G.uniformsList=Wt}function Yo(b,H,B,G){H.isScene!==!0&&(H=ge),X.resetTextureUnits();const oe=H.fog,Ie=B.isMeshStandardMaterial?H.environment:null,Te=p===null?u.outputEncoding:p.texture.encoding,Ne=$.get(B.envMap||Ie),Ae=_e.get(B),Xe=d.state.lights;if(V===!0&&(q===!0||b!==T)){const Ze=b===T&&B.id===R;I.setState(B,b,Ze)}B.version===Ae.__version?(B.fog&&Ae.fog!==oe||Ae.environment!==Ie||Ae.needsLights&&Ae.lightsStateVersion!==Xe.state.version||Ae.numClippingPlanes!==void 0&&(Ae.numClippingPlanes!==I.numPlanes||Ae.numIntersection!==I.numIntersection)||Ae.outputEncoding!==Te||Ae.envMap!==Ne)&&Vt(B,H,G):(Vt(B,H,G),Ae.__version=B.version);let qe=!1,Me=!1,ze=!1;const Wt=Ae.program,He=Wt.getUniforms(),Sn=Ae.uniforms;if(xe.useProgram(Wt.program)&&(qe=!0,Me=!0,ze=!0),B.id!==R&&(R=B.id,Me=!0),qe||T!==b){if(He.setValue(k,"projectionMatrix",b.projectionMatrix),Se.logarithmicDepthBuffer&&He.setValue(k,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2)),T!==b&&(T=b,Me=!0,ze=!0),B.isShaderMaterial||B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshStandardMaterial||B.envMap){const Ze=He.map.cameraPosition;Ze!==void 0&&Ze.setValue(k,le.setFromMatrixPosition(b.matrixWorld))}(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&He.setValue(k,"isOrthographic",b.isOrthographicCamera===!0),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial||B.isShadowMaterial||B.skinning)&&He.setValue(k,"viewMatrix",b.matrixWorldInverse)}if(B.skinning){He.setOptional(k,G,"bindMatrix"),He.setOptional(k,G,"bindMatrixInverse");const Ze=G.skeleton;if(Ze){const ws=Ze.bones;if(Se.floatVertexTextures){if(Ze.boneTexture===null){let ct=Math.sqrt(ws.length*4);ct=we.ceilPowerOfTwo(ct),ct=Math.max(ct,4);const Pi=new Float32Array(ct*ct*4);Pi.set(Ze.boneMatrices);const kn=new yi(Pi,ct,ct,Pt,dn);Ze.boneMatrices=Pi,Ze.boneTexture=kn,Ze.boneTextureSize=ct}He.setValue(k,"boneTexture",Ze.boneTexture,X),He.setValue(k,"boneTextureSize",Ze.boneTextureSize)}else He.setOptional(k,Ze,"boneMatrices")}}return(Me||Ae.receiveShadow!==G.receiveShadow)&&(Ae.receiveShadow=G.receiveShadow,He.setValue(k,"receiveShadow",G.receiveShadow)),Me&&(He.setValue(k,"toneMappingExposure",u.toneMappingExposure),Ae.needsLights&&yl(Sn,ze),oe&&B.fog&&_.refreshFogUniforms(Sn,oe),_.refreshMaterialUniforms(Sn,B,O,S),gn.upload(k,Ae.uniformsList,Sn,X)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(gn.upload(k,Ae.uniformsList,Sn,X),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&He.setValue(k,"center",G.center),He.setValue(k,"modelViewMatrix",G.modelViewMatrix),He.setValue(k,"normalMatrix",G.normalMatrix),He.setValue(k,"modelMatrix",G.matrixWorld),Wt}function yl(b,H){b.ambientLightColor.needsUpdate=H,b.lightProbe.needsUpdate=H,b.directionalLights.needsUpdate=H,b.directionalLightShadows.needsUpdate=H,b.pointLights.needsUpdate=H,b.pointLightShadows.needsUpdate=H,b.spotLights.needsUpdate=H,b.spotLightShadows.needsUpdate=H,b.rectAreaLights.needsUpdate=H,b.hemisphereLights.needsUpdate=H}function xl(b){return b.isMeshLambertMaterial||b.isMeshToonMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isShadowMaterial||b.isShaderMaterial&&b.lights===!0}this.setFramebuffer=function(b){v!==b&&p===null&&k.bindFramebuffer(36160,b),v=b},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return g},this.getRenderList=function(){return h},this.setRenderList=function(b){h=b},this.getRenderState=function(){return d},this.setRenderState=function(b){d=b},this.getRenderTarget=function(){return p},this.setRenderTarget=function(b,H=0,B=0){p=b,y=H,g=B,b&&_e.get(b).__webglFramebuffer===void 0&&X.setupRenderTarget(b);let G=v,oe=!1;if(b){const Ie=_e.get(b).__webglFramebuffer;b.isWebGLCubeRenderTarget?(G=Ie[H],oe=!0):b.isWebGLMultisampleRenderTarget?G=_e.get(b).__webglMultisampledFramebuffer:G=Ie,P.copy(b.viewport),U.copy(b.scissor),K=b.scissorTest}else P.copy(C).multiplyScalar(O).floor(),U.copy(w).multiplyScalar(O).floor(),K=F;if(L!==G&&(k.bindFramebuffer(36160,G),L=G),xe.viewport(P),xe.scissor(U),xe.setScissorTest(K),oe){const Ie=_e.get(b.texture);k.framebufferTexture2D(36160,36064,34069+H,Ie.__webglTexture,B)}},this.readRenderTargetPixels=function(b,H,B,G,oe,Ie,Te){if(!(b&&b.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=_e.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&Te!==void 0&&(Ne=Ne[Te]),Ne){let Ae=!1;Ne!==L&&(k.bindFramebuffer(36160,Ne),Ae=!0);try{const Xe=b.texture,qe=Xe.format,Me=Xe.type;if(qe!==Pt&&A.convert(qe)!==k.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Me!==Ho&&A.convert(Me)!==k.getParameter(35738)&&!(Me===dn&&(Se.isWebGL2||ue.get("OES_texture_float")||ue.get("WEBGL_color_buffer_float")))&&!(Me===ts&&(Se.isWebGL2?ue.get("EXT_color_buffer_float"):ue.get("EXT_color_buffer_half_float")))){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k.checkFramebufferStatus(36160)===36053?H>=0&&H<=b.width-G&&B>=0&&B<=b.height-oe&&k.readPixels(H,B,G,oe,A.convert(qe),A.convert(Me),Ie):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{Ae&&k.bindFramebuffer(36160,L)}}},this.copyFramebufferToTexture=function(b,H,B=0){const G=Math.pow(2,-B),oe=Math.floor(H.image.width*G),Ie=Math.floor(H.image.height*G),Te=A.convert(H.format);X.setTexture2D(H,0),k.copyTexImage2D(3553,B,Te,b.x,b.y,oe,Ie,0),xe.unbindTexture()},this.copyTextureToTexture=function(b,H,B,G=0){const oe=H.image.width,Ie=H.image.height,Te=A.convert(B.format),Ne=A.convert(B.type);X.setTexture2D(B,0),k.pixelStorei(37440,B.flipY),k.pixelStorei(37441,B.premultiplyAlpha),k.pixelStorei(3317,B.unpackAlignment),H.isDataTexture?k.texSubImage2D(3553,G,b.x,b.y,oe,Ie,Te,Ne,H.image.data):H.isCompressedTexture?k.compressedTexSubImage2D(3553,G,b.x,b.y,H.mipmaps[0].width,H.mipmaps[0].height,Te,H.mipmaps[0].data):k.texSubImage2D(3553,G,b.x,b.y,Te,Ne,H.image),G===0&&B.generateMipmaps&&k.generateMipmap(3553),xe.unbindTexture()},this.initTexture=function(b){X.setTexture2D(b,0),xe.unbindTexture()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function qa(t){gr.call(this,t)}qa.prototype=Object.assign(Object.create(gr.prototype),{constructor:qa,isWebGL1Renderer:!0});class nl extends ve{constructor(){super(),Object.defineProperty(this,"isScene",{value:!0}),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.background!==null&&(n.object.background=this.background.toJSON(e)),this.environment!==null&&(n.object.environment=this.environment.toJSON(e)),this.fog!==null&&(n.object.fog=this.fog.toJSON()),n}}function xt(t,e){this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=ys,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=we.generateUUID()}Object.defineProperty(xt.prototype,"needsUpdate",{set:function(t){t===!0&&this.version++}});Object.assign(xt.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e=0){return this.array.set(t,e),this},clone:function(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=we.generateUUID()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new xt(e,this.stride);return n.setUsage(this.usage),n},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=we.generateUUID()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const Rn=new E;function On(t,e,n,i){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i===!0}Object.defineProperties(On.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}});Object.assign(On.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(let e=0,n=this.data.count;e<n;e++)Rn.x=this.getX(e),Rn.y=this.getY(e),Rn.z=this.getZ(e),Rn.applyMatrix4(t),this.setXYZ(e,Rn.x,Rn.y,Rn.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this},clone:function(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[i+r])}return new be(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new On(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}});function Fn(t){ye.call(this),this.type="SpriteMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}Fn.prototype=Object.create(ye.prototype);Fn.prototype.constructor=Fn;Fn.prototype.isSpriteMaterial=!0;Fn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};let ni;const Ui=new E,ii=new E,ri=new E,si=new W,zi=new W,il=new Ee,Or=new E,Hi=new E,Fr=new E,Xa=new W,qs=new W,Ya=new W;function Za(t){if(ve.call(this),this.type="Sprite",ni===void 0){ni=new Fe;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new xt(e,5);ni.setIndex([0,1,2,0,2,3]),ni.setAttribute("position",new On(n,3,0,!1)),ni.setAttribute("uv",new On(n,2,3,!1))}this.geometry=ni,this.material=t!==void 0?t:new Fn,this.center=new W(.5,.5)}Za.prototype=Object.assign(Object.create(ve.prototype),{constructor:Za,isSprite:!0,raycast:function(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ii.setFromMatrixScale(this.matrixWorld),il.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),ri.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ii.multiplyScalar(-ri.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;Br(Or.set(-.5,-.5,0),ri,s,ii,i,r),Br(Hi.set(.5,-.5,0),ri,s,ii,i,r),Br(Fr.set(.5,.5,0),ri,s,ii,i,r),Xa.set(0,0),qs.set(1,0),Ya.set(1,1);let o=t.ray.intersectTriangle(Or,Hi,Fr,!1,Ui);if(o===null&&(Br(Hi.set(-.5,.5,0),ri,s,ii,i,r),qs.set(0,1),o=t.ray.intersectTriangle(Or,Fr,Hi,!1,Ui),o===null))return;const a=t.ray.origin.distanceTo(Ui);a<t.near||a>t.far||e.push({distance:a,point:Ui.clone(),uv:nt.getUV(Ui,Or,Hi,Fr,Xa,qs,Ya,new W),face:null,object:this})},copy:function(t){return ve.prototype.copy.call(this,t),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}});function Br(t,e,n,i,r,s){si.subVectors(t,n).addScalar(.5).multiply(i),r!==void 0?(zi.x=s*si.x-r*si.y,zi.y=r*si.x+s*si.y):zi.copy(si),t.copy(e),t.x+=zi.x,t.y+=zi.y,t.applyMatrix4(il)}const Ur=new E,Ja=new E;function uo(){ve.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}uo.prototype=Object.assign(Object.create(ve.prototype),{constructor:uo,isLOD:!0,copy:function(t){ve.prototype.copy.call(this,t,!1);const e=t.levels;for(let n=0,i=e.length;n<i;n++){const r=e[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=t.autoUpdate,this},addLevel:function(t,e=0){e=Math.abs(e);const n=this.levels;let i;for(i=0;i<n.length&&!(e<n[i].distance);i++);return n.splice(i,0,{distance:e,object:t}),this.add(t),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object}return null},raycast:function(t,e){if(this.levels.length>0){Ur.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(Ur);this.getObjectForDistance(i).raycast(t,e)}},update:function(t){const e=this.levels;if(e.length>1){Ur.setFromMatrixPosition(t.matrixWorld),Ja.setFromMatrixPosition(this.matrixWorld);const n=Ur.distanceTo(Ja)/t.zoom;e[0].object.visible=!0;let i,r;for(i=1,r=e.length;i<r&&n>=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}},toJSON:function(t){const e=ve.prototype.toJSON.call(this,t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const s=n[i];e.object.levels.push({object:s.object.uuid,distance:s.distance})}return e}});function fo(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),et.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ee,this.bindMatrixInverse=new Ee}fo.prototype=Object.assign(Object.create(et.prototype),{constructor:fo,isSkinnedMesh:!0,copy:function(t){return et.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const t=new Be,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){et.prototype.updateMatrixWorld.call(this,t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(){const t=new E,e=new Be,n=new Be,i=new E,r=new Ee;return function(s,o){const a=this.skeleton,c=this.geometry;e.fromBufferAttribute(c.attributes.skinIndex,s),n.fromBufferAttribute(c.attributes.skinWeight,s),t.fromBufferAttribute(c.attributes.position,s).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(let l=0;l<4;l++){const f=n.getComponent(l);if(f!==0){const h=e.getComponent(l);r.multiplyMatrices(a.bones[h].matrixWorld,a.boneInverses[h]),o.addScaledVector(i.copy(t).applyMatrix4(r),f)}}return o.applyMatrix4(this.bindMatrixInverse)}}()});function po(){ve.call(this),this.type="Bone"}po.prototype=Object.assign(Object.create(ve.prototype),{constructor:po,isBone:!0});const Ka=new Ee,Fm=new Ee;function mo(t=[],e=[]){this.uuid=we.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}Object.assign(mo.prototype,{init:function(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.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 Ee)}},calculateInverses:function(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const n=new Ee;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}},pose:function(){for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];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:function(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,s=t.length;r<s;r++){const o=t[r]?t[r].matrixWorld:Fm;Ka.multiplyMatrices(o,e[r]),Ka.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)},clone:function(){return new mo(this.bones,this.boneInverses)},getBoneByName:function(t){for(let e=0,n=this.bones.length;e<n;e++){const i=this.bones[e];if(i.name===t)return i}},dispose:function(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)},fromJSON:function(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const r=t.bones[n];let s=e[r];s===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),s=new po),this.bones.push(s),this.boneInverses.push(new Ee().fromArray(t.boneInverses[n]))}return this.init(),this},toJSON:function(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const s=e[i];t.bones.push(s.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}});const Qa=new Ee,$a=new Ee,zr=[],ki=new et;function ec(t,e,n){et.call(this,t,e),this.instanceMatrix=new be(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}ec.prototype=Object.assign(Object.create(et.prototype),{constructor:ec,isInstancedMesh:!0,copy:function(t){return et.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,t*3)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,t*16)},raycast:function(t,e){const n=this.matrixWorld,i=this.count;if(ki.geometry=this.geometry,ki.material=this.material,ki.material!==void 0)for(let r=0;r<i;r++){this.getMatrixAt(r,Qa),$a.multiplyMatrices(n,Qa),ki.matrixWorld=$a,ki.raycast(t,zr);for(let s=0,o=zr.length;s<o;s++){const a=zr[s];a.instanceId=r,a.object=this,e.push(a)}zr.length=0}},setColorAt:function(t,e){this.instanceColor===null&&(this.instanceColor=new be(new Float32Array(this.count*3),3)),e.toArray(this.instanceColor.array,t*3)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,t*16)},updateMorphTargets:function(){}});function Mt(t){ye.call(this),this.type="LineBasicMaterial",this.color=new pe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}Mt.prototype=Object.create(ye.prototype);Mt.prototype.constructor=Mt;Mt.prototype.isLineBasicMaterial=!0;Mt.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this};const tc=new E,nc=new E,ic=new Ee,Hr=new pr,kr=new Mn;function xi(t,e,n){n===1&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),ve.call(this),this.type="Line",this.geometry=t!==void 0?t:new Fe,this.material=e!==void 0?e:new Mt,this.updateMorphTargets()}xi.prototype=Object.assign(Object.create(ve.prototype),{constructor:xi,isLine:!0,copy:function(t){return ve.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const e=t.attributes.position,n=[0];for(let i=1,r=e.count;i<r;i++)tc.fromBufferAttribute(e,i-1),nc.fromBufferAttribute(e,i),n[i]=n[i-1],n[i]+=tc.distanceTo(nc);t.setAttribute("lineDistance",new De(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){const e=t.vertices,n=t.lineDistances;n[0]=0;for(let i=1,r=e.length;i<r;i++)n[i]=n[i-1],n[i]+=e[i-1].distanceTo(e[i])}return this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),kr.copy(n.boundingSphere),kr.applyMatrix4(i),kr.radius+=r,t.ray.intersectsSphere(kr)===!1)return;ic.copy(i).invert(),Hr.copy(t.ray).applyMatrix4(ic);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,a=new E,c=new E,l=new E,f=new E,h=this.isLineSegments?2:1;if(n.isBufferGeometry){const d=n.index,m=n.attributes.position;if(d!==null){const v=d.array;for(let y=0,g=v.length-1;y<g;y+=h){const p=v[y],L=v[y+1];if(a.fromBufferAttribute(m,p),c.fromBufferAttribute(m,L),Hr.distanceSqToSegment(a,c,f,l)>o)continue;f.applyMatrix4(this.matrixWorld);const T=t.ray.origin.distanceTo(f);T<t.near||T>t.far||e.push({distance:T,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(let v=0,y=m.count-1;v<y;v+=h){if(a.fromBufferAttribute(m,v),c.fromBufferAttribute(m,v+1),Hr.distanceSqToSegment(a,c,f,l)>o)continue;f.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(f);p<t.near||p>t.far||e.push({distance:p,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){const d=n.vertices,u=d.length;for(let m=0;m<u-1;m+=h){if(Hr.distanceSqToSegment(d[m],d[m+1],f,l)>o)continue;f.applyMatrix4(this.matrixWorld);const y=t.ray.origin.distanceTo(f);y<t.near||y>t.far||e.push({distance:y,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}else{const e=t.morphTargets;e!==void 0&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Gr=new E,Vr=new E;function ss(t,e){xi.call(this,t,e),this.type="LineSegments"}ss.prototype=Object.assign(Object.create(xi.prototype),{constructor:ss,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const e=t.attributes.position,n=[];for(let i=0,r=e.count;i<r;i+=2)Gr.fromBufferAttribute(e,i),Vr.fromBufferAttribute(e,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Gr.distanceTo(Vr);t.setAttribute("lineDistance",new De(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){const e=t.vertices,n=t.lineDistances;for(let i=0,r=e.length;i<r;i+=2)Gr.copy(e[i]),Vr.copy(e[i+1]),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Gr.distanceTo(Vr)}return this}});function rc(t,e){xi.call(this,t,e),this.type="LineLoop"}rc.prototype=Object.assign(Object.create(xi.prototype),{constructor:rc,isLineLoop:!0});function Bn(t){ye.call(this),this.type="PointsMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}Bn.prototype=Object.create(ye.prototype);Bn.prototype.constructor=Bn;Bn.prototype.isPointsMaterial=!0;Bn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this};const sc=new Ee,go=new pr,Wr=new Mn,jr=new E;function oc(t,e){ve.call(this),this.type="Points",this.geometry=t!==void 0?t:new Fe,this.material=e!==void 0?e:new Bn,this.updateMorphTargets()}oc.prototype=Object.assign(Object.create(ve.prototype),{constructor:oc,isPoints:!0,copy:function(t){return ve.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),Wr.copy(n.boundingSphere),Wr.applyMatrix4(i),Wr.radius+=r,t.ray.intersectsSphere(Wr)===!1)return;sc.copy(i).invert(),go.copy(t.ray).applyMatrix4(sc);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const a=n.index,l=n.attributes.position;if(a!==null){const f=a.array;for(let h=0,d=f.length;h<d;h++){const u=f[h];jr.fromBufferAttribute(l,u),Xs(jr,u,o,i,t,e,this)}}else for(let f=0,h=l.count;f<h;f++)jr.fromBufferAttribute(l,f),Xs(jr,f,o,i,t,e,this)}else{const a=n.vertices;for(let c=0,l=a.length;c<l;c++)Xs(a[c],c,o,i,t,e,this)}},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}else{const e=t.morphTargets;e!==void 0&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});function Xs(t,e,n,i,r,s,o){const a=go.distanceSqToPoint(t);if(a<n){const c=new E;go.closestPointToPoint(t,c),c.applyMatrix4(i);const l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}function ac(t,e,n,i,r,s,o,a,c){Ge.call(this,t,e,n,i,r,s,o,a,c),this.format=o!==void 0?o:Pn,this.minFilter=s!==void 0?s:it,this.magFilter=r!==void 0?r:it,this.generateMipmaps=!1;const l=this;function f(){l.needsUpdate=!0,t.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(f)}ac.prototype=Object.assign(Object.create(Ge.prototype),{constructor:ac,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});function rr(t,e,n,i,r,s,o,a,c,l,f,h){Ge.call(this,null,s,o,a,c,l,i,r,f,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}rr.prototype=Object.create(Ge.prototype);rr.prototype.constructor=rr;rr.prototype.isCompressedTexture=!0;function os(t,e,n,i,r,s,o,a,c){Ge.call(this,t,e,n,i,r,s,o,a,c),this.needsUpdate=!0}os.prototype=Object.create(Ge.prototype);os.prototype.constructor=os;os.prototype.isCanvasTexture=!0;function as(t,e,n,i,r,s,o,a,c,l){if(l=l!==void 0?l:pi,l!==pi&&l!==Qi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&l===pi&&(n=es),n===void 0&&l===Qi&&(n=Xi),Ge.call(this,null,i,r,s,o,a,l,n,c),this.image={width:t,height:e},this.magFilter=o!==void 0?o:st,this.minFilter=a!==void 0?a:st,this.flipY=!1,this.generateMipmaps=!1}as.prototype=Object.create(Ge.prototype);as.prototype.constructor=as;as.prototype.isDepthTexture=!0;let Bm=0;const Ot=new Ee,Ys=new ve,qr=new E;function _t(){Object.defineProperty(this,"id",{value:Bm+=2}),this.uuid=we.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}_t.prototype=Object.assign(Object.create(Nt.prototype),{constructor:_t,isGeometry:!0,applyMatrix4:function(t){const e=new ht().getNormalMatrix(t);for(let n=0,i=this.vertices.length;n<i;n++)this.vertices[n].applyMatrix4(t);for(let n=0,i=this.faces.length;n<i;n++){const r=this.faces[n];r.normal.applyMatrix3(e).normalize();for(let s=0,o=r.vertexNormals.length;s<o;s++)r.vertexNormals[s].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return Ot.makeRotationX(t),this.applyMatrix4(Ot),this},rotateY:function(t){return Ot.makeRotationY(t),this.applyMatrix4(Ot),this},rotateZ:function(t){return Ot.makeRotationZ(t),this.applyMatrix4(Ot),this},translate:function(t,e,n){return Ot.makeTranslation(t,e,n),this.applyMatrix4(Ot),this},scale:function(t,e,n){return Ot.makeScale(t,e,n),this.applyMatrix4(Ot),this},lookAt:function(t){return Ys.lookAt(t),Ys.updateMatrix(),this.applyMatrix4(Ys.matrix),this},fromBufferGeometry:function(t){const e=this,n=t.index!==null?t.index:void 0,i=t.attributes;if(i.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const r=i.position,s=i.normal,o=i.color,a=i.uv,c=i.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let h=0;h<r.count;h++)e.vertices.push(new E().fromBufferAttribute(r,h)),o!==void 0&&e.colors.push(new pe().fromBufferAttribute(o,h));function l(h,d,u,m){const v=o===void 0?[]:[e.colors[h].clone(),e.colors[d].clone(),e.colors[u].clone()],y=s===void 0?[]:[new E().fromBufferAttribute(s,h),new E().fromBufferAttribute(s,d),new E().fromBufferAttribute(s,u)],g=new no(h,d,u,y,v,m);e.faces.push(g),a!==void 0&&e.faceVertexUvs[0].push([new W().fromBufferAttribute(a,h),new W().fromBufferAttribute(a,d),new W().fromBufferAttribute(a,u)]),c!==void 0&&e.faceVertexUvs[1].push([new W().fromBufferAttribute(c,h),new W().fromBufferAttribute(c,d),new W().fromBufferAttribute(c,u)])}const f=t.groups;if(f.length>0)for(let h=0;h<f.length;h++){const d=f[h],u=d.start,m=d.count;for(let v=u,y=u+m;v<y;v+=3)n!==void 0?l(n.getX(v),n.getX(v+1),n.getX(v+2),d.materialIndex):l(v,v+1,v+2,d.materialIndex)}else if(n!==void 0)for(let h=0;h<n.count;h+=3)l(n.getX(h),n.getX(h+1),n.getX(h+2));else for(let h=0;h<r.count;h+=3)l(h,h+1,h+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(qr).negate(),this.translate(qr.x,qr.y,qr.z),this},normalize:function(){this.computeBoundingSphere();const t=this.boundingSphere.center,e=this.boundingSphere.radius,n=e===0?1:1/e,i=new Ee;return i.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){const t=new E,e=new E;for(let n=0,i=this.faces.length;n<i;n++){const r=this.faces[n],s=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c];t.subVectors(a,o),e.subVectors(s,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t=!0){const e=new Array(this.vertices.length);for(let n=0,i=this.vertices.length;n<i;n++)e[n]=new E;if(t){const n=new E,i=new E;for(let r=0,s=this.faces.length;r<s;r++){const o=this.faces[r],a=this.vertices[o.a],c=this.vertices[o.b],l=this.vertices[o.c];n.subVectors(l,c),i.subVectors(a,c),n.cross(i),e[o.a].add(n),e[o.b].add(n),e[o.c].add(n)}}else{this.computeFaceNormals();for(let n=0,i=this.faces.length;n<i;n++){const r=this.faces[n];e[r.a].add(r.normal),e[r.b].add(r.normal),e[r.c].add(r.normal)}}for(let n=0,i=this.vertices.length;n<i;n++)e[n].normalize();for(let n=0,i=this.faces.length;n<i;n++){const r=this.faces[n],s=r.vertexNormals;s.length===3?(s[0].copy(e[r.a]),s[1].copy(e[r.b]),s[2].copy(e[r.c])):(s[0]=e[r.a].clone(),s[1]=e[r.b].clone(),s[2]=e[r.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t<e;t++){const n=this.faces[t],i=n.vertexNormals;i.length===3?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,n=this.faces.length;e<n;e++){const i=this.faces[e];i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]);for(let r=0,s=i.vertexNormals.length;r<s;r++)i.__originalVertexNormals[r]?i.__originalVertexNormals[r].copy(i.vertexNormals[r]):i.__originalVertexNormals[r]=i.vertexNormals[r].clone()}const t=new _t;t.faces=this.faces;for(let e=0,n=this.morphTargets.length;e<n;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];const r=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(let o=0,a=this.faces.length;o<a;o++){const c=new E,l={a:new E,b:new E,c:new E};r.push(c),s.push(l)}}const i=this.morphNormals[e];t.vertices=this.morphTargets[e].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let r=0,s=this.faces.length;r<s;r++){const o=this.faces[r],a=i.faceNormals[r],c=i.vertexNormals[r];a.copy(o.normal),c.a.copy(o.vertexNormals[0]),c.b.copy(o.vertexNormals[1]),c.c.copy(o.vertexNormals[2])}}for(let e=0,n=this.faces.length;e<n;e++){const i=this.faces[e];i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals}},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new wn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new Mn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n=0){if(!(t&&t.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);return}let i;const r=this.vertices.length,s=this.vertices,o=t.vertices,a=this.faces,c=t.faces,l=this.colors,f=t.colors;e!==void 0&&(i=new ht().getNormalMatrix(e));for(let h=0,d=o.length;h<d;h++){const m=o[h].clone();e!==void 0&&m.applyMatrix4(e),s.push(m)}for(let h=0,d=f.length;h<d;h++)l.push(f[h].clone());for(let h=0,d=c.length;h<d;h++){const u=c[h];let m,v;const y=u.vertexNormals,g=u.vertexColors,p=new no(u.a+r,u.b+r,u.c+r);p.normal.copy(u.normal),i!==void 0&&p.normal.applyMatrix3(i).normalize();for(let L=0,R=y.length;L<R;L++)m=y[L].clone(),i!==void 0&&m.applyMatrix3(i).normalize(),p.vertexNormals.push(m);p.color.copy(u.color);for(let L=0,R=g.length;L<R;L++)v=g[L],p.vertexColors.push(v.clone());p.materialIndex=u.materialIndex+n,a.push(p)}for(let h=0,d=t.faceVertexUvs.length;h<d;h++){const u=t.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(let m=0,v=u.length;m<v;m++){const y=u[m],g=[];for(let p=0,L=y.length;p<L;p++)g.push(y[p].clone());this.faceVertexUvs[h].push(g)}}},mergeMesh:function(t){if(!(t&&t.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);return}t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)},mergeVertices:function(t=4){const e={},n=[],i=[],r=Math.pow(10,t);for(let a=0,c=this.vertices.length;a<c;a++){const l=this.vertices[a],f=Math.round(l.x*r)+"_"+Math.round(l.y*r)+"_"+Math.round(l.z*r);e[f]===void 0?(e[f]=a,n.push(this.vertices[a]),i[a]=n.length-1):i[a]=i[e[f]]}const s=[];for(let a=0,c=this.faces.length;a<c;a++){const l=this.faces[a];l.a=i[l.a],l.b=i[l.b],l.c=i[l.c];const f=[l.a,l.b,l.c];for(let h=0;h<3;h++)if(f[h]===f[(h+1)%3]){s.push(a);break}}for(let a=s.length-1;a>=0;a--){const c=s[a];this.faces.splice(c,1);for(let l=0,f=this.faceVertexUvs.length;l<f;l++)this.faceVertexUvs[l].splice(c,1)}const o=this.vertices.length-n.length;return this.vertices=n,o},setFromPoints:function(t){this.vertices=[];for(let e=0,n=t.length;e<n;e++){const i=t[e];this.vertices.push(new E(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){const t=this.faces,e=t.length;for(let a=0;a<e;a++)t[a]._id=a;function n(a,c){return a.materialIndex-c.materialIndex}t.sort(n);const i=this.faceVertexUvs[0],r=this.faceVertexUvs[1];let s,o;i&&i.length===e&&(s=[]),r&&r.length===e&&(o=[]);for(let a=0;a<e;a++){const c=t[a]._id;s&&s.push(i[c]),o&&o.push(r[c])}s&&(this.faceVertexUvs[0]=s),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){const t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.parameters!==void 0){const u=this.parameters;for(const m in u)u[m]!==void 0&&(t[m]=u[m]);return t}const e=[];for(let u=0;u<this.vertices.length;u++){const m=this.vertices[u];e.push(m.x,m.y,m.z)}const n=[],i=[],r={},s=[],o={},a=[],c={};for(let u=0;u<this.faces.length;u++){const m=this.faces[u],v=!0,y=!1,g=this.faceVertexUvs[0][u]!==void 0,p=m.normal.length()>0,L=m.vertexNormals.length>0,R=m.color.r!==1||m.color.g!==1||m.color.b!==1,T=m.vertexColors.length>0;let x=0;if(x=l(x,0,0),x=l(x,1,v),x=l(x,2,y),x=l(x,3,g),x=l(x,4,p),x=l(x,5,L),x=l(x,6,R),x=l(x,7,T),n.push(x),n.push(m.a,m.b,m.c),n.push(m.materialIndex),g){const P=this.faceVertexUvs[0][u];n.push(d(P[0]),d(P[1]),d(P[2]))}if(p&&n.push(f(m.normal)),L){const P=m.vertexNormals;n.push(f(P[0]),f(P[1]),f(P[2]))}if(R&&n.push(h(m.color)),T){const P=m.vertexColors;n.push(h(P[0]),h(P[1]),h(P[2]))}}function l(u,m,v){return v?u|1<<m:u&~(1<<m)}function f(u){const m=u.x.toString()+u.y.toString()+u.z.toString();return r[m]!==void 0||(r[m]=i.length/3,i.push(u.x,u.y,u.z)),r[m]}function h(u){const m=u.r.toString()+u.g.toString()+u.b.toString();return o[m]!==void 0||(o[m]=s.length,s.push(u.getHex())),o[m]}function d(u){const m=u.x.toString()+u.y.toString();return c[m]!==void 0||(c[m]=a.length/2,a.push(u.x,u.y)),c[m]}return t.data={},t.data.vertices=e,t.data.normals=i,s.length>0&&(t.data.colors=s),a.length>0&&(t.data.uvs=[a]),t.data.faces=n,t},clone:function(){return new _t().copy(this)},copy:function(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;const e=t.vertices;for(let h=0,d=e.length;h<d;h++)this.vertices.push(e[h].clone());const n=t.colors;for(let h=0,d=n.length;h<d;h++)this.colors.push(n[h].clone());const i=t.faces;for(let h=0,d=i.length;h<d;h++)this.faces.push(i[h].clone());for(let h=0,d=t.faceVertexUvs.length;h<d;h++){const u=t.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(let m=0,v=u.length;m<v;m++){const y=u[m],g=[];for(let p=0,L=y.length;p<L;p++){const R=y[p];g.push(R.clone())}this.faceVertexUvs[h].push(g)}}const r=t.morphTargets;for(let h=0,d=r.length;h<d;h++){const u={};if(u.name=r[h].name,r[h].vertices!==void 0){u.vertices=[];for(let m=0,v=r[h].vertices.length;m<v;m++)u.vertices.push(r[h].vertices[m].clone())}if(r[h].normals!==void 0){u.normals=[];for(let m=0,v=r[h].normals.length;m<v;m++)u.normals.push(r[h].normals[m].clone())}this.morphTargets.push(u)}const s=t.morphNormals;for(let h=0,d=s.length;h<d;h++){const u={};if(s[h].vertexNormals!==void 0){u.vertexNormals=[];for(let m=0,v=s[h].vertexNormals.length;m<v;m++){const y=s[h].vertexNormals[m],g={};g.a=y.a.clone(),g.b=y.b.clone(),g.c=y.c.clone(),u.vertexNormals.push(g)}}if(s[h].faceNormals!==void 0){u.faceNormals=[];for(let m=0,v=s[h].faceNormals.length;m<v;m++)u.faceNormals.push(s[h].faceNormals[m].clone())}this.morphNormals.push(u)}const o=t.skinWeights;for(let h=0,d=o.length;h<d;h++)this.skinWeights.push(o[h].clone());const a=t.skinIndices;for(let h=0,d=a.length;h<d;h++)this.skinIndices.push(a[h].clone());const c=t.lineDistances;for(let h=0,d=c.length;h<d;h++)this.lineDistances.push(c[h]);const l=t.boundingBox;l!==null&&(this.boundingBox=l.clone());const f=t.boundingSphere;return f!==null&&(this.boundingSphere=f.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});new E;new E;new E;new nt;const Um={triangulate:function(t,e,n){n=n||2;const i=e&&e.length,r=i?e[0]*n:t.length;let s=rl(t,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,c,l,f,h,d,u;if(i&&(s=Vm(t,e,s,n)),t.length>80*n){a=l=t[0],c=f=t[1];for(let m=n;m<r;m+=n)h=t[m],d=t[m+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>f&&(f=d);u=Math.max(l-a,f-c),u=u!==0?1/u:0}return sr(s,o,n,a,c,u),o}};function rl(t,e,n,i,r){let s,o;if(r===eg(t,e,n,i)>0)for(s=e;s<n;s+=i)o=cc(s,t[s],t[s+1],o);else for(s=n-i;s>=e;s-=i)o=cc(s,t[s],t[s+1],o);return o&&_s(o,o.next)&&(ar(o),o=o.next),o}function bn(t,e){if(!t)return t;e||(e=t);let n=t,i;do if(i=!1,!n.steiner&&(_s(n,n.next)||je(n.prev,n,n.next)===0)){if(ar(n),n=e=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==e);return e}function sr(t,e,n,i,r,s,o){if(!t)return;!o&&s&&Ym(t,i,r,s);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,s?Hm(t,i,r,s):zm(t)){e.push(c.i/n),e.push(t.i/n),e.push(l.i/n),ar(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=km(bn(t),e,n),sr(t,e,n,i,r,s,2)):o===2&&Gm(t,e,n,i,r,s):sr(bn(t),e,n,i,r,s,1);break}}}function zm(t){const e=t.prev,n=t,i=t.next;if(je(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(di(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&je(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Hm(t,e,n,i){const r=t.prev,s=t,o=t.next;if(je(r,s,o)>=0)return!1;const a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,c=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,l=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,f=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,h=vo(a,c,e,n,i),d=vo(l,f,e,n,i);let u=t.prevZ,m=t.nextZ;for(;u&&u.z>=h&&m&&m.z<=d;){if(u!==t.prev&&u!==t.next&&di(r.x,r.y,s.x,s.y,o.x,o.y,u.x,u.y)&&je(u.prev,u,u.next)>=0||(u=u.prevZ,m!==t.prev&&m!==t.next&&di(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&je(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;u&&u.z>=h;){if(u!==t.prev&&u!==t.next&&di(r.x,r.y,s.x,s.y,o.x,o.y,u.x,u.y)&&je(u.prev,u,u.next)>=0)return!1;u=u.prevZ}for(;m&&m.z<=d;){if(m!==t.prev&&m!==t.next&&di(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&je(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function km(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!_s(r,s)&&sl(r,i,i.next,s)&&or(r,s)&&or(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),ar(i),ar(i.next),i=t=s),i=i.next}while(i!==t);return bn(i)}function Gm(t,e,n,i,r,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Km(o,a)){let c=ol(o,a);o=bn(o,o.next),c=bn(c,c.next),sr(o,e,n,i,r,s),sr(c,e,n,i,r,s);return}a=a.next}o=o.next}while(o!==t)}function Vm(t,e,n,i){const r=[];let s,o,a,c,l;for(s=0,o=e.length;s<o;s++)a=e[s]*i,c=s<o-1?e[s+1]*i:t.length,l=rl(t,a,c,i,!1),l===l.next&&(l.steiner=!0),r.push(Jm(l));for(r.sort(Wm),s=0;s<r.length;s++)jm(r[s],n),n=bn(n,n.next);return n}function Wm(t,e){return t.x-e.x}function jm(t,e){if(e=qm(t,e),e){const n=ol(e,t);bn(e,e.next),bn(n,n.next)}}function qm(t,e){let n=e;const i=t.x,r=t.y;let s=-1/0,o;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const d=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(d<=i&&d>s){if(s=d,d===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(i===s)return o;const a=o,c=o.x,l=o.y;let f=1/0,h;n=o;do i>=n.x&&n.x>=c&&i!==n.x&&di(r<l?i:s,r,c,l,r<l?s:i,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(i-n.x),or(n,t)&&(h<f||h===f&&(n.x>o.x||n.x===o.x&&Xm(o,n)))&&(o=n,f=h)),n=n.next;while(n!==a);return o}function Xm(t,e){return je(t.prev,t,e.prev)<0&&je(e.next,t,t.next)<0}function Ym(t,e,n,i){let r=t;do r.z===null&&(r.z=vo(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Zm(r)}function Zm(t){let e,n,i,r,s,o,a,c,l=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e<l&&(a++,i=i.nextZ,!!i);e++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,l*=2}while(o>1);return t}function vo(t,e,n,i,r){return t=32767*(t-n)*r,e=32767*(e-i)*r,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Jm(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function di(t,e,n,i,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(i-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function Km(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Qm(t,e)&&(or(t,e)&&or(e,t)&&$m(t,e)&&(je(t.prev,t,e.prev)||je(t,e.prev,e))||_s(t,e)&&je(t.prev,t,t.next)>0&&je(e.prev,e,e.next)>0)}function je(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function _s(t,e){return t.x===e.x&&t.y===e.y}function sl(t,e,n,i){const r=Yr(je(t,e,n)),s=Yr(je(t,e,i)),o=Yr(je(n,i,t)),a=Yr(je(n,i,e));return!!(r!==s&&o!==a||r===0&&Xr(t,n,e)||s===0&&Xr(t,i,e)||o===0&&Xr(n,t,i)||a===0&&Xr(n,e,i))}function Xr(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Yr(t){return t>0?1:t<0?-1:0}function Qm(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&sl(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function or(t,e){return je(t.prev,t,t.next)<0?je(t,e,t.next)>=0&&je(t,t.prev,e)>=0:je(t,e,t.prev)<0||je(t,t.next,e)<0}function $m(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==t);return i}function ol(t,e){const n=new yo(t.i,t.x,t.y),i=new yo(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function cc(t,e,n,i){const r=new yo(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function ar(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yo(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function eg(t,e,n,i){let r=0;for(let s=e,o=n-i;s<n;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}const vn={area:function(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return n*.5},isClockWise:function(t){return vn.area(t)<0},triangulateShape:function(t,e){const n=[],i=[],r=[];lc(t),hc(n,t);let s=t.length;e.forEach(lc);for(let a=0;a<e.length;a++)i.push(s),s+=e[a].length,hc(n,e[a]);const o=Um.triangulate(n,i);for(let a=0;a<o.length;a+=3)r.push(o.slice(a,a+3));return r}};function lc(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function hc(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class al extends Fe{constructor(e,n){super(),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new De(r,3)),this.setAttribute("uv",new De(s,2)),this.computeVertexNormals();function o(a){const c=[],l=n.curveSegments!==void 0?n.curveSegments:12,f=n.steps!==void 0?n.steps:1;let h=n.depth!==void 0?n.depth:100,d=n.bevelEnabled!==void 0?n.bevelEnabled:!0,u=n.bevelThickness!==void 0?n.bevelThickness:6,m=n.bevelSize!==void 0?n.bevelSize:u-2,v=n.bevelOffset!==void 0?n.bevelOffset:0,y=n.bevelSegments!==void 0?n.bevelSegments:3;const g=n.extrudePath,p=n.UVGenerator!==void 0?n.UVGenerator:tg;n.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=n.amount);let L,R=!1,T,x,P,U;g&&(L=g.getSpacedPoints(f),R=!0,d=!1,T=g.computeFrenetFrames(f,!1),x=new E,P=new E,U=new E),d||(y=0,u=0,m=0,v=0);const K=a.extractPoints(l);let ae=K.shape;const S=K.holes;if(!vn.isClockWise(ae)){ae=ae.reverse();for(let X=0,$=S.length;X<$;X++){const te=S[X];vn.isClockWise(te)&&(S[X]=te.reverse())}}const N=vn.triangulateShape(ae,S),D=ae;for(let X=0,$=S.length;X<$;X++){const te=S[X];ae=ae.concat(te)}function C(X,$,te){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),$.clone().multiplyScalar(te).add(X)}const w=ae.length,F=N.length;function z(X,$,te){let fe,se,M;const _=X.x-$.x,Y=X.y-$.y,j=te.x-X.x,I=te.y-X.y,Z=_*_+Y*Y,re=_*I-Y*j;if(Math.abs(re)>Number.EPSILON){const he=Math.sqrt(Z),ee=Math.sqrt(j*j+I*I),A=$.x-Y/he,Q=$.y+_/he,ce=te.x-I/ee,ne=te.y+j/ee,de=((ce-A)*I-(ne-Q)*j)/(_*I-Y*j);fe=A+_*de-X.x,se=Q+Y*de-X.y;const Oe=fe*fe+se*se;if(Oe<=2)return new W(fe,se);M=Math.sqrt(Oe/2)}else{let he=!1;_>Number.EPSILON?j>Number.EPSILON&&(he=!0):_<-Number.EPSILON?j<-Number.EPSILON&&(he=!0):Math.sign(Y)===Math.sign(I)&&(he=!0),he?(fe=-Y,se=_,M=Math.sqrt(Z)):(fe=_,se=Y,M=Math.sqrt(Z/2))}return new W(fe/M,se/M)}const V=[];for(let X=0,$=D.length,te=$-1,fe=X+1;X<$;X++,te++,fe++)te===$&&(te=0),fe===$&&(fe=0),V[X]=z(D[X],D[te],D[fe]);const q=[];let J,le=V.concat();for(let X=0,$=S.length;X<$;X++){const te=S[X];J=[];for(let fe=0,se=te.length,M=se-1,_=fe+1;fe<se;fe++,M++,_++)M===se&&(M=0),_===se&&(_=0),J[fe]=z(te[fe],te[M],te[_]);q.push(J),le=le.concat(J)}for(let X=0;X<y;X++){const $=X/y,te=u*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+v;for(let se=0,M=D.length;se<M;se++){const _=C(D[se],V[se],fe);ue(_.x,_.y,-te)}for(let se=0,M=S.length;se<M;se++){const _=S[se];J=q[se];for(let Y=0,j=_.length;Y<j;Y++){const I=C(_[Y],J[Y],fe);ue(I.x,I.y,-te)}}}const ge=m+v;for(let X=0;X<w;X++){const $=d?C(ae[X],le[X],ge):ae[X];R?(P.copy(T.normals[0]).multiplyScalar($.x),x.copy(T.binormals[0]).multiplyScalar($.y),U.copy(L[0]).add(P).add(x),ue(U.x,U.y,U.z)):ue($.x,$.y,0)}for(let X=1;X<=f;X++)for(let $=0;$<w;$++){const te=d?C(ae[$],le[$],ge):ae[$];R?(P.copy(T.normals[X]).multiplyScalar(te.x),x.copy(T.binormals[X]).multiplyScalar(te.y),U.copy(L[X]).add(P).add(x),ue(U.x,U.y,U.z)):ue(te.x,te.y,h/f*X)}for(let X=y-1;X>=0;X--){const $=X/y,te=u*Math.cos($*Math.PI/2),fe=m*Math.sin($*Math.PI/2)+v;for(let se=0,M=D.length;se<M;se++){const _=C(D[se],V[se],fe);ue(_.x,_.y,h+te)}for(let se=0,M=S.length;se<M;se++){const _=S[se];J=q[se];for(let Y=0,j=_.length;Y<j;Y++){const I=C(_[Y],J[Y],fe);R?ue(I.x,I.y+L[f-1].y,L[f-1].x+te):ue(I.x,I.y,h+te)}}}Re(),k();function Re(){const X=r.length/3;if(d){let $=0,te=w*$;for(let fe=0;fe<F;fe++){const se=N[fe];Se(se[2]+te,se[1]+te,se[0]+te)}$=f+y*2,te=w*$;for(let fe=0;fe<F;fe++){const se=N[fe];Se(se[0]+te,se[1]+te,se[2]+te)}}else{for(let $=0;$<F;$++){const te=N[$];Se(te[2],te[1],te[0])}for(let $=0;$<F;$++){const te=N[$];Se(te[0]+w*f,te[1]+w*f,te[2]+w*f)}}i.addGroup(X,r.length/3-X,0)}function k(){const X=r.length/3;let $=0;Le(D,$),$+=D.length;for(let te=0,fe=S.length;te<fe;te++){const se=S[te];Le(se,$),$+=se.length}i.addGroup(X,r.length/3-X,1)}function Le(X,$){let te=X.length;for(;--te>=0;){const fe=te;let se=te-1;se<0&&(se=X.length-1);for(let M=0,_=f+y*2;M<_;M++){const Y=w*M,j=w*(M+1),I=$+fe+Y,Z=$+se+Y,re=$+se+j,he=$+fe+j;xe(I,Z,re,he)}}}function ue(X,$,te){c.push(X),c.push($),c.push(te)}function Se(X,$,te){Pe(X),Pe($),Pe(te);const fe=r.length/3,se=p.generateTopUV(i,r,fe-3,fe-2,fe-1);_e(se[0]),_e(se[1]),_e(se[2])}function xe(X,$,te,fe){Pe(X),Pe($),Pe(fe),Pe($),Pe(te),Pe(fe);const se=r.length/3,M=p.generateSideWallUV(i,r,se-6,se-3,se-2,se-1);_e(M[0]),_e(M[1]),_e(M[3]),_e(M[1]),_e(M[2]),_e(M[3])}function Pe(X){r.push(c[X*3+0]),r.push(c[X*3+1]),r.push(c[X*3+2])}function _e(X){s.push(X.x),s.push(X.y)}}}toJSON(){const e=Fe.prototype.toJSON.call(this),n=this.parameters.shapes,i=this.parameters.options;return ng(n,i,e)}}const tg={generateTopUV:function(t,e,n,i,r){const s=e[n*3],o=e[n*3+1],a=e[i*3],c=e[i*3+1],l=e[r*3],f=e[r*3+1];return[new W(s,o),new W(a,c),new W(l,f)]},generateSideWallUV:function(t,e,n,i,r,s){const o=e[n*3],a=e[n*3+1],c=e[n*3+2],l=e[i*3],f=e[i*3+1],h=e[i*3+2],d=e[r*3],u=e[r*3+1],m=e[r*3+2],v=e[s*3],y=e[s*3+1],g=e[s*3+2];return Math.abs(a-f)<.01?[new W(o,1-c),new W(l,1-h),new W(d,1-m),new W(v,1-g)]:[new W(a,1-c),new W(f,1-h),new W(u,1-m),new W(y,1-g)]}};function ng(t,e,n){if(n.shapes=[],Array.isArray(t))for(let i=0,r=t.length;i<r;i++){const s=t[i];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class ig extends _t{constructor(e,n){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:n},this.fromBufferGeometry(new al(e,n)),this.mergeVertices()}toJSON(){const e=super.toJSON(),n=this.parameters.shapes,i=this.parameters.options;return rg(n,i,e)}}function rg(t,e,n){if(n.shapes=[],Array.isArray(t))for(let i=0,r=t.length;i<r;i++){const s=t[i];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}function cs(t,e,n){Fe.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};const i=[],r=[],s=[],o=[],a=1e-5,c=new E,l=new E,f=new E,h=new E,d=new E;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const u=e+1;for(let m=0;m<=n;m++){const v=m/n;for(let y=0;y<=e;y++){const g=y/e;t(g,v,l),r.push(l.x,l.y,l.z),g-a>=0?(t(g-a,v,f),h.subVectors(l,f)):(t(g+a,v,f),h.subVectors(f,l)),v-a>=0?(t(g,v-a,f),d.subVectors(l,f)):(t(g,v+a,f),d.subVectors(f,l)),c.crossVectors(h,d).normalize(),s.push(c.x,c.y,c.z),o.push(g,v)}}for(let m=0;m<n;m++)for(let v=0;v<e;v++){const y=m*u+v,g=m*u+v+1,p=(m+1)*u+v+1,L=(m+1)*u+v;i.push(y,g,L),i.push(g,p,L)}this.setIndex(i),this.setAttribute("position",new De(r,3)),this.setAttribute("normal",new De(s,3)),this.setAttribute("uv",new De(o,2))}cs.prototype=Object.create(Fe.prototype);cs.prototype.constructor=cs;function xo(t,e,n){_t.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new cs(t,e,n)),this.mergeVertices()}xo.prototype=Object.create(_t.prototype);xo.prototype.constructor=xo;class sg extends Fe{constructor(e,n=12){super(),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:n};const i=[],r=[],s=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let f=0;f<e.length;f++)l(e[f]),this.addGroup(a,c,f),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new De(r,3)),this.setAttribute("normal",new De(s,3)),this.setAttribute("uv",new De(o,2));function l(f){const h=r.length/3,d=f.extractPoints(n);let u=d.shape;const m=d.holes;vn.isClockWise(u)===!1&&(u=u.reverse());for(let y=0,g=m.length;y<g;y++){const p=m[y];vn.isClockWise(p)===!0&&(m[y]=p.reverse())}const v=vn.triangulateShape(u,m);for(let y=0,g=m.length;y<g;y++){const p=m[y];u=u.concat(p)}for(let y=0,g=u.length;y<g;y++){const p=u[y];r.push(p.x,p.y,0),s.push(0,0,1),o.push(p.x,p.y)}for(let y=0,g=v.length;y<g;y++){const p=v[y],L=p[0]+h,R=p[1]+h,T=p[2]+h;i.push(L,R,T),c+=3}}}toJSON(){const e=Fe.prototype.toJSON.call(this),n=this.parameters.shapes;return og(n,e)}}function og(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}class ag extends _t{constructor(e,n){super(),this.type="ShapeGeometry",typeof n=="object"&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),n=n.curveSegments),this.parameters={shapes:e,curveSegments:n},this.fromBufferGeometry(new sg(e,n)),this.mergeVertices()}toJSON(){const e=_t.prototype.toJSON.call(this),n=this.parameters.shapes;return cg(n,e)}}function cg(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}class lg extends Fe{constructor(e=1,n=8,i=6,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));const c=Math.min(o+a,Math.PI);let l=0;const f=[],h=new E,d=new E,u=[],m=[],v=[],y=[];for(let g=0;g<=i;g++){const p=[],L=g/i;let R=0;g==0&&o==0?R=.5/n:g==i&&c==Math.PI&&(R=-.5/n);for(let T=0;T<=n;T++){const x=T/n;h.x=-e*Math.cos(r+x*s)*Math.sin(o+L*a),h.y=e*Math.cos(o+L*a),h.z=e*Math.sin(r+x*s)*Math.sin(o+L*a),m.push(h.x,h.y,h.z),d.copy(h).normalize(),v.push(d.x,d.y,d.z),y.push(x+R,1-L),p.push(l++)}f.push(p)}for(let g=0;g<i;g++)for(let p=0;p<n;p++){const L=f[g][p+1],R=f[g][p],T=f[g+1][p],x=f[g+1][p+1];(g!==0||o>0)&&u.push(L,R,x),(g!==i-1||c<Math.PI)&&u.push(R,T,x)}this.setIndex(u),this.setAttribute("position",new De(m,3)),this.setAttribute("normal",new De(v,3)),this.setAttribute("uv",new De(y,2))}}class hg extends _t{constructor(e,n,i,r,s,o,a){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new lg(e,n,i,r,s,o,a)),this.mergeVertices()}}function _i(t){ye.call(this),this.type="ShadowMaterial",this.color=new pe(0),this.transparent=!0,this.setValues(t)}_i.prototype=Object.create(ye.prototype);_i.prototype.constructor=_i;_i.prototype.isShadowMaterial=!0;_i.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this};function cr(t){ut.call(this,t),this.type="RawShaderMaterial"}cr.prototype=Object.create(ut.prototype);cr.prototype.constructor=cr;cr.prototype.isRawShaderMaterial=!0;function Kt(t){ye.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pe(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 pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ti,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}Kt.prototype=Object.create(ye.prototype);Kt.prototype.constructor=Kt;Kt.prototype.isMeshStandardMaterial=!0;Kt.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this};function Un(t){Kt.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new W(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(e){this.reflectivity=we.clamp(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}Un.prototype=Object.create(Kt.prototype);Un.prototype.constructor=Un;Un.prototype.isMeshPhysicalMaterial=!0;Un.prototype.copy=function(t){return Kt.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new pe).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this};function zn(t){ye.call(this),this.type="MeshPhongMaterial",this.color=new pe(16777215),this.specular=new pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ti,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=gs,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}zn.prototype=Object.create(ye.prototype);zn.prototype.constructor=zn;zn.prototype.isMeshPhongMaterial=!0;zn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};function bi(t){ye.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ti,this.normalScale=new W(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}bi.prototype=Object.create(ye.prototype);bi.prototype.constructor=bi;bi.prototype.isMeshToonMaterial=!0;bi.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};function wi(t){ye.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ti,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}wi.prototype=Object.create(ye.prototype);wi.prototype.constructor=wi;wi.prototype.isMeshNormalMaterial=!0;wi.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};function Hn(t){ye.call(this),this.type="MeshLambertMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=gs,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}Hn.prototype=Object.create(ye.prototype);Hn.prototype.constructor=Hn;Hn.prototype.isMeshLambertMaterial=!0;Hn.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};function Mi(t){ye.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ti,this.normalScale=new W(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}Mi.prototype=Object.create(ye.prototype);Mi.prototype.constructor=Mi;Mi.prototype.isMeshMatcapMaterial=!0;Mi.prototype.copy=function(t){return ye.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this};function Si(t){Mt.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}Si.prototype=Object.create(Mt.prototype);Si.prototype.constructor=Si;Si.prototype.isLineDashedMaterial=!0;Si.prototype.copy=function(t){return Mt.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var ug=Object.freeze({__proto__:null,ShadowMaterial:_i,SpriteMaterial:Fn,RawShaderMaterial:cr,ShaderMaterial:ut,PointsMaterial:Bn,MeshPhysicalMaterial:Un,MeshStandardMaterial:Kt,MeshPhongMaterial:zn,MeshToonMaterial:bi,MeshNormalMaterial:wi,MeshLambertMaterial:Hn,MeshDepthMaterial:Nn,MeshDistanceMaterial:Dn,MeshBasicMaterial:yn,MeshMatcapMaterial:Mi,LineDashedMaterial:Si,LineBasicMaterial:Mt,Material:ye});const We={arraySlice:function(t,e,n){return We.isTypedArray(t)?new t.constructor(t.subarray(e,n!==void 0?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(r,s){return t[r]-t[s]}const n=t.length,i=new Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(e),i},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,o=0;o!==i;++s){const a=n[s]*e;for(let c=0;c!==e;++c)r[o++]=t[a+c]}return r},flattenJSON:function(t,e,n,i){let r=1,s=t[0];for(;s!==void 0&&s[i]===void 0;)s=t[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),n.push(o)),s=t[r++];while(s!==void 0)},subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const o=[];for(let c=0;c<s.tracks.length;++c){const l=s.tracks[c],f=l.getValueSize(),h=[],d=[];for(let u=0;u<l.times.length;++u){const m=l.times[u]*r;if(!(m<n||m>=i)){h.push(l.times[u]);for(let v=0;v<f;++v)d.push(l.values[u*f+v])}}h.length!==0&&(l.times=We.convertArray(h,l.times.constructor),l.values=We.convertArray(d,l.values.constructor),o.push(l))}s.tracks=o;let a=1/0;for(let c=0;c<s.tracks.length;++c)a>s.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=n.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=t.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(l===void 0)continue;let f=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=h/3);let d=0;const u=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=u/3);const m=a.times.length-1;let v;if(s<=a.times[0]){const g=f,p=h-f;v=We.arraySlice(a.values,g,p)}else if(s>=a.times[m]){const g=m*h+f,p=g+h-f;v=We.arraySlice(a.values,g,p)}else{const g=a.createInterpolant(),p=f,L=h-f;g.evaluate(s),v=We.arraySlice(g.resultBuffer,p,L)}c==="quaternion"&&new ot().fromArray(v).normalize().conjugate().toArray(v);const y=l.times.length;for(let g=0;g<y;++g){const p=g*u+d;if(c==="quaternion")ot.multiplyQuaternionsFlat(l.values,p,v,0,l.values,p);else{const L=u-d*2;for(let R=0;R<L;++R)l.values[p+R]-=v[R]}}}return t.blendMode=zc,t}};function bt(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}Object.assign(bt.prototype,{evaluate:function(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];e:{t:{let s;n:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===o)break;if(r=i,i=e[++n],t<i)break t}s=e.length;break n}if(!(t>=r)){const o=e[1];t<o&&(n=2,r=o);for(let a=n-2;;){if(r===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===a)break;if(i=r,r=e[--n-1],t>=r)break t}s=n,n=0;break n}break e}for(;n<s;){const o=n+s>>>1;t<e[o]?s=o:n=o+1}if(i=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(i===void 0)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let s=0;s!==i;++s)e[s]=n[r+s];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}});Object.assign(bt.prototype,{beforeStart_:bt.prototype.copySampleValue_,afterEnd_:bt.prototype.copySampleValue_});function _o(t,e,n,i){bt.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}_o.prototype=Object.assign(Object.create(bt.prototype),{constructor:_o,DefaultSettings_:{endingStart:ai,endingEnd:ai},intervalChanged_:function(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,o=i[r],a=i[s];if(o===void 0)switch(this.getSettings_().endingStart){case ci:r=t,o=2*e-n;break;case is:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case ci:s=t,a=2*n-e;break;case is:s=1,a=n+i[1]-i[0];break;default:s=t-1,a=e}const c=(n-e)*.5,l=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(a-n),this._offsetPrev=r*l,this._offsetNext=s*l},interpolate_:function(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,c=a-o,l=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,d=this._weightNext,u=(n-e)/(i-e),m=u*u,v=m*u,y=-h*v+2*h*m-h*u,g=(1+h)*v+(-1.5-2*h)*m+(-.5+h)*u+1,p=(-1-d)*v+(1.5+d)*m+.5*u,L=d*v-d*m;for(let R=0;R!==o;++R)r[R]=y*s[l+R]+g*s[c+R]+p*s[a+R]+L*s[f+R];return r}});function ls(t,e,n,i){bt.call(this,t,e,n,i)}ls.prototype=Object.assign(Object.create(bt.prototype),{constructor:ls,interpolate_:function(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,c=a-o,l=(n-e)/(i-e),f=1-l;for(let h=0;h!==o;++h)r[h]=s[c+h]*f+s[a+h]*l;return r}});function bo(t,e,n,i){bt.call(this,t,e,n,i)}bo.prototype=Object.assign(Object.create(bt.prototype),{constructor:bo,interpolate_:function(t){return this.copySampleValue_(t-1)}});function rt(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=We.convertArray(e,this.TimeBufferType),this.values=We.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}Object.assign(rt,{toJSON:function(t){const e=t.constructor;let n;if(e.toJSON!==void 0)n=e.toJSON(t);else{n={name:t.name,times:We.convertArray(t.times,Array),values:We.convertArray(t.values,Array)};const i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}});Object.assign(rt.prototype,{constructor:rt,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:$r,InterpolantFactoryMethodDiscrete:function(t){return new bo(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new ls(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new _o(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){let e;switch(t){case ns:e=this.InterpolantFactoryMethodDiscrete;break;case $r:e=this.InterpolantFactoryMethodLinear;break;case Ms:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ns;case this.InterpolantFactoryMethodLinear:return $r;case this.InterpolantFactoryMethodSmooth:return Ms}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(t!==0){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this},scale:function(t){if(t!==1){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this},trim:function(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;s!==-1&&n[s]>e;)--s;if(++s,r!==0||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const o=this.getValueSize();this.times=We.arraySlice(n,r,s),this.values=We.arraySlice(this.values,r*o,s*o)}return this},validate:function(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==r;o++){const a=n[o];if(typeof a=="number"&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(s!==null&&s>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,s),t=!1;break}s=a}if(i!==void 0&&We.isTypedArray(i))for(let o=0,a=i.length;o!==a;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t},optimize:function(){const t=We.arraySlice(this.times),e=We.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ms,r=t.length-1;let s=1;for(let o=1;o<r;++o){let a=!1;const c=t[o],l=t[o+1];if(c!==l&&(o!==1||c!==c[0]))if(i)a=!0;else{const f=o*n,h=f-n,d=f+n;for(let u=0;u!==n;++u){const m=e[f+u];if(m!==e[h+u]||m!==e[d+u]){a=!0;break}}}if(a){if(o!==s){t[s]=t[o];const f=o*n,h=s*n;for(let d=0;d!==n;++d)e[h+d]=e[f+d]}++s}}if(r>0){t[s]=t[r];for(let o=r*n,a=s*n,c=0;c!==n;++c)e[a+c]=e[o+c];++s}return s!==t.length?(this.times=We.arraySlice(t,0,s),this.values=We.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this},clone:function(){const t=We.arraySlice(this.times,0),e=We.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}});function wo(t,e,n){rt.call(this,t,e,n)}wo.prototype=Object.assign(Object.create(rt.prototype),{constructor:wo,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ns,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function Mo(t,e,n,i){rt.call(this,t,e,n,i)}Mo.prototype=Object.assign(Object.create(rt.prototype),{constructor:Mo,ValueTypeName:"color"});function lr(t,e,n,i){rt.call(this,t,e,n,i)}lr.prototype=Object.assign(Object.create(rt.prototype),{constructor:lr,ValueTypeName:"number"});function So(t,e,n,i){bt.call(this,t,e,n,i)}So.prototype=Object.assign(Object.create(bt.prototype),{constructor:So,interpolate_:function(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e);let c=t*o;for(let l=c+o;c!==l;c+=4)ot.slerpFlat(r,0,s,c-o,s,c,a);return r}});function hs(t,e,n,i){rt.call(this,t,e,n,i)}hs.prototype=Object.assign(Object.create(rt.prototype),{constructor:hs,ValueTypeName:"quaternion",DefaultInterpolation:$r,InterpolantFactoryMethodLinear:function(t){return new So(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0});function Eo(t,e,n,i){rt.call(this,t,e,n,i)}Eo.prototype=Object.assign(Object.create(rt.prototype),{constructor:Eo,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ns,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function hr(t,e,n,i){rt.call(this,t,e,n,i)}hr.prototype=Object.assign(Object.create(rt.prototype),{constructor:hr,ValueTypeName:"vector"});function Ct(t,e,n,i){this.name=t,this.tracks=n,this.duration=e!==void 0?e:-1,this.blendMode=i!==void 0?i:ko,this.uuid=we.generateUUID(),this.duration<0&&this.resetDuration()}function fg(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return lr;case"vector":case"vector2":case"vector3":case"vector4":return hr;case"color":return Mo;case"quaternion":return hs;case"bool":case"boolean":return wo;case"string":return Eo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function dg(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=fg(t.type);if(t.times===void 0){const n=[],i=[];We.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Ct,{parse:function(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(dg(n[s]).scale(i));const r=new Ct(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r},toJSON:function(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,s=n.length;r!==s;++r)e.push(rt.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){const r=e.length,s=[];for(let o=0;o<r;o++){let a=[],c=[];a.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);const l=We.getKeyframeOrder(a);a=We.sortedArray(a,1,l),c=We.sortedArray(c,1,l),!i&&a[0]===0&&(a.push(r),c.push(c[0])),s.push(new lr(".morphTargetInfluences["+e[o].name+"]",a,c).scale(1/n))}return new Ct(t,-1,s)},findByName:function(t,e){let n=t;if(!Array.isArray(t)){const i=t;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=t.length;o<a;o++){const c=t[o],l=c.name.match(r);if(l&&l.length>1){const f=l[1];let h=i[f];h||(i[f]=h=[]),h.push(c)}}const s=[];for(const o in i)s.push(Ct.CreateFromMorphTargetSequence(o,i[o],e,n));return s},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(f,h,d,u,m){if(d.length!==0){const v=[],y=[];We.flattenJSON(d,v,y,u),v.length!==0&&m.push(new f(h,v,y))}},i=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const c=t.hierarchy||[];for(let f=0;f<c.length;f++){const h=c[f].keys;if(!(!h||h.length===0))if(h[0].morphTargets){const d={};let u;for(u=0;u<h.length;u++)if(h[u].morphTargets)for(let m=0;m<h[u].morphTargets.length;m++)d[h[u].morphTargets[m]]=-1;for(const m in d){const v=[],y=[];for(let g=0;g!==h[u].morphTargets.length;++g){const p=h[u];v.push(p.time),y.push(p.morphTarget===m?1:0)}i.push(new lr(".morphTargetInfluence["+m+"]",v,y))}a=d.length*(s||1)}else{const d=".bones["+e[f].name+"]";n(hr,d+".position",h,"pos",i),n(hs,d+".quaternion",h,"rot",i),n(hr,d+".scale",h,"scl",i)}}return i.length===0?null:new Ct(r,a,i,o)}});Object.assign(Ct.prototype,{resetDuration:function(){const t=this.tracks;let e=0;for(let n=0,i=t.length;n!==i;++n){const r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new Ct(this.name,this.duration,t,this.blendMode)},toJSON:function(){return Ct.toJSON(this)}});const Ei={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function pg(t,e,n){const i=this;let r=!1,s=0,o=0,a;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(l){o++,r===!1&&i.onStart!==void 0&&i.onStart(l,s,o),r=!0},this.itemEnd=function(l){s++,i.onProgress!==void 0&&i.onProgress(l,s,o),s===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(l){i.onError!==void 0&&i.onError(l)},this.resolveURL=function(l){return a?a(l):l},this.setURLModifier=function(l){return a=l,this},this.addHandler=function(l,f){return c.push(l,f),this},this.removeHandler=function(l){const f=c.indexOf(l);return f!==-1&&c.splice(f,2),this},this.getHandler=function(l){for(let f=0,h=c.length;f<h;f+=2){const d=c[f],u=c[f+1];if(d.global&&(d.lastIndex=0),d.test(l))return u}return null}}const mg=new pg;function Ue(t){this.manager=t!==void 0?t:mg,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Ue.prototype,{load:function(){},loadAsync:function(t,e){const n=this;return new Promise(function(i,r){n.load(t,i,e,r)})},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});const Rt={};function Qt(t){Ue.call(this,t)}Qt.prototype=Object.assign(Object.create(Ue.prototype),{constructor:Qt,load:function(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ei.get(t);if(s!==void 0)return r.manager.itemStart(t),setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0),s;if(Rt[t]!==void 0){Rt[t].push({onLoad:e,onProgress:n,onError:i});return}const o=/^data:(.*?)(;base64)?,(.*)$/,a=t.match(o);let c;if(a){const l=a[1],f=!!a[2];let h=a[3];h=decodeURIComponent(h),f&&(h=atob(h));try{let d;const u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":const m=new Uint8Array(h.length);for(let y=0;y<h.length;y++)m[y]=h.charCodeAt(y);u==="blob"?d=new Blob([m.buffer],{type:l}):d=m.buffer;break;case"document":d=new DOMParser().parseFromString(h,l);break;case"json":d=JSON.parse(h);break;default:d=h;break}setTimeout(function(){e&&e(d),r.manager.itemEnd(t)},0)}catch(d){setTimeout(function(){i&&i(d),r.manager.itemError(t),r.manager.itemEnd(t)},0)}}else{Rt[t]=[],Rt[t].push({onLoad:e,onProgress:n,onError:i}),c=new XMLHttpRequest,c.open("GET",t,!0),c.addEventListener("load",function(l){const f=this.response,h=Rt[t];if(delete Rt[t],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ei.add(t,f);for(let d=0,u=h.length;d<u;d++){const m=h[d];m.onLoad&&m.onLoad(f)}r.manager.itemEnd(t)}else{for(let d=0,u=h.length;d<u;d++){const m=h[d];m.onError&&m.onError(l)}r.manager.itemError(t),r.manager.itemEnd(t)}},!1),c.addEventListener("progress",function(l){const f=Rt[t];for(let h=0,d=f.length;h<d;h++){const u=f[h];u.onProgress&&u.onProgress(l)}},!1),c.addEventListener("error",function(l){const f=Rt[t];delete Rt[t];for(let h=0,d=f.length;h<d;h++){const u=f[h];u.onError&&u.onError(l)}r.manager.itemError(t),r.manager.itemEnd(t)},!1),c.addEventListener("abort",function(l){const f=Rt[t];delete Rt[t];for(let h=0,d=f.length;h<d;h++){const u=f[h];u.onError&&u.onError(l)}r.manager.itemError(t),r.manager.itemEnd(t)},!1),this.responseType!==void 0&&(c.responseType=this.responseType),this.withCredentials!==void 0&&(c.withCredentials=this.withCredentials),c.overrideMimeType&&c.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const l in this.requestHeader)c.setRequestHeader(l,this.requestHeader[l]);c.send(null)}return r.manager.itemStart(t),c},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}});function uc(t){Ue.call(this,t)}uc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:uc,load:function(t,e,n,i){const r=this,s=new Qt(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(a){i?i(a):console.error(a),r.manager.itemError(t)}},n,i)},parse:function(t){const e=[];for(let n=0;n<t.length;n++){const i=Ct.parse(t[n]);e.push(i)}return e}});function fc(t){Ue.call(this,t)}fc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:fc,load:function(t,e,n,i){const r=this,s=[],o=new rr;o.image=s;const a=new Qt(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let c=0;function l(f){a.load(t[f],function(h){const d=r.parse(h,!0);s[f]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},c+=1,c===6&&(d.mipmapCount===1&&(o.minFilter=it),o.format=d.format,o.needsUpdate=!0,e&&e(o))},n,i)}if(Array.isArray(t))for(let f=0,h=t.length;f<h;++f)l(f);else a.load(t,function(f){const h=r.parse(f,!0);if(h.isCubemap){const d=h.mipmaps.length/h.mipmapCount;for(let u=0;u<d;u++){s[u]={mipmaps:[]};for(let m=0;m<h.mipmapCount;m++)s[u].mipmaps.push(h.mipmaps[u*h.mipmapCount+m]),s[u].format=h.format,s[u].width=h.width,s[u].height=h.height}}else o.image.width=h.width,o.image.height=h.height,o.mipmaps=h.mipmaps;h.mipmapCount===1&&(o.minFilter=it),o.format=h.format,o.needsUpdate=!0,e&&e(o)},n,i);return o}});function us(t){Ue.call(this,t)}us.prototype=Object.assign(Object.create(Ue.prototype),{constructor:us,load:function(t,e,n,i){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ei.get(t);if(s!==void 0)return r.manager.itemStart(t),setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0),s;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1),Ei.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(l){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1),i&&i(l),r.manager.itemError(t),r.manager.itemEnd(t)}return o.addEventListener("load",a,!1),o.addEventListener("error",c,!1),t.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}});function To(t){Ue.call(this,t)}To.prototype=Object.assign(Object.create(Ue.prototype),{constructor:To,load:function(t,e,n,i){const r=new _n,s=new us(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(c){s.load(t[c],function(l){r.images[c]=l,o++,o===6&&(r.needsUpdate=!0,e&&e(r))},void 0,i)}for(let c=0;c<t.length;++c)a(c);return r}});function dc(t){Ue.call(this,t)}dc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:dc,load:function(t,e,n,i){const r=this,s=new yi,o=new Qt(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,function(a){const c=r.parse(a);c&&(c.image!==void 0?s.image=c.image:c.data!==void 0&&(s.image.width=c.width,s.image.height=c.height,s.image.data=c.data),s.wrapS=c.wrapS!==void 0?c.wrapS:pt,s.wrapT=c.wrapT!==void 0?c.wrapT:pt,s.magFilter=c.magFilter!==void 0?c.magFilter:it,s.minFilter=c.minFilter!==void 0?c.minFilter:it,s.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.format!==void 0&&(s.format=c.format),c.type!==void 0&&(s.type=c.type),c.mipmaps!==void 0&&(s.mipmaps=c.mipmaps,s.minFilter=vs),c.mipmapCount===1&&(s.minFilter=it),s.needsUpdate=!0,e&&e(s,c))},n,i),s}});function pn(t){Ue.call(this,t)}pn.prototype=Object.assign(Object.create(Ue.prototype),{constructor:pn,load:function(t,e,n,i){const r=new Ge,s=new us(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,function(o){r.image=o;const a=t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0;r.format=a?Pn:Pt,r.needsUpdate=!0,e!==void 0&&e(r)},n,i),r}});function me(){this.type="Curve",this.arcLengthDivisions=200}Object.assign(me.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t===void 0&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;e?s=e:s=t*n[r-1];let o=0,a=r-1,c;for(;o<=a;)if(i=Math.floor(o+(a-o)/2),c=n[i]-s,c<0)o=i+1;else if(c>0)a=i-1;else{a=i;break}if(i=a,n[i]===s)return i/(r-1);const l=n[i],h=n[i+1]-l,d=(s-l)/h;return(i+d)/(r-1)},getTangent:function(t,e){let i=t-1e-4,r=t+1e-4;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=e||(s.isVector2?new W:new E);return a.copy(o).sub(s).normalize(),a},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new E,i=[],r=[],s=[],o=new E,a=new Ee;for(let d=0;d<=t;d++){const u=d/t;i[d]=this.getTangentAt(u,new E),i[d].normalize()}r[0]=new E,s[0]=new E;let c=Number.MAX_VALUE;const l=Math.abs(i[0].x),f=Math.abs(i[0].y),h=Math.abs(i[0].z);l<=c&&(c=l,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),h<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let d=1;d<=t;d++){if(r[d]=r[d-1].clone(),s[d]=s[d-1].clone(),o.crossVectors(i[d-1],i[d]),o.length()>Number.EPSILON){o.normalize();const u=Math.acos(we.clamp(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(a.makeRotationAxis(o,u))}s[d].crossVectors(i[d],r[d])}if(e===!0){let d=Math.acos(we.clamp(r[0].dot(r[t]),-1,1));d/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(d=-d);for(let u=1;u<=t;u++)r[u].applyMatrix4(a.makeRotationAxis(i[u],d*u)),s[u].crossVectors(i[u],r[u])}return{tangents:i,normals:r,binormals:s}},clone:function(){return new this.constructor().copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});function St(t,e,n,i,r,s,o,a){me.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=s||2*Math.PI,this.aClockwise=o||!1,this.aRotation=a||0}St.prototype=Object.create(me.prototype);St.prototype.constructor=St;St.prototype.isEllipseCurve=!0;St.prototype.getPoint=function(t,e){const n=e||new W,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(s?r=0:r=i),this.aClockwise===!0&&!s&&(r===i?r=-i:r=r-i);const o=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const l=Math.cos(this.aRotation),f=Math.sin(this.aRotation),h=a-this.aX,d=c-this.aY;a=h*l-d*f+this.aX,c=h*f+d*l+this.aY}return n.set(a,c)};St.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this};St.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t};St.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this};function ur(t,e,n,i,r,s){St.call(this,t,e,n,n,i,r,s),this.type="ArcCurve"}ur.prototype=Object.create(St.prototype);ur.prototype.constructor=ur;ur.prototype.isArcCurve=!0;function Go(){let t=0,e=0,n=0,i=0;function r(s,o,a,c){t=s,e=a,n=-3*s+3*o-2*a-c,i=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){r(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,f,h){let d=(o-s)/l-(a-s)/(l+f)+(a-o)/f,u=(a-o)/f-(c-o)/(f+h)+(c-a)/h;d*=f,u*=f,r(o,a,d,u)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+i*a}}}const Zr=new E,Zs=new Go,Js=new Go,Ks=new Go;function gt(t=[],e=!1,n="centripetal",i=.5){me.call(this),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}gt.prototype=Object.create(me.prototype);gt.prototype.constructor=gt;gt.prototype.isCatmullRomCurve3=!0;gt.prototype.getPoint=function(t,e=new E){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let o=Math.floor(s),a=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:a===0&&o===r-1&&(o=r-2,a=1);let c,l;this.closed||o>0?c=i[(o-1)%r]:(Zr.subVectors(i[0],i[1]).add(i[0]),c=Zr);const f=i[o%r],h=i[(o+1)%r];if(this.closed||o+2<r?l=i[(o+2)%r]:(Zr.subVectors(i[r-1],i[r-2]).add(i[r-1]),l=Zr),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let u=Math.pow(c.distanceToSquared(f),d),m=Math.pow(f.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(l),d);m<1e-4&&(m=1),u<1e-4&&(u=m),v<1e-4&&(v=m),Zs.initNonuniformCatmullRom(c.x,f.x,h.x,l.x,u,m,v),Js.initNonuniformCatmullRom(c.y,f.y,h.y,l.y,u,m,v),Ks.initNonuniformCatmullRom(c.z,f.z,h.z,l.z,u,m,v)}else this.curveType==="catmullrom"&&(Zs.initCatmullRom(c.x,f.x,h.x,l.x,this.tension),Js.initCatmullRom(c.y,f.y,h.y,l.y,this.tension),Ks.initCatmullRom(c.z,f.z,h.z,l.z,this.tension));return n.set(Zs.calc(a),Js.calc(a),Ks.calc(a)),n};gt.prototype.copy=function(t){me.prototype.copy.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this};gt.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t};gt.prototype.fromJSON=function(t){me.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new E().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this};function pc(t,e,n,i,r){const s=(i-e)*.5,o=(r-n)*.5,a=t*t,c=t*a;return(2*n-2*i+s+o)*c+(-3*n+3*i-2*s-o)*a+s*t+n}function gg(t,e){const n=1-t;return n*n*e}function vg(t,e){return 2*(1-t)*t*e}function yg(t,e){return t*t*e}function Ji(t,e,n,i){return gg(t,e)+vg(t,n)+yg(t,i)}function xg(t,e){const n=1-t;return n*n*n*e}function _g(t,e){const n=1-t;return 3*n*n*t*e}function bg(t,e){return 3*(1-t)*t*t*e}function wg(t,e){return t*t*t*e}function Ki(t,e,n,i,r){return xg(t,e)+_g(t,n)+bg(t,i)+wg(t,r)}function zt(t=new W,e=new W,n=new W,i=new W){me.call(this),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}zt.prototype=Object.create(me.prototype);zt.prototype.constructor=zt;zt.prototype.isCubicBezierCurve=!0;zt.prototype.getPoint=function(t,e=new W){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Ki(t,i.x,r.x,s.x,o.x),Ki(t,i.y,r.y,s.y,o.y)),n};zt.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this};zt.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t};zt.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this};function $t(t=new E,e=new E,n=new E,i=new E){me.call(this),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}$t.prototype=Object.create(me.prototype);$t.prototype.constructor=$t;$t.prototype.isCubicBezierCurve3=!0;$t.prototype.getPoint=function(t,e=new E){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Ki(t,i.x,r.x,s.x,o.x),Ki(t,i.y,r.y,s.y,o.y),Ki(t,i.z,r.z,s.z,o.z)),n};$t.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this};$t.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t};$t.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this};function vt(t=new W,e=new W){me.call(this),this.type="LineCurve",this.v1=t,this.v2=e}vt.prototype=Object.create(me.prototype);vt.prototype.constructor=vt;vt.prototype.isLineCurve=!0;vt.prototype.getPoint=function(t,e=new W){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n};vt.prototype.getPointAt=function(t,e){return this.getPoint(t,e)};vt.prototype.getTangent=function(t,e){const n=e||new W;return n.copy(this.v2).sub(this.v1).normalize(),n};vt.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this};vt.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t};vt.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this};function Ht(t=new E,e=new E){me.call(this),this.type="LineCurve3",this.v1=t,this.v2=e}Ht.prototype=Object.create(me.prototype);Ht.prototype.constructor=Ht;Ht.prototype.isLineCurve3=!0;Ht.prototype.getPoint=function(t,e=new E){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n};Ht.prototype.getPointAt=function(t,e){return this.getPoint(t,e)};Ht.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this};Ht.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t};Ht.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this};function kt(t=new W,e=new W,n=new W){me.call(this),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}kt.prototype=Object.create(me.prototype);kt.prototype.constructor=kt;kt.prototype.isQuadraticBezierCurve=!0;kt.prototype.getPoint=function(t,e=new W){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(Ji(t,i.x,r.x,s.x),Ji(t,i.y,r.y,s.y)),n};kt.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this};kt.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t};kt.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this};function en(t=new E,e=new E,n=new E){me.call(this),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}en.prototype=Object.create(me.prototype);en.prototype.constructor=en;en.prototype.isQuadraticBezierCurve3=!0;en.prototype.getPoint=function(t,e=new E){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(Ji(t,i.x,r.x,s.x),Ji(t,i.y,r.y,s.y),Ji(t,i.z,r.z,s.z)),n};en.prototype.copy=function(t){return me.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this};en.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t};en.prototype.fromJSON=function(t){return me.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this};function Gt(t=[]){me.call(this),this.type="SplineCurve",this.points=t}Gt.prototype=Object.create(me.prototype);Gt.prototype.constructor=Gt;Gt.prototype.isSplineCurve=!0;Gt.prototype.getPoint=function(t,e=new W){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),o=r-s,a=i[s===0?s:s-1],c=i[s],l=i[s>i.length-2?i.length-1:s+1],f=i[s>i.length-3?i.length-1:s+2];return n.set(pc(o,a.x,c.x,l.x,f.x),pc(o,a.y,c.y,l.y,f.y)),n};Gt.prototype.copy=function(t){me.prototype.copy.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this};Gt.prototype.toJSON=function(){const t=me.prototype.toJSON.call(this);t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t};Gt.prototype.fromJSON=function(t){me.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new W().fromArray(i))}return this};var Mg=Object.freeze({__proto__:null,ArcCurve:ur,CatmullRomCurve3:gt,CubicBezierCurve:zt,CubicBezierCurve3:$t,EllipseCurve:St,LineCurve:vt,LineCurve3:Ht,QuadraticBezierCurve:kt,QuadraticBezierCurve3:en,SplineCurve:Gt});function mn(){me.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}mn.prototype=Object.assign(Object.create(me.prototype),{constructor:mn,add:function(t){this.curves.push(t)},closePath:function(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new vt(e,t))},getPoint:function(t){const e=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=e){const r=n[i]-e,s=this.curves[i],o=s.getLength(),a=o===0?0:1-r/o;return s.getPointAt(a)}i++}return null},getLength:function(){const t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s&&s.isEllipseCurve?t*2:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let c=0;c<a.length;c++){const l=a[c];n&&n.equals(l)||(e.push(l),n=l)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){me.prototype.copy.call(this,t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){const t=me.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t},fromJSON:function(t){me.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(new Mg[i.type]().fromJSON(i))}return this}});function Bt(t){mn.call(this),this.type="Path",this.currentPoint=new W,t&&this.setFromPoints(t)}Bt.prototype=Object.assign(Object.create(mn.prototype),{constructor:Bt,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){const n=new vt(this.currentPoint.clone(),new W(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,n,i){const r=new kt(this.currentPoint.clone(),new W(t,e),new W(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(t,e,n,i,r,s){const o=new zt(this.currentPoint.clone(),new W(t,e),new W(n,i),new W(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this},splineThru:function(t){const e=[this.currentPoint.clone()].concat(t),n=new Gt(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,i,r,s),this},absarc:function(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this},ellipse:function(t,e,n,i,r,s,o,a){const c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,n,i,r,s,o,a),this},absellipse:function(t,e,n,i,r,s,o,a){const c=new St(t,e,n,i,r,s,o,a);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),this},copy:function(t){return mn.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){const t=mn.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return mn.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}});function mi(t){Bt.call(this,t),this.uuid=we.generateUUID(),this.type="Shape",this.holes=[]}mi.prototype=Object.assign(Object.create(Bt.prototype),{constructor:mi,getPointsHoles:function(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Bt.prototype.copy.call(this,t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(i.clone())}return this},toJSON:function(){const t=Bt.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t},fromJSON:function(t){Bt.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(new Bt().fromJSON(i))}return this}});function Ve(t,e=1){ve.call(this),this.type="Light",this.color=new pe(t),this.intensity=e}Ve.prototype=Object.assign(Object.create(ve.prototype),{constructor:Ve,isLight:!0,copy:function(t){return ve.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){const e=ve.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}});function mc(t,e,n){Ve.call(this,t,n),this.type="HemisphereLight",this.position.copy(ve.DefaultUp),this.updateMatrix(),this.groundColor=new pe(e)}mc.prototype=Object.assign(Object.create(Ve.prototype),{constructor:mc,isHemisphereLight:!0,copy:function(t){return Ve.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}});function tn(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new W(512,512),this.map=null,this.mapPass=null,this.matrix=new Ee,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xs,this._frameExtents=new W(1,1),this._viewportCount=1,this._viewports=[new Be(0,0,1,1)]}Object.assign(tn.prototype,{_projScreenMatrix:new Ee,_lightPositionWorld:new E,_lookTarget:new E,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){const e=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,s=this._lightPositionWorld;s.setFromMatrixPosition(t.matrixWorld),e.position.copy(s),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),i.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){const t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}});function Ao(){tn.call(this,new Ke(50,1,.5,500)),this.focus=1}Ao.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ao,isSpotLightShadow:!0,updateMatrices:function(t){const e=this.camera,n=we.RAD2DEG*2*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;(n!==e.fov||i!==e.aspect||r!==e.far)&&(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),tn.prototype.updateMatrices.call(this,t)}});function Lo(t,e,n,i,r,s){Ve.call(this,t,e),this.type="SpotLight",this.position.copy(ve.DefaultUp),this.updateMatrix(),this.target=new ve,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(o){this.intensity=o/Math.PI}}),this.distance=n!==void 0?n:0,this.angle=i!==void 0?i:Math.PI/3,this.penumbra=r!==void 0?r:0,this.decay=s!==void 0?s:1,this.shadow=new Ao}Lo.prototype=Object.assign(Object.create(Ve.prototype),{constructor:Lo,isSpotLight:!0,copy:function(t){return Ve.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}});function Ro(){tn.call(this,new Ke(90,1,.5,500)),this._frameExtents=new W(4,2),this._viewportCount=6,this._viewports=[new Be(2,1,1,1),new Be(0,1,1,1),new Be(3,1,1,1),new Be(1,1,1,1),new Be(3,0,1,1),new Be(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}Ro.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ro,isPointLightShadow:!0,updateMatrices:function(t,e=0){const n=this.camera,i=this.matrix,r=this._lightPositionWorld,s=this._lookTarget,o=this._projScreenMatrix;r.setFromMatrixPosition(t.matrixWorld),n.position.copy(r),s.copy(n.position),s.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(s),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}});function gc(t,e,n,i){Ve.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return this.intensity*4*Math.PI},set:function(r){this.intensity=r/(4*Math.PI)}}),this.distance=n!==void 0?n:0,this.decay=i!==void 0?i:1,this.shadow=new Ro}gc.prototype=Object.assign(Object.create(Ve.prototype),{constructor:gc,isPointLight:!0,copy:function(t){return Ve.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}});function Co(t,e,n,i,r,s){xn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t!==void 0?t:-1,this.right=e!==void 0?e:1,this.top=n!==void 0?n:1,this.bottom=i!==void 0?i:-1,this.near=r!==void 0?r:.1,this.far=s!==void 0?s:2e3,this.updateProjectionMatrix()}Co.prototype=Object.assign(Object.create(xn.prototype),{constructor:Co,isOrthographicCamera:!0,copy:function(t,e){return xn.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,s){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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,o=i+e,a=i-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,s=r+c*this.view.width,o-=l*this.view.offsetY,a=o-l*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=ve.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}});function Po(){tn.call(this,new Co(-5,5,5,-5,.5,500))}Po.prototype=Object.assign(Object.create(tn.prototype),{constructor:Po,isDirectionalLightShadow:!0,updateMatrices:function(t){tn.prototype.updateMatrices.call(this,t)}});function vc(t,e){Ve.call(this,t,e),this.type="DirectionalLight",this.position.copy(ve.DefaultUp),this.updateMatrix(),this.target=new ve,this.shadow=new Po}vc.prototype=Object.assign(Object.create(Ve.prototype),{constructor:vc,isDirectionalLight:!0,copy:function(t){return Ve.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}});function Io(t,e){Ve.call(this,t,e),this.type="AmbientLight"}Io.prototype=Object.assign(Object.create(Ve.prototype),{constructor:Io,isAmbientLight:!0});function yc(t,e,n,i){Ve.call(this,t,e),this.type="RectAreaLight",this.width=n!==void 0?n:10,this.height=i!==void 0?i:10}yc.prototype=Object.assign(Object.create(Ve.prototype),{constructor:yc,isRectAreaLight:!0,copy:function(t){return Ve.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){const e=Ve.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});class Sg{constructor(){Object.defineProperty(this,"isSphericalHarmonics3",{value:!0}),this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new E)}set(e){for(let n=0;n<9;n++)this.coefficients[n].copy(e[n]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,n){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.282095),n.addScaledVector(o[1],.488603*r),n.addScaledVector(o[2],.488603*s),n.addScaledVector(o[3],.488603*i),n.addScaledVector(o[4],1.092548*(i*r)),n.addScaledVector(o[5],1.092548*(r*s)),n.addScaledVector(o[6],.315392*(3*s*s-1)),n.addScaledVector(o[7],1.092548*(i*s)),n.addScaledVector(o[8],.546274*(i*i-r*r)),n}getIrradianceAt(e,n){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.886227),n.addScaledVector(o[1],2*.511664*r),n.addScaledVector(o[2],2*.511664*s),n.addScaledVector(o[3],2*.511664*i),n.addScaledVector(o[4],2*.429043*i*r),n.addScaledVector(o[5],2*.429043*r*s),n.addScaledVector(o[6],.743125*s*s-.247708),n.addScaledVector(o[7],2*.429043*i*s),n.addScaledVector(o[8],.429043*(i*i-r*r)),n}add(e){for(let n=0;n<9;n++)this.coefficients[n].add(e.coefficients[n]);return this}addScaledSH(e,n){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],n);return this}scale(e){for(let n=0;n<9;n++)this.coefficients[n].multiplyScalar(e);return this}lerp(e,n){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],n);return this}equals(e){for(let n=0;n<9;n++)if(!this.coefficients[n].equals(e.coefficients[n]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,n=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,n+r*3);return this}toArray(e=[],n=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,n+r*3);return e}static getBasisAt(e,n){const i=e.x,r=e.y,s=e.z;n[0]=.282095,n[1]=.488603*r,n[2]=.488603*s,n[3]=.488603*i,n[4]=1.092548*i*r,n[5]=1.092548*r*s,n[6]=.315392*(3*s*s-1),n[7]=1.092548*i*s,n[8]=.546274*(i*i-r*r)}}function Ut(t,e){Ve.call(this,void 0,e),this.type="LightProbe",this.sh=t!==void 0?t:new Sg}Ut.prototype=Object.assign(Object.create(Ve.prototype),{constructor:Ut,isLightProbe:!0,copy:function(t){return Ve.prototype.copy.call(this,t),this.sh.copy(t.sh),this},fromJSON:function(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this},toJSON:function(t){const e=Ve.prototype.toJSON.call(this,t);return e.object.sh=this.sh.toArray(),e}});function xc(t){Ue.call(this,t),this.textures={}}xc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:xc,load:function(t,e,n,i){const r=this,s=new Qt(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(a){i?i(a):console.error(a),r.manager.itemError(t)}},n,i)},parse:function(t){const e=this.textures;function n(r){return e[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),e[r]}const i=new ug[t.type];if(t.uuid!==void 0&&(i.uuid=t.uuid),t.name!==void 0&&(i.name=t.name),t.color!==void 0&&i.color!==void 0&&i.color.setHex(t.color),t.roughness!==void 0&&(i.roughness=t.roughness),t.metalness!==void 0&&(i.metalness=t.metalness),t.sheen!==void 0&&(i.sheen=new pe().setHex(t.sheen)),t.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(t.emissive),t.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(t.specular),t.shininess!==void 0&&(i.shininess=t.shininess),t.clearcoat!==void 0&&(i.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=t.clearcoatRoughness),t.fog!==void 0&&(i.fog=t.fog),t.flatShading!==void 0&&(i.flatShading=t.flatShading),t.blending!==void 0&&(i.blending=t.blending),t.combine!==void 0&&(i.combine=t.combine),t.side!==void 0&&(i.side=t.side),t.opacity!==void 0&&(i.opacity=t.opacity),t.transparent!==void 0&&(i.transparent=t.transparent),t.alphaTest!==void 0&&(i.alphaTest=t.alphaTest),t.depthTest!==void 0&&(i.depthTest=t.depthTest),t.depthWrite!==void 0&&(i.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(i.colorWrite=t.colorWrite),t.stencilWrite!==void 0&&(i.stencilWrite=t.stencilWrite),t.stencilWriteMask!==void 0&&(i.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(i.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(i.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(i.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(i.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(i.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(i.stencilZPass=t.stencilZPass),t.wireframe!==void 0&&(i.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(i.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(i.rotation=t.rotation),t.linewidth!==1&&(i.linewidth=t.linewidth),t.dashSize!==void 0&&(i.dashSize=t.dashSize),t.gapSize!==void 0&&(i.gapSize=t.gapSize),t.scale!==void 0&&(i.scale=t.scale),t.polygonOffset!==void 0&&(i.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=t.polygonOffsetUnits),t.skinning!==void 0&&(i.skinning=t.skinning),t.morphTargets!==void 0&&(i.morphTargets=t.morphTargets),t.morphNormals!==void 0&&(i.morphNormals=t.morphNormals),t.dithering!==void 0&&(i.dithering=t.dithering),t.vertexTangents!==void 0&&(i.vertexTangents=t.vertexTangents),t.visible!==void 0&&(i.visible=t.visible),t.toneMapped!==void 0&&(i.toneMapped=t.toneMapped),t.userData!==void 0&&(i.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const r in t.uniforms){const s=t.uniforms[r];switch(i.uniforms[r]={},s.type){case"t":i.uniforms[r].value=n(s.value);break;case"c":i.uniforms[r].value=new pe().setHex(s.value);break;case"v2":i.uniforms[r].value=new W().fromArray(s.value);break;case"v3":i.uniforms[r].value=new E().fromArray(s.value);break;case"v4":i.uniforms[r].value=new Be().fromArray(s.value);break;case"m3":i.uniforms[r].value=new ht().fromArray(s.value);break;case"m4":i.uniforms[r].value=new Ee().fromArray(s.value);break;default:i.uniforms[r].value=s.value}}if(t.defines!==void 0&&(i.defines=t.defines),t.vertexShader!==void 0&&(i.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(i.fragmentShader=t.fragmentShader),t.extensions!==void 0)for(const r in t.extensions)i.extensions[r]=t.extensions[r];if(t.shading!==void 0&&(i.flatShading=t.shading===1),t.size!==void 0&&(i.size=t.size),t.sizeAttenuation!==void 0&&(i.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(i.map=n(t.map)),t.matcap!==void 0&&(i.matcap=n(t.matcap)),t.alphaMap!==void 0&&(i.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(i.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(i.bumpScale=t.bumpScale),t.normalMap!==void 0&&(i.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(i.normalMapType=t.normalMapType),t.normalScale!==void 0){let r=t.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new W().fromArray(r)}return t.displacementMap!==void 0&&(i.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(i.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(i.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(i.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(i.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(i.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(i.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(i.specularMap=n(t.specularMap)),t.envMap!==void 0&&(i.envMap=n(t.envMap)),t.envMapIntensity!==void 0&&(i.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(i.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(i.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(i.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(i.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(i.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(i.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(i.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(i.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new W().fromArray(t.clearcoatNormalScale)),t.transmission!==void 0&&(i.transmission=t.transmission),t.transmissionMap!==void 0&&(i.transmissionMap=n(t.transmissionMap)),i},setTextures:function(t){return this.textures=t,this}});const Eg={decodeText:function(t){if(typeof TextDecoder<"u")return new TextDecoder().decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch{return e}},extractUrlBase:function(t){const e=t.lastIndexOf("/");return e===-1?"./":t.substr(0,e+1)}};function fs(){Fe.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}fs.prototype=Object.assign(Object.create(Fe.prototype),{constructor:fs,isInstancedBufferGeometry:!0,copy:function(t){return Fe.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){const t=Fe.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}});function No(t,e,n,i){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),be.call(this,t,e,n),this.meshPerAttribute=i||1}No.prototype=Object.assign(Object.create(be.prototype),{constructor:No,isInstancedBufferAttribute:!0,copy:function(t){return be.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){const t=be.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}});function _c(t){Ue.call(this,t)}_c.prototype=Object.assign(Object.create(Ue.prototype),{constructor:_c,load:function(t,e,n,i){const r=this,s=new Qt(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(a){i?i(a):console.error(a),r.manager.itemError(t)}},n,i)},parse:function(t){const e={},n={};function i(d,u){if(e[u]!==void 0)return e[u];const v=d.interleavedBuffers[u],y=r(d,v.buffer),g=Lr(v.type,y),p=new xt(g,v.stride);return p.uuid=v.uuid,e[u]=p,p}function r(d,u){if(n[u]!==void 0)return n[u];const v=d.arrayBuffers[u],y=new Uint32Array(v).buffer;return n[u]=y,y}const s=t.isInstancedBufferGeometry?new fs:new Fe,o=t.data.index;if(o!==void 0){const d=Lr(o.type,o.array);s.setIndex(new be(d,1))}const a=t.data.attributes;for(const d in a){const u=a[d];let m;if(u.isInterleavedBufferAttribute){const v=i(t.data,u.data);m=new On(v,u.itemSize,u.offset,u.normalized)}else{const v=Lr(u.type,u.array),y=u.isInstancedBufferAttribute?No:be;m=new y(v,u.itemSize,u.normalized)}u.name!==void 0&&(m.name=u.name),s.setAttribute(d,m)}const c=t.data.morphAttributes;if(c)for(const d in c){const u=c[d],m=[];for(let v=0,y=u.length;v<y;v++){const g=u[v];let p;if(g.isInterleavedBufferAttribute){const L=i(t.data,g.data);p=new On(L,g.itemSize,g.offset,g.normalized)}else{const L=Lr(g.type,g.array);p=new be(L,g.itemSize,g.normalized)}g.name!==void 0&&(p.name=g.name),m.push(p)}s.morphAttributes[d]=m}t.data.morphTargetsRelative&&(s.morphTargetsRelative=!0);const f=t.data.groups||t.data.drawcalls||t.data.offsets;if(f!==void 0)for(let d=0,u=f.length;d!==u;++d){const m=f[d];s.addGroup(m.start,m.count,m.materialIndex)}const h=t.data.boundingSphere;if(h!==void 0){const d=new E;h.center!==void 0&&d.fromArray(h.center),s.boundingSphere=new Mn(d,h.radius)}return t.name&&(s.name=t.name),t.userData&&(s.userData=t.userData),s}});function bc(t){typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Ue.call(this,t),this.options={premultiplyAlpha:"none"}}bc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:bc,isImageBitmapLoader:!0,setOptions:function(e){return this.options=e,this},load:function(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ei.get(t);if(s!==void 0)return r.manager.itemStart(t),setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0),s;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",fetch(t,o).then(function(a){return a.blob()}).then(function(a){return createImageBitmap(a,r.options)}).then(function(a){Ei.add(t,a),e&&e(a),r.manager.itemEnd(t)}).catch(function(a){i&&i(a),r.manager.itemError(t),r.manager.itemEnd(t)}),r.manager.itemStart(t)}});function cl(){this.type="ShapePath",this.color=new pe,this.subPaths=[],this.currentPath=null}Object.assign(cl.prototype,{moveTo:function(t,e){return this.currentPath=new Bt,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this},bezierCurveTo:function(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function n(g){const p=[];for(let L=0,R=g.length;L<R;L++){const T=g[L],x=new mi;x.curves=T.curves,p.push(x)}return p}function i(g,p){const L=p.length;let R=!1;for(let T=L-1,x=0;x<L;T=x++){let P=p[T],U=p[x],K=U.x-P.x,ae=U.y-P.y;if(Math.abs(ae)>Number.EPSILON){if(ae<0&&(P=p[x],K=-K,U=p[T],ae=-ae),g.y<P.y||g.y>U.y)continue;if(g.y===P.y){if(g.x===P.x)return!0}else{const S=ae*(g.x-P.x)-K*(g.y-P.y);if(S===0)return!0;if(S<0)continue;R=!R}}else{if(g.y!==P.y)continue;if(U.x<=g.x&&g.x<=P.x||P.x<=g.x&&g.x<=U.x)return!0}}return R}const r=vn.isClockWise,s=this.subPaths;if(s.length===0)return[];if(e===!0)return n(s);let o,a,c;const l=[];if(s.length===1)return a=s[0],c=new mi,c.curves=a.curves,l.push(c),l;let f=!r(s[0].getPoints());f=t?!f:f;const h=[],d=[];let u=[],m=0,v;d[m]=void 0,u[m]=[];for(let g=0,p=s.length;g<p;g++)a=s[g],v=a.getPoints(),o=r(v),o=t?!o:o,o?(!f&&d[m]&&m++,d[m]={s:new mi,p:v},d[m].s.curves=a.curves,f&&m++,u[m]=[]):u[m].push({h:a,p:v[0]});if(!d[0])return n(s);if(d.length>1){let g=!1;const p=[];for(let L=0,R=d.length;L<R;L++)h[L]=[];for(let L=0,R=d.length;L<R;L++){const T=u[L];for(let x=0;x<T.length;x++){const P=T[x];let U=!0;for(let K=0;K<d.length;K++)i(P.p,d[K].p)&&(L!==K&&p.push({froms:L,tos:K,hole:x}),U?(U=!1,h[K].push(P)):g=!0);U&&h[L].push(P)}}p.length>0&&(g||(u=h))}let y;for(let g=0,p=d.length;g<p;g++){c=d[g].s,l.push(c),y=u[g];for(let L=0,R=y.length;L<R;L++)c.holes.push(y[L].h)}return l}});function ll(t){this.type="Font",this.data=t}Object.assign(ll.prototype,{isFont:!0,generateShapes:function(t,e=100){const n=[],i=Tg(t,e,this.data);for(let r=0,s=i.length;r<s;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}});function Tg(t,e,n){const i=Array.from?Array.from(t):String(t).split(""),r=e/n.resolution,s=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[];let a=0,c=0;for(let l=0;l<i.length;l++){const f=i[l];if(f===`
  2800. `)a=0,c-=s;else{const h=Ag(f,r,a,c,n);a+=h.offsetX,o.push(h.path)}}return o}function Ag(t,e,n,i,r){const s=r.glyphs[t]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");return}const o=new cl;let a,c,l,f,h,d,u,m;if(s.o){const v=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let y=0,g=v.length;y<g;)switch(v[y++]){case"m":a=v[y++]*e+n,c=v[y++]*e+i,o.moveTo(a,c);break;case"l":a=v[y++]*e+n,c=v[y++]*e+i,o.lineTo(a,c);break;case"q":l=v[y++]*e+n,f=v[y++]*e+i,h=v[y++]*e+n,d=v[y++]*e+i,o.quadraticCurveTo(h,d,l,f);break;case"b":l=v[y++]*e+n,f=v[y++]*e+i,h=v[y++]*e+n,d=v[y++]*e+i,u=v[y++]*e+n,m=v[y++]*e+i,o.bezierCurveTo(h,d,u,m,l,f);break}}return{offsetX:s.ha*e,path:o}}function wc(t){Ue.call(this,t)}wc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:wc,load:function(t,e,n,i){const r=this,s=new Qt(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(o){let a;try{a=JSON.parse(o)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),a=JSON.parse(o.substring(65,o.length-2))}const c=r.parse(a);e&&e(c)},n,i)},parse:function(t){return new ll(t)}});let Jr;const Lg={getContext:function(){return Jr===void 0&&(Jr=new(window.AudioContext||window.webkitAudioContext)),Jr},setContext:function(t){Jr=t}};function Mc(t){Ue.call(this,t)}Mc.prototype=Object.assign(Object.create(Ue.prototype),{constructor:Mc,load:function(t,e,n,i){const r=this,s=new Qt(r.manager);s.setResponseType("arraybuffer"),s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(o){try{const a=o.slice(0);Lg.getContext().decodeAudioData(a,function(l){e(l)})}catch(a){i?i(a):console.error(a),r.manager.itemError(t)}},n,i)}});function Sc(t,e,n){Ut.call(this,void 0,n);const i=new pe().set(t),r=new pe().set(e),s=new E(i.r,i.g,i.b),o=new E(r.r,r.g,r.b),a=Math.sqrt(Math.PI),c=a*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(o).multiplyScalar(a),this.sh.coefficients[1].copy(s).sub(o).multiplyScalar(c)}Sc.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Sc,isHemisphereLightProbe:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this},toJSON:function(t){return Ut.prototype.toJSON.call(this,t)}});function Ec(t,e){Ut.call(this,void 0,e);const n=new pe().set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}Ec.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Ec,isAmbientLightProbe:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this},toJSON:function(t){return Ut.prototype.toJSON.call(this,t)}});const Tc=new Ee,Ac=new Ee;function Rg(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ke,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ke,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}}Object.assign(Rg.prototype,{update:function(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;const i=t.projectionMatrix.clone(),r=e.eyeSep/2,s=r*e.near/e.focus,o=e.near*Math.tan(we.DEG2RAD*e.fov*.5)/e.zoom;let a,c;Ac.elements[12]=-r,Tc.elements[12]=r,a=-o*e.aspect+s,c=o*e.aspect+s,i.elements[0]=2*e.near/(c-a),i.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(i),a=-o*e.aspect-s,c=o*e.aspect-s,i.elements[0]=2*e.near/(c-a),i.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Ac),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Tc)}});function hl(t,e,n){this.binding=t,this.valueSize=n;let i,r,s;switch(e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Object.assign(hl.prototype,{accumulate:function(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(s===0){for(let o=0;o!==i;++o)n[r+o]=n[o];s=e}else{s+=e;const o=e/s;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=s},accumulateAdditive:function(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t},apply:function(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const a=e*this._origIndex;this._mixBufferRegion(n,i,a,1-r,e)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let a=e,c=e+e;a!==c;++a)if(n[a]!==n[a+e]){o.setValue(n,i);break}},saveOriginalState:function(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,s=i;r!==s;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)},_setAdditiveIdentityNumeric:function(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},_setAdditiveIdentityOther:function(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]},_select:function(t,e,n,i,r){if(i>=.5)for(let s=0;s!==r;++s)t[e+s]=t[n+s]},_slerp:function(t,e,n,i){ot.slerpFlat(t,e,t,e,t,n,i)},_slerpAdditive:function(t,e,n,i,r){const s=this._workIndex*r;ot.multiplyQuaternionsFlat(t,s,t,e,t,n),ot.slerpFlat(t,e,t,e,t,s,i)},_lerp:function(t,e,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const a=e+o;t[a]=t[a]*s+t[n+o]*i}},_lerpAdditive:function(t,e,n,i,r){for(let s=0;s!==r;++s){const o=e+s;t[o]=t[o]+t[n+s]*i}}});const Vo="\\[\\]\\.:\\/",Cg=new RegExp("["+Vo+"]","g"),Wo="[^"+Vo+"]",Pg="[^"+Vo.replace("\\.","")+"]",Ig=/((?:WC+[\/:])*)/.source.replace("WC",Wo),Ng=/(WCOD+)?/.source.replace("WCOD",Pg),Dg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Wo),Og=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Wo),Fg=new RegExp("^"+Ig+Ng+Dg+Og+"$"),Bg=["material","materials","bones"];function ul(t,e,n){const i=n||at.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}Object.assign(ul.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}});function at(t,e,n){this.path=e,this.parsedPath=n||at.parseTrackName(e),this.node=at.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(at,{Composite:ul,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new at.Composite(t,e,n):new at(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Cg,"")},parseTrackName:function(t){const e=Fg.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);Bg.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: "+t);return n},findNode:function(t,e){if(!e||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){const n=function(r){for(let s=0;s<r.length;s++){const o=r[s];if(o.name===e||o.uuid===e)return o;const a=n(o.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}});Object.assign(at.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,n){e[n]=this.node[this.propertyName]},function(e,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[n++]=i[r]},function(e,n){e[n]=this.resolvedProperty[this.propertyIndex]},function(e,n){this.resolvedProperty.toArray(e,n)}],SetterByBindingTypeAndVersioning:[[function(e,n){this.targetObject[this.propertyName]=e[n]},function(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0},function(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[n++]},function(e,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[n++];this.targetObject.needsUpdate=!0},function(e,n){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,n){this.resolvedProperty[this.propertyIndex]=e[n]},function(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0},function(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,n){this.resolvedProperty.fromArray(e,n)},function(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0},function(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,n){this.bind(),this.getValue(e,n)},setValue:function(e,n){this.bind(),this.setValue(e,n)},bind:function(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=at.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let l=0;l<t.length;l++)if(t[l].name===c){c=l;break}break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}const s=t[i];if(s===void 0){const c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else s.fromArray!==void 0&&s.toArray!==void 0?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}});Object.assign(at.prototype,{_getValue_unbound:at.prototype.getValue,_setValue_unbound:at.prototype.setValue});function Ug(){this.uuid=we.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,i=arguments.length;n!==i;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}Object.assign(Ug.prototype,{isAnimationObjectGroup:!0,add:function(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=t.length,c=this.nCachedObjects_;for(let l=0,f=arguments.length;l!==f;++l){const h=arguments[l],d=h.uuid;let u=e[d];if(u===void 0){u=a++,e[d]=u,t.push(h);for(let m=0,v=s;m!==v;++m)r[m].push(new at(h,n[m],i[m]))}else if(u<c){o=t[u];const m=--c,v=t[m];e[v.uuid]=u,t[u]=v,e[d]=m,t[m]=h;for(let y=0,g=s;y!==g;++y){const p=r[y],L=p[m];let R=p[u];p[u]=L,R===void 0&&(R=new at(h,n[y],i[y])),p[m]=R}}else t[u]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c},remove:function(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const a=arguments[s],c=a.uuid,l=e[c];if(l!==void 0&&l>=r){const f=r++,h=t[f];e[h.uuid]=l,t[l]=h,e[c]=f,t[f]=a;for(let d=0,u=i;d!==u;++d){const m=n[d],v=m[f],y=m[l];m[l]=v,m[f]=y}}}this.nCachedObjects_=r},uncache:function(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,f=e[l];if(f!==void 0)if(delete e[l],f<r){const h=--r,d=t[h],u=--s,m=t[u];e[d.uuid]=f,t[f]=d,e[m.uuid]=h,t[h]=m,t.pop();for(let v=0,y=i;v!==y;++v){const g=n[v],p=g[h],L=g[u];g[f]=p,g[h]=L,g.pop()}}else{const h=--s,d=t[h];h>0&&(e[d.uuid]=f),t[f]=d,t.pop();for(let u=0,m=i;u!==m;++u){const v=n[u];v[f]=v[h],v.pop()}}}this.nCachedObjects_=r},subscribe_:function(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(i!==void 0)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,c=a.length,l=this.nCachedObjects_,f=new Array(c);i=r.length,n[t]=i,s.push(t),o.push(e),r.push(f);for(let h=l,d=a.length;h!==d;++h){const u=a[h];f[h]=new at(u,t,e)}return f},unsubscribe_:function(t){const e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o],c=t[o];e[c]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}});class zg{constructor(e,n,i=null,r=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=i,this.blendMode=r;const s=n.tracks,o=s.length,a=new Array(o),c={endingStart:ai,endingEnd:ai};for(let l=0;l!==o;++l){const f=s[l].createInterpolant(null);a[l]=f,f.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ou,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,n){return this.loop=e,this.repetitions=n,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,n,i){if(e.fadeOut(n),this.fadeIn(n),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,i){return e.crossFadeFrom(this,n,i)}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,n,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=s,c[1]=s+i,l[0]=e/o,l[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*i;if(c<0||i===0)return;this._startTime=null,n=i*c}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case zc:for(let f=0,h=c.length;f!==h;++f)c[f].evaluate(o),l[f].accumulateAdditive(a);break;case ko:default:for(let f=0,h=c.length;f!==h;++f)c[f].evaluate(o),l[f].accumulate(r,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];n*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];n*=r,e>i.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===au;if(e===0)return s===-1?r:o&&(s&1)===1?n-r:r;if(i===su){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=n)r=n;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=n||r<0){const a=Math.floor(r/n);r-=n*a,s+=Math.abs(a);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?n:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return n-r}return r}_setEndings(e,n,i){const r=this._interpolantSettings;i?(r.endingStart=ci,r.endingEnd=ci):(e?r.endingStart=this.zeroSlopeAtStart?ci:ai:r.endingStart=is,n?r.endingEnd=this.zeroSlopeAtEnd?ci:ai:r.endingEnd=is)}_scheduleFading(e,n,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=s,c[0]=n,a[1]=s+e,c[1]=i,this}}function Lc(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}Lc.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Lc,_bindAction:function(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,c=this._bindingsByRootAndName;let l=c[a];l===void 0&&(l={},c[a]=l);for(let f=0;f!==r;++f){const h=i[f],d=h.name;let u=l[d];if(u!==void 0)s[f]=u;else{if(u=s[f],u!==void 0){u._cacheIndex===null&&(++u.referenceCount,this._addInactiveBinding(u,a,d));continue}const m=e&&e._propertyBindings[f].binding.parsedPath;u=new hl(at.create(n,d,m),h.ValueTypeName,h.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,a,d),s[f]=u}o[f].resultBuffer=u.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const n=(t._localRoot||this._root).uuid,i=t._clip.uuid,r=this._actionsByClip[i];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,i,n)}const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const r=e[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const r=e[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){const e=t._cacheIndex;return e!==null&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(s===void 0)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const o=s.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t},_removeInactiveAction:function(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,c=a[a.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),t._byClipCacheIndex=null;const f=o.actionByRoot,h=(t._localRoot||this._root).uuid;delete f[h],a.length===0&&delete s[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const r=e[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}},_lendAction:function(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];s===void 0&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)},_removeInactiveBinding:function(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=e[e.length-1],c=t._cacheIndex;a._cacheIndex=c,e[c]=a,e.pop(),delete o[r],Object.keys(o).length===0&&delete s[i]},_lendBinding:function(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return n===void 0&&(n=new ls(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e,n){const i=e||this._root,r=i.uuid;let s=typeof t=="string"?Ct.findByName(i,t):t;const o=s!==null?s.uuid:t,a=this._actionsByClip[o];let c=null;if(n===void 0&&(s!==null?n=s.blendMode:n=ko),a!==void 0){const f=a.actionByRoot[r];if(f!==void 0&&f.blendMode===n)return f;c=a.knownActions[0],s===null&&(s=c._clip)}if(s===null)return null;const l=new zg(this,s,e,n);return this._bindAction(l,c),this._addInactiveAction(l,o,r),l},existingAction:function(t,e){const n=e||this._root,i=n.uuid,r=typeof t=="string"?Ct.findByName(n,t):t,s=r?r.uuid:t,o=this._actionsByClip[s];return o!==void 0&&o.actionByRoot[i]||null},stopAllAction:function(){const t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this},update:function(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(i,t,r,s);const o=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)o[c].apply(s);return this},setTime:function(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},getRoot:function(){return this._root},uncacheClip:function(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const s=r.knownActions;for(let o=0,a=s.length;o!==a;++o){const c=s[o];this._deactivateAction(c);const l=c._cacheIndex,f=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,f._cacheIndex=l,e[l]=f,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(t){const e=t.uuid,n=this._actionsByClip;for(const s in n){const o=n[s].actionByRoot,a=o[e];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}const i=this._bindingsByRootAndName,r=i[e];if(r!==void 0)for(const s in r){const o=r[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}},uncacheAction:function(t,e){const n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}});function Rc(t,e,n){xt.call(this,t,e),this.meshPerAttribute=n||1}Rc.prototype=Object.assign(Object.create(xt.prototype),{constructor:Rc,isInstancedInterleavedBuffer:!0,copy:function(t){return xt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){const e=xt.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){const e=xt.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}});function fl(t,e,n,i,r){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}Object.defineProperty(fl.prototype,"needsUpdate",{set:function(t){t===!0&&this.version++}});Object.assign(fl.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}});function dl(t,e,n,i){this.ray=new pr(t,e),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new kc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Cc(t,e){return t.distance-e.distance}function Do(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),i===!0){const r=t.children;for(let s=0,o=r.length;s<o;s++)Do(r[s],e,n,!0)}}Object.assign(dl.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,n){const i=n||[];return Do(t,this,i,e),i.sort(Cc),i},intersectObjects:function(t,e,n){const i=n||[];if(Array.isArray(t)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(let r=0,s=t.length;r<s;r++)Do(t[r],this,i,e);return i.sort(Cc),i}});class Pc{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}clone(){return new this.constructor().copy(this)}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(we.clamp(n/this.radius,-1,1))),this}}const Ic=new W;class Hg{constructor(e,n){Object.defineProperty(this,"isBox2",{value:!0}),this.min=e!==void 0?e:new W(1/0,1/0),this.max=n!==void 0?n:new W(-1/0,-1/0)}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Ic.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 e===void 0&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new W),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return e===void 0&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new W),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,n){return n===void 0&&(console.warn("THREE.Box2: .getParameter() target is now required"),n=new W),n.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,n){return n===void 0&&(console.warn("THREE.Box2: .clampPoint() target is now required"),n=new W),n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ic.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),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)}}function ds(t){ve.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}ds.prototype=Object.create(ve.prototype);ds.prototype.constructor=ds;ds.prototype.isImmediateRenderObject=!0;const hn=new E,Kr=new Ee,Qs=new Ee;class kg extends ss{constructor(e){const n=pl(e),i=new Fe,r=[],s=[],o=new pe(0,0,1),a=new pe(0,1,0);for(let l=0;l<n.length;l++){const f=n[l];f.parent&&f.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new De(r,3)),i.setAttribute("color",new De(s,3));const c=new Mt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,c),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const n=this.bones,i=this.geometry,r=i.getAttribute("position");Qs.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(Kr.multiplyMatrices(Qs,a.matrixWorld),hn.setFromMatrixPosition(Kr),r.setXYZ(o,hn.x,hn.y,hn.z),Kr.multiplyMatrices(Qs,a.parent.matrixWorld),hn.setFromMatrixPosition(Kr),r.setXYZ(o+1,hn.x,hn.y,hn.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function pl(t){const e=[];t&&t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,pl(t.children[n]));return e}class Gg extends ss{constructor(e=10,n=10,i=4473924,r=8947848){i=new pe(i),r=new pe(r);const s=n/2,o=e/n,a=e/2,c=[],l=[];for(let d=0,u=0,m=-a;d<=n;d++,m+=o){c.push(-a,0,m,a,0,m),c.push(m,0,-a,m,0,a);const v=d===s?i:r;v.toArray(l,u),u+=3,v.toArray(l,u),u+=3,v.toArray(l,u),u+=3,v.toArray(l,u),u+=3}const f=new Fe;f.setAttribute("position",new De(c,3)),f.setAttribute("color",new De(l,3));const h=new Mt({vertexColors:!0,toneMapped:!1});super(f,h),this.type="GridHelper"}}const Vg=new Float32Array(1);new Int32Array(Vg.buffer);me.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(me.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t};Object.assign(mn.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=new _t;for(let n=0,i=t.length;n<i;n++){const r=t[n];e.vertices.push(new E(r.x,r.y,r.z||0))}return e}});Object.assign(Bt.prototype,{fromPoints:function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}});Object.create(gt.prototype);Object.create(gt.prototype);function ml(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),gt.call(this,t),this.type="catmullrom"}ml.prototype=Object.create(gt.prototype);Object.assign(ml.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});Gg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};kg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(Ue.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Eg.extractUrlBase(t)}});Ue.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Object.assign(Hg.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}});Object.assign(wn.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}});Object.assign(Mn.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}});xs.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)};Object.assign(we,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),we.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),we.ceilPowerOfTwo(t)}});Object.assign(ht.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},getInverse:function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()}});Object.assign(Ee.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new E().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,s)},getInverse:function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()}});Jt.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)};Object.assign(ot.prototype,{multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},inverse:function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()}});Object.assign(pr.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}});Object.assign(nt.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}});Object.assign(nt,{barycoordFromPoint:function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),nt.getBarycoord(t,e,n,i,r)},normal:function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),nt.getNormal(t,e,n,i)}});Object.assign(mi.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ig(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ag(this,t)}});Object.assign(W.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(E.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(Be.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(_t.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(t){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}});Object.assign(ve.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}});Object.defineProperties(ve.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.assign(et.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}});Object.defineProperties(et.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),cu},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});Object.defineProperties(uo.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Object.defineProperty(mo.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});fo.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(me.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}});Ke.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(t)};Object.defineProperties(Ve.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}});Object.defineProperties(be.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===$i},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage($i)}}});Object.assign(be.prototype,{setDynamic:function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(t===!0?$i:ys),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(Fe.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addAttribute:function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new be(arguments[1],arguments[2]))):t==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e)},addDrawCall:function(t,e,n){n!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},applyMatrix:function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}});Object.defineProperties(Fe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Object.defineProperties(fs.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}});Object.defineProperties(dl.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}});Object.defineProperties(xt.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===$i},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}});Object.assign(xt.prototype,{setDynamic:function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(t===!0?$i:ys),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(al.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.assign(nl.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}});Object.defineProperties(ye.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new pe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===Oc}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}});Object.defineProperties(zn.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Un.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}});Object.defineProperties(ut.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}});Object.assign(gr.prototype,{clearTarget:function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}});Object.defineProperties(gr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=t===!0?Hc:dr}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(el.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(It.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}});vi.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)};vi.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)};Ai.crossOrigin=void 0;Ai.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new pn;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s};Ai.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new To;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s};Ai.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Ai.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Bl}}));const Wg=""+new URL("jx-f8a49980.jpg",import.meta.url).href,jg=""+new URL("mx-b1664ff4.jpg",import.meta.url).href,qg=""+new URL("hx-152506bf.jpg",import.meta.url).href,Xg=""+new URL("sx-447b6154.png",import.meta.url).href,Yg=""+new URL("hwx-02db964e.png",import.meta.url).href;var fr=function(t,e){e===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new E,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:un.ROTATE,MIDDLE:un.DOLLY,RIGHT:un.PAN},this.touches={ONE:fn.ROTATE,TWO:fn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),a=o.NONE},this.update=function(){var A=new E,Q=new ot().setFromUnitVectors(t.up,new E(0,1,0)),ce=Q.clone().invert(),ne=new E,de=new ot,Oe=2*Math.PI;return function(){var Ri=n.object.position;A.copy(Ri).sub(n.target),A.applyQuaternion(Q),l.setFromVector3(A),n.autoRotate&&a===o.NONE&&K(P()),n.enableDamping?(l.theta+=f.theta*n.dampingFactor,l.phi+=f.phi*n.dampingFactor):(l.theta+=f.theta,l.phi+=f.phi);var Et=n.minAzimuthAngle,yt=n.maxAzimuthAngle;return isFinite(Et)&&isFinite(yt)&&(Et<-Math.PI?Et+=Oe:Et>Math.PI&&(Et-=Oe),yt<-Math.PI?yt+=Oe:yt>Math.PI&&(yt-=Oe),Et<=yt?l.theta=Math.max(Et,Math.min(yt,l.theta)):l.theta=l.theta>(Et+yt)/2?Math.max(Et,l.theta):Math.min(yt,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=h,l.radius=Math.max(n.minDistance,Math.min(n.maxDistance,l.radius)),n.enableDamping===!0?n.target.addScaledVector(d,n.dampingFactor):n.target.add(d),A.setFromSpherical(l),A.applyQuaternion(ce),Ri.copy(n.target).add(A),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),d.set(0,0,0)),h=1,u||ne.distanceToSquared(n.object.position)>c||8*(1-de.dot(n.object.quaternion))>c?(n.dispatchEvent(i),ne.copy(n.object.position),de.copy(n.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",ee,!1),n.domElement.removeEventListener("pointerdown",te,!1),n.domElement.removeEventListener("wheel",j,!1),n.domElement.removeEventListener("touchstart",Z,!1),n.domElement.removeEventListener("touchend",he,!1),n.domElement.removeEventListener("touchmove",re,!1),n.domElement.ownerDocument.removeEventListener("pointermove",fe,!1),n.domElement.ownerDocument.removeEventListener("pointerup",se,!1),n.domElement.removeEventListener("keydown",I,!1)};var n=this,i={type:"change"},r={type:"start"},s={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},a=o.NONE,c=1e-6,l=new Pc,f=new Pc,h=1,d=new E,u=!1,m=new W,v=new W,y=new W,g=new W,p=new W,L=new W,R=new W,T=new W,x=new W;function P(){return 2*Math.PI/60/60*n.autoRotateSpeed}function U(){return Math.pow(.95,n.zoomSpeed)}function K(A){f.theta-=A}function ae(A){f.phi-=A}var S=function(){var A=new E;return function(ce,ne){A.setFromMatrixColumn(ne,0),A.multiplyScalar(-ce),d.add(A)}}(),O=function(){var A=new E;return function(ce,ne){n.screenSpacePanning===!0?A.setFromMatrixColumn(ne,1):(A.setFromMatrixColumn(ne,0),A.crossVectors(n.object.up,A)),A.multiplyScalar(ce),d.add(A)}}(),N=function(){var A=new E;return function(ce,ne){var de=n.domElement;if(n.object.isPerspectiveCamera){var Oe=n.object.position;A.copy(Oe).sub(n.target);var Ye=A.length();Ye*=Math.tan(n.object.fov/2*Math.PI/180),S(2*ce*Ye/de.clientHeight,n.object.matrix),O(2*ne*Ye/de.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(S(ce*(n.object.right-n.object.left)/n.object.zoom/de.clientWidth,n.object.matrix),O(ne*(n.object.top-n.object.bottom)/n.object.zoom/de.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function D(A){n.object.isPerspectiveCamera?h/=A:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*A)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function C(A){n.object.isPerspectiveCamera?h*=A:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/A)),n.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function w(A){m.set(A.clientX,A.clientY)}function F(A){R.set(A.clientX,A.clientY)}function z(A){g.set(A.clientX,A.clientY)}function V(A){v.set(A.clientX,A.clientY),y.subVectors(v,m).multiplyScalar(n.rotateSpeed);var Q=n.domElement;K(2*Math.PI*y.x/Q.clientHeight),ae(2*Math.PI*y.y/Q.clientHeight),m.copy(v),n.update()}function q(A){T.set(A.clientX,A.clientY),x.subVectors(T,R),x.y>0?D(U()):x.y<0&&C(U()),R.copy(T),n.update()}function J(A){p.set(A.clientX,A.clientY),L.subVectors(p,g).multiplyScalar(n.panSpeed),N(L.x,L.y),g.copy(p),n.update()}function le(A){A.deltaY<0?C(U()):A.deltaY>0&&D(U()),n.update()}function ge(A){var Q=!1;switch(A.keyCode){case n.keys.UP:N(0,n.keyPanSpeed),Q=!0;break;case n.keys.BOTTOM:N(0,-n.keyPanSpeed),Q=!0;break;case n.keys.LEFT:N(n.keyPanSpeed,0),Q=!0;break;case n.keys.RIGHT:N(-n.keyPanSpeed,0),Q=!0;break}Q&&(A.preventDefault(),n.update())}function Re(A){if(A.touches.length==1)m.set(A.touches[0].pageX,A.touches[0].pageY);else{var Q=.5*(A.touches[0].pageX+A.touches[1].pageX),ce=.5*(A.touches[0].pageY+A.touches[1].pageY);m.set(Q,ce)}}function k(A){if(A.touches.length==1)g.set(A.touches[0].pageX,A.touches[0].pageY);else{var Q=.5*(A.touches[0].pageX+A.touches[1].pageX),ce=.5*(A.touches[0].pageY+A.touches[1].pageY);g.set(Q,ce)}}function Le(A){var Q=A.touches[0].pageX-A.touches[1].pageX,ce=A.touches[0].pageY-A.touches[1].pageY,ne=Math.sqrt(Q*Q+ce*ce);R.set(0,ne)}function ue(A){n.enableZoom&&Le(A),n.enablePan&&k(A)}function Se(A){n.enableZoom&&Le(A),n.enableRotate&&Re(A)}function xe(A){if(A.touches.length==1)v.set(A.touches[0].pageX,A.touches[0].pageY);else{var Q=.5*(A.touches[0].pageX+A.touches[1].pageX),ce=.5*(A.touches[0].pageY+A.touches[1].pageY);v.set(Q,ce)}y.subVectors(v,m).multiplyScalar(n.rotateSpeed);var ne=n.domElement;K(2*Math.PI*y.x/ne.clientHeight),ae(2*Math.PI*y.y/ne.clientHeight),m.copy(v)}function Pe(A){if(A.touches.length==1)p.set(A.touches[0].pageX,A.touches[0].pageY);else{var Q=.5*(A.touches[0].pageX+A.touches[1].pageX),ce=.5*(A.touches[0].pageY+A.touches[1].pageY);p.set(Q,ce)}L.subVectors(p,g).multiplyScalar(n.panSpeed),N(L.x,L.y),g.copy(p)}function _e(A){var Q=A.touches[0].pageX-A.touches[1].pageX,ce=A.touches[0].pageY-A.touches[1].pageY,ne=Math.sqrt(Q*Q+ce*ce);T.set(0,ne),x.set(0,Math.pow(T.y/R.y,n.zoomSpeed)),D(x.y),R.copy(T)}function X(A){n.enableZoom&&_e(A),n.enablePan&&Pe(A)}function $(A){n.enableZoom&&_e(A),n.enableRotate&&xe(A)}function te(A){if(n.enabled!==!1)switch(A.pointerType){case"mouse":case"pen":M(A);break}}function fe(A){if(n.enabled!==!1)switch(A.pointerType){case"mouse":case"pen":_(A);break}}function se(A){switch(A.pointerType){case"mouse":case"pen":Y();break}}function M(A){A.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus();var Q;switch(A.button){case 0:Q=n.mouseButtons.LEFT;break;case 1:Q=n.mouseButtons.MIDDLE;break;case 2:Q=n.mouseButtons.RIGHT;break;default:Q=-1}switch(Q){case un.DOLLY:if(n.enableZoom===!1)return;F(A),a=o.DOLLY;break;case un.ROTATE:if(A.ctrlKey||A.metaKey||A.shiftKey){if(n.enablePan===!1)return;z(A),a=o.PAN}else{if(n.enableRotate===!1)return;w(A),a=o.ROTATE}break;case un.PAN:if(A.ctrlKey||A.metaKey||A.shiftKey){if(n.enableRotate===!1)return;w(A),a=o.ROTATE}else{if(n.enablePan===!1)return;z(A),a=o.PAN}break;default:a=o.NONE}a!==o.NONE&&(n.domElement.ownerDocument.addEventListener("pointermove",fe,!1),n.domElement.ownerDocument.addEventListener("pointerup",se,!1),n.dispatchEvent(r))}function _(A){if(n.enabled!==!1)switch(A.preventDefault(),a){case o.ROTATE:if(n.enableRotate===!1)return;V(A);break;case o.DOLLY:if(n.enableZoom===!1)return;q(A);break;case o.PAN:if(n.enablePan===!1)return;J(A);break}}function Y(A){n.domElement.ownerDocument.removeEventListener("pointermove",fe,!1),n.domElement.ownerDocument.removeEventListener("pointerup",se,!1),n.enabled!==!1&&(n.dispatchEvent(s),a=o.NONE)}function j(A){n.enabled===!1||n.enableZoom===!1||a!==o.NONE&&a!==o.ROTATE||(A.preventDefault(),A.stopPropagation(),n.dispatchEvent(r),le(A),n.dispatchEvent(s))}function I(A){n.enabled===!1||n.enableKeys===!1||n.enablePan===!1||ge(A)}function Z(A){if(n.enabled!==!1){switch(A.preventDefault(),A.touches.length){case 1:switch(n.touches.ONE){case fn.ROTATE:if(n.enableRotate===!1)return;Re(A),a=o.TOUCH_ROTATE;break;case fn.PAN:if(n.enablePan===!1)return;k(A),a=o.TOUCH_PAN;break;default:a=o.NONE}break;case 2:switch(n.touches.TWO){case fn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ue(A),a=o.TOUCH_DOLLY_PAN;break;case fn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Se(A),a=o.TOUCH_DOLLY_ROTATE;break;default:a=o.NONE}break;default:a=o.NONE}a!==o.NONE&&n.dispatchEvent(r)}}function re(A){if(n.enabled!==!1)switch(A.preventDefault(),A.stopPropagation(),a){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;xe(A),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;Pe(A),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;X(A),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;$(A),n.update();break;default:a=o.NONE}}function he(A){n.enabled!==!1&&(n.dispatchEvent(s),a=o.NONE)}function ee(A){n.enabled!==!1&&A.preventDefault()}n.domElement.addEventListener("contextmenu",ee,!1),n.domElement.addEventListener("pointerdown",te,!1),n.domElement.addEventListener("wheel",j,!1),n.domElement.addEventListener("touchstart",Z,!1),n.domElement.addEventListener("touchend",he,!1),n.domElement.addEventListener("touchmove",re,!1),n.domElement.addEventListener("keydown",I,!1),this.update()};fr.prototype=Object.create(Nt.prototype);fr.prototype.constructor=fr;var Oo=function(t,e){fr.call(this,t,e),this.screenSpacePanning=!1,this.mouseButtons.LEFT=un.PAN,this.mouseButtons.RIGHT=un.ROTATE,this.touches.ONE=fn.PAN,this.touches.TWO=fn.DOLLY_ROTATE};Oo.prototype=Object.create(Nt.prototype);Oo.prototype.constructor=Oo;const Zg={id:"home-page"},Jg={class:"star"},Kg=["onClick"],Qg=Nc('<div class="hx-box pa" data-v-c25f890e><ul class="pr" data-v-c25f890e><li class="hx-k1 pa0" data-v-c25f890e><span data-v-c25f890e></span></li><li class="hx-k2 pa0" data-v-c25f890e><span data-v-c25f890e></span></li><li class="hx-k3 pa0" data-v-c25f890e><span data-v-c25f890e></span></li></ul></div>',1),$g={class:"font-ht"},ev={key:0,class:"child-kuang"},tv=["onClick"],nv=Nc('<div style="--i:0s;" class="dot dot1" data-v-c25f890e></div><div style="--i:0s;" class="dot dot2" data-v-c25f890e></div><div style="--i:0s;" class="dot dot3" data-v-c25f890e></div><div style="--i:0s;" class="dot dot4" data-v-c25f890e></div><div style="--i:0s;" class="dot dot5" data-v-c25f890e></div>',5),Cn="https://cimweb.zjw.sh.cegn.cn:2007",iv="/cim-home/#/login",rv={__name:"HomePage",setup(t){let e=1;const n=bl();vr(!1);const i=wl();let r={renderer1:null,renderer2:null,renderer3:null,renderer4:null,renderer5:null},s={img1:new pn().load(Wg),img2:new pn().load(jg),img3:new pn().load(qg),img4:new pn().load(Xg),img5:new pn().load(Yg)};function o(S,O){var N;return(N=O.moduleId)==null?void 0:N.split(",").map(D=>+D).includes(+S)}function a(S){return!S.isOutZj&&!n.canSeeSystemArr.find(O=>o(+O.MODULE_ID,S))||S.disabled}let c={scene1:null,scene2:null,scene3:null,scene4:null,scene5:null},l={camera1:null,camera2:null,camera3:null,camera4:null,camera5:null},f={resizeObserver1:null,resizeObserver2:null,resizeObserver3:null,resizeObserver4:null,resizeObserver5:null};const h=localStorage.getItem("canSeeSystemArr")!==void 0?JSON.parse(localStorage.getItem("canSeeSystemArr")):null;Ml(()=>{});function d(){i.replace("/login")}function u(S,O,N){Pl(n.loginInfo.username,yr(n.loginInfo.psd),S).then(D=>{var C=D.msg;if(C.length==0){lt({type:"warning",message:"登录信息已失效!"});return}var w=C[0].Rows;if(S=="3"){var F=w[0].USERID,z=w[0].USERNAME,V=w[0].UNIT,q=w[0].UNIT_NAME,J=w[0].LAST_TIME,le=w[0].CHANGE_TIME,ge=w[0].ROLE_LIST,Re=w[0].TEMPUSERKEYCODE,k=w[0].ROLE_UUID;w[0].CHANGE_TIME;const Le={zhfx_usercode:F,zhfx_username:z,zhfx_unitcode:V,zhfx_unitname:q,zhfx_lasttime:J,zhfx_role:ge,zhfx_userkeycode:Re,zhfx_changetime:le,zhfx_role_uuid:k,zhfx_systemtype:w[0].SYSTEM_TYPE};debugger;localStorage.setItem("anaLoginUserInfo",JSON.stringify(Le)),window.open(O);return}}).catch(D=>{lt({type:"error",message:"登录失败"})})}function m(S,O){let N="",D="";h.forEach(w=>{if(w.MODULE_ID===S.moduleId){const F=encodeURIComponent(w.TICKET);N=w.o_path,D="?ticket="+F}});let C=O?Cn+iv:Cn+N+D;if(S.isOutZj){window.open(C,C);return}if(O){window.open(C,C);return}debugger;switch(S.moduleId){case"569":R(2,C);break;case"538":R(1,C);break;case"570":p(0,C);break;case"116":p(1,C);break;case"662":p(2,C);break;case"571,579":u(3,C);break;case"572":break;case"573":break;case"574":break;case"575":break;case"576":p(9,C);break;case"577":break;case"578":break;case"579":u(3,C);break;case"663":p(9,C);break;default:window.open(C)}}function v(S){debugger;let N={unit_id:JSON.parse(localStorage.getItem("loginUserInfoSpace")).ywxt_unitcode};Ol(N).then(D=>{let C=D.msg;if(C.length==0){lt({type:"error",message:"获取所属行业失败!"});return}if(C[0].TotalRowCount=="0"){lt({type:"error",message:"获取所属行业失败!"});return}let F=C[0].Rows;if(F.length==0){lt({type:"error",message:"获取所属行业失败!"});return}let z=[];for(var V=0;V<F.length;V++)z.push({code:F[V].CODE,name:F[V].NAME});for(var q="",V=0;V<z.length;V++)q+="code:"+z[V].code+",name:"+z[V].name+";";q=q.substring(0,q.length-1),localStorage.setItem("ywxt_unitclass",q),window.open(S,S)})}function y(S,O,N,D,C){var w={UNIT:S,userid:O,PLATE:N,OPERATION:D,OPERATIONRESULT:C,appkey:localStorage.getItem("ywxt_userkeycode")};Il(w).then(F=>{})}function g(S,O,N,D,C){let w={CODE:S,USERKEYCODE:O,LOGIN_LOCK:N,LOGIN_TYPE:D,LOGIN_COUNT:"0"};debugger;Nl(w).then(F=>{Fl(F,()=>{window.open(C,C)})})}function p(S,O,N){debugger;Al(n.loginInfo.username,yr(n.loginInfo.psd),S).then(D=>{var C=D.msg;if(C.length==0){lt({type:"warning",message:"登录信息已失效!"});return}var w=C[0].Rows;if(S=="0"){var F=w[0].USERID,z=w[0].USERNAME;w[0].NAME;var V=w[0].UNIT,q=w[0].UNIT_NAME,J=w[0].LAST_TIME,le=w[0].ROLE_CODE,ge=w[0].NAME,Re=w[0].PHONE,k=w[0].MAIL,Le=w[0].TEMPUSERKEYCODE;localStorage.setItem("zjw_usercode",F),localStorage.setItem("zjw_username",z),localStorage.setItem("zjw_unitcode",V),localStorage.setItem("zjw_unitname",q),localStorage.setItem("zjw_lasttime",J),localStorage.setItem("zjw_role",le),localStorage.setItem("zjw_name",ge),localStorage.setItem("zjw_phone",Re),localStorage.setItem("zjw_mail",k),localStorage.setItem("zjw_userkeycode",Le),g(F,Le,"1","0",O);return}if(S=="1"){var F=w[0].USERID,z=w[0].USERNAME;w[0].NAME;var V=w[0].UNIT,q=w[0].UNIT_NAME,J=w[0].LAST_TIME,ue=w[0].CHANGE_TIME,le=w[0].ROLE_CODE,Le=w[0].TEMPUSERKEYCODE,Se=w[0].QC,xe=w[0].TYSHDM,Pe=w[0].HLWJ,_e=w[0].ROLE_UUID;localStorage.setItem("yml_usercode",F),localStorage.setItem("yml_username",z),localStorage.setItem("yml_unitcode",V),localStorage.setItem("yml_unitname",q),localStorage.setItem("yml_lasttime",J),localStorage.setItem("yml_role",le),localStorage.setItem("yml_userkeycode",Le),localStorage.setItem("yml_changetime",ue),localStorage.setItem("zyml_role_uuid",_e),localStorage.setItem("yml_qc",Se),localStorage.setItem("yml_tyshdm",xe),localStorage.setItem("hlwj",Pe),g(F,Le,"1","1",O);return}if(S=="2"){var F=w[0].USERID,z=w[0].USERNAME;w[0].NAME;var V=w[0].UNIT,q=w[0].UNIT_NAME,J=w[0].LAST_TIME,X=w[0].CHANGE_TIME,le=w[0].ROLE_CODE,Le=w[0].TEMPUSERKEYCODE,$=w[0].ROLE_UUID;const I={ptjk_usercode:F,ptjk_username:z,ptjk_unitcode:V,ptjk_unitname:q,ptjk_lasttime:J,ptjk_changetime:X,ptjk_role:le," ptjk-part":"",ptjk_userkeycode:Le,ptjk_role_uuid:$};localStorage.setItem("dataWatchLoginUserInfo",JSON.stringify(I)),g(F,Le,"1","2",O);return}if(S=="9"){var F=w[0].USERID,z=w[0].USERNAME,V=w[0].UNIT,q=w[0].UNIT_NAME,J=w[0].LAST_TIME,le=w[0].ROLE_CODE,ge=w[0].NAME,Re=w[0].PHONE,k=w[0].MAIL,Le=w[0].TEMPUSERKEYCODE,X=w[0].CHANGE_TIME;localStorage.setItem("cstj_usercode",F),localStorage.setItem("cstj_username",z),localStorage.setItem("cstj_unitcode",V),localStorage.setItem("cstj_unitname",q),localStorage.setItem("cstj_lasttime",J),localStorage.setItem("cstj_role",le),localStorage.setItem("cstj_name",ge),localStorage.setItem("cstj_phone",Re),localStorage.setItem("cstj_mail",k),localStorage.setItem("cstj_userkeycode",Le),localStorage.setItem("cstj_changetime",X),g(F,Le,"1","9",O);return}}).catch(D=>{lt({type:"error",message:"登录失败"})})}function L(S,O){var N={user_id:S};Dl(N).then(D=>{var C=D.msg;if(C.length==0){lt({type:"error",message:"获取用户角色失败!"});return}var w=C[0].TotalRowCount;if(w=="0"){lt({type:"error",message:"获取用户角色失败!"});return}var F=C[0].Rows;if(F.length==0){lt({type:"error",message:"获取用户角色失败!"});return}for(var z=[],V=0;V<F.length;V++)z.push({code:F[V].ROLE_ID,name:F[V].ROLE_NAME});for(var q="",V=0;V<z.length;V++)q+="code:"+z[V].code+",name:"+z[V].name+";";q=q.substring(0,q.length-1),localStorage.setItem("ywxt_userrole",q);debugger;let J=JSON.parse(localStorage.getItem("loginUserInfoSpace"));J.role=F,localStorage.setItem("loginUserInfoSpace",JSON.stringify(J)),v(O)})}function R(S,O,N){Ll(n.loginInfo.username,yr(n.loginInfo.psd),S).then(D=>{debugger;let C=D.msg;if(C.length==0){lt({type:"warning",message:"登录信息失效"});return}let w=C[0].Rows;if(S=="1"){var F=w[0].USERID,z=w[0].UNIT,V=w[0].USERNAME;w[0].NAME;var q=w[0].PASSWORD,J=w[0].UNIT_NAME,le=w[0].CONTACT;w[0].SEX;var ge=w[0].TELPHONE,Re=w[0].MAIL,k=w[0].IS_IDENTIFY;w[0].TYPE;var Le=w[0].TEMPUSERKEYCODE,ue=w[0].CHANGE_TIME;debugger;Rl(F,Le).then(async xe=>{localStorage.setItem("ptjk_changetime",ue);const Pe={ywxt_usercode:F,ywxt_username:V,ywxt_unitcode:z,ywxt_unitname:J,ywxt_contact:le,ywxt_telephone:ge,ywxt_email:Re,ywxt_identify:k,ywxt_userkeycode:Le,ptjk_changetime:ue,role:xe.msg[0].Rows,password:q};localStorage.setItem("loginUserInfoSpace",JSON.stringify(Pe)),y(z,F,"运维系统-登录","登录系统成功","系统登录"),L(F,O)});return}if(S=="2"){var F=w[0].USERID,V=w[0].USERNAME;w[0].NAME;var q=w[0].PASSWORD,z=w[0].UNIT,J=w[0].UNIT_NAME,le=w[0].CONTACT;w[0].SEX;var ge=w[0].TELPHONE,Re=w[0].MAIL,k=w[0].IS_IDENTIFY;w[0].TYPE;var Le=w[0].TEMPUSERKEYCODE,Se=w[0].CHANGE_TIME;const Y={gxjh_usercode:F,gxjh_username:V,gxjh_unitcode:z,gxjh_unitname:J,gxjh_contact:le?decode(le):"",gxjh_telephone:ge?decode(ge):"",gxjh_email:Re?decode(Re):"",gxjh_identify:k,gxjh_userkeycode:Le,gxjh_changetime:Se};localStorage.setItem("exchangeUserInfo",JSON.stringify(Y)),y(z,F,"浏览系统-登录","登录系统成功","系统登录"),window.open(O,O);return}}).catch(D=>{debugger;lt({type:"error",message:"登录失败"})})}function T(){Cl(n.loginInfo.username,yr(n.loginInfo.psd)).then(S=>{let O=S.msg;if(O.length==0){lt({type:"warning",message:"登录信息失效"});return}let N=O[0].Rows[0];Tl.set("cim-token",N.TOKEN),localStorage.setItem("yyfnzt_user",JSON.stringify(N))}).catch(S=>{console.log(S,123132),lt({type:"error",message:"登录失败"})})}function x(S,O){if(S.path=="/power-home"&&T(),S.path){let N=i.resolve({path:S.path});window.open(N.href,"_blank")}else S.aPath&&m(S,O);ae.value.forEach(N=>{N.isExtend=N.name===S.name?!N.isExtend:!1})}function P(S){f["resizeObserver"+e]=new ResizeObserver(O=>{for(let N of O)if(N.target===U.value[S]){const D=N.contentRect.width,C=N.contentRect.height;l["camera"+e].aspect=D/C,l["camera"+e].updateProjectionMatrix(),r["renderer"+e].setSize(D,C),r["renderer"+e].render(c["scene"+e],l["camera"+e])}}),f["resizeObserver"+e].observe(U.value[S])}const U=vr(null);function K(S){let O=U.value[S].offsetWidth,N=U.value[S].offsetHeight,D=0;console.log(U.value,"我的",D),c["scene"+e]=new nl,l["camera"+e]=new Ke(45,O/N,.1,1e3),r["renderer"+e]=new gr({antialias:!0,alpha:!0}),r["renderer"+e].setSize(O,N),[].push(new yn({map:s["img"+(S+1)]}));const w=new hg(20,60,60);let F=new Hn({color:16777215,map:s["img"+(S+1)]}),z=new et(w,F);z.rotation.x=.1,c["scene"+e].add(z);let V=new Io(6710886);c["scene"+e].add(V);let q=new Lo(16777215);q.position.set(-40,160,100),q.castShadow=!0,c["scene"+e].add(q),l["camera"+e].position.x=-80,l["camera"+e].position.y=26,l["camera"+e].position.z=50,l["camera"+e].lookAt(c["scene"+e].position),J();function J(){z.rotation.y=D+=.005,requestAnimationFrame(J),r["renderer"+(S+1)].render(c["scene"+(S+1)],l["camera"+(S+1)])}let le=new fr(l["camera"+e],r["renderer"+e].domElement);le.enableZoomenableZoom=!1,U.value[S].appendChild(r["renderer"+e].domElement),P(S)}Sl(()=>{K(0),e++,K(1),e++,K(2),e++,K(3),e++,K(4)}),vr([{name:"上海市农民相对集中居住管理系统"},{name:"市体育局体育公共设施GIS系统"},{name:"城市体检专题评估系统"},{name:"上海城市维护项目管理信息系统"},{name:"杨浦大桥数字孪生"},{name:"上海市城市更新信息系统"}]);const ae=vr([{name:"GIS中台",children:[{name:"空间地理信息应用系统",aPath:"https://cimweb.zjw.sh.cegn.cn:2007/space-application/#/main/home",moduleId:"569",loginPage:Cn+"/space-application/#/login"},{name:"空间地理信息管理系统",aPath:"https://cimweb.zjw.sh.cegn.cn:2007/space-manage/#/main/GXYWWebsite/view/main/MainFrame",moduleId:"538",loginPage:Cn+"/space-manage/#/login"}]},{name:"BIM中台",children:[{name:"BIM数据应用系统",aPath:Cn+"/bim-application-web/#/index",moduleId:"1029",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"},{name:"BIM数据管理系统",aPath:Cn+"/BimManagement/#/dashboard",moduleId:"964",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"}]},{name:"IOT中台",children:[{name:"视频数据管理系统",aPath:"http://10.90.12.105:40490/#/login?redirect=/index",moduleId:"765",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"},{name:"视频数据应用系统",aPath:"http://10.90.12.105:40490/#/login?redirect=/index",moduleId:"749",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"},{name:"IOT数据应用系统",aPath:Cn+"http://10.90.13.56:8000",moduleId:"1282",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"},{name:"IOT数据管理系统",aPath:"http://10.90.14.52:16001/dmpweb/#/noLogin",moduleId:"765",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"}]},{name:`智能分析
  2801. AI中台`,children:[{name:"数据可视化系统",aPath:"http://10.1.152.195:3000/#/index",moduleId:"1030",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"},{name:"数据分析融合系统",aPath:"http://10.90.12.105:40499/#/index",moduleId:"1046",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"},{name:"数据治理监控",aPath:"https://cimweb.zjw.sh.cegn.cn:2007/space-monitor/#/home",moduleId:"662",loginPage:"https://cimweb.zjw.sh.cegn.cn:2007/cim-home/#/login"}]},{name:"应用赋能中台",path:"/power-home",moduleId:"651"}]);return(S,O)=>(Gn(),Vn("div",Zg,[En("div",{class:"title"},[En("div",{class:"text font-ht",onClick:d}," 上海市CIM平台 ")]),En("div",Jg,[(Gn(!0),Vn(Zo,null,Jo(ae.value,N=>(Gn(),Vn("div",{class:"bg1",onClick:D=>x(N,!Ko(n).canSeeSystemArr.find(C=>o(+C.MODULE_ID,N))&&!N.children&&N.aPath),key:N.name},[En("div",{class:"bgc",ref_for:!0,ref_key:"canvasGLTF",ref:U},null,512),Qg,En("div",{class:Qo(["text",{disabled:!Ko(n).canSeeSystemArr.find(D=>o(+D.MODULE_ID,N))&&!N.children&&N.aPath}])},[En("pre",$g,$o(N.name),1)],2),N.children&&N.isExtend?(Gn(),Vn("div",ev,[En("ul",null,[(Gn(!0),Vn(Zo,null,Jo(N.children,D=>(Gn(),Vn("li",{class:Qo(["font-ht",{disabled:a(D)}]),onClick:C=>x(D,a(D)),key:D.name},$o(D.name),11,tv))),128))])])):El("",!0)],8,Kg))),128)),nv])]))}},hv=_l(rv,[["__scopeId","data-v-c25f890e"]]);export{hv as default};