| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797 |
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function KP(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var tw={exports:{}},im={},nw={exports:{}},Bt={};/**
- * @license React
- * react.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Rf=Symbol.for("react.element"),YP=Symbol.for("react.portal"),QP=Symbol.for("react.fragment"),ZP=Symbol.for("react.strict_mode"),qP=Symbol.for("react.profiler"),$P=Symbol.for("react.provider"),eB=Symbol.for("react.context"),tB=Symbol.for("react.forward_ref"),nB=Symbol.for("react.suspense"),iB=Symbol.for("react.memo"),rB=Symbol.for("react.lazy"),HS=Symbol.iterator;function sB(n){return n===null||typeof n!="object"?null:(n=HS&&n[HS]||n["@@iterator"],typeof n=="function"?n:null)}var iw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rw=Object.assign,sw={};function Bc(n,e,t){this.props=n,this.context=e,this.refs=sw,this.updater=t||iw}Bc.prototype.isReactComponent={};Bc.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Bc.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function ow(){}ow.prototype=Bc.prototype;function __(n,e,t){this.props=n,this.context=e,this.refs=sw,this.updater=t||iw}var x_=__.prototype=new ow;x_.constructor=__;rw(x_,Bc.prototype);x_.isPureReactComponent=!0;var VS=Array.isArray,aw=Object.prototype.hasOwnProperty,A_={current:null},lw={key:!0,ref:!0,__self:!0,__source:!0};function cw(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)aw.call(e,i)&&!lw.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),f=0;f<a;f++)l[f]=arguments[f+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:Rf,type:n,key:s,ref:o,props:r,_owner:A_.current}}function oB(n,e){return{$$typeof:Rf,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function S_(n){return typeof n=="object"&&n!==null&&n.$$typeof===Rf}function aB(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var WS=/\/+/g;function rv(n,e){return typeof n=="object"&&n!==null&&n.key!=null?aB(""+n.key):e.toString(36)}function sp(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case Rf:case YP:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+rv(o,0):i,VS(r)?(t="",n!=null&&(t=n.replace(WS,"$&/")+"/"),sp(r,e,t,"",function(f){return f})):r!=null&&(S_(r)&&(r=oB(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(WS,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",VS(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+rv(s,a);o+=sp(s,e,t,l,r)}else if(l=sB(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+rv(s,a++),o+=sp(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Wh(n,e,t){if(n==null)return n;var i=[],r=0;return sp(n,i,"","",function(s){return e.call(t,s,r++)}),i}function lB(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var xi={current:null},op={transition:null},cB={ReactCurrentDispatcher:xi,ReactCurrentBatchConfig:op,ReactCurrentOwner:A_};function uw(){throw Error("act(...) is not supported in production builds of React.")}Bt.Children={map:Wh,forEach:function(n,e,t){Wh(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return Wh(n,function(){e++}),e},toArray:function(n){return Wh(n,function(e){return e})||[]},only:function(n){if(!S_(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Bt.Component=Bc;Bt.Fragment=QP;Bt.Profiler=qP;Bt.PureComponent=__;Bt.StrictMode=ZP;Bt.Suspense=nB;Bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cB;Bt.act=uw;Bt.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=rw({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=A_.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)aw.call(e,l)&&!lw.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var f=0;f<l;f++)a[f]=arguments[f+2];i.children=a}return{$$typeof:Rf,type:n.type,key:r,ref:s,props:i,_owner:o}};Bt.createContext=function(n){return n={$$typeof:eB,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:$P,_context:n},n.Consumer=n};Bt.createElement=cw;Bt.createFactory=function(n){var e=cw.bind(null,n);return e.type=n,e};Bt.createRef=function(){return{current:null}};Bt.forwardRef=function(n){return{$$typeof:tB,render:n}};Bt.isValidElement=S_;Bt.lazy=function(n){return{$$typeof:rB,_payload:{_status:-1,_result:n},_init:lB}};Bt.memo=function(n,e){return{$$typeof:iB,type:n,compare:e===void 0?null:e}};Bt.startTransition=function(n){var e=op.transition;op.transition={};try{n()}finally{op.transition=e}};Bt.unstable_act=uw;Bt.useCallback=function(n,e){return xi.current.useCallback(n,e)};Bt.useContext=function(n){return xi.current.useContext(n)};Bt.useDebugValue=function(){};Bt.useDeferredValue=function(n){return xi.current.useDeferredValue(n)};Bt.useEffect=function(n,e){return xi.current.useEffect(n,e)};Bt.useId=function(){return xi.current.useId()};Bt.useImperativeHandle=function(n,e,t){return xi.current.useImperativeHandle(n,e,t)};Bt.useInsertionEffect=function(n,e){return xi.current.useInsertionEffect(n,e)};Bt.useLayoutEffect=function(n,e){return xi.current.useLayoutEffect(n,e)};Bt.useMemo=function(n,e){return xi.current.useMemo(n,e)};Bt.useReducer=function(n,e,t){return xi.current.useReducer(n,e,t)};Bt.useRef=function(n){return xi.current.useRef(n)};Bt.useState=function(n){return xi.current.useState(n)};Bt.useSyncExternalStore=function(n,e,t){return xi.current.useSyncExternalStore(n,e,t)};Bt.useTransition=function(){return xi.current.useTransition()};Bt.version="18.3.1";nw.exports=Bt;var se=nw.exports;/**
- * @license React
- * react-jsx-runtime.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var uB=se,fB=Symbol.for("react.element"),hB=Symbol.for("react.fragment"),dB=Object.prototype.hasOwnProperty,pB=uB.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,mB={key:!0,ref:!0,__self:!0,__source:!0};function fw(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)dB.call(e,i)&&!mB.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:fB,type:n,key:s,ref:o,props:r,_owner:pB.current}}im.Fragment=hB;im.jsx=fw;im.jsxs=fw;tw.exports=im;var Rt=tw.exports,hw={exports:{}},Qi={},dw={exports:{}},pw={};/**
- * @license React
- * scheduler.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */(function(n){function e(O,V){var H=O.length;O.push(V);e:for(;0<H;){var q=H-1>>>1,ne=O[q];if(0<r(ne,V))O[q]=V,O[H]=ne,H=q;else break e}}function t(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var V=O[0],H=O.pop();if(H!==V){O[0]=H;e:for(var q=0,ne=O.length,Y=ne>>>1;q<Y;){var ue=2*(q+1)-1,Se=O[ue],Te=ue+1,Ce=O[Te];if(0>r(Se,H))Te<ne&&0>r(Ce,Se)?(O[q]=Ce,O[Te]=H,q=Te):(O[q]=Se,O[ue]=H,q=ue);else if(Te<ne&&0>r(Ce,H))O[q]=Ce,O[Te]=H,q=Te;else break e}}return V}function r(O,V){var H=O.sortIndex-V.sortIndex;return H!==0?H:O.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],f=[],h=1,d=null,p=3,m=!1,y=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(O){for(var V=t(f);V!==null;){if(V.callback===null)i(f);else if(V.startTime<=O)i(f),V.sortIndex=V.expirationTime,e(l,V);else break;V=t(f)}}function w(O){if(S=!1,M(O),!y)if(t(l)!==null)y=!0,Z(B);else{var V=t(f);V!==null&&ae(w,V.startTime-O)}}function B(O,V){y=!1,S&&(S=!1,g(L),L=-1),m=!0;var H=p;try{for(M(V),d=t(l);d!==null&&(!(d.expirationTime>V)||O&&!U());){var q=d.callback;if(typeof q=="function"){d.callback=null,p=d.priorityLevel;var ne=q(d.expirationTime<=V);V=n.unstable_now(),typeof ne=="function"?d.callback=ne:d===t(l)&&i(l),M(V)}else i(l);d=t(l)}if(d!==null)var Y=!0;else{var ue=t(f);ue!==null&&ae(w,ue.startTime-V),Y=!1}return Y}finally{d=null,p=H,m=!1}}var T=!1,b=null,L=-1,R=5,P=-1;function U(){return!(n.unstable_now()-P<R)}function K(){if(b!==null){var O=n.unstable_now();P=O;var V=!0;try{V=b(!0,O)}finally{V?ie():(T=!1,b=null)}}else T=!1}var ie;if(typeof _=="function")ie=function(){_(K)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,J=G.port2;G.port1.onmessage=K,ie=function(){J.postMessage(null)}}else ie=function(){A(K,0)};function Z(O){b=O,T||(T=!0,ie())}function ae(O,V){L=A(function(){O(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_continueExecution=function(){y||m||(y=!0,Z(B))},n.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<O?Math.floor(1e3/O):5},n.unstable_getCurrentPriorityLevel=function(){return p},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(O){switch(p){case 1:case 2:case 3:var V=3;break;default:V=p}var H=p;p=V;try{return O()}finally{p=H}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(O,V){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var H=p;p=O;try{return V()}finally{p=H}},n.unstable_scheduleCallback=function(O,V,H){var q=n.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?q+H:q):H=q,O){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=H+ne,O={id:h++,callback:V,priorityLevel:O,startTime:H,expirationTime:ne,sortIndex:-1},H>q?(O.sortIndex=H,e(f,O),t(l)===null&&O===t(f)&&(S?(g(L),L=-1):S=!0,ae(w,H-q))):(O.sortIndex=ne,e(l,O),y||m||(y=!0,Z(B))),O},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(O){var V=p;return function(){var H=p;p=V;try{return O.apply(this,arguments)}finally{p=H}}}})(pw);dw.exports=pw;var gB=dw.exports;/**
- * @license React
- * react-dom.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var vB=se,Yi=gB;function Ee(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var mw=new Set,Yu={};function Xa(n,e){pc(n,e),pc(n+"Capture",e)}function pc(n,e){for(Yu[n]=e,n=0;n<e.length;n++)mw.add(e[n])}var Gs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),P0=Object.prototype.hasOwnProperty,yB=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,XS={},JS={};function _B(n){return P0.call(JS,n)?!0:P0.call(XS,n)?!1:yB.test(n)?JS[n]=!0:(XS[n]=!0,!1)}function xB(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function AB(n,e,t,i){if(e===null||typeof e>"u"||xB(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ai(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var qn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){qn[n]=new Ai(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];qn[e]=new Ai(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){qn[n]=new Ai(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){qn[n]=new Ai(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){qn[n]=new Ai(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){qn[n]=new Ai(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){qn[n]=new Ai(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){qn[n]=new Ai(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){qn[n]=new Ai(n,5,!1,n.toLowerCase(),null,!1,!1)});var M_=/[\-:]([a-z])/g;function E_(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(M_,E_);qn[e]=new Ai(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(M_,E_);qn[e]=new Ai(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(M_,E_);qn[e]=new Ai(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){qn[n]=new Ai(n,1,!1,n.toLowerCase(),null,!1,!1)});qn.xlinkHref=new Ai("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){qn[n]=new Ai(n,1,!1,n.toLowerCase(),null,!0,!0)});function w_(n,e,t,i){var r=qn.hasOwnProperty(e)?qn[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(AB(e,t,r,i)&&(t=null),i||r===null?_B(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var js=vB.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Xh=Symbol.for("react.element"),Hl=Symbol.for("react.portal"),Vl=Symbol.for("react.fragment"),T_=Symbol.for("react.strict_mode"),B0=Symbol.for("react.profiler"),gw=Symbol.for("react.provider"),vw=Symbol.for("react.context"),C_=Symbol.for("react.forward_ref"),I0=Symbol.for("react.suspense"),L0=Symbol.for("react.suspense_list"),R_=Symbol.for("react.memo"),mo=Symbol.for("react.lazy"),yw=Symbol.for("react.offscreen"),jS=Symbol.iterator;function ou(n){return n===null||typeof n!="object"?null:(n=jS&&n[jS]||n["@@iterator"],typeof n=="function"?n:null)}var fn=Object.assign,sv;function Ru(n){if(sv===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);sv=e&&e[1]||""}return`
- `+sv+n}var ov=!1;function av(n,e){if(!n||ov)return"";ov=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(f){var i=f}Reflect.construct(n,[],e)}else{try{e.call()}catch(f){i=f}n.call(e.prototype)}else{try{throw Error()}catch(f){i=f}n()}}catch(f){if(f&&i&&typeof f.stack=="string"){for(var r=f.stack.split(`
- `),s=i.stack.split(`
- `),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==s[a]){var l=`
- `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{ov=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Ru(n):""}function SB(n){switch(n.tag){case 5:return Ru(n.type);case 16:return Ru("Lazy");case 13:return Ru("Suspense");case 19:return Ru("SuspenseList");case 0:case 2:case 15:return n=av(n.type,!1),n;case 11:return n=av(n.type.render,!1),n;case 1:return n=av(n.type,!0),n;default:return""}}function D0(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Vl:return"Fragment";case Hl:return"Portal";case B0:return"Profiler";case T_:return"StrictMode";case I0:return"Suspense";case L0:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case vw:return(n.displayName||"Context")+".Consumer";case gw:return(n._context.displayName||"Context")+".Provider";case C_:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case R_:return e=n.displayName||null,e!==null?e:D0(n.type)||"Memo";case mo:e=n._payload,n=n._init;try{return D0(n(e))}catch{}}return null}function MB(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D0(e);case 8:return e===T_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Do(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function _w(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function EB(n){var e=_w(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Jh(n){n._valueTracker||(n._valueTracker=EB(n))}function xw(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=_w(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function wp(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function F0(n,e){var t=e.checked;return fn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function KS(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Do(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Aw(n,e){e=e.checked,e!=null&&w_(n,"checked",e,!1)}function N0(n,e){Aw(n,e);var t=Do(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?U0(n,e.type,t):e.hasOwnProperty("defaultValue")&&U0(n,e.type,Do(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function YS(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function U0(n,e,t){(e!=="number"||wp(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var bu=Array.isArray;function sc(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Do(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function O0(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Ee(91));return fn({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function QS(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(Ee(92));if(bu(t)){if(1<t.length)throw Error(Ee(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Do(t)}}function Sw(n,e){var t=Do(e.value),i=Do(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function ZS(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function Mw(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function k0(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?Mw(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var jh,Ew=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(jh=jh||document.createElement("div"),jh.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=jh.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function Qu(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Lu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wB=["Webkit","ms","Moz","O"];Object.keys(Lu).forEach(function(n){wB.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Lu[e]=Lu[n]})});function ww(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Lu.hasOwnProperty(n)&&Lu[n]?(""+e).trim():e+"px"}function Tw(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=ww(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var TB=fn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function z0(n,e){if(e){if(TB[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ee(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ee(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ee(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ee(62))}}function G0(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var H0=null;function b_(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var V0=null,oc=null,ac=null;function qS(n){if(n=Bf(n)){if(typeof V0!="function")throw Error(Ee(280));var e=n.stateNode;e&&(e=lm(e),V0(n.stateNode,n.type,e))}}function Cw(n){oc?ac?ac.push(n):ac=[n]:oc=n}function Rw(){if(oc){var n=oc,e=ac;if(ac=oc=null,qS(n),e)for(n=0;n<e.length;n++)qS(e[n])}}function bw(n,e){return n(e)}function Pw(){}var lv=!1;function Bw(n,e,t){if(lv)return n(e,t);lv=!0;try{return bw(n,e,t)}finally{lv=!1,(oc!==null||ac!==null)&&(Pw(),Rw())}}function Zu(n,e){var t=n.stateNode;if(t===null)return null;var i=lm(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(Ee(231,e,typeof t));return t}var W0=!1;if(Gs)try{var au={};Object.defineProperty(au,"passive",{get:function(){W0=!0}}),window.addEventListener("test",au,au),window.removeEventListener("test",au,au)}catch{W0=!1}function CB(n,e,t,i,r,s,o,a,l){var f=Array.prototype.slice.call(arguments,3);try{e.apply(t,f)}catch(h){this.onError(h)}}var Du=!1,Tp=null,Cp=!1,X0=null,RB={onError:function(n){Du=!0,Tp=n}};function bB(n,e,t,i,r,s,o,a,l){Du=!1,Tp=null,CB.apply(RB,arguments)}function PB(n,e,t,i,r,s,o,a,l){if(bB.apply(this,arguments),Du){if(Du){var f=Tp;Du=!1,Tp=null}else throw Error(Ee(198));Cp||(Cp=!0,X0=f)}}function Ja(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function Iw(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function $S(n){if(Ja(n)!==n)throw Error(Ee(188))}function BB(n){var e=n.alternate;if(!e){if(e=Ja(n),e===null)throw Error(Ee(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return $S(r),n;if(s===i)return $S(r),e;s=s.sibling}throw Error(Ee(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(Ee(189))}}if(t.alternate!==i)throw Error(Ee(190))}if(t.tag!==3)throw Error(Ee(188));return t.stateNode.current===t?n:e}function Lw(n){return n=BB(n),n!==null?Dw(n):null}function Dw(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=Dw(n);if(e!==null)return e;n=n.sibling}return null}var Fw=Yi.unstable_scheduleCallback,eM=Yi.unstable_cancelCallback,IB=Yi.unstable_shouldYield,LB=Yi.unstable_requestPaint,Sn=Yi.unstable_now,DB=Yi.unstable_getCurrentPriorityLevel,P_=Yi.unstable_ImmediatePriority,Nw=Yi.unstable_UserBlockingPriority,Rp=Yi.unstable_NormalPriority,FB=Yi.unstable_LowPriority,Uw=Yi.unstable_IdlePriority,rm=null,rs=null;function NB(n){if(rs&&typeof rs.onCommitFiberRoot=="function")try{rs.onCommitFiberRoot(rm,n,void 0,(n.current.flags&128)===128)}catch{}}var kr=Math.clz32?Math.clz32:kB,UB=Math.log,OB=Math.LN2;function kB(n){return n>>>=0,n===0?32:31-(UB(n)/OB|0)|0}var Kh=64,Yh=4194304;function Pu(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function bp(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Pu(a):(s&=o,s!==0&&(i=Pu(s)))}else o=t&~r,o!==0?i=Pu(o):s!==0&&(i=Pu(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-kr(e),r=1<<t,i|=n[t],e&=~r;return i}function zB(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function GB(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-kr(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=zB(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function J0(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Ow(){var n=Kh;return Kh<<=1,!(Kh&4194240)&&(Kh=64),n}function cv(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function bf(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-kr(e),n[e]=t}function HB(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-kr(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function B_(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-kr(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var Ht=0;function kw(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var zw,I_,Gw,Hw,Vw,j0=!1,Qh=[],Mo=null,Eo=null,wo=null,qu=new Map,$u=new Map,vo=[],VB="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function tM(n,e){switch(n){case"focusin":case"focusout":Mo=null;break;case"dragenter":case"dragleave":Eo=null;break;case"mouseover":case"mouseout":wo=null;break;case"pointerover":case"pointerout":qu.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":$u.delete(e.pointerId)}}function lu(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Bf(e),e!==null&&I_(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function WB(n,e,t,i,r){switch(e){case"focusin":return Mo=lu(Mo,n,e,t,i,r),!0;case"dragenter":return Eo=lu(Eo,n,e,t,i,r),!0;case"mouseover":return wo=lu(wo,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return qu.set(s,lu(qu.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,$u.set(s,lu($u.get(s)||null,n,e,t,i,r)),!0}return!1}function Ww(n){var e=_a(n.target);if(e!==null){var t=Ja(e);if(t!==null){if(e=t.tag,e===13){if(e=Iw(t),e!==null){n.blockedOn=e,Vw(n.priority,function(){Gw(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function ap(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=K0(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);H0=i,t.target.dispatchEvent(i),H0=null}else return e=Bf(t),e!==null&&I_(e),n.blockedOn=t,!1;e.shift()}return!0}function nM(n,e,t){ap(n)&&t.delete(e)}function XB(){j0=!1,Mo!==null&&ap(Mo)&&(Mo=null),Eo!==null&&ap(Eo)&&(Eo=null),wo!==null&&ap(wo)&&(wo=null),qu.forEach(nM),$u.forEach(nM)}function cu(n,e){n.blockedOn===e&&(n.blockedOn=null,j0||(j0=!0,Yi.unstable_scheduleCallback(Yi.unstable_NormalPriority,XB)))}function ef(n){function e(r){return cu(r,n)}if(0<Qh.length){cu(Qh[0],n);for(var t=1;t<Qh.length;t++){var i=Qh[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Mo!==null&&cu(Mo,n),Eo!==null&&cu(Eo,n),wo!==null&&cu(wo,n),qu.forEach(e),$u.forEach(e),t=0;t<vo.length;t++)i=vo[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<vo.length&&(t=vo[0],t.blockedOn===null);)Ww(t),t.blockedOn===null&&vo.shift()}var lc=js.ReactCurrentBatchConfig,Pp=!0;function JB(n,e,t,i){var r=Ht,s=lc.transition;lc.transition=null;try{Ht=1,L_(n,e,t,i)}finally{Ht=r,lc.transition=s}}function jB(n,e,t,i){var r=Ht,s=lc.transition;lc.transition=null;try{Ht=4,L_(n,e,t,i)}finally{Ht=r,lc.transition=s}}function L_(n,e,t,i){if(Pp){var r=K0(n,e,t,i);if(r===null)_v(n,e,i,Bp,t),tM(n,i);else if(WB(r,n,e,t,i))i.stopPropagation();else if(tM(n,i),e&4&&-1<VB.indexOf(n)){for(;r!==null;){var s=Bf(r);if(s!==null&&zw(s),s=K0(n,e,t,i),s===null&&_v(n,e,i,Bp,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else _v(n,e,i,null,t)}}var Bp=null;function K0(n,e,t,i){if(Bp=null,n=b_(i),n=_a(n),n!==null)if(e=Ja(n),e===null)n=null;else if(t=e.tag,t===13){if(n=Iw(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return Bp=n,null}function Xw(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(DB()){case P_:return 1;case Nw:return 4;case Rp:case FB:return 16;case Uw:return 536870912;default:return 16}default:return 16}}var xo=null,D_=null,lp=null;function Jw(){if(lp)return lp;var n,e=D_,t=e.length,i,r="value"in xo?xo.value:xo.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return lp=r.slice(n,1<i?1-i:void 0)}function cp(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function Zh(){return!0}function iM(){return!1}function Zi(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Zh:iM,this.isPropagationStopped=iM,this}return fn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=Zh)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=Zh)},persist:function(){},isPersistent:Zh}),e}var Ic={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},F_=Zi(Ic),Pf=fn({},Ic,{view:0,detail:0}),KB=Zi(Pf),uv,fv,uu,sm=fn({},Pf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:N_,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==uu&&(uu&&n.type==="mousemove"?(uv=n.screenX-uu.screenX,fv=n.screenY-uu.screenY):fv=uv=0,uu=n),uv)},movementY:function(n){return"movementY"in n?n.movementY:fv}}),rM=Zi(sm),YB=fn({},sm,{dataTransfer:0}),QB=Zi(YB),ZB=fn({},Pf,{relatedTarget:0}),hv=Zi(ZB),qB=fn({},Ic,{animationName:0,elapsedTime:0,pseudoElement:0}),$B=Zi(qB),eI=fn({},Ic,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),tI=Zi(eI),nI=fn({},Ic,{data:0}),sM=Zi(nI),iI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rI={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},sI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oI(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=sI[n])?!!e[n]:!1}function N_(){return oI}var aI=fn({},Pf,{key:function(n){if(n.key){var e=iI[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=cp(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?rI[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:N_,charCode:function(n){return n.type==="keypress"?cp(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?cp(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),lI=Zi(aI),cI=fn({},sm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),oM=Zi(cI),uI=fn({},Pf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:N_}),fI=Zi(uI),hI=fn({},Ic,{propertyName:0,elapsedTime:0,pseudoElement:0}),dI=Zi(hI),pI=fn({},sm,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),mI=Zi(pI),gI=[9,13,27,32],U_=Gs&&"CompositionEvent"in window,Fu=null;Gs&&"documentMode"in document&&(Fu=document.documentMode);var vI=Gs&&"TextEvent"in window&&!Fu,jw=Gs&&(!U_||Fu&&8<Fu&&11>=Fu),aM=" ",lM=!1;function Kw(n,e){switch(n){case"keyup":return gI.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yw(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Wl=!1;function yI(n,e){switch(n){case"compositionend":return Yw(e);case"keypress":return e.which!==32?null:(lM=!0,aM);case"textInput":return n=e.data,n===aM&&lM?null:n;default:return null}}function _I(n,e){if(Wl)return n==="compositionend"||!U_&&Kw(n,e)?(n=Jw(),lp=D_=xo=null,Wl=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return jw&&e.locale!=="ko"?null:e.data;default:return null}}var xI={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function cM(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!xI[n.type]:e==="textarea"}function Qw(n,e,t,i){Cw(i),e=Ip(e,"onChange"),0<e.length&&(t=new F_("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var Nu=null,tf=null;function AI(n){aT(n,0)}function om(n){var e=jl(n);if(xw(e))return n}function SI(n,e){if(n==="change")return e}var Zw=!1;if(Gs){var dv;if(Gs){var pv="oninput"in document;if(!pv){var uM=document.createElement("div");uM.setAttribute("oninput","return;"),pv=typeof uM.oninput=="function"}dv=pv}else dv=!1;Zw=dv&&(!document.documentMode||9<document.documentMode)}function fM(){Nu&&(Nu.detachEvent("onpropertychange",qw),tf=Nu=null)}function qw(n){if(n.propertyName==="value"&&om(tf)){var e=[];Qw(e,tf,n,b_(n)),Bw(AI,e)}}function MI(n,e,t){n==="focusin"?(fM(),Nu=e,tf=t,Nu.attachEvent("onpropertychange",qw)):n==="focusout"&&fM()}function EI(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return om(tf)}function wI(n,e){if(n==="click")return om(e)}function TI(n,e){if(n==="input"||n==="change")return om(e)}function CI(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Gr=typeof Object.is=="function"?Object.is:CI;function nf(n,e){if(Gr(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!P0.call(e,r)||!Gr(n[r],e[r]))return!1}return!0}function hM(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function dM(n,e){var t=hM(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=hM(t)}}function $w(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?$w(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function eT(){for(var n=window,e=wp();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=wp(n.document)}return e}function O_(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function RI(n){var e=eT(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&$w(t.ownerDocument.documentElement,t)){if(i!==null&&O_(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=dM(t,s);var o=dM(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var bI=Gs&&"documentMode"in document&&11>=document.documentMode,Xl=null,Y0=null,Uu=null,Q0=!1;function pM(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Q0||Xl==null||Xl!==wp(i)||(i=Xl,"selectionStart"in i&&O_(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Uu&&nf(Uu,i)||(Uu=i,i=Ip(Y0,"onSelect"),0<i.length&&(e=new F_("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=Xl)))}function qh(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Jl={animationend:qh("Animation","AnimationEnd"),animationiteration:qh("Animation","AnimationIteration"),animationstart:qh("Animation","AnimationStart"),transitionend:qh("Transition","TransitionEnd")},mv={},tT={};Gs&&(tT=document.createElement("div").style,"AnimationEvent"in window||(delete Jl.animationend.animation,delete Jl.animationiteration.animation,delete Jl.animationstart.animation),"TransitionEvent"in window||delete Jl.transitionend.transition);function am(n){if(mv[n])return mv[n];if(!Jl[n])return n;var e=Jl[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in tT)return mv[n]=e[t];return n}var nT=am("animationend"),iT=am("animationiteration"),rT=am("animationstart"),sT=am("transitionend"),oT=new Map,mM="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function zo(n,e){oT.set(n,e),Xa(e,[n])}for(var gv=0;gv<mM.length;gv++){var vv=mM[gv],PI=vv.toLowerCase(),BI=vv[0].toUpperCase()+vv.slice(1);zo(PI,"on"+BI)}zo(nT,"onAnimationEnd");zo(iT,"onAnimationIteration");zo(rT,"onAnimationStart");zo("dblclick","onDoubleClick");zo("focusin","onFocus");zo("focusout","onBlur");zo(sT,"onTransitionEnd");pc("onMouseEnter",["mouseout","mouseover"]);pc("onMouseLeave",["mouseout","mouseover"]);pc("onPointerEnter",["pointerout","pointerover"]);pc("onPointerLeave",["pointerout","pointerover"]);Xa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Xa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Xa("onBeforeInput",["compositionend","keypress","textInput","paste"]);Xa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Xa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Xa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),II=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bu));function gM(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,PB(i,e,void 0,n),n.currentTarget=null}function aT(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,f=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;gM(r,a,f),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,f=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;gM(r,a,f),s=l}}}if(Cp)throw n=X0,Cp=!1,X0=null,n}function Yt(n,e){var t=e[ty];t===void 0&&(t=e[ty]=new Set);var i=n+"__bubble";t.has(i)||(lT(e,n,2,!1),t.add(i))}function yv(n,e,t){var i=0;e&&(i|=4),lT(t,n,i,e)}var $h="_reactListening"+Math.random().toString(36).slice(2);function rf(n){if(!n[$h]){n[$h]=!0,mw.forEach(function(t){t!=="selectionchange"&&(II.has(t)||yv(t,!1,n),yv(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[$h]||(e[$h]=!0,yv("selectionchange",!1,e))}}function lT(n,e,t,i){switch(Xw(e)){case 1:var r=JB;break;case 4:r=jB;break;default:r=L_}t=r.bind(null,e,t,n),r=void 0,!W0||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function _v(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=_a(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}Bw(function(){var f=s,h=b_(t),d=[];e:{var p=oT.get(n);if(p!==void 0){var m=F_,y=n;switch(n){case"keypress":if(cp(t)===0)break e;case"keydown":case"keyup":m=lI;break;case"focusin":y="focus",m=hv;break;case"focusout":y="blur",m=hv;break;case"beforeblur":case"afterblur":m=hv;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=rM;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=QB;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=fI;break;case nT:case iT:case rT:m=$B;break;case sT:m=dI;break;case"scroll":m=KB;break;case"wheel":m=mI;break;case"copy":case"cut":case"paste":m=tI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=oM}var S=(e&4)!==0,A=!S&&n==="scroll",g=S?p!==null?p+"Capture":null:p;S=[];for(var _=f,M;_!==null;){M=_;var w=M.stateNode;if(M.tag===5&&w!==null&&(M=w,g!==null&&(w=Zu(_,g),w!=null&&S.push(sf(_,w,M)))),A)break;_=_.return}0<S.length&&(p=new m(p,y,null,t,h),d.push({event:p,listeners:S}))}}if(!(e&7)){e:{if(p=n==="mouseover"||n==="pointerover",m=n==="mouseout"||n==="pointerout",p&&t!==H0&&(y=t.relatedTarget||t.fromElement)&&(_a(y)||y[Hs]))break e;if((m||p)&&(p=h.window===h?h:(p=h.ownerDocument)?p.defaultView||p.parentWindow:window,m?(y=t.relatedTarget||t.toElement,m=f,y=y?_a(y):null,y!==null&&(A=Ja(y),y!==A||y.tag!==5&&y.tag!==6)&&(y=null)):(m=null,y=f),m!==y)){if(S=rM,w="onMouseLeave",g="onMouseEnter",_="mouse",(n==="pointerout"||n==="pointerover")&&(S=oM,w="onPointerLeave",g="onPointerEnter",_="pointer"),A=m==null?p:jl(m),M=y==null?p:jl(y),p=new S(w,_+"leave",m,t,h),p.target=A,p.relatedTarget=M,w=null,_a(h)===f&&(S=new S(g,_+"enter",y,t,h),S.target=M,S.relatedTarget=A,w=S),A=w,m&&y)t:{for(S=m,g=y,_=0,M=S;M;M=pl(M))_++;for(M=0,w=g;w;w=pl(w))M++;for(;0<_-M;)S=pl(S),_--;for(;0<M-_;)g=pl(g),M--;for(;_--;){if(S===g||g!==null&&S===g.alternate)break t;S=pl(S),g=pl(g)}S=null}else S=null;m!==null&&vM(d,p,m,S,!1),y!==null&&A!==null&&vM(d,A,y,S,!0)}}e:{if(p=f?jl(f):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var B=SI;else if(cM(p))if(Zw)B=TI;else{B=EI;var T=MI}else(m=p.nodeName)&&m.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(B=wI);if(B&&(B=B(n,f))){Qw(d,B,t,h);break e}T&&T(n,p,f),n==="focusout"&&(T=p._wrapperState)&&T.controlled&&p.type==="number"&&U0(p,"number",p.value)}switch(T=f?jl(f):window,n){case"focusin":(cM(T)||T.contentEditable==="true")&&(Xl=T,Y0=f,Uu=null);break;case"focusout":Uu=Y0=Xl=null;break;case"mousedown":Q0=!0;break;case"contextmenu":case"mouseup":case"dragend":Q0=!1,pM(d,t,h);break;case"selectionchange":if(bI)break;case"keydown":case"keyup":pM(d,t,h)}var b;if(U_)e:{switch(n){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else Wl?Kw(n,t)&&(L="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(L="onCompositionStart");L&&(jw&&t.locale!=="ko"&&(Wl||L!=="onCompositionStart"?L==="onCompositionEnd"&&Wl&&(b=Jw()):(xo=h,D_="value"in xo?xo.value:xo.textContent,Wl=!0)),T=Ip(f,L),0<T.length&&(L=new sM(L,n,null,t,h),d.push({event:L,listeners:T}),b?L.data=b:(b=Yw(t),b!==null&&(L.data=b)))),(b=vI?yI(n,t):_I(n,t))&&(f=Ip(f,"onBeforeInput"),0<f.length&&(h=new sM("onBeforeInput","beforeinput",null,t,h),d.push({event:h,listeners:f}),h.data=b))}aT(d,e)})}function sf(n,e,t){return{instance:n,listener:e,currentTarget:t}}function Ip(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Zu(n,t),s!=null&&i.unshift(sf(n,s,r)),s=Zu(n,e),s!=null&&i.push(sf(n,s,r))),n=n.return}return i}function pl(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function vM(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,f=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&f!==null&&(a=f,r?(l=Zu(t,s),l!=null&&o.unshift(sf(t,l,a))):r||(l=Zu(t,s),l!=null&&o.push(sf(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var LI=/\r\n?/g,DI=/\u0000|\uFFFD/g;function yM(n){return(typeof n=="string"?n:""+n).replace(LI,`
- `).replace(DI,"")}function ed(n,e,t){if(e=yM(e),yM(n)!==e&&t)throw Error(Ee(425))}function Lp(){}var Z0=null,q0=null;function $0(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ey=typeof setTimeout=="function"?setTimeout:void 0,FI=typeof clearTimeout=="function"?clearTimeout:void 0,_M=typeof Promise=="function"?Promise:void 0,NI=typeof queueMicrotask=="function"?queueMicrotask:typeof _M<"u"?function(n){return _M.resolve(null).then(n).catch(UI)}:ey;function UI(n){setTimeout(function(){throw n})}function xv(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),ef(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);ef(e)}function To(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function xM(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var Lc=Math.random().toString(36).slice(2),ns="__reactFiber$"+Lc,of="__reactProps$"+Lc,Hs="__reactContainer$"+Lc,ty="__reactEvents$"+Lc,OI="__reactListeners$"+Lc,kI="__reactHandles$"+Lc;function _a(n){var e=n[ns];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Hs]||t[ns]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=xM(n);n!==null;){if(t=n[ns])return t;n=xM(n)}return e}n=t,t=n.parentNode}return null}function Bf(n){return n=n[ns]||n[Hs],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function jl(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(Ee(33))}function lm(n){return n[of]||null}var ny=[],Kl=-1;function Go(n){return{current:n}}function qt(n){0>Kl||(n.current=ny[Kl],ny[Kl]=null,Kl--)}function jt(n,e){Kl++,ny[Kl]=n.current,n.current=e}var Fo={},fi=Go(Fo),Bi=Go(!1),Fa=Fo;function mc(n,e){var t=n.type.contextTypes;if(!t)return Fo;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Ii(n){return n=n.childContextTypes,n!=null}function Dp(){qt(Bi),qt(fi)}function AM(n,e,t){if(fi.current!==Fo)throw Error(Ee(168));jt(fi,e),jt(Bi,t)}function cT(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Ee(108,MB(n)||"Unknown",r));return fn({},t,i)}function Fp(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Fo,Fa=fi.current,jt(fi,n),jt(Bi,Bi.current),!0}function SM(n,e,t){var i=n.stateNode;if(!i)throw Error(Ee(169));t?(n=cT(n,e,Fa),i.__reactInternalMemoizedMergedChildContext=n,qt(Bi),qt(fi),jt(fi,n)):qt(Bi),jt(Bi,t)}var bs=null,cm=!1,Av=!1;function uT(n){bs===null?bs=[n]:bs.push(n)}function zI(n){cm=!0,uT(n)}function Ho(){if(!Av&&bs!==null){Av=!0;var n=0,e=Ht;try{var t=bs;for(Ht=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}bs=null,cm=!1}catch(r){throw bs!==null&&(bs=bs.slice(n+1)),Fw(P_,Ho),r}finally{Ht=e,Av=!1}}return null}var Yl=[],Ql=0,Np=null,Up=0,hr=[],dr=0,Na=null,Ls=1,Ds="";function da(n,e){Yl[Ql++]=Up,Yl[Ql++]=Np,Np=n,Up=e}function fT(n,e,t){hr[dr++]=Ls,hr[dr++]=Ds,hr[dr++]=Na,Na=n;var i=Ls;n=Ds;var r=32-kr(i)-1;i&=~(1<<r),t+=1;var s=32-kr(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,Ls=1<<32-kr(e)+r|t<<r|i,Ds=s+n}else Ls=1<<s|t<<r|i,Ds=n}function k_(n){n.return!==null&&(da(n,1),fT(n,1,0))}function z_(n){for(;n===Np;)Np=Yl[--Ql],Yl[Ql]=null,Up=Yl[--Ql],Yl[Ql]=null;for(;n===Na;)Na=hr[--dr],hr[dr]=null,Ds=hr[--dr],hr[dr]=null,Ls=hr[--dr],hr[dr]=null}var ji=null,Xi=null,rn=!1,Dr=null;function hT(n,e){var t=vr(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function MM(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,ji=n,Xi=To(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,ji=n,Xi=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Na!==null?{id:Ls,overflow:Ds}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=vr(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,ji=n,Xi=null,!0):!1;default:return!1}}function iy(n){return(n.mode&1)!==0&&(n.flags&128)===0}function ry(n){if(rn){var e=Xi;if(e){var t=e;if(!MM(n,e)){if(iy(n))throw Error(Ee(418));e=To(t.nextSibling);var i=ji;e&&MM(n,e)?hT(i,t):(n.flags=n.flags&-4097|2,rn=!1,ji=n)}}else{if(iy(n))throw Error(Ee(418));n.flags=n.flags&-4097|2,rn=!1,ji=n}}}function EM(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;ji=n}function td(n){if(n!==ji)return!1;if(!rn)return EM(n),rn=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!$0(n.type,n.memoizedProps)),e&&(e=Xi)){if(iy(n))throw dT(),Error(Ee(418));for(;e;)hT(n,e),e=To(e.nextSibling)}if(EM(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(Ee(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Xi=To(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Xi=null}}else Xi=ji?To(n.stateNode.nextSibling):null;return!0}function dT(){for(var n=Xi;n;)n=To(n.nextSibling)}function gc(){Xi=ji=null,rn=!1}function G_(n){Dr===null?Dr=[n]:Dr.push(n)}var GI=js.ReactCurrentBatchConfig;function fu(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(Ee(309));var i=t.stateNode}if(!i)throw Error(Ee(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(Ee(284));if(!t._owner)throw Error(Ee(290,n))}return n}function nd(n,e){throw n=Object.prototype.toString.call(e),Error(Ee(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function wM(n){var e=n._init;return e(n._payload)}function pT(n){function e(g,_){if(n){var M=g.deletions;M===null?(g.deletions=[_],g.flags|=16):M.push(_)}}function t(g,_){if(!n)return null;for(;_!==null;)e(g,_),_=_.sibling;return null}function i(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function r(g,_){return g=Po(g,_),g.index=0,g.sibling=null,g}function s(g,_,M){return g.index=M,n?(M=g.alternate,M!==null?(M=M.index,M<_?(g.flags|=2,_):M):(g.flags|=2,_)):(g.flags|=1048576,_)}function o(g){return n&&g.alternate===null&&(g.flags|=2),g}function a(g,_,M,w){return _===null||_.tag!==6?(_=Rv(M,g.mode,w),_.return=g,_):(_=r(_,M),_.return=g,_)}function l(g,_,M,w){var B=M.type;return B===Vl?h(g,_,M.props.children,w,M.key):_!==null&&(_.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===mo&&wM(B)===_.type)?(w=r(_,M.props),w.ref=fu(g,_,M),w.return=g,w):(w=gp(M.type,M.key,M.props,null,g.mode,w),w.ref=fu(g,_,M),w.return=g,w)}function f(g,_,M,w){return _===null||_.tag!==4||_.stateNode.containerInfo!==M.containerInfo||_.stateNode.implementation!==M.implementation?(_=bv(M,g.mode,w),_.return=g,_):(_=r(_,M.children||[]),_.return=g,_)}function h(g,_,M,w,B){return _===null||_.tag!==7?(_=ba(M,g.mode,w,B),_.return=g,_):(_=r(_,M),_.return=g,_)}function d(g,_,M){if(typeof _=="string"&&_!==""||typeof _=="number")return _=Rv(""+_,g.mode,M),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Xh:return M=gp(_.type,_.key,_.props,null,g.mode,M),M.ref=fu(g,null,_),M.return=g,M;case Hl:return _=bv(_,g.mode,M),_.return=g,_;case mo:var w=_._init;return d(g,w(_._payload),M)}if(bu(_)||ou(_))return _=ba(_,g.mode,M,null),_.return=g,_;nd(g,_)}return null}function p(g,_,M,w){var B=_!==null?_.key:null;if(typeof M=="string"&&M!==""||typeof M=="number")return B!==null?null:a(g,_,""+M,w);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case Xh:return M.key===B?l(g,_,M,w):null;case Hl:return M.key===B?f(g,_,M,w):null;case mo:return B=M._init,p(g,_,B(M._payload),w)}if(bu(M)||ou(M))return B!==null?null:h(g,_,M,w,null);nd(g,M)}return null}function m(g,_,M,w,B){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(M)||null,a(_,g,""+w,B);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Xh:return g=g.get(w.key===null?M:w.key)||null,l(_,g,w,B);case Hl:return g=g.get(w.key===null?M:w.key)||null,f(_,g,w,B);case mo:var T=w._init;return m(g,_,M,T(w._payload),B)}if(bu(w)||ou(w))return g=g.get(M)||null,h(_,g,w,B,null);nd(_,w)}return null}function y(g,_,M,w){for(var B=null,T=null,b=_,L=_=0,R=null;b!==null&&L<M.length;L++){b.index>L?(R=b,b=null):R=b.sibling;var P=p(g,b,M[L],w);if(P===null){b===null&&(b=R);break}n&&b&&P.alternate===null&&e(g,b),_=s(P,_,L),T===null?B=P:T.sibling=P,T=P,b=R}if(L===M.length)return t(g,b),rn&&da(g,L),B;if(b===null){for(;L<M.length;L++)b=d(g,M[L],w),b!==null&&(_=s(b,_,L),T===null?B=b:T.sibling=b,T=b);return rn&&da(g,L),B}for(b=i(g,b);L<M.length;L++)R=m(b,g,L,M[L],w),R!==null&&(n&&R.alternate!==null&&b.delete(R.key===null?L:R.key),_=s(R,_,L),T===null?B=R:T.sibling=R,T=R);return n&&b.forEach(function(U){return e(g,U)}),rn&&da(g,L),B}function S(g,_,M,w){var B=ou(M);if(typeof B!="function")throw Error(Ee(150));if(M=B.call(M),M==null)throw Error(Ee(151));for(var T=B=null,b=_,L=_=0,R=null,P=M.next();b!==null&&!P.done;L++,P=M.next()){b.index>L?(R=b,b=null):R=b.sibling;var U=p(g,b,P.value,w);if(U===null){b===null&&(b=R);break}n&&b&&U.alternate===null&&e(g,b),_=s(U,_,L),T===null?B=U:T.sibling=U,T=U,b=R}if(P.done)return t(g,b),rn&&da(g,L),B;if(b===null){for(;!P.done;L++,P=M.next())P=d(g,P.value,w),P!==null&&(_=s(P,_,L),T===null?B=P:T.sibling=P,T=P);return rn&&da(g,L),B}for(b=i(g,b);!P.done;L++,P=M.next())P=m(b,g,L,P.value,w),P!==null&&(n&&P.alternate!==null&&b.delete(P.key===null?L:P.key),_=s(P,_,L),T===null?B=P:T.sibling=P,T=P);return n&&b.forEach(function(K){return e(g,K)}),rn&&da(g,L),B}function A(g,_,M,w){if(typeof M=="object"&&M!==null&&M.type===Vl&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case Xh:e:{for(var B=M.key,T=_;T!==null;){if(T.key===B){if(B=M.type,B===Vl){if(T.tag===7){t(g,T.sibling),_=r(T,M.props.children),_.return=g,g=_;break e}}else if(T.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===mo&&wM(B)===T.type){t(g,T.sibling),_=r(T,M.props),_.ref=fu(g,T,M),_.return=g,g=_;break e}t(g,T);break}else e(g,T);T=T.sibling}M.type===Vl?(_=ba(M.props.children,g.mode,w,M.key),_.return=g,g=_):(w=gp(M.type,M.key,M.props,null,g.mode,w),w.ref=fu(g,_,M),w.return=g,g=w)}return o(g);case Hl:e:{for(T=M.key;_!==null;){if(_.key===T)if(_.tag===4&&_.stateNode.containerInfo===M.containerInfo&&_.stateNode.implementation===M.implementation){t(g,_.sibling),_=r(_,M.children||[]),_.return=g,g=_;break e}else{t(g,_);break}else e(g,_);_=_.sibling}_=bv(M,g.mode,w),_.return=g,g=_}return o(g);case mo:return T=M._init,A(g,_,T(M._payload),w)}if(bu(M))return y(g,_,M,w);if(ou(M))return S(g,_,M,w);nd(g,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,_!==null&&_.tag===6?(t(g,_.sibling),_=r(_,M),_.return=g,g=_):(t(g,_),_=Rv(M,g.mode,w),_.return=g,g=_),o(g)):t(g,_)}return A}var vc=pT(!0),mT=pT(!1),Op=Go(null),kp=null,Zl=null,H_=null;function V_(){H_=Zl=kp=null}function W_(n){var e=Op.current;qt(Op),n._currentValue=e}function sy(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function cc(n,e){kp=n,H_=Zl=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Pi=!0),n.firstContext=null)}function xr(n){var e=n._currentValue;if(H_!==n)if(n={context:n,memoizedValue:e,next:null},Zl===null){if(kp===null)throw Error(Ee(308));Zl=n,kp.dependencies={lanes:0,firstContext:n}}else Zl=Zl.next=n;return e}var xa=null;function X_(n){xa===null?xa=[n]:xa.push(n)}function gT(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,X_(e)):(t.next=r.next,r.next=t),e.interleaved=t,Vs(n,i)}function Vs(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var go=!1;function J_(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vT(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Us(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Co(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Ut&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Vs(n,t)}return r=i.interleaved,r===null?(e.next=e,X_(i)):(e.next=r.next,r.next=e),i.interleaved=e,Vs(n,t)}function up(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,B_(n,t)}}function TM(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function zp(n,e,t,i){var r=n.updateQueue;go=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,f=l.next;l.next=null,o===null?s=f:o.next=f,o=l;var h=n.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=f:a.next=f,h.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;o=0,h=f=l=null,a=s;do{var p=a.lane,m=a.eventTime;if((i&p)===p){h!==null&&(h=h.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=n,S=a;switch(p=e,m=t,S.tag){case 1:if(y=S.payload,typeof y=="function"){d=y.call(m,d,p);break e}d=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=S.payload,p=typeof y=="function"?y.call(m,d,p):y,p==null)break e;d=fn({},d,p);break e;case 2:go=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,p=r.effects,p===null?r.effects=[a]:p.push(a))}else m={eventTime:m,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(f=h=m,l=d):h=h.next=m,o|=p;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(h===null&&(l=d),r.baseState=l,r.firstBaseUpdate=f,r.lastBaseUpdate=h,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Oa|=o,n.lanes=o,n.memoizedState=d}}function CM(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(Ee(191,r));r.call(i)}}}var If={},ss=Go(If),af=Go(If),lf=Go(If);function Aa(n){if(n===If)throw Error(Ee(174));return n}function j_(n,e){switch(jt(lf,e),jt(af,n),jt(ss,If),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:k0(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=k0(e,n)}qt(ss),jt(ss,e)}function yc(){qt(ss),qt(af),qt(lf)}function yT(n){Aa(lf.current);var e=Aa(ss.current),t=k0(e,n.type);e!==t&&(jt(af,n),jt(ss,t))}function K_(n){af.current===n&&(qt(ss),qt(af))}var an=Go(0);function Gp(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Sv=[];function Y_(){for(var n=0;n<Sv.length;n++)Sv[n]._workInProgressVersionPrimary=null;Sv.length=0}var fp=js.ReactCurrentDispatcher,Mv=js.ReactCurrentBatchConfig,Ua=0,un=null,bn=null,Hn=null,Hp=!1,Ou=!1,cf=0,HI=0;function si(){throw Error(Ee(321))}function Q_(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!Gr(n[t],e[t]))return!1;return!0}function Z_(n,e,t,i,r,s){if(Ua=s,un=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,fp.current=n===null||n.memoizedState===null?JI:jI,n=t(i,r),Ou){s=0;do{if(Ou=!1,cf=0,25<=s)throw Error(Ee(301));s+=1,Hn=bn=null,e.updateQueue=null,fp.current=KI,n=t(i,r)}while(Ou)}if(fp.current=Vp,e=bn!==null&&bn.next!==null,Ua=0,Hn=bn=un=null,Hp=!1,e)throw Error(Ee(300));return n}function q_(){var n=cf!==0;return cf=0,n}function ts(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Hn===null?un.memoizedState=Hn=n:Hn=Hn.next=n,Hn}function Ar(){if(bn===null){var n=un.alternate;n=n!==null?n.memoizedState:null}else n=bn.next;var e=Hn===null?un.memoizedState:Hn.next;if(e!==null)Hn=e,bn=n;else{if(n===null)throw Error(Ee(310));bn=n,n={memoizedState:bn.memoizedState,baseState:bn.baseState,baseQueue:bn.baseQueue,queue:bn.queue,next:null},Hn===null?un.memoizedState=Hn=n:Hn=Hn.next=n}return Hn}function uf(n,e){return typeof e=="function"?e(n):e}function Ev(n){var e=Ar(),t=e.queue;if(t===null)throw Error(Ee(311));t.lastRenderedReducer=n;var i=bn,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,f=s;do{var h=f.lane;if((Ua&h)===h)l!==null&&(l=l.next={lane:0,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null}),i=f.hasEagerState?f.eagerState:n(i,f.action);else{var d={lane:h,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null};l===null?(a=l=d,o=i):l=l.next=d,un.lanes|=h,Oa|=h}f=f.next}while(f!==null&&f!==s);l===null?o=i:l.next=a,Gr(i,e.memoizedState)||(Pi=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,un.lanes|=s,Oa|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function wv(n){var e=Ar(),t=e.queue;if(t===null)throw Error(Ee(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);Gr(s,e.memoizedState)||(Pi=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function _T(){}function xT(n,e){var t=un,i=Ar(),r=e(),s=!Gr(i.memoizedState,r);if(s&&(i.memoizedState=r,Pi=!0),i=i.queue,$_(MT.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||Hn!==null&&Hn.memoizedState.tag&1){if(t.flags|=2048,ff(9,ST.bind(null,t,i,r,e),void 0,null),Vn===null)throw Error(Ee(349));Ua&30||AT(t,e,r)}return r}function AT(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=un.updateQueue,e===null?(e={lastEffect:null,stores:null},un.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function ST(n,e,t,i){e.value=t,e.getSnapshot=i,ET(e)&&wT(n)}function MT(n,e,t){return t(function(){ET(e)&&wT(n)})}function ET(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Gr(n,t)}catch{return!0}}function wT(n){var e=Vs(n,1);e!==null&&zr(e,n,1,-1)}function RM(n){var e=ts();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:uf,lastRenderedState:n},e.queue=n,n=n.dispatch=XI.bind(null,un,n),[e.memoizedState,n]}function ff(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=un.updateQueue,e===null?(e={lastEffect:null,stores:null},un.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function TT(){return Ar().memoizedState}function hp(n,e,t,i){var r=ts();un.flags|=n,r.memoizedState=ff(1|e,t,void 0,i===void 0?null:i)}function um(n,e,t,i){var r=Ar();i=i===void 0?null:i;var s=void 0;if(bn!==null){var o=bn.memoizedState;if(s=o.destroy,i!==null&&Q_(i,o.deps)){r.memoizedState=ff(e,t,s,i);return}}un.flags|=n,r.memoizedState=ff(1|e,t,s,i)}function bM(n,e){return hp(8390656,8,n,e)}function $_(n,e){return um(2048,8,n,e)}function CT(n,e){return um(4,2,n,e)}function RT(n,e){return um(4,4,n,e)}function bT(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function PT(n,e,t){return t=t!=null?t.concat([n]):null,um(4,4,bT.bind(null,e,n),t)}function ex(){}function BT(n,e){var t=Ar();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Q_(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function IT(n,e){var t=Ar();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Q_(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function LT(n,e,t){return Ua&21?(Gr(t,e)||(t=Ow(),un.lanes|=t,Oa|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,Pi=!0),n.memoizedState=t)}function VI(n,e){var t=Ht;Ht=t!==0&&4>t?t:4,n(!0);var i=Mv.transition;Mv.transition={};try{n(!1),e()}finally{Ht=t,Mv.transition=i}}function DT(){return Ar().memoizedState}function WI(n,e,t){var i=bo(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},FT(n))NT(e,t);else if(t=gT(n,e,t,i),t!==null){var r=yi();zr(t,n,i,r),UT(t,e,i)}}function XI(n,e,t){var i=bo(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(FT(n))NT(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Gr(a,o)){var l=e.interleaved;l===null?(r.next=r,X_(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=gT(n,e,r,i),t!==null&&(r=yi(),zr(t,n,i,r),UT(t,e,i))}}function FT(n){var e=n.alternate;return n===un||e!==null&&e===un}function NT(n,e){Ou=Hp=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function UT(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,B_(n,t)}}var Vp={readContext:xr,useCallback:si,useContext:si,useEffect:si,useImperativeHandle:si,useInsertionEffect:si,useLayoutEffect:si,useMemo:si,useReducer:si,useRef:si,useState:si,useDebugValue:si,useDeferredValue:si,useTransition:si,useMutableSource:si,useSyncExternalStore:si,useId:si,unstable_isNewReconciler:!1},JI={readContext:xr,useCallback:function(n,e){return ts().memoizedState=[n,e===void 0?null:e],n},useContext:xr,useEffect:bM,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,hp(4194308,4,bT.bind(null,e,n),t)},useLayoutEffect:function(n,e){return hp(4194308,4,n,e)},useInsertionEffect:function(n,e){return hp(4,2,n,e)},useMemo:function(n,e){var t=ts();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=ts();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=WI.bind(null,un,n),[i.memoizedState,n]},useRef:function(n){var e=ts();return n={current:n},e.memoizedState=n},useState:RM,useDebugValue:ex,useDeferredValue:function(n){return ts().memoizedState=n},useTransition:function(){var n=RM(!1),e=n[0];return n=VI.bind(null,n[1]),ts().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=un,r=ts();if(rn){if(t===void 0)throw Error(Ee(407));t=t()}else{if(t=e(),Vn===null)throw Error(Ee(349));Ua&30||AT(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,bM(MT.bind(null,i,s,n),[n]),i.flags|=2048,ff(9,ST.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=ts(),e=Vn.identifierPrefix;if(rn){var t=Ds,i=Ls;t=(i&~(1<<32-kr(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=cf++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=HI++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},jI={readContext:xr,useCallback:BT,useContext:xr,useEffect:$_,useImperativeHandle:PT,useInsertionEffect:CT,useLayoutEffect:RT,useMemo:IT,useReducer:Ev,useRef:TT,useState:function(){return Ev(uf)},useDebugValue:ex,useDeferredValue:function(n){var e=Ar();return LT(e,bn.memoizedState,n)},useTransition:function(){var n=Ev(uf)[0],e=Ar().memoizedState;return[n,e]},useMutableSource:_T,useSyncExternalStore:xT,useId:DT,unstable_isNewReconciler:!1},KI={readContext:xr,useCallback:BT,useContext:xr,useEffect:$_,useImperativeHandle:PT,useInsertionEffect:CT,useLayoutEffect:RT,useMemo:IT,useReducer:wv,useRef:TT,useState:function(){return wv(uf)},useDebugValue:ex,useDeferredValue:function(n){var e=Ar();return bn===null?e.memoizedState=n:LT(e,bn.memoizedState,n)},useTransition:function(){var n=wv(uf)[0],e=Ar().memoizedState;return[n,e]},useMutableSource:_T,useSyncExternalStore:xT,useId:DT,unstable_isNewReconciler:!1};function Br(n,e){if(n&&n.defaultProps){e=fn({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function oy(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:fn({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var fm={isMounted:function(n){return(n=n._reactInternals)?Ja(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=yi(),r=bo(n),s=Us(i,r);s.payload=e,t!=null&&(s.callback=t),e=Co(n,s,r),e!==null&&(zr(e,n,r,i),up(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=yi(),r=bo(n),s=Us(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Co(n,s,r),e!==null&&(zr(e,n,r,i),up(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=yi(),i=bo(n),r=Us(t,i);r.tag=2,e!=null&&(r.callback=e),e=Co(n,r,i),e!==null&&(zr(e,n,i,t),up(e,n,i))}};function PM(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!nf(t,i)||!nf(r,s):!0}function OT(n,e,t){var i=!1,r=Fo,s=e.contextType;return typeof s=="object"&&s!==null?s=xr(s):(r=Ii(e)?Fa:fi.current,i=e.contextTypes,s=(i=i!=null)?mc(n,r):Fo),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=fm,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function BM(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&fm.enqueueReplaceState(e,e.state,null)}function ay(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},J_(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=xr(s):(s=Ii(e)?Fa:fi.current,r.context=mc(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(oy(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&fm.enqueueReplaceState(r,r.state,null),zp(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function _c(n,e){try{var t="",i=e;do t+=SB(i),i=i.return;while(i);var r=t}catch(s){r=`
- Error generating stack: `+s.message+`
- `+s.stack}return{value:n,source:e,stack:r,digest:null}}function Tv(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function ly(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var YI=typeof WeakMap=="function"?WeakMap:Map;function kT(n,e,t){t=Us(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){Xp||(Xp=!0,yy=i),ly(n,e)},t}function zT(n,e,t){t=Us(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){ly(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){ly(n,e),typeof i!="function"&&(Ro===null?Ro=new Set([this]):Ro.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function IM(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new YI;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=cL.bind(null,n,e,t),e.then(n,n))}function LM(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function DM(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Us(-1,1),e.tag=2,Co(t,e,1))),t.lanes|=1),n)}var QI=js.ReactCurrentOwner,Pi=!1;function gi(n,e,t,i){e.child=n===null?mT(e,null,t,i):vc(e,n.child,t,i)}function FM(n,e,t,i,r){t=t.render;var s=e.ref;return cc(e,r),i=Z_(n,e,t,i,s,r),t=q_(),n!==null&&!Pi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,Ws(n,e,r)):(rn&&t&&k_(e),e.flags|=1,gi(n,e,i,r),e.child)}function NM(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!lx(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,GT(n,e,s,i,r)):(n=gp(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:nf,t(o,i)&&n.ref===e.ref)return Ws(n,e,r)}return e.flags|=1,n=Po(s,i),n.ref=e.ref,n.return=e,e.child=n}function GT(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(nf(s,i)&&n.ref===e.ref)if(Pi=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(Pi=!0);else return e.lanes=n.lanes,Ws(n,e,r)}return cy(n,e,t,i,r)}function HT(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},jt($l,Hi),Hi|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,jt($l,Hi),Hi|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,jt($l,Hi),Hi|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,jt($l,Hi),Hi|=i;return gi(n,e,r,t),e.child}function VT(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function cy(n,e,t,i,r){var s=Ii(t)?Fa:fi.current;return s=mc(e,s),cc(e,r),t=Z_(n,e,t,i,s,r),i=q_(),n!==null&&!Pi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,Ws(n,e,r)):(rn&&i&&k_(e),e.flags|=1,gi(n,e,t,r),e.child)}function UM(n,e,t,i,r){if(Ii(t)){var s=!0;Fp(e)}else s=!1;if(cc(e,r),e.stateNode===null)dp(n,e),OT(e,t,i),ay(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,f=t.contextType;typeof f=="object"&&f!==null?f=xr(f):(f=Ii(t)?Fa:fi.current,f=mc(e,f));var h=t.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==f)&&BM(e,o,i,f),go=!1;var p=e.memoizedState;o.state=p,zp(e,i,o,r),l=e.memoizedState,a!==i||p!==l||Bi.current||go?(typeof h=="function"&&(oy(e,t,h,i),l=e.memoizedState),(a=go||PM(e,t,a,i,p,l,f))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=f,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,vT(n,e),a=e.memoizedProps,f=e.type===e.elementType?a:Br(e.type,a),o.props=f,d=e.pendingProps,p=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=xr(l):(l=Ii(t)?Fa:fi.current,l=mc(e,l));var m=t.getDerivedStateFromProps;(h=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||p!==l)&&BM(e,o,i,l),go=!1,p=e.memoizedState,o.state=p,zp(e,i,o,r);var y=e.memoizedState;a!==d||p!==y||Bi.current||go?(typeof m=="function"&&(oy(e,t,m,i),y=e.memoizedState),(f=go||PM(e,t,f,i,p,y,l)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,y,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,y,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=y),o.props=i,o.state=y,o.context=l,i=f):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&p===n.memoizedState||(e.flags|=1024),i=!1)}return uy(n,e,t,i,s,r)}function uy(n,e,t,i,r,s){VT(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&SM(e,t,!1),Ws(n,e,s);i=e.stateNode,QI.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=vc(e,n.child,null,s),e.child=vc(e,null,a,s)):gi(n,e,a,s),e.memoizedState=i.state,r&&SM(e,t,!0),e.child}function WT(n){var e=n.stateNode;e.pendingContext?AM(n,e.pendingContext,e.pendingContext!==e.context):e.context&&AM(n,e.context,!1),j_(n,e.containerInfo)}function OM(n,e,t,i,r){return gc(),G_(r),e.flags|=256,gi(n,e,t,i),e.child}var fy={dehydrated:null,treeContext:null,retryLane:0};function hy(n){return{baseLanes:n,cachePool:null,transitions:null}}function XT(n,e,t){var i=e.pendingProps,r=an.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),jt(an,r&1),n===null)return ry(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=pm(o,i,0,null),n=ba(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=hy(t),e.memoizedState=fy,n):tx(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return ZI(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Po(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=Po(a,s):(s=ba(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?hy(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=fy,i}return s=n.child,n=s.sibling,i=Po(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function tx(n,e){return e=pm({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function id(n,e,t,i){return i!==null&&G_(i),vc(e,n.child,null,t),n=tx(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function ZI(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=Tv(Error(Ee(422))),id(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=pm({mode:"visible",children:i.children},r,0,null),s=ba(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&vc(e,n.child,null,o),e.child.memoizedState=hy(o),e.memoizedState=fy,s);if(!(e.mode&1))return id(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(Ee(419)),i=Tv(s,i,void 0),id(n,e,o,i)}if(a=(o&n.childLanes)!==0,Pi||a){if(i=Vn,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,Vs(n,r),zr(i,n,r,-1))}return ax(),i=Tv(Error(Ee(421))),id(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=uL.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Xi=To(r.nextSibling),ji=e,rn=!0,Dr=null,n!==null&&(hr[dr++]=Ls,hr[dr++]=Ds,hr[dr++]=Na,Ls=n.id,Ds=n.overflow,Na=e),e=tx(e,i.children),e.flags|=4096,e)}function kM(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),sy(n.return,e,t)}function Cv(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function JT(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(gi(n,e,i.children,t),i=an.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&kM(n,t,e);else if(n.tag===19)kM(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(jt(an,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Gp(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Cv(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Gp(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Cv(e,!0,t,null,s);break;case"together":Cv(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function dp(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function Ws(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Oa|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Ee(153));if(e.child!==null){for(n=e.child,t=Po(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Po(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function qI(n,e,t){switch(e.tag){case 3:WT(e),gc();break;case 5:yT(e);break;case 1:Ii(e.type)&&Fp(e);break;case 4:j_(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;jt(Op,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(jt(an,an.current&1),e.flags|=128,null):t&e.child.childLanes?XT(n,e,t):(jt(an,an.current&1),n=Ws(n,e,t),n!==null?n.sibling:null);jt(an,an.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return JT(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),jt(an,an.current),i)break;return null;case 22:case 23:return e.lanes=0,HT(n,e,t)}return Ws(n,e,t)}var jT,dy,KT,YT;jT=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};dy=function(){};KT=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Aa(ss.current);var s=null;switch(t){case"input":r=F0(n,r),i=F0(n,i),s=[];break;case"select":r=fn({},r,{value:void 0}),i=fn({},i,{value:void 0}),s=[];break;case"textarea":r=O0(n,r),i=O0(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=Lp)}z0(t,i);var o;t=null;for(f in r)if(!i.hasOwnProperty(f)&&r.hasOwnProperty(f)&&r[f]!=null)if(f==="style"){var a=r[f];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else f!=="dangerouslySetInnerHTML"&&f!=="children"&&f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(Yu.hasOwnProperty(f)?s||(s=[]):(s=s||[]).push(f,null));for(f in i){var l=i[f];if(a=r!=null?r[f]:void 0,i.hasOwnProperty(f)&&l!==a&&(l!=null||a!=null))if(f==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(f,t)),t=l;else f==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(f,l)):f==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(f,""+l):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&(Yu.hasOwnProperty(f)?(l!=null&&f==="onScroll"&&Yt("scroll",n),s||a===l||(s=[])):(s=s||[]).push(f,l))}t&&(s=s||[]).push("style",t);var f=s;(e.updateQueue=f)&&(e.flags|=4)}};YT=function(n,e,t,i){t!==i&&(e.flags|=4)};function hu(n,e){if(!rn)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function oi(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function $I(n,e,t){var i=e.pendingProps;switch(z_(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return oi(e),null;case 1:return Ii(e.type)&&Dp(),oi(e),null;case 3:return i=e.stateNode,yc(),qt(Bi),qt(fi),Y_(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(td(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Dr!==null&&(Ay(Dr),Dr=null))),dy(n,e),oi(e),null;case 5:K_(e);var r=Aa(lf.current);if(t=e.type,n!==null&&e.stateNode!=null)KT(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(Ee(166));return oi(e),null}if(n=Aa(ss.current),td(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[ns]=e,i[of]=s,n=(e.mode&1)!==0,t){case"dialog":Yt("cancel",i),Yt("close",i);break;case"iframe":case"object":case"embed":Yt("load",i);break;case"video":case"audio":for(r=0;r<Bu.length;r++)Yt(Bu[r],i);break;case"source":Yt("error",i);break;case"img":case"image":case"link":Yt("error",i),Yt("load",i);break;case"details":Yt("toggle",i);break;case"input":KS(i,s),Yt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},Yt("invalid",i);break;case"textarea":QS(i,s),Yt("invalid",i)}z0(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&ed(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&ed(i.textContent,a,n),r=["children",""+a]):Yu.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Yt("scroll",i)}switch(t){case"input":Jh(i),YS(i,s,!0);break;case"textarea":Jh(i),ZS(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=Lp)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=Mw(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[ns]=e,n[of]=i,jT(n,e,!1,!1),e.stateNode=n;e:{switch(o=G0(t,i),t){case"dialog":Yt("cancel",n),Yt("close",n),r=i;break;case"iframe":case"object":case"embed":Yt("load",n),r=i;break;case"video":case"audio":for(r=0;r<Bu.length;r++)Yt(Bu[r],n);r=i;break;case"source":Yt("error",n),r=i;break;case"img":case"image":case"link":Yt("error",n),Yt("load",n),r=i;break;case"details":Yt("toggle",n),r=i;break;case"input":KS(n,i),r=F0(n,i),Yt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=fn({},i,{value:void 0}),Yt("invalid",n);break;case"textarea":QS(n,i),r=O0(n,i),Yt("invalid",n);break;default:r=i}z0(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?Tw(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Ew(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&Qu(n,l):typeof l=="number"&&Qu(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Yu.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Yt("scroll",n):l!=null&&w_(n,s,l,o))}switch(t){case"input":Jh(n),YS(n,i,!1);break;case"textarea":Jh(n),ZS(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Do(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?sc(n,!!i.multiple,s,!1):i.defaultValue!=null&&sc(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=Lp)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return oi(e),null;case 6:if(n&&e.stateNode!=null)YT(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(Ee(166));if(t=Aa(lf.current),Aa(ss.current),td(e)){if(i=e.stateNode,t=e.memoizedProps,i[ns]=e,(s=i.nodeValue!==t)&&(n=ji,n!==null))switch(n.tag){case 3:ed(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&ed(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[ns]=e,e.stateNode=i}return oi(e),null;case 13:if(qt(an),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(rn&&Xi!==null&&e.mode&1&&!(e.flags&128))dT(),gc(),e.flags|=98560,s=!1;else if(s=td(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(Ee(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Ee(317));s[ns]=e}else gc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;oi(e),s=!1}else Dr!==null&&(Ay(Dr),Dr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||an.current&1?In===0&&(In=3):ax())),e.updateQueue!==null&&(e.flags|=4),oi(e),null);case 4:return yc(),dy(n,e),n===null&&rf(e.stateNode.containerInfo),oi(e),null;case 10:return W_(e.type._context),oi(e),null;case 17:return Ii(e.type)&&Dp(),oi(e),null;case 19:if(qt(an),s=e.memoizedState,s===null)return oi(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)hu(s,!1);else{if(In!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=Gp(n),o!==null){for(e.flags|=128,hu(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return jt(an,an.current&1|2),e.child}n=n.sibling}s.tail!==null&&Sn()>xc&&(e.flags|=128,i=!0,hu(s,!1),e.lanes=4194304)}else{if(!i)if(n=Gp(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),hu(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!rn)return oi(e),null}else 2*Sn()-s.renderingStartTime>xc&&t!==1073741824&&(e.flags|=128,i=!0,hu(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Sn(),e.sibling=null,t=an.current,jt(an,i?t&1|2:t&1),e):(oi(e),null);case 22:case 23:return ox(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Hi&1073741824&&(oi(e),e.subtreeFlags&6&&(e.flags|=8192)):oi(e),null;case 24:return null;case 25:return null}throw Error(Ee(156,e.tag))}function eL(n,e){switch(z_(e),e.tag){case 1:return Ii(e.type)&&Dp(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return yc(),qt(Bi),qt(fi),Y_(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return K_(e),null;case 13:if(qt(an),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ee(340));gc()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return qt(an),null;case 4:return yc(),null;case 10:return W_(e.type._context),null;case 22:case 23:return ox(),null;case 24:return null;default:return null}}var rd=!1,ui=!1,tL=typeof WeakSet=="function"?WeakSet:Set,Je=null;function ql(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){mn(n,e,i)}else t.current=null}function py(n,e,t){try{t()}catch(i){mn(n,e,i)}}var zM=!1;function nL(n,e){if(Z0=Pp,n=eT(),O_(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,f=0,h=0,d=n,p=null;t:for(;;){for(var m;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===n)break t;if(p===t&&++f===r&&(a=o),p===s&&++h===i&&(l=o),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(q0={focusedElem:n,selectionRange:t},Pp=!1,Je=e;Je!==null;)if(e=Je,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Je=n;else for(;Je!==null;){e=Je;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var S=y.memoizedProps,A=y.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?S:Br(e.type,S),A);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var M=e.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ee(163))}}catch(w){mn(e,e.return,w)}if(n=e.sibling,n!==null){n.return=e.return,Je=n;break}Je=e.return}return y=zM,zM=!1,y}function ku(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&py(e,t,s)}r=r.next}while(r!==i)}}function hm(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function my(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function QT(n){var e=n.alternate;e!==null&&(n.alternate=null,QT(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[ns],delete e[of],delete e[ty],delete e[OI],delete e[kI])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function ZT(n){return n.tag===5||n.tag===3||n.tag===4}function GM(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||ZT(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function gy(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Lp));else if(i!==4&&(n=n.child,n!==null))for(gy(n,e,t),n=n.sibling;n!==null;)gy(n,e,t),n=n.sibling}function vy(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(vy(n,e,t),n=n.sibling;n!==null;)vy(n,e,t),n=n.sibling}var Kn=null,Lr=!1;function ro(n,e,t){for(t=t.child;t!==null;)qT(n,e,t),t=t.sibling}function qT(n,e,t){if(rs&&typeof rs.onCommitFiberUnmount=="function")try{rs.onCommitFiberUnmount(rm,t)}catch{}switch(t.tag){case 5:ui||ql(t,e);case 6:var i=Kn,r=Lr;Kn=null,ro(n,e,t),Kn=i,Lr=r,Kn!==null&&(Lr?(n=Kn,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Kn.removeChild(t.stateNode));break;case 18:Kn!==null&&(Lr?(n=Kn,t=t.stateNode,n.nodeType===8?xv(n.parentNode,t):n.nodeType===1&&xv(n,t),ef(n)):xv(Kn,t.stateNode));break;case 4:i=Kn,r=Lr,Kn=t.stateNode.containerInfo,Lr=!0,ro(n,e,t),Kn=i,Lr=r;break;case 0:case 11:case 14:case 15:if(!ui&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&py(t,e,o),r=r.next}while(r!==i)}ro(n,e,t);break;case 1:if(!ui&&(ql(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){mn(t,e,a)}ro(n,e,t);break;case 21:ro(n,e,t);break;case 22:t.mode&1?(ui=(i=ui)||t.memoizedState!==null,ro(n,e,t),ui=i):ro(n,e,t);break;default:ro(n,e,t)}}function HM(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new tL),e.forEach(function(i){var r=fL.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Tr(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Kn=a.stateNode,Lr=!1;break e;case 3:Kn=a.stateNode.containerInfo,Lr=!0;break e;case 4:Kn=a.stateNode.containerInfo,Lr=!0;break e}a=a.return}if(Kn===null)throw Error(Ee(160));qT(s,o,r),Kn=null,Lr=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(f){mn(r,e,f)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)$T(e,n),e=e.sibling}function $T(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Tr(e,n),es(n),i&4){try{ku(3,n,n.return),hm(3,n)}catch(S){mn(n,n.return,S)}try{ku(5,n,n.return)}catch(S){mn(n,n.return,S)}}break;case 1:Tr(e,n),es(n),i&512&&t!==null&&ql(t,t.return);break;case 5:if(Tr(e,n),es(n),i&512&&t!==null&&ql(t,t.return),n.flags&32){var r=n.stateNode;try{Qu(r,"")}catch(S){mn(n,n.return,S)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&Aw(r,s),G0(a,o);var f=G0(a,s);for(o=0;o<l.length;o+=2){var h=l[o],d=l[o+1];h==="style"?Tw(r,d):h==="dangerouslySetInnerHTML"?Ew(r,d):h==="children"?Qu(r,d):w_(r,h,d,f)}switch(a){case"input":N0(r,s);break;case"textarea":Sw(r,s);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var m=s.value;m!=null?sc(r,!!s.multiple,m,!1):p!==!!s.multiple&&(s.defaultValue!=null?sc(r,!!s.multiple,s.defaultValue,!0):sc(r,!!s.multiple,s.multiple?[]:"",!1))}r[of]=s}catch(S){mn(n,n.return,S)}}break;case 6:if(Tr(e,n),es(n),i&4){if(n.stateNode===null)throw Error(Ee(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(S){mn(n,n.return,S)}}break;case 3:if(Tr(e,n),es(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{ef(e.containerInfo)}catch(S){mn(n,n.return,S)}break;case 4:Tr(e,n),es(n);break;case 13:Tr(e,n),es(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(rx=Sn())),i&4&&HM(n);break;case 22:if(h=t!==null&&t.memoizedState!==null,n.mode&1?(ui=(f=ui)||h,Tr(e,n),ui=f):Tr(e,n),es(n),i&8192){if(f=n.memoizedState!==null,(n.stateNode.isHidden=f)&&!h&&n.mode&1)for(Je=n,h=n.child;h!==null;){for(d=Je=h;Je!==null;){switch(p=Je,m=p.child,p.tag){case 0:case 11:case 14:case 15:ku(4,p,p.return);break;case 1:ql(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){i=p,t=p.return;try{e=i,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(S){mn(i,t,S)}}break;case 5:ql(p,p.return);break;case 22:if(p.memoizedState!==null){WM(d);continue}}m!==null?(m.return=p,Je=m):WM(d)}h=h.sibling}e:for(h=null,d=n;;){if(d.tag===5){if(h===null){h=d;try{r=d.stateNode,f?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=ww("display",o))}catch(S){mn(n,n.return,S)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=f?"":d.memoizedProps}catch(S){mn(n,n.return,S)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===n)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===n)break e;for(;d.sibling===null;){if(d.return===null||d.return===n)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Tr(e,n),es(n),i&4&&HM(n);break;case 21:break;default:Tr(e,n),es(n)}}function es(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(ZT(t)){var i=t;break e}t=t.return}throw Error(Ee(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(Qu(r,""),i.flags&=-33);var s=GM(n);vy(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=GM(n);gy(n,a,o);break;default:throw Error(Ee(161))}}catch(l){mn(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function iL(n,e,t){Je=n,eC(n)}function eC(n,e,t){for(var i=(n.mode&1)!==0;Je!==null;){var r=Je,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||rd;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||ui;a=rd;var f=ui;if(rd=o,(ui=l)&&!f)for(Je=r;Je!==null;)o=Je,l=o.child,o.tag===22&&o.memoizedState!==null?XM(r):l!==null?(l.return=o,Je=l):XM(r);for(;s!==null;)Je=s,eC(s),s=s.sibling;Je=r,rd=a,ui=f}VM(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,Je=s):VM(n)}}function VM(n){for(;Je!==null;){var e=Je;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:ui||hm(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!ui)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:Br(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&CM(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}CM(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var f=e.alternate;if(f!==null){var h=f.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&ef(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ee(163))}ui||e.flags&512&&my(e)}catch(p){mn(e,e.return,p)}}if(e===n){Je=null;break}if(t=e.sibling,t!==null){t.return=e.return,Je=t;break}Je=e.return}}function WM(n){for(;Je!==null;){var e=Je;if(e===n){Je=null;break}var t=e.sibling;if(t!==null){t.return=e.return,Je=t;break}Je=e.return}}function XM(n){for(;Je!==null;){var e=Je;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{hm(4,e)}catch(l){mn(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){mn(e,r,l)}}var s=e.return;try{my(e)}catch(l){mn(e,s,l)}break;case 5:var o=e.return;try{my(e)}catch(l){mn(e,o,l)}}}catch(l){mn(e,e.return,l)}if(e===n){Je=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Je=a;break}Je=e.return}}var rL=Math.ceil,Wp=js.ReactCurrentDispatcher,nx=js.ReactCurrentOwner,yr=js.ReactCurrentBatchConfig,Ut=0,Vn=null,Cn=null,Yn=0,Hi=0,$l=Go(0),In=0,hf=null,Oa=0,dm=0,ix=0,zu=null,Ci=null,rx=0,xc=1/0,Cs=null,Xp=!1,yy=null,Ro=null,sd=!1,Ao=null,Jp=0,Gu=0,_y=null,pp=-1,mp=0;function yi(){return Ut&6?Sn():pp!==-1?pp:pp=Sn()}function bo(n){return n.mode&1?Ut&2&&Yn!==0?Yn&-Yn:GI.transition!==null?(mp===0&&(mp=Ow()),mp):(n=Ht,n!==0||(n=window.event,n=n===void 0?16:Xw(n.type)),n):1}function zr(n,e,t,i){if(50<Gu)throw Gu=0,_y=null,Error(Ee(185));bf(n,t,i),(!(Ut&2)||n!==Vn)&&(n===Vn&&(!(Ut&2)&&(dm|=t),In===4&&yo(n,Yn)),Li(n,i),t===1&&Ut===0&&!(e.mode&1)&&(xc=Sn()+500,cm&&Ho()))}function Li(n,e){var t=n.callbackNode;GB(n,e);var i=bp(n,n===Vn?Yn:0);if(i===0)t!==null&&eM(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&eM(t),e===1)n.tag===0?zI(JM.bind(null,n)):uT(JM.bind(null,n)),NI(function(){!(Ut&6)&&Ho()}),t=null;else{switch(kw(i)){case 1:t=P_;break;case 4:t=Nw;break;case 16:t=Rp;break;case 536870912:t=Uw;break;default:t=Rp}t=lC(t,tC.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function tC(n,e){if(pp=-1,mp=0,Ut&6)throw Error(Ee(327));var t=n.callbackNode;if(uc()&&n.callbackNode!==t)return null;var i=bp(n,n===Vn?Yn:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=jp(n,i);else{e=i;var r=Ut;Ut|=2;var s=iC();(Vn!==n||Yn!==e)&&(Cs=null,xc=Sn()+500,Ra(n,e));do try{aL();break}catch(a){nC(n,a)}while(!0);V_(),Wp.current=s,Ut=r,Cn!==null?e=0:(Vn=null,Yn=0,e=In)}if(e!==0){if(e===2&&(r=J0(n),r!==0&&(i=r,e=xy(n,r))),e===1)throw t=hf,Ra(n,0),yo(n,i),Li(n,Sn()),t;if(e===6)yo(n,i);else{if(r=n.current.alternate,!(i&30)&&!sL(r)&&(e=jp(n,i),e===2&&(s=J0(n),s!==0&&(i=s,e=xy(n,s))),e===1))throw t=hf,Ra(n,0),yo(n,i),Li(n,Sn()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(Ee(345));case 2:pa(n,Ci,Cs);break;case 3:if(yo(n,i),(i&130023424)===i&&(e=rx+500-Sn(),10<e)){if(bp(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){yi(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=ey(pa.bind(null,n,Ci,Cs),e);break}pa(n,Ci,Cs);break;case 4:if(yo(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-kr(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Sn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*rL(i/1960))-i,10<i){n.timeoutHandle=ey(pa.bind(null,n,Ci,Cs),i);break}pa(n,Ci,Cs);break;case 5:pa(n,Ci,Cs);break;default:throw Error(Ee(329))}}}return Li(n,Sn()),n.callbackNode===t?tC.bind(null,n):null}function xy(n,e){var t=zu;return n.current.memoizedState.isDehydrated&&(Ra(n,e).flags|=256),n=jp(n,e),n!==2&&(e=Ci,Ci=t,e!==null&&Ay(e)),n}function Ay(n){Ci===null?Ci=n:Ci.push.apply(Ci,n)}function sL(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!Gr(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function yo(n,e){for(e&=~ix,e&=~dm,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-kr(e),i=1<<t;n[t]=-1,e&=~i}}function JM(n){if(Ut&6)throw Error(Ee(327));uc();var e=bp(n,0);if(!(e&1))return Li(n,Sn()),null;var t=jp(n,e);if(n.tag!==0&&t===2){var i=J0(n);i!==0&&(e=i,t=xy(n,i))}if(t===1)throw t=hf,Ra(n,0),yo(n,e),Li(n,Sn()),t;if(t===6)throw Error(Ee(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,pa(n,Ci,Cs),Li(n,Sn()),null}function sx(n,e){var t=Ut;Ut|=1;try{return n(e)}finally{Ut=t,Ut===0&&(xc=Sn()+500,cm&&Ho())}}function ka(n){Ao!==null&&Ao.tag===0&&!(Ut&6)&&uc();var e=Ut;Ut|=1;var t=yr.transition,i=Ht;try{if(yr.transition=null,Ht=1,n)return n()}finally{Ht=i,yr.transition=t,Ut=e,!(Ut&6)&&Ho()}}function ox(){Hi=$l.current,qt($l)}function Ra(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,FI(t)),Cn!==null)for(t=Cn.return;t!==null;){var i=t;switch(z_(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&Dp();break;case 3:yc(),qt(Bi),qt(fi),Y_();break;case 5:K_(i);break;case 4:yc();break;case 13:qt(an);break;case 19:qt(an);break;case 10:W_(i.type._context);break;case 22:case 23:ox()}t=t.return}if(Vn=n,Cn=n=Po(n.current,null),Yn=Hi=e,In=0,hf=null,ix=dm=Oa=0,Ci=zu=null,xa!==null){for(e=0;e<xa.length;e++)if(t=xa[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}xa=null}return n}function nC(n,e){do{var t=Cn;try{if(V_(),fp.current=Vp,Hp){for(var i=un.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Hp=!1}if(Ua=0,Hn=bn=un=null,Ou=!1,cf=0,nx.current=null,t===null||t.return===null){In=1,hf=e,Cn=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=Yn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var f=l,h=a,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var p=h.alternate;p?(h.updateQueue=p.updateQueue,h.memoizedState=p.memoizedState,h.lanes=p.lanes):(h.updateQueue=null,h.memoizedState=null)}var m=LM(o);if(m!==null){m.flags&=-257,DM(m,o,a,s,e),m.mode&1&&IM(s,f,e),e=m,l=f;var y=e.updateQueue;if(y===null){var S=new Set;S.add(l),e.updateQueue=S}else y.add(l);break e}else{if(!(e&1)){IM(s,f,e),ax();break e}l=Error(Ee(426))}}else if(rn&&a.mode&1){var A=LM(o);if(A!==null){!(A.flags&65536)&&(A.flags|=256),DM(A,o,a,s,e),G_(_c(l,a));break e}}s=l=_c(l,a),In!==4&&(In=2),zu===null?zu=[s]:zu.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var g=kT(s,l,e);TM(s,g);break e;case 1:a=l;var _=s.type,M=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(Ro===null||!Ro.has(M)))){s.flags|=65536,e&=-e,s.lanes|=e;var w=zT(s,a,e);TM(s,w);break e}}s=s.return}while(s!==null)}sC(t)}catch(B){e=B,Cn===t&&t!==null&&(Cn=t=t.return);continue}break}while(!0)}function iC(){var n=Wp.current;return Wp.current=Vp,n===null?Vp:n}function ax(){(In===0||In===3||In===2)&&(In=4),Vn===null||!(Oa&268435455)&&!(dm&268435455)||yo(Vn,Yn)}function jp(n,e){var t=Ut;Ut|=2;var i=iC();(Vn!==n||Yn!==e)&&(Cs=null,Ra(n,e));do try{oL();break}catch(r){nC(n,r)}while(!0);if(V_(),Ut=t,Wp.current=i,Cn!==null)throw Error(Ee(261));return Vn=null,Yn=0,In}function oL(){for(;Cn!==null;)rC(Cn)}function aL(){for(;Cn!==null&&!IB();)rC(Cn)}function rC(n){var e=aC(n.alternate,n,Hi);n.memoizedProps=n.pendingProps,e===null?sC(n):Cn=e,nx.current=null}function sC(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=eL(t,e),t!==null){t.flags&=32767,Cn=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{In=6,Cn=null;return}}else if(t=$I(t,e,Hi),t!==null){Cn=t;return}if(e=e.sibling,e!==null){Cn=e;return}Cn=e=n}while(e!==null);In===0&&(In=5)}function pa(n,e,t){var i=Ht,r=yr.transition;try{yr.transition=null,Ht=1,lL(n,e,t,i)}finally{yr.transition=r,Ht=i}return null}function lL(n,e,t,i){do uc();while(Ao!==null);if(Ut&6)throw Error(Ee(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(Ee(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(HB(n,s),n===Vn&&(Cn=Vn=null,Yn=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||sd||(sd=!0,lC(Rp,function(){return uc(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=yr.transition,yr.transition=null;var o=Ht;Ht=1;var a=Ut;Ut|=4,nx.current=null,nL(n,t),$T(t,n),RI(q0),Pp=!!Z0,q0=Z0=null,n.current=t,iL(t),LB(),Ut=a,Ht=o,yr.transition=s}else n.current=t;if(sd&&(sd=!1,Ao=n,Jp=r),s=n.pendingLanes,s===0&&(Ro=null),NB(t.stateNode),Li(n,Sn()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(Xp)throw Xp=!1,n=yy,yy=null,n;return Jp&1&&n.tag!==0&&uc(),s=n.pendingLanes,s&1?n===_y?Gu++:(Gu=0,_y=n):Gu=0,Ho(),null}function uc(){if(Ao!==null){var n=kw(Jp),e=yr.transition,t=Ht;try{if(yr.transition=null,Ht=16>n?16:n,Ao===null)var i=!1;else{if(n=Ao,Ao=null,Jp=0,Ut&6)throw Error(Ee(331));var r=Ut;for(Ut|=4,Je=n.current;Je!==null;){var s=Je,o=s.child;if(Je.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var f=a[l];for(Je=f;Je!==null;){var h=Je;switch(h.tag){case 0:case 11:case 15:ku(8,h,s)}var d=h.child;if(d!==null)d.return=h,Je=d;else for(;Je!==null;){h=Je;var p=h.sibling,m=h.return;if(QT(h),h===f){Je=null;break}if(p!==null){p.return=m,Je=p;break}Je=m}}}var y=s.alternate;if(y!==null){var S=y.child;if(S!==null){y.child=null;do{var A=S.sibling;S.sibling=null,S=A}while(S!==null)}}Je=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Je=o;else e:for(;Je!==null;){if(s=Je,s.flags&2048)switch(s.tag){case 0:case 11:case 15:ku(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,Je=g;break e}Je=s.return}}var _=n.current;for(Je=_;Je!==null;){o=Je;var M=o.child;if(o.subtreeFlags&2064&&M!==null)M.return=o,Je=M;else e:for(o=_;Je!==null;){if(a=Je,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:hm(9,a)}}catch(B){mn(a,a.return,B)}if(a===o){Je=null;break e}var w=a.sibling;if(w!==null){w.return=a.return,Je=w;break e}Je=a.return}}if(Ut=r,Ho(),rs&&typeof rs.onPostCommitFiberRoot=="function")try{rs.onPostCommitFiberRoot(rm,n)}catch{}i=!0}return i}finally{Ht=t,yr.transition=e}}return!1}function jM(n,e,t){e=_c(t,e),e=kT(n,e,1),n=Co(n,e,1),e=yi(),n!==null&&(bf(n,1,e),Li(n,e))}function mn(n,e,t){if(n.tag===3)jM(n,n,t);else for(;e!==null;){if(e.tag===3){jM(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ro===null||!Ro.has(i))){n=_c(t,n),n=zT(e,n,1),e=Co(e,n,1),n=yi(),e!==null&&(bf(e,1,n),Li(e,n));break}}e=e.return}}function cL(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=yi(),n.pingedLanes|=n.suspendedLanes&t,Vn===n&&(Yn&t)===t&&(In===4||In===3&&(Yn&130023424)===Yn&&500>Sn()-rx?Ra(n,0):ix|=t),Li(n,e)}function oC(n,e){e===0&&(n.mode&1?(e=Yh,Yh<<=1,!(Yh&130023424)&&(Yh=4194304)):e=1);var t=yi();n=Vs(n,e),n!==null&&(bf(n,e,t),Li(n,t))}function uL(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),oC(n,t)}function fL(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Ee(314))}i!==null&&i.delete(e),oC(n,t)}var aC;aC=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Bi.current)Pi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Pi=!1,qI(n,e,t);Pi=!!(n.flags&131072)}else Pi=!1,rn&&e.flags&1048576&&fT(e,Up,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;dp(n,e),n=e.pendingProps;var r=mc(e,fi.current);cc(e,t),r=Z_(null,e,i,n,r,t);var s=q_();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ii(i)?(s=!0,Fp(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,J_(e),r.updater=fm,e.stateNode=r,r._reactInternals=e,ay(e,i,n,t),e=uy(null,e,i,!0,s,t)):(e.tag=0,rn&&s&&k_(e),gi(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(dp(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=dL(i),n=Br(i,n),r){case 0:e=cy(null,e,i,n,t);break e;case 1:e=UM(null,e,i,n,t);break e;case 11:e=FM(null,e,i,n,t);break e;case 14:e=NM(null,e,i,Br(i.type,n),t);break e}throw Error(Ee(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Br(i,r),cy(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Br(i,r),UM(n,e,i,r,t);case 3:e:{if(WT(e),n===null)throw Error(Ee(387));i=e.pendingProps,s=e.memoizedState,r=s.element,vT(n,e),zp(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=_c(Error(Ee(423)),e),e=OM(n,e,i,t,r);break e}else if(i!==r){r=_c(Error(Ee(424)),e),e=OM(n,e,i,t,r);break e}else for(Xi=To(e.stateNode.containerInfo.firstChild),ji=e,rn=!0,Dr=null,t=mT(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(gc(),i===r){e=Ws(n,e,t);break e}gi(n,e,i,t)}e=e.child}return e;case 5:return yT(e),n===null&&ry(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,$0(i,r)?o=null:s!==null&&$0(i,s)&&(e.flags|=32),VT(n,e),gi(n,e,o,t),e.child;case 6:return n===null&&ry(e),null;case 13:return XT(n,e,t);case 4:return j_(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=vc(e,null,i,t):gi(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Br(i,r),FM(n,e,i,r,t);case 7:return gi(n,e,e.pendingProps,t),e.child;case 8:return gi(n,e,e.pendingProps.children,t),e.child;case 12:return gi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,jt(Op,i._currentValue),i._currentValue=o,s!==null)if(Gr(s.value,o)){if(s.children===r.children&&!Bi.current){e=Ws(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Us(-1,t&-t),l.tag=2;var f=s.updateQueue;if(f!==null){f=f.shared;var h=f.pending;h===null?l.next=l:(l.next=h.next,h.next=l),f.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),sy(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Ee(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),sy(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}gi(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,cc(e,t),r=xr(r),i=i(r),e.flags|=1,gi(n,e,i,t),e.child;case 14:return i=e.type,r=Br(i,e.pendingProps),r=Br(i.type,r),NM(n,e,i,r,t);case 15:return GT(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Br(i,r),dp(n,e),e.tag=1,Ii(i)?(n=!0,Fp(e)):n=!1,cc(e,t),OT(e,i,r),ay(e,i,r,t),uy(null,e,i,!0,n,t);case 19:return JT(n,e,t);case 22:return HT(n,e,t)}throw Error(Ee(156,e.tag))};function lC(n,e){return Fw(n,e)}function hL(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vr(n,e,t,i){return new hL(n,e,t,i)}function lx(n){return n=n.prototype,!(!n||!n.isReactComponent)}function dL(n){if(typeof n=="function")return lx(n)?1:0;if(n!=null){if(n=n.$$typeof,n===C_)return 11;if(n===R_)return 14}return 2}function Po(n,e){var t=n.alternate;return t===null?(t=vr(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function gp(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")lx(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Vl:return ba(t.children,r,s,e);case T_:o=8,r|=8;break;case B0:return n=vr(12,t,e,r|2),n.elementType=B0,n.lanes=s,n;case I0:return n=vr(13,t,e,r),n.elementType=I0,n.lanes=s,n;case L0:return n=vr(19,t,e,r),n.elementType=L0,n.lanes=s,n;case yw:return pm(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case gw:o=10;break e;case vw:o=9;break e;case C_:o=11;break e;case R_:o=14;break e;case mo:o=16,i=null;break e}throw Error(Ee(130,n==null?n:typeof n,""))}return e=vr(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function ba(n,e,t,i){return n=vr(7,n,i,e),n.lanes=t,n}function pm(n,e,t,i){return n=vr(22,n,i,e),n.elementType=yw,n.lanes=t,n.stateNode={isHidden:!1},n}function Rv(n,e,t){return n=vr(6,n,null,e),n.lanes=t,n}function bv(n,e,t){return e=vr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function pL(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cv(0),this.expirationTimes=cv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cv(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function cx(n,e,t,i,r,s,o,a,l){return n=new pL(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=vr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},J_(s),n}function mL(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Hl,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function cC(n){if(!n)return Fo;n=n._reactInternals;e:{if(Ja(n)!==n||n.tag!==1)throw Error(Ee(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Ii(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Ee(171))}if(n.tag===1){var t=n.type;if(Ii(t))return cT(n,t,e)}return e}function uC(n,e,t,i,r,s,o,a,l){return n=cx(t,i,!0,n,r,s,o,a,l),n.context=cC(null),t=n.current,i=yi(),r=bo(t),s=Us(i,r),s.callback=e??null,Co(t,s,r),n.current.lanes=r,bf(n,r,i),Li(n,i),n}function mm(n,e,t,i){var r=e.current,s=yi(),o=bo(r);return t=cC(t),e.context===null?e.context=t:e.pendingContext=t,e=Us(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Co(r,e,o),n!==null&&(zr(n,r,o,s),up(n,r,o)),o}function Kp(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function KM(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function ux(n,e){KM(n,e),(n=n.alternate)&&KM(n,e)}function gL(){return null}var fC=typeof reportError=="function"?reportError:function(n){console.error(n)};function fx(n){this._internalRoot=n}gm.prototype.render=fx.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(Ee(409));mm(n,e,null,null)};gm.prototype.unmount=fx.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;ka(function(){mm(null,n,null,null)}),e[Hs]=null}};function gm(n){this._internalRoot=n}gm.prototype.unstable_scheduleHydration=function(n){if(n){var e=Hw();n={blockedOn:null,target:n,priority:e};for(var t=0;t<vo.length&&e!==0&&e<vo[t].priority;t++);vo.splice(t,0,n),t===0&&Ww(n)}};function hx(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function vm(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function YM(){}function vL(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var f=Kp(o);s.call(f)}}var o=uC(e,i,n,0,null,!1,!1,"",YM);return n._reactRootContainer=o,n[Hs]=o.current,rf(n.nodeType===8?n.parentNode:n),ka(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var f=Kp(l);a.call(f)}}var l=cx(n,0,!1,null,null,!1,!1,"",YM);return n._reactRootContainer=l,n[Hs]=l.current,rf(n.nodeType===8?n.parentNode:n),ka(function(){mm(e,l,t,i)}),l}function ym(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=Kp(o);a.call(l)}}mm(e,o,n,r)}else o=vL(t,e,n,r,i);return Kp(o)}zw=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=Pu(e.pendingLanes);t!==0&&(B_(e,t|1),Li(e,Sn()),!(Ut&6)&&(xc=Sn()+500,Ho()))}break;case 13:ka(function(){var i=Vs(n,1);if(i!==null){var r=yi();zr(i,n,1,r)}}),ux(n,1)}};I_=function(n){if(n.tag===13){var e=Vs(n,134217728);if(e!==null){var t=yi();zr(e,n,134217728,t)}ux(n,134217728)}};Gw=function(n){if(n.tag===13){var e=bo(n),t=Vs(n,e);if(t!==null){var i=yi();zr(t,n,e,i)}ux(n,e)}};Hw=function(){return Ht};Vw=function(n,e){var t=Ht;try{return Ht=n,e()}finally{Ht=t}};V0=function(n,e,t){switch(e){case"input":if(N0(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=lm(i);if(!r)throw Error(Ee(90));xw(i),N0(i,r)}}}break;case"textarea":Sw(n,t);break;case"select":e=t.value,e!=null&&sc(n,!!t.multiple,e,!1)}};bw=sx;Pw=ka;var yL={usingClientEntryPoint:!1,Events:[Bf,jl,lm,Cw,Rw,sx]},du={findFiberByHostInstance:_a,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},_L={bundleType:du.bundleType,version:du.version,rendererPackageName:du.rendererPackageName,rendererConfig:du.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:js.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=Lw(n),n===null?null:n.stateNode},findFiberByHostInstance:du.findFiberByHostInstance||gL,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var od=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!od.isDisabled&&od.supportsFiber)try{rm=od.inject(_L),rs=od}catch{}}Qi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yL;Qi.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hx(e))throw Error(Ee(200));return mL(n,e,null,t)};Qi.createRoot=function(n,e){if(!hx(n))throw Error(Ee(299));var t=!1,i="",r=fC;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=cx(n,1,!1,null,null,t,!1,i,r),n[Hs]=e.current,rf(n.nodeType===8?n.parentNode:n),new fx(e)};Qi.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(Ee(188)):(n=Object.keys(n).join(","),Error(Ee(268,n)));return n=Lw(e),n=n===null?null:n.stateNode,n};Qi.flushSync=function(n){return ka(n)};Qi.hydrate=function(n,e,t){if(!vm(e))throw Error(Ee(200));return ym(null,n,e,!0,t)};Qi.hydrateRoot=function(n,e,t){if(!hx(n))throw Error(Ee(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=fC;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=uC(e,null,n,1,t??null,r,!1,s,o),n[Hs]=e.current,rf(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new gm(e)};Qi.render=function(n,e,t){if(!vm(e))throw Error(Ee(200));return ym(null,n,e,!1,t)};Qi.unmountComponentAtNode=function(n){if(!vm(n))throw Error(Ee(40));return n._reactRootContainer?(ka(function(){ym(null,null,n,!1,function(){n._reactRootContainer=null,n[Hs]=null})}),!0):!1};Qi.unstable_batchedUpdates=sx;Qi.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!vm(t))throw Error(Ee(200));if(n==null||n._reactInternals===void 0)throw Error(Ee(38));return ym(n,e,t,!1,i)};Qi.version="18.3.1-next-f1338f8080-20240426";function hC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(hC)}catch(n){console.error(n)}}hC(),hw.exports=Qi;var xL=hw.exports,dx,QM=xL;dx=QM.createRoot,QM.hydrateRoot;/**
- * @license
- * Copyright 2010-2023 Three.js Authors
- * SPDX-License-Identifier: MIT
- */const Lf="160",ma={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Ps={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dC=0,Sy=1,pC=2,AL=3,mC=0,_m=1,Hu=2,Ir=3,cs=0,_i=1,pr=2,SL=2,Os=0,Pa=1,My=2,Ey=3,wy=4,gC=5,_o=100,vC=101,yC=102,Ty=103,Cy=104,_C=200,xC=201,AC=202,SC=203,Yp=204,Qp=205,MC=206,EC=207,wC=208,TC=209,CC=210,RC=211,bC=212,PC=213,BC=214,IC=0,LC=1,DC=2,df=3,FC=4,NC=5,UC=6,OC=7,Df=0,kC=1,zC=2,os=0,GC=1,HC=2,VC=3,px=4,WC=5,XC=6,Ry="attached",JC="detached",xm=300,Xs=301,No=302,Ac=303,pf=304,Dc=306,us=1e3,Bn=1001,Sc=1002,gn=1003,mf=1004,ML=1004,fc=1005,EL=1005,ln=1006,Am=1007,wL=1007,fs=1008,TL=1008,as=1009,jC=1010,KC=1011,Sm=1012,mx=1013,Fs=1014,Nr=1015,Mc=1016,gx=1017,vx=1018,Bo=1020,YC=1021,vi=1023,QC=1024,ZC=1025,Io=1026,za=1027,qC=1028,yx=1029,$C=1030,_x=1031,xx=1033,vp=33776,yp=33777,_p=33778,xp=33779,by=35840,Py=35841,By=35842,Iy=35843,Ax=36196,Ly=37492,Dy=37496,Fy=37808,Ny=37809,Uy=37810,Oy=37811,ky=37812,zy=37813,Gy=37814,Hy=37815,Vy=37816,Wy=37817,Xy=37818,Jy=37819,jy=37820,Ky=37821,Ap=36492,Yy=36494,Qy=36495,eR=36283,Zy=36284,qy=36285,$y=36286,tR=2200,nR=2201,iR=2202,Ec=2300,Ga=2301,Sp=2302,Sa=2400,Ma=2401,gf=2402,Mm=2500,Sx=2501,rR=0,Mx=1,Zp=2,Ex=3e3,Lo=3001,sR=3200,oR=3201,Vo=0,aR=1,Wi="",Pn="srgb",hs="srgb-linear",Em="display-p3",Ff="display-p3-linear",vf="linear",Xt="srgb",yf="rec709",_f="p3",CL=0,ga=7680,RL=7681,bL=7682,PL=7683,BL=34055,IL=34056,LL=5386,DL=512,FL=513,NL=514,UL=515,OL=516,kL=517,zL=518,e_=519,lR=512,cR=513,uR=514,wx=515,fR=516,hR=517,dR=518,pR=519,xf=35044,GL=35048,HL=35040,VL=35045,WL=35049,XL=35041,JL=35046,jL=35050,KL=35042,YL="100",t_="300 es",qp=1035,Ur=2e3,wc=2001;let Ks=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}};const ai=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ZM=1234567;const Ba=Math.PI/180,Tc=180/Math.PI;function Ki(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ai[n&255]+ai[n>>8&255]+ai[n>>16&255]+ai[n>>24&255]+"-"+ai[e&255]+ai[e>>8&255]+"-"+ai[e>>16&15|64]+ai[e>>24&255]+"-"+ai[t&63|128]+ai[t>>8&255]+"-"+ai[t>>16&255]+ai[t>>24&255]+ai[i&255]+ai[i>>8&255]+ai[i>>16&255]+ai[i>>24&255]).toLowerCase()}function vn(n,e,t){return Math.max(e,Math.min(t,n))}function Tx(n,e){return(n%e+e)%e}function QL(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function ZL(n,e,t){return n!==e?(t-n)/(e-n):0}function Vu(n,e,t){return(1-t)*n+t*e}function qL(n,e,t,i){return Vu(n,e,1-Math.exp(-t*i))}function $L(n,e=1){return e-Math.abs(Tx(n,e*2)-e)}function e2(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function t2(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function n2(n,e){return n+Math.floor(Math.random()*(e-n+1))}function i2(n,e){return n+Math.random()*(e-n)}function r2(n){return n*(.5-Math.random())}function s2(n){n!==void 0&&(ZM=n);let e=ZM+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function o2(n){return n*Ba}function a2(n){return n*Tc}function n_(n){return(n&n-1)===0&&n!==0}function l2(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function $p(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function c2(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),f=s((e+i)/2),h=o((e+i)/2),d=s((e-i)/2),p=o((e-i)/2),m=s((i-e)/2),y=o((i-e)/2);switch(r){case"XYX":n.set(a*h,l*d,l*p,a*f);break;case"YZY":n.set(l*p,a*h,l*d,a*f);break;case"ZXZ":n.set(l*d,l*p,a*h,a*f);break;case"XZX":n.set(a*h,l*y,l*m,a*f);break;case"YXY":n.set(l*m,a*h,l*y,a*f);break;case"ZYZ":n.set(l*y,l*m,a*h,a*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function bi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function At(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const mr={DEG2RAD:Ba,RAD2DEG:Tc,generateUUID:Ki,clamp:vn,euclideanModulo:Tx,mapLinear:QL,inverseLerp:ZL,lerp:Vu,damp:qL,pingpong:$L,smoothstep:e2,smootherstep:t2,randInt:n2,randFloat:i2,randFloatSpread:r2,seededRandom:s2,degToRad:o2,radToDeg:a2,isPowerOfTwo:n_,ceilPowerOfTwo:l2,floorPowerOfTwo:$p,setQuaternionFromProperEuler:c2,normalize:At,denormalize:bi};class de{constructor(e=0,t=0){de.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(vn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class xt{constructor(e,t,i,r,s,o,a,l,f){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,f)}set(e,t,i,r,s,o,a,l,f){const h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=i,h[7]=o,h[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],f=i[1],h=i[4],d=i[7],p=i[2],m=i[5],y=i[8],S=r[0],A=r[3],g=r[6],_=r[1],M=r[4],w=r[7],B=r[2],T=r[5],b=r[8];return s[0]=o*S+a*_+l*B,s[3]=o*A+a*M+l*T,s[6]=o*g+a*w+l*b,s[1]=f*S+h*_+d*B,s[4]=f*A+h*M+d*T,s[7]=f*g+h*w+d*b,s[2]=p*S+m*_+y*B,s[5]=p*A+m*M+y*T,s[8]=p*g+m*w+y*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],f=e[7],h=e[8];return t*o*h-t*a*f-i*s*h+i*a*l+r*s*f-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],f=e[7],h=e[8],d=h*o-a*f,p=a*l-h*s,m=f*s-o*l,y=t*d+i*p+r*m;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/y;return e[0]=d*S,e[1]=(r*f-h*i)*S,e[2]=(a*i-r*o)*S,e[3]=p*S,e[4]=(h*t-r*l)*S,e[5]=(r*s-a*t)*S,e[6]=m*S,e[7]=(i*l-f*t)*S,e[8]=(o*t-i*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),f=Math.sin(s);return this.set(i*l,i*f,-i*(l*o+f*a)+o+e,-r*f,r*l,-r*(-f*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Pv.makeScale(e,t)),this}rotate(e){return this.premultiply(Pv.makeRotation(-e)),this}translate(e,t){return this.premultiply(Pv.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Pv=new xt;function mR(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const u2={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ec(n,e){return new u2[n](e)}function Af(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function gR(){const n=Af("canvas");return n.style.display="block",n}const qM={};function Wu(n){n in qM||(qM[n]=!0,console.warn(n))}const $M=new xt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),eE=new xt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ad={[hs]:{transfer:vf,primaries:yf,toReference:n=>n,fromReference:n=>n},[Pn]:{transfer:Xt,primaries:yf,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Ff]:{transfer:vf,primaries:_f,toReference:n=>n.applyMatrix3(eE),fromReference:n=>n.applyMatrix3($M)},[Em]:{transfer:Xt,primaries:_f,toReference:n=>n.convertSRGBToLinear().applyMatrix3(eE),fromReference:n=>n.applyMatrix3($M).convertLinearToSRGB()}},f2=new Set([hs,Ff]),Gt={enabled:!0,_workingColorSpace:hs,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!f2.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=ad[e].toReference,r=ad[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return ad[n].primaries},getTransfer:function(n){return n===Wi?vf:ad[n].transfer}};function hc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Bv(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ml;class Cx{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ml===void 0&&(ml=Af("canvas")),ml.width=e.width,ml.height=e.height;const i=ml.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ml}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Af("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=hc(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(hc(t[i]/255)*255):t[i]=hc(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let h2=0;class Ea{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:h2++}),this.uuid=Ki(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(Iv(r[o].image)):s.push(Iv(r[o]))}else s=Iv(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Iv(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Cx.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let d2=0;class en extends Ks{constructor(e=en.DEFAULT_IMAGE,t=en.DEFAULT_MAPPING,i=Bn,r=Bn,s=ln,o=fs,a=vi,l=as,f=en.DEFAULT_ANISOTROPY,h=Wi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:d2++}),this.uuid=Ki(),this.name="",this.source=new Ea(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=f,this.format=a,this.internalFormat=null,this.type=l,this.offset=new de(0,0),this.repeat=new de(1,1),this.center=new de(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof h=="string"?this.colorSpace=h:(Wu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=h===Lo?Pn:Wi),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==xm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case us:e.x=e.x-Math.floor(e.x);break;case Bn:e.x=e.x<0?0:1;break;case Sc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case us:e.y=e.y-Math.floor(e.y);break;case Bn:e.y=e.y<0?0:1;break;case Sc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Wu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Pn?Lo:Ex}set encoding(e){Wu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Lo?Pn:Wi}}en.DEFAULT_IMAGE=null;en.DEFAULT_MAPPING=xm;en.DEFAULT_ANISOTROPY=1;class Nt{constructor(e=0,t=0,i=0,r=1){Nt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,f=l[0],h=l[4],d=l[8],p=l[1],m=l[5],y=l[9],S=l[2],A=l[6],g=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-S)<.01&&Math.abs(y-A)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+S)<.1&&Math.abs(y+A)<.1&&Math.abs(f+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(f+1)/2,w=(m+1)/2,B=(g+1)/2,T=(h+p)/4,b=(d+S)/4,L=(y+A)/4;return M>w&&M>B?M<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(M),r=T/i,s=b/i):w>B?w<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(w),i=T/r,s=L/r):B<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(B),i=b/s,r=L/s),this.set(i,r,s,t),this}let _=Math.sqrt((A-y)*(A-y)+(d-S)*(d-S)+(p-h)*(p-h));return Math.abs(_)<.001&&(_=1),this.x=(A-y)/_,this.y=(d-S)/_,this.z=(p-h)/_,this.w=Math.acos((f+m+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,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class vR extends Ks{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Nt(0,0,e,t),this.scissorTest=!1,this.viewport=new Nt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(Wu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Lo?Pn:Wi),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ln,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new en(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ea(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Hr extends vR{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class wm extends en{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=gn,this.minFilter=gn,this.wrapR=Bn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class p2 extends Hr{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new wm(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class Rx extends en{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=gn,this.minFilter=gn,this.wrapR=Bn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class m2 extends Hr{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Rx(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class g2 extends Hr{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o<i;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class $t{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],f=i[r+1],h=i[r+2],d=i[r+3];const p=s[o+0],m=s[o+1],y=s[o+2],S=s[o+3];if(a===0){e[t+0]=l,e[t+1]=f,e[t+2]=h,e[t+3]=d;return}if(a===1){e[t+0]=p,e[t+1]=m,e[t+2]=y,e[t+3]=S;return}if(d!==S||l!==p||f!==m||h!==y){let A=1-a;const g=l*p+f*m+h*y+d*S,_=g>=0?1:-1,M=1-g*g;if(M>Number.EPSILON){const B=Math.sqrt(M),T=Math.atan2(B,g*_);A=Math.sin(A*T)/B,a=Math.sin(a*T)/B}const w=a*_;if(l=l*A+p*w,f=f*A+m*w,h=h*A+y*w,d=d*A+S*w,A===1-a){const B=1/Math.sqrt(l*l+f*f+h*h+d*d);l*=B,f*=B,h*=B,d*=B}}e[t]=l,e[t+1]=f,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],f=i[r+2],h=i[r+3],d=s[o],p=s[o+1],m=s[o+2],y=s[o+3];return e[t]=a*y+h*d+l*m-f*p,e[t+1]=l*y+h*p+f*d-a*m,e[t+2]=f*y+h*m+a*p-l*d,e[t+3]=h*y-a*d-l*p-f*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,f=a(i/2),h=a(r/2),d=a(s/2),p=l(i/2),m=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=p*h*d+f*m*y,this._y=f*m*d-p*h*y,this._z=f*h*y+p*m*d,this._w=f*h*d-p*m*y;break;case"YXZ":this._x=p*h*d+f*m*y,this._y=f*m*d-p*h*y,this._z=f*h*y-p*m*d,this._w=f*h*d+p*m*y;break;case"ZXY":this._x=p*h*d-f*m*y,this._y=f*m*d+p*h*y,this._z=f*h*y+p*m*d,this._w=f*h*d-p*m*y;break;case"ZYX":this._x=p*h*d-f*m*y,this._y=f*m*d+p*h*y,this._z=f*h*y-p*m*d,this._w=f*h*d+p*m*y;break;case"YZX":this._x=p*h*d+f*m*y,this._y=f*m*d+p*h*y,this._z=f*h*y-p*m*d,this._w=f*h*d-p*m*y;break;case"XZY":this._x=p*h*d-f*m*y,this._y=f*m*d-p*h*y,this._z=f*h*y+p*m*d,this._w=f*h*d+p*m*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],f=t[2],h=t[6],d=t[10],p=i+a+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-f)*m,this._z=(o-r)*m}else if(i>a&&i>d){const m=2*Math.sqrt(1+i-a-d);this._w=(h-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+f)/m}else if(a>d){const m=2*Math.sqrt(1+a-i-d);this._w=(s-f)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+d-i-a);this._w=(o-r)/m,this._x=(s+f)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(vn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,f=t._z,h=t._w;return this._x=i*h+o*a+r*f-s*l,this._y=r*h+o*l+s*a-i*f,this._z=s*h+o*f+i*l-r*a,this._w=o*h-i*a-r*l-s*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const f=Math.sqrt(l),h=Math.atan2(f,a),d=Math.sin((1-t)*h)/f,p=Math.sin(t*h)/f;return this._w=o*d+this._w*p,this._x=i*d+this._x*p,this._y=r*d+this._y*p,this._z=s*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class D{constructor(e=0,t=0,i=0){D.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(tE.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(tE.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,f=2*(o*r-a*i),h=2*(a*t-s*r),d=2*(s*i-o*t);return this.x=t+l*f+o*d-a*h,this.y=i+l*h+a*f-s*d,this.z=r+l*d+s*h-o*f,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Lv.copy(this).projectOnVector(e),this.sub(Lv)}reflect(e){return this.sub(Lv.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(vn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Lv=new D,tE=new $t;class Qn{constructor(e=new D(1/0,1/0,1/0),t=new D(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Cr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Cr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Cr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Cr):Cr.fromBufferAttribute(s,o),Cr.applyMatrix4(e.matrixWorld),this.expandByPoint(Cr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ld.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ld.copy(i.boundingBox)),ld.applyMatrix4(e.matrixWorld),this.union(ld)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Cr),Cr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(pu),cd.subVectors(this.max,pu),gl.subVectors(e.a,pu),vl.subVectors(e.b,pu),yl.subVectors(e.c,pu),so.subVectors(vl,gl),oo.subVectors(yl,vl),na.subVectors(gl,yl);let t=[0,-so.z,so.y,0,-oo.z,oo.y,0,-na.z,na.y,so.z,0,-so.x,oo.z,0,-oo.x,na.z,0,-na.x,-so.y,so.x,0,-oo.y,oo.x,0,-na.y,na.x,0];return!Dv(t,gl,vl,yl,cd)||(t=[1,0,0,0,1,0,0,0,1],!Dv(t,gl,vl,yl,cd))?!1:(ud.crossVectors(so,oo),t=[ud.x,ud.y,ud.z],Dv(t,gl,vl,yl,cd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Cr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Cr).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:(As[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),As[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),As[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),As[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),As[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),As[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),As[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),As[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(As),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const As=[new D,new D,new D,new D,new D,new D,new D,new D],Cr=new D,ld=new Qn,gl=new D,vl=new D,yl=new D,so=new D,oo=new D,na=new D,pu=new D,cd=new D,ud=new D,ia=new D;function Dv(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){ia.fromArray(n,s);const a=r.x*Math.abs(ia.x)+r.y*Math.abs(ia.y)+r.z*Math.abs(ia.z),l=e.dot(ia),f=t.dot(ia),h=i.dot(ia);if(Math.max(-Math.max(l,f,h),Math.min(l,f,h))>a)return!1}return!0}const v2=new Qn,mu=new D,Fv=new D;class Zn{constructor(e=new D,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):v2.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}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;mu.subVectors(e,this.center);const t=mu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(mu,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Fv.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mu.copy(e.center).add(Fv)),this.expandByPoint(mu.copy(e.center).sub(Fv))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ss=new D,Nv=new D,fd=new D,ao=new D,Uv=new D,hd=new D,Ov=new D;class ja{constructor(e=new D,t=new D(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ss)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ss.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ss.copy(this.origin).addScaledVector(this.direction,t),Ss.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Nv.copy(e).add(t).multiplyScalar(.5),fd.copy(t).sub(e).normalize(),ao.copy(this.origin).sub(Nv);const s=e.distanceTo(t)*.5,o=-this.direction.dot(fd),a=ao.dot(this.direction),l=-ao.dot(fd),f=ao.lengthSq(),h=Math.abs(1-o*o);let d,p,m,y;if(h>0)if(d=o*l-a,p=o*a-l,y=s*h,d>=0)if(p>=-y)if(p<=y){const S=1/h;d*=S,p*=S,m=d*(d+o*p+2*a)+p*(o*d+p+2*l)+f}else p=s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+f;else p=-s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+f;else p<=-y?(d=Math.max(0,-(-o*s+a)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+f):p<=y?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+f):(d=Math.max(0,-(o*s+a)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+f);else p=o>0?-s:s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+f;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Nv).addScaledVector(fd,p),m}intersectSphere(e,t){Ss.subVectors(e.center,this.origin);const i=Ss.dot(this.direction),r=Ss.dot(Ss)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const f=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,p=this.origin;return f>=0?(i=(e.min.x-p.x)*f,r=(e.max.x-p.x)*f):(i=(e.max.x-p.x)*f,r=(e.min.x-p.x)*f),h>=0?(s=(e.min.y-p.y)*h,o=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,o=(e.min.y-p.y)*h),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(a=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ss)!==null}intersectTriangle(e,t,i,r,s){Uv.subVectors(t,e),hd.subVectors(i,e),Ov.crossVectors(Uv,hd);let o=this.direction.dot(Ov),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ao.subVectors(this.origin,e);const l=a*this.direction.dot(hd.crossVectors(ao,hd));if(l<0)return null;const f=a*this.direction.dot(Uv.cross(ao));if(f<0||l+f>o)return null;const h=-a*ao.dot(Ov);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ue{constructor(e,t,i,r,s,o,a,l,f,h,d,p,m,y,S,A){Ue.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,f,h,d,p,m,y,S,A)}set(e,t,i,r,s,o,a,l,f,h,d,p,m,y,S,A){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=f,g[6]=h,g[10]=d,g[14]=p,g[3]=m,g[7]=y,g[11]=S,g[15]=A,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 Ue().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/_l.setFromMatrixColumn(e,0).length(),s=1/_l.setFromMatrixColumn(e,1).length(),o=1/_l.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),f=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=o*h,m=o*d,y=a*h,S=a*d;t[0]=l*h,t[4]=-l*d,t[8]=f,t[1]=m+y*f,t[5]=p-S*f,t[9]=-a*l,t[2]=S-p*f,t[6]=y+m*f,t[10]=o*l}else if(e.order==="YXZ"){const p=l*h,m=l*d,y=f*h,S=f*d;t[0]=p+S*a,t[4]=y*a-m,t[8]=o*f,t[1]=o*d,t[5]=o*h,t[9]=-a,t[2]=m*a-y,t[6]=S+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*h,m=l*d,y=f*h,S=f*d;t[0]=p-S*a,t[4]=-o*d,t[8]=y+m*a,t[1]=m+y*a,t[5]=o*h,t[9]=S-p*a,t[2]=-o*f,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*h,m=o*d,y=a*h,S=a*d;t[0]=l*h,t[4]=y*f-m,t[8]=p*f+S,t[1]=l*d,t[5]=S*f+p,t[9]=m*f-y,t[2]=-f,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*f,y=a*l,S=a*f;t[0]=l*h,t[4]=S-p*d,t[8]=y*d+m,t[1]=d,t[5]=o*h,t[9]=-a*h,t[2]=-f*h,t[6]=m*d+y,t[10]=p-S*d}else if(e.order==="XZY"){const p=o*l,m=o*f,y=a*l,S=a*f;t[0]=l*h,t[4]=-d,t[8]=f*h,t[1]=p*d+S,t[5]=o*h,t[9]=m*d-y,t[2]=y*d-m,t[6]=a*h,t[10]=S*d+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(y2,e,_2)}lookAt(e,t,i){const r=this.elements;return zi.subVectors(e,t),zi.lengthSq()===0&&(zi.z=1),zi.normalize(),lo.crossVectors(i,zi),lo.lengthSq()===0&&(Math.abs(i.z)===1?zi.x+=1e-4:zi.z+=1e-4,zi.normalize(),lo.crossVectors(i,zi)),lo.normalize(),dd.crossVectors(zi,lo),r[0]=lo.x,r[4]=dd.x,r[8]=zi.x,r[1]=lo.y,r[5]=dd.y,r[9]=zi.y,r[2]=lo.z,r[6]=dd.z,r[10]=zi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],f=i[12],h=i[1],d=i[5],p=i[9],m=i[13],y=i[2],S=i[6],A=i[10],g=i[14],_=i[3],M=i[7],w=i[11],B=i[15],T=r[0],b=r[4],L=r[8],R=r[12],P=r[1],U=r[5],K=r[9],ie=r[13],G=r[2],J=r[6],Z=r[10],ae=r[14],O=r[3],V=r[7],H=r[11],q=r[15];return s[0]=o*T+a*P+l*G+f*O,s[4]=o*b+a*U+l*J+f*V,s[8]=o*L+a*K+l*Z+f*H,s[12]=o*R+a*ie+l*ae+f*q,s[1]=h*T+d*P+p*G+m*O,s[5]=h*b+d*U+p*J+m*V,s[9]=h*L+d*K+p*Z+m*H,s[13]=h*R+d*ie+p*ae+m*q,s[2]=y*T+S*P+A*G+g*O,s[6]=y*b+S*U+A*J+g*V,s[10]=y*L+S*K+A*Z+g*H,s[14]=y*R+S*ie+A*ae+g*q,s[3]=_*T+M*P+w*G+B*O,s[7]=_*b+M*U+w*J+B*V,s[11]=_*L+M*K+w*Z+B*H,s[15]=_*R+M*ie+w*ae+B*q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],f=e[13],h=e[2],d=e[6],p=e[10],m=e[14],y=e[3],S=e[7],A=e[11],g=e[15];return y*(+s*l*d-r*f*d-s*a*p+i*f*p+r*a*m-i*l*m)+S*(+t*l*m-t*f*p+s*o*p-r*o*m+r*f*h-s*l*h)+A*(+t*f*d-t*a*m-s*o*d+i*o*m+s*a*h-i*f*h)+g*(-r*a*h-t*l*d+t*a*p+r*o*d-i*o*p+i*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],f=e[7],h=e[8],d=e[9],p=e[10],m=e[11],y=e[12],S=e[13],A=e[14],g=e[15],_=d*A*f-S*p*f+S*l*m-a*A*m-d*l*g+a*p*g,M=y*p*f-h*A*f-y*l*m+o*A*m+h*l*g-o*p*g,w=h*S*f-y*d*f+y*a*m-o*S*m-h*a*g+o*d*g,B=y*d*l-h*S*l-y*a*p+o*S*p+h*a*A-o*d*A,T=t*_+i*M+r*w+s*B;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/T;return e[0]=_*b,e[1]=(S*p*s-d*A*s-S*r*m+i*A*m+d*r*g-i*p*g)*b,e[2]=(a*A*s-S*l*s+S*r*f-i*A*f-a*r*g+i*l*g)*b,e[3]=(d*l*s-a*p*s-d*r*f+i*p*f+a*r*m-i*l*m)*b,e[4]=M*b,e[5]=(h*A*s-y*p*s+y*r*m-t*A*m-h*r*g+t*p*g)*b,e[6]=(y*l*s-o*A*s-y*r*f+t*A*f+o*r*g-t*l*g)*b,e[7]=(o*p*s-h*l*s+h*r*f-t*p*f-o*r*m+t*l*m)*b,e[8]=w*b,e[9]=(y*d*s-h*S*s-y*i*m+t*S*m+h*i*g-t*d*g)*b,e[10]=(o*S*s-y*a*s+y*i*f-t*S*f-o*i*g+t*a*g)*b,e[11]=(h*a*s-o*d*s-h*i*f+t*d*f+o*i*m-t*a*m)*b,e[12]=B*b,e[13]=(h*S*r-y*d*r+y*i*p-t*S*p-h*i*A+t*d*A)*b,e[14]=(y*a*r-o*S*r-y*i*l+t*S*l+o*i*A-t*a*A)*b,e[15]=(o*d*r-h*a*r+h*i*l-t*d*l-o*i*p+t*a*p)*b,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,f=s*o,h=s*a;return this.set(f*o+i,f*a-r*l,f*l+r*a,0,f*a+r*l,h*a+i,h*l-r*o,0,f*l-r*a,h*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,f=s+s,h=o+o,d=a+a,p=s*f,m=s*h,y=s*d,S=o*h,A=o*d,g=a*d,_=l*f,M=l*h,w=l*d,B=i.x,T=i.y,b=i.z;return r[0]=(1-(S+g))*B,r[1]=(m+w)*B,r[2]=(y-M)*B,r[3]=0,r[4]=(m-w)*T,r[5]=(1-(p+g))*T,r[6]=(A+_)*T,r[7]=0,r[8]=(y+M)*b,r[9]=(A-_)*b,r[10]=(1-(p+S))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=_l.set(r[0],r[1],r[2]).length();const o=_l.set(r[4],r[5],r[6]).length(),a=_l.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],Rr.copy(this);const f=1/s,h=1/o,d=1/a;return Rr.elements[0]*=f,Rr.elements[1]*=f,Rr.elements[2]*=f,Rr.elements[4]*=h,Rr.elements[5]*=h,Rr.elements[6]*=h,Rr.elements[8]*=d,Rr.elements[9]*=d,Rr.elements[10]*=d,t.setFromRotationMatrix(Rr),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Ur){const l=this.elements,f=2*s/(t-e),h=2*s/(i-r),d=(t+e)/(t-e),p=(i+r)/(i-r);let m,y;if(a===Ur)m=-(o+s)/(o-s),y=-2*o*s/(o-s);else if(a===wc)m=-o/(o-s),y=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=f,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Ur){const l=this.elements,f=1/(t-e),h=1/(i-r),d=1/(o-s),p=(t+e)*f,m=(i+r)*h;let y,S;if(a===Ur)y=(o+s)*d,S=-2*d;else if(a===wc)y=s*d,S=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*f,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=S,l[14]=-y,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const _l=new D,Rr=new Ue,y2=new D(0,0,0),_2=new D(1,1,1),lo=new D,dd=new D,zi=new D,nE=new Ue,iE=new $t;class is{constructor(e=0,t=0,i=0,r=is.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],f=r[5],h=r[9],d=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(vn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,f),this._z=0);break;case"YXZ":this._x=Math.asin(-vn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,f)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(vn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,f)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-vn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,f));break;case"YZX":this._z=Math.asin(vn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,f),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-vn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,f),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return nE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(nE,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return iE.setFromEuler(this),this.setFromQuaternion(iE,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}is.DEFAULT_ORDER="XYZ";class Ia{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let x2=0;const rE=new D,xl=new $t,Ms=new Ue,pd=new D,gu=new D,A2=new D,S2=new $t,sE=new D(1,0,0),oE=new D(0,1,0),aE=new D(0,0,1),M2={type:"added"},E2={type:"removed"};class wt extends Ks{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:x2++}),this.uuid=Ki(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wt.DEFAULT_UP.clone();const e=new D,t=new is,i=new $t,r=new D(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ue},normalMatrix:{value:new xt}}),this.matrix=new Ue,this.matrixWorld=new Ue,this.matrixAutoUpdate=wt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ia,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return xl.setFromAxisAngle(e,t),this.quaternion.multiply(xl),this}rotateOnWorldAxis(e,t){return xl.setFromAxisAngle(e,t),this.quaternion.premultiply(xl),this}rotateX(e){return this.rotateOnAxis(sE,e)}rotateY(e){return this.rotateOnAxis(oE,e)}rotateZ(e){return this.rotateOnAxis(aE,e)}translateOnAxis(e,t){return rE.copy(e).applyQuaternion(this.quaternion),this.position.add(rE.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(sE,e)}translateY(e){return this.translateOnAxis(oE,e)}translateZ(e){return this.translateOnAxis(aE,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ms.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?pd.copy(e):pd.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),gu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ms.lookAt(gu,pd,this.up):Ms.lookAt(pd,gu,this.up),this.quaternion.setFromRotationMatrix(Ms),r&&(Ms.extractRotation(r.matrixWorld),xl.setFromRotationMatrix(Ms),this.quaternion.premultiply(xl.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(M2)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(E2)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ms.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ms.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ms),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gu,e,A2),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gu,S2,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const a=r[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let f=0,h=l.length;f<h;f++){const d=l[f];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,f=this.material.length;l<f;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),f=o(e.textures),h=o(e.images),d=o(e.shapes),p=o(e.skeletons),m=o(e.animations),y=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),f.length>0&&(i.textures=f),h.length>0&&(i.images=h),d.length>0&&(i.shapes=d),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),y.length>0&&(i.nodes=y)}return i.object=r,i;function o(a){const l=[];for(const f in a){const h=a[f];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}wt.DEFAULT_UP=new D(0,1,0);wt.DEFAULT_MATRIX_AUTO_UPDATE=!0;wt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const br=new D,Es=new D,kv=new D,ws=new D,Al=new D,Sl=new D,lE=new D,zv=new D,Gv=new D,Hv=new D;let md=!1;class Ri{constructor(e=new D,t=new D,i=new D){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),br.subVectors(e,t),r.cross(br);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){br.subVectors(r,t),Es.subVectors(i,t),kv.subVectors(e,t);const o=br.dot(br),a=br.dot(Es),l=br.dot(kv),f=Es.dot(Es),h=Es.dot(kv),d=o*f-a*a;if(d===0)return s.set(0,0,0),null;const p=1/d,m=(f*l-a*h)*p,y=(o*h-a*l)*p;return s.set(1-m-y,y,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ws)===null?!1:ws.x>=0&&ws.y>=0&&ws.x+ws.y<=1}static getUV(e,t,i,r,s,o,a,l){return md===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),md=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,ws)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ws.x),l.addScaledVector(o,ws.y),l.addScaledVector(a,ws.z),l)}static isFrontFacing(e,t,i,r){return br.subVectors(i,t),Es.subVectors(e,t),br.cross(Es).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return br.subVectors(this.c,this.b),Es.subVectors(this.a,this.b),br.cross(Es).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ri.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ri.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return md===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),md=!0),Ri.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return Ri.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Ri.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ri.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Al.subVectors(r,i),Sl.subVectors(s,i),zv.subVectors(e,i);const l=Al.dot(zv),f=Sl.dot(zv);if(l<=0&&f<=0)return t.copy(i);Gv.subVectors(e,r);const h=Al.dot(Gv),d=Sl.dot(Gv);if(h>=0&&d<=h)return t.copy(r);const p=l*d-h*f;if(p<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(i).addScaledVector(Al,o);Hv.subVectors(e,s);const m=Al.dot(Hv),y=Sl.dot(Hv);if(y>=0&&m<=y)return t.copy(s);const S=m*f-l*y;if(S<=0&&f>=0&&y<=0)return a=f/(f-y),t.copy(i).addScaledVector(Sl,a);const A=h*y-m*d;if(A<=0&&d-h>=0&&m-y>=0)return lE.subVectors(s,r),a=(d-h)/(d-h+(m-y)),t.copy(r).addScaledVector(lE,a);const g=1/(A+S+p);return o=S*g,a=p*g,t.copy(i).addScaledVector(Al,o).addScaledVector(Sl,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const yR={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},co={h:0,s:0,l:0},gd={h:0,s:0,l:0};function Vv(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Pe{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Pn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Gt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Gt.workingColorSpace){if(e=Tx(e,1),t=vn(t,0,1),i=vn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Vv(o,s,e+1/3),this.g=Vv(o,s,e),this.b=Vv(o,s,e-1/3)}return Gt.toWorkingColorSpace(this,r),this}setStyle(e,t=Pn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Pn){const i=yR[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=hc(e.r),this.g=hc(e.g),this.b=hc(e.b),this}copyLinearToSRGB(e){return this.r=Bv(e.r),this.g=Bv(e.g),this.b=Bv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Pn){return Gt.fromWorkingColorSpace(li.copy(this),e),Math.round(vn(li.r*255,0,255))*65536+Math.round(vn(li.g*255,0,255))*256+Math.round(vn(li.b*255,0,255))}getHexString(e=Pn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.fromWorkingColorSpace(li.copy(this),t);const i=li.r,r=li.g,s=li.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,f;const h=(a+o)/2;if(a===o)l=0,f=0;else{const d=o-a;switch(f=h<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=f,e.l=h,e}getRGB(e,t=Gt.workingColorSpace){return Gt.fromWorkingColorSpace(li.copy(this),t),e.r=li.r,e.g=li.g,e.b=li.b,e}getStyle(e=Pn){Gt.fromWorkingColorSpace(li.copy(this),e);const t=li.r,i=li.g,r=li.b;return e!==Pn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(co),this.setHSL(co.h+e,co.s+t,co.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(co),e.getHSL(gd);const i=Vu(co.h,gd.h,t),r=Vu(co.s,gd.s,t),s=Vu(co.l,gd.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const li=new Pe;Pe.NAMES=yR;let w2=0;class Ln extends Ks{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:w2++}),this.uuid=Ki(),this.name="",this.type="Material",this.blending=Pa,this.side=cs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Yp,this.blendDst=Qp,this.blendEquation=_o,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Pe(0,0,0),this.blendAlpha=0,this.depthFunc=df,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=e_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ga,this.stencilZFail=ga,this.stencilZPass=ga,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Pa&&(i.blending=this.blending),this.side!==cs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Yp&&(i.blendSrc=this.blendSrc),this.blendDst!==Qp&&(i.blendDst=this.blendDst),this.blendEquation!==_o&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==df&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==e_&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ga&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ga&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ga&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ji extends Ln{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Df,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Is=T2();function T2(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const f=l-127;f<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):f<-14?(i[l]=1024>>-f-14,i[l|256]=1024>>-f-14|32768,r[l]=-f-1,r[l|256]=-f-1):f<=15?(i[l]=f+15<<10,i[l|256]=f+15<<10|32768,r[l]=13,r[l|256]=13):f<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let f=l<<13,h=0;for(;!(f&8388608);)f<<=1,h-=8388608;f&=-8388609,h+=947912704,s[l]=f|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function wi(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=vn(n,-65504,65504),Is.floatView[0]=n;const e=Is.uint32View[0],t=e>>23&511;return Is.baseTable[t]+((e&8388607)>>Is.shiftTable[t])}function Iu(n){const e=n>>10;return Is.uint32View[0]=Is.mantissaTable[Is.offsetTable[e]+(n&1023)]+Is.exponentTable[e],Is.floatView[0]}const C2={toHalfFloat:wi,fromHalfFloat:Iu},Tn=new D,vd=new de;class Dt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=xf,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Nr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)vd.fromBufferAttribute(this,t),vd.applyMatrix3(e),this.setXY(t,vd.x,vd.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Tn.fromBufferAttribute(this,t),Tn.applyMatrix3(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Tn.fromBufferAttribute(this,t),Tn.applyMatrix4(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Tn.fromBufferAttribute(this,t),Tn.applyNormalMatrix(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Tn.fromBufferAttribute(this,t),Tn.transformDirection(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=bi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=At(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=bi(t,this.array)),t}setX(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=bi(t,this.array)),t}setY(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=bi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=bi(t,this.array)),t}setW(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),i=At(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),i=At(i,this.array),r=At(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),i=At(i,this.array),r=At(r,this.array),s=At(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==xf&&(e.usage=this.usage),e}}class R2 extends Dt{constructor(e,t,i){super(new Int8Array(e),t,i)}}class b2 extends Dt{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class P2 extends Dt{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class B2 extends Dt{constructor(e,t,i){super(new Int16Array(e),t,i)}}class Tm extends Dt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class I2 extends Dt{constructor(e,t,i){super(new Int32Array(e),t,i)}}class bx extends Dt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class L2 extends Dt{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=Iu(this.array[e*this.itemSize]);return this.normalized&&(t=bi(t,this.array)),t}setX(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize]=wi(t),this}getY(e){let t=Iu(this.array[e*this.itemSize+1]);return this.normalized&&(t=bi(t,this.array)),t}setY(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+1]=wi(t),this}getZ(e){let t=Iu(this.array[e*this.itemSize+2]);return this.normalized&&(t=bi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+2]=wi(t),this}getW(e){let t=Iu(this.array[e*this.itemSize+3]);return this.normalized&&(t=bi(t,this.array)),t}setW(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+3]=wi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),i=At(i,this.array)),this.array[e+0]=wi(t),this.array[e+1]=wi(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),i=At(i,this.array),r=At(r,this.array)),this.array[e+0]=wi(t),this.array[e+1]=wi(i),this.array[e+2]=wi(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),i=At(i,this.array),r=At(r,this.array),s=At(s,this.array)),this.array[e+0]=wi(t),this.array[e+1]=wi(i),this.array[e+2]=wi(r),this.array[e+3]=wi(s),this}}class Xe extends Dt{constructor(e,t,i){super(new Float32Array(e),t,i)}}class D2 extends Dt{constructor(e,t,i){super(new Float64Array(e),t,i)}}let F2=0;const cr=new Ue,Wv=new wt,Ml=new D,Gi=new Qn,vu=new Qn,Gn=new D;class ht extends Ks{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:F2++}),this.uuid=Ki(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(mR(e)?bx:Tm)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new xt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return cr.makeRotationFromQuaternion(e),this.applyMatrix4(cr),this}rotateX(e){return cr.makeRotationX(e),this.applyMatrix4(cr),this}rotateY(e){return cr.makeRotationY(e),this.applyMatrix4(cr),this}rotateZ(e){return cr.makeRotationZ(e),this.applyMatrix4(cr),this}translate(e,t,i){return cr.makeTranslation(e,t,i),this.applyMatrix4(cr),this}scale(e,t,i){return cr.makeScale(e,t,i),this.applyMatrix4(cr),this}lookAt(e){return Wv.lookAt(e),Wv.updateMatrix(),this.applyMatrix4(Wv.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ml).negate(),this.translate(Ml.x,Ml.y,Ml.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Xe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Gi.setFromBufferAttribute(s),this.morphTargetsRelative?(Gn.addVectors(this.boundingBox.min,Gi.min),this.boundingBox.expandByPoint(Gn),Gn.addVectors(this.boundingBox.max,Gi.max),this.boundingBox.expandByPoint(Gn)):(this.boundingBox.expandByPoint(Gi.min),this.boundingBox.expandByPoint(Gi.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(){this.boundingSphere===null&&(this.boundingSphere=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new D,1/0);return}if(e){const i=this.boundingSphere.center;if(Gi.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];vu.setFromBufferAttribute(a),this.morphTargetsRelative?(Gn.addVectors(Gi.min,vu.min),Gi.expandByPoint(Gn),Gn.addVectors(Gi.max,vu.max),Gi.expandByPoint(Gn)):(Gi.expandByPoint(vu.min),Gi.expandByPoint(vu.max))}Gi.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Gn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Gn));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let f=0,h=a.count;f<h;f++)Gn.fromBufferAttribute(a,f),l&&(Ml.fromBufferAttribute(e,f),Gn.add(Ml)),r=Math.max(r,i.distanceToSquared(Gn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,s=t.normal.array,o=t.uv.array,a=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Dt(new Float32Array(4*a),4));const l=this.getAttribute("tangent").array,f=[],h=[];for(let P=0;P<a;P++)f[P]=new D,h[P]=new D;const d=new D,p=new D,m=new D,y=new de,S=new de,A=new de,g=new D,_=new D;function M(P,U,K){d.fromArray(r,P*3),p.fromArray(r,U*3),m.fromArray(r,K*3),y.fromArray(o,P*2),S.fromArray(o,U*2),A.fromArray(o,K*2),p.sub(d),m.sub(d),S.sub(y),A.sub(y);const ie=1/(S.x*A.y-A.x*S.y);isFinite(ie)&&(g.copy(p).multiplyScalar(A.y).addScaledVector(m,-S.y).multiplyScalar(ie),_.copy(m).multiplyScalar(S.x).addScaledVector(p,-A.x).multiplyScalar(ie),f[P].add(g),f[U].add(g),f[K].add(g),h[P].add(_),h[U].add(_),h[K].add(_))}let w=this.groups;w.length===0&&(w=[{start:0,count:i.length}]);for(let P=0,U=w.length;P<U;++P){const K=w[P],ie=K.start,G=K.count;for(let J=ie,Z=ie+G;J<Z;J+=3)M(i[J+0],i[J+1],i[J+2])}const B=new D,T=new D,b=new D,L=new D;function R(P){b.fromArray(s,P*3),L.copy(b);const U=f[P];B.copy(U),B.sub(b.multiplyScalar(b.dot(U))).normalize(),T.crossVectors(L,U);const ie=T.dot(h[P])<0?-1:1;l[P*4]=B.x,l[P*4+1]=B.y,l[P*4+2]=B.z,l[P*4+3]=ie}for(let P=0,U=w.length;P<U;++P){const K=w[P],ie=K.start,G=K.count;for(let J=ie,Z=ie+G;J<Z;J+=3)R(i[J+0]),R(i[J+1]),R(i[J+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Dt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let p=0,m=i.count;p<m;p++)i.setXYZ(p,0,0,0);const r=new D,s=new D,o=new D,a=new D,l=new D,f=new D,h=new D,d=new D;if(e)for(let p=0,m=e.count;p<m;p+=3){const y=e.getX(p+0),S=e.getX(p+1),A=e.getX(p+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,S),o.fromBufferAttribute(t,A),h.subVectors(o,s),d.subVectors(r,s),h.cross(d),a.fromBufferAttribute(i,y),l.fromBufferAttribute(i,S),f.fromBufferAttribute(i,A),a.add(h),l.add(h),f.add(h),i.setXYZ(y,a.x,a.y,a.z),i.setXYZ(S,l.x,l.y,l.z),i.setXYZ(A,f.x,f.y,f.z)}else for(let p=0,m=t.count;p<m;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),h.subVectors(o,s),d.subVectors(r,s),h.cross(d),i.setXYZ(p+0,h.x,h.y,h.z),i.setXYZ(p+1,h.x,h.y,h.z),i.setXYZ(p+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Gn.fromBufferAttribute(e,t),Gn.normalize(),e.setXYZ(t,Gn.x,Gn.y,Gn.z)}toNonIndexed(){function e(a,l){const f=a.array,h=a.itemSize,d=a.normalized,p=new f.constructor(l.length*h);let m=0,y=0;for(let S=0,A=l.length;S<A;S++){a.isInterleavedBufferAttribute?m=l[S]*a.data.stride+a.offset:m=l[S]*h;for(let g=0;g<h;g++)p[y++]=f[m++]}return new Dt(p,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ht,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],f=e(l,i);t.setAttribute(a,f)}const s=this.morphAttributes;for(const a in s){const l=[],f=s[a];for(let h=0,d=f.length;h<d;h++){const p=f[h],m=e(p,i);l.push(m)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const f=o[a];t.addGroup(f.start,f.count,f.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const f in l)l[f]!==void 0&&(e[f]=l[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const f=i[l];e.data.attributes[l]=f.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const f=this.morphAttributes[l],h=[];for(let d=0,p=f.length;d<p;d++){const m=f[d];h.push(m.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const f in r){const h=r[f];this.setAttribute(f,h.clone(t))}const s=e.morphAttributes;for(const f in s){const h=[],d=s[f];for(let p=0,m=d.length;p<m;p++)h.push(d[p].clone(t));this.morphAttributes[f]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let f=0,h=o.length;f<h;f++){const d=o[f];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const cE=new Ue,ra=new ja,yd=new Zn,uE=new D,El=new D,wl=new D,Tl=new D,Xv=new D,_d=new D,xd=new de,Ad=new de,Sd=new de,fE=new D,hE=new D,dE=new D,Md=new D,Ed=new D;class Mn extends wt{constructor(e=new ht,t=new Ji){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){_d.set(0,0,0);for(let l=0,f=s.length;l<f;l++){const h=a[l],d=s[l];h!==0&&(Xv.fromBufferAttribute(d,e),o?_d.addScaledVector(Xv,h):_d.addScaledVector(Xv.sub(t),h))}t.add(_d)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),yd.copy(i.boundingSphere),yd.applyMatrix4(s),ra.copy(e.ray).recast(e.near),!(yd.containsPoint(ra.origin)===!1&&(ra.intersectSphere(yd,uE)===null||ra.origin.distanceToSquared(uE)>(e.far-e.near)**2))&&(cE.copy(s).invert(),ra.copy(e.ray).applyMatrix4(cE),!(i.boundingBox!==null&&ra.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ra)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,f=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,S=p.length;y<S;y++){const A=p[y],g=o[A.materialIndex],_=Math.max(A.start,m.start),M=Math.min(a.count,Math.min(A.start+A.count,m.start+m.count));for(let w=_,B=M;w<B;w+=3){const T=a.getX(w),b=a.getX(w+1),L=a.getX(w+2);r=wd(this,g,e,i,f,h,d,T,b,L),r&&(r.faceIndex=Math.floor(w/3),r.face.materialIndex=A.materialIndex,t.push(r))}}else{const y=Math.max(0,m.start),S=Math.min(a.count,m.start+m.count);for(let A=y,g=S;A<g;A+=3){const _=a.getX(A),M=a.getX(A+1),w=a.getX(A+2);r=wd(this,o,e,i,f,h,d,_,M,w),r&&(r.faceIndex=Math.floor(A/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,S=p.length;y<S;y++){const A=p[y],g=o[A.materialIndex],_=Math.max(A.start,m.start),M=Math.min(l.count,Math.min(A.start+A.count,m.start+m.count));for(let w=_,B=M;w<B;w+=3){const T=w,b=w+1,L=w+2;r=wd(this,g,e,i,f,h,d,T,b,L),r&&(r.faceIndex=Math.floor(w/3),r.face.materialIndex=A.materialIndex,t.push(r))}}else{const y=Math.max(0,m.start),S=Math.min(l.count,m.start+m.count);for(let A=y,g=S;A<g;A+=3){const _=A,M=A+1,w=A+2;r=wd(this,o,e,i,f,h,d,_,M,w),r&&(r.faceIndex=Math.floor(A/3),t.push(r))}}}}function N2(n,e,t,i,r,s,o,a){let l;if(e.side===_i?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===cs,a),l===null)return null;Ed.copy(a),Ed.applyMatrix4(n.matrixWorld);const f=t.ray.origin.distanceTo(Ed);return f<t.near||f>t.far?null:{distance:f,point:Ed.clone(),object:n}}function wd(n,e,t,i,r,s,o,a,l,f){n.getVertexPosition(a,El),n.getVertexPosition(l,wl),n.getVertexPosition(f,Tl);const h=N2(n,e,t,i,El,wl,Tl,Md);if(h){r&&(xd.fromBufferAttribute(r,a),Ad.fromBufferAttribute(r,l),Sd.fromBufferAttribute(r,f),h.uv=Ri.getInterpolation(Md,El,wl,Tl,xd,Ad,Sd,new de)),s&&(xd.fromBufferAttribute(s,a),Ad.fromBufferAttribute(s,l),Sd.fromBufferAttribute(s,f),h.uv1=Ri.getInterpolation(Md,El,wl,Tl,xd,Ad,Sd,new de),h.uv2=h.uv1),o&&(fE.fromBufferAttribute(o,a),hE.fromBufferAttribute(o,l),dE.fromBufferAttribute(o,f),h.normal=Ri.getInterpolation(Md,El,wl,Tl,fE,hE,dE,new D),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const d={a,b:l,c:f,normal:new D,materialIndex:0};Ri.getNormal(El,wl,Tl,d.normal),h.face=d}return h}class Ka extends ht{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],f=[],h=[],d=[];let p=0,m=0;y("z","y","x",-1,-1,i,t,e,o,s,0),y("z","y","x",1,-1,i,t,-e,o,s,1),y("x","z","y",1,1,e,i,t,r,o,2),y("x","z","y",1,-1,e,i,-t,r,o,3),y("x","y","z",1,-1,e,t,i,r,s,4),y("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Xe(f,3)),this.setAttribute("normal",new Xe(h,3)),this.setAttribute("uv",new Xe(d,2));function y(S,A,g,_,M,w,B,T,b,L,R){const P=w/b,U=B/L,K=w/2,ie=B/2,G=T/2,J=b+1,Z=L+1;let ae=0,O=0;const V=new D;for(let H=0;H<Z;H++){const q=H*U-ie;for(let ne=0;ne<J;ne++){const Y=ne*P-K;V[S]=Y*_,V[A]=q*M,V[g]=G,f.push(V.x,V.y,V.z),V[S]=0,V[A]=0,V[g]=T>0?1:-1,h.push(V.x,V.y,V.z),d.push(ne/b),d.push(1-H/L),ae+=1}}for(let H=0;H<L;H++)for(let q=0;q<b;q++){const ne=p+q+J*H,Y=p+q+J*(H+1),ue=p+(q+1)+J*(H+1),Se=p+(q+1)+J*H;l.push(ne,Y,Se),l.push(Y,ue,Se),O+=6}a.addGroup(m,O,R),m+=O,p+=ae}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ka(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Cc(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function mi(n){const e={};for(let t=0;t<n.length;t++){const i=Cc(n[t]);for(const r in i)e[r]=i[r]}return e}function U2(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function _R(n){return n.getRenderTarget()===null?n.outputColorSpace:Gt.workingColorSpace}const xR={clone:Cc,merge:mi};var O2=`void main() {
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,k2=`void main() {
- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
- }`;class ds extends Ln{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=O2,this.fragmentShader=k2,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Cc(e.uniforms),this.uniformsGroups=U2(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Nf extends wt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ue,this.projectionMatrix=new Ue,this.projectionMatrixInverse=new Ue,this.coordinateSystem=Ur}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Qt extends Nf{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Tc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ba*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Tc*2*Math.atan(Math.tan(Ba*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ba*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,f=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/f,r*=o.width/l,i*=o.height/f}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Cl=-90,Rl=1;class AR extends wt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Qt(Cl,Rl,e,t);r.layers=this.layers,this.add(r);const s=new Qt(Cl,Rl,e,t);s.layers=this.layers,this.add(s);const o=new Qt(Cl,Rl,e,t);o.layers=this.layers,this.add(o);const a=new Qt(Cl,Rl,e,t);a.layers=this.layers,this.add(a);const l=new Qt(Cl,Rl,e,t);l.layers=this.layers,this.add(l);const f=new Qt(Cl,Rl,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const f of t)this.remove(f);if(e===Ur)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===wc)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,f,h]=this.children,d=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const S=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,f),i.texture.generateMipmaps=S,e.setRenderTarget(i,5,r),e.render(t,h),e.setRenderTarget(d,p,m),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}}class Uf extends en{constructor(e,t,i,r,s,o,a,l,f,h){e=e!==void 0?e:[],t=t!==void 0?t:Xs,super(e,t,i,r,s,o,a,l,f,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class SR extends Hr{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(Wu("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Lo?Pn:Wi),this.texture=new Uf(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ln}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
- varying vec3 vWorldDirection;
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }
- `,fragmentShader:`
- uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- }
- `},r=new Ka(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:Cc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:_i,blending:Os});s.uniforms.tEquirect.value=t;const o=new Mn(r,s),a=t.minFilter;return t.minFilter===fs&&(t.minFilter=ln),new AR(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const Jv=new D,z2=new D,G2=new xt;class Bs{constructor(e=new D(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Jv.subVectors(i,t).cross(z2.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(Jv),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||G2.getNormalMatrix(e),r=this.coplanarPoint(Jv).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const sa=new Zn,Td=new D;class Of{constructor(e=new Bs,t=new Bs,i=new Bs,r=new Bs,s=new Bs,o=new Bs){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ur){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],f=r[4],h=r[5],d=r[6],p=r[7],m=r[8],y=r[9],S=r[10],A=r[11],g=r[12],_=r[13],M=r[14],w=r[15];if(i[0].setComponents(l-s,p-f,A-m,w-g).normalize(),i[1].setComponents(l+s,p+f,A+m,w+g).normalize(),i[2].setComponents(l+o,p+h,A+y,w+_).normalize(),i[3].setComponents(l-o,p-h,A-y,w-_).normalize(),i[4].setComponents(l-a,p-d,A-S,w-M).normalize(),t===Ur)i[5].setComponents(l+a,p+d,A+S,w+M).normalize();else if(t===wc)i[5].setComponents(a,d,S,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),sa.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),sa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(sa)}intersectsSprite(e){return sa.center.set(0,0,0),sa.radius=.7071067811865476,sa.applyMatrix4(e.matrixWorld),this.intersectsSphere(sa)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Td.x=r.normal.x>0?e.max.x:e.min.x,Td.y=r.normal.y>0?e.max.y:e.min.y,Td.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Td)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function MR(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function H2(n,e){const t=e.isWebGL2,i=new WeakMap;function r(f,h){const d=f.array,p=f.usage,m=d.byteLength,y=n.createBuffer();n.bindBuffer(h,y),n.bufferData(h,d,p),f.onUploadCallback();let S;if(d instanceof Float32Array)S=n.FLOAT;else if(d instanceof Uint16Array)if(f.isFloat16BufferAttribute)if(t)S=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else S=n.UNSIGNED_SHORT;else if(d instanceof Int16Array)S=n.SHORT;else if(d instanceof Uint32Array)S=n.UNSIGNED_INT;else if(d instanceof Int32Array)S=n.INT;else if(d instanceof Int8Array)S=n.BYTE;else if(d instanceof Uint8Array)S=n.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)S=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:y,type:S,bytesPerElement:d.BYTES_PER_ELEMENT,version:f.version,size:m}}function s(f,h,d){const p=h.array,m=h._updateRange,y=h.updateRanges;if(n.bindBuffer(d,f),m.count===-1&&y.length===0&&n.bufferSubData(d,0,p),y.length!==0){for(let S=0,A=y.length;S<A;S++){const g=y[S];t?n.bufferSubData(d,g.start*p.BYTES_PER_ELEMENT,p,g.start,g.count):n.bufferSubData(d,g.start*p.BYTES_PER_ELEMENT,p.subarray(g.start,g.start+g.count))}h.clearUpdateRanges()}m.count!==-1&&(t?n.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):n.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),h.onUploadCallback()}function o(f){return f.isInterleavedBufferAttribute&&(f=f.data),i.get(f)}function a(f){f.isInterleavedBufferAttribute&&(f=f.data);const h=i.get(f);h&&(n.deleteBuffer(h.buffer),i.delete(f))}function l(f,h){if(f.isGLBufferAttribute){const p=i.get(f);(!p||p.version<f.version)&&i.set(f,{buffer:f.buffer,type:f.type,bytesPerElement:f.elementSize,version:f.version});return}f.isInterleavedBufferAttribute&&(f=f.data);const d=i.get(f);if(d===void 0)i.set(f,r(f,h));else if(d.version<f.version){if(d.size!==f.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");s(d.buffer,f,h),d.version=f.version}}return{get:o,remove:a,update:l}}class kf extends ht{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),f=a+1,h=l+1,d=e/a,p=t/l,m=[],y=[],S=[],A=[];for(let g=0;g<h;g++){const _=g*p-o;for(let M=0;M<f;M++){const w=M*d-s;y.push(w,-_,0),S.push(0,0,1),A.push(M/a),A.push(1-g/l)}}for(let g=0;g<l;g++)for(let _=0;_<a;_++){const M=_+f*g,w=_+f*(g+1),B=_+1+f*(g+1),T=_+1+f*g;m.push(M,w,T),m.push(w,B,T)}this.setIndex(m),this.setAttribute("position",new Xe(y,3)),this.setAttribute("normal",new Xe(S,3)),this.setAttribute("uv",new Xe(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kf(e.width,e.height,e.widthSegments,e.heightSegments)}}var V2=`#ifdef USE_ALPHAHASH
- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
- #endif`,W2=`#ifdef USE_ALPHAHASH
- const float ALPHA_HASH_SCALE = 0.05;
- float hash2D( vec2 value ) {
- return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
- }
- float hash3D( vec3 value ) {
- return hash2D( vec2( hash2D( value.xy ), value.z ) );
- }
- float getAlphaHashThreshold( vec3 position ) {
- float maxDeriv = max(
- length( dFdx( position.xyz ) ),
- length( dFdy( position.xyz ) )
- );
- float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
- vec2 pixScales = vec2(
- exp2( floor( log2( pixScale ) ) ),
- exp2( ceil( log2( pixScale ) ) )
- );
- vec2 alpha = vec2(
- hash3D( floor( pixScales.x * position.xyz ) ),
- hash3D( floor( pixScales.y * position.xyz ) )
- );
- float lerpFactor = fract( log2( pixScale ) );
- float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
- float a = min( lerpFactor, 1.0 - lerpFactor );
- vec3 cases = vec3(
- x * x / ( 2.0 * a * ( 1.0 - a ) ),
- ( x - 0.5 * a ) / ( 1.0 - a ),
- 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
- );
- float threshold = ( x < ( 1.0 - a ) )
- ? ( ( x < a ) ? cases.x : cases.y )
- : cases.z;
- return clamp( threshold , 1.0e-6, 1.0 );
- }
- #endif`,X2=`#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
- #endif`,J2=`#ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,j2=`#ifdef USE_ALPHATEST
- if ( diffuseColor.a < alphaTest ) discard;
- #endif`,K2=`#ifdef USE_ALPHATEST
- uniform float alphaTest;
- #endif`,Y2=`#ifdef USE_AOMAP
- float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
- reflectedLight.indirectDiffuse *= ambientOcclusion;
- #if defined( USE_CLEARCOAT )
- clearcoatSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_SHEEN )
- sheenSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD )
- float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
- #endif
- #endif`,Q2=`#ifdef USE_AOMAP
- uniform sampler2D aoMap;
- uniform float aoMapIntensity;
- #endif`,Z2=`#ifdef USE_BATCHING
- attribute float batchId;
- uniform highp sampler2D batchingTexture;
- mat4 getBatchingMatrix( const in float i ) {
- int size = textureSize( batchingTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- #endif`,q2=`#ifdef USE_BATCHING
- mat4 batchingMatrix = getBatchingMatrix( batchId );
- #endif`,$2=`vec3 transformed = vec3( position );
- #ifdef USE_ALPHAHASH
- vPosition = vec3( position );
- #endif`,eD=`vec3 objectNormal = vec3( normal );
- #ifdef USE_TANGENT
- vec3 objectTangent = vec3( tangent.xyz );
- #endif`,tD=`float G_BlinnPhong_Implicit( ) {
- return 0.25;
- }
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
- }
- vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( specularColor, 1.0, dotVH );
- float G = G_BlinnPhong_Implicit( );
- float D = D_BlinnPhong( shininess, dotNH );
- return F * ( G * D );
- } // validated`,nD=`#ifdef USE_IRIDESCENCE
- const mat3 XYZ_TO_REC709 = mat3(
- 3.2404542, -0.9692660, 0.0556434,
- -1.5371385, 1.8760108, -0.2040259,
- -0.4985314, 0.0415560, 1.0572252
- );
- vec3 Fresnel0ToIor( vec3 fresnel0 ) {
- vec3 sqrtF0 = sqrt( fresnel0 );
- return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
- }
- vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
- }
- float IorToFresnel0( float transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
- }
- vec3 evalSensitivity( float OPD, vec3 shift ) {
- float phase = 2.0 * PI * OPD * 1.0e-9;
- vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
- vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
- vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
- vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
- xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
- xyz /= 1.0685e-7;
- vec3 rgb = XYZ_TO_REC709 * xyz;
- return rgb;
- }
- vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
- vec3 I;
- float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
- float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
- float cosTheta2Sq = 1.0 - sinTheta2Sq;
- if ( cosTheta2Sq < 0.0 ) {
- return vec3( 1.0 );
- }
- float cosTheta2 = sqrt( cosTheta2Sq );
- float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
- float R12 = F_Schlick( R0, 1.0, cosTheta1 );
- float T121 = 1.0 - R12;
- float phi12 = 0.0;
- if ( iridescenceIOR < outsideIOR ) phi12 = PI;
- float phi21 = PI - phi12;
- vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
- vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
- vec3 phi23 = vec3( 0.0 );
- if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
- if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
- if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
- float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
- vec3 phi = vec3( phi21 ) + phi23;
- vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
- vec3 r123 = sqrt( R123 );
- vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
- vec3 C0 = R12 + Rs;
- I = C0;
- vec3 Cm = Rs - T121;
- for ( int m = 1; m <= 2; ++ m ) {
- Cm *= r123;
- vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
- I += Cm * Sm;
- }
- return max( I, vec3( 0.0 ) );
- }
- #endif`,iD=`#ifdef USE_BUMPMAP
- uniform sampler2D bumpMap;
- uniform float bumpScale;
- vec2 dHdxy_fwd() {
- vec2 dSTdx = dFdx( vBumpMapUv );
- vec2 dSTdy = dFdy( vBumpMapUv );
- float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
- float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
- float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
- return vec2( dBx, dBy );
- }
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
- vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
- vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
- vec3 vN = surf_norm;
- vec3 R1 = cross( vSigmaY, vN );
- vec3 R2 = cross( vN, vSigmaX );
- float fDet = dot( vSigmaX, R1 ) * faceDirection;
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
- return normalize( abs( fDet ) * surf_norm - vGrad );
- }
- #endif`,rD=`#if NUM_CLIPPING_PLANES > 0
- vec4 plane;
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- bool clipped = true;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
- }
- #pragma unroll_loop_end
- if ( clipped ) discard;
- #endif
- #endif`,sD=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
- #endif`,oD=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- #endif`,aD=`#if NUM_CLIPPING_PLANES > 0
- vClipPosition = - mvPosition.xyz;
- #endif`,lD=`#if defined( USE_COLOR_ALPHA )
- diffuseColor *= vColor;
- #elif defined( USE_COLOR )
- diffuseColor.rgb *= vColor;
- #endif`,cD=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR )
- varying vec3 vColor;
- #endif`,uD=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
- varying vec3 vColor;
- #endif`,fD=`#if defined( USE_COLOR_ALPHA )
- vColor = vec4( 1.0 );
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
- vColor = vec3( 1.0 );
- #endif
- #ifdef USE_COLOR
- vColor *= color;
- #endif
- #ifdef USE_INSTANCING_COLOR
- vColor.xyz *= instanceColor.xyz;
- #endif`,hD=`#define PI 3.141592653589793
- #define PI2 6.283185307179586
- #define PI_HALF 1.5707963267948966
- #define RECIPROCAL_PI 0.3183098861837907
- #define RECIPROCAL_PI2 0.15915494309189535
- #define EPSILON 1e-6
- #ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- #define whiteComplement( a ) ( 1.0 - saturate( a ) )
- float pow2( const in float x ) { return x*x; }
- vec3 pow2( const in vec3 x ) { return x*x; }
- float pow3( const in float x ) { return x*x*x; }
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
- float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
- float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
- highp float rand( const in vec2 uv ) {
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
- return fract( sin( sn ) * c );
- }
- #ifdef HIGH_PRECISION
- float precisionSafeLength( vec3 v ) { return length( v ); }
- #else
- float precisionSafeLength( vec3 v ) {
- float maxComponent = max3( abs( v ) );
- return length( v / maxComponent ) * maxComponent;
- }
- #endif
- struct IncidentLight {
- vec3 color;
- vec3 direction;
- bool visible;
- };
- struct ReflectedLight {
- vec3 directDiffuse;
- vec3 directSpecular;
- vec3 indirectDiffuse;
- vec3 indirectSpecular;
- };
- #ifdef USE_ALPHAHASH
- varying vec3 vPosition;
- #endif
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
- }
- mat3 transposeMat3( const in mat3 m ) {
- mat3 tmp;
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
- return tmp;
- }
- float luminance( const in vec3 rgb ) {
- const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
- return dot( weights, rgb );
- }
- bool isPerspectiveMatrix( mat4 m ) {
- return m[ 2 ][ 3 ] == - 1.0;
- }
- vec2 equirectUv( in vec3 dir ) {
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
- return vec2( u, v );
- }
- vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
- return RECIPROCAL_PI * diffuseColor;
- }
- vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- }
- float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- } // validated`,dD=`#ifdef ENVMAP_TYPE_CUBE_UV
- #define cubeUV_minMipLevel 4.0
- #define cubeUV_minTileSize 16.0
- float getFace( vec3 direction ) {
- vec3 absDirection = abs( direction );
- float face = - 1.0;
- if ( absDirection.x > absDirection.z ) {
- if ( absDirection.x > absDirection.y )
- face = direction.x > 0.0 ? 0.0 : 3.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- } else {
- if ( absDirection.z > absDirection.y )
- face = direction.z > 0.0 ? 2.0 : 5.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- }
- return face;
- }
- vec2 getUV( vec3 direction, float face ) {
- vec2 uv;
- if ( face == 0.0 ) {
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 1.0 ) {
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
- } else if ( face == 2.0 ) {
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
- } else if ( face == 3.0 ) {
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 4.0 ) {
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
- } else {
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
- }
- return 0.5 * ( uv + 1.0 );
- }
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
- float face = getFace( direction );
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
- mipInt = max( mipInt, cubeUV_minMipLevel );
- float faceSize = exp2( mipInt );
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
- if ( face > 2.0 ) {
- uv.y += faceSize;
- face -= 3.0;
- }
- uv.x += face * faceSize;
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
- uv.x *= CUBEUV_TEXEL_WIDTH;
- uv.y *= CUBEUV_TEXEL_HEIGHT;
- #ifdef texture2DGradEXT
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
- #else
- return texture2D( envMap, uv ).rgb;
- #endif
- }
- #define cubeUV_r0 1.0
- #define cubeUV_m0 - 2.0
- #define cubeUV_r1 0.8
- #define cubeUV_m1 - 1.0
- #define cubeUV_r4 0.4
- #define cubeUV_m4 2.0
- #define cubeUV_r5 0.305
- #define cubeUV_m5 3.0
- #define cubeUV_r6 0.21
- #define cubeUV_m6 4.0
- float roughnessToMip( float roughness ) {
- float mip = 0.0;
- if ( roughness >= cubeUV_r1 ) {
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
- } else if ( roughness >= cubeUV_r4 ) {
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
- } else if ( roughness >= cubeUV_r5 ) {
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
- } else if ( roughness >= cubeUV_r6 ) {
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
- } else {
- mip = - 2.0 * log2( 1.16 * roughness ); }
- return mip;
- }
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
- float mipF = fract( mip );
- float mipInt = floor( mip );
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
- if ( mipF == 0.0 ) {
- return vec4( color0, 1.0 );
- } else {
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
- return vec4( mix( color0, color1, mipF ), 1.0 );
- }
- }
- #endif`,pD=`vec3 transformedNormal = objectNormal;
- #ifdef USE_TANGENT
- vec3 transformedTangent = objectTangent;
- #endif
- #ifdef USE_BATCHING
- mat3 bm = mat3( batchingMatrix );
- transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
- transformedNormal = bm * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = bm * transformedTangent;
- #endif
- #endif
- #ifdef USE_INSTANCING
- mat3 im = mat3( instanceMatrix );
- transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
- transformedNormal = im * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = im * transformedTangent;
- #endif
- #endif
- transformedNormal = normalMatrix * transformedNormal;
- #ifdef FLIP_SIDED
- transformedNormal = - transformedNormal;
- #endif
- #ifdef USE_TANGENT
- transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
- #ifdef FLIP_SIDED
- transformedTangent = - transformedTangent;
- #endif
- #endif`,mD=`#ifdef USE_DISPLACEMENTMAP
- uniform sampler2D displacementMap;
- uniform float displacementScale;
- uniform float displacementBias;
- #endif`,gD=`#ifdef USE_DISPLACEMENTMAP
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
- #endif`,vD=`#ifdef USE_EMISSIVEMAP
- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
- totalEmissiveRadiance *= emissiveColor.rgb;
- #endif`,yD=`#ifdef USE_EMISSIVEMAP
- uniform sampler2D emissiveMap;
- #endif`,_D="gl_FragColor = linearToOutputTexel( gl_FragColor );",xD=`
- const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
- vec3( 0.8224621, 0.177538, 0.0 ),
- vec3( 0.0331941, 0.9668058, 0.0 ),
- vec3( 0.0170827, 0.0723974, 0.9105199 )
- );
- const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
- vec3( 1.2249401, - 0.2249404, 0.0 ),
- vec3( - 0.0420569, 1.0420571, 0.0 ),
- vec3( - 0.0196376, - 0.0786361, 1.0982735 )
- );
- vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
- return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
- }
- vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
- return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
- }
- vec4 LinearTransferOETF( in vec4 value ) {
- return value;
- }
- vec4 sRGBTransferOETF( in vec4 value ) {
- return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
- }
- vec4 LinearToLinear( in vec4 value ) {
- return value;
- }
- vec4 LinearTosRGB( in vec4 value ) {
- return sRGBTransferOETF( value );
- }`,AD=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vec3 cameraToFrag;
- if ( isOrthographic ) {
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
- #else
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
- #endif
- #else
- vec3 reflectVec = vReflect;
- #endif
- #ifdef ENVMAP_TYPE_CUBE
- vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
- #else
- vec4 envColor = vec4( 0.0 );
- #endif
- #ifdef ENVMAP_BLENDING_MULTIPLY
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_MIX )
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_ADD )
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
- #endif
- #endif`,SD=`#ifdef USE_ENVMAP
- uniform float envMapIntensity;
- uniform float flipEnvMap;
- #ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #else
- uniform sampler2D envMap;
- #endif
-
- #endif`,MD=`#ifdef USE_ENVMAP
- uniform float reflectivity;
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
- varying vec3 vWorldPosition;
- uniform float refractionRatio;
- #else
- varying vec3 vReflect;
- #endif
- #endif`,ED=`#ifdef USE_ENVMAP
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
-
- varying vec3 vWorldPosition;
- #else
- varying vec3 vReflect;
- uniform float refractionRatio;
- #endif
- #endif`,wD=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vWorldPosition = worldPosition.xyz;
- #else
- vec3 cameraToVertex;
- if ( isOrthographic ) {
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vReflect = reflect( cameraToVertex, worldNormal );
- #else
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
- #endif
- #endif
- #endif`,TD=`#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
- #endif`,CD=`#ifdef USE_FOG
- varying float vFogDepth;
- #endif`,RD=`#ifdef USE_FOG
- #ifdef FOG_EXP2
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
- #else
- float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
- #endif
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
- #endif`,bD=`#ifdef USE_FOG
- uniform vec3 fogColor;
- varying float vFogDepth;
- #ifdef FOG_EXP2
- uniform float fogDensity;
- #else
- uniform float fogNear;
- uniform float fogFar;
- #endif
- #endif`,PD=`#ifdef USE_GRADIENTMAP
- uniform sampler2D gradientMap;
- #endif
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
- float dotNL = dot( normal, lightDirection );
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
- #ifdef USE_GRADIENTMAP
- return vec3( texture2D( gradientMap, coord ).r );
- #else
- vec2 fw = fwidth( coord ) * 0.5;
- return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
- #endif
- }`,BD=`#ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- reflectedLight.indirectDiffuse += lightMapIrradiance;
- #endif`,ID=`#ifdef USE_LIGHTMAP
- uniform sampler2D lightMap;
- uniform float lightMapIntensity;
- #endif`,LD=`LambertMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularStrength = specularStrength;`,DD=`varying vec3 vViewPosition;
- struct LambertMaterial {
- vec3 diffuseColor;
- float specularStrength;
- };
- void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Lambert
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,FD=`uniform bool receiveShadow;
- uniform vec3 ambientLightColor;
- #if defined( USE_LIGHT_PROBES )
- uniform vec3 lightProbe[ 9 ];
- #endif
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
- float x = normal.x, y = normal.y, z = normal.z;
- vec3 result = shCoefficients[ 0 ] * 0.886227;
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
- return result;
- }
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
- return irradiance;
- }
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
- vec3 irradiance = ambientLightColor;
- return irradiance;
- }
- float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
- #if defined ( LEGACY_LIGHTS )
- if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
- return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
- }
- return 1.0;
- #else
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
- if ( cutoffDistance > 0.0 ) {
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
- }
- return distanceFalloff;
- #endif
- }
- float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
- return smoothstep( coneCosine, penumbraCosine, angleCosine );
- }
- #if NUM_DIR_LIGHTS > 0
- struct DirectionalLight {
- vec3 direction;
- vec3 color;
- };
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
- void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
- light.color = directionalLight.color;
- light.direction = directionalLight.direction;
- light.visible = true;
- }
- #endif
- #if NUM_POINT_LIGHTS > 0
- struct PointLight {
- vec3 position;
- vec3 color;
- float distance;
- float decay;
- };
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
- void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = pointLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float lightDistance = length( lVector );
- light.color = pointLight.color;
- light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- }
- #endif
- #if NUM_SPOT_LIGHTS > 0
- struct SpotLight {
- vec3 position;
- vec3 direction;
- vec3 color;
- float distance;
- float decay;
- float coneCos;
- float penumbraCos;
- };
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
- void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = spotLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float angleCos = dot( light.direction, spotLight.direction );
- float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
- if ( spotAttenuation > 0.0 ) {
- float lightDistance = length( lVector );
- light.color = spotLight.color * spotAttenuation;
- light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- } else {
- light.color = vec3( 0.0 );
- light.visible = false;
- }
- }
- #endif
- #if NUM_RECT_AREA_LIGHTS > 0
- struct RectAreaLight {
- vec3 color;
- vec3 position;
- vec3 halfWidth;
- vec3 halfHeight;
- };
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
- #endif
- #if NUM_HEMI_LIGHTS > 0
- struct HemisphereLight {
- vec3 direction;
- vec3 skyColor;
- vec3 groundColor;
- };
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
- float dotNL = dot( normal, hemiLight.direction );
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
- return irradiance;
- }
- #endif`,ND=`#ifdef USE_ENVMAP
- vec3 getIBLIrradiance( const in vec3 normal ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
- return PI * envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 reflectVec = reflect( - viewDir, normal );
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
- reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
- return envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- #ifdef USE_ANISOTROPY
- vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 bentNormal = cross( bitangent, viewDir );
- bentNormal = normalize( cross( bentNormal, bitangent ) );
- bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
- return getIBLRadiance( viewDir, bentNormal, roughness );
- #else
- return vec3( 0.0 );
- #endif
- }
- #endif
- #endif`,UD=`ToonMaterial material;
- material.diffuseColor = diffuseColor.rgb;`,OD=`varying vec3 vViewPosition;
- struct ToonMaterial {
- vec3 diffuseColor;
- };
- void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
- vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Toon
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,kD=`BlinnPhongMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularColor = specular;
- material.specularShininess = shininess;
- material.specularStrength = specularStrength;`,zD=`varying vec3 vViewPosition;
- struct BlinnPhongMaterial {
- vec3 diffuseColor;
- vec3 specularColor;
- float specularShininess;
- float specularStrength;
- };
- void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
- }
- void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_BlinnPhong
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,GD=`PhysicalMaterial material;
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
- vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
- material.roughness = min( material.roughness, 1.0 );
- #ifdef IOR
- material.ior = ior;
- #ifdef USE_SPECULAR
- float specularIntensityFactor = specularIntensity;
- vec3 specularColorFactor = specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
- #endif
- material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
- #else
- float specularIntensityFactor = 1.0;
- vec3 specularColorFactor = vec3( 1.0 );
- material.specularF90 = 1.0;
- #endif
- material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
- #else
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
- material.specularF90 = 1.0;
- #endif
- #ifdef USE_CLEARCOAT
- material.clearcoat = clearcoat;
- material.clearcoatRoughness = clearcoatRoughness;
- material.clearcoatF0 = vec3( 0.04 );
- material.clearcoatF90 = 1.0;
- #ifdef USE_CLEARCOATMAP
- material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
- #endif
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
- material.clearcoatRoughness += geometryRoughness;
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
- #endif
- #ifdef USE_IRIDESCENCE
- material.iridescence = iridescence;
- material.iridescenceIOR = iridescenceIOR;
- #ifdef USE_IRIDESCENCEMAP
- material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
- #else
- material.iridescenceThickness = iridescenceThicknessMaximum;
- #endif
- #endif
- #ifdef USE_SHEEN
- material.sheenColor = sheenColor;
- #ifdef USE_SHEEN_COLORMAP
- material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
- #endif
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
- #ifdef USE_SHEEN_ROUGHNESSMAP
- material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- #ifdef USE_ANISOTROPYMAP
- mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
- vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
- vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
- #else
- vec2 anisotropyV = anisotropyVector;
- #endif
- material.anisotropy = length( anisotropyV );
- if( material.anisotropy == 0.0 ) {
- anisotropyV = vec2( 1.0, 0.0 );
- } else {
- anisotropyV /= material.anisotropy;
- material.anisotropy = saturate( material.anisotropy );
- }
- material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
- material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
- material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
- #endif`,HD=`struct PhysicalMaterial {
- vec3 diffuseColor;
- float roughness;
- vec3 specularColor;
- float specularF90;
- #ifdef USE_CLEARCOAT
- float clearcoat;
- float clearcoatRoughness;
- vec3 clearcoatF0;
- float clearcoatF90;
- #endif
- #ifdef USE_IRIDESCENCE
- float iridescence;
- float iridescenceIOR;
- float iridescenceThickness;
- vec3 iridescenceFresnel;
- vec3 iridescenceF0;
- #endif
- #ifdef USE_SHEEN
- vec3 sheenColor;
- float sheenRoughness;
- #endif
- #ifdef IOR
- float ior;
- #endif
- #ifdef USE_TRANSMISSION
- float transmission;
- float transmissionAlpha;
- float thickness;
- float attenuationDistance;
- vec3 attenuationColor;
- #endif
- #ifdef USE_ANISOTROPY
- float anisotropy;
- float alphaT;
- vec3 anisotropyT;
- vec3 anisotropyB;
- #endif
- };
- vec3 clearcoatSpecularDirect = vec3( 0.0 );
- vec3 clearcoatSpecularIndirect = vec3( 0.0 );
- vec3 sheenSpecularDirect = vec3( 0.0 );
- vec3 sheenSpecularIndirect = vec3(0.0 );
- vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
- float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
- float x2 = x * x;
- float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
- return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
- }
- float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
- float a2 = pow2( alpha );
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
- return 0.5 / max( gv + gl, EPSILON );
- }
- float D_GGX( const in float alpha, const in float dotNH ) {
- float a2 = pow2( alpha );
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
- return RECIPROCAL_PI * a2 / pow2( denom );
- }
- #ifdef USE_ANISOTROPY
- float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
- float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
- float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
- float v = 0.5 / ( gv + gl );
- return saturate(v);
- }
- float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
- float a2 = alphaT * alphaB;
- highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
- highp float v2 = dot( v, v );
- float w2 = a2 / v2;
- return RECIPROCAL_PI * a2 * pow2 ( w2 );
- }
- #endif
- #ifdef USE_CLEARCOAT
- vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
- vec3 f0 = material.clearcoatF0;
- float f90 = material.clearcoatF90;
- float roughness = material.clearcoatRoughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- return F * ( V * D );
- }
- #endif
- vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
- vec3 f0 = material.specularColor;
- float f90 = material.specularF90;
- float roughness = material.roughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- #ifdef USE_IRIDESCENCE
- F = mix( F, material.iridescenceFresnel, material.iridescence );
- #endif
- #ifdef USE_ANISOTROPY
- float dotTL = dot( material.anisotropyT, lightDir );
- float dotTV = dot( material.anisotropyT, viewDir );
- float dotTH = dot( material.anisotropyT, halfDir );
- float dotBL = dot( material.anisotropyB, lightDir );
- float dotBV = dot( material.anisotropyB, viewDir );
- float dotBH = dot( material.anisotropyB, halfDir );
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
- #else
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- #endif
- return F * ( V * D );
- }
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
- const float LUT_SIZE = 64.0;
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
- const float LUT_BIAS = 0.5 / LUT_SIZE;
- float dotNV = saturate( dot( N, V ) );
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
- uv = uv * LUT_SCALE + LUT_BIAS;
- return uv;
- }
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
- float l = length( f );
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
- }
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
- float x = dot( v1, v2 );
- float y = abs( x );
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
- float v = a / b;
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
- return cross( v1, v2 ) * theta_sintheta;
- }
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
- vec3 lightNormal = cross( v1, v2 );
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
- vec3 T1, T2;
- T1 = normalize( V - N * dot( V, N ) );
- T2 = - cross( N, T1 );
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
- vec3 coords[ 4 ];
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
- coords[ 0 ] = normalize( coords[ 0 ] );
- coords[ 1 ] = normalize( coords[ 1 ] );
- coords[ 2 ] = normalize( coords[ 2 ] );
- coords[ 3 ] = normalize( coords[ 3 ] );
- vec3 vectorFormFactor = vec3( 0.0 );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
- return vec3( result );
- }
- #if defined( USE_SHEEN )
- float D_Charlie( float roughness, float dotNH ) {
- float alpha = pow2( roughness );
- float invAlpha = 1.0 / alpha;
- float cos2h = dotNH * dotNH;
- float sin2h = max( 1.0 - cos2h, 0.0078125 );
- return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
- }
- float V_Neubelt( float dotNV, float dotNL ) {
- return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
- }
- vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float D = D_Charlie( sheenRoughness, dotNH );
- float V = V_Neubelt( dotNV, dotNL );
- return sheenColor * ( D * V );
- }
- #endif
- float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- float r2 = roughness * roughness;
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
- return saturate( DG * RECIPROCAL_PI );
- }
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
- vec4 r = roughness * c0 + c1;
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
- vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
- return fab;
- }
- vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- return specularColor * fab.x + specularF90 * fab.y;
- }
- #ifdef USE_IRIDESCENCE
- void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
- #else
- void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
- #endif
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- #ifdef USE_IRIDESCENCE
- vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
- #else
- vec3 Fr = specularColor;
- #endif
- vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
- float Ess = fab.x + fab.y;
- float Ems = 1.0 - Ess;
- vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
- singleScatter += FssEss;
- multiScatter += Fms * Ems;
- }
- #if NUM_RECT_AREA_LIGHTS > 0
- void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- vec3 normal = geometryNormal;
- vec3 viewDir = geometryViewDir;
- vec3 position = geometryPosition;
- vec3 lightPos = rectAreaLight.position;
- vec3 halfWidth = rectAreaLight.halfWidth;
- vec3 halfHeight = rectAreaLight.halfHeight;
- vec3 lightColor = rectAreaLight.color;
- float roughness = material.roughness;
- vec3 rectCoords[ 4 ];
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
- vec4 t1 = texture2D( ltc_1, uv );
- vec4 t2 = texture2D( ltc_2, uv );
- mat3 mInv = mat3(
- vec3( t1.x, 0, t1.y ),
- vec3( 0, 1, 0 ),
- vec3( t1.z, 0, t1.w )
- );
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
- }
- #endif
- void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- #ifdef USE_CLEARCOAT
- float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
- vec3 ccIrradiance = dotNLcc * directLight.color;
- clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
- #endif
- reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
- #ifdef USE_CLEARCOAT
- clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
- #endif
- vec3 singleScattering = vec3( 0.0 );
- vec3 multiScattering = vec3( 0.0 );
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
- #ifdef USE_IRIDESCENCE
- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
- #else
- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
- #endif
- vec3 totalScattering = singleScattering + multiScattering;
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
- reflectedLight.indirectSpecular += radiance * singleScattering;
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
- }
- #define RE_Direct RE_Direct_Physical
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
- }`,VD=`
- vec3 geometryPosition = - vViewPosition;
- vec3 geometryNormal = normal;
- vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
- vec3 geometryClearcoatNormal = vec3( 0.0 );
- #ifdef USE_CLEARCOAT
- geometryClearcoatNormal = clearcoatNormal;
- #endif
- #ifdef USE_IRIDESCENCE
- float dotNVi = saturate( dot( normal, geometryViewDir ) );
- if ( material.iridescenceThickness == 0.0 ) {
- material.iridescence = 0.0;
- } else {
- material.iridescence = saturate( material.iridescence );
- }
- if ( material.iridescence > 0.0 ) {
- material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
- material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
- }
- #endif
- IncidentLight directLight;
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
- PointLight pointLight;
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
- pointLight = pointLights[ i ];
- getPointLightInfo( pointLight, geometryPosition, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
- pointLightShadow = pointLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
- SpotLight spotLight;
- vec4 spotColor;
- vec3 spotLightCoord;
- bool inSpotLightMap;
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
- spotLight = spotLights[ i ];
- getSpotLightInfo( spotLight, geometryPosition, directLight );
- #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
- #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
- #else
- #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #endif
- #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
- spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
- inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
- spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
- directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
- #endif
- #undef SPOT_LIGHT_MAP_INDEX
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- spotLightShadow = spotLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
- DirectionalLight directionalLight;
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalLightInfo( directionalLight, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directionalLightShadow = directionalLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
- RectAreaLight rectAreaLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
- rectAreaLight = rectAreaLights[ i ];
- RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if defined( RE_IndirectDiffuse )
- vec3 iblIrradiance = vec3( 0.0 );
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
- #if defined( USE_LIGHT_PROBES )
- irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
- #endif
- #if ( NUM_HEMI_LIGHTS > 0 )
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if defined( RE_IndirectSpecular )
- vec3 radiance = vec3( 0.0 );
- vec3 clearcoatRadiance = vec3( 0.0 );
- #endif`,WD=`#if defined( RE_IndirectDiffuse )
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- irradiance += lightMapIrradiance;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
- iblIrradiance += getIBLIrradiance( geometryNormal );
- #endif
- #endif
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
- #ifdef USE_ANISOTROPY
- radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
- #else
- radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
- #endif
- #ifdef USE_CLEARCOAT
- clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
- #endif
- #endif`,XD=`#if defined( RE_IndirectDiffuse )
- RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif
- #if defined( RE_IndirectSpecular )
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif`,JD=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
- gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
- #endif`,jD=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
- uniform float logDepthBufFC;
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,KD=`#ifdef USE_LOGDEPTHBUF
- #ifdef USE_LOGDEPTHBUF_EXT
- varying float vFragDepth;
- varying float vIsPerspective;
- #else
- uniform float logDepthBufFC;
- #endif
- #endif`,YD=`#ifdef USE_LOGDEPTHBUF
- #ifdef USE_LOGDEPTHBUF_EXT
- vFragDepth = 1.0 + gl_Position.w;
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
- #else
- if ( isPerspectiveMatrix( projectionMatrix ) ) {
- gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
- gl_Position.z *= gl_Position.w;
- }
- #endif
- #endif`,QD=`#ifdef USE_MAP
- vec4 sampledDiffuseColor = texture2D( map, vMapUv );
- #ifdef DECODE_VIDEO_TEXTURE
- sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
-
- #endif
- diffuseColor *= sampledDiffuseColor;
- #endif`,ZD=`#ifdef USE_MAP
- uniform sampler2D map;
- #endif`,qD=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- #if defined( USE_POINTS_UV )
- vec2 uv = vUv;
- #else
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
- #endif
- #endif
- #ifdef USE_MAP
- diffuseColor *= texture2D( map, uv );
- #endif
- #ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
- #endif`,$D=`#if defined( USE_POINTS_UV )
- varying vec2 vUv;
- #else
- #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- uniform mat3 uvTransform;
- #endif
- #endif
- #ifdef USE_MAP
- uniform sampler2D map;
- #endif
- #ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,eF=`float metalnessFactor = metalness;
- #ifdef USE_METALNESSMAP
- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
- metalnessFactor *= texelMetalness.b;
- #endif`,tF=`#ifdef USE_METALNESSMAP
- uniform sampler2D metalnessMap;
- #endif`,nF=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
- vColor *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- #if defined( USE_COLOR_ALPHA )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
- #elif defined( USE_COLOR )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
- #endif
- }
- #endif`,iF=`#ifdef USE_MORPHNORMALS
- objectNormal *= morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
- }
- #else
- objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
- objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
- objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
- objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
- #endif
- #endif`,rF=`#ifdef USE_MORPHTARGETS
- uniform float morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- uniform sampler2DArray morphTargetsTexture;
- uniform ivec2 morphTargetsTextureSize;
- vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
- int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
- int y = texelIndex / morphTargetsTextureSize.x;
- int x = texelIndex - y * morphTargetsTextureSize.x;
- ivec3 morphUV = ivec3( x, y, morphTargetIndex );
- return texelFetch( morphTargetsTexture, morphUV, 0 );
- }
- #else
- #ifndef USE_MORPHNORMALS
- uniform float morphTargetInfluences[ 8 ];
- #else
- uniform float morphTargetInfluences[ 4 ];
- #endif
- #endif
- #endif`,sF=`#ifdef USE_MORPHTARGETS
- transformed *= morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
- }
- #else
- transformed += morphTarget0 * morphTargetInfluences[ 0 ];
- transformed += morphTarget1 * morphTargetInfluences[ 1 ];
- transformed += morphTarget2 * morphTargetInfluences[ 2 ];
- transformed += morphTarget3 * morphTargetInfluences[ 3 ];
- #ifndef USE_MORPHNORMALS
- transformed += morphTarget4 * morphTargetInfluences[ 4 ];
- transformed += morphTarget5 * morphTargetInfluences[ 5 ];
- transformed += morphTarget6 * morphTargetInfluences[ 6 ];
- transformed += morphTarget7 * morphTargetInfluences[ 7 ];
- #endif
- #endif
- #endif`,oF=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
- #ifdef FLAT_SHADED
- vec3 fdx = dFdx( vViewPosition );
- vec3 fdy = dFdy( vViewPosition );
- vec3 normal = normalize( cross( fdx, fdy ) );
- #else
- vec3 normal = normalize( vNormal );
- #ifdef DOUBLE_SIDED
- normal *= faceDirection;
- #endif
- #endif
- #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
- #ifdef USE_TANGENT
- mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn = getTangentFrame( - vViewPosition, normal,
- #if defined( USE_NORMALMAP )
- vNormalMapUv
- #elif defined( USE_CLEARCOAT_NORMALMAP )
- vClearcoatNormalMapUv
- #else
- vUv
- #endif
- );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn[0] *= faceDirection;
- tbn[1] *= faceDirection;
- #endif
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- #ifdef USE_TANGENT
- mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn2[0] *= faceDirection;
- tbn2[1] *= faceDirection;
- #endif
- #endif
- vec3 nonPerturbedNormal = normal;`,aF=`#ifdef USE_NORMALMAP_OBJECTSPACE
- normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- #ifdef FLIP_SIDED
- normal = - normal;
- #endif
- #ifdef DOUBLE_SIDED
- normal = normal * faceDirection;
- #endif
- normal = normalize( normalMatrix * normal );
- #elif defined( USE_NORMALMAP_TANGENTSPACE )
- vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- mapN.xy *= normalScale;
- normal = normalize( tbn * mapN );
- #elif defined( USE_BUMPMAP )
- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
- #endif`,lF=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,cF=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,uF=`#ifndef FLAT_SHADED
- vNormal = normalize( transformedNormal );
- #ifdef USE_TANGENT
- vTangent = normalize( transformedTangent );
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
- #endif
- #endif`,fF=`#ifdef USE_NORMALMAP
- uniform sampler2D normalMap;
- uniform vec2 normalScale;
- #endif
- #ifdef USE_NORMALMAP_OBJECTSPACE
- uniform mat3 normalMatrix;
- #endif
- #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
- mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
- vec3 q0 = dFdx( eye_pos.xyz );
- vec3 q1 = dFdy( eye_pos.xyz );
- vec2 st0 = dFdx( uv.st );
- vec2 st1 = dFdy( uv.st );
- vec3 N = surf_norm;
- vec3 q1perp = cross( q1, N );
- vec3 q0perp = cross( N, q0 );
- vec3 T = q1perp * st0.x + q0perp * st1.x;
- vec3 B = q1perp * st0.y + q0perp * st1.y;
- float det = max( dot( T, T ), dot( B, B ) );
- float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
- return mat3( T * scale, B * scale, N );
- }
- #endif`,hF=`#ifdef USE_CLEARCOAT
- vec3 clearcoatNormal = nonPerturbedNormal;
- #endif`,dF=`#ifdef USE_CLEARCOAT_NORMALMAP
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
- clearcoatMapN.xy *= clearcoatNormalScale;
- clearcoatNormal = normalize( tbn2 * clearcoatMapN );
- #endif`,pF=`#ifdef USE_CLEARCOATMAP
- uniform sampler2D clearcoatMap;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform sampler2D clearcoatNormalMap;
- uniform vec2 clearcoatNormalScale;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform sampler2D clearcoatRoughnessMap;
- #endif`,mF=`#ifdef USE_IRIDESCENCEMAP
- uniform sampler2D iridescenceMap;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform sampler2D iridescenceThicknessMap;
- #endif`,gF=`#ifdef OPAQUE
- diffuseColor.a = 1.0;
- #endif
- #ifdef USE_TRANSMISSION
- diffuseColor.a *= material.transmissionAlpha;
- #endif
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,vF=`vec3 packNormalToRGB( const in vec3 normal ) {
- return normalize( normal ) * 0.5 + 0.5;
- }
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
- return 2.0 * rgb.xyz - 1.0;
- }
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
- const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
- const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
- const float ShiftRight8 = 1. / 256.;
- vec4 packDepthToRGBA( const in float v ) {
- vec4 r = vec4( fract( v * PackFactors ), v );
- r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
- }
- float unpackRGBAToDepth( const in vec4 v ) {
- return dot( v, UnpackFactors );
- }
- vec2 packDepthToRG( in highp float v ) {
- return packDepthToRGBA( v ).yx;
- }
- float unpackRGToDepth( const in highp vec2 v ) {
- return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
- }
- vec4 pack2HalfToRGBA( vec2 v ) {
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
- }
- vec2 unpackRGBATo2Half( vec4 v ) {
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
- }
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
- return ( viewZ + near ) / ( near - far );
- }
- float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return depth * ( near - far ) - near;
- }
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
- return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
- }
- float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return ( near * far ) / ( ( far - near ) * depth - far );
- }`,yF=`#ifdef PREMULTIPLIED_ALPHA
- gl_FragColor.rgb *= gl_FragColor.a;
- #endif`,_F=`vec4 mvPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- mvPosition = batchingMatrix * mvPosition;
- #endif
- #ifdef USE_INSTANCING
- mvPosition = instanceMatrix * mvPosition;
- #endif
- mvPosition = modelViewMatrix * mvPosition;
- gl_Position = projectionMatrix * mvPosition;`,xF=`#ifdef DITHERING
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
- #endif`,AF=`#ifdef DITHERING
- vec3 dithering( vec3 color ) {
- float grid_position = rand( gl_FragCoord.xy );
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
- return color + dither_shift_RGB;
- }
- #endif`,SF=`float roughnessFactor = roughness;
- #ifdef USE_ROUGHNESSMAP
- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
- roughnessFactor *= texelRoughness.g;
- #endif`,MF=`#ifdef USE_ROUGHNESSMAP
- uniform sampler2D roughnessMap;
- #endif`,EF=`#if NUM_SPOT_LIGHT_COORDS > 0
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #if NUM_SPOT_LIGHT_MAPS > 0
- uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
- struct SpotLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
- return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
- }
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
- }
- float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
- float occlusion = 1.0;
- vec2 distribution = texture2DDistribution( shadow, uv );
- float hard_shadow = step( compare , distribution.x );
- if (hard_shadow != 1.0 ) {
- float distance = compare - distribution.x ;
- float variance = max( 0.00000, distribution.y * distribution.y );
- float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
- }
- return occlusion;
- }
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
- float shadow = 1.0;
- shadowCoord.xyz /= shadowCoord.w;
- shadowCoord.z += shadowBias;
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
- if ( frustumTest ) {
- #if defined( SHADOWMAP_TYPE_PCF )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx0 = - texelSize.x * shadowRadius;
- float dy0 = - texelSize.y * shadowRadius;
- float dx1 = + texelSize.x * shadowRadius;
- float dy1 = + texelSize.y * shadowRadius;
- float dx2 = dx0 / 2.0;
- float dy2 = dy0 / 2.0;
- float dx3 = dx1 / 2.0;
- float dy3 = dy1 / 2.0;
- shadow = (
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
- ) * ( 1.0 / 17.0 );
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx = texelSize.x;
- float dy = texelSize.y;
- vec2 uv = shadowCoord.xy;
- vec2 f = fract( uv * shadowMapSize + 0.5 );
- uv -= f * texelSize;
- shadow = (
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
- f.x ),
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
- f.x ),
- f.y )
- ) * ( 1.0 / 9.0 );
- #elif defined( SHADOWMAP_TYPE_VSM )
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
- #else
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
- #endif
- }
- return shadow;
- }
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
- vec3 absV = abs( v );
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
- absV *= scaleToCube;
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
- vec2 planar = v.xy;
- float almostATexel = 1.5 * texelSizeY;
- float almostOne = 1.0 - almostATexel;
- if ( absV.z >= almostOne ) {
- if ( v.z > 0.0 )
- planar.x = 4.0 - v.x;
- } else if ( absV.x >= almostOne ) {
- float signX = sign( v.x );
- planar.x = v.z * signX + 2.0 * signX;
- } else if ( absV.y >= almostOne ) {
- float signY = sign( v.y );
- planar.x = v.x + 2.0 * signY + 2.0;
- planar.y = v.z * signY - 2.0;
- }
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
- }
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
- vec3 lightToPosition = shadowCoord.xyz;
- float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
- vec3 bd3D = normalize( lightToPosition );
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
- return (
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
- ) * ( 1.0 / 9.0 );
- #else
- return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
- #endif
- }
- #endif`,wF=`#if NUM_SPOT_LIGHT_COORDS > 0
- uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- struct SpotLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- #endif`,TF=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- vec4 shadowWorldPosition;
- #endif
- #if defined( USE_SHADOWMAP )
- #if NUM_DIR_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if NUM_SPOT_LIGHT_COORDS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
- shadowWorldPosition = worldPosition;
- #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
- #endif
- vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif`,CF=`float getShadowMask() {
- float shadow = 1.0;
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- directionalLight = directionalLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
- spotLight = spotLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- pointLight = pointLightShadows[ i ];
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- return shadow;
- }`,RF=`#ifdef USE_SKINNING
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
- #endif`,bF=`#ifdef USE_SKINNING
- uniform mat4 bindMatrix;
- uniform mat4 bindMatrixInverse;
- uniform highp sampler2D boneTexture;
- mat4 getBoneMatrix( const in float i ) {
- int size = textureSize( boneTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- #endif`,PF=`#ifdef USE_SKINNING
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
- vec4 skinned = vec4( 0.0 );
- skinned += boneMatX * skinVertex * skinWeight.x;
- skinned += boneMatY * skinVertex * skinWeight.y;
- skinned += boneMatZ * skinVertex * skinWeight.z;
- skinned += boneMatW * skinVertex * skinWeight.w;
- transformed = ( bindMatrixInverse * skinned ).xyz;
- #endif`,BF=`#ifdef USE_SKINNING
- mat4 skinMatrix = mat4( 0.0 );
- skinMatrix += skinWeight.x * boneMatX;
- skinMatrix += skinWeight.y * boneMatY;
- skinMatrix += skinWeight.z * boneMatZ;
- skinMatrix += skinWeight.w * boneMatW;
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
- #ifdef USE_TANGENT
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
- #endif
- #endif`,IF=`float specularStrength;
- #ifdef USE_SPECULARMAP
- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
- specularStrength = texelSpecular.r;
- #else
- specularStrength = 1.0;
- #endif`,LF=`#ifdef USE_SPECULARMAP
- uniform sampler2D specularMap;
- #endif`,DF=`#if defined( TONE_MAPPING )
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
- #endif`,FF=`#ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- uniform float toneMappingExposure;
- vec3 LinearToneMapping( vec3 color ) {
- return saturate( toneMappingExposure * color );
- }
- vec3 ReinhardToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- return saturate( color / ( vec3( 1.0 ) + color ) );
- }
- vec3 OptimizedCineonToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- color = max( vec3( 0.0 ), color - 0.004 );
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
- }
- vec3 RRTAndODTFit( vec3 v ) {
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
- return a / b;
- }
- vec3 ACESFilmicToneMapping( vec3 color ) {
- const mat3 ACESInputMat = mat3(
- vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
- vec3( 0.04823, 0.01566, 0.83777 )
- );
- const mat3 ACESOutputMat = mat3(
- vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
- vec3( -0.07367, -0.00605, 1.07602 )
- );
- color *= toneMappingExposure / 0.6;
- color = ACESInputMat * color;
- color = RRTAndODTFit( color );
- color = ACESOutputMat * color;
- return saturate( color );
- }
- const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
- vec3( 1.6605, - 0.1246, - 0.0182 ),
- vec3( - 0.5876, 1.1329, - 0.1006 ),
- vec3( - 0.0728, - 0.0083, 1.1187 )
- );
- const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
- vec3( 0.6274, 0.0691, 0.0164 ),
- vec3( 0.3293, 0.9195, 0.0880 ),
- vec3( 0.0433, 0.0113, 0.8956 )
- );
- vec3 agxDefaultContrastApprox( vec3 x ) {
- vec3 x2 = x * x;
- vec3 x4 = x2 * x2;
- return + 15.5 * x4 * x2
- - 40.14 * x4 * x
- + 31.96 * x4
- - 6.868 * x2 * x
- + 0.4298 * x2
- + 0.1191 * x
- - 0.00232;
- }
- vec3 AgXToneMapping( vec3 color ) {
- const mat3 AgXInsetMatrix = mat3(
- vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
- vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
- vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
- );
- const mat3 AgXOutsetMatrix = mat3(
- vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
- vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
- vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
- );
- const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
- color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
- color *= toneMappingExposure;
- color = AgXInsetMatrix * color;
- color = max( color, 1e-10 ); color = log2( color );
- color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
- color = clamp( color, 0.0, 1.0 );
- color = agxDefaultContrastApprox( color );
- color = AgXOutsetMatrix * color;
- color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
- color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
- return color;
- }
- vec3 CustomToneMapping( vec3 color ) { return color; }`,NF=`#ifdef USE_TRANSMISSION
- material.transmission = transmission;
- material.transmissionAlpha = 1.0;
- material.thickness = thickness;
- material.attenuationDistance = attenuationDistance;
- material.attenuationColor = attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
- #endif
- #ifdef USE_THICKNESSMAP
- material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
- #endif
- vec3 pos = vWorldPosition;
- vec3 v = normalize( cameraPosition - pos );
- vec3 n = inverseTransformDirection( normal, viewMatrix );
- vec4 transmitted = getIBLVolumeRefraction(
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
- pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
- material.attenuationColor, material.attenuationDistance );
- material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
- totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
- #endif`,UF=`#ifdef USE_TRANSMISSION
- uniform float transmission;
- uniform float thickness;
- uniform float attenuationDistance;
- uniform vec3 attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- uniform sampler2D transmissionMap;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform sampler2D thicknessMap;
- #endif
- uniform vec2 transmissionSamplerSize;
- uniform sampler2D transmissionSamplerMap;
- uniform mat4 modelMatrix;
- uniform mat4 projectionMatrix;
- varying vec3 vWorldPosition;
- float w0( float a ) {
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
- }
- float w1( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
- }
- float w2( float a ){
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
- }
- float w3( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * a );
- }
- float g0( float a ) {
- return w0( a ) + w1( a );
- }
- float g1( float a ) {
- return w2( a ) + w3( a );
- }
- float h0( float a ) {
- return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
- }
- float h1( float a ) {
- return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
- }
- vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
- uv = uv * texelSize.zw + 0.5;
- vec2 iuv = floor( uv );
- vec2 fuv = fract( uv );
- float g0x = g0( fuv.x );
- float g1x = g1( fuv.x );
- float h0x = h0( fuv.x );
- float h1x = h1( fuv.x );
- float h0y = h0( fuv.y );
- float h1y = h1( fuv.y );
- vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
- g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
- }
- vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
- vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
- vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
- vec2 fLodSizeInv = 1.0 / fLodSize;
- vec2 cLodSizeInv = 1.0 / cLodSize;
- vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
- vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
- return mix( fSample, cSample, fract( lod ) );
- }
- vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
- vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
- vec3 modelScale;
- modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
- modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
- modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
- return normalize( refractionVector ) * thickness * modelScale;
- }
- float applyIorToRoughness( const in float roughness, const in float ior ) {
- return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
- }
- vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
- float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
- return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
- }
- vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
- if ( isinf( attenuationDistance ) ) {
- return vec3( 1.0 );
- } else {
- vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
- vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
- }
- }
- vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
- const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
- const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
- const in vec3 attenuationColor, const in float attenuationDistance ) {
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
- vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
- vec3 attenuatedColor = transmittance * transmittedLight.rgb;
- vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
- float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
- return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
- }
- #endif`,OF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,kF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- uniform mat3 mapTransform;
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- uniform mat3 alphaMapTransform;
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- uniform mat3 lightMapTransform;
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- uniform mat3 aoMapTransform;
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- uniform mat3 bumpMapTransform;
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- uniform mat3 normalMapTransform;
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- uniform mat3 displacementMapTransform;
- varying vec2 vDisplacementMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- uniform mat3 emissiveMapTransform;
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- uniform mat3 metalnessMapTransform;
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- uniform mat3 roughnessMapTransform;
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- uniform mat3 anisotropyMapTransform;
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- uniform mat3 clearcoatMapTransform;
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform mat3 clearcoatNormalMapTransform;
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform mat3 clearcoatRoughnessMapTransform;
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- uniform mat3 sheenColorMapTransform;
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform mat3 sheenRoughnessMapTransform;
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- uniform mat3 iridescenceMapTransform;
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform mat3 iridescenceThicknessMapTransform;
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- uniform mat3 specularMapTransform;
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- uniform mat3 specularColorMapTransform;
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform mat3 specularIntensityMapTransform;
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,zF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- vUv = vec3( uv, 1 ).xy;
- #endif
- #ifdef USE_MAP
- vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ALPHAMAP
- vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_LIGHTMAP
- vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_AOMAP
- vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_BUMPMAP
- vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_NORMALMAP
- vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_EMISSIVEMAP
- vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_METALNESSMAP
- vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ROUGHNESSMAP
- vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ANISOTROPYMAP
- vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOATMAP
- vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULARMAP
- vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_THICKNESSMAP
- vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
- #endif`,GF=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
- vec4 worldPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- worldPosition = batchingMatrix * worldPosition;
- #endif
- #ifdef USE_INSTANCING
- worldPosition = instanceMatrix * worldPosition;
- #endif
- worldPosition = modelMatrix * worldPosition;
- #endif`;const HF=`varying vec2 vUv;
- uniform mat3 uvTransform;
- void main() {
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- gl_Position = vec4( position.xy, 1.0, 1.0 );
- }`,VF=`uniform sampler2D t2D;
- uniform float backgroundIntensity;
- varying vec2 vUv;
- void main() {
- vec4 texColor = texture2D( t2D, vUv );
- #ifdef DECODE_VIDEO_TEXTURE
- texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,WF=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,XF=`#ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- uniform sampler2D envMap;
- #endif
- uniform float flipEnvMap;
- uniform float backgroundBlurriness;
- uniform float backgroundIntensity;
- varying vec3 vWorldDirection;
- #include <cube_uv_reflection_fragment>
- void main() {
- #ifdef ENVMAP_TYPE_CUBE
- vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
- #else
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,JF=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,jF=`uniform samplerCube tCube;
- uniform float tFlip;
- uniform float opacity;
- varying vec3 vWorldDirection;
- void main() {
- vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
- gl_FragColor = texColor;
- gl_FragColor.a *= opacity;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,KF=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vHighPrecisionZW = gl_Position.zw;
- }`,YF=`#if DEPTH_PACKING == 3200
- uniform float opacity;
- #endif
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( 1.0 );
- #if DEPTH_PACKING == 3200
- diffuseColor.a = opacity;
- #endif
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <logdepthbuf_fragment>
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
- #if DEPTH_PACKING == 3200
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
- #elif DEPTH_PACKING == 3201
- gl_FragColor = packDepthToRGBA( fragCoordZ );
- #endif
- }`,QF=`#define DISTANCE
- varying vec3 vWorldPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <worldpos_vertex>
- #include <clipping_planes_vertex>
- vWorldPosition = worldPosition.xyz;
- }`,ZF=`#define DISTANCE
- uniform vec3 referencePosition;
- uniform float nearDistance;
- uniform float farDistance;
- varying vec3 vWorldPosition;
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main () {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( 1.0 );
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- float dist = length( vWorldPosition - referencePosition );
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
- dist = saturate( dist );
- gl_FragColor = packDepthToRGBA( dist );
- }`,qF=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }`,$F=`uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,e3=`uniform float scale;
- attribute float lineDistance;
- varying float vLineDistance;
- #include <common>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- vLineDistance = scale * lineDistance;
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,t3=`uniform vec3 diffuse;
- uniform float opacity;
- uniform float dashSize;
- uniform float totalSize;
- varying float vLineDistance;
- #include <common>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
- discard;
- }
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,n3=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <fog_vertex>
- }`,i3=`uniform vec3 diffuse;
- uniform float opacity;
- #ifndef FLAT_SHADED
- varying vec3 vNormal;
- #endif
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
- #else
- reflectedLight.indirectDiffuse += vec3( 1.0 );
- #endif
- #include <aomap_fragment>
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,r3=`#define LAMBERT
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,s3=`#define LAMBERT
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_lambert_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_lambert_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,o3=`#define MATCAP
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- vViewPosition = - mvPosition.xyz;
- }`,a3=`#define MATCAP
- uniform vec3 diffuse;
- uniform float opacity;
- uniform sampler2D matcap;
- varying vec3 vViewPosition;
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- vec3 viewDir = normalize( vViewPosition );
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
- vec3 y = cross( viewDir, x );
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
- #ifdef USE_MATCAP
- vec4 matcapColor = texture2D( matcap, uv );
- #else
- vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
- #endif
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,l3=`#define NORMAL
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- vViewPosition = - mvPosition.xyz;
- #endif
- }`,c3=`#define NORMAL
- uniform float opacity;
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <packing>
- #include <uv_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
- #ifdef OPAQUE
- gl_FragColor.a = 1.0;
- #endif
- }`,u3=`#define PHONG
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,f3=`#define PHONG
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform vec3 specular;
- uniform float shininess;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_phong_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_phong_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,h3=`#define STANDARD
- varying vec3 vViewPosition;
- #ifdef USE_TRANSMISSION
- varying vec3 vWorldPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- #ifdef USE_TRANSMISSION
- vWorldPosition = worldPosition.xyz;
- #endif
- }`,d3=`#define STANDARD
- #ifdef PHYSICAL
- #define IOR
- #define USE_SPECULAR
- #endif
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float roughness;
- uniform float metalness;
- uniform float opacity;
- #ifdef IOR
- uniform float ior;
- #endif
- #ifdef USE_SPECULAR
- uniform float specularIntensity;
- uniform vec3 specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- uniform sampler2D specularColorMap;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform sampler2D specularIntensityMap;
- #endif
- #endif
- #ifdef USE_CLEARCOAT
- uniform float clearcoat;
- uniform float clearcoatRoughness;
- #endif
- #ifdef USE_IRIDESCENCE
- uniform float iridescence;
- uniform float iridescenceIOR;
- uniform float iridescenceThicknessMinimum;
- uniform float iridescenceThicknessMaximum;
- #endif
- #ifdef USE_SHEEN
- uniform vec3 sheenColor;
- uniform float sheenRoughness;
- #ifdef USE_SHEEN_COLORMAP
- uniform sampler2D sheenColorMap;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform sampler2D sheenRoughnessMap;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- uniform vec2 anisotropyVector;
- #ifdef USE_ANISOTROPYMAP
- uniform sampler2D anisotropyMap;
- #endif
- #endif
- varying vec3 vViewPosition;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <iridescence_fragment>
- #include <cube_uv_reflection_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_physical_pars_fragment>
- #include <fog_pars_fragment>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_physical_pars_fragment>
- #include <transmission_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <clearcoat_pars_fragment>
- #include <iridescence_pars_fragment>
- #include <roughnessmap_pars_fragment>
- #include <metalnessmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <roughnessmap_fragment>
- #include <metalnessmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <clearcoat_normal_fragment_begin>
- #include <clearcoat_normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_physical_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
- vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
- #include <transmission_fragment>
- vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
- #ifdef USE_SHEEN
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
- #endif
- #ifdef USE_CLEARCOAT
- float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
- vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
- outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
- #endif
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,p3=`#define TOON
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,m3=`#define TOON
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <gradientmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_toon_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_toon_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,g3=`uniform float size;
- uniform float scale;
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- #ifdef USE_POINTS_UV
- varying vec2 vUv;
- uniform mat3 uvTransform;
- #endif
- void main() {
- #ifdef USE_POINTS_UV
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- #endif
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- gl_PointSize = size;
- #ifdef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
- #endif
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <fog_vertex>
- }`,v3=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <color_pars_fragment>
- #include <map_particle_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_particle_fragment>
- #include <color_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,y3=`#include <common>
- #include <batching_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <shadowmap_pars_vertex>
- void main() {
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,_3=`uniform vec3 color;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <logdepthbuf_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <shadowmask_pars_fragment>
- void main() {
- #include <logdepthbuf_fragment>
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,x3=`uniform float rotation;
- uniform vec2 center;
- #include <common>
- #include <uv_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
- vec2 scale;
- scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
- scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
- #ifndef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) scale *= - mvPosition.z;
- #endif
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
- vec2 rotatedPosition;
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
- mvPosition.xy += rotatedPosition;
- gl_Position = projectionMatrix * mvPosition;
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,A3=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,_t={alphahash_fragment:V2,alphahash_pars_fragment:W2,alphamap_fragment:X2,alphamap_pars_fragment:J2,alphatest_fragment:j2,alphatest_pars_fragment:K2,aomap_fragment:Y2,aomap_pars_fragment:Q2,batching_pars_vertex:Z2,batching_vertex:q2,begin_vertex:$2,beginnormal_vertex:eD,bsdfs:tD,iridescence_fragment:nD,bumpmap_pars_fragment:iD,clipping_planes_fragment:rD,clipping_planes_pars_fragment:sD,clipping_planes_pars_vertex:oD,clipping_planes_vertex:aD,color_fragment:lD,color_pars_fragment:cD,color_pars_vertex:uD,color_vertex:fD,common:hD,cube_uv_reflection_fragment:dD,defaultnormal_vertex:pD,displacementmap_pars_vertex:mD,displacementmap_vertex:gD,emissivemap_fragment:vD,emissivemap_pars_fragment:yD,colorspace_fragment:_D,colorspace_pars_fragment:xD,envmap_fragment:AD,envmap_common_pars_fragment:SD,envmap_pars_fragment:MD,envmap_pars_vertex:ED,envmap_physical_pars_fragment:ND,envmap_vertex:wD,fog_vertex:TD,fog_pars_vertex:CD,fog_fragment:RD,fog_pars_fragment:bD,gradientmap_pars_fragment:PD,lightmap_fragment:BD,lightmap_pars_fragment:ID,lights_lambert_fragment:LD,lights_lambert_pars_fragment:DD,lights_pars_begin:FD,lights_toon_fragment:UD,lights_toon_pars_fragment:OD,lights_phong_fragment:kD,lights_phong_pars_fragment:zD,lights_physical_fragment:GD,lights_physical_pars_fragment:HD,lights_fragment_begin:VD,lights_fragment_maps:WD,lights_fragment_end:XD,logdepthbuf_fragment:JD,logdepthbuf_pars_fragment:jD,logdepthbuf_pars_vertex:KD,logdepthbuf_vertex:YD,map_fragment:QD,map_pars_fragment:ZD,map_particle_fragment:qD,map_particle_pars_fragment:$D,metalnessmap_fragment:eF,metalnessmap_pars_fragment:tF,morphcolor_vertex:nF,morphnormal_vertex:iF,morphtarget_pars_vertex:rF,morphtarget_vertex:sF,normal_fragment_begin:oF,normal_fragment_maps:aF,normal_pars_fragment:lF,normal_pars_vertex:cF,normal_vertex:uF,normalmap_pars_fragment:fF,clearcoat_normal_fragment_begin:hF,clearcoat_normal_fragment_maps:dF,clearcoat_pars_fragment:pF,iridescence_pars_fragment:mF,opaque_fragment:gF,packing:vF,premultiplied_alpha_fragment:yF,project_vertex:_F,dithering_fragment:xF,dithering_pars_fragment:AF,roughnessmap_fragment:SF,roughnessmap_pars_fragment:MF,shadowmap_pars_fragment:EF,shadowmap_pars_vertex:wF,shadowmap_vertex:TF,shadowmask_pars_fragment:CF,skinbase_vertex:RF,skinning_pars_vertex:bF,skinning_vertex:PF,skinnormal_vertex:BF,specularmap_fragment:IF,specularmap_pars_fragment:LF,tonemapping_fragment:DF,tonemapping_pars_fragment:FF,transmission_fragment:NF,transmission_pars_fragment:UF,uv_pars_fragment:OF,uv_pars_vertex:kF,uv_vertex:zF,worldpos_vertex:GF,background_vert:HF,background_frag:VF,backgroundCube_vert:WF,backgroundCube_frag:XF,cube_vert:JF,cube_frag:jF,depth_vert:KF,depth_frag:YF,distanceRGBA_vert:QF,distanceRGBA_frag:ZF,equirect_vert:qF,equirect_frag:$F,linedashed_vert:e3,linedashed_frag:t3,meshbasic_vert:n3,meshbasic_frag:i3,meshlambert_vert:r3,meshlambert_frag:s3,meshmatcap_vert:o3,meshmatcap_frag:a3,meshnormal_vert:l3,meshnormal_frag:c3,meshphong_vert:u3,meshphong_frag:f3,meshphysical_vert:h3,meshphysical_frag:d3,meshtoon_vert:p3,meshtoon_frag:m3,points_vert:g3,points_frag:v3,shadow_vert:y3,shadow_frag:_3,sprite_vert:x3,sprite_frag:A3},Ie={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new de(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new de(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},Fr={basic:{uniforms:mi([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.fog]),vertexShader:_t.meshbasic_vert,fragmentShader:_t.meshbasic_frag},lambert:{uniforms:mi([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)}}]),vertexShader:_t.meshlambert_vert,fragmentShader:_t.meshlambert_frag},phong:{uniforms:mi([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:_t.meshphong_vert,fragmentShader:_t.meshphong_frag},standard:{uniforms:mi([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:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag},toon:{uniforms:mi([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:_t.meshtoon_vert,fragmentShader:_t.meshtoon_frag},matcap:{uniforms:mi([Ie.common,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,{matcap:{value:null}}]),vertexShader:_t.meshmatcap_vert,fragmentShader:_t.meshmatcap_frag},points:{uniforms:mi([Ie.points,Ie.fog]),vertexShader:_t.points_vert,fragmentShader:_t.points_frag},dashed:{uniforms:mi([Ie.common,Ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_t.linedashed_vert,fragmentShader:_t.linedashed_frag},depth:{uniforms:mi([Ie.common,Ie.displacementmap]),vertexShader:_t.depth_vert,fragmentShader:_t.depth_frag},normal:{uniforms:mi([Ie.common,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,{opacity:{value:1}}]),vertexShader:_t.meshnormal_vert,fragmentShader:_t.meshnormal_frag},sprite:{uniforms:mi([Ie.sprite,Ie.fog]),vertexShader:_t.sprite_vert,fragmentShader:_t.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_t.background_vert,fragmentShader:_t.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:_t.backgroundCube_vert,fragmentShader:_t.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_t.cube_vert,fragmentShader:_t.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_t.equirect_vert,fragmentShader:_t.equirect_frag},distanceRGBA:{uniforms:mi([Ie.common,Ie.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_t.distanceRGBA_vert,fragmentShader:_t.distanceRGBA_frag},shadow:{uniforms:mi([Ie.lights,Ie.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:_t.shadow_vert,fragmentShader:_t.shadow_frag}};Fr.physical={uniforms:mi([Fr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new de(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new de},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new de},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag};const Cd={r:0,b:0,g:0};function S3(n,e,t,i,r,s,o){const a=new Pe(0);let l=s===!0?0:1,f,h,d=null,p=0,m=null;function y(A,g){let _=!1,M=g.isScene===!0?g.background:null;M&&M.isTexture&&(M=(g.backgroundBlurriness>0?t:e).get(M)),M===null?S(a,l):M&&M.isColor&&(S(M,1),_=!0);const w=n.xr.getEnvironmentBlendMode();w==="additive"?i.buffers.color.setClear(0,0,0,1,o):w==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),M&&(M.isCubeTexture||M.mapping===Dc)?(h===void 0&&(h=new Mn(new Ka(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:Cc(Fr.backgroundCube.uniforms),vertexShader:Fr.backgroundCube.vertexShader,fragmentShader:Fr.backgroundCube.fragmentShader,side:_i,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(B,T,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),h.material.uniforms.envMap.value=M,h.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,h.material.toneMapped=Gt.getTransfer(M.colorSpace)!==Xt,(d!==M||p!==M.version||m!==n.toneMapping)&&(h.material.needsUpdate=!0,d=M,p=M.version,m=n.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null)):M&&M.isTexture&&(f===void 0&&(f=new Mn(new kf(2,2),new ds({name:"BackgroundMaterial",uniforms:Cc(Fr.background.uniforms),vertexShader:Fr.background.vertexShader,fragmentShader:Fr.background.fragmentShader,side:cs,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(f)),f.material.uniforms.t2D.value=M,f.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,f.material.toneMapped=Gt.getTransfer(M.colorSpace)!==Xt,M.matrixAutoUpdate===!0&&M.updateMatrix(),f.material.uniforms.uvTransform.value.copy(M.matrix),(d!==M||p!==M.version||m!==n.toneMapping)&&(f.material.needsUpdate=!0,d=M,p=M.version,m=n.toneMapping),f.layers.enableAll(),A.unshift(f,f.geometry,f.material,0,0,null))}function S(A,g){A.getRGB(Cd,_R(n)),i.buffers.color.setClear(Cd.r,Cd.g,Cd.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(A,g=1){a.set(A),l=g,S(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,S(a,l)},render:y}}function M3(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=A(null);let f=l,h=!1;function d(G,J,Z,ae,O){let V=!1;if(o){const H=S(ae,Z,J);f!==H&&(f=H,m(f.object)),V=g(G,ae,Z,O),V&&_(G,ae,Z,O)}else{const H=J.wireframe===!0;(f.geometry!==ae.id||f.program!==Z.id||f.wireframe!==H)&&(f.geometry=ae.id,f.program=Z.id,f.wireframe=H,V=!0)}O!==null&&t.update(O,n.ELEMENT_ARRAY_BUFFER),(V||h)&&(h=!1,L(G,J,Z,ae),O!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(O).buffer))}function p(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(G){return i.isWebGL2?n.bindVertexArray(G):s.bindVertexArrayOES(G)}function y(G){return i.isWebGL2?n.deleteVertexArray(G):s.deleteVertexArrayOES(G)}function S(G,J,Z){const ae=Z.wireframe===!0;let O=a[G.id];O===void 0&&(O={},a[G.id]=O);let V=O[J.id];V===void 0&&(V={},O[J.id]=V);let H=V[ae];return H===void 0&&(H=A(p()),V[ae]=H),H}function A(G){const J=[],Z=[],ae=[];for(let O=0;O<r;O++)J[O]=0,Z[O]=0,ae[O]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:J,enabledAttributes:Z,attributeDivisors:ae,object:G,attributes:{},index:null}}function g(G,J,Z,ae){const O=f.attributes,V=J.attributes;let H=0;const q=Z.getAttributes();for(const ne in q)if(q[ne].location>=0){const ue=O[ne];let Se=V[ne];if(Se===void 0&&(ne==="instanceMatrix"&&G.instanceMatrix&&(Se=G.instanceMatrix),ne==="instanceColor"&&G.instanceColor&&(Se=G.instanceColor)),ue===void 0||ue.attribute!==Se||Se&&ue.data!==Se.data)return!0;H++}return f.attributesNum!==H||f.index!==ae}function _(G,J,Z,ae){const O={},V=J.attributes;let H=0;const q=Z.getAttributes();for(const ne in q)if(q[ne].location>=0){let ue=V[ne];ue===void 0&&(ne==="instanceMatrix"&&G.instanceMatrix&&(ue=G.instanceMatrix),ne==="instanceColor"&&G.instanceColor&&(ue=G.instanceColor));const Se={};Se.attribute=ue,ue&&ue.data&&(Se.data=ue.data),O[ne]=Se,H++}f.attributes=O,f.attributesNum=H,f.index=ae}function M(){const G=f.newAttributes;for(let J=0,Z=G.length;J<Z;J++)G[J]=0}function w(G){B(G,0)}function B(G,J){const Z=f.newAttributes,ae=f.enabledAttributes,O=f.attributeDivisors;Z[G]=1,ae[G]===0&&(n.enableVertexAttribArray(G),ae[G]=1),O[G]!==J&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](G,J),O[G]=J)}function T(){const G=f.newAttributes,J=f.enabledAttributes;for(let Z=0,ae=J.length;Z<ae;Z++)J[Z]!==G[Z]&&(n.disableVertexAttribArray(Z),J[Z]=0)}function b(G,J,Z,ae,O,V,H){H===!0?n.vertexAttribIPointer(G,J,Z,O,V):n.vertexAttribPointer(G,J,Z,ae,O,V)}function L(G,J,Z,ae){if(i.isWebGL2===!1&&(G.isInstancedMesh||ae.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;M();const O=ae.attributes,V=Z.getAttributes(),H=J.defaultAttributeValues;for(const q in V){const ne=V[q];if(ne.location>=0){let Y=O[q];if(Y===void 0&&(q==="instanceMatrix"&&G.instanceMatrix&&(Y=G.instanceMatrix),q==="instanceColor"&&G.instanceColor&&(Y=G.instanceColor)),Y!==void 0){const ue=Y.normalized,Se=Y.itemSize,Te=t.get(Y);if(Te===void 0)continue;const Ce=Te.buffer,Ze=Te.type,ot=Te.bytesPerElement,Le=i.isWebGL2===!0&&(Ze===n.INT||Ze===n.UNSIGNED_INT||Y.gpuType===mx);if(Y.isInterleavedBufferAttribute){const be=Y.data,z=be.stride,ve=Y.offset;if(be.isInstancedInterleavedBuffer){for(let he=0;he<ne.locationSize;he++)B(ne.location+he,be.meshPerAttribute);G.isInstancedMesh!==!0&&ae._maxInstanceCount===void 0&&(ae._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let he=0;he<ne.locationSize;he++)w(ne.location+he);n.bindBuffer(n.ARRAY_BUFFER,Ce);for(let he=0;he<ne.locationSize;he++)b(ne.location+he,Se/ne.locationSize,Ze,ue,z*ot,(ve+Se/ne.locationSize*he)*ot,Le)}else{if(Y.isInstancedBufferAttribute){for(let be=0;be<ne.locationSize;be++)B(ne.location+be,Y.meshPerAttribute);G.isInstancedMesh!==!0&&ae._maxInstanceCount===void 0&&(ae._maxInstanceCount=Y.meshPerAttribute*Y.count)}else for(let be=0;be<ne.locationSize;be++)w(ne.location+be);n.bindBuffer(n.ARRAY_BUFFER,Ce);for(let be=0;be<ne.locationSize;be++)b(ne.location+be,Se/ne.locationSize,Ze,ue,Se*ot,Se/ne.locationSize*be*ot,Le)}}else if(H!==void 0){const ue=H[q];if(ue!==void 0)switch(ue.length){case 2:n.vertexAttrib2fv(ne.location,ue);break;case 3:n.vertexAttrib3fv(ne.location,ue);break;case 4:n.vertexAttrib4fv(ne.location,ue);break;default:n.vertexAttrib1fv(ne.location,ue)}}}}T()}function R(){K();for(const G in a){const J=a[G];for(const Z in J){const ae=J[Z];for(const O in ae)y(ae[O].object),delete ae[O];delete J[Z]}delete a[G]}}function P(G){if(a[G.id]===void 0)return;const J=a[G.id];for(const Z in J){const ae=J[Z];for(const O in ae)y(ae[O].object),delete ae[O];delete J[Z]}delete a[G.id]}function U(G){for(const J in a){const Z=a[J];if(Z[G.id]===void 0)continue;const ae=Z[G.id];for(const O in ae)y(ae[O].object),delete ae[O];delete Z[G.id]}}function K(){ie(),h=!0,f!==l&&(f=l,m(f.object))}function ie(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:d,reset:K,resetDefaultState:ie,dispose:R,releaseStatesOfGeometry:P,releaseStatesOfProgram:U,initAttributes:M,enableAttribute:w,disableUnusedAttributes:T}}function E3(n,e,t,i){const r=i.isWebGL2;let s;function o(h){s=h}function a(h,d){n.drawArrays(s,h,d),t.update(d,s,1)}function l(h,d,p){if(p===0)return;let m,y;if(r)m=n,y="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),y="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[y](s,h,d,p),t.update(d,s,p)}function f(h,d,p){if(p===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let y=0;y<p;y++)this.render(h[y],d[y]);else{m.multiDrawArraysWEBGL(s,h,0,d,0,p);let y=0;for(let S=0;S<p;S++)y+=d[S];t.update(y,s,1)}}this.setMode=o,this.render=a,this.renderInstances=l,this.renderMultiDraw=f}function w3(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const b=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(b){if(b==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const f=o||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),y=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),S=n.getParameter(n.MAX_VERTEX_ATTRIBS),A=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),M=p>0,w=o||e.has("OES_texture_float"),B=M&&w,T=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:f,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:y,maxAttributes:S,maxVertexUniforms:A,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:M,floatFragmentTextures:w,floatVertexTextures:B,maxSamples:T}}function T3(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Bs,a=new xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,p){const m=d.length!==0||p||i!==0||r;return r=p,i=d.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,p){t=h(d,p,0)},this.setState=function(d,p,m){const y=d.clippingPlanes,S=d.clipIntersection,A=d.clipShadows,g=n.get(d);if(!r||y===null||y.length===0||s&&!A)s?h(null):f();else{const _=s?0:i,M=_*4;let w=g.clippingState||null;l.value=w,w=h(y,p,M,m);for(let B=0;B!==M;++B)w[B]=t[B];g.clippingState=w,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=_}};function f(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,p,m,y){const S=d!==null?d.length:0;let A=null;if(S!==0){if(A=l.value,y!==!0||A===null){const g=m+S*4,_=p.matrixWorldInverse;a.getNormalMatrix(_),(A===null||A.length<g)&&(A=new Float32Array(g));for(let M=0,w=m;M!==S;++M,w+=4)o.copy(d[M]).applyMatrix4(_,a),o.normal.toArray(A,w),A[w+3]=o.constant}l.value=A,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,A}}function C3(n){let e=new WeakMap;function t(o,a){return a===Ac?o.mapping=Xs:a===pf&&(o.mapping=No),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===Ac||a===pf)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const f=new SR(l.height/2);return f.fromEquirectangularTexture(n,o),e.set(o,f),o.addEventListener("dispose",r),t(f.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class _r extends Nf{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const f=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=f*this.view.offsetX,o=s+f*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const tc=4,pE=[.125,.215,.35,.446,.526,.582],ya=20,jv=new _r,mE=new Pe;let Kv=null,Yv=0,Qv=0;const va=(1+Math.sqrt(5))/2,bl=1/va,gE=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,va,bl),new D(0,va,-bl),new D(bl,0,va),new D(-bl,0,va),new D(va,bl,0),new D(-va,bl,0)];class i_{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){Kv=this._renderer.getRenderTarget(),Yv=this._renderer.getActiveCubeFace(),Qv=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_E(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=yE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Kv,Yv,Qv),e.scissorTest=!1,Rd(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Xs||e.mapping===No?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Kv=this._renderer.getRenderTarget(),Yv=this._renderer.getActiveCubeFace(),Qv=this._renderer.getActiveMipmapLevel();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:ln,minFilter:ln,generateMipmaps:!1,type:Mc,format:vi,colorSpace:hs,depthBuffer:!1},r=vE(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=vE(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=R3(s)),this._blurMaterial=b3(s,e,t)}return r}_compileMaterial(e){const t=new Mn(this._lodPlanes[0],e);this._renderer.compile(t,jv)}_sceneToCubeUV(e,t,i,r){const a=new Qt(90,1,t,i),l=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,p=h.toneMapping;h.getClearColor(mE),h.toneMapping=os,h.autoClear=!1;const m=new Ji({name:"PMREM.Background",side:_i,depthWrite:!1,depthTest:!1}),y=new Mn(new Ka,m);let S=!1;const A=e.background;A?A.isColor&&(m.color.copy(A),e.background=null,S=!0):(m.color.copy(mE),S=!0);for(let g=0;g<6;g++){const _=g%3;_===0?(a.up.set(0,l[g],0),a.lookAt(f[g],0,0)):_===1?(a.up.set(0,0,l[g]),a.lookAt(0,f[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,f[g]));const M=this._cubeSize;Rd(r,_*M,g>2?M:0,M,M),h.setRenderTarget(r),S&&h.render(y,a),h.render(e,a)}y.geometry.dispose(),y.material.dispose(),h.toneMapping=p,h.autoClear=d,e.background=A}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Xs||e.mapping===No;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_E()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=yE());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Mn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Rd(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,jv)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=gE[(r-1)%gE.length];this._blur(e,r-1,r,s,o)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,f=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new Mn(this._lodPlanes[r],f),p=f.uniforms,m=this._sizeLods[i]-1,y=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*ya-1),S=s/y,A=isFinite(s)?1+Math.floor(h*S):ya;A>ya&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${A} samples when the maximum is set to ${ya}`);const g=[];let _=0;for(let b=0;b<ya;++b){const L=b/S,R=Math.exp(-L*L/2);g.push(R),b===0?_+=R:b<A&&(_+=2*R)}for(let b=0;b<g.length;b++)g[b]=g[b]/_;p.envMap.value=e.texture,p.samples.value=A,p.weights.value=g,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);const{_lodMax:M}=this;p.dTheta.value=y,p.mipInt.value=M-i;const w=this._sizeLods[r],B=3*w*(r>M-tc?r-M+tc:0),T=4*(this._cubeSize-w);Rd(t,B,T,3*w,2*w),l.setRenderTarget(t),l.render(d,jv)}}function R3(n){const e=[],t=[],i=[];let r=n;const s=n-tc+1+pE.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-tc?l=pE[o-n+tc-1]:o===0&&(l=0),i.push(l);const f=1/(a-2),h=-f,d=1+f,p=[h,h,d,h,d,d,h,h,d,d,h,d],m=6,y=6,S=3,A=2,g=1,_=new Float32Array(S*y*m),M=new Float32Array(A*y*m),w=new Float32Array(g*y*m);for(let T=0;T<m;T++){const b=T%3*2/3-1,L=T>2?0:-1,R=[b,L,0,b+2/3,L,0,b+2/3,L+1,0,b,L,0,b+2/3,L+1,0,b,L+1,0];_.set(R,S*y*T),M.set(p,A*y*T);const P=[T,T,T,T,T,T];w.set(P,g*y*T)}const B=new ht;B.setAttribute("position",new Dt(_,S)),B.setAttribute("uv",new Dt(M,A)),B.setAttribute("faceIndex",new Dt(w,g)),e.push(B),r>tc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function vE(n,e,t){const i=new Hr(n,e,t);return i.texture.mapping=Dc,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Rd(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function b3(n,e,t){const i=new Float32Array(ya),r=new D(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:ya,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Px(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform int samples;
- uniform float weights[ n ];
- uniform bool latitudinal;
- uniform float dTheta;
- uniform float mipInt;
- uniform vec3 poleAxis;
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- vec3 getSample( float theta, vec3 axis ) {
- float cosTheta = cos( theta );
- // Rodrigues' axis-angle rotation
- vec3 sampleDirection = vOutputDirection * cosTheta
- + cross( axis, vOutputDirection ) * sin( theta )
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
- }
- void main() {
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
- }
- axis = normalize( axis );
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
- for ( int i = 1; i < n; i++ ) {
- if ( i >= samples ) {
- break;
- }
- float theta = dTheta * float( i );
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
- }
- }
- `,blending:Os,depthTest:!1,depthWrite:!1})}function yE(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Px(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- #include <common>
- void main() {
- vec3 outputDirection = normalize( vOutputDirection );
- vec2 uv = equirectUv( outputDirection );
- gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
- }
- `,blending:Os,depthTest:!1,depthWrite:!1})}function _E(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Px(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- uniform float flipEnvMap;
- varying vec3 vOutputDirection;
- uniform samplerCube envMap;
- void main() {
- gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
- }
- `,blending:Os,depthTest:!1,depthWrite:!1})}function Px(){return`
- precision mediump float;
- precision mediump int;
- attribute float faceIndex;
- varying vec3 vOutputDirection;
- // RH coordinate system; PMREM face-indexing convention
- vec3 getDirection( vec2 uv, float face ) {
- uv = 2.0 * uv - 1.0;
- vec3 direction = vec3( uv, 1.0 );
- if ( face == 0.0 ) {
- direction = direction.zyx; // ( 1, v, u ) pos x
- } else if ( face == 1.0 ) {
- direction = direction.xzy;
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
- } else if ( face == 2.0 ) {
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
- } else if ( face == 3.0 ) {
- direction = direction.zyx;
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
- } else if ( face == 4.0 ) {
- direction = direction.xzy;
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
- } else if ( face == 5.0 ) {
- direction.z *= -1.0; // ( u, v, -1 ) neg z
- }
- return direction;
- }
- void main() {
- vOutputDirection = getDirection( uv, faceIndex );
- gl_Position = vec4( position, 1.0 );
- }
- `}function P3(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,f=l===Ac||l===pf,h=l===Xs||l===No;if(f||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new i_(n)),d=f?t.fromEquirectangular(a,d):t.fromCubemap(a,d),e.set(a,d),d.texture}else{if(e.has(a))return e.get(a).texture;{const d=a.image;if(f&&d&&d.height>0||h&&d&&r(d)){t===null&&(t=new i_(n));const p=f?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",s),p.texture}else return null}}}return a}function r(a){let l=0;const f=6;for(let h=0;h<f;h++)a[h]!==void 0&&l++;return l===f}function s(a){const l=a.target;l.removeEventListener("dispose",s);const f=e.get(l);f!==void 0&&(e.delete(l),f.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function B3(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function I3(n,e,t,i){const r={},s=new WeakMap;function o(d){const p=d.target;p.index!==null&&e.remove(p.index);for(const y in p.attributes)e.remove(p.attributes[y]);for(const y in p.morphAttributes){const S=p.morphAttributes[y];for(let A=0,g=S.length;A<g;A++)e.remove(S[A])}p.removeEventListener("dispose",o),delete r[p.id];const m=s.get(p);m&&(e.remove(m),s.delete(p)),i.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(d,p){return r[p.id]===!0||(p.addEventListener("dispose",o),r[p.id]=!0,t.memory.geometries++),p}function l(d){const p=d.attributes;for(const y in p)e.update(p[y],n.ARRAY_BUFFER);const m=d.morphAttributes;for(const y in m){const S=m[y];for(let A=0,g=S.length;A<g;A++)e.update(S[A],n.ARRAY_BUFFER)}}function f(d){const p=[],m=d.index,y=d.attributes.position;let S=0;if(m!==null){const _=m.array;S=m.version;for(let M=0,w=_.length;M<w;M+=3){const B=_[M+0],T=_[M+1],b=_[M+2];p.push(B,T,T,b,b,B)}}else if(y!==void 0){const _=y.array;S=y.version;for(let M=0,w=_.length/3-1;M<w;M+=3){const B=M+0,T=M+1,b=M+2;p.push(B,T,T,b,b,B)}}else return;const A=new(mR(p)?bx:Tm)(p,1);A.version=S;const g=s.get(d);g&&e.remove(g),s.set(d,A)}function h(d){const p=s.get(d);if(p){const m=d.index;m!==null&&p.version<m.version&&f(d)}else f(d);return s.get(d)}return{get:a,update:l,getWireframeAttribute:h}}function L3(n,e,t,i){const r=i.isWebGL2;let s;function o(m){s=m}let a,l;function f(m){a=m.type,l=m.bytesPerElement}function h(m,y){n.drawElements(s,y,a,m*l),t.update(y,s,1)}function d(m,y,S){if(S===0)return;let A,g;if(r)A=n,g="drawElementsInstanced";else if(A=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",A===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}A[g](s,y,a,m*l,S),t.update(y,s,S)}function p(m,y,S){if(S===0)return;const A=e.get("WEBGL_multi_draw");if(A===null)for(let g=0;g<S;g++)this.render(m[g]/l,y[g]);else{A.multiDrawElementsWEBGL(s,y,0,a,m,0,S);let g=0;for(let _=0;_<S;_++)g+=y[_];t.update(g,s,1)}}this.setMode=o,this.setIndex=f,this.render=h,this.renderInstances=d,this.renderMultiDraw=p}function D3(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function F3(n,e){return n[0]-e[0]}function N3(n,e){return Math.abs(e[1])-Math.abs(n[1])}function U3(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,o=new Nt,a=[];for(let f=0;f<8;f++)a[f]=[f,0];function l(f,h,d){const p=f.morphTargetInfluences;if(e.isWebGL2===!0){const y=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,S=y!==void 0?y.length:0;let A=s.get(h);if(A===void 0||A.count!==S){let J=function(){ie.dispose(),s.delete(h),h.removeEventListener("dispose",J)};var m=J;A!==void 0&&A.texture.dispose();const M=h.morphAttributes.position!==void 0,w=h.morphAttributes.normal!==void 0,B=h.morphAttributes.color!==void 0,T=h.morphAttributes.position||[],b=h.morphAttributes.normal||[],L=h.morphAttributes.color||[];let R=0;M===!0&&(R=1),w===!0&&(R=2),B===!0&&(R=3);let P=h.attributes.position.count*R,U=1;P>e.maxTextureSize&&(U=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const K=new Float32Array(P*U*4*S),ie=new wm(K,P,U,S);ie.type=Nr,ie.needsUpdate=!0;const G=R*4;for(let Z=0;Z<S;Z++){const ae=T[Z],O=b[Z],V=L[Z],H=P*U*4*Z;for(let q=0;q<ae.count;q++){const ne=q*G;M===!0&&(o.fromBufferAttribute(ae,q),K[H+ne+0]=o.x,K[H+ne+1]=o.y,K[H+ne+2]=o.z,K[H+ne+3]=0),w===!0&&(o.fromBufferAttribute(O,q),K[H+ne+4]=o.x,K[H+ne+5]=o.y,K[H+ne+6]=o.z,K[H+ne+7]=0),B===!0&&(o.fromBufferAttribute(V,q),K[H+ne+8]=o.x,K[H+ne+9]=o.y,K[H+ne+10]=o.z,K[H+ne+11]=V.itemSize===4?o.w:1)}}A={count:S,texture:ie,size:new de(P,U)},s.set(h,A),h.addEventListener("dispose",J)}let g=0;for(let M=0;M<p.length;M++)g+=p[M];const _=h.morphTargetsRelative?1:1-g;d.getUniforms().setValue(n,"morphTargetBaseInfluence",_),d.getUniforms().setValue(n,"morphTargetInfluences",p),d.getUniforms().setValue(n,"morphTargetsTexture",A.texture,t),d.getUniforms().setValue(n,"morphTargetsTextureSize",A.size)}else{const y=p===void 0?0:p.length;let S=i[h.id];if(S===void 0||S.length!==y){S=[];for(let w=0;w<y;w++)S[w]=[w,0];i[h.id]=S}for(let w=0;w<y;w++){const B=S[w];B[0]=w,B[1]=p[w]}S.sort(N3);for(let w=0;w<8;w++)w<y&&S[w][1]?(a[w][0]=S[w][0],a[w][1]=S[w][1]):(a[w][0]=Number.MAX_SAFE_INTEGER,a[w][1]=0);a.sort(F3);const A=h.morphAttributes.position,g=h.morphAttributes.normal;let _=0;for(let w=0;w<8;w++){const B=a[w],T=B[0],b=B[1];T!==Number.MAX_SAFE_INTEGER&&b?(A&&h.getAttribute("morphTarget"+w)!==A[T]&&h.setAttribute("morphTarget"+w,A[T]),g&&h.getAttribute("morphNormal"+w)!==g[T]&&h.setAttribute("morphNormal"+w,g[T]),r[w]=b,_+=b):(A&&h.hasAttribute("morphTarget"+w)===!0&&h.deleteAttribute("morphTarget"+w),g&&h.hasAttribute("morphNormal"+w)===!0&&h.deleteAttribute("morphNormal"+w),r[w]=0)}const M=h.morphTargetsRelative?1:1-_;d.getUniforms().setValue(n,"morphTargetBaseInfluence",M),d.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:l}}function O3(n,e,t,i){let r=new WeakMap;function s(l){const f=i.render.frame,h=l.geometry,d=e.get(l,h);if(r.get(d)!==f&&(e.update(d),r.set(d,f)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==f&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,f))),l.isSkinnedMesh){const p=l.skeleton;r.get(p)!==f&&(p.update(),r.set(p,f))}return d}function o(){r=new WeakMap}function a(l){const f=l.target;f.removeEventListener("dispose",a),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:s,dispose:o}}class Bx extends en{constructor(e,t,i,r,s,o,a,l,f,h){if(h=h!==void 0?h:Io,h!==Io&&h!==za)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Io&&(i=Fs),i===void 0&&h===za&&(i=Bo),super(null,r,s,o,a,l,h,i,f),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:gn,this.minFilter=l!==void 0?l:gn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const ER=new en,wR=new Bx(1,1);wR.compareFunction=wx;const TR=new wm,CR=new Rx,RR=new Uf,xE=[],AE=[],SE=new Float32Array(16),ME=new Float32Array(9),EE=new Float32Array(4);function Fc(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=xE[r];if(s===void 0&&(s=new Float32Array(r),xE[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Dn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Fn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Cm(n,e){let t=AE[e];t===void 0&&(t=new Int32Array(e),AE[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function k3(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function z3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Dn(t,e))return;n.uniform2fv(this.addr,e),Fn(t,e)}}function G3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Dn(t,e))return;n.uniform3fv(this.addr,e),Fn(t,e)}}function H3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Dn(t,e))return;n.uniform4fv(this.addr,e),Fn(t,e)}}function V3(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Dn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Fn(t,e)}else{if(Dn(t,i))return;EE.set(i),n.uniformMatrix2fv(this.addr,!1,EE),Fn(t,i)}}function W3(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Dn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Fn(t,e)}else{if(Dn(t,i))return;ME.set(i),n.uniformMatrix3fv(this.addr,!1,ME),Fn(t,i)}}function X3(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Dn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Fn(t,e)}else{if(Dn(t,i))return;SE.set(i),n.uniformMatrix4fv(this.addr,!1,SE),Fn(t,i)}}function J3(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function j3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Dn(t,e))return;n.uniform2iv(this.addr,e),Fn(t,e)}}function K3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Dn(t,e))return;n.uniform3iv(this.addr,e),Fn(t,e)}}function Y3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Dn(t,e))return;n.uniform4iv(this.addr,e),Fn(t,e)}}function Q3(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Z3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Dn(t,e))return;n.uniform2uiv(this.addr,e),Fn(t,e)}}function q3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Dn(t,e))return;n.uniform3uiv(this.addr,e),Fn(t,e)}}function $3(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Dn(t,e))return;n.uniform4uiv(this.addr,e),Fn(t,e)}}function eN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);const s=this.type===n.SAMPLER_2D_SHADOW?wR:ER;t.setTexture2D(e||s,r)}function tN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||CR,r)}function nN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||RR,r)}function iN(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||TR,r)}function rN(n){switch(n){case 5126:return k3;case 35664:return z3;case 35665:return G3;case 35666:return H3;case 35674:return V3;case 35675:return W3;case 35676:return X3;case 5124:case 35670:return J3;case 35667:case 35671:return j3;case 35668:case 35672:return K3;case 35669:case 35673:return Y3;case 5125:return Q3;case 36294:return Z3;case 36295:return q3;case 36296:return $3;case 35678:case 36198:case 36298:case 36306:case 35682:return eN;case 35679:case 36299:case 36307:return tN;case 35680:case 36300:case 36308:case 36293:return nN;case 36289:case 36303:case 36311:case 36292:return iN}}function sN(n,e){n.uniform1fv(this.addr,e)}function oN(n,e){const t=Fc(e,this.size,2);n.uniform2fv(this.addr,t)}function aN(n,e){const t=Fc(e,this.size,3);n.uniform3fv(this.addr,t)}function lN(n,e){const t=Fc(e,this.size,4);n.uniform4fv(this.addr,t)}function cN(n,e){const t=Fc(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function uN(n,e){const t=Fc(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function fN(n,e){const t=Fc(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function hN(n,e){n.uniform1iv(this.addr,e)}function dN(n,e){n.uniform2iv(this.addr,e)}function pN(n,e){n.uniform3iv(this.addr,e)}function mN(n,e){n.uniform4iv(this.addr,e)}function gN(n,e){n.uniform1uiv(this.addr,e)}function vN(n,e){n.uniform2uiv(this.addr,e)}function yN(n,e){n.uniform3uiv(this.addr,e)}function _N(n,e){n.uniform4uiv(this.addr,e)}function xN(n,e,t){const i=this.cache,r=e.length,s=Cm(t,r);Dn(i,s)||(n.uniform1iv(this.addr,s),Fn(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||ER,s[o])}function AN(n,e,t){const i=this.cache,r=e.length,s=Cm(t,r);Dn(i,s)||(n.uniform1iv(this.addr,s),Fn(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||CR,s[o])}function SN(n,e,t){const i=this.cache,r=e.length,s=Cm(t,r);Dn(i,s)||(n.uniform1iv(this.addr,s),Fn(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||RR,s[o])}function MN(n,e,t){const i=this.cache,r=e.length,s=Cm(t,r);Dn(i,s)||(n.uniform1iv(this.addr,s),Fn(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||TR,s[o])}function EN(n){switch(n){case 5126:return sN;case 35664:return oN;case 35665:return aN;case 35666:return lN;case 35674:return cN;case 35675:return uN;case 35676:return fN;case 5124:case 35670:return hN;case 35667:case 35671:return dN;case 35668:case 35672:return pN;case 35669:case 35673:return mN;case 5125:return gN;case 36294:return vN;case 36295:return yN;case 36296:return _N;case 35678:case 36198:case 36298:case 36306:case 35682:return xN;case 35679:case 36299:case 36307:return AN;case 35680:case 36300:case 36308:case 36293:return SN;case 36289:case 36303:case 36311:case 36292:return MN}}class wN{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=rN(t.type)}}class TN{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=EN(t.type)}}class CN{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const Zv=/(\w+)(\])?(\[|\.)?/g;function wE(n,e){n.seq.push(e),n.map[e.id]=e}function RN(n,e,t){const i=n.name,r=i.length;for(Zv.lastIndex=0;;){const s=Zv.exec(i),o=Zv.lastIndex;let a=s[1];const l=s[2]==="]",f=s[3];if(l&&(a=a|0),f===void 0||f==="["&&o+2===r){wE(t,f===void 0?new wN(a,n,e):new TN(a,n,e));break}else{let d=t.map[a];d===void 0&&(d=new CN(a),wE(t,d)),t=d}}}class Mp{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);RN(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function TE(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const bN=37297;let PN=0;function BN(n,e){const t=n.split(`
- `),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
- `)}function IN(n){const e=Gt.getPrimaries(Gt.workingColorSpace),t=Gt.getPrimaries(n);let i;switch(e===t?i="":e===_f&&t===yf?i="LinearDisplayP3ToLinearSRGB":e===yf&&t===_f&&(i="LinearSRGBToLinearDisplayP3"),n){case hs:case Ff:return[i,"LinearTransferOETF"];case Pn:case Em:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function CE(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
- `+r+`
- `+BN(n.getShaderSource(e),o)}else return r}function LN(n,e){const t=IN(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function DN(n,e){let t;switch(e){case GC:t="Linear";break;case HC:t="Reinhard";break;case VC:t="OptimizedCineon";break;case px:t="ACESFilmic";break;case XC:t="AgX";break;case WC:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function FN(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(nc).join(`
- `)}function NN(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":""].filter(nc).join(`
- `)}function UN(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
- `)}function ON(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function nc(n){return n!==""}function RE(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function bE(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const kN=/^[ \t]*#include +<([\w\d./]+)>/gm;function r_(n){return n.replace(kN,GN)}const zN=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function GN(n,e){let t=_t[e];if(t===void 0){const i=zN.get(e);if(i!==void 0)t=_t[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return r_(t)}const HN=/#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 PE(n){return n.replace(HN,VN)}function VN(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function BE(n){let e="precision "+n.precision+` float;
- precision `+n.precision+" int;";return n.precision==="highp"?e+=`
- #define HIGH_PRECISION`:n.precision==="mediump"?e+=`
- #define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
- #define LOW_PRECISION`),e}function WN(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===_m?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Hu?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Ir&&(e="SHADOWMAP_TYPE_VSM"),e}function XN(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Xs:case No:e="ENVMAP_TYPE_CUBE";break;case Dc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function JN(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case No:e="ENVMAP_MODE_REFRACTION";break}return e}function jN(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Df:e="ENVMAP_BLENDING_MULTIPLY";break;case kC:e="ENVMAP_BLENDING_MIX";break;case zC:e="ENVMAP_BLENDING_ADD";break}return e}function KN(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function YN(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=WN(t),f=XN(t),h=JN(t),d=jN(t),p=KN(t),m=t.isWebGL2?"":FN(t),y=NN(t),S=UN(s),A=r.createProgram();let g,_,M=t.glslVersion?"#version "+t.glslVersion+`
- `:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(nc).join(`
- `),g.length>0&&(g+=`
- `),_=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(nc).join(`
- `),_.length>0&&(_+=`
- `)):(g=[BE(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.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_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," 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",`
- `].filter(nc).join(`
- `),_=[m,BE(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==os?"#define TONE_MAPPING":"",t.toneMapping!==os?_t.tonemapping_pars_fragment:"",t.toneMapping!==os?DN("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",_t.colorspace_pars_fragment,LN("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
- `].filter(nc).join(`
- `)),o=r_(o),o=RE(o,t),o=bE(o,t),a=r_(a),a=RE(a,t),a=bE(a,t),o=PE(o),a=PE(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(M=`#version 300 es
- `,g=[y,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
- `)+`
- `+g,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===t_?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===t_?"":"#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(`
- `)+`
- `+_);const w=M+g+o,B=M+_+a,T=TE(r,r.VERTEX_SHADER,w),b=TE(r,r.FRAGMENT_SHADER,B);r.attachShader(A,T),r.attachShader(A,b),t.index0AttributeName!==void 0?r.bindAttribLocation(A,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(A,0,"position"),r.linkProgram(A);function L(K){if(n.debug.checkShaderErrors){const ie=r.getProgramInfoLog(A).trim(),G=r.getShaderInfoLog(T).trim(),J=r.getShaderInfoLog(b).trim();let Z=!0,ae=!0;if(r.getProgramParameter(A,r.LINK_STATUS)===!1)if(Z=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,A,T,b);else{const O=CE(r,T,"vertex"),V=CE(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(A,r.VALIDATE_STATUS)+`
- Program Info Log: `+ie+`
- `+O+`
- `+V)}else ie!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ie):(G===""||J==="")&&(ae=!1);ae&&(K.diagnostics={runnable:Z,programLog:ie,vertexShader:{log:G,prefix:g},fragmentShader:{log:J,prefix:_}})}r.deleteShader(T),r.deleteShader(b),R=new Mp(r,A),P=ON(r,A)}let R;this.getUniforms=function(){return R===void 0&&L(this),R};let P;this.getAttributes=function(){return P===void 0&&L(this),P};let U=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return U===!1&&(U=r.getProgramParameter(A,bN)),U},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=PN++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=T,this.fragmentShader=b,this}let QN=0;class ZN{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new qN(e),t.set(e,i)),i}}class qN{constructor(e){this.id=QN++,this.code=e,this.usedTimes=0}}function $N(n,e,t,i,r,s,o){const a=new Ia,l=new ZN,f=[],h=r.isWebGL2,d=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=r.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function S(R){return R===0?"uv":`uv${R}`}function A(R,P,U,K,ie){const G=K.fog,J=ie.geometry,Z=R.isMeshStandardMaterial?K.environment:null,ae=(R.isMeshStandardMaterial?t:e).get(R.envMap||Z),O=ae&&ae.mapping===Dc?ae.image.height:null,V=y[R.type];R.precision!==null&&(m=r.getMaxPrecision(R.precision),m!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",m,"instead."));const H=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,q=H!==void 0?H.length:0;let ne=0;J.morphAttributes.position!==void 0&&(ne=1),J.morphAttributes.normal!==void 0&&(ne=2),J.morphAttributes.color!==void 0&&(ne=3);let Y,ue,Se,Te;if(V){const tn=Fr[V];Y=tn.vertexShader,ue=tn.fragmentShader}else Y=R.vertexShader,ue=R.fragmentShader,l.update(R),Se=l.getVertexShaderID(R),Te=l.getFragmentShaderID(R);const Ce=n.getRenderTarget(),Ze=ie.isInstancedMesh===!0,ot=ie.isBatchedMesh===!0,Le=!!R.map,be=!!R.matcap,z=!!ae,ve=!!R.aoMap,he=!!R.lightMap,Me=!!R.bumpMap,pe=!!R.normalMap,Ve=!!R.displacementMap,De=!!R.emissiveMap,F=!!R.metalnessMap,I=!!R.roughnessMap,$=R.anisotropy>0,_e=R.clearcoat>0,ye=R.iridescence>0,me=R.sheen>0,Ye=R.transmission>0,Be=$&&!!R.anisotropyMap,Fe=_e&&!!R.clearcoatMap,nt=_e&&!!R.clearcoatNormalMap,dt=_e&&!!R.clearcoatRoughnessMap,xe=ye&&!!R.iridescenceMap,It=ye&&!!R.iridescenceThicknessMap,yt=me&&!!R.sheenColorMap,ut=me&&!!R.sheenRoughnessMap,tt=!!R.specularMap,We=!!R.specularColorMap,W=!!R.specularIntensityMap,ge=Ye&&!!R.transmissionMap,Ge=Ye&&!!R.thicknessMap,ke=!!R.gradientMap,Ae=!!R.alphaMap,X=R.alphaTest>0,Re=!!R.alphaHash,Ne=!!R.extensions,it=!!J.attributes.uv1,Qe=!!J.attributes.uv2,Tt=!!J.attributes.uv3;let Lt=os;return R.toneMapped&&(Ce===null||Ce.isXRRenderTarget===!0)&&(Lt=n.toneMapping),{isWebGL2:h,shaderID:V,shaderType:R.type,shaderName:R.name,vertexShader:Y,fragmentShader:ue,defines:R.defines,customVertexShaderID:Se,customFragmentShaderID:Te,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:m,batching:ot,instancing:Ze,instancingColor:Ze&&ie.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:Ce===null?n.outputColorSpace:Ce.isXRRenderTarget===!0?Ce.texture.colorSpace:hs,map:Le,matcap:be,envMap:z,envMapMode:z&&ae.mapping,envMapCubeUVHeight:O,aoMap:ve,lightMap:he,bumpMap:Me,normalMap:pe,displacementMap:p&&Ve,emissiveMap:De,normalMapObjectSpace:pe&&R.normalMapType===aR,normalMapTangentSpace:pe&&R.normalMapType===Vo,metalnessMap:F,roughnessMap:I,anisotropy:$,anisotropyMap:Be,clearcoat:_e,clearcoatMap:Fe,clearcoatNormalMap:nt,clearcoatRoughnessMap:dt,iridescence:ye,iridescenceMap:xe,iridescenceThicknessMap:It,sheen:me,sheenColorMap:yt,sheenRoughnessMap:ut,specularMap:tt,specularColorMap:We,specularIntensityMap:W,transmission:Ye,transmissionMap:ge,thicknessMap:Ge,gradientMap:ke,opaque:R.transparent===!1&&R.blending===Pa,alphaMap:Ae,alphaTest:X,alphaHash:Re,combine:R.combine,mapUv:Le&&S(R.map.channel),aoMapUv:ve&&S(R.aoMap.channel),lightMapUv:he&&S(R.lightMap.channel),bumpMapUv:Me&&S(R.bumpMap.channel),normalMapUv:pe&&S(R.normalMap.channel),displacementMapUv:Ve&&S(R.displacementMap.channel),emissiveMapUv:De&&S(R.emissiveMap.channel),metalnessMapUv:F&&S(R.metalnessMap.channel),roughnessMapUv:I&&S(R.roughnessMap.channel),anisotropyMapUv:Be&&S(R.anisotropyMap.channel),clearcoatMapUv:Fe&&S(R.clearcoatMap.channel),clearcoatNormalMapUv:nt&&S(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:dt&&S(R.clearcoatRoughnessMap.channel),iridescenceMapUv:xe&&S(R.iridescenceMap.channel),iridescenceThicknessMapUv:It&&S(R.iridescenceThicknessMap.channel),sheenColorMapUv:yt&&S(R.sheenColorMap.channel),sheenRoughnessMapUv:ut&&S(R.sheenRoughnessMap.channel),specularMapUv:tt&&S(R.specularMap.channel),specularColorMapUv:We&&S(R.specularColorMap.channel),specularIntensityMapUv:W&&S(R.specularIntensityMap.channel),transmissionMapUv:ge&&S(R.transmissionMap.channel),thicknessMapUv:Ge&&S(R.thicknessMap.channel),alphaMapUv:Ae&&S(R.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(pe||$),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,vertexUv1s:it,vertexUv2s:Qe,vertexUv3s:Tt,pointsUvs:ie.isPoints===!0&&!!J.attributes.uv&&(Le||Ae),fog:!!G,useFog:R.fog===!0,fogExp2:G&&G.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:ie.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:ne,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:R.dithering,shadowMapEnabled:n.shadowMap.enabled&&U.length>0,shadowMapType:n.shadowMap.type,toneMapping:Lt,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Le&&R.map.isVideoTexture===!0&&Gt.getTransfer(R.map.colorSpace)===Xt,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===pr,flipSided:R.side===_i,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:Ne&&R.extensions.derivatives===!0,extensionFragDepth:Ne&&R.extensions.fragDepth===!0,extensionDrawBuffers:Ne&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ne&&R.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Ne&&R.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()}}function g(R){const P=[];if(R.shaderID?P.push(R.shaderID):(P.push(R.customVertexShaderID),P.push(R.customFragmentShaderID)),R.defines!==void 0)for(const U in R.defines)P.push(U),P.push(R.defines[U]);return R.isRawShaderMaterial===!1&&(_(P,R),M(P,R),P.push(n.outputColorSpace)),P.push(R.customProgramCacheKey),P.join()}function _(R,P){R.push(P.precision),R.push(P.outputColorSpace),R.push(P.envMapMode),R.push(P.envMapCubeUVHeight),R.push(P.mapUv),R.push(P.alphaMapUv),R.push(P.lightMapUv),R.push(P.aoMapUv),R.push(P.bumpMapUv),R.push(P.normalMapUv),R.push(P.displacementMapUv),R.push(P.emissiveMapUv),R.push(P.metalnessMapUv),R.push(P.roughnessMapUv),R.push(P.anisotropyMapUv),R.push(P.clearcoatMapUv),R.push(P.clearcoatNormalMapUv),R.push(P.clearcoatRoughnessMapUv),R.push(P.iridescenceMapUv),R.push(P.iridescenceThicknessMapUv),R.push(P.sheenColorMapUv),R.push(P.sheenRoughnessMapUv),R.push(P.specularMapUv),R.push(P.specularColorMapUv),R.push(P.specularIntensityMapUv),R.push(P.transmissionMapUv),R.push(P.thicknessMapUv),R.push(P.combine),R.push(P.fogExp2),R.push(P.sizeAttenuation),R.push(P.morphTargetsCount),R.push(P.morphAttributeCount),R.push(P.numDirLights),R.push(P.numPointLights),R.push(P.numSpotLights),R.push(P.numSpotLightMaps),R.push(P.numHemiLights),R.push(P.numRectAreaLights),R.push(P.numDirLightShadows),R.push(P.numPointLightShadows),R.push(P.numSpotLightShadows),R.push(P.numSpotLightShadowsWithMaps),R.push(P.numLightProbes),R.push(P.shadowMapType),R.push(P.toneMapping),R.push(P.numClippingPlanes),R.push(P.numClipIntersection),R.push(P.depthPacking)}function M(R,P){a.disableAll(),P.isWebGL2&&a.enable(0),P.supportsVertexTextures&&a.enable(1),P.instancing&&a.enable(2),P.instancingColor&&a.enable(3),P.matcap&&a.enable(4),P.envMap&&a.enable(5),P.normalMapObjectSpace&&a.enable(6),P.normalMapTangentSpace&&a.enable(7),P.clearcoat&&a.enable(8),P.iridescence&&a.enable(9),P.alphaTest&&a.enable(10),P.vertexColors&&a.enable(11),P.vertexAlphas&&a.enable(12),P.vertexUv1s&&a.enable(13),P.vertexUv2s&&a.enable(14),P.vertexUv3s&&a.enable(15),P.vertexTangents&&a.enable(16),P.anisotropy&&a.enable(17),P.alphaHash&&a.enable(18),P.batching&&a.enable(19),R.push(a.mask),a.disableAll(),P.fog&&a.enable(0),P.useFog&&a.enable(1),P.flatShading&&a.enable(2),P.logarithmicDepthBuffer&&a.enable(3),P.skinning&&a.enable(4),P.morphTargets&&a.enable(5),P.morphNormals&&a.enable(6),P.morphColors&&a.enable(7),P.premultipliedAlpha&&a.enable(8),P.shadowMapEnabled&&a.enable(9),P.useLegacyLights&&a.enable(10),P.doubleSided&&a.enable(11),P.flipSided&&a.enable(12),P.useDepthPacking&&a.enable(13),P.dithering&&a.enable(14),P.transmission&&a.enable(15),P.sheen&&a.enable(16),P.opaque&&a.enable(17),P.pointsUvs&&a.enable(18),P.decodeVideoTexture&&a.enable(19),R.push(a.mask)}function w(R){const P=y[R.type];let U;if(P){const K=Fr[P];U=xR.clone(K.uniforms)}else U=R.uniforms;return U}function B(R,P){let U;for(let K=0,ie=f.length;K<ie;K++){const G=f[K];if(G.cacheKey===P){U=G,++U.usedTimes;break}}return U===void 0&&(U=new YN(n,P,R,s),f.push(U)),U}function T(R){if(--R.usedTimes===0){const P=f.indexOf(R);f[P]=f[f.length-1],f.pop(),R.destroy()}}function b(R){l.remove(R)}function L(){l.dispose()}return{getParameters:A,getProgramCacheKey:g,getUniforms:w,acquireProgram:B,releaseProgram:T,releaseShaderCache:b,programs:f,dispose:L}}function eU(){let n=new WeakMap;function e(s){let o=n.get(s);return o===void 0&&(o={},n.set(s,o)),o}function t(s){n.delete(s)}function i(s,o,a){n.get(s)[o]=a}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function tU(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function IE(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function LE(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(d,p,m,y,S,A){let g=n[e];return g===void 0?(g={id:d.id,object:d,geometry:p,material:m,groupOrder:y,renderOrder:d.renderOrder,z:S,group:A},n[e]=g):(g.id=d.id,g.object=d,g.geometry=p,g.material=m,g.groupOrder=y,g.renderOrder=d.renderOrder,g.z=S,g.group=A),e++,g}function a(d,p,m,y,S,A){const g=o(d,p,m,y,S,A);m.transmission>0?i.push(g):m.transparent===!0?r.push(g):t.push(g)}function l(d,p,m,y,S,A){const g=o(d,p,m,y,S,A);m.transmission>0?i.unshift(g):m.transparent===!0?r.unshift(g):t.unshift(g)}function f(d,p){t.length>1&&t.sort(d||tU),i.length>1&&i.sort(p||IE),r.length>1&&r.sort(p||IE)}function h(){for(let d=e,p=n.length;d<p;d++){const m=n[d];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:h,sort:f}}function nU(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new LE,n.set(i,[o])):r>=s.length?(o=new LE,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function iU(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new D,color:new Pe};break;case"SpotLight":t={position:new D,direction:new D,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new D,halfWidth:new D,halfHeight:new D};break}return n[e.id]=t,t}}}function rU(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let sU=0;function oU(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function aU(n,e){const t=new iU,i=rU(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)r.probe.push(new D);const s=new D,o=new Ue,a=new Ue;function l(h,d){let p=0,m=0,y=0;for(let K=0;K<9;K++)r.probe[K].set(0,0,0);let S=0,A=0,g=0,_=0,M=0,w=0,B=0,T=0,b=0,L=0,R=0;h.sort(oU);const P=d===!0?Math.PI:1;for(let K=0,ie=h.length;K<ie;K++){const G=h[K],J=G.color,Z=G.intensity,ae=G.distance,O=G.shadow&&G.shadow.map?G.shadow.map.texture:null;if(G.isAmbientLight)p+=J.r*Z*P,m+=J.g*Z*P,y+=J.b*Z*P;else if(G.isLightProbe){for(let V=0;V<9;V++)r.probe[V].addScaledVector(G.sh.coefficients[V],Z);R++}else if(G.isDirectionalLight){const V=t.get(G);if(V.color.copy(G.color).multiplyScalar(G.intensity*P),G.castShadow){const H=G.shadow,q=i.get(G);q.shadowBias=H.bias,q.shadowNormalBias=H.normalBias,q.shadowRadius=H.radius,q.shadowMapSize=H.mapSize,r.directionalShadow[S]=q,r.directionalShadowMap[S]=O,r.directionalShadowMatrix[S]=G.shadow.matrix,w++}r.directional[S]=V,S++}else if(G.isSpotLight){const V=t.get(G);V.position.setFromMatrixPosition(G.matrixWorld),V.color.copy(J).multiplyScalar(Z*P),V.distance=ae,V.coneCos=Math.cos(G.angle),V.penumbraCos=Math.cos(G.angle*(1-G.penumbra)),V.decay=G.decay,r.spot[g]=V;const H=G.shadow;if(G.map&&(r.spotLightMap[b]=G.map,b++,H.updateMatrices(G),G.castShadow&&L++),r.spotLightMatrix[g]=H.matrix,G.castShadow){const q=i.get(G);q.shadowBias=H.bias,q.shadowNormalBias=H.normalBias,q.shadowRadius=H.radius,q.shadowMapSize=H.mapSize,r.spotShadow[g]=q,r.spotShadowMap[g]=O,T++}g++}else if(G.isRectAreaLight){const V=t.get(G);V.color.copy(J).multiplyScalar(Z),V.halfWidth.set(G.width*.5,0,0),V.halfHeight.set(0,G.height*.5,0),r.rectArea[_]=V,_++}else if(G.isPointLight){const V=t.get(G);if(V.color.copy(G.color).multiplyScalar(G.intensity*P),V.distance=G.distance,V.decay=G.decay,G.castShadow){const H=G.shadow,q=i.get(G);q.shadowBias=H.bias,q.shadowNormalBias=H.normalBias,q.shadowRadius=H.radius,q.shadowMapSize=H.mapSize,q.shadowCameraNear=H.camera.near,q.shadowCameraFar=H.camera.far,r.pointShadow[A]=q,r.pointShadowMap[A]=O,r.pointShadowMatrix[A]=G.shadow.matrix,B++}r.point[A]=V,A++}else if(G.isHemisphereLight){const V=t.get(G);V.skyColor.copy(G.color).multiplyScalar(Z*P),V.groundColor.copy(G.groundColor).multiplyScalar(Z*P),r.hemi[M]=V,M++}}_>0&&(e.isWebGL2?n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ie.LTC_FLOAT_1,r.rectAreaLTC2=Ie.LTC_FLOAT_2):(r.rectAreaLTC1=Ie.LTC_HALF_1,r.rectAreaLTC2=Ie.LTC_HALF_2):n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ie.LTC_FLOAT_1,r.rectAreaLTC2=Ie.LTC_FLOAT_2):n.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]=p,r.ambient[1]=m,r.ambient[2]=y;const U=r.hash;(U.directionalLength!==S||U.pointLength!==A||U.spotLength!==g||U.rectAreaLength!==_||U.hemiLength!==M||U.numDirectionalShadows!==w||U.numPointShadows!==B||U.numSpotShadows!==T||U.numSpotMaps!==b||U.numLightProbes!==R)&&(r.directional.length=S,r.spot.length=g,r.rectArea.length=_,r.point.length=A,r.hemi.length=M,r.directionalShadow.length=w,r.directionalShadowMap.length=w,r.pointShadow.length=B,r.pointShadowMap.length=B,r.spotShadow.length=T,r.spotShadowMap.length=T,r.directionalShadowMatrix.length=w,r.pointShadowMatrix.length=B,r.spotLightMatrix.length=T+b-L,r.spotLightMap.length=b,r.numSpotLightShadowsWithMaps=L,r.numLightProbes=R,U.directionalLength=S,U.pointLength=A,U.spotLength=g,U.rectAreaLength=_,U.hemiLength=M,U.numDirectionalShadows=w,U.numPointShadows=B,U.numSpotShadows=T,U.numSpotMaps=b,U.numLightProbes=R,r.version=sU++)}function f(h,d){let p=0,m=0,y=0,S=0,A=0;const g=d.matrixWorldInverse;for(let _=0,M=h.length;_<M;_++){const w=h[_];if(w.isDirectionalLight){const B=r.directional[p];B.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),B.direction.sub(s),B.direction.transformDirection(g),p++}else if(w.isSpotLight){const B=r.spot[y];B.position.setFromMatrixPosition(w.matrixWorld),B.position.applyMatrix4(g),B.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),B.direction.sub(s),B.direction.transformDirection(g),y++}else if(w.isRectAreaLight){const B=r.rectArea[S];B.position.setFromMatrixPosition(w.matrixWorld),B.position.applyMatrix4(g),a.identity(),o.copy(w.matrixWorld),o.premultiply(g),a.extractRotation(o),B.halfWidth.set(w.width*.5,0,0),B.halfHeight.set(0,w.height*.5,0),B.halfWidth.applyMatrix4(a),B.halfHeight.applyMatrix4(a),S++}else if(w.isPointLight){const B=r.point[m];B.position.setFromMatrixPosition(w.matrixWorld),B.position.applyMatrix4(g),m++}else if(w.isHemisphereLight){const B=r.hemi[A];B.direction.setFromMatrixPosition(w.matrixWorld),B.direction.transformDirection(g),A++}}}return{setup:l,setupView:f,state:r}}function DE(n,e){const t=new aU(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function o(d){i.push(d)}function a(d){r.push(d)}function l(d){t.setup(i,d)}function f(d){t.setupView(i,d)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:l,setupLightsView:f,pushLight:o,pushShadow:a}}function lU(n,e){let t=new WeakMap;function i(s,o=0){const a=t.get(s);let l;return a===void 0?(l=new DE(n,e),t.set(s,[l])):o>=a.length?(l=new DE(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class Ix extends Ln{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=sR,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Lx extends Ln{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const cU=`void main() {
- gl_Position = vec4( position, 1.0 );
- }`,uU=`uniform sampler2D shadow_pass;
- uniform vec2 resolution;
- uniform float radius;
- #include <packing>
- void main() {
- const float samples = float( VSM_SAMPLES );
- float mean = 0.0;
- float squared_mean = 0.0;
- float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
- float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
- for ( float i = 0.0; i < samples; i ++ ) {
- float uvOffset = uvStart + i * uvStride;
- #ifdef HORIZONTAL_PASS
- vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
- mean += distribution.x;
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
- #else
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
- mean += depth;
- squared_mean += depth * depth;
- #endif
- }
- mean = mean / samples;
- squared_mean = squared_mean / samples;
- float std_dev = sqrt( squared_mean - mean * mean );
- gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
- }`;function fU(n,e,t){let i=new Of;const r=new de,s=new de,o=new Nt,a=new Ix({depthPacking:oR}),l=new Lx,f={},h=t.maxTextureSize,d={[cs]:_i,[_i]:cs,[pr]:pr},p=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new de},radius:{value:4}},vertexShader:cU,fragmentShader:uU}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const y=new ht;y.setAttribute("position",new Dt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new Mn(y,p),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=_m;let g=this.type;this.render=function(T,b,L){if(A.enabled===!1||A.autoUpdate===!1&&A.needsUpdate===!1||T.length===0)return;const R=n.getRenderTarget(),P=n.getActiveCubeFace(),U=n.getActiveMipmapLevel(),K=n.state;K.setBlending(Os),K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const ie=g!==Ir&&this.type===Ir,G=g===Ir&&this.type!==Ir;for(let J=0,Z=T.length;J<Z;J++){const ae=T[J],O=ae.shadow;if(O===void 0){console.warn("THREE.WebGLShadowMap:",ae,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;r.copy(O.mapSize);const V=O.getFrameExtents();if(r.multiply(V),s.copy(O.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/V.x),r.x=s.x*V.x,O.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/V.y),r.y=s.y*V.y,O.mapSize.y=s.y)),O.map===null||ie===!0||G===!0){const q=this.type!==Ir?{minFilter:gn,magFilter:gn}:{};O.map!==null&&O.map.dispose(),O.map=new Hr(r.x,r.y,q),O.map.texture.name=ae.name+".shadowMap",O.camera.updateProjectionMatrix()}n.setRenderTarget(O.map),n.clear();const H=O.getViewportCount();for(let q=0;q<H;q++){const ne=O.getViewport(q);o.set(s.x*ne.x,s.y*ne.y,s.x*ne.z,s.y*ne.w),K.viewport(o),O.updateMatrices(ae,q),i=O.getFrustum(),w(b,L,O.camera,ae,this.type)}O.isPointLightShadow!==!0&&this.type===Ir&&_(O,L),O.needsUpdate=!1}g=this.type,A.needsUpdate=!1,n.setRenderTarget(R,P,U)};function _(T,b){const L=e.update(S);p.defines.VSM_SAMPLES!==T.blurSamples&&(p.defines.VSM_SAMPLES=T.blurSamples,m.defines.VSM_SAMPLES=T.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Hr(r.x,r.y)),p.uniforms.shadow_pass.value=T.map.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(b,null,L,p,S,null),m.uniforms.shadow_pass.value=T.mapPass.texture,m.uniforms.resolution.value=T.mapSize,m.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(b,null,L,m,S,null)}function M(T,b,L,R){let P=null;const U=L.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(U!==void 0)P=U;else if(P=L.isPointLight===!0?l:a,n.localClippingEnabled&&b.clipShadows===!0&&Array.isArray(b.clippingPlanes)&&b.clippingPlanes.length!==0||b.displacementMap&&b.displacementScale!==0||b.alphaMap&&b.alphaTest>0||b.map&&b.alphaTest>0){const K=P.uuid,ie=b.uuid;let G=f[K];G===void 0&&(G={},f[K]=G);let J=G[ie];J===void 0&&(J=P.clone(),G[ie]=J,b.addEventListener("dispose",B)),P=J}if(P.visible=b.visible,P.wireframe=b.wireframe,R===Ir?P.side=b.shadowSide!==null?b.shadowSide:b.side:P.side=b.shadowSide!==null?b.shadowSide:d[b.side],P.alphaMap=b.alphaMap,P.alphaTest=b.alphaTest,P.map=b.map,P.clipShadows=b.clipShadows,P.clippingPlanes=b.clippingPlanes,P.clipIntersection=b.clipIntersection,P.displacementMap=b.displacementMap,P.displacementScale=b.displacementScale,P.displacementBias=b.displacementBias,P.wireframeLinewidth=b.wireframeLinewidth,P.linewidth=b.linewidth,L.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const K=n.properties.get(P);K.light=L}return P}function w(T,b,L,R,P){if(T.visible===!1)return;if(T.layers.test(b.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&P===Ir)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,T.matrixWorld);const ie=e.update(T),G=T.material;if(Array.isArray(G)){const J=ie.groups;for(let Z=0,ae=J.length;Z<ae;Z++){const O=J[Z],V=G[O.materialIndex];if(V&&V.visible){const H=M(T,V,R,P);T.onBeforeShadow(n,T,b,L,ie,H,O),n.renderBufferDirect(L,null,ie,H,T,O),T.onAfterShadow(n,T,b,L,ie,H,O)}}}else if(G.visible){const J=M(T,G,R,P);T.onBeforeShadow(n,T,b,L,ie,J,null),n.renderBufferDirect(L,null,ie,J,T,null),T.onAfterShadow(n,T,b,L,ie,J,null)}}const K=T.children;for(let ie=0,G=K.length;ie<G;ie++)w(K[ie],b,L,R,P)}function B(T){T.target.removeEventListener("dispose",B);for(const L in f){const R=f[L],P=T.target.uuid;P in R&&(R[P].dispose(),delete R[P])}}}function hU(n,e,t){const i=t.isWebGL2;function r(){let X=!1;const Re=new Nt;let Ne=null;const it=new Nt(0,0,0,0);return{setMask:function(Qe){Ne!==Qe&&!X&&(n.colorMask(Qe,Qe,Qe,Qe),Ne=Qe)},setLocked:function(Qe){X=Qe},setClear:function(Qe,Tt,Lt,Vt,tn){tn===!0&&(Qe*=Vt,Tt*=Vt,Lt*=Vt),Re.set(Qe,Tt,Lt,Vt),it.equals(Re)===!1&&(n.clearColor(Qe,Tt,Lt,Vt),it.copy(Re))},reset:function(){X=!1,Ne=null,it.set(-1,0,0,0)}}}function s(){let X=!1,Re=null,Ne=null,it=null;return{setTest:function(Qe){Qe?ot(n.DEPTH_TEST):Le(n.DEPTH_TEST)},setMask:function(Qe){Re!==Qe&&!X&&(n.depthMask(Qe),Re=Qe)},setFunc:function(Qe){if(Ne!==Qe){switch(Qe){case IC:n.depthFunc(n.NEVER);break;case LC:n.depthFunc(n.ALWAYS);break;case DC:n.depthFunc(n.LESS);break;case df:n.depthFunc(n.LEQUAL);break;case FC:n.depthFunc(n.EQUAL);break;case NC:n.depthFunc(n.GEQUAL);break;case UC:n.depthFunc(n.GREATER);break;case OC:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Ne=Qe}},setLocked:function(Qe){X=Qe},setClear:function(Qe){it!==Qe&&(n.clearDepth(Qe),it=Qe)},reset:function(){X=!1,Re=null,Ne=null,it=null}}}function o(){let X=!1,Re=null,Ne=null,it=null,Qe=null,Tt=null,Lt=null,Vt=null,tn=null;return{setTest:function(Ft){X||(Ft?ot(n.STENCIL_TEST):Le(n.STENCIL_TEST))},setMask:function(Ft){Re!==Ft&&!X&&(n.stencilMask(Ft),Re=Ft)},setFunc:function(Ft,Wn,qi){(Ne!==Ft||it!==Wn||Qe!==qi)&&(n.stencilFunc(Ft,Wn,qi),Ne=Ft,it=Wn,Qe=qi)},setOp:function(Ft,Wn,qi){(Tt!==Ft||Lt!==Wn||Vt!==qi)&&(n.stencilOp(Ft,Wn,qi),Tt=Ft,Lt=Wn,Vt=qi)},setLocked:function(Ft){X=Ft},setClear:function(Ft){tn!==Ft&&(n.clearStencil(Ft),tn=Ft)},reset:function(){X=!1,Re=null,Ne=null,it=null,Qe=null,Tt=null,Lt=null,Vt=null,tn=null}}}const a=new r,l=new s,f=new o,h=new WeakMap,d=new WeakMap;let p={},m={},y=new WeakMap,S=[],A=null,g=!1,_=null,M=null,w=null,B=null,T=null,b=null,L=null,R=new Pe(0,0,0),P=0,U=!1,K=null,ie=null,G=null,J=null,Z=null;const ae=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let O=!1,V=0;const H=n.getParameter(n.VERSION);H.indexOf("WebGL")!==-1?(V=parseFloat(/^WebGL (\d)/.exec(H)[1]),O=V>=1):H.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),O=V>=2);let q=null,ne={};const Y=n.getParameter(n.SCISSOR_BOX),ue=n.getParameter(n.VIEWPORT),Se=new Nt().fromArray(Y),Te=new Nt().fromArray(ue);function Ce(X,Re,Ne,it){const Qe=new Uint8Array(4),Tt=n.createTexture();n.bindTexture(X,Tt),n.texParameteri(X,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(X,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Lt=0;Lt<Ne;Lt++)i&&(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)?n.texImage3D(Re,0,n.RGBA,1,1,it,0,n.RGBA,n.UNSIGNED_BYTE,Qe):n.texImage2D(Re+Lt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Qe);return Tt}const Ze={};Ze[n.TEXTURE_2D]=Ce(n.TEXTURE_2D,n.TEXTURE_2D,1),Ze[n.TEXTURE_CUBE_MAP]=Ce(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Ze[n.TEXTURE_2D_ARRAY]=Ce(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Ze[n.TEXTURE_3D]=Ce(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),a.setClear(0,0,0,1),l.setClear(1),f.setClear(0),ot(n.DEPTH_TEST),l.setFunc(df),De(!1),F(Sy),ot(n.CULL_FACE),pe(Os);function ot(X){p[X]!==!0&&(n.enable(X),p[X]=!0)}function Le(X){p[X]!==!1&&(n.disable(X),p[X]=!1)}function be(X,Re){return m[X]!==Re?(n.bindFramebuffer(X,Re),m[X]=Re,i&&(X===n.DRAW_FRAMEBUFFER&&(m[n.FRAMEBUFFER]=Re),X===n.FRAMEBUFFER&&(m[n.DRAW_FRAMEBUFFER]=Re)),!0):!1}function z(X,Re){let Ne=S,it=!1;if(X)if(Ne=y.get(Re),Ne===void 0&&(Ne=[],y.set(Re,Ne)),X.isWebGLMultipleRenderTargets){const Qe=X.texture;if(Ne.length!==Qe.length||Ne[0]!==n.COLOR_ATTACHMENT0){for(let Tt=0,Lt=Qe.length;Tt<Lt;Tt++)Ne[Tt]=n.COLOR_ATTACHMENT0+Tt;Ne.length=Qe.length,it=!0}}else Ne[0]!==n.COLOR_ATTACHMENT0&&(Ne[0]=n.COLOR_ATTACHMENT0,it=!0);else Ne[0]!==n.BACK&&(Ne[0]=n.BACK,it=!0);it&&(t.isWebGL2?n.drawBuffers(Ne):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ne))}function ve(X){return A!==X?(n.useProgram(X),A=X,!0):!1}const he={[_o]:n.FUNC_ADD,[vC]:n.FUNC_SUBTRACT,[yC]:n.FUNC_REVERSE_SUBTRACT};if(i)he[Ty]=n.MIN,he[Cy]=n.MAX;else{const X=e.get("EXT_blend_minmax");X!==null&&(he[Ty]=X.MIN_EXT,he[Cy]=X.MAX_EXT)}const Me={[_C]:n.ZERO,[xC]:n.ONE,[AC]:n.SRC_COLOR,[Yp]:n.SRC_ALPHA,[CC]:n.SRC_ALPHA_SATURATE,[wC]:n.DST_COLOR,[MC]:n.DST_ALPHA,[SC]:n.ONE_MINUS_SRC_COLOR,[Qp]:n.ONE_MINUS_SRC_ALPHA,[TC]:n.ONE_MINUS_DST_COLOR,[EC]:n.ONE_MINUS_DST_ALPHA,[RC]:n.CONSTANT_COLOR,[bC]:n.ONE_MINUS_CONSTANT_COLOR,[PC]:n.CONSTANT_ALPHA,[BC]:n.ONE_MINUS_CONSTANT_ALPHA};function pe(X,Re,Ne,it,Qe,Tt,Lt,Vt,tn,Ft){if(X===Os){g===!0&&(Le(n.BLEND),g=!1);return}if(g===!1&&(ot(n.BLEND),g=!0),X!==gC){if(X!==_||Ft!==U){if((M!==_o||T!==_o)&&(n.blendEquation(n.FUNC_ADD),M=_o,T=_o),Ft)switch(X){case Pa:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case My:n.blendFunc(n.ONE,n.ONE);break;case Ey:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case wy:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case Pa:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case My:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Ey:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case wy:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}w=null,B=null,b=null,L=null,R.set(0,0,0),P=0,_=X,U=Ft}return}Qe=Qe||Re,Tt=Tt||Ne,Lt=Lt||it,(Re!==M||Qe!==T)&&(n.blendEquationSeparate(he[Re],he[Qe]),M=Re,T=Qe),(Ne!==w||it!==B||Tt!==b||Lt!==L)&&(n.blendFuncSeparate(Me[Ne],Me[it],Me[Tt],Me[Lt]),w=Ne,B=it,b=Tt,L=Lt),(Vt.equals(R)===!1||tn!==P)&&(n.blendColor(Vt.r,Vt.g,Vt.b,tn),R.copy(Vt),P=tn),_=X,U=!1}function Ve(X,Re){X.side===pr?Le(n.CULL_FACE):ot(n.CULL_FACE);let Ne=X.side===_i;Re&&(Ne=!Ne),De(Ne),X.blending===Pa&&X.transparent===!1?pe(Os):pe(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.blendColor,X.blendAlpha,X.premultipliedAlpha),l.setFunc(X.depthFunc),l.setTest(X.depthTest),l.setMask(X.depthWrite),a.setMask(X.colorWrite);const it=X.stencilWrite;f.setTest(it),it&&(f.setMask(X.stencilWriteMask),f.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),f.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),$(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?ot(n.SAMPLE_ALPHA_TO_COVERAGE):Le(n.SAMPLE_ALPHA_TO_COVERAGE)}function De(X){K!==X&&(X?n.frontFace(n.CW):n.frontFace(n.CCW),K=X)}function F(X){X!==dC?(ot(n.CULL_FACE),X!==ie&&(X===Sy?n.cullFace(n.BACK):X===pC?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Le(n.CULL_FACE),ie=X}function I(X){X!==G&&(O&&n.lineWidth(X),G=X)}function $(X,Re,Ne){X?(ot(n.POLYGON_OFFSET_FILL),(J!==Re||Z!==Ne)&&(n.polygonOffset(Re,Ne),J=Re,Z=Ne)):Le(n.POLYGON_OFFSET_FILL)}function _e(X){X?ot(n.SCISSOR_TEST):Le(n.SCISSOR_TEST)}function ye(X){X===void 0&&(X=n.TEXTURE0+ae-1),q!==X&&(n.activeTexture(X),q=X)}function me(X,Re,Ne){Ne===void 0&&(q===null?Ne=n.TEXTURE0+ae-1:Ne=q);let it=ne[Ne];it===void 0&&(it={type:void 0,texture:void 0},ne[Ne]=it),(it.type!==X||it.texture!==Re)&&(q!==Ne&&(n.activeTexture(Ne),q=Ne),n.bindTexture(X,Re||Ze[X]),it.type=X,it.texture=Re)}function Ye(){const X=ne[q];X!==void 0&&X.type!==void 0&&(n.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function Be(){try{n.compressedTexImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Fe(){try{n.compressedTexImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function nt(){try{n.texSubImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function dt(){try{n.texSubImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function xe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function It(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function yt(){try{n.texStorage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function ut(){try{n.texStorage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function tt(){try{n.texImage2D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function We(){try{n.texImage3D.apply(n,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function W(X){Se.equals(X)===!1&&(n.scissor(X.x,X.y,X.z,X.w),Se.copy(X))}function ge(X){Te.equals(X)===!1&&(n.viewport(X.x,X.y,X.z,X.w),Te.copy(X))}function Ge(X,Re){let Ne=d.get(Re);Ne===void 0&&(Ne=new WeakMap,d.set(Re,Ne));let it=Ne.get(X);it===void 0&&(it=n.getUniformBlockIndex(Re,X.name),Ne.set(X,it))}function ke(X,Re){const it=d.get(Re).get(X);h.get(Re)!==it&&(n.uniformBlockBinding(Re,it,X.__bindingPointIndex),h.set(Re,it))}function Ae(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),i===!0&&(n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),p={},q=null,ne={},m={},y=new WeakMap,S=[],A=null,g=!1,_=null,M=null,w=null,B=null,T=null,b=null,L=null,R=new Pe(0,0,0),P=0,U=!1,K=null,ie=null,G=null,J=null,Z=null,Se.set(0,0,n.canvas.width,n.canvas.height),Te.set(0,0,n.canvas.width,n.canvas.height),a.reset(),l.reset(),f.reset()}return{buffers:{color:a,depth:l,stencil:f},enable:ot,disable:Le,bindFramebuffer:be,drawBuffers:z,useProgram:ve,setBlending:pe,setMaterial:Ve,setFlipSided:De,setCullFace:F,setLineWidth:I,setPolygonOffset:$,setScissorTest:_e,activeTexture:ye,bindTexture:me,unbindTexture:Ye,compressedTexImage2D:Be,compressedTexImage3D:Fe,texImage2D:tt,texImage3D:We,updateUBOMapping:Ge,uniformBlockBinding:ke,texStorage2D:yt,texStorage3D:ut,texSubImage2D:nt,texSubImage3D:dt,compressedTexSubImage2D:xe,compressedTexSubImage3D:It,scissor:W,viewport:ge,reset:Ae}}function dU(n,e,t,i,r,s,o){const a=r.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,f=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap;let d;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(F,I){return m?new OffscreenCanvas(F,I):Af("canvas")}function S(F,I,$,_e){let ye=1;if((F.width>_e||F.height>_e)&&(ye=_e/Math.max(F.width,F.height)),ye<1||I===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap){const me=I?$p:Math.floor,Ye=me(ye*F.width),Be=me(ye*F.height);d===void 0&&(d=y(Ye,Be));const Fe=$?y(Ye,Be):d;return Fe.width=Ye,Fe.height=Be,Fe.getContext("2d").drawImage(F,0,0,Ye,Be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+Ye+"x"+Be+")."),Fe}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function A(F){return n_(F.width)&&n_(F.height)}function g(F){return a?!1:F.wrapS!==Bn||F.wrapT!==Bn||F.minFilter!==gn&&F.minFilter!==ln}function _(F,I){return F.generateMipmaps&&I&&F.minFilter!==gn&&F.minFilter!==ln}function M(F){n.generateMipmap(F)}function w(F,I,$,_e,ye=!1){if(a===!1)return I;if(F!==null){if(n[F]!==void 0)return n[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let me=I;if(I===n.RED&&($===n.FLOAT&&(me=n.R32F),$===n.HALF_FLOAT&&(me=n.R16F),$===n.UNSIGNED_BYTE&&(me=n.R8)),I===n.RED_INTEGER&&($===n.UNSIGNED_BYTE&&(me=n.R8UI),$===n.UNSIGNED_SHORT&&(me=n.R16UI),$===n.UNSIGNED_INT&&(me=n.R32UI),$===n.BYTE&&(me=n.R8I),$===n.SHORT&&(me=n.R16I),$===n.INT&&(me=n.R32I)),I===n.RG&&($===n.FLOAT&&(me=n.RG32F),$===n.HALF_FLOAT&&(me=n.RG16F),$===n.UNSIGNED_BYTE&&(me=n.RG8)),I===n.RGBA){const Ye=ye?vf:Gt.getTransfer(_e);$===n.FLOAT&&(me=n.RGBA32F),$===n.HALF_FLOAT&&(me=n.RGBA16F),$===n.UNSIGNED_BYTE&&(me=Ye===Xt?n.SRGB8_ALPHA8:n.RGBA8),$===n.UNSIGNED_SHORT_4_4_4_4&&(me=n.RGBA4),$===n.UNSIGNED_SHORT_5_5_5_1&&(me=n.RGB5_A1)}return(me===n.R16F||me===n.R32F||me===n.RG16F||me===n.RG32F||me===n.RGBA16F||me===n.RGBA32F)&&e.get("EXT_color_buffer_float"),me}function B(F,I,$){return _(F,$)===!0||F.isFramebufferTexture&&F.minFilter!==gn&&F.minFilter!==ln?Math.log2(Math.max(I.width,I.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?I.mipmaps.length:1}function T(F){return F===gn||F===mf||F===fc?n.NEAREST:n.LINEAR}function b(F){const I=F.target;I.removeEventListener("dispose",b),R(I),I.isVideoTexture&&h.delete(I)}function L(F){const I=F.target;I.removeEventListener("dispose",L),U(I)}function R(F){const I=i.get(F);if(I.__webglInit===void 0)return;const $=F.source,_e=p.get($);if(_e){const ye=_e[I.__cacheKey];ye.usedTimes--,ye.usedTimes===0&&P(F),Object.keys(_e).length===0&&p.delete($)}i.remove(F)}function P(F){const I=i.get(F);n.deleteTexture(I.__webglTexture);const $=F.source,_e=p.get($);delete _e[I.__cacheKey],o.memory.textures--}function U(F){const I=F.texture,$=i.get(F),_e=i.get(I);if(_e.__webglTexture!==void 0&&(n.deleteTexture(_e.__webglTexture),o.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let ye=0;ye<6;ye++){if(Array.isArray($.__webglFramebuffer[ye]))for(let me=0;me<$.__webglFramebuffer[ye].length;me++)n.deleteFramebuffer($.__webglFramebuffer[ye][me]);else n.deleteFramebuffer($.__webglFramebuffer[ye]);$.__webglDepthbuffer&&n.deleteRenderbuffer($.__webglDepthbuffer[ye])}else{if(Array.isArray($.__webglFramebuffer))for(let ye=0;ye<$.__webglFramebuffer.length;ye++)n.deleteFramebuffer($.__webglFramebuffer[ye]);else n.deleteFramebuffer($.__webglFramebuffer);if($.__webglDepthbuffer&&n.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&n.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let ye=0;ye<$.__webglColorRenderbuffer.length;ye++)$.__webglColorRenderbuffer[ye]&&n.deleteRenderbuffer($.__webglColorRenderbuffer[ye]);$.__webglDepthRenderbuffer&&n.deleteRenderbuffer($.__webglDepthRenderbuffer)}if(F.isWebGLMultipleRenderTargets)for(let ye=0,me=I.length;ye<me;ye++){const Ye=i.get(I[ye]);Ye.__webglTexture&&(n.deleteTexture(Ye.__webglTexture),o.memory.textures--),i.remove(I[ye])}i.remove(I),i.remove(F)}let K=0;function ie(){K=0}function G(){const F=K;return F>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+r.maxTextures),K+=1,F}function J(F){const I=[];return I.push(F.wrapS),I.push(F.wrapT),I.push(F.wrapR||0),I.push(F.magFilter),I.push(F.minFilter),I.push(F.anisotropy),I.push(F.internalFormat),I.push(F.format),I.push(F.type),I.push(F.generateMipmaps),I.push(F.premultiplyAlpha),I.push(F.flipY),I.push(F.unpackAlignment),I.push(F.colorSpace),I.join()}function Z(F,I){const $=i.get(F);if(F.isVideoTexture&&Ve(F),F.isRenderTargetTexture===!1&&F.version>0&&$.__version!==F.version){const _e=F.image;if(_e===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(_e.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Se($,F,I);return}}t.bindTexture(n.TEXTURE_2D,$.__webglTexture,n.TEXTURE0+I)}function ae(F,I){const $=i.get(F);if(F.version>0&&$.__version!==F.version){Se($,F,I);return}t.bindTexture(n.TEXTURE_2D_ARRAY,$.__webglTexture,n.TEXTURE0+I)}function O(F,I){const $=i.get(F);if(F.version>0&&$.__version!==F.version){Se($,F,I);return}t.bindTexture(n.TEXTURE_3D,$.__webglTexture,n.TEXTURE0+I)}function V(F,I){const $=i.get(F);if(F.version>0&&$.__version!==F.version){Te($,F,I);return}t.bindTexture(n.TEXTURE_CUBE_MAP,$.__webglTexture,n.TEXTURE0+I)}const H={[us]:n.REPEAT,[Bn]:n.CLAMP_TO_EDGE,[Sc]:n.MIRRORED_REPEAT},q={[gn]:n.NEAREST,[mf]:n.NEAREST_MIPMAP_NEAREST,[fc]:n.NEAREST_MIPMAP_LINEAR,[ln]:n.LINEAR,[Am]:n.LINEAR_MIPMAP_NEAREST,[fs]:n.LINEAR_MIPMAP_LINEAR},ne={[lR]:n.NEVER,[pR]:n.ALWAYS,[cR]:n.LESS,[wx]:n.LEQUAL,[uR]:n.EQUAL,[dR]:n.GEQUAL,[fR]:n.GREATER,[hR]:n.NOTEQUAL};function Y(F,I,$){if($?(n.texParameteri(F,n.TEXTURE_WRAP_S,H[I.wrapS]),n.texParameteri(F,n.TEXTURE_WRAP_T,H[I.wrapT]),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,H[I.wrapR]),n.texParameteri(F,n.TEXTURE_MAG_FILTER,q[I.magFilter]),n.texParameteri(F,n.TEXTURE_MIN_FILTER,q[I.minFilter])):(n.texParameteri(F,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(F,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(I.wrapS!==Bn||I.wrapT!==Bn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(F,n.TEXTURE_MAG_FILTER,T(I.magFilter)),n.texParameteri(F,n.TEXTURE_MIN_FILTER,T(I.minFilter)),I.minFilter!==gn&&I.minFilter!==ln&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(n.texParameteri(F,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(F,n.TEXTURE_COMPARE_FUNC,ne[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const _e=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===gn||I.minFilter!==fc&&I.minFilter!==fs||I.type===Nr&&e.has("OES_texture_float_linear")===!1||a===!1&&I.type===Mc&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||i.get(I).__currentAnisotropy)&&(n.texParameterf(F,_e.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,r.getMaxAnisotropy())),i.get(I).__currentAnisotropy=I.anisotropy)}}function ue(F,I){let $=!1;F.__webglInit===void 0&&(F.__webglInit=!0,I.addEventListener("dispose",b));const _e=I.source;let ye=p.get(_e);ye===void 0&&(ye={},p.set(_e,ye));const me=J(I);if(me!==F.__cacheKey){ye[me]===void 0&&(ye[me]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,$=!0),ye[me].usedTimes++;const Ye=ye[F.__cacheKey];Ye!==void 0&&(ye[F.__cacheKey].usedTimes--,Ye.usedTimes===0&&P(I)),F.__cacheKey=me,F.__webglTexture=ye[me].texture}return $}function Se(F,I,$){let _e=n.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(_e=n.TEXTURE_2D_ARRAY),I.isData3DTexture&&(_e=n.TEXTURE_3D);const ye=ue(F,I),me=I.source;t.bindTexture(_e,F.__webglTexture,n.TEXTURE0+$);const Ye=i.get(me);if(me.version!==Ye.__version||ye===!0){t.activeTexture(n.TEXTURE0+$);const Be=Gt.getPrimaries(Gt.workingColorSpace),Fe=I.colorSpace===Wi?null:Gt.getPrimaries(I.colorSpace),nt=I.colorSpace===Wi||Be===Fe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,nt);const dt=g(I)&&A(I.image)===!1;let xe=S(I.image,dt,!1,r.maxTextureSize);xe=De(I,xe);const It=A(xe)||a,yt=s.convert(I.format,I.colorSpace);let ut=s.convert(I.type),tt=w(I.internalFormat,yt,ut,I.colorSpace,I.isVideoTexture);Y(_e,I,It);let We;const W=I.mipmaps,ge=a&&I.isVideoTexture!==!0&&tt!==Ax,Ge=Ye.__version===void 0||ye===!0,ke=B(I,xe,It);if(I.isDepthTexture)tt=n.DEPTH_COMPONENT,a?I.type===Nr?tt=n.DEPTH_COMPONENT32F:I.type===Fs?tt=n.DEPTH_COMPONENT24:I.type===Bo?tt=n.DEPTH24_STENCIL8:tt=n.DEPTH_COMPONENT16:I.type===Nr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===Io&&tt===n.DEPTH_COMPONENT&&I.type!==Sm&&I.type!==Fs&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=Fs,ut=s.convert(I.type)),I.format===za&&tt===n.DEPTH_COMPONENT&&(tt=n.DEPTH_STENCIL,I.type!==Bo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=Bo,ut=s.convert(I.type))),Ge&&(ge?t.texStorage2D(n.TEXTURE_2D,1,tt,xe.width,xe.height):t.texImage2D(n.TEXTURE_2D,0,tt,xe.width,xe.height,0,yt,ut,null));else if(I.isDataTexture)if(W.length>0&&It){ge&&Ge&&t.texStorage2D(n.TEXTURE_2D,ke,tt,W[0].width,W[0].height);for(let Ae=0,X=W.length;Ae<X;Ae++)We=W[Ae],ge?t.texSubImage2D(n.TEXTURE_2D,Ae,0,0,We.width,We.height,yt,ut,We.data):t.texImage2D(n.TEXTURE_2D,Ae,tt,We.width,We.height,0,yt,ut,We.data);I.generateMipmaps=!1}else ge?(Ge&&t.texStorage2D(n.TEXTURE_2D,ke,tt,xe.width,xe.height),t.texSubImage2D(n.TEXTURE_2D,0,0,0,xe.width,xe.height,yt,ut,xe.data)):t.texImage2D(n.TEXTURE_2D,0,tt,xe.width,xe.height,0,yt,ut,xe.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){ge&&Ge&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ke,tt,W[0].width,W[0].height,xe.depth);for(let Ae=0,X=W.length;Ae<X;Ae++)We=W[Ae],I.format!==vi?yt!==null?ge?t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Ae,0,0,0,We.width,We.height,xe.depth,yt,We.data,0,0):t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Ae,tt,We.width,We.height,xe.depth,0,We.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ge?t.texSubImage3D(n.TEXTURE_2D_ARRAY,Ae,0,0,0,We.width,We.height,xe.depth,yt,ut,We.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Ae,tt,We.width,We.height,xe.depth,0,yt,ut,We.data)}else{ge&&Ge&&t.texStorage2D(n.TEXTURE_2D,ke,tt,W[0].width,W[0].height);for(let Ae=0,X=W.length;Ae<X;Ae++)We=W[Ae],I.format!==vi?yt!==null?ge?t.compressedTexSubImage2D(n.TEXTURE_2D,Ae,0,0,We.width,We.height,yt,We.data):t.compressedTexImage2D(n.TEXTURE_2D,Ae,tt,We.width,We.height,0,We.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ge?t.texSubImage2D(n.TEXTURE_2D,Ae,0,0,We.width,We.height,yt,ut,We.data):t.texImage2D(n.TEXTURE_2D,Ae,tt,We.width,We.height,0,yt,ut,We.data)}else if(I.isDataArrayTexture)ge?(Ge&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ke,tt,xe.width,xe.height,xe.depth),t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,yt,ut,xe.data)):t.texImage3D(n.TEXTURE_2D_ARRAY,0,tt,xe.width,xe.height,xe.depth,0,yt,ut,xe.data);else if(I.isData3DTexture)ge?(Ge&&t.texStorage3D(n.TEXTURE_3D,ke,tt,xe.width,xe.height,xe.depth),t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,yt,ut,xe.data)):t.texImage3D(n.TEXTURE_3D,0,tt,xe.width,xe.height,xe.depth,0,yt,ut,xe.data);else if(I.isFramebufferTexture){if(Ge)if(ge)t.texStorage2D(n.TEXTURE_2D,ke,tt,xe.width,xe.height);else{let Ae=xe.width,X=xe.height;for(let Re=0;Re<ke;Re++)t.texImage2D(n.TEXTURE_2D,Re,tt,Ae,X,0,yt,ut,null),Ae>>=1,X>>=1}}else if(W.length>0&&It){ge&&Ge&&t.texStorage2D(n.TEXTURE_2D,ke,tt,W[0].width,W[0].height);for(let Ae=0,X=W.length;Ae<X;Ae++)We=W[Ae],ge?t.texSubImage2D(n.TEXTURE_2D,Ae,0,0,yt,ut,We):t.texImage2D(n.TEXTURE_2D,Ae,tt,yt,ut,We);I.generateMipmaps=!1}else ge?(Ge&&t.texStorage2D(n.TEXTURE_2D,ke,tt,xe.width,xe.height),t.texSubImage2D(n.TEXTURE_2D,0,0,0,yt,ut,xe)):t.texImage2D(n.TEXTURE_2D,0,tt,yt,ut,xe);_(I,It)&&M(_e),Ye.__version=me.version,I.onUpdate&&I.onUpdate(I)}F.__version=I.version}function Te(F,I,$){if(I.image.length!==6)return;const _e=ue(F,I),ye=I.source;t.bindTexture(n.TEXTURE_CUBE_MAP,F.__webglTexture,n.TEXTURE0+$);const me=i.get(ye);if(ye.version!==me.__version||_e===!0){t.activeTexture(n.TEXTURE0+$);const Ye=Gt.getPrimaries(Gt.workingColorSpace),Be=I.colorSpace===Wi?null:Gt.getPrimaries(I.colorSpace),Fe=I.colorSpace===Wi||Ye===Be?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Fe);const nt=I.isCompressedTexture||I.image[0].isCompressedTexture,dt=I.image[0]&&I.image[0].isDataTexture,xe=[];for(let Ae=0;Ae<6;Ae++)!nt&&!dt?xe[Ae]=S(I.image[Ae],!1,!0,r.maxCubemapSize):xe[Ae]=dt?I.image[Ae].image:I.image[Ae],xe[Ae]=De(I,xe[Ae]);const It=xe[0],yt=A(It)||a,ut=s.convert(I.format,I.colorSpace),tt=s.convert(I.type),We=w(I.internalFormat,ut,tt,I.colorSpace),W=a&&I.isVideoTexture!==!0,ge=me.__version===void 0||_e===!0;let Ge=B(I,It,yt);Y(n.TEXTURE_CUBE_MAP,I,yt);let ke;if(nt){W&&ge&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ge,We,It.width,It.height);for(let Ae=0;Ae<6;Ae++){ke=xe[Ae].mipmaps;for(let X=0;X<ke.length;X++){const Re=ke[X];I.format!==vi?ut!==null?W?t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X,0,0,Re.width,Re.height,ut,Re.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X,We,Re.width,Re.height,0,Re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):W?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X,0,0,Re.width,Re.height,ut,tt,Re.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X,We,Re.width,Re.height,0,ut,tt,Re.data)}}}else{ke=I.mipmaps,W&&ge&&(ke.length>0&&Ge++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Ge,We,xe[0].width,xe[0].height));for(let Ae=0;Ae<6;Ae++)if(dt){W?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0,0,0,xe[Ae].width,xe[Ae].height,ut,tt,xe[Ae].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0,We,xe[Ae].width,xe[Ae].height,0,ut,tt,xe[Ae].data);for(let X=0;X<ke.length;X++){const Ne=ke[X].image[Ae].image;W?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X+1,0,0,Ne.width,Ne.height,ut,tt,Ne.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X+1,We,Ne.width,Ne.height,0,ut,tt,Ne.data)}}else{W?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0,0,0,ut,tt,xe[Ae]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0,We,ut,tt,xe[Ae]);for(let X=0;X<ke.length;X++){const Re=ke[X];W?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X+1,0,0,ut,tt,Re.image[Ae]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,X+1,We,ut,tt,Re.image[Ae])}}}_(I,yt)&&M(n.TEXTURE_CUBE_MAP),me.__version=ye.version,I.onUpdate&&I.onUpdate(I)}F.__version=I.version}function Ce(F,I,$,_e,ye,me){const Ye=s.convert($.format,$.colorSpace),Be=s.convert($.type),Fe=w($.internalFormat,Ye,Be,$.colorSpace);if(!i.get(I).__hasExternalTextures){const dt=Math.max(1,I.width>>me),xe=Math.max(1,I.height>>me);ye===n.TEXTURE_3D||ye===n.TEXTURE_2D_ARRAY?t.texImage3D(ye,me,Fe,dt,xe,I.depth,0,Ye,Be,null):t.texImage2D(ye,me,Fe,dt,xe,0,Ye,Be,null)}t.bindFramebuffer(n.FRAMEBUFFER,F),pe(I)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,_e,ye,i.get($).__webglTexture,0,Me(I)):(ye===n.TEXTURE_2D||ye>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ye<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,_e,ye,i.get($).__webglTexture,me),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ze(F,I,$){if(n.bindRenderbuffer(n.RENDERBUFFER,F),I.depthBuffer&&!I.stencilBuffer){let _e=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if($||pe(I)){const ye=I.depthTexture;ye&&ye.isDepthTexture&&(ye.type===Nr?_e=n.DEPTH_COMPONENT32F:ye.type===Fs&&(_e=n.DEPTH_COMPONENT24));const me=Me(I);pe(I)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,me,_e,I.width,I.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,me,_e,I.width,I.height)}else n.renderbufferStorage(n.RENDERBUFFER,_e,I.width,I.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,F)}else if(I.depthBuffer&&I.stencilBuffer){const _e=Me(I);$&&pe(I)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,_e,n.DEPTH24_STENCIL8,I.width,I.height):pe(I)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,_e,n.DEPTH24_STENCIL8,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,I.width,I.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,F)}else{const _e=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let ye=0;ye<_e.length;ye++){const me=_e[ye],Ye=s.convert(me.format,me.colorSpace),Be=s.convert(me.type),Fe=w(me.internalFormat,Ye,Be,me.colorSpace),nt=Me(I);$&&pe(I)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,nt,Fe,I.width,I.height):pe(I)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,nt,Fe,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,Fe,I.width,I.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function ot(F,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,F),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(I.depthTexture).__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),Z(I.depthTexture,0);const _e=i.get(I.depthTexture).__webglTexture,ye=Me(I);if(I.depthTexture.format===Io)pe(I)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,_e,0,ye):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,_e,0);else if(I.depthTexture.format===za)pe(I)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,_e,0,ye):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,_e,0);else throw new Error("Unknown depthTexture format")}function Le(F){const I=i.get(F),$=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!I.__autoAllocateDepthBuffer){if($)throw new Error("target.depthTexture not supported in Cube render targets");ot(I.__webglFramebuffer,F)}else if($){I.__webglDepthbuffer=[];for(let _e=0;_e<6;_e++)t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer[_e]),I.__webglDepthbuffer[_e]=n.createRenderbuffer(),Ze(I.__webglDepthbuffer[_e],F,!1)}else t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer=n.createRenderbuffer(),Ze(I.__webglDepthbuffer,F,!1);t.bindFramebuffer(n.FRAMEBUFFER,null)}function be(F,I,$){const _e=i.get(F);I!==void 0&&Ce(_e.__webglFramebuffer,F,F.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),$!==void 0&&Le(F)}function z(F){const I=F.texture,$=i.get(F),_e=i.get(I);F.addEventListener("dispose",L),F.isWebGLMultipleRenderTargets!==!0&&(_e.__webglTexture===void 0&&(_e.__webglTexture=n.createTexture()),_e.__version=I.version,o.memory.textures++);const ye=F.isWebGLCubeRenderTarget===!0,me=F.isWebGLMultipleRenderTargets===!0,Ye=A(F)||a;if(ye){$.__webglFramebuffer=[];for(let Be=0;Be<6;Be++)if(a&&I.mipmaps&&I.mipmaps.length>0){$.__webglFramebuffer[Be]=[];for(let Fe=0;Fe<I.mipmaps.length;Fe++)$.__webglFramebuffer[Be][Fe]=n.createFramebuffer()}else $.__webglFramebuffer[Be]=n.createFramebuffer()}else{if(a&&I.mipmaps&&I.mipmaps.length>0){$.__webglFramebuffer=[];for(let Be=0;Be<I.mipmaps.length;Be++)$.__webglFramebuffer[Be]=n.createFramebuffer()}else $.__webglFramebuffer=n.createFramebuffer();if(me)if(r.drawBuffers){const Be=F.texture;for(let Fe=0,nt=Be.length;Fe<nt;Fe++){const dt=i.get(Be[Fe]);dt.__webglTexture===void 0&&(dt.__webglTexture=n.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&F.samples>0&&pe(F)===!1){const Be=me?I:[I];$.__webglMultisampledFramebuffer=n.createFramebuffer(),$.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,$.__webglMultisampledFramebuffer);for(let Fe=0;Fe<Be.length;Fe++){const nt=Be[Fe];$.__webglColorRenderbuffer[Fe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,$.__webglColorRenderbuffer[Fe]);const dt=s.convert(nt.format,nt.colorSpace),xe=s.convert(nt.type),It=w(nt.internalFormat,dt,xe,nt.colorSpace,F.isXRRenderTarget===!0),yt=Me(F);n.renderbufferStorageMultisample(n.RENDERBUFFER,yt,It,F.width,F.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.RENDERBUFFER,$.__webglColorRenderbuffer[Fe])}n.bindRenderbuffer(n.RENDERBUFFER,null),F.depthBuffer&&($.__webglDepthRenderbuffer=n.createRenderbuffer(),Ze($.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ye){t.bindTexture(n.TEXTURE_CUBE_MAP,_e.__webglTexture),Y(n.TEXTURE_CUBE_MAP,I,Ye);for(let Be=0;Be<6;Be++)if(a&&I.mipmaps&&I.mipmaps.length>0)for(let Fe=0;Fe<I.mipmaps.length;Fe++)Ce($.__webglFramebuffer[Be][Fe],F,I,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,Fe);else Ce($.__webglFramebuffer[Be],F,I,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0);_(I,Ye)&&M(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(me){const Be=F.texture;for(let Fe=0,nt=Be.length;Fe<nt;Fe++){const dt=Be[Fe],xe=i.get(dt);t.bindTexture(n.TEXTURE_2D,xe.__webglTexture),Y(n.TEXTURE_2D,dt,Ye),Ce($.__webglFramebuffer,F,dt,n.COLOR_ATTACHMENT0+Fe,n.TEXTURE_2D,0),_(dt,Ye)&&M(n.TEXTURE_2D)}t.unbindTexture()}else{let Be=n.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(a?Be=F.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Be,_e.__webglTexture),Y(Be,I,Ye),a&&I.mipmaps&&I.mipmaps.length>0)for(let Fe=0;Fe<I.mipmaps.length;Fe++)Ce($.__webglFramebuffer[Fe],F,I,n.COLOR_ATTACHMENT0,Be,Fe);else Ce($.__webglFramebuffer,F,I,n.COLOR_ATTACHMENT0,Be,0);_(I,Ye)&&M(Be),t.unbindTexture()}F.depthBuffer&&Le(F)}function ve(F){const I=A(F)||a,$=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let _e=0,ye=$.length;_e<ye;_e++){const me=$[_e];if(_(me,I)){const Ye=F.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Be=i.get(me).__webglTexture;t.bindTexture(Ye,Be),M(Ye),t.unbindTexture()}}}function he(F){if(a&&F.samples>0&&pe(F)===!1){const I=F.isWebGLMultipleRenderTargets?F.texture:[F.texture],$=F.width,_e=F.height;let ye=n.COLOR_BUFFER_BIT;const me=[],Ye=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Be=i.get(F),Fe=F.isWebGLMultipleRenderTargets===!0;if(Fe)for(let nt=0;nt<I.length;nt++)t.bindFramebuffer(n.FRAMEBUFFER,Be.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+nt,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Be.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+nt,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Be.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Be.__webglFramebuffer);for(let nt=0;nt<I.length;nt++){me.push(n.COLOR_ATTACHMENT0+nt),F.depthBuffer&&me.push(Ye);const dt=Be.__ignoreDepthValues!==void 0?Be.__ignoreDepthValues:!1;if(dt===!1&&(F.depthBuffer&&(ye|=n.DEPTH_BUFFER_BIT),F.stencilBuffer&&(ye|=n.STENCIL_BUFFER_BIT)),Fe&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Be.__webglColorRenderbuffer[nt]),dt===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[Ye]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[Ye])),Fe){const xe=i.get(I[nt]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,xe,0)}n.blitFramebuffer(0,0,$,_e,0,0,$,_e,ye,n.NEAREST),f&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,me)}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Fe)for(let nt=0;nt<I.length;nt++){t.bindFramebuffer(n.FRAMEBUFFER,Be.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+nt,n.RENDERBUFFER,Be.__webglColorRenderbuffer[nt]);const dt=i.get(I[nt]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Be.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+nt,n.TEXTURE_2D,dt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Be.__webglMultisampledFramebuffer)}}function Me(F){return Math.min(r.maxSamples,F.samples)}function pe(F){const I=i.get(F);return a&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function Ve(F){const I=o.render.frame;h.get(F)!==I&&(h.set(F,I),F.update())}function De(F,I){const $=F.colorSpace,_e=F.format,ye=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===qp||$!==hs&&$!==Wi&&(Gt.getTransfer($)===Xt?a===!1?e.has("EXT_sRGB")===!0&&_e===vi?(F.format=qp,F.minFilter=ln,F.generateMipmaps=!1):I=Cx.sRGBToLinear(I):(_e!==vi||ye!==as)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",$)),I}this.allocateTextureUnit=G,this.resetTextureUnits=ie,this.setTexture2D=Z,this.setTexture2DArray=ae,this.setTexture3D=O,this.setTextureCube=V,this.rebindTextures=be,this.setupRenderTarget=z,this.updateRenderTargetMipmap=ve,this.updateMultisampleRenderTarget=he,this.setupDepthRenderbuffer=Le,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=pe}function bR(n,e,t){const i=t.isWebGL2;function r(s,o=Wi){let a;const l=Gt.getTransfer(o);if(s===as)return n.UNSIGNED_BYTE;if(s===gx)return n.UNSIGNED_SHORT_4_4_4_4;if(s===vx)return n.UNSIGNED_SHORT_5_5_5_1;if(s===jC)return n.BYTE;if(s===KC)return n.SHORT;if(s===Sm)return n.UNSIGNED_SHORT;if(s===mx)return n.INT;if(s===Fs)return n.UNSIGNED_INT;if(s===Nr)return n.FLOAT;if(s===Mc)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===YC)return n.ALPHA;if(s===vi)return n.RGBA;if(s===QC)return n.LUMINANCE;if(s===ZC)return n.LUMINANCE_ALPHA;if(s===Io)return n.DEPTH_COMPONENT;if(s===za)return n.DEPTH_STENCIL;if(s===qp)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===qC)return n.RED;if(s===yx)return n.RED_INTEGER;if(s===$C)return n.RG;if(s===_x)return n.RG_INTEGER;if(s===xx)return n.RGBA_INTEGER;if(s===vp||s===yp||s===_p||s===xp)if(l===Xt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===vp)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===yp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===_p)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===xp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===vp)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===yp)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===_p)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===xp)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===by||s===Py||s===By||s===Iy)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===by)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Py)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===By)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Iy)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Ax)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Ly||s===Dy)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Ly)return l===Xt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Dy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Fy||s===Ny||s===Uy||s===Oy||s===ky||s===zy||s===Gy||s===Hy||s===Vy||s===Wy||s===Xy||s===Jy||s===jy||s===Ky)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Fy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Ny)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Uy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Oy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ky)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===zy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Gy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Hy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Vy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Wy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Xy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Jy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===jy)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Ky)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Ap||s===Yy||s===Qy)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Ap)return l===Xt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Yy)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Qy)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===eR||s===Zy||s===qy||s===$y)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Ap)return a.COMPRESSED_RED_RGTC1_EXT;if(s===Zy)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===qy)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===$y)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Bo?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class PR extends Qt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Or extends wt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pU={type:"move"};class qv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Or,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Or,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Or,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(f&&e.hand){o=!0;for(const S of e.hand.values()){const A=t.getJointPose(S,i),g=this._getHandJoint(f,S);A!==null&&(g.matrix.fromArray(A.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=A.radius),g.visible=A!==null}const h=f.joints["index-finger-tip"],d=f.joints["thumb-tip"],p=h.position.distanceTo(d.position),m=.02,y=.005;f.inputState.pinching&&p>m+y?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&p<=m-y&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(pU)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),f!==null&&(f.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Or;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class mU extends Ks{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,f=null,h=null,d=null,p=null,m=null,y=null;const S=t.getContextAttributes();let A=null,g=null;const _=[],M=[],w=new de;let B=null;const T=new Qt;T.layers.enable(1),T.viewport=new Nt;const b=new Qt;b.layers.enable(2),b.viewport=new Nt;const L=[T,b],R=new PR;R.layers.enable(1),R.layers.enable(2);let P=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let ue=_[Y];return ue===void 0&&(ue=new qv,_[Y]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(Y){let ue=_[Y];return ue===void 0&&(ue=new qv,_[Y]=ue),ue.getGripSpace()},this.getHand=function(Y){let ue=_[Y];return ue===void 0&&(ue=new qv,_[Y]=ue),ue.getHandSpace()};function K(Y){const ue=M.indexOf(Y.inputSource);if(ue===-1)return;const Se=_[ue];Se!==void 0&&(Se.update(Y.inputSource,Y.frame,f||o),Se.dispatchEvent({type:Y.type,data:Y.inputSource}))}function ie(){r.removeEventListener("select",K),r.removeEventListener("selectstart",K),r.removeEventListener("selectend",K),r.removeEventListener("squeeze",K),r.removeEventListener("squeezestart",K),r.removeEventListener("squeezeend",K),r.removeEventListener("end",ie),r.removeEventListener("inputsourceschange",G);for(let Y=0;Y<_.length;Y++){const ue=M[Y];ue!==null&&(M[Y]=null,_[Y].disconnect(ue))}P=null,U=null,e.setRenderTarget(A),m=null,p=null,d=null,r=null,g=null,ne.stop(),i.isPresenting=!1,e.setPixelRatio(B),e.setSize(w.width,w.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||o},this.setReferenceSpace=function(Y){f=Y},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return d},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Y){if(r=Y,r!==null){if(A=e.getRenderTarget(),r.addEventListener("select",K),r.addEventListener("selectstart",K),r.addEventListener("selectend",K),r.addEventListener("squeeze",K),r.addEventListener("squeezestart",K),r.addEventListener("squeezeend",K),r.addEventListener("end",ie),r.addEventListener("inputsourceschange",G),S.xrCompatible!==!0&&await t.makeXRCompatible(),B=e.getPixelRatio(),e.getSize(w),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const ue={antialias:r.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,ue),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),g=new Hr(m.framebufferWidth,m.framebufferHeight,{format:vi,type:as,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil})}else{let ue=null,Se=null,Te=null;S.depth&&(Te=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ue=S.stencil?za:Io,Se=S.stencil?Bo:Fs);const Ce={colorFormat:t.RGBA8,depthFormat:Te,scaleFactor:s};d=new XRWebGLBinding(r,t),p=d.createProjectionLayer(Ce),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),g=new Hr(p.textureWidth,p.textureHeight,{format:vi,type:as,depthTexture:new Bx(p.textureWidth,p.textureHeight,Se,void 0,void 0,void 0,void 0,void 0,void 0,ue),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0});const Ze=e.properties.get(g);Ze.__ignoreDepthValues=p.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(l),f=null,o=await r.requestReferenceSpace(a),ne.setContext(r),ne.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function G(Y){for(let ue=0;ue<Y.removed.length;ue++){const Se=Y.removed[ue],Te=M.indexOf(Se);Te>=0&&(M[Te]=null,_[Te].disconnect(Se))}for(let ue=0;ue<Y.added.length;ue++){const Se=Y.added[ue];let Te=M.indexOf(Se);if(Te===-1){for(let Ze=0;Ze<_.length;Ze++)if(Ze>=M.length){M.push(Se),Te=Ze;break}else if(M[Ze]===null){M[Ze]=Se,Te=Ze;break}if(Te===-1)break}const Ce=_[Te];Ce&&Ce.connect(Se)}}const J=new D,Z=new D;function ae(Y,ue,Se){J.setFromMatrixPosition(ue.matrixWorld),Z.setFromMatrixPosition(Se.matrixWorld);const Te=J.distanceTo(Z),Ce=ue.projectionMatrix.elements,Ze=Se.projectionMatrix.elements,ot=Ce[14]/(Ce[10]-1),Le=Ce[14]/(Ce[10]+1),be=(Ce[9]+1)/Ce[5],z=(Ce[9]-1)/Ce[5],ve=(Ce[8]-1)/Ce[0],he=(Ze[8]+1)/Ze[0],Me=ot*ve,pe=ot*he,Ve=Te/(-ve+he),De=Ve*-ve;ue.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(De),Y.translateZ(Ve),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();const F=ot+Ve,I=Le+Ve,$=Me-De,_e=pe+(Te-De),ye=be*Le/I*F,me=z*Le/I*F;Y.projectionMatrix.makePerspective($,_e,ye,me,F,I),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}function O(Y,ue){ue===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(ue.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;R.near=b.near=T.near=Y.near,R.far=b.far=T.far=Y.far,(P!==R.near||U!==R.far)&&(r.updateRenderState({depthNear:R.near,depthFar:R.far}),P=R.near,U=R.far);const ue=Y.parent,Se=R.cameras;O(R,ue);for(let Te=0;Te<Se.length;Te++)O(Se[Te],ue);Se.length===2?ae(R,T,b):R.projectionMatrix.copy(T.projectionMatrix),V(Y,R,ue)};function V(Y,ue,Se){Se===null?Y.matrix.copy(ue.matrixWorld):(Y.matrix.copy(Se.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(ue.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(ue.projectionMatrix),Y.projectionMatrixInverse.copy(ue.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=Tc*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(Y){l=Y,p!==null&&(p.fixedFoveation=Y),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=Y)};let H=null;function q(Y,ue){if(h=ue.getViewerPose(f||o),y=ue,h!==null){const Se=h.views;m!==null&&(e.setRenderTargetFramebuffer(g,m.framebuffer),e.setRenderTarget(g));let Te=!1;Se.length!==R.cameras.length&&(R.cameras.length=0,Te=!0);for(let Ce=0;Ce<Se.length;Ce++){const Ze=Se[Ce];let ot=null;if(m!==null)ot=m.getViewport(Ze);else{const be=d.getViewSubImage(p,Ze);ot=be.viewport,Ce===0&&(e.setRenderTargetTextures(g,be.colorTexture,p.ignoreDepthValues?void 0:be.depthStencilTexture),e.setRenderTarget(g))}let Le=L[Ce];Le===void 0&&(Le=new Qt,Le.layers.enable(Ce),Le.viewport=new Nt,L[Ce]=Le),Le.matrix.fromArray(Ze.transform.matrix),Le.matrix.decompose(Le.position,Le.quaternion,Le.scale),Le.projectionMatrix.fromArray(Ze.projectionMatrix),Le.projectionMatrixInverse.copy(Le.projectionMatrix).invert(),Le.viewport.set(ot.x,ot.y,ot.width,ot.height),Ce===0&&(R.matrix.copy(Le.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),Te===!0&&R.cameras.push(Le)}}for(let Se=0;Se<_.length;Se++){const Te=M[Se],Ce=_[Se];Te!==null&&Ce!==void 0&&Ce.update(Te,ue,f||o)}H&&H(Y,ue),ue.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ue}),y=null}const ne=new MR;ne.setAnimationLoop(q),this.setAnimationLoop=function(Y){H=Y},this.dispose=function(){}}}function gU(n,e){function t(A,g){A.matrixAutoUpdate===!0&&A.updateMatrix(),g.value.copy(A.matrix)}function i(A,g){g.color.getRGB(A.fogColor.value,_R(n)),g.isFog?(A.fogNear.value=g.near,A.fogFar.value=g.far):g.isFogExp2&&(A.fogDensity.value=g.density)}function r(A,g,_,M,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(A,g):g.isMeshToonMaterial?(s(A,g),d(A,g)):g.isMeshPhongMaterial?(s(A,g),h(A,g)):g.isMeshStandardMaterial?(s(A,g),p(A,g),g.isMeshPhysicalMaterial&&m(A,g,w)):g.isMeshMatcapMaterial?(s(A,g),y(A,g)):g.isMeshDepthMaterial?s(A,g):g.isMeshDistanceMaterial?(s(A,g),S(A,g)):g.isMeshNormalMaterial?s(A,g):g.isLineBasicMaterial?(o(A,g),g.isLineDashedMaterial&&a(A,g)):g.isPointsMaterial?l(A,g,_,M):g.isSpriteMaterial?f(A,g):g.isShadowMaterial?(A.color.value.copy(g.color),A.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(A,g){A.opacity.value=g.opacity,g.color&&A.diffuse.value.copy(g.color),g.emissive&&A.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(A.map.value=g.map,t(g.map,A.mapTransform)),g.alphaMap&&(A.alphaMap.value=g.alphaMap,t(g.alphaMap,A.alphaMapTransform)),g.bumpMap&&(A.bumpMap.value=g.bumpMap,t(g.bumpMap,A.bumpMapTransform),A.bumpScale.value=g.bumpScale,g.side===_i&&(A.bumpScale.value*=-1)),g.normalMap&&(A.normalMap.value=g.normalMap,t(g.normalMap,A.normalMapTransform),A.normalScale.value.copy(g.normalScale),g.side===_i&&A.normalScale.value.negate()),g.displacementMap&&(A.displacementMap.value=g.displacementMap,t(g.displacementMap,A.displacementMapTransform),A.displacementScale.value=g.displacementScale,A.displacementBias.value=g.displacementBias),g.emissiveMap&&(A.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,A.emissiveMapTransform)),g.specularMap&&(A.specularMap.value=g.specularMap,t(g.specularMap,A.specularMapTransform)),g.alphaTest>0&&(A.alphaTest.value=g.alphaTest);const _=e.get(g).envMap;if(_&&(A.envMap.value=_,A.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,A.reflectivity.value=g.reflectivity,A.ior.value=g.ior,A.refractionRatio.value=g.refractionRatio),g.lightMap){A.lightMap.value=g.lightMap;const M=n._useLegacyLights===!0?Math.PI:1;A.lightMapIntensity.value=g.lightMapIntensity*M,t(g.lightMap,A.lightMapTransform)}g.aoMap&&(A.aoMap.value=g.aoMap,A.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,A.aoMapTransform))}function o(A,g){A.diffuse.value.copy(g.color),A.opacity.value=g.opacity,g.map&&(A.map.value=g.map,t(g.map,A.mapTransform))}function a(A,g){A.dashSize.value=g.dashSize,A.totalSize.value=g.dashSize+g.gapSize,A.scale.value=g.scale}function l(A,g,_,M){A.diffuse.value.copy(g.color),A.opacity.value=g.opacity,A.size.value=g.size*_,A.scale.value=M*.5,g.map&&(A.map.value=g.map,t(g.map,A.uvTransform)),g.alphaMap&&(A.alphaMap.value=g.alphaMap,t(g.alphaMap,A.alphaMapTransform)),g.alphaTest>0&&(A.alphaTest.value=g.alphaTest)}function f(A,g){A.diffuse.value.copy(g.color),A.opacity.value=g.opacity,A.rotation.value=g.rotation,g.map&&(A.map.value=g.map,t(g.map,A.mapTransform)),g.alphaMap&&(A.alphaMap.value=g.alphaMap,t(g.alphaMap,A.alphaMapTransform)),g.alphaTest>0&&(A.alphaTest.value=g.alphaTest)}function h(A,g){A.specular.value.copy(g.specular),A.shininess.value=Math.max(g.shininess,1e-4)}function d(A,g){g.gradientMap&&(A.gradientMap.value=g.gradientMap)}function p(A,g){A.metalness.value=g.metalness,g.metalnessMap&&(A.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,A.metalnessMapTransform)),A.roughness.value=g.roughness,g.roughnessMap&&(A.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,A.roughnessMapTransform)),e.get(g).envMap&&(A.envMapIntensity.value=g.envMapIntensity)}function m(A,g,_){A.ior.value=g.ior,g.sheen>0&&(A.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),A.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(A.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,A.sheenColorMapTransform)),g.sheenRoughnessMap&&(A.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,A.sheenRoughnessMapTransform))),g.clearcoat>0&&(A.clearcoat.value=g.clearcoat,A.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(A.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,A.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(A.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,A.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(A.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,A.clearcoatNormalMapTransform),A.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===_i&&A.clearcoatNormalScale.value.negate())),g.iridescence>0&&(A.iridescence.value=g.iridescence,A.iridescenceIOR.value=g.iridescenceIOR,A.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(A.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,A.iridescenceMapTransform)),g.iridescenceThicknessMap&&(A.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,A.iridescenceThicknessMapTransform))),g.transmission>0&&(A.transmission.value=g.transmission,A.transmissionSamplerMap.value=_.texture,A.transmissionSamplerSize.value.set(_.width,_.height),g.transmissionMap&&(A.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,A.transmissionMapTransform)),A.thickness.value=g.thickness,g.thicknessMap&&(A.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,A.thicknessMapTransform)),A.attenuationDistance.value=g.attenuationDistance,A.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(A.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(A.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,A.anisotropyMapTransform))),A.specularIntensity.value=g.specularIntensity,A.specularColor.value.copy(g.specularColor),g.specularColorMap&&(A.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,A.specularColorMapTransform)),g.specularIntensityMap&&(A.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,A.specularIntensityMapTransform))}function y(A,g){g.matcap&&(A.matcap.value=g.matcap)}function S(A,g){const _=e.get(g).light;A.referencePosition.value.setFromMatrixPosition(_.matrixWorld),A.nearDistance.value=_.shadow.camera.near,A.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function vU(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,M){const w=M.program;i.uniformBlockBinding(_,w)}function f(_,M){let w=r[_.id];w===void 0&&(y(_),w=h(_),r[_.id]=w,_.addEventListener("dispose",A));const B=M.program;i.updateUBOMapping(_,B);const T=e.render.frame;s[_.id]!==T&&(p(_),s[_.id]=T)}function h(_){const M=d();_.__bindingPointIndex=M;const w=n.createBuffer(),B=_.__size,T=_.usage;return n.bindBuffer(n.UNIFORM_BUFFER,w),n.bufferData(n.UNIFORM_BUFFER,B,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,M,w),w}function d(){for(let _=0;_<a;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(_){const M=r[_.id],w=_.uniforms,B=_.__cache;n.bindBuffer(n.UNIFORM_BUFFER,M);for(let T=0,b=w.length;T<b;T++){const L=Array.isArray(w[T])?w[T]:[w[T]];for(let R=0,P=L.length;R<P;R++){const U=L[R];if(m(U,T,R,B)===!0){const K=U.__offset,ie=Array.isArray(U.value)?U.value:[U.value];let G=0;for(let J=0;J<ie.length;J++){const Z=ie[J],ae=S(Z);typeof Z=="number"||typeof Z=="boolean"?(U.__data[0]=Z,n.bufferSubData(n.UNIFORM_BUFFER,K+G,U.__data)):Z.isMatrix3?(U.__data[0]=Z.elements[0],U.__data[1]=Z.elements[1],U.__data[2]=Z.elements[2],U.__data[3]=0,U.__data[4]=Z.elements[3],U.__data[5]=Z.elements[4],U.__data[6]=Z.elements[5],U.__data[7]=0,U.__data[8]=Z.elements[6],U.__data[9]=Z.elements[7],U.__data[10]=Z.elements[8],U.__data[11]=0):(Z.toArray(U.__data,G),G+=ae.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,K,U.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(_,M,w,B){const T=_.value,b=M+"_"+w;if(B[b]===void 0)return typeof T=="number"||typeof T=="boolean"?B[b]=T:B[b]=T.clone(),!0;{const L=B[b];if(typeof T=="number"||typeof T=="boolean"){if(L!==T)return B[b]=T,!0}else if(L.equals(T)===!1)return L.copy(T),!0}return!1}function y(_){const M=_.uniforms;let w=0;const B=16;for(let b=0,L=M.length;b<L;b++){const R=Array.isArray(M[b])?M[b]:[M[b]];for(let P=0,U=R.length;P<U;P++){const K=R[P],ie=Array.isArray(K.value)?K.value:[K.value];for(let G=0,J=ie.length;G<J;G++){const Z=ie[G],ae=S(Z),O=w%B;O!==0&&B-O<ae.boundary&&(w+=B-O),K.__data=new Float32Array(ae.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=w,w+=ae.storage}}}const T=w%B;return T>0&&(w+=B-T),_.__size=w,_.__cache={},this}function S(_){const M={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(M.boundary=4,M.storage=4):_.isVector2?(M.boundary=8,M.storage=8):_.isVector3||_.isColor?(M.boundary=16,M.storage=12):_.isVector4?(M.boundary=16,M.storage=16):_.isMatrix3?(M.boundary=48,M.storage=48):_.isMatrix4?(M.boundary=64,M.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),M}function A(_){const M=_.target;M.removeEventListener("dispose",A);const w=o.indexOf(M.__bindingPointIndex);o.splice(w,1),n.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function g(){for(const _ in r)n.deleteBuffer(r[_]);o=[],r={},s={}}return{bind:l,update:f,dispose:g}}class Dx{constructor(e={}){const{canvas:t=gR(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:f=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let p;i!==null?p=i.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),y=new Int32Array(4);let S=null,A=null;const g=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Pn,this._useLegacyLights=!1,this.toneMapping=os,this.toneMappingExposure=1;const M=this;let w=!1,B=0,T=0,b=null,L=-1,R=null;const P=new Nt,U=new Nt;let K=null;const ie=new Pe(0);let G=0,J=t.width,Z=t.height,ae=1,O=null,V=null;const H=new Nt(0,0,J,Z),q=new Nt(0,0,J,Z);let ne=!1;const Y=new Of;let ue=!1,Se=!1,Te=null;const Ce=new Ue,Ze=new de,ot=new D,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function be(){return b===null?ae:1}let z=i;function ve(N,ee){for(let oe=0;oe<N.length;oe++){const le=N[oe],re=t.getContext(le,ee);if(re!==null)return re}return null}try{const N={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:f,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Lf}`),t.addEventListener("webglcontextlost",Ae,!1),t.addEventListener("webglcontextrestored",X,!1),t.addEventListener("webglcontextcreationerror",Re,!1),z===null){const ee=["webgl2","webgl","experimental-webgl"];if(M.isWebGL1Renderer===!0&&ee.shift(),z=ve(ee,N),z===null)throw ve(ee)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&z instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),z.getShaderPrecisionFormat===void 0&&(z.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let he,Me,pe,Ve,De,F,I,$,_e,ye,me,Ye,Be,Fe,nt,dt,xe,It,yt,ut,tt,We,W,ge;function Ge(){he=new B3(z),Me=new w3(z,he,e),he.init(Me),We=new bR(z,he,Me),pe=new hU(z,he,Me),Ve=new D3(z),De=new eU,F=new dU(z,he,pe,De,Me,We,Ve),I=new C3(M),$=new P3(M),_e=new H2(z,Me),W=new M3(z,he,_e,Me),ye=new I3(z,_e,Ve,W),me=new O3(z,ye,_e,Ve),yt=new U3(z,Me,F),dt=new T3(De),Ye=new $N(M,I,$,he,Me,W,dt),Be=new gU(M,De),Fe=new nU,nt=new lU(he,Me),It=new S3(M,I,$,pe,me,p,l),xe=new fU(M,me,Me),ge=new vU(z,Ve,Me,pe),ut=new E3(z,he,Ve,Me),tt=new L3(z,he,Ve,Me),Ve.programs=Ye.programs,M.capabilities=Me,M.extensions=he,M.properties=De,M.renderLists=Fe,M.shadowMap=xe,M.state=pe,M.info=Ve}Ge();const ke=new mU(M,z);this.xr=ke,this.getContext=function(){return z},this.getContextAttributes=function(){return z.getContextAttributes()},this.forceContextLoss=function(){const N=he.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=he.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return ae},this.setPixelRatio=function(N){N!==void 0&&(ae=N,this.setSize(J,Z,!1))},this.getSize=function(N){return N.set(J,Z)},this.setSize=function(N,ee,oe=!0){if(ke.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}J=N,Z=ee,t.width=Math.floor(N*ae),t.height=Math.floor(ee*ae),oe===!0&&(t.style.width=N+"px",t.style.height=ee+"px"),this.setViewport(0,0,N,ee)},this.getDrawingBufferSize=function(N){return N.set(J*ae,Z*ae).floor()},this.setDrawingBufferSize=function(N,ee,oe){J=N,Z=ee,ae=oe,t.width=Math.floor(N*oe),t.height=Math.floor(ee*oe),this.setViewport(0,0,N,ee)},this.getCurrentViewport=function(N){return N.copy(P)},this.getViewport=function(N){return N.copy(H)},this.setViewport=function(N,ee,oe,le){N.isVector4?H.set(N.x,N.y,N.z,N.w):H.set(N,ee,oe,le),pe.viewport(P.copy(H).multiplyScalar(ae).floor())},this.getScissor=function(N){return N.copy(q)},this.setScissor=function(N,ee,oe,le){N.isVector4?q.set(N.x,N.y,N.z,N.w):q.set(N,ee,oe,le),pe.scissor(U.copy(q).multiplyScalar(ae).floor())},this.getScissorTest=function(){return ne},this.setScissorTest=function(N){pe.setScissorTest(ne=N)},this.setOpaqueSort=function(N){O=N},this.setTransparentSort=function(N){V=N},this.getClearColor=function(N){return N.copy(It.getClearColor())},this.setClearColor=function(){It.setClearColor.apply(It,arguments)},this.getClearAlpha=function(){return It.getClearAlpha()},this.setClearAlpha=function(){It.setClearAlpha.apply(It,arguments)},this.clear=function(N=!0,ee=!0,oe=!0){let le=0;if(N){let re=!1;if(b!==null){const He=b.texture.format;re=He===xx||He===_x||He===yx}if(re){const He=b.texture.type,$e=He===as||He===Fs||He===Sm||He===Bo||He===gx||He===vx,at=It.getClearColor(),lt=It.getClearAlpha(),pt=at.r,ft=at.g,mt=at.b;$e?(m[0]=pt,m[1]=ft,m[2]=mt,m[3]=lt,z.clearBufferuiv(z.COLOR,0,m)):(y[0]=pt,y[1]=ft,y[2]=mt,y[3]=lt,z.clearBufferiv(z.COLOR,0,y))}else le|=z.COLOR_BUFFER_BIT}ee&&(le|=z.DEPTH_BUFFER_BIT),oe&&(le|=z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z.clear(le)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ae,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Re,!1),Fe.dispose(),nt.dispose(),De.dispose(),I.dispose(),$.dispose(),me.dispose(),W.dispose(),ge.dispose(),Ye.dispose(),ke.dispose(),ke.removeEventListener("sessionstart",tn),ke.removeEventListener("sessionend",Ft),Te&&(Te.dispose(),Te=null),Wn.stop()};function Ae(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function X(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const N=Ve.autoReset,ee=xe.enabled,oe=xe.autoUpdate,le=xe.needsUpdate,re=xe.type;Ge(),Ve.autoReset=N,xe.enabled=ee,xe.autoUpdate=oe,xe.needsUpdate=le,xe.type=re}function Re(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function Ne(N){const ee=N.target;ee.removeEventListener("dispose",Ne),it(ee)}function it(N){Qe(N),De.remove(N)}function Qe(N){const ee=De.get(N).programs;ee!==void 0&&(ee.forEach(function(oe){Ye.releaseProgram(oe)}),N.isShaderMaterial&&Ye.releaseShaderCache(N))}this.renderBufferDirect=function(N,ee,oe,le,re,He){ee===null&&(ee=Le);const $e=re.isMesh&&re.matrixWorld.determinant()<0,at=Zm(N,ee,oe,le,re);pe.setMaterial(le,$e);let lt=oe.index,pt=1;if(le.wireframe===!0){if(lt=ye.getWireframeAttribute(oe),lt===void 0)return;pt=2}const ft=oe.drawRange,mt=oe.attributes.position;let sn=ft.start*pt,Xn=(ft.start+ft.count)*pt;He!==null&&(sn=Math.max(sn,He.start*pt),Xn=Math.min(Xn,(He.start+He.count)*pt)),lt!==null?(sn=Math.max(sn,0),Xn=Math.min(Xn,lt.count)):mt!=null&&(sn=Math.max(sn,0),Xn=Math.min(Xn,mt.count));const Kt=Xn-sn;if(Kt<0||Kt===1/0)return;W.setup(re,le,at,oe,lt);let Nn,ct=ut;if(lt!==null&&(Nn=_e.get(lt),ct=tt,ct.setIndex(Nn)),re.isMesh)le.wireframe===!0?(pe.setLineWidth(le.wireframeLinewidth*be()),ct.setMode(z.LINES)):ct.setMode(z.TRIANGLES);else if(re.isLine){let je=le.linewidth;je===void 0&&(je=1),pe.setLineWidth(je*be()),re.isLineSegments?ct.setMode(z.LINES):re.isLineLoop?ct.setMode(z.LINE_LOOP):ct.setMode(z.LINE_STRIP)}else re.isPoints?ct.setMode(z.POINTS):re.isSprite&&ct.setMode(z.TRIANGLES);if(re.isBatchedMesh)ct.renderMultiDraw(re._multiDrawStarts,re._multiDrawCounts,re._multiDrawCount);else if(re.isInstancedMesh)ct.renderInstances(sn,Kt,re.count);else if(oe.isInstancedBufferGeometry){const je=oe._maxInstanceCount!==void 0?oe._maxInstanceCount:1/0,$i=Math.min(oe.instanceCount,je);ct.renderInstances(sn,Kt,$i)}else ct.render(sn,Kt)};function Tt(N,ee,oe){N.transparent===!0&&N.side===pr&&N.forceSinglePass===!1?(N.side=_i,N.needsUpdate=!0,$a(N,ee,oe),N.side=cs,N.needsUpdate=!0,$a(N,ee,oe),N.side=pr):$a(N,ee,oe)}this.compile=function(N,ee,oe=null){oe===null&&(oe=N),A=nt.get(oe),A.init(),_.push(A),oe.traverseVisible(function(re){re.isLight&&re.layers.test(ee.layers)&&(A.pushLight(re),re.castShadow&&A.pushShadow(re))}),N!==oe&&N.traverseVisible(function(re){re.isLight&&re.layers.test(ee.layers)&&(A.pushLight(re),re.castShadow&&A.pushShadow(re))}),A.setupLights(M._useLegacyLights);const le=new Set;return N.traverse(function(re){const He=re.material;if(He)if(Array.isArray(He))for(let $e=0;$e<He.length;$e++){const at=He[$e];Tt(at,oe,re),le.add(at)}else Tt(He,oe,re),le.add(He)}),_.pop(),A=null,le},this.compileAsync=function(N,ee,oe=null){const le=this.compile(N,ee,oe);return new Promise(re=>{function He(){if(le.forEach(function($e){De.get($e).currentProgram.isReady()&&le.delete($e)}),le.size===0){re(N);return}setTimeout(He,10)}he.get("KHR_parallel_shader_compile")!==null?He():setTimeout(He,10)})};let Lt=null;function Vt(N){Lt&&Lt(N)}function tn(){Wn.stop()}function Ft(){Wn.start()}const Wn=new MR;Wn.setAnimationLoop(Vt),typeof self<"u"&&Wn.setContext(self),this.setAnimationLoop=function(N){Lt=N,ke.setAnimationLoop(N),N===null?Wn.stop():Wn.start()},ke.addEventListener("sessionstart",tn),ke.addEventListener("sessionend",Ft),this.render=function(N,ee){if(ee!==void 0&&ee.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),ee.parent===null&&ee.matrixWorldAutoUpdate===!0&&ee.updateMatrixWorld(),ke.enabled===!0&&ke.isPresenting===!0&&(ke.cameraAutoUpdate===!0&&ke.updateCamera(ee),ee=ke.getCamera()),N.isScene===!0&&N.onBeforeRender(M,N,ee,b),A=nt.get(N,_.length),A.init(),_.push(A),Ce.multiplyMatrices(ee.projectionMatrix,ee.matrixWorldInverse),Y.setFromProjectionMatrix(Ce),Se=this.localClippingEnabled,ue=dt.init(this.clippingPlanes,Se),S=Fe.get(N,g.length),S.init(),g.push(S),qi(N,ee,0,M.sortObjects),S.finish(),M.sortObjects===!0&&S.sort(O,V),this.info.render.frame++,ue===!0&&dt.beginShadows();const oe=A.state.shadowsArray;if(xe.render(oe,N,ee),ue===!0&&dt.endShadows(),this.info.autoReset===!0&&this.info.reset(),It.render(S,N),A.setupLights(M._useLegacyLights),ee.isArrayCamera){const le=ee.cameras;for(let re=0,He=le.length;re<He;re++){const $e=le[re];kc(S,N,$e,$e.viewport)}}else kc(S,N,ee);b!==null&&(F.updateMultisampleRenderTarget(b),F.updateRenderTargetMipmap(b)),N.isScene===!0&&N.onAfterRender(M,N,ee),W.resetDefaultState(),L=-1,R=null,_.pop(),_.length>0?A=_[_.length-1]:A=null,g.pop(),g.length>0?S=g[g.length-1]:S=null};function qi(N,ee,oe,le){if(N.visible===!1)return;if(N.layers.test(ee.layers)){if(N.isGroup)oe=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(ee);else if(N.isLight)A.pushLight(N),N.castShadow&&A.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||Y.intersectsSprite(N)){le&&ot.setFromMatrixPosition(N.matrixWorld).applyMatrix4(Ce);const $e=me.update(N),at=N.material;at.visible&&S.push(N,$e,at,oe,ot.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||Y.intersectsObject(N))){const $e=me.update(N),at=N.material;if(le&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),ot.copy(N.boundingSphere.center)):($e.boundingSphere===null&&$e.computeBoundingSphere(),ot.copy($e.boundingSphere.center)),ot.applyMatrix4(N.matrixWorld).applyMatrix4(Ce)),Array.isArray(at)){const lt=$e.groups;for(let pt=0,ft=lt.length;pt<ft;pt++){const mt=lt[pt],sn=at[mt.materialIndex];sn&&sn.visible&&S.push(N,$e,sn,oe,ot.z,mt)}}else at.visible&&S.push(N,$e,at,oe,ot.z,null)}}const He=N.children;for(let $e=0,at=He.length;$e<at;$e++)qi(He[$e],ee,oe,le)}function kc(N,ee,oe,le){const re=N.opaque,He=N.transmissive,$e=N.transparent;A.setupLightsView(oe),ue===!0&&dt.setGlobalState(M.clippingPlanes,oe),He.length>0&&zc(re,He,ee,oe),le&&pe.viewport(P.copy(le)),re.length>0&&qa(re,ee,oe),He.length>0&&qa(He,ee,oe),$e.length>0&&qa($e,ee,oe),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function zc(N,ee,oe,le){if((oe.isScene===!0?oe.overrideMaterial:null)!==null)return;const He=Me.isWebGL2;Te===null&&(Te=new Hr(1,1,{generateMipmaps:!0,type:he.has("EXT_color_buffer_half_float")?Mc:as,minFilter:fs,samples:He?4:0})),M.getDrawingBufferSize(Ze),He?Te.setSize(Ze.x,Ze.y):Te.setSize($p(Ze.x),$p(Ze.y));const $e=M.getRenderTarget();M.setRenderTarget(Te),M.getClearColor(ie),G=M.getClearAlpha(),G<1&&M.setClearColor(16777215,.5),M.clear();const at=M.toneMapping;M.toneMapping=os,qa(N,oe,le),F.updateMultisampleRenderTarget(Te),F.updateRenderTargetMipmap(Te);let lt=!1;for(let pt=0,ft=ee.length;pt<ft;pt++){const mt=ee[pt],sn=mt.object,Xn=mt.geometry,Kt=mt.material,Nn=mt.group;if(Kt.side===pr&&sn.layers.test(le.layers)){const ct=Kt.side;Kt.side=_i,Kt.needsUpdate=!0,Ys(sn,oe,le,Xn,Kt,Nn),Kt.side=ct,Kt.needsUpdate=!0,lt=!0}}lt===!0&&(F.updateMultisampleRenderTarget(Te),F.updateRenderTargetMipmap(Te)),M.setRenderTarget($e),M.setClearColor(ie,G),M.toneMapping=at}function qa(N,ee,oe){const le=ee.isScene===!0?ee.overrideMaterial:null;for(let re=0,He=N.length;re<He;re++){const $e=N[re],at=$e.object,lt=$e.geometry,pt=le===null?$e.material:le,ft=$e.group;at.layers.test(oe.layers)&&Ys(at,ee,oe,lt,pt,ft)}}function Ys(N,ee,oe,le,re,He){N.onBeforeRender(M,ee,oe,le,re,He),N.modelViewMatrix.multiplyMatrices(oe.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),re.onBeforeRender(M,ee,oe,le,N,He),re.transparent===!0&&re.side===pr&&re.forceSinglePass===!1?(re.side=_i,re.needsUpdate=!0,M.renderBufferDirect(oe,ee,le,re,N,He),re.side=cs,re.needsUpdate=!0,M.renderBufferDirect(oe,ee,le,re,N,He),re.side=pr):M.renderBufferDirect(oe,ee,le,re,N,He),N.onAfterRender(M,ee,oe,le,re,He)}function $a(N,ee,oe){ee.isScene!==!0&&(ee=Le);const le=De.get(N),re=A.state.lights,He=A.state.shadowsArray,$e=re.state.version,at=Ye.getParameters(N,re.state,He,ee,oe),lt=Ye.getProgramCacheKey(at);let pt=le.programs;le.environment=N.isMeshStandardMaterial?ee.environment:null,le.fog=ee.fog,le.envMap=(N.isMeshStandardMaterial?$:I).get(N.envMap||le.environment),pt===void 0&&(N.addEventListener("dispose",Ne),pt=new Map,le.programs=pt);let ft=pt.get(lt);if(ft!==void 0){if(le.currentProgram===ft&&le.lightsStateVersion===$e)return Qf(N,at),ft}else at.uniforms=Ye.getUniforms(N),N.onBuild(oe,at,M),N.onBeforeCompile(at,M),ft=Ye.acquireProgram(at,lt),pt.set(lt,ft),le.uniforms=at.uniforms;const mt=le.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(mt.clippingPlanes=dt.uniform),Qf(N,at),le.needsLights=$m(N),le.lightsStateVersion=$e,le.needsLights&&(mt.ambientLightColor.value=re.state.ambient,mt.lightProbe.value=re.state.probe,mt.directionalLights.value=re.state.directional,mt.directionalLightShadows.value=re.state.directionalShadow,mt.spotLights.value=re.state.spot,mt.spotLightShadows.value=re.state.spotShadow,mt.rectAreaLights.value=re.state.rectArea,mt.ltc_1.value=re.state.rectAreaLTC1,mt.ltc_2.value=re.state.rectAreaLTC2,mt.pointLights.value=re.state.point,mt.pointLightShadows.value=re.state.pointShadow,mt.hemisphereLights.value=re.state.hemi,mt.directionalShadowMap.value=re.state.directionalShadowMap,mt.directionalShadowMatrix.value=re.state.directionalShadowMatrix,mt.spotShadowMap.value=re.state.spotShadowMap,mt.spotLightMatrix.value=re.state.spotLightMatrix,mt.spotLightMap.value=re.state.spotLightMap,mt.pointShadowMap.value=re.state.pointShadowMap,mt.pointShadowMatrix.value=re.state.pointShadowMatrix),le.currentProgram=ft,le.uniformsList=null,ft}function Yf(N){if(N.uniformsList===null){const ee=N.currentProgram.getUniforms();N.uniformsList=Mp.seqWithValue(ee.seq,N.uniforms)}return N.uniformsList}function Qf(N,ee){const oe=De.get(N);oe.outputColorSpace=ee.outputColorSpace,oe.batching=ee.batching,oe.instancing=ee.instancing,oe.instancingColor=ee.instancingColor,oe.skinning=ee.skinning,oe.morphTargets=ee.morphTargets,oe.morphNormals=ee.morphNormals,oe.morphColors=ee.morphColors,oe.morphTargetsCount=ee.morphTargetsCount,oe.numClippingPlanes=ee.numClippingPlanes,oe.numIntersection=ee.numClipIntersection,oe.vertexAlphas=ee.vertexAlphas,oe.vertexTangents=ee.vertexTangents,oe.toneMapping=ee.toneMapping}function Zm(N,ee,oe,le,re){ee.isScene!==!0&&(ee=Le),F.resetTextureUnits();const He=ee.fog,$e=le.isMeshStandardMaterial?ee.environment:null,at=b===null?M.outputColorSpace:b.isXRRenderTarget===!0?b.texture.colorSpace:hs,lt=(le.isMeshStandardMaterial?$:I).get(le.envMap||$e),pt=le.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,ft=!!oe.attributes.tangent&&(!!le.normalMap||le.anisotropy>0),mt=!!oe.morphAttributes.position,sn=!!oe.morphAttributes.normal,Xn=!!oe.morphAttributes.color;let Kt=os;le.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(Kt=M.toneMapping);const Nn=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,ct=Nn!==void 0?Nn.length:0,je=De.get(le),$i=A.state.lights;if(ue===!0&&(Se===!0||N!==R)){const Jn=N===R&&le.id===L;dt.setState(le,N,Jn)}let Mt=!1;le.version===je.__version?(je.needsLights&&je.lightsStateVersion!==$i.state.version||je.outputColorSpace!==at||re.isBatchedMesh&&je.batching===!1||!re.isBatchedMesh&&je.batching===!0||re.isInstancedMesh&&je.instancing===!1||!re.isInstancedMesh&&je.instancing===!0||re.isSkinnedMesh&&je.skinning===!1||!re.isSkinnedMesh&&je.skinning===!0||re.isInstancedMesh&&je.instancingColor===!0&&re.instanceColor===null||re.isInstancedMesh&&je.instancingColor===!1&&re.instanceColor!==null||je.envMap!==lt||le.fog===!0&&je.fog!==He||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==dt.numPlanes||je.numIntersection!==dt.numIntersection)||je.vertexAlphas!==pt||je.vertexTangents!==ft||je.morphTargets!==mt||je.morphNormals!==sn||je.morphColors!==Xn||je.toneMapping!==Kt||Me.isWebGL2===!0&&je.morphTargetsCount!==ct)&&(Mt=!0):(Mt=!0,je.__version=le.version);let hn=je.currentProgram;Mt===!0&&(hn=$a(le,ee,re));let Xr=!1,er=!1,Un=!1;const yn=hn.getUniforms(),Jr=je.uniforms;if(pe.useProgram(hn.program)&&(Xr=!0,er=!0,Un=!0),le.id!==L&&(L=le.id,er=!0),Xr||R!==N){yn.setValue(z,"projectionMatrix",N.projectionMatrix),yn.setValue(z,"viewMatrix",N.matrixWorldInverse);const Jn=yn.map.cameraPosition;Jn!==void 0&&Jn.setValue(z,ot.setFromMatrixPosition(N.matrixWorld)),Me.logarithmicDepthBuffer&&yn.setValue(z,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(le.isMeshPhongMaterial||le.isMeshToonMaterial||le.isMeshLambertMaterial||le.isMeshBasicMaterial||le.isMeshStandardMaterial||le.isShaderMaterial)&&yn.setValue(z,"isOrthographic",N.isOrthographicCamera===!0),R!==N&&(R=N,er=!0,Un=!0)}if(re.isSkinnedMesh){yn.setOptional(z,re,"bindMatrix"),yn.setOptional(z,re,"bindMatrixInverse");const Jn=re.skeleton;Jn&&(Me.floatVertexTextures?(Jn.boneTexture===null&&Jn.computeBoneTexture(),yn.setValue(z,"boneTexture",Jn.boneTexture,F)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}re.isBatchedMesh&&(yn.setOptional(z,re,"batchingTexture"),yn.setValue(z,"batchingTexture",re._matricesTexture,F));const el=oe.morphAttributes;if((el.position!==void 0||el.normal!==void 0||el.color!==void 0&&Me.isWebGL2===!0)&&yt.update(re,oe,hn),(er||je.receiveShadow!==re.receiveShadow)&&(je.receiveShadow=re.receiveShadow,yn.setValue(z,"receiveShadow",re.receiveShadow)),le.isMeshGouraudMaterial&&le.envMap!==null&&(Jr.envMap.value=lt,Jr.flipEnvMap.value=lt.isCubeTexture&<.isRenderTargetTexture===!1?-1:1),er&&(yn.setValue(z,"toneMappingExposure",M.toneMappingExposure),je.needsLights&&qm(Jr,Un),He&&le.fog===!0&&Be.refreshFogUniforms(Jr,He),Be.refreshMaterialUniforms(Jr,le,ae,Z,Te),Mp.upload(z,Yf(je),Jr,F)),le.isShaderMaterial&&le.uniformsNeedUpdate===!0&&(Mp.upload(z,Yf(je),Jr,F),le.uniformsNeedUpdate=!1),le.isSpriteMaterial&&yn.setValue(z,"center",re.center),yn.setValue(z,"modelViewMatrix",re.modelViewMatrix),yn.setValue(z,"normalMatrix",re.normalMatrix),yn.setValue(z,"modelMatrix",re.matrixWorld),le.isShaderMaterial||le.isRawShaderMaterial){const Jn=le.uniformsGroups;for(let tl=0,Fi=Jn.length;tl<Fi;tl++)if(Me.isWebGL2){const Zf=Jn[tl];ge.update(Zf,hn),ge.bind(Zf,hn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return hn}function qm(N,ee){N.ambientLightColor.needsUpdate=ee,N.lightProbe.needsUpdate=ee,N.directionalLights.needsUpdate=ee,N.directionalLightShadows.needsUpdate=ee,N.pointLights.needsUpdate=ee,N.pointLightShadows.needsUpdate=ee,N.spotLights.needsUpdate=ee,N.spotLightShadows.needsUpdate=ee,N.rectAreaLights.needsUpdate=ee,N.hemisphereLights.needsUpdate=ee}function $m(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(N,ee,oe){De.get(N.texture).__webglTexture=ee,De.get(N.depthTexture).__webglTexture=oe;const le=De.get(N);le.__hasExternalTextures=!0,le.__hasExternalTextures&&(le.__autoAllocateDepthBuffer=oe===void 0,le.__autoAllocateDepthBuffer||he.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),le.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(N,ee){const oe=De.get(N);oe.__webglFramebuffer=ee,oe.__useDefaultFramebuffer=ee===void 0},this.setRenderTarget=function(N,ee=0,oe=0){b=N,B=ee,T=oe;let le=!0,re=null,He=!1,$e=!1;if(N){const lt=De.get(N);lt.__useDefaultFramebuffer!==void 0?(pe.bindFramebuffer(z.FRAMEBUFFER,null),le=!1):lt.__webglFramebuffer===void 0?F.setupRenderTarget(N):lt.__hasExternalTextures&&F.rebindTextures(N,De.get(N.texture).__webglTexture,De.get(N.depthTexture).__webglTexture);const pt=N.texture;(pt.isData3DTexture||pt.isDataArrayTexture||pt.isCompressedArrayTexture)&&($e=!0);const ft=De.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(ft[ee])?re=ft[ee][oe]:re=ft[ee],He=!0):Me.isWebGL2&&N.samples>0&&F.useMultisampledRTT(N)===!1?re=De.get(N).__webglMultisampledFramebuffer:Array.isArray(ft)?re=ft[oe]:re=ft,P.copy(N.viewport),U.copy(N.scissor),K=N.scissorTest}else P.copy(H).multiplyScalar(ae).floor(),U.copy(q).multiplyScalar(ae).floor(),K=ne;if(pe.bindFramebuffer(z.FRAMEBUFFER,re)&&Me.drawBuffers&&le&&pe.drawBuffers(N,re),pe.viewport(P),pe.scissor(U),pe.setScissorTest(K),He){const lt=De.get(N.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+ee,lt.__webglTexture,oe)}else if($e){const lt=De.get(N.texture),pt=ee||0;z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,lt.__webglTexture,oe||0,pt)}L=-1},this.readRenderTargetPixels=function(N,ee,oe,le,re,He,$e){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let at=De.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&$e!==void 0&&(at=at[$e]),at){pe.bindFramebuffer(z.FRAMEBUFFER,at);try{const lt=N.texture,pt=lt.format,ft=lt.type;if(pt!==vi&&We.convert(pt)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const mt=ft===Mc&&(he.has("EXT_color_buffer_half_float")||Me.isWebGL2&&he.has("EXT_color_buffer_float"));if(ft!==as&&We.convert(ft)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ft===Nr&&(Me.isWebGL2||he.has("OES_texture_float")||he.has("WEBGL_color_buffer_float")))&&!mt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ee>=0&&ee<=N.width-le&&oe>=0&&oe<=N.height-re&&z.readPixels(ee,oe,le,re,We.convert(pt),We.convert(ft),He)}finally{const lt=b!==null?De.get(b).__webglFramebuffer:null;pe.bindFramebuffer(z.FRAMEBUFFER,lt)}}},this.copyFramebufferToTexture=function(N,ee,oe=0){const le=Math.pow(2,-oe),re=Math.floor(ee.image.width*le),He=Math.floor(ee.image.height*le);F.setTexture2D(ee,0),z.copyTexSubImage2D(z.TEXTURE_2D,oe,0,0,N.x,N.y,re,He),pe.unbindTexture()},this.copyTextureToTexture=function(N,ee,oe,le=0){const re=ee.image.width,He=ee.image.height,$e=We.convert(oe.format),at=We.convert(oe.type);F.setTexture2D(oe,0),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,oe.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,oe.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,oe.unpackAlignment),ee.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,le,N.x,N.y,re,He,$e,at,ee.image.data):ee.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,le,N.x,N.y,ee.mipmaps[0].width,ee.mipmaps[0].height,$e,ee.mipmaps[0].data):z.texSubImage2D(z.TEXTURE_2D,le,N.x,N.y,$e,at,ee.image),le===0&&oe.generateMipmaps&&z.generateMipmap(z.TEXTURE_2D),pe.unbindTexture()},this.copyTextureToTexture3D=function(N,ee,oe,le,re=0){if(M.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const He=N.max.x-N.min.x+1,$e=N.max.y-N.min.y+1,at=N.max.z-N.min.z+1,lt=We.convert(le.format),pt=We.convert(le.type);let ft;if(le.isData3DTexture)F.setTexture3D(le,0),ft=z.TEXTURE_3D;else if(le.isDataArrayTexture||le.isCompressedArrayTexture)F.setTexture2DArray(le,0),ft=z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,le.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,le.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,le.unpackAlignment);const mt=z.getParameter(z.UNPACK_ROW_LENGTH),sn=z.getParameter(z.UNPACK_IMAGE_HEIGHT),Xn=z.getParameter(z.UNPACK_SKIP_PIXELS),Kt=z.getParameter(z.UNPACK_SKIP_ROWS),Nn=z.getParameter(z.UNPACK_SKIP_IMAGES),ct=oe.isCompressedTexture?oe.mipmaps[re]:oe.image;z.pixelStorei(z.UNPACK_ROW_LENGTH,ct.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,ct.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,N.min.x),z.pixelStorei(z.UNPACK_SKIP_ROWS,N.min.y),z.pixelStorei(z.UNPACK_SKIP_IMAGES,N.min.z),oe.isDataTexture||oe.isData3DTexture?z.texSubImage3D(ft,re,ee.x,ee.y,ee.z,He,$e,at,lt,pt,ct.data):oe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),z.compressedTexSubImage3D(ft,re,ee.x,ee.y,ee.z,He,$e,at,lt,ct.data)):z.texSubImage3D(ft,re,ee.x,ee.y,ee.z,He,$e,at,lt,pt,ct),z.pixelStorei(z.UNPACK_ROW_LENGTH,mt),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,sn),z.pixelStorei(z.UNPACK_SKIP_PIXELS,Xn),z.pixelStorei(z.UNPACK_SKIP_ROWS,Kt),z.pixelStorei(z.UNPACK_SKIP_IMAGES,Nn),re===0&&le.generateMipmaps&&z.generateMipmap(ft),pe.unbindTexture()},this.initTexture=function(N){N.isCubeTexture?F.setTextureCube(N,0):N.isData3DTexture?F.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?F.setTexture2DArray(N,0):F.setTexture2D(N,0),pe.unbindTexture()},this.resetState=function(){B=0,T=0,b=null,pe.reset(),W.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ur}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Em?"display-p3":"srgb",t.unpackColorSpace=Gt.workingColorSpace===Ff?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Pn?Lo:Ex}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Lo?Pn:hs}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class BR extends Dx{}BR.prototype.isWebGL1Renderer=!0;class Rm{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Pe(e),this.density=t}clone(){return new Rm(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class bm{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Pe(e),this.near=t,this.far=i}clone(){return new bm(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let Fx=class extends wt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}};class zf{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=xf,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Ki()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ki()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ki()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const pi=new D;class Uo{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)pi.fromBufferAttribute(this,t),pi.applyMatrix4(e),this.setXYZ(t,pi.x,pi.y,pi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)pi.fromBufferAttribute(this,t),pi.applyNormalMatrix(e),this.setXYZ(t,pi.x,pi.y,pi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)pi.fromBufferAttribute(this,t),pi.transformDirection(e),this.setXYZ(t,pi.x,pi.y,pi.z);return this}setX(e,t){return this.normalized&&(t=At(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=At(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=At(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=At(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=bi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=bi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=bi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=bi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=At(t,this.array),i=At(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=At(t,this.array),i=At(i,this.array),r=At(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=At(t,this.array),i=At(i,this.array),r=At(r,this.array),s=At(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Dt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Uo(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Nx extends Ln{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Pe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Pl;const yu=new D,Bl=new D,Il=new D,Ll=new de,_u=new de,IR=new Ue,bd=new D,xu=new D,Pd=new D,FE=new de,$v=new de,NE=new de;class LR extends wt{constructor(e=new Nx){if(super(),this.isSprite=!0,this.type="Sprite",Pl===void 0){Pl=new ht;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new zf(t,5);Pl.setIndex([0,1,2,0,2,3]),Pl.setAttribute("position",new Uo(i,3,0,!1)),Pl.setAttribute("uv",new Uo(i,2,3,!1))}this.geometry=Pl,this.material=e,this.center=new de(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Bl.setFromMatrixScale(this.matrixWorld),IR.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Il.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Bl.multiplyScalar(-Il.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Bd(bd.set(-.5,-.5,0),Il,o,Bl,r,s),Bd(xu.set(.5,-.5,0),Il,o,Bl,r,s),Bd(Pd.set(.5,.5,0),Il,o,Bl,r,s),FE.set(0,0),$v.set(1,0),NE.set(1,1);let a=e.ray.intersectTriangle(bd,xu,Pd,!1,yu);if(a===null&&(Bd(xu.set(-.5,.5,0),Il,o,Bl,r,s),$v.set(0,1),a=e.ray.intersectTriangle(bd,Pd,xu,!1,yu),a===null))return;const l=e.ray.origin.distanceTo(yu);l<e.near||l>e.far||t.push({distance:l,point:yu.clone(),uv:Ri.getInterpolation(yu,bd,xu,Pd,FE,$v,NE,new de),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Bd(n,e,t,i,r,s){Ll.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(_u.x=s*Ll.x-r*Ll.y,_u.y=r*Ll.x+s*Ll.y):_u.copy(Ll),n.copy(e),n.x+=_u.x,n.y+=_u.y,n.applyMatrix4(IR)}const Id=new D,UE=new D;class DR extends wt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Id.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Id);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Id.setFromMatrixPosition(e.matrixWorld),UE.setFromMatrixPosition(this.matrixWorld);const i=Id.distanceTo(UE)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const OE=new D,kE=new Nt,zE=new Nt,yU=new D,GE=new Ue,Ld=new D,e0=new Zn,HE=new Ue,t0=new ja;class Pm extends Mn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ry,this.bindMatrix=new Ue,this.bindMatrixInverse=new Ue,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Qn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ld),this.boundingBox.expandByPoint(Ld)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Zn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ld),this.boundingSphere.expandByPoint(Ld)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),e0.copy(this.boundingSphere),e0.applyMatrix4(r),e.ray.intersectsSphere(e0)!==!1&&(HE.copy(r).invert(),t0.copy(e.ray).applyMatrix4(HE),!(this.boundingBox!==null&&t0.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,t0)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Nt,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ry?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===JC?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;kE.fromBufferAttribute(r.attributes.skinIndex,e),zE.fromBufferAttribute(r.attributes.skinWeight,e),OE.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=zE.getComponent(s);if(o!==0){const a=kE.getComponent(s);GE.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(yU.copy(OE).applyMatrix4(GE),o)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class Rc extends wt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class La extends en{constructor(e=null,t=1,i=1,r,s,o,a,l,f=gn,h=gn,d,p){super(null,o,a,l,f,h,r,s,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const VE=new Ue,_U=new Ue;class Nc{constructor(e=[],t=[]){this.uuid=Ki(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new Ue)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new Ue;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:_U;VE.multiplyMatrices(a,t[s]),VE.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Nc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new La(t,e,e,vi,Nr);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Rc),this.bones.push(o),this.boneInverses.push(new Ue().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Ha extends Dt{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Dl=new Ue,WE=new Ue,Dd=[],XE=new Qn,xU=new Ue,Au=new Mn,Su=new Zn;class Ux extends Mn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ha(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,xU)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Qn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Dl),XE.copy(e.boundingBox).applyMatrix4(Dl),this.boundingBox.union(XE)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Dl),Su.copy(e.boundingSphere).applyMatrix4(Dl),this.boundingSphere.union(Su)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,r=this.count;if(Au.geometry=this.geometry,Au.material=this.material,Au.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Su.copy(this.boundingSphere),Su.applyMatrix4(i),e.ray.intersectsSphere(Su)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Dl),WE.multiplyMatrices(i,Dl),Au.matrixWorld=WE,Au.raycast(e,Dd);for(let o=0,a=Dd.length;o<a;o++){const l=Dd[o];l.instanceId=s,l.object=this,t.push(l)}Dd.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ha(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function AU(n,e){return n.z-e.z}function SU(n,e){return e.z-n.z}class MU{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1});const s=i[this.index];r.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const Fl="batchId",uo=new Ue,JE=new Ue,EU=new Ue,jE=new Ue,n0=new Of,Fd=new Qn,oa=new Zn,Mu=new D,i0=new MU,ci=new Mn,Nd=[];function wU(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class FR extends Mn{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,i=t*2,r){super(new ht,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new La(t,e,e,vi,Nr);this._matricesTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const a in e.attributes){const l=e.getAttribute(a),{array:f,itemSize:h,normalized:d}=l,p=new f.constructor(i*h),m=new l.constructor(p,h,d);m.setUsage(l.usage),t.setAttribute(a,m)}if(e.getIndex()!==null){const a=i>65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Dt(a,1))}const o=r>65536?new Uint32Array(i):new Uint16Array(i);t.setAttribute(Fl,new Dt(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Fl))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Fl}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(i===Fl)continue;if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this._geometryCount,t=this.boundingBox,i=this._active;t.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,uo),this.getBoundingBoxAt(r,Fd).applyMatrix4(uo),t.union(Fd))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zn);const e=this._geometryCount,t=this.boundingSphere,i=this._active;t.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,uo),this.getBoundingSphereAt(r,oa).applyMatrix4(uo),t.union(oa))}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const f=e.getIndex(),h=f!==null;if(h&&(i===-1?r.indexCount=f.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const d=this._visibility,p=this._active,m=this._matricesTexture,y=this._matricesTexture.image.data;d.push(!0),p.push(!0);const S=this._geometryCount;this._geometryCount++,EU.toArray(y,S*16),m.needsUpdate=!0,o.push(r),a.push({start:h?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Qn,sphereInitialized:!1,sphere:new Zn});const A=this.geometry.getAttribute(Fl);for(let g=0;g<r.vertexCount;g++)A.setX(r.vertexStart+g,S);return A.needsUpdate=!0,this.setGeometryAt(S,e),S}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,f=a.vertexCount;for(const m in i.attributes){if(m===Fl)continue;const y=t.getAttribute(m),S=i.getAttribute(m);wU(y,S,l);const A=y.itemSize;for(let g=y.count,_=f;g<_;g++){const M=l+g;for(let w=0;w<A;w++)S.setComponent(M,w,0)}S.needsUpdate=!0}if(r){const m=a.indexStart;for(let y=0;y<o.count;y++)s.setX(m+y,l+o.getX(y));for(let y=o.count,S=a.indexCount;y<S;y++)s.setX(m+y,l);s.needsUpdate=!0}const h=this._bounds[e];t.boundingBox!==null?(h.box.copy(t.boundingBox),h.boxInitialized=!0):h.boxInitialized=!1,t.boundingSphere!==null?(h.sphere.copy(t.boundingSphere),h.sphereInitialized=!0):h.sphereInitialized=!1;const d=this._drawRanges[e],p=t.getAttribute("position");return d.count=r?o.count:p.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return this;const r=this._bounds[e],s=r.box,o=this.geometry;if(r.boxInitialized===!1){s.makeEmpty();const a=o.index,l=o.attributes.position,f=this._drawRanges[e];for(let h=f.start,d=f.start+f.count;h<d;h++){let p=h;a&&(p=a.getX(p)),s.expandByPoint(Mu.fromBufferAttribute(l,p))}r.boxInitialized=!0}return t.copy(s),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return this;const r=this._bounds[e],s=r.sphere,o=this.geometry;if(r.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,Fd),Fd.getCenter(s.center);const a=o.index,l=o.attributes.position,f=this._drawRanges[e];let h=0;for(let d=f.start,p=f.start+f.count;d<p;d++){let m=d;a&&(m=a.getX(m)),Mu.fromBufferAttribute(l,m),h=Math.max(h,s.center.distanceToSquared(Mu))}s.radius=Math.sqrt(h),r.sphereInitialized=!0}return t.copy(s),t}setMatrixAt(e,t){const i=this._active,r=this._matricesTexture,s=this._matricesTexture.image.data,o=this._geometryCount;return e>=o||i[e]===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._active,r=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||i[e]===!1?null:t.fromArray(r,e*16)}setVisibleAt(e,t){const i=this._visibility,r=this._active,s=this._geometryCount;return e>=s||r[e]===!1||i[e]===t?this:(i[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1?!1:t[e]}raycast(e,t){const i=this._visibility,r=this._active,s=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,l=this.geometry;ci.material=this.material,ci.geometry.index=l.index,ci.geometry.attributes=l.attributes,ci.geometry.boundingBox===null&&(ci.geometry.boundingBox=new Qn),ci.geometry.boundingSphere===null&&(ci.geometry.boundingSphere=new Zn);for(let f=0;f<o;f++){if(!i[f]||!r[f])continue;const h=s[f];ci.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(f,ci.matrixWorld).premultiply(a),this.getBoundingBoxAt(f,ci.geometry.boundingBox),this.getBoundingSphereAt(f,ci.geometry.boundingSphere),ci.raycast(e,Nd);for(let d=0,p=Nd.length;d<p;d++){const m=Nd[d];m.object=this,m.batchId=f,t.push(m)}Nd.length=0}ci.material=null,ci.geometry.index=null,ci.geometry.attributes={},ci.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._visibility,f=this._multiDrawStarts,h=this._multiDrawCounts,d=this._drawRanges,p=this.perObjectFrustumCulled;p&&(jE.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),n0.setFromProjectionMatrix(jE,e.isWebGPURenderer?wc:Ur));let m=0;if(this.sortObjects){JE.copy(this.matrixWorld).invert(),Mu.setFromMatrixPosition(i.matrixWorld).applyMatrix4(JE);for(let A=0,g=l.length;A<g;A++)if(l[A]){this.getMatrixAt(A,uo),this.getBoundingSphereAt(A,oa).applyMatrix4(uo);let _=!1;if(p&&(_=!n0.intersectsSphere(oa)),!_){const M=Mu.distanceTo(oa.center);i0.push(d[A],M)}}const y=i0.list,S=this.customSort;S===null?y.sort(s.transparent?SU:AU):S.call(this,y,i);for(let A=0,g=y.length;A<g;A++){const _=y[A];f[m]=_.start*a,h[m]=_.count,m++}i0.reset()}else for(let y=0,S=l.length;y<S;y++)if(l[y]){let A=!1;if(p&&(this.getMatrixAt(y,uo),this.getBoundingSphereAt(y,oa).applyMatrix4(uo),A=!n0.intersectsSphere(oa)),!A){const g=d[y];f[m]=g.start*a,h[m]=g.count,m++}}this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class $n extends Ln{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Pe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const KE=new D,YE=new D,QE=new Ue,r0=new ja,Ud=new Zn;class ps extends wt{constructor(e=new ht,t=new $n){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)KE.fromBufferAttribute(t,r-1),YE.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=KE.distanceTo(YE);e.setAttribute("lineDistance",new Xe(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ud.copy(i.boundingSphere),Ud.applyMatrix4(r),Ud.radius+=s,e.ray.intersectsSphere(Ud)===!1)return;QE.copy(r).invert(),r0.copy(e.ray).applyMatrix4(QE);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,f=new D,h=new D,d=new D,p=new D,m=this.isLineSegments?2:1,y=i.index,A=i.attributes.position;if(y!==null){const g=Math.max(0,o.start),_=Math.min(y.count,o.start+o.count);for(let M=g,w=_-1;M<w;M+=m){const B=y.getX(M),T=y.getX(M+1);if(f.fromBufferAttribute(A,B),h.fromBufferAttribute(A,T),r0.distanceSqToSegment(f,h,p,d)>l)continue;p.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(p);L<e.near||L>e.far||t.push({distance:L,point:d.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),_=Math.min(A.count,o.start+o.count);for(let M=g,w=_-1;M<w;M+=m){if(f.fromBufferAttribute(A,M),h.fromBufferAttribute(A,M+1),r0.distanceSqToSegment(f,h,p,d)>l)continue;p.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(p);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const ZE=new D,qE=new D;class Vr extends ps{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)ZE.fromBufferAttribute(t,r),qE.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+ZE.distanceTo(qE);e.setAttribute("lineDistance",new Xe(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ox extends ps{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Bm extends Ln{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const $E=new Ue,s_=new ja,Od=new Zn,kd=new D;class kx extends wt{constructor(e=new ht,t=new Bm){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Od.copy(i.boundingSphere),Od.applyMatrix4(r),Od.radius+=s,e.ray.intersectsSphere(Od)===!1)return;$E.copy(r).invert(),s_.copy(e.ray).applyMatrix4($E);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,f=i.index,d=i.attributes.position;if(f!==null){const p=Math.max(0,o.start),m=Math.min(f.count,o.start+o.count);for(let y=p,S=m;y<S;y++){const A=f.getX(y);kd.fromBufferAttribute(d,A),e1(kd,A,l,r,e,t,this)}}else{const p=Math.max(0,o.start),m=Math.min(d.count,o.start+o.count);for(let y=p,S=m;y<S;y++)kd.fromBufferAttribute(d,y),e1(kd,y,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function e1(n,e,t,i,r,s,o){const a=s_.distanceSqToPoint(n);if(a<t){const l=new D;s_.closestPointToPoint(n,l),l.applyMatrix4(i);const f=r.ray.origin.distanceTo(l);if(f<r.near||f>r.far)return;s.push({distance:f,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class TU extends en{constructor(e,t,i,r,s,o,a,l,f){super(e,t,i,r,s,o,a,l,f),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:ln,this.magFilter=s!==void 0?s:ln,this.generateMipmaps=!1;const h=this;function d(){h.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class CU extends en{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=gn,this.minFilter=gn,this.generateMipmaps=!1,this.needsUpdate=!0}}class Im extends en{constructor(e,t,i,r,s,o,a,l,f,h,d,p){super(null,o,a,l,f,h,r,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class RU extends Im{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Bn}}class bU extends Im{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Xs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class PU extends en{constructor(e,t,i,r,s,o,a,l,f){super(e,t,i,r,s,o,a,l,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Sr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,f;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),f=i[r]-o,f<0)a=r+1;else if(f>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const h=i[r],p=i[r+1]-h,m=(o-h)/p;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new de:new D);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new D,r=[],s=[],o=[],a=new D,l=new Ue;for(let m=0;m<=e;m++){const y=m/e;r[m]=this.getTangentAt(y,new D)}s[0]=new D,o[0]=new D;let f=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=f&&(f=h,i.set(1,0,0)),d<=f&&(f=d,i.set(0,1,0)),p<=f&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const y=Math.acos(vn(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,y))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(vn(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],m*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Lm extends Sr{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new de,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),f=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=l-this.aX,m=f-this.aY;l=p*h-m*d+this.aX,f=p*d+m*h+this.aY}return i.set(l,f)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class NR extends Lm{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function zx(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,f){r(o,a,f*(a-s),f*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,f,h,d){let p=(o-s)/f-(a-s)/(f+h)+(a-o)/h,m=(a-o)/h-(l-o)/(h+d)+(l-a)/d;p*=h,m*=h,r(o,a,p,m)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const zd=new D,s0=new zx,o0=new zx,a0=new zx;class UR extends Sr{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new D){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let f,h;this.closed||a>0?f=r[(a-1)%s]:(zd.subVectors(r[0],r[1]).add(r[0]),f=zd);const d=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?h=r[(a+2)%s]:(zd.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=zd),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let y=Math.pow(f.distanceToSquared(d),m),S=Math.pow(d.distanceToSquared(p),m),A=Math.pow(p.distanceToSquared(h),m);S<1e-4&&(S=1),y<1e-4&&(y=S),A<1e-4&&(A=S),s0.initNonuniformCatmullRom(f.x,d.x,p.x,h.x,y,S,A),o0.initNonuniformCatmullRom(f.y,d.y,p.y,h.y,y,S,A),a0.initNonuniformCatmullRom(f.z,d.z,p.z,h.z,y,S,A)}else this.curveType==="catmullrom"&&(s0.initCatmullRom(f.x,d.x,p.x,h.x,this.tension),o0.initCatmullRom(f.y,d.y,p.y,h.y,this.tension),a0.initCatmullRom(f.z,d.z,p.z,h.z,this.tension));return i.set(s0.calc(l),o0.calc(l),a0.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new D().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function t1(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function BU(n,e){const t=1-n;return t*t*e}function IU(n,e){return 2*(1-n)*n*e}function LU(n,e){return n*n*e}function Xu(n,e,t,i){return BU(n,e)+IU(n,t)+LU(n,i)}function DU(n,e){const t=1-n;return t*t*t*e}function FU(n,e){const t=1-n;return 3*t*t*n*e}function NU(n,e){return 3*(1-n)*n*n*e}function UU(n,e){return n*n*n*e}function Ju(n,e,t,i,r){return DU(n,e)+FU(n,t)+NU(n,i)+UU(n,r)}class Gx extends Sr{constructor(e=new de,t=new de,i=new de,r=new de){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new de){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Ju(e,r.x,s.x,o.x,a.x),Ju(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class OR extends Sr{constructor(e=new D,t=new D,i=new D,r=new D){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new D){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Ju(e,r.x,s.x,o.x,a.x),Ju(e,r.y,s.y,o.y,a.y),Ju(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Hx extends Sr{constructor(e=new de,t=new de){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new de){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new de){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class kR extends Sr{constructor(e=new D,t=new D){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new D){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new D){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Vx extends Sr{constructor(e=new de,t=new de,i=new de){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new de){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Xu(e,r.x,s.x,o.x),Xu(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Wx extends Sr{constructor(e=new D,t=new D,i=new D){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new D){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Xu(e,r.x,s.x,o.x),Xu(e,r.y,s.y,o.y),Xu(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Xx extends Sr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new de){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],f=r[o],h=r[o>r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(t1(a,l.x,f.x,h.x,d.x),t1(a,l.y,f.y,h.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new de().fromArray(r))}return this}}var em=Object.freeze({__proto__:null,ArcCurve:NR,CatmullRomCurve3:UR,CubicBezierCurve:Gx,CubicBezierCurve3:OR,EllipseCurve:Lm,LineCurve:Hx,LineCurve3:kR,QuadraticBezierCurve:Vx,QuadraticBezierCurve3:Wx,SplineCurve:Xx});class zR extends Sr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new em[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),f=l===0?0:1-o/l;return a.getPointAt(f,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let f=0;f<l.length;f++){const h=l[f];i&&i.equals(h)||(t.push(h),i=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new em[r.type]().fromJSON(r))}return this}}class Sf extends zR{constructor(e){super(),this.type="Path",this.currentPoint=new de,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new Hx(this.currentPoint.clone(),new de(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new Vx(this.currentPoint.clone(),new de(e,t),new de(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new Gx(this.currentPoint.clone(),new de(e,t),new de(i,r),new de(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Xx(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const f=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+f,t+h,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const f=new Lm(e,t,i,r,s,o,a,l);if(this.curves.length>0){const d=f.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(f);const h=f.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Gf extends ht{constructor(e=[new de(0,-.5),new de(.5,0),new de(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=vn(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],f=[],h=1/t,d=new D,p=new de,m=new D,y=new D,S=new D;let A=0,g=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:A=e[_+1].x-e[_].x,g=e[_+1].y-e[_].y,m.x=g*1,m.y=-A,m.z=g*0,S.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:A=e[_+1].x-e[_].x,g=e[_+1].y-e[_].y,m.x=g*1,m.y=-A,m.z=g*0,y.copy(m),m.x+=S.x,m.y+=S.y,m.z+=S.z,m.normalize(),l.push(m.x,m.y,m.z),S.copy(y)}for(let _=0;_<=t;_++){const M=i+_*h*r,w=Math.sin(M),B=Math.cos(M);for(let T=0;T<=e.length-1;T++){d.x=e[T].x*w,d.y=e[T].y,d.z=e[T].x*B,o.push(d.x,d.y,d.z),p.x=_/t,p.y=T/(e.length-1),a.push(p.x,p.y);const b=l[3*T+0]*w,L=l[3*T+1],R=l[3*T+0]*B;f.push(b,L,R)}}for(let _=0;_<t;_++)for(let M=0;M<e.length-1;M++){const w=M+_*e.length,B=w,T=w+e.length,b=w+e.length+1,L=w+1;s.push(B,T,L),s.push(b,L,T)}this.setIndex(s),this.setAttribute("position",new Xe(o,3)),this.setAttribute("uv",new Xe(a,2)),this.setAttribute("normal",new Xe(f,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gf(e.points,e.segments,e.phiStart,e.phiLength)}}class Dm extends Gf{constructor(e=1,t=1,i=4,r=8){const s=new Sf;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new Dm(e.radius,e.length,e.capSegments,e.radialSegments)}}class Fm extends ht{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],f=new D,h=new de;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const m=i+d/t*r;f.x=e*Math.cos(m),f.y=e*Math.sin(m),o.push(f.x,f.y,f.z),a.push(0,0,1),h.x=(o[p]/e+1)/2,h.y=(o[p+1]/e+1)/2,l.push(h.x,h.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new Xe(o,3)),this.setAttribute("normal",new Xe(a,3)),this.setAttribute("uv",new Xe(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fm(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Uc extends ht{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const f=this;r=Math.floor(r),s=Math.floor(s);const h=[],d=[],p=[],m=[];let y=0;const S=[],A=i/2;let g=0;_(),o===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(h),this.setAttribute("position",new Xe(d,3)),this.setAttribute("normal",new Xe(p,3)),this.setAttribute("uv",new Xe(m,2));function _(){const w=new D,B=new D;let T=0;const b=(t-e)/i;for(let L=0;L<=s;L++){const R=[],P=L/s,U=P*(t-e)+e;for(let K=0;K<=r;K++){const ie=K/r,G=ie*l+a,J=Math.sin(G),Z=Math.cos(G);B.x=U*J,B.y=-P*i+A,B.z=U*Z,d.push(B.x,B.y,B.z),w.set(J,b,Z).normalize(),p.push(w.x,w.y,w.z),m.push(ie,1-P),R.push(y++)}S.push(R)}for(let L=0;L<r;L++)for(let R=0;R<s;R++){const P=S[R][L],U=S[R+1][L],K=S[R+1][L+1],ie=S[R][L+1];h.push(P,U,ie),h.push(U,K,ie),T+=6}f.addGroup(g,T,0),g+=T}function M(w){const B=y,T=new de,b=new D;let L=0;const R=w===!0?e:t,P=w===!0?1:-1;for(let K=1;K<=r;K++)d.push(0,A*P,0),p.push(0,P,0),m.push(.5,.5),y++;const U=y;for(let K=0;K<=r;K++){const G=K/r*l+a,J=Math.cos(G),Z=Math.sin(G);b.x=R*Z,b.y=A*P,b.z=R*J,d.push(b.x,b.y,b.z),p.push(0,P,0),T.x=J*.5+.5,T.y=Z*.5*P+.5,m.push(T.x,T.y),y++}for(let K=0;K<r;K++){const ie=B+K,G=U+K;w===!0?h.push(G,G+1,ie):h.push(G+1,G,ie),L+=3}f.addGroup(g,L,w===!0?1:2),g+=L}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Uc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Nm extends Uc{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Nm(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Wo extends ht{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),f(i),h(),this.setAttribute("position",new Xe(s,3)),this.setAttribute("normal",new Xe(s.slice(),3)),this.setAttribute("uv",new Xe(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(_){const M=new D,w=new D,B=new D;for(let T=0;T<t.length;T+=3)m(t[T+0],M),m(t[T+1],w),m(t[T+2],B),l(M,w,B,_)}function l(_,M,w,B){const T=B+1,b=[];for(let L=0;L<=T;L++){b[L]=[];const R=_.clone().lerp(w,L/T),P=M.clone().lerp(w,L/T),U=T-L;for(let K=0;K<=U;K++)K===0&&L===T?b[L][K]=R:b[L][K]=R.clone().lerp(P,K/U)}for(let L=0;L<T;L++)for(let R=0;R<2*(T-L)-1;R++){const P=Math.floor(R/2);R%2===0?(p(b[L][P+1]),p(b[L+1][P]),p(b[L][P])):(p(b[L][P+1]),p(b[L+1][P+1]),p(b[L+1][P]))}}function f(_){const M=new D;for(let w=0;w<s.length;w+=3)M.x=s[w+0],M.y=s[w+1],M.z=s[w+2],M.normalize().multiplyScalar(_),s[w+0]=M.x,s[w+1]=M.y,s[w+2]=M.z}function h(){const _=new D;for(let M=0;M<s.length;M+=3){_.x=s[M+0],_.y=s[M+1],_.z=s[M+2];const w=A(_)/2/Math.PI+.5,B=g(_)/Math.PI+.5;o.push(w,1-B)}y(),d()}function d(){for(let _=0;_<o.length;_+=6){const M=o[_+0],w=o[_+2],B=o[_+4],T=Math.max(M,w,B),b=Math.min(M,w,B);T>.9&&b<.1&&(M<.2&&(o[_+0]+=1),w<.2&&(o[_+2]+=1),B<.2&&(o[_+4]+=1))}}function p(_){s.push(_.x,_.y,_.z)}function m(_,M){const w=_*3;M.x=e[w+0],M.y=e[w+1],M.z=e[w+2]}function y(){const _=new D,M=new D,w=new D,B=new D,T=new de,b=new de,L=new de;for(let R=0,P=0;R<s.length;R+=9,P+=6){_.set(s[R+0],s[R+1],s[R+2]),M.set(s[R+3],s[R+4],s[R+5]),w.set(s[R+6],s[R+7],s[R+8]),T.set(o[P+0],o[P+1]),b.set(o[P+2],o[P+3]),L.set(o[P+4],o[P+5]),B.copy(_).add(M).add(w).divideScalar(3);const U=A(B);S(T,P+0,_,U),S(b,P+2,M,U),S(L,P+4,w,U)}}function S(_,M,w,B){B<0&&_.x===1&&(o[M]=_.x-1),w.x===0&&w.z===0&&(o[M]=B/2/Math.PI+.5)}function A(_){return Math.atan2(_.z,-_.x)}function g(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wo(e.vertices,e.indices,e.radius,e.details)}}class Um extends Wo{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Um(e.radius,e.detail)}}const Gd=new D,Hd=new D,l0=new D,Vd=new Ri;class GR extends ht{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(Ba*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,f=[0,0,0],h=["a","b","c"],d=new Array(3),p={},m=[];for(let y=0;y<l;y+=3){o?(f[0]=o.getX(y),f[1]=o.getX(y+1),f[2]=o.getX(y+2)):(f[0]=y,f[1]=y+1,f[2]=y+2);const{a:S,b:A,c:g}=Vd;if(S.fromBufferAttribute(a,f[0]),A.fromBufferAttribute(a,f[1]),g.fromBufferAttribute(a,f[2]),Vd.getNormal(l0),d[0]=`${Math.round(S.x*r)},${Math.round(S.y*r)},${Math.round(S.z*r)}`,d[1]=`${Math.round(A.x*r)},${Math.round(A.y*r)},${Math.round(A.z*r)}`,d[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let _=0;_<3;_++){const M=(_+1)%3,w=d[_],B=d[M],T=Vd[h[_]],b=Vd[h[M]],L=`${w}_${B}`,R=`${B}_${w}`;R in p&&p[R]?(l0.dot(p[R].normal)<=s&&(m.push(T.x,T.y,T.z),m.push(b.x,b.y,b.z)),p[R]=null):L in p||(p[L]={index0:f[_],index1:f[M],normal:l0.clone()})}}for(const y in p)if(p[y]){const{index0:S,index1:A}=p[y];Gd.fromBufferAttribute(a,S),Hd.fromBufferAttribute(a,A),m.push(Gd.x,Gd.y,Gd.z),m.push(Hd.x,Hd.y,Hd.z)}this.setAttribute("position",new Xe(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Da extends Sf{constructor(e){super(e),this.uuid=Ki(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new Sf().fromJSON(r))}return this}}const OU={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=HR(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,f,h,d,p,m;if(i&&(s=VU(n,e,s,t)),n.length>80*t){a=f=n[0],l=h=n[1];for(let y=t;y<r;y+=t)d=n[y],p=n[y+1],d<a&&(a=d),p<l&&(l=p),d>f&&(f=d),p>h&&(h=p);m=Math.max(f-a,h-l),m=m!==0?32767/m:0}return Mf(s,o,t,a,l,m,0),o}};function HR(n,e,t,i,r){let s,o;if(r===eO(n,e,t,i)>0)for(s=e;s<t;s+=i)o=n1(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=n1(s,n[s],n[s+1],o);return o&&Om(o,o.next)&&(wf(o),o=o.next),o}function Va(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Om(t,t.next)||cn(t.prev,t,t.next)===0)){if(wf(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Mf(n,e,t,i,r,s,o){if(!n)return;!o&&s&&KU(n,i,r,s);let a=n,l,f;for(;n.prev!==n.next;){if(l=n.prev,f=n.next,s?zU(n,i,r,s):kU(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(f.i/t|0),wf(n),n=f.next,a=f.next;continue}if(n=f,n===a){o?o===1?(n=GU(Va(n),e,t),Mf(n,e,t,i,r,s,2)):o===2&&HU(n,e,t,i,r,s):Mf(Va(n),e,t,i,r,s,1);break}}}function kU(n){const e=n.prev,t=n,i=n.next;if(cn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,f=i.y,h=r<s?r<o?r:o:s<o?s:o,d=a<l?a<f?a:f:l<f?l:f,p=r>s?r>o?r:o:s>o?s:o,m=a>l?a>f?a:f:l>f?l:f;let y=i.next;for(;y!==e;){if(y.x>=h&&y.x<=p&&y.y>=d&&y.y<=m&&ic(r,a,s,l,o,f,y.x,y.y)&&cn(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function zU(n,e,t,i){const r=n.prev,s=n,o=n.next;if(cn(r,s,o)>=0)return!1;const a=r.x,l=s.x,f=o.x,h=r.y,d=s.y,p=o.y,m=a<l?a<f?a:f:l<f?l:f,y=h<d?h<p?h:p:d<p?d:p,S=a>l?a>f?a:f:l>f?l:f,A=h>d?h>p?h:p:d>p?d:p,g=o_(m,y,e,t,i),_=o_(S,A,e,t,i);let M=n.prevZ,w=n.nextZ;for(;M&&M.z>=g&&w&&w.z<=_;){if(M.x>=m&&M.x<=S&&M.y>=y&&M.y<=A&&M!==r&&M!==o&&ic(a,h,l,d,f,p,M.x,M.y)&&cn(M.prev,M,M.next)>=0||(M=M.prevZ,w.x>=m&&w.x<=S&&w.y>=y&&w.y<=A&&w!==r&&w!==o&&ic(a,h,l,d,f,p,w.x,w.y)&&cn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;M&&M.z>=g;){if(M.x>=m&&M.x<=S&&M.y>=y&&M.y<=A&&M!==r&&M!==o&&ic(a,h,l,d,f,p,M.x,M.y)&&cn(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;w&&w.z<=_;){if(w.x>=m&&w.x<=S&&w.y>=y&&w.y<=A&&w!==r&&w!==o&&ic(a,h,l,d,f,p,w.x,w.y)&&cn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function GU(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Om(r,s)&&VR(r,i,i.next,s)&&Ef(r,s)&&Ef(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),wf(i),wf(i.next),i=n=s),i=i.next}while(i!==n);return Va(i)}function HU(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&ZU(o,a)){let l=WR(o,a);o=Va(o,o.next),l=Va(l,l.next),Mf(o,e,t,i,r,s,0),Mf(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function VU(n,e,t,i){const r=[];let s,o,a,l,f;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,f=HR(n,a,l,i,!1),f===f.next&&(f.steiner=!0),r.push(QU(f));for(r.sort(WU),s=0;s<r.length;s++)t=XU(r[s],t);return t}function WU(n,e){return n.x-e.x}function XU(n,e){const t=JU(n,e);if(!t)return e;const i=WR(t,n);return Va(i,i.next),Va(t,t.next)}function JU(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const p=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=s&&p>i&&(i=p,r=t.x<t.next.x?t:t.next,p===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,f=r.y;let h=1/0,d;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&ic(o<f?s:i,o,l,f,o<f?i:s,o,t.x,t.y)&&(d=Math.abs(o-t.y)/(s-t.x),Ef(t,n)&&(d<h||d===h&&(t.x>r.x||t.x===r.x&&jU(r,t)))&&(r=t,h=d)),t=t.next;while(t!==a);return r}function jU(n,e){return cn(n.prev,n,e.prev)<0&&cn(e.next,n,n.next)<0}function KU(n,e,t,i){let r=n;do r.z===0&&(r.z=o_(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,YU(r)}function YU(n){let e,t,i,r,s,o,a,l,f=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<f&&(a++,i=i.nextZ,!!i);e++);for(l=f;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,f*=2}while(o>1);return n}function o_(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function QU(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function ic(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function ZU(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!qU(n,e)&&(Ef(n,e)&&Ef(e,n)&&$U(n,e)&&(cn(n.prev,n,e.prev)||cn(n,e.prev,e))||Om(n,e)&&cn(n.prev,n,n.next)>0&&cn(e.prev,e,e.next)>0)}function cn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Om(n,e){return n.x===e.x&&n.y===e.y}function VR(n,e,t,i){const r=Xd(cn(n,e,t)),s=Xd(cn(n,e,i)),o=Xd(cn(t,i,n)),a=Xd(cn(t,i,e));return!!(r!==s&&o!==a||r===0&&Wd(n,t,e)||s===0&&Wd(n,i,e)||o===0&&Wd(t,n,i)||a===0&&Wd(t,e,i))}function Wd(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Xd(n){return n>0?1:n<0?-1:0}function qU(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&VR(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Ef(n,e){return cn(n.prev,n,n.next)<0?cn(n,e,n.next)>=0&&cn(n,n.prev,e)>=0:cn(n,e,n.prev)<0||cn(n,n.next,e)<0}function $U(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function WR(n,e){const t=new a_(n.i,n.x,n.y),i=new a_(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function n1(n,e,t,i){const r=new a_(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function wf(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function a_(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function eO(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class ls{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return ls.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];i1(e),r1(i,e);let o=e.length;t.forEach(i1);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,r1(i,t[l]);const a=OU.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function i1(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function r1(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class km extends ht{constructor(e=new Da([new de(.5,.5),new de(-.5,.5),new de(-.5,-.5),new de(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const f=e[a];o(f)}this.setAttribute("position",new Xe(r,3)),this.setAttribute("uv",new Xe(s,2)),this.computeVertexNormals();function o(a){const l=[],f=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:m-.1,S=t.bevelOffset!==void 0?t.bevelOffset:0,A=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:tO;let M,w=!1,B,T,b,L;g&&(M=g.getSpacedPoints(h),w=!0,p=!1,B=g.computeFrenetFrames(h,!1),T=new D,b=new D,L=new D),p||(A=0,m=0,y=0,S=0);const R=a.extractPoints(f);let P=R.shape;const U=R.holes;if(!ls.isClockWise(P)){P=P.reverse();for(let z=0,ve=U.length;z<ve;z++){const he=U[z];ls.isClockWise(he)&&(U[z]=he.reverse())}}const ie=ls.triangulateShape(P,U),G=P;for(let z=0,ve=U.length;z<ve;z++){const he=U[z];P=P.concat(he)}function J(z,ve,he){return ve||console.error("THREE.ExtrudeGeometry: vec does not exist"),z.clone().addScaledVector(ve,he)}const Z=P.length,ae=ie.length;function O(z,ve,he){let Me,pe,Ve;const De=z.x-ve.x,F=z.y-ve.y,I=he.x-z.x,$=he.y-z.y,_e=De*De+F*F,ye=De*$-F*I;if(Math.abs(ye)>Number.EPSILON){const me=Math.sqrt(_e),Ye=Math.sqrt(I*I+$*$),Be=ve.x-F/me,Fe=ve.y+De/me,nt=he.x-$/Ye,dt=he.y+I/Ye,xe=((nt-Be)*$-(dt-Fe)*I)/(De*$-F*I);Me=Be+De*xe-z.x,pe=Fe+F*xe-z.y;const It=Me*Me+pe*pe;if(It<=2)return new de(Me,pe);Ve=Math.sqrt(It/2)}else{let me=!1;De>Number.EPSILON?I>Number.EPSILON&&(me=!0):De<-Number.EPSILON?I<-Number.EPSILON&&(me=!0):Math.sign(F)===Math.sign($)&&(me=!0),me?(Me=-F,pe=De,Ve=Math.sqrt(_e)):(Me=De,pe=F,Ve=Math.sqrt(_e/2))}return new de(Me/Ve,pe/Ve)}const V=[];for(let z=0,ve=G.length,he=ve-1,Me=z+1;z<ve;z++,he++,Me++)he===ve&&(he=0),Me===ve&&(Me=0),V[z]=O(G[z],G[he],G[Me]);const H=[];let q,ne=V.concat();for(let z=0,ve=U.length;z<ve;z++){const he=U[z];q=[];for(let Me=0,pe=he.length,Ve=pe-1,De=Me+1;Me<pe;Me++,Ve++,De++)Ve===pe&&(Ve=0),De===pe&&(De=0),q[Me]=O(he[Me],he[Ve],he[De]);H.push(q),ne=ne.concat(q)}for(let z=0;z<A;z++){const ve=z/A,he=m*Math.cos(ve*Math.PI/2),Me=y*Math.sin(ve*Math.PI/2)+S;for(let pe=0,Ve=G.length;pe<Ve;pe++){const De=J(G[pe],V[pe],Me);Ce(De.x,De.y,-he)}for(let pe=0,Ve=U.length;pe<Ve;pe++){const De=U[pe];q=H[pe];for(let F=0,I=De.length;F<I;F++){const $=J(De[F],q[F],Me);Ce($.x,$.y,-he)}}}const Y=y+S;for(let z=0;z<Z;z++){const ve=p?J(P[z],ne[z],Y):P[z];w?(b.copy(B.normals[0]).multiplyScalar(ve.x),T.copy(B.binormals[0]).multiplyScalar(ve.y),L.copy(M[0]).add(b).add(T),Ce(L.x,L.y,L.z)):Ce(ve.x,ve.y,0)}for(let z=1;z<=h;z++)for(let ve=0;ve<Z;ve++){const he=p?J(P[ve],ne[ve],Y):P[ve];w?(b.copy(B.normals[z]).multiplyScalar(he.x),T.copy(B.binormals[z]).multiplyScalar(he.y),L.copy(M[z]).add(b).add(T),Ce(L.x,L.y,L.z)):Ce(he.x,he.y,d/h*z)}for(let z=A-1;z>=0;z--){const ve=z/A,he=m*Math.cos(ve*Math.PI/2),Me=y*Math.sin(ve*Math.PI/2)+S;for(let pe=0,Ve=G.length;pe<Ve;pe++){const De=J(G[pe],V[pe],Me);Ce(De.x,De.y,d+he)}for(let pe=0,Ve=U.length;pe<Ve;pe++){const De=U[pe];q=H[pe];for(let F=0,I=De.length;F<I;F++){const $=J(De[F],q[F],Me);w?Ce($.x,$.y+M[h-1].y,M[h-1].x+he):Ce($.x,$.y,d+he)}}}ue(),Se();function ue(){const z=r.length/3;if(p){let ve=0,he=Z*ve;for(let Me=0;Me<ae;Me++){const pe=ie[Me];Ze(pe[2]+he,pe[1]+he,pe[0]+he)}ve=h+A*2,he=Z*ve;for(let Me=0;Me<ae;Me++){const pe=ie[Me];Ze(pe[0]+he,pe[1]+he,pe[2]+he)}}else{for(let ve=0;ve<ae;ve++){const he=ie[ve];Ze(he[2],he[1],he[0])}for(let ve=0;ve<ae;ve++){const he=ie[ve];Ze(he[0]+Z*h,he[1]+Z*h,he[2]+Z*h)}}i.addGroup(z,r.length/3-z,0)}function Se(){const z=r.length/3;let ve=0;Te(G,ve),ve+=G.length;for(let he=0,Me=U.length;he<Me;he++){const pe=U[he];Te(pe,ve),ve+=pe.length}i.addGroup(z,r.length/3-z,1)}function Te(z,ve){let he=z.length;for(;--he>=0;){const Me=he;let pe=he-1;pe<0&&(pe=z.length-1);for(let Ve=0,De=h+A*2;Ve<De;Ve++){const F=Z*Ve,I=Z*(Ve+1),$=ve+Me+F,_e=ve+pe+F,ye=ve+pe+I,me=ve+Me+I;ot($,_e,ye,me)}}}function Ce(z,ve,he){l.push(z),l.push(ve),l.push(he)}function Ze(z,ve,he){Le(z),Le(ve),Le(he);const Me=r.length/3,pe=_.generateTopUV(i,r,Me-3,Me-2,Me-1);be(pe[0]),be(pe[1]),be(pe[2])}function ot(z,ve,he,Me){Le(z),Le(ve),Le(Me),Le(ve),Le(he),Le(Me);const pe=r.length/3,Ve=_.generateSideWallUV(i,r,pe-6,pe-3,pe-2,pe-1);be(Ve[0]),be(Ve[1]),be(Ve[3]),be(Ve[1]),be(Ve[2]),be(Ve[3])}function Le(z){r.push(l[z*3+0]),r.push(l[z*3+1]),r.push(l[z*3+2])}function be(z){s.push(z.x),s.push(z.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return nO(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new em[r.type]().fromJSON(r)),new km(i,e.options)}}const tO={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],f=e[r*3],h=e[r*3+1];return[new de(s,o),new de(a,l),new de(f,h)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],f=e[i*3],h=e[i*3+1],d=e[i*3+2],p=e[r*3],m=e[r*3+1],y=e[r*3+2],S=e[s*3],A=e[s*3+1],g=e[s*3+2];return Math.abs(a-h)<Math.abs(o-f)?[new de(o,1-l),new de(f,1-d),new de(p,1-y),new de(S,1-g)]:[new de(a,1-l),new de(h,1-d),new de(m,1-y),new de(A,1-g)]}};function nO(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class zm extends Wo{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new zm(e.radius,e.detail)}}class Hf extends Wo{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Hf(e.radius,e.detail)}}class Gm extends ht{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],f=[],h=[];let d=e;const p=(t-e)/r,m=new D,y=new de;for(let S=0;S<=r;S++){for(let A=0;A<=i;A++){const g=s+A/i*o;m.x=d*Math.cos(g),m.y=d*Math.sin(g),l.push(m.x,m.y,m.z),f.push(0,0,1),y.x=(m.x/t+1)/2,y.y=(m.y/t+1)/2,h.push(y.x,y.y)}d+=p}for(let S=0;S<r;S++){const A=S*(i+1);for(let g=0;g<i;g++){const _=g+A,M=_,w=_+i+1,B=_+i+2,T=_+1;a.push(M,w,T),a.push(w,B,T)}}this.setIndex(a),this.setAttribute("position",new Xe(l,3)),this.setAttribute("normal",new Xe(f,3)),this.setAttribute("uv",new Xe(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gm(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Hm extends ht{constructor(e=new Da([new de(0,.5),new de(-.5,-.5),new de(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)f(e);else for(let h=0;h<e.length;h++)f(e[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Xe(r,3)),this.setAttribute("normal",new Xe(s,3)),this.setAttribute("uv",new Xe(o,2));function f(h){const d=r.length/3,p=h.extractPoints(t);let m=p.shape;const y=p.holes;ls.isClockWise(m)===!1&&(m=m.reverse());for(let A=0,g=y.length;A<g;A++){const _=y[A];ls.isClockWise(_)===!0&&(y[A]=_.reverse())}const S=ls.triangulateShape(m,y);for(let A=0,g=y.length;A<g;A++){const _=y[A];m=m.concat(_)}for(let A=0,g=m.length;A<g;A++){const _=m[A];r.push(_.x,_.y,0),s.push(0,0,1),o.push(_.x,_.y)}for(let A=0,g=S.length;A<g;A++){const _=S[A],M=_[0]+d,w=_[1]+d,B=_[2]+d;i.push(M,w,B),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return iO(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new Hm(i,e.curveSegments)}}function iO(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Vf extends ht{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let f=0;const h=[],d=new D,p=new D,m=[],y=[],S=[],A=[];for(let g=0;g<=i;g++){const _=[],M=g/i;let w=0;g===0&&o===0?w=.5/t:g===i&&l===Math.PI&&(w=-.5/t);for(let B=0;B<=t;B++){const T=B/t;d.x=-e*Math.cos(r+T*s)*Math.sin(o+M*a),d.y=e*Math.cos(o+M*a),d.z=e*Math.sin(r+T*s)*Math.sin(o+M*a),y.push(d.x,d.y,d.z),p.copy(d).normalize(),S.push(p.x,p.y,p.z),A.push(T+w,1-M),_.push(f++)}h.push(_)}for(let g=0;g<i;g++)for(let _=0;_<t;_++){const M=h[g][_+1],w=h[g][_],B=h[g+1][_],T=h[g+1][_+1];(g!==0||o>0)&&m.push(M,w,T),(g!==i-1||l<Math.PI)&&m.push(w,B,T)}this.setIndex(m),this.setAttribute("position",new Xe(y,3)),this.setAttribute("normal",new Xe(S,3)),this.setAttribute("uv",new Xe(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vf(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Vm extends Wo{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Vm(e.radius,e.detail)}}class Wm extends ht{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],f=[],h=new D,d=new D,p=new D;for(let m=0;m<=i;m++)for(let y=0;y<=r;y++){const S=y/r*s,A=m/i*Math.PI*2;d.x=(e+t*Math.cos(A))*Math.cos(S),d.y=(e+t*Math.cos(A))*Math.sin(S),d.z=t*Math.sin(A),a.push(d.x,d.y,d.z),h.x=e*Math.cos(S),h.y=e*Math.sin(S),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),f.push(y/r),f.push(m/i)}for(let m=1;m<=i;m++)for(let y=1;y<=r;y++){const S=(r+1)*m+y-1,A=(r+1)*(m-1)+y-1,g=(r+1)*(m-1)+y,_=(r+1)*m+y;o.push(S,A,_),o.push(A,g,_)}this.setIndex(o),this.setAttribute("position",new Xe(a,3)),this.setAttribute("normal",new Xe(l,3)),this.setAttribute("uv",new Xe(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wm(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Xm extends ht{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],f=[],h=[],d=new D,p=new D,m=new D,y=new D,S=new D,A=new D,g=new D;for(let M=0;M<=i;++M){const w=M/i*s*Math.PI*2;_(w,s,o,e,m),_(w+.01,s,o,e,y),A.subVectors(y,m),g.addVectors(y,m),S.crossVectors(A,g),g.crossVectors(S,A),S.normalize(),g.normalize();for(let B=0;B<=r;++B){const T=B/r*Math.PI*2,b=-t*Math.cos(T),L=t*Math.sin(T);d.x=m.x+(b*g.x+L*S.x),d.y=m.y+(b*g.y+L*S.y),d.z=m.z+(b*g.z+L*S.z),l.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),f.push(p.x,p.y,p.z),h.push(M/i),h.push(B/r)}}for(let M=1;M<=i;M++)for(let w=1;w<=r;w++){const B=(r+1)*(M-1)+(w-1),T=(r+1)*M+(w-1),b=(r+1)*M+w,L=(r+1)*(M-1)+w;a.push(B,T,L),a.push(T,b,L)}this.setIndex(a),this.setAttribute("position",new Xe(l,3)),this.setAttribute("normal",new Xe(f,3)),this.setAttribute("uv",new Xe(h,2));function _(M,w,B,T,b){const L=Math.cos(M),R=Math.sin(M),P=B/w*M,U=Math.cos(P);b.x=T*(2+U)*.5*L,b.y=T*(2+U)*R*.5,b.z=T*Math.sin(P)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xm(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Jm extends ht{constructor(e=new Wx(new D(-1,-1,0),new D(-1,1,0),new D(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new D,l=new D,f=new de;let h=new D;const d=[],p=[],m=[],y=[];S(),this.setIndex(y),this.setAttribute("position",new Xe(d,3)),this.setAttribute("normal",new Xe(p,3)),this.setAttribute("uv",new Xe(m,2));function S(){for(let M=0;M<t;M++)A(M);A(s===!1?t:0),_(),g()}function A(M){h=e.getPointAt(M/t,h);const w=o.normals[M],B=o.binormals[M];for(let T=0;T<=r;T++){const b=T/r*Math.PI*2,L=Math.sin(b),R=-Math.cos(b);l.x=R*w.x+L*B.x,l.y=R*w.y+L*B.y,l.z=R*w.z+L*B.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=h.x+i*l.x,a.y=h.y+i*l.y,a.z=h.z+i*l.z,d.push(a.x,a.y,a.z)}}function g(){for(let M=1;M<=t;M++)for(let w=1;w<=r;w++){const B=(r+1)*(M-1)+(w-1),T=(r+1)*M+(w-1),b=(r+1)*M+w,L=(r+1)*(M-1)+w;y.push(B,T,L),y.push(T,b,L)}}function _(){for(let M=0;M<=t;M++)for(let w=0;w<=r;w++)f.x=M/t,f.y=w/r,m.push(f.x,f.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Jm(new em[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class XR extends ht{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new D,s=new D;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let f=0,h=l.length;f<h;++f){const d=l[f],p=d.start,m=d.count;for(let y=p,S=p+m;y<S;y+=3)for(let A=0;A<3;A++){const g=a.getX(y+A),_=a.getX(y+(A+1)%3);r.fromBufferAttribute(o,g),s.fromBufferAttribute(o,_),s1(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let f=0;f<3;f++){const h=3*a+f,d=3*a+(f+1)%3;r.fromBufferAttribute(o,h),s.fromBufferAttribute(o,d),s1(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Xe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function s1(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var o1=Object.freeze({__proto__:null,BoxGeometry:Ka,CapsuleGeometry:Dm,CircleGeometry:Fm,ConeGeometry:Nm,CylinderGeometry:Uc,DodecahedronGeometry:Um,EdgesGeometry:GR,ExtrudeGeometry:km,IcosahedronGeometry:zm,LatheGeometry:Gf,OctahedronGeometry:Hf,PlaneGeometry:kf,PolyhedronGeometry:Wo,RingGeometry:Gm,ShapeGeometry:Hm,SphereGeometry:Vf,TetrahedronGeometry:Vm,TorusGeometry:Wm,TorusKnotGeometry:Xm,TubeGeometry:Jm,WireframeGeometry:XR});class JR extends Ln{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Pe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class jR extends ds{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Wf extends Ln{constructor(e){super(),this.isMeshStandardMaterial=!0,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=Vo,this.normalScale=new de(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.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Mr extends Wf{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new de(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return vn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Pe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Pe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ju extends Ln{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Pe(16777215),this.specular=new Pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vo,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Df,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class KR extends Ln{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vo,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class YR extends Ln{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vo,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Jx extends Ln{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vo,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Df,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class QR extends Ln{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vo,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ZR extends $n{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function wa(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function qR(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function $R(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function l_(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function jx(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function rO(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const f=s.tracks[l],h=f.getValueSize(),d=[],p=[];for(let m=0;m<f.times.length;++m){const y=f.times[m]*r;if(!(y<t||y>=i)){d.push(f.times[m]);for(let S=0;S<h;++S)p.push(f.values[m*h+S])}}d.length!==0&&(f.times=wa(d,f.times.constructor),f.values=wa(p,f.values.constructor),o.push(f))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function sO(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const f=n.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(f===void 0)continue;let h=0;const d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=d/3);let p=0;const m=f.getValueSize();f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);const y=a.times.length-1;let S;if(s<=a.times[0]){const g=h,_=d-h;S=a.values.slice(g,_)}else if(s>=a.times[y]){const g=y*d+h,_=g+d-h;S=a.values.slice(g,_)}else{const g=a.createInterpolant(),_=h,M=d-h;g.evaluate(s),S=g.resultBuffer.slice(_,M)}l==="quaternion"&&new $t().fromArray(S).normalize().conjugate().toArray(S);const A=f.times.length;for(let g=0;g<A;++g){const _=g*m+p;if(l==="quaternion")$t.multiplyQuaternionsFlat(f.values,_,S,0,f.values,_);else{const M=m-p*2;for(let w=0;w<M;++w)f.values[_+w]-=S[w]}}}return n.blendMode=Sx,n}const oO={convertArray:wa,isTypedArray:qR,getKeyframeOrder:$R,sortedArray:l_,flattenJSON:jx,subclip:rO,makeClipAdditive:sO};class Oc{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class eb extends Oc{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Sa,endingEnd:Sa}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ma:s=e,a=2*t-i;break;case gf:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case Ma:o=e,l=2*i-t;break;case gf:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const f=(i-t)*.5,h=this.valueSize;this._weightPrev=f/(t-a),this._weightNext=f/(l-i),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,f=l-a,h=this._offsetPrev,d=this._offsetNext,p=this._weightPrev,m=this._weightNext,y=(i-t)/(r-t),S=y*y,A=S*y,g=-p*A+2*p*S-p*y,_=(1+p)*A+(-1.5-2*p)*S+(-.5+p)*y+1,M=(-1-m)*A+(1.5+m)*S+.5*y,w=m*A-m*S;for(let B=0;B!==a;++B)s[B]=g*o[h+B]+_*o[f+B]+M*o[l+B]+w*o[d+B];return s}}class Kx extends Oc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,f=l-a,h=(i-t)/(r-t),d=1-h;for(let p=0;p!==a;++p)s[p]=o[f+p]*d+o[l+p]*h;return s}}class tb extends Oc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Wr{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=wa(t,this.TimeBufferType),this.values=wa(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:wa(e.times,Array),values:wa(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new tb(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Kx(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new eb(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ec:t=this.InterpolantFactoryMethodDiscrete;break;case Ga:t=this.InterpolantFactoryMethodLinear;break;case Sp:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ec;case this.InterpolantFactoryMethodLinear:return Ga;case this.InterpolantFactoryMethodSmooth:return Sp}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&qR(r))for(let a=0,l=r.length;a!==l;++a){const f=r[a];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Sp,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const f=e[a],h=e[a+1];if(f!==h&&(a!==1||f!==e[0]))if(r)l=!0;else{const d=a*i,p=d-i,m=d+i;for(let y=0;y!==i;++y){const S=t[d+y];if(S!==t[p+y]||S!==t[m+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const d=a*i,p=o*i;for(let m=0;m!==i;++m)t[p+m]=t[d+m]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,f=0;f!==i;++f)t[l+f]=t[a+f];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Wr.prototype.TimeBufferType=Float32Array;Wr.prototype.ValueBufferType=Float32Array;Wr.prototype.DefaultInterpolation=Ga;class Ya extends Wr{}Ya.prototype.ValueTypeName="bool";Ya.prototype.ValueBufferType=Array;Ya.prototype.DefaultInterpolation=Ec;Ya.prototype.InterpolantFactoryMethodLinear=void 0;Ya.prototype.InterpolantFactoryMethodSmooth=void 0;class Yx extends Wr{}Yx.prototype.ValueTypeName="color";class Oo extends Wr{}Oo.prototype.ValueTypeName="number";class nb extends Oc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let f=e*a;for(let h=f+a;f!==h;f+=4)$t.slerpFlat(s,0,o,f-a,o,f,l);return s}}class Js extends Wr{InterpolantFactoryMethodLinear(e){return new nb(this.times,this.values,this.getValueSize(),e)}}Js.prototype.ValueTypeName="quaternion";Js.prototype.DefaultInterpolation=Ga;Js.prototype.InterpolantFactoryMethodSmooth=void 0;class Qa extends Wr{}Qa.prototype.ValueTypeName="string";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=Ec;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;class ko extends Wr{}ko.prototype.ValueTypeName="vector";class Wa{constructor(e,t=-1,i,r=Mm){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Ki(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(lO(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(Wr.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],f=[];l.push((a+s-1)%s,a,(a+1)%s),f.push(0,1,0);const h=$R(l);l=l_(l,1,h),f=l_(f,1,h),!r&&l[0]===0&&(l.push(s),f.push(f[0])),o.push(new Oo(".morphTargetInfluences["+t[a].name+"]",l,f).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const f=e[a],h=f.name.match(s);if(h&&h.length>1){const d=h[1];let p=r[d];p||(r[d]=p=[]),p.push(f)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(d,p,m,y,S){if(m.length!==0){const A=[],g=[];jx(m,A,g,y),A.length!==0&&S.push(new d(p,A,g))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const f=e.hierarchy||[];for(let d=0;d<f.length;d++){const p=f[d].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const m={};let y;for(y=0;y<p.length;y++)if(p[y].morphTargets)for(let S=0;S<p[y].morphTargets.length;S++)m[p[y].morphTargets[S]]=-1;for(const S in m){const A=[],g=[];for(let _=0;_!==p[y].morphTargets.length;++_){const M=p[y];A.push(M.time),g.push(M.morphTarget===S?1:0)}r.push(new Oo(".morphTargetInfluence["+S+"]",A,g))}l=m.length*o}else{const m=".bones["+t[d].name+"]";i(ko,m+".position",p,"pos",r),i(Js,m+".quaternion",p,"rot",r),i(ko,m+".scale",p,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function aO(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Oo;case"vector":case"vector2":case"vector3":case"vector4":return ko;case"color":return Yx;case"quaternion":return Js;case"bool":case"boolean":return Ya;case"string":return Qa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function lO(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=aO(n.type);if(n.times===void 0){const t=[],i=[];jx(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Ns={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class Qx{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const f=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){a++,s===!1&&r.onStart!==void 0&&r.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,r.onProgress!==void 0&&r.onProgress(h,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return f.push(h,d),this},this.removeHandler=function(h){const d=f.indexOf(h);return d!==-1&&f.splice(d,2),this},this.getHandler=function(h){for(let d=0,p=f.length;d<p;d+=2){const m=f[d],y=f[d+1];if(m.global&&(m.lastIndex=0),m.test(h))return y}return null}}}const ib=new Qx;class ei{constructor(e){this.manager=e!==void 0?e:ib,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}ei.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ts={};class cO extends Error{constructor(e,t){super(e),this.response=t}}class Di extends ei{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ns.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ts[e]!==void 0){Ts[e].push({onLoad:t,onProgress:i,onError:r});return}Ts[e]=[],Ts[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const h=Ts[e],d=f.body.getReader(),p=f.headers.get("Content-Length")||f.headers.get("X-File-Size"),m=p?parseInt(p):0,y=m!==0;let S=0;const A=new ReadableStream({start(g){_();function _(){d.read().then(({done:M,value:w})=>{if(M)g.close();else{S+=w.byteLength;const B=new ProgressEvent("progress",{lengthComputable:y,loaded:S,total:m});for(let T=0,b=h.length;T<b;T++){const L=h[T];L.onProgress&&L.onProgress(B)}g.enqueue(w),_()}})}}});return new Response(A)}else throw new cO(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(l){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return f.json();default:if(a===void 0)return f.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return f.arrayBuffer().then(y=>m.decode(y))}}}).then(f=>{Ns.add(e,f);const h=Ts[e];delete Ts[e];for(let d=0,p=h.length;d<p;d++){const m=h[d];m.onLoad&&m.onLoad(f)}}).catch(f=>{const h=Ts[e];if(h===void 0)throw this.manager.itemError(e),f;delete Ts[e];for(let d=0,p=h.length;d<p;d++){const m=h[d];m.onError&&m.onError(f)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class uO extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Di(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Wa.parse(e[i]);t.push(r)}return t}}class fO extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new Im,l=new Di(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let f=0;function h(d){l.load(e[d],function(p){const m=s.parse(p,!0);o[d]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},f+=1,f===6&&(m.mipmapCount===1&&(a.minFilter=ln),a.image=o,a.format=m.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let d=0,p=e.length;d<p;++d)h(d);else l.load(e,function(d){const p=s.parse(d,!0);if(p.isCubemap){const m=p.mipmaps.length/p.mipmapCount;for(let y=0;y<m;y++){o[y]={mipmaps:[]};for(let S=0;S<p.mipmapCount;S++)o[y].mipmaps.push(p.mipmaps[y*p.mipmapCount+S]),o[y].format=p.format,o[y].width=p.width,o[y].height=p.height}a.image=o}else a.image.width=p.width,a.image.height=p.height,a.mipmaps=p.mipmaps;p.mipmapCount===1&&(a.minFilter=ln),a.format=p.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Tf extends ei{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ns.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Af("img");function l(){h(),Ns.add(e,this),t&&t(this),s.manager.itemEnd(e)}function f(d){h(),r&&r(d),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",f,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",f,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class hO extends ei{constructor(e){super(e)}load(e,t,i,r){const s=new Uf;s.colorSpace=Pn;const o=new Tf(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(f){o.load(e[f],function(h){s.images[f]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let f=0;f<e.length;++f)l(f);return s}}class dO extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new La,a=new Di(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let f;try{f=s.parse(l)}catch(h){if(r!==void 0)r(h);else{console.error(h);return}}f.image!==void 0?o.image=f.image:f.data!==void 0&&(o.image.width=f.width,o.image.height=f.height,o.image.data=f.data),o.wrapS=f.wrapS!==void 0?f.wrapS:Bn,o.wrapT=f.wrapT!==void 0?f.wrapT:Bn,o.magFilter=f.magFilter!==void 0?f.magFilter:ln,o.minFilter=f.minFilter!==void 0?f.minFilter:ln,o.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.colorSpace!==void 0?o.colorSpace=f.colorSpace:f.encoding!==void 0&&(o.encoding=f.encoding),f.flipY!==void 0&&(o.flipY=f.flipY),f.format!==void 0&&(o.format=f.format),f.type!==void 0&&(o.type=f.type),f.mipmaps!==void 0&&(o.mipmaps=f.mipmaps,o.minFilter=fs),f.mipmapCount===1&&(o.minFilter=ln),f.generateMipmaps!==void 0&&(o.generateMipmaps=f.generateMipmaps),o.needsUpdate=!0,t&&t(o,f)},i,r),o}}class Zx extends ei{constructor(e){super(e)}load(e,t,i,r){const s=new en,o=new Tf(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Xo extends wt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Pe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class rb extends Xo{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(wt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Pe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const c0=new Ue,a1=new D,l1=new D;class qx{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new de(512,512),this.map=null,this.mapPass=null,this.matrix=new Ue,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Of,this._frameExtents=new de(1,1),this._viewportCount=1,this._viewports=[new Nt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;a1.setFromMatrixPosition(e.matrixWorld),t.position.copy(a1),l1.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(l1),t.updateMatrixWorld(),c0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(c0),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(c0)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class pO extends qx{constructor(){super(new Qt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Tc*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class jm extends Xo{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(wt.DEFAULT_UP),this.updateMatrix(),this.target=new wt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new pO}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const c1=new Ue,Eu=new D,u0=new D;class mO extends qx{constructor(){super(new Qt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new de(4,2),this._viewportCount=6,this._viewports=[new Nt(2,1,1,1),new Nt(0,1,1,1),new Nt(3,1,1,1),new Nt(1,1,1,1),new Nt(3,0,1,1),new Nt(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Eu.setFromMatrixPosition(e.matrixWorld),i.position.copy(Eu),u0.copy(i.position),u0.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(u0),i.updateMatrixWorld(),r.makeTranslation(-Eu.x,-Eu.y,-Eu.z),c1.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(c1)}}class Cf extends Xo{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new mO}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class gO extends qx{constructor(){super(new _r(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Km extends Xo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wt.DEFAULT_UP),this.updateMatrix(),this.target=new wt,this.shadow=new gO}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class $x extends Xo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sb extends Xo{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class ob{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new D)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class ab extends Xo{constructor(e=new ob,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ym extends ei{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Di(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=Ym.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new Pe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new Pe().setHex(o.value);break;case"v2":r.uniforms[s].value=new de().fromArray(o.value);break;case"v3":r.uniforms[s].value=new D().fromArray(o.value);break;case"v4":r.uniforms[s].value=new Nt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new xt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new Ue().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new de().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new de().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:JR,SpriteMaterial:Nx,RawShaderMaterial:jR,ShaderMaterial:ds,PointsMaterial:Bm,MeshPhysicalMaterial:Mr,MeshStandardMaterial:Wf,MeshPhongMaterial:ju,MeshToonMaterial:KR,MeshNormalMaterial:YR,MeshLambertMaterial:Jx,MeshDepthMaterial:Ix,MeshDistanceMaterial:Lx,MeshBasicMaterial:Ji,MeshMatcapMaterial:QR,LineDashedMaterial:ZR,LineBasicMaterial:$n,Material:Ln};return new t[e]}}class ks{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class lb extends ht{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class cb extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Di(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(m,y){if(t[y]!==void 0)return t[y];const A=m.interleavedBuffers[y],g=s(m,A.buffer),_=ec(A.type,g),M=new zf(_,A.stride);return M.uuid=A.uuid,t[y]=M,M}function s(m,y){if(i[y]!==void 0)return i[y];const A=m.arrayBuffers[y],g=new Uint32Array(A).buffer;return i[y]=g,g}const o=e.isInstancedBufferGeometry?new lb:new ht,a=e.data.index;if(a!==void 0){const m=ec(a.type,a.array);o.setIndex(new Dt(m,1))}const l=e.data.attributes;for(const m in l){const y=l[m];let S;if(y.isInterleavedBufferAttribute){const A=r(e.data,y.data);S=new Uo(A,y.itemSize,y.offset,y.normalized)}else{const A=ec(y.type,y.array),g=y.isInstancedBufferAttribute?Ha:Dt;S=new g(A,y.itemSize,y.normalized)}y.name!==void 0&&(S.name=y.name),y.usage!==void 0&&S.setUsage(y.usage),o.setAttribute(m,S)}const f=e.data.morphAttributes;if(f)for(const m in f){const y=f[m],S=[];for(let A=0,g=y.length;A<g;A++){const _=y[A];let M;if(_.isInterleavedBufferAttribute){const w=r(e.data,_.data);M=new Uo(w,_.itemSize,_.offset,_.normalized)}else{const w=ec(_.type,_.array);M=new Dt(w,_.itemSize,_.normalized)}_.name!==void 0&&(M.name=_.name),S.push(M)}o.morphAttributes[m]=S}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let m=0,y=d.length;m!==y;++m){const S=d[m];o.addGroup(S.start,S.count,S.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const m=new D;p.center!==void 0&&m.fromArray(p.center),o.boundingSphere=new Zn(m,p.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class vO extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?ks.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Di(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let f=null;try{f=JSON.parse(l)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const h=f.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(f,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?ks.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Di(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(f)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),f=this.parseObject(e.object,s,l,a,i),h=this.parseSkeletons(e.skeletons,f);if(this.bindSkeletons(f,h),t!==void 0){let d=!1;for(const p in o)if(o[p].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(f)}return f}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),f=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,f),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new Da().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Nc().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new cb;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in o1?a=o1[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new Ym;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Wa.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const f=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:i.resourcePath+f;return o(h)}else return l.data?{data:ec(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Qx(t);s=new Tf(l),s.setCrossOrigin(this.crossOrigin);for(let f=0,h=e.length;f<h;f++){const d=e[f],p=d.url;if(Array.isArray(p)){const m=[];for(let y=0,S=p.length;y<S;y++){const A=p[y],g=a(A);g!==null&&(g instanceof HTMLImageElement?m.push(g):m.push(new La(g.data,g.width,g.height)))}r[d.uuid]=new Ea(m)}else{const m=a(d.url);r[d.uuid]=new Ea(m)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:ec(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Tf(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],f=l.url;if(Array.isArray(f)){const h=[];for(let d=0,p=f.length;d<p;d++){const m=f[d],y=await s(m);y!==null&&(y instanceof HTMLImageElement?h.push(y):h.push(new La(y.data,y.width,y.height)))}i[l.uuid]=new Ea(h)}else{const h=await s(l.url);i[l.uuid]=new Ea(h)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],f=l.data;let h;Array.isArray(f)?(h=new Uf,f.length===6&&(h.needsUpdate=!0)):(f&&f.data?h=new La:h=new en,f&&(h.needsUpdate=!0)),h.source=l,h.uuid=a.uuid,a.name!==void 0&&(h.name=a.name),a.mapping!==void 0&&(h.mapping=i(a.mapping,yO)),a.channel!==void 0&&(h.channel=a.channel),a.offset!==void 0&&h.offset.fromArray(a.offset),a.repeat!==void 0&&h.repeat.fromArray(a.repeat),a.center!==void 0&&h.center.fromArray(a.center),a.rotation!==void 0&&(h.rotation=a.rotation),a.wrap!==void 0&&(h.wrapS=i(a.wrap[0],u1),h.wrapT=i(a.wrap[1],u1)),a.format!==void 0&&(h.format=a.format),a.internalFormat!==void 0&&(h.internalFormat=a.internalFormat),a.type!==void 0&&(h.type=a.type),a.colorSpace!==void 0&&(h.colorSpace=a.colorSpace),a.encoding!==void 0&&(h.encoding=a.encoding),a.minFilter!==void 0&&(h.minFilter=i(a.minFilter,f1)),a.magFilter!==void 0&&(h.magFilter=i(a.magFilter,f1)),a.anisotropy!==void 0&&(h.anisotropy=a.anisotropy),a.flipY!==void 0&&(h.flipY=a.flipY),a.generateMipmaps!==void 0&&(h.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(h.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(h.compareFunction=a.compareFunction),a.userData!==void 0&&(h.userData=a.userData),r[a.uuid]=h}return r}parseObject(e,t,i,r,s){let o;function a(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function l(p){if(p!==void 0){if(Array.isArray(p)){const m=[];for(let y=0,S=p.length;y<S;y++){const A=p[y];i[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",A),m.push(i[A])}return m}return i[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),i[p]}}function f(p){return r[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),r[p]}let h,d;switch(e.type){case"Scene":o=new Fx,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Pe(e.background):o.background=f(e.background)),e.environment!==void 0&&(o.environment=f(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new bm(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Rm(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":o=new Qt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new _r(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new $x(e.color,e.intensity);break;case"DirectionalLight":o=new Km(e.color,e.intensity);break;case"PointLight":o=new Cf(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new sb(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new jm(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new rb(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new ab().fromJSON(e);break;case"SkinnedMesh":h=a(e.geometry),d=l(e.material),o=new Pm(h,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":h=a(e.geometry),d=l(e.material),o=new Mn(h,d);break;case"InstancedMesh":h=a(e.geometry),d=l(e.material);const p=e.count,m=e.instanceMatrix,y=e.instanceColor;o=new Ux(h,d,p),o.instanceMatrix=new Ha(new Float32Array(m.array),16),y!==void 0&&(o.instanceColor=new Ha(new Float32Array(y.array),y.itemSize));break;case"BatchedMesh":h=a(e.geometry),d=l(e.material),o=new FR(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=h,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(S=>{const A=new Qn;A.min.fromArray(S.boxMin),A.max.fromArray(S.boxMax);const g=new Zn;return g.radius=S.sphereRadius,g.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:A,sphereInitialized:S.sphereInitialized,sphere:g}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=f(e.matricesTexture.uuid);break;case"LOD":o=new DR;break;case"Line":o=new ps(a(e.geometry),l(e.material));break;case"LineLoop":o=new Ox(a(e.geometry),l(e.material));break;case"LineSegments":o=new Vr(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new kx(a(e.geometry),l(e.material));break;case"Sprite":o=new LR(l(e.material));break;case"Group":o=new Or;break;case"Bone":o=new Rc;break;default:o=new wt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let m=0;m<p.length;m++)o.add(this.parseObject(p[m],t,i,r,s))}if(e.animations!==void 0){const p=e.animations;for(let m=0;m<p.length;m++){const y=p[m];o.animations.push(s[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const p=e.levels;for(let m=0;m<p.length;m++){const y=p[m],S=o.getObjectByProperty("uuid",y.object);S!==void 0&&o.addLevel(S,y.distance,y.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const yO={UVMapping:xm,CubeReflectionMapping:Xs,CubeRefractionMapping:No,EquirectangularReflectionMapping:Ac,EquirectangularRefractionMapping:pf,CubeUVReflectionMapping:Dc},u1={RepeatWrapping:us,ClampToEdgeWrapping:Bn,MirroredRepeatWrapping:Sc},f1={NearestFilter:gn,NearestMipmapNearestFilter:mf,NearestMipmapLinearFilter:fc,LinearFilter:ln,LinearMipmapNearestFilter:Am,LinearMipmapLinearFilter:fs};class ub extends ei{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ns.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(f=>{t&&t(f),s.manager.itemEnd(e)}).catch(f=>{r&&r(f)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(f){return Ns.add(e,f),t&&t(f),s.manager.itemEnd(e),f}).catch(function(f){r&&r(f),Ns.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Ns.add(e,l),s.manager.itemStart(e)}}let Jd;class eA{static getContext(){return Jd===void 0&&(Jd=new(window.AudioContext||window.webkitAudioContext)),Jd}static setContext(e){Jd=e}}class _O extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Di(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const f=l.slice(0);eA.getContext().decodeAudioData(f,function(d){t(d)}).catch(a)}catch(f){a(f)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const h1=new Ue,d1=new Ue,aa=new Ue;class xO{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Qt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Qt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,aa.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(Ba*t.fov*.5)/t.zoom;let a,l;d1.elements[12]=-r,h1.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,aa.elements[0]=2*t.near/(l-a),aa.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(aa),a=-o*t.aspect-s,l=o*t.aspect-s,aa.elements[0]=2*t.near/(l-a),aa.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(aa)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(d1),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(h1)}}class tA{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=p1(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=p1();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function p1(){return(typeof performance>"u"?Date:performance).now()}const la=new D,m1=new $t,AO=new D,ca=new D;class SO extends wt{constructor(){super(),this.type="AudioListener",this.context=eA.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new tA}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(la,m1,AO),ca.set(0,0,-1).applyQuaternion(m1),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(la.x,r),t.positionY.linearRampToValueAtTime(la.y,r),t.positionZ.linearRampToValueAtTime(la.z,r),t.forwardX.linearRampToValueAtTime(ca.x,r),t.forwardY.linearRampToValueAtTime(ca.y,r),t.forwardZ.linearRampToValueAtTime(ca.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(la.x,la.y,la.z),t.setOrientation(ca.x,ca.y,ca.z,i.x,i.y,i.z)}}class fb extends wt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const ua=new D,g1=new $t,MO=new D,fa=new D;class EO extends fb{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(ua,g1,MO),fa.set(0,0,1).applyQuaternion(g1);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ua.x,i),t.positionY.linearRampToValueAtTime(ua.y,i),t.positionZ.linearRampToValueAtTime(ua.z,i),t.orientationX.linearRampToValueAtTime(fa.x,i),t.orientationY.linearRampToValueAtTime(fa.y,i),t.orientationZ.linearRampToValueAtTime(fa.z,i)}else t.setPosition(ua.x,ua.y,ua.z),t.setOrientation(fa.x,fa.y,fa.z)}}class wO{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class hb{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,f=t+t;l!==f;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){$t.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;$t.multiplyQuaternionsFlat(e,o,e,t,e,i),$t.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const nA="\\[\\]\\.:\\/",TO=new RegExp("["+nA+"]","g"),iA="[^"+nA+"]",CO="[^"+nA.replace("\\.","")+"]",RO=/((?:WC+[\/:])*)/.source.replace("WC",iA),bO=/(WCOD+)?/.source.replace("WCOD",CO),PO=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",iA),BO=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",iA),IO=new RegExp("^"+RO+bO+PO+BO+"$"),LO=["material","materials","bones","map"];class DO{constructor(e,t,i){const r=i||Ct.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Ct{constructor(e,t,i){this.path=t,this.parsedPath=i||Ct.parseTrackName(t),this.node=Ct.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Ct.Composite(e,t,i):new Ct(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(TO,"")}static parseTrackName(e){const t=IO.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);LO.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Ct.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let f=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===f){f=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(f!==void 0){if(e[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[f]}}const o=e[r];if(o===void 0){const f=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ct.Composite=DO;Ct.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ct.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ct.prototype.GetterByBindingType=[Ct.prototype._getValue_direct,Ct.prototype._getValue_array,Ct.prototype._getValue_arrayElement,Ct.prototype._getValue_toArray];Ct.prototype.SetterByBindingTypeAndVersioning=[[Ct.prototype._setValue_direct,Ct.prototype._setValue_direct_setNeedsUpdate,Ct.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ct.prototype._setValue_array,Ct.prototype._setValue_array_setNeedsUpdate,Ct.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ct.prototype._setValue_arrayElement,Ct.prototype._setValue_arrayElement_setNeedsUpdate,Ct.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ct.prototype._setValue_fromArray,Ct.prototype._setValue_fromArray_setNeedsUpdate,Ct.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class FO{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ki(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,f=this.nCachedObjects_;for(let h=0,d=arguments.length;h!==d;++h){const p=arguments[h],m=p.uuid;let y=t[m];if(y===void 0){y=l++,t[m]=y,e.push(p);for(let S=0,A=o;S!==A;++S)s[S].push(new Ct(p,i[S],r[S]))}else if(y<f){a=e[y];const S=--f,A=e[S];t[A.uuid]=y,e[y]=A,t[m]=S,e[S]=p;for(let g=0,_=o;g!==_;++g){const M=s[g],w=M[S];let B=M[y];M[y]=w,B===void 0&&(B=new Ct(p,i[g],r[g])),M[S]=B}}else e[y]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],f=l.uuid,h=t[f];if(h!==void 0&&h>=s){const d=s++,p=e[d];t[p.uuid]=h,e[h]=p,t[f]=d,e[d]=l;for(let m=0,y=r;m!==y;++m){const S=i[m],A=S[d],g=S[h];S[h]=A,S[d]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const f=arguments[a],h=f.uuid,d=t[h];if(d!==void 0)if(delete t[h],d<s){const p=--s,m=e[p],y=--o,S=e[y];t[m.uuid]=d,e[d]=m,t[S.uuid]=p,e[p]=S,e.pop();for(let A=0,g=r;A!==g;++A){const _=i[A],M=_[p],w=_[y];_[d]=M,_[p]=w,_.pop()}}else{const p=--o,m=e[p];p>0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let y=0,S=r;y!==S;++y){const A=i[y];A[d]=A[p],A.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,f=l.length,h=this.nCachedObjects_,d=new Array(f);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(d);for(let p=h,m=l.length;p!==m;++p){const y=l[p];d[p]=new Ct(y,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],f=e[a];t[f]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class db{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Sa,endingEnd:Sa};for(let f=0;f!==o;++f){const h=s[f].createInterpolant(null);a[f]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=nR,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,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,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,f=a.sampleValues;return l[0]=s,l[1]=s+i,f[0]=e/o,f[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Sx:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(o),f[h].accumulateAdditive(a);break;case Mm:default:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(o),f[h].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===iR;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===tR){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const f=e<0;this._setEndings(f,!f,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 t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Ma,r.endingEnd=Ma):(e?r.endingStart=this.zeroSlopeAtStart?Ma:Sa:r.endingStart=gf,t?r.endingEnd=this.zeroSlopeAtEnd?Ma:Sa:r.endingEnd=gf)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const NO=new Float32Array(1);class pb extends Ks{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,f=this._bindingsByRootAndName;let h=f[l];h===void 0&&(h={},f[l]=h);for(let d=0;d!==s;++d){const p=r[d],m=p.name;let y=h[m];if(y!==void 0)++y.referenceCount,o[d]=y;else{if(y=o[d],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,l,m));continue}const S=t&&t._propertyBindings[d].binding.parsedPath;y=new hb(Ct.create(i,m,S),p.ValueTypeName,p.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,l,m),o[d]=y}a[d].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,f=l[l.length-1],h=e._byClipCacheIndex;f._byClipCacheIndex=h,l[h]=f,l.pop(),e._byClipCacheIndex=null;const d=a.actionByRoot,p=(e._localRoot||this._root).uuid;delete d[p],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],f=e._cacheIndex;l._cacheIndex=f,t[f]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new Kx(new Float32Array(2),new Float32Array(2),1,NO),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Wa.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let f=null;if(i===void 0&&(o!==null?i=o.blendMode:i=Mm),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===i)return d;f=l.knownActions[0],o===null&&(o=f._clip)}if(o===null)return null;const h=new db(this,o,t,i);return this._bindAction(h,f),this._addInactiveAction(h,a,s),h}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Wa.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let f=0;f!==i;++f)t[f]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let f=0;f!==l;++f)a[f].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const f=o[a];this._deactivateAction(f);const h=f._cacheIndex,d=t[t.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,d._cacheIndex=h,t[h]=d,t.pop(),this._removeInactiveBindingsForAction(f)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class rA{constructor(e){this.value=e}clone(){return new rA(this.value.clone===void 0?this.value:this.value.clone())}}let UO=0;class OO extends Ks{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:UO++}),this.name="",this.usage=xf,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class kO extends zf{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class zO{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class mb{constructor(e,t,i=0,r=1/0){this.ray=new ja(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Ia,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return c_(e,this,i,t),i.sort(v1),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)c_(e[r],this,i,t);return i.sort(v1),i}}function v1(n,e){return n.distance-e.distance}function c_(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,o=r.length;s<o;s++)c_(r[s],e,t,!0)}}class u_{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,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,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(vn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class GO{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const y1=new de;class HO{constructor(e=new de(1/0,1/0),t=new de(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=y1.copy(t).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 this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,y1).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _1=new D,jd=new D;class VO{constructor(e=new D,t=new D){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){_1.subVectors(e,this.start),jd.subVectors(this.end,this.start);const i=jd.dot(jd);let s=jd.dot(_1)/i;return t&&(s=vn(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const x1=new D;class WO extends wt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new ht,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const f=o/l*Math.PI*2,h=a/l*Math.PI*2;r.push(Math.cos(f),Math.sin(f),1,Math.cos(h),Math.sin(h),1)}i.setAttribute("position",new Xe(r,3));const s=new $n({fog:!1,toneMapped:!1});this.cone=new Vr(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),x1.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(x1),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const fo=new D,Kd=new Ue,f0=new Ue;class XO extends Vr{constructor(e){const t=gb(e),i=new ht,r=[],s=[],o=new Pe(0,0,1),a=new Pe(0,1,0);for(let f=0;f<t.length;f++){const h=t[f];h.parent&&h.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 Xe(r,3)),i.setAttribute("color",new Xe(s,3));const l=new $n({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");f0.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(Kd.multiplyMatrices(f0,a.matrixWorld),fo.setFromMatrixPosition(Kd),r.setXYZ(o,fo.x,fo.y,fo.z),Kd.multiplyMatrices(f0,a.parent.matrixWorld),fo.setFromMatrixPosition(Kd),r.setXYZ(o+1,fo.x,fo.y,fo.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function gb(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,gb(n.children[t]));return e}class JO extends Mn{constructor(e,t,i){const r=new Vf(t,4,2),s=new Ji({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const jO=new D,A1=new Pe,S1=new Pe;class KO extends wt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Hf(t);r.rotateY(Math.PI*.5),this.material=new Ji({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new Dt(o,3)),this.add(new Mn(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");A1.copy(this.light.color),S1.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?A1:S1;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(jO.setFromMatrixPosition(this.light.matrixWorld).negate())}}class YO extends Vr{constructor(e=10,t=10,i=4473924,r=8947848){i=new Pe(i),r=new Pe(r);const s=t/2,o=e/t,a=e/2,l=[],f=[];for(let p=0,m=0,y=-a;p<=t;p++,y+=o){l.push(-a,0,y,a,0,y),l.push(y,0,-a,y,0,a);const S=p===s?i:r;S.toArray(f,m),m+=3,S.toArray(f,m),m+=3,S.toArray(f,m),m+=3,S.toArray(f,m),m+=3}const h=new ht;h.setAttribute("position",new Xe(l,3)),h.setAttribute("color",new Xe(f,3));const d=new $n({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class QO extends Vr{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new Pe(s),o=new Pe(o);const a=[],l=[];if(t>1)for(let d=0;d<t;d++){const p=d/t*(Math.PI*2),m=Math.sin(p)*e,y=Math.cos(p)*e;a.push(0,0,0),a.push(m,0,y);const S=d&1?s:o;l.push(S.r,S.g,S.b),l.push(S.r,S.g,S.b)}for(let d=0;d<i;d++){const p=d&1?s:o,m=e-e/i*d;for(let y=0;y<r;y++){let S=y/r*(Math.PI*2),A=Math.sin(S)*m,g=Math.cos(S)*m;a.push(A,0,g),l.push(p.r,p.g,p.b),S=(y+1)/r*(Math.PI*2),A=Math.sin(S)*m,g=Math.cos(S)*m,a.push(A,0,g),l.push(p.r,p.g,p.b)}}const f=new ht;f.setAttribute("position",new Xe(a,3)),f.setAttribute("color",new Xe(l,3));const h=new $n({vertexColors:!0,toneMapped:!1});super(f,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const M1=new D,Yd=new D,E1=new D;class ZO extends wt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new ht;r.setAttribute("position",new Xe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new $n({fog:!1,toneMapped:!1});this.lightPlane=new ps(r,s),this.add(this.lightPlane),r=new ht,r.setAttribute("position",new Xe([0,0,0,0,0,1],3)),this.targetLine=new ps(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),M1.setFromMatrixPosition(this.light.matrixWorld),Yd.setFromMatrixPosition(this.light.target.matrixWorld),E1.subVectors(Yd,M1),this.lightPlane.lookAt(Yd),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Yd),this.targetLine.scale.z=E1.length()}}const Qd=new D,pn=new Nf;class qO extends Vr{constructor(e){const t=new ht,i=new $n({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(y,S){l(y),l(S)}function l(y){r.push(0,0,0),s.push(0,0,0),o[y]===void 0&&(o[y]=[]),o[y].push(r.length/3-1)}t.setAttribute("position",new Xe(r,3)),t.setAttribute("color",new Xe(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const f=new Pe(16755200),h=new Pe(16711680),d=new Pe(43775),p=new Pe(16777215),m=new Pe(3355443);this.setColors(f,h,d,p,m)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;pn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xn("c",t,e,pn,0,0,-1),xn("t",t,e,pn,0,0,1),xn("n1",t,e,pn,-i,-r,-1),xn("n2",t,e,pn,i,-r,-1),xn("n3",t,e,pn,-i,r,-1),xn("n4",t,e,pn,i,r,-1),xn("f1",t,e,pn,-i,-r,1),xn("f2",t,e,pn,i,-r,1),xn("f3",t,e,pn,-i,r,1),xn("f4",t,e,pn,i,r,1),xn("u1",t,e,pn,i*.7,r*1.1,-1),xn("u2",t,e,pn,-i*.7,r*1.1,-1),xn("u3",t,e,pn,0,r*2,-1),xn("cf1",t,e,pn,-i,0,1),xn("cf2",t,e,pn,i,0,1),xn("cf3",t,e,pn,0,-r,1),xn("cf4",t,e,pn,0,r,1),xn("cn1",t,e,pn,-i,0,-1),xn("cn2",t,e,pn,i,0,-1),xn("cn3",t,e,pn,0,-r,-1),xn("cn4",t,e,pn,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function xn(n,e,t,i,r,s,o){Qd.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let f=0,h=a.length;f<h;f++)l.setXYZ(a[f],Qd.x,Qd.y,Qd.z)}}const Zd=new Qn;class $O extends Vr{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new ht;s.setIndex(new Dt(i,1)),s.setAttribute("position",new Dt(r,3)),super(s,new $n({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Zd.setFromObject(this.object),Zd.isEmpty())return;const t=Zd.min,i=Zd.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ek extends Vr{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new ht;s.setIndex(new Dt(i,1)),s.setAttribute("position",new Xe(r,3)),super(s,new $n({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class tk extends ps{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new ht;o.setAttribute("position",new Xe(s,3)),o.computeBoundingSphere(),super(o,new $n({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new ht;l.setAttribute("position",new Xe(a,3)),l.computeBoundingSphere(),this.add(new Mn(l,new Ji({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const w1=new D;let qd,h0;class nk extends wt{constructor(e=new D(0,0,1),t=new D(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",qd===void 0&&(qd=new ht,qd.setAttribute("position",new Xe([0,0,0,0,1,0],3)),h0=new Uc(0,.5,1,5,1),h0.translate(0,-.5,0)),this.position.copy(t),this.line=new ps(qd,new $n({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mn(h0,new Ji({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{w1.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(w1,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class ik extends Vr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new ht;r.setAttribute("position",new Xe(t,3)),r.setAttribute("color",new Xe(i,3));const s=new $n({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Pe,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class rk{constructor(){this.type="ShapePath",this.color=new Pe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Sf,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const _=[];for(let M=0,w=g.length;M<w;M++){const B=g[M],T=new Da;T.curves=B.curves,_.push(T)}return _}function i(g,_){const M=_.length;let w=!1;for(let B=M-1,T=0;T<M;B=T++){let b=_[B],L=_[T],R=L.x-b.x,P=L.y-b.y;if(Math.abs(P)>Number.EPSILON){if(P<0&&(b=_[T],R=-R,L=_[B],P=-P),g.y<b.y||g.y>L.y)continue;if(g.y===b.y){if(g.x===b.x)return!0}else{const U=P*(g.x-b.x)-R*(g.y-b.y);if(U===0)return!0;if(U<0)continue;w=!w}}else{if(g.y!==b.y)continue;if(L.x<=g.x&&g.x<=b.x||b.x<=g.x&&g.x<=L.x)return!0}}return w}const r=ls.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const f=[];if(s.length===1)return a=s[0],l=new Da,l.curves=a.curves,f.push(l),f;let h=!r(s[0].getPoints());h=e?!h:h;const d=[],p=[];let m=[],y=0,S;p[y]=void 0,m[y]=[];for(let g=0,_=s.length;g<_;g++)a=s[g],S=a.getPoints(),o=r(S),o=e?!o:o,o?(!h&&p[y]&&y++,p[y]={s:new Da,p:S},p[y].s.curves=a.curves,h&&y++,m[y]=[]):m[y].push({h:a,p:S[0]});if(!p[0])return t(s);if(p.length>1){let g=!1,_=0;for(let M=0,w=p.length;M<w;M++)d[M]=[];for(let M=0,w=p.length;M<w;M++){const B=m[M];for(let T=0;T<B.length;T++){const b=B[T];let L=!0;for(let R=0;R<p.length;R++)i(b.p,p[R].p)&&(M!==R&&_++,L?(L=!1,d[R].push(b)):g=!0);L&&d[M].push(b)}}_>0&&g===!1&&(m=d)}let A;for(let g=0,_=p.length;g<_;g++){l=p[g].s,f.push(l),A=m[g];for(let M=0,w=A.length;M<w;M++)l.holes.push(A[M].h)}return f}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Lf}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Lf);const sk=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:px,AddEquation:_o,AddOperation:zC,AdditiveAnimationBlendMode:Sx,AdditiveBlending:My,AgXToneMapping:XC,AlphaFormat:YC,AlwaysCompare:pR,AlwaysDepth:LC,AlwaysStencilFunc:e_,AmbientLight:$x,AnimationAction:db,AnimationClip:Wa,AnimationLoader:uO,AnimationMixer:pb,AnimationObjectGroup:FO,AnimationUtils:oO,ArcCurve:NR,ArrayCamera:PR,ArrowHelper:nk,AttachedBindMode:Ry,Audio:fb,AudioAnalyser:wO,AudioContext:eA,AudioListener:SO,AudioLoader:_O,AxesHelper:ik,BackSide:_i,BasicDepthPacking:sR,BasicShadowMap:mC,BatchedMesh:FR,Bone:Rc,BooleanKeyframeTrack:Ya,Box2:HO,Box3:Qn,Box3Helper:ek,BoxGeometry:Ka,BoxHelper:$O,BufferAttribute:Dt,BufferGeometry:ht,BufferGeometryLoader:cb,ByteType:jC,Cache:Ns,Camera:Nf,CameraHelper:qO,CanvasTexture:PU,CapsuleGeometry:Dm,CatmullRomCurve3:UR,CineonToneMapping:VC,CircleGeometry:Fm,ClampToEdgeWrapping:Bn,Clock:tA,Color:Pe,ColorKeyframeTrack:Yx,ColorManagement:Gt,CompressedArrayTexture:RU,CompressedCubeTexture:bU,CompressedTexture:Im,CompressedTextureLoader:fO,ConeGeometry:Nm,ConstantAlphaFactor:PC,ConstantColorFactor:RC,CubeCamera:AR,CubeReflectionMapping:Xs,CubeRefractionMapping:No,CubeTexture:Uf,CubeTextureLoader:hO,CubeUVReflectionMapping:Dc,CubicBezierCurve:Gx,CubicBezierCurve3:OR,CubicInterpolant:eb,CullFaceBack:Sy,CullFaceFront:pC,CullFaceFrontBack:AL,CullFaceNone:dC,Curve:Sr,CurvePath:zR,CustomBlending:gC,CustomToneMapping:WC,CylinderGeometry:Uc,Cylindrical:GO,Data3DTexture:Rx,DataArrayTexture:wm,DataTexture:La,DataTextureLoader:dO,DataUtils:C2,DecrementStencilOp:PL,DecrementWrapStencilOp:IL,DefaultLoadingManager:ib,DepthFormat:Io,DepthStencilFormat:za,DepthTexture:Bx,DetachedBindMode:JC,DirectionalLight:Km,DirectionalLightHelper:ZO,DiscreteInterpolant:tb,DisplayP3ColorSpace:Em,DodecahedronGeometry:Um,DoubleSide:pr,DstAlphaFactor:MC,DstColorFactor:wC,DynamicCopyUsage:jL,DynamicDrawUsage:GL,DynamicReadUsage:WL,EdgesGeometry:GR,EllipseCurve:Lm,EqualCompare:uR,EqualDepth:FC,EqualStencilFunc:NL,EquirectangularReflectionMapping:Ac,EquirectangularRefractionMapping:pf,Euler:is,EventDispatcher:Ks,ExtrudeGeometry:km,FileLoader:Di,Float16BufferAttribute:L2,Float32BufferAttribute:Xe,Float64BufferAttribute:D2,FloatType:Nr,Fog:bm,FogExp2:Rm,FramebufferTexture:CU,FrontSide:cs,Frustum:Of,GLBufferAttribute:zO,GLSL1:YL,GLSL3:t_,GreaterCompare:fR,GreaterDepth:UC,GreaterEqualCompare:dR,GreaterEqualDepth:NC,GreaterEqualStencilFunc:zL,GreaterStencilFunc:OL,GridHelper:YO,Group:Or,HalfFloatType:Mc,HemisphereLight:rb,HemisphereLightHelper:KO,IcosahedronGeometry:zm,ImageBitmapLoader:ub,ImageLoader:Tf,ImageUtils:Cx,IncrementStencilOp:bL,IncrementWrapStencilOp:BL,InstancedBufferAttribute:Ha,InstancedBufferGeometry:lb,InstancedInterleavedBuffer:kO,InstancedMesh:Ux,Int16BufferAttribute:B2,Int32BufferAttribute:I2,Int8BufferAttribute:R2,IntType:mx,InterleavedBuffer:zf,InterleavedBufferAttribute:Uo,Interpolant:Oc,InterpolateDiscrete:Ec,InterpolateLinear:Ga,InterpolateSmooth:Sp,InvertStencilOp:LL,KeepStencilOp:ga,KeyframeTrack:Wr,LOD:DR,LatheGeometry:Gf,Layers:Ia,LessCompare:cR,LessDepth:DC,LessEqualCompare:wx,LessEqualDepth:df,LessEqualStencilFunc:UL,LessStencilFunc:FL,Light:Xo,LightProbe:ab,Line:ps,Line3:VO,LineBasicMaterial:$n,LineCurve:Hx,LineCurve3:kR,LineDashedMaterial:ZR,LineLoop:Ox,LineSegments:Vr,LinearDisplayP3ColorSpace:Ff,LinearEncoding:Ex,LinearFilter:ln,LinearInterpolant:Kx,LinearMipMapLinearFilter:TL,LinearMipMapNearestFilter:wL,LinearMipmapLinearFilter:fs,LinearMipmapNearestFilter:Am,LinearSRGBColorSpace:hs,LinearToneMapping:GC,LinearTransfer:vf,Loader:ei,LoaderUtils:ks,LoadingManager:Qx,LoopOnce:tR,LoopPingPong:iR,LoopRepeat:nR,LuminanceAlphaFormat:ZC,LuminanceFormat:QC,MOUSE:ma,Material:Ln,MaterialLoader:Ym,MathUtils:mr,Matrix3:xt,Matrix4:Ue,MaxEquation:Cy,Mesh:Mn,MeshBasicMaterial:Ji,MeshDepthMaterial:Ix,MeshDistanceMaterial:Lx,MeshLambertMaterial:Jx,MeshMatcapMaterial:QR,MeshNormalMaterial:YR,MeshPhongMaterial:ju,MeshPhysicalMaterial:Mr,MeshStandardMaterial:Wf,MeshToonMaterial:KR,MinEquation:Ty,MirroredRepeatWrapping:Sc,MixOperation:kC,MultiplyBlending:wy,MultiplyOperation:Df,NearestFilter:gn,NearestMipMapLinearFilter:EL,NearestMipMapNearestFilter:ML,NearestMipmapLinearFilter:fc,NearestMipmapNearestFilter:mf,NeverCompare:lR,NeverDepth:IC,NeverStencilFunc:DL,NoBlending:Os,NoColorSpace:Wi,NoToneMapping:os,NormalAnimationBlendMode:Mm,NormalBlending:Pa,NotEqualCompare:hR,NotEqualDepth:OC,NotEqualStencilFunc:kL,NumberKeyframeTrack:Oo,Object3D:wt,ObjectLoader:vO,ObjectSpaceNormalMap:aR,OctahedronGeometry:Hf,OneFactor:xC,OneMinusConstantAlphaFactor:BC,OneMinusConstantColorFactor:bC,OneMinusDstAlphaFactor:EC,OneMinusDstColorFactor:TC,OneMinusSrcAlphaFactor:Qp,OneMinusSrcColorFactor:SC,OrthographicCamera:_r,P3Primaries:_f,PCFShadowMap:_m,PCFSoftShadowMap:Hu,PMREMGenerator:i_,Path:Sf,PerspectiveCamera:Qt,Plane:Bs,PlaneGeometry:kf,PlaneHelper:tk,PointLight:Cf,PointLightHelper:JO,Points:kx,PointsMaterial:Bm,PolarGridHelper:QO,PolyhedronGeometry:Wo,PositionalAudio:EO,PropertyBinding:Ct,PropertyMixer:hb,QuadraticBezierCurve:Vx,QuadraticBezierCurve3:Wx,Quaternion:$t,QuaternionKeyframeTrack:Js,QuaternionLinearInterpolant:nb,RED_GREEN_RGTC2_Format:qy,RED_RGTC1_Format:eR,REVISION:Lf,RGBADepthPacking:oR,RGBAFormat:vi,RGBAIntegerFormat:xx,RGBA_ASTC_10x10_Format:Jy,RGBA_ASTC_10x5_Format:Vy,RGBA_ASTC_10x6_Format:Wy,RGBA_ASTC_10x8_Format:Xy,RGBA_ASTC_12x10_Format:jy,RGBA_ASTC_12x12_Format:Ky,RGBA_ASTC_4x4_Format:Fy,RGBA_ASTC_5x4_Format:Ny,RGBA_ASTC_5x5_Format:Uy,RGBA_ASTC_6x5_Format:Oy,RGBA_ASTC_6x6_Format:ky,RGBA_ASTC_8x5_Format:zy,RGBA_ASTC_8x6_Format:Gy,RGBA_ASTC_8x8_Format:Hy,RGBA_BPTC_Format:Ap,RGBA_ETC2_EAC_Format:Dy,RGBA_PVRTC_2BPPV1_Format:Iy,RGBA_PVRTC_4BPPV1_Format:By,RGBA_S3TC_DXT1_Format:yp,RGBA_S3TC_DXT3_Format:_p,RGBA_S3TC_DXT5_Format:xp,RGB_BPTC_SIGNED_Format:Yy,RGB_BPTC_UNSIGNED_Format:Qy,RGB_ETC1_Format:Ax,RGB_ETC2_Format:Ly,RGB_PVRTC_2BPPV1_Format:Py,RGB_PVRTC_4BPPV1_Format:by,RGB_S3TC_DXT1_Format:vp,RGFormat:$C,RGIntegerFormat:_x,RawShaderMaterial:jR,Ray:ja,Raycaster:mb,Rec709Primaries:yf,RectAreaLight:sb,RedFormat:qC,RedIntegerFormat:yx,ReinhardToneMapping:HC,RenderTarget:vR,RepeatWrapping:us,ReplaceStencilOp:RL,ReverseSubtractEquation:yC,RingGeometry:Gm,SIGNED_RED_GREEN_RGTC2_Format:$y,SIGNED_RED_RGTC1_Format:Zy,SRGBColorSpace:Pn,SRGBTransfer:Xt,Scene:Fx,ShaderChunk:_t,ShaderLib:Fr,ShaderMaterial:ds,ShadowMaterial:JR,Shape:Da,ShapeGeometry:Hm,ShapePath:rk,ShapeUtils:ls,ShortType:KC,Skeleton:Nc,SkeletonHelper:XO,SkinnedMesh:Pm,Source:Ea,Sphere:Zn,SphereGeometry:Vf,Spherical:u_,SphericalHarmonics3:ob,SplineCurve:Xx,SpotLight:jm,SpotLightHelper:WO,Sprite:LR,SpriteMaterial:Nx,SrcAlphaFactor:Yp,SrcAlphaSaturateFactor:CC,SrcColorFactor:AC,StaticCopyUsage:JL,StaticDrawUsage:xf,StaticReadUsage:VL,StereoCamera:xO,StreamCopyUsage:KL,StreamDrawUsage:HL,StreamReadUsage:XL,StringKeyframeTrack:Qa,SubtractEquation:vC,SubtractiveBlending:Ey,TOUCH:Ps,TangentSpaceNormalMap:Vo,TetrahedronGeometry:Vm,Texture:en,TextureLoader:Zx,TorusGeometry:Wm,TorusKnotGeometry:Xm,Triangle:Ri,TriangleFanDrawMode:Zp,TriangleStripDrawMode:Mx,TrianglesDrawMode:rR,TubeGeometry:Jm,TwoPassDoubleSide:SL,UVMapping:xm,Uint16BufferAttribute:Tm,Uint32BufferAttribute:bx,Uint8BufferAttribute:b2,Uint8ClampedBufferAttribute:P2,Uniform:rA,UniformsGroup:OO,UniformsLib:Ie,UniformsUtils:xR,UnsignedByteType:as,UnsignedInt248Type:Bo,UnsignedIntType:Fs,UnsignedShort4444Type:gx,UnsignedShort5551Type:vx,UnsignedShortType:Sm,VSMShadowMap:Ir,Vector2:de,Vector3:D,Vector4:Nt,VectorKeyframeTrack:ko,VideoTexture:TU,WebGL1Renderer:BR,WebGL3DRenderTarget:m2,WebGLArrayRenderTarget:p2,WebGLCoordinateSystem:Ur,WebGLCubeRenderTarget:SR,WebGLMultipleRenderTargets:g2,WebGLRenderTarget:Hr,WebGLRenderer:Dx,WebGLUtils:bR,WebGPUCoordinateSystem:wc,WireframeGeometry:XR,WrapAroundEnding:gf,ZeroCurvatureEnding:Sa,ZeroFactor:_C,ZeroSlopeEnding:Ma,ZeroStencilOp:CL,_SRGBAFormat:qp,createCanvasElement:gR,sRGBEncoding:Lo},Symbol.toStringTag,{value:"Module"}));var vb={exports:{}},Za={};/**
- * @license React
- * react-reconciler-constants.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */Za.ConcurrentRoot=1;Za.ContinuousEventPriority=4;Za.DefaultEventPriority=16;Za.DiscreteEventPriority=1;Za.IdleEventPriority=536870912;Za.LegacyRoot=0;vb.exports=Za;var rc=vb.exports;function ok(n){let e;const t=new Set,i=(f,h)=>{const d=typeof f=="function"?f(e):f;if(d!==e){const p=e;e=h?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},r=()=>e,s=(f,h=r,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=h(e);function m(){const y=h(e);if(!d(p,y)){const S=p;f(p=y,S)}}return t.add(m),()=>t.delete(m)},l={setState:i,getState:r,subscribe:(f,h,d)=>h||d?s(f,h,d):(t.add(f),()=>t.delete(f)),destroy:()=>t.clear()};return e=n(i,r,l),l}const ak=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),T1=ak?se.useEffect:se.useLayoutEffect;function lk(n){const e=typeof n=="function"?ok(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=se.useReducer(A=>A+1,0),o=e.getState(),a=se.useRef(o),l=se.useRef(i),f=se.useRef(r),h=se.useRef(!1),d=se.useRef();d.current===void 0&&(d.current=i(o));let p,m=!1;(a.current!==o||l.current!==i||f.current!==r||h.current)&&(p=i(o),m=!r(d.current,p)),T1(()=>{m&&(d.current=p),a.current=o,l.current=i,f.current=r,h.current=!1});const y=se.useRef(o);T1(()=>{const A=()=>{try{const _=e.getState(),M=l.current(_);f.current(d.current,M)||(a.current=_,d.current=M,s())}catch{h.current=!0,s()}},g=e.subscribe(A);return e.getState()!==y.current&&A(),g},[]);const S=m?p:d.current;return se.useDebugValue(S),S};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}const ck=n=>typeof n=="object"&&typeof n.then=="function",Ta=[];function yb(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r<i;r++)if(!t(n[r],e[r]))return!1;return!0}function _b(n,e=null,t=!1,i={}){e===null&&(e=[n]);for(const s of Ta)if(yb(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return i.lifespan&&i.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Ta.indexOf(r);s!==-1&&Ta.splice(s,1)},promise:(ck(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Ta.push(r),!t)throw r.promise}const uk=(n,e,t)=>_b(n,e,!1,t),fk=(n,e,t)=>void _b(n,e,!0,t),hk=n=>{if(n===void 0||n.length===0)Ta.splice(0,Ta.length);else{const e=Ta.find(t=>yb(n,t.keys,t.equal));e&&e.remove()}};var xb={exports:{}},Ab={exports:{}},Sb={};/**
- * @license React
- * scheduler.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */(function(n){function e(O,V){var H=O.length;O.push(V);e:for(;0<H;){var q=H-1>>>1,ne=O[q];if(0<r(ne,V))O[q]=V,O[H]=ne,H=q;else break e}}function t(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var V=O[0],H=O.pop();if(H!==V){O[0]=H;e:for(var q=0,ne=O.length,Y=ne>>>1;q<Y;){var ue=2*(q+1)-1,Se=O[ue],Te=ue+1,Ce=O[Te];if(0>r(Se,H))Te<ne&&0>r(Ce,Se)?(O[q]=Ce,O[Te]=H,q=Te):(O[q]=Se,O[ue]=H,q=ue);else if(Te<ne&&0>r(Ce,H))O[q]=Ce,O[Te]=H,q=Te;else break e}}return V}function r(O,V){var H=O.sortIndex-V.sortIndex;return H!==0?H:O.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],f=[],h=1,d=null,p=3,m=!1,y=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(O){for(var V=t(f);V!==null;){if(V.callback===null)i(f);else if(V.startTime<=O)i(f),V.sortIndex=V.expirationTime,e(l,V);else break;V=t(f)}}function w(O){if(S=!1,M(O),!y)if(t(l)!==null)y=!0,Z(B);else{var V=t(f);V!==null&&ae(w,V.startTime-O)}}function B(O,V){y=!1,S&&(S=!1,g(L),L=-1),m=!0;var H=p;try{for(M(V),d=t(l);d!==null&&(!(d.expirationTime>V)||O&&!U());){var q=d.callback;if(typeof q=="function"){d.callback=null,p=d.priorityLevel;var ne=q(d.expirationTime<=V);V=n.unstable_now(),typeof ne=="function"?d.callback=ne:d===t(l)&&i(l),M(V)}else i(l);d=t(l)}if(d!==null)var Y=!0;else{var ue=t(f);ue!==null&&ae(w,ue.startTime-V),Y=!1}return Y}finally{d=null,p=H,m=!1}}var T=!1,b=null,L=-1,R=5,P=-1;function U(){return!(n.unstable_now()-P<R)}function K(){if(b!==null){var O=n.unstable_now();P=O;var V=!0;try{V=b(!0,O)}finally{V?ie():(T=!1,b=null)}}else T=!1}var ie;if(typeof _=="function")ie=function(){_(K)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,J=G.port2;G.port1.onmessage=K,ie=function(){J.postMessage(null)}}else ie=function(){A(K,0)};function Z(O){b=O,T||(T=!0,ie())}function ae(O,V){L=A(function(){O(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_continueExecution=function(){y||m||(y=!0,Z(B))},n.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<O?Math.floor(1e3/O):5},n.unstable_getCurrentPriorityLevel=function(){return p},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(O){switch(p){case 1:case 2:case 3:var V=3;break;default:V=p}var H=p;p=V;try{return O()}finally{p=H}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(O,V){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var H=p;p=O;try{return V()}finally{p=H}},n.unstable_scheduleCallback=function(O,V,H){var q=n.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?q+H:q):H=q,O){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=H+ne,O={id:h++,callback:V,priorityLevel:O,startTime:H,expirationTime:ne,sortIndex:-1},H>q?(O.sortIndex=H,e(f,O),t(l)===null&&O===t(f)&&(S?(g(L),L=-1):S=!0,ae(w,H-q))):(O.sortIndex=ne,e(l,O),y||m||(y=!0,Z(B))),O},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(O){var V=p;return function(){var H=p;p=V;try{return O.apply(this,arguments)}finally{p=H}}}})(Sb);Ab.exports=Sb;var f_=Ab.exports;/**
- * @license React
- * react-reconciler.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var dk=function(e){var t={},i=se,r=f_,s=Object.assign;function o(c){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;v<arguments.length;v++)u+="&args[]="+encodeURIComponent(arguments[v]);return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),f=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),y=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),B=Symbol.iterator;function T(c){return c===null||typeof c!="object"?null:(c=B&&c[B]||c["@@iterator"],typeof c=="function"?c:null)}function b(c){if(c==null)return null;if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case h:return"Fragment";case f:return"Portal";case p:return"Profiler";case d:return"StrictMode";case A:return"Suspense";case g:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case y:return(c.displayName||"Context")+".Consumer";case m:return(c._context.displayName||"Context")+".Provider";case S:var u=c.render;return c=c.displayName,c||(c=u.displayName||u.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case _:return u=c.displayName||null,u!==null?u:b(c.type)||"Memo";case M:u=c._payload,c=c._init;try{return b(c(u))}catch{}}return null}function L(c){var u=c.type;switch(c.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=u.render,c=c.displayName||c.name||"",u.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return b(u);case 8:return u===d?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function R(c){var u=c,v=c;if(c.alternate)for(;u.return;)u=u.return;else{c=u;do u=c,u.flags&4098&&(v=u.return),c=u.return;while(c)}return u.tag===3?v:null}function P(c){if(R(c)!==c)throw Error(o(188))}function U(c){var u=c.alternate;if(!u){if(u=R(c),u===null)throw Error(o(188));return u!==c?null:c}for(var v=c,x=u;;){var E=v.return;if(E===null)break;var C=E.alternate;if(C===null){if(x=E.return,x!==null){v=x;continue}break}if(E.child===C.child){for(C=E.child;C;){if(C===v)return P(E),c;if(C===x)return P(E),u;C=C.sibling}throw Error(o(188))}if(v.return!==x.return)v=E,x=C;else{for(var k=!1,j=E.child;j;){if(j===v){k=!0,v=E,x=C;break}if(j===x){k=!0,x=E,v=C;break}j=j.sibling}if(!k){for(j=C.child;j;){if(j===v){k=!0,v=C,x=E;break}if(j===x){k=!0,x=C,v=E;break}j=j.sibling}if(!k)throw Error(o(189))}}if(v.alternate!==x)throw Error(o(190))}if(v.tag!==3)throw Error(o(188));return v.stateNode.current===v?c:u}function K(c){return c=U(c),c!==null?ie(c):null}function ie(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var u=ie(c);if(u!==null)return u;c=c.sibling}return null}function G(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){if(c.tag!==4){var u=G(c);if(u!==null)return u}c=c.sibling}return null}var J=Array.isArray,Z=e.getPublicInstance,ae=e.getRootHostContext,O=e.getChildHostContext,V=e.prepareForCommit,H=e.resetAfterCommit,q=e.createInstance,ne=e.appendInitialChild,Y=e.finalizeInitialChildren,ue=e.prepareUpdate,Se=e.shouldSetTextContent,Te=e.createTextInstance,Ce=e.scheduleTimeout,Ze=e.cancelTimeout,ot=e.noTimeout,Le=e.isPrimaryRenderer,be=e.supportsMutation,z=e.supportsPersistence,ve=e.supportsHydration,he=e.getInstanceFromNode,Me=e.preparePortalMount,pe=e.getCurrentEventPriority,Ve=e.detachDeletedInstance,De=e.supportsMicrotasks,F=e.scheduleMicrotask,I=e.supportsTestSelectors,$=e.findFiberRoot,_e=e.getBoundingRect,ye=e.getTextContent,me=e.isHiddenSubtree,Ye=e.matchAccessibilityRole,Be=e.setFocusIfFocusable,Fe=e.setupIntersectionObserver,nt=e.appendChild,dt=e.appendChildToContainer,xe=e.commitTextUpdate,It=e.commitMount,yt=e.commitUpdate,ut=e.insertBefore,tt=e.insertInContainerBefore,We=e.removeChild,W=e.removeChildFromContainer,ge=e.resetTextContent,Ge=e.hideInstance,ke=e.hideTextInstance,Ae=e.unhideInstance,X=e.unhideTextInstance,Re=e.clearContainer,Ne=e.cloneInstance,it=e.createContainerChildSet,Qe=e.appendChildToContainerChildSet,Tt=e.finalizeContainerChildren,Lt=e.replaceContainerChildren,Vt=e.cloneHiddenInstance,tn=e.cloneHiddenTextInstance,Ft=e.canHydrateInstance,Wn=e.canHydrateTextInstance,qi=e.canHydrateSuspenseInstance,kc=e.isSuspenseInstancePending,zc=e.isSuspenseInstanceFallback,qa=e.registerSuspenseInstanceRetry,Ys=e.getNextHydratableSibling,$a=e.getFirstHydratableChild,Yf=e.getFirstHydratableChildWithinContainer,Qf=e.getFirstHydratableChildWithinSuspenseInstance,Zm=e.hydrateInstance,qm=e.hydrateTextInstance,$m=e.hydrateSuspenseInstance,N=e.getNextHydratableInstanceAfterSuspenseInstance,ee=e.commitHydratedContainer,oe=e.commitHydratedSuspenseInstance,le=e.clearSuspenseBoundary,re=e.clearSuspenseBoundaryFromContainer,He=e.shouldDeleteUnhydratedTailInstances,$e=e.didNotMatchHydratedContainerTextInstance,at=e.didNotMatchHydratedTextInstance,lt;function pt(c){if(lt===void 0)try{throw Error()}catch(v){var u=v.stack.trim().match(/\n( *(at )?)/);lt=u&&u[1]||""}return`
- `+lt+c}var ft=!1;function mt(c,u){if(!c||ft)return"";ft=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(we){var x=we}Reflect.construct(c,[],u)}else{try{u.call()}catch(we){x=we}c.call(u.prototype)}else{try{throw Error()}catch(we){x=we}c()}}catch(we){if(we&&x&&typeof we.stack=="string"){for(var E=we.stack.split(`
- `),C=x.stack.split(`
- `),k=E.length-1,j=C.length-1;1<=k&&0<=j&&E[k]!==C[j];)j--;for(;1<=k&&0<=j;k--,j--)if(E[k]!==C[j]){if(k!==1||j!==1)do if(k--,j--,0>j||E[k]!==C[j]){var fe=`
- `+E[k].replace(" at new "," at ");return c.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",c.displayName)),fe}while(1<=k&&0<=j);break}}}finally{ft=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?pt(c):""}var sn=Object.prototype.hasOwnProperty,Xn=[],Kt=-1;function Nn(c){return{current:c}}function ct(c){0>Kt||(c.current=Xn[Kt],Xn[Kt]=null,Kt--)}function je(c,u){Kt++,Xn[Kt]=c.current,c.current=u}var $i={},Mt=Nn($i),hn=Nn(!1),Xr=$i;function er(c,u){var v=c.type.contextTypes;if(!v)return $i;var x=c.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===u)return x.__reactInternalMemoizedMaskedChildContext;var E={},C;for(C in v)E[C]=u[C];return x&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=u,c.__reactInternalMemoizedMaskedChildContext=E),E}function Un(c){return c=c.childContextTypes,c!=null}function yn(){ct(hn),ct(Mt)}function Jr(c,u,v){if(Mt.current!==$i)throw Error(o(168));je(Mt,u),je(hn,v)}function el(c,u,v){var x=c.stateNode;if(u=u.childContextTypes,typeof x.getChildContext!="function")return v;x=x.getChildContext();for(var E in x)if(!(E in u))throw Error(o(108,L(c)||"Unknown",E));return s({},v,x)}function Jn(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||$i,Xr=Mt.current,je(Mt,c),je(hn,hn.current),!0}function tl(c,u,v){var x=c.stateNode;if(!x)throw Error(o(169));v?(c=el(c,u,Xr),x.__reactInternalMemoizedMergedChildContext=c,ct(hn),ct(Mt),je(Mt,c)):ct(hn),je(hn,v)}var Fi=Math.clz32?Math.clz32:sP,Zf=Math.log,rP=Math.LN2;function sP(c){return c>>>=0,c===0?32:31-(Zf(c)/rP|0)|0}var qf=64,$f=4194304;function Gc(c){switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function eh(c,u){var v=c.pendingLanes;if(v===0)return 0;var x=0,E=c.suspendedLanes,C=c.pingedLanes,k=v&268435455;if(k!==0){var j=k&~E;j!==0?x=Gc(j):(C&=k,C!==0&&(x=Gc(C)))}else k=v&~E,k!==0?x=Gc(k):C!==0&&(x=Gc(C));if(x===0)return 0;if(u!==0&&u!==x&&!(u&E)&&(E=x&-x,C=u&-u,E>=C||E===16&&(C&4194240)!==0))return u;if(x&4&&(x|=v&16),u=c.entangledLanes,u!==0)for(c=c.entanglements,u&=x;0<u;)v=31-Fi(u),E=1<<v,x|=c[v],u&=~E;return x}function oP(c,u){switch(c){case 1:case 2:case 4:return u+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function aP(c,u){for(var v=c.suspendedLanes,x=c.pingedLanes,E=c.expirationTimes,C=c.pendingLanes;0<C;){var k=31-Fi(C),j=1<<k,fe=E[k];fe===-1?(!(j&v)||j&x)&&(E[k]=oP(j,u)):fe<=u&&(c.expiredLanes|=j),C&=~j}}function eg(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function tg(c){for(var u=[],v=0;31>v;v++)u.push(c);return u}function Hc(c,u,v){c.pendingLanes|=u,u!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,u=31-Fi(u),c[u]=v}function lP(c,u){var v=c.pendingLanes&~u;c.pendingLanes=u,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=u,c.mutableReadLanes&=u,c.entangledLanes&=u,u=c.entanglements;var x=c.eventTimes;for(c=c.expirationTimes;0<v;){var E=31-Fi(v),C=1<<E;u[E]=0,x[E]=-1,c[E]=-1,v&=~C}}function ng(c,u){var v=c.entangledLanes|=u;for(c=c.entanglements;v;){var x=31-Fi(v),E=1<<x;E&u|c[x]&u&&(c[x]|=u),v&=~E}}var Ot=0;function fA(c){return c&=-c,1<c?4<c?c&268435455?16:536870912:4:1}var ig=r.unstable_scheduleCallback,hA=r.unstable_cancelCallback,cP=r.unstable_shouldYield,uP=r.unstable_requestPaint,On=r.unstable_now,rg=r.unstable_ImmediatePriority,fP=r.unstable_UserBlockingPriority,sg=r.unstable_NormalPriority,hP=r.unstable_IdlePriority,th=null,jr=null;function dP(c){if(jr&&typeof jr.onCommitFiberRoot=="function")try{jr.onCommitFiberRoot(th,c,void 0,(c.current.flags&128)===128)}catch{}}function pP(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var Kr=typeof Object.is=="function"?Object.is:pP,ms=null,nh=!1,og=!1;function dA(c){ms===null?ms=[c]:ms.push(c)}function mP(c){nh=!0,dA(c)}function Yr(){if(!og&&ms!==null){og=!0;var c=0,u=Ot;try{var v=ms;for(Ot=1;c<v.length;c++){var x=v[c];do x=x(!0);while(x!==null)}ms=null,nh=!1}catch(E){throw ms!==null&&(ms=ms.slice(c+1)),ig(rg,Yr),E}finally{Ot=u,og=!1}}return null}var gP=a.ReactCurrentBatchConfig;function ih(c,u){if(Kr(c,u))return!0;if(typeof c!="object"||c===null||typeof u!="object"||u===null)return!1;var v=Object.keys(c),x=Object.keys(u);if(v.length!==x.length)return!1;for(x=0;x<v.length;x++){var E=v[x];if(!sn.call(u,E)||!Kr(c[E],u[E]))return!1}return!0}function vP(c){switch(c.tag){case 5:return pt(c.type);case 16:return pt("Lazy");case 13:return pt("Suspense");case 19:return pt("SuspenseList");case 0:case 2:case 15:return c=mt(c.type,!1),c;case 11:return c=mt(c.type.render,!1),c;case 1:return c=mt(c.type,!0),c;default:return""}}function Er(c,u){if(c&&c.defaultProps){u=s({},u),c=c.defaultProps;for(var v in c)u[v]===void 0&&(u[v]=c[v]);return u}return u}var rh=Nn(null),sh=null,nl=null,ag=null;function lg(){ag=nl=sh=null}function pA(c,u,v){Le?(je(rh,u._currentValue),u._currentValue=v):(je(rh,u._currentValue2),u._currentValue2=v)}function cg(c){var u=rh.current;ct(rh),Le?c._currentValue=u:c._currentValue2=u}function ug(c,u,v){for(;c!==null;){var x=c.alternate;if((c.childLanes&u)!==u?(c.childLanes|=u,x!==null&&(x.childLanes|=u)):x!==null&&(x.childLanes&u)!==u&&(x.childLanes|=u),c===v)break;c=c.return}}function il(c,u){sh=c,ag=nl=null,c=c.dependencies,c!==null&&c.firstContext!==null&&(c.lanes&u&&(Oi=!0),c.firstContext=null)}function tr(c){var u=Le?c._currentValue:c._currentValue2;if(ag!==c)if(c={context:c,memoizedValue:u,next:null},nl===null){if(sh===null)throw Error(o(308));nl=c,sh.dependencies={lanes:0,firstContext:c}}else nl=nl.next=c;return u}var Qr=null,Qs=!1;function fg(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mA(c,u){c=c.updateQueue,u.updateQueue===c&&(u.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function gs(c,u){return{eventTime:c,lane:u,tag:0,payload:null,callback:null,next:null}}function Zs(c,u){var v=c.updateQueue;v!==null&&(v=v.shared,En!==null&&c.mode&1&&!(Et&2)?(c=v.interleaved,c===null?(u.next=u,Qr===null?Qr=[v]:Qr.push(v)):(u.next=c.next,c.next=u),v.interleaved=u):(c=v.pending,c===null?u.next=u:(u.next=c.next,c.next=u),v.pending=u))}function oh(c,u,v){if(u=u.updateQueue,u!==null&&(u=u.shared,(v&4194240)!==0)){var x=u.lanes;x&=c.pendingLanes,v|=x,u.lanes=v,ng(c,v)}}function gA(c,u){var v=c.updateQueue,x=c.alternate;if(x!==null&&(x=x.updateQueue,v===x)){var E=null,C=null;if(v=v.firstBaseUpdate,v!==null){do{var k={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};C===null?E=C=k:C=C.next=k,v=v.next}while(v!==null);C===null?E=C=u:C=C.next=u}else E=C=u;v={baseState:x.baseState,firstBaseUpdate:E,lastBaseUpdate:C,shared:x.shared,effects:x.effects},c.updateQueue=v;return}c=v.lastBaseUpdate,c===null?v.firstBaseUpdate=u:c.next=u,v.lastBaseUpdate=u}function ah(c,u,v,x){var E=c.updateQueue;Qs=!1;var C=E.firstBaseUpdate,k=E.lastBaseUpdate,j=E.shared.pending;if(j!==null){E.shared.pending=null;var fe=j,we=fe.next;fe.next=null,k===null?C=we:k.next=we,k=fe;var Ke=c.alternate;Ke!==null&&(Ke=Ke.updateQueue,j=Ke.lastBaseUpdate,j!==k&&(j===null?Ke.firstBaseUpdate=we:j.next=we,Ke.lastBaseUpdate=fe))}if(C!==null){var gt=E.baseState;k=0,Ke=we=fe=null,j=C;do{var rt=j.lane,Wt=j.eventTime;if((x&rt)===rt){Ke!==null&&(Ke=Ke.next={eventTime:Wt,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var et=c,ri=j;switch(rt=u,Wt=v,ri.tag){case 1:if(et=ri.payload,typeof et=="function"){gt=et.call(Wt,gt,rt);break e}gt=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=ri.payload,rt=typeof et=="function"?et.call(Wt,gt,rt):et,rt==null)break e;gt=s({},gt,rt);break e;case 2:Qs=!0}}j.callback!==null&&j.lane!==0&&(c.flags|=64,rt=E.effects,rt===null?E.effects=[j]:rt.push(j))}else Wt={eventTime:Wt,lane:rt,tag:j.tag,payload:j.payload,callback:j.callback,next:null},Ke===null?(we=Ke=Wt,fe=gt):Ke=Ke.next=Wt,k|=rt;if(j=j.next,j===null){if(j=E.shared.pending,j===null)break;rt=j,j=rt.next,rt.next=null,E.lastBaseUpdate=rt,E.shared.pending=null}}while(!0);if(Ke===null&&(fe=gt),E.baseState=fe,E.firstBaseUpdate=we,E.lastBaseUpdate=Ke,u=E.shared.interleaved,u!==null){E=u;do k|=E.lane,E=E.next;while(E!==u)}else C===null&&(E.shared.lanes=0);hl|=k,c.lanes=k,c.memoizedState=gt}}function vA(c,u,v){if(c=u.effects,u.effects=null,c!==null)for(u=0;u<c.length;u++){var x=c[u],E=x.callback;if(E!==null){if(x.callback=null,x=v,typeof E!="function")throw Error(o(191,E));E.call(x)}}}var yA=new i.Component().refs;function hg(c,u,v,x){u=c.memoizedState,v=v(x,u),v=v==null?u:s({},u,v),c.memoizedState=v,c.lanes===0&&(c.updateQueue.baseState=v)}var lh={isMounted:function(c){return(c=c._reactInternals)?R(c)===c:!1},enqueueSetState:function(c,u,v){c=c._reactInternals;var x=di(),E=eo(c),C=gs(x,E);C.payload=u,v!=null&&(C.callback=v),Zs(c,C),u=or(c,E,x),u!==null&&oh(u,c,E)},enqueueReplaceState:function(c,u,v){c=c._reactInternals;var x=di(),E=eo(c),C=gs(x,E);C.tag=1,C.payload=u,v!=null&&(C.callback=v),Zs(c,C),u=or(c,E,x),u!==null&&oh(u,c,E)},enqueueForceUpdate:function(c,u){c=c._reactInternals;var v=di(),x=eo(c),E=gs(v,x);E.tag=2,u!=null&&(E.callback=u),Zs(c,E),u=or(c,x,v),u!==null&&oh(u,c,x)}};function _A(c,u,v,x,E,C,k){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(x,C,k):u.prototype&&u.prototype.isPureReactComponent?!ih(v,x)||!ih(E,C):!0}function xA(c,u,v){var x=!1,E=$i,C=u.contextType;return typeof C=="object"&&C!==null?C=tr(C):(E=Un(u)?Xr:Mt.current,x=u.contextTypes,C=(x=x!=null)?er(c,E):$i),u=new u(v,C),c.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=lh,c.stateNode=u,u._reactInternals=c,x&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=E,c.__reactInternalMemoizedMaskedChildContext=C),u}function AA(c,u,v,x){c=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(v,x),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(v,x),u.state!==c&&lh.enqueueReplaceState(u,u.state,null)}function dg(c,u,v,x){var E=c.stateNode;E.props=v,E.state=c.memoizedState,E.refs=yA,fg(c);var C=u.contextType;typeof C=="object"&&C!==null?E.context=tr(C):(C=Un(u)?Xr:Mt.current,E.context=er(c,C)),E.state=c.memoizedState,C=u.getDerivedStateFromProps,typeof C=="function"&&(hg(c,u,C,v),E.state=c.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(u=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),u!==E.state&&lh.enqueueReplaceState(E,E.state,null),ah(c,v,E,x),E.state=c.memoizedState),typeof E.componentDidMount=="function"&&(c.flags|=4194308)}var rl=[],sl=0,ch=null,uh=0,nr=[],ir=0,jo=null,vs=1,ys="";function Ko(c,u){rl[sl++]=uh,rl[sl++]=ch,ch=c,uh=u}function SA(c,u,v){nr[ir++]=vs,nr[ir++]=ys,nr[ir++]=jo,jo=c;var x=vs;c=ys;var E=32-Fi(x)-1;x&=~(1<<E),v+=1;var C=32-Fi(u)+E;if(30<C){var k=E-E%5;C=(x&(1<<k)-1).toString(32),x>>=k,E-=k,vs=1<<32-Fi(u)+E|v<<E|x,ys=C+c}else vs=1<<C|v<<E|x,ys=c}function pg(c){c.return!==null&&(Ko(c,1),SA(c,1,0))}function mg(c){for(;c===ch;)ch=rl[--sl],rl[sl]=null,uh=rl[--sl],rl[sl]=null;for(;c===jo;)jo=nr[--ir],nr[ir]=null,ys=nr[--ir],nr[ir]=null,vs=nr[--ir],nr[ir]=null}var Ni=null,Ui=null,nn=!1,Vc=!1,wr=null;function MA(c,u){var v=ar(5,null,null,0);v.elementType="DELETED",v.stateNode=u,v.return=c,u=c.deletions,u===null?(c.deletions=[v],c.flags|=16):u.push(v)}function EA(c,u){switch(c.tag){case 5:return u=Ft(u,c.type,c.pendingProps),u!==null?(c.stateNode=u,Ni=c,Ui=$a(u),!0):!1;case 6:return u=Wn(u,c.pendingProps),u!==null?(c.stateNode=u,Ni=c,Ui=null,!0):!1;case 13:if(u=qi(u),u!==null){var v=jo!==null?{id:vs,overflow:ys}:null;return c.memoizedState={dehydrated:u,treeContext:v,retryLane:1073741824},v=ar(18,null,null,0),v.stateNode=u,v.return=c,c.child=v,Ni=c,Ui=null,!0}return!1;default:return!1}}function gg(c){return(c.mode&1)!==0&&(c.flags&128)===0}function vg(c){if(nn){var u=Ui;if(u){var v=u;if(!EA(c,u)){if(gg(c))throw Error(o(418));u=Ys(v);var x=Ni;u&&EA(c,u)?MA(x,v):(c.flags=c.flags&-4097|2,nn=!1,Ni=c)}}else{if(gg(c))throw Error(o(418));c.flags=c.flags&-4097|2,nn=!1,Ni=c}}}function wA(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;Ni=c}function Wc(c){if(!ve||c!==Ni)return!1;if(!nn)return wA(c),nn=!0,!1;if(c.tag!==3&&(c.tag!==5||He(c.type)&&!Se(c.type,c.memoizedProps))){var u=Ui;if(u){if(gg(c)){for(c=Ui;c;)c=Ys(c);throw Error(o(418))}for(;u;)MA(c,u),u=Ys(u)}}if(wA(c),c.tag===13){if(!ve)throw Error(o(316));if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));Ui=N(c)}else Ui=Ni?Ys(c.stateNode):null;return!0}function ol(){ve&&(Ui=Ni=null,Vc=nn=!1)}function yg(c){wr===null?wr=[c]:wr.push(c)}function Xc(c,u,v){if(c=v.ref,c!==null&&typeof c!="function"&&typeof c!="object"){if(v._owner){if(v=v._owner,v){if(v.tag!==1)throw Error(o(309));var x=v.stateNode}if(!x)throw Error(o(147,c));var E=x,C=""+c;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===C?u.ref:(u=function(k){var j=E.refs;j===yA&&(j=E.refs={}),k===null?delete j[C]:j[C]=k},u._stringRef=C,u)}if(typeof c!="string")throw Error(o(284));if(!v._owner)throw Error(o(290,c))}return c}function fh(c,u){throw c=Object.prototype.toString.call(u),Error(o(31,c==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":c))}function TA(c){var u=c._init;return u(c._payload)}function CA(c){function u(te,Q){if(c){var ce=te.deletions;ce===null?(te.deletions=[Q],te.flags|=16):ce.push(Q)}}function v(te,Q){if(!c)return null;for(;Q!==null;)u(te,Q),Q=Q.sibling;return null}function x(te,Q){for(te=new Map;Q!==null;)Q.key!==null?te.set(Q.key,Q):te.set(Q.index,Q),Q=Q.sibling;return te}function E(te,Q){return te=no(te,Q),te.index=0,te.sibling=null,te}function C(te,Q,ce){return te.index=ce,c?(ce=te.alternate,ce!==null?(ce=ce.index,ce<Q?(te.flags|=2,Q):ce):(te.flags|=2,Q)):(te.flags|=1048576,Q)}function k(te){return c&&te.alternate===null&&(te.flags|=2),te}function j(te,Q,ce,ze){return Q===null||Q.tag!==6?(Q=tv(ce,te.mode,ze),Q.return=te,Q):(Q=E(Q,ce),Q.return=te,Q)}function fe(te,Q,ce,ze){var qe=ce.type;return qe===h?Ke(te,Q,ce.props.children,ze,ce.key):Q!==null&&(Q.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===M&&TA(qe)===Q.type)?(ze=E(Q,ce.props),ze.ref=Xc(te,Q,ce),ze.return=te,ze):(ze=Hh(ce.type,ce.key,ce.props,null,te.mode,ze),ze.ref=Xc(te,Q,ce),ze.return=te,ze)}function we(te,Q,ce,ze){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ce.containerInfo||Q.stateNode.implementation!==ce.implementation?(Q=nv(ce,te.mode,ze),Q.return=te,Q):(Q=E(Q,ce.children||[]),Q.return=te,Q)}function Ke(te,Q,ce,ze,qe){return Q===null||Q.tag!==7?(Q=ta(ce,te.mode,ze,qe),Q.return=te,Q):(Q=E(Q,ce),Q.return=te,Q)}function gt(te,Q,ce){if(typeof Q=="string"&&Q!==""||typeof Q=="number")return Q=tv(""+Q,te.mode,ce),Q.return=te,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case l:return ce=Hh(Q.type,Q.key,Q.props,null,te.mode,ce),ce.ref=Xc(te,null,Q),ce.return=te,ce;case f:return Q=nv(Q,te.mode,ce),Q.return=te,Q;case M:var ze=Q._init;return gt(te,ze(Q._payload),ce)}if(J(Q)||T(Q))return Q=ta(Q,te.mode,ce,null),Q.return=te,Q;fh(te,Q)}return null}function rt(te,Q,ce,ze){var qe=Q!==null?Q.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return qe!==null?null:j(te,Q,""+ce,ze);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case l:return ce.key===qe?fe(te,Q,ce,ze):null;case f:return ce.key===qe?we(te,Q,ce,ze):null;case M:return qe=ce._init,rt(te,Q,qe(ce._payload),ze)}if(J(ce)||T(ce))return qe!==null?null:Ke(te,Q,ce,ze,null);fh(te,ce)}return null}function Wt(te,Q,ce,ze,qe){if(typeof ze=="string"&&ze!==""||typeof ze=="number")return te=te.get(ce)||null,j(Q,te,""+ze,qe);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case l:return te=te.get(ze.key===null?ce:ze.key)||null,fe(Q,te,ze,qe);case f:return te=te.get(ze.key===null?ce:ze.key)||null,we(Q,te,ze,qe);case M:var St=ze._init;return Wt(te,Q,ce,St(ze._payload),qe)}if(J(ze)||T(ze))return te=te.get(ce)||null,Ke(Q,te,ze,qe,null);fh(Q,ze)}return null}function et(te,Q,ce,ze){for(var qe=null,St=null,vt=Q,kt=Q=0,zn=null;vt!==null&&kt<ce.length;kt++){vt.index>kt?(zn=vt,vt=null):zn=vt.sibling;var zt=rt(te,vt,ce[kt],ze);if(zt===null){vt===null&&(vt=zn);break}c&&vt&&zt.alternate===null&&u(te,vt),Q=C(zt,Q,kt),St===null?qe=zt:St.sibling=zt,St=zt,vt=zn}if(kt===ce.length)return v(te,vt),nn&&Ko(te,kt),qe;if(vt===null){for(;kt<ce.length;kt++)vt=gt(te,ce[kt],ze),vt!==null&&(Q=C(vt,Q,kt),St===null?qe=vt:St.sibling=vt,St=vt);return nn&&Ko(te,kt),qe}for(vt=x(te,vt);kt<ce.length;kt++)zn=Wt(vt,te,kt,ce[kt],ze),zn!==null&&(c&&zn.alternate!==null&&vt.delete(zn.key===null?kt:zn.key),Q=C(zn,Q,kt),St===null?qe=zn:St.sibling=zn,St=zn);return c&&vt.forEach(function(io){return u(te,io)}),nn&&Ko(te,kt),qe}function ri(te,Q,ce,ze){var qe=T(ce);if(typeof qe!="function")throw Error(o(150));if(ce=qe.call(ce),ce==null)throw Error(o(151));for(var St=qe=null,vt=Q,kt=Q=0,zn=null,zt=ce.next();vt!==null&&!zt.done;kt++,zt=ce.next()){vt.index>kt?(zn=vt,vt=null):zn=vt.sibling;var io=rt(te,vt,zt.value,ze);if(io===null){vt===null&&(vt=zn);break}c&&vt&&io.alternate===null&&u(te,vt),Q=C(io,Q,kt),St===null?qe=io:St.sibling=io,St=io,vt=zn}if(zt.done)return v(te,vt),nn&&Ko(te,kt),qe;if(vt===null){for(;!zt.done;kt++,zt=ce.next())zt=gt(te,zt.value,ze),zt!==null&&(Q=C(zt,Q,kt),St===null?qe=zt:St.sibling=zt,St=zt);return nn&&Ko(te,kt),qe}for(vt=x(te,vt);!zt.done;kt++,zt=ce.next())zt=Wt(vt,te,kt,zt.value,ze),zt!==null&&(c&&zt.alternate!==null&&vt.delete(zt.key===null?kt:zt.key),Q=C(zt,Q,kt),St===null?qe=zt:St.sibling=zt,St=zt);return c&&vt.forEach(function(jP){return u(te,jP)}),nn&&Ko(te,kt),qe}function lr(te,Q,ce,ze){if(typeof ce=="object"&&ce!==null&&ce.type===h&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case l:e:{for(var qe=ce.key,St=Q;St!==null;){if(St.key===qe){if(qe=ce.type,qe===h){if(St.tag===7){v(te,St.sibling),Q=E(St,ce.props.children),Q.return=te,te=Q;break e}}else if(St.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===M&&TA(qe)===St.type){v(te,St.sibling),Q=E(St,ce.props),Q.ref=Xc(te,St,ce),Q.return=te,te=Q;break e}v(te,St);break}else u(te,St);St=St.sibling}ce.type===h?(Q=ta(ce.props.children,te.mode,ze,ce.key),Q.return=te,te=Q):(ze=Hh(ce.type,ce.key,ce.props,null,te.mode,ze),ze.ref=Xc(te,Q,ce),ze.return=te,te=ze)}return k(te);case f:e:{for(St=ce.key;Q!==null;){if(Q.key===St)if(Q.tag===4&&Q.stateNode.containerInfo===ce.containerInfo&&Q.stateNode.implementation===ce.implementation){v(te,Q.sibling),Q=E(Q,ce.children||[]),Q.return=te,te=Q;break e}else{v(te,Q);break}else u(te,Q);Q=Q.sibling}Q=nv(ce,te.mode,ze),Q.return=te,te=Q}return k(te);case M:return St=ce._init,lr(te,Q,St(ce._payload),ze)}if(J(ce))return et(te,Q,ce,ze);if(T(ce))return ri(te,Q,ce,ze);fh(te,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,Q!==null&&Q.tag===6?(v(te,Q.sibling),Q=E(Q,ce),Q.return=te,te=Q):(v(te,Q),Q=tv(ce,te.mode,ze),Q.return=te,te=Q),k(te)):v(te,Q)}return lr}var al=CA(!0),RA=CA(!1),Jc={},rr=Nn(Jc),jc=Nn(Jc),ll=Nn(Jc);function Zr(c){if(c===Jc)throw Error(o(174));return c}function _g(c,u){je(ll,u),je(jc,c),je(rr,Jc),c=ae(u),ct(rr),je(rr,c)}function cl(){ct(rr),ct(jc),ct(ll)}function bA(c){var u=Zr(ll.current),v=Zr(rr.current);u=O(v,c.type,u),v!==u&&(je(jc,c),je(rr,u))}function xg(c){jc.current===c&&(ct(rr),ct(jc))}var on=Nn(0);function hh(c){for(var u=c;u!==null;){if(u.tag===13){var v=u.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||kc(v)||zc(v)))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if(u.flags&128)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===c)break;for(;u.sibling===null;){if(u.return===null||u.return===c)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Ag=[];function Sg(){for(var c=0;c<Ag.length;c++){var u=Ag[c];Le?u._workInProgressVersionPrimary=null:u._workInProgressVersionSecondary=null}Ag.length=0}var dh=a.ReactCurrentDispatcher,sr=a.ReactCurrentBatchConfig,ul=0,dn=null,ti=null,kn=null,ph=!1,Kc=!1,Yc=0,yP=0;function ni(){throw Error(o(321))}function Mg(c,u){if(u===null)return!1;for(var v=0;v<u.length&&v<c.length;v++)if(!Kr(c[v],u[v]))return!1;return!0}function Eg(c,u,v,x,E,C){if(ul=C,dn=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,dh.current=c===null||c.memoizedState===null?SP:MP,c=v(x,E),Kc){C=0;do{if(Kc=!1,Yc=0,25<=C)throw Error(o(301));C+=1,kn=ti=null,u.updateQueue=null,dh.current=EP,c=v(x,E)}while(Kc)}if(dh.current=_h,u=ti!==null&&ti.next!==null,ul=0,kn=ti=dn=null,ph=!1,u)throw Error(o(300));return c}function wg(){var c=Yc!==0;return Yc=0,c}function _s(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?dn.memoizedState=kn=c:kn=kn.next=c,kn}function qr(){if(ti===null){var c=dn.alternate;c=c!==null?c.memoizedState:null}else c=ti.next;var u=kn===null?dn.memoizedState:kn.next;if(u!==null)kn=u,ti=c;else{if(c===null)throw Error(o(310));ti=c,c={memoizedState:ti.memoizedState,baseState:ti.baseState,baseQueue:ti.baseQueue,queue:ti.queue,next:null},kn===null?dn.memoizedState=kn=c:kn=kn.next=c}return kn}function Yo(c,u){return typeof u=="function"?u(c):u}function mh(c){var u=qr(),v=u.queue;if(v===null)throw Error(o(311));v.lastRenderedReducer=c;var x=ti,E=x.baseQueue,C=v.pending;if(C!==null){if(E!==null){var k=E.next;E.next=C.next,C.next=k}x.baseQueue=E=C,v.pending=null}if(E!==null){C=E.next,x=x.baseState;var j=k=null,fe=null,we=C;do{var Ke=we.lane;if((ul&Ke)===Ke)fe!==null&&(fe=fe.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),x=we.hasEagerState?we.eagerState:c(x,we.action);else{var gt={lane:Ke,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};fe===null?(j=fe=gt,k=x):fe=fe.next=gt,dn.lanes|=Ke,hl|=Ke}we=we.next}while(we!==null&&we!==C);fe===null?k=x:fe.next=j,Kr(x,u.memoizedState)||(Oi=!0),u.memoizedState=x,u.baseState=k,u.baseQueue=fe,v.lastRenderedState=x}if(c=v.interleaved,c!==null){E=c;do C=E.lane,dn.lanes|=C,hl|=C,E=E.next;while(E!==c)}else E===null&&(v.lanes=0);return[u.memoizedState,v.dispatch]}function gh(c){var u=qr(),v=u.queue;if(v===null)throw Error(o(311));v.lastRenderedReducer=c;var x=v.dispatch,E=v.pending,C=u.memoizedState;if(E!==null){v.pending=null;var k=E=E.next;do C=c(C,k.action),k=k.next;while(k!==E);Kr(C,u.memoizedState)||(Oi=!0),u.memoizedState=C,u.baseQueue===null&&(u.baseState=C),v.lastRenderedState=C}return[C,x]}function PA(){}function BA(c,u){var v=dn,x=qr(),E=u(),C=!Kr(x.memoizedState,E);if(C&&(x.memoizedState=E,Oi=!0),x=x.queue,Zc(DA.bind(null,v,x,c),[c]),x.getSnapshot!==u||C||kn!==null&&kn.memoizedState.tag&1){if(v.flags|=2048,Qc(9,LA.bind(null,v,x,E,u),void 0,null),En===null)throw Error(o(349));ul&30||IA(v,u,E)}return E}function IA(c,u,v){c.flags|=16384,c={getSnapshot:u,value:v},u=dn.updateQueue,u===null?(u={lastEffect:null,stores:null},dn.updateQueue=u,u.stores=[c]):(v=u.stores,v===null?u.stores=[c]:v.push(c))}function LA(c,u,v,x){u.value=v,u.getSnapshot=x,FA(u)&&or(c,1,-1)}function DA(c,u,v){return v(function(){FA(u)&&or(c,1,-1)})}function FA(c){var u=c.getSnapshot;c=c.value;try{var v=u();return!Kr(c,v)}catch{return!0}}function Tg(c){var u=_s();return typeof c=="function"&&(c=c()),u.memoizedState=u.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:c},u.queue=c,c=c.dispatch=AP.bind(null,dn,c),[u.memoizedState,c]}function Qc(c,u,v,x){return c={tag:c,create:u,destroy:v,deps:x,next:null},u=dn.updateQueue,u===null?(u={lastEffect:null,stores:null},dn.updateQueue=u,u.lastEffect=c.next=c):(v=u.lastEffect,v===null?u.lastEffect=c.next=c:(x=v.next,v.next=c,c.next=x,u.lastEffect=c)),c}function NA(){return qr().memoizedState}function vh(c,u,v,x){var E=_s();dn.flags|=c,E.memoizedState=Qc(1|u,v,void 0,x===void 0?null:x)}function yh(c,u,v,x){var E=qr();x=x===void 0?null:x;var C=void 0;if(ti!==null){var k=ti.memoizedState;if(C=k.destroy,x!==null&&Mg(x,k.deps)){E.memoizedState=Qc(u,v,C,x);return}}dn.flags|=c,E.memoizedState=Qc(1|u,v,C,x)}function Cg(c,u){return vh(8390656,8,c,u)}function Zc(c,u){return yh(2048,8,c,u)}function UA(c,u){return yh(4,2,c,u)}function OA(c,u){return yh(4,4,c,u)}function kA(c,u){if(typeof u=="function")return c=c(),u(c),function(){u(null)};if(u!=null)return c=c(),u.current=c,function(){u.current=null}}function zA(c,u,v){return v=v!=null?v.concat([c]):null,yh(4,4,kA.bind(null,u,c),v)}function Rg(){}function GA(c,u){var v=qr();u=u===void 0?null:u;var x=v.memoizedState;return x!==null&&u!==null&&Mg(u,x[1])?x[0]:(v.memoizedState=[c,u],c)}function HA(c,u){var v=qr();u=u===void 0?null:u;var x=v.memoizedState;return x!==null&&u!==null&&Mg(u,x[1])?x[0]:(c=c(),v.memoizedState=[c,u],c)}function _P(c,u){var v=Ot;Ot=v!==0&&4>v?v:4,c(!0);var x=sr.transition;sr.transition={};try{c(!1),u()}finally{Ot=v,sr.transition=x}}function VA(){return qr().memoizedState}function xP(c,u,v){var x=eo(c);v={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null},WA(c)?XA(u,v):(JA(c,u,v),v=di(),c=or(c,x,v),c!==null&&jA(c,u,x))}function AP(c,u,v){var x=eo(c),E={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null};if(WA(c))XA(u,E);else{JA(c,u,E);var C=c.alternate;if(c.lanes===0&&(C===null||C.lanes===0)&&(C=u.lastRenderedReducer,C!==null))try{var k=u.lastRenderedState,j=C(k,v);if(E.hasEagerState=!0,E.eagerState=j,Kr(j,k))return}catch{}finally{}v=di(),c=or(c,x,v),c!==null&&jA(c,u,x)}}function WA(c){var u=c.alternate;return c===dn||u!==null&&u===dn}function XA(c,u){Kc=ph=!0;var v=c.pending;v===null?u.next=u:(u.next=v.next,v.next=u),c.pending=u}function JA(c,u,v){En!==null&&c.mode&1&&!(Et&2)?(c=u.interleaved,c===null?(v.next=v,Qr===null?Qr=[u]:Qr.push(u)):(v.next=c.next,c.next=v),u.interleaved=v):(c=u.pending,c===null?v.next=v:(v.next=c.next,c.next=v),u.pending=v)}function jA(c,u,v){if(v&4194240){var x=u.lanes;x&=c.pendingLanes,v|=x,u.lanes=v,ng(c,v)}}var _h={readContext:tr,useCallback:ni,useContext:ni,useEffect:ni,useImperativeHandle:ni,useInsertionEffect:ni,useLayoutEffect:ni,useMemo:ni,useReducer:ni,useRef:ni,useState:ni,useDebugValue:ni,useDeferredValue:ni,useTransition:ni,useMutableSource:ni,useSyncExternalStore:ni,useId:ni,unstable_isNewReconciler:!1},SP={readContext:tr,useCallback:function(c,u){return _s().memoizedState=[c,u===void 0?null:u],c},useContext:tr,useEffect:Cg,useImperativeHandle:function(c,u,v){return v=v!=null?v.concat([c]):null,vh(4194308,4,kA.bind(null,u,c),v)},useLayoutEffect:function(c,u){return vh(4194308,4,c,u)},useInsertionEffect:function(c,u){return vh(4,2,c,u)},useMemo:function(c,u){var v=_s();return u=u===void 0?null:u,c=c(),v.memoizedState=[c,u],c},useReducer:function(c,u,v){var x=_s();return u=v!==void 0?v(u):u,x.memoizedState=x.baseState=u,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:u},x.queue=c,c=c.dispatch=xP.bind(null,dn,c),[x.memoizedState,c]},useRef:function(c){var u=_s();return c={current:c},u.memoizedState=c},useState:Tg,useDebugValue:Rg,useDeferredValue:function(c){var u=Tg(c),v=u[0],x=u[1];return Cg(function(){var E=sr.transition;sr.transition={};try{x(c)}finally{sr.transition=E}},[c]),v},useTransition:function(){var c=Tg(!1),u=c[0];return c=_P.bind(null,c[1]),_s().memoizedState=c,[u,c]},useMutableSource:function(){},useSyncExternalStore:function(c,u,v){var x=dn,E=_s();if(nn){if(v===void 0)throw Error(o(407));v=v()}else{if(v=u(),En===null)throw Error(o(349));ul&30||IA(x,u,v)}E.memoizedState=v;var C={value:v,getSnapshot:u};return E.queue=C,Cg(DA.bind(null,x,C,c),[c]),x.flags|=2048,Qc(9,LA.bind(null,x,C,v,u),void 0,null),v},useId:function(){var c=_s(),u=En.identifierPrefix;if(nn){var v=ys,x=vs;v=(x&~(1<<32-Fi(x)-1)).toString(32)+v,u=":"+u+"R"+v,v=Yc++,0<v&&(u+="H"+v.toString(32)),u+=":"}else v=yP++,u=":"+u+"r"+v.toString(32)+":";return c.memoizedState=u},unstable_isNewReconciler:!1},MP={readContext:tr,useCallback:GA,useContext:tr,useEffect:Zc,useImperativeHandle:zA,useInsertionEffect:UA,useLayoutEffect:OA,useMemo:HA,useReducer:mh,useRef:NA,useState:function(){return mh(Yo)},useDebugValue:Rg,useDeferredValue:function(c){var u=mh(Yo),v=u[0],x=u[1];return Zc(function(){var E=sr.transition;sr.transition={};try{x(c)}finally{sr.transition=E}},[c]),v},useTransition:function(){var c=mh(Yo)[0],u=qr().memoizedState;return[c,u]},useMutableSource:PA,useSyncExternalStore:BA,useId:VA,unstable_isNewReconciler:!1},EP={readContext:tr,useCallback:GA,useContext:tr,useEffect:Zc,useImperativeHandle:zA,useInsertionEffect:UA,useLayoutEffect:OA,useMemo:HA,useReducer:gh,useRef:NA,useState:function(){return gh(Yo)},useDebugValue:Rg,useDeferredValue:function(c){var u=gh(Yo),v=u[0],x=u[1];return Zc(function(){var E=sr.transition;sr.transition={};try{x(c)}finally{sr.transition=E}},[c]),v},useTransition:function(){var c=gh(Yo)[0],u=qr().memoizedState;return[c,u]},useMutableSource:PA,useSyncExternalStore:BA,useId:VA,unstable_isNewReconciler:!1};function bg(c,u){try{var v="",x=u;do v+=vP(x),x=x.return;while(x);var E=v}catch(C){E=`
- Error generating stack: `+C.message+`
- `+C.stack}return{value:c,source:u,stack:E}}function Pg(c,u){try{console.error(u.value)}catch(v){setTimeout(function(){throw v})}}var wP=typeof WeakMap=="function"?WeakMap:Map;function KA(c,u,v){v=gs(-1,v),v.tag=3,v.payload={element:null};var x=u.value;return v.callback=function(){Fh||(Fh=!0,Kg=x),Pg(c,u)},v}function YA(c,u,v){v=gs(-1,v),v.tag=3;var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var E=u.value;v.payload=function(){return x(E)},v.callback=function(){Pg(c,u)}}var C=c.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(v.callback=function(){Pg(c,u),typeof x!="function"&&(qs===null?qs=new Set([this]):qs.add(this));var k=u.stack;this.componentDidCatch(u.value,{componentStack:k!==null?k:""})}),v}function QA(c,u,v){var x=c.pingCache;if(x===null){x=c.pingCache=new wP;var E=new Set;x.set(u,E)}else E=x.get(u),E===void 0&&(E=new Set,x.set(u,E));E.has(v)||(E.add(v),c=kP.bind(null,c,u,v),u.then(c,c))}function ZA(c){do{var u;if((u=c.tag===13)&&(u=c.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return c;c=c.return}while(c!==null);return null}function qA(c,u,v,x,E){return c.mode&1?(c.flags|=65536,c.lanes=E,c):(c===u?c.flags|=65536:(c.flags|=128,v.flags|=131072,v.flags&=-52805,v.tag===1&&(v.alternate===null?v.tag=17:(u=gs(-1,1),u.tag=2,Zs(v,u))),v.lanes|=1),c)}function $r(c){c.flags|=4}function $A(c,u){if(c!==null&&c.child===u.child)return!0;if(u.flags&16)return!1;for(c=u.child;c!==null;){if(c.flags&12854||c.subtreeFlags&12854)return!1;c=c.sibling}return!0}var qc,$c,xh,Ah;if(be)qc=function(c,u){for(var v=u.child;v!==null;){if(v.tag===5||v.tag===6)ne(c,v.stateNode);else if(v.tag!==4&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===u)break;for(;v.sibling===null;){if(v.return===null||v.return===u)return;v=v.return}v.sibling.return=v.return,v=v.sibling}},$c=function(){},xh=function(c,u,v,x,E){if(c=c.memoizedProps,c!==x){var C=u.stateNode,k=Zr(rr.current);v=ue(C,v,c,x,E,k),(u.updateQueue=v)&&$r(u)}},Ah=function(c,u,v,x){v!==x&&$r(u)};else if(z){qc=function(c,u,v,x){for(var E=u.child;E!==null;){if(E.tag===5){var C=E.stateNode;v&&x&&(C=Vt(C,E.type,E.memoizedProps,E)),ne(c,C)}else if(E.tag===6)C=E.stateNode,v&&x&&(C=tn(C,E.memoizedProps,E)),ne(c,C);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)C=E.child,C!==null&&(C.return=E),qc(c,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===u)break;for(;E.sibling===null;){if(E.return===null||E.return===u)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};var eS=function(c,u,v,x){for(var E=u.child;E!==null;){if(E.tag===5){var C=E.stateNode;v&&x&&(C=Vt(C,E.type,E.memoizedProps,E)),Qe(c,C)}else if(E.tag===6)C=E.stateNode,v&&x&&(C=tn(C,E.memoizedProps,E)),Qe(c,C);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)C=E.child,C!==null&&(C.return=E),eS(c,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===u)break;for(;E.sibling===null;){if(E.return===null||E.return===u)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};$c=function(c,u){var v=u.stateNode;if(!$A(c,u)){c=v.containerInfo;var x=it(c);eS(x,u,!1,!1),v.pendingChildren=x,$r(u),Tt(c,x)}},xh=function(c,u,v,x,E){var C=c.stateNode,k=c.memoizedProps;if((c=$A(c,u))&&k===x)u.stateNode=C;else{var j=u.stateNode,fe=Zr(rr.current),we=null;k!==x&&(we=ue(j,v,k,x,E,fe)),c&&we===null?u.stateNode=C:(C=Ne(C,we,v,k,x,u,c,j),Y(C,v,x,E,fe)&&$r(u),u.stateNode=C,c?$r(u):qc(C,u,!1,!1))}},Ah=function(c,u,v,x){v!==x?(c=Zr(ll.current),v=Zr(rr.current),u.stateNode=Te(x,c,v,u),$r(u)):u.stateNode=c.stateNode}}else $c=function(){},xh=function(){},Ah=function(){};function eu(c,u){if(!nn)switch(c.tailMode){case"hidden":u=c.tail;for(var v=null;u!==null;)u.alternate!==null&&(v=u),u=u.sibling;v===null?c.tail=null:v.sibling=null;break;case"collapsed":v=c.tail;for(var x=null;v!==null;)v.alternate!==null&&(x=v),v=v.sibling;x===null?u||c.tail===null?c.tail=null:c.tail.sibling=null:x.sibling=null}}function ii(c){var u=c.alternate!==null&&c.alternate.child===c.child,v=0,x=0;if(u)for(var E=c.child;E!==null;)v|=E.lanes|E.childLanes,x|=E.subtreeFlags&14680064,x|=E.flags&14680064,E.return=c,E=E.sibling;else for(E=c.child;E!==null;)v|=E.lanes|E.childLanes,x|=E.subtreeFlags,x|=E.flags,E.return=c,E=E.sibling;return c.subtreeFlags|=x,c.childLanes=v,u}function TP(c,u,v){var x=u.pendingProps;switch(mg(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ii(u),null;case 1:return Un(u.type)&&yn(),ii(u),null;case 3:return x=u.stateNode,cl(),ct(hn),ct(Mt),Sg(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(c===null||c.child===null)&&(Wc(u)?$r(u):c===null||c.memoizedState.isDehydrated&&!(u.flags&256)||(u.flags|=1024,wr!==null&&(Zg(wr),wr=null))),$c(c,u),ii(u),null;case 5:xg(u),v=Zr(ll.current);var E=u.type;if(c!==null&&u.stateNode!=null)xh(c,u,E,x,v),c.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!x){if(u.stateNode===null)throw Error(o(166));return ii(u),null}if(c=Zr(rr.current),Wc(u)){if(!ve)throw Error(o(175));c=Zm(u.stateNode,u.type,u.memoizedProps,v,c,u,!Vc),u.updateQueue=c,c!==null&&$r(u)}else{var C=q(E,x,v,c,u);qc(C,u,!1,!1),u.stateNode=C,Y(C,E,x,v,c)&&$r(u)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return ii(u),null;case 6:if(c&&u.stateNode!=null)Ah(c,u,c.memoizedProps,x);else{if(typeof x!="string"&&u.stateNode===null)throw Error(o(166));if(c=Zr(ll.current),v=Zr(rr.current),Wc(u)){if(!ve)throw Error(o(176));if(c=u.stateNode,x=u.memoizedProps,(v=qm(c,x,u,!Vc))&&(E=Ni,E!==null))switch(C=(E.mode&1)!==0,E.tag){case 3:$e(E.stateNode.containerInfo,c,x,C);break;case 5:at(E.type,E.memoizedProps,E.stateNode,c,x,C)}v&&$r(u)}else u.stateNode=Te(x,c,v,u)}return ii(u),null;case 13:if(ct(on),x=u.memoizedState,nn&&Ui!==null&&u.mode&1&&!(u.flags&128)){for(c=Ui;c;)c=Ys(c);return ol(),u.flags|=98560,u}if(x!==null&&x.dehydrated!==null){if(x=Wc(u),c===null){if(!x)throw Error(o(318));if(!ve)throw Error(o(344));if(c=u.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));$m(c,u)}else ol(),!(u.flags&128)&&(u.memoizedState=null),u.flags|=4;return ii(u),null}return wr!==null&&(Zg(wr),wr=null),u.flags&128?(u.lanes=v,u):(x=x!==null,v=!1,c===null?Wc(u):v=c.memoizedState!==null,x&&!v&&(u.child.flags|=8192,u.mode&1&&(c===null||on.current&1?Rn===0&&(Rn=3):$g())),u.updateQueue!==null&&(u.flags|=4),ii(u),null);case 4:return cl(),$c(c,u),c===null&&Me(u.stateNode.containerInfo),ii(u),null;case 10:return cg(u.type._context),ii(u),null;case 17:return Un(u.type)&&yn(),ii(u),null;case 19:if(ct(on),E=u.memoizedState,E===null)return ii(u),null;if(x=(u.flags&128)!==0,C=E.rendering,C===null)if(x)eu(E,!1);else{if(Rn!==0||c!==null&&c.flags&128)for(c=u.child;c!==null;){if(C=hh(c),C!==null){for(u.flags|=128,eu(E,!1),c=C.updateQueue,c!==null&&(u.updateQueue=c,u.flags|=4),u.subtreeFlags=0,c=v,x=u.child;x!==null;)v=x,E=c,v.flags&=14680066,C=v.alternate,C===null?(v.childLanes=0,v.lanes=E,v.child=null,v.subtreeFlags=0,v.memoizedProps=null,v.memoizedState=null,v.updateQueue=null,v.dependencies=null,v.stateNode=null):(v.childLanes=C.childLanes,v.lanes=C.lanes,v.child=C.child,v.subtreeFlags=0,v.deletions=null,v.memoizedProps=C.memoizedProps,v.memoizedState=C.memoizedState,v.updateQueue=C.updateQueue,v.type=C.type,E=C.dependencies,v.dependencies=E===null?null:{lanes:E.lanes,firstContext:E.firstContext}),x=x.sibling;return je(on,on.current&1|2),u.child}c=c.sibling}E.tail!==null&&On()>jg&&(u.flags|=128,x=!0,eu(E,!1),u.lanes=4194304)}else{if(!x)if(c=hh(C),c!==null){if(u.flags|=128,x=!0,c=c.updateQueue,c!==null&&(u.updateQueue=c,u.flags|=4),eu(E,!0),E.tail===null&&E.tailMode==="hidden"&&!C.alternate&&!nn)return ii(u),null}else 2*On()-E.renderingStartTime>jg&&v!==1073741824&&(u.flags|=128,x=!0,eu(E,!1),u.lanes=4194304);E.isBackwards?(C.sibling=u.child,u.child=C):(c=E.last,c!==null?c.sibling=C:u.child=C,E.last=C)}return E.tail!==null?(u=E.tail,E.rendering=u,E.tail=u.sibling,E.renderingStartTime=On(),u.sibling=null,c=on.current,je(on,x?c&1|2:c&1),u):(ii(u),null);case 22:case 23:return qg(),x=u.memoizedState!==null,c!==null&&c.memoizedState!==null!==x&&(u.flags|=8192),x&&u.mode&1?ki&1073741824&&(ii(u),be&&u.subtreeFlags&6&&(u.flags|=8192)):ii(u),null;case 24:return null;case 25:return null}throw Error(o(156,u.tag))}var CP=a.ReactCurrentOwner,Oi=!1;function hi(c,u,v,x){u.child=c===null?RA(u,null,v,x):al(u,c.child,v,x)}function tS(c,u,v,x,E){v=v.render;var C=u.ref;return il(u,E),x=Eg(c,u,v,x,C,E),v=wg(),c!==null&&!Oi?(u.updateQueue=c.updateQueue,u.flags&=-2053,c.lanes&=~E,xs(c,u,E)):(nn&&v&&pg(u),u.flags|=1,hi(c,u,x,E),u.child)}function nS(c,u,v,x,E){if(c===null){var C=v.type;return typeof C=="function"&&!ev(C)&&C.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(u.tag=15,u.type=C,iS(c,u,C,x,E)):(c=Hh(v.type,null,x,u,u.mode,E),c.ref=u.ref,c.return=u,u.child=c)}if(C=c.child,!(c.lanes&E)){var k=C.memoizedProps;if(v=v.compare,v=v!==null?v:ih,v(k,x)&&c.ref===u.ref)return xs(c,u,E)}return u.flags|=1,c=no(C,x),c.ref=u.ref,c.return=u,u.child=c}function iS(c,u,v,x,E){if(c!==null&&ih(c.memoizedProps,x)&&c.ref===u.ref)if(Oi=!1,(c.lanes&E)!==0)c.flags&131072&&(Oi=!0);else return u.lanes=c.lanes,xs(c,u,E);return Bg(c,u,v,x,E)}function rS(c,u,v){var x=u.pendingProps,E=x.children,C=c!==null?c.memoizedState:null;if(x.mode==="hidden")if(!(u.mode&1))u.memoizedState={baseLanes:0,cachePool:null},je(fl,ki),ki|=v;else if(v&1073741824)u.memoizedState={baseLanes:0,cachePool:null},x=C!==null?C.baseLanes:v,je(fl,ki),ki|=x;else return c=C!==null?C.baseLanes|v:v,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:c,cachePool:null},u.updateQueue=null,je(fl,ki),ki|=c,null;else C!==null?(x=C.baseLanes|v,u.memoizedState=null):x=v,je(fl,ki),ki|=x;return hi(c,u,E,v),u.child}function sS(c,u){var v=u.ref;(c===null&&v!==null||c!==null&&c.ref!==v)&&(u.flags|=512,u.flags|=2097152)}function Bg(c,u,v,x,E){var C=Un(v)?Xr:Mt.current;return C=er(u,C),il(u,E),v=Eg(c,u,v,x,C,E),x=wg(),c!==null&&!Oi?(u.updateQueue=c.updateQueue,u.flags&=-2053,c.lanes&=~E,xs(c,u,E)):(nn&&x&&pg(u),u.flags|=1,hi(c,u,v,E),u.child)}function oS(c,u,v,x,E){if(Un(v)){var C=!0;Jn(u)}else C=!1;if(il(u,E),u.stateNode===null)c!==null&&(c.alternate=null,u.alternate=null,u.flags|=2),xA(u,v,x),dg(u,v,x,E),x=!0;else if(c===null){var k=u.stateNode,j=u.memoizedProps;k.props=j;var fe=k.context,we=v.contextType;typeof we=="object"&&we!==null?we=tr(we):(we=Un(v)?Xr:Mt.current,we=er(u,we));var Ke=v.getDerivedStateFromProps,gt=typeof Ke=="function"||typeof k.getSnapshotBeforeUpdate=="function";gt||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(j!==x||fe!==we)&&AA(u,k,x,we),Qs=!1;var rt=u.memoizedState;k.state=rt,ah(u,x,k,E),fe=u.memoizedState,j!==x||rt!==fe||hn.current||Qs?(typeof Ke=="function"&&(hg(u,v,Ke,x),fe=u.memoizedState),(j=Qs||_A(u,v,j,x,rt,fe,we))?(gt||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(u.flags|=4194308)):(typeof k.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=x,u.memoizedState=fe),k.props=x,k.state=fe,k.context=we,x=j):(typeof k.componentDidMount=="function"&&(u.flags|=4194308),x=!1)}else{k=u.stateNode,mA(c,u),j=u.memoizedProps,we=u.type===u.elementType?j:Er(u.type,j),k.props=we,gt=u.pendingProps,rt=k.context,fe=v.contextType,typeof fe=="object"&&fe!==null?fe=tr(fe):(fe=Un(v)?Xr:Mt.current,fe=er(u,fe));var Wt=v.getDerivedStateFromProps;(Ke=typeof Wt=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(j!==gt||rt!==fe)&&AA(u,k,x,fe),Qs=!1,rt=u.memoizedState,k.state=rt,ah(u,x,k,E);var et=u.memoizedState;j!==gt||rt!==et||hn.current||Qs?(typeof Wt=="function"&&(hg(u,v,Wt,x),et=u.memoizedState),(we=Qs||_A(u,v,we,x,rt,et,fe)||!1)?(Ke||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(x,et,fe),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(x,et,fe)),typeof k.componentDidUpdate=="function"&&(u.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof k.componentDidUpdate!="function"||j===c.memoizedProps&&rt===c.memoizedState||(u.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||j===c.memoizedProps&&rt===c.memoizedState||(u.flags|=1024),u.memoizedProps=x,u.memoizedState=et),k.props=x,k.state=et,k.context=fe,x=we):(typeof k.componentDidUpdate!="function"||j===c.memoizedProps&&rt===c.memoizedState||(u.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||j===c.memoizedProps&&rt===c.memoizedState||(u.flags|=1024),x=!1)}return Ig(c,u,v,x,C,E)}function Ig(c,u,v,x,E,C){sS(c,u);var k=(u.flags&128)!==0;if(!x&&!k)return E&&tl(u,v,!1),xs(c,u,C);x=u.stateNode,CP.current=u;var j=k&&typeof v.getDerivedStateFromError!="function"?null:x.render();return u.flags|=1,c!==null&&k?(u.child=al(u,c.child,null,C),u.child=al(u,null,j,C)):hi(c,u,j,C),u.memoizedState=x.state,E&&tl(u,v,!0),u.child}function aS(c){var u=c.stateNode;u.pendingContext?Jr(c,u.pendingContext,u.pendingContext!==u.context):u.context&&Jr(c,u.context,!1),_g(c,u.containerInfo)}function lS(c,u,v,x,E){return ol(),yg(E),u.flags|=256,hi(c,u,v,x),u.child}var Sh={dehydrated:null,treeContext:null,retryLane:0};function Mh(c){return{baseLanes:c,cachePool:null}}function cS(c,u,v){var x=u.pendingProps,E=on.current,C=!1,k=(u.flags&128)!==0,j;if((j=k)||(j=c!==null&&c.memoizedState===null?!1:(E&2)!==0),j?(C=!0,u.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),je(on,E&1),c===null)return vg(u),c=u.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?(u.mode&1?zc(c)?u.lanes=8:u.lanes=1073741824:u.lanes=1,null):(E=x.children,c=x.fallback,C?(x=u.mode,C=u.child,E={mode:"hidden",children:E},!(x&1)&&C!==null?(C.childLanes=0,C.pendingProps=E):C=Vh(E,x,0,null),c=ta(c,x,v,null),C.return=u,c.return=u,C.sibling=c,u.child=C,u.child.memoizedState=Mh(v),u.memoizedState=Sh,c):Lg(u,E));if(E=c.memoizedState,E!==null){if(j=E.dehydrated,j!==null){if(k)return u.flags&256?(u.flags&=-257,Eh(c,u,v,Error(o(422)))):u.memoizedState!==null?(u.child=c.child,u.flags|=128,null):(C=x.fallback,E=u.mode,x=Vh({mode:"visible",children:x.children},E,0,null),C=ta(C,E,v,null),C.flags|=2,x.return=u,C.return=u,x.sibling=C,u.child=x,u.mode&1&&al(u,c.child,null,v),u.child.memoizedState=Mh(v),u.memoizedState=Sh,C);if(!(u.mode&1))u=Eh(c,u,v,null);else if(zc(j))u=Eh(c,u,v,Error(o(419)));else if(x=(v&c.childLanes)!==0,Oi||x){if(x=En,x!==null){switch(v&-v){case 4:C=2;break;case 16:C=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:C=32;break;case 536870912:C=268435456;break;default:C=0}x=C&(x.suspendedLanes|v)?0:C,x!==0&&x!==E.retryLane&&(E.retryLane=x,or(c,x,-1))}$g(),u=Eh(c,u,v,Error(o(421)))}else kc(j)?(u.flags|=128,u.child=c.child,u=zP.bind(null,c),qa(j,u),u=null):(v=E.treeContext,ve&&(Ui=Qf(j),Ni=u,nn=!0,wr=null,Vc=!1,v!==null&&(nr[ir++]=vs,nr[ir++]=ys,nr[ir++]=jo,vs=v.id,ys=v.overflow,jo=u)),u=Lg(u,u.pendingProps.children),u.flags|=4096);return u}return C?(x=fS(c,u,x.children,x.fallback,v),C=u.child,E=c.child.memoizedState,C.memoizedState=E===null?Mh(v):{baseLanes:E.baseLanes|v,cachePool:null},C.childLanes=c.childLanes&~v,u.memoizedState=Sh,x):(v=uS(c,u,x.children,v),u.memoizedState=null,v)}return C?(x=fS(c,u,x.children,x.fallback,v),C=u.child,E=c.child.memoizedState,C.memoizedState=E===null?Mh(v):{baseLanes:E.baseLanes|v,cachePool:null},C.childLanes=c.childLanes&~v,u.memoizedState=Sh,x):(v=uS(c,u,x.children,v),u.memoizedState=null,v)}function Lg(c,u){return u=Vh({mode:"visible",children:u},c.mode,0,null),u.return=c,c.child=u}function uS(c,u,v,x){var E=c.child;return c=E.sibling,v=no(E,{mode:"visible",children:v}),!(u.mode&1)&&(v.lanes=x),v.return=u,v.sibling=null,c!==null&&(x=u.deletions,x===null?(u.deletions=[c],u.flags|=16):x.push(c)),u.child=v}function fS(c,u,v,x,E){var C=u.mode;c=c.child;var k=c.sibling,j={mode:"hidden",children:v};return!(C&1)&&u.child!==c?(v=u.child,v.childLanes=0,v.pendingProps=j,u.deletions=null):(v=no(c,j),v.subtreeFlags=c.subtreeFlags&14680064),k!==null?x=no(k,x):(x=ta(x,C,E,null),x.flags|=2),x.return=u,v.return=u,v.sibling=x,u.child=v,x}function Eh(c,u,v,x){return x!==null&&yg(x),al(u,c.child,null,v),c=Lg(u,u.pendingProps.children),c.flags|=2,u.memoizedState=null,c}function hS(c,u,v){c.lanes|=u;var x=c.alternate;x!==null&&(x.lanes|=u),ug(c.return,u,v)}function Dg(c,u,v,x,E){var C=c.memoizedState;C===null?c.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:x,tail:v,tailMode:E}:(C.isBackwards=u,C.rendering=null,C.renderingStartTime=0,C.last=x,C.tail=v,C.tailMode=E)}function dS(c,u,v){var x=u.pendingProps,E=x.revealOrder,C=x.tail;if(hi(c,u,x.children,v),x=on.current,x&2)x=x&1|2,u.flags|=128;else{if(c!==null&&c.flags&128)e:for(c=u.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&hS(c,v,u);else if(c.tag===19)hS(c,v,u);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===u)break e;for(;c.sibling===null;){if(c.return===null||c.return===u)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}x&=1}if(je(on,x),!(u.mode&1))u.memoizedState=null;else switch(E){case"forwards":for(v=u.child,E=null;v!==null;)c=v.alternate,c!==null&&hh(c)===null&&(E=v),v=v.sibling;v=E,v===null?(E=u.child,u.child=null):(E=v.sibling,v.sibling=null),Dg(u,!1,E,v,C);break;case"backwards":for(v=null,E=u.child,u.child=null;E!==null;){if(c=E.alternate,c!==null&&hh(c)===null){u.child=E;break}c=E.sibling,E.sibling=v,v=E,E=c}Dg(u,!0,v,null,C);break;case"together":Dg(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function xs(c,u,v){if(c!==null&&(u.dependencies=c.dependencies),hl|=u.lanes,!(v&u.childLanes))return null;if(c!==null&&u.child!==c.child)throw Error(o(153));if(u.child!==null){for(c=u.child,v=no(c,c.pendingProps),u.child=v,v.return=u;c.sibling!==null;)c=c.sibling,v=v.sibling=no(c,c.pendingProps),v.return=u;v.sibling=null}return u.child}function RP(c,u,v){switch(u.tag){case 3:aS(u),ol();break;case 5:bA(u);break;case 1:Un(u.type)&&Jn(u);break;case 4:_g(u,u.stateNode.containerInfo);break;case 10:pA(u,u.type._context,u.memoizedProps.value);break;case 13:var x=u.memoizedState;if(x!==null)return x.dehydrated!==null?(je(on,on.current&1),u.flags|=128,null):v&u.child.childLanes?cS(c,u,v):(je(on,on.current&1),c=xs(c,u,v),c!==null?c.sibling:null);je(on,on.current&1);break;case 19:if(x=(v&u.childLanes)!==0,c.flags&128){if(x)return dS(c,u,v);u.flags|=128}var E=u.memoizedState;if(E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),je(on,on.current),x)break;return null;case 22:case 23:return u.lanes=0,rS(c,u,v)}return xs(c,u,v)}function bP(c,u){switch(mg(u),u.tag){case 1:return Un(u.type)&&yn(),c=u.flags,c&65536?(u.flags=c&-65537|128,u):null;case 3:return cl(),ct(hn),ct(Mt),Sg(),c=u.flags,c&65536&&!(c&128)?(u.flags=c&-65537|128,u):null;case 5:return xg(u),null;case 13:if(ct(on),c=u.memoizedState,c!==null&&c.dehydrated!==null){if(u.alternate===null)throw Error(o(340));ol()}return c=u.flags,c&65536?(u.flags=c&-65537|128,u):null;case 19:return ct(on),null;case 4:return cl(),null;case 10:return cg(u.type._context),null;case 22:case 23:return qg(),null;case 24:return null;default:return null}}var wh=!1,Qo=!1,PP=typeof WeakSet=="function"?WeakSet:Set,Oe=null;function Th(c,u){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(x){Ei(c,u,x)}else v.current=null}function Fg(c,u,v){try{v()}catch(x){Ei(c,u,x)}}var pS=!1;function BP(c,u){for(V(c.containerInfo),Oe=u;Oe!==null;)if(c=Oe,u=c.child,(c.subtreeFlags&1028)!==0&&u!==null)u.return=c,Oe=u;else for(;Oe!==null;){c=Oe;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,E=v.memoizedState,C=c.stateNode,k=C.getSnapshotBeforeUpdate(c.elementType===c.type?x:Er(c.type,x),E);C.__reactInternalSnapshotBeforeUpdate=k}break;case 3:be&&Re(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(j){Ei(c,c.return,j)}if(u=c.sibling,u!==null){u.return=c.return,Oe=u;break}Oe=c.return}return v=pS,pS=!1,v}function Zo(c,u,v){var x=u.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var E=x=x.next;do{if((E.tag&c)===c){var C=E.destroy;E.destroy=void 0,C!==void 0&&Fg(u,v,C)}E=E.next}while(E!==x)}}function tu(c,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var v=u=u.next;do{if((v.tag&c)===c){var x=v.create;v.destroy=x()}v=v.next}while(v!==u)}}function Ng(c){var u=c.ref;if(u!==null){var v=c.stateNode;switch(c.tag){case 5:c=Z(v);break;default:c=v}typeof u=="function"?u(c):u.current=c}}function mS(c,u,v){if(jr&&typeof jr.onCommitFiberUnmount=="function")try{jr.onCommitFiberUnmount(th,u)}catch{}switch(u.tag){case 0:case 11:case 14:case 15:if(c=u.updateQueue,c!==null&&(c=c.lastEffect,c!==null)){var x=c=c.next;do{var E=x,C=E.destroy;E=E.tag,C!==void 0&&(E&2||E&4)&&Fg(u,v,C),x=x.next}while(x!==c)}break;case 1:if(Th(u,v),c=u.stateNode,typeof c.componentWillUnmount=="function")try{c.props=u.memoizedProps,c.state=u.memoizedState,c.componentWillUnmount()}catch(k){Ei(u,v,k)}break;case 5:Th(u,v);break;case 4:be?AS(c,u,v):z&&z&&(u=u.stateNode.containerInfo,v=it(u),Lt(u,v))}}function gS(c,u,v){for(var x=u;;)if(mS(c,x,v),x.child===null||be&&x.tag===4){if(x===u)break;for(;x.sibling===null;){if(x.return===null||x.return===u)return;x=x.return}x.sibling.return=x.return,x=x.sibling}else x.child.return=x,x=x.child}function vS(c){var u=c.alternate;u!==null&&(c.alternate=null,vS(u)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(u=c.stateNode,u!==null&&Ve(u)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function yS(c){return c.tag===5||c.tag===3||c.tag===4}function _S(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||yS(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function xS(c){if(be){e:{for(var u=c.return;u!==null;){if(yS(u))break e;u=u.return}throw Error(o(160))}var v=u;switch(v.tag){case 5:u=v.stateNode,v.flags&32&&(ge(u),v.flags&=-33),v=_S(c),Og(c,v,u);break;case 3:case 4:u=v.stateNode.containerInfo,v=_S(c),Ug(c,v,u);break;default:throw Error(o(161))}}}function Ug(c,u,v){var x=c.tag;if(x===5||x===6)c=c.stateNode,u?tt(v,c,u):dt(v,c);else if(x!==4&&(c=c.child,c!==null))for(Ug(c,u,v),c=c.sibling;c!==null;)Ug(c,u,v),c=c.sibling}function Og(c,u,v){var x=c.tag;if(x===5||x===6)c=c.stateNode,u?ut(v,c,u):nt(v,c);else if(x!==4&&(c=c.child,c!==null))for(Og(c,u,v),c=c.sibling;c!==null;)Og(c,u,v),c=c.sibling}function AS(c,u,v){for(var x=u,E=!1,C,k;;){if(!E){E=x.return;e:for(;;){if(E===null)throw Error(o(160));switch(C=E.stateNode,E.tag){case 5:k=!1;break e;case 3:C=C.containerInfo,k=!0;break e;case 4:C=C.containerInfo,k=!0;break e}E=E.return}E=!0}if(x.tag===5||x.tag===6)gS(c,x,v),k?W(C,x.stateNode):We(C,x.stateNode);else if(x.tag===18)k?re(C,x.stateNode):le(C,x.stateNode);else if(x.tag===4){if(x.child!==null){C=x.stateNode.containerInfo,k=!0,x.child.return=x,x=x.child;continue}}else if(mS(c,x,v),x.child!==null){x.child.return=x,x=x.child;continue}if(x===u)break;for(;x.sibling===null;){if(x.return===null||x.return===u)return;x=x.return,x.tag===4&&(E=!1)}x.sibling.return=x.return,x=x.sibling}}function kg(c,u){if(be){switch(u.tag){case 0:case 11:case 14:case 15:Zo(3,u,u.return),tu(3,u),Zo(5,u,u.return);return;case 1:return;case 5:var v=u.stateNode;if(v!=null){var x=u.memoizedProps;c=c!==null?c.memoizedProps:x;var E=u.type,C=u.updateQueue;u.updateQueue=null,C!==null&&yt(v,C,E,c,x,u)}return;case 6:if(u.stateNode===null)throw Error(o(162));v=u.memoizedProps,xe(u.stateNode,c!==null?c.memoizedProps:v,v);return;case 3:ve&&c!==null&&c.memoizedState.isDehydrated&&ee(u.stateNode.containerInfo);return;case 12:return;case 13:Ch(u);return;case 19:Ch(u);return;case 17:return}throw Error(o(163))}switch(u.tag){case 0:case 11:case 14:case 15:Zo(3,u,u.return),tu(3,u),Zo(5,u,u.return);return;case 12:return;case 13:Ch(u);return;case 19:Ch(u);return;case 3:ve&&c!==null&&c.memoizedState.isDehydrated&&ee(u.stateNode.containerInfo);break;case 22:case 23:return}e:if(z){switch(u.tag){case 1:case 5:case 6:break e;case 3:case 4:u=u.stateNode,Lt(u.containerInfo,u.pendingChildren);break e}throw Error(o(163))}}function Ch(c){var u=c.updateQueue;if(u!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new PP),u.forEach(function(x){var E=GP.bind(null,c,x);v.has(x)||(v.add(x),x.then(E,E))})}}function IP(c,u){for(Oe=u;Oe!==null;){u=Oe;var v=u.deletions;if(v!==null)for(var x=0;x<v.length;x++){var E=v[x];try{var C=c;be?AS(C,E,u):gS(C,E,u);var k=E.alternate;k!==null&&(k.return=null),E.return=null}catch(qe){Ei(E,u,qe)}}if(v=u.child,u.subtreeFlags&12854&&v!==null)v.return=u,Oe=v;else for(;Oe!==null;){u=Oe;try{var j=u.flags;if(j&32&&be&&ge(u.stateNode),j&512){var fe=u.alternate;if(fe!==null){var we=fe.ref;we!==null&&(typeof we=="function"?we(null):we.current=null)}}if(j&8192)switch(u.tag){case 13:if(u.memoizedState!==null){var Ke=u.alternate;(Ke===null||Ke.memoizedState===null)&&(Jg=On())}break;case 22:var gt=u.memoizedState!==null,rt=u.alternate,Wt=rt!==null&&rt.memoizedState!==null;if(v=u,be){e:if(x=v,E=gt,C=null,be)for(var et=x;;){if(et.tag===5){if(C===null){C=et;var ri=et.stateNode;E?Ge(ri):Ae(et.stateNode,et.memoizedProps)}}else if(et.tag===6){if(C===null){var lr=et.stateNode;E?ke(lr):X(lr,et.memoizedProps)}}else if((et.tag!==22&&et.tag!==23||et.memoizedState===null||et===x)&&et.child!==null){et.child.return=et,et=et.child;continue}if(et===x)break;for(;et.sibling===null;){if(et.return===null||et.return===x)break e;C===et&&(C=null),et=et.return}C===et&&(C=null),et.sibling.return=et.return,et=et.sibling}}if(gt&&!Wt&&v.mode&1){Oe=v;for(var te=v.child;te!==null;){for(v=Oe=te;Oe!==null;){x=Oe;var Q=x.child;switch(x.tag){case 0:case 11:case 14:case 15:Zo(4,x,x.return);break;case 1:Th(x,x.return);var ce=x.stateNode;if(typeof ce.componentWillUnmount=="function"){var ze=x.return;try{ce.props=x.memoizedProps,ce.state=x.memoizedState,ce.componentWillUnmount()}catch(qe){Ei(x,ze,qe)}}break;case 5:Th(x,x.return);break;case 22:if(x.memoizedState!==null){ES(v);continue}}Q!==null?(Q.return=x,Oe=Q):ES(v)}te=te.sibling}}}switch(j&4102){case 2:xS(u),u.flags&=-3;break;case 6:xS(u),u.flags&=-3,kg(u.alternate,u);break;case 4096:u.flags&=-4097;break;case 4100:u.flags&=-4097,kg(u.alternate,u);break;case 4:kg(u.alternate,u)}}catch(qe){Ei(u,u.return,qe)}if(v=u.sibling,v!==null){v.return=u.return,Oe=v;break}Oe=u.return}}}function LP(c,u,v){Oe=c,SS(c)}function SS(c,u,v){for(var x=(c.mode&1)!==0;Oe!==null;){var E=Oe,C=E.child;if(E.tag===22&&x){var k=E.memoizedState!==null||wh;if(!k){var j=E.alternate,fe=j!==null&&j.memoizedState!==null||Qo;j=wh;var we=Qo;if(wh=k,(Qo=fe)&&!we)for(Oe=E;Oe!==null;)k=Oe,fe=k.child,k.tag===22&&k.memoizedState!==null?wS(E):fe!==null?(fe.return=k,Oe=fe):wS(E);for(;C!==null;)Oe=C,SS(C),C=C.sibling;Oe=E,wh=j,Qo=we}MS(c)}else E.subtreeFlags&8772&&C!==null?(C.return=E,Oe=C):MS(c)}}function MS(c){for(;Oe!==null;){var u=Oe;if(u.flags&8772){var v=u.alternate;try{if(u.flags&8772)switch(u.tag){case 0:case 11:case 15:Qo||tu(5,u);break;case 1:var x=u.stateNode;if(u.flags&4&&!Qo)if(v===null)x.componentDidMount();else{var E=u.elementType===u.type?v.memoizedProps:Er(u.type,v.memoizedProps);x.componentDidUpdate(E,v.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var C=u.updateQueue;C!==null&&vA(u,C,x);break;case 3:var k=u.updateQueue;if(k!==null){if(v=null,u.child!==null)switch(u.child.tag){case 5:v=Z(u.child.stateNode);break;case 1:v=u.child.stateNode}vA(u,k,v)}break;case 5:var j=u.stateNode;v===null&&u.flags&4&&It(j,u.type,u.memoizedProps,u);break;case 6:break;case 4:break;case 12:break;case 13:if(ve&&u.memoizedState===null){var fe=u.alternate;if(fe!==null){var we=fe.memoizedState;if(we!==null){var Ke=we.dehydrated;Ke!==null&&oe(Ke)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}Qo||u.flags&512&&Ng(u)}catch(gt){Ei(u,u.return,gt)}}if(u===c){Oe=null;break}if(v=u.sibling,v!==null){v.return=u.return,Oe=v;break}Oe=u.return}}function ES(c){for(;Oe!==null;){var u=Oe;if(u===c){Oe=null;break}var v=u.sibling;if(v!==null){v.return=u.return,Oe=v;break}Oe=u.return}}function wS(c){for(;Oe!==null;){var u=Oe;try{switch(u.tag){case 0:case 11:case 15:var v=u.return;try{tu(4,u)}catch(fe){Ei(u,v,fe)}break;case 1:var x=u.stateNode;if(typeof x.componentDidMount=="function"){var E=u.return;try{x.componentDidMount()}catch(fe){Ei(u,E,fe)}}var C=u.return;try{Ng(u)}catch(fe){Ei(u,C,fe)}break;case 5:var k=u.return;try{Ng(u)}catch(fe){Ei(u,k,fe)}}}catch(fe){Ei(u,u.return,fe)}if(u===c){Oe=null;break}var j=u.sibling;if(j!==null){j.return=u.return,Oe=j;break}Oe=u.return}}var Rh=0,bh=1,Ph=2,Bh=3,Ih=4;if(typeof Symbol=="function"&&Symbol.for){var nu=Symbol.for;Rh=nu("selector.component"),bh=nu("selector.has_pseudo_class"),Ph=nu("selector.role"),Bh=nu("selector.test_id"),Ih=nu("selector.text")}function zg(c){var u=he(c);if(u!=null){if(typeof u.memoizedProps["data-testname"]!="string")throw Error(o(364));return u}if(c=$(c),c===null)throw Error(o(362));return c.stateNode.current}function Gg(c,u){switch(u.$$typeof){case Rh:if(c.type===u.value)return!0;break;case bh:e:{u=u.value,c=[c,0];for(var v=0;v<c.length;){var x=c[v++],E=c[v++],C=u[E];if(x.tag!==5||!me(x)){for(;C!=null&&Gg(x,C);)E++,C=u[E];if(E===u.length){u=!0;break e}else for(x=x.child;x!==null;)c.push(x,E),x=x.sibling}}u=!1}return u;case Ph:if(c.tag===5&&Ye(c.stateNode,u.value))return!0;break;case Ih:if((c.tag===5||c.tag===6)&&(c=ye(c),c!==null&&0<=c.indexOf(u.value)))return!0;break;case Bh:if(c.tag===5&&(c=c.memoizedProps["data-testname"],typeof c=="string"&&c.toLowerCase()===u.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Hg(c){switch(c.$$typeof){case Rh:return"<"+(b(c.value)||"Unknown")+">";case bh:return":has("+(Hg(c)||"")+")";case Ph:return'[role="'+c.value+'"]';case Ih:return'"'+c.value+'"';case Bh:return'[data-testname="'+c.value+'"]';default:throw Error(o(365))}}function TS(c,u){var v=[];c=[c,0];for(var x=0;x<c.length;){var E=c[x++],C=c[x++],k=u[C];if(E.tag!==5||!me(E)){for(;k!=null&&Gg(E,k);)C++,k=u[C];if(C===u.length)v.push(E);else for(E=E.child;E!==null;)c.push(E,C),E=E.sibling}}return v}function Vg(c,u){if(!I)throw Error(o(363));c=zg(c),c=TS(c,u),u=[],c=Array.from(c);for(var v=0;v<c.length;){var x=c[v++];if(x.tag===5)me(x)||u.push(x.stateNode);else for(x=x.child;x!==null;)c.push(x),x=x.sibling}return u}var DP=Math.ceil,Lh=a.ReactCurrentDispatcher,Wg=a.ReactCurrentOwner,_n=a.ReactCurrentBatchConfig,Et=0,En=null,wn=null,jn=0,ki=0,fl=Nn(0),Rn=0,iu=null,hl=0,Dh=0,Xg=0,ru=null,Si=null,Jg=0,jg=1/0;function dl(){jg=On()+500}var Fh=!1,Kg=null,qs=null,Nh=!1,$s=null,Uh=0,su=0,Yg=null,Oh=-1,kh=0;function di(){return Et&6?On():Oh!==-1?Oh:Oh=On()}function eo(c){return c.mode&1?Et&2&&jn!==0?jn&-jn:gP.transition!==null?(kh===0&&(c=qf,qf<<=1,!(qf&4194240)&&(qf=64),kh=c),kh):(c=Ot,c!==0?c:pe()):1}function or(c,u,v){if(50<su)throw su=0,Yg=null,Error(o(185));var x=zh(c,u);return x===null?null:(Hc(x,u,v),(!(Et&2)||x!==En)&&(x===En&&(!(Et&2)&&(Dh|=u),Rn===4&&to(x,jn)),Mi(x,v),u===1&&Et===0&&!(c.mode&1)&&(dl(),nh&&Yr())),x)}function zh(c,u){c.lanes|=u;var v=c.alternate;for(v!==null&&(v.lanes|=u),v=c,c=c.return;c!==null;)c.childLanes|=u,v=c.alternate,v!==null&&(v.childLanes|=u),v=c,c=c.return;return v.tag===3?v.stateNode:null}function Mi(c,u){var v=c.callbackNode;aP(c,u);var x=eh(c,c===En?jn:0);if(x===0)v!==null&&hA(v),c.callbackNode=null,c.callbackPriority=0;else if(u=x&-x,c.callbackPriority!==u){if(v!=null&&hA(v),u===1)c.tag===0?mP(RS.bind(null,c)):dA(RS.bind(null,c)),De?F(function(){Et===0&&Yr()}):ig(rg,Yr),v=null;else{switch(fA(x)){case 1:v=rg;break;case 4:v=fP;break;case 16:v=sg;break;case 536870912:v=hP;break;default:v=sg}v=US(v,CS.bind(null,c))}c.callbackPriority=u,c.callbackNode=v}}function CS(c,u){if(Oh=-1,kh=0,Et&6)throw Error(o(327));var v=c.callbackNode;if(ea()&&c.callbackNode!==v)return null;var x=eh(c,c===En?jn:0);if(x===0)return null;if(x&30||x&c.expiredLanes||u)u=Gh(c,x);else{u=x;var E=Et;Et|=2;var C=BS();(En!==c||jn!==u)&&(dl(),qo(c,u));do try{UP();break}catch(j){PS(c,j)}while(!0);lg(),Lh.current=C,Et=E,wn!==null?u=0:(En=null,jn=0,u=Rn)}if(u!==0){if(u===2&&(E=eg(c),E!==0&&(x=E,u=Qg(c,E))),u===1)throw v=iu,qo(c,0),to(c,x),Mi(c,On()),v;if(u===6)to(c,x);else{if(E=c.current.alternate,!(x&30)&&!FP(E)&&(u=Gh(c,x),u===2&&(C=eg(c),C!==0&&(x=C,u=Qg(c,C))),u===1))throw v=iu,qo(c,0),to(c,x),Mi(c,On()),v;switch(c.finishedWork=E,c.finishedLanes=x,u){case 0:case 1:throw Error(o(345));case 2:$o(c,Si);break;case 3:if(to(c,x),(x&130023424)===x&&(u=Jg+500-On(),10<u)){if(eh(c,0)!==0)break;if(E=c.suspendedLanes,(E&x)!==x){di(),c.pingedLanes|=c.suspendedLanes&E;break}c.timeoutHandle=Ce($o.bind(null,c,Si),u);break}$o(c,Si);break;case 4:if(to(c,x),(x&4194240)===x)break;for(u=c.eventTimes,E=-1;0<x;){var k=31-Fi(x);C=1<<k,k=u[k],k>E&&(E=k),x&=~C}if(x=E,x=On()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*DP(x/1960))-x,10<x){c.timeoutHandle=Ce($o.bind(null,c,Si),x);break}$o(c,Si);break;case 5:$o(c,Si);break;default:throw Error(o(329))}}}return Mi(c,On()),c.callbackNode===v?CS.bind(null,c):null}function Qg(c,u){var v=ru;return c.current.memoizedState.isDehydrated&&(qo(c,u).flags|=256),c=Gh(c,u),c!==2&&(u=Si,Si=v,u!==null&&Zg(u)),c}function Zg(c){Si===null?Si=c:Si.push.apply(Si,c)}function FP(c){for(var u=c;;){if(u.flags&16384){var v=u.updateQueue;if(v!==null&&(v=v.stores,v!==null))for(var x=0;x<v.length;x++){var E=v[x],C=E.getSnapshot;E=E.value;try{if(!Kr(C(),E))return!1}catch{return!1}}}if(v=u.child,u.subtreeFlags&16384&&v!==null)v.return=u,u=v;else{if(u===c)break;for(;u.sibling===null;){if(u.return===null||u.return===c)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function to(c,u){for(u&=~Xg,u&=~Dh,c.suspendedLanes|=u,c.pingedLanes&=~u,c=c.expirationTimes;0<u;){var v=31-Fi(u),x=1<<v;c[v]=-1,u&=~x}}function RS(c){if(Et&6)throw Error(o(327));ea();var u=eh(c,0);if(!(u&1))return Mi(c,On()),null;var v=Gh(c,u);if(c.tag!==0&&v===2){var x=eg(c);x!==0&&(u=x,v=Qg(c,x))}if(v===1)throw v=iu,qo(c,0),to(c,u),Mi(c,On()),v;if(v===6)throw Error(o(345));return c.finishedWork=c.current.alternate,c.finishedLanes=u,$o(c,Si),Mi(c,On()),null}function bS(c){$s!==null&&$s.tag===0&&!(Et&6)&&ea();var u=Et;Et|=1;var v=_n.transition,x=Ot;try{if(_n.transition=null,Ot=1,c)return c()}finally{Ot=x,_n.transition=v,Et=u,!(Et&6)&&Yr()}}function qg(){ki=fl.current,ct(fl)}function qo(c,u){c.finishedWork=null,c.finishedLanes=0;var v=c.timeoutHandle;if(v!==ot&&(c.timeoutHandle=ot,Ze(v)),wn!==null)for(v=wn.return;v!==null;){var x=v;switch(mg(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&yn();break;case 3:cl(),ct(hn),ct(Mt),Sg();break;case 5:xg(x);break;case 4:cl();break;case 13:ct(on);break;case 19:ct(on);break;case 10:cg(x.type._context);break;case 22:case 23:qg()}v=v.return}if(En=c,wn=c=no(c.current,null),jn=ki=u,Rn=0,iu=null,Xg=Dh=hl=0,Si=ru=null,Qr!==null){for(u=0;u<Qr.length;u++)if(v=Qr[u],x=v.interleaved,x!==null){v.interleaved=null;var E=x.next,C=v.pending;if(C!==null){var k=C.next;C.next=E,x.next=k}v.pending=x}Qr=null}return c}function PS(c,u){do{var v=wn;try{if(lg(),dh.current=_h,ph){for(var x=dn.memoizedState;x!==null;){var E=x.queue;E!==null&&(E.pending=null),x=x.next}ph=!1}if(ul=0,kn=ti=dn=null,Kc=!1,Yc=0,Wg.current=null,v===null||v.return===null){Rn=1,iu=u,wn=null;break}e:{var C=c,k=v.return,j=v,fe=u;if(u=jn,j.flags|=32768,fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var we=fe,Ke=j,gt=Ke.tag;if(!(Ke.mode&1)&&(gt===0||gt===11||gt===15)){var rt=Ke.alternate;rt?(Ke.updateQueue=rt.updateQueue,Ke.memoizedState=rt.memoizedState,Ke.lanes=rt.lanes):(Ke.updateQueue=null,Ke.memoizedState=null)}var Wt=ZA(k);if(Wt!==null){Wt.flags&=-257,qA(Wt,k,j,C,u),Wt.mode&1&&QA(C,we,u),u=Wt,fe=we;var et=u.updateQueue;if(et===null){var ri=new Set;ri.add(fe),u.updateQueue=ri}else et.add(fe);break e}else{if(!(u&1)){QA(C,we,u),$g();break e}fe=Error(o(426))}}else if(nn&&j.mode&1){var lr=ZA(k);if(lr!==null){!(lr.flags&65536)&&(lr.flags|=256),qA(lr,k,j,C,u),yg(fe);break e}}C=fe,Rn!==4&&(Rn=2),ru===null?ru=[C]:ru.push(C),fe=bg(fe,j),j=k;do{switch(j.tag){case 3:j.flags|=65536,u&=-u,j.lanes|=u;var te=KA(j,fe,u);gA(j,te);break e;case 1:C=fe;var Q=j.type,ce=j.stateNode;if(!(j.flags&128)&&(typeof Q.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(qs===null||!qs.has(ce)))){j.flags|=65536,u&=-u,j.lanes|=u;var ze=YA(j,C,u);gA(j,ze);break e}}j=j.return}while(j!==null)}LS(v)}catch(qe){u=qe,wn===v&&v!==null&&(wn=v=v.return);continue}break}while(!0)}function BS(){var c=Lh.current;return Lh.current=_h,c===null?_h:c}function $g(){(Rn===0||Rn===3||Rn===2)&&(Rn=4),En===null||!(hl&268435455)&&!(Dh&268435455)||to(En,jn)}function Gh(c,u){var v=Et;Et|=2;var x=BS();En===c&&jn===u||qo(c,u);do try{NP();break}catch(E){PS(c,E)}while(!0);if(lg(),Et=v,Lh.current=x,wn!==null)throw Error(o(261));return En=null,jn=0,Rn}function NP(){for(;wn!==null;)IS(wn)}function UP(){for(;wn!==null&&!cP();)IS(wn)}function IS(c){var u=NS(c.alternate,c,ki);c.memoizedProps=c.pendingProps,u===null?LS(c):wn=u,Wg.current=null}function LS(c){var u=c;do{var v=u.alternate;if(c=u.return,u.flags&32768){if(v=bP(v,u),v!==null){v.flags&=32767,wn=v;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{Rn=6,wn=null;return}}else if(v=TP(v,u,ki),v!==null){wn=v;return}if(u=u.sibling,u!==null){wn=u;return}wn=u=c}while(u!==null);Rn===0&&(Rn=5)}function $o(c,u){var v=Ot,x=_n.transition;try{_n.transition=null,Ot=1,OP(c,u,v)}finally{_n.transition=x,Ot=v}return null}function OP(c,u,v){do ea();while($s!==null);if(Et&6)throw Error(o(327));var x=c.finishedWork,E=c.finishedLanes;if(x===null)return null;if(c.finishedWork=null,c.finishedLanes=0,x===c.current)throw Error(o(177));c.callbackNode=null,c.callbackPriority=0;var C=x.lanes|x.childLanes;if(lP(c,C),c===En&&(wn=En=null,jn=0),!(x.subtreeFlags&2064)&&!(x.flags&2064)||Nh||(Nh=!0,US(sg,function(){return ea(),null})),C=(x.flags&15990)!==0,x.subtreeFlags&15990||C){C=_n.transition,_n.transition=null;var k=Ot;Ot=1;var j=Et;Et|=4,Wg.current=null,BP(c,x),IP(c,x),H(c.containerInfo),c.current=x,LP(x),uP(),Et=j,Ot=k,_n.transition=C}else c.current=x;if(Nh&&(Nh=!1,$s=c,Uh=E),C=c.pendingLanes,C===0&&(qs=null),dP(x.stateNode),Mi(c,On()),u!==null)for(v=c.onRecoverableError,x=0;x<u.length;x++)v(u[x]);if(Fh)throw Fh=!1,c=Kg,Kg=null,c;return Uh&1&&c.tag!==0&&ea(),C=c.pendingLanes,C&1?c===Yg?su++:(su=0,Yg=c):su=0,Yr(),null}function ea(){if($s!==null){var c=fA(Uh),u=_n.transition,v=Ot;try{if(_n.transition=null,Ot=16>c?16:c,$s===null)var x=!1;else{if(c=$s,$s=null,Uh=0,Et&6)throw Error(o(331));var E=Et;for(Et|=4,Oe=c.current;Oe!==null;){var C=Oe,k=C.child;if(Oe.flags&16){var j=C.deletions;if(j!==null){for(var fe=0;fe<j.length;fe++){var we=j[fe];for(Oe=we;Oe!==null;){var Ke=Oe;switch(Ke.tag){case 0:case 11:case 15:Zo(8,Ke,C)}var gt=Ke.child;if(gt!==null)gt.return=Ke,Oe=gt;else for(;Oe!==null;){Ke=Oe;var rt=Ke.sibling,Wt=Ke.return;if(vS(Ke),Ke===we){Oe=null;break}if(rt!==null){rt.return=Wt,Oe=rt;break}Oe=Wt}}}var et=C.alternate;if(et!==null){var ri=et.child;if(ri!==null){et.child=null;do{var lr=ri.sibling;ri.sibling=null,ri=lr}while(ri!==null)}}Oe=C}}if(C.subtreeFlags&2064&&k!==null)k.return=C,Oe=k;else e:for(;Oe!==null;){if(C=Oe,C.flags&2048)switch(C.tag){case 0:case 11:case 15:Zo(9,C,C.return)}var te=C.sibling;if(te!==null){te.return=C.return,Oe=te;break e}Oe=C.return}}var Q=c.current;for(Oe=Q;Oe!==null;){k=Oe;var ce=k.child;if(k.subtreeFlags&2064&&ce!==null)ce.return=k,Oe=ce;else e:for(k=Q;Oe!==null;){if(j=Oe,j.flags&2048)try{switch(j.tag){case 0:case 11:case 15:tu(9,j)}}catch(qe){Ei(j,j.return,qe)}if(j===k){Oe=null;break e}var ze=j.sibling;if(ze!==null){ze.return=j.return,Oe=ze;break e}Oe=j.return}}if(Et=E,Yr(),jr&&typeof jr.onPostCommitFiberRoot=="function")try{jr.onPostCommitFiberRoot(th,c)}catch{}x=!0}return x}finally{Ot=v,_n.transition=u}}return!1}function DS(c,u,v){u=bg(v,u),u=KA(c,u,1),Zs(c,u),u=di(),c=zh(c,1),c!==null&&(Hc(c,1,u),Mi(c,u))}function Ei(c,u,v){if(c.tag===3)DS(c,c,v);else for(;u!==null;){if(u.tag===3){DS(u,c,v);break}else if(u.tag===1){var x=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(qs===null||!qs.has(x))){c=bg(v,c),c=YA(u,c,1),Zs(u,c),c=di(),u=zh(u,1),u!==null&&(Hc(u,1,c),Mi(u,c));break}}u=u.return}}function kP(c,u,v){var x=c.pingCache;x!==null&&x.delete(u),u=di(),c.pingedLanes|=c.suspendedLanes&v,En===c&&(jn&v)===v&&(Rn===4||Rn===3&&(jn&130023424)===jn&&500>On()-Jg?qo(c,0):Xg|=v),Mi(c,u)}function FS(c,u){u===0&&(c.mode&1?(u=$f,$f<<=1,!($f&130023424)&&($f=4194304)):u=1);var v=di();c=zh(c,u),c!==null&&(Hc(c,u,v),Mi(c,v))}function zP(c){var u=c.memoizedState,v=0;u!==null&&(v=u.retryLane),FS(c,v)}function GP(c,u){var v=0;switch(c.tag){case 13:var x=c.stateNode,E=c.memoizedState;E!==null&&(v=E.retryLane);break;case 19:x=c.stateNode;break;default:throw Error(o(314))}x!==null&&x.delete(u),FS(c,v)}var NS;NS=function(c,u,v){if(c!==null)if(c.memoizedProps!==u.pendingProps||hn.current)Oi=!0;else{if(!(c.lanes&v)&&!(u.flags&128))return Oi=!1,RP(c,u,v);Oi=!!(c.flags&131072)}else Oi=!1,nn&&u.flags&1048576&&SA(u,uh,u.index);switch(u.lanes=0,u.tag){case 2:var x=u.type;c!==null&&(c.alternate=null,u.alternate=null,u.flags|=2),c=u.pendingProps;var E=er(u,Mt.current);il(u,v),E=Eg(null,u,x,c,E,v);var C=wg();return u.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,Un(x)?(C=!0,Jn(u)):C=!1,u.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,fg(u),E.updater=lh,u.stateNode=E,E._reactInternals=u,dg(u,x,c,v),u=Ig(null,u,x,!0,C,v)):(u.tag=0,nn&&C&&pg(u),hi(null,u,E,v),u=u.child),u;case 16:x=u.elementType;e:{switch(c!==null&&(c.alternate=null,u.alternate=null,u.flags|=2),c=u.pendingProps,E=x._init,x=E(x._payload),u.type=x,E=u.tag=VP(x),c=Er(x,c),E){case 0:u=Bg(null,u,x,c,v);break e;case 1:u=oS(null,u,x,c,v);break e;case 11:u=tS(null,u,x,c,v);break e;case 14:u=nS(null,u,x,Er(x.type,c),v);break e}throw Error(o(306,x,""))}return u;case 0:return x=u.type,E=u.pendingProps,E=u.elementType===x?E:Er(x,E),Bg(c,u,x,E,v);case 1:return x=u.type,E=u.pendingProps,E=u.elementType===x?E:Er(x,E),oS(c,u,x,E,v);case 3:e:{if(aS(u),c===null)throw Error(o(387));x=u.pendingProps,C=u.memoizedState,E=C.element,mA(c,u),ah(u,x,null,v);var k=u.memoizedState;if(x=k.element,ve&&C.isDehydrated)if(C={element:x,isDehydrated:!1,cache:k.cache,transitions:k.transitions},u.updateQueue.baseState=C,u.memoizedState=C,u.flags&256){E=Error(o(423)),u=lS(c,u,x,v,E);break e}else if(x!==E){E=Error(o(424)),u=lS(c,u,x,v,E);break e}else for(ve&&(Ui=Yf(u.stateNode.containerInfo),Ni=u,nn=!0,wr=null,Vc=!1),v=RA(u,null,x,v),u.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(ol(),x===E){u=xs(c,u,v);break e}hi(c,u,x,v)}u=u.child}return u;case 5:return bA(u),c===null&&vg(u),x=u.type,E=u.pendingProps,C=c!==null?c.memoizedProps:null,k=E.children,Se(x,E)?k=null:C!==null&&Se(x,C)&&(u.flags|=32),sS(c,u),hi(c,u,k,v),u.child;case 6:return c===null&&vg(u),null;case 13:return cS(c,u,v);case 4:return _g(u,u.stateNode.containerInfo),x=u.pendingProps,c===null?u.child=al(u,null,x,v):hi(c,u,x,v),u.child;case 11:return x=u.type,E=u.pendingProps,E=u.elementType===x?E:Er(x,E),tS(c,u,x,E,v);case 7:return hi(c,u,u.pendingProps,v),u.child;case 8:return hi(c,u,u.pendingProps.children,v),u.child;case 12:return hi(c,u,u.pendingProps.children,v),u.child;case 10:e:{if(x=u.type._context,E=u.pendingProps,C=u.memoizedProps,k=E.value,pA(u,x,k),C!==null)if(Kr(C.value,k)){if(C.children===E.children&&!hn.current){u=xs(c,u,v);break e}}else for(C=u.child,C!==null&&(C.return=u);C!==null;){var j=C.dependencies;if(j!==null){k=C.child;for(var fe=j.firstContext;fe!==null;){if(fe.context===x){if(C.tag===1){fe=gs(-1,v&-v),fe.tag=2;var we=C.updateQueue;if(we!==null){we=we.shared;var Ke=we.pending;Ke===null?fe.next=fe:(fe.next=Ke.next,Ke.next=fe),we.pending=fe}}C.lanes|=v,fe=C.alternate,fe!==null&&(fe.lanes|=v),ug(C.return,v,u),j.lanes|=v;break}fe=fe.next}}else if(C.tag===10)k=C.type===u.type?null:C.child;else if(C.tag===18){if(k=C.return,k===null)throw Error(o(341));k.lanes|=v,j=k.alternate,j!==null&&(j.lanes|=v),ug(k,v,u),k=C.sibling}else k=C.child;if(k!==null)k.return=C;else for(k=C;k!==null;){if(k===u){k=null;break}if(C=k.sibling,C!==null){C.return=k.return,k=C;break}k=k.return}C=k}hi(c,u,E.children,v),u=u.child}return u;case 9:return E=u.type,x=u.pendingProps.children,il(u,v),E=tr(E),x=x(E),u.flags|=1,hi(c,u,x,v),u.child;case 14:return x=u.type,E=Er(x,u.pendingProps),E=Er(x.type,E),nS(c,u,x,E,v);case 15:return iS(c,u,u.type,u.pendingProps,v);case 17:return x=u.type,E=u.pendingProps,E=u.elementType===x?E:Er(x,E),c!==null&&(c.alternate=null,u.alternate=null,u.flags|=2),u.tag=1,Un(x)?(c=!0,Jn(u)):c=!1,il(u,v),xA(u,x,E),dg(u,x,E,v),Ig(null,u,x,!0,c,v);case 19:return dS(c,u,v);case 22:return rS(c,u,v)}throw Error(o(156,u.tag))};function US(c,u){return ig(c,u)}function HP(c,u,v,x){this.tag=c,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ar(c,u,v,x){return new HP(c,u,v,x)}function ev(c){return c=c.prototype,!(!c||!c.isReactComponent)}function VP(c){if(typeof c=="function")return ev(c)?1:0;if(c!=null){if(c=c.$$typeof,c===S)return 11;if(c===_)return 14}return 2}function no(c,u){var v=c.alternate;return v===null?(v=ar(c.tag,u,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=u,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,u=c.dependencies,v.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Hh(c,u,v,x,E,C){var k=2;if(x=c,typeof c=="function")ev(c)&&(k=1);else if(typeof c=="string")k=5;else e:switch(c){case h:return ta(v.children,E,C,u);case d:k=8,E|=8;break;case p:return c=ar(12,v,u,E|2),c.elementType=p,c.lanes=C,c;case A:return c=ar(13,v,u,E),c.elementType=A,c.lanes=C,c;case g:return c=ar(19,v,u,E),c.elementType=g,c.lanes=C,c;case w:return Vh(v,E,C,u);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case m:k=10;break e;case y:k=9;break e;case S:k=11;break e;case _:k=14;break e;case M:k=16,x=null;break e}throw Error(o(130,c==null?c:typeof c,""))}return u=ar(k,v,u,E),u.elementType=c,u.type=x,u.lanes=C,u}function ta(c,u,v,x){return c=ar(7,c,x,u),c.lanes=v,c}function Vh(c,u,v,x){return c=ar(22,c,x,u),c.elementType=w,c.lanes=v,c.stateNode={},c}function tv(c,u,v){return c=ar(6,c,null,u),c.lanes=v,c}function nv(c,u,v){return u=ar(4,c.children!==null?c.children:[],c.key,u),u.lanes=v,u.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},u}function WP(c,u,v,x,E){this.tag=u,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ot,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=tg(0),this.expirationTimes=tg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tg(0),this.identifierPrefix=x,this.onRecoverableError=E,ve&&(this.mutableSourceEagerHydrationData=null)}function OS(c,u,v,x,E,C,k,j,fe){return c=new WP(c,u,v,j,fe),u===1?(u=1,C===!0&&(u|=8)):u=0,C=ar(3,null,null,u),c.current=C,C.stateNode=c,C.memoizedState={element:x,isDehydrated:v,cache:null,transitions:null},fg(C),c}function kS(c){if(!c)return $i;c=c._reactInternals;e:{if(R(c)!==c||c.tag!==1)throw Error(o(170));var u=c;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(Un(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(o(171))}if(c.tag===1){var v=c.type;if(Un(v))return el(c,v,u)}return u}function zS(c){var u=c._reactInternals;if(u===void 0)throw typeof c.render=="function"?Error(o(188)):(c=Object.keys(c).join(","),Error(o(268,c)));return c=K(u),c===null?null:c.stateNode}function GS(c,u){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v<u?v:u}}function iv(c,u){GS(c,u),(c=c.alternate)&&GS(c,u)}function XP(c){return c=K(c),c===null?null:c.stateNode}function JP(){return null}return t.attemptContinuousHydration=function(c){if(c.tag===13){var u=di();or(c,134217728,u),iv(c,134217728)}},t.attemptHydrationAtCurrentPriority=function(c){if(c.tag===13){var u=di(),v=eo(c);or(c,v,u),iv(c,v)}},t.attemptSynchronousHydration=function(c){switch(c.tag){case 3:var u=c.stateNode;if(u.current.memoizedState.isDehydrated){var v=Gc(u.pendingLanes);v!==0&&(ng(u,v|1),Mi(u,On()),!(Et&6)&&(dl(),Yr()))}break;case 13:var x=di();bS(function(){return or(c,1,x)}),iv(c,1)}},t.batchedUpdates=function(c,u){var v=Et;Et|=1;try{return c(u)}finally{Et=v,Et===0&&(dl(),nh&&Yr())}},t.createComponentSelector=function(c){return{$$typeof:Rh,value:c}},t.createContainer=function(c,u,v,x,E,C,k){return OS(c,u,!1,null,v,x,E,C,k)},t.createHasPseudoClassSelector=function(c){return{$$typeof:bh,value:c}},t.createHydrationContainer=function(c,u,v,x,E,C,k,j,fe){return c=OS(v,x,!0,c,E,C,k,j,fe),c.context=kS(null),v=c.current,x=di(),E=eo(v),C=gs(x,E),C.callback=u??null,Zs(v,C),c.current.lanes=E,Hc(c,E,x),Mi(c,x),c},t.createPortal=function(c,u,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:x==null?null:""+x,children:c,containerInfo:u,implementation:v}},t.createRoleSelector=function(c){return{$$typeof:Ph,value:c}},t.createTestNameSelector=function(c){return{$$typeof:Bh,value:c}},t.createTextSelector=function(c){return{$$typeof:Ih,value:c}},t.deferredUpdates=function(c){var u=Ot,v=_n.transition;try{return _n.transition=null,Ot=16,c()}finally{Ot=u,_n.transition=v}},t.discreteUpdates=function(c,u,v,x,E){var C=Ot,k=_n.transition;try{return _n.transition=null,Ot=1,c(u,v,x,E)}finally{Ot=C,_n.transition=k,Et===0&&dl()}},t.findAllNodes=Vg,t.findBoundingRects=function(c,u){if(!I)throw Error(o(363));u=Vg(c,u),c=[];for(var v=0;v<u.length;v++)c.push(_e(u[v]));for(u=c.length-1;0<u;u--){v=c[u];for(var x=v.x,E=x+v.width,C=v.y,k=C+v.height,j=u-1;0<=j;j--)if(u!==j){var fe=c[j],we=fe.x,Ke=we+fe.width,gt=fe.y,rt=gt+fe.height;if(x>=we&&C>=gt&&E<=Ke&&k<=rt){c.splice(u,1);break}else if(x!==we||v.width!==fe.width||rt<C||gt>k){if(!(C!==gt||v.height!==fe.height||Ke<x||we>E)){we>x&&(fe.width+=we-x,fe.x=x),Ke<E&&(fe.width=E-we),c.splice(u,1);break}}else{gt>C&&(fe.height+=gt-C,fe.y=C),rt<k&&(fe.height=k-gt),c.splice(u,1);break}}}return c},t.findHostInstance=zS,t.findHostInstanceWithNoPortals=function(c){return c=U(c),c=c!==null?G(c):null,c===null?null:c.stateNode},t.findHostInstanceWithWarning=function(c){return zS(c)},t.flushControlled=function(c){var u=Et;Et|=1;var v=_n.transition,x=Ot;try{_n.transition=null,Ot=1,c()}finally{Ot=x,_n.transition=v,Et=u,Et===0&&(dl(),Yr())}},t.flushPassiveEffects=ea,t.flushSync=bS,t.focusWithin=function(c,u){if(!I)throw Error(o(363));for(c=zg(c),u=TS(c,u),u=Array.from(u),c=0;c<u.length;){var v=u[c++];if(!me(v)){if(v.tag===5&&Be(v.stateNode))return!0;for(v=v.child;v!==null;)u.push(v),v=v.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Ot},t.getFindAllNodesFailureDescription=function(c,u){if(!I)throw Error(o(363));var v=0,x=[];c=[zg(c),0];for(var E=0;E<c.length;){var C=c[E++],k=c[E++],j=u[k];if((C.tag!==5||!me(C))&&(Gg(C,j)&&(x.push(Hg(j)),k++,k>v&&(v=k)),k<u.length))for(C=C.child;C!==null;)c.push(C,k),C=C.sibling}if(v<u.length){for(c=[];v<u.length;v++)c.push(Hg(u[v]));return`findAllNodes was able to match part of the selector:
- `+(x.join(" > ")+`
- No matching component was found for:
- `)+c.join(" > ")}return null},t.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return Z(c.child.stateNode);default:return c.child.stateNode}},t.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:XP,findFiberByHostInstance:c.findFiberByHostInstance||JP,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)c=!0;else{try{th=u.inject(c),jr=u}catch{}c=!!u.checkDCE}}return c},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(c,u,v,x){if(!I)throw Error(o(363));c=Vg(c,u);var E=Fe(c,v,x).disconnect;return{disconnect:function(){E()}}},t.registerMutableSourceForHydration=function(c,u){var v=u._getVersion;v=v(u._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[u,v]:c.mutableSourceEagerHydrationData.push(u,v)},t.runWithPriority=function(c,u){var v=Ot;try{return Ot=c,u()}finally{Ot=v}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(c,u,v,x){var E=u.current,C=di(),k=eo(E);return v=kS(v),u.context===null?u.context=v:u.pendingContext=v,u=gs(C,k),u.payload={element:c},x=x===void 0?null:x,x!==null&&(u.callback=x),Zs(E,u),c=or(E,k,C),c!==null&&oh(c,E,k),k},t};xb.exports=dk;var pk=xb.exports;const mk=KP(pk),sA={},gk=n=>void Object.assign(sA,n);function vk(n,e){function t(h,{args:d=[],attach:p,...m},y){let S=`${h[0].toUpperCase()}${h.slice(1)}`,A;if(h==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;A=zl(g,{type:h,root:y,attach:p,primitive:!0})}else{const g=sA[S];if(!g)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");A=zl(new g(...d),{type:h,root:y,attach:p,memoizedProps:{args:d}})}return A.__r3f.attach===void 0&&(A.isBufferGeometry?A.__r3f.attach="geometry":A.isMaterial&&(A.__r3f.attach="material")),S!=="inject"&&m0(A,m),A}function i(h,d){let p=!1;if(d){var m,y;(m=d.__r3f)!=null&&m.attach?p0(h,d,d.__r3f.attach):d.isObject3D&&h.isObject3D&&(h.add(d),p=!0),p||(y=h.__r3f)==null||y.objects.push(d),d.__r3f||zl(d,{}),d.__r3f.parent=h,d_(d),Gl(d)}}function r(h,d,p){let m=!1;if(d){var y,S;if((y=d.__r3f)!=null&&y.attach)p0(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){d.parent=h,d.dispatchEvent({type:"added"}),h.dispatchEvent({type:"childadded",child:d});const A=h.children.filter(_=>_!==d),g=A.indexOf(p);h.children=[...A.slice(0,g),d,...A.slice(g)],m=!0}m||(S=h.__r3f)==null||S.objects.push(d),d.__r3f||zl(d,{}),d.__r3f.parent=h,d_(d),Gl(d)}}function s(h,d,p=!1){h&&[...h].forEach(m=>o(d,m,p))}function o(h,d,p){if(d){var m,y,S;if(d.__r3f&&(d.__r3f.parent=null),(m=h.__r3f)!=null&&m.objects&&(h.__r3f.objects=h.__r3f.objects.filter(w=>w!==d)),(y=d.__r3f)!=null&&y.attach)B1(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){var A;h.remove(d),(A=d.__r3f)!=null&&A.root&&wk(Ep(d),d)}const _=(S=d.__r3f)==null?void 0:S.primitive,M=!_&&(p===void 0?d.dispose!==null:p);if(!_){var g;s((g=d.__r3f)==null?void 0:g.objects,d,M),s(d.children,d,M)}if(delete d.__r3f,M&&d.dispose&&d.type!=="Scene"){const w=()=>{try{d.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?f_.unstable_scheduleCallback(f_.unstable_IdlePriority,w):w()}Gl(h)}}function a(h,d,p,m){var y;const S=(y=h.__r3f)==null?void 0:y.parent;if(!S)return;const A=t(d,p,h.__r3f.root);if(h.children){for(const g of h.children)g.__r3f&&i(A,g);h.children=h.children.filter(g=>!g.__r3f)}h.__r3f.objects.forEach(g=>i(A,g)),h.__r3f.objects=[],h.__r3f.autoRemovedBeforeAppend||o(S,h),A.parent&&(A.__r3f.autoRemovedBeforeAppend=!0),i(S,A),A.raycast&&A.__r3f.eventCount&&Ep(A).getState().internal.interaction.push(A),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=A,g.ref&&(typeof g.ref=="function"?g.ref(A):g.ref.current=A))})}const l=()=>{};return{reconciler:mk({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(h,d)=>{if(!d)return;const p=h.getState().scene;p.__r3f&&(p.__r3f.root=h,i(p,d))},removeChildFromContainer:(h,d)=>{d&&o(h.getState().scene,d)},insertInContainerBefore:(h,d,p)=>{if(!d||!p)return;const m=h.getState().scene;m.__r3f&&r(m,d,p)},getRootHostContext:()=>null,getChildHostContext:h=>h,finalizeInitialChildren(h){var d;return!!((d=h==null?void 0:h.__r3f)!=null?d:{}).handlers},prepareUpdate(h,d,p,m){var y;if(((y=h==null?void 0:h.__r3f)!=null?y:{}).primitive&&m.object&&m.object!==h)return[!0];{const{args:A=[],children:g,..._}=m,{args:M=[],children:w,...B}=p;if(!Array.isArray(A))throw new Error("R3F: the args prop must be an array!");if(A.some((b,L)=>b!==M[L]))return[!0];const T=bb(h,_,B,!0);return T.changes.length?[!1,T]:null}},commitUpdate(h,[d,p],m,y,S,A){d?a(h,m,S,A):m0(h,p)},commitMount(h,d,p,m){var y;const S=(y=h.__r3f)!=null?y:{};h.raycast&&S.handlers&&S.eventCount&&Ep(h).getState().internal.interaction.push(h)},getPublicInstance:h=>h,prepareForCommit:()=>null,preparePortalMount:h=>zl(h.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(h){var d;const{attach:p,parent:m}=(d=h.__r3f)!=null?d:{};p&&m&&B1(m,h,p),h.isObject3D&&(h.visible=!1),Gl(h)},unhideInstance(h,d){var p;const{attach:m,parent:y}=(p=h.__r3f)!=null?p:{};m&&y&&p0(y,h,m),(h.isObject3D&&d.visible==null||d.visible)&&(h.visible=!0),Gl(h)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():rc.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Jt.fun(performance.now)?performance.now:Jt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Jt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Jt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:m0}}var C1,R1;const d0=n=>"colorSpace"in n||"outputColorSpace"in n,Mb=()=>{var n;return(n=sA.ColorManagement)!=null?n:null},Eb=n=>n&&n.isOrthographicCamera,yk=n=>n&&n.hasOwnProperty("current"),Xf=typeof window<"u"&&((C1=window.document)!=null&&C1.createElement||((R1=window.navigator)==null?void 0:R1.product)==="ReactNative")?se.useLayoutEffect:se.useEffect;function wb(n){const e=se.useRef(n);return Xf(()=>void(e.current=n),[n]),e}function _k({set:n}){return Xf(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class Tb extends se.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}Tb.getDerivedStateFromError=()=>({error:!0});const Cb="__default",b1=new Map,xk=n=>n&&!!n.memoized&&!!n.changes;function Rb(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const wu=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()};function Ep(n){let e=n.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const Jt={obj:n=>n===Object(n)&&!Jt.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(Jt.str(n)||Jt.num(n)||Jt.boo(n))return n===e;const s=Jt.obj(n);if(s&&i==="reference")return n===e;const o=Jt.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!Jt.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(Jt.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function Ak(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function Sk(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function zl(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function h_(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const P1=/-\d+$/;function p0(n,e,t){if(Jt.str(t)){if(P1.test(t)){const s=t.replace(P1,""),{target:o,key:a}=h_(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=h_(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function B1(n,e,t){var i,r;if(Jt.str(t)){const{target:s,key:o}=h_(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function bb(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...l}={},f=!1){const h=n.__r3f,d=Object.entries(r),p=[];if(f){const y=Object.keys(l);for(let S=0;S<y.length;S++)r.hasOwnProperty(y[S])||d.unshift([y[S],Cb+"remove"])}d.forEach(([y,S])=>{var A;if((A=n.__r3f)!=null&&A.primitive&&y==="object"||Jt.equ(S,l[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return p.push([y,S,!0,[]]);let g=[];y.includes("-")&&(g=y.split("-")),p.push([y,S,!1,g]);for(const _ in r){const M=r[_];_.startsWith(`${y}-`)&&p.push([_,M,!1,_.split("-")])}});const m={...r};return h!=null&&h.memoizedProps&&h!=null&&h.memoizedProps.args&&(m.args=h.memoizedProps.args),h!=null&&h.memoizedProps&&h!=null&&h.memoizedProps.attach&&(m.attach=h.memoizedProps.attach),{memoized:m,changes:p}}function m0(n,e){var t;const i=n.__r3f,r=i==null?void 0:i.root,s=r==null||r.getState==null?void 0:r.getState(),{memoized:o,changes:a}=xk(e)?e:bb(n,e),l=i==null?void 0:i.eventCount;n.__r3f&&(n.__r3f.memoizedProps=o);for(let p=0;p<a.length;p++){let[m,y,S,A]=a[p];if(d0(n)){const w="srgb",B="srgb-linear";m==="encoding"?(m="colorSpace",y=y===3001?w:B):m==="outputEncoding"&&(m="outputColorSpace",y=y===3001?w:B)}let g=n,_=g[m];if(A.length&&(_=A.reduce((M,w)=>M[w],n),!(_&&_.set))){const[M,...w]=A.reverse();g=w.reverse().reduce((B,T)=>B[T],n),m=M}if(y===Cb+"remove")if(g.constructor){let M=b1.get(g.constructor);M||(M=new g.constructor,b1.set(g.constructor,M)),y=M[m]}else y=0;if(S&&i)y?i.handlers[m]=y:delete i.handlers[m],i.eventCount=Object.keys(i.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof Ia)){if(Array.isArray(y))_.fromArray?_.fromArray(y):_.set(...y);else if(_.copy&&y&&y.constructor&&_.constructor===y.constructor)_.copy(y);else if(y!==void 0){var f;const M=(f=_)==null?void 0:f.isColor;!M&&_.setScalar?_.setScalar(y):_ instanceof Ia&&y instanceof Ia?_.mask=y.mask:_.set(y),!Mb()&&s&&!s.linear&&M&&_.convertSRGBToLinear()}}else{var h;if(g[m]=y,(h=g[m])!=null&&h.isTexture&&g[m].format===vi&&g[m].type===as&&s){const M=g[m];d0(M)&&d0(s.gl)?M.colorSpace=s.gl.outputColorSpace:M.encoding=s.gl.outputEncoding}}Gl(n)}if(i&&i.parent&&n.raycast&&l!==i.eventCount){const p=Ep(n).getState().internal,m=p.interaction.indexOf(n);m>-1&&p.interaction.splice(m,1),i.eventCount&&p.interaction.push(n)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(t=n.__r3f)!=null&&t.parent&&d_(n),n}function Gl(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function d_(n){n.onUpdate==null||n.onUpdate(n)}function Mk(n,e){n.manual||(Eb(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function $d(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function Ek(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return rc.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return rc.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return rc.ContinuousEventPriority;default:return rc.DefaultEventPriority}}function Pb(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function wk(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{Pb(t.capturedMap,e,i,r)})}function Tk(n){function e(l){const{internal:f}=n.getState(),h=l.offsetX-f.initialClick[0],d=l.offsetY-f.initialClick[1];return Math.round(Math.sqrt(h*h+d*d))}function t(l){return l.filter(f=>["Move","Over","Enter","Out","Leave"].some(h=>{var d;return(d=f.__r3f)==null?void 0:d.handlers["onPointer"+h]}))}function i(l,f){const h=n.getState(),d=new Set,p=[],m=f?f(h.internal.interaction):h.internal.interaction;for(let g=0;g<m.length;g++){const _=wu(m[g]);_&&(_.raycaster.camera=void 0)}h.previousRoot||h.events.compute==null||h.events.compute(l,h);function y(g){const _=wu(g);if(!_||!_.events.enabled||_.raycaster.camera===null)return[];if(_.raycaster.camera===void 0){var M;_.events.compute==null||_.events.compute(l,_,(M=_.previousRoot)==null?void 0:M.getState()),_.raycaster.camera===void 0&&(_.raycaster.camera=null)}return _.raycaster.camera?_.raycaster.intersectObject(g,!0):[]}let S=m.flatMap(y).sort((g,_)=>{const M=wu(g.object),w=wu(_.object);return!M||!w?g.distance-_.distance:w.events.priority-M.events.priority||g.distance-_.distance}).filter(g=>{const _=$d(g);return d.has(_)?!1:(d.add(_),!0)});h.events.filter&&(S=h.events.filter(S,h));for(const g of S){let _=g.object;for(;_;){var A;(A=_.__r3f)!=null&&A.eventCount&&p.push({...g,eventObject:_}),_=_.parent}}if("pointerId"in l&&h.internal.capturedMap.has(l.pointerId))for(let g of h.internal.capturedMap.get(l.pointerId).values())d.has($d(g.intersection))||p.push(g.intersection);return p}function r(l,f,h,d){const p=n.getState();if(l.length){const m={stopped:!1};for(const y of l){const S=wu(y.object)||p,{raycaster:A,pointer:g,camera:_,internal:M}=S,w=new D(g.x,g.y,0).unproject(_),B=P=>{var U,K;return(U=(K=M.capturedMap.get(P))==null?void 0:K.has(y.eventObject))!=null?U:!1},T=P=>{const U={intersection:y,target:f.target};M.capturedMap.has(P)?M.capturedMap.get(P).set(y.eventObject,U):M.capturedMap.set(P,new Map([[y.eventObject,U]])),f.target.setPointerCapture(P)},b=P=>{const U=M.capturedMap.get(P);U&&Pb(M.capturedMap,y.eventObject,U,P)};let L={};for(let P in f){let U=f[P];typeof U!="function"&&(L[P]=U)}let R={...y,...L,pointer:g,intersections:l,stopped:m.stopped,delta:h,unprojectedPoint:w,ray:A.ray,camera:_,stopPropagation(){const P="pointerId"in f&&M.capturedMap.get(f.pointerId);if((!P||P.has(y.eventObject))&&(R.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(U=>U.eventObject===y.eventObject))){const U=l.slice(0,l.indexOf(y));s([...U,y])}},target:{hasPointerCapture:B,setPointerCapture:T,releasePointerCapture:b},currentTarget:{hasPointerCapture:B,setPointerCapture:T,releasePointerCapture:b},nativeEvent:f};if(d(R),m.stopped===!0)break}}return l}function s(l){const{internal:f}=n.getState();for(const h of f.hovered.values())if(!l.length||!l.find(d=>d.object===h.object&&d.index===h.index&&d.instanceId===h.instanceId)){const p=h.eventObject.__r3f,m=p==null?void 0:p.handlers;if(f.hovered.delete($d(h)),p!=null&&p.eventCount){const y={...h,intersections:l};m.onPointerOut==null||m.onPointerOut(y),m.onPointerLeave==null||m.onPointerLeave(y)}}}function o(l,f){for(let h=0;h<f.length;h++){const d=f[h].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(l)}}function a(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return f=>{const{internal:h}=n.getState();"pointerId"in f&&h.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(f.pointerId)&&(h.capturedMap.delete(f.pointerId),s([]))})}}return function(h){const{onPointerMissed:d,internal:p}=n.getState();p.lastEvent.current=h;const m=l==="onPointerMove",y=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",A=i(h,m?t:void 0),g=y?e(h):0;l==="onPointerDown"&&(p.initialClick=[h.offsetX,h.offsetY],p.initialHits=A.map(M=>M.eventObject)),y&&!A.length&&g<=2&&(o(h,p.interaction),d&&d(h)),m&&s(A);function _(M){const w=M.eventObject,B=w.__r3f,T=B==null?void 0:B.handlers;if(B!=null&&B.eventCount)if(m){if(T.onPointerOver||T.onPointerEnter||T.onPointerOut||T.onPointerLeave){const b=$d(M),L=p.hovered.get(b);L?L.stopped&&M.stopPropagation():(p.hovered.set(b,M),T.onPointerOver==null||T.onPointerOver(M),T.onPointerEnter==null||T.onPointerEnter(M))}T.onPointerMove==null||T.onPointerMove(M)}else{const b=T[l];b?(!y||p.initialHits.includes(w))&&(o(h,p.interaction.filter(L=>!p.initialHits.includes(L))),b(M)):y&&p.initialHits.includes(w)&&o(h,p.interaction.filter(L=>!p.initialHits.includes(L)))}}r(A,h,g,_)}}return{handlePointer:a}}const Bb=n=>!!(n!=null&&n.render),Ib=se.createContext(null),Ck=(n,e)=>{const t=lk((a,l)=>{const f=new D,h=new D,d=new D;function p(g=l().camera,_=h,M=l().size){const{width:w,height:B,top:T,left:b}=M,L=w/B;_.isVector3?d.copy(_):d.set(..._);const R=g.getWorldPosition(f).distanceTo(d);if(Eb(g))return{width:w/g.zoom,height:B/g.zoom,top:T,left:b,factor:1,distance:R,aspect:L};{const P=g.fov*Math.PI/180,U=2*Math.tan(P/2)*R,K=U*(w/B);return{width:K,height:U,top:T,left:b,factor:w/K,distance:R,aspect:L}}}let m;const y=g=>a(_=>({performance:{..._.performance,current:g}})),S=new de;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(l(),g),advance:(g,_)=>e(g,_,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new tA,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&y(g.performance.min),m=setTimeout(()=>y(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:g=>a(_=>({..._,events:{..._.events,...g}})),setSize:(g,_,M,w,B)=>{const T=l().camera,b={width:g,height:_,top:w||0,left:B||0,updateStyle:M};a(L=>({size:b,viewport:{...L.viewport,...p(T,h,b)}}))},setDpr:g=>a(_=>{const M=Rb(g);return{viewport:{..._.viewport,dpr:M,initialDpr:_.viewport.initialDpr||M}}}),setFrameloop:(g="always")=>{const _=l().clock;_.stop(),_.elapsedTime=0,g!=="never"&&(_.start(),_.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:se.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,_,M)=>{const w=l().internal;return w.priority=w.priority+(_>0?1:0),w.subscribers.push({ref:g,priority:_,store:M}),w.subscribers=w.subscribers.sort((B,T)=>B.priority-T.priority),()=>{const B=l().internal;B!=null&&B.subscribers&&(B.priority=B.priority-(_>0?1:0),B.subscribers=B.subscribers.filter(T=>T.ref!==g))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:f,gl:h,set:d}=t.getState();if(l.width!==r.width||l.height!==r.height||f.dpr!==s){var p;r=l,s=f.dpr,Mk(a,l),h.setPixelRatio(f.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(l.width,l.height,m)}a!==o&&(o=a,d(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let ep,Rk=new Set,bk=new Set,Pk=new Set;function g0(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function Tu(n,e){switch(n){case"before":return g0(Rk,e);case"after":return g0(bk,e);case"tail":return g0(Pk,e)}}let v0,y0;function _0(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),v0=e.internal.subscribers,ep=0;ep<v0.length;ep++)y0=v0[ep],y0.ref.current(y0.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function Bk(n){let e=!1,t=!1,i,r,s;function o(f){r=requestAnimationFrame(o),e=!0,i=0,Tu("before",f),t=!0;for(const d of n.values()){var h;s=d.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((h=s.gl.xr)!=null&&h.isPresenting)&&(i+=_0(f,s))}if(t=!1,Tu("after",f),i===0)return Tu("tail",f),e=!1,cancelAnimationFrame(r)}function a(f,h=1){var d;if(!f)return n.forEach(p=>a(p.store.getState(),h));(d=f.gl.xr)!=null&&d.isPresenting||!f.internal.active||f.frameloop==="never"||(h>1?f.internal.frames=Math.min(60,f.internal.frames+h):t?f.internal.frames=2:f.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(f,h=!0,d,p){if(h&&Tu("before",f),d)_0(f,d,p);else for(const m of n.values())_0(f,m.store.getState());h&&Tu("after",f)}return{loop:o,invalidate:a,advance:l}}function Lb(){const n=se.useContext(Ib);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Vi(n=t=>t,e){return Lb()(n,e)}function Jf(n,e=0){const t=Lb(),i=t.getState().internal.subscribe,r=wb(n);return Xf(()=>i(r,e,t),[e,i,t]),null}const I1=new WeakMap;function Db(n,e){return function(t,...i){let r=I1.get(t);return r||(r=new t,I1.set(t,r)),n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,Ak(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`))))))}}function Jo(n,e,t,i){const r=Array.isArray(e)?e:[e],s=uk(Db(t,i),[n,...r],{equal:Jt.equ});return Array.isArray(e)?s:s[0]}Jo.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return fk(Db(t),[n,...i])};Jo.clear=function(n,e){const t=Array.isArray(e)?e:[e];return hk([n,...t])};const bc=new Map,{invalidate:L1,advance:D1}=Bk(bc),{reconciler:tm,applyProps:Nl}=vk(bc,Ek),Ul={objects:"shallow",strict:!1},Ik=(n,e)=>{const t=typeof n=="function"?n(e):n;return Bb(t)?t:new Dx({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function Lk(n,e){const t=typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=t}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:i,height:r,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function Dk(n){const e=bc.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||Ck(L1,D1),o=t||tm.createContainer(s,rc.ConcurrentRoot,null,!1,null,"",r,null);e||bc.set(n,{fiber:o,store:s});let a,l=!1,f;return{configure(h={}){let{gl:d,size:p,scene:m,events:y,onCreated:S,shadows:A=!1,linear:g=!1,flat:_=!1,legacy:M=!1,orthographic:w=!1,frameloop:B="always",dpr:T=[1,2],performance:b,raycaster:L,camera:R,onPointerMissed:P}=h,U=s.getState(),K=U.gl;U.gl||U.set({gl:K=Ik(d,n)});let ie=U.raycaster;ie||U.set({raycaster:ie=new mb});const{params:G,...J}=L||{};if(Jt.equ(J,ie,Ul)||Nl(ie,{...J}),Jt.equ(G,ie.params,Ul)||Nl(ie,{params:{...ie.params,...G}}),!U.camera||U.camera===f&&!Jt.equ(f,R,Ul)){f=R;const H=R instanceof Nf,q=H?R:w?new _r(0,0,0,0,.1,1e3):new Qt(75,0,.1,1e3);H||(q.position.z=5,R&&(Nl(q,R),("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(q.manual=!0,q.updateProjectionMatrix())),!U.camera&&!(R!=null&&R.rotation)&&q.lookAt(0,0,0)),U.set({camera:q}),ie.camera=q}if(!U.scene){let H;m!=null&&m.isScene?H=m:(H=new Fx,m&&Nl(H,m)),U.set({scene:zl(H)})}if(!U.xr){var Z;const H=(Y,ue)=>{const Se=s.getState();Se.frameloop!=="never"&&D1(Y,!0,Se,ue)},q=()=>{const Y=s.getState();Y.gl.xr.enabled=Y.gl.xr.isPresenting,Y.gl.xr.setAnimationLoop(Y.gl.xr.isPresenting?H:null),Y.gl.xr.isPresenting||L1(Y)},ne={connect(){const Y=s.getState().gl;Y.xr.addEventListener("sessionstart",q),Y.xr.addEventListener("sessionend",q)},disconnect(){const Y=s.getState().gl;Y.xr.removeEventListener("sessionstart",q),Y.xr.removeEventListener("sessionend",q)}};typeof((Z=K.xr)==null?void 0:Z.addEventListener)=="function"&&ne.connect(),U.set({xr:ne})}if(K.shadowMap){const H=K.shadowMap.enabled,q=K.shadowMap.type;if(K.shadowMap.enabled=!!A,Jt.boo(A))K.shadowMap.type=Hu;else if(Jt.str(A)){var ae;const ne={basic:mC,percentage:_m,soft:Hu,variance:Ir};K.shadowMap.type=(ae=ne[A])!=null?ae:Hu}else Jt.obj(A)&&Object.assign(K.shadowMap,A);(H!==K.shadowMap.enabled||q!==K.shadowMap.type)&&(K.shadowMap.needsUpdate=!0)}const O=Mb();O&&("enabled"in O?O.enabled=!M:"legacyMode"in O&&(O.legacyMode=M)),l||Nl(K,{outputEncoding:g?3e3:3001,toneMapping:_?os:px}),U.legacy!==M&&U.set(()=>({legacy:M})),U.linear!==g&&U.set(()=>({linear:g})),U.flat!==_&&U.set(()=>({flat:_})),d&&!Jt.fun(d)&&!Bb(d)&&!Jt.equ(d,K,Ul)&&Nl(K,d),y&&!U.events.handlers&&U.set({events:y(s)});const V=Lk(n,p);return Jt.equ(V,U.size,Ul)||U.setSize(V.width,V.height,V.updateStyle,V.top,V.left),T&&U.viewport.dpr!==Rb(T)&&U.setDpr(T),U.frameloop!==B&&U.setFrameloop(B),U.onPointerMissed||U.set({onPointerMissed:P}),b&&!Jt.equ(b,U.performance,Ul)&&U.set(H=>({performance:{...H.performance,...b}})),a=S,l=!0,this},render(h){return l||this.configure(),tm.updateContainer(Rt.jsx(Fk,{store:s,children:h,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){Fb(n)}}}function Fk({store:n,children:e,onCreated:t,rootElement:i}){return Xf(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),Rt.jsx(Ib.Provider,{value:n,children:e})}function Fb(n,e){const t=bc.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),tm.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),Sk(r),bc.delete(n)}catch{}},500)})}}tm.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:se.version});const x0={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Nk(n){const{handlePointer:e}=Tk(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(x0).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,f]=x0[o];t.addEventListener(l,a,{passive:f})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=x0[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function F1(n,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...i),e)}}function Uk({debounce:n,scroll:e,polyfill:t,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=se.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=se.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=n?typeof n=="number"?n:n.scroll:null,f=n?typeof n=="number"?n:n.resize:null,h=se.useRef(!1);se.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[d,p,m]=se.useMemo(()=>{const g=()=>{if(!a.current.element)return;const{left:_,top:M,width:w,height:B,bottom:T,right:b,x:L,y:R}=a.current.element.getBoundingClientRect(),P={left:_,top:M,width:w,height:B,bottom:T,right:b,x:L,y:R};a.current.element instanceof HTMLElement&&i&&(P.height=a.current.element.offsetHeight,P.width=a.current.element.offsetWidth),Object.freeze(P),h.current&&!Gk(a.current.lastBounds,P)&&o(a.current.lastBounds=P)};return[g,f?F1(g,f):g,l?F1(g,l):g]},[o,i,l,f]);function y(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(g=>g.removeEventListener("scroll",m,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new r(m),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(g=>g.addEventListener("scroll",m,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const A=g=>{!g||g===a.current.element||(y(),a.current.element=g,a.current.scrollContainers=Nb(g),S())};return kk(m,!!e),Ok(p),se.useEffect(()=>{y(),S()},[e,m,p]),se.useEffect(()=>y,[]),[A,s,d]}function Ok(n){se.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function kk(n,e){se.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function Nb(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...Nb(n.parentElement)]}const zk=["x","y","top","bottom","left","right","width","height"],Gk=(n,e)=>zk.every(t=>n[t]===e[t]);var Hk=Object.defineProperty,Vk=Object.defineProperties,Wk=Object.getOwnPropertyDescriptors,N1=Object.getOwnPropertySymbols,Xk=Object.prototype.hasOwnProperty,Jk=Object.prototype.propertyIsEnumerable,U1=(n,e,t)=>e in n?Hk(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,O1=(n,e)=>{for(var t in e||(e={}))Xk.call(e,t)&&U1(n,t,e[t]);if(N1)for(var t of N1(e))Jk.call(e,t)&&U1(n,t,e[t]);return n},jk=(n,e)=>Vk(n,Wk(e)),k1,z1;typeof window<"u"&&((k1=window.document)!=null&&k1.createElement||((z1=window.navigator)==null?void 0:z1.product)==="ReactNative")?se.useLayoutEffect:se.useEffect;function Ub(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=n.child;for(;i;){const r=Ub(i,e,t);if(r)return r;i=i.sibling}}function Ob(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const G1=console.error;console.error=function(){const n=[...arguments].join("");if(n!=null&&n.startsWith("Warning:")&&n.includes("useContext")){console.error=G1;return}return G1.apply(this,arguments)};const oA=Ob(se.createContext(null));class kb extends se.Component{render(){return se.createElement(oA.Provider,{value:this._reactInternals},this.props.children)}}function Kk(){const n=se.useContext(oA);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=se.useId();return se.useMemo(()=>{for(const i of[n,n==null?void 0:n.alternate]){if(!i)continue;const r=Ub(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[n,e])}function Yk(){const n=Kk(),[e]=se.useState(()=>new Map);e.clear();let t=n;for(;t;){if(t.type&&typeof t.type=="object"){const r=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;r&&r!==oA&&!e.has(r)&&e.set(r,se.useContext(Ob(r)))}t=t.return}return e}function Qk(){const n=Yk();return se.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>se.createElement(e,null,se.createElement(t.Provider,jk(O1({},i),{value:n.get(t)}))),e=>se.createElement(kb,O1({},e))),[n])}const Zk=se.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=Nk,eventSource:a,eventPrefix:l,shadows:f,linear:h,flat:d,legacy:p,orthographic:m,frameloop:y,dpr:S,performance:A,raycaster:g,camera:_,scene:M,onPointerMissed:w,onCreated:B,...T},b){se.useMemo(()=>gk(sk),[]);const L=Qk(),[R,P]=Uk({scroll:!0,debounce:{scroll:50,resize:0},...i}),U=se.useRef(null),K=se.useRef(null);se.useImperativeHandle(b,()=>U.current);const ie=wb(w),[G,J]=se.useState(!1),[Z,ae]=se.useState(!1);if(G)throw G;if(Z)throw Z;const O=se.useRef(null);Xf(()=>{const H=U.current;P.width>0&&P.height>0&&H&&(O.current||(O.current=Dk(H)),O.current.configure({gl:s,events:o,shadows:f,linear:h,flat:d,legacy:p,orthographic:m,frameloop:y,dpr:S,performance:A,raycaster:g,camera:_,scene:M,size:P,onPointerMissed:(...q)=>ie.current==null?void 0:ie.current(...q),onCreated:q=>{q.events.connect==null||q.events.connect(a?yk(a)?a.current:a:K.current),l&&q.setEvents({compute:(ne,Y)=>{const ue=ne[l+"X"],Se=ne[l+"Y"];Y.pointer.set(ue/Y.size.width*2-1,-(Se/Y.size.height)*2+1),Y.raycaster.setFromCamera(Y.pointer,Y.camera)}}),B==null||B(q)}}),O.current.render(Rt.jsx(L,{children:Rt.jsx(Tb,{set:ae,children:Rt.jsx(se.Suspense,{fallback:Rt.jsx(_k,{set:J}),children:e??null})})})))}),se.useEffect(()=>{const H=U.current;if(H)return()=>Fb(H)},[]);const V=a?"none":"auto";return Rt.jsx("div",{ref:K,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:V,...r},...T,children:Rt.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:Rt.jsx("canvas",{ref:U,style:{display:"block"},children:t})})})}),qk=se.forwardRef(function(e,t){return Rt.jsx(kb,{children:Rt.jsx(Zk,{...e,ref:t})})});function nm(){return nm=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},nm.apply(null,arguments)}const jf=new D,aA=new D,$k=new D,H1=new de;function ez(n,e,t){const i=jf.setFromMatrixPosition(n.matrixWorld);i.project(e);const r=t.width/2,s=t.height/2;return[i.x*r+r,-(i.y*s)+s]}function tz(n,e){const t=jf.setFromMatrixPosition(n.matrixWorld),i=aA.setFromMatrixPosition(e.matrixWorld),r=t.sub(i),s=e.getWorldDirection($k);return r.angleTo(s)>Math.PI/2}function nz(n,e,t,i){const r=jf.setFromMatrixPosition(n.matrixWorld),s=r.clone();s.project(e),H1.set(s.x,s.y),t.setFromCamera(H1,e);const o=t.intersectObjects(i,!0);if(o.length){const a=o[0].distance;return r.distanceTo(t.ray.origin)<a}return!0}function iz(n,e){if(e instanceof _r)return e.zoom;if(e instanceof Qt){const t=jf.setFromMatrixPosition(n.matrixWorld),i=aA.setFromMatrixPosition(e.matrixWorld),r=e.fov*Math.PI/180,s=t.distanceTo(i);return 1/(2*Math.tan(r/2)*s)}else return 1}function rz(n,e,t){if(e instanceof Qt||e instanceof _r){const i=jf.setFromMatrixPosition(n.matrixWorld),r=aA.setFromMatrixPosition(e.matrixWorld),s=i.distanceTo(r),o=(t[1]-t[0])/(e.far-e.near),a=t[1]-o*e.far;return Math.round(o*s+a)}}const p_=n=>Math.abs(n)<1e-10?0:n;function zb(n,e,t=""){let i="matrix3d(";for(let r=0;r!==16;r++)i+=p_(e[r]*n.elements[r])+(r!==15?",":")");return t+i}const sz=(n=>e=>zb(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),oz=(n=>(e,t)=>zb(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]);function az(n){return n&&typeof n=="object"&&"current"in n}const lz=se.forwardRef(({children:n,eps:e=.001,style:t,className:i,prepend:r,center:s,fullscreen:o,portal:a,distanceFactor:l,sprite:f=!1,transform:h=!1,occlude:d,onOcclude:p,castShadow:m,receiveShadow:y,material:S,geometry:A,zIndexRange:g=[16777271,0],calculatePosition:_=ez,as:M="div",wrapperClass:w,pointerEvents:B="auto",...T},b)=>{const{gl:L,camera:R,scene:P,size:U,raycaster:K,events:ie,viewport:G}=Vi(),[J]=se.useState(()=>document.createElement(M)),Z=se.useRef(),ae=se.useRef(null),O=se.useRef(0),V=se.useRef([0,0]),H=se.useRef(null),q=se.useRef(null),ne=(a==null?void 0:a.current)||ie.connected||L.domElement.parentNode,Y=se.useRef(null),ue=se.useRef(!1),Se=se.useMemo(()=>d&&d!=="blending"||Array.isArray(d)&&d.length&&az(d[0]),[d]);se.useLayoutEffect(()=>{const Le=L.domElement;d&&d==="blending"?(Le.style.zIndex=`${Math.floor(g[0]/2)}`,Le.style.position="absolute",Le.style.pointerEvents="none"):(Le.style.zIndex=null,Le.style.position=null,Le.style.pointerEvents=null)},[d]),se.useLayoutEffect(()=>{if(ae.current){const Le=Z.current=dx(J);if(P.updateMatrixWorld(),h)J.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const be=_(ae.current,R,U);J.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${be[0]}px,${be[1]}px,0);transform-origin:0 0;`}return ne&&(r?ne.prepend(J):ne.appendChild(J)),()=>{ne&&ne.removeChild(J),Le.unmount()}}},[ne,h]),se.useLayoutEffect(()=>{w&&(J.className=w)},[w]);const Te=se.useMemo(()=>h?{position:"absolute",top:0,left:0,width:U.width,height:U.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-U.height/2,left:-U.width/2,width:U.width,height:U.height},...t},[t,s,o,U,h]),Ce=se.useMemo(()=>({position:"absolute",pointerEvents:B}),[B]);se.useLayoutEffect(()=>{if(ue.current=!1,h){var Le;(Le=Z.current)==null||Le.render(se.createElement("div",{ref:H,style:Te},se.createElement("div",{ref:q,style:Ce},se.createElement("div",{ref:b,className:i,style:t,children:n}))))}else{var be;(be=Z.current)==null||be.render(se.createElement("div",{ref:b,style:Te,className:i,children:n}))}});const Ze=se.useRef(!0);Jf(Le=>{if(ae.current){R.updateMatrixWorld(),ae.current.updateWorldMatrix(!0,!1);const be=h?V.current:_(ae.current,R,U);if(h||Math.abs(O.current-R.zoom)>e||Math.abs(V.current[0]-be[0])>e||Math.abs(V.current[1]-be[1])>e){const z=tz(ae.current,R);let ve=!1;Se&&(Array.isArray(d)?ve=d.map(Ve=>Ve.current):d!=="blending"&&(ve=[P]));const he=Ze.current;if(ve){const Ve=nz(ae.current,R,K,ve);Ze.current=Ve&&!z}else Ze.current=!z;he!==Ze.current&&(p?p(!Ze.current):J.style.display=Ze.current?"block":"none");const Me=Math.floor(g[0]/2),pe=d?Se?[g[0],Me]:[Me-1,0]:g;if(J.style.zIndex=`${rz(ae.current,R,pe)}`,h){const[Ve,De]=[U.width/2,U.height/2],F=R.projectionMatrix.elements[5]*De,{isOrthographicCamera:I,top:$,left:_e,bottom:ye,right:me}=R,Ye=sz(R.matrixWorldInverse),Be=I?`scale(${F})translate(${p_(-(me+_e)/2)}px,${p_(($+ye)/2)}px)`:`translateZ(${F}px)`;let Fe=ae.current.matrixWorld;f&&(Fe=R.matrixWorldInverse.clone().transpose().copyPosition(Fe).scale(ae.current.scale),Fe.elements[3]=Fe.elements[7]=Fe.elements[11]=0,Fe.elements[15]=1),J.style.width=U.width+"px",J.style.height=U.height+"px",J.style.perspective=I?"":`${F}px`,H.current&&q.current&&(H.current.style.transform=`${Be}${Ye}translate(${Ve}px,${De}px)`,q.current.style.transform=oz(Fe,1/((l||10)/400)))}else{const Ve=l===void 0?1:iz(ae.current,R)*l;J.style.transform=`translate3d(${be[0]}px,${be[1]}px,0) scale(${Ve})`}V.current=be,O.current=R.zoom}}if(!Se&&Y.current&&!ue.current)if(h){if(H.current){const be=H.current.children[0];if(be!=null&&be.clientWidth&&be!=null&&be.clientHeight){const{isOrthographicCamera:z}=R;if(z||A)T.scale&&(Array.isArray(T.scale)?T.scale instanceof D?Y.current.scale.copy(T.scale.clone().divideScalar(1)):Y.current.scale.set(1/T.scale[0],1/T.scale[1],1/T.scale[2]):Y.current.scale.setScalar(1/T.scale));else{const ve=(l||10)/400,he=be.clientWidth*ve,Me=be.clientHeight*ve;Y.current.scale.set(he,Me,1)}ue.current=!0}}}else{const be=J.children[0];if(be!=null&&be.clientWidth&&be!=null&&be.clientHeight){const z=1/G.factor,ve=be.clientWidth*z,he=be.clientHeight*z;Y.current.scale.set(ve,he,1),ue.current=!0}Y.current.lookAt(Le.camera.position)}});const ot=se.useMemo(()=>({vertexShader:h?void 0:`
- /*
- This shader is from the THREE's SpriteMaterial.
- We need to turn the backing plane into a Sprite
- (make it always face the camera) if "transfrom"
- is false.
- */
- #include <common>
- void main() {
- vec2 center = vec2(0., 1.);
- float rotation = 0.0;
- // This is somewhat arbitrary, but it seems to work well
- // Need to figure out how to derive this dynamically if it even matters
- float size = 0.03;
- vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
- vec2 scale;
- scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
- scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) scale *= - mvPosition.z;
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
- vec2 rotatedPosition;
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
- mvPosition.xy += rotatedPosition;
- gl_Position = projectionMatrix * mvPosition;
- }
- `,fragmentShader:`
- void main() {
- gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
- }
- `}),[h]);return se.createElement("group",nm({},T,{ref:ae}),d&&!Se&&se.createElement("mesh",{castShadow:m,receiveShadow:y,ref:Y},A||se.createElement("planeGeometry",null),S||se.createElement("shaderMaterial",{side:pr,vertexShader:ot.vertexShader,fragmentShader:ot.fragmentShader})))}),Gb=parseInt(Lf.replace(/\D+/g,"")),cz=Gb>=125?"uv1":"uv2";function V1(n,e){if(e===rR)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Zp||e===Mx){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(t)if(e===Zp)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=n.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}var gr=Uint8Array,So=Uint16Array,m_=Uint32Array,Hb=new gr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vb=new gr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),uz=new gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wb=function(n,e){for(var t=new So(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new m_(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)r[s]=s-t[i]<<5|i;return[t,r]},Xb=Wb(Hb,2),Jb=Xb[0],fz=Xb[1];Jb[28]=258,fz[258]=28;var hz=Wb(Vb,0),dz=hz[0],g_=new So(32768);for(var Zt=0;Zt<32768;++Zt){var ho=(Zt&43690)>>>1|(Zt&21845)<<1;ho=(ho&52428)>>>2|(ho&13107)<<2,ho=(ho&61680)>>>4|(ho&3855)<<4,g_[Zt]=((ho&65280)>>>8|(ho&255)<<8)>>>1}var Ku=function(n,e,t){for(var i=n.length,r=0,s=new So(e);r<i;++r)++s[n[r]-1];var o=new So(e);for(r=0;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(t){a=new So(1<<e);var l=15-e;for(r=0;r<i;++r)if(n[r])for(var f=r<<4|n[r],h=e-n[r],d=o[n[r]-1]++<<h,p=d|(1<<h)-1;d<=p;++d)a[g_[d]>>>l]=f}else for(a=new So(i),r=0;r<i;++r)n[r]&&(a[r]=g_[o[n[r]-1]++]>>>15-n[r]);return a},Kf=new gr(288);for(var Zt=0;Zt<144;++Zt)Kf[Zt]=8;for(var Zt=144;Zt<256;++Zt)Kf[Zt]=9;for(var Zt=256;Zt<280;++Zt)Kf[Zt]=7;for(var Zt=280;Zt<288;++Zt)Kf[Zt]=8;var jb=new gr(32);for(var Zt=0;Zt<32;++Zt)jb[Zt]=5;var pz=Ku(Kf,9,1),mz=Ku(jb,5,1),A0=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},Pr=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},S0=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},gz=function(n){return(n/8|0)+(n&7&&1)},vz=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var i=new(n instanceof So?So:n instanceof m_?m_:gr)(t-e);return i.set(n.subarray(e,t)),i},yz=function(n,e,t){var i=n.length;if(!i||t&&!t.l&&i<5)return e||new gr(0);var r=!e||t,s=!t||t.i;t||(t={}),e||(e=new gr(i*3));var o=function(Te){var Ce=e.length;if(Te>Ce){var Ze=new gr(Math.max(Ce*2,Te));Ze.set(e),e=Ze}},a=t.f||0,l=t.p||0,f=t.b||0,h=t.l,d=t.d,p=t.m,m=t.n,y=i*8;do{if(!h){t.f=a=Pr(n,l,1);var S=Pr(n,l+1,3);if(l+=3,S)if(S==1)h=pz,d=mz,p=9,m=5;else if(S==2){var M=Pr(n,l,31)+257,w=Pr(n,l+10,15)+4,B=M+Pr(n,l+5,31)+1;l+=14;for(var T=new gr(B),b=new gr(19),L=0;L<w;++L)b[uz[L]]=Pr(n,l+L*3,7);l+=w*3;for(var R=A0(b),P=(1<<R)-1,U=Ku(b,R,1),L=0;L<B;){var K=U[Pr(n,l,P)];l+=K&15;var A=K>>>4;if(A<16)T[L++]=A;else{var ie=0,G=0;for(A==16?(G=3+Pr(n,l,3),l+=2,ie=T[L-1]):A==17?(G=3+Pr(n,l,7),l+=3):A==18&&(G=11+Pr(n,l,127),l+=7);G--;)T[L++]=ie}}var J=T.subarray(0,M),Z=T.subarray(M);p=A0(J),m=A0(Z),h=Ku(J,p,1),d=Ku(Z,m,1)}else throw"invalid block type";else{var A=gz(l)+4,g=n[A-4]|n[A-3]<<8,_=A+g;if(_>i){if(s)throw"unexpected EOF";break}r&&o(f+g),e.set(n.subarray(A,_),f),t.b=f+=g,t.p=l=_*8;continue}if(l>y){if(s)throw"unexpected EOF";break}}r&&o(f+131072);for(var ae=(1<<p)-1,O=(1<<m)-1,V=l;;V=l){var ie=h[S0(n,l)&ae],H=ie>>>4;if(l+=ie&15,l>y){if(s)throw"unexpected EOF";break}if(!ie)throw"invalid length/literal";if(H<256)e[f++]=H;else if(H==256){V=l,h=null;break}else{var q=H-254;if(H>264){var L=H-257,ne=Hb[L];q=Pr(n,l,(1<<ne)-1)+Jb[L],l+=ne}var Y=d[S0(n,l)&O],ue=Y>>>4;if(!Y)throw"invalid distance";l+=Y&15;var Z=dz[ue];if(ue>3){var ne=Vb[ue];Z+=S0(n,l)&(1<<ne)-1,l+=ne}if(l>y){if(s)throw"unexpected EOF";break}r&&o(f+131072);for(var Se=f+q;f<Se;f+=4)e[f]=e[f-Z],e[f+1]=e[f+1-Z],e[f+2]=e[f+2-Z],e[f+3]=e[f+3-Z];f=Se}}t.l=h,t.p=V,t.b=f,h&&(a=1,t.m=p,t.d=d,t.n=m)}while(!a);return f==e.length?e:vz(e,0,f)},_z=new gr(0),xz=function(n){if((n[0]&15)!=8||n[0]>>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Az(n,e){return yz((xz(n),n.subarray(2,-4)),e)}var Sz=typeof TextDecoder<"u"&&new TextDecoder,Mz=0;try{Sz.decode(_z,{stream:!0}),Mz=1}catch{}var Ez=Object.defineProperty,wz=(n,e,t)=>e in n?Ez(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Tz=(n,e,t)=>(wz(n,e+"",t),t);class Cz{constructor(){Tz(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}var Rz=Object.defineProperty,bz=(n,e,t)=>e in n?Rz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,st=(n,e,t)=>(bz(n,typeof e!="symbol"?e+"":e,t),t);const tp=new ja,W1=new Bs,Pz=Math.cos(70*(Math.PI/180)),X1=(n,e)=>(n%e+e)%e;let Bz=class extends Cz{constructor(e,t){super(),st(this,"object"),st(this,"domElement"),st(this,"enabled",!0),st(this,"target",new D),st(this,"minDistance",0),st(this,"maxDistance",1/0),st(this,"minZoom",0),st(this,"maxZoom",1/0),st(this,"minPolarAngle",0),st(this,"maxPolarAngle",Math.PI),st(this,"minAzimuthAngle",-1/0),st(this,"maxAzimuthAngle",1/0),st(this,"enableDamping",!1),st(this,"dampingFactor",.05),st(this,"enableZoom",!0),st(this,"zoomSpeed",1),st(this,"enableRotate",!0),st(this,"rotateSpeed",1),st(this,"enablePan",!0),st(this,"panSpeed",1),st(this,"screenSpacePanning",!0),st(this,"keyPanSpeed",7),st(this,"zoomToCursor",!1),st(this,"autoRotate",!1),st(this,"autoRotateSpeed",2),st(this,"reverseOrbit",!1),st(this,"reverseHorizontalOrbit",!1),st(this,"reverseVerticalOrbit",!1),st(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),st(this,"mouseButtons",{LEFT:ma.ROTATE,MIDDLE:ma.DOLLY,RIGHT:ma.PAN}),st(this,"touches",{ONE:Ps.ROTATE,TWO:Ps.DOLLY_PAN}),st(this,"target0"),st(this,"position0"),st(this,"zoom0"),st(this,"_domElementKeyEvents",null),st(this,"getPolarAngle"),st(this,"getAzimuthalAngle"),st(this,"setPolarAngle"),st(this,"setAzimuthalAngle"),st(this,"getDistance"),st(this,"getZoomScale"),st(this,"listenToKeyEvents"),st(this,"stopListenToKeyEvents"),st(this,"saveState"),st(this,"reset"),st(this,"update"),st(this,"connect"),st(this,"dispose"),st(this,"dollyIn"),st(this,"dollyOut"),st(this,"getScale"),st(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>h.phi,this.getAzimuthalAngle=()=>h.theta,this.setPolarAngle=W=>{let ge=X1(W,2*Math.PI),Ge=h.phi;Ge<0&&(Ge+=2*Math.PI),ge<0&&(ge+=2*Math.PI);let ke=Math.abs(ge-Ge);2*Math.PI-ke<ke&&(ge<Ge?ge+=2*Math.PI:Ge+=2*Math.PI),d.phi=ge-Ge,i.update()},this.setAzimuthalAngle=W=>{let ge=X1(W,2*Math.PI),Ge=h.theta;Ge<0&&(Ge+=2*Math.PI),ge<0&&(ge+=2*Math.PI);let ke=Math.abs(ge-Ge);2*Math.PI-ke<ke&&(ge<Ge?ge+=2*Math.PI:Ge+=2*Math.PI),d.theta=ge-Ge,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=W=>{W.addEventListener("keydown",nt),this._domElementKeyEvents=W},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",nt),this._domElementKeyEvents=null},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(r),i.update(),l=a.NONE},this.update=(()=>{const W=new D,ge=new D(0,1,0),Ge=new $t().setFromUnitVectors(e.up,ge),ke=Ge.clone().invert(),Ae=new D,X=new $t,Re=2*Math.PI;return function(){const it=i.object.position;Ge.setFromUnitVectors(e.up,ge),ke.copy(Ge).invert(),W.copy(it).sub(i.target),W.applyQuaternion(Ge),h.setFromVector3(W),i.autoRotate&&l===a.NONE&&G(K()),i.enableDamping?(h.theta+=d.theta*i.dampingFactor,h.phi+=d.phi*i.dampingFactor):(h.theta+=d.theta,h.phi+=d.phi);let Qe=i.minAzimuthAngle,Tt=i.maxAzimuthAngle;isFinite(Qe)&&isFinite(Tt)&&(Qe<-Math.PI?Qe+=Re:Qe>Math.PI&&(Qe-=Re),Tt<-Math.PI?Tt+=Re:Tt>Math.PI&&(Tt-=Re),Qe<=Tt?h.theta=Math.max(Qe,Math.min(Tt,h.theta)):h.theta=h.theta>(Qe+Tt)/2?Math.max(Qe,h.theta):Math.min(Tt,h.theta)),h.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,h.phi)),h.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(m,i.dampingFactor):i.target.add(m),i.zoomToCursor&&R||i.object.isOrthographicCamera?h.radius=Y(h.radius):h.radius=Y(h.radius*p),W.setFromSpherical(h),W.applyQuaternion(ke),it.copy(i.target).add(W),i.object.matrixAutoUpdate||i.object.updateMatrix(),i.object.lookAt(i.target),i.enableDamping===!0?(d.theta*=1-i.dampingFactor,d.phi*=1-i.dampingFactor,m.multiplyScalar(1-i.dampingFactor)):(d.set(0,0,0),m.set(0,0,0));let Lt=!1;if(i.zoomToCursor&&R){let Vt=null;if(i.object instanceof Qt&&i.object.isPerspectiveCamera){const tn=W.length();Vt=Y(tn*p);const Ft=tn-Vt;i.object.position.addScaledVector(b,Ft),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const tn=new D(L.x,L.y,0);tn.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/p)),i.object.updateProjectionMatrix(),Lt=!0;const Ft=new D(L.x,L.y,0);Ft.unproject(i.object),i.object.position.sub(Ft).add(tn),i.object.updateMatrixWorld(),Vt=W.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Vt!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Vt).add(i.object.position):(tp.origin.copy(i.object.position),tp.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(tp.direction))<Pz?e.lookAt(i.target):(W1.setFromNormalAndCoplanarPoint(i.object.up,i.target),tp.intersectPlane(W1,i.target))))}else i.object instanceof _r&&i.object.isOrthographicCamera&&(Lt=p!==1,Lt&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/p)),i.object.updateProjectionMatrix()));return p=1,R=!1,Lt||Ae.distanceToSquared(i.object.position)>f||8*(1-X.dot(i.object.quaternion))>f?(i.dispatchEvent(r),Ae.copy(i.object.position),X.copy(i.object.quaternion),Lt=!1,!0):!1}})(),this.connect=W=>{i.domElement=W,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",It),i.domElement.addEventListener("pointerdown",_e),i.domElement.addEventListener("pointercancel",me),i.domElement.addEventListener("wheel",Fe)},this.dispose=()=>{var W,ge,Ge,ke,Ae,X;i.domElement&&(i.domElement.style.touchAction="auto"),(W=i.domElement)==null||W.removeEventListener("contextmenu",It),(ge=i.domElement)==null||ge.removeEventListener("pointerdown",_e),(Ge=i.domElement)==null||Ge.removeEventListener("pointercancel",me),(ke=i.domElement)==null||ke.removeEventListener("wheel",Fe),(Ae=i.domElement)==null||Ae.ownerDocument.removeEventListener("pointermove",ye),(X=i.domElement)==null||X.ownerDocument.removeEventListener("pointerup",me),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",nt)};const i=this,r={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const f=1e-6,h=new u_,d=new u_;let p=1;const m=new D,y=new de,S=new de,A=new de,g=new de,_=new de,M=new de,w=new de,B=new de,T=new de,b=new D,L=new de;let R=!1;const P=[],U={};function K(){return 2*Math.PI/60/60*i.autoRotateSpeed}function ie(){return Math.pow(.95,i.zoomSpeed)}function G(W){i.reverseOrbit||i.reverseHorizontalOrbit?d.theta+=W:d.theta-=W}function J(W){i.reverseOrbit||i.reverseVerticalOrbit?d.phi+=W:d.phi-=W}const Z=(()=>{const W=new D;return function(Ge,ke){W.setFromMatrixColumn(ke,0),W.multiplyScalar(-Ge),m.add(W)}})(),ae=(()=>{const W=new D;return function(Ge,ke){i.screenSpacePanning===!0?W.setFromMatrixColumn(ke,1):(W.setFromMatrixColumn(ke,0),W.crossVectors(i.object.up,W)),W.multiplyScalar(Ge),m.add(W)}})(),O=(()=>{const W=new D;return function(Ge,ke){const Ae=i.domElement;if(Ae&&i.object instanceof Qt&&i.object.isPerspectiveCamera){const X=i.object.position;W.copy(X).sub(i.target);let Re=W.length();Re*=Math.tan(i.object.fov/2*Math.PI/180),Z(2*Ge*Re/Ae.clientHeight,i.object.matrix),ae(2*ke*Re/Ae.clientHeight,i.object.matrix)}else Ae&&i.object instanceof _r&&i.object.isOrthographicCamera?(Z(Ge*(i.object.right-i.object.left)/i.object.zoom/Ae.clientWidth,i.object.matrix),ae(ke*(i.object.top-i.object.bottom)/i.object.zoom/Ae.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function V(W){i.object instanceof Qt&&i.object.isPerspectiveCamera||i.object instanceof _r&&i.object.isOrthographicCamera?p=W:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function H(W){V(p/W)}function q(W){V(p*W)}function ne(W){if(!i.zoomToCursor||!i.domElement)return;R=!0;const ge=i.domElement.getBoundingClientRect(),Ge=W.clientX-ge.left,ke=W.clientY-ge.top,Ae=ge.width,X=ge.height;L.x=Ge/Ae*2-1,L.y=-(ke/X)*2+1,b.set(L.x,L.y,1).unproject(i.object).sub(i.object.position).normalize()}function Y(W){return Math.max(i.minDistance,Math.min(i.maxDistance,W))}function ue(W){y.set(W.clientX,W.clientY)}function Se(W){ne(W),w.set(W.clientX,W.clientY)}function Te(W){g.set(W.clientX,W.clientY)}function Ce(W){S.set(W.clientX,W.clientY),A.subVectors(S,y).multiplyScalar(i.rotateSpeed);const ge=i.domElement;ge&&(G(2*Math.PI*A.x/ge.clientHeight),J(2*Math.PI*A.y/ge.clientHeight)),y.copy(S),i.update()}function Ze(W){B.set(W.clientX,W.clientY),T.subVectors(B,w),T.y>0?H(ie()):T.y<0&&q(ie()),w.copy(B),i.update()}function ot(W){_.set(W.clientX,W.clientY),M.subVectors(_,g).multiplyScalar(i.panSpeed),O(M.x,M.y),g.copy(_),i.update()}function Le(W){ne(W),W.deltaY<0?q(ie()):W.deltaY>0&&H(ie()),i.update()}function be(W){let ge=!1;switch(W.code){case i.keys.UP:O(0,i.keyPanSpeed),ge=!0;break;case i.keys.BOTTOM:O(0,-i.keyPanSpeed),ge=!0;break;case i.keys.LEFT:O(i.keyPanSpeed,0),ge=!0;break;case i.keys.RIGHT:O(-i.keyPanSpeed,0),ge=!0;break}ge&&(W.preventDefault(),i.update())}function z(){if(P.length==1)y.set(P[0].pageX,P[0].pageY);else{const W=.5*(P[0].pageX+P[1].pageX),ge=.5*(P[0].pageY+P[1].pageY);y.set(W,ge)}}function ve(){if(P.length==1)g.set(P[0].pageX,P[0].pageY);else{const W=.5*(P[0].pageX+P[1].pageX),ge=.5*(P[0].pageY+P[1].pageY);g.set(W,ge)}}function he(){const W=P[0].pageX-P[1].pageX,ge=P[0].pageY-P[1].pageY,Ge=Math.sqrt(W*W+ge*ge);w.set(0,Ge)}function Me(){i.enableZoom&&he(),i.enablePan&&ve()}function pe(){i.enableZoom&&he(),i.enableRotate&&z()}function Ve(W){if(P.length==1)S.set(W.pageX,W.pageY);else{const Ge=We(W),ke=.5*(W.pageX+Ge.x),Ae=.5*(W.pageY+Ge.y);S.set(ke,Ae)}A.subVectors(S,y).multiplyScalar(i.rotateSpeed);const ge=i.domElement;ge&&(G(2*Math.PI*A.x/ge.clientHeight),J(2*Math.PI*A.y/ge.clientHeight)),y.copy(S)}function De(W){if(P.length==1)_.set(W.pageX,W.pageY);else{const ge=We(W),Ge=.5*(W.pageX+ge.x),ke=.5*(W.pageY+ge.y);_.set(Ge,ke)}M.subVectors(_,g).multiplyScalar(i.panSpeed),O(M.x,M.y),g.copy(_)}function F(W){const ge=We(W),Ge=W.pageX-ge.x,ke=W.pageY-ge.y,Ae=Math.sqrt(Ge*Ge+ke*ke);B.set(0,Ae),T.set(0,Math.pow(B.y/w.y,i.zoomSpeed)),H(T.y),w.copy(B)}function I(W){i.enableZoom&&F(W),i.enablePan&&De(W)}function $(W){i.enableZoom&&F(W),i.enableRotate&&Ve(W)}function _e(W){var ge,Ge;i.enabled!==!1&&(P.length===0&&((ge=i.domElement)==null||ge.ownerDocument.addEventListener("pointermove",ye),(Ge=i.domElement)==null||Ge.ownerDocument.addEventListener("pointerup",me)),yt(W),W.pointerType==="touch"?dt(W):Ye(W))}function ye(W){i.enabled!==!1&&(W.pointerType==="touch"?xe(W):Be(W))}function me(W){var ge,Ge,ke;ut(W),P.length===0&&((ge=i.domElement)==null||ge.releasePointerCapture(W.pointerId),(Ge=i.domElement)==null||Ge.ownerDocument.removeEventListener("pointermove",ye),(ke=i.domElement)==null||ke.ownerDocument.removeEventListener("pointerup",me)),i.dispatchEvent(o),l=a.NONE}function Ye(W){let ge;switch(W.button){case 0:ge=i.mouseButtons.LEFT;break;case 1:ge=i.mouseButtons.MIDDLE;break;case 2:ge=i.mouseButtons.RIGHT;break;default:ge=-1}switch(ge){case ma.DOLLY:if(i.enableZoom===!1)return;Se(W),l=a.DOLLY;break;case ma.ROTATE:if(W.ctrlKey||W.metaKey||W.shiftKey){if(i.enablePan===!1)return;Te(W),l=a.PAN}else{if(i.enableRotate===!1)return;ue(W),l=a.ROTATE}break;case ma.PAN:if(W.ctrlKey||W.metaKey||W.shiftKey){if(i.enableRotate===!1)return;ue(W),l=a.ROTATE}else{if(i.enablePan===!1)return;Te(W),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function Be(W){if(i.enabled!==!1)switch(l){case a.ROTATE:if(i.enableRotate===!1)return;Ce(W);break;case a.DOLLY:if(i.enableZoom===!1)return;Ze(W);break;case a.PAN:if(i.enablePan===!1)return;ot(W);break}}function Fe(W){i.enabled===!1||i.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(W.preventDefault(),i.dispatchEvent(s),Le(W),i.dispatchEvent(o))}function nt(W){i.enabled===!1||i.enablePan===!1||be(W)}function dt(W){switch(tt(W),P.length){case 1:switch(i.touches.ONE){case Ps.ROTATE:if(i.enableRotate===!1)return;z(),l=a.TOUCH_ROTATE;break;case Ps.PAN:if(i.enablePan===!1)return;ve(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(i.touches.TWO){case Ps.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Me(),l=a.TOUCH_DOLLY_PAN;break;case Ps.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;pe(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function xe(W){switch(tt(W),l){case a.TOUCH_ROTATE:if(i.enableRotate===!1)return;Ve(W),i.update();break;case a.TOUCH_PAN:if(i.enablePan===!1)return;De(W),i.update();break;case a.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;I(W),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;$(W),i.update();break;default:l=a.NONE}}function It(W){i.enabled!==!1&&W.preventDefault()}function yt(W){P.push(W)}function ut(W){delete U[W.pointerId];for(let ge=0;ge<P.length;ge++)if(P[ge].pointerId==W.pointerId){P.splice(ge,1);return}}function tt(W){let ge=U[W.pointerId];ge===void 0&&(ge=new de,U[W.pointerId]=ge),ge.set(W.pageX,W.pageY)}function We(W){const ge=W.pointerId===P[0].pointerId?P[1]:P[0];return U[ge.pointerId]}this.dollyIn=(W=ie())=>{q(W),i.update()},this.dollyOut=(W=ie())=>{H(W),i.update()},this.getScale=()=>p,this.setScale=W=>{V(W),i.update()},this.getZoomScale=()=>ie(),t!==void 0&&this.connect(t),this.update()}};function Pc(n){if(typeof TextDecoder<"u")return new TextDecoder().decode(n);let e="";for(let t=0,i=n.length;t<i;t++)e+=String.fromCharCode(n[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const Ca="srgb",zs="srgb-linear",J1=3001,Iz=3e3;class lA extends ei{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Uz(t)}),this.register(function(t){return new Oz(t)}),this.register(function(t){return new jz(t)}),this.register(function(t){return new Kz(t)}),this.register(function(t){return new Yz(t)}),this.register(function(t){return new zz(t)}),this.register(function(t){return new Gz(t)}),this.register(function(t){return new Hz(t)}),this.register(function(t){return new Vz(t)}),this.register(function(t){return new Nz(t)}),this.register(function(t){return new Wz(t)}),this.register(function(t){return new kz(t)}),this.register(function(t){return new Jz(t)}),this.register(function(t){return new Xz(t)}),this.register(function(t){return new Dz(t)}),this.register(function(t){return new Qz(t)}),this.register(function(t){return new Zz(t)})}load(e,t,i,r){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const f=ks.extractUrlBase(e);o=ks.resolveURL(f,this.path)}else o=ks.extractUrlBase(e);this.manager.itemStart(e);const a=function(f){r?r(f):console.error(f),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Di(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(f){try{s.parse(f,o,function(h){t(h),s.manager.itemEnd(e)},a)}catch(h){a(h)}},i,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let s;const o={},a={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Pc(new Uint8Array(e.slice(0,4)))===Kb){try{o[Pt.KHR_BINARY_GLTF]=new qz(e)}catch(h){r&&r(h);return}s=JSON.parse(o[Pt.KHR_BINARY_GLTF].content)}else s=JSON.parse(Pc(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new fG(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const h=this.pluginCallbacks[f](l);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[h.name]=h,o[h.name]=!0}if(s.extensionsUsed)for(let f=0;f<s.extensionsUsed.length;++f){const h=s.extensionsUsed[f],d=s.extensionsRequired||[];switch(h){case Pt.KHR_MATERIALS_UNLIT:o[h]=new Fz;break;case Pt.KHR_DRACO_MESH_COMPRESSION:o[h]=new $z(s,this.dracoLoader);break;case Pt.KHR_TEXTURE_TRANSFORM:o[h]=new eG;break;case Pt.KHR_MESH_QUANTIZATION:o[h]=new tG;break;default:d.indexOf(h)>=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function Lz(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Pt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Dz{constructor(e){this.parser=e,this.name=Pt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let f;const h=new Pe(16777215);l.color!==void 0&&h.setRGB(l.color[0],l.color[1],l.color[2],zs);const d=l.range!==void 0?l.range:0;switch(l.type){case"directional":f=new Km(h),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new Cf(h),f.distance=d;break;case"spot":f=new jm(h),f.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,f.angle=l.spot.outerConeAngle,f.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return f.position.set(0,0,0),f.decay=2,Rs(f,l),l.intensity!==void 0&&(f.intensity=l.intensity),f.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(f),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,s=i.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return i._getNodeRef(t.cache,a,l)})}}class Fz{constructor(){this.name=Pt.KHR_MATERIALS_UNLIT}getMaterialType(){return Ji}extendParams(e,t,i){const r=[];e.color=new Pe(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],zs),e.opacity=o[3]}s.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",s.baseColorTexture,Ca))}return Promise.all(r)}}class Nz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class Uz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new de(a,a)}return Promise.all(s)}}class Oz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class kz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class zz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Pe(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=r.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],zs)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(i.assignTexture(t,"sheenColorMap",o.sheenColorTexture,Ca)),o.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class Gz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(i.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class Hz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(i.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new Pe().setRGB(a[0],a[1],a[2],zs),Promise.all(s)}}class Vz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class Wz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(i.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new Pe().setRGB(a[0],a[1],a[2],zs),o.specularColorTexture!==void 0&&s.push(i.assignTexture(t,"specularColorMap",o.specularColorTexture,Ca)),Promise.all(s)}}class Xz{constructor(e){this.parser=e,this.name=Pt.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(i.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class Jz{constructor(e){this.parser=e,this.name=Pt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:Mr}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(i.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class jz{constructor(e){this.parser=e,this.name=Pt.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class Kz{constructor(e){this.parser=e,this.name=Pt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const f=i.options.manager.getHandler(a.uri);f!==null&&(l=f)}return this.detectSupport().then(function(f){if(f)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Yz{constructor(e){this.parser=e,this.name=Pt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const f=i.options.manager.getHandler(a.uri);f!==null&&(l=f)}return this.detectSupport().then(function(f){if(f)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Qz{constructor(e){this.name=Pt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,f=r.byteLength||0,h=r.count,d=r.byteStride,p=new Uint8Array(a,l,f);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,d,p,r.mode,r.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(h*d);return o.decodeGltfBuffer(new Uint8Array(m),h,d,p,r.mode,r.filter),m})})}else return null}}class Zz{constructor(e){this.name=Pt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const f of r.primitives)if(f.mode!==fr.TRIANGLES&&f.mode!==fr.TRIANGLE_STRIP&&f.mode!==fr.TRIANGLE_FAN&&f.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const f in o)a.push(this.parser.getDependency("accessor",o[f]).then(h=>(l[f]=h,l[f])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(f=>{const h=f.pop(),d=h.isGroup?h.children:[h],p=f[0].count,m=[];for(const y of d){const S=new Ue,A=new D,g=new $t,_=new D(1,1,1),M=new Ux(y.geometry,y.material,p);for(let w=0;w<p;w++)l.TRANSLATION&&A.fromBufferAttribute(l.TRANSLATION,w),l.ROTATION&&g.fromBufferAttribute(l.ROTATION,w),l.SCALE&&_.fromBufferAttribute(l.SCALE,w),M.setMatrixAt(w,S.compose(A,g,_));for(const w in l)if(w==="_COLOR_0"){const B=l[w];M.instanceColor=new Ha(B.array,B.itemSize,B.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&y.geometry.setAttribute(w,l[w]);wt.prototype.copy.call(M,y),this.parser.assignFinalMaterial(M),m.push(M)}return h.isGroup?(h.clear(),h.add(...m),h):m[0]}))}}const Kb="glTF",Cu=12,j1={JSON:1313821514,BIN:5130562};class qz{constructor(e){this.name=Pt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Cu);if(this.header={magic:Pc(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Kb)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Cu,r=new DataView(e,Cu);let s=0;for(;s<i;){const o=r.getUint32(s,!0);s+=4;const a=r.getUint32(s,!0);if(s+=4,a===j1.JSON){const l=new Uint8Array(e,Cu+s,o);this.content=Pc(l)}else if(a===j1.BIN){const l=Cu+s;this.body=e.slice(l,l+o)}s+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class $z{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Pt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},f={};for(const h in o){const d=v_[h]||h.toLowerCase();a[d]=o[h]}for(const h in e.attributes){const d=v_[h]||h.toLowerCase();if(o[h]!==void 0){const p=i.accessors[e.attributes[h]],m=dc[p.componentType];f[d]=m.name,l[d]=p.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(d,p){r.decodeDracoFile(h,function(m){for(const y in m.attributes){const S=m.attributes[y],A=l[y];A!==void 0&&(S.normalized=A)}d(m)},a,f,zs,p)})})}}class eG{constructor(){this.name=Pt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class tG{constructor(){this.name=Pt.KHR_MESH_QUANTIZATION}}class Yb extends Oc{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[s+o];return t}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,f=a*3,h=r-t,d=(i-t)/h,p=d*d,m=p*d,y=e*f,S=y-f,A=-2*m+3*p,g=m-p,_=1-A,M=g-p+d;for(let w=0;w!==a;w++){const B=o[S+w+a],T=o[S+w+l]*h,b=o[y+w+a],L=o[y+w]*h;s[w]=_*B+M*T+A*b+g*L}return s}}const nG=new $t;class iG extends Yb{interpolate_(e,t,i,r){const s=super.interpolate_(e,t,i,r);return nG.fromArray(s).normalize().toArray(s),s}}const fr={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},dc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},K1={9728:gn,9729:ln,9984:mf,9985:Am,9986:fc,9987:fs},Y1={33071:Bn,33648:Sc,10497:us},M0={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},v_={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Gb>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},po={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},rG={CUBICSPLINE:void 0,LINEAR:Ga,STEP:Ec},E0={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function sG(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Wf({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:cs})),n.DefaultMaterial}function ha(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Rs(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function oG(n,e,t){let i=!1,r=!1,s=!1;for(let f=0,h=e.length;f<h;f++){const d=e[f];if(d.POSITION!==void 0&&(i=!0),d.NORMAL!==void 0&&(r=!0),d.COLOR_0!==void 0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(n);const o=[],a=[],l=[];for(let f=0,h=e.length;f<h;f++){const d=e[f];if(i){const p=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):n.attributes.position;o.push(p)}if(r){const p=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):n.attributes.normal;a.push(p)}if(s){const p=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):n.attributes.color;l.push(p)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(f){const h=f[0],d=f[1],p=f[2];return i&&(n.morphAttributes.position=h),r&&(n.morphAttributes.normal=d),s&&(n.morphAttributes.color=p),n.morphTargetsRelative=!0,n})}function aG(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function lG(n){let e;const t=n.extensions&&n.extensions[Pt.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+w0(t.attributes):e=n.indices+":"+w0(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+w0(n.targets[i]);return e}function w0(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function y_(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function cG(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const uG=new Ue;class fG{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Lz,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||r&&s<98?this.textureLoader=new Zx(this.options.manager):this.textureLoader=new ub(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Di(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return ha(s,a,r),Rs(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const o=t[r].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[f,h]of o.children.entries())s(h,a.children[f])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Pt.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,o){i.load(ks.resolveURL(t.uri,r.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const o=M0[r.type],a=dc[r.componentType],l=r.normalized===!0,f=new a(r.count*o);return Promise.resolve(new Dt(f,o,l))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=M0[r.type],f=dc[r.componentType],h=f.BYTES_PER_ELEMENT,d=h*l,p=r.byteOffset||0,m=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,y=r.normalized===!0;let S,A;if(m&&m!==d){const g=Math.floor(p/m),_="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+g+":"+r.count;let M=t.cache.get(_);M||(S=new f(a,g*m,r.count*m/h),M=new zf(S,m/h),t.cache.add(_,M)),A=new Uo(M,l,p%m/h,y)}else a===null?S=new f(r.count*l):S=new f(a,p,r.count*l),A=new Dt(S,l,y);if(r.sparse!==void 0){const g=M0.SCALAR,_=dc[r.sparse.indices.componentType],M=r.sparse.indices.byteOffset||0,w=r.sparse.values.byteOffset||0,B=new _(o[1],M,r.sparse.count*g),T=new f(o[2],w,r.sparse.count*l);a!==null&&(A=new Dt(A.array.slice(),A.itemSize,A.normalized));for(let b=0,L=B.length;b<L;b++){const R=B[b];if(A.setX(R,T[b*l]),l>=2&&A.setY(R,T[b*l+1]),l>=3&&A.setZ(R,T[b*l+2]),l>=4&&A.setW(R,T[b*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return A})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const f=this.loadImageSource(t,i).then(function(h){h.flipY=!1,h.name=o.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const p=(s.samplers||{})[o.sampler]||{};return h.magFilter=K1[p.magFilter]||ln,h.minFilter=K1[p.minFilter]||fs,h.wrapS=Y1[p.wrapS]||us,h.wrapT=Y1[p.wrapT]||us,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=f,f}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",f=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(d){f=!0;const p=new Blob([d],{type:o.mimeType});return l=a.createObjectURL(p),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(l).then(function(d){return new Promise(function(p,m){let y=p;t.isImageBitmapLoader===!0&&(y=function(S){const A=new en(S);A.needsUpdate=!0,p(A)}),t.load(ks.resolveURL(d,s.path),y,void 0,m)})}).then(function(d){return f===!0&&a.revokeObjectURL(l),Rs(d,o),d.userData.mimeType=o.mimeType||cG(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=h,h}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[Pt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Pt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Pt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(typeof r=="number"&&(r=r===J1?Ca:zs),"colorSpace"in o?o.colorSpace=r:o.encoding=r===Ca?J1:Iz),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Bm,Ln.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new $n,Ln.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return Wf}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},f=[];if(l[Pt.KHR_MATERIALS_UNLIT]){const d=r[Pt.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),f.push(d.extendParams(a,s,t))}else{const d=s.pbrMetallicRoughness||{};if(a.color=new Pe(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){const p=d.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],zs),a.opacity=p[3]}d.baseColorTexture!==void 0&&f.push(t.assignTexture(a,"map",d.baseColorTexture,Ca)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),f.push(t.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=pr);const h=s.alphaMode||E0.OPAQUE;if(h===E0.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===E0.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ji&&(f.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new de(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;a.normalScale.set(d,d)}if(s.occlusionTexture!==void 0&&o!==Ji&&(f.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ji){const d=s.emissiveFactor;a.emissive=new Pe().setRGB(d[0],d[1],d[2],zs)}return s.emissiveTexture!==void 0&&o!==Ji&&f.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Ca)),Promise.all(f).then(function(){const d=new o(a);return s.name&&(d.name=s.name),Rs(d,s),t.associations.set(d,{materials:e}),s.extensions&&ha(r,d,s),d})}createUniqueName(e){const t=Ct.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[Pt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Q1(l,a,t)})}const o=[];for(let a=0,l=e.length;a<l;a++){const f=e[a],h=lG(f),d=r[h];if(d)o.push(d.promise);else{let p;f.extensions&&f.extensions[Pt.KHR_DRACO_MESH_COMPRESSION]?p=s(f):p=Q1(new ht,f,t),r[h]={primitive:f,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,r=this.extensions,s=i.meshes[e],o=s.primitives,a=[];for(let l=0,f=o.length;l<f;l++){const h=o[l].material===void 0?sG(this.cache):this.getDependency("material",o[l].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){const f=l.slice(0,l.length-1),h=l[l.length-1],d=[];for(let m=0,y=h.length;m<y;m++){const S=h[m],A=o[m];let g;const _=f[m];if(A.mode===fr.TRIANGLES||A.mode===fr.TRIANGLE_STRIP||A.mode===fr.TRIANGLE_FAN||A.mode===void 0)g=s.isSkinnedMesh===!0?new Pm(S,_):new Mn(S,_),g.isSkinnedMesh===!0&&g.normalizeSkinWeights(),A.mode===fr.TRIANGLE_STRIP?g.geometry=V1(g.geometry,Mx):A.mode===fr.TRIANGLE_FAN&&(g.geometry=V1(g.geometry,Zp));else if(A.mode===fr.LINES)g=new Vr(S,_);else if(A.mode===fr.LINE_STRIP)g=new ps(S,_);else if(A.mode===fr.LINE_LOOP)g=new Ox(S,_);else if(A.mode===fr.POINTS)g=new kx(S,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(g.geometry.morphAttributes).length>0&&aG(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),Rs(g,s),A.extensions&&ha(r,g,A),t.assignFinalMaterial(g),d.push(g)}for(let m=0,y=d.length;m<y;m++)t.associations.set(d[m],{meshes:e,primitives:m});if(d.length===1)return s.extensions&&ha(r,d[0],s),d[0];const p=new Or;s.extensions&&ha(r,p,s),t.associations.set(p,{meshes:e});for(let m=0,y=d.length;m<y;m++)p.add(d[m]);return p})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new Qt(mr.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new _r(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Rs(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,s=t.joints.length;r<s;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const s=r.pop(),o=r,a=[],l=[];for(let f=0,h=o.length;f<h;f++){const d=o[f];if(d){a.push(d);const p=new Ue;s!==null&&p.fromArray(s.array,f*16),l.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[f])}return new Nc(a,l)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,o=[],a=[],l=[],f=[],h=[];for(let d=0,p=r.channels.length;d<p;d++){const m=r.channels[d],y=r.samplers[m.sampler],S=m.target,A=S.node,g=r.parameters!==void 0?r.parameters[y.input]:y.input,_=r.parameters!==void 0?r.parameters[y.output]:y.output;S.node!==void 0&&(o.push(this.getDependency("node",A)),a.push(this.getDependency("accessor",g)),l.push(this.getDependency("accessor",_)),f.push(y),h.push(S))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(f),Promise.all(h)]).then(function(d){const p=d[0],m=d[1],y=d[2],S=d[3],A=d[4],g=[];for(let _=0,M=p.length;_<M;_++){const w=p[_],B=m[_],T=y[_],b=S[_],L=A[_];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const R=i._createAnimationTracks(w,B,T,b,L);if(R)for(let P=0;P<R.length;P++)g.push(R[P])}return new Wa(s,void 0,g)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){const o=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,f=r.weights.length;l<f;l++)a.morphTargetInfluences[l]=r.weights[l]}),o})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],s=i._loadNodeShallow(e),o=[],a=r.children||[];for(let f=0,h=a.length;f<h;f++)o.push(i.getDependency("node",a[f]));const l=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),l]).then(function(f){const h=f[0],d=f[1],p=f[2];p!==null&&h.traverse(function(m){m.isSkinnedMesh&&m.bind(p,uG)});for(let m=0,y=d.length;m<y;m++)h.add(d[m]);return h})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],l=r._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(f){return r._getNodeRef(r.cameraCache,s.camera,f)})),r._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){a.push(f)}),this.nodeCache[e]=Promise.all(a).then(function(f){let h;if(s.isBone===!0?h=new Rc:f.length>1?h=new Or:f.length===1?h=f[0]:h=new wt,h!==f[0])for(let d=0,p=f.length;d<p;d++)h.add(f[d]);if(s.name&&(h.userData.name=s.name,h.name=o),Rs(h,s),s.extensions&&ha(i,h,s),s.matrix!==void 0){const d=new Ue;d.fromArray(s.matrix),h.applyMatrix4(d)}else s.translation!==void 0&&h.position.fromArray(s.translation),s.rotation!==void 0&&h.quaternion.fromArray(s.rotation),s.scale!==void 0&&h.scale.fromArray(s.scale);return r.associations.has(h)||r.associations.set(h,{}),r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new Or;i.name&&(s.name=r.createUniqueName(i.name)),Rs(s,i),i.extensions&&ha(t,s,i);const o=i.nodes||[],a=[];for(let l=0,f=o.length;l<f;l++)a.push(r.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let h=0,d=l.length;h<d;h++)s.add(l[h]);const f=h=>{const d=new Map;for(const[p,m]of r.associations)(p instanceof Ln||p instanceof en)&&d.set(p,m);return h.traverse(p=>{const m=r.associations.get(p);m!=null&&d.set(p,m)}),d};return r.associations=f(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];po[s.path]===po.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(a);let f;switch(po[s.path]){case po.weights:f=Oo;break;case po.rotation:f=Js;break;case po.position:case po.scale:f=ko;break;default:switch(i.itemSize){case 1:f=Oo;break;case 2:case 3:default:f=ko;break}break}const h=r.interpolation!==void 0?rG[r.interpolation]:Ga,d=this._getArrayFromAccessor(i);for(let p=0,m=l.length;p<m;p++){const y=new f(l[p]+"."+po[s.path],t.array,d,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),o.push(y)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=y_(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof Js?iG:Yb;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function hG(n,e,t){const i=e.attributes,r=new Qn;if(i.POSITION!==void 0){const a=t.json.accessors[i.POSITION],l=a.min,f=a.max;if(l!==void 0&&f!==void 0){if(r.set(new D(l[0],l[1],l[2]),new D(f[0],f[1],f[2])),a.normalized){const h=y_(dc[a.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new D,l=new D;for(let f=0,h=s.length;f<h;f++){const d=s[f];if(d.POSITION!==void 0){const p=t.json.accessors[d.POSITION],m=p.min,y=p.max;if(m!==void 0&&y!==void 0){if(l.setX(Math.max(Math.abs(m[0]),Math.abs(y[0]))),l.setY(Math.max(Math.abs(m[1]),Math.abs(y[1]))),l.setZ(Math.max(Math.abs(m[2]),Math.abs(y[2]))),p.normalized){const S=y_(dc[p.componentType]);l.multiplyScalar(S)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}n.boundingBox=r;const o=new Zn;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=o}function Q1(n,e,t){const i=e.attributes,r=[];function s(o,a){return t.getDependency("accessor",o).then(function(l){n.setAttribute(a,l)})}for(const o in i){const a=v_[o]||o.toLowerCase();a in n.attributes||r.push(s(i[o],a))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(a){n.setIndex(a)});r.push(o)}return Rs(n,e),hG(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?oG(n,e.targets,t):n})}function Qb(n,e,t){const i=t.length-n-1;if(e>=t[i])return i-1;if(e<=t[n])return n;let r=n,s=i,o=Math.floor((r+s)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?s=o:r=o,o=Math.floor((r+s)/2);return o}function dG(n,e,t,i){const r=[],s=[],o=[];r[0]=1;for(let a=1;a<=t;++a){s[a]=e-i[n+1-a],o[a]=i[n+a]-e;let l=0;for(let f=0;f<a;++f){const h=o[f+1],d=s[a-f],p=r[f]/(h+d);r[f]=l+h*p,l=d*p}r[a]=l}return r}function pG(n,e,t,i){const r=Qb(n,i,e),s=dG(r,i,n,e),o=new Nt(0,0,0,0);for(let a=0;a<=n;++a){const l=t[r-n+a],f=s[a],h=l.w*f;o.x+=l.x*h,o.y+=l.y*h,o.z+=l.z*h,o.w+=l.w*f}return o}function mG(n,e,t,i,r){const s=[];for(let d=0;d<=t;++d)s[d]=0;const o=[];for(let d=0;d<=i;++d)o[d]=s.slice(0);const a=[];for(let d=0;d<=t;++d)a[d]=s.slice(0);a[0][0]=1;const l=s.slice(0),f=s.slice(0);for(let d=1;d<=t;++d){l[d]=e-r[n+1-d],f[d]=r[n+d]-e;let p=0;for(let m=0;m<d;++m){const y=f[m+1],S=l[d-m];a[d][m]=y+S;const A=a[m][d-1]/a[d][m];a[m][d]=p+y*A,p=S*A}a[d][d]=p}for(let d=0;d<=t;++d)o[0][d]=a[d][t];for(let d=0;d<=t;++d){let p=0,m=1;const y=[];for(let S=0;S<=t;++S)y[S]=s.slice(0);y[0][0]=1;for(let S=1;S<=i;++S){let A=0;const g=d-S,_=t-S;d>=S&&(y[m][0]=y[p][0]/a[_+1][g],A=y[m][0]*a[g][_]);const M=g>=-1?1:-g,w=d-1<=_?S-1:t-d;for(let T=M;T<=w;++T)y[m][T]=(y[p][T]-y[p][T-1])/a[_+1][g+T],A+=y[m][T]*a[g+T][_];d<=_&&(y[m][S]=-y[p][S-1]/a[_+1][d],A+=y[m][S]*a[d][_]),o[S][d]=A;const B=p;p=m,m=B}}let h=t;for(let d=1;d<=i;++d){for(let p=0;p<=t;++p)o[d][p]*=h;h*=t-d}return o}function gG(n,e,t,i,r){const s=r<n?r:n,o=[],a=Qb(n,i,e),l=mG(a,i,n,s,e),f=[];for(let h=0;h<t.length;++h){const d=t[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,f[h]=d}for(let h=0;h<=s;++h){const d=f[a-n].clone().multiplyScalar(l[h][0]);for(let p=1;p<=n;++p)d.add(f[a-n+p].clone().multiplyScalar(l[h][p]));o[h]=d}for(let h=s+1;h<=r+1;++h)o[h]=new Nt(0,0,0);return o}function vG(n,e){let t=1;for(let r=2;r<=n;++r)t*=r;let i=1;for(let r=2;r<=e;++r)i*=r;for(let r=2;r<=n-e;++r)i*=r;return t/i}function yG(n){const e=n.length,t=[],i=[];for(let s=0;s<e;++s){const o=n[s];t[s]=new D(o.x,o.y,o.z),i[s]=o.w}const r=[];for(let s=0;s<e;++s){const o=t[s].clone();for(let a=1;a<=s;++a)o.sub(r[s-a].clone().multiplyScalar(vG(s,a)*i[a]));r[s]=o.divideScalar(i[0])}return r}function _G(n,e,t,i,r){const s=gG(n,e,t,i,r);return yG(s)}class Z1 extends Sr{constructor(e,t,i,r,s){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||this.knots.length-1;for(let o=0;o<i.length;++o){const a=i[o];this.controlPoints[o]=new Nt(a.x,a.y,a.z,a.w)}}getPoint(e,t){const i=t||new D,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=pG(this.degree,this.knots,this.controlPoints,r);return s.w!=1&&s.divideScalar(s.w),i.set(s.x,s.y,s.z)}getTangent(e,t){const i=t||new D,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=_G(this.degree,this.knots,this.controlPoints,r,1);return i.copy(s[1]).normalize(),i}}let bt,An,Ti;class cA extends ei{constructor(e){super(e)}load(e,t,i,r){const s=this,o=s.path===""?ks.extractUrlBase(e):s.path,a=new Di(this.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(l){try{t(s.parse(l,o))}catch(f){r?r(f):console.error(f),s.manager.itemError(e)}},i,r)}parse(e,t){if(wG(e))bt=new EG().parse(e);else{const r=eP(e);if(!TG(r))throw new Error("THREE.FBXLoader: Unknown format.");if($1(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+$1(r));bt=new MG().parse(r)}const i=new Zx(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new xG(i,this.manager).parse(bt)}}class xG{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){An=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),r=this.parseDeformers(),s=new AG().parse(r);return this.parseScene(r,s,i),Ti}parseConnections(){const e=new Map;return"Connections"in bt&&bt.Connections.connections.forEach(function(i){const r=i[0],s=i[1],o=i[2];e.has(r)||e.set(r,{parents:[],children:[]});const a={ID:s,relationship:o};e.get(r).parents.push(a),e.has(s)||e.set(s,{parents:[],children:[]});const l={ID:r,relationship:o};e.get(s).children.push(l)}),e}parseImages(){const e={},t={};if("Video"in bt.Objects){const i=bt.Objects.Video;for(const r in i){const s=i[r],o=parseInt(r);if(e[o]=s.RelativeFilename||s.Filename,"Content"in s){const a=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const f=this.parseImage(i[r]);t[s.RelativeFilename||s.Filename]=f}}}}for(const i in e){const r=e[i];t[r]!==void 0?e[i]=t[r]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){const t=e.Content,i=e.RelativeFilename||e.Filename,r=i.slice(i.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in bt.Objects){const i=bt.Objects.Texture;for(const r in i){const s=this.parseTexture(i[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,o=r!==void 0?r.value:0,a=s!==void 0?s.value:0;if(i.wrapS=o===0?us:Bn,i.wrapT=a===0?us:Bn,"Scaling"in e){const l=e.Scaling.value;i.repeat.x=l[0],i.repeat.y=l[1]}return i}loadTexture(e,t){let i;const r=this.textureLoader.path,s=An.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(i=t[s[0].ID],(i.indexOf("blob:")===0||i.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new en):(l.setPath(this.textureLoader.path),o=l.load(i))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new en):o=this.textureLoader.load(i);return this.textureLoader.setPath(r),o}parseMaterials(e){const t=new Map;if("Material"in bt.Objects){const i=bt.Objects.Material;for(const r in i){const s=this.parseMaterial(i[r],e);s!==null&&t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const i=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!An.has(i))return null;const o=this.parseParameters(e,t,i);let a;switch(s.toLowerCase()){case"phong":a=new ju;break;case"lambert":a=new Jx;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new ju;break}return a.setValues(o),a.name=r,a}parseParameters(e,t,i){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new Pe().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new Pe().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new Pe().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new Pe().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new Pe().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new Pe().fromArray(e.SpecularColor.value));const s=this;return An.get(i).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":r.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,o.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,o.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,o.ID),r.envMap!==void 0&&(r.envMap.mapping=Ac,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=s.getTexture(t,o.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,o.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),r}getTexture(e,t){return"LayeredTexture"in bt.Objects&&t in bt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=An.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in bt.Objects){const i=bt.Objects.Deformer;for(const r in i){const s=i[r],o=An.get(parseInt(r));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,i);a.ID=r,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[r]=a}else if(s.attrType==="BlendShape"){const a={id:r};a.rawTargets=this.parseMorphTargets(o,i),a.id=r,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const i=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const o={ID:r.ID,indices:[],weights:[],transformLink:new Ue().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),i.push(o)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const i=[];for(let r=0;r<e.children.length;r++){const s=e.children[r],o=t[s.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;a.geoID=An.get(parseInt(s.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,i.push(a)}return i}parseScene(e,t,i){Ti=new Or;const r=this.parseModels(e.skeletons,t,i),s=bt.Objects.Model,o=this;r.forEach(function(l){const f=s[l.ID];o.setLookAtProperties(l,f),An.get(l.ID).parents.forEach(function(d){const p=r.get(d.ID);p!==void 0&&p.add(l)}),l.parent===null&&Ti.add(l)}),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),Ti.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const f=qb(l.userData.transformData);l.applyMatrix4(f),l.updateWorldMatrix()}});const a=new SG().parse();Ti.children.length===1&&Ti.children[0].isGroup&&(Ti.children[0].animations=a,Ti=Ti.children[0]),Ti.animations=a}parseModels(e,t,i){const r=new Map,s=bt.Objects.Model;for(const o in s){const a=parseInt(o),l=s[o],f=An.get(a);let h=this.buildSkeleton(f,e,a,l.attrName);if(!h){switch(l.attrType){case"Camera":h=this.createCamera(f);break;case"Light":h=this.createLight(f);break;case"Mesh":h=this.createMesh(f,t,i);break;case"NurbsCurve":h=this.createCurve(f,t);break;case"LimbNode":case"Root":h=new Rc;break;case"Null":default:h=new Or;break}h.name=l.attrName?Ct.sanitizeNodeName(l.attrName):"",h.ID=a}this.getTransformData(h,l),r.set(a,h)}return r}buildSkeleton(e,t,i,r){let s=null;return e.parents.forEach(function(o){for(const a in t){const l=t[a];l.rawBones.forEach(function(f,h){if(f.ID===o.ID){const d=s;s=new Rc,s.matrixWorld.copy(f.transformLink),s.name=r?Ct.sanitizeNodeName(r):"",s.ID=i,l.bones[h]=s,d!==null&&s.add(d)}})}}),s}createCamera(e){let t,i;if(e.children.forEach(function(r){const s=bt.Objects.NodeAttribute[r.ID];s!==void 0&&(i=s)}),i===void 0)t=new wt;else{let r=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(r=1);let s=1;i.NearPlane!==void 0&&(s=i.NearPlane.value/1e3);let o=1e3;i.FarPlane!==void 0&&(o=i.FarPlane.value/1e3);let a=window.innerWidth,l=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(a=i.AspectWidth.value,l=i.AspectHeight.value);const f=a/l;let h=45;i.FieldOfView!==void 0&&(h=i.FieldOfView.value);const d=i.FocalLength?i.FocalLength.value:null;switch(r){case 0:t=new Qt(h,f,s,o),d!==null&&t.setFocalLength(d);break;case 1:t=new _r(-a/2,a/2,l/2,-l/2,s,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new wt;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(r){const s=bt.Objects.NodeAttribute[r.ID];s!==void 0&&(i=s)}),i===void 0)t=new wt;else{let r;i.LightType===void 0?r=0:r=i.LightType.value;let s=16777215;i.Color!==void 0&&(s=new Pe().fromArray(i.Color.value));let o=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(o=0);let a=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?a=0:a=i.FarAttenuationEnd.value);const l=1;switch(r){case 0:t=new Cf(s,o,a,l);break;case 1:t=new Km(s,o);break;case 2:let f=Math.PI/3;i.InnerAngle!==void 0&&(f=mr.degToRad(i.InnerAngle.value));let h=0;i.OuterAngle!==void 0&&(h=mr.degToRad(i.OuterAngle.value),h=Math.max(h,1)),t=new jm(s,o,a,f,h,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new Cf(s,o);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let r,s=null,o=null;const a=[];return e.children.forEach(function(l){t.has(l.ID)&&(s=t.get(l.ID)),i.has(l.ID)&&a.push(i.get(l.ID))}),a.length>1?o=a:a.length>0?o=a[0]:(o=new ju({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(r=new Pm(s,o),r.normalizeSkinWeights()):r=new Mn(s,o),r}createCurve(e,t){const i=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),r=new $n({color:3342591,linewidth:1});return new ps(i,r)}getTransformData(e,t){const i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=$b(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&An.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=bt.Objects.Model[r.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Ti.add(e.target)):e.lookAt(new D().fromArray(o))}}})}bindSkeleton(e,t,i){const r=this.parsePoseNodes();for(const s in e){const o=e[s];An.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const f=l.ID;An.get(f).parents.forEach(function(d){i.has(d.ID)&&i.get(d.ID).bind(new Nc(o.bones),r[d.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in bt.Objects){const t=bt.Objects.Pose;for(const i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){const r=t[i].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new Ue().fromArray(s.Matrix.a)}):e[r.Node]=new Ue().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in bt&&"AmbientColor"in bt.GlobalSettings){const e=bt.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],r=e[2];if(t!==0||i!==0||r!==0){const s=new Pe(t,i,r);Ti.add(new $x(s,1))}}}}class AG{parse(e){const t=new Map;if("Geometry"in bt.Objects){const i=bt.Objects.Geometry;for(const r in i){const s=An.get(parseInt(r)),o=this.parseGeometry(s,i[r],e);t.set(parseInt(r),o)}}return t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){const r=i.skeletons,s=[],o=e.parents.map(function(d){return bt.Objects.Model[d.ID]});if(o.length===0)return;const a=e.children.reduce(function(d,p){return r[p.ID]!==void 0&&(d=r[p.ID]),d},null);e.children.forEach(function(d){i.morphTargets[d.ID]!==void 0&&s.push(i.morphTargets[d.ID])});const l=o[0],f={};"RotationOrder"in l&&(f.eulerOrder=$b(l.RotationOrder.value)),"InheritType"in l&&(f.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(f.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(f.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(f.scale=l.GeometricScaling.value);const h=qb(f);return this.genGeometry(t,a,s,h)}genGeometry(e,t,i,r){const s=new ht;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new Xe(a.vertex,3);if(l.applyMatrix4(r),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new Xe(a.colors,3)),t&&(s.setAttribute("skinIndex",new Tm(a.weightsIndices,4)),s.setAttribute("skinWeight",new Xe(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const f=new xt().getNormalMatrix(r),h=new Xe(a.normal,3);h.applyNormalMatrix(f),s.setAttribute("normal",h)}if(a.uvs.forEach(function(f,h){cz==="uv2"&&h++;const d=h===0?"uv":`uv${h}`;s.setAttribute(d,new Xe(a.uvs[h],2))}),o.material&&o.material.mappingType!=="AllSame"){let f=a.materialIndex[0],h=0;if(a.materialIndex.forEach(function(d,p){d!==f&&(s.addGroup(h,p-h,f),f=d,h=p)}),s.groups.length>0){const d=s.groups[s.groups.length-1],p=d.start+d.count;p!==a.materialIndex.length&&s.addGroup(p,a.materialIndex.length-p,f)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,i,r),s}parseGeoNode(e,t){const i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(o,a){i.weightTable[o]===void 0&&(i.weightTable[o]=[]),i.weightTable[o].push({id:s,weight:r.weights[a]})})})),i}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let i=0,r=0,s=!1,o=[],a=[],l=[],f=[],h=[],d=[];const p=this;return e.vertexIndices.forEach(function(m,y){let S,A=!1;m<0&&(m=m^-1,A=!0);let g=[],_=[];if(o.push(m*3,m*3+1,m*3+2),e.color){const M=np(y,i,m,e.color);l.push(M[0],M[1],M[2])}if(e.skeleton){if(e.weightTable[m]!==void 0&&e.weightTable[m].forEach(function(M){_.push(M.weight),g.push(M.id)}),_.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const M=[0,0,0,0],w=[0,0,0,0];_.forEach(function(B,T){let b=B,L=g[T];w.forEach(function(R,P,U){if(b>R){U[P]=b,b=R;const K=M[P];M[P]=L,L=K}})}),g=M,_=w}for(;_.length<4;)_.push(0),g.push(0);for(let M=0;M<4;++M)h.push(_[M]),d.push(g[M])}if(e.normal){const M=np(y,i,m,e.normal);a.push(M[0],M[1],M[2])}e.material&&e.material.mappingType!=="AllSame"&&(S=np(y,i,m,e.material)[0]),e.uv&&e.uv.forEach(function(M,w){const B=np(y,i,m,M);f[w]===void 0&&(f[w]=[]),f[w].push(B[0]),f[w].push(B[1])}),r++,A&&(p.genFace(t,e,o,S,a,l,f,h,d,r),i++,r=0,o=[],a=[],l=[],f=[],h=[],d=[])}),t}genFace(e,t,i,r,s,o,a,l,f,h){for(let d=2;d<h;d++)e.vertex.push(t.vertexPositions[i[0]]),e.vertex.push(t.vertexPositions[i[1]]),e.vertex.push(t.vertexPositions[i[2]]),e.vertex.push(t.vertexPositions[i[(d-1)*3]]),e.vertex.push(t.vertexPositions[i[(d-1)*3+1]]),e.vertex.push(t.vertexPositions[i[(d-1)*3+2]]),e.vertex.push(t.vertexPositions[i[d*3]]),e.vertex.push(t.vertexPositions[i[d*3+1]]),e.vertex.push(t.vertexPositions[i[d*3+2]]),t.skeleton&&(e.vertexWeights.push(l[0]),e.vertexWeights.push(l[1]),e.vertexWeights.push(l[2]),e.vertexWeights.push(l[3]),e.vertexWeights.push(l[(d-1)*4]),e.vertexWeights.push(l[(d-1)*4+1]),e.vertexWeights.push(l[(d-1)*4+2]),e.vertexWeights.push(l[(d-1)*4+3]),e.vertexWeights.push(l[d*4]),e.vertexWeights.push(l[d*4+1]),e.vertexWeights.push(l[d*4+2]),e.vertexWeights.push(l[d*4+3]),e.weightsIndices.push(f[0]),e.weightsIndices.push(f[1]),e.weightsIndices.push(f[2]),e.weightsIndices.push(f[3]),e.weightsIndices.push(f[(d-1)*4]),e.weightsIndices.push(f[(d-1)*4+1]),e.weightsIndices.push(f[(d-1)*4+2]),e.weightsIndices.push(f[(d-1)*4+3]),e.weightsIndices.push(f[d*4]),e.weightsIndices.push(f[d*4+1]),e.weightsIndices.push(f[d*4+2]),e.weightsIndices.push(f[d*4+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[(d-1)*3]),e.colors.push(o[(d-1)*3+1]),e.colors.push(o[(d-1)*3+2]),e.colors.push(o[d*3]),e.colors.push(o[d*3+1]),e.colors.push(o[d*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(s[0]),e.normal.push(s[1]),e.normal.push(s[2]),e.normal.push(s[(d-1)*3]),e.normal.push(s[(d-1)*3+1]),e.normal.push(s[(d-1)*3+2]),e.normal.push(s[d*3]),e.normal.push(s[d*3+1]),e.normal.push(s[d*3+2])),t.uv&&t.uv.forEach(function(p,m){e.uvs[m]===void 0&&(e.uvs[m]=[]),e.uvs[m].push(a[m][0]),e.uvs[m].push(a[m][1]),e.uvs[m].push(a[m][(d-1)*2]),e.uvs[m].push(a[m][(d-1)*2+1]),e.uvs[m].push(a[m][d*2]),e.uvs[m].push(a[m][d*2+1])})}addMorphTargets(e,t,i,r){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;i.forEach(function(o){o.rawTargets.forEach(function(a){const l=bt.Objects.Geometry[a.geoID];l!==void 0&&s.genMorphGeometry(e,t,l,r,a.name)})})}genMorphGeometry(e,t,i,r,s){const o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],a=i.Vertices!==void 0?i.Vertices.a:[],l=i.Indexes!==void 0?i.Indexes.a:[],f=e.attributes.position.count*3,h=new Float32Array(f);for(let y=0;y<l.length;y++){const S=l[y]*3;h[S]=a[y*3],h[S+1]=a[y*3+1],h[S+2]=a[y*3+2]}const d={vertexIndices:o,vertexPositions:h},p=this.genBuffers(d),m=new Xe(p.vertex,3);m.name=s||i.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Normals.a;let s=[];return i==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:t,referenceType:i}}parseUVs(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.UV.a;let s=[];return i==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:t,referenceType:i}}parseVertexColors(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Colors.a;let s=[];return i==="IndexToDirect"&&(s=e.ColorIndex.a),{dataSize:4,buffer:r,indices:s,mappingType:t,referenceType:i}}parseMaterialIndices(e){const t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};const r=e.Materials.a,s=[];for(let o=0;o<r.length;++o)s.push(o);return{dataSize:1,buffer:r,indices:s,mappingType:t,referenceType:i}}parseNurbsGeometry(e){if(Z1===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new ht;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new ht;const i=t-1,r=e.KnotVector.a,s=[],o=e.Points.a;for(let d=0,p=o.length;d<p;d+=4)s.push(new Nt().fromArray(o,d));let a,l;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){a=i,l=r.length-1-a;for(let d=0;d<i;++d)s.push(s[d])}const h=new Z1(i,r,s,a,l).getPoints(s.length*12);return new ht().setFromPoints(h)}}class SG{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const i in t){const r=t[i],s=this.addClip(r);e.push(s)}return e}parseClips(){if(bt.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=bt.Objects.AnimationCurveNode,t=new Map;for(const i in e){const r=e[i];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=bt.Objects.AnimationCurve;for(const i in t){const r={id:t[i].id,times:t[i].KeyTime.a.map(CG),values:t[i].KeyValueFloat.a},s=An.get(r.id);if(s!==void 0){const o=s.parents[0].ID,a=s.parents[0].relationship;a.match(/X/)?e.get(o).curves.x=r:a.match(/Y/)?e.get(o).curves.y=r:a.match(/Z/)?e.get(o).curves.z=r:a.match(/d|DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=r)}}}parseAnimationLayers(e){const t=bt.Objects.AnimationLayer,i=new Map;for(const r in t){const s=[],o=An.get(parseInt(r));o!==void 0&&(o.children.forEach(function(l,f){if(e.has(l.ID)){const h=e.get(l.ID);if(h.curves.x!==void 0||h.curves.y!==void 0||h.curves.z!==void 0){if(s[f]===void 0){const d=An.get(l.ID).parents.filter(function(p){return p.relationship!==void 0})[0].ID;if(d!==void 0){const p=bt.Objects.Model[d.toString()];if(p===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}const m={modelName:p.attrName?Ct.sanitizeNodeName(p.attrName):"",ID:p.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ti.traverse(function(y){y.ID===p.id&&(m.transform=y.matrix,y.userData.transformData&&(m.eulerOrder=y.userData.transformData.eulerOrder))}),m.transform||(m.transform=new Ue),"PreRotation"in p&&(m.preRotation=p.PreRotation.value),"PostRotation"in p&&(m.postRotation=p.PostRotation.value),s[f]=m}}s[f]&&(s[f][h.attr]=h)}else if(h.curves.morph!==void 0){if(s[f]===void 0){const d=An.get(l.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID,p=An.get(d).parents[0].ID,m=An.get(p).parents[0].ID,y=An.get(m).parents[0].ID,S=bt.Objects.Model[y],A={modelName:S.attrName?Ct.sanitizeNodeName(S.attrName):"",morphName:bt.Objects.Deformer[d].attrName};s[f]=A}s[f][h.attr]=h}}}),i.set(parseInt(r),s))}return i}parseAnimStacks(e){const t=bt.Objects.AnimationStack,i={};for(const r in t){const s=An.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);i[r]={name:t[r].attrName,layer:o}}return i}addClip(e){let t=[];const i=this;return e.layer.forEach(function(r){t=t.concat(i.generateTracks(r))}),new Wa(e.name,-1,t)}generateTracks(e){const t=[];let i=new D,r=new $t,s=new D;if(e.transform&&e.transform.decompose(i,r,s),i=i.toArray(),r=new is().setFromQuaternion(r,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,i,r){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,i);return new ko(e+"."+r,s,o)}generateRotationTrack(e,t,i,r,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(mr.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(mr.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(mr.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,i);r!==void 0&&(r=r.map(mr.degToRad),r.push(o),r=new is().fromArray(r),r=new $t().setFromEuler(r)),s!==void 0&&(s=s.map(mr.degToRad),s.push(o),s=new is().fromArray(s),s=new $t().setFromEuler(s).invert());const f=new $t,h=new is,d=[];for(let p=0;p<l.length;p+=3)h.set(l[p],l[p+1],l[p+2],o),f.setFromEuler(h),r!==void 0&&f.premultiply(r),s!==void 0&&f.multiply(s),f.toArray(d,p/3*4);return new Js(e+".quaternion",a,d)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,i=t.values.map(function(s){return s/100}),r=Ti.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Oo(e.modelName+".morphTargetInfluences["+r+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,r){return i-r}),t.length>1){let i=1,r=t[0];for(let s=1;s<t.length;s++){const o=t[s];o!==r&&(t[i]=o,r=o,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){const r=i,s=[];let o=-1,a=-1,l=-1;return e.forEach(function(f){if(t.x&&(o=t.x.times.indexOf(f)),t.y&&(a=t.y.times.indexOf(f)),t.z&&(l=t.z.times.indexOf(f)),o!==-1){const h=t.x.values[o];s.push(h),r[0]=h}else s.push(r[0]);if(a!==-1){const h=t.y.values[a];s.push(h),r[1]=h}else s.push(r[1]);if(l!==-1){const h=t.z.values[l];s.push(h),r[2]=h}else s.push(r[2])}),s}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const i=e.values[t-1],r=e.values[t]-i,s=Math.abs(r);if(s>=180){const o=s/180,a=r/o;let l=i+a;const f=e.times[t-1],d=(e.times[t]-f)/o;let p=f+d;const m=[],y=[];for(;p<e.times[t];)m.push(p),p+=d,y.push(l),l+=a;e.times=ew(e.times,t,m),e.values=ew(e.values,t,y)}}}}class MG{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Zb,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,i=e.split(/[\r\n]+/);return i.forEach(function(r,s){const o=r.match(/^[\s\t]*;/),a=r.match(/^[\s\t]*$/);if(o||a)return;const l=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),f=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),h=r.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(r,l):f?t.parseNodeProperty(r,f,i[++s]):h?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const i=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:i},o=this.parseNodeAttr(r),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,s):i in a?(i==="PoseNode"?a.PoseNode.push(s):a[i].id!==void 0&&(a[i]={},a[i][a[i].id]=a[i]),o.id!==""&&(a[i][o.id]=s)):typeof o.id=="number"?(a[i]={},a[i][o.id]=s):i!=="Properties70"&&(i==="PoseNode"?a[i]=[s]:a[i]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",r="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:i,type:r}}parseNodeProperty(e,t,i){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=i.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const l=s.split(",").slice(1),f=parseInt(l[0]),h=parseInt(l[1]);let d=s.split(",").slice(3);d=d.map(function(p){return p.trim().replace(/^"/,"")}),r="connections",s=[f,h],bG(s,d),o[r]===void 0&&(o[r]=[])}r==="Node"&&(o.id=s),r in o&&Array.isArray(o[r])?o[r].push(s):r!=="a"?o[r]=s:o.a=s,this.setCurrentProp(o,r),r==="a"&&s.slice(-1)!==","&&(o.a=C0(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=C0(t.a))}parseNodeSpecialProperty(e,t,i){const r=i.split('",').map(function(h){return h.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],o=r[1],a=r[2],l=r[3];let f=r[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=C0(f);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:f},this.setCurrentProp(this.getPrevNode(),s)}}class EG{parse(e){const t=new q1(e);t.skip(23);const i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);const r=new Zb;for(;!this.endOfContent(t);){const s=this.parseNode(t,i);s!==null&&r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const i={},r=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(r===0)return null;const l=[];for(let p=0;p<s;p++)l.push(this.parseProperty(e));const f=l.length>0?l[0]:"",h=l.length>1?l[1]:"",d=l.length>2?l[2]:"";for(i.singleProperty=s===1&&e.getOffset()===r;r>e.getOffset();){const p=this.parseNode(e,t);p!==null&&this.parseSubNode(a,i,p)}return i.propertyList=l,typeof f=="number"&&(i.id=f),h!==""&&(i.attrName=h),d!==""&&(i.attrType=d),a!==""&&(i.name=a),i}parseSubNode(e,t,i){if(i.singleProperty===!0){const r=i.propertyList[0];Array.isArray(r)?(t[i.name]=i,i.a=r):t[i.name]=r}else if(e==="Connections"&&i.name==="C"){const r=[];i.propertyList.forEach(function(s,o){o!==0&&r.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(i.name==="Properties70")Object.keys(i).forEach(function(s){t[s]=i[s]});else if(e==="Properties70"&&i.name==="P"){let r=i.propertyList[0],s=i.propertyList[1];const o=i.propertyList[2],a=i.propertyList[3];let l;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:l=i.propertyList[4],t[r]={type:s,type2:o,flag:a,value:l}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){const t=e.getString(1);let i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const a=Az(new Uint8Array(e.getArrayBuffer(o))),l=new q1(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(r);case"d":return l.getFloat64Array(r);case"f":return l.getFloat32Array(r);case"i":return l.getInt32Array(r);case"l":return l.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class q1{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let r=0;r<e;r++)t[r]=this.getUint8();const i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),Pc(new Uint8Array(t))}}class Zb{add(e,t){this[e]=t}}function wG(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===eP(n,0,e.length)}function TG(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function i(r){const s=n[r-1];return n=n.slice(t+r),t++,s}for(let r=0;r<e.length;++r)if(i(1)===e[r])return!1;return!0}function $1(n){const e=/FBXVersion: (\d+)/,t=n.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function CG(n){return n/46186158e3}const RG=[];function np(n,e,t,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=n;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(r=i.indices[r]);const s=r*i.dataSize,o=s+i.dataSize;return PG(RG,i.buffer,s,o)}const T0=new is,Ol=new D;function qb(n){const e=new Ue,t=new Ue,i=new Ue,r=new Ue,s=new Ue,o=new Ue,a=new Ue,l=new Ue,f=new Ue,h=new Ue,d=new Ue,p=new Ue,m=n.inheritType?n.inheritType:0;if(n.translation&&e.setPosition(Ol.fromArray(n.translation)),n.preRotation){const P=n.preRotation.map(mr.degToRad);P.push(n.eulerOrder),t.makeRotationFromEuler(T0.fromArray(P))}if(n.rotation){const P=n.rotation.map(mr.degToRad);P.push(n.eulerOrder),i.makeRotationFromEuler(T0.fromArray(P))}if(n.postRotation){const P=n.postRotation.map(mr.degToRad);P.push(n.eulerOrder),r.makeRotationFromEuler(T0.fromArray(P)),r.invert()}n.scale&&s.scale(Ol.fromArray(n.scale)),n.scalingOffset&&a.setPosition(Ol.fromArray(n.scalingOffset)),n.scalingPivot&&o.setPosition(Ol.fromArray(n.scalingPivot)),n.rotationOffset&&l.setPosition(Ol.fromArray(n.rotationOffset)),n.rotationPivot&&f.setPosition(Ol.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(d.copy(n.parentMatrix),h.copy(n.parentMatrixWorld));const y=t.clone().multiply(i).multiply(r),S=new Ue;S.extractRotation(h);const A=new Ue;A.copyPosition(h);const g=A.clone().invert().multiply(h),_=S.clone().invert().multiply(g),M=s,w=new Ue;if(m===0)w.copy(S).multiply(y).multiply(_).multiply(M);else if(m===1)w.copy(S).multiply(_).multiply(y).multiply(M);else{const U=new Ue().scale(new D().setFromMatrixScale(d)).clone().invert(),K=_.clone().multiply(U);w.copy(S).multiply(y).multiply(K).multiply(M)}const B=f.clone().invert(),T=o.clone().invert();let b=e.clone().multiply(l).multiply(f).multiply(t).multiply(i).multiply(r).multiply(B).multiply(a).multiply(o).multiply(s).multiply(T);const L=new Ue().copyPosition(b),R=h.clone().multiply(L);return p.copyPosition(R),b=p.clone().multiply(w),b.premultiply(h.invert()),b}function $b(n){n=n||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[n]}function C0(n){return n.split(",").map(function(t){return parseFloat(t)})}function eP(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=n.byteLength),Pc(new Uint8Array(n,e,t))}function bG(n,e){for(let t=0,i=n.length,r=e.length;t<r;t++,i++)n[i]=e[t]}function PG(n,e,t,i){for(let r=t,s=0;r<i;r++,s++)n[s]=e[r];return n}function ew(n,e,t){return n.slice(0,e).concat(t).concat(n.slice(e))}const R0=new WeakMap;class BG extends ei{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const s=new Di(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const f=t.attributeTypes[l];f.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=f.name)}const i=JSON.stringify(t);if(R0.has(e)){const l=R0.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((f,h)=>{r._callbacks[s]={resolve:f,reject:h},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),R0.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new ht;e.index&&t.setIndex(new Dt(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],s=r.name,o=r.array,a=r.itemSize;t.setAttribute(s,new Dt(o,a))}return t}_loadLibrary(e,t){const i=new Di(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=IG.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
- `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function IG(){let n,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(d){h({draco:d})},DracoDecoderModule(n)});break;case"decode":const l=a.buffer,f=a.taskConfig;e.then(h=>{const d=h.draco,p=new d.Decoder,m=new d.DecoderBuffer;m.Init(new Int8Array(l),l.byteLength);try{const y=t(d,p,m,f),S=y.attributes.map(A=>A.array.buffer);y.index&&S.push(y.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:y},S)}catch(y){console.error(y),self.postMessage({type:"error",id:a.id,error:y.message})}finally{d.destroy(m),d.destroy(p)}});break}};function t(o,a,l,f){const h=f.attributeIDs,d=f.attributeTypes;let p,m;const y=a.GetEncodedGeometryType(l);if(y===o.TRIANGULAR_MESH)p=new o.Mesh,m=a.DecodeBufferToMesh(l,p);else if(y===o.POINT_CLOUD)p=new o.PointCloud,m=a.DecodeBufferToPointCloud(l,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const S={index:null,attributes:[]};for(const A in h){const g=self[d[A]];let _,M;if(f.useUniqueIDs)M=h[A],_=a.GetAttributeByUniqueId(p,M);else{if(M=a.GetAttributeId(p,o[h[A]]),M===-1)continue;_=a.GetAttribute(p,M)}S.attributes.push(r(o,a,p,A,g,_))}return y===o.TRIANGULAR_MESH&&(S.index=i(o,a,p)),o.destroy(p),S}function i(o,a,l){const h=l.num_faces()*3,d=h*4,p=o._malloc(d);a.GetTrianglesUInt32Array(l,d,p);const m=new Uint32Array(o.HEAPF32.buffer,p,h).slice();return o._free(p),{array:m,itemSize:1}}function r(o,a,l,f,h,d){const p=d.num_components(),y=l.num_points()*p,S=y*h.BYTES_PER_ELEMENT,A=s(o,h),g=o._malloc(S);a.GetAttributeDataArrayForAllPoints(l,d,A,S,g);const _=new h(o.HEAPF32.buffer,g,y).slice();return o._free(g),{name:f,array:_,itemSize:p}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let ip;const b0=()=>{if(ip)return ip;const n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let r=n;WebAssembly.validate(t)&&(r=e);let s;const o=WebAssembly.instantiate(a(r),{}).then(d=>{s=d.instance,s.exports.__wasm_call_ctors()});function a(d){const p=new Uint8Array(d.length);for(let y=0;y<d.length;++y){const S=d.charCodeAt(y);p[y]=S>96?S-71:S>64?S-65:S>47?S+4:S>46?63:62}let m=0;for(let y=0;y<d.length;++y)p[m++]=p[y]<60?i[p[y]]:(p[y]-60)*64+p[++y];return p.buffer.slice(0,m)}function l(d,p,m,y,S,A){const g=s.exports.sbrk,_=m+3&-4,M=g(_*y),w=g(S.length),B=new Uint8Array(s.exports.memory.buffer);B.set(S,w);const T=d(M,m,y,w,S.length);if(T===0&&A&&A(M,_,y),p.set(B.subarray(M,M+m*y)),g(M-g(0)),T!==0)throw new Error(`Malformed buffer data: ${T}`)}const f={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return ip={ready:o,supported:!0,decodeVertexBuffer(d,p,m,y,S){l(s.exports.meshopt_decodeVertexBuffer,d,p,m,y,s.exports[f[S]])},decodeIndexBuffer(d,p,m,y){l(s.exports.meshopt_decodeIndexBuffer,d,p,m,y)},decodeIndexSequence(d,p,m,y){l(s.exports.meshopt_decodeIndexSequence,d,p,m,y)},decodeGltfBuffer(d,p,m,y,S,A){l(s.exports[h[S]],d,p,m,y,s.exports[f[A]])}},ip};let rp=null,tP="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function nP(n=!0,e=!0,t){return i=>{t&&t(i),n&&(rp||(rp=new BG),rp.setDecoderPath(typeof n=="string"?n:tP),i.setDRACOLoader(rp)),e&&i.setMeshoptDecoder(typeof b0=="function"?b0():b0)}}const Qm=(n,e,t,i)=>Jo(lA,n,nP(e,t,i));Qm.preload=(n,e,t,i)=>Jo.preload(lA,n,nP(e,t,i));Qm.clear=n=>Jo.clear(lA,n);Qm.setDecoderPath=n=>{tP=n};const LG=se.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:i,enableDamping:r=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...f},h)=>{const d=Vi(T=>T.invalidate),p=Vi(T=>T.camera),m=Vi(T=>T.gl),y=Vi(T=>T.events),S=Vi(T=>T.setEvents),A=Vi(T=>T.set),g=Vi(T=>T.get),_=Vi(T=>T.performance),M=e||p,w=i||y.connected||m.domElement,B=se.useMemo(()=>new Bz(M),[M]);return Jf(()=>{B.enabled&&B.update()},-1),se.useEffect(()=>(s&&B.connect(s===!0?w:s),B.connect(w),()=>void B.dispose()),[s,w,t,B,d]),se.useEffect(()=>{const T=R=>{d(),t&&_.regress(),o&&o(R)},b=R=>{a&&a(R)},L=R=>{l&&l(R)};return B.addEventListener("change",T),B.addEventListener("start",b),B.addEventListener("end",L),()=>{B.removeEventListener("start",b),B.removeEventListener("end",L),B.removeEventListener("change",T)}},[o,a,l,B,d,S]),se.useEffect(()=>{if(n){const T=g().controls;return A({controls:B}),()=>A({controls:T})}},[n,B]),se.createElement("primitive",nm({ref:h,object:B,enableDamping:r},f))});function uA(n){return Jo(cA,n)}uA.preload=n=>Jo.preload(cA,n);uA.clear=n=>Jo.clear(cA,n);function iP(n,e){const t=se.useRef(),[i]=se.useState(()=>e?e instanceof wt?{current:e}:e:t),[r]=se.useState(()=>new pb(void 0));se.useLayoutEffect(()=>{e&&(i.current=e instanceof wt?e:e.current),r._root=i.current});const s=se.useRef({}),o=se.useMemo(()=>{const a={};return n.forEach(l=>Object.defineProperty(a,l.name,{enumerable:!0,get(){if(i.current)return s.current[l.name]||(s.current[l.name]=r.clipAction(l,i.current))},configurable:!0})),{ref:i,clips:n,actions:a,names:n.map(l=>l.name),mixer:r}},[n]);return Jf((a,l)=>r.update(l)),se.useEffect(()=>{const a=i.current;return()=>{s.current={},r.stopAllAction(),Object.values(o.actions).forEach(l=>{a&&r.uncacheAction(l,a)})}},[n]),o}var ur=function(n){return n[n.NONE=0]="NONE",n[n.START=1]="START",n[n.ACTIVE=2]="ACTIVE",n}(ur||{});const kl=n=>n&&n.isOrthographicCamera,DG=n=>n&&n.isBox3,FG=n=>1-Math.exp(-5*n)+.007*n,NG=se.createContext(null);function UG({children:n,maxDuration:e=1,margin:t=1.2,observe:i,fit:r,clip:s,interpolateFunc:o=FG,onFit:a}){const l=se.useRef(null),{camera:f,size:h,invalidate:d}=Vi(),p=Vi(B=>B.controls),m=se.useRef(a);m.current=a;const y=se.useRef({camPos:new D,camRot:new $t,camZoom:1}),S=se.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),A=se.useRef(ur.NONE),g=se.useRef(0),[_]=se.useState(()=>new Qn),M=se.useMemo(()=>{function B(){const T=_.getSize(new D),b=_.getCenter(new D),L=Math.max(T.x,T.y,T.z),R=kl(f)?L*4:L/(2*Math.atan(Math.PI*f.fov/360)),P=kl(f)?L*4:R/f.aspect,U=t*Math.max(R,P);return{box:_,size:T,center:b,distance:U}}return{getSize:B,refresh(T){if(DG(T))_.copy(T);else{const b=T||l.current;if(!b)return this;b.updateWorldMatrix(!0,!0),_.setFromObject(b)}if(_.isEmpty()){const b=f.position.length()||10;_.setFromCenterAndSize(new D,new D(b,b,b))}return y.current.camPos.copy(f.position),y.current.camRot.copy(f.quaternion),kl(f)&&(y.current.camZoom=f.zoom),S.current.camPos=void 0,S.current.camRot=void 0,S.current.camZoom=void 0,S.current.camUp=void 0,S.current.target=void 0,this},reset(){const{center:T,distance:b}=B(),L=f.position.clone().sub(T).normalize();S.current.camPos=T.clone().addScaledVector(L,b),S.current.target=T.clone();const R=new Ue().lookAt(S.current.camPos,S.current.target,f.up);return S.current.camRot=new $t().setFromRotationMatrix(R),A.current=ur.START,g.current=0,this},moveTo(T){return S.current.camPos=Array.isArray(T)?new D(...T):T.clone(),A.current=ur.START,g.current=0,this},lookAt({target:T,up:b}){S.current.target=Array.isArray(T)?new D(...T):T.clone(),b?S.current.camUp=Array.isArray(b)?new D(...b):b.clone():S.current.camUp=f.up.clone();const L=new Ue().lookAt(S.current.camPos||f.position,S.current.target,S.current.camUp);return S.current.camRot=new $t().setFromRotationMatrix(L),A.current=ur.START,g.current=0,this},to({position:T,target:b}){return this.moveTo(T).lookAt({target:b})},fit(){if(!kl(f))return this.reset();let T=0,b=0;const L=[new D(_.min.x,_.min.y,_.min.z),new D(_.min.x,_.max.y,_.min.z),new D(_.min.x,_.min.y,_.max.z),new D(_.min.x,_.max.y,_.max.z),new D(_.max.x,_.max.y,_.max.z),new D(_.max.x,_.max.y,_.min.z),new D(_.max.x,_.min.y,_.max.z),new D(_.max.x,_.min.y,_.min.z)],R=S.current.camPos||f.position,P=S.current.target||(p==null?void 0:p.target),U=S.current.camUp||f.up,K=P?new Ue().lookAt(R,P,U).setPosition(R).invert():f.matrixWorldInverse;for(const J of L)J.applyMatrix4(K),T=Math.max(T,Math.abs(J.y)),b=Math.max(b,Math.abs(J.x));T*=2,b*=2;const ie=(f.top-f.bottom)/T,G=(f.right-f.left)/b;return S.current.camZoom=Math.min(ie,G)/t,A.current=ur.START,g.current=0,m.current&&m.current(this.getSize()),this},clip(){const{distance:T}=B();return f.near=T/100,f.far=T*100,f.updateProjectionMatrix(),p&&(p.maxDistance=T*10,p.update()),d(),this}}},[_,f,p,t,d]);se.useLayoutEffect(()=>{if(p){const B=()=>{if(p&&S.current.target&&A.current!==ur.NONE){const T=new D().setFromMatrixColumn(f.matrix,2),b=y.current.camPos.distanceTo(p.target),L=(S.current.camPos||y.current.camPos).distanceTo(S.current.target),R=(1-g.current)*b+g.current*L;p.target.copy(f.position).addScaledVector(T,-R),p.update()}A.current=ur.NONE};return p.addEventListener("start",B),()=>p.removeEventListener("start",B)}},[p]);const w=se.useRef(0);return se.useLayoutEffect(()=>{(i||w.current++===0)&&(M.refresh(),r&&M.reset().fit(),s&&M.clip())},[h,s,r,i,f,p]),Jf((B,T)=>{if(A.current===ur.START)A.current=ur.ACTIVE,d();else if(A.current===ur.ACTIVE){if(g.current+=T/e,g.current>=1)S.current.camPos&&f.position.copy(S.current.camPos),S.current.camRot&&f.quaternion.copy(S.current.camRot),S.current.camUp&&f.up.copy(S.current.camUp),S.current.camZoom&&kl(f)&&(f.zoom=S.current.camZoom),f.updateMatrixWorld(),f.updateProjectionMatrix(),p&&S.current.target&&(p.target.copy(S.current.target),p.update()),A.current=ur.NONE;else{const b=o(g.current);S.current.camPos&&f.position.lerpVectors(y.current.camPos,S.current.camPos,b),S.current.camRot&&f.quaternion.slerpQuaternions(y.current.camRot,S.current.camRot,b),S.current.camUp&&f.up.set(0,1,0).applyQuaternion(f.quaternion),S.current.camZoom&&kl(f)&&(f.zoom=(1-b)*y.current.camZoom+b*S.current.camZoom),f.updateMatrixWorld(),f.updateProjectionMatrix()}d()}}),se.createElement("group",{ref:l},se.createElement(NG.Provider,{value:M},n))}function OG(n){const[e,t]=se.useState({progress:0,loaded:0,total:0,blobUrl:null,error:null,loading:!1});return se.useEffect(()=>{if(!n)return;const i=new AbortController;let r=null;return(async()=>{t(o=>({...o,loading:!0,progress:0,loaded:0,total:0,error:null}));try{const o=await fetch(n,{signal:i.signal});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const a=o.headers.get("content-length"),l=a?parseInt(a,10):0,f=o.body.getReader();let h=0;const d=[];for(;;){const{done:m,value:y}=await f.read();if(m)break;d.push(y),h+=y.length,t(S=>({...S,loaded:h,total:l,progress:l?h/l*100:0}))}const p=new Blob(d);r=URL.createObjectURL(p),t(m=>({...m,blobUrl:r,loading:!1,progress:100}))}catch(o){o.name!=="AbortError"&&(console.error("Fetch Loader error:",o),t(a=>({...a,error:o.message,loading:!1})))}})(),()=>{i.abort(),r&&URL.revokeObjectURL(r)}},[n]),e}function kG({fetchState:n,isModelReady:e,color:t,active:i}){const r=n&&n.loading,s=n&&n.blobUrl&&!e,o=i&&!e;let a=0;return r?a=n.progress:s?a=100:o&&(a=0),Rt.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:o?1:0,transition:o?"none":"opacity 0.8s ease-out",pointerEvents:o?"auto":"none",zIndex:9999},children:Rt.jsx("div",{style:{width:600,height:10,background:"#fff",borderRadius:5,overflow:"hidden",position:"relative",boxShadow:"0 2px 8px rgba(0,0,0,0.2)"},children:Rt.jsx("div",{style:{width:"100%",transform:`scaleX(${a/100})`,transformOrigin:"left",height:"100%",background:t||"#4C7F7A"}})})})}function zG({url:n,...e}){const{scene:t,animations:i}=Qm(n,!0),r=se.useRef(),{actions:s,names:o}=iP(i,r);return se.useEffect(()=>{s&&o.length>0&&s[o[0]].reset().fadeIn(.5).play()},[s,o]),Rt.jsx("primitive",{ref:r,object:t,...e})}function GG({url:n,...e}){const t=uA(n),i=se.useRef(),{actions:r,names:s}=iP(t.animations||[],i);return se.useEffect(()=>{r&&s.length>0&&r[s[0]].reset().fadeIn(.5).play()},[r,s]),Rt.jsx("primitive",{ref:i,object:t,...e})}function HG({url:n,...e}){}function VG({url:n,fileType:e}){switch(se.useMemo(()=>{if(e)return e;const i=(n||"").toLowerCase().split("?")[0].split("#")[0];return i.endsWith(".fbx")?"fbx":i.endsWith(".usdz")?"usdz":"gltf"},[n,e])){case"fbx":return Rt.jsx(GG,{url:n});case"usdz":return Rt.jsx(HG,{url:n});default:return Rt.jsx(zG,{url:n})}}function WG({controlsRef:n,onFitReady:e,zoomMin:t}){const{camera:i}=Vi(),r=se.useRef({pos:new D,target:new D}),s=se.useRef(0),o=se.useRef(!1),a=se.useRef(1/0);return se.useEffect(()=>{o.current=!1,s.current=0,a.current=Date.now()},[e]),Jf(()=>{if(!n.current||o.current||Date.now()-a.current<300)return;const l=n.current,f=i.position,h=l.target,d=f.distanceTo(r.current.pos),p=h.distanceTo(r.current.target);if(d<.001&&p<.001?s.current++:s.current=0,r.current.pos.copy(f),r.current.target.copy(h),s.current>20){o.current=!0;const m=f.distanceTo(h);e({position:f.clone(),target:h.clone(),distance:m,baseDistance:m})}}),null}function XG({controlsRef:n,zoomMin:e,zoomMax:t,baseDistance:i,autoRotateSpeed:r,enabled:s=!0,onStart:o,onEnd:a}){return se.useEffect(()=>{const l=n.current;if(!l||i==null)return;const f=Math.max(.001,e||1),h=Math.max(f,t||4);l.maxDistance=i/f,l.minDistance=i/h},[i,e,t,n]),Rt.jsx(LG,{ref:n,enabled:s,enableDamping:!0,dampingFactor:.08,rotateSpeed:.8,zoomSpeed:1,enableZoom:!0,enablePan:!0,panSpeed:.8,screenSpacePanning:!0,touches:{ONE:Ps.ROTATE,TWO:Ps.DOLLY_PAN},makeDefault:!0,autoRotate:!!r,autoRotateSpeed:r,onStart:o,onEnd:a})}function JG({url:n,zoomMin:e,zoomMax:t,fileType:i,onReady:r}){const s=se.useRef(),{camera:o,gl:a}=Vi(),[l,f]=se.useState(null),[h,d]=se.useState({active:!1,speed:1,delay:5e3,isInteracting:!1}),[p,m]=se.useState(!1),y=se.useRef(null),S=se.useRef(null),A=se.useCallback(b=>{y.current={position:b.position,target:b.target},f(b.baseDistance||b.distance),m(!0),r&&setTimeout(()=>r(),50)},[r]),g=se.useCallback(b=>{if(!s.current||!y.current)return;const L=s.current,R=o.position.clone(),P=L.target.clone(),U=y.current.position,K=y.current.target,ie=800,G=performance.now(),J=Z=>{const ae=Z-G,O=Math.min(ae/ie,1),V=1-Math.pow(1-O,3);o.position.lerpVectors(R,U,V),L.target.lerpVectors(P,K,V),L.update(),O<1?requestAnimationFrame(J):typeof b=="function"&&b()};requestAnimationFrame(J)},[o]),_=se.useCallback(()=>{d(b=>({...b,isInteracting:!0})),S.current&&(clearTimeout(S.current),S.current=null)},[]),M=se.useCallback(()=>{d(b=>({...b,isInteracting:!1})),h.active&&(d(b=>({...b,isWaiting:!0})),S.current=setTimeout(()=>{console.log("无操作超时,开始复位并恢复旋转..."),g(()=>{d(b=>({...b,isWaiting:!1}))})},h.delay))},[h.active,h.delay,g]),w=h.active&&!h.isInteracting&&!h.isWaiting?h.speed:0,B=se.useCallback((b,L)=>{if(!s.current)return;const R=s.current,P=o.position.clone(),U=performance.now(),K=300,ie=G=>{const J=Math.min((G-U)/K,1),Z=1-Math.pow(1-J,3);o.position.lerpVectors(P,b,Z),R.update(),J<1?requestAnimationFrame(ie):typeof L=="function"&&L()};requestAnimationFrame(ie)},[o]),T=se.useCallback((b,L)=>{if(!s.current||!l)return null;const R=s.current,P=o.position.distanceTo(R.target),U=L?P/b:P*b;if(L&&U<R.minDistance)return console.warn("已达到最大放大倍数"),null;!L&&U>R.maxDistance&&console.warn("已达到最小缩小倍数");const K=Math.max(R.minDistance,Math.min(U,R.maxDistance)),ie=new D().subVectors(o.position,R.target).normalize();return R.target.clone().add(ie.multiplyScalar(K))},[o,l]);return se.useEffect(()=>(window.sceneFc={resetView:()=>{d(b=>({...b,active:!1})),g(),console.log("已调用重置方法!")},setAutoRotate:(b=1,L=5e3)=>{const R=Math.max(.1,Math.min(8,Number(b)||1)),P=Math.max(0,Number(L)||5e3);console.log(`设置自动旋转: 速度=${R}, 延迟=${P}ms`),d(U=>({...U,active:!1})),g(()=>{d({active:!0,speed:R,delay:P,isInteracting:!1,isWaiting:!1})})},stopAutoRotate:()=>{console.log("停止自动旋转"),d(b=>({...b,active:!1}))},zoomIn:(b=1.2)=>{const L=Math.max(1.01,Number(b)||1.2),R=P=>{const U=T(L,!0);U?B(U,()=>{P&&P()}):P&&P()};h.active?(_(),g(()=>{R(()=>{M()})})):R()},zoomOut:(b=1.2)=>{const L=Math.max(1.01,Number(b)||1.2),R=P=>{const U=T(L,!1);U?B(U,()=>{P&&P()}):P&&P()};h.active?(_(),g(()=>{R(()=>{M()})})):R()}},console.log("已提出方法:",window.sceneFc),()=>{window.sceneFc&&delete window.sceneFc}),[g,l,o,h.active,_,M,B,T]),se.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]),se.useEffect(()=>{const b=a.domElement,L=R=>{R.preventDefault(),g()};return b.addEventListener("dblclick",L),()=>b.removeEventListener("dblclick",L)},[a,g]),Rt.jsxs(Rt.Fragment,{children:[Rt.jsx(UG,{fit:!0,clip:!0,margin:1.5,children:Rt.jsx(VG,{url:n,fileType:i})}),Rt.jsx(XG,{controlsRef:s,zoomMin:e,zoomMax:t,baseDistance:l,autoRotateSpeed:w,enabled:p,onStart:_,onEnd:M}),Rt.jsx(WG,{controlsRef:s,onFitReady:A,zoomMin:e})]})}function jG({blobUrl:n,zoomMin:e,zoomMax:t,onModelReady:i,fileType:r}){const s=se.useMemo(()=>r||(n?"gltf":null),[n,r]);return Rt.jsxs(Rt.Fragment,{children:[Rt.jsx("ambientLight",{intensity:.8}),Rt.jsx("directionalLight",{position:[5,5,5],intensity:1}),n&&Rt.jsx(se.Suspense,{fallback:null,children:Rt.jsx(JG,{url:n,zoomMin:e,zoomMax:t,fileType:s,onReady:i})})]})}function KG(){const n=new URLSearchParams(window.location.search),e=n.get("src")||"",t=Number(n.get("min")),i=Number(n.get("max")),r=Number.isFinite(t)&&t>0?t:.01,s=Number.isFinite(i)&&i>0?i:4;let o=Math.min(r,s);const a=Math.max(r,s);o=Math.min(1,o);const l=n.get("progressColor");return console.log("当前参数:src:",e),console.log("当前参数:srzoomMinc:",o),console.log("当前参数:zoomMax:",a),console.log("当前参数:progressColor:",l),{src:e,zoomMin:o,zoomMax:a,progressColor:l}}function YG(){const{src:n,zoomMin:e,zoomMax:t,progressColor:i}=se.useMemo(()=>KG(),[]),r=OG(n),[s,o]=se.useState(!1),a=se.useMemo(()=>{if(!n)return"gltf";const l=n.toLowerCase().split("?")[0];return l.endsWith(".fbx")?"fbx":l.endsWith(".usdz")?"usdz":"gltf"},[n]);return se.useEffect(()=>{console.log("%c╔════════════════════════════════════════════","color: #ff6b6b; font-weight: bold; font-size: 12px;"),console.log("%c示例链接:http://localhost:5173/?src=https://houseoss.4dkankan.com/project/DEMO/usdz/static/yw2-196-high.glb&progressColor=yellow&min=0.1&max=20","color: #ff6b6b; font-weight: bold; font-size: 12px;"),console.log("%csrc:完整模型路径,支持glb/gltf,fbx格式","color: #ff6b6b; font-weight: bold; font-size: 12px;"),console.log("%cprogressColor:进度条背景色 ","color: #ff6b6b; font-weight: bold; font-size: 12px;"),console.log("%cmin:可缩小的最小倍数。默认0.01,选值区间[0.01,1] ","color: #ff6b6b; font-weight: bold; font-size: 12px;"),console.log("%cmax:可放大的最大倍数。默认4,选值区间[1,∞] ","color: #ff6b6b; font-weight: bold; font-size: 12px;"),console.log("%c╚════════════════════════════════════════════","color: #ff6b6b; font-weight: bold; font-size: 12px;")},[]),Rt.jsxs("div",{style:{width:"100vw",height:"100vh"},children:[Rt.jsx(kG,{fetchState:r,isModelReady:s,color:i,active:!!n}),Rt.jsx(qk,{dpr:[1,2],gl:{antialias:!0},style:{touchAction:"none",opacity:s?1:0,transition:"opacity 1s ease-in-out"},children:r.blobUrl?Rt.jsx(jG,{blobUrl:r.blobUrl,fileType:a,zoomMin:e,zoomMax:t,progressColor:i,onModelReady:()=>o(!0)}):!n&&Rt.jsx(lz,{center:!0,style:{width:"200px",color:"#222",fontSize:14},children:"请在地址栏提供 ?src=GLB地址"})})]})}dx(document.getElementById("root")).render(Rt.jsx(YG,{}));
|