@tresjs_cientos.js 563 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539
  1. import {
  2. ACESFilmicToneMapping,
  3. AmbientLight,
  4. AnimationClip,
  5. AnimationMixer,
  6. Bone,
  7. Box3,
  8. BoxGeometry,
  9. BufferAttribute,
  10. BufferGeometry,
  11. ClampToEdgeWrapping,
  12. Clock,
  13. Color,
  14. CubeReflectionMapping,
  15. CubeTextureLoader,
  16. Curve,
  17. CylinderGeometry,
  18. DataTextureLoader,
  19. DataUtils,
  20. DirectionalLight,
  21. DoubleSide,
  22. EquirectangularReflectionMapping,
  23. Euler,
  24. EventDispatcher,
  25. ExtrudeGeometry,
  26. FileLoader,
  27. Float32BufferAttribute,
  28. FloatType,
  29. FrontSide,
  30. Group,
  31. HalfFloatType,
  32. ImageBitmapLoader,
  33. InterleavedBuffer,
  34. InterleavedBufferAttribute,
  35. Interpolant,
  36. InterpolateDiscrete,
  37. InterpolateLinear,
  38. Line,
  39. LineBasicMaterial,
  40. LineLoop,
  41. LineSegments,
  42. LinearEncoding,
  43. LinearFilter,
  44. LinearMipmapLinearFilter,
  45. LinearMipmapNearestFilter,
  46. Loader,
  47. LoaderUtils,
  48. MOUSE,
  49. Material,
  50. MathUtils,
  51. Matrix3,
  52. Matrix4,
  53. Mesh,
  54. MeshBasicMaterial,
  55. MeshLambertMaterial,
  56. MeshPhongMaterial,
  57. MeshPhysicalMaterial,
  58. MeshStandardMaterial,
  59. MirroredRepeatWrapping,
  60. NearestFilter,
  61. NearestMipmapLinearFilter,
  62. NearestMipmapNearestFilter,
  63. NoToneMapping,
  64. NumberKeyframeTrack,
  65. Object3D,
  66. OctahedronGeometry,
  67. OrthographicCamera,
  68. PCFShadowMap,
  69. PCFSoftShadowMap,
  70. PerspectiveCamera,
  71. PlaneGeometry,
  72. PointLight,
  73. Points,
  74. PointsMaterial,
  75. PropertyBinding,
  76. QuadraticBezierCurve3,
  77. Quaternion,
  78. QuaternionKeyframeTrack,
  79. Raycaster,
  80. RepeatWrapping,
  81. Scene,
  82. ShapePath,
  83. Skeleton,
  84. SkinnedMesh,
  85. Sphere,
  86. SphereGeometry,
  87. Spherical,
  88. SpotLight,
  89. TOUCH,
  90. TangentSpaceNormalMap,
  91. Texture,
  92. TextureLoader,
  93. TorusGeometry,
  94. TriangleFanDrawMode,
  95. TriangleStripDrawMode,
  96. Uint16BufferAttribute,
  97. Vector2,
  98. Vector3,
  99. Vector4,
  100. VectorKeyframeTrack,
  101. WebGLRenderer,
  102. sRGBEncoding,
  103. three_module_exports
  104. } from "./chunk-4QXXOI63.js";
  105. import {
  106. computed,
  107. createBlock,
  108. createCommentVNode,
  109. createRenderer,
  110. createVNode,
  111. defineComponent,
  112. getCurrentInstance,
  113. getCurrentScope,
  114. h,
  115. inject,
  116. mergeProps,
  117. nextTick,
  118. onMounted,
  119. onScopeDispose,
  120. onUnmounted,
  121. openBlock,
  122. readonly,
  123. ref,
  124. renderSlot,
  125. resolveComponent,
  126. shallowReactive,
  127. shallowRef,
  128. toRef,
  129. toRefs,
  130. unref,
  131. useSlots,
  132. watch,
  133. watchEffect,
  134. withAsyncContext,
  135. withCtx
  136. } from "./chunk-LZPJ5JBW.js";
  137. import "./chunk-JC4IRQUL.js";
  138. // node_modules/.pnpm/@vueuse+shared@9.13.0_vue@3.2.47/node_modules/@vueuse/shared/index.mjs
  139. var _a;
  140. var isClient = typeof window !== "undefined";
  141. var isFunction = (val) => typeof val === "function";
  142. var isString = (val) => typeof val === "string";
  143. var noop = () => {
  144. };
  145. var isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  146. function resolveUnref(r) {
  147. return typeof r === "function" ? r() : unref(r);
  148. }
  149. function identity(arg) {
  150. return arg;
  151. }
  152. function tryOnScopeDispose(fn) {
  153. if (getCurrentScope()) {
  154. onScopeDispose(fn);
  155. return true;
  156. }
  157. return false;
  158. }
  159. function createEventHook() {
  160. const fns = [];
  161. const off = (fn) => {
  162. const index = fns.indexOf(fn);
  163. if (index !== -1)
  164. fns.splice(index, 1);
  165. };
  166. const on = (fn) => {
  167. fns.push(fn);
  168. const offFn = () => off(fn);
  169. tryOnScopeDispose(offFn);
  170. return {
  171. off: offFn
  172. };
  173. };
  174. const trigger = (param) => {
  175. fns.forEach((fn) => fn(param));
  176. };
  177. return {
  178. on,
  179. off,
  180. trigger
  181. };
  182. }
  183. function tryOnMounted(fn, sync = true) {
  184. if (getCurrentInstance())
  185. onMounted(fn);
  186. else if (sync)
  187. fn();
  188. else
  189. nextTick(fn);
  190. }
  191. // node_modules/.pnpm/@vueuse+core@9.13.0_vue@3.2.47/node_modules/@vueuse/core/index.mjs
  192. function unrefElement(elRef) {
  193. var _a3;
  194. const plain = resolveUnref(elRef);
  195. return (_a3 = plain == null ? void 0 : plain.$el) != null ? _a3 : plain;
  196. }
  197. var defaultWindow = isClient ? window : void 0;
  198. var defaultDocument = isClient ? window.document : void 0;
  199. var defaultNavigator = isClient ? window.navigator : void 0;
  200. var defaultLocation = isClient ? window.location : void 0;
  201. function useEventListener(...args) {
  202. let target;
  203. let events;
  204. let listeners;
  205. let options;
  206. if (isString(args[0]) || Array.isArray(args[0])) {
  207. [events, listeners, options] = args;
  208. target = defaultWindow;
  209. } else {
  210. [target, events, listeners, options] = args;
  211. }
  212. if (!target)
  213. return noop;
  214. if (!Array.isArray(events))
  215. events = [events];
  216. if (!Array.isArray(listeners))
  217. listeners = [listeners];
  218. const cleanups = [];
  219. const cleanup = () => {
  220. cleanups.forEach((fn) => fn());
  221. cleanups.length = 0;
  222. };
  223. const register = (el2, event, listener, options2) => {
  224. el2.addEventListener(event, listener, options2);
  225. return () => el2.removeEventListener(event, listener, options2);
  226. };
  227. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el2, options2]) => {
  228. cleanup();
  229. if (!el2)
  230. return;
  231. cleanups.push(...events.flatMap((event) => {
  232. return listeners.map((listener) => register(el2, event, listener, options2));
  233. }));
  234. }, { immediate: true, flush: "post" });
  235. const stop = () => {
  236. stopWatch();
  237. cleanup();
  238. };
  239. tryOnScopeDispose(stop);
  240. return stop;
  241. }
  242. function useSupported(callback, sync = false) {
  243. const isSupported = ref();
  244. const update = () => isSupported.value = Boolean(callback());
  245. update();
  246. tryOnMounted(update, sync);
  247. return isSupported;
  248. }
  249. var _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  250. var globalKey = "__vueuse_ssr_handlers__";
  251. _global[globalKey] = _global[globalKey] || {};
  252. var handlers = _global[globalKey];
  253. function useDevicePixelRatio({
  254. window: window2 = defaultWindow
  255. } = {}) {
  256. const pixelRatio = ref(1);
  257. if (window2) {
  258. let observe = function() {
  259. pixelRatio.value = window2.devicePixelRatio;
  260. cleanup();
  261. media = window2.matchMedia(`(resolution: ${pixelRatio.value}dppx)`);
  262. media.addEventListener("change", observe, { once: true });
  263. }, cleanup = function() {
  264. media == null ? void 0 : media.removeEventListener("change", observe);
  265. };
  266. let media;
  267. observe();
  268. tryOnScopeDispose(cleanup);
  269. }
  270. return { pixelRatio };
  271. }
  272. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  273. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  274. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  275. var __objRest$2 = (source, exclude) => {
  276. var target = {};
  277. for (var prop in source)
  278. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  279. target[prop] = source[prop];
  280. if (source != null && __getOwnPropSymbols$g)
  281. for (var prop of __getOwnPropSymbols$g(source)) {
  282. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  283. target[prop] = source[prop];
  284. }
  285. return target;
  286. };
  287. function useResizeObserver(target, callback, options = {}) {
  288. const _a3 = options, { window: window2 = defaultWindow } = _a3, observerOptions = __objRest$2(_a3, ["window"]);
  289. let observer;
  290. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  291. const cleanup = () => {
  292. if (observer) {
  293. observer.disconnect();
  294. observer = void 0;
  295. }
  296. };
  297. const stopWatch = watch(() => unrefElement(target), (el2) => {
  298. cleanup();
  299. if (isSupported.value && window2 && el2) {
  300. observer = new ResizeObserver(callback);
  301. observer.observe(el2, observerOptions);
  302. }
  303. }, { immediate: true, flush: "post" });
  304. const stop = () => {
  305. cleanup();
  306. stopWatch();
  307. };
  308. tryOnScopeDispose(stop);
  309. return {
  310. isSupported,
  311. stop
  312. };
  313. }
  314. function useRafFn(fn, options = {}) {
  315. const {
  316. immediate = true,
  317. window: window2 = defaultWindow
  318. } = options;
  319. const isActive = ref(false);
  320. let previousFrameTimestamp = 0;
  321. let rafId = null;
  322. function loop(timestamp2) {
  323. if (!isActive.value || !window2)
  324. return;
  325. const delta = timestamp2 - previousFrameTimestamp;
  326. fn({ delta, timestamp: timestamp2 });
  327. previousFrameTimestamp = timestamp2;
  328. rafId = window2.requestAnimationFrame(loop);
  329. }
  330. function resume() {
  331. if (!isActive.value && window2) {
  332. isActive.value = true;
  333. rafId = window2.requestAnimationFrame(loop);
  334. }
  335. }
  336. function pause() {
  337. isActive.value = false;
  338. if (rafId != null && window2) {
  339. window2.cancelAnimationFrame(rafId);
  340. rafId = null;
  341. }
  342. }
  343. if (immediate)
  344. resume();
  345. tryOnScopeDispose(pause);
  346. return {
  347. isActive: readonly(isActive),
  348. pause,
  349. resume
  350. };
  351. }
  352. function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
  353. const { window: window2 = defaultWindow, box = "content-box" } = options;
  354. const isSVG = computed(() => {
  355. var _a3, _b;
  356. return (_b = (_a3 = unrefElement(target)) == null ? void 0 : _a3.namespaceURI) == null ? void 0 : _b.includes("svg");
  357. });
  358. const width = ref(initialSize.width);
  359. const height = ref(initialSize.height);
  360. useResizeObserver(target, ([entry]) => {
  361. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  362. if (window2 && isSVG.value) {
  363. const $elem = unrefElement(target);
  364. if ($elem) {
  365. const styles = window2.getComputedStyle($elem);
  366. width.value = parseFloat(styles.width);
  367. height.value = parseFloat(styles.height);
  368. }
  369. } else {
  370. if (boxSize) {
  371. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  372. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  373. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  374. } else {
  375. width.value = entry.contentRect.width;
  376. height.value = entry.contentRect.height;
  377. }
  378. }
  379. }, options);
  380. watch(() => unrefElement(target), (ele) => {
  381. width.value = ele ? initialSize.width : 0;
  382. height.value = ele ? initialSize.height : 0;
  383. });
  384. return {
  385. width,
  386. height
  387. };
  388. }
  389. var defaultState = {
  390. x: 0,
  391. y: 0,
  392. pointerId: 0,
  393. pressure: 0,
  394. tiltX: 0,
  395. tiltY: 0,
  396. width: 0,
  397. height: 0,
  398. twist: 0,
  399. pointerType: null
  400. };
  401. var keys = Object.keys(defaultState);
  402. var SwipeDirection;
  403. (function(SwipeDirection2) {
  404. SwipeDirection2["UP"] = "UP";
  405. SwipeDirection2["RIGHT"] = "RIGHT";
  406. SwipeDirection2["DOWN"] = "DOWN";
  407. SwipeDirection2["LEFT"] = "LEFT";
  408. SwipeDirection2["NONE"] = "NONE";
  409. })(SwipeDirection || (SwipeDirection = {}));
  410. var __defProp = Object.defineProperty;
  411. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  412. var __hasOwnProp = Object.prototype.hasOwnProperty;
  413. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  414. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  415. var __spreadValues = (a, b2) => {
  416. for (var prop in b2 || (b2 = {}))
  417. if (__hasOwnProp.call(b2, prop))
  418. __defNormalProp(a, prop, b2[prop]);
  419. if (__getOwnPropSymbols)
  420. for (var prop of __getOwnPropSymbols(b2)) {
  421. if (__propIsEnum.call(b2, prop))
  422. __defNormalProp(a, prop, b2[prop]);
  423. }
  424. return a;
  425. };
  426. var _TransitionPresets = {
  427. easeInSine: [0.12, 0, 0.39, 0],
  428. easeOutSine: [0.61, 1, 0.88, 1],
  429. easeInOutSine: [0.37, 0, 0.63, 1],
  430. easeInQuad: [0.11, 0, 0.5, 0],
  431. easeOutQuad: [0.5, 1, 0.89, 1],
  432. easeInOutQuad: [0.45, 0, 0.55, 1],
  433. easeInCubic: [0.32, 0, 0.67, 0],
  434. easeOutCubic: [0.33, 1, 0.68, 1],
  435. easeInOutCubic: [0.65, 0, 0.35, 1],
  436. easeInQuart: [0.5, 0, 0.75, 0],
  437. easeOutQuart: [0.25, 1, 0.5, 1],
  438. easeInOutQuart: [0.76, 0, 0.24, 1],
  439. easeInQuint: [0.64, 0, 0.78, 0],
  440. easeOutQuint: [0.22, 1, 0.36, 1],
  441. easeInOutQuint: [0.83, 0, 0.17, 1],
  442. easeInExpo: [0.7, 0, 0.84, 0],
  443. easeOutExpo: [0.16, 1, 0.3, 1],
  444. easeInOutExpo: [0.87, 0, 0.13, 1],
  445. easeInCirc: [0.55, 0, 1, 0.45],
  446. easeOutCirc: [0, 0.55, 0.45, 1],
  447. easeInOutCirc: [0.85, 0, 0.15, 1],
  448. easeInBack: [0.36, 0, 0.66, -0.56],
  449. easeOutBack: [0.34, 1.56, 0.64, 1],
  450. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  451. };
  452. var TransitionPresets = __spreadValues({
  453. linear: identity
  454. }, _TransitionPresets);
  455. function useWindowSize(options = {}) {
  456. const {
  457. window: window2 = defaultWindow,
  458. initialWidth = Infinity,
  459. initialHeight = Infinity,
  460. listenOrientation = true,
  461. includeScrollbar = true
  462. } = options;
  463. const width = ref(initialWidth);
  464. const height = ref(initialHeight);
  465. const update = () => {
  466. if (window2) {
  467. if (includeScrollbar) {
  468. width.value = window2.innerWidth;
  469. height.value = window2.innerHeight;
  470. } else {
  471. width.value = window2.document.documentElement.clientWidth;
  472. height.value = window2.document.documentElement.clientHeight;
  473. }
  474. }
  475. };
  476. update();
  477. tryOnMounted(update);
  478. useEventListener("resize", update, { passive: true });
  479. if (listenOrientation)
  480. useEventListener("orientationchange", update, { passive: true });
  481. return { width, height };
  482. }
  483. // node_modules/.pnpm/@tresjs+core@2.0.0-alpha.1_three@0.150.1+vue@3.2.47/node_modules/@tresjs/core/dist/tres.js
  484. var G = ref({ uuid: MathUtils.generateUUID() });
  485. var se = (e) => void Object.assign(G.value, e);
  486. var Ne = ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Ne || {});
  487. var qe = 45;
  488. var y;
  489. function ce() {
  490. const { state: e, setState: t, aspectRatio: r } = L();
  491. function o(a = "Perspective", s) {
  492. var l, p, m;
  493. if (a === "Perspective") {
  494. const { near: d, far: w, fov: v } = s || {
  495. near: 0.1,
  496. far: 1e3,
  497. fov: qe
  498. };
  499. y = new PerspectiveCamera(v, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, d, w), (p = e.cameras) == null || p.push(y);
  500. } else {
  501. const { left: d, right: w, top: v, bottom: g, near: E, far: x } = s || {
  502. left: -100,
  503. right: 100,
  504. top: 100,
  505. bottom: -100,
  506. near: 0.1,
  507. far: 1e3
  508. };
  509. y = new OrthographicCamera(d, w, v, g, E, x), (m = e.cameras) == null || m.push(y);
  510. }
  511. return e.camera = y, t("camera", e.camera), y;
  512. }
  513. function n() {
  514. var a;
  515. e.camera instanceof PerspectiveCamera && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (a = e.camera) == null || a.updateProjectionMatrix();
  516. }
  517. function i(a) {
  518. var s;
  519. (s = e.cameras) == null || s.push(a), a instanceof PerspectiveCamera && e.aspectRatio && (a.aspect = e.aspectRatio.value), a.updateProjectionMatrix(), t("camera", a);
  520. }
  521. function c() {
  522. e.cameras = [];
  523. }
  524. return watchEffect(() => {
  525. r != null && r.value && n();
  526. }), {
  527. activeCamera: toRef(e, "camera"),
  528. createCamera: o,
  529. updateCamera: n,
  530. pushCamera: i,
  531. clearCameras: c
  532. };
  533. }
  534. var ue = createEventHook();
  535. var le = createEventHook();
  536. var V = createEventHook();
  537. var b = new Clock();
  538. var A = 0;
  539. var k = 0;
  540. var { pause: Je, resume: Ke, isActive: Xe } = useRafFn(
  541. () => {
  542. ue.trigger({ delta: A, elapsed: k, clock: b }), le.trigger({ delta: A, elapsed: k, clock: b }), V.trigger({ delta: A, elapsed: k, clock: b });
  543. },
  544. { immediate: false }
  545. );
  546. V.on(() => {
  547. A = b.getDelta(), k = b.getElapsedTime();
  548. });
  549. function $() {
  550. return {
  551. onBeforeLoop: ue.on,
  552. onLoop: le.on,
  553. onAfterLoop: V.on,
  554. pause: Je,
  555. resume: Ke,
  556. isActive: Xe
  557. };
  558. }
  559. function Ye(e) {
  560. return e instanceof Color ? e : Array.isArray(e) ? new Color(...e) : new Color(e);
  561. }
  562. var B = {
  563. realistic: {
  564. outputEncoding: sRGBEncoding,
  565. toneMapping: ACESFilmicToneMapping,
  566. toneMappingExposure: 3,
  567. shadowMap: {
  568. enabled: true,
  569. type: PCFSoftShadowMap
  570. }
  571. }
  572. };
  573. var fe = (e, t) => {
  574. for (const r of Object.keys(t))
  575. t[r] instanceof Object && Object.assign(t[r], fe(e[r], t[r]));
  576. return Object.assign(e || {}, t), e;
  577. };
  578. var Qe = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  579. var Ze = et(Qe);
  580. function I(e) {
  581. return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
  582. }
  583. function et(e, t) {
  584. const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
  585. for (let n = 0; n < o.length; n++)
  586. r[o[n]] = true;
  587. return t ? (n) => !!r[n.toLowerCase()] : (n) => !!r[n];
  588. }
  589. var f = shallowRef();
  590. var H = ref(false);
  591. function tt(e, t, r) {
  592. const {
  593. alpha: o = true,
  594. antialias: n = true,
  595. depth: i,
  596. logarithmicDepthBuffer: c,
  597. failIfMajorPerformanceCaveat: a,
  598. precision: s,
  599. premultipliedAlpha: l,
  600. stencil: p,
  601. shadows: m = false,
  602. shadowMapType: d = PCFShadowMap,
  603. physicallyCorrectLights: w = false,
  604. useLegacyLights: v = false,
  605. outputEncoding: g = LinearEncoding,
  606. toneMapping: E = NoToneMapping,
  607. toneMappingExposure: x = 1,
  608. context: de = void 0,
  609. powerPreference: ve = "default",
  610. preserveDrawingBuffer: ge = false,
  611. clearColor: C,
  612. windowSize: we = false,
  613. preset: he = void 0
  614. } = toRefs(r), { setState: D } = L(), { width: N, height: q } = resolveUnref(we) ? useWindowSize() : useElementSize(t), { logError: ye } = j(), { pixelRatio: J } = useDevicePixelRatio(), { pause: Me, resume: Ce } = $(), F = computed(() => N.value / q.value), K = () => {
  615. f.value && (f.value.setSize(N.value, q.value), f.value.setPixelRatio(Math.min(J.value, 2)));
  616. }, X = () => {
  617. if (!f.value)
  618. return;
  619. const h2 = resolveUnref(he);
  620. if (h2) {
  621. h2 in B || ye("Renderer Preset must be one of these: " + Object.keys(B).join(", ")), fe(f.value, B[h2]);
  622. return;
  623. }
  624. f.value.shadowMap.enabled = resolveUnref(m), f.value.shadowMap.type = resolveUnref(d), f.value.toneMapping = resolveUnref(E) || NoToneMapping, f.value.toneMappingExposure = resolveUnref(x), f.value.outputEncoding = resolveUnref(g) || LinearEncoding, C != null && C.value && f.value.setClearColor(Ye(resolveUnref(C))), f.value.useLegacyLights = resolveUnref(v);
  625. }, be = () => {
  626. const h2 = unrefElement(e);
  627. h2 && (f.value = new WebGLRenderer({
  628. canvas: h2,
  629. alpha: resolveUnref(o),
  630. antialias: resolveUnref(n),
  631. context: resolveUnref(de),
  632. depth: resolveUnref(i),
  633. failIfMajorPerformanceCaveat: resolveUnref(a),
  634. logarithmicDepthBuffer: resolveUnref(c),
  635. powerPreference: resolveUnref(ve),
  636. precision: resolveUnref(s),
  637. stencil: resolveUnref(p),
  638. preserveDrawingBuffer: resolveUnref(ge),
  639. premultipliedAlpha: resolveUnref(l)
  640. }), D("renderer", f.value), D("clock", new Clock()), D("aspectRatio", F), X(), K(), Ce(), H.value = true);
  641. }, Le2 = () => {
  642. f.value && (f.value.dispose(), f.value = void 0, H.value = false, Me());
  643. };
  644. return watch([F, J], K), watch(
  645. [m, d, g, v, E, x, C],
  646. X
  647. ), watch(
  648. () => [e, t],
  649. () => {
  650. unrefElement(e) && unrefElement(t) && be();
  651. },
  652. { immediate: true, deep: true }
  653. ), {
  654. renderer: f,
  655. isReady: H,
  656. dispose: Le2,
  657. aspectRatio: F
  658. };
  659. }
  660. var pe = (e) => !!e && e.constructor === Array;
  661. function nt(e) {
  662. const t = { nodes: {}, materials: {} };
  663. return e && e.traverse((r) => {
  664. r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
  665. }), t;
  666. }
  667. async function dt(e, t, r, o, n) {
  668. const { logError: i } = j(), c = new e();
  669. n && n(c), r && r(c);
  670. const s = (Array.isArray(t) ? t : [t]).map(
  671. (l) => new Promise((p, m) => {
  672. c.load(
  673. l,
  674. (d) => {
  675. d.scene && Object.assign(d, nt(d.scene)), p(d);
  676. },
  677. o,
  678. (d) => m(i("[useLoader] - Failed to load resource", d))
  679. );
  680. })
  681. );
  682. return pe(t) ? await Promise.all(s) : await s[0];
  683. }
  684. var R = shallowReactive({
  685. camera: void 0,
  686. cameras: [],
  687. aspectRatio: computed(() => window.innerWidth / window.innerHeight)
  688. });
  689. function L() {
  690. function e(r) {
  691. return R[r];
  692. }
  693. function t(r, o) {
  694. R[r] = o;
  695. }
  696. return {
  697. state: R,
  698. ...toRefs(R),
  699. getState: e,
  700. setState: t
  701. };
  702. }
  703. var ee = shallowRef(new Raycaster());
  704. var S = ref(new Vector2());
  705. var at = ref(null);
  706. function me() {
  707. const { setState: e } = L();
  708. e("raycaster", ee.value), e("pointer", S), e("currentInstance", at);
  709. function t(r) {
  710. S.value.x = r.clientX / window.innerWidth * 2 - 1, S.value.y = -(r.clientY / window.innerHeight) * 2 + 1;
  711. }
  712. return window.addEventListener("pointermove", t), {
  713. raycaster: ee,
  714. pointer: S
  715. };
  716. }
  717. var te = "[TresJS ▲ ■ ●] ";
  718. function j() {
  719. function e(o, n) {
  720. console.error(`${te} ${o}`, n || "");
  721. }
  722. function t(o) {
  723. console.warn(`${te} ${o}`);
  724. }
  725. function r(o, n) {
  726. }
  727. return {
  728. logError: e,
  729. logWarning: t,
  730. logMessage: r
  731. };
  732. }
  733. var { logWarning: rt } = j();
  734. function ot(e) {
  735. for (const t in e)
  736. if (t.indexOf("on") === 0)
  737. return true;
  738. return false;
  739. }
  740. var T = null;
  741. var it = {
  742. createElement(e, t, r, o) {
  743. if (e === "template" || Ze(e))
  744. return null;
  745. let n;
  746. if (o === null && (o = {}), o != null && o.args ? n = new G.value[e.replace("Tres", "")](...o.args) : n = new G.value[e.replace("Tres", "")](), n.isCamera) {
  747. (!(o != null && o.position) || o != null && o.position.every((c) => c == 0)) && rt(
  748. // eslint-disable-next-line max-len
  749. "Camera is positioned at the center of the scene [0,0,0], if this is not intentional try setting a position if your scene seems empty 🤗"
  750. );
  751. const { pushCamera: i } = ce();
  752. i(n);
  753. }
  754. return (o == null ? void 0 : o.attach) === void 0 && (n.isMaterial ? n.attach = "material" : n.isBufferGeometry && (n.attach = "geometry")), n;
  755. },
  756. insert(e, t, r) {
  757. if (T === null && t.isScene && (T = t), t === null && (t = T), t != null && t.isObject3D && (e != null && e.isObject3D)) {
  758. const a = r ? t.children.indexOf(r) : 0;
  759. e.parent = t, t.children.splice(a, 0, e), e.dispatchEvent({ type: "added" });
  760. } else
  761. typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
  762. const { onLoop: o } = $();
  763. let n = null, i = null;
  764. const { raycaster: c } = me();
  765. e && e instanceof Mesh && ot(e) && (o(() => {
  766. var a, s, l;
  767. if (t != null && t.children && e && c) {
  768. const p = c.value.intersectObjects(t.children);
  769. p.length > 0 && p[0].object.uuid === e.uuid ? (i = p[0], (n === null || n.object.uuid !== (i == null ? void 0 : i.object.uuid)) && ((a = e.onPointerEnter) == null || a.call(e, i)), (s = e.onPointerMove) == null || s.call(e, i)) : (i = null, n !== null && ((l = e.onPointerLeave) == null || l.call(e, n))), n = i;
  770. }
  771. }), useEventListener(window, "click", () => {
  772. var a;
  773. i !== null && ((a = e.onClick) == null || a.call(e, i));
  774. }));
  775. },
  776. remove(e) {
  777. if (!e)
  778. return;
  779. const t = e.parentNode;
  780. t && t.removeChild(e);
  781. },
  782. patchProp(e, t, r, o) {
  783. if (e) {
  784. let n = e, i = t;
  785. const c = I(i);
  786. let a = n == null ? void 0 : n[c];
  787. if (e.parent || (e.parent = T), i.includes("-") && a === void 0) {
  788. const l = i.split("-");
  789. a = l.reduce((p, m) => p[I(m)], n), i = l.pop(), a != null && a.set || (n = l.reduce((p, m) => p[I(m)], n));
  790. }
  791. let s = o;
  792. if (s === "" && (s = true), isFunction(a))
  793. return;
  794. !(a != null && a.set) && !isFunction(a) ? n[c] = s : a.constructor === s.constructor && (a != null && a.copy) ? a == null || a.copy(s) : Array.isArray(s) ? a.set(...s) : !a.isColor && a.setScalar ? a.setScalar(s) : a.set(s);
  795. }
  796. },
  797. parentNode(e) {
  798. return (e == null ? void 0 : e.parent) || null;
  799. },
  800. createText: () => void 0,
  801. createComment: () => void 0,
  802. setText: () => void 0,
  803. setElementText: () => void 0,
  804. nextSibling: () => void 0,
  805. querySelector: () => void 0,
  806. setScopeId: () => void 0,
  807. cloneNode: () => void 0,
  808. insertStaticContent: () => void 0
  809. };
  810. var { createApp: st } = createRenderer(it);
  811. var ct = (e) => {
  812. const t = st(r);
  813. function r() {
  814. return e && e.default ? e.default() : [];
  815. }
  816. return t;
  817. };
  818. se(three_module_exports);
  819. var { logWarning: ut } = j();
  820. var lt = defineComponent({
  821. name: "TresCanvas",
  822. props: [
  823. "shadows",
  824. "shadowMapType",
  825. "physicallyCorrectLights",
  826. "useLegacyLights",
  827. "outputEncoding",
  828. "toneMapping",
  829. "toneMappingExposure",
  830. "context",
  831. "powerPreference",
  832. "preserveDrawingBuffer",
  833. "clearColor",
  834. "windowSize",
  835. "preset"
  836. ],
  837. setup(e, { slots: t, expose: r }) {
  838. e.physicallyCorrectLights === true && ut("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
  839. const o = ref(), n = ref(), i = new Scene(), { setState: c } = L();
  840. c("scene", i);
  841. function a() {
  842. const { renderer: p } = tt(n, o, e), { activeCamera: m } = ce(), { onLoop: d } = $(), { raycaster: w, pointer: v } = me();
  843. d(() => {
  844. var g;
  845. m.value && (w.value.setFromCamera(v.value, m.value), (g = p.value) == null || g.render(i, m.value));
  846. });
  847. }
  848. watch(n, a);
  849. let s;
  850. function l() {
  851. s = ct(t), s.provide("useTres", L()), s.provide("extend", se), s.mount(i);
  852. }
  853. return l(), r({
  854. scene: i
  855. }), () => h(
  856. h(
  857. "div",
  858. {
  859. ref: o,
  860. style: {
  861. position: "relative",
  862. width: "100%",
  863. height: "100%",
  864. pointerEvents: "auto",
  865. touchAction: "none"
  866. }
  867. },
  868. [
  869. h(
  870. "div",
  871. {
  872. style: {
  873. width: "100%",
  874. height: "100%"
  875. }
  876. },
  877. [
  878. h("canvas", {
  879. ref: n,
  880. style: {
  881. display: "block",
  882. width: "100%",
  883. height: "100%",
  884. position: e.windowSize ? "fixed" : "absolute",
  885. top: 0,
  886. left: 0
  887. }
  888. })
  889. ]
  890. )
  891. ]
  892. )
  893. );
  894. }
  895. });
  896. // node_modules/.pnpm/@tresjs+cientos@2.0.0-alpha.1_three@0.150.1/node_modules/@tresjs/cientos/dist/trescientos.js
  897. function Bp(b2, i) {
  898. for (var r = 0; r < i.length; r++) {
  899. const s = i[r];
  900. if (typeof s != "string" && !Array.isArray(s)) {
  901. for (const a in s)
  902. if (a !== "default" && !(a in b2)) {
  903. const c = Object.getOwnPropertyDescriptor(s, a);
  904. c && Object.defineProperty(b2, a, c.get ? c : {
  905. enumerable: true,
  906. get: () => s[a]
  907. });
  908. }
  909. }
  910. }
  911. return Object.freeze(Object.defineProperty(b2, Symbol.toStringTag, { value: "Module" }));
  912. }
  913. function Ji(b2) {
  914. return Ji = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
  915. return typeof i;
  916. } : function(i) {
  917. return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
  918. }, Ji(b2);
  919. }
  920. function jp(b2, i) {
  921. if (Ji(b2) !== "object" || b2 === null)
  922. return b2;
  923. var r = b2[Symbol.toPrimitive];
  924. if (r !== void 0) {
  925. var s = r.call(b2, i || "default");
  926. if (Ji(s) !== "object")
  927. return s;
  928. throw new TypeError("@@toPrimitive must return a primitive value.");
  929. }
  930. return (i === "string" ? String : Number)(b2);
  931. }
  932. function zp(b2) {
  933. var i = jp(b2, "string");
  934. return Ji(i) === "symbol" ? i : String(i);
  935. }
  936. function T2(b2, i, r) {
  937. return i = zp(i), i in b2 ? Object.defineProperty(b2, i, {
  938. value: r,
  939. enumerable: true,
  940. configurable: true,
  941. writable: true
  942. }) : b2[i] = r, b2;
  943. }
  944. var mt = Uint8Array;
  945. var an = Uint16Array;
  946. var co = Uint32Array;
  947. var Ua = new mt([
  948. 0,
  949. 0,
  950. 0,
  951. 0,
  952. 0,
  953. 0,
  954. 0,
  955. 0,
  956. 1,
  957. 1,
  958. 1,
  959. 1,
  960. 2,
  961. 2,
  962. 2,
  963. 2,
  964. 3,
  965. 3,
  966. 3,
  967. 3,
  968. 4,
  969. 4,
  970. 4,
  971. 4,
  972. 5,
  973. 5,
  974. 5,
  975. 5,
  976. 0,
  977. /* unused */
  978. 0,
  979. 0,
  980. /* impossible */
  981. 0
  982. ]);
  983. var Ga = new mt([
  984. 0,
  985. 0,
  986. 0,
  987. 0,
  988. 1,
  989. 1,
  990. 2,
  991. 2,
  992. 3,
  993. 3,
  994. 4,
  995. 4,
  996. 5,
  997. 5,
  998. 6,
  999. 6,
  1000. 7,
  1001. 7,
  1002. 8,
  1003. 8,
  1004. 9,
  1005. 9,
  1006. 10,
  1007. 10,
  1008. 11,
  1009. 11,
  1010. 12,
  1011. 12,
  1012. 13,
  1013. 13,
  1014. /* unused */
  1015. 0,
  1016. 0
  1017. ]);
  1018. var Up = new mt([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  1019. var Ha = function(b2, i) {
  1020. for (var r = new an(31), s = 0; s < 31; ++s)
  1021. r[s] = i += 1 << b2[s - 1];
  1022. for (var a = new co(r[30]), s = 1; s < 30; ++s)
  1023. for (var c = r[s]; c < r[s + 1]; ++c)
  1024. a[c] = c - r[s] << 5 | s;
  1025. return [r, a];
  1026. };
  1027. var Ka = Ha(Ua, 2);
  1028. var $a = Ka[0];
  1029. var Gp = Ka[1];
  1030. $a[28] = 258, Gp[258] = 28;
  1031. var Hp = Ha(Ga, 0);
  1032. var Kp = Hp[0];
  1033. var po = new an(32768);
  1034. for (Pe = 0; Pe < 32768; ++Pe) {
  1035. sn = (Pe & 43690) >>> 1 | (Pe & 21845) << 1;
  1036. sn = (sn & 52428) >>> 2 | (sn & 13107) << 2, sn = (sn & 61680) >>> 4 | (sn & 3855) << 4, po[Pe] = ((sn & 65280) >>> 8 | (sn & 255) << 8) >>> 1;
  1037. }
  1038. var sn;
  1039. var Pe;
  1040. var qi = function(b2, i, r) {
  1041. for (var s = b2.length, a = 0, c = new an(i); a < s; ++a)
  1042. ++c[b2[a] - 1];
  1043. var u = new an(i);
  1044. for (a = 0; a < i; ++a)
  1045. u[a] = u[a - 1] + c[a - 1] << 1;
  1046. var h2;
  1047. if (r) {
  1048. h2 = new an(1 << i);
  1049. var d = 15 - i;
  1050. for (a = 0; a < s; ++a)
  1051. if (b2[a])
  1052. for (var g = a << 4 | b2[a], w = i - b2[a], _ = u[b2[a] - 1]++ << w, y2 = _ | (1 << w) - 1; _ <= y2; ++_)
  1053. h2[po[_] >>> d] = g;
  1054. } else
  1055. for (h2 = new an(s), a = 0; a < s; ++a)
  1056. b2[a] && (h2[a] = po[u[b2[a] - 1]++] >>> 15 - b2[a]);
  1057. return h2;
  1058. };
  1059. var ns = new mt(288);
  1060. for (Pe = 0; Pe < 144; ++Pe)
  1061. ns[Pe] = 8;
  1062. var Pe;
  1063. for (Pe = 144; Pe < 256; ++Pe)
  1064. ns[Pe] = 9;
  1065. var Pe;
  1066. for (Pe = 256; Pe < 280; ++Pe)
  1067. ns[Pe] = 7;
  1068. var Pe;
  1069. for (Pe = 280; Pe < 288; ++Pe)
  1070. ns[Pe] = 8;
  1071. var Pe;
  1072. var Xa = new mt(32);
  1073. for (Pe = 0; Pe < 32; ++Pe)
  1074. Xa[Pe] = 5;
  1075. var Pe;
  1076. var $p = qi(ns, 9, 1);
  1077. var Xp = qi(Xa, 5, 1);
  1078. var Zr = function(b2) {
  1079. for (var i = b2[0], r = 1; r < b2.length; ++r)
  1080. b2[r] > i && (i = b2[r]);
  1081. return i;
  1082. };
  1083. var xt = function(b2, i, r) {
  1084. var s = i / 8 | 0;
  1085. return (b2[s] | b2[s + 1] << 8) >> (i & 7) & r;
  1086. };
  1087. var Wr = function(b2, i) {
  1088. var r = i / 8 | 0;
  1089. return (b2[r] | b2[r + 1] << 8 | b2[r + 2] << 16) >> (i & 7);
  1090. };
  1091. var Yp = function(b2) {
  1092. return (b2 / 8 | 0) + (b2 & 7 && 1);
  1093. };
  1094. var qp = function(b2, i, r) {
  1095. (i == null || i < 0) && (i = 0), (r == null || r > b2.length) && (r = b2.length);
  1096. var s = new (b2 instanceof an ? an : b2 instanceof co ? co : mt)(r - i);
  1097. return s.set(b2.subarray(i, r)), s;
  1098. };
  1099. var Qp = function(b2, i, r) {
  1100. var s = b2.length;
  1101. if (!s || r && !r.l && s < 5)
  1102. return i || new mt(0);
  1103. var a = !i || r, c = !r || r.i;
  1104. r || (r = {}), i || (i = new mt(s * 3));
  1105. var u = function(De) {
  1106. var Fe = i.length;
  1107. if (De > Fe) {
  1108. var ye = new mt(Math.max(Fe * 2, De));
  1109. ye.set(i), i = ye;
  1110. }
  1111. }, h2 = r.f || 0, d = r.p || 0, g = r.b || 0, w = r.l, _ = r.d, y2 = r.m, C = r.n, I2 = s * 8;
  1112. do {
  1113. if (!w) {
  1114. r.f = h2 = xt(b2, d, 1);
  1115. var S2 = xt(b2, d + 1, 3);
  1116. if (d += 3, S2)
  1117. if (S2 == 1)
  1118. w = $p, _ = Xp, y2 = 9, C = 5;
  1119. else if (S2 == 2) {
  1120. var V2 = xt(b2, d, 31) + 257, D = xt(b2, d + 10, 15) + 4, Y = V2 + xt(b2, d + 5, 31) + 1;
  1121. d += 14;
  1122. for (var G2 = new mt(Y), N = new mt(19), O = 0; O < D; ++O)
  1123. N[Up[O]] = xt(b2, d + O * 3, 7);
  1124. d += D * 3;
  1125. for (var H2 = Zr(N), K = (1 << H2) - 1, q = qi(N, H2, 1), O = 0; O < Y; ) {
  1126. var he = q[xt(b2, d, K)];
  1127. d += he & 15;
  1128. var R2 = he >>> 4;
  1129. if (R2 < 16)
  1130. G2[O++] = R2;
  1131. else {
  1132. var _e = 0, pe2 = 0;
  1133. for (R2 == 16 ? (pe2 = 3 + xt(b2, d, 3), d += 2, _e = G2[O - 1]) : R2 == 17 ? (pe2 = 3 + xt(b2, d, 7), d += 3) : R2 == 18 && (pe2 = 11 + xt(b2, d, 127), d += 7); pe2--; )
  1134. G2[O++] = _e;
  1135. }
  1136. }
  1137. var fe2 = G2.subarray(0, V2), de = G2.subarray(V2);
  1138. y2 = Zr(fe2), C = Zr(de), w = qi(fe2, y2, 1), _ = qi(de, C, 1);
  1139. } else
  1140. throw "invalid block type";
  1141. else {
  1142. var R2 = Yp(d) + 4, j2 = b2[R2 - 4] | b2[R2 - 3] << 8, F = R2 + j2;
  1143. if (F > s) {
  1144. if (c)
  1145. throw "unexpected EOF";
  1146. break;
  1147. }
  1148. a && u(g + j2), i.set(b2.subarray(R2, F), g), r.b = g += j2, r.p = d = F * 8;
  1149. continue;
  1150. }
  1151. if (d > I2) {
  1152. if (c)
  1153. throw "unexpected EOF";
  1154. break;
  1155. }
  1156. }
  1157. a && u(g + 131072);
  1158. for (var ee2 = (1 << y2) - 1, X = (1 << C) - 1, Te = d; ; Te = d) {
  1159. var _e = w[Wr(b2, d) & ee2], ve = _e >>> 4;
  1160. if (d += _e & 15, d > I2) {
  1161. if (c)
  1162. throw "unexpected EOF";
  1163. break;
  1164. }
  1165. if (!_e)
  1166. throw "invalid length/literal";
  1167. if (ve < 256)
  1168. i[g++] = ve;
  1169. else if (ve == 256) {
  1170. Te = d, w = null;
  1171. break;
  1172. } else {
  1173. var le2 = ve - 254;
  1174. if (ve > 264) {
  1175. var O = ve - 257, ie = Ua[O];
  1176. le2 = xt(b2, d, (1 << ie) - 1) + $a[O], d += ie;
  1177. }
  1178. var ge = _[Wr(b2, d) & X], M = ge >>> 4;
  1179. if (!ge)
  1180. throw "invalid distance";
  1181. d += ge & 15;
  1182. var de = Kp[M];
  1183. if (M > 3) {
  1184. var ie = Ga[M];
  1185. de += Wr(b2, d) & (1 << ie) - 1, d += ie;
  1186. }
  1187. if (d > I2) {
  1188. if (c)
  1189. throw "unexpected EOF";
  1190. break;
  1191. }
  1192. a && u(g + 131072);
  1193. for (var ce2 = g + le2; g < ce2; g += 4)
  1194. i[g] = i[g - de], i[g + 1] = i[g + 1 - de], i[g + 2] = i[g + 2 - de], i[g + 3] = i[g + 3 - de];
  1195. g = ce2;
  1196. }
  1197. }
  1198. r.l = w, r.p = Te, r.b = g, w && (h2 = 1, r.m = y2, r.d = _, r.n = C);
  1199. } while (!h2);
  1200. return g == i.length ? i : qp(i, 0, g);
  1201. };
  1202. var Zp = new mt(0);
  1203. var Wp = function(b2) {
  1204. if ((b2[0] & 15) != 8 || b2[0] >>> 4 > 7 || (b2[0] << 8 | b2[1]) % 31)
  1205. throw "invalid zlib data";
  1206. if (b2[1] & 32)
  1207. throw "invalid zlib data: preset dictionaries not supported";
  1208. };
  1209. function Jp(b2, i) {
  1210. return Qp((Wp(b2), b2.subarray(2, -4)), i);
  1211. }
  1212. var eu = typeof TextDecoder < "u" && new TextDecoder();
  1213. var tu = 0;
  1214. try {
  1215. eu.decode(Zp, { stream: true }), tu = 1;
  1216. } catch {
  1217. }
  1218. var nu = class extends Object3D {
  1219. // events
  1220. constructor(i, r) {
  1221. super(), T2(this, "isTransformControls", true), T2(this, "visible", false), T2(this, "domElement", void 0), T2(this, "raycaster", new Raycaster()), T2(this, "gizmo", void 0), T2(this, "plane", void 0), T2(this, "tempVector", new Vector3()), T2(this, "tempVector2", new Vector3()), T2(this, "tempQuaternion", new Quaternion()), T2(this, "unit", {
  1222. X: new Vector3(1, 0, 0),
  1223. Y: new Vector3(0, 1, 0),
  1224. Z: new Vector3(0, 0, 1)
  1225. }), T2(this, "pointStart", new Vector3()), T2(this, "pointEnd", new Vector3()), T2(this, "offset", new Vector3()), T2(this, "rotationAxis", new Vector3()), T2(this, "startNorm", new Vector3()), T2(this, "endNorm", new Vector3()), T2(this, "rotationAngle", 0), T2(this, "cameraPosition", new Vector3()), T2(this, "cameraQuaternion", new Quaternion()), T2(this, "cameraScale", new Vector3()), T2(this, "parentPosition", new Vector3()), T2(this, "parentQuaternion", new Quaternion()), T2(this, "parentQuaternionInv", new Quaternion()), T2(this, "parentScale", new Vector3()), T2(this, "worldPositionStart", new Vector3()), T2(this, "worldQuaternionStart", new Quaternion()), T2(this, "worldScaleStart", new Vector3()), T2(this, "worldPosition", new Vector3()), T2(this, "worldQuaternion", new Quaternion()), T2(this, "worldQuaternionInv", new Quaternion()), T2(this, "worldScale", new Vector3()), T2(this, "eye", new Vector3()), T2(this, "positionStart", new Vector3()), T2(this, "quaternionStart", new Quaternion()), T2(this, "scaleStart", new Vector3()), T2(this, "camera", void 0), T2(this, "object", void 0), T2(this, "enabled", true), T2(this, "axis", null), T2(this, "mode", "translate"), T2(this, "translationSnap", null), T2(this, "rotationSnap", null), T2(this, "scaleSnap", null), T2(this, "space", "world"), T2(this, "size", 1), T2(this, "dragging", false), T2(this, "showX", true), T2(this, "showY", true), T2(this, "showZ", true), T2(this, "changeEvent", {
  1226. type: "change"
  1227. }), T2(this, "mouseDownEvent", {
  1228. type: "mouseDown",
  1229. mode: this.mode
  1230. }), T2(this, "mouseUpEvent", {
  1231. type: "mouseUp",
  1232. mode: this.mode
  1233. }), T2(this, "objectChangeEvent", {
  1234. type: "objectChange"
  1235. }), T2(this, "intersectObjectWithRay", (a, c, u) => {
  1236. const h2 = c.intersectObject(a, true);
  1237. for (let d = 0; d < h2.length; d++)
  1238. if (h2[d].object.visible || u)
  1239. return h2[d];
  1240. return false;
  1241. }), T2(this, "attach", (a) => (this.object = a, this.visible = true, this)), T2(this, "detach", () => (this.object = void 0, this.visible = false, this.axis = null, this)), T2(this, "reset", () => this.enabled ? (this.dragging && this.object !== void 0 && (this.object.position.copy(this.positionStart), this.object.quaternion.copy(this.quaternionStart), this.object.scale.copy(this.scaleStart), this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent), this.pointStart.copy(this.pointEnd)), this) : this), T2(this, "updateMatrixWorld", () => {
  1242. this.object !== void 0 && (this.object.updateMatrixWorld(), this.object.parent === null ? console.error("TransformControls: The attached 3D object must be a part of the scene graph.") : this.object.parent.matrixWorld.decompose(this.parentPosition, this.parentQuaternion, this.parentScale), this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this.worldScale), this.parentQuaternionInv.copy(this.parentQuaternion).invert(), this.worldQuaternionInv.copy(this.worldQuaternion).invert()), this.camera.updateMatrixWorld(), this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this.cameraScale), this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(), super.updateMatrixWorld();
  1243. }), T2(this, "pointerHover", (a) => {
  1244. if (this.object === void 0 || this.dragging === true)
  1245. return;
  1246. this.raycaster.setFromCamera(a, this.camera);
  1247. const c = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);
  1248. c ? this.axis = c.object.name : this.axis = null;
  1249. }), T2(this, "pointerDown", (a) => {
  1250. if (!(this.object === void 0 || this.dragging === true || a.button !== 0) && this.axis !== null) {
  1251. this.raycaster.setFromCamera(a, this.camera);
  1252. const c = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  1253. if (c) {
  1254. let u = this.space;
  1255. if (this.mode === "scale" ? u = "local" : (this.axis === "E" || this.axis === "XYZE" || this.axis === "XYZ") && (u = "world"), u === "local" && this.mode === "rotate") {
  1256. const h2 = this.rotationSnap;
  1257. this.axis === "X" && h2 && (this.object.rotation.x = Math.round(this.object.rotation.x / h2) * h2), this.axis === "Y" && h2 && (this.object.rotation.y = Math.round(this.object.rotation.y / h2) * h2), this.axis === "Z" && h2 && (this.object.rotation.z = Math.round(this.object.rotation.z / h2) * h2);
  1258. }
  1259. this.object.updateMatrixWorld(), this.object.parent && this.object.parent.updateMatrixWorld(), this.positionStart.copy(this.object.position), this.quaternionStart.copy(this.object.quaternion), this.scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this.worldScaleStart), this.pointStart.copy(c.point).sub(this.worldPositionStart);
  1260. }
  1261. this.dragging = true, this.mouseDownEvent.mode = this.mode, this.dispatchEvent(this.mouseDownEvent);
  1262. }
  1263. }), T2(this, "pointerMove", (a) => {
  1264. const c = this.axis, u = this.mode, h2 = this.object;
  1265. let d = this.space;
  1266. if (u === "scale" ? d = "local" : (c === "E" || c === "XYZE" || c === "XYZ") && (d = "world"), h2 === void 0 || c === null || this.dragging === false || a.button !== -1)
  1267. return;
  1268. this.raycaster.setFromCamera(a, this.camera);
  1269. const g = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  1270. if (g) {
  1271. if (this.pointEnd.copy(g.point).sub(this.worldPositionStart), u === "translate")
  1272. this.offset.copy(this.pointEnd).sub(this.pointStart), d === "local" && c !== "XYZ" && this.offset.applyQuaternion(this.worldQuaternionInv), c.indexOf("X") === -1 && (this.offset.x = 0), c.indexOf("Y") === -1 && (this.offset.y = 0), c.indexOf("Z") === -1 && (this.offset.z = 0), d === "local" && c !== "XYZ" ? this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale) : this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale), h2.position.copy(this.offset).add(this.positionStart), this.translationSnap && (d === "local" && (h2.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()), c.search("X") !== -1 && (h2.position.x = Math.round(h2.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h2.position.y = Math.round(h2.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h2.position.z = Math.round(h2.position.z / this.translationSnap) * this.translationSnap), h2.position.applyQuaternion(this.quaternionStart)), d === "world" && (h2.parent && h2.position.add(this.tempVector.setFromMatrixPosition(h2.parent.matrixWorld)), c.search("X") !== -1 && (h2.position.x = Math.round(h2.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h2.position.y = Math.round(h2.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h2.position.z = Math.round(h2.position.z / this.translationSnap) * this.translationSnap), h2.parent && h2.position.sub(this.tempVector.setFromMatrixPosition(h2.parent.matrixWorld))));
  1273. else if (u === "scale") {
  1274. if (c.search("XYZ") !== -1) {
  1275. let w = this.pointEnd.length() / this.pointStart.length();
  1276. this.pointEnd.dot(this.pointStart) < 0 && (w *= -1), this.tempVector2.set(w, w, w);
  1277. } else
  1278. this.tempVector.copy(this.pointStart), this.tempVector2.copy(this.pointEnd), this.tempVector.applyQuaternion(this.worldQuaternionInv), this.tempVector2.applyQuaternion(this.worldQuaternionInv), this.tempVector2.divide(this.tempVector), c.search("X") === -1 && (this.tempVector2.x = 1), c.search("Y") === -1 && (this.tempVector2.y = 1), c.search("Z") === -1 && (this.tempVector2.z = 1);
  1279. h2.scale.copy(this.scaleStart).multiply(this.tempVector2), this.scaleSnap && this.object && (c.search("X") !== -1 && (this.object.scale.x = Math.round(h2.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Y") !== -1 && (h2.scale.y = Math.round(h2.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Z") !== -1 && (h2.scale.z = Math.round(h2.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
  1280. } else if (u === "rotate") {
  1281. this.offset.copy(this.pointEnd).sub(this.pointStart);
  1282. const w = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));
  1283. c === "E" ? (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this.startNorm.copy(this.pointStart).normalize(), this.endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this.endNorm.cross(this.startNorm).dot(this.eye) < 0 ? 1 : -1) : c === "XYZE" ? (this.rotationAxis.copy(this.offset).cross(this.eye).normalize(), this.rotationAngle = this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye)) * w) : (c === "X" || c === "Y" || c === "Z") && (this.rotationAxis.copy(this.unit[c]), this.tempVector.copy(this.unit[c]), d === "local" && this.tempVector.applyQuaternion(this.worldQuaternion), this.rotationAngle = this.offset.dot(this.tempVector.cross(this.eye).normalize()) * w), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), d === "local" && c !== "E" && c !== "XYZE" ? (h2.quaternion.copy(this.quaternionStart), h2.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this.parentQuaternionInv), h2.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), h2.quaternion.multiply(this.quaternionStart).normalize());
  1284. }
  1285. this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent);
  1286. }
  1287. }), T2(this, "pointerUp", (a) => {
  1288. a.button === 0 && (this.dragging && this.axis !== null && (this.mouseUpEvent.mode = this.mode, this.dispatchEvent(this.mouseUpEvent)), this.dragging = false, this.axis = null);
  1289. }), T2(this, "getPointer", (a) => {
  1290. var c;
  1291. if (this.domElement && (c = this.domElement.ownerDocument) !== null && c !== void 0 && c.pointerLockElement)
  1292. return {
  1293. x: 0,
  1294. y: 0,
  1295. button: a.button
  1296. };
  1297. {
  1298. var u;
  1299. const h2 = a.changedTouches ? a.changedTouches[0] : a, d = (u = this.domElement) === null || u === void 0 ? void 0 : u.getBoundingClientRect();
  1300. return {
  1301. x: (h2.clientX - d.left) / d.width * 2 - 1,
  1302. y: -(h2.clientY - d.top) / d.height * 2 + 1,
  1303. button: a.button
  1304. };
  1305. }
  1306. }), T2(this, "onPointerHover", (a) => {
  1307. if (this.enabled)
  1308. switch (a.pointerType) {
  1309. case "mouse":
  1310. case "pen":
  1311. this.pointerHover(this.getPointer(a));
  1312. break;
  1313. }
  1314. }), T2(this, "onPointerDown", (a) => {
  1315. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "none", this.domElement.ownerDocument.addEventListener("pointermove", this.onPointerMove), this.pointerHover(this.getPointer(a)), this.pointerDown(this.getPointer(a)));
  1316. }), T2(this, "onPointerMove", (a) => {
  1317. this.enabled && this.pointerMove(this.getPointer(a));
  1318. }), T2(this, "onPointerUp", (a) => {
  1319. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "", this.domElement.ownerDocument.removeEventListener("pointermove", this.onPointerMove), this.pointerUp(this.getPointer(a)));
  1320. }), T2(this, "getMode", () => this.mode), T2(this, "setMode", (a) => {
  1321. this.mode = a;
  1322. }), T2(this, "setTranslationSnap", (a) => {
  1323. this.translationSnap = a;
  1324. }), T2(this, "setRotationSnap", (a) => {
  1325. this.rotationSnap = a;
  1326. }), T2(this, "setScaleSnap", (a) => {
  1327. this.scaleSnap = a;
  1328. }), T2(this, "setSize", (a) => {
  1329. this.size = a;
  1330. }), T2(this, "setSpace", (a) => {
  1331. this.space = a;
  1332. }), T2(this, "update", () => {
  1333. console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.");
  1334. }), T2(this, "connect", (a) => {
  1335. a === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), this.domElement = a, this.domElement.addEventListener("pointerdown", this.onPointerDown), this.domElement.addEventListener("pointermove", this.onPointerHover), this.domElement.ownerDocument.addEventListener("pointerup", this.onPointerUp);
  1336. }), T2(this, "dispose", () => {
  1337. var a, c, u, h2, d, g;
  1338. (a = this.domElement) === null || a === void 0 || a.removeEventListener("pointerdown", this.onPointerDown), (c = this.domElement) === null || c === void 0 || c.removeEventListener("pointermove", this.onPointerHover), (u = this.domElement) === null || u === void 0 || (h2 = u.ownerDocument) === null || h2 === void 0 || h2.removeEventListener("pointermove", this.onPointerMove), (d = this.domElement) === null || d === void 0 || (g = d.ownerDocument) === null || g === void 0 || g.removeEventListener("pointerup", this.onPointerUp), this.traverse((w) => {
  1339. const _ = w;
  1340. _.geometry && _.geometry.dispose(), _.material && _.material.dispose();
  1341. });
  1342. }), this.domElement = r, this.camera = i, this.gizmo = new iu(), this.add(this.gizmo), this.plane = new su(), this.add(this.plane);
  1343. const s = (a, c) => {
  1344. let u = c;
  1345. Object.defineProperty(this, a, {
  1346. get: function() {
  1347. return u !== void 0 ? u : c;
  1348. },
  1349. set: function(h2) {
  1350. u !== h2 && (u = h2, this.plane[a] = h2, this.gizmo[a] = h2, this.dispatchEvent({
  1351. type: a + "-changed",
  1352. value: h2
  1353. }), this.dispatchEvent(this.changeEvent));
  1354. }
  1355. }), this[a] = c, this.plane[a] = c, this.gizmo[a] = c;
  1356. };
  1357. s("camera", this.camera), s("object", this.object), s("enabled", this.enabled), s("axis", this.axis), s("mode", this.mode), s("translationSnap", this.translationSnap), s("rotationSnap", this.rotationSnap), s("scaleSnap", this.scaleSnap), s("space", this.space), s("size", this.size), s("dragging", this.dragging), s("showX", this.showX), s("showY", this.showY), s("showZ", this.showZ), s("worldPosition", this.worldPosition), s("worldPositionStart", this.worldPositionStart), s("worldQuaternion", this.worldQuaternion), s("worldQuaternionStart", this.worldQuaternionStart), s("cameraPosition", this.cameraPosition), s("cameraQuaternion", this.cameraQuaternion), s("pointStart", this.pointStart), s("pointEnd", this.pointEnd), s("rotationAxis", this.rotationAxis), s("rotationAngle", this.rotationAngle), s("eye", this.eye), r !== void 0 && this.connect(r);
  1358. }
  1359. };
  1360. var iu = class extends Object3D {
  1361. // these are set from parent class TransformControls
  1362. constructor() {
  1363. super(), T2(this, "isTransformControlsGizmo", true), T2(this, "type", "TransformControlsGizmo"), T2(this, "tempVector", new Vector3(0, 0, 0)), T2(this, "tempEuler", new Euler()), T2(this, "alignVector", new Vector3(0, 1, 0)), T2(this, "zeroVector", new Vector3(0, 0, 0)), T2(this, "lookAtMatrix", new Matrix4()), T2(this, "tempQuaternion", new Quaternion()), T2(this, "tempQuaternion2", new Quaternion()), T2(this, "identityQuaternion", new Quaternion()), T2(this, "unitX", new Vector3(1, 0, 0)), T2(this, "unitY", new Vector3(0, 1, 0)), T2(this, "unitZ", new Vector3(0, 0, 1)), T2(this, "gizmo", void 0), T2(this, "picker", void 0), T2(this, "helper", void 0), T2(this, "rotationAxis", new Vector3()), T2(this, "cameraPosition", new Vector3()), T2(this, "worldPositionStart", new Vector3()), T2(this, "worldQuaternionStart", new Quaternion()), T2(this, "worldPosition", new Vector3()), T2(this, "worldQuaternion", new Quaternion()), T2(this, "eye", new Vector3()), T2(this, "camera", null), T2(this, "enabled", true), T2(this, "axis", null), T2(this, "mode", "translate"), T2(this, "space", "world"), T2(this, "size", 1), T2(this, "dragging", false), T2(this, "showX", true), T2(this, "showY", true), T2(this, "showZ", true), T2(this, "updateMatrixWorld", () => {
  1364. let ve = this.space;
  1365. this.mode === "scale" && (ve = "local");
  1366. const le2 = ve === "local" ? this.worldQuaternion : this.identityQuaternion;
  1367. this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
  1368. let ie = [];
  1369. ie = ie.concat(this.picker[this.mode].children), ie = ie.concat(this.gizmo[this.mode].children), ie = ie.concat(this.helper[this.mode].children);
  1370. for (let ge = 0; ge < ie.length; ge++) {
  1371. const M = ie[ge];
  1372. M.visible = true, M.rotation.set(0, 0, 0), M.position.copy(this.worldPosition);
  1373. let ce2;
  1374. if (this.camera.isOrthographicCamera ? ce2 = (this.camera.top - this.camera.bottom) / this.camera.zoom : ce2 = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), M.scale.set(1, 1, 1).multiplyScalar(ce2 * this.size / 7), M.tag === "helper") {
  1375. M.visible = false, M.name === "AXIS" ? (M.position.copy(this.worldPositionStart), M.visible = !!this.axis, this.axis === "X" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, 0)), M.quaternion.copy(le2).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(le2).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "Y" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, Math.PI / 2)), M.quaternion.copy(le2).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(le2).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "Z" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), M.quaternion.copy(le2).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(le2).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "XYZE" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), this.alignVector.copy(this.rotationAxis), M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector, this.alignVector, this.unitY)), M.quaternion.multiply(this.tempQuaternion), M.visible = this.dragging), this.axis === "E" && (M.visible = false)) : M.name === "START" ? (M.position.copy(this.worldPositionStart), M.visible = this.dragging) : M.name === "END" ? (M.position.copy(this.worldPosition), M.visible = this.dragging) : M.name === "DELTA" ? (M.position.copy(this.worldPositionStart), M.quaternion.copy(this.worldQuaternionStart), this.tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()), M.scale.copy(this.tempVector), M.visible = this.dragging) : (M.quaternion.copy(le2), this.dragging ? M.position.copy(this.worldPositionStart) : M.position.copy(this.worldPosition), this.axis && (M.visible = this.axis.search(M.name) !== -1));
  1376. continue;
  1377. }
  1378. M.quaternion.copy(le2), this.mode === "translate" || this.mode === "scale" ? ((M.name === "X" || M.name === "XYZX") && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(le2).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), (M.name === "Y" || M.name === "XYZY") && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(le2).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), (M.name === "Z" || M.name === "XYZZ") && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(le2).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "XY" && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(le2).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "YZ" && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(le2).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "XZ" && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(le2).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name.search("X") !== -1 && (this.alignVector.copy(this.unitX).applyQuaternion(le2).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.x *= -1 : M.tag === "bwd" && (M.visible = false)), M.name.search("Y") !== -1 && (this.alignVector.copy(this.unitY).applyQuaternion(le2).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.y *= -1 : M.tag === "bwd" && (M.visible = false)), M.name.search("Z") !== -1 && (this.alignVector.copy(this.unitZ).applyQuaternion(le2).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.z *= -1 : M.tag === "bwd" && (M.visible = false))) : this.mode === "rotate" && (this.tempQuaternion2.copy(le2), this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(le2).invert()), M.name.search("E") !== -1 && M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye, this.zeroVector, this.unitY)), M.name === "X" && (this.tempQuaternion.setFromAxisAngle(this.unitX, Math.atan2(-this.alignVector.y, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion)), M.name === "Y" && (this.tempQuaternion.setFromAxisAngle(this.unitY, Math.atan2(this.alignVector.x, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion)), M.name === "Z" && (this.tempQuaternion.setFromAxisAngle(this.unitZ, Math.atan2(this.alignVector.y, this.alignVector.x)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion))), M.visible = M.visible && (M.name.indexOf("X") === -1 || this.showX), M.visible = M.visible && (M.name.indexOf("Y") === -1 || this.showY), M.visible = M.visible && (M.name.indexOf("Z") === -1 || this.showZ), M.visible = M.visible && (M.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), M.material.tempOpacity = M.material.tempOpacity || M.material.opacity, M.material.tempColor = M.material.tempColor || M.material.color.clone(), M.material.color.copy(M.material.tempColor), M.material.opacity = M.material.tempOpacity, this.enabled ? this.axis && (M.name === this.axis ? (M.material.opacity = 1, M.material.color.lerp(new Color(1, 1, 1), 0.5)) : this.axis.split("").some(function(De) {
  1379. return M.name === De;
  1380. }) ? (M.material.opacity = 1, M.material.color.lerp(new Color(1, 1, 1), 0.5)) : (M.material.opacity *= 0.25, M.material.color.lerp(new Color(1, 1, 1), 0.5))) : (M.material.opacity *= 0.5, M.material.color.lerp(new Color(1, 1, 1), 0.5));
  1381. }
  1382. super.updateMatrixWorld();
  1383. });
  1384. const i = new MeshBasicMaterial({
  1385. depthTest: false,
  1386. depthWrite: false,
  1387. transparent: true,
  1388. side: DoubleSide,
  1389. fog: false,
  1390. toneMapped: false
  1391. }), r = new LineBasicMaterial({
  1392. depthTest: false,
  1393. depthWrite: false,
  1394. transparent: true,
  1395. linewidth: 1,
  1396. fog: false,
  1397. toneMapped: false
  1398. }), s = i.clone();
  1399. s.opacity = 0.15;
  1400. const a = i.clone();
  1401. a.opacity = 0.33;
  1402. const c = i.clone();
  1403. c.color.set(16711680);
  1404. const u = i.clone();
  1405. u.color.set(65280);
  1406. const h2 = i.clone();
  1407. h2.color.set(255);
  1408. const d = i.clone();
  1409. d.opacity = 0.25;
  1410. const g = d.clone();
  1411. g.color.set(16776960);
  1412. const w = d.clone();
  1413. w.color.set(65535);
  1414. const _ = d.clone();
  1415. _.color.set(16711935), i.clone().color.set(16776960);
  1416. const C = r.clone();
  1417. C.color.set(16711680);
  1418. const I2 = r.clone();
  1419. I2.color.set(65280);
  1420. const S2 = r.clone();
  1421. S2.color.set(255);
  1422. const R2 = r.clone();
  1423. R2.color.set(65535);
  1424. const j2 = r.clone();
  1425. j2.color.set(16711935);
  1426. const F = r.clone();
  1427. F.color.set(16776960);
  1428. const V2 = r.clone();
  1429. V2.color.set(7895160);
  1430. const D = F.clone();
  1431. D.opacity = 0.25;
  1432. const Y = new CylinderGeometry(0, 0.05, 0.2, 12, 1, false), G2 = new BoxGeometry(0.125, 0.125, 0.125), N = new BufferGeometry();
  1433. N.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
  1434. const O = (ve, le2) => {
  1435. const ie = new BufferGeometry(), ge = [];
  1436. for (let M = 0; M <= 64 * le2; ++M)
  1437. ge.push(0, Math.cos(M / 32 * Math.PI) * ve, Math.sin(M / 32 * Math.PI) * ve);
  1438. return ie.setAttribute("position", new Float32BufferAttribute(ge, 3)), ie;
  1439. }, H2 = () => {
  1440. const ve = new BufferGeometry();
  1441. return ve.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3)), ve;
  1442. }, K = {
  1443. X: [[new Mesh(Y, c), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new Mesh(Y, c), [1, 0, 0], [0, 0, Math.PI / 2], null, "bwd"], [new Line(N, C)]],
  1444. Y: [[new Mesh(Y, u), [0, 1, 0], null, null, "fwd"], [new Mesh(Y, u), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"], [new Line(N, I2), null, [0, 0, Math.PI / 2]]],
  1445. Z: [[new Mesh(Y, h2), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new Mesh(Y, h2), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"], [new Line(N, S2), null, [0, -Math.PI / 2, 0]]],
  1446. XYZ: [[new Mesh(new OctahedronGeometry(0.1, 0), d.clone()), [0, 0, 0], [0, 0, 0]]],
  1447. XY: [[new Mesh(new PlaneGeometry(0.295, 0.295), g.clone()), [0.15, 0.15, 0]], [new Line(N, F), [0.18, 0.3, 0], null, [0.125, 1, 1]], [new Line(N, F), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]],
  1448. YZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), w.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]], [new Line(N, R2), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R2), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  1449. XZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), _.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]], [new Line(N, j2), [0.18, 0, 0.3], null, [0.125, 1, 1]], [new Line(N, j2), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]]
  1450. }, q = {
  1451. X: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],
  1452. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0.6, 0]]],
  1453. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],
  1454. XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), s)]],
  1455. XY: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0.2, 0]]],
  1456. YZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],
  1457. XZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]
  1458. }, he = {
  1459. START: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  1460. END: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  1461. DELTA: [[new Line(H2(), a), null, null, null, "helper"]],
  1462. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  1463. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  1464. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  1465. }, _e = {
  1466. X: [[new Line(O(1, 0.5), C)], [new Mesh(new OctahedronGeometry(0.04, 0), c), [0, 0, 0.99], null, [1, 3, 1]]],
  1467. Y: [[new Line(O(1, 0.5), I2), null, [0, 0, -Math.PI / 2]], [new Mesh(new OctahedronGeometry(0.04, 0), u), [0, 0, 0.99], null, [3, 1, 1]]],
  1468. Z: [[new Line(O(1, 0.5), S2), null, [0, Math.PI / 2, 0]], [new Mesh(new OctahedronGeometry(0.04, 0), h2), [0.99, 0, 0], null, [1, 3, 1]]],
  1469. E: [[new Line(O(1.25, 1), D), null, [0, Math.PI / 2, 0]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [0, 1.17, 0], [0, 0, 0], [1, 1, 1e-3]]],
  1470. XYZE: [[new Line(O(1, 1), V2), null, [0, Math.PI / 2, 0]]]
  1471. }, pe2 = {
  1472. AXIS: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
  1473. }, fe2 = {
  1474. X: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
  1475. Y: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [Math.PI / 2, 0, 0]]],
  1476. Z: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, 0, -Math.PI / 2]]],
  1477. E: [[new Mesh(new TorusGeometry(1.25, 0.1, 2, 24), s)]],
  1478. XYZE: [[new Mesh(new SphereGeometry(0.7, 10, 8), s)]]
  1479. }, de = {
  1480. X: [[new Mesh(G2, c), [0.8, 0, 0], [0, 0, -Math.PI / 2]], [new Line(N, C), null, null, [0.8, 1, 1]]],
  1481. Y: [[new Mesh(G2, u), [0, 0.8, 0]], [new Line(N, I2), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]],
  1482. Z: [[new Mesh(G2, h2), [0, 0, 0.8], [Math.PI / 2, 0, 0]], [new Line(N, S2), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]],
  1483. XY: [[new Mesh(G2, g), [0.85, 0.85, 0], null, [2, 2, 0.2]], [new Line(N, F), [0.855, 0.98, 0], null, [0.125, 1, 1]], [new Line(N, F), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]],
  1484. YZ: [[new Mesh(G2, w), [0, 0.85, 0.85], null, [0.2, 2, 2]], [new Line(N, R2), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R2), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  1485. XZ: [[new Mesh(G2, _), [0.85, 0, 0.85], null, [2, 0.2, 2]], [new Line(N, j2), [0.855, 0, 0.98], null, [0.125, 1, 1]], [new Line(N, j2), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  1486. XYZX: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [1.1, 0, 0]]],
  1487. XYZY: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 1.1, 0]]],
  1488. XYZZ: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 0, 1.1]]]
  1489. }, ee2 = {
  1490. X: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],
  1491. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0.5, 0]]],
  1492. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],
  1493. XY: [[new Mesh(G2, s), [0.85, 0.85, 0], null, [3, 3, 0.2]]],
  1494. YZ: [[new Mesh(G2, s), [0, 0.85, 0.85], null, [0.2, 3, 3]]],
  1495. XZ: [[new Mesh(G2, s), [0.85, 0, 0.85], null, [3, 0.2, 3]]],
  1496. XYZX: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [1.1, 0, 0]]],
  1497. XYZY: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 1.1, 0]]],
  1498. XYZZ: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 0, 1.1]]]
  1499. }, X = {
  1500. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  1501. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  1502. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  1503. }, Te = (ve) => {
  1504. const le2 = new Object3D();
  1505. for (let ie in ve)
  1506. for (let ge = ve[ie].length; ge--; ) {
  1507. const M = ve[ie][ge][0].clone(), ce2 = ve[ie][ge][1], De = ve[ie][ge][2], Fe = ve[ie][ge][3], ye = ve[ie][ge][4];
  1508. M.name = ie, M.tag = ye, ce2 && M.position.set(ce2[0], ce2[1], ce2[2]), De && M.rotation.set(De[0], De[1], De[2]), Fe && M.scale.set(Fe[0], Fe[1], Fe[2]), M.updateMatrix();
  1509. const ot2 = M.geometry.clone();
  1510. ot2.applyMatrix4(M.matrix), M.geometry = ot2, M.renderOrder = 1 / 0, M.position.set(0, 0, 0), M.rotation.set(0, 0, 0), M.scale.set(1, 1, 1), le2.add(M);
  1511. }
  1512. return le2;
  1513. };
  1514. this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = Te(K)), this.add(this.gizmo.rotate = Te(_e)), this.add(this.gizmo.scale = Te(de)), this.add(this.picker.translate = Te(q)), this.add(this.picker.rotate = Te(fe2)), this.add(this.picker.scale = Te(ee2)), this.add(this.helper.translate = Te(he)), this.add(this.helper.rotate = Te(pe2)), this.add(this.helper.scale = Te(X)), this.picker.translate.visible = false, this.picker.rotate.visible = false, this.picker.scale.visible = false;
  1515. }
  1516. // updateMatrixWorld will update transformations and appearance of individual handles
  1517. };
  1518. var su = class extends Mesh {
  1519. constructor() {
  1520. super(new PlaneGeometry(1e5, 1e5, 2, 2), new MeshBasicMaterial({
  1521. visible: false,
  1522. wireframe: true,
  1523. side: DoubleSide,
  1524. transparent: true,
  1525. opacity: 0.1,
  1526. toneMapped: false
  1527. })), T2(this, "isTransformControlsPlane", true), T2(this, "type", "TransformControlsPlane"), T2(this, "unitX", new Vector3(1, 0, 0)), T2(this, "unitY", new Vector3(0, 1, 0)), T2(this, "unitZ", new Vector3(0, 0, 1)), T2(this, "tempVector", new Vector3()), T2(this, "dirVector", new Vector3()), T2(this, "alignVector", new Vector3()), T2(this, "tempMatrix", new Matrix4()), T2(this, "identityQuaternion", new Quaternion()), T2(this, "cameraQuaternion", new Quaternion()), T2(this, "worldPosition", new Vector3()), T2(this, "worldQuaternion", new Quaternion()), T2(this, "eye", new Vector3()), T2(this, "axis", null), T2(this, "mode", "translate"), T2(this, "space", "world"), T2(this, "updateMatrixWorld", () => {
  1528. let i = this.space;
  1529. switch (this.position.copy(this.worldPosition), this.mode === "scale" && (i = "local"), this.unitX.set(1, 0, 0).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitY.set(0, 1, 0).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitZ.set(0, 0, 1).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.alignVector.copy(this.unitY), this.mode) {
  1530. case "translate":
  1531. case "scale":
  1532. switch (this.axis) {
  1533. case "X":
  1534. this.alignVector.copy(this.eye).cross(this.unitX), this.dirVector.copy(this.unitX).cross(this.alignVector);
  1535. break;
  1536. case "Y":
  1537. this.alignVector.copy(this.eye).cross(this.unitY), this.dirVector.copy(this.unitY).cross(this.alignVector);
  1538. break;
  1539. case "Z":
  1540. this.alignVector.copy(this.eye).cross(this.unitZ), this.dirVector.copy(this.unitZ).cross(this.alignVector);
  1541. break;
  1542. case "XY":
  1543. this.dirVector.copy(this.unitZ);
  1544. break;
  1545. case "YZ":
  1546. this.dirVector.copy(this.unitX);
  1547. break;
  1548. case "XZ":
  1549. this.alignVector.copy(this.unitZ), this.dirVector.copy(this.unitY);
  1550. break;
  1551. case "XYZ":
  1552. case "E":
  1553. this.dirVector.set(0, 0, 0);
  1554. break;
  1555. }
  1556. break;
  1557. case "rotate":
  1558. default:
  1559. this.dirVector.set(0, 0, 0);
  1560. }
  1561. this.dirVector.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (this.tempMatrix.lookAt(this.tempVector.set(0, 0, 0), this.dirVector, this.alignVector), this.quaternion.setFromRotationMatrix(this.tempMatrix)), super.updateMatrixWorld();
  1562. });
  1563. }
  1564. };
  1565. var aa = (b2, i) => (b2 % i + i) % i;
  1566. var ru = class extends EventDispatcher {
  1567. // Set to false to disable this control
  1568. // "target" sets the location of focus, where the object orbits around
  1569. // How far you can dolly in and out ( PerspectiveCamera only )
  1570. // How far you can zoom in and out ( OrthographicCamera only )
  1571. // How far you can orbit vertically, upper and lower limits.
  1572. // Range is 0 to Math.PI radians.
  1573. // radians
  1574. // radians
  1575. // How far you can orbit horizontally, upper and lower limits.
  1576. // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
  1577. // radians
  1578. // radians
  1579. // Set to true to enable damping (inertia)
  1580. // If damping is enabled, you must call controls.update() in your animation loop
  1581. // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
  1582. // Set to false to disable zooming
  1583. // Set to false to disable rotating
  1584. // Set to false to disable panning
  1585. // if false, pan orthogonal to world-space direction camera.up
  1586. // pixels moved per arrow key push
  1587. // Set to true to automatically rotate around the target
  1588. // If auto-rotate is enabled, you must call controls.update() in your animation loop
  1589. // 30 seconds per orbit when fps is 60
  1590. // true if you want to reverse the orbit to mouse drag from left to right = orbits left
  1591. // The four arrow keys
  1592. // Mouse buttons
  1593. // Touch fingers
  1594. // the target DOM element for key events
  1595. constructor(i, r) {
  1596. super(), T2(this, "object", void 0), T2(this, "domElement", void 0), T2(this, "enabled", true), T2(this, "target", new Vector3()), T2(this, "minDistance", 0), T2(this, "maxDistance", 1 / 0), T2(this, "minZoom", 0), T2(this, "maxZoom", 1 / 0), T2(this, "minPolarAngle", 0), T2(this, "maxPolarAngle", Math.PI), T2(this, "minAzimuthAngle", -1 / 0), T2(this, "maxAzimuthAngle", 1 / 0), T2(this, "enableDamping", false), T2(this, "dampingFactor", 0.05), T2(this, "enableZoom", true), T2(this, "zoomSpeed", 1), T2(this, "enableRotate", true), T2(this, "rotateSpeed", 1), T2(this, "enablePan", true), T2(this, "panSpeed", 1), T2(this, "screenSpacePanning", true), T2(this, "keyPanSpeed", 7), T2(this, "autoRotate", false), T2(this, "autoRotateSpeed", 2), T2(this, "reverseOrbit", false), T2(this, "keys", {
  1597. LEFT: "ArrowLeft",
  1598. UP: "ArrowUp",
  1599. RIGHT: "ArrowRight",
  1600. BOTTOM: "ArrowDown"
  1601. }), T2(this, "mouseButtons", {
  1602. LEFT: MOUSE.ROTATE,
  1603. MIDDLE: MOUSE.DOLLY,
  1604. RIGHT: MOUSE.PAN
  1605. }), T2(this, "touches", {
  1606. ONE: TOUCH.ROTATE,
  1607. TWO: TOUCH.DOLLY_PAN
  1608. }), T2(this, "target0", void 0), T2(this, "position0", void 0), T2(this, "zoom0", void 0), T2(this, "_domElementKeyEvents", null), T2(this, "getPolarAngle", void 0), T2(this, "getAzimuthalAngle", void 0), T2(this, "setPolarAngle", void 0), T2(this, "setAzimuthalAngle", void 0), T2(this, "getDistance", void 0), T2(this, "listenToKeyEvents", void 0), T2(this, "saveState", void 0), T2(this, "reset", void 0), T2(this, "update", void 0), T2(this, "connect", void 0), T2(this, "dispose", void 0), this.object = i, this.domElement = r, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object instanceof PerspectiveCamera ? this.object.zoom : 1, this.getPolarAngle = () => w.phi, this.getAzimuthalAngle = () => w.theta, this.setPolarAngle = (A2) => {
  1609. let U = aa(A2, 2 * Math.PI), W = w.phi;
  1610. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  1611. let se2 = Math.abs(U - W);
  1612. 2 * Math.PI - se2 < se2 && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.phi = U - W, s.update();
  1613. }, this.setAzimuthalAngle = (A2) => {
  1614. let U = aa(A2, 2 * Math.PI), W = w.theta;
  1615. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  1616. let se2 = Math.abs(U - W);
  1617. 2 * Math.PI - se2 < se2 && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.theta = U - W, s.update();
  1618. }, this.getDistance = () => s.object.position.distanceTo(s.target), this.listenToKeyEvents = (A2) => {
  1619. A2.addEventListener("keydown", Ct), this._domElementKeyEvents = A2;
  1620. }, this.saveState = () => {
  1621. s.target0.copy(s.target), s.position0.copy(s.object.position), s.zoom0 = s.object instanceof PerspectiveCamera ? s.object.zoom : 1;
  1622. }, this.reset = () => {
  1623. s.target.copy(s.target0), s.object.position.copy(s.position0), s.object instanceof PerspectiveCamera && (s.object.zoom = s.zoom0, s.object.updateProjectionMatrix()), s.dispatchEvent(a), s.update(), d = h2.NONE;
  1624. }, this.update = (() => {
  1625. const A2 = new Vector3(), U = new Quaternion().setFromUnitVectors(i.up, new Vector3(0, 1, 0)), W = U.clone().invert(), se2 = new Vector3(), xe = new Quaternion(), Oe = 2 * Math.PI;
  1626. return function() {
  1627. const un = s.object.position;
  1628. A2.copy(un).sub(s.target), A2.applyQuaternion(U), w.setFromVector3(A2), s.autoRotate && d === h2.NONE && he(K()), s.enableDamping ? (w.theta += _.theta * s.dampingFactor, w.phi += _.phi * s.dampingFactor) : (w.theta += _.theta, w.phi += _.phi);
  1629. let Ge = s.minAzimuthAngle, He = s.maxAzimuthAngle;
  1630. return isFinite(Ge) && isFinite(He) && (Ge < -Math.PI ? Ge += Oe : Ge > Math.PI && (Ge -= Oe), He < -Math.PI ? He += Oe : He > Math.PI && (He -= Oe), Ge <= He ? w.theta = Math.max(Ge, Math.min(He, w.theta)) : w.theta = w.theta > (Ge + He) / 2 ? Math.max(Ge, w.theta) : Math.min(He, w.theta)), w.phi = Math.max(s.minPolarAngle, Math.min(s.maxPolarAngle, w.phi)), w.makeSafe(), w.radius *= y2, w.radius = Math.max(s.minDistance, Math.min(s.maxDistance, w.radius)), s.enableDamping === true ? s.target.addScaledVector(C, s.dampingFactor) : s.target.add(C), A2.setFromSpherical(w), A2.applyQuaternion(W), un.copy(s.target).add(A2), s.object.lookAt(s.target), s.enableDamping === true ? (_.theta *= 1 - s.dampingFactor, _.phi *= 1 - s.dampingFactor, C.multiplyScalar(1 - s.dampingFactor)) : (_.set(0, 0, 0), C.set(0, 0, 0)), y2 = 1, I2 || se2.distanceToSquared(s.object.position) > g || 8 * (1 - xe.dot(s.object.quaternion)) > g ? (s.dispatchEvent(a), se2.copy(s.object.position), xe.copy(s.object.quaternion), I2 = false, true) : false;
  1631. };
  1632. })(), this.connect = (A2) => {
  1633. A2 === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), s.domElement = A2, s.domElement.style.touchAction = "none", s.domElement.addEventListener("contextmenu", pn), s.domElement.addEventListener("pointerdown", at2), s.domElement.addEventListener("pointercancel", Gn), s.domElement.addEventListener("wheel", Kn);
  1634. }, this.dispose = () => {
  1635. var A2, U, W, se2, xe, Oe;
  1636. (A2 = s.domElement) === null || A2 === void 0 || A2.removeEventListener("contextmenu", pn), (U = s.domElement) === null || U === void 0 || U.removeEventListener("pointerdown", at2), (W = s.domElement) === null || W === void 0 || W.removeEventListener("pointercancel", Gn), (se2 = s.domElement) === null || se2 === void 0 || se2.removeEventListener("wheel", Kn), (xe = s.domElement) === null || xe === void 0 || xe.ownerDocument.removeEventListener("pointermove", cn), (Oe = s.domElement) === null || Oe === void 0 || Oe.ownerDocument.removeEventListener("pointerup", bt), s._domElementKeyEvents !== null && s._domElementKeyEvents.removeEventListener("keydown", Ct);
  1637. };
  1638. const s = this, a = {
  1639. type: "change"
  1640. }, c = {
  1641. type: "start"
  1642. }, u = {
  1643. type: "end"
  1644. }, h2 = {
  1645. NONE: -1,
  1646. ROTATE: 0,
  1647. DOLLY: 1,
  1648. PAN: 2,
  1649. TOUCH_ROTATE: 3,
  1650. TOUCH_PAN: 4,
  1651. TOUCH_DOLLY_PAN: 5,
  1652. TOUCH_DOLLY_ROTATE: 6
  1653. };
  1654. let d = h2.NONE;
  1655. const g = 1e-6, w = new Spherical(), _ = new Spherical();
  1656. let y2 = 1;
  1657. const C = new Vector3();
  1658. let I2 = false;
  1659. const S2 = new Vector2(), R2 = new Vector2(), j2 = new Vector2(), F = new Vector2(), V2 = new Vector2(), D = new Vector2(), Y = new Vector2(), G2 = new Vector2(), N = new Vector2(), O = [], H2 = {};
  1660. function K() {
  1661. return 2 * Math.PI / 60 / 60 * s.autoRotateSpeed;
  1662. }
  1663. function q() {
  1664. return Math.pow(0.95, s.zoomSpeed);
  1665. }
  1666. function he(A2) {
  1667. s.reverseOrbit ? _.theta += A2 : _.theta -= A2;
  1668. }
  1669. function _e(A2) {
  1670. s.reverseOrbit ? _.phi += A2 : _.phi -= A2;
  1671. }
  1672. const pe2 = (() => {
  1673. const A2 = new Vector3();
  1674. return function(W, se2) {
  1675. A2.setFromMatrixColumn(se2, 0), A2.multiplyScalar(-W), C.add(A2);
  1676. };
  1677. })(), fe2 = (() => {
  1678. const A2 = new Vector3();
  1679. return function(W, se2) {
  1680. s.screenSpacePanning === true ? A2.setFromMatrixColumn(se2, 1) : (A2.setFromMatrixColumn(se2, 0), A2.crossVectors(s.object.up, A2)), A2.multiplyScalar(W), C.add(A2);
  1681. };
  1682. })(), de = (() => {
  1683. const A2 = new Vector3();
  1684. return function(W, se2) {
  1685. const xe = s.domElement;
  1686. if (xe && s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera) {
  1687. const Oe = s.object.position;
  1688. A2.copy(Oe).sub(s.target);
  1689. let Ht = A2.length();
  1690. Ht *= Math.tan(s.object.fov / 2 * Math.PI / 180), pe2(2 * W * Ht / xe.clientHeight, s.object.matrix), fe2(2 * se2 * Ht / xe.clientHeight, s.object.matrix);
  1691. } else
  1692. xe && s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (pe2(W * (s.object.right - s.object.left) / s.object.zoom / xe.clientWidth, s.object.matrix), fe2(se2 * (s.object.top - s.object.bottom) / s.object.zoom / xe.clientHeight, s.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), s.enablePan = false);
  1693. };
  1694. })();
  1695. function ee2(A2) {
  1696. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y2 /= A2 : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom * A2)), s.object.updateProjectionMatrix(), I2 = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  1697. }
  1698. function X(A2) {
  1699. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y2 *= A2 : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom / A2)), s.object.updateProjectionMatrix(), I2 = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  1700. }
  1701. function Te(A2) {
  1702. S2.set(A2.clientX, A2.clientY);
  1703. }
  1704. function ve(A2) {
  1705. Y.set(A2.clientX, A2.clientY);
  1706. }
  1707. function le2(A2) {
  1708. F.set(A2.clientX, A2.clientY);
  1709. }
  1710. function ie(A2) {
  1711. R2.set(A2.clientX, A2.clientY), j2.subVectors(R2, S2).multiplyScalar(s.rotateSpeed);
  1712. const U = s.domElement;
  1713. U && (he(2 * Math.PI * j2.x / U.clientHeight), _e(2 * Math.PI * j2.y / U.clientHeight)), S2.copy(R2), s.update();
  1714. }
  1715. function ge(A2) {
  1716. G2.set(A2.clientX, A2.clientY), N.subVectors(G2, Y), N.y > 0 ? ee2(q()) : N.y < 0 && X(q()), Y.copy(G2), s.update();
  1717. }
  1718. function M(A2) {
  1719. V2.set(A2.clientX, A2.clientY), D.subVectors(V2, F).multiplyScalar(s.panSpeed), de(D.x, D.y), F.copy(V2), s.update();
  1720. }
  1721. function ce2(A2) {
  1722. A2.deltaY < 0 ? X(q()) : A2.deltaY > 0 && ee2(q()), s.update();
  1723. }
  1724. function De(A2) {
  1725. let U = false;
  1726. switch (A2.code) {
  1727. case s.keys.UP:
  1728. de(0, s.keyPanSpeed), U = true;
  1729. break;
  1730. case s.keys.BOTTOM:
  1731. de(0, -s.keyPanSpeed), U = true;
  1732. break;
  1733. case s.keys.LEFT:
  1734. de(s.keyPanSpeed, 0), U = true;
  1735. break;
  1736. case s.keys.RIGHT:
  1737. de(-s.keyPanSpeed, 0), U = true;
  1738. break;
  1739. }
  1740. U && (A2.preventDefault(), s.update());
  1741. }
  1742. function Fe() {
  1743. if (O.length == 1)
  1744. S2.set(O[0].pageX, O[0].pageY);
  1745. else {
  1746. const A2 = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1747. S2.set(A2, U);
  1748. }
  1749. }
  1750. function ye() {
  1751. if (O.length == 1)
  1752. F.set(O[0].pageX, O[0].pageY);
  1753. else {
  1754. const A2 = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1755. F.set(A2, U);
  1756. }
  1757. }
  1758. function ot2() {
  1759. const A2 = O[0].pageX - O[1].pageX, U = O[0].pageY - O[1].pageY, W = Math.sqrt(A2 * A2 + U * U);
  1760. Y.set(0, W);
  1761. }
  1762. function zn() {
  1763. s.enableZoom && ot2(), s.enablePan && ye();
  1764. }
  1765. function Ye2() {
  1766. s.enableZoom && ot2(), s.enableRotate && Fe();
  1767. }
  1768. function Un(A2) {
  1769. if (O.length == 1)
  1770. R2.set(A2.pageX, A2.pageY);
  1771. else {
  1772. const W = Rt(A2), se2 = 0.5 * (A2.pageX + W.x), xe = 0.5 * (A2.pageY + W.y);
  1773. R2.set(se2, xe);
  1774. }
  1775. j2.subVectors(R2, S2).multiplyScalar(s.rotateSpeed);
  1776. const U = s.domElement;
  1777. U && (he(2 * Math.PI * j2.x / U.clientHeight), _e(2 * Math.PI * j2.y / U.clientHeight)), S2.copy(R2);
  1778. }
  1779. function ln(A2) {
  1780. if (O.length == 1)
  1781. V2.set(A2.pageX, A2.pageY);
  1782. else {
  1783. const U = Rt(A2), W = 0.5 * (A2.pageX + U.x), se2 = 0.5 * (A2.pageY + U.y);
  1784. V2.set(W, se2);
  1785. }
  1786. D.subVectors(V2, F).multiplyScalar(s.panSpeed), de(D.x, D.y), F.copy(V2);
  1787. }
  1788. function vt(A2) {
  1789. const U = Rt(A2), W = A2.pageX - U.x, se2 = A2.pageY - U.y, xe = Math.sqrt(W * W + se2 * se2);
  1790. G2.set(0, xe), N.set(0, Math.pow(G2.y / Y.y, s.zoomSpeed)), ee2(N.y), Y.copy(G2);
  1791. }
  1792. function At(A2) {
  1793. s.enableZoom && vt(A2), s.enablePan && ln(A2);
  1794. }
  1795. function Ue(A2) {
  1796. s.enableZoom && vt(A2), s.enableRotate && Un(A2);
  1797. }
  1798. function at2(A2) {
  1799. if (s.enabled !== false) {
  1800. if (O.length === 0) {
  1801. var U, W;
  1802. (U = s.domElement) === null || U === void 0 || U.ownerDocument.addEventListener("pointermove", cn), (W = s.domElement) === null || W === void 0 || W.ownerDocument.addEventListener("pointerup", bt);
  1803. }
  1804. Xn(A2), A2.pointerType === "touch" ? Lt(A2) : mi(A2);
  1805. }
  1806. }
  1807. function cn(A2) {
  1808. s.enabled !== false && (A2.pointerType === "touch" ? $n(A2) : Hn(A2));
  1809. }
  1810. function bt(A2) {
  1811. if (Pt(A2), O.length === 0) {
  1812. var U, W, se2;
  1813. (U = s.domElement) === null || U === void 0 || U.releasePointerCapture(A2.pointerId), (W = s.domElement) === null || W === void 0 || W.ownerDocument.removeEventListener("pointermove", cn), (se2 = s.domElement) === null || se2 === void 0 || se2.ownerDocument.removeEventListener("pointerup", bt);
  1814. }
  1815. s.dispatchEvent(u), d = h2.NONE;
  1816. }
  1817. function Gn(A2) {
  1818. Pt(A2);
  1819. }
  1820. function mi(A2) {
  1821. let U;
  1822. switch (A2.button) {
  1823. case 0:
  1824. U = s.mouseButtons.LEFT;
  1825. break;
  1826. case 1:
  1827. U = s.mouseButtons.MIDDLE;
  1828. break;
  1829. case 2:
  1830. U = s.mouseButtons.RIGHT;
  1831. break;
  1832. default:
  1833. U = -1;
  1834. }
  1835. switch (U) {
  1836. case MOUSE.DOLLY:
  1837. if (s.enableZoom === false)
  1838. return;
  1839. ve(A2), d = h2.DOLLY;
  1840. break;
  1841. case MOUSE.ROTATE:
  1842. if (A2.ctrlKey || A2.metaKey || A2.shiftKey) {
  1843. if (s.enablePan === false)
  1844. return;
  1845. le2(A2), d = h2.PAN;
  1846. } else {
  1847. if (s.enableRotate === false)
  1848. return;
  1849. Te(A2), d = h2.ROTATE;
  1850. }
  1851. break;
  1852. case MOUSE.PAN:
  1853. if (A2.ctrlKey || A2.metaKey || A2.shiftKey) {
  1854. if (s.enableRotate === false)
  1855. return;
  1856. Te(A2), d = h2.ROTATE;
  1857. } else {
  1858. if (s.enablePan === false)
  1859. return;
  1860. le2(A2), d = h2.PAN;
  1861. }
  1862. break;
  1863. default:
  1864. d = h2.NONE;
  1865. }
  1866. d !== h2.NONE && s.dispatchEvent(c);
  1867. }
  1868. function Hn(A2) {
  1869. if (s.enabled !== false)
  1870. switch (d) {
  1871. case h2.ROTATE:
  1872. if (s.enableRotate === false)
  1873. return;
  1874. ie(A2);
  1875. break;
  1876. case h2.DOLLY:
  1877. if (s.enableZoom === false)
  1878. return;
  1879. ge(A2);
  1880. break;
  1881. case h2.PAN:
  1882. if (s.enablePan === false)
  1883. return;
  1884. M(A2);
  1885. break;
  1886. }
  1887. }
  1888. function Kn(A2) {
  1889. s.enabled === false || s.enableZoom === false || d !== h2.NONE && d !== h2.ROTATE || (A2.preventDefault(), s.dispatchEvent(c), ce2(A2), s.dispatchEvent(u));
  1890. }
  1891. function Ct(A2) {
  1892. s.enabled === false || s.enablePan === false || De(A2);
  1893. }
  1894. function Lt(A2) {
  1895. switch (gt(A2), O.length) {
  1896. case 1:
  1897. switch (s.touches.ONE) {
  1898. case TOUCH.ROTATE:
  1899. if (s.enableRotate === false)
  1900. return;
  1901. Fe(), d = h2.TOUCH_ROTATE;
  1902. break;
  1903. case TOUCH.PAN:
  1904. if (s.enablePan === false)
  1905. return;
  1906. ye(), d = h2.TOUCH_PAN;
  1907. break;
  1908. default:
  1909. d = h2.NONE;
  1910. }
  1911. break;
  1912. case 2:
  1913. switch (s.touches.TWO) {
  1914. case TOUCH.DOLLY_PAN:
  1915. if (s.enableZoom === false && s.enablePan === false)
  1916. return;
  1917. zn(), d = h2.TOUCH_DOLLY_PAN;
  1918. break;
  1919. case TOUCH.DOLLY_ROTATE:
  1920. if (s.enableZoom === false && s.enableRotate === false)
  1921. return;
  1922. Ye2(), d = h2.TOUCH_DOLLY_ROTATE;
  1923. break;
  1924. default:
  1925. d = h2.NONE;
  1926. }
  1927. break;
  1928. default:
  1929. d = h2.NONE;
  1930. }
  1931. d !== h2.NONE && s.dispatchEvent(c);
  1932. }
  1933. function $n(A2) {
  1934. switch (gt(A2), d) {
  1935. case h2.TOUCH_ROTATE:
  1936. if (s.enableRotate === false)
  1937. return;
  1938. Un(A2), s.update();
  1939. break;
  1940. case h2.TOUCH_PAN:
  1941. if (s.enablePan === false)
  1942. return;
  1943. ln(A2), s.update();
  1944. break;
  1945. case h2.TOUCH_DOLLY_PAN:
  1946. if (s.enableZoom === false && s.enablePan === false)
  1947. return;
  1948. At(A2), s.update();
  1949. break;
  1950. case h2.TOUCH_DOLLY_ROTATE:
  1951. if (s.enableZoom === false && s.enableRotate === false)
  1952. return;
  1953. Ue(A2), s.update();
  1954. break;
  1955. default:
  1956. d = h2.NONE;
  1957. }
  1958. }
  1959. function pn(A2) {
  1960. s.enabled !== false && A2.preventDefault();
  1961. }
  1962. function Xn(A2) {
  1963. O.push(A2);
  1964. }
  1965. function Pt(A2) {
  1966. delete H2[A2.pointerId];
  1967. for (let U = 0; U < O.length; U++)
  1968. if (O[U].pointerId == A2.pointerId) {
  1969. O.splice(U, 1);
  1970. return;
  1971. }
  1972. }
  1973. function gt(A2) {
  1974. let U = H2[A2.pointerId];
  1975. U === void 0 && (U = new Vector2(), H2[A2.pointerId] = U), U.set(A2.pageX, A2.pageY);
  1976. }
  1977. function Rt(A2) {
  1978. const U = A2.pointerId === O[0].pointerId ? O[1] : O[0];
  1979. return H2[U.pointerId];
  1980. }
  1981. r !== void 0 && this.connect(r), this.update();
  1982. }
  1983. };
  1984. var ou = class extends Loader {
  1985. constructor(i) {
  1986. super(i), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(r) {
  1987. return new uu(r);
  1988. }), this.register(function(r) {
  1989. return new gu(r);
  1990. }), this.register(function(r) {
  1991. return new _u(r);
  1992. }), this.register(function(r) {
  1993. return new du(r);
  1994. }), this.register(function(r) {
  1995. return new mu(r);
  1996. }), this.register(function(r) {
  1997. return new fu(r);
  1998. }), this.register(function(r) {
  1999. return new vu(r);
  2000. }), this.register(function(r) {
  2001. return new pu(r);
  2002. }), this.register(function(r) {
  2003. return new bu(r);
  2004. }), this.register(function(r) {
  2005. return new hu(r);
  2006. }), this.register(function(r) {
  2007. return new lu(r);
  2008. }), this.register(function(r) {
  2009. return new wu(r);
  2010. });
  2011. }
  2012. load(i, r, s, a) {
  2013. const c = this;
  2014. let u;
  2015. this.resourcePath !== "" ? u = this.resourcePath : this.path !== "" ? u = this.path : u = LoaderUtils.extractUrlBase(i), this.manager.itemStart(i);
  2016. const h2 = function(g) {
  2017. a ? a(g) : console.error(g), c.manager.itemError(i), c.manager.itemEnd(i);
  2018. }, d = new FileLoader(this.manager);
  2019. d.setPath(this.path), d.setResponseType("arraybuffer"), d.setRequestHeader(this.requestHeader), d.setWithCredentials(this.withCredentials), d.load(i, function(g) {
  2020. try {
  2021. c.parse(g, u, function(w) {
  2022. r(w), c.manager.itemEnd(i);
  2023. }, h2);
  2024. } catch (w) {
  2025. h2(w);
  2026. }
  2027. }, s, h2);
  2028. }
  2029. setDRACOLoader(i) {
  2030. return this.dracoLoader = i, this;
  2031. }
  2032. setDDSLoader() {
  2033. throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
  2034. }
  2035. setKTX2Loader(i) {
  2036. return this.ktx2Loader = i, this;
  2037. }
  2038. setMeshoptDecoder(i) {
  2039. return this.meshoptDecoder = i, this;
  2040. }
  2041. register(i) {
  2042. return this.pluginCallbacks.indexOf(i) === -1 && this.pluginCallbacks.push(i), this;
  2043. }
  2044. unregister(i) {
  2045. return this.pluginCallbacks.indexOf(i) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(i), 1), this;
  2046. }
  2047. parse(i, r, s, a) {
  2048. let c;
  2049. const u = {}, h2 = {};
  2050. if (typeof i == "string")
  2051. c = i;
  2052. else if (LoaderUtils.decodeText(new Uint8Array(i, 0, 4)) === Ya) {
  2053. try {
  2054. u[oe.KHR_BINARY_GLTF] = new yu(i);
  2055. } catch (_) {
  2056. a && a(_);
  2057. return;
  2058. }
  2059. c = u[oe.KHR_BINARY_GLTF].content;
  2060. } else
  2061. c = LoaderUtils.decodeText(new Uint8Array(i));
  2062. const d = JSON.parse(c);
  2063. if (d.asset === void 0 || d.asset.version[0] < 2) {
  2064. a && a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
  2065. return;
  2066. }
  2067. const g = new Vu(d, {
  2068. path: r || this.resourcePath || "",
  2069. crossOrigin: this.crossOrigin,
  2070. requestHeader: this.requestHeader,
  2071. manager: this.manager,
  2072. ktx2Loader: this.ktx2Loader,
  2073. meshoptDecoder: this.meshoptDecoder
  2074. });
  2075. g.fileLoader.setRequestHeader(this.requestHeader);
  2076. for (let w = 0; w < this.pluginCallbacks.length; w++) {
  2077. const _ = this.pluginCallbacks[w](g);
  2078. h2[_.name] = _, u[_.name] = true;
  2079. }
  2080. if (d.extensionsUsed)
  2081. for (let w = 0; w < d.extensionsUsed.length; ++w) {
  2082. const _ = d.extensionsUsed[w], y2 = d.extensionsRequired || [];
  2083. switch (_) {
  2084. case oe.KHR_MATERIALS_UNLIT:
  2085. u[_] = new cu();
  2086. break;
  2087. case oe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
  2088. u[_] = new Cu();
  2089. break;
  2090. case oe.KHR_DRACO_MESH_COMPRESSION:
  2091. u[_] = new xu(d, this.dracoLoader);
  2092. break;
  2093. case oe.KHR_TEXTURE_TRANSFORM:
  2094. u[_] = new Eu();
  2095. break;
  2096. case oe.KHR_MESH_QUANTIZATION:
  2097. u[_] = new Pu();
  2098. break;
  2099. default:
  2100. y2.indexOf(_) >= 0 && h2[_] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + _ + '".');
  2101. }
  2102. }
  2103. g.setExtensions(u), g.setPlugins(h2), g.parse(s, a);
  2104. }
  2105. parseAsync(i, r) {
  2106. const s = this;
  2107. return new Promise(function(a, c) {
  2108. s.parse(i, r, a, c);
  2109. });
  2110. }
  2111. };
  2112. function au() {
  2113. let b2 = {};
  2114. return {
  2115. get: function(i) {
  2116. return b2[i];
  2117. },
  2118. add: function(i, r) {
  2119. b2[i] = r;
  2120. },
  2121. remove: function(i) {
  2122. delete b2[i];
  2123. },
  2124. removeAll: function() {
  2125. b2 = {};
  2126. }
  2127. };
  2128. }
  2129. var oe = {
  2130. KHR_BINARY_GLTF: "KHR_binary_glTF",
  2131. KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  2132. KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  2133. KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  2134. KHR_MATERIALS_IOR: "KHR_materials_ior",
  2135. KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  2136. KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
  2137. KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
  2138. KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  2139. KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
  2140. KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  2141. KHR_MATERIALS_VOLUME: "KHR_materials_volume",
  2142. KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  2143. KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  2144. KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  2145. KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
  2146. EXT_TEXTURE_WEBP: "EXT_texture_webp",
  2147. EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
  2148. };
  2149. var lu = class {
  2150. constructor(i) {
  2151. this.parser = i, this.name = oe.KHR_LIGHTS_PUNCTUAL, this.cache = {
  2152. refs: {},
  2153. uses: {}
  2154. };
  2155. }
  2156. _markDefs() {
  2157. const i = this.parser, r = this.parser.json.nodes || [];
  2158. for (let s = 0, a = r.length; s < a; s++) {
  2159. const c = r[s];
  2160. c.extensions && c.extensions[this.name] && c.extensions[this.name].light !== void 0 && i._addNodeRef(this.cache, c.extensions[this.name].light);
  2161. }
  2162. }
  2163. _loadLight(i) {
  2164. const r = this.parser, s = "light:" + i;
  2165. let a = r.cache.get(s);
  2166. if (a)
  2167. return a;
  2168. const c = r.json, d = ((c.extensions && c.extensions[this.name] || {}).lights || [])[i];
  2169. let g;
  2170. const w = new Color(16777215);
  2171. d.color !== void 0 && w.fromArray(d.color);
  2172. const _ = d.range !== void 0 ? d.range : 0;
  2173. switch (d.type) {
  2174. case "directional":
  2175. g = new DirectionalLight(w), g.target.position.set(0, 0, -1), g.add(g.target);
  2176. break;
  2177. case "point":
  2178. g = new PointLight(w), g.distance = _;
  2179. break;
  2180. case "spot":
  2181. g = new SpotLight(w), g.distance = _, d.spot = d.spot || {}, d.spot.innerConeAngle = d.spot.innerConeAngle !== void 0 ? d.spot.innerConeAngle : 0, d.spot.outerConeAngle = d.spot.outerConeAngle !== void 0 ? d.spot.outerConeAngle : Math.PI / 4, g.angle = d.spot.outerConeAngle, g.penumbra = 1 - d.spot.innerConeAngle / d.spot.outerConeAngle, g.target.position.set(0, 0, -1), g.add(g.target);
  2182. break;
  2183. default:
  2184. throw new Error("THREE.GLTFLoader: Unexpected light type: " + d.type);
  2185. }
  2186. return g.position.set(0, 0, 0), g.decay = 2, d.intensity !== void 0 && (g.intensity = d.intensity), g.name = r.createUniqueName(d.name || "light_" + i), a = Promise.resolve(g), r.cache.add(s, a), a;
  2187. }
  2188. createNodeAttachment(i) {
  2189. const r = this, s = this.parser, c = s.json.nodes[i], h2 = (c.extensions && c.extensions[this.name] || {}).light;
  2190. return h2 === void 0 ? null : this._loadLight(h2).then(function(d) {
  2191. return s._getNodeRef(r.cache, h2, d);
  2192. });
  2193. }
  2194. };
  2195. var cu = class {
  2196. constructor() {
  2197. this.name = oe.KHR_MATERIALS_UNLIT;
  2198. }
  2199. getMaterialType() {
  2200. return MeshBasicMaterial;
  2201. }
  2202. extendParams(i, r, s) {
  2203. const a = [];
  2204. i.color = new Color(1, 1, 1), i.opacity = 1;
  2205. const c = r.pbrMetallicRoughness;
  2206. if (c) {
  2207. if (Array.isArray(c.baseColorFactor)) {
  2208. const u = c.baseColorFactor;
  2209. i.color.fromArray(u), i.opacity = u[3];
  2210. }
  2211. c.baseColorTexture !== void 0 && a.push(s.assignTexture(i, "map", c.baseColorTexture, sRGBEncoding));
  2212. }
  2213. return Promise.all(a);
  2214. }
  2215. };
  2216. var pu = class {
  2217. constructor(i) {
  2218. this.parser = i, this.name = oe.KHR_MATERIALS_EMISSIVE_STRENGTH;
  2219. }
  2220. extendMaterialParams(i, r) {
  2221. const a = this.parser.json.materials[i];
  2222. if (!a.extensions || !a.extensions[this.name])
  2223. return Promise.resolve();
  2224. const c = a.extensions[this.name].emissiveStrength;
  2225. return c !== void 0 && (r.emissiveIntensity = c), Promise.resolve();
  2226. }
  2227. };
  2228. var uu = class {
  2229. constructor(i) {
  2230. this.parser = i, this.name = oe.KHR_MATERIALS_CLEARCOAT;
  2231. }
  2232. getMaterialType(i) {
  2233. const s = this.parser.json.materials[i];
  2234. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2235. }
  2236. extendMaterialParams(i, r) {
  2237. const s = this.parser, a = s.json.materials[i];
  2238. if (!a.extensions || !a.extensions[this.name])
  2239. return Promise.resolve();
  2240. const c = [], u = a.extensions[this.name];
  2241. if (u.clearcoatFactor !== void 0 && (r.clearcoat = u.clearcoatFactor), u.clearcoatTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatMap", u.clearcoatTexture)), u.clearcoatRoughnessFactor !== void 0 && (r.clearcoatRoughness = u.clearcoatRoughnessFactor), u.clearcoatRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatRoughnessMap", u.clearcoatRoughnessTexture)), u.clearcoatNormalTexture !== void 0 && (c.push(s.assignTexture(r, "clearcoatNormalMap", u.clearcoatNormalTexture)), u.clearcoatNormalTexture.scale !== void 0)) {
  2242. const h2 = u.clearcoatNormalTexture.scale;
  2243. r.clearcoatNormalScale = new Vector2(h2, h2);
  2244. }
  2245. return Promise.all(c);
  2246. }
  2247. };
  2248. var hu = class {
  2249. constructor(i) {
  2250. this.parser = i, this.name = oe.KHR_MATERIALS_IRIDESCENCE;
  2251. }
  2252. getMaterialType(i) {
  2253. const s = this.parser.json.materials[i];
  2254. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2255. }
  2256. extendMaterialParams(i, r) {
  2257. const s = this.parser, a = s.json.materials[i];
  2258. if (!a.extensions || !a.extensions[this.name])
  2259. return Promise.resolve();
  2260. const c = [], u = a.extensions[this.name];
  2261. return u.iridescenceFactor !== void 0 && (r.iridescence = u.iridescenceFactor), u.iridescenceTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceMap", u.iridescenceTexture)), u.iridescenceIor !== void 0 && (r.iridescenceIOR = u.iridescenceIor), r.iridescenceThicknessRange === void 0 && (r.iridescenceThicknessRange = [100, 400]), u.iridescenceThicknessMinimum !== void 0 && (r.iridescenceThicknessRange[0] = u.iridescenceThicknessMinimum), u.iridescenceThicknessMaximum !== void 0 && (r.iridescenceThicknessRange[1] = u.iridescenceThicknessMaximum), u.iridescenceThicknessTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceThicknessMap", u.iridescenceThicknessTexture)), Promise.all(c);
  2262. }
  2263. };
  2264. var du = class {
  2265. constructor(i) {
  2266. this.parser = i, this.name = oe.KHR_MATERIALS_SHEEN;
  2267. }
  2268. getMaterialType(i) {
  2269. const s = this.parser.json.materials[i];
  2270. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2271. }
  2272. extendMaterialParams(i, r) {
  2273. const s = this.parser, a = s.json.materials[i];
  2274. if (!a.extensions || !a.extensions[this.name])
  2275. return Promise.resolve();
  2276. const c = [];
  2277. r.sheenColor = new Color(0, 0, 0), r.sheenRoughness = 0, r.sheen = 1;
  2278. const u = a.extensions[this.name];
  2279. return u.sheenColorFactor !== void 0 && r.sheenColor.fromArray(u.sheenColorFactor), u.sheenRoughnessFactor !== void 0 && (r.sheenRoughness = u.sheenRoughnessFactor), u.sheenColorTexture !== void 0 && c.push(s.assignTexture(r, "sheenColorMap", u.sheenColorTexture, sRGBEncoding)), u.sheenRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "sheenRoughnessMap", u.sheenRoughnessTexture)), Promise.all(c);
  2280. }
  2281. };
  2282. var mu = class {
  2283. constructor(i) {
  2284. this.parser = i, this.name = oe.KHR_MATERIALS_TRANSMISSION;
  2285. }
  2286. getMaterialType(i) {
  2287. const s = this.parser.json.materials[i];
  2288. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2289. }
  2290. extendMaterialParams(i, r) {
  2291. const s = this.parser, a = s.json.materials[i];
  2292. if (!a.extensions || !a.extensions[this.name])
  2293. return Promise.resolve();
  2294. const c = [], u = a.extensions[this.name];
  2295. return u.transmissionFactor !== void 0 && (r.transmission = u.transmissionFactor), u.transmissionTexture !== void 0 && c.push(s.assignTexture(r, "transmissionMap", u.transmissionTexture)), Promise.all(c);
  2296. }
  2297. };
  2298. var fu = class {
  2299. constructor(i) {
  2300. this.parser = i, this.name = oe.KHR_MATERIALS_VOLUME;
  2301. }
  2302. getMaterialType(i) {
  2303. const s = this.parser.json.materials[i];
  2304. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2305. }
  2306. extendMaterialParams(i, r) {
  2307. const s = this.parser, a = s.json.materials[i];
  2308. if (!a.extensions || !a.extensions[this.name])
  2309. return Promise.resolve();
  2310. const c = [], u = a.extensions[this.name];
  2311. r.thickness = u.thicknessFactor !== void 0 ? u.thicknessFactor : 0, u.thicknessTexture !== void 0 && c.push(s.assignTexture(r, "thicknessMap", u.thicknessTexture)), r.attenuationDistance = u.attenuationDistance || 1 / 0;
  2312. const h2 = u.attenuationColor || [1, 1, 1];
  2313. return r.attenuationColor = new Color(h2[0], h2[1], h2[2]), Promise.all(c);
  2314. }
  2315. };
  2316. var vu = class {
  2317. constructor(i) {
  2318. this.parser = i, this.name = oe.KHR_MATERIALS_IOR;
  2319. }
  2320. getMaterialType(i) {
  2321. const s = this.parser.json.materials[i];
  2322. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2323. }
  2324. extendMaterialParams(i, r) {
  2325. const a = this.parser.json.materials[i];
  2326. if (!a.extensions || !a.extensions[this.name])
  2327. return Promise.resolve();
  2328. const c = a.extensions[this.name];
  2329. return r.ior = c.ior !== void 0 ? c.ior : 1.5, Promise.resolve();
  2330. }
  2331. };
  2332. var bu = class {
  2333. constructor(i) {
  2334. this.parser = i, this.name = oe.KHR_MATERIALS_SPECULAR;
  2335. }
  2336. getMaterialType(i) {
  2337. const s = this.parser.json.materials[i];
  2338. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2339. }
  2340. extendMaterialParams(i, r) {
  2341. const s = this.parser, a = s.json.materials[i];
  2342. if (!a.extensions || !a.extensions[this.name])
  2343. return Promise.resolve();
  2344. const c = [], u = a.extensions[this.name];
  2345. r.specularIntensity = u.specularFactor !== void 0 ? u.specularFactor : 1, u.specularTexture !== void 0 && c.push(s.assignTexture(r, "specularIntensityMap", u.specularTexture));
  2346. const h2 = u.specularColorFactor || [1, 1, 1];
  2347. return r.specularColor = new Color(h2[0], h2[1], h2[2]), u.specularColorTexture !== void 0 && c.push(s.assignTexture(r, "specularColorMap", u.specularColorTexture, sRGBEncoding)), Promise.all(c);
  2348. }
  2349. };
  2350. var gu = class {
  2351. constructor(i) {
  2352. this.parser = i, this.name = oe.KHR_TEXTURE_BASISU;
  2353. }
  2354. loadTexture(i) {
  2355. const r = this.parser, s = r.json, a = s.textures[i];
  2356. if (!a.extensions || !a.extensions[this.name])
  2357. return null;
  2358. const c = a.extensions[this.name], u = r.options.ktx2Loader;
  2359. if (!u) {
  2360. if (s.extensionsRequired && s.extensionsRequired.indexOf(this.name) >= 0)
  2361. throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
  2362. return null;
  2363. }
  2364. return r.loadTextureImage(i, c.source, u);
  2365. }
  2366. };
  2367. var _u = class {
  2368. constructor(i) {
  2369. this.parser = i, this.name = oe.EXT_TEXTURE_WEBP, this.isSupported = null;
  2370. }
  2371. loadTexture(i) {
  2372. const r = this.name, s = this.parser, a = s.json, c = a.textures[i];
  2373. if (!c.extensions || !c.extensions[r])
  2374. return null;
  2375. const u = c.extensions[r], h2 = a.images[u.source];
  2376. let d = s.textureLoader;
  2377. if (h2.uri) {
  2378. const g = s.options.manager.getHandler(h2.uri);
  2379. g !== null && (d = g);
  2380. }
  2381. return this.detectSupport().then(function(g) {
  2382. if (g)
  2383. return s.loadTextureImage(i, u.source, d);
  2384. if (a.extensionsRequired && a.extensionsRequired.indexOf(r) >= 0)
  2385. throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
  2386. return s.loadTexture(i);
  2387. });
  2388. }
  2389. detectSupport() {
  2390. return this.isSupported || (this.isSupported = new Promise(function(i) {
  2391. const r = new Image();
  2392. r.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", r.onload = r.onerror = function() {
  2393. i(r.height === 1);
  2394. };
  2395. })), this.isSupported;
  2396. }
  2397. };
  2398. var wu = class {
  2399. constructor(i) {
  2400. this.name = oe.EXT_MESHOPT_COMPRESSION, this.parser = i;
  2401. }
  2402. loadBufferView(i) {
  2403. const r = this.parser.json, s = r.bufferViews[i];
  2404. if (s.extensions && s.extensions[this.name]) {
  2405. const a = s.extensions[this.name], c = this.parser.getDependency("buffer", a.buffer), u = this.parser.options.meshoptDecoder;
  2406. if (!u || !u.supported) {
  2407. if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
  2408. throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
  2409. return null;
  2410. }
  2411. return c.then(function(h2) {
  2412. const d = a.byteOffset || 0, g = a.byteLength || 0, w = a.count, _ = a.byteStride, y2 = new Uint8Array(h2, d, g);
  2413. return u.decodeGltfBufferAsync ? u.decodeGltfBufferAsync(w, _, y2, a.mode, a.filter).then(function(C) {
  2414. return C.buffer;
  2415. }) : u.ready.then(function() {
  2416. const C = new ArrayBuffer(w * _);
  2417. return u.decodeGltfBuffer(new Uint8Array(C), w, _, y2, a.mode, a.filter), C;
  2418. });
  2419. });
  2420. } else
  2421. return null;
  2422. }
  2423. };
  2424. var Ya = "glTF";
  2425. var Ki = 12;
  2426. var la = {
  2427. JSON: 1313821514,
  2428. BIN: 5130562
  2429. };
  2430. var yu = class {
  2431. constructor(i) {
  2432. this.name = oe.KHR_BINARY_GLTF, this.content = null, this.body = null;
  2433. const r = new DataView(i, 0, Ki);
  2434. if (this.header = {
  2435. magic: LoaderUtils.decodeText(new Uint8Array(i.slice(0, 4))),
  2436. version: r.getUint32(4, true),
  2437. length: r.getUint32(8, true)
  2438. }, this.header.magic !== Ya)
  2439. throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
  2440. if (this.header.version < 2)
  2441. throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
  2442. const s = this.header.length - Ki, a = new DataView(i, Ki);
  2443. let c = 0;
  2444. for (; c < s; ) {
  2445. const u = a.getUint32(c, true);
  2446. c += 4;
  2447. const h2 = a.getUint32(c, true);
  2448. if (c += 4, h2 === la.JSON) {
  2449. const d = new Uint8Array(i, Ki + c, u);
  2450. this.content = LoaderUtils.decodeText(d);
  2451. } else if (h2 === la.BIN) {
  2452. const d = Ki + c;
  2453. this.body = i.slice(d, d + u);
  2454. }
  2455. c += u;
  2456. }
  2457. if (this.content === null)
  2458. throw new Error("THREE.GLTFLoader: JSON content not found.");
  2459. }
  2460. };
  2461. var xu = class {
  2462. constructor(i, r) {
  2463. if (!r)
  2464. throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
  2465. this.name = oe.KHR_DRACO_MESH_COMPRESSION, this.json = i, this.dracoLoader = r, this.dracoLoader.preload();
  2466. }
  2467. decodePrimitive(i, r) {
  2468. const s = this.json, a = this.dracoLoader, c = i.extensions[this.name].bufferView, u = i.extensions[this.name].attributes, h2 = {}, d = {}, g = {};
  2469. for (const w in u) {
  2470. const _ = ho[w] || w.toLowerCase();
  2471. h2[_] = u[w];
  2472. }
  2473. for (const w in i.attributes) {
  2474. const _ = ho[w] || w.toLowerCase();
  2475. if (u[w] !== void 0) {
  2476. const y2 = s.accessors[i.attributes[w]], C = es[y2.componentType];
  2477. g[_] = C.name, d[_] = y2.normalized === true;
  2478. }
  2479. }
  2480. return r.getDependency("bufferView", c).then(function(w) {
  2481. return new Promise(function(_) {
  2482. a.decodeDracoFile(w, function(y2) {
  2483. for (const C in y2.attributes) {
  2484. const I2 = y2.attributes[C], S2 = d[C];
  2485. S2 !== void 0 && (I2.normalized = S2);
  2486. }
  2487. _(y2);
  2488. }, h2, g);
  2489. });
  2490. });
  2491. }
  2492. };
  2493. var Eu = class {
  2494. constructor() {
  2495. this.name = oe.KHR_TEXTURE_TRANSFORM;
  2496. }
  2497. extendTexture(i, r) {
  2498. return r.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), r.offset === void 0 && r.rotation === void 0 && r.scale === void 0 || (i = i.clone(), r.offset !== void 0 && i.offset.fromArray(r.offset), r.rotation !== void 0 && (i.rotation = r.rotation), r.scale !== void 0 && i.repeat.fromArray(r.scale), i.needsUpdate = true), i;
  2499. }
  2500. };
  2501. var uo = class extends MeshStandardMaterial {
  2502. constructor(i) {
  2503. super(), this.isGLTFSpecularGlossinessMaterial = true;
  2504. const r = ["#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif"].join(`
  2505. `), s = ["#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif"].join(`
  2506. `), a = ["vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", " vec4 texelSpecular = texture2D( specularMap, vUv );", " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", " specularFactor *= texelSpecular.rgb;", "#endif"].join(`
  2507. `), c = ["float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", " vec4 texelGlossiness = texture2D( glossinessMap, vUv );", " // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", " glossinessFactor *= texelGlossiness.a;", "#endif"].join(`
  2508. `), u = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.roughness += geometryRoughness;", "material.roughness = min( material.roughness, 1.0 );", "material.specularColor = specularFactor;"].join(`
  2509. `), h2 = {
  2510. specular: {
  2511. value: new Color().setHex(16777215)
  2512. },
  2513. glossiness: {
  2514. value: 1
  2515. },
  2516. specularMap: {
  2517. value: null
  2518. },
  2519. glossinessMap: {
  2520. value: null
  2521. }
  2522. };
  2523. this._extraUniforms = h2, this.onBeforeCompile = function(d) {
  2524. for (const g in h2)
  2525. d.uniforms[g] = h2[g];
  2526. d.fragmentShader = d.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", r).replace("#include <metalnessmap_pars_fragment>", s).replace("#include <roughnessmap_fragment>", a).replace("#include <metalnessmap_fragment>", c).replace("#include <lights_physical_fragment>", u);
  2527. }, Object.defineProperties(this, {
  2528. specular: {
  2529. get: function() {
  2530. return h2.specular.value;
  2531. },
  2532. set: function(d) {
  2533. h2.specular.value = d;
  2534. }
  2535. },
  2536. specularMap: {
  2537. get: function() {
  2538. return h2.specularMap.value;
  2539. },
  2540. set: function(d) {
  2541. h2.specularMap.value = d, d ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP;
  2542. }
  2543. },
  2544. glossiness: {
  2545. get: function() {
  2546. return h2.glossiness.value;
  2547. },
  2548. set: function(d) {
  2549. h2.glossiness.value = d;
  2550. }
  2551. },
  2552. glossinessMap: {
  2553. get: function() {
  2554. return h2.glossinessMap.value;
  2555. },
  2556. set: function(d) {
  2557. h2.glossinessMap.value = d, d ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV);
  2558. }
  2559. }
  2560. }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(i);
  2561. }
  2562. copy(i) {
  2563. return super.copy(i), this.specularMap = i.specularMap, this.specular.copy(i.specular), this.glossinessMap = i.glossinessMap, this.glossiness = i.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this;
  2564. }
  2565. };
  2566. var Cu = class {
  2567. constructor() {
  2568. this.name = oe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, this.specularGlossinessParams = ["color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio"];
  2569. }
  2570. getMaterialType() {
  2571. return uo;
  2572. }
  2573. extendParams(i, r, s) {
  2574. const a = r.extensions[this.name];
  2575. i.color = new Color(1, 1, 1), i.opacity = 1;
  2576. const c = [];
  2577. if (Array.isArray(a.diffuseFactor)) {
  2578. const u = a.diffuseFactor;
  2579. i.color.fromArray(u), i.opacity = u[3];
  2580. }
  2581. if (a.diffuseTexture !== void 0 && c.push(s.assignTexture(i, "map", a.diffuseTexture, sRGBEncoding)), i.emissive = new Color(0, 0, 0), i.glossiness = a.glossinessFactor !== void 0 ? a.glossinessFactor : 1, i.specular = new Color(1, 1, 1), Array.isArray(a.specularFactor) && i.specular.fromArray(a.specularFactor), a.specularGlossinessTexture !== void 0) {
  2582. const u = a.specularGlossinessTexture;
  2583. c.push(s.assignTexture(i, "glossinessMap", u)), c.push(s.assignTexture(i, "specularMap", u, sRGBEncoding));
  2584. }
  2585. return Promise.all(c);
  2586. }
  2587. createMaterial(i) {
  2588. const r = new uo(i);
  2589. return r.fog = true, r.color = i.color, r.map = i.map === void 0 ? null : i.map, r.lightMap = null, r.lightMapIntensity = 1, r.aoMap = i.aoMap === void 0 ? null : i.aoMap, r.aoMapIntensity = 1, r.emissive = i.emissive, r.emissiveIntensity = i.emissiveIntensity === void 0 ? 1 : i.emissiveIntensity, r.emissiveMap = i.emissiveMap === void 0 ? null : i.emissiveMap, r.bumpMap = i.bumpMap === void 0 ? null : i.bumpMap, r.bumpScale = 1, r.normalMap = i.normalMap === void 0 ? null : i.normalMap, r.normalMapType = TangentSpaceNormalMap, i.normalScale && (r.normalScale = i.normalScale), r.displacementMap = null, r.displacementScale = 1, r.displacementBias = 0, r.specularMap = i.specularMap === void 0 ? null : i.specularMap, r.specular = i.specular, r.glossinessMap = i.glossinessMap === void 0 ? null : i.glossinessMap, r.glossiness = i.glossiness, r.alphaMap = null, r.envMap = i.envMap === void 0 ? null : i.envMap, r.envMapIntensity = 1, r.refractionRatio = 0.98, r;
  2590. }
  2591. };
  2592. var Pu = class {
  2593. constructor() {
  2594. this.name = oe.KHR_MESH_QUANTIZATION;
  2595. }
  2596. };
  2597. var qa = class extends Interpolant {
  2598. constructor(i, r, s, a) {
  2599. super(i, r, s, a);
  2600. }
  2601. copySampleValue_(i) {
  2602. const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, c = i * a * 3 + a;
  2603. for (let u = 0; u !== a; u++)
  2604. r[u] = s[c + u];
  2605. return r;
  2606. }
  2607. interpolate_(i, r, s, a) {
  2608. const c = this.resultBuffer, u = this.sampleValues, h2 = this.valueSize, d = h2 * 2, g = h2 * 3, w = a - r, _ = (s - r) / w, y2 = _ * _, C = y2 * _, I2 = i * g, S2 = I2 - g, R2 = -2 * C + 3 * y2, j2 = C - y2, F = 1 - R2, V2 = j2 - y2 + _;
  2609. for (let D = 0; D !== h2; D++) {
  2610. const Y = u[S2 + D + h2], G2 = u[S2 + D + d] * w, N = u[I2 + D + h2], O = u[I2 + D] * w;
  2611. c[D] = F * Y + V2 * G2 + R2 * N + j2 * O;
  2612. }
  2613. return c;
  2614. }
  2615. };
  2616. var Tu = new Quaternion();
  2617. var ku = class extends qa {
  2618. interpolate_(i, r, s, a) {
  2619. const c = super.interpolate_(i, r, s, a);
  2620. return Tu.fromArray(c).normalize().toArray(c), c;
  2621. }
  2622. };
  2623. var zt = {
  2624. FLOAT: 5126,
  2625. //FLOAT_MAT2: 35674,
  2626. FLOAT_MAT3: 35675,
  2627. FLOAT_MAT4: 35676,
  2628. FLOAT_VEC2: 35664,
  2629. FLOAT_VEC3: 35665,
  2630. FLOAT_VEC4: 35666,
  2631. LINEAR: 9729,
  2632. REPEAT: 10497,
  2633. SAMPLER_2D: 35678,
  2634. POINTS: 0,
  2635. LINES: 1,
  2636. LINE_LOOP: 2,
  2637. LINE_STRIP: 3,
  2638. TRIANGLES: 4,
  2639. TRIANGLE_STRIP: 5,
  2640. TRIANGLE_FAN: 6,
  2641. UNSIGNED_BYTE: 5121,
  2642. UNSIGNED_SHORT: 5123
  2643. };
  2644. var es = {
  2645. 5120: Int8Array,
  2646. 5121: Uint8Array,
  2647. 5122: Int16Array,
  2648. 5123: Uint16Array,
  2649. 5125: Uint32Array,
  2650. 5126: Float32Array
  2651. };
  2652. var ca = {
  2653. 9728: NearestFilter,
  2654. 9729: LinearFilter,
  2655. 9984: NearestMipmapNearestFilter,
  2656. 9985: LinearMipmapNearestFilter,
  2657. 9986: NearestMipmapLinearFilter,
  2658. 9987: LinearMipmapLinearFilter
  2659. };
  2660. var pa = {
  2661. 33071: ClampToEdgeWrapping,
  2662. 33648: MirroredRepeatWrapping,
  2663. 10497: RepeatWrapping
  2664. };
  2665. var ua = {
  2666. SCALAR: 1,
  2667. VEC2: 2,
  2668. VEC3: 3,
  2669. VEC4: 4,
  2670. MAT2: 4,
  2671. MAT3: 9,
  2672. MAT4: 16
  2673. };
  2674. var ho = {
  2675. POSITION: "position",
  2676. NORMAL: "normal",
  2677. TANGENT: "tangent",
  2678. TEXCOORD_0: "uv",
  2679. TEXCOORD_1: "uv2",
  2680. COLOR_0: "color",
  2681. WEIGHTS_0: "skinWeight",
  2682. JOINTS_0: "skinIndex"
  2683. };
  2684. var rn = {
  2685. scale: "scale",
  2686. translation: "position",
  2687. rotation: "quaternion",
  2688. weights: "morphTargetInfluences"
  2689. };
  2690. var Mu = {
  2691. CUBICSPLINE: void 0,
  2692. // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  2693. // keyframe track will be initialized with a default interpolation type, then modified.
  2694. LINEAR: InterpolateLinear,
  2695. STEP: InterpolateDiscrete
  2696. };
  2697. var Jr = {
  2698. OPAQUE: "OPAQUE",
  2699. MASK: "MASK",
  2700. BLEND: "BLEND"
  2701. };
  2702. function Su(b2) {
  2703. return b2.DefaultMaterial === void 0 && (b2.DefaultMaterial = new MeshStandardMaterial({
  2704. color: 16777215,
  2705. emissive: 0,
  2706. metalness: 1,
  2707. roughness: 1,
  2708. transparent: false,
  2709. depthTest: true,
  2710. side: FrontSide
  2711. })), b2.DefaultMaterial;
  2712. }
  2713. function $i(b2, i, r) {
  2714. for (const s in r.extensions)
  2715. b2[s] === void 0 && (i.userData.gltfExtensions = i.userData.gltfExtensions || {}, i.userData.gltfExtensions[s] = r.extensions[s]);
  2716. }
  2717. function Vn(b2, i) {
  2718. i.extras !== void 0 && (typeof i.extras == "object" ? Object.assign(b2.userData, i.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + i.extras));
  2719. }
  2720. function Au(b2, i, r) {
  2721. let s = false, a = false, c = false;
  2722. for (let g = 0, w = i.length; g < w; g++) {
  2723. const _ = i[g];
  2724. if (_.POSITION !== void 0 && (s = true), _.NORMAL !== void 0 && (a = true), _.COLOR_0 !== void 0 && (c = true), s && a && c)
  2725. break;
  2726. }
  2727. if (!s && !a && !c)
  2728. return Promise.resolve(b2);
  2729. const u = [], h2 = [], d = [];
  2730. for (let g = 0, w = i.length; g < w; g++) {
  2731. const _ = i[g];
  2732. if (s) {
  2733. const y2 = _.POSITION !== void 0 ? r.getDependency("accessor", _.POSITION) : b2.attributes.position;
  2734. u.push(y2);
  2735. }
  2736. if (a) {
  2737. const y2 = _.NORMAL !== void 0 ? r.getDependency("accessor", _.NORMAL) : b2.attributes.normal;
  2738. h2.push(y2);
  2739. }
  2740. if (c) {
  2741. const y2 = _.COLOR_0 !== void 0 ? r.getDependency("accessor", _.COLOR_0) : b2.attributes.color;
  2742. d.push(y2);
  2743. }
  2744. }
  2745. return Promise.all([Promise.all(u), Promise.all(h2), Promise.all(d)]).then(function(g) {
  2746. const w = g[0], _ = g[1], y2 = g[2];
  2747. return s && (b2.morphAttributes.position = w), a && (b2.morphAttributes.normal = _), c && (b2.morphAttributes.color = y2), b2.morphTargetsRelative = true, b2;
  2748. });
  2749. }
  2750. function Lu(b2, i) {
  2751. if (b2.updateMorphTargets(), i.weights !== void 0)
  2752. for (let r = 0, s = i.weights.length; r < s; r++)
  2753. b2.morphTargetInfluences[r] = i.weights[r];
  2754. if (i.extras && Array.isArray(i.extras.targetNames)) {
  2755. const r = i.extras.targetNames;
  2756. if (b2.morphTargetInfluences.length === r.length) {
  2757. b2.morphTargetDictionary = {};
  2758. for (let s = 0, a = r.length; s < a; s++)
  2759. b2.morphTargetDictionary[r[s]] = s;
  2760. } else
  2761. console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
  2762. }
  2763. }
  2764. function Ru(b2) {
  2765. const i = b2.extensions && b2.extensions[oe.KHR_DRACO_MESH_COMPRESSION];
  2766. let r;
  2767. return i ? r = "draco:" + i.bufferView + ":" + i.indices + ":" + ha(i.attributes) : r = b2.indices + ":" + ha(b2.attributes) + ":" + b2.mode, r;
  2768. }
  2769. function ha(b2) {
  2770. let i = "";
  2771. const r = Object.keys(b2).sort();
  2772. for (let s = 0, a = r.length; s < a; s++)
  2773. i += r[s] + ":" + b2[r[s]] + ";";
  2774. return i;
  2775. }
  2776. function mo(b2) {
  2777. switch (b2) {
  2778. case Int8Array:
  2779. return 1 / 127;
  2780. case Uint8Array:
  2781. return 1 / 255;
  2782. case Int16Array:
  2783. return 1 / 32767;
  2784. case Uint16Array:
  2785. return 1 / 65535;
  2786. default:
  2787. throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
  2788. }
  2789. }
  2790. function Iu(b2) {
  2791. return b2.search(/\.jpe?g($|\?)/i) > 0 || b2.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : b2.search(/\.webp($|\?)/i) > 0 || b2.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
  2792. }
  2793. var Vu = class {
  2794. constructor(i = {}, r = {}) {
  2795. var s, a;
  2796. this.json = i, this.extensions = {}, this.plugins = {}, this.options = r, this.cache = new au(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = {
  2797. refs: {},
  2798. uses: {}
  2799. }, this.cameraCache = {
  2800. refs: {},
  2801. uses: {}
  2802. }, this.lightCache = {
  2803. refs: {},
  2804. uses: {}
  2805. }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
  2806. const c = typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true, u = typeof navigator < "u" && ((s = navigator.userAgent) === null || s === void 0 ? void 0 : s.indexOf("Firefox")) > -1, h2 = typeof navigator < "u" && u ? (a = navigator.userAgent) === null || a === void 0 ? void 0 : a.match(/Firefox\/([0-9]+)\./)[1] : -1;
  2807. typeof createImageBitmap > "u" || c || u && h2 < 98 ? this.textureLoader = new TextureLoader(this.options.manager) : this.textureLoader = new ImageBitmapLoader(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new FileLoader(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(true);
  2808. }
  2809. setExtensions(i) {
  2810. this.extensions = i;
  2811. }
  2812. setPlugins(i) {
  2813. this.plugins = i;
  2814. }
  2815. parse(i, r) {
  2816. const s = this, a = this.json, c = this.extensions;
  2817. this.cache.removeAll(), this._invokeAll(function(u) {
  2818. return u._markDefs && u._markDefs();
  2819. }), Promise.all(this._invokeAll(function(u) {
  2820. return u.beforeRoot && u.beforeRoot();
  2821. })).then(function() {
  2822. return Promise.all([s.getDependencies("scene"), s.getDependencies("animation"), s.getDependencies("camera")]);
  2823. }).then(function(u) {
  2824. const h2 = {
  2825. scene: u[0][a.scene || 0],
  2826. scenes: u[0],
  2827. animations: u[1],
  2828. cameras: u[2],
  2829. asset: a.asset,
  2830. parser: s,
  2831. userData: {}
  2832. };
  2833. $i(c, h2, a), Vn(h2, a), Promise.all(s._invokeAll(function(d) {
  2834. return d.afterRoot && d.afterRoot(h2);
  2835. })).then(function() {
  2836. i(h2);
  2837. });
  2838. }).catch(r);
  2839. }
  2840. /**
  2841. * Marks the special nodes/meshes in json for efficient parse.
  2842. */
  2843. _markDefs() {
  2844. const i = this.json.nodes || [], r = this.json.skins || [], s = this.json.meshes || [];
  2845. for (let a = 0, c = r.length; a < c; a++) {
  2846. const u = r[a].joints;
  2847. for (let h2 = 0, d = u.length; h2 < d; h2++)
  2848. i[u[h2]].isBone = true;
  2849. }
  2850. for (let a = 0, c = i.length; a < c; a++) {
  2851. const u = i[a];
  2852. u.mesh !== void 0 && (this._addNodeRef(this.meshCache, u.mesh), u.skin !== void 0 && (s[u.mesh].isSkinnedMesh = true)), u.camera !== void 0 && this._addNodeRef(this.cameraCache, u.camera);
  2853. }
  2854. }
  2855. /**
  2856. * Counts references to shared node / Object3D resources. These resources
  2857. * can be reused, or "instantiated", at multiple nodes in the scene
  2858. * hierarchy. Mesh, Camera, and Light instances are instantiated and must
  2859. * be marked. Non-scenegraph resources (like Materials, Geometries, and
  2860. * Textures) can be reused directly and are not marked here.
  2861. *
  2862. * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
  2863. */
  2864. _addNodeRef(i, r) {
  2865. r !== void 0 && (i.refs[r] === void 0 && (i.refs[r] = i.uses[r] = 0), i.refs[r]++);
  2866. }
  2867. /** Returns a reference to a shared resource, cloning it if necessary. */
  2868. _getNodeRef(i, r, s) {
  2869. if (i.refs[r] <= 1)
  2870. return s;
  2871. const a = s.clone(), c = (u, h2) => {
  2872. const d = this.associations.get(u);
  2873. d != null && this.associations.set(h2, d);
  2874. for (const [g, w] of u.children.entries())
  2875. c(w, h2.children[g]);
  2876. };
  2877. return c(s, a), a.name += "_instance_" + i.uses[r]++, a;
  2878. }
  2879. _invokeOne(i) {
  2880. const r = Object.values(this.plugins);
  2881. r.push(this);
  2882. for (let s = 0; s < r.length; s++) {
  2883. const a = i(r[s]);
  2884. if (a)
  2885. return a;
  2886. }
  2887. return null;
  2888. }
  2889. _invokeAll(i) {
  2890. const r = Object.values(this.plugins);
  2891. r.unshift(this);
  2892. const s = [];
  2893. for (let a = 0; a < r.length; a++) {
  2894. const c = i(r[a]);
  2895. c && s.push(c);
  2896. }
  2897. return s;
  2898. }
  2899. /**
  2900. * Requests the specified dependency asynchronously, with caching.
  2901. * @param {string} type
  2902. * @param {number} index
  2903. * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
  2904. */
  2905. getDependency(i, r) {
  2906. const s = i + ":" + r;
  2907. let a = this.cache.get(s);
  2908. if (!a) {
  2909. switch (i) {
  2910. case "scene":
  2911. a = this.loadScene(r);
  2912. break;
  2913. case "node":
  2914. a = this.loadNode(r);
  2915. break;
  2916. case "mesh":
  2917. a = this._invokeOne(function(c) {
  2918. return c.loadMesh && c.loadMesh(r);
  2919. });
  2920. break;
  2921. case "accessor":
  2922. a = this.loadAccessor(r);
  2923. break;
  2924. case "bufferView":
  2925. a = this._invokeOne(function(c) {
  2926. return c.loadBufferView && c.loadBufferView(r);
  2927. });
  2928. break;
  2929. case "buffer":
  2930. a = this.loadBuffer(r);
  2931. break;
  2932. case "material":
  2933. a = this._invokeOne(function(c) {
  2934. return c.loadMaterial && c.loadMaterial(r);
  2935. });
  2936. break;
  2937. case "texture":
  2938. a = this._invokeOne(function(c) {
  2939. return c.loadTexture && c.loadTexture(r);
  2940. });
  2941. break;
  2942. case "skin":
  2943. a = this.loadSkin(r);
  2944. break;
  2945. case "animation":
  2946. a = this._invokeOne(function(c) {
  2947. return c.loadAnimation && c.loadAnimation(r);
  2948. });
  2949. break;
  2950. case "camera":
  2951. a = this.loadCamera(r);
  2952. break;
  2953. default:
  2954. throw new Error("Unknown type: " + i);
  2955. }
  2956. this.cache.add(s, a);
  2957. }
  2958. return a;
  2959. }
  2960. /**
  2961. * Requests all dependencies of the specified type asynchronously, with caching.
  2962. * @param {string} type
  2963. * @return {Promise<Array<Object>>}
  2964. */
  2965. getDependencies(i) {
  2966. let r = this.cache.get(i);
  2967. if (!r) {
  2968. const s = this, a = this.json[i + (i === "mesh" ? "es" : "s")] || [];
  2969. r = Promise.all(a.map(function(c, u) {
  2970. return s.getDependency(i, u);
  2971. })), this.cache.add(i, r);
  2972. }
  2973. return r;
  2974. }
  2975. /**
  2976. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2977. * @param {number} bufferIndex
  2978. * @return {Promise<ArrayBuffer>}
  2979. */
  2980. loadBuffer(i) {
  2981. const r = this.json.buffers[i], s = this.fileLoader;
  2982. if (r.type && r.type !== "arraybuffer")
  2983. throw new Error("THREE.GLTFLoader: " + r.type + " buffer type is not supported.");
  2984. if (r.uri === void 0 && i === 0)
  2985. return Promise.resolve(this.extensions[oe.KHR_BINARY_GLTF].body);
  2986. const a = this.options;
  2987. return new Promise(function(c, u) {
  2988. s.load(LoaderUtils.resolveURL(r.uri, a.path), c, void 0, function() {
  2989. u(new Error('THREE.GLTFLoader: Failed to load buffer "' + r.uri + '".'));
  2990. });
  2991. });
  2992. }
  2993. /**
  2994. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2995. * @param {number} bufferViewIndex
  2996. * @return {Promise<ArrayBuffer>}
  2997. */
  2998. loadBufferView(i) {
  2999. const r = this.json.bufferViews[i];
  3000. return this.getDependency("buffer", r.buffer).then(function(s) {
  3001. const a = r.byteLength || 0, c = r.byteOffset || 0;
  3002. return s.slice(c, c + a);
  3003. });
  3004. }
  3005. /**
  3006. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
  3007. * @param {number} accessorIndex
  3008. * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
  3009. */
  3010. loadAccessor(i) {
  3011. const r = this, s = this.json, a = this.json.accessors[i];
  3012. if (a.bufferView === void 0 && a.sparse === void 0)
  3013. return Promise.resolve(null);
  3014. const c = [];
  3015. return a.bufferView !== void 0 ? c.push(this.getDependency("bufferView", a.bufferView)) : c.push(null), a.sparse !== void 0 && (c.push(this.getDependency("bufferView", a.sparse.indices.bufferView)), c.push(this.getDependency("bufferView", a.sparse.values.bufferView))), Promise.all(c).then(function(u) {
  3016. const h2 = u[0], d = ua[a.type], g = es[a.componentType], w = g.BYTES_PER_ELEMENT, _ = w * d, y2 = a.byteOffset || 0, C = a.bufferView !== void 0 ? s.bufferViews[a.bufferView].byteStride : void 0, I2 = a.normalized === true;
  3017. let S2, R2;
  3018. if (C && C !== _) {
  3019. const j2 = Math.floor(y2 / C), F = "InterleavedBuffer:" + a.bufferView + ":" + a.componentType + ":" + j2 + ":" + a.count;
  3020. let V2 = r.cache.get(F);
  3021. V2 || (S2 = new g(h2, j2 * C, a.count * C / w), V2 = new InterleavedBuffer(S2, C / w), r.cache.add(F, V2)), R2 = new InterleavedBufferAttribute(V2, d, y2 % C / w, I2);
  3022. } else
  3023. h2 === null ? S2 = new g(a.count * d) : S2 = new g(h2, y2, a.count * d), R2 = new BufferAttribute(S2, d, I2);
  3024. if (a.sparse !== void 0) {
  3025. const j2 = ua.SCALAR, F = es[a.sparse.indices.componentType], V2 = a.sparse.indices.byteOffset || 0, D = a.sparse.values.byteOffset || 0, Y = new F(u[1], V2, a.sparse.count * j2), G2 = new g(u[2], D, a.sparse.count * d);
  3026. h2 !== null && (R2 = new BufferAttribute(R2.array.slice(), R2.itemSize, R2.normalized));
  3027. for (let N = 0, O = Y.length; N < O; N++) {
  3028. const H2 = Y[N];
  3029. if (R2.setX(H2, G2[N * d]), d >= 2 && R2.setY(H2, G2[N * d + 1]), d >= 3 && R2.setZ(H2, G2[N * d + 2]), d >= 4 && R2.setW(H2, G2[N * d + 3]), d >= 5)
  3030. throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
  3031. }
  3032. }
  3033. return R2;
  3034. });
  3035. }
  3036. /**
  3037. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
  3038. * @param {number} textureIndex
  3039. * @return {Promise<THREE.Texture>}
  3040. */
  3041. loadTexture(i) {
  3042. const r = this.json, s = this.options, c = r.textures[i].source, u = r.images[c];
  3043. let h2 = this.textureLoader;
  3044. if (u.uri) {
  3045. const d = s.manager.getHandler(u.uri);
  3046. d !== null && (h2 = d);
  3047. }
  3048. return this.loadTextureImage(i, c, h2);
  3049. }
  3050. loadTextureImage(i, r, s) {
  3051. const a = this, c = this.json, u = c.textures[i], h2 = c.images[r], d = (h2.uri || h2.bufferView) + ":" + u.sampler;
  3052. if (this.textureCache[d])
  3053. return this.textureCache[d];
  3054. const g = this.loadImageSource(r, s).then(function(w) {
  3055. w.flipY = false, u.name && (w.name = u.name);
  3056. const y2 = (c.samplers || {})[u.sampler] || {};
  3057. return w.magFilter = ca[y2.magFilter] || LinearFilter, w.minFilter = ca[y2.minFilter] || LinearMipmapLinearFilter, w.wrapS = pa[y2.wrapS] || RepeatWrapping, w.wrapT = pa[y2.wrapT] || RepeatWrapping, a.associations.set(w, {
  3058. textures: i
  3059. }), w;
  3060. }).catch(function() {
  3061. return null;
  3062. });
  3063. return this.textureCache[d] = g, g;
  3064. }
  3065. loadImageSource(i, r) {
  3066. const s = this, a = this.json, c = this.options;
  3067. if (this.sourceCache[i] !== void 0)
  3068. return this.sourceCache[i].then((_) => _.clone());
  3069. const u = a.images[i], h2 = self.URL || self.webkitURL;
  3070. let d = u.uri || "", g = false;
  3071. if (u.bufferView !== void 0)
  3072. d = s.getDependency("bufferView", u.bufferView).then(function(_) {
  3073. g = true;
  3074. const y2 = new Blob([_], {
  3075. type: u.mimeType
  3076. });
  3077. return d = h2.createObjectURL(y2), d;
  3078. });
  3079. else if (u.uri === void 0)
  3080. throw new Error("THREE.GLTFLoader: Image " + i + " is missing URI and bufferView");
  3081. const w = Promise.resolve(d).then(function(_) {
  3082. return new Promise(function(y2, C) {
  3083. let I2 = y2;
  3084. r.isImageBitmapLoader === true && (I2 = function(S2) {
  3085. const R2 = new Texture(S2);
  3086. R2.needsUpdate = true, y2(R2);
  3087. }), r.load(LoaderUtils.resolveURL(_, c.path), I2, void 0, C);
  3088. });
  3089. }).then(function(_) {
  3090. return g === true && h2.revokeObjectURL(d), _.userData.mimeType = u.mimeType || Iu(u.uri), _;
  3091. }).catch(function(_) {
  3092. throw console.error("THREE.GLTFLoader: Couldn't load texture", d), _;
  3093. });
  3094. return this.sourceCache[i] = w, w;
  3095. }
  3096. /**
  3097. * Asynchronously assigns a texture to the given material parameters.
  3098. * @param {Object} materialParams
  3099. * @param {string} mapName
  3100. * @param {Object} mapDef
  3101. * @return {Promise<Texture>}
  3102. */
  3103. assignTexture(i, r, s, a) {
  3104. const c = this;
  3105. return this.getDependency("texture", s.index).then(function(u) {
  3106. if (s.texCoord !== void 0 && s.texCoord != 0 && !(r === "aoMap" && s.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + s.texCoord + " for texture " + r + " not yet supported."), c.extensions[oe.KHR_TEXTURE_TRANSFORM]) {
  3107. const h2 = s.extensions !== void 0 ? s.extensions[oe.KHR_TEXTURE_TRANSFORM] : void 0;
  3108. if (h2) {
  3109. const d = c.associations.get(u);
  3110. u = c.extensions[oe.KHR_TEXTURE_TRANSFORM].extendTexture(u, h2), c.associations.set(u, d);
  3111. }
  3112. }
  3113. return a !== void 0 && (u.encoding = a), i[r] = u, u;
  3114. });
  3115. }
  3116. /**
  3117. * Assigns final material to a Mesh, Line, or Points instance. The instance
  3118. * already has a material (generated from the glTF material options alone)
  3119. * but reuse of the same glTF material may require multiple threejs materials
  3120. * to accommodate different primitive types, defines, etc. New materials will
  3121. * be created if necessary, and reused from a cache.
  3122. * @param {Object3D} mesh Mesh, Line, or Points instance.
  3123. */
  3124. assignFinalMaterial(i) {
  3125. const r = i.geometry;
  3126. let s = i.material;
  3127. const a = r.attributes.tangent === void 0, c = r.attributes.color !== void 0, u = r.attributes.normal === void 0;
  3128. if (i.isPoints) {
  3129. const h2 = "PointsMaterial:" + s.uuid;
  3130. let d = this.cache.get(h2);
  3131. d || (d = new PointsMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), d.map = s.map, d.sizeAttenuation = false, this.cache.add(h2, d)), s = d;
  3132. } else if (i.isLine) {
  3133. const h2 = "LineBasicMaterial:" + s.uuid;
  3134. let d = this.cache.get(h2);
  3135. d || (d = new LineBasicMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), this.cache.add(h2, d)), s = d;
  3136. }
  3137. if (a || c || u) {
  3138. let h2 = "ClonedMaterial:" + s.uuid + ":";
  3139. s.isGLTFSpecularGlossinessMaterial && (h2 += "specular-glossiness:"), a && (h2 += "derivative-tangents:"), c && (h2 += "vertex-colors:"), u && (h2 += "flat-shading:");
  3140. let d = this.cache.get(h2);
  3141. d || (d = s.clone(), c && (d.vertexColors = true), u && (d.flatShading = true), a && (d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(h2, d), this.associations.set(d, this.associations.get(s))), s = d;
  3142. }
  3143. s.aoMap && r.attributes.uv2 === void 0 && r.attributes.uv !== void 0 && r.setAttribute("uv2", r.attributes.uv), i.material = s;
  3144. }
  3145. getMaterialType() {
  3146. return MeshStandardMaterial;
  3147. }
  3148. /**
  3149. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
  3150. * @param {number} materialIndex
  3151. * @return {Promise<Material>}
  3152. */
  3153. loadMaterial(i) {
  3154. const r = this, s = this.json, a = this.extensions, c = s.materials[i];
  3155. let u;
  3156. const h2 = {}, d = c.extensions || {}, g = [];
  3157. if (d[oe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
  3158. const _ = a[oe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
  3159. u = _.getMaterialType(), g.push(_.extendParams(h2, c, r));
  3160. } else if (d[oe.KHR_MATERIALS_UNLIT]) {
  3161. const _ = a[oe.KHR_MATERIALS_UNLIT];
  3162. u = _.getMaterialType(), g.push(_.extendParams(h2, c, r));
  3163. } else {
  3164. const _ = c.pbrMetallicRoughness || {};
  3165. if (h2.color = new Color(1, 1, 1), h2.opacity = 1, Array.isArray(_.baseColorFactor)) {
  3166. const y2 = _.baseColorFactor;
  3167. h2.color.fromArray(y2), h2.opacity = y2[3];
  3168. }
  3169. _.baseColorTexture !== void 0 && g.push(r.assignTexture(h2, "map", _.baseColorTexture, sRGBEncoding)), h2.metalness = _.metallicFactor !== void 0 ? _.metallicFactor : 1, h2.roughness = _.roughnessFactor !== void 0 ? _.roughnessFactor : 1, _.metallicRoughnessTexture !== void 0 && (g.push(r.assignTexture(h2, "metalnessMap", _.metallicRoughnessTexture)), g.push(r.assignTexture(h2, "roughnessMap", _.metallicRoughnessTexture))), u = this._invokeOne(function(y2) {
  3170. return y2.getMaterialType && y2.getMaterialType(i);
  3171. }), g.push(Promise.all(this._invokeAll(function(y2) {
  3172. return y2.extendMaterialParams && y2.extendMaterialParams(i, h2);
  3173. })));
  3174. }
  3175. c.doubleSided === true && (h2.side = DoubleSide);
  3176. const w = c.alphaMode || Jr.OPAQUE;
  3177. if (w === Jr.BLEND ? (h2.transparent = true, h2.depthWrite = false) : (h2.transparent = false, w === Jr.MASK && (h2.alphaTest = c.alphaCutoff !== void 0 ? c.alphaCutoff : 0.5)), c.normalTexture !== void 0 && u !== MeshBasicMaterial && (g.push(r.assignTexture(h2, "normalMap", c.normalTexture)), h2.normalScale = new Vector2(1, 1), c.normalTexture.scale !== void 0)) {
  3178. const _ = c.normalTexture.scale;
  3179. h2.normalScale.set(_, _);
  3180. }
  3181. return c.occlusionTexture !== void 0 && u !== MeshBasicMaterial && (g.push(r.assignTexture(h2, "aoMap", c.occlusionTexture)), c.occlusionTexture.strength !== void 0 && (h2.aoMapIntensity = c.occlusionTexture.strength)), c.emissiveFactor !== void 0 && u !== MeshBasicMaterial && (h2.emissive = new Color().fromArray(c.emissiveFactor)), c.emissiveTexture !== void 0 && u !== MeshBasicMaterial && g.push(r.assignTexture(h2, "emissiveMap", c.emissiveTexture, sRGBEncoding)), Promise.all(g).then(function() {
  3182. let _;
  3183. return u === uo ? _ = a[oe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(h2) : _ = new u(h2), c.name && (_.name = c.name), Vn(_, c), r.associations.set(_, {
  3184. materials: i
  3185. }), c.extensions && $i(a, _, c), _;
  3186. });
  3187. }
  3188. /** When Object3D instances are targeted by animation, they need unique names. */
  3189. createUniqueName(i) {
  3190. const r = PropertyBinding.sanitizeNodeName(i || "");
  3191. let s = r;
  3192. for (let a = 1; this.nodeNamesUsed[s]; ++a)
  3193. s = r + "_" + a;
  3194. return this.nodeNamesUsed[s] = true, s;
  3195. }
  3196. /**
  3197. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
  3198. *
  3199. * Creates BufferGeometries from primitives.
  3200. *
  3201. * @param {Array<GLTF.Primitive>} primitives
  3202. * @return {Promise<Array<BufferGeometry>>}
  3203. */
  3204. loadGeometries(i) {
  3205. const r = this, s = this.extensions, a = this.primitiveCache;
  3206. function c(h2) {
  3207. return s[oe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h2, r).then(function(d) {
  3208. return da(d, h2, r);
  3209. });
  3210. }
  3211. const u = [];
  3212. for (let h2 = 0, d = i.length; h2 < d; h2++) {
  3213. const g = i[h2], w = Ru(g), _ = a[w];
  3214. if (_)
  3215. u.push(_.promise);
  3216. else {
  3217. let y2;
  3218. g.extensions && g.extensions[oe.KHR_DRACO_MESH_COMPRESSION] ? y2 = c(g) : y2 = da(new BufferGeometry(), g, r), a[w] = {
  3219. primitive: g,
  3220. promise: y2
  3221. }, u.push(y2);
  3222. }
  3223. }
  3224. return Promise.all(u);
  3225. }
  3226. /**
  3227. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
  3228. * @param {number} meshIndex
  3229. * @return {Promise<Group|Mesh|SkinnedMesh>}
  3230. */
  3231. loadMesh(i) {
  3232. const r = this, s = this.json, a = this.extensions, c = s.meshes[i], u = c.primitives, h2 = [];
  3233. for (let d = 0, g = u.length; d < g; d++) {
  3234. const w = u[d].material === void 0 ? Su(this.cache) : this.getDependency("material", u[d].material);
  3235. h2.push(w);
  3236. }
  3237. return h2.push(r.loadGeometries(u)), Promise.all(h2).then(function(d) {
  3238. const g = d.slice(0, d.length - 1), w = d[d.length - 1], _ = [];
  3239. for (let C = 0, I2 = w.length; C < I2; C++) {
  3240. const S2 = w[C], R2 = u[C];
  3241. let j2;
  3242. const F = g[C];
  3243. if (R2.mode === zt.TRIANGLES || R2.mode === zt.TRIANGLE_STRIP || R2.mode === zt.TRIANGLE_FAN || R2.mode === void 0)
  3244. j2 = c.isSkinnedMesh === true ? new SkinnedMesh(S2, F) : new Mesh(S2, F), j2.isSkinnedMesh === true && !j2.geometry.attributes.skinWeight.normalized && j2.normalizeSkinWeights(), R2.mode === zt.TRIANGLE_STRIP ? j2.geometry = ma(j2.geometry, TriangleStripDrawMode) : R2.mode === zt.TRIANGLE_FAN && (j2.geometry = ma(j2.geometry, TriangleFanDrawMode));
  3245. else if (R2.mode === zt.LINES)
  3246. j2 = new LineSegments(S2, F);
  3247. else if (R2.mode === zt.LINE_STRIP)
  3248. j2 = new Line(S2, F);
  3249. else if (R2.mode === zt.LINE_LOOP)
  3250. j2 = new LineLoop(S2, F);
  3251. else if (R2.mode === zt.POINTS)
  3252. j2 = new Points(S2, F);
  3253. else
  3254. throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + R2.mode);
  3255. Object.keys(j2.geometry.morphAttributes).length > 0 && Lu(j2, c), j2.name = r.createUniqueName(c.name || "mesh_" + i), Vn(j2, c), R2.extensions && $i(a, j2, R2), r.assignFinalMaterial(j2), _.push(j2);
  3256. }
  3257. for (let C = 0, I2 = _.length; C < I2; C++)
  3258. r.associations.set(_[C], {
  3259. meshes: i,
  3260. primitives: C
  3261. });
  3262. if (_.length === 1)
  3263. return _[0];
  3264. const y2 = new Group();
  3265. r.associations.set(y2, {
  3266. meshes: i
  3267. });
  3268. for (let C = 0, I2 = _.length; C < I2; C++)
  3269. y2.add(_[C]);
  3270. return y2;
  3271. });
  3272. }
  3273. /**
  3274. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
  3275. * @param {number} cameraIndex
  3276. * @return {Promise<THREE.Camera>}
  3277. */
  3278. loadCamera(i) {
  3279. let r;
  3280. const s = this.json.cameras[i], a = s[s.type];
  3281. if (!a) {
  3282. console.warn("THREE.GLTFLoader: Missing camera parameters.");
  3283. return;
  3284. }
  3285. return s.type === "perspective" ? r = new PerspectiveCamera(MathUtils.radToDeg(a.yfov), a.aspectRatio || 1, a.znear || 1, a.zfar || 2e6) : s.type === "orthographic" && (r = new OrthographicCamera(-a.xmag, a.xmag, a.ymag, -a.ymag, a.znear, a.zfar)), s.name && (r.name = this.createUniqueName(s.name)), Vn(r, s), Promise.resolve(r);
  3286. }
  3287. /**
  3288. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
  3289. * @param {number} skinIndex
  3290. * @return {Promise<Object>}
  3291. */
  3292. loadSkin(i) {
  3293. const r = this.json.skins[i], s = {
  3294. joints: r.joints
  3295. };
  3296. return r.inverseBindMatrices === void 0 ? Promise.resolve(s) : this.getDependency("accessor", r.inverseBindMatrices).then(function(a) {
  3297. return s.inverseBindMatrices = a, s;
  3298. });
  3299. }
  3300. /**
  3301. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
  3302. * @param {number} animationIndex
  3303. * @return {Promise<AnimationClip>}
  3304. */
  3305. loadAnimation(i) {
  3306. const s = this.json.animations[i], a = [], c = [], u = [], h2 = [], d = [];
  3307. for (let g = 0, w = s.channels.length; g < w; g++) {
  3308. const _ = s.channels[g], y2 = s.samplers[_.sampler], C = _.target, I2 = C.node, S2 = s.parameters !== void 0 ? s.parameters[y2.input] : y2.input, R2 = s.parameters !== void 0 ? s.parameters[y2.output] : y2.output;
  3309. a.push(this.getDependency("node", I2)), c.push(this.getDependency("accessor", S2)), u.push(this.getDependency("accessor", R2)), h2.push(y2), d.push(C);
  3310. }
  3311. return Promise.all([Promise.all(a), Promise.all(c), Promise.all(u), Promise.all(h2), Promise.all(d)]).then(function(g) {
  3312. const w = g[0], _ = g[1], y2 = g[2], C = g[3], I2 = g[4], S2 = [];
  3313. for (let j2 = 0, F = w.length; j2 < F; j2++) {
  3314. const V2 = w[j2], D = _[j2], Y = y2[j2], G2 = C[j2], N = I2[j2];
  3315. if (V2 === void 0)
  3316. continue;
  3317. V2.updateMatrix();
  3318. let O;
  3319. switch (rn[N.path]) {
  3320. case rn.weights:
  3321. O = NumberKeyframeTrack;
  3322. break;
  3323. case rn.rotation:
  3324. O = QuaternionKeyframeTrack;
  3325. break;
  3326. case rn.position:
  3327. case rn.scale:
  3328. default:
  3329. O = VectorKeyframeTrack;
  3330. break;
  3331. }
  3332. const H2 = V2.name ? V2.name : V2.uuid, K = G2.interpolation !== void 0 ? Mu[G2.interpolation] : InterpolateLinear, q = [];
  3333. rn[N.path] === rn.weights ? V2.traverse(function(_e) {
  3334. _e.morphTargetInfluences && q.push(_e.name ? _e.name : _e.uuid);
  3335. }) : q.push(H2);
  3336. let he = Y.array;
  3337. if (Y.normalized) {
  3338. const _e = mo(he.constructor), pe2 = new Float32Array(he.length);
  3339. for (let fe2 = 0, de = he.length; fe2 < de; fe2++)
  3340. pe2[fe2] = he[fe2] * _e;
  3341. he = pe2;
  3342. }
  3343. for (let _e = 0, pe2 = q.length; _e < pe2; _e++) {
  3344. const fe2 = new O(q[_e] + "." + rn[N.path], D.array, he, K);
  3345. G2.interpolation === "CUBICSPLINE" && (fe2.createInterpolant = function(ee2) {
  3346. const X = this instanceof QuaternionKeyframeTrack ? ku : qa;
  3347. return new X(this.times, this.values, this.getValueSize() / 3, ee2);
  3348. }, fe2.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true), S2.push(fe2);
  3349. }
  3350. }
  3351. const R2 = s.name ? s.name : "animation_" + i;
  3352. return new AnimationClip(R2, void 0, S2);
  3353. });
  3354. }
  3355. createNodeMesh(i) {
  3356. const r = this.json, s = this, a = r.nodes[i];
  3357. return a.mesh === void 0 ? null : s.getDependency("mesh", a.mesh).then(function(c) {
  3358. const u = s._getNodeRef(s.meshCache, a.mesh, c);
  3359. return a.weights !== void 0 && u.traverse(function(h2) {
  3360. if (h2.isMesh)
  3361. for (let d = 0, g = a.weights.length; d < g; d++)
  3362. h2.morphTargetInfluences[d] = a.weights[d];
  3363. }), u;
  3364. });
  3365. }
  3366. /**
  3367. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
  3368. * @param {number} nodeIndex
  3369. * @return {Promise<Object3D>}
  3370. */
  3371. loadNode(i) {
  3372. const r = this.json, s = this.extensions, a = this, c = r.nodes[i], u = c.name ? a.createUniqueName(c.name) : "";
  3373. return function() {
  3374. const h2 = [], d = a._invokeOne(function(g) {
  3375. return g.createNodeMesh && g.createNodeMesh(i);
  3376. });
  3377. return d && h2.push(d), c.camera !== void 0 && h2.push(a.getDependency("camera", c.camera).then(function(g) {
  3378. return a._getNodeRef(a.cameraCache, c.camera, g);
  3379. })), a._invokeAll(function(g) {
  3380. return g.createNodeAttachment && g.createNodeAttachment(i);
  3381. }).forEach(function(g) {
  3382. h2.push(g);
  3383. }), Promise.all(h2);
  3384. }().then(function(h2) {
  3385. let d;
  3386. if (c.isBone === true ? d = new Bone() : h2.length > 1 ? d = new Group() : h2.length === 1 ? d = h2[0] : d = new Object3D(), d !== h2[0])
  3387. for (let g = 0, w = h2.length; g < w; g++)
  3388. d.add(h2[g]);
  3389. if (c.name && (d.userData.name = c.name, d.name = u), Vn(d, c), c.extensions && $i(s, d, c), c.matrix !== void 0) {
  3390. const g = new Matrix4();
  3391. g.fromArray(c.matrix), d.applyMatrix4(g);
  3392. } else
  3393. c.translation !== void 0 && d.position.fromArray(c.translation), c.rotation !== void 0 && d.quaternion.fromArray(c.rotation), c.scale !== void 0 && d.scale.fromArray(c.scale);
  3394. return a.associations.has(d) || a.associations.set(d, {}), a.associations.get(d).nodes = i, d;
  3395. });
  3396. }
  3397. /**
  3398. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
  3399. * @param {number} sceneIndex
  3400. * @return {Promise<Group>}
  3401. */
  3402. loadScene(i) {
  3403. const r = this.json, s = this.extensions, a = this.json.scenes[i], c = this, u = new Group();
  3404. a.name && (u.name = c.createUniqueName(a.name)), Vn(u, a), a.extensions && $i(s, u, a);
  3405. const h2 = a.nodes || [], d = [];
  3406. for (let g = 0, w = h2.length; g < w; g++)
  3407. d.push(Qa(h2[g], u, r, c));
  3408. return Promise.all(d).then(function() {
  3409. const g = (w) => {
  3410. const _ = /* @__PURE__ */ new Map();
  3411. for (const [y2, C] of c.associations)
  3412. (y2 instanceof Material || y2 instanceof Texture) && _.set(y2, C);
  3413. return w.traverse((y2) => {
  3414. const C = c.associations.get(y2);
  3415. C != null && _.set(y2, C);
  3416. }), _;
  3417. };
  3418. return c.associations = g(u), u;
  3419. });
  3420. }
  3421. };
  3422. function Qa(b2, i, r, s) {
  3423. const a = r.nodes[b2];
  3424. return s.getDependency("node", b2).then(function(c) {
  3425. if (a.skin === void 0)
  3426. return c;
  3427. let u;
  3428. return s.getDependency("skin", a.skin).then(function(h2) {
  3429. u = h2;
  3430. const d = [];
  3431. for (let g = 0, w = u.joints.length; g < w; g++)
  3432. d.push(s.getDependency("node", u.joints[g]));
  3433. return Promise.all(d);
  3434. }).then(function(h2) {
  3435. return c.traverse(function(d) {
  3436. if (!d.isMesh)
  3437. return;
  3438. const g = [], w = [];
  3439. for (let _ = 0, y2 = h2.length; _ < y2; _++) {
  3440. const C = h2[_];
  3441. if (C) {
  3442. g.push(C);
  3443. const I2 = new Matrix4();
  3444. u.inverseBindMatrices !== void 0 && I2.fromArray(u.inverseBindMatrices.array, _ * 16), w.push(I2);
  3445. } else
  3446. console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', u.joints[_]);
  3447. }
  3448. d.bind(new Skeleton(g, w), d.matrixWorld);
  3449. }), c;
  3450. });
  3451. }).then(function(c) {
  3452. i.add(c);
  3453. const u = [];
  3454. if (a.children) {
  3455. const h2 = a.children;
  3456. for (let d = 0, g = h2.length; d < g; d++) {
  3457. const w = h2[d];
  3458. u.push(Qa(w, c, r, s));
  3459. }
  3460. }
  3461. return Promise.all(u);
  3462. });
  3463. }
  3464. function Du(b2, i, r) {
  3465. const s = i.attributes, a = new Box3();
  3466. if (s.POSITION !== void 0) {
  3467. const h2 = r.json.accessors[s.POSITION], d = h2.min, g = h2.max;
  3468. if (d !== void 0 && g !== void 0) {
  3469. if (a.set(new Vector3(d[0], d[1], d[2]), new Vector3(g[0], g[1], g[2])), h2.normalized) {
  3470. const w = mo(es[h2.componentType]);
  3471. a.min.multiplyScalar(w), a.max.multiplyScalar(w);
  3472. }
  3473. } else {
  3474. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  3475. return;
  3476. }
  3477. } else
  3478. return;
  3479. const c = i.targets;
  3480. if (c !== void 0) {
  3481. const h2 = new Vector3(), d = new Vector3();
  3482. for (let g = 0, w = c.length; g < w; g++) {
  3483. const _ = c[g];
  3484. if (_.POSITION !== void 0) {
  3485. const y2 = r.json.accessors[_.POSITION], C = y2.min, I2 = y2.max;
  3486. if (C !== void 0 && I2 !== void 0) {
  3487. if (d.setX(Math.max(Math.abs(C[0]), Math.abs(I2[0]))), d.setY(Math.max(Math.abs(C[1]), Math.abs(I2[1]))), d.setZ(Math.max(Math.abs(C[2]), Math.abs(I2[2]))), y2.normalized) {
  3488. const S2 = mo(es[y2.componentType]);
  3489. d.multiplyScalar(S2);
  3490. }
  3491. h2.max(d);
  3492. } else
  3493. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  3494. }
  3495. }
  3496. a.expandByVector(h2);
  3497. }
  3498. b2.boundingBox = a;
  3499. const u = new Sphere();
  3500. a.getCenter(u.center), u.radius = a.min.distanceTo(a.max) / 2, b2.boundingSphere = u;
  3501. }
  3502. function da(b2, i, r) {
  3503. const s = i.attributes, a = [];
  3504. function c(u, h2) {
  3505. return r.getDependency("accessor", u).then(function(d) {
  3506. b2.setAttribute(h2, d);
  3507. });
  3508. }
  3509. for (const u in s) {
  3510. const h2 = ho[u] || u.toLowerCase();
  3511. h2 in b2.attributes || a.push(c(s[u], h2));
  3512. }
  3513. if (i.indices !== void 0 && !b2.index) {
  3514. const u = r.getDependency("accessor", i.indices).then(function(h2) {
  3515. b2.setIndex(h2);
  3516. });
  3517. a.push(u);
  3518. }
  3519. return Vn(b2, i), Du(b2, i, r), Promise.all(a).then(function() {
  3520. return i.targets !== void 0 ? Au(b2, i.targets, r) : b2;
  3521. });
  3522. }
  3523. function ma(b2, i) {
  3524. let r = b2.getIndex();
  3525. if (r === null) {
  3526. const u = [], h2 = b2.getAttribute("position");
  3527. if (h2 !== void 0) {
  3528. for (let d = 0; d < h2.count; d++)
  3529. u.push(d);
  3530. b2.setIndex(u), r = b2.getIndex();
  3531. } else
  3532. return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), b2;
  3533. }
  3534. const s = r.count - 2, a = [];
  3535. if (i === TriangleFanDrawMode)
  3536. for (let u = 1; u <= s; u++)
  3537. a.push(r.getX(0)), a.push(r.getX(u)), a.push(r.getX(u + 1));
  3538. else
  3539. for (let u = 0; u < s; u++)
  3540. u % 2 === 0 ? (a.push(r.getX(u)), a.push(r.getX(u + 1)), a.push(r.getX(u + 2))) : (a.push(r.getX(u + 2)), a.push(r.getX(u + 1)), a.push(r.getX(u)));
  3541. a.length / 3 !== s && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  3542. const c = b2.clone();
  3543. return c.setIndex(a), c;
  3544. }
  3545. var Ou = class extends ExtrudeGeometry {
  3546. constructor(i, r = {}) {
  3547. const {
  3548. bevelEnabled: s = false,
  3549. bevelSize: a = 8,
  3550. bevelThickness: c = 10,
  3551. font: u,
  3552. height: h2 = 50,
  3553. size: d = 100,
  3554. lineHeight: g = 1,
  3555. letterSpacing: w = 0,
  3556. ..._
  3557. } = r;
  3558. if (u === void 0)
  3559. super();
  3560. else {
  3561. const y2 = u.generateShapes(i, d, {
  3562. lineHeight: g,
  3563. letterSpacing: w
  3564. });
  3565. super(y2, {
  3566. ..._,
  3567. bevelEnabled: s,
  3568. bevelSize: a,
  3569. bevelThickness: c,
  3570. depth: h2
  3571. });
  3572. }
  3573. this.type = "TextGeometry";
  3574. }
  3575. };
  3576. function Za(b2, i, r) {
  3577. const s = r.length - b2 - 1;
  3578. if (i >= r[s])
  3579. return s - 1;
  3580. if (i <= r[b2])
  3581. return b2;
  3582. let a = b2, c = s, u = Math.floor((a + c) / 2);
  3583. for (; i < r[u] || i >= r[u + 1]; )
  3584. i < r[u] ? c = u : a = u, u = Math.floor((a + c) / 2);
  3585. return u;
  3586. }
  3587. function Nu(b2, i, r, s) {
  3588. const a = [], c = [], u = [];
  3589. a[0] = 1;
  3590. for (let h2 = 1; h2 <= r; ++h2) {
  3591. c[h2] = i - s[b2 + 1 - h2], u[h2] = s[b2 + h2] - i;
  3592. let d = 0;
  3593. for (let g = 0; g < h2; ++g) {
  3594. const w = u[g + 1], _ = c[h2 - g], y2 = a[g] / (w + _);
  3595. a[g] = d + w * y2, d = _ * y2;
  3596. }
  3597. a[h2] = d;
  3598. }
  3599. return a;
  3600. }
  3601. function Fu(b2, i, r, s) {
  3602. const a = Za(b2, s, i), c = Nu(a, s, b2, i), u = new Vector4(0, 0, 0, 0);
  3603. for (let h2 = 0; h2 <= b2; ++h2) {
  3604. const d = r[a - b2 + h2], g = c[h2], w = d.w * g;
  3605. u.x += d.x * w, u.y += d.y * w, u.z += d.z * w, u.w += d.w * g;
  3606. }
  3607. return u;
  3608. }
  3609. function Bu(b2, i, r, s, a) {
  3610. const c = [];
  3611. for (let y2 = 0; y2 <= r; ++y2)
  3612. c[y2] = 0;
  3613. const u = [];
  3614. for (let y2 = 0; y2 <= s; ++y2)
  3615. u[y2] = c.slice(0);
  3616. const h2 = [];
  3617. for (let y2 = 0; y2 <= r; ++y2)
  3618. h2[y2] = c.slice(0);
  3619. h2[0][0] = 1;
  3620. const d = c.slice(0), g = c.slice(0);
  3621. for (let y2 = 1; y2 <= r; ++y2) {
  3622. d[y2] = i - a[b2 + 1 - y2], g[y2] = a[b2 + y2] - i;
  3623. let C = 0;
  3624. for (let I2 = 0; I2 < y2; ++I2) {
  3625. const S2 = g[I2 + 1], R2 = d[y2 - I2];
  3626. h2[y2][I2] = S2 + R2;
  3627. const j2 = h2[I2][y2 - 1] / h2[y2][I2];
  3628. h2[I2][y2] = C + S2 * j2, C = R2 * j2;
  3629. }
  3630. h2[y2][y2] = C;
  3631. }
  3632. for (let y2 = 0; y2 <= r; ++y2)
  3633. u[0][y2] = h2[y2][r];
  3634. for (let y2 = 0; y2 <= r; ++y2) {
  3635. let C = 0, I2 = 1;
  3636. const S2 = [];
  3637. for (let R2 = 0; R2 <= r; ++R2)
  3638. S2[R2] = c.slice(0);
  3639. S2[0][0] = 1;
  3640. for (let R2 = 1; R2 <= s; ++R2) {
  3641. let j2 = 0;
  3642. const F = y2 - R2, V2 = r - R2;
  3643. y2 >= R2 && (S2[I2][0] = S2[C][0] / h2[V2 + 1][F], j2 = S2[I2][0] * h2[F][V2]);
  3644. const D = F >= -1 ? 1 : -F, Y = y2 - 1 <= V2 ? R2 - 1 : r - y2;
  3645. for (let G2 = D; G2 <= Y; ++G2)
  3646. S2[I2][G2] = (S2[C][G2] - S2[C][G2 - 1]) / h2[V2 + 1][F + G2], j2 += S2[I2][G2] * h2[F + G2][V2];
  3647. y2 <= V2 && (S2[I2][R2] = -S2[C][R2 - 1] / h2[V2 + 1][y2], j2 += S2[I2][R2] * h2[y2][V2]), u[R2][y2] = j2;
  3648. var w = C;
  3649. C = I2, I2 = w;
  3650. }
  3651. }
  3652. var _ = r;
  3653. for (let y2 = 1; y2 <= s; ++y2) {
  3654. for (let C = 0; C <= r; ++C)
  3655. u[y2][C] *= _;
  3656. _ *= r - y2;
  3657. }
  3658. return u;
  3659. }
  3660. function ju(b2, i, r, s, a) {
  3661. const c = a < b2 ? a : b2, u = [], h2 = Za(b2, s, i), d = Bu(h2, s, b2, c, i), g = [];
  3662. for (let _ = 0; _ < r.length; ++_) {
  3663. var w = r[_].clone();
  3664. const y2 = w.w;
  3665. w.x *= y2, w.y *= y2, w.z *= y2, g[_] = w;
  3666. }
  3667. for (let _ = 0; _ <= c; ++_) {
  3668. var w = g[h2 - b2].clone().multiplyScalar(d[_][0]);
  3669. for (let C = 1; C <= b2; ++C)
  3670. w.add(g[h2 - b2 + C].clone().multiplyScalar(d[_][C]));
  3671. u[_] = w;
  3672. }
  3673. for (let _ = c + 1; _ <= a + 1; ++_)
  3674. u[_] = new Vector4(0, 0, 0);
  3675. return u;
  3676. }
  3677. function zu(b2, i) {
  3678. let r = 1;
  3679. for (let a = 2; a <= b2; ++a)
  3680. r *= a;
  3681. let s = 1;
  3682. for (let a = 2; a <= i; ++a)
  3683. s *= a;
  3684. for (let a = 2; a <= b2 - i; ++a)
  3685. s *= a;
  3686. return r / s;
  3687. }
  3688. function Uu(b2) {
  3689. const i = b2.length, r = [], s = [];
  3690. for (let c = 0; c < i; ++c) {
  3691. const u = b2[c];
  3692. r[c] = new Vector3(u.x, u.y, u.z), s[c] = u.w;
  3693. }
  3694. const a = [];
  3695. for (let c = 0; c < i; ++c) {
  3696. const u = r[c].clone();
  3697. for (let h2 = 1; h2 <= c; ++h2)
  3698. u.sub(a[c - h2].clone().multiplyScalar(zu(c, h2) * s[h2]));
  3699. a[c] = u.divideScalar(s[0]);
  3700. }
  3701. return a;
  3702. }
  3703. function Gu(b2, i, r, s, a) {
  3704. const c = ju(b2, i, r, s, a);
  3705. return Uu(c);
  3706. }
  3707. var fa = class extends Curve {
  3708. constructor(i, r, s, a, c) {
  3709. super(), this.degree = i, this.knots = r, this.controlPoints = [], this.startKnot = a || 0, this.endKnot = c || this.knots.length - 1;
  3710. for (let u = 0; u < s.length; ++u) {
  3711. const h2 = s[u];
  3712. this.controlPoints[u] = new Vector4(h2.x, h2.y, h2.z, h2.w);
  3713. }
  3714. }
  3715. getPoint(i, r) {
  3716. const s = r || new Vector3(), a = this.knots[this.startKnot] + i * (this.knots[this.endKnot] - this.knots[this.startKnot]), c = Fu(this.degree, this.knots, this.controlPoints, a);
  3717. return c.w != 1 && c.divideScalar(c.w), s.set(c.x, c.y, c.z);
  3718. }
  3719. getTangent(i, r) {
  3720. const s = r || new Vector3(), a = this.knots[0] + i * (this.knots[this.knots.length - 1] - this.knots[0]), c = Gu(this.degree, this.knots, this.controlPoints, a, 1);
  3721. return s.copy(c[1]).normalize(), s;
  3722. }
  3723. };
  3724. var re;
  3725. var Le;
  3726. var Je2;
  3727. var Hu = class extends Loader {
  3728. constructor(i) {
  3729. super(i);
  3730. }
  3731. load(i, r, s, a) {
  3732. const c = this, u = c.path === "" ? LoaderUtils.extractUrlBase(i) : c.path, h2 = new FileLoader(this.manager);
  3733. h2.setPath(c.path), h2.setResponseType("arraybuffer"), h2.setRequestHeader(c.requestHeader), h2.setWithCredentials(c.withCredentials), h2.load(i, function(d) {
  3734. try {
  3735. r(c.parse(d, u));
  3736. } catch (g) {
  3737. a ? a(g) : console.error(g), c.manager.itemError(i);
  3738. }
  3739. }, s, a);
  3740. }
  3741. parse(i, r) {
  3742. if (Qu(i))
  3743. re = new qu().parse(i);
  3744. else {
  3745. const a = tl(i);
  3746. if (!Zu(a))
  3747. throw new Error("THREE.FBXLoader: Unknown format.");
  3748. if (ba(a) < 7e3)
  3749. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + ba(a));
  3750. re = new Yu().parse(a);
  3751. }
  3752. const s = new TextureLoader(this.manager).setPath(this.resourcePath || r).setCrossOrigin(this.crossOrigin);
  3753. return new Ku(s, this.manager).parse(re);
  3754. }
  3755. };
  3756. var Ku = class {
  3757. constructor(i, r) {
  3758. this.textureLoader = i, this.manager = r;
  3759. }
  3760. parse() {
  3761. Le = this.parseConnections();
  3762. const i = this.parseImages(), r = this.parseTextures(i), s = this.parseMaterials(r), a = this.parseDeformers(), c = new $u().parse(a);
  3763. return this.parseScene(a, c, s), Je2;
  3764. }
  3765. // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
  3766. // and details the connection type
  3767. parseConnections() {
  3768. const i = /* @__PURE__ */ new Map();
  3769. return "Connections" in re && re.Connections.connections.forEach(function(s) {
  3770. const a = s[0], c = s[1], u = s[2];
  3771. i.has(a) || i.set(a, {
  3772. parents: [],
  3773. children: []
  3774. });
  3775. const h2 = {
  3776. ID: c,
  3777. relationship: u
  3778. };
  3779. i.get(a).parents.push(h2), i.has(c) || i.set(c, {
  3780. parents: [],
  3781. children: []
  3782. });
  3783. const d = {
  3784. ID: a,
  3785. relationship: u
  3786. };
  3787. i.get(c).children.push(d);
  3788. }), i;
  3789. }
  3790. // Parse FBXTree.Objects.Video for embedded image data
  3791. // These images are connected to textures in FBXTree.Objects.Textures
  3792. // via FBXTree.Connections.
  3793. parseImages() {
  3794. const i = {}, r = {};
  3795. if ("Video" in re.Objects) {
  3796. const s = re.Objects.Video;
  3797. for (const a in s) {
  3798. const c = s[a], u = parseInt(a);
  3799. if (i[u] = c.RelativeFilename || c.Filename, "Content" in c) {
  3800. const h2 = c.Content instanceof ArrayBuffer && c.Content.byteLength > 0, d = typeof c.Content == "string" && c.Content !== "";
  3801. if (h2 || d) {
  3802. const g = this.parseImage(s[a]);
  3803. r[c.RelativeFilename || c.Filename] = g;
  3804. }
  3805. }
  3806. }
  3807. }
  3808. for (const s in i) {
  3809. const a = i[s];
  3810. r[a] !== void 0 ? i[s] = r[a] : i[s] = i[s].split("\\").pop();
  3811. }
  3812. return i;
  3813. }
  3814. // Parse embedded image data in FBXTree.Video.Content
  3815. parseImage(i) {
  3816. const r = i.Content, s = i.RelativeFilename || i.Filename, a = s.slice(s.lastIndexOf(".") + 1).toLowerCase();
  3817. let c;
  3818. switch (a) {
  3819. case "bmp":
  3820. c = "image/bmp";
  3821. break;
  3822. case "jpg":
  3823. case "jpeg":
  3824. c = "image/jpeg";
  3825. break;
  3826. case "png":
  3827. c = "image/png";
  3828. break;
  3829. case "tif":
  3830. c = "image/tiff";
  3831. break;
  3832. case "tga":
  3833. this.manager.getHandler(".tga") === null && console.warn("FBXLoader: TGA loader not found, skipping ", s), c = "image/tga";
  3834. break;
  3835. default:
  3836. console.warn('FBXLoader: Image type "' + a + '" is not supported.');
  3837. return;
  3838. }
  3839. if (typeof r == "string")
  3840. return "data:" + c + ";base64," + r;
  3841. {
  3842. const u = new Uint8Array(r);
  3843. return window.URL.createObjectURL(new Blob([u], {
  3844. type: c
  3845. }));
  3846. }
  3847. }
  3848. // Parse nodes in FBXTree.Objects.Texture
  3849. // These contain details such as UV scaling, cropping, rotation etc and are connected
  3850. // to images in FBXTree.Objects.Video
  3851. parseTextures(i) {
  3852. const r = /* @__PURE__ */ new Map();
  3853. if ("Texture" in re.Objects) {
  3854. const s = re.Objects.Texture;
  3855. for (const a in s) {
  3856. const c = this.parseTexture(s[a], i);
  3857. r.set(parseInt(a), c);
  3858. }
  3859. }
  3860. return r;
  3861. }
  3862. // Parse individual node in FBXTree.Objects.Texture
  3863. parseTexture(i, r) {
  3864. const s = this.loadTexture(i, r);
  3865. s.ID = i.id, s.name = i.attrName;
  3866. const a = i.WrapModeU, c = i.WrapModeV, u = a !== void 0 ? a.value : 0, h2 = c !== void 0 ? c.value : 0;
  3867. if (s.wrapS = u === 0 ? RepeatWrapping : ClampToEdgeWrapping, s.wrapT = h2 === 0 ? RepeatWrapping : ClampToEdgeWrapping, "Scaling" in i) {
  3868. const d = i.Scaling.value;
  3869. s.repeat.x = d[0], s.repeat.y = d[1];
  3870. }
  3871. return s;
  3872. }
  3873. // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
  3874. loadTexture(i, r) {
  3875. let s;
  3876. const a = this.textureLoader.path, c = Le.get(i.id).children;
  3877. c !== void 0 && c.length > 0 && r[c[0].ID] !== void 0 && (s = r[c[0].ID], (s.indexOf("blob:") === 0 || s.indexOf("data:") === 0) && this.textureLoader.setPath(void 0));
  3878. let u;
  3879. const h2 = i.FileName.slice(-3).toLowerCase();
  3880. if (h2 === "tga") {
  3881. const d = this.manager.getHandler(".tga");
  3882. d === null ? (console.warn("FBXLoader: TGA loader not found, creating placeholder texture for", i.RelativeFilename), u = new Texture()) : (d.setPath(this.textureLoader.path), u = d.load(s));
  3883. } else
  3884. h2 === "psd" ? (console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for", i.RelativeFilename), u = new Texture()) : u = this.textureLoader.load(s);
  3885. return this.textureLoader.setPath(a), u;
  3886. }
  3887. // Parse nodes in FBXTree.Objects.Material
  3888. parseMaterials(i) {
  3889. const r = /* @__PURE__ */ new Map();
  3890. if ("Material" in re.Objects) {
  3891. const s = re.Objects.Material;
  3892. for (const a in s) {
  3893. const c = this.parseMaterial(s[a], i);
  3894. c !== null && r.set(parseInt(a), c);
  3895. }
  3896. }
  3897. return r;
  3898. }
  3899. // Parse single node in FBXTree.Objects.Material
  3900. // Materials are connected to texture maps in FBXTree.Objects.Textures
  3901. // FBX format currently only supports Lambert and Phong shading models
  3902. parseMaterial(i, r) {
  3903. const s = i.id, a = i.attrName;
  3904. let c = i.ShadingModel;
  3905. if (typeof c == "object" && (c = c.value), !Le.has(s))
  3906. return null;
  3907. const u = this.parseParameters(i, r, s);
  3908. let h2;
  3909. switch (c.toLowerCase()) {
  3910. case "phong":
  3911. h2 = new MeshPhongMaterial();
  3912. break;
  3913. case "lambert":
  3914. h2 = new MeshLambertMaterial();
  3915. break;
  3916. default:
  3917. console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', c), h2 = new MeshPhongMaterial();
  3918. break;
  3919. }
  3920. return h2.setValues(u), h2.name = a, h2;
  3921. }
  3922. // Parse FBX material and return parameters suitable for a three.js material
  3923. // Also parse the texture map and return any textures associated with the material
  3924. parseParameters(i, r, s) {
  3925. const a = {};
  3926. i.BumpFactor && (a.bumpScale = i.BumpFactor.value), i.Diffuse ? a.color = new Color().fromArray(i.Diffuse.value) : i.DiffuseColor && (i.DiffuseColor.type === "Color" || i.DiffuseColor.type === "ColorRGB") && (a.color = new Color().fromArray(i.DiffuseColor.value)), i.DisplacementFactor && (a.displacementScale = i.DisplacementFactor.value), i.Emissive ? a.emissive = new Color().fromArray(i.Emissive.value) : i.EmissiveColor && (i.EmissiveColor.type === "Color" || i.EmissiveColor.type === "ColorRGB") && (a.emissive = new Color().fromArray(i.EmissiveColor.value)), i.EmissiveFactor && (a.emissiveIntensity = parseFloat(i.EmissiveFactor.value)), i.Opacity && (a.opacity = parseFloat(i.Opacity.value)), a.opacity < 1 && (a.transparent = true), i.ReflectionFactor && (a.reflectivity = i.ReflectionFactor.value), i.Shininess && (a.shininess = i.Shininess.value), i.Specular ? a.specular = new Color().fromArray(i.Specular.value) : i.SpecularColor && i.SpecularColor.type === "Color" && (a.specular = new Color().fromArray(i.SpecularColor.value));
  3927. const c = this;
  3928. return Le.get(s).children.forEach(function(u) {
  3929. const h2 = u.relationship;
  3930. switch (h2) {
  3931. case "Bump":
  3932. a.bumpMap = c.getTexture(r, u.ID);
  3933. break;
  3934. case "Maya|TEX_ao_map":
  3935. a.aoMap = c.getTexture(r, u.ID);
  3936. break;
  3937. case "DiffuseColor":
  3938. case "Maya|TEX_color_map":
  3939. a.map = c.getTexture(r, u.ID), a.map !== void 0 && (a.map.encoding = sRGBEncoding);
  3940. break;
  3941. case "DisplacementColor":
  3942. a.displacementMap = c.getTexture(r, u.ID);
  3943. break;
  3944. case "EmissiveColor":
  3945. a.emissiveMap = c.getTexture(r, u.ID), a.emissiveMap !== void 0 && (a.emissiveMap.encoding = sRGBEncoding);
  3946. break;
  3947. case "NormalMap":
  3948. case "Maya|TEX_normal_map":
  3949. a.normalMap = c.getTexture(r, u.ID);
  3950. break;
  3951. case "ReflectionColor":
  3952. a.envMap = c.getTexture(r, u.ID), a.envMap !== void 0 && (a.envMap.mapping = EquirectangularReflectionMapping, a.envMap.encoding = sRGBEncoding);
  3953. break;
  3954. case "SpecularColor":
  3955. a.specularMap = c.getTexture(r, u.ID), a.specularMap !== void 0 && (a.specularMap.encoding = sRGBEncoding);
  3956. break;
  3957. case "TransparentColor":
  3958. case "TransparencyFactor":
  3959. a.alphaMap = c.getTexture(r, u.ID), a.transparent = true;
  3960. break;
  3961. case "AmbientColor":
  3962. case "ShininessExponent":
  3963. case "SpecularFactor":
  3964. case "VectorDisplacementColor":
  3965. default:
  3966. console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", h2);
  3967. break;
  3968. }
  3969. }), a;
  3970. }
  3971. // get a texture from the textureMap for use by a material.
  3972. getTexture(i, r) {
  3973. return "LayeredTexture" in re.Objects && r in re.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), r = Le.get(r).children[0].ID), i.get(r);
  3974. }
  3975. // Parse nodes in FBXTree.Objects.Deformer
  3976. // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
  3977. // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
  3978. parseDeformers() {
  3979. const i = {}, r = {};
  3980. if ("Deformer" in re.Objects) {
  3981. const s = re.Objects.Deformer;
  3982. for (const a in s) {
  3983. const c = s[a], u = Le.get(parseInt(a));
  3984. if (c.attrType === "Skin") {
  3985. const h2 = this.parseSkeleton(u, s);
  3986. h2.ID = a, u.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), h2.geometryID = u.parents[0].ID, i[a] = h2;
  3987. } else if (c.attrType === "BlendShape") {
  3988. const h2 = {
  3989. id: a
  3990. };
  3991. h2.rawTargets = this.parseMorphTargets(u, s), h2.id = a, u.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), r[a] = h2;
  3992. }
  3993. }
  3994. }
  3995. return {
  3996. skeletons: i,
  3997. morphTargets: r
  3998. };
  3999. }
  4000. // Parse single nodes in FBXTree.Objects.Deformer
  4001. // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
  4002. // Each skin node represents a skeleton and each cluster node represents a bone
  4003. parseSkeleton(i, r) {
  4004. const s = [];
  4005. return i.children.forEach(function(a) {
  4006. const c = r[a.ID];
  4007. if (c.attrType !== "Cluster")
  4008. return;
  4009. const u = {
  4010. ID: a.ID,
  4011. indices: [],
  4012. weights: [],
  4013. transformLink: new Matrix4().fromArray(c.TransformLink.a)
  4014. // transform: new Matrix4().fromArray( boneNode.Transform.a ),
  4015. // linkMode: boneNode.Mode,
  4016. };
  4017. "Indexes" in c && (u.indices = c.Indexes.a, u.weights = c.Weights.a), s.push(u);
  4018. }), {
  4019. rawBones: s,
  4020. bones: []
  4021. };
  4022. }
  4023. // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
  4024. parseMorphTargets(i, r) {
  4025. const s = [];
  4026. for (let a = 0; a < i.children.length; a++) {
  4027. const c = i.children[a], u = r[c.ID], h2 = {
  4028. name: u.attrName,
  4029. initialWeight: u.DeformPercent,
  4030. id: u.id,
  4031. fullWeights: u.FullWeights.a
  4032. };
  4033. if (u.attrType !== "BlendShapeChannel")
  4034. return;
  4035. h2.geoID = Le.get(parseInt(c.ID)).children.filter(function(d) {
  4036. return d.relationship === void 0;
  4037. })[0].ID, s.push(h2);
  4038. }
  4039. return s;
  4040. }
  4041. // create the main Group() to be returned by the loader
  4042. parseScene(i, r, s) {
  4043. Je2 = new Group();
  4044. const a = this.parseModels(i.skeletons, r, s), c = re.Objects.Model, u = this;
  4045. a.forEach(function(d) {
  4046. const g = c[d.ID];
  4047. u.setLookAtProperties(d, g), Le.get(d.ID).parents.forEach(function(_) {
  4048. const y2 = a.get(_.ID);
  4049. y2 !== void 0 && y2.add(d);
  4050. }), d.parent === null && Je2.add(d);
  4051. }), this.bindSkeleton(i.skeletons, r, a), this.createAmbientLight(), Je2.traverse(function(d) {
  4052. if (d.userData.transformData) {
  4053. d.parent && (d.userData.transformData.parentMatrix = d.parent.matrix, d.userData.transformData.parentMatrixWorld = d.parent.matrixWorld);
  4054. const g = Ja(d.userData.transformData);
  4055. d.applyMatrix4(g), d.updateWorldMatrix();
  4056. }
  4057. });
  4058. const h2 = new Xu().parse();
  4059. Je2.children.length === 1 && Je2.children[0].isGroup && (Je2.children[0].animations = h2, Je2 = Je2.children[0]), Je2.animations = h2;
  4060. }
  4061. // parse nodes in FBXTree.Objects.Model
  4062. parseModels(i, r, s) {
  4063. const a = /* @__PURE__ */ new Map(), c = re.Objects.Model;
  4064. for (const u in c) {
  4065. const h2 = parseInt(u), d = c[u], g = Le.get(h2);
  4066. let w = this.buildSkeleton(g, i, h2, d.attrName);
  4067. if (!w) {
  4068. switch (d.attrType) {
  4069. case "Camera":
  4070. w = this.createCamera(g);
  4071. break;
  4072. case "Light":
  4073. w = this.createLight(g);
  4074. break;
  4075. case "Mesh":
  4076. w = this.createMesh(g, r, s);
  4077. break;
  4078. case "NurbsCurve":
  4079. w = this.createCurve(g, r);
  4080. break;
  4081. case "LimbNode":
  4082. case "Root":
  4083. w = new Bone();
  4084. break;
  4085. case "Null":
  4086. default:
  4087. w = new Group();
  4088. break;
  4089. }
  4090. w.name = d.attrName ? PropertyBinding.sanitizeNodeName(d.attrName) : "", w.ID = h2;
  4091. }
  4092. this.getTransformData(w, d), a.set(h2, w);
  4093. }
  4094. return a;
  4095. }
  4096. buildSkeleton(i, r, s, a) {
  4097. let c = null;
  4098. return i.parents.forEach(function(u) {
  4099. for (const h2 in r) {
  4100. const d = r[h2];
  4101. d.rawBones.forEach(function(g, w) {
  4102. if (g.ID === u.ID) {
  4103. const _ = c;
  4104. c = new Bone(), c.matrixWorld.copy(g.transformLink), c.name = a ? PropertyBinding.sanitizeNodeName(a) : "", c.ID = s, d.bones[w] = c, _ !== null && c.add(_);
  4105. }
  4106. });
  4107. }
  4108. }), c;
  4109. }
  4110. // create a PerspectiveCamera or OrthographicCamera
  4111. createCamera(i) {
  4112. let r, s;
  4113. if (i.children.forEach(function(a) {
  4114. const c = re.Objects.NodeAttribute[a.ID];
  4115. c !== void 0 && (s = c);
  4116. }), s === void 0)
  4117. r = new Object3D();
  4118. else {
  4119. let a = 0;
  4120. s.CameraProjectionType !== void 0 && s.CameraProjectionType.value === 1 && (a = 1);
  4121. let c = 1;
  4122. s.NearPlane !== void 0 && (c = s.NearPlane.value / 1e3);
  4123. let u = 1e3;
  4124. s.FarPlane !== void 0 && (u = s.FarPlane.value / 1e3);
  4125. let h2 = window.innerWidth, d = window.innerHeight;
  4126. s.AspectWidth !== void 0 && s.AspectHeight !== void 0 && (h2 = s.AspectWidth.value, d = s.AspectHeight.value);
  4127. const g = h2 / d;
  4128. let w = 45;
  4129. s.FieldOfView !== void 0 && (w = s.FieldOfView.value);
  4130. const _ = s.FocalLength ? s.FocalLength.value : null;
  4131. switch (a) {
  4132. case 0:
  4133. r = new PerspectiveCamera(w, g, c, u), _ !== null && r.setFocalLength(_);
  4134. break;
  4135. case 1:
  4136. r = new OrthographicCamera(-h2 / 2, h2 / 2, d / 2, -d / 2, c, u);
  4137. break;
  4138. default:
  4139. console.warn("THREE.FBXLoader: Unknown camera type " + a + "."), r = new Object3D();
  4140. break;
  4141. }
  4142. }
  4143. return r;
  4144. }
  4145. // Create a DirectionalLight, PointLight or SpotLight
  4146. createLight(i) {
  4147. let r, s;
  4148. if (i.children.forEach(function(a) {
  4149. const c = re.Objects.NodeAttribute[a.ID];
  4150. c !== void 0 && (s = c);
  4151. }), s === void 0)
  4152. r = new Object3D();
  4153. else {
  4154. let a;
  4155. s.LightType === void 0 ? a = 0 : a = s.LightType.value;
  4156. let c = 16777215;
  4157. s.Color !== void 0 && (c = new Color().fromArray(s.Color.value));
  4158. let u = s.Intensity === void 0 ? 1 : s.Intensity.value / 100;
  4159. s.CastLightOnObject !== void 0 && s.CastLightOnObject.value === 0 && (u = 0);
  4160. let h2 = 0;
  4161. s.FarAttenuationEnd !== void 0 && (s.EnableFarAttenuation !== void 0 && s.EnableFarAttenuation.value === 0 ? h2 = 0 : h2 = s.FarAttenuationEnd.value);
  4162. const d = 1;
  4163. switch (a) {
  4164. case 0:
  4165. r = new PointLight(c, u, h2, d);
  4166. break;
  4167. case 1:
  4168. r = new DirectionalLight(c, u);
  4169. break;
  4170. case 2:
  4171. let g = Math.PI / 3;
  4172. s.InnerAngle !== void 0 && (g = MathUtils.degToRad(s.InnerAngle.value));
  4173. let w = 0;
  4174. s.OuterAngle !== void 0 && (w = MathUtils.degToRad(s.OuterAngle.value), w = Math.max(w, 1)), r = new SpotLight(c, u, h2, g, w, d);
  4175. break;
  4176. default:
  4177. console.warn("THREE.FBXLoader: Unknown light type " + s.LightType.value + ", defaulting to a PointLight."), r = new PointLight(c, u);
  4178. break;
  4179. }
  4180. s.CastShadows !== void 0 && s.CastShadows.value === 1 && (r.castShadow = true);
  4181. }
  4182. return r;
  4183. }
  4184. createMesh(i, r, s) {
  4185. let a, c = null, u = null;
  4186. const h2 = [];
  4187. return i.children.forEach(function(d) {
  4188. r.has(d.ID) && (c = r.get(d.ID)), s.has(d.ID) && h2.push(s.get(d.ID));
  4189. }), h2.length > 1 ? u = h2 : h2.length > 0 ? u = h2[0] : (u = new MeshPhongMaterial({
  4190. color: 13421772
  4191. }), h2.push(u)), "color" in c.attributes && h2.forEach(function(d) {
  4192. d.vertexColors = true;
  4193. }), c.FBX_Deformer ? (a = new SkinnedMesh(c, u), a.normalizeSkinWeights()) : a = new Mesh(c, u), a;
  4194. }
  4195. createCurve(i, r) {
  4196. const s = i.children.reduce(function(c, u) {
  4197. return r.has(u.ID) && (c = r.get(u.ID)), c;
  4198. }, null), a = new LineBasicMaterial({
  4199. color: 3342591,
  4200. linewidth: 1
  4201. });
  4202. return new Line(s, a);
  4203. }
  4204. // parse the model node for transform data
  4205. getTransformData(i, r) {
  4206. const s = {};
  4207. "InheritType" in r && (s.inheritType = parseInt(r.InheritType.value)), "RotationOrder" in r ? s.eulerOrder = el(r.RotationOrder.value) : s.eulerOrder = "ZYX", "Lcl_Translation" in r && (s.translation = r.Lcl_Translation.value), "PreRotation" in r && (s.preRotation = r.PreRotation.value), "Lcl_Rotation" in r && (s.rotation = r.Lcl_Rotation.value), "PostRotation" in r && (s.postRotation = r.PostRotation.value), "Lcl_Scaling" in r && (s.scale = r.Lcl_Scaling.value), "ScalingOffset" in r && (s.scalingOffset = r.ScalingOffset.value), "ScalingPivot" in r && (s.scalingPivot = r.ScalingPivot.value), "RotationOffset" in r && (s.rotationOffset = r.RotationOffset.value), "RotationPivot" in r && (s.rotationPivot = r.RotationPivot.value), i.userData.transformData = s;
  4208. }
  4209. setLookAtProperties(i, r) {
  4210. "LookAtProperty" in r && Le.get(i.ID).children.forEach(function(a) {
  4211. if (a.relationship === "LookAtProperty") {
  4212. const c = re.Objects.Model[a.ID];
  4213. if ("Lcl_Translation" in c) {
  4214. const u = c.Lcl_Translation.value;
  4215. i.target !== void 0 ? (i.target.position.fromArray(u), Je2.add(i.target)) : i.lookAt(new Vector3().fromArray(u));
  4216. }
  4217. }
  4218. });
  4219. }
  4220. bindSkeleton(i, r, s) {
  4221. const a = this.parsePoseNodes();
  4222. for (const c in i) {
  4223. const u = i[c];
  4224. Le.get(parseInt(u.ID)).parents.forEach(function(d) {
  4225. if (r.has(d.ID)) {
  4226. const g = d.ID;
  4227. Le.get(g).parents.forEach(function(_) {
  4228. s.has(_.ID) && s.get(_.ID).bind(new Skeleton(u.bones), a[_.ID]);
  4229. });
  4230. }
  4231. });
  4232. }
  4233. }
  4234. parsePoseNodes() {
  4235. const i = {};
  4236. if ("Pose" in re.Objects) {
  4237. const r = re.Objects.Pose;
  4238. for (const s in r)
  4239. if (r[s].attrType === "BindPose" && r[s].NbPoseNodes > 0) {
  4240. const a = r[s].PoseNode;
  4241. Array.isArray(a) ? a.forEach(function(c) {
  4242. i[c.Node] = new Matrix4().fromArray(c.Matrix.a);
  4243. }) : i[a.Node] = new Matrix4().fromArray(a.Matrix.a);
  4244. }
  4245. }
  4246. return i;
  4247. }
  4248. // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
  4249. createAmbientLight() {
  4250. if ("GlobalSettings" in re && "AmbientColor" in re.GlobalSettings) {
  4251. const i = re.GlobalSettings.AmbientColor.value, r = i[0], s = i[1], a = i[2];
  4252. if (r !== 0 || s !== 0 || a !== 0) {
  4253. const c = new Color(r, s, a);
  4254. Je2.add(new AmbientLight(c, 1));
  4255. }
  4256. }
  4257. }
  4258. };
  4259. var $u = class {
  4260. // Parse nodes in FBXTree.Objects.Geometry
  4261. parse(i) {
  4262. const r = /* @__PURE__ */ new Map();
  4263. if ("Geometry" in re.Objects) {
  4264. const s = re.Objects.Geometry;
  4265. for (const a in s) {
  4266. const c = Le.get(parseInt(a)), u = this.parseGeometry(c, s[a], i);
  4267. r.set(parseInt(a), u);
  4268. }
  4269. }
  4270. return r;
  4271. }
  4272. // Parse single node in FBXTree.Objects.Geometry
  4273. parseGeometry(i, r, s) {
  4274. switch (r.attrType) {
  4275. case "Mesh":
  4276. return this.parseMeshGeometry(i, r, s);
  4277. case "NurbsCurve":
  4278. return this.parseNurbsGeometry(r);
  4279. }
  4280. }
  4281. // Parse single node mesh geometry in FBXTree.Objects.Geometry
  4282. parseMeshGeometry(i, r, s) {
  4283. const a = s.skeletons, c = [], u = i.parents.map(function(_) {
  4284. return re.Objects.Model[_.ID];
  4285. });
  4286. if (u.length === 0)
  4287. return;
  4288. const h2 = i.children.reduce(function(_, y2) {
  4289. return a[y2.ID] !== void 0 && (_ = a[y2.ID]), _;
  4290. }, null);
  4291. i.children.forEach(function(_) {
  4292. s.morphTargets[_.ID] !== void 0 && c.push(s.morphTargets[_.ID]);
  4293. });
  4294. const d = u[0], g = {};
  4295. "RotationOrder" in d && (g.eulerOrder = el(d.RotationOrder.value)), "InheritType" in d && (g.inheritType = parseInt(d.InheritType.value)), "GeometricTranslation" in d && (g.translation = d.GeometricTranslation.value), "GeometricRotation" in d && (g.rotation = d.GeometricRotation.value), "GeometricScaling" in d && (g.scale = d.GeometricScaling.value);
  4296. const w = Ja(g);
  4297. return this.genGeometry(r, h2, c, w);
  4298. }
  4299. // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
  4300. genGeometry(i, r, s, a) {
  4301. const c = new BufferGeometry();
  4302. i.attrName && (c.name = i.attrName);
  4303. const u = this.parseGeoNode(i, r), h2 = this.genBuffers(u), d = new Float32BufferAttribute(h2.vertex, 3);
  4304. if (d.applyMatrix4(a), c.setAttribute("position", d), h2.colors.length > 0 && c.setAttribute("color", new Float32BufferAttribute(h2.colors, 3)), r && (c.setAttribute("skinIndex", new Uint16BufferAttribute(h2.weightsIndices, 4)), c.setAttribute("skinWeight", new Float32BufferAttribute(h2.vertexWeights, 4)), c.FBX_Deformer = r), h2.normal.length > 0) {
  4305. const g = new Matrix3().getNormalMatrix(a), w = new Float32BufferAttribute(h2.normal, 3);
  4306. w.applyNormalMatrix(g), c.setAttribute("normal", w);
  4307. }
  4308. if (h2.uvs.forEach(function(g, w) {
  4309. let _ = "uv" + (w + 1).toString();
  4310. w === 0 && (_ = "uv"), c.setAttribute(_, new Float32BufferAttribute(h2.uvs[w], 2));
  4311. }), u.material && u.material.mappingType !== "AllSame") {
  4312. let g = h2.materialIndex[0], w = 0;
  4313. if (h2.materialIndex.forEach(function(_, y2) {
  4314. _ !== g && (c.addGroup(w, y2 - w, g), g = _, w = y2);
  4315. }), c.groups.length > 0) {
  4316. const _ = c.groups[c.groups.length - 1], y2 = _.start + _.count;
  4317. y2 !== h2.materialIndex.length && c.addGroup(y2, h2.materialIndex.length - y2, g);
  4318. }
  4319. c.groups.length === 0 && c.addGroup(0, h2.materialIndex.length, h2.materialIndex[0]);
  4320. }
  4321. return this.addMorphTargets(c, i, s, a), c;
  4322. }
  4323. parseGeoNode(i, r) {
  4324. const s = {};
  4325. if (s.vertexPositions = i.Vertices !== void 0 ? i.Vertices.a : [], s.vertexIndices = i.PolygonVertexIndex !== void 0 ? i.PolygonVertexIndex.a : [], i.LayerElementColor && (s.color = this.parseVertexColors(i.LayerElementColor[0])), i.LayerElementMaterial && (s.material = this.parseMaterialIndices(i.LayerElementMaterial[0])), i.LayerElementNormal && (s.normal = this.parseNormals(i.LayerElementNormal[0])), i.LayerElementUV) {
  4326. s.uv = [];
  4327. let a = 0;
  4328. for (; i.LayerElementUV[a]; )
  4329. i.LayerElementUV[a].UV && s.uv.push(this.parseUVs(i.LayerElementUV[a])), a++;
  4330. }
  4331. return s.weightTable = {}, r !== null && (s.skeleton = r, r.rawBones.forEach(function(a, c) {
  4332. a.indices.forEach(function(u, h2) {
  4333. s.weightTable[u] === void 0 && (s.weightTable[u] = []), s.weightTable[u].push({
  4334. id: c,
  4335. weight: a.weights[h2]
  4336. });
  4337. });
  4338. })), s;
  4339. }
  4340. genBuffers(i) {
  4341. const r = {
  4342. vertex: [],
  4343. normal: [],
  4344. colors: [],
  4345. uvs: [],
  4346. materialIndex: [],
  4347. vertexWeights: [],
  4348. weightsIndices: []
  4349. };
  4350. let s = 0, a = 0, c = false, u = [], h2 = [], d = [], g = [], w = [], _ = [];
  4351. const y2 = this;
  4352. return i.vertexIndices.forEach(function(C, I2) {
  4353. let S2, R2 = false;
  4354. C < 0 && (C = C ^ -1, R2 = true);
  4355. let j2 = [], F = [];
  4356. if (u.push(C * 3, C * 3 + 1, C * 3 + 2), i.color) {
  4357. const V2 = Os(I2, s, C, i.color);
  4358. d.push(V2[0], V2[1], V2[2]);
  4359. }
  4360. if (i.skeleton) {
  4361. if (i.weightTable[C] !== void 0 && i.weightTable[C].forEach(function(V2) {
  4362. F.push(V2.weight), j2.push(V2.id);
  4363. }), F.length > 4) {
  4364. c || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), c = true);
  4365. const V2 = [0, 0, 0, 0], D = [0, 0, 0, 0];
  4366. F.forEach(function(Y, G2) {
  4367. let N = Y, O = j2[G2];
  4368. D.forEach(function(H2, K, q) {
  4369. if (N > H2) {
  4370. q[K] = N, N = H2;
  4371. const he = V2[K];
  4372. V2[K] = O, O = he;
  4373. }
  4374. });
  4375. }), j2 = V2, F = D;
  4376. }
  4377. for (; F.length < 4; )
  4378. F.push(0), j2.push(0);
  4379. for (let V2 = 0; V2 < 4; ++V2)
  4380. w.push(F[V2]), _.push(j2[V2]);
  4381. }
  4382. if (i.normal) {
  4383. const V2 = Os(I2, s, C, i.normal);
  4384. h2.push(V2[0], V2[1], V2[2]);
  4385. }
  4386. i.material && i.material.mappingType !== "AllSame" && (S2 = Os(I2, s, C, i.material)[0]), i.uv && i.uv.forEach(function(V2, D) {
  4387. const Y = Os(I2, s, C, V2);
  4388. g[D] === void 0 && (g[D] = []), g[D].push(Y[0]), g[D].push(Y[1]);
  4389. }), a++, R2 && (y2.genFace(r, i, u, S2, h2, d, g, w, _, a), s++, a = 0, u = [], h2 = [], d = [], g = [], w = [], _ = []);
  4390. }), r;
  4391. }
  4392. // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
  4393. genFace(i, r, s, a, c, u, h2, d, g, w) {
  4394. for (let _ = 2; _ < w; _++)
  4395. i.vertex.push(r.vertexPositions[s[0]]), i.vertex.push(r.vertexPositions[s[1]]), i.vertex.push(r.vertexPositions[s[2]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 1]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 2]]), i.vertex.push(r.vertexPositions[s[_ * 3]]), i.vertex.push(r.vertexPositions[s[_ * 3 + 1]]), i.vertex.push(r.vertexPositions[s[_ * 3 + 2]]), r.skeleton && (i.vertexWeights.push(d[0]), i.vertexWeights.push(d[1]), i.vertexWeights.push(d[2]), i.vertexWeights.push(d[3]), i.vertexWeights.push(d[(_ - 1) * 4]), i.vertexWeights.push(d[(_ - 1) * 4 + 1]), i.vertexWeights.push(d[(_ - 1) * 4 + 2]), i.vertexWeights.push(d[(_ - 1) * 4 + 3]), i.vertexWeights.push(d[_ * 4]), i.vertexWeights.push(d[_ * 4 + 1]), i.vertexWeights.push(d[_ * 4 + 2]), i.vertexWeights.push(d[_ * 4 + 3]), i.weightsIndices.push(g[0]), i.weightsIndices.push(g[1]), i.weightsIndices.push(g[2]), i.weightsIndices.push(g[3]), i.weightsIndices.push(g[(_ - 1) * 4]), i.weightsIndices.push(g[(_ - 1) * 4 + 1]), i.weightsIndices.push(g[(_ - 1) * 4 + 2]), i.weightsIndices.push(g[(_ - 1) * 4 + 3]), i.weightsIndices.push(g[_ * 4]), i.weightsIndices.push(g[_ * 4 + 1]), i.weightsIndices.push(g[_ * 4 + 2]), i.weightsIndices.push(g[_ * 4 + 3])), r.color && (i.colors.push(u[0]), i.colors.push(u[1]), i.colors.push(u[2]), i.colors.push(u[(_ - 1) * 3]), i.colors.push(u[(_ - 1) * 3 + 1]), i.colors.push(u[(_ - 1) * 3 + 2]), i.colors.push(u[_ * 3]), i.colors.push(u[_ * 3 + 1]), i.colors.push(u[_ * 3 + 2])), r.material && r.material.mappingType !== "AllSame" && (i.materialIndex.push(a), i.materialIndex.push(a), i.materialIndex.push(a)), r.normal && (i.normal.push(c[0]), i.normal.push(c[1]), i.normal.push(c[2]), i.normal.push(c[(_ - 1) * 3]), i.normal.push(c[(_ - 1) * 3 + 1]), i.normal.push(c[(_ - 1) * 3 + 2]), i.normal.push(c[_ * 3]), i.normal.push(c[_ * 3 + 1]), i.normal.push(c[_ * 3 + 2])), r.uv && r.uv.forEach(function(y2, C) {
  4396. i.uvs[C] === void 0 && (i.uvs[C] = []), i.uvs[C].push(h2[C][0]), i.uvs[C].push(h2[C][1]), i.uvs[C].push(h2[C][(_ - 1) * 2]), i.uvs[C].push(h2[C][(_ - 1) * 2 + 1]), i.uvs[C].push(h2[C][_ * 2]), i.uvs[C].push(h2[C][_ * 2 + 1]);
  4397. });
  4398. }
  4399. addMorphTargets(i, r, s, a) {
  4400. if (s.length === 0)
  4401. return;
  4402. i.morphTargetsRelative = true, i.morphAttributes.position = [];
  4403. const c = this;
  4404. s.forEach(function(u) {
  4405. u.rawTargets.forEach(function(h2) {
  4406. const d = re.Objects.Geometry[h2.geoID];
  4407. d !== void 0 && c.genMorphGeometry(i, r, d, a, h2.name);
  4408. });
  4409. });
  4410. }
  4411. // a morph geometry node is similar to a standard node, and the node is also contained
  4412. // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
  4413. // and a special attribute Index defining which vertices of the original geometry are affected
  4414. // Normal and position attributes only have data for the vertices that are affected by the morph
  4415. genMorphGeometry(i, r, s, a, c) {
  4416. const u = r.PolygonVertexIndex !== void 0 ? r.PolygonVertexIndex.a : [], h2 = s.Vertices !== void 0 ? s.Vertices.a : [], d = s.Indexes !== void 0 ? s.Indexes.a : [], g = i.attributes.position.count * 3, w = new Float32Array(g);
  4417. for (let I2 = 0; I2 < d.length; I2++) {
  4418. const S2 = d[I2] * 3;
  4419. w[S2] = h2[I2 * 3], w[S2 + 1] = h2[I2 * 3 + 1], w[S2 + 2] = h2[I2 * 3 + 2];
  4420. }
  4421. const _ = {
  4422. vertexIndices: u,
  4423. vertexPositions: w
  4424. }, y2 = this.genBuffers(_), C = new Float32BufferAttribute(y2.vertex, 3);
  4425. C.name = c || s.attrName, C.applyMatrix4(a), i.morphAttributes.position.push(C);
  4426. }
  4427. // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
  4428. parseNormals(i) {
  4429. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.Normals.a;
  4430. let c = [];
  4431. return s === "IndexToDirect" && ("NormalIndex" in i ? c = i.NormalIndex.a : "NormalsIndex" in i && (c = i.NormalsIndex.a)), {
  4432. dataSize: 3,
  4433. buffer: a,
  4434. indices: c,
  4435. mappingType: r,
  4436. referenceType: s
  4437. };
  4438. }
  4439. // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
  4440. parseUVs(i) {
  4441. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.UV.a;
  4442. let c = [];
  4443. return s === "IndexToDirect" && (c = i.UVIndex.a), {
  4444. dataSize: 2,
  4445. buffer: a,
  4446. indices: c,
  4447. mappingType: r,
  4448. referenceType: s
  4449. };
  4450. }
  4451. // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
  4452. parseVertexColors(i) {
  4453. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.Colors.a;
  4454. let c = [];
  4455. return s === "IndexToDirect" && (c = i.ColorIndex.a), {
  4456. dataSize: 4,
  4457. buffer: a,
  4458. indices: c,
  4459. mappingType: r,
  4460. referenceType: s
  4461. };
  4462. }
  4463. // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
  4464. parseMaterialIndices(i) {
  4465. const r = i.MappingInformationType, s = i.ReferenceInformationType;
  4466. if (r === "NoMappingInformation")
  4467. return {
  4468. dataSize: 1,
  4469. buffer: [0],
  4470. indices: [0],
  4471. mappingType: "AllSame",
  4472. referenceType: s
  4473. };
  4474. const a = i.Materials.a, c = [];
  4475. for (let u = 0; u < a.length; ++u)
  4476. c.push(u);
  4477. return {
  4478. dataSize: 1,
  4479. buffer: a,
  4480. indices: c,
  4481. mappingType: r,
  4482. referenceType: s
  4483. };
  4484. }
  4485. // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
  4486. parseNurbsGeometry(i) {
  4487. if (fa === void 0)
  4488. 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 BufferGeometry();
  4489. const r = parseInt(i.Order);
  4490. if (isNaN(r))
  4491. return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", i.Order, i.id), new BufferGeometry();
  4492. const s = r - 1, a = i.KnotVector.a, c = [], u = i.Points.a;
  4493. for (let _ = 0, y2 = u.length; _ < y2; _ += 4)
  4494. c.push(new Vector4().fromArray(u, _));
  4495. let h2, d;
  4496. if (i.Form === "Closed")
  4497. c.push(c[0]);
  4498. else if (i.Form === "Periodic") {
  4499. h2 = s, d = a.length - 1 - h2;
  4500. for (let _ = 0; _ < s; ++_)
  4501. c.push(c[_]);
  4502. }
  4503. const w = new fa(s, a, c, h2, d).getPoints(c.length * 12);
  4504. return new BufferGeometry().setFromPoints(w);
  4505. }
  4506. };
  4507. var Xu = class {
  4508. // take raw animation clips and turn them into three.js animation clips
  4509. parse() {
  4510. const i = [], r = this.parseClips();
  4511. if (r !== void 0)
  4512. for (const s in r) {
  4513. const a = r[s], c = this.addClip(a);
  4514. i.push(c);
  4515. }
  4516. return i;
  4517. }
  4518. parseClips() {
  4519. if (re.Objects.AnimationCurve === void 0)
  4520. return;
  4521. const i = this.parseAnimationCurveNodes();
  4522. this.parseAnimationCurves(i);
  4523. const r = this.parseAnimationLayers(i);
  4524. return this.parseAnimStacks(r);
  4525. }
  4526. // parse nodes in FBXTree.Objects.AnimationCurveNode
  4527. // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
  4528. // and is referenced by an AnimationLayer
  4529. parseAnimationCurveNodes() {
  4530. const i = re.Objects.AnimationCurveNode, r = /* @__PURE__ */ new Map();
  4531. for (const s in i) {
  4532. const a = i[s];
  4533. if (a.attrName.match(/S|R|T|DeformPercent/) !== null) {
  4534. const c = {
  4535. id: a.id,
  4536. attr: a.attrName,
  4537. curves: {}
  4538. };
  4539. r.set(c.id, c);
  4540. }
  4541. }
  4542. return r;
  4543. }
  4544. // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
  4545. // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
  4546. // axis ( e.g. times and values of x rotation)
  4547. parseAnimationCurves(i) {
  4548. const r = re.Objects.AnimationCurve;
  4549. for (const s in r) {
  4550. const a = {
  4551. id: r[s].id,
  4552. times: r[s].KeyTime.a.map(Wu),
  4553. values: r[s].KeyValueFloat.a
  4554. }, c = Le.get(a.id);
  4555. if (c !== void 0) {
  4556. const u = c.parents[0].ID, h2 = c.parents[0].relationship;
  4557. h2.match(/X/) ? i.get(u).curves.x = a : h2.match(/Y/) ? i.get(u).curves.y = a : h2.match(/Z/) ? i.get(u).curves.z = a : h2.match(/d|DeformPercent/) && i.has(u) && (i.get(u).curves.morph = a);
  4558. }
  4559. }
  4560. }
  4561. // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
  4562. // to various AnimationCurveNodes and is referenced by an AnimationStack node
  4563. // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
  4564. parseAnimationLayers(i) {
  4565. const r = re.Objects.AnimationLayer, s = /* @__PURE__ */ new Map();
  4566. for (const a in r) {
  4567. const c = [], u = Le.get(parseInt(a));
  4568. u !== void 0 && (u.children.forEach(function(d, g) {
  4569. if (i.has(d.ID)) {
  4570. const w = i.get(d.ID);
  4571. if (w.curves.x !== void 0 || w.curves.y !== void 0 || w.curves.z !== void 0) {
  4572. if (c[g] === void 0) {
  4573. const _ = Le.get(d.ID).parents.filter(function(y2) {
  4574. return y2.relationship !== void 0;
  4575. })[0].ID;
  4576. if (_ !== void 0) {
  4577. const y2 = re.Objects.Model[_.toString()];
  4578. if (y2 === void 0) {
  4579. console.warn("THREE.FBXLoader: Encountered a unused curve.", d);
  4580. return;
  4581. }
  4582. const C = {
  4583. modelName: y2.attrName ? PropertyBinding.sanitizeNodeName(y2.attrName) : "",
  4584. ID: y2.id,
  4585. initialPosition: [0, 0, 0],
  4586. initialRotation: [0, 0, 0],
  4587. initialScale: [1, 1, 1]
  4588. };
  4589. Je2.traverse(function(I2) {
  4590. I2.ID === y2.id && (C.transform = I2.matrix, I2.userData.transformData && (C.eulerOrder = I2.userData.transformData.eulerOrder));
  4591. }), C.transform || (C.transform = new Matrix4()), "PreRotation" in y2 && (C.preRotation = y2.PreRotation.value), "PostRotation" in y2 && (C.postRotation = y2.PostRotation.value), c[g] = C;
  4592. }
  4593. }
  4594. c[g] && (c[g][w.attr] = w);
  4595. } else if (w.curves.morph !== void 0) {
  4596. if (c[g] === void 0) {
  4597. const _ = Le.get(d.ID).parents.filter(function(j2) {
  4598. return j2.relationship !== void 0;
  4599. })[0].ID, y2 = Le.get(_).parents[0].ID, C = Le.get(y2).parents[0].ID, I2 = Le.get(C).parents[0].ID, S2 = re.Objects.Model[I2], R2 = {
  4600. modelName: S2.attrName ? PropertyBinding.sanitizeNodeName(S2.attrName) : "",
  4601. morphName: re.Objects.Deformer[_].attrName
  4602. };
  4603. c[g] = R2;
  4604. }
  4605. c[g][w.attr] = w;
  4606. }
  4607. }
  4608. }), s.set(parseInt(a), c));
  4609. }
  4610. return s;
  4611. }
  4612. // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
  4613. // hierarchy. Each Stack node will be used to create a AnimationClip
  4614. parseAnimStacks(i) {
  4615. const r = re.Objects.AnimationStack, s = {};
  4616. for (const a in r) {
  4617. const c = Le.get(parseInt(a)).children;
  4618. c.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
  4619. const u = i.get(c[0].ID);
  4620. s[a] = {
  4621. name: r[a].attrName,
  4622. layer: u
  4623. };
  4624. }
  4625. return s;
  4626. }
  4627. addClip(i) {
  4628. let r = [];
  4629. const s = this;
  4630. return i.layer.forEach(function(a) {
  4631. r = r.concat(s.generateTracks(a));
  4632. }), new AnimationClip(i.name, -1, r);
  4633. }
  4634. generateTracks(i) {
  4635. const r = [];
  4636. let s = new Vector3(), a = new Quaternion(), c = new Vector3();
  4637. if (i.transform && i.transform.decompose(s, a, c), s = s.toArray(), a = new Euler().setFromQuaternion(a, i.eulerOrder).toArray(), c = c.toArray(), i.T !== void 0 && Object.keys(i.T.curves).length > 0) {
  4638. const u = this.generateVectorTrack(i.modelName, i.T.curves, s, "position");
  4639. u !== void 0 && r.push(u);
  4640. }
  4641. if (i.R !== void 0 && Object.keys(i.R.curves).length > 0) {
  4642. const u = this.generateRotationTrack(i.modelName, i.R.curves, a, i.preRotation, i.postRotation, i.eulerOrder);
  4643. u !== void 0 && r.push(u);
  4644. }
  4645. if (i.S !== void 0 && Object.keys(i.S.curves).length > 0) {
  4646. const u = this.generateVectorTrack(i.modelName, i.S.curves, c, "scale");
  4647. u !== void 0 && r.push(u);
  4648. }
  4649. if (i.DeformPercent !== void 0) {
  4650. const u = this.generateMorphTrack(i);
  4651. u !== void 0 && r.push(u);
  4652. }
  4653. return r;
  4654. }
  4655. generateVectorTrack(i, r, s, a) {
  4656. const c = this.getTimesForAllAxes(r), u = this.getKeyframeTrackValues(c, r, s);
  4657. return new VectorKeyframeTrack(i + "." + a, c, u);
  4658. }
  4659. generateRotationTrack(i, r, s, a, c, u) {
  4660. r.x !== void 0 && (this.interpolateRotations(r.x), r.x.values = r.x.values.map(MathUtils.degToRad)), r.y !== void 0 && (this.interpolateRotations(r.y), r.y.values = r.y.values.map(MathUtils.degToRad)), r.z !== void 0 && (this.interpolateRotations(r.z), r.z.values = r.z.values.map(MathUtils.degToRad));
  4661. const h2 = this.getTimesForAllAxes(r), d = this.getKeyframeTrackValues(h2, r, s);
  4662. a !== void 0 && (a = a.map(MathUtils.degToRad), a.push(u), a = new Euler().fromArray(a), a = new Quaternion().setFromEuler(a)), c !== void 0 && (c = c.map(MathUtils.degToRad), c.push(u), c = new Euler().fromArray(c), c = new Quaternion().setFromEuler(c).invert());
  4663. const g = new Quaternion(), w = new Euler(), _ = [];
  4664. for (let y2 = 0; y2 < d.length; y2 += 3)
  4665. w.set(d[y2], d[y2 + 1], d[y2 + 2], u), g.setFromEuler(w), a !== void 0 && g.premultiply(a), c !== void 0 && g.multiply(c), g.toArray(_, y2 / 3 * 4);
  4666. return new QuaternionKeyframeTrack(i + ".quaternion", h2, _);
  4667. }
  4668. generateMorphTrack(i) {
  4669. const r = i.DeformPercent.curves.morph, s = r.values.map(function(c) {
  4670. return c / 100;
  4671. }), a = Je2.getObjectByName(i.modelName).morphTargetDictionary[i.morphName];
  4672. return new NumberKeyframeTrack(i.modelName + ".morphTargetInfluences[" + a + "]", r.times, s);
  4673. }
  4674. // For all animated objects, times are defined separately for each axis
  4675. // Here we'll combine the times into one sorted array without duplicates
  4676. getTimesForAllAxes(i) {
  4677. let r = [];
  4678. if (i.x !== void 0 && (r = r.concat(i.x.times)), i.y !== void 0 && (r = r.concat(i.y.times)), i.z !== void 0 && (r = r.concat(i.z.times)), r = r.sort(function(s, a) {
  4679. return s - a;
  4680. }), r.length > 1) {
  4681. let s = 1, a = r[0];
  4682. for (let c = 1; c < r.length; c++) {
  4683. const u = r[c];
  4684. u !== a && (r[s] = u, a = u, s++);
  4685. }
  4686. r = r.slice(0, s);
  4687. }
  4688. return r;
  4689. }
  4690. getKeyframeTrackValues(i, r, s) {
  4691. const a = s, c = [];
  4692. let u = -1, h2 = -1, d = -1;
  4693. return i.forEach(function(g) {
  4694. if (r.x && (u = r.x.times.indexOf(g)), r.y && (h2 = r.y.times.indexOf(g)), r.z && (d = r.z.times.indexOf(g)), u !== -1) {
  4695. const w = r.x.values[u];
  4696. c.push(w), a[0] = w;
  4697. } else
  4698. c.push(a[0]);
  4699. if (h2 !== -1) {
  4700. const w = r.y.values[h2];
  4701. c.push(w), a[1] = w;
  4702. } else
  4703. c.push(a[1]);
  4704. if (d !== -1) {
  4705. const w = r.z.values[d];
  4706. c.push(w), a[2] = w;
  4707. } else
  4708. c.push(a[2]);
  4709. }), c;
  4710. }
  4711. // Rotations are defined as Euler angles which can have values of any size
  4712. // These will be converted to quaternions which don't support values greater than
  4713. // PI, so we'll interpolate large rotations
  4714. interpolateRotations(i) {
  4715. for (let r = 1; r < i.values.length; r++) {
  4716. const s = i.values[r - 1], a = i.values[r] - s, c = Math.abs(a);
  4717. if (c >= 180) {
  4718. const u = c / 180, h2 = a / u;
  4719. let d = s + h2;
  4720. const g = i.times[r - 1], _ = (i.times[r] - g) / u;
  4721. let y2 = g + _;
  4722. const C = [], I2 = [];
  4723. for (; y2 < i.times[r]; )
  4724. C.push(y2), y2 += _, I2.push(d), d += h2;
  4725. i.times = ga(i.times, r, C), i.values = ga(i.values, r, I2);
  4726. }
  4727. }
  4728. }
  4729. };
  4730. var Yu = class {
  4731. getPrevNode() {
  4732. return this.nodeStack[this.currentIndent - 2];
  4733. }
  4734. getCurrentNode() {
  4735. return this.nodeStack[this.currentIndent - 1];
  4736. }
  4737. getCurrentProp() {
  4738. return this.currentProp;
  4739. }
  4740. pushStack(i) {
  4741. this.nodeStack.push(i), this.currentIndent += 1;
  4742. }
  4743. popStack() {
  4744. this.nodeStack.pop(), this.currentIndent -= 1;
  4745. }
  4746. setCurrentProp(i, r) {
  4747. this.currentProp = i, this.currentPropName = r;
  4748. }
  4749. parse(i) {
  4750. this.currentIndent = 0, this.allNodes = new Wa(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
  4751. const r = this, s = i.split(/[\r\n]+/);
  4752. return s.forEach(function(a, c) {
  4753. const u = a.match(/^[\s\t]*;/), h2 = a.match(/^[\s\t]*$/);
  4754. if (u || h2)
  4755. return;
  4756. const d = a.match("^\\t{" + r.currentIndent + "}(\\w+):(.*){", ""), g = a.match("^\\t{" + r.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"), w = a.match("^\\t{" + (r.currentIndent - 1) + "}}");
  4757. d ? r.parseNodeBegin(a, d) : g ? r.parseNodeProperty(a, g, s[++c]) : w ? r.popStack() : a.match(/^[^\s\t}]/) && r.parseNodePropertyContinued(a);
  4758. }), this.allNodes;
  4759. }
  4760. parseNodeBegin(i, r) {
  4761. const s = r[1].trim().replace(/^"/, "").replace(/"$/, ""), a = r[2].split(",").map(function(d) {
  4762. return d.trim().replace(/^"/, "").replace(/"$/, "");
  4763. }), c = {
  4764. name: s
  4765. }, u = this.parseNodeAttr(a), h2 = this.getCurrentNode();
  4766. this.currentIndent === 0 ? this.allNodes.add(s, c) : s in h2 ? (s === "PoseNode" ? h2.PoseNode.push(c) : h2[s].id !== void 0 && (h2[s] = {}, h2[s][h2[s].id] = h2[s]), u.id !== "" && (h2[s][u.id] = c)) : typeof u.id == "number" ? (h2[s] = {}, h2[s][u.id] = c) : s !== "Properties70" && (s === "PoseNode" ? h2[s] = [c] : h2[s] = c), typeof u.id == "number" && (c.id = u.id), u.name !== "" && (c.attrName = u.name), u.type !== "" && (c.attrType = u.type), this.pushStack(c);
  4767. }
  4768. parseNodeAttr(i) {
  4769. let r = i[0];
  4770. i[0] !== "" && (r = parseInt(i[0]), isNaN(r) && (r = i[0]));
  4771. let s = "", a = "";
  4772. return i.length > 1 && (s = i[1].replace(/^(\w+)::/, ""), a = i[2]), {
  4773. id: r,
  4774. name: s,
  4775. type: a
  4776. };
  4777. }
  4778. parseNodeProperty(i, r, s) {
  4779. let a = r[1].replace(/^"/, "").replace(/"$/, "").trim(), c = r[2].replace(/^"/, "").replace(/"$/, "").trim();
  4780. a === "Content" && c === "," && (c = s.replace(/"/g, "").replace(/,$/, "").trim());
  4781. const u = this.getCurrentNode();
  4782. if (u.name === "Properties70") {
  4783. this.parseNodeSpecialProperty(i, a, c);
  4784. return;
  4785. }
  4786. if (a === "C") {
  4787. const d = c.split(",").slice(1), g = parseInt(d[0]), w = parseInt(d[1]);
  4788. let _ = c.split(",").slice(3);
  4789. _ = _.map(function(y2) {
  4790. return y2.trim().replace(/^"/, "");
  4791. }), a = "connections", c = [g, w], eh(c, _), u[a] === void 0 && (u[a] = []);
  4792. }
  4793. a === "Node" && (u.id = c), a in u && Array.isArray(u[a]) ? u[a].push(c) : a !== "a" ? u[a] = c : u.a = c, this.setCurrentProp(u, a), a === "a" && c.slice(-1) !== "," && (u.a = to(c));
  4794. }
  4795. parseNodePropertyContinued(i) {
  4796. const r = this.getCurrentNode();
  4797. r.a += i, i.slice(-1) !== "," && (r.a = to(r.a));
  4798. }
  4799. // parse "Property70"
  4800. parseNodeSpecialProperty(i, r, s) {
  4801. const a = s.split('",').map(function(w) {
  4802. return w.trim().replace(/^\"/, "").replace(/\s/, "_");
  4803. }), c = a[0], u = a[1], h2 = a[2], d = a[3];
  4804. let g = a[4];
  4805. switch (u) {
  4806. case "int":
  4807. case "enum":
  4808. case "bool":
  4809. case "ULongLong":
  4810. case "double":
  4811. case "Number":
  4812. case "FieldOfView":
  4813. g = parseFloat(g);
  4814. break;
  4815. case "Color":
  4816. case "ColorRGB":
  4817. case "Vector3D":
  4818. case "Lcl_Translation":
  4819. case "Lcl_Rotation":
  4820. case "Lcl_Scaling":
  4821. g = to(g);
  4822. break;
  4823. }
  4824. this.getPrevNode()[c] = {
  4825. type: u,
  4826. type2: h2,
  4827. flag: d,
  4828. value: g
  4829. }, this.setCurrentProp(this.getPrevNode(), c);
  4830. }
  4831. };
  4832. var qu = class {
  4833. parse(i) {
  4834. const r = new va(i);
  4835. r.skip(23);
  4836. const s = r.getUint32();
  4837. if (s < 6400)
  4838. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + s);
  4839. const a = new Wa();
  4840. for (; !this.endOfContent(r); ) {
  4841. const c = this.parseNode(r, s);
  4842. c !== null && a.add(c.name, c);
  4843. }
  4844. return a;
  4845. }
  4846. // Check if reader has reached the end of content.
  4847. endOfContent(i) {
  4848. return i.size() % 16 === 0 ? (i.getOffset() + 160 + 16 & -16) >= i.size() : i.getOffset() + 160 + 16 >= i.size();
  4849. }
  4850. // recursively parse nodes until the end of the file is reached
  4851. parseNode(i, r) {
  4852. const s = {}, a = r >= 7500 ? i.getUint64() : i.getUint32(), c = r >= 7500 ? i.getUint64() : i.getUint32();
  4853. r >= 7500 ? i.getUint64() : i.getUint32();
  4854. const u = i.getUint8(), h2 = i.getString(u);
  4855. if (a === 0)
  4856. return null;
  4857. const d = [];
  4858. for (let y2 = 0; y2 < c; y2++)
  4859. d.push(this.parseProperty(i));
  4860. const g = d.length > 0 ? d[0] : "", w = d.length > 1 ? d[1] : "", _ = d.length > 2 ? d[2] : "";
  4861. for (s.singleProperty = c === 1 && i.getOffset() === a; a > i.getOffset(); ) {
  4862. const y2 = this.parseNode(i, r);
  4863. y2 !== null && this.parseSubNode(h2, s, y2);
  4864. }
  4865. return s.propertyList = d, typeof g == "number" && (s.id = g), w !== "" && (s.attrName = w), _ !== "" && (s.attrType = _), h2 !== "" && (s.name = h2), s;
  4866. }
  4867. parseSubNode(i, r, s) {
  4868. if (s.singleProperty === true) {
  4869. const a = s.propertyList[0];
  4870. Array.isArray(a) ? (r[s.name] = s, s.a = a) : r[s.name] = a;
  4871. } else if (i === "Connections" && s.name === "C") {
  4872. const a = [];
  4873. s.propertyList.forEach(function(c, u) {
  4874. u !== 0 && a.push(c);
  4875. }), r.connections === void 0 && (r.connections = []), r.connections.push(a);
  4876. } else if (s.name === "Properties70")
  4877. Object.keys(s).forEach(function(c) {
  4878. r[c] = s[c];
  4879. });
  4880. else if (i === "Properties70" && s.name === "P") {
  4881. let a = s.propertyList[0], c = s.propertyList[1];
  4882. const u = s.propertyList[2], h2 = s.propertyList[3];
  4883. let d;
  4884. a.indexOf("Lcl ") === 0 && (a = a.replace("Lcl ", "Lcl_")), c.indexOf("Lcl ") === 0 && (c = c.replace("Lcl ", "Lcl_")), c === "Color" || c === "ColorRGB" || c === "Vector" || c === "Vector3D" || c.indexOf("Lcl_") === 0 ? d = [s.propertyList[4], s.propertyList[5], s.propertyList[6]] : d = s.propertyList[4], r[a] = {
  4885. type: c,
  4886. type2: u,
  4887. flag: h2,
  4888. value: d
  4889. };
  4890. } else
  4891. r[s.name] === void 0 ? typeof s.id == "number" ? (r[s.name] = {}, r[s.name][s.id] = s) : r[s.name] = s : s.name === "PoseNode" ? (Array.isArray(r[s.name]) || (r[s.name] = [r[s.name]]), r[s.name].push(s)) : r[s.name][s.id] === void 0 && (r[s.name][s.id] = s);
  4892. }
  4893. parseProperty(i) {
  4894. const r = i.getString(1);
  4895. let s;
  4896. switch (r) {
  4897. case "C":
  4898. return i.getBoolean();
  4899. case "D":
  4900. return i.getFloat64();
  4901. case "F":
  4902. return i.getFloat32();
  4903. case "I":
  4904. return i.getInt32();
  4905. case "L":
  4906. return i.getInt64();
  4907. case "R":
  4908. return s = i.getUint32(), i.getArrayBuffer(s);
  4909. case "S":
  4910. return s = i.getUint32(), i.getString(s);
  4911. case "Y":
  4912. return i.getInt16();
  4913. case "b":
  4914. case "c":
  4915. case "d":
  4916. case "f":
  4917. case "i":
  4918. case "l":
  4919. const a = i.getUint32(), c = i.getUint32(), u = i.getUint32();
  4920. if (c === 0)
  4921. switch (r) {
  4922. case "b":
  4923. case "c":
  4924. return i.getBooleanArray(a);
  4925. case "d":
  4926. return i.getFloat64Array(a);
  4927. case "f":
  4928. return i.getFloat32Array(a);
  4929. case "i":
  4930. return i.getInt32Array(a);
  4931. case "l":
  4932. return i.getInt64Array(a);
  4933. }
  4934. const h2 = Jp(new Uint8Array(i.getArrayBuffer(u))), d = new va(h2.buffer);
  4935. switch (r) {
  4936. case "b":
  4937. case "c":
  4938. return d.getBooleanArray(a);
  4939. case "d":
  4940. return d.getFloat64Array(a);
  4941. case "f":
  4942. return d.getFloat32Array(a);
  4943. case "i":
  4944. return d.getInt32Array(a);
  4945. case "l":
  4946. return d.getInt64Array(a);
  4947. }
  4948. default:
  4949. throw new Error("THREE.FBXLoader: Unknown property type " + r);
  4950. }
  4951. }
  4952. };
  4953. var va = class {
  4954. constructor(i, r) {
  4955. this.dv = new DataView(i), this.offset = 0, this.littleEndian = r !== void 0 ? r : true;
  4956. }
  4957. getOffset() {
  4958. return this.offset;
  4959. }
  4960. size() {
  4961. return this.dv.buffer.byteLength;
  4962. }
  4963. skip(i) {
  4964. this.offset += i;
  4965. }
  4966. // seems like true/false representation depends on exporter.
  4967. // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
  4968. // then sees LSB.
  4969. getBoolean() {
  4970. return (this.getUint8() & 1) === 1;
  4971. }
  4972. getBooleanArray(i) {
  4973. const r = [];
  4974. for (let s = 0; s < i; s++)
  4975. r.push(this.getBoolean());
  4976. return r;
  4977. }
  4978. getUint8() {
  4979. const i = this.dv.getUint8(this.offset);
  4980. return this.offset += 1, i;
  4981. }
  4982. getInt16() {
  4983. const i = this.dv.getInt16(this.offset, this.littleEndian);
  4984. return this.offset += 2, i;
  4985. }
  4986. getInt32() {
  4987. const i = this.dv.getInt32(this.offset, this.littleEndian);
  4988. return this.offset += 4, i;
  4989. }
  4990. getInt32Array(i) {
  4991. const r = [];
  4992. for (let s = 0; s < i; s++)
  4993. r.push(this.getInt32());
  4994. return r;
  4995. }
  4996. getUint32() {
  4997. const i = this.dv.getUint32(this.offset, this.littleEndian);
  4998. return this.offset += 4, i;
  4999. }
  5000. // JavaScript doesn't support 64-bit integer so calculate this here
  5001. // 1 << 32 will return 1 so using multiply operation instead here.
  5002. // There's a possibility that this method returns wrong value if the value
  5003. // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
  5004. // TODO: safely handle 64-bit integer
  5005. getInt64() {
  5006. let i, r;
  5007. return this.littleEndian ? (i = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), i = this.getUint32()), r & 2147483648 ? (r = ~r & 4294967295, i = ~i & 4294967295, i === 4294967295 && (r = r + 1 & 4294967295), i = i + 1 & 4294967295, -(r * 4294967296 + i)) : r * 4294967296 + i;
  5008. }
  5009. getInt64Array(i) {
  5010. const r = [];
  5011. for (let s = 0; s < i; s++)
  5012. r.push(this.getInt64());
  5013. return r;
  5014. }
  5015. // Note: see getInt64() comment
  5016. getUint64() {
  5017. let i, r;
  5018. return this.littleEndian ? (i = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), i = this.getUint32()), r * 4294967296 + i;
  5019. }
  5020. getFloat32() {
  5021. const i = this.dv.getFloat32(this.offset, this.littleEndian);
  5022. return this.offset += 4, i;
  5023. }
  5024. getFloat32Array(i) {
  5025. const r = [];
  5026. for (let s = 0; s < i; s++)
  5027. r.push(this.getFloat32());
  5028. return r;
  5029. }
  5030. getFloat64() {
  5031. const i = this.dv.getFloat64(this.offset, this.littleEndian);
  5032. return this.offset += 8, i;
  5033. }
  5034. getFloat64Array(i) {
  5035. const r = [];
  5036. for (let s = 0; s < i; s++)
  5037. r.push(this.getFloat64());
  5038. return r;
  5039. }
  5040. getArrayBuffer(i) {
  5041. const r = this.dv.buffer.slice(this.offset, this.offset + i);
  5042. return this.offset += i, r;
  5043. }
  5044. getString(i) {
  5045. let r = [];
  5046. for (let a = 0; a < i; a++)
  5047. r[a] = this.getUint8();
  5048. const s = r.indexOf(0);
  5049. return s >= 0 && (r = r.slice(0, s)), LoaderUtils.decodeText(new Uint8Array(r));
  5050. }
  5051. };
  5052. var Wa = class {
  5053. add(i, r) {
  5054. this[i] = r;
  5055. }
  5056. };
  5057. function Qu(b2) {
  5058. const i = "Kaydara FBX Binary \0";
  5059. return b2.byteLength >= i.length && i === tl(b2, 0, i.length);
  5060. }
  5061. function Zu(b2) {
  5062. const i = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
  5063. let r = 0;
  5064. function s(a) {
  5065. const c = b2[a - 1];
  5066. return b2 = b2.slice(r + a), r++, c;
  5067. }
  5068. for (let a = 0; a < i.length; ++a)
  5069. if (s(1) === i[a])
  5070. return false;
  5071. return true;
  5072. }
  5073. function ba(b2) {
  5074. const i = /FBXVersion: (\d+)/, r = b2.match(i);
  5075. if (r)
  5076. return parseInt(r[1]);
  5077. throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
  5078. }
  5079. function Wu(b2) {
  5080. return b2 / 46186158e3;
  5081. }
  5082. var Ju = [];
  5083. function Os(b2, i, r, s) {
  5084. let a;
  5085. switch (s.mappingType) {
  5086. case "ByPolygonVertex":
  5087. a = b2;
  5088. break;
  5089. case "ByPolygon":
  5090. a = i;
  5091. break;
  5092. case "ByVertice":
  5093. a = r;
  5094. break;
  5095. case "AllSame":
  5096. a = s.indices[0];
  5097. break;
  5098. default:
  5099. console.warn("THREE.FBXLoader: unknown attribute mapping type " + s.mappingType);
  5100. }
  5101. s.referenceType === "IndexToDirect" && (a = s.indices[a]);
  5102. const c = a * s.dataSize, u = c + s.dataSize;
  5103. return th(Ju, s.buffer, c, u);
  5104. }
  5105. var eo = new Euler();
  5106. var ui = new Vector3();
  5107. function Ja(b2) {
  5108. const i = new Matrix4(), r = new Matrix4(), s = new Matrix4(), a = new Matrix4(), c = new Matrix4(), u = new Matrix4(), h2 = new Matrix4(), d = new Matrix4(), g = new Matrix4(), w = new Matrix4(), _ = new Matrix4(), y2 = new Matrix4(), C = b2.inheritType ? b2.inheritType : 0;
  5109. if (b2.translation && i.setPosition(ui.fromArray(b2.translation)), b2.preRotation) {
  5110. const K = b2.preRotation.map(MathUtils.degToRad);
  5111. K.push(b2.eulerOrder), r.makeRotationFromEuler(eo.fromArray(K));
  5112. }
  5113. if (b2.rotation) {
  5114. const K = b2.rotation.map(MathUtils.degToRad);
  5115. K.push(b2.eulerOrder), s.makeRotationFromEuler(eo.fromArray(K));
  5116. }
  5117. if (b2.postRotation) {
  5118. const K = b2.postRotation.map(MathUtils.degToRad);
  5119. K.push(b2.eulerOrder), a.makeRotationFromEuler(eo.fromArray(K)), a.invert();
  5120. }
  5121. b2.scale && c.scale(ui.fromArray(b2.scale)), b2.scalingOffset && h2.setPosition(ui.fromArray(b2.scalingOffset)), b2.scalingPivot && u.setPosition(ui.fromArray(b2.scalingPivot)), b2.rotationOffset && d.setPosition(ui.fromArray(b2.rotationOffset)), b2.rotationPivot && g.setPosition(ui.fromArray(b2.rotationPivot)), b2.parentMatrixWorld && (_.copy(b2.parentMatrix), w.copy(b2.parentMatrixWorld));
  5122. const I2 = r.clone().multiply(s).multiply(a), S2 = new Matrix4();
  5123. S2.extractRotation(w);
  5124. const R2 = new Matrix4();
  5125. R2.copyPosition(w);
  5126. const j2 = R2.clone().invert().multiply(w), F = S2.clone().invert().multiply(j2), V2 = c, D = new Matrix4();
  5127. if (C === 0)
  5128. D.copy(S2).multiply(I2).multiply(F).multiply(V2);
  5129. else if (C === 1)
  5130. D.copy(S2).multiply(F).multiply(I2).multiply(V2);
  5131. else {
  5132. const q = new Matrix4().scale(new Vector3().setFromMatrixScale(_)).clone().invert(), he = F.clone().multiply(q);
  5133. D.copy(S2).multiply(I2).multiply(he).multiply(V2);
  5134. }
  5135. const Y = g.clone().invert(), G2 = u.clone().invert();
  5136. let N = i.clone().multiply(d).multiply(g).multiply(r).multiply(s).multiply(a).multiply(Y).multiply(h2).multiply(u).multiply(c).multiply(G2);
  5137. const O = new Matrix4().copyPosition(N), H2 = w.clone().multiply(O);
  5138. return y2.copyPosition(H2), N = y2.clone().multiply(D), N.premultiply(w.invert()), N;
  5139. }
  5140. function el(b2) {
  5141. b2 = b2 || 0;
  5142. const i = [
  5143. "ZYX",
  5144. // -> XYZ extrinsic
  5145. "YZX",
  5146. // -> XZY extrinsic
  5147. "XZY",
  5148. // -> YZX extrinsic
  5149. "ZXY",
  5150. // -> YXZ extrinsic
  5151. "YXZ",
  5152. // -> ZXY extrinsic
  5153. "XYZ"
  5154. // -> ZYX extrinsic
  5155. //'SphericXYZ', // not possible to support
  5156. ];
  5157. return b2 === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), i[0]) : i[b2];
  5158. }
  5159. function to(b2) {
  5160. return b2.split(",").map(function(r) {
  5161. return parseFloat(r);
  5162. });
  5163. }
  5164. function tl(b2, i, r) {
  5165. return i === void 0 && (i = 0), r === void 0 && (r = b2.byteLength), LoaderUtils.decodeText(new Uint8Array(b2, i, r));
  5166. }
  5167. function eh(b2, i) {
  5168. for (let r = 0, s = b2.length, a = i.length; r < a; r++, s++)
  5169. b2[s] = i[r];
  5170. }
  5171. function th(b2, i, r, s) {
  5172. for (let a = r, c = 0; a < s; a++, c++)
  5173. b2[c] = i[a];
  5174. return b2;
  5175. }
  5176. function ga(b2, i, r) {
  5177. return b2.slice(0, i).concat(r).concat(b2.slice(i));
  5178. }
  5179. var nh = class extends Loader {
  5180. constructor(i) {
  5181. super(i);
  5182. }
  5183. load(i, r, s, a) {
  5184. const c = new FileLoader(this.manager);
  5185. c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(i, (u) => {
  5186. if (typeof u != "string")
  5187. throw new Error("unsupported data type");
  5188. const h2 = JSON.parse(u), d = this.parse(h2);
  5189. r && r(d);
  5190. }, s, a);
  5191. }
  5192. parse(i) {
  5193. return new _o(i);
  5194. }
  5195. };
  5196. var _o = class {
  5197. constructor(i) {
  5198. T2(this, "data", void 0), this.data = i;
  5199. }
  5200. generateShapes(i, r = 100, s) {
  5201. const a = [], c = {
  5202. letterSpacing: 0,
  5203. lineHeight: 1,
  5204. ...s
  5205. }, u = ih(i, r, this.data, c);
  5206. for (let h2 = 0, d = u.length; h2 < d; h2++)
  5207. Array.prototype.push.apply(a, u[h2].toShapes(false));
  5208. return a;
  5209. }
  5210. };
  5211. T2(_o, "isFont", void 0);
  5212. T2(_o, "type", void 0);
  5213. function ih(b2, i, r, s) {
  5214. const a = Array.from(b2), c = i / r.resolution, u = (r.boundingBox.yMax - r.boundingBox.yMin + r.underlineThickness) * c, h2 = [];
  5215. let d = 0, g = 0;
  5216. for (let w = 0; w < a.length; w++) {
  5217. const _ = a[w];
  5218. if (_ === `
  5219. `)
  5220. d = 0, g -= u * s.lineHeight;
  5221. else {
  5222. const y2 = sh(_, c, d, g, r);
  5223. y2 && (d += y2.offsetX + s.letterSpacing, h2.push(y2.path));
  5224. }
  5225. }
  5226. return h2;
  5227. }
  5228. function sh(b2, i, r, s, a) {
  5229. const c = a.glyphs[b2] || a.glyphs["?"];
  5230. if (!c) {
  5231. console.error('THREE.Font: character "' + b2 + '" does not exists in font family ' + a.familyName + ".");
  5232. return;
  5233. }
  5234. const u = new ShapePath();
  5235. let h2, d, g, w, _, y2, C, I2;
  5236. if (c.o) {
  5237. const S2 = c._cachedOutline || (c._cachedOutline = c.o.split(" "));
  5238. for (let R2 = 0, j2 = S2.length; R2 < j2; )
  5239. switch (S2[R2++]) {
  5240. case "m":
  5241. h2 = parseInt(S2[R2++]) * i + r, d = parseInt(S2[R2++]) * i + s, u.moveTo(h2, d);
  5242. break;
  5243. case "l":
  5244. h2 = parseInt(S2[R2++]) * i + r, d = parseInt(S2[R2++]) * i + s, u.lineTo(h2, d);
  5245. break;
  5246. case "q":
  5247. g = parseInt(S2[R2++]) * i + r, w = parseInt(S2[R2++]) * i + s, _ = parseInt(S2[R2++]) * i + r, y2 = parseInt(S2[R2++]) * i + s, u.quadraticCurveTo(_, y2, g, w);
  5248. break;
  5249. case "b":
  5250. g = parseInt(S2[R2++]) * i + r, w = parseInt(S2[R2++]) * i + s, _ = parseInt(S2[R2++]) * i + r, y2 = parseInt(S2[R2++]) * i + s, C = parseInt(S2[R2++]) * i + r, I2 = parseInt(S2[R2++]) * i + s, u.bezierCurveTo(_, y2, C, I2, g, w);
  5251. break;
  5252. }
  5253. }
  5254. return {
  5255. offsetX: c.ha * i,
  5256. path: u
  5257. };
  5258. }
  5259. var nl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  5260. function rh(b2) {
  5261. return b2 && b2.__esModule && Object.prototype.hasOwnProperty.call(b2, "default") ? b2.default : b2;
  5262. }
  5263. var oh = class extends DataTextureLoader {
  5264. constructor(i) {
  5265. super(i), this.type = HalfFloatType;
  5266. }
  5267. // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
  5268. parse(i) {
  5269. const h2 = function(V2, D) {
  5270. switch (V2) {
  5271. case 1:
  5272. console.error("THREE.RGBELoader Read Error: " + (D || ""));
  5273. break;
  5274. case 2:
  5275. console.error("THREE.RGBELoader Write Error: " + (D || ""));
  5276. break;
  5277. case 3:
  5278. console.error("THREE.RGBELoader Bad File Format: " + (D || ""));
  5279. break;
  5280. default:
  5281. case 4:
  5282. console.error("THREE.RGBELoader: Error: " + (D || ""));
  5283. }
  5284. return -1;
  5285. }, _ = `
  5286. `, y2 = function(V2, D, Y) {
  5287. D = D || 1024;
  5288. let N = V2.pos, O = -1, H2 = 0, K = "", q = String.fromCharCode.apply(null, new Uint16Array(V2.subarray(N, N + 128)));
  5289. for (; 0 > (O = q.indexOf(_)) && H2 < D && N < V2.byteLength; )
  5290. K += q, H2 += q.length, N += 128, q += String.fromCharCode.apply(null, new Uint16Array(V2.subarray(N, N + 128)));
  5291. return -1 < O ? (Y !== false && (V2.pos += H2 + O + 1), K + q.slice(0, O)) : false;
  5292. }, C = function(V2) {
  5293. const D = /^#\?(\S+)/, Y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, G2 = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, O = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, H2 = {
  5294. valid: 0,
  5295. string: "",
  5296. comments: "",
  5297. programtype: "RGBE",
  5298. format: "",
  5299. gamma: 1,
  5300. exposure: 1,
  5301. width: 0,
  5302. height: 0
  5303. /* image dimensions, width/height */
  5304. };
  5305. let K, q;
  5306. if (V2.pos >= V2.byteLength || !(K = y2(V2)))
  5307. return h2(1, "no header found");
  5308. if (!(q = K.match(D)))
  5309. return h2(3, "bad initial token");
  5310. for (H2.valid |= 1, H2.programtype = q[1], H2.string += K + `
  5311. `; K = y2(V2), K !== false; ) {
  5312. if (H2.string += K + `
  5313. `, K.charAt(0) === "#") {
  5314. H2.comments += K + `
  5315. `;
  5316. continue;
  5317. }
  5318. if ((q = K.match(Y)) && (H2.gamma = parseFloat(q[1])), (q = K.match(G2)) && (H2.exposure = parseFloat(q[1])), (q = K.match(N)) && (H2.valid |= 2, H2.format = q[1]), (q = K.match(O)) && (H2.valid |= 4, H2.height = parseInt(q[1], 10), H2.width = parseInt(q[2], 10)), H2.valid & 2 && H2.valid & 4)
  5319. break;
  5320. }
  5321. return H2.valid & 2 ? H2.valid & 4 ? H2 : h2(3, "missing image size specifier") : h2(3, "missing format specifier");
  5322. }, I2 = function(V2, D, Y) {
  5323. const G2 = D;
  5324. if (
  5325. // run length encoding is not allowed so read flat
  5326. G2 < 8 || G2 > 32767 || // this file is not run length encoded
  5327. V2[0] !== 2 || V2[1] !== 2 || V2[2] & 128
  5328. )
  5329. return new Uint8Array(V2);
  5330. if (G2 !== (V2[2] << 8 | V2[3]))
  5331. return h2(3, "wrong scanline width");
  5332. const N = new Uint8Array(4 * D * Y);
  5333. if (!N.length)
  5334. return h2(4, "unable to allocate buffer space");
  5335. let O = 0, H2 = 0;
  5336. const K = 4 * G2, q = new Uint8Array(4), he = new Uint8Array(K);
  5337. let _e = Y;
  5338. for (; _e > 0 && H2 < V2.byteLength; ) {
  5339. if (H2 + 4 > V2.byteLength)
  5340. return h2(1);
  5341. if (q[0] = V2[H2++], q[1] = V2[H2++], q[2] = V2[H2++], q[3] = V2[H2++], q[0] != 2 || q[1] != 2 || (q[2] << 8 | q[3]) != G2)
  5342. return h2(3, "bad rgbe scanline format");
  5343. let pe2 = 0, fe2;
  5344. for (; pe2 < K && H2 < V2.byteLength; ) {
  5345. fe2 = V2[H2++];
  5346. const ee2 = fe2 > 128;
  5347. if (ee2 && (fe2 -= 128), fe2 === 0 || pe2 + fe2 > K)
  5348. return h2(3, "bad scanline data");
  5349. if (ee2) {
  5350. const X = V2[H2++];
  5351. for (let Te = 0; Te < fe2; Te++)
  5352. he[pe2++] = X;
  5353. } else
  5354. he.set(V2.subarray(H2, H2 + fe2), pe2), pe2 += fe2, H2 += fe2;
  5355. }
  5356. const de = G2;
  5357. for (let ee2 = 0; ee2 < de; ee2++) {
  5358. let X = 0;
  5359. N[O] = he[ee2 + X], X += G2, N[O + 1] = he[ee2 + X], X += G2, N[O + 2] = he[ee2 + X], X += G2, N[O + 3] = he[ee2 + X], O += 4;
  5360. }
  5361. _e--;
  5362. }
  5363. return N;
  5364. }, S2 = function(V2, D, Y, G2) {
  5365. const N = V2[D + 3], O = Math.pow(2, N - 128) / 255;
  5366. Y[G2 + 0] = V2[D + 0] * O, Y[G2 + 1] = V2[D + 1] * O, Y[G2 + 2] = V2[D + 2] * O, Y[G2 + 3] = 1;
  5367. }, R2 = function(V2, D, Y, G2) {
  5368. const N = V2[D + 3], O = Math.pow(2, N - 128) / 255;
  5369. Y[G2 + 0] = DataUtils.toHalfFloat(Math.min(V2[D + 0] * O, 65504)), Y[G2 + 1] = DataUtils.toHalfFloat(Math.min(V2[D + 1] * O, 65504)), Y[G2 + 2] = DataUtils.toHalfFloat(Math.min(V2[D + 2] * O, 65504)), Y[G2 + 3] = DataUtils.toHalfFloat(1);
  5370. }, j2 = new Uint8Array(i);
  5371. j2.pos = 0;
  5372. const F = C(j2);
  5373. if (F !== -1) {
  5374. const V2 = F.width, D = F.height, Y = I2(j2.subarray(j2.pos), V2, D);
  5375. if (Y !== -1) {
  5376. let G2, N, O;
  5377. switch (this.type) {
  5378. case FloatType:
  5379. O = Y.length / 4;
  5380. const H2 = new Float32Array(O * 4);
  5381. for (let q = 0; q < O; q++)
  5382. S2(Y, q * 4, H2, q * 4);
  5383. G2 = H2, N = FloatType;
  5384. break;
  5385. case HalfFloatType:
  5386. O = Y.length / 4;
  5387. const K = new Uint16Array(O * 4);
  5388. for (let q = 0; q < O; q++)
  5389. R2(Y, q * 4, K, q * 4);
  5390. G2 = K, N = HalfFloatType;
  5391. break;
  5392. default:
  5393. console.error("THREE.RGBELoader: unsupported type: ", this.type);
  5394. break;
  5395. }
  5396. return {
  5397. width: V2,
  5398. height: D,
  5399. data: G2,
  5400. header: F.string,
  5401. gamma: F.gamma,
  5402. exposure: F.exposure,
  5403. type: N
  5404. };
  5405. }
  5406. }
  5407. return null;
  5408. }
  5409. setDataType(i) {
  5410. return this.type = i, this;
  5411. }
  5412. load(i, r, s, a) {
  5413. function c(u, h2) {
  5414. switch (u.type) {
  5415. case FloatType:
  5416. case HalfFloatType:
  5417. u.encoding = LinearEncoding, u.minFilter = LinearFilter, u.magFilter = LinearFilter, u.generateMipmaps = false, u.flipY = true;
  5418. break;
  5419. }
  5420. r && r(u, h2);
  5421. }
  5422. return super.load(i, c, s, a);
  5423. }
  5424. };
  5425. var no = /* @__PURE__ */ new WeakMap();
  5426. var ah = class extends Loader {
  5427. constructor(i) {
  5428. super(i), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
  5429. position: "POSITION",
  5430. normal: "NORMAL",
  5431. color: "COLOR",
  5432. uv: "TEX_COORD"
  5433. }, this.defaultAttributeTypes = {
  5434. position: "Float32Array",
  5435. normal: "Float32Array",
  5436. color: "Float32Array",
  5437. uv: "Float32Array"
  5438. };
  5439. }
  5440. setDecoderPath(i) {
  5441. return this.decoderPath = i, this;
  5442. }
  5443. setDecoderConfig(i) {
  5444. return this.decoderConfig = i, this;
  5445. }
  5446. setWorkerLimit(i) {
  5447. return this.workerLimit = i, this;
  5448. }
  5449. load(i, r, s, a) {
  5450. const c = new FileLoader(this.manager);
  5451. c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(i, (u) => {
  5452. const h2 = {
  5453. attributeIDs: this.defaultAttributeIDs,
  5454. attributeTypes: this.defaultAttributeTypes,
  5455. useUniqueIDs: false
  5456. };
  5457. this.decodeGeometry(u, h2).then(r).catch(a);
  5458. }, s, a);
  5459. }
  5460. /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
  5461. decodeDracoFile(i, r, s, a) {
  5462. const c = {
  5463. attributeIDs: s || this.defaultAttributeIDs,
  5464. attributeTypes: a || this.defaultAttributeTypes,
  5465. useUniqueIDs: !!s
  5466. };
  5467. this.decodeGeometry(i, c).then(r);
  5468. }
  5469. decodeGeometry(i, r) {
  5470. for (const d in r.attributeTypes) {
  5471. const g = r.attributeTypes[d];
  5472. g.BYTES_PER_ELEMENT !== void 0 && (r.attributeTypes[d] = g.name);
  5473. }
  5474. const s = JSON.stringify(r);
  5475. if (no.has(i)) {
  5476. const d = no.get(i);
  5477. if (d.key === s)
  5478. return d.promise;
  5479. if (i.byteLength === 0)
  5480. throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
  5481. }
  5482. let a;
  5483. const c = this.workerNextTaskID++, u = i.byteLength, h2 = this._getWorker(c, u).then((d) => (a = d, new Promise((g, w) => {
  5484. a._callbacks[c] = {
  5485. resolve: g,
  5486. reject: w
  5487. }, a.postMessage({
  5488. type: "decode",
  5489. id: c,
  5490. taskConfig: r,
  5491. buffer: i
  5492. }, [i]);
  5493. }))).then((d) => this._createGeometry(d.geometry));
  5494. return h2.catch(() => true).then(() => {
  5495. a && c && this._releaseTask(a, c);
  5496. }), no.set(i, {
  5497. key: s,
  5498. promise: h2
  5499. }), h2;
  5500. }
  5501. _createGeometry(i) {
  5502. const r = new BufferGeometry();
  5503. i.index && r.setIndex(new BufferAttribute(i.index.array, 1));
  5504. for (let s = 0; s < i.attributes.length; s++) {
  5505. const a = i.attributes[s], c = a.name, u = a.array, h2 = a.itemSize;
  5506. r.setAttribute(c, new BufferAttribute(u, h2));
  5507. }
  5508. return r;
  5509. }
  5510. _loadLibrary(i, r) {
  5511. const s = new FileLoader(this.manager);
  5512. return s.setPath(this.decoderPath), s.setResponseType(r), s.setWithCredentials(this.withCredentials), new Promise((a, c) => {
  5513. s.load(i, a, void 0, c);
  5514. });
  5515. }
  5516. preload() {
  5517. return this._initDecoder(), this;
  5518. }
  5519. _initDecoder() {
  5520. if (this.decoderPending)
  5521. return this.decoderPending;
  5522. const i = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
  5523. return i ? r.push(this._loadLibrary("draco_decoder.js", "text")) : (r.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), r.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(r).then((s) => {
  5524. const a = s[0];
  5525. i || (this.decoderConfig.wasmBinary = s[1]);
  5526. const c = lh.toString(), u = ["/* draco decoder */", a, "", "/* worker */", c.substring(c.indexOf("{") + 1, c.lastIndexOf("}"))].join(`
  5527. `);
  5528. this.workerSourceURL = URL.createObjectURL(new Blob([u]));
  5529. }), this.decoderPending;
  5530. }
  5531. _getWorker(i, r) {
  5532. return this._initDecoder().then(() => {
  5533. if (this.workerPool.length < this.workerLimit) {
  5534. const a = new Worker(this.workerSourceURL);
  5535. a._callbacks = {}, a._taskCosts = {}, a._taskLoad = 0, a.postMessage({
  5536. type: "init",
  5537. decoderConfig: this.decoderConfig
  5538. }), a.onmessage = function(c) {
  5539. const u = c.data;
  5540. switch (u.type) {
  5541. case "decode":
  5542. a._callbacks[u.id].resolve(u);
  5543. break;
  5544. case "error":
  5545. a._callbacks[u.id].reject(u);
  5546. break;
  5547. default:
  5548. console.error('THREE.DRACOLoader: Unexpected message, "' + u.type + '"');
  5549. }
  5550. }, this.workerPool.push(a);
  5551. } else
  5552. this.workerPool.sort(function(a, c) {
  5553. return a._taskLoad > c._taskLoad ? -1 : 1;
  5554. });
  5555. const s = this.workerPool[this.workerPool.length - 1];
  5556. return s._taskCosts[i] = r, s._taskLoad += r, s;
  5557. });
  5558. }
  5559. _releaseTask(i, r) {
  5560. i._taskLoad -= i._taskCosts[r], delete i._callbacks[r], delete i._taskCosts[r];
  5561. }
  5562. debug() {
  5563. console.log("Task load: ", this.workerPool.map((i) => i._taskLoad));
  5564. }
  5565. dispose() {
  5566. for (let i = 0; i < this.workerPool.length; ++i)
  5567. this.workerPool[i].terminate();
  5568. return this.workerPool.length = 0, this;
  5569. }
  5570. };
  5571. function lh() {
  5572. let b2, i;
  5573. onmessage = function(u) {
  5574. const h2 = u.data;
  5575. switch (h2.type) {
  5576. case "init":
  5577. b2 = h2.decoderConfig, i = new Promise(function(w) {
  5578. b2.onModuleLoaded = function(_) {
  5579. w({
  5580. draco: _
  5581. });
  5582. }, DracoDecoderModule(b2);
  5583. });
  5584. break;
  5585. case "decode":
  5586. const d = h2.buffer, g = h2.taskConfig;
  5587. i.then((w) => {
  5588. const _ = w.draco, y2 = new _.Decoder(), C = new _.DecoderBuffer();
  5589. C.Init(new Int8Array(d), d.byteLength);
  5590. try {
  5591. const I2 = r(_, y2, C, g), S2 = I2.attributes.map((R2) => R2.array.buffer);
  5592. I2.index && S2.push(I2.index.array.buffer), self.postMessage({
  5593. type: "decode",
  5594. id: h2.id,
  5595. geometry: I2
  5596. }, S2);
  5597. } catch (I2) {
  5598. console.error(I2), self.postMessage({
  5599. type: "error",
  5600. id: h2.id,
  5601. error: I2.message
  5602. });
  5603. } finally {
  5604. _.destroy(C), _.destroy(y2);
  5605. }
  5606. });
  5607. break;
  5608. }
  5609. };
  5610. function r(u, h2, d, g) {
  5611. const w = g.attributeIDs, _ = g.attributeTypes;
  5612. let y2, C;
  5613. const I2 = h2.GetEncodedGeometryType(d);
  5614. if (I2 === u.TRIANGULAR_MESH)
  5615. y2 = new u.Mesh(), C = h2.DecodeBufferToMesh(d, y2);
  5616. else if (I2 === u.POINT_CLOUD)
  5617. y2 = new u.PointCloud(), C = h2.DecodeBufferToPointCloud(d, y2);
  5618. else
  5619. throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
  5620. if (!C.ok() || y2.ptr === 0)
  5621. throw new Error("THREE.DRACOLoader: Decoding failed: " + C.error_msg());
  5622. const S2 = {
  5623. index: null,
  5624. attributes: []
  5625. };
  5626. for (const R2 in w) {
  5627. const j2 = self[_[R2]];
  5628. let F, V2;
  5629. if (g.useUniqueIDs)
  5630. V2 = w[R2], F = h2.GetAttributeByUniqueId(y2, V2);
  5631. else {
  5632. if (V2 = h2.GetAttributeId(y2, u[w[R2]]), V2 === -1)
  5633. continue;
  5634. F = h2.GetAttribute(y2, V2);
  5635. }
  5636. S2.attributes.push(a(u, h2, y2, R2, j2, F));
  5637. }
  5638. return I2 === u.TRIANGULAR_MESH && (S2.index = s(u, h2, y2)), u.destroy(y2), S2;
  5639. }
  5640. function s(u, h2, d) {
  5641. const w = d.num_faces() * 3, _ = w * 4, y2 = u._malloc(_);
  5642. h2.GetTrianglesUInt32Array(d, _, y2);
  5643. const C = new Uint32Array(u.HEAPF32.buffer, y2, w).slice();
  5644. return u._free(y2), {
  5645. array: C,
  5646. itemSize: 1
  5647. };
  5648. }
  5649. function a(u, h2, d, g, w, _) {
  5650. const y2 = _.num_components(), I2 = d.num_points() * y2, S2 = I2 * w.BYTES_PER_ELEMENT, R2 = c(u, w), j2 = u._malloc(S2);
  5651. h2.GetAttributeDataArrayForAllPoints(d, _, R2, S2, j2);
  5652. const F = new w(u.HEAPF32.buffer, j2, I2).slice();
  5653. return u._free(j2), {
  5654. name: g,
  5655. array: F,
  5656. itemSize: y2
  5657. };
  5658. }
  5659. function c(u, h2) {
  5660. switch (h2) {
  5661. case Float32Array:
  5662. return u.DT_FLOAT32;
  5663. case Int8Array:
  5664. return u.DT_INT8;
  5665. case Int16Array:
  5666. return u.DT_INT16;
  5667. case Int32Array:
  5668. return u.DT_INT32;
  5669. case Uint8Array:
  5670. return u.DT_UINT8;
  5671. case Uint16Array:
  5672. return u.DT_UINT16;
  5673. case Uint32Array:
  5674. return u.DT_UINT32;
  5675. }
  5676. }
  5677. }
  5678. function jn() {
  5679. const { state: b2, setState: i } = inject("useTres", L()), r = inject("extend") || (() => {
  5680. });
  5681. return {
  5682. state: b2,
  5683. setState: i,
  5684. extend: r
  5685. };
  5686. }
  5687. var Oh = defineComponent({
  5688. __name: "OrbitControls",
  5689. props: {
  5690. makeDefault: { type: Boolean, default: false },
  5691. camera: null,
  5692. domElement: null,
  5693. target: null,
  5694. enableDamping: { type: Boolean }
  5695. },
  5696. setup(b2) {
  5697. const i = b2, { state: r, setState: s, extend: a } = jn(), c = ref(null);
  5698. return a({ OrbitControls: ru }), watch(c, (u) => {
  5699. u && i.makeDefault ? s("controls", u) : s("controls", null);
  5700. }), (u, h2) => {
  5701. var g;
  5702. const d = resolveComponent("TresOrbitControls");
  5703. return unref(r).camera && unref(r).renderer ? (openBlock(), createBlock(d, {
  5704. key: 0,
  5705. ref_key: "controls",
  5706. ref: c,
  5707. args: [unref(unref(r).camera) || b2.camera, ((g = unref(r).renderer) == null ? void 0 : g.domElement) || b2.domElement]
  5708. }, null, 8, ["args"])) : createCommentVNode("", true);
  5709. };
  5710. }
  5711. });
  5712. function ch(b2, i) {
  5713. const r = {};
  5714. for (const s of i)
  5715. Object.prototype.hasOwnProperty.call(b2, s) && (r[s] = b2[s]);
  5716. return r;
  5717. }
  5718. function ph(b2, i) {
  5719. const r = `set${i[0].toUpperCase()}${i.slice(1)}`;
  5720. return b2[r] !== void 0;
  5721. }
  5722. var Nh = defineComponent({
  5723. __name: "TransformControls",
  5724. props: {
  5725. object: null,
  5726. mode: null,
  5727. enabled: { type: Boolean, default: true },
  5728. axis: null,
  5729. translationSnap: null,
  5730. rotationSnap: null,
  5731. scaleSnap: null,
  5732. space: null,
  5733. size: null,
  5734. showX: { type: Boolean },
  5735. showY: { type: Boolean },
  5736. showZ: { type: Boolean }
  5737. },
  5738. emits: ["dragging", "change", "mouseDown", "mouseUp", "objectChange"],
  5739. setup(b2, { emit: i }) {
  5740. const r = b2;
  5741. let s = shallowRef();
  5742. const { state: a } = jn(), c = computed(
  5743. () => ch(r, [
  5744. "enabled",
  5745. "axis",
  5746. "mode",
  5747. "translationSnap",
  5748. "rotationSnap",
  5749. "scaleSnap",
  5750. "space",
  5751. "size",
  5752. "showX",
  5753. "showY",
  5754. "showZ"
  5755. ])
  5756. ), u = () => i("change", s.value), h2 = () => i("mouseDown", s.value), d = () => i("mouseUp", s.value), g = () => i("objectChange", s.value), w = (y2) => {
  5757. a.controls && (a.controls.enabled = !y2.value), i("dragging", y2.value);
  5758. };
  5759. function _(y2) {
  5760. y2.addEventListener("dragging-changed", w), y2.addEventListener("change", u), y2.addEventListener("mouseDown", h2), y2.addEventListener("mouseUp", d), y2.addEventListener("objectChange", g);
  5761. }
  5762. return watch(
  5763. () => r.object,
  5764. () => {
  5765. a.camera && a.renderer && a.scene && r.object && (s.value = new nu(a.camera, unref(a.renderer).domElement), s.value.attach(unref(r.object)), a.scene.add(unref(s)), _(unref(s)));
  5766. },
  5767. {
  5768. deep: true
  5769. }
  5770. ), watch(
  5771. [c, s],
  5772. // TODO: properly type this
  5773. ([y2, C]) => {
  5774. if (y2 && C)
  5775. for (const I2 in y2)
  5776. if (!ph(C, I2))
  5777. C[I2] = y2[I2];
  5778. else {
  5779. const S2 = `set${I2[0].toUpperCase()}${I2.slice(1)}`;
  5780. typeof C[S2] == "function" && y2[I2] !== void 0 && C[S2](y2[I2]);
  5781. }
  5782. },
  5783. {
  5784. immediate: true
  5785. }
  5786. ), onUnmounted(() => {
  5787. s.value && (s.value.removeEventListener("dragging-changed", w), s.value.removeEventListener("change", u), s.value.removeEventListener("mouseDown", h2), s.value.removeEventListener("mouseUp", d), s.value.removeEventListener("objectChange", g));
  5788. }), (y2, C) => renderSlot(y2.$slots, "default");
  5789. }
  5790. });
  5791. var _a2;
  5792. var il = typeof window < "u";
  5793. var uh = (b2) => typeof b2 == "string";
  5794. var hh = () => {
  5795. };
  5796. il && ((_a2 = window == null ? void 0 : window.navigator) != null && _a2.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  5797. function sl(b2) {
  5798. return typeof b2 == "function" ? b2() : unref(b2);
  5799. }
  5800. function dh(b2) {
  5801. return b2;
  5802. }
  5803. function mh(b2) {
  5804. return getCurrentScope() ? (onScopeDispose(b2), true) : false;
  5805. }
  5806. function fh(b2, i = true) {
  5807. getCurrentInstance() ? onMounted(b2) : i ? b2() : nextTick(b2);
  5808. }
  5809. function vh(b2) {
  5810. var i;
  5811. const r = sl(b2);
  5812. return (i = r == null ? void 0 : r.$el) != null ? i : r;
  5813. }
  5814. var wo = il ? window : void 0;
  5815. function Dn(...b2) {
  5816. let i, r, s, a;
  5817. if (uh(b2[0]) || Array.isArray(b2[0]) ? ([r, s, a] = b2, i = wo) : [i, r, s, a] = b2, !i)
  5818. return hh;
  5819. Array.isArray(r) || (r = [r]), Array.isArray(s) || (s = [s]);
  5820. const c = [], u = () => {
  5821. c.forEach((w) => w()), c.length = 0;
  5822. }, h2 = (w, _, y2, C) => (w.addEventListener(_, y2, C), () => w.removeEventListener(_, y2, C)), d = watch(() => [vh(i), sl(a)], ([w, _]) => {
  5823. u(), w && c.push(...r.flatMap((y2) => s.map((C) => h2(w, y2, C, _))));
  5824. }, { immediate: true, flush: "post" }), g = () => {
  5825. d(), u();
  5826. };
  5827. return mh(g), g;
  5828. }
  5829. var wa = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  5830. var ya = "__vueuse_ssr_handlers__";
  5831. wa[ya] = wa[ya] || {};
  5832. function bh(b2 = {}) {
  5833. const {
  5834. type: i = "page",
  5835. touch: r = true,
  5836. resetOnTouchEnds: s = false,
  5837. initialValue: a = { x: 0, y: 0 },
  5838. window: c = wo,
  5839. eventFilter: u
  5840. } = b2, h2 = ref(a.x), d = ref(a.y), g = ref(null), w = (S2) => {
  5841. i === "page" ? (h2.value = S2.pageX, d.value = S2.pageY) : i === "client" ? (h2.value = S2.clientX, d.value = S2.clientY) : i === "movement" && (h2.value = S2.movementX, d.value = S2.movementY), g.value = "mouse";
  5842. }, _ = () => {
  5843. h2.value = a.x, d.value = a.y;
  5844. }, y2 = (S2) => {
  5845. if (S2.touches.length > 0) {
  5846. const R2 = S2.touches[0];
  5847. i === "page" ? (h2.value = R2.pageX, d.value = R2.pageY) : i === "client" && (h2.value = R2.clientX, d.value = R2.clientY), g.value = "touch";
  5848. }
  5849. }, C = (S2) => u === void 0 ? w(S2) : u(() => w(S2), {}), I2 = (S2) => u === void 0 ? y2(S2) : u(() => y2(S2), {});
  5850. return c && (Dn(c, "mousemove", C, { passive: true }), Dn(c, "dragover", C, { passive: true }), r && i !== "movement" && (Dn(c, "touchstart", I2, { passive: true }), Dn(c, "touchmove", I2, { passive: true }), s && Dn(c, "touchend", _, { passive: true }))), {
  5851. x: h2,
  5852. y: d,
  5853. sourceType: g
  5854. };
  5855. }
  5856. var xa;
  5857. (function(b2) {
  5858. b2.UP = "UP", b2.RIGHT = "RIGHT", b2.DOWN = "DOWN", b2.LEFT = "LEFT", b2.NONE = "NONE";
  5859. })(xa || (xa = {}));
  5860. var gh = Object.defineProperty;
  5861. var Ea = Object.getOwnPropertySymbols;
  5862. var _h = Object.prototype.hasOwnProperty;
  5863. var wh = Object.prototype.propertyIsEnumerable;
  5864. var Ca = (b2, i, r) => i in b2 ? gh(b2, i, { enumerable: true, configurable: true, writable: true, value: r }) : b2[i] = r;
  5865. var yh = (b2, i) => {
  5866. for (var r in i || (i = {}))
  5867. _h.call(i, r) && Ca(b2, r, i[r]);
  5868. if (Ea)
  5869. for (var r of Ea(i))
  5870. wh.call(i, r) && Ca(b2, r, i[r]);
  5871. return b2;
  5872. };
  5873. var xh = {
  5874. easeInSine: [0.12, 0, 0.39, 0],
  5875. easeOutSine: [0.61, 1, 0.88, 1],
  5876. easeInOutSine: [0.37, 0, 0.63, 1],
  5877. easeInQuad: [0.11, 0, 0.5, 0],
  5878. easeOutQuad: [0.5, 1, 0.89, 1],
  5879. easeInOutQuad: [0.45, 0, 0.55, 1],
  5880. easeInCubic: [0.32, 0, 0.67, 0],
  5881. easeOutCubic: [0.33, 1, 0.68, 1],
  5882. easeInOutCubic: [0.65, 0, 0.35, 1],
  5883. easeInQuart: [0.5, 0, 0.75, 0],
  5884. easeOutQuart: [0.25, 1, 0.5, 1],
  5885. easeInOutQuart: [0.76, 0, 0.24, 1],
  5886. easeInQuint: [0.64, 0, 0.78, 0],
  5887. easeOutQuint: [0.22, 1, 0.36, 1],
  5888. easeInOutQuint: [0.83, 0, 0.17, 1],
  5889. easeInExpo: [0.7, 0, 0.84, 0],
  5890. easeOutExpo: [0.16, 1, 0.3, 1],
  5891. easeInOutExpo: [0.87, 0, 0.13, 1],
  5892. easeInCirc: [0.55, 0, 1, 0.45],
  5893. easeOutCirc: [0, 0.55, 0.45, 1],
  5894. easeInOutCirc: [0.85, 0, 0.15, 1],
  5895. easeInBack: [0.36, 0, 0.66, -0.56],
  5896. easeOutBack: [0.34, 1.56, 0.64, 1],
  5897. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  5898. };
  5899. yh({
  5900. linear: dh
  5901. }, xh);
  5902. function Eh(b2 = {}) {
  5903. const {
  5904. window: i = wo,
  5905. initialWidth: r = 1 / 0,
  5906. initialHeight: s = 1 / 0,
  5907. listenOrientation: a = true,
  5908. includeScrollbar: c = true
  5909. } = b2, u = ref(r), h2 = ref(s), d = () => {
  5910. i && (c ? (u.value = i.innerWidth, h2.value = i.innerHeight) : (u.value = i.document.documentElement.clientWidth, h2.value = i.document.documentElement.clientHeight));
  5911. };
  5912. return d(), fh(d), Dn("resize", d, { passive: true }), a && Dn("orientationchange", d, { passive: true }), { width: u, height: h2 };
  5913. }
  5914. function Ch(b2 = false, i = 5, r) {
  5915. const { x: s, y: a } = bh(), { logWarning: c } = j(), { width: u, height: h2 } = Eh(), d = computed(() => (s.value / u.value - 0.5) * i), g = computed(() => -(a.value / h2.value - 0.5) * i);
  5916. if (r) {
  5917. const { x: w, y: _ } = r.position;
  5918. watchEffect(() => {
  5919. b2 || r && (r.position.x = w + d.value, r.position.y = _ + g.value);
  5920. });
  5921. } else
  5922. c("Scene must contain a Camera component to use this composable");
  5923. }
  5924. var Fh = defineComponent({
  5925. name: "PamCameraMouse",
  5926. props: ["disabled", "factor"],
  5927. setup(b2) {
  5928. const { state: i } = jn();
  5929. return watchEffect(() => {
  5930. if (i != null && i.camera) {
  5931. const r = i == null ? void 0 : i.camera;
  5932. Ch(b2.disabled, b2.factor, r);
  5933. }
  5934. }), () => {
  5935. };
  5936. }
  5937. });
  5938. var Gs = {};
  5939. var Ph = {
  5940. get exports() {
  5941. return Gs;
  5942. },
  5943. set exports(b2) {
  5944. Gs = b2;
  5945. }
  5946. };
  5947. (function(b2, i) {
  5948. (function(r, s) {
  5949. s(i);
  5950. })(nl, function(r) {
  5951. class s {
  5952. /**
  5953. * @hidden
  5954. */
  5955. constructor(e) {
  5956. const [t, l] = e.split("-"), v = t.split(".");
  5957. this.major = parseInt(v[0], 10), this.minor = parseInt(v[1], 10), this.patch = parseInt(v[2], 10), this.prerelease = l ?? null;
  5958. }
  5959. toString() {
  5960. const e = [this.major, this.minor, this.patch].join(".");
  5961. return this.prerelease !== null ? [e, this.prerelease].join("-") : e;
  5962. }
  5963. }
  5964. class a {
  5965. constructor(e) {
  5966. this.controller_ = e;
  5967. }
  5968. get element() {
  5969. return this.controller_.view.element;
  5970. }
  5971. get disabled() {
  5972. return this.controller_.viewProps.get("disabled");
  5973. }
  5974. set disabled(e) {
  5975. this.controller_.viewProps.set("disabled", e);
  5976. }
  5977. get hidden() {
  5978. return this.controller_.viewProps.get("hidden");
  5979. }
  5980. set hidden(e) {
  5981. this.controller_.viewProps.set("hidden", e);
  5982. }
  5983. dispose() {
  5984. this.controller_.viewProps.set("disposed", true);
  5985. }
  5986. }
  5987. class c {
  5988. constructor(e) {
  5989. this.target = e;
  5990. }
  5991. }
  5992. class u extends c {
  5993. constructor(e, t, l, v) {
  5994. super(e), this.value = t, this.presetKey = l, this.last = v ?? true;
  5995. }
  5996. }
  5997. class h2 extends c {
  5998. constructor(e, t, l) {
  5999. super(e), this.value = t, this.presetKey = l;
  6000. }
  6001. }
  6002. class d extends c {
  6003. constructor(e, t) {
  6004. super(e), this.expanded = t;
  6005. }
  6006. }
  6007. class g extends c {
  6008. constructor(e, t) {
  6009. super(e), this.index = t;
  6010. }
  6011. }
  6012. function w(n) {
  6013. return n;
  6014. }
  6015. function _(n) {
  6016. return n == null;
  6017. }
  6018. function y2(n, e) {
  6019. if (n.length !== e.length)
  6020. return false;
  6021. for (let t = 0; t < n.length; t++)
  6022. if (n[t] !== e[t])
  6023. return false;
  6024. return true;
  6025. }
  6026. function C(n, e) {
  6027. let t = n;
  6028. do {
  6029. const l = Object.getOwnPropertyDescriptor(t, e);
  6030. if (l && (l.set !== void 0 || l.writable === true))
  6031. return true;
  6032. t = Object.getPrototypeOf(t);
  6033. } while (t !== null);
  6034. return false;
  6035. }
  6036. const I2 = {
  6037. alreadydisposed: () => "View has been already disposed",
  6038. invalidparams: (n) => `Invalid parameters for '${n.name}'`,
  6039. nomatchingcontroller: (n) => `No matching controller for '${n.key}'`,
  6040. nomatchingview: (n) => `No matching view for '${JSON.stringify(n.params)}'`,
  6041. notbindable: () => "Value is not bindable",
  6042. propertynotfound: (n) => `Property '${n.name}' not found`,
  6043. shouldneverhappen: () => "This error should never happen"
  6044. };
  6045. class S2 {
  6046. static alreadyDisposed() {
  6047. return new S2({ type: "alreadydisposed" });
  6048. }
  6049. static notBindable() {
  6050. return new S2({
  6051. type: "notbindable"
  6052. });
  6053. }
  6054. static propertyNotFound(e) {
  6055. return new S2({
  6056. type: "propertynotfound",
  6057. context: {
  6058. name: e
  6059. }
  6060. });
  6061. }
  6062. static shouldNeverHappen() {
  6063. return new S2({ type: "shouldneverhappen" });
  6064. }
  6065. constructor(e) {
  6066. var t;
  6067. this.message = (t = I2[e.type](e.context)) !== null && t !== void 0 ? t : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = e.type;
  6068. }
  6069. }
  6070. class R2 {
  6071. constructor(e, t, l) {
  6072. this.obj_ = e, this.key_ = t, this.presetKey_ = l ?? t;
  6073. }
  6074. static isBindable(e) {
  6075. return !(e === null || typeof e != "object");
  6076. }
  6077. get key() {
  6078. return this.key_;
  6079. }
  6080. get presetKey() {
  6081. return this.presetKey_;
  6082. }
  6083. read() {
  6084. return this.obj_[this.key_];
  6085. }
  6086. write(e) {
  6087. this.obj_[this.key_] = e;
  6088. }
  6089. writeProperty(e, t) {
  6090. const l = this.read();
  6091. if (!R2.isBindable(l))
  6092. throw S2.notBindable();
  6093. if (!(e in l))
  6094. throw S2.propertyNotFound(e);
  6095. l[e] = t;
  6096. }
  6097. }
  6098. class j2 extends a {
  6099. get label() {
  6100. return this.controller_.props.get("label");
  6101. }
  6102. set label(e) {
  6103. this.controller_.props.set("label", e);
  6104. }
  6105. get title() {
  6106. var e;
  6107. return (e = this.controller_.valueController.props.get("title")) !== null && e !== void 0 ? e : "";
  6108. }
  6109. set title(e) {
  6110. this.controller_.valueController.props.set("title", e);
  6111. }
  6112. on(e, t) {
  6113. const l = t.bind(this);
  6114. return this.controller_.valueController.emitter.on(e, () => {
  6115. l(new c(this));
  6116. }), this;
  6117. }
  6118. }
  6119. class F {
  6120. constructor() {
  6121. this.observers_ = {};
  6122. }
  6123. on(e, t) {
  6124. let l = this.observers_[e];
  6125. return l || (l = this.observers_[e] = []), l.push({
  6126. handler: t
  6127. }), this;
  6128. }
  6129. off(e, t) {
  6130. const l = this.observers_[e];
  6131. return l && (this.observers_[e] = l.filter((v) => v.handler !== t)), this;
  6132. }
  6133. emit(e, t) {
  6134. const l = this.observers_[e];
  6135. l && l.forEach((v) => {
  6136. v.handler(t);
  6137. });
  6138. }
  6139. }
  6140. const V2 = "tp";
  6141. function D(n) {
  6142. return (t, l) => [
  6143. V2,
  6144. "-",
  6145. n,
  6146. "v",
  6147. t ? `_${t}` : "",
  6148. l ? `-${l}` : ""
  6149. ].join("");
  6150. }
  6151. function Y(n, e) {
  6152. return (t) => e(n(t));
  6153. }
  6154. function G2(n) {
  6155. return n.rawValue;
  6156. }
  6157. function N(n, e) {
  6158. n.emitter.on("change", Y(G2, e)), e(n.rawValue);
  6159. }
  6160. function O(n, e, t) {
  6161. N(n.value(e), t);
  6162. }
  6163. function H2(n, e, t) {
  6164. t ? n.classList.add(e) : n.classList.remove(e);
  6165. }
  6166. function K(n, e) {
  6167. return (t) => {
  6168. H2(n, e, t);
  6169. };
  6170. }
  6171. function q(n, e) {
  6172. N(n, (t) => {
  6173. e.textContent = t ?? "";
  6174. });
  6175. }
  6176. const he = D("btn");
  6177. class _e {
  6178. constructor(e, t) {
  6179. this.element = e.createElement("div"), this.element.classList.add(he()), t.viewProps.bindClassModifiers(this.element);
  6180. const l = e.createElement("button");
  6181. l.classList.add(he("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  6182. const v = e.createElement("div");
  6183. v.classList.add(he("t")), q(t.props.value("title"), v), this.buttonElement.appendChild(v);
  6184. }
  6185. }
  6186. class pe2 {
  6187. constructor(e, t) {
  6188. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new _e(e, {
  6189. props: this.props,
  6190. viewProps: this.viewProps
  6191. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  6192. }
  6193. onClick_() {
  6194. this.emitter.emit("click", {
  6195. sender: this
  6196. });
  6197. }
  6198. }
  6199. class fe2 {
  6200. constructor(e, t) {
  6201. var l;
  6202. this.constraint_ = t == null ? void 0 : t.constraint, this.equals_ = (l = t == null ? void 0 : t.equals) !== null && l !== void 0 ? l : (v, E) => v === E, this.emitter = new F(), this.rawValue_ = e;
  6203. }
  6204. get constraint() {
  6205. return this.constraint_;
  6206. }
  6207. get rawValue() {
  6208. return this.rawValue_;
  6209. }
  6210. set rawValue(e) {
  6211. this.setRawValue(e, {
  6212. forceEmit: false,
  6213. last: true
  6214. });
  6215. }
  6216. setRawValue(e, t) {
  6217. const l = t ?? {
  6218. forceEmit: false,
  6219. last: true
  6220. }, v = this.constraint_ ? this.constraint_.constrain(e) : e, E = this.rawValue_;
  6221. this.equals_(E, v) && !l.forceEmit || (this.emitter.emit("beforechange", {
  6222. sender: this
  6223. }), this.rawValue_ = v, this.emitter.emit("change", {
  6224. options: l,
  6225. previousRawValue: E,
  6226. rawValue: v,
  6227. sender: this
  6228. }));
  6229. }
  6230. }
  6231. class de {
  6232. constructor(e) {
  6233. this.emitter = new F(), this.value_ = e;
  6234. }
  6235. get rawValue() {
  6236. return this.value_;
  6237. }
  6238. set rawValue(e) {
  6239. this.setRawValue(e, {
  6240. forceEmit: false,
  6241. last: true
  6242. });
  6243. }
  6244. setRawValue(e, t) {
  6245. const l = t ?? {
  6246. forceEmit: false,
  6247. last: true
  6248. }, v = this.value_;
  6249. v === e && !l.forceEmit || (this.emitter.emit("beforechange", {
  6250. sender: this
  6251. }), this.value_ = e, this.emitter.emit("change", {
  6252. options: l,
  6253. previousRawValue: v,
  6254. rawValue: this.value_,
  6255. sender: this
  6256. }));
  6257. }
  6258. }
  6259. function ee2(n, e) {
  6260. const t = e == null ? void 0 : e.constraint, l = e == null ? void 0 : e.equals;
  6261. return !t && !l ? new de(n) : new fe2(n, e);
  6262. }
  6263. class X {
  6264. constructor(e) {
  6265. this.emitter = new F(), this.valMap_ = e;
  6266. for (const t in this.valMap_)
  6267. this.valMap_[t].emitter.on("change", () => {
  6268. this.emitter.emit("change", {
  6269. key: t,
  6270. sender: this
  6271. });
  6272. });
  6273. }
  6274. static createCore(e) {
  6275. return Object.keys(e).reduce((l, v) => Object.assign(l, {
  6276. [v]: ee2(e[v])
  6277. }), {});
  6278. }
  6279. static fromObject(e) {
  6280. const t = this.createCore(e);
  6281. return new X(t);
  6282. }
  6283. get(e) {
  6284. return this.valMap_[e].rawValue;
  6285. }
  6286. set(e, t) {
  6287. this.valMap_[e].rawValue = t;
  6288. }
  6289. value(e) {
  6290. return this.valMap_[e];
  6291. }
  6292. }
  6293. function Te(n, e) {
  6294. const l = Object.keys(e).reduce((v, E) => {
  6295. if (v === void 0)
  6296. return;
  6297. const k2 = e[E], B2 = k2(n[E]);
  6298. return B2.succeeded ? Object.assign(Object.assign({}, v), { [E]: B2.value }) : void 0;
  6299. }, {});
  6300. return l;
  6301. }
  6302. function ve(n, e) {
  6303. return n.reduce((t, l) => {
  6304. if (t === void 0)
  6305. return;
  6306. const v = e(l);
  6307. if (!(!v.succeeded || v.value === void 0))
  6308. return [...t, v.value];
  6309. }, []);
  6310. }
  6311. function le2(n) {
  6312. return n === null ? false : typeof n == "object";
  6313. }
  6314. function ie(n) {
  6315. return (e) => (t) => {
  6316. if (!e && t === void 0)
  6317. return {
  6318. succeeded: false,
  6319. value: void 0
  6320. };
  6321. if (e && t === void 0)
  6322. return {
  6323. succeeded: true,
  6324. value: void 0
  6325. };
  6326. const l = n(t);
  6327. return l !== void 0 ? {
  6328. succeeded: true,
  6329. value: l
  6330. } : {
  6331. succeeded: false,
  6332. value: void 0
  6333. };
  6334. };
  6335. }
  6336. function ge(n) {
  6337. return {
  6338. custom: (e) => ie(e)(n),
  6339. boolean: ie((e) => typeof e == "boolean" ? e : void 0)(n),
  6340. number: ie((e) => typeof e == "number" ? e : void 0)(n),
  6341. string: ie((e) => typeof e == "string" ? e : void 0)(n),
  6342. function: ie((e) => typeof e == "function" ? e : void 0)(n),
  6343. constant: (e) => ie((t) => t === e ? e : void 0)(n),
  6344. raw: ie((e) => e)(n),
  6345. object: (e) => ie((t) => {
  6346. if (le2(t))
  6347. return Te(t, e);
  6348. })(n),
  6349. array: (e) => ie((t) => {
  6350. if (Array.isArray(t))
  6351. return ve(t, e);
  6352. })(n)
  6353. };
  6354. }
  6355. const M = {
  6356. optional: ge(true),
  6357. required: ge(false)
  6358. };
  6359. function ce2(n, e) {
  6360. const t = M.required.object(e)(n);
  6361. return t.succeeded ? t.value : void 0;
  6362. }
  6363. function De(n) {
  6364. console.warn([
  6365. `Missing '${n.key}' of ${n.target} in ${n.place}.`,
  6366. "Please rebuild plugins with the latest core package."
  6367. ].join(" "));
  6368. }
  6369. function Fe(n) {
  6370. return n && n.parentElement && n.parentElement.removeChild(n), null;
  6371. }
  6372. class ye {
  6373. constructor(e) {
  6374. this.value_ = e;
  6375. }
  6376. static create(e) {
  6377. return [
  6378. new ye(e),
  6379. (t, l) => {
  6380. e.setRawValue(t, l);
  6381. }
  6382. ];
  6383. }
  6384. get emitter() {
  6385. return this.value_.emitter;
  6386. }
  6387. get rawValue() {
  6388. return this.value_.rawValue;
  6389. }
  6390. }
  6391. const ot2 = D("");
  6392. function zn(n, e) {
  6393. return K(n, ot2(void 0, e));
  6394. }
  6395. class Ye2 extends X {
  6396. constructor(e) {
  6397. var t;
  6398. super(e), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = ye.create(ee2(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (t = this.get("parent")) === null || t === void 0 || t.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  6399. }
  6400. static create(e) {
  6401. var t, l, v;
  6402. const E = e ?? {};
  6403. return new Ye2(X.createCore({
  6404. disabled: (t = E.disabled) !== null && t !== void 0 ? t : false,
  6405. disposed: false,
  6406. hidden: (l = E.hidden) !== null && l !== void 0 ? l : false,
  6407. parent: (v = E.parent) !== null && v !== void 0 ? v : null
  6408. }));
  6409. }
  6410. get globalDisabled() {
  6411. return this.globalDisabled_;
  6412. }
  6413. bindClassModifiers(e) {
  6414. N(this.globalDisabled_, zn(e, "disabled")), O(this, "hidden", zn(e, "hidden"));
  6415. }
  6416. bindDisabled(e) {
  6417. N(this.globalDisabled_, (t) => {
  6418. e.disabled = t;
  6419. });
  6420. }
  6421. bindTabIndex(e) {
  6422. N(this.globalDisabled_, (t) => {
  6423. e.tabIndex = t ? -1 : 0;
  6424. });
  6425. }
  6426. handleDispose(e) {
  6427. this.value("disposed").emitter.on("change", (t) => {
  6428. t && e();
  6429. });
  6430. }
  6431. getGlobalDisabled_() {
  6432. const e = this.get("parent");
  6433. return (e ? e.globalDisabled.rawValue : false) || this.get("disabled");
  6434. }
  6435. updateGlobalDisabled_() {
  6436. this.setGlobalDisabled_(this.getGlobalDisabled_());
  6437. }
  6438. onDisabledChange_() {
  6439. this.updateGlobalDisabled_();
  6440. }
  6441. onParentGlobalDisabledChange_() {
  6442. this.updateGlobalDisabled_();
  6443. }
  6444. onParentChange_(e) {
  6445. var t;
  6446. const l = e.previousRawValue;
  6447. l == null || l.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (t = this.get("parent")) === null || t === void 0 || t.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  6448. }
  6449. }
  6450. function Un() {
  6451. return ["veryfirst", "first", "last", "verylast"];
  6452. }
  6453. const ln = D(""), vt = {
  6454. veryfirst: "vfst",
  6455. first: "fst",
  6456. last: "lst",
  6457. verylast: "vlst"
  6458. };
  6459. class At {
  6460. constructor(e) {
  6461. this.parent_ = null, this.blade = e.blade, this.view = e.view, this.viewProps = e.viewProps;
  6462. const t = this.view.element;
  6463. this.blade.value("positions").emitter.on("change", () => {
  6464. Un().forEach((l) => {
  6465. t.classList.remove(ln(void 0, vt[l]));
  6466. }), this.blade.get("positions").forEach((l) => {
  6467. t.classList.add(ln(void 0, vt[l]));
  6468. });
  6469. }), this.viewProps.handleDispose(() => {
  6470. Fe(t);
  6471. });
  6472. }
  6473. get parent() {
  6474. return this.parent_;
  6475. }
  6476. set parent(e) {
  6477. if (this.parent_ = e, !("parent" in this.viewProps.valMap_)) {
  6478. De({
  6479. key: "parent",
  6480. target: Ye2.name,
  6481. place: "BladeController.parent"
  6482. });
  6483. return;
  6484. }
  6485. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  6486. }
  6487. }
  6488. const Ue = "http://www.w3.org/2000/svg";
  6489. function at2(n) {
  6490. n.offsetHeight;
  6491. }
  6492. function cn(n, e) {
  6493. const t = n.style.transition;
  6494. n.style.transition = "none", e(), n.style.transition = t;
  6495. }
  6496. function bt(n) {
  6497. return n.ontouchstart !== void 0;
  6498. }
  6499. function Gn() {
  6500. return globalThis;
  6501. }
  6502. function mi() {
  6503. return Gn().document;
  6504. }
  6505. function Hn(n) {
  6506. const e = n.ownerDocument.defaultView;
  6507. return e && "document" in e ? n.getContext("2d", {
  6508. willReadFrequently: true
  6509. }) : null;
  6510. }
  6511. const Kn = {
  6512. check: '<path d="M2 8l4 4l8 -8"/>',
  6513. dropdown: '<path d="M5 7h6l-3 3 z"/>',
  6514. p2dpad: '<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'
  6515. };
  6516. function Ct(n, e) {
  6517. const t = n.createElementNS(Ue, "svg");
  6518. return t.innerHTML = Kn[e], t;
  6519. }
  6520. function Lt(n, e, t) {
  6521. n.insertBefore(e, n.children[t]);
  6522. }
  6523. function $n(n) {
  6524. n.parentElement && n.parentElement.removeChild(n);
  6525. }
  6526. function pn(n) {
  6527. for (; n.children.length > 0; )
  6528. n.removeChild(n.children[0]);
  6529. }
  6530. function Xn(n) {
  6531. for (; n.childNodes.length > 0; )
  6532. n.removeChild(n.childNodes[0]);
  6533. }
  6534. function Pt(n) {
  6535. return n.relatedTarget ? n.relatedTarget : "explicitOriginalTarget" in n ? n.explicitOriginalTarget : null;
  6536. }
  6537. const gt = D("lbl");
  6538. function Rt(n, e) {
  6539. const t = n.createDocumentFragment();
  6540. return e.split(`
  6541. `).map((v) => n.createTextNode(v)).forEach((v, E) => {
  6542. E > 0 && t.appendChild(n.createElement("br")), t.appendChild(v);
  6543. }), t;
  6544. }
  6545. class A2 {
  6546. constructor(e, t) {
  6547. this.element = e.createElement("div"), this.element.classList.add(gt()), t.viewProps.bindClassModifiers(this.element);
  6548. const l = e.createElement("div");
  6549. l.classList.add(gt("l")), O(t.props, "label", (E) => {
  6550. _(E) ? this.element.classList.add(gt(void 0, "nol")) : (this.element.classList.remove(gt(void 0, "nol")), Xn(l), l.appendChild(Rt(e, E)));
  6551. }), this.element.appendChild(l), this.labelElement = l;
  6552. const v = e.createElement("div");
  6553. v.classList.add(gt("v")), this.element.appendChild(v), this.valueElement = v;
  6554. }
  6555. }
  6556. class U extends At {
  6557. constructor(e, t) {
  6558. const l = t.valueController.viewProps;
  6559. super(Object.assign(Object.assign({}, t), { view: new A2(e, {
  6560. props: t.props,
  6561. viewProps: l
  6562. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  6563. }
  6564. }
  6565. const W = {
  6566. id: "button",
  6567. type: "blade",
  6568. accept(n) {
  6569. const e = M, t = ce2(n, {
  6570. title: e.required.string,
  6571. view: e.required.constant("button"),
  6572. label: e.optional.string
  6573. });
  6574. return t ? { params: t } : null;
  6575. },
  6576. controller(n) {
  6577. return new U(n.document, {
  6578. blade: n.blade,
  6579. props: X.fromObject({
  6580. label: n.params.label
  6581. }),
  6582. valueController: new pe2(n.document, {
  6583. props: X.fromObject({
  6584. title: n.params.title
  6585. }),
  6586. viewProps: n.viewProps
  6587. })
  6588. });
  6589. },
  6590. api(n) {
  6591. return !(n.controller instanceof U) || !(n.controller.valueController instanceof pe2) ? null : new j2(n.controller);
  6592. }
  6593. };
  6594. class se2 extends At {
  6595. constructor(e) {
  6596. super(e), this.value = e.value;
  6597. }
  6598. }
  6599. function xe() {
  6600. return new X({
  6601. positions: ee2([], {
  6602. equals: y2
  6603. })
  6604. });
  6605. }
  6606. class Oe extends X {
  6607. constructor(e) {
  6608. super(e);
  6609. }
  6610. static create(e) {
  6611. const t = {
  6612. completed: true,
  6613. expanded: e,
  6614. expandedHeight: null,
  6615. shouldFixHeight: false,
  6616. temporaryExpanded: null
  6617. }, l = X.createCore(t);
  6618. return new Oe(l);
  6619. }
  6620. get styleExpanded() {
  6621. var e;
  6622. return (e = this.get("temporaryExpanded")) !== null && e !== void 0 ? e : this.get("expanded");
  6623. }
  6624. get styleHeight() {
  6625. if (!this.styleExpanded)
  6626. return "0";
  6627. const e = this.get("expandedHeight");
  6628. return this.get("shouldFixHeight") && !_(e) ? `${e}px` : "auto";
  6629. }
  6630. bindExpandedClass(e, t) {
  6631. const l = () => {
  6632. this.styleExpanded ? e.classList.add(t) : e.classList.remove(t);
  6633. };
  6634. O(this, "expanded", l), O(this, "temporaryExpanded", l);
  6635. }
  6636. cleanUpTransition() {
  6637. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  6638. }
  6639. }
  6640. function Ht(n, e) {
  6641. let t = 0;
  6642. return cn(e, () => {
  6643. n.set("expandedHeight", null), n.set("temporaryExpanded", true), at2(e), t = e.clientHeight, n.set("temporaryExpanded", null), at2(e);
  6644. }), t;
  6645. }
  6646. function un(n, e) {
  6647. e.style.height = n.styleHeight;
  6648. }
  6649. function Ge(n, e) {
  6650. n.value("expanded").emitter.on("beforechange", () => {
  6651. if (n.set("completed", false), _(n.get("expandedHeight"))) {
  6652. const t = Ht(n, e);
  6653. t > 0 && n.set("expandedHeight", t);
  6654. }
  6655. n.set("shouldFixHeight", true), at2(e);
  6656. }), n.emitter.on("change", () => {
  6657. un(n, e);
  6658. }), un(n, e), e.addEventListener("transitionend", (t) => {
  6659. t.propertyName === "height" && n.cleanUpTransition();
  6660. });
  6661. }
  6662. class He extends a {
  6663. constructor(e, t) {
  6664. super(e), this.rackApi_ = t;
  6665. }
  6666. }
  6667. function $s(n, e) {
  6668. return n.addBlade(Object.assign(Object.assign({}, e), { view: "button" }));
  6669. }
  6670. function Xs(n, e) {
  6671. return n.addBlade(Object.assign(Object.assign({}, e), { view: "folder" }));
  6672. }
  6673. function Ys(n, e) {
  6674. const t = e ?? {};
  6675. return n.addBlade(Object.assign(Object.assign({}, t), { view: "separator" }));
  6676. }
  6677. function fi(n, e) {
  6678. return n.addBlade(Object.assign(Object.assign({}, e), { view: "tab" }));
  6679. }
  6680. class It {
  6681. constructor(e) {
  6682. this.emitter = new F(), this.items_ = [], this.cache_ = /* @__PURE__ */ new Set(), this.onSubListAdd_ = this.onSubListAdd_.bind(this), this.onSubListRemove_ = this.onSubListRemove_.bind(this), this.extract_ = e;
  6683. }
  6684. get items() {
  6685. return this.items_;
  6686. }
  6687. allItems() {
  6688. return Array.from(this.cache_);
  6689. }
  6690. find(e) {
  6691. for (const t of this.allItems())
  6692. if (e(t))
  6693. return t;
  6694. return null;
  6695. }
  6696. includes(e) {
  6697. return this.cache_.has(e);
  6698. }
  6699. add(e, t) {
  6700. if (this.includes(e))
  6701. throw S2.shouldNeverHappen();
  6702. const l = t !== void 0 ? t : this.items_.length;
  6703. this.items_.splice(l, 0, e), this.cache_.add(e);
  6704. const v = this.extract_(e);
  6705. v && (v.emitter.on("add", this.onSubListAdd_), v.emitter.on("remove", this.onSubListRemove_), v.allItems().forEach((E) => {
  6706. this.cache_.add(E);
  6707. })), this.emitter.emit("add", {
  6708. index: l,
  6709. item: e,
  6710. root: this,
  6711. target: this
  6712. });
  6713. }
  6714. remove(e) {
  6715. const t = this.items_.indexOf(e);
  6716. if (t < 0)
  6717. return;
  6718. this.items_.splice(t, 1), this.cache_.delete(e);
  6719. const l = this.extract_(e);
  6720. l && (l.emitter.off("add", this.onSubListAdd_), l.emitter.off("remove", this.onSubListRemove_)), this.emitter.emit("remove", {
  6721. index: t,
  6722. item: e,
  6723. root: this,
  6724. target: this
  6725. });
  6726. }
  6727. onSubListAdd_(e) {
  6728. this.cache_.add(e.item), this.emitter.emit("add", {
  6729. index: e.index,
  6730. item: e.item,
  6731. root: this,
  6732. target: e.target
  6733. });
  6734. }
  6735. onSubListRemove_(e) {
  6736. this.cache_.delete(e.item), this.emitter.emit("remove", {
  6737. index: e.index,
  6738. item: e.item,
  6739. root: this,
  6740. target: e.target
  6741. });
  6742. }
  6743. }
  6744. class vi extends a {
  6745. constructor(e) {
  6746. super(e), this.onBindingChange_ = this.onBindingChange_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("change", this.onBindingChange_);
  6747. }
  6748. get label() {
  6749. return this.controller_.props.get("label");
  6750. }
  6751. set label(e) {
  6752. this.controller_.props.set("label", e);
  6753. }
  6754. on(e, t) {
  6755. const l = t.bind(this);
  6756. return this.emitter_.on(e, (v) => {
  6757. l(v.event);
  6758. }), this;
  6759. }
  6760. refresh() {
  6761. this.controller_.binding.read();
  6762. }
  6763. onBindingChange_(e) {
  6764. const t = e.sender.target.read();
  6765. this.emitter_.emit("change", {
  6766. event: new u(this, t, this.controller_.binding.target.presetKey, e.options.last)
  6767. });
  6768. }
  6769. }
  6770. class Be extends U {
  6771. constructor(e, t) {
  6772. super(e, t), this.binding = t.binding;
  6773. }
  6774. }
  6775. class bi extends a {
  6776. constructor(e) {
  6777. super(e), this.onBindingUpdate_ = this.onBindingUpdate_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("update", this.onBindingUpdate_);
  6778. }
  6779. get label() {
  6780. return this.controller_.props.get("label");
  6781. }
  6782. set label(e) {
  6783. this.controller_.props.set("label", e);
  6784. }
  6785. on(e, t) {
  6786. const l = t.bind(this);
  6787. return this.emitter_.on(e, (v) => {
  6788. l(v.event);
  6789. }), this;
  6790. }
  6791. refresh() {
  6792. this.controller_.binding.read();
  6793. }
  6794. onBindingUpdate_(e) {
  6795. const t = e.sender.target.read();
  6796. this.emitter_.emit("update", {
  6797. event: new h2(this, t, this.controller_.binding.target.presetKey)
  6798. });
  6799. }
  6800. }
  6801. class lt2 extends U {
  6802. constructor(e, t) {
  6803. super(e, t), this.binding = t.binding, this.viewProps.bindDisabled(this.binding.ticker), this.viewProps.handleDispose(() => {
  6804. this.binding.dispose();
  6805. });
  6806. }
  6807. }
  6808. function is(n) {
  6809. return n instanceof Yn ? n.apiSet_ : n instanceof He ? n.rackApi_.apiSet_ : null;
  6810. }
  6811. function hn(n, e) {
  6812. const t = n.find((l) => l.controller_ === e);
  6813. if (!t)
  6814. throw S2.shouldNeverHappen();
  6815. return t;
  6816. }
  6817. function ss(n, e, t) {
  6818. if (!R2.isBindable(n))
  6819. throw S2.notBindable();
  6820. return new R2(n, e, t);
  6821. }
  6822. class Yn extends a {
  6823. constructor(e, t) {
  6824. super(e), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this), this.onRackInputChange_ = this.onRackInputChange_.bind(this), this.onRackMonitorUpdate_ = this.onRackMonitorUpdate_.bind(this), this.emitter_ = new F(), this.apiSet_ = new It(is), this.pool_ = t;
  6825. const l = this.controller_.rack;
  6826. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), l.emitter.on("inputchange", this.onRackInputChange_), l.emitter.on("monitorupdate", this.onRackMonitorUpdate_), l.children.forEach((v) => {
  6827. this.setUpApi_(v);
  6828. });
  6829. }
  6830. get children() {
  6831. return this.controller_.rack.children.map((e) => hn(this.apiSet_, e));
  6832. }
  6833. addInput(e, t, l) {
  6834. const v = l ?? {}, E = this.controller_.view.element.ownerDocument, k2 = this.pool_.createInput(E, ss(e, t, v.presetKey), v), B2 = new vi(k2);
  6835. return this.add(B2, v.index);
  6836. }
  6837. addMonitor(e, t, l) {
  6838. const v = l ?? {}, E = this.controller_.view.element.ownerDocument, k2 = this.pool_.createMonitor(E, ss(e, t), v), B2 = new bi(k2);
  6839. return this.add(B2, v.index);
  6840. }
  6841. addFolder(e) {
  6842. return Xs(this, e);
  6843. }
  6844. addButton(e) {
  6845. return $s(this, e);
  6846. }
  6847. addSeparator(e) {
  6848. return Ys(this, e);
  6849. }
  6850. addTab(e) {
  6851. return fi(this, e);
  6852. }
  6853. add(e, t) {
  6854. this.controller_.rack.add(e.controller_, t);
  6855. const l = this.apiSet_.find((v) => v.controller_ === e.controller_);
  6856. return l && this.apiSet_.remove(l), this.apiSet_.add(e), e;
  6857. }
  6858. remove(e) {
  6859. this.controller_.rack.remove(e.controller_);
  6860. }
  6861. addBlade(e) {
  6862. const t = this.controller_.view.element.ownerDocument, l = this.pool_.createBlade(t, e), v = this.pool_.createBladeApi(l);
  6863. return this.add(v, e.index);
  6864. }
  6865. on(e, t) {
  6866. const l = t.bind(this);
  6867. return this.emitter_.on(e, (v) => {
  6868. l(v.event);
  6869. }), this;
  6870. }
  6871. setUpApi_(e) {
  6872. this.apiSet_.find((l) => l.controller_ === e) || this.apiSet_.add(this.pool_.createBladeApi(e));
  6873. }
  6874. onRackAdd_(e) {
  6875. this.setUpApi_(e.bladeController);
  6876. }
  6877. onRackRemove_(e) {
  6878. if (e.isRoot) {
  6879. const t = hn(this.apiSet_, e.bladeController);
  6880. this.apiSet_.remove(t);
  6881. }
  6882. }
  6883. onRackInputChange_(e) {
  6884. const t = e.bladeController;
  6885. if (t instanceof Be) {
  6886. const l = hn(this.apiSet_, t), v = t.binding;
  6887. this.emitter_.emit("change", {
  6888. event: new u(l, v.target.read(), v.target.presetKey, e.options.last)
  6889. });
  6890. } else if (t instanceof se2) {
  6891. const l = hn(this.apiSet_, t);
  6892. this.emitter_.emit("change", {
  6893. event: new u(l, t.value.rawValue, void 0, e.options.last)
  6894. });
  6895. }
  6896. }
  6897. onRackMonitorUpdate_(e) {
  6898. if (!(e.bladeController instanceof lt2))
  6899. throw S2.shouldNeverHappen();
  6900. const t = hn(this.apiSet_, e.bladeController), l = e.bladeController.binding;
  6901. this.emitter_.emit("update", {
  6902. event: new h2(t, l.target.read(), l.target.presetKey)
  6903. });
  6904. }
  6905. }
  6906. class gi extends He {
  6907. constructor(e, t) {
  6908. super(e, new Yn(e.rackController, t)), this.emitter_ = new F(), this.controller_.foldable.value("expanded").emitter.on("change", (l) => {
  6909. this.emitter_.emit("fold", {
  6910. event: new d(this, l.sender.rawValue)
  6911. });
  6912. }), this.rackApi_.on("change", (l) => {
  6913. this.emitter_.emit("change", {
  6914. event: l
  6915. });
  6916. }), this.rackApi_.on("update", (l) => {
  6917. this.emitter_.emit("update", {
  6918. event: l
  6919. });
  6920. });
  6921. }
  6922. get expanded() {
  6923. return this.controller_.foldable.get("expanded");
  6924. }
  6925. set expanded(e) {
  6926. this.controller_.foldable.set("expanded", e);
  6927. }
  6928. get title() {
  6929. return this.controller_.props.get("title");
  6930. }
  6931. set title(e) {
  6932. this.controller_.props.set("title", e);
  6933. }
  6934. get children() {
  6935. return this.rackApi_.children;
  6936. }
  6937. addInput(e, t, l) {
  6938. return this.rackApi_.addInput(e, t, l);
  6939. }
  6940. addMonitor(e, t, l) {
  6941. return this.rackApi_.addMonitor(e, t, l);
  6942. }
  6943. addFolder(e) {
  6944. return this.rackApi_.addFolder(e);
  6945. }
  6946. addButton(e) {
  6947. return this.rackApi_.addButton(e);
  6948. }
  6949. addSeparator(e) {
  6950. return this.rackApi_.addSeparator(e);
  6951. }
  6952. addTab(e) {
  6953. return this.rackApi_.addTab(e);
  6954. }
  6955. add(e, t) {
  6956. return this.rackApi_.add(e, t);
  6957. }
  6958. remove(e) {
  6959. this.rackApi_.remove(e);
  6960. }
  6961. addBlade(e) {
  6962. return this.rackApi_.addBlade(e);
  6963. }
  6964. on(e, t) {
  6965. const l = t.bind(this);
  6966. return this.emitter_.on(e, (v) => {
  6967. l(v.event);
  6968. }), this;
  6969. }
  6970. }
  6971. class _i extends At {
  6972. constructor(e) {
  6973. super({
  6974. blade: e.blade,
  6975. view: e.view,
  6976. viewProps: e.rackController.viewProps
  6977. }), this.rackController = e.rackController;
  6978. }
  6979. }
  6980. class qs {
  6981. constructor(e, t) {
  6982. const l = D(t.viewName);
  6983. this.element = e.createElement("div"), this.element.classList.add(l()), t.viewProps.bindClassModifiers(this.element);
  6984. }
  6985. }
  6986. function Qs(n, e) {
  6987. for (let t = 0; t < n.length; t++) {
  6988. const l = n[t];
  6989. if (l instanceof Be && l.binding === e)
  6990. return l;
  6991. }
  6992. return null;
  6993. }
  6994. function Zs(n, e) {
  6995. for (let t = 0; t < n.length; t++) {
  6996. const l = n[t];
  6997. if (l instanceof lt2 && l.binding === e)
  6998. return l;
  6999. }
  7000. return null;
  7001. }
  7002. function Ws(n, e) {
  7003. for (let t = 0; t < n.length; t++) {
  7004. const l = n[t];
  7005. if (l instanceof se2 && l.value === e)
  7006. return l;
  7007. }
  7008. return null;
  7009. }
  7010. function wi(n) {
  7011. return n instanceof dn ? n.rack : n instanceof _i ? n.rackController.rack : null;
  7012. }
  7013. function Js(n) {
  7014. const e = wi(n);
  7015. return e ? e.bcSet_ : null;
  7016. }
  7017. class er {
  7018. constructor(e) {
  7019. var t, l;
  7020. this.onBladePositionsChange_ = this.onBladePositionsChange_.bind(this), this.onSetAdd_ = this.onSetAdd_.bind(this), this.onSetRemove_ = this.onSetRemove_.bind(this), this.onChildDispose_ = this.onChildDispose_.bind(this), this.onChildPositionsChange_ = this.onChildPositionsChange_.bind(this), this.onChildInputChange_ = this.onChildInputChange_.bind(this), this.onChildMonitorUpdate_ = this.onChildMonitorUpdate_.bind(this), this.onChildValueChange_ = this.onChildValueChange_.bind(this), this.onChildViewPropsChange_ = this.onChildViewPropsChange_.bind(this), this.onDescendantLayout_ = this.onDescendantLayout_.bind(this), this.onDescendantInputChange_ = this.onDescendantInputChange_.bind(this), this.onDescendantMonitorUpdate_ = this.onDescendantMonitorUpdate_.bind(this), this.emitter = new F(), this.blade_ = (t = e.blade) !== null && t !== void 0 ? t : null, (l = this.blade_) === null || l === void 0 || l.value("positions").emitter.on("change", this.onBladePositionsChange_), this.viewProps = e.viewProps, this.bcSet_ = new It(Js), this.bcSet_.emitter.on("add", this.onSetAdd_), this.bcSet_.emitter.on("remove", this.onSetRemove_);
  7021. }
  7022. get children() {
  7023. return this.bcSet_.items;
  7024. }
  7025. add(e, t) {
  7026. var l;
  7027. (l = e.parent) === null || l === void 0 || l.remove(e), C(e, "parent") ? e.parent = this : (e.parent_ = this, De({
  7028. key: "parent",
  7029. target: "BladeController",
  7030. place: "BladeRack.add"
  7031. })), this.bcSet_.add(e, t);
  7032. }
  7033. remove(e) {
  7034. C(e, "parent") ? e.parent = null : (e.parent_ = null, De({
  7035. key: "parent",
  7036. target: "BladeController",
  7037. place: "BladeRack.remove"
  7038. })), this.bcSet_.remove(e);
  7039. }
  7040. find(e) {
  7041. return this.bcSet_.allItems().filter((t) => t instanceof e);
  7042. }
  7043. onSetAdd_(e) {
  7044. this.updatePositions_();
  7045. const t = e.target === e.root;
  7046. if (this.emitter.emit("add", {
  7047. bladeController: e.item,
  7048. index: e.index,
  7049. isRoot: t,
  7050. sender: this
  7051. }), !t)
  7052. return;
  7053. const l = e.item;
  7054. if (l.viewProps.emitter.on("change", this.onChildViewPropsChange_), l.blade.value("positions").emitter.on("change", this.onChildPositionsChange_), l.viewProps.handleDispose(this.onChildDispose_), l instanceof Be)
  7055. l.binding.emitter.on("change", this.onChildInputChange_);
  7056. else if (l instanceof lt2)
  7057. l.binding.emitter.on("update", this.onChildMonitorUpdate_);
  7058. else if (l instanceof se2)
  7059. l.value.emitter.on("change", this.onChildValueChange_);
  7060. else {
  7061. const v = wi(l);
  7062. if (v) {
  7063. const E = v.emitter;
  7064. E.on("layout", this.onDescendantLayout_), E.on("inputchange", this.onDescendantInputChange_), E.on("monitorupdate", this.onDescendantMonitorUpdate_);
  7065. }
  7066. }
  7067. }
  7068. onSetRemove_(e) {
  7069. this.updatePositions_();
  7070. const t = e.target === e.root;
  7071. if (this.emitter.emit("remove", {
  7072. bladeController: e.item,
  7073. isRoot: t,
  7074. sender: this
  7075. }), !t)
  7076. return;
  7077. const l = e.item;
  7078. if (l instanceof Be)
  7079. l.binding.emitter.off("change", this.onChildInputChange_);
  7080. else if (l instanceof lt2)
  7081. l.binding.emitter.off("update", this.onChildMonitorUpdate_);
  7082. else if (l instanceof se2)
  7083. l.value.emitter.off("change", this.onChildValueChange_);
  7084. else {
  7085. const v = wi(l);
  7086. if (v) {
  7087. const E = v.emitter;
  7088. E.off("layout", this.onDescendantLayout_), E.off("inputchange", this.onDescendantInputChange_), E.off("monitorupdate", this.onDescendantMonitorUpdate_);
  7089. }
  7090. }
  7091. }
  7092. updatePositions_() {
  7093. const e = this.bcSet_.items.filter((v) => !v.viewProps.get("hidden")), t = e[0], l = e[e.length - 1];
  7094. this.bcSet_.items.forEach((v) => {
  7095. const E = [];
  7096. v === t && (E.push("first"), (!this.blade_ || this.blade_.get("positions").includes("veryfirst")) && E.push("veryfirst")), v === l && (E.push("last"), (!this.blade_ || this.blade_.get("positions").includes("verylast")) && E.push("verylast")), v.blade.set("positions", E);
  7097. });
  7098. }
  7099. onChildPositionsChange_() {
  7100. this.updatePositions_(), this.emitter.emit("layout", {
  7101. sender: this
  7102. });
  7103. }
  7104. onChildViewPropsChange_(e) {
  7105. this.updatePositions_(), this.emitter.emit("layout", {
  7106. sender: this
  7107. });
  7108. }
  7109. onChildDispose_() {
  7110. this.bcSet_.items.filter((t) => t.viewProps.get("disposed")).forEach((t) => {
  7111. this.bcSet_.remove(t);
  7112. });
  7113. }
  7114. onChildInputChange_(e) {
  7115. const t = Qs(this.find(Be), e.sender);
  7116. if (!t)
  7117. throw S2.alreadyDisposed();
  7118. this.emitter.emit("inputchange", {
  7119. bladeController: t,
  7120. options: e.options,
  7121. sender: this
  7122. });
  7123. }
  7124. onChildMonitorUpdate_(e) {
  7125. const t = Zs(this.find(lt2), e.sender);
  7126. if (!t)
  7127. throw S2.alreadyDisposed();
  7128. this.emitter.emit("monitorupdate", {
  7129. bladeController: t,
  7130. sender: this
  7131. });
  7132. }
  7133. onChildValueChange_(e) {
  7134. const t = Ws(this.find(se2), e.sender);
  7135. if (!t)
  7136. throw S2.alreadyDisposed();
  7137. this.emitter.emit("inputchange", {
  7138. bladeController: t,
  7139. options: e.options,
  7140. sender: this
  7141. });
  7142. }
  7143. onDescendantLayout_(e) {
  7144. this.updatePositions_(), this.emitter.emit("layout", {
  7145. sender: this
  7146. });
  7147. }
  7148. onDescendantInputChange_(e) {
  7149. this.emitter.emit("inputchange", {
  7150. bladeController: e.bladeController,
  7151. options: e.options,
  7152. sender: this
  7153. });
  7154. }
  7155. onDescendantMonitorUpdate_(e) {
  7156. this.emitter.emit("monitorupdate", {
  7157. bladeController: e.bladeController,
  7158. sender: this
  7159. });
  7160. }
  7161. onBladePositionsChange_() {
  7162. this.updatePositions_();
  7163. }
  7164. }
  7165. class dn extends At {
  7166. constructor(e, t) {
  7167. super(Object.assign(Object.assign({}, t), { view: new qs(e, {
  7168. viewName: "brk",
  7169. viewProps: t.viewProps
  7170. }) })), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this);
  7171. const l = new er({
  7172. blade: t.root ? void 0 : t.blade,
  7173. viewProps: t.viewProps
  7174. });
  7175. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), this.rack = l, this.viewProps.handleDispose(() => {
  7176. for (let v = this.rack.children.length - 1; v >= 0; v--)
  7177. this.rack.children[v].viewProps.set("disposed", true);
  7178. });
  7179. }
  7180. onRackAdd_(e) {
  7181. e.isRoot && Lt(this.view.element, e.bladeController.view.element, e.index);
  7182. }
  7183. onRackRemove_(e) {
  7184. e.isRoot && $n(e.bladeController.view.element);
  7185. }
  7186. }
  7187. const rs = D("cnt");
  7188. class tr {
  7189. constructor(e, t) {
  7190. var l;
  7191. this.className_ = D((l = t.viewName) !== null && l !== void 0 ? l : "fld"), this.element = e.createElement("div"), this.element.classList.add(this.className_(), rs()), t.viewProps.bindClassModifiers(this.element), this.foldable_ = t.foldable, this.foldable_.bindExpandedClass(this.element, this.className_(void 0, "expanded")), O(this.foldable_, "completed", K(this.element, this.className_(void 0, "cpl")));
  7192. const v = e.createElement("button");
  7193. v.classList.add(this.className_("b")), O(t.props, "title", (J) => {
  7194. _(J) ? this.element.classList.add(this.className_(void 0, "not")) : this.element.classList.remove(this.className_(void 0, "not"));
  7195. }), t.viewProps.bindDisabled(v), this.element.appendChild(v), this.buttonElement = v;
  7196. const E = e.createElement("div");
  7197. E.classList.add(this.className_("i")), this.element.appendChild(E);
  7198. const k2 = e.createElement("div");
  7199. k2.classList.add(this.className_("t")), q(t.props.value("title"), k2), this.buttonElement.appendChild(k2), this.titleElement = k2;
  7200. const B2 = e.createElement("div");
  7201. B2.classList.add(this.className_("m")), this.buttonElement.appendChild(B2);
  7202. const Q = t.containerElement;
  7203. Q.classList.add(this.className_("c")), this.element.appendChild(Q), this.containerElement = Q;
  7204. }
  7205. }
  7206. class qn extends _i {
  7207. constructor(e, t) {
  7208. var l;
  7209. const v = Oe.create((l = t.expanded) !== null && l !== void 0 ? l : true), E = new dn(e, {
  7210. blade: t.blade,
  7211. root: t.root,
  7212. viewProps: t.viewProps
  7213. });
  7214. super(Object.assign(Object.assign({}, t), { rackController: E, view: new tr(e, {
  7215. containerElement: E.view.element,
  7216. foldable: v,
  7217. props: t.props,
  7218. viewName: t.root ? "rot" : void 0,
  7219. viewProps: t.viewProps
  7220. }) })), this.onTitleClick_ = this.onTitleClick_.bind(this), this.props = t.props, this.foldable = v, Ge(this.foldable, this.view.containerElement), this.rackController.rack.emitter.on("add", () => {
  7221. this.foldable.cleanUpTransition();
  7222. }), this.rackController.rack.emitter.on("remove", () => {
  7223. this.foldable.cleanUpTransition();
  7224. }), this.view.buttonElement.addEventListener("click", this.onTitleClick_);
  7225. }
  7226. get document() {
  7227. return this.view.element.ownerDocument;
  7228. }
  7229. onTitleClick_() {
  7230. this.foldable.set("expanded", !this.foldable.get("expanded"));
  7231. }
  7232. }
  7233. const nr = {
  7234. id: "folder",
  7235. type: "blade",
  7236. accept(n) {
  7237. const e = M, t = ce2(n, {
  7238. title: e.required.string,
  7239. view: e.required.constant("folder"),
  7240. expanded: e.optional.boolean
  7241. });
  7242. return t ? { params: t } : null;
  7243. },
  7244. controller(n) {
  7245. return new qn(n.document, {
  7246. blade: n.blade,
  7247. expanded: n.params.expanded,
  7248. props: X.fromObject({
  7249. title: n.params.title
  7250. }),
  7251. viewProps: n.viewProps
  7252. });
  7253. },
  7254. api(n) {
  7255. return n.controller instanceof qn ? new gi(n.controller, n.pool) : null;
  7256. }
  7257. };
  7258. class Kt extends se2 {
  7259. constructor(e, t) {
  7260. const l = t.valueController.viewProps;
  7261. super(Object.assign(Object.assign({}, t), { value: t.valueController.value, view: new A2(e, {
  7262. props: t.props,
  7263. viewProps: l
  7264. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  7265. }
  7266. }
  7267. class os extends a {
  7268. }
  7269. const yi = D("spr");
  7270. class ir {
  7271. constructor(e, t) {
  7272. this.element = e.createElement("div"), this.element.classList.add(yi()), t.viewProps.bindClassModifiers(this.element);
  7273. const l = e.createElement("hr");
  7274. l.classList.add(yi("r")), this.element.appendChild(l);
  7275. }
  7276. }
  7277. class mn extends At {
  7278. constructor(e, t) {
  7279. super(Object.assign(Object.assign({}, t), { view: new ir(e, {
  7280. viewProps: t.viewProps
  7281. }) }));
  7282. }
  7283. }
  7284. const sr = {
  7285. id: "separator",
  7286. type: "blade",
  7287. accept(n) {
  7288. const t = ce2(n, {
  7289. view: M.required.constant("separator")
  7290. });
  7291. return t ? { params: t } : null;
  7292. },
  7293. controller(n) {
  7294. return new mn(n.document, {
  7295. blade: n.blade,
  7296. viewProps: n.viewProps
  7297. });
  7298. },
  7299. api(n) {
  7300. return n.controller instanceof mn ? new os(n.controller) : null;
  7301. }
  7302. }, Re = D("tbi");
  7303. class rr {
  7304. constructor(e, t) {
  7305. this.element = e.createElement("div"), this.element.classList.add(Re()), t.viewProps.bindClassModifiers(this.element), O(t.props, "selected", (E) => {
  7306. E ? this.element.classList.add(Re(void 0, "sel")) : this.element.classList.remove(Re(void 0, "sel"));
  7307. });
  7308. const l = e.createElement("button");
  7309. l.classList.add(Re("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  7310. const v = e.createElement("div");
  7311. v.classList.add(Re("t")), q(t.props.value("title"), v), this.buttonElement.appendChild(v), this.titleElement = v;
  7312. }
  7313. }
  7314. class Qn {
  7315. constructor(e, t) {
  7316. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new rr(e, {
  7317. props: t.props,
  7318. viewProps: t.viewProps
  7319. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  7320. }
  7321. onClick_() {
  7322. this.emitter.emit("click", {
  7323. sender: this
  7324. });
  7325. }
  7326. }
  7327. class as {
  7328. constructor(e, t) {
  7329. this.onItemClick_ = this.onItemClick_.bind(this), this.ic_ = new Qn(e, {
  7330. props: t.itemProps,
  7331. viewProps: Ye2.create()
  7332. }), this.ic_.emitter.on("click", this.onItemClick_), this.cc_ = new dn(e, {
  7333. blade: xe(),
  7334. viewProps: Ye2.create()
  7335. }), this.props = t.props, O(this.props, "selected", (l) => {
  7336. this.itemController.props.set("selected", l), this.contentController.viewProps.set("hidden", !l);
  7337. });
  7338. }
  7339. get itemController() {
  7340. return this.ic_;
  7341. }
  7342. get contentController() {
  7343. return this.cc_;
  7344. }
  7345. onItemClick_() {
  7346. this.props.set("selected", true);
  7347. }
  7348. }
  7349. class xi {
  7350. constructor(e, t) {
  7351. this.controller_ = e, this.rackApi_ = t;
  7352. }
  7353. get title() {
  7354. var e;
  7355. return (e = this.controller_.itemController.props.get("title")) !== null && e !== void 0 ? e : "";
  7356. }
  7357. set title(e) {
  7358. this.controller_.itemController.props.set("title", e);
  7359. }
  7360. get selected() {
  7361. return this.controller_.props.get("selected");
  7362. }
  7363. set selected(e) {
  7364. this.controller_.props.set("selected", e);
  7365. }
  7366. get children() {
  7367. return this.rackApi_.children;
  7368. }
  7369. addButton(e) {
  7370. return this.rackApi_.addButton(e);
  7371. }
  7372. addFolder(e) {
  7373. return this.rackApi_.addFolder(e);
  7374. }
  7375. addSeparator(e) {
  7376. return this.rackApi_.addSeparator(e);
  7377. }
  7378. addTab(e) {
  7379. return this.rackApi_.addTab(e);
  7380. }
  7381. add(e, t) {
  7382. this.rackApi_.add(e, t);
  7383. }
  7384. remove(e) {
  7385. this.rackApi_.remove(e);
  7386. }
  7387. addInput(e, t, l) {
  7388. return this.rackApi_.addInput(e, t, l);
  7389. }
  7390. addMonitor(e, t, l) {
  7391. return this.rackApi_.addMonitor(e, t, l);
  7392. }
  7393. addBlade(e) {
  7394. return this.rackApi_.addBlade(e);
  7395. }
  7396. }
  7397. class ls extends He {
  7398. constructor(e, t) {
  7399. super(e, new Yn(e.rackController, t)), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.onSelect_ = this.onSelect_.bind(this), this.emitter_ = new F(), this.pageApiMap_ = /* @__PURE__ */ new Map(), this.rackApi_.on("change", (l) => {
  7400. this.emitter_.emit("change", {
  7401. event: l
  7402. });
  7403. }), this.rackApi_.on("update", (l) => {
  7404. this.emitter_.emit("update", {
  7405. event: l
  7406. });
  7407. }), this.controller_.tab.selectedIndex.emitter.on("change", this.onSelect_), this.controller_.pageSet.emitter.on("add", this.onPageAdd_), this.controller_.pageSet.emitter.on("remove", this.onPageRemove_), this.controller_.pageSet.items.forEach((l) => {
  7408. this.setUpPageApi_(l);
  7409. });
  7410. }
  7411. get pages() {
  7412. return this.controller_.pageSet.items.map((e) => {
  7413. const t = this.pageApiMap_.get(e);
  7414. if (!t)
  7415. throw S2.shouldNeverHappen();
  7416. return t;
  7417. });
  7418. }
  7419. addPage(e) {
  7420. const t = this.controller_.view.element.ownerDocument, l = new as(t, {
  7421. itemProps: X.fromObject({
  7422. selected: false,
  7423. title: e.title
  7424. }),
  7425. props: X.fromObject({
  7426. selected: false
  7427. })
  7428. });
  7429. this.controller_.add(l, e.index);
  7430. const v = this.pageApiMap_.get(l);
  7431. if (!v)
  7432. throw S2.shouldNeverHappen();
  7433. return v;
  7434. }
  7435. removePage(e) {
  7436. this.controller_.remove(e);
  7437. }
  7438. on(e, t) {
  7439. const l = t.bind(this);
  7440. return this.emitter_.on(e, (v) => {
  7441. l(v.event);
  7442. }), this;
  7443. }
  7444. setUpPageApi_(e) {
  7445. const t = this.rackApi_.apiSet_.find((v) => v.controller_ === e.contentController);
  7446. if (!t)
  7447. throw S2.shouldNeverHappen();
  7448. const l = new xi(e, t);
  7449. this.pageApiMap_.set(e, l);
  7450. }
  7451. onPageAdd_(e) {
  7452. this.setUpPageApi_(e.item);
  7453. }
  7454. onPageRemove_(e) {
  7455. if (!this.pageApiMap_.get(e.item))
  7456. throw S2.shouldNeverHappen();
  7457. this.pageApiMap_.delete(e.item);
  7458. }
  7459. onSelect_(e) {
  7460. this.emitter_.emit("select", {
  7461. event: new g(this, e.rawValue)
  7462. });
  7463. }
  7464. }
  7465. const cs = -1;
  7466. class or {
  7467. constructor() {
  7468. this.onItemSelectedChange_ = this.onItemSelectedChange_.bind(this), this.empty = ee2(true), this.selectedIndex = ee2(cs), this.items_ = [];
  7469. }
  7470. add(e, t) {
  7471. const l = t ?? this.items_.length;
  7472. this.items_.splice(l, 0, e), e.emitter.on("change", this.onItemSelectedChange_), this.keepSelection_();
  7473. }
  7474. remove(e) {
  7475. const t = this.items_.indexOf(e);
  7476. t < 0 || (this.items_.splice(t, 1), e.emitter.off("change", this.onItemSelectedChange_), this.keepSelection_());
  7477. }
  7478. keepSelection_() {
  7479. if (this.items_.length === 0) {
  7480. this.selectedIndex.rawValue = cs, this.empty.rawValue = true;
  7481. return;
  7482. }
  7483. const e = this.items_.findIndex((t) => t.rawValue);
  7484. e < 0 ? (this.items_.forEach((t, l) => {
  7485. t.rawValue = l === 0;
  7486. }), this.selectedIndex.rawValue = 0) : (this.items_.forEach((t, l) => {
  7487. t.rawValue = l === e;
  7488. }), this.selectedIndex.rawValue = e), this.empty.rawValue = false;
  7489. }
  7490. onItemSelectedChange_(e) {
  7491. if (e.rawValue) {
  7492. const t = this.items_.findIndex((l) => l === e.sender);
  7493. this.items_.forEach((l, v) => {
  7494. l.rawValue = v === t;
  7495. }), this.selectedIndex.rawValue = t;
  7496. } else
  7497. this.keepSelection_();
  7498. }
  7499. }
  7500. const $t = D("tab");
  7501. class Xt {
  7502. constructor(e, t) {
  7503. this.element = e.createElement("div"), this.element.classList.add($t(), rs()), t.viewProps.bindClassModifiers(this.element), N(t.empty, K(this.element, $t(void 0, "nop")));
  7504. const l = e.createElement("div");
  7505. l.classList.add($t("t")), this.element.appendChild(l), this.itemsElement = l;
  7506. const v = e.createElement("div");
  7507. v.classList.add($t("i")), this.element.appendChild(v);
  7508. const E = t.contentsElement;
  7509. E.classList.add($t("c")), this.element.appendChild(E), this.contentsElement = E;
  7510. }
  7511. }
  7512. class fn extends _i {
  7513. constructor(e, t) {
  7514. const l = new dn(e, {
  7515. blade: t.blade,
  7516. viewProps: t.viewProps
  7517. }), v = new or();
  7518. super({
  7519. blade: t.blade,
  7520. rackController: l,
  7521. view: new Xt(e, {
  7522. contentsElement: l.view.element,
  7523. empty: v.empty,
  7524. viewProps: t.viewProps
  7525. })
  7526. }), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.pageSet_ = new It(() => null), this.pageSet_.emitter.on("add", this.onPageAdd_), this.pageSet_.emitter.on("remove", this.onPageRemove_), this.tab = v;
  7527. }
  7528. get pageSet() {
  7529. return this.pageSet_;
  7530. }
  7531. add(e, t) {
  7532. this.pageSet_.add(e, t);
  7533. }
  7534. remove(e) {
  7535. this.pageSet_.remove(this.pageSet_.items[e]);
  7536. }
  7537. onPageAdd_(e) {
  7538. const t = e.item;
  7539. Lt(this.view.itemsElement, t.itemController.view.element, e.index), t.itemController.viewProps.set("parent", this.viewProps), this.rackController.rack.add(t.contentController, e.index), this.tab.add(t.props.value("selected"));
  7540. }
  7541. onPageRemove_(e) {
  7542. const t = e.item;
  7543. $n(t.itemController.view.element), t.itemController.viewProps.set("parent", null), this.rackController.rack.remove(t.contentController), this.tab.remove(t.props.value("selected"));
  7544. }
  7545. }
  7546. const Ei = {
  7547. id: "tab",
  7548. type: "blade",
  7549. accept(n) {
  7550. const e = M, t = ce2(n, {
  7551. pages: e.required.array(e.required.object({ title: e.required.string })),
  7552. view: e.required.constant("tab")
  7553. });
  7554. return !t || t.pages.length === 0 ? null : { params: t };
  7555. },
  7556. controller(n) {
  7557. const e = new fn(n.document, {
  7558. blade: n.blade,
  7559. viewProps: n.viewProps
  7560. });
  7561. return n.params.pages.forEach((t) => {
  7562. const l = new as(n.document, {
  7563. itemProps: X.fromObject({
  7564. selected: false,
  7565. title: t.title
  7566. }),
  7567. props: X.fromObject({
  7568. selected: false
  7569. })
  7570. });
  7571. e.add(l);
  7572. }), e;
  7573. },
  7574. api(n) {
  7575. return n.controller instanceof fn ? new ls(n.controller, n.pool) : null;
  7576. }
  7577. };
  7578. function ar(n, e) {
  7579. const t = n.accept(e.params);
  7580. if (!t)
  7581. return null;
  7582. const l = M.optional.boolean(e.params.disabled).value, v = M.optional.boolean(e.params.hidden).value;
  7583. return n.controller({
  7584. blade: xe(),
  7585. document: e.document,
  7586. params: Object.assign(Object.assign({}, t.params), { disabled: l, hidden: v }),
  7587. viewProps: Ye2.create({
  7588. disabled: l,
  7589. hidden: v
  7590. })
  7591. });
  7592. }
  7593. class ps {
  7594. constructor() {
  7595. this.disabled = false, this.emitter = new F();
  7596. }
  7597. dispose() {
  7598. }
  7599. tick() {
  7600. this.disabled || this.emitter.emit("tick", {
  7601. sender: this
  7602. });
  7603. }
  7604. }
  7605. class Ci {
  7606. constructor(e, t) {
  7607. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = e, this.emitter = new F(), this.interval_ = t, this.setTimer_();
  7608. }
  7609. get disabled() {
  7610. return this.disabled_;
  7611. }
  7612. set disabled(e) {
  7613. this.disabled_ = e, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  7614. }
  7615. dispose() {
  7616. this.clearTimer_();
  7617. }
  7618. clearTimer_() {
  7619. if (this.timerId_ === null)
  7620. return;
  7621. const e = this.doc_.defaultView;
  7622. e && e.clearInterval(this.timerId_), this.timerId_ = null;
  7623. }
  7624. setTimer_() {
  7625. if (this.clearTimer_(), this.interval_ <= 0)
  7626. return;
  7627. const e = this.doc_.defaultView;
  7628. e && (this.timerId_ = e.setInterval(this.onTick_, this.interval_));
  7629. }
  7630. onTick_() {
  7631. this.disabled_ || this.emitter.emit("tick", {
  7632. sender: this
  7633. });
  7634. }
  7635. }
  7636. class Zn {
  7637. constructor(e) {
  7638. this.onValueChange_ = this.onValueChange_.bind(this), this.reader = e.reader, this.writer = e.writer, this.emitter = new F(), this.value = e.value, this.value.emitter.on("change", this.onValueChange_), this.target = e.target, this.read();
  7639. }
  7640. read() {
  7641. const e = this.target.read();
  7642. e !== void 0 && (this.value.rawValue = this.reader(e));
  7643. }
  7644. write_(e) {
  7645. this.writer(this.target, e);
  7646. }
  7647. onValueChange_(e) {
  7648. this.write_(e.rawValue), this.emitter.emit("change", {
  7649. options: e.options,
  7650. rawValue: e.rawValue,
  7651. sender: this
  7652. });
  7653. }
  7654. }
  7655. function Se(n, e) {
  7656. for (; n.length < e; )
  7657. n.push(void 0);
  7658. }
  7659. function us(n) {
  7660. const e = [];
  7661. return Se(e, n), ee2(e);
  7662. }
  7663. function Yt(n) {
  7664. const e = n.indexOf(void 0);
  7665. return e < 0 ? n : n.slice(0, e);
  7666. }
  7667. function qe2(n, e) {
  7668. const t = [...Yt(n), e];
  7669. return t.length > n.length ? t.splice(0, t.length - n.length) : Se(t, n.length), t;
  7670. }
  7671. class lr {
  7672. constructor(e) {
  7673. this.onTick_ = this.onTick_.bind(this), this.reader_ = e.reader, this.target = e.target, this.emitter = new F(), this.value = e.value, this.ticker = e.ticker, this.ticker.emitter.on("tick", this.onTick_), this.read();
  7674. }
  7675. dispose() {
  7676. this.ticker.dispose();
  7677. }
  7678. read() {
  7679. const e = this.target.read();
  7680. if (e === void 0)
  7681. return;
  7682. const t = this.value.rawValue, l = this.reader_(e);
  7683. this.value.rawValue = qe2(t, l), this.emitter.emit("update", {
  7684. rawValue: l,
  7685. sender: this
  7686. });
  7687. }
  7688. onTick_(e) {
  7689. this.read();
  7690. }
  7691. }
  7692. class vn {
  7693. constructor(e) {
  7694. this.constraints = e;
  7695. }
  7696. constrain(e) {
  7697. return this.constraints.reduce((t, l) => l.constrain(t), e);
  7698. }
  7699. }
  7700. function it2(n, e) {
  7701. if (n instanceof e)
  7702. return n;
  7703. if (n instanceof vn) {
  7704. const t = n.constraints.reduce((l, v) => l || (v instanceof e ? v : null), null);
  7705. if (t)
  7706. return t;
  7707. }
  7708. return null;
  7709. }
  7710. class qt {
  7711. constructor(e) {
  7712. this.values = X.fromObject({
  7713. max: e.max,
  7714. min: e.min
  7715. });
  7716. }
  7717. constrain(e) {
  7718. const t = this.values.get("max"), l = this.values.get("min");
  7719. return Math.min(Math.max(e, l), t);
  7720. }
  7721. }
  7722. class bn {
  7723. constructor(e) {
  7724. this.values = X.fromObject({
  7725. options: e
  7726. });
  7727. }
  7728. get options() {
  7729. return this.values.get("options");
  7730. }
  7731. constrain(e) {
  7732. const t = this.values.get("options");
  7733. return t.length === 0 || t.filter((v) => v.value === e).length > 0 ? e : t[0].value;
  7734. }
  7735. }
  7736. class Pi {
  7737. constructor(e) {
  7738. this.values = X.fromObject({
  7739. max: e.max,
  7740. min: e.min
  7741. });
  7742. }
  7743. get maxValue() {
  7744. return this.values.get("max");
  7745. }
  7746. get minValue() {
  7747. return this.values.get("min");
  7748. }
  7749. constrain(e) {
  7750. const t = this.values.get("max"), l = this.values.get("min");
  7751. let v = e;
  7752. return _(l) || (v = Math.max(v, l)), _(t) || (v = Math.min(v, t)), v;
  7753. }
  7754. }
  7755. class Wn {
  7756. constructor(e, t = 0) {
  7757. this.step = e, this.origin = t;
  7758. }
  7759. constrain(e) {
  7760. const t = this.origin % this.step, l = Math.round((e - t) / this.step);
  7761. return t + l * this.step;
  7762. }
  7763. }
  7764. const Qt = D("lst");
  7765. class hs {
  7766. constructor(e, t) {
  7767. this.onValueChange_ = this.onValueChange_.bind(this), this.props_ = t.props, this.element = e.createElement("div"), this.element.classList.add(Qt()), t.viewProps.bindClassModifiers(this.element);
  7768. const l = e.createElement("select");
  7769. l.classList.add(Qt("s")), O(this.props_, "options", (E) => {
  7770. pn(l), E.forEach((k2, B2) => {
  7771. const Q = e.createElement("option");
  7772. Q.dataset.index = String(B2), Q.textContent = k2.text, Q.value = String(k2.value), l.appendChild(Q);
  7773. });
  7774. }), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.selectElement = l;
  7775. const v = e.createElement("div");
  7776. v.classList.add(Qt("m")), v.appendChild(Ct(e, "dropdown")), this.element.appendChild(v), t.value.emitter.on("change", this.onValueChange_), this.value_ = t.value, this.update_();
  7777. }
  7778. update_() {
  7779. this.selectElement.value = String(this.value_.rawValue);
  7780. }
  7781. onValueChange_() {
  7782. this.update_();
  7783. }
  7784. }
  7785. class gn {
  7786. constructor(e, t) {
  7787. this.onSelectChange_ = this.onSelectChange_.bind(this), this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new hs(e, {
  7788. props: this.props,
  7789. value: this.value,
  7790. viewProps: this.viewProps
  7791. }), this.view.selectElement.addEventListener("change", this.onSelectChange_);
  7792. }
  7793. onSelectChange_(e) {
  7794. const l = e.currentTarget.selectedOptions.item(0);
  7795. if (!l)
  7796. return;
  7797. const v = Number(l.dataset.index);
  7798. this.value.rawValue = this.props.get("options")[v].value;
  7799. }
  7800. }
  7801. const ds = D("pop");
  7802. class cr {
  7803. constructor(e, t) {
  7804. this.element = e.createElement("div"), this.element.classList.add(ds()), t.viewProps.bindClassModifiers(this.element), N(t.shows, K(this.element, ds(void 0, "v")));
  7805. }
  7806. }
  7807. class ms {
  7808. constructor(e, t) {
  7809. this.shows = ee2(false), this.viewProps = t.viewProps, this.view = new cr(e, {
  7810. shows: this.shows,
  7811. viewProps: this.viewProps
  7812. });
  7813. }
  7814. }
  7815. const fs = D("txt");
  7816. class pr {
  7817. constructor(e, t) {
  7818. this.onChange_ = this.onChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(fs()), t.viewProps.bindClassModifiers(this.element), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_);
  7819. const l = e.createElement("input");
  7820. l.classList.add(fs("i")), l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, t.value.emitter.on("change", this.onChange_), this.value_ = t.value, this.refresh();
  7821. }
  7822. refresh() {
  7823. const e = this.props_.get("formatter");
  7824. this.inputElement.value = e(this.value_.rawValue);
  7825. }
  7826. onChange_() {
  7827. this.refresh();
  7828. }
  7829. }
  7830. class Jn {
  7831. constructor(e, t) {
  7832. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = t.parser, this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new pr(e, {
  7833. props: t.props,
  7834. value: this.value,
  7835. viewProps: this.viewProps
  7836. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7837. }
  7838. onInputChange_(e) {
  7839. const l = e.currentTarget.value, v = this.parser_(l);
  7840. _(v) || (this.value.rawValue = v), this.view.refresh();
  7841. }
  7842. }
  7843. function ur(n) {
  7844. return String(n);
  7845. }
  7846. function vs(n) {
  7847. return n === "false" ? false : !!n;
  7848. }
  7849. function bs(n) {
  7850. return ur(n);
  7851. }
  7852. class hr {
  7853. constructor(e) {
  7854. this.text = e;
  7855. }
  7856. evaluate() {
  7857. return Number(this.text);
  7858. }
  7859. toString() {
  7860. return this.text;
  7861. }
  7862. }
  7863. const dr = {
  7864. "**": (n, e) => Math.pow(n, e),
  7865. "*": (n, e) => n * e,
  7866. "/": (n, e) => n / e,
  7867. "%": (n, e) => n % e,
  7868. "+": (n, e) => n + e,
  7869. "-": (n, e) => n - e,
  7870. "<<": (n, e) => n << e,
  7871. ">>": (n, e) => n >> e,
  7872. ">>>": (n, e) => n >>> e,
  7873. "&": (n, e) => n & e,
  7874. "^": (n, e) => n ^ e,
  7875. "|": (n, e) => n | e
  7876. };
  7877. class mr {
  7878. constructor(e, t, l) {
  7879. this.left = t, this.operator = e, this.right = l;
  7880. }
  7881. evaluate() {
  7882. const e = dr[this.operator];
  7883. if (!e)
  7884. throw new Error(`unexpected binary operator: '${this.operator}`);
  7885. return e(this.left.evaluate(), this.right.evaluate());
  7886. }
  7887. toString() {
  7888. return [
  7889. "b(",
  7890. this.left.toString(),
  7891. this.operator,
  7892. this.right.toString(),
  7893. ")"
  7894. ].join(" ");
  7895. }
  7896. }
  7897. const gs = {
  7898. "+": (n) => n,
  7899. "-": (n) => -n,
  7900. "~": (n) => ~n
  7901. };
  7902. class fr {
  7903. constructor(e, t) {
  7904. this.operator = e, this.expression = t;
  7905. }
  7906. evaluate() {
  7907. const e = gs[this.operator];
  7908. if (!e)
  7909. throw new Error(`unexpected unary operator: '${this.operator}`);
  7910. return e(this.expression.evaluate());
  7911. }
  7912. toString() {
  7913. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  7914. }
  7915. }
  7916. function Ti(n) {
  7917. return (e, t) => {
  7918. for (let l = 0; l < n.length; l++) {
  7919. const v = n[l](e, t);
  7920. if (v !== "")
  7921. return v;
  7922. }
  7923. return "";
  7924. };
  7925. }
  7926. function Vt(n, e) {
  7927. var t;
  7928. const l = n.substr(e).match(/^\s+/);
  7929. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7930. }
  7931. function vr(n, e) {
  7932. const t = n.substr(e, 1);
  7933. return t.match(/^[1-9]$/) ? t : "";
  7934. }
  7935. function _n(n, e) {
  7936. var t;
  7937. const l = n.substr(e).match(/^[0-9]+/);
  7938. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7939. }
  7940. function br(n, e) {
  7941. const t = _n(n, e);
  7942. if (t !== "")
  7943. return t;
  7944. const l = n.substr(e, 1);
  7945. if (e += 1, l !== "-" && l !== "+")
  7946. return "";
  7947. const v = _n(n, e);
  7948. return v === "" ? "" : l + v;
  7949. }
  7950. function ct2(n, e) {
  7951. const t = n.substr(e, 1);
  7952. if (e += 1, t.toLowerCase() !== "e")
  7953. return "";
  7954. const l = br(n, e);
  7955. return l === "" ? "" : t + l;
  7956. }
  7957. function _s(n, e) {
  7958. const t = n.substr(e, 1);
  7959. if (t === "0")
  7960. return t;
  7961. const l = vr(n, e);
  7962. return e += l.length, l === "" ? "" : l + _n(n, e);
  7963. }
  7964. function gr(n, e) {
  7965. const t = _s(n, e);
  7966. if (e += t.length, t === "")
  7967. return "";
  7968. const l = n.substr(e, 1);
  7969. if (e += l.length, l !== ".")
  7970. return "";
  7971. const v = _n(n, e);
  7972. return e += v.length, t + l + v + ct2(n, e);
  7973. }
  7974. function ws(n, e) {
  7975. const t = n.substr(e, 1);
  7976. if (e += t.length, t !== ".")
  7977. return "";
  7978. const l = _n(n, e);
  7979. return e += l.length, l === "" ? "" : t + l + ct2(n, e);
  7980. }
  7981. function _r(n, e) {
  7982. const t = _s(n, e);
  7983. return e += t.length, t === "" ? "" : t + ct2(n, e);
  7984. }
  7985. const ys = Ti([
  7986. gr,
  7987. ws,
  7988. _r
  7989. ]);
  7990. function ki(n, e) {
  7991. var t;
  7992. const l = n.substr(e).match(/^[01]+/);
  7993. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7994. }
  7995. function wr(n, e) {
  7996. const t = n.substr(e, 2);
  7997. if (e += t.length, t.toLowerCase() !== "0b")
  7998. return "";
  7999. const l = ki(n, e);
  8000. return l === "" ? "" : t + l;
  8001. }
  8002. function xs(n, e) {
  8003. var t;
  8004. const l = n.substr(e).match(/^[0-7]+/);
  8005. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  8006. }
  8007. function Qe2(n, e) {
  8008. const t = n.substr(e, 2);
  8009. if (e += t.length, t.toLowerCase() !== "0o")
  8010. return "";
  8011. const l = xs(n, e);
  8012. return l === "" ? "" : t + l;
  8013. }
  8014. function yr(n, e) {
  8015. var t;
  8016. const l = n.substr(e).match(/^[0-9a-f]+/i);
  8017. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  8018. }
  8019. function xr(n, e) {
  8020. const t = n.substr(e, 2);
  8021. if (e += t.length, t.toLowerCase() !== "0x")
  8022. return "";
  8023. const l = yr(n, e);
  8024. return l === "" ? "" : t + l;
  8025. }
  8026. const Mi = Ti([
  8027. wr,
  8028. Qe2,
  8029. xr
  8030. ]), Er = Ti([
  8031. Mi,
  8032. ys
  8033. ]);
  8034. function Tt(n, e) {
  8035. const t = Er(n, e);
  8036. return e += t.length, t === "" ? null : {
  8037. evaluable: new hr(t),
  8038. cursor: e
  8039. };
  8040. }
  8041. function Si(n, e) {
  8042. const t = n.substr(e, 1);
  8043. if (e += t.length, t !== "(")
  8044. return null;
  8045. const l = ei(n, e);
  8046. if (!l)
  8047. return null;
  8048. e = l.cursor, e += Vt(n, e).length;
  8049. const v = n.substr(e, 1);
  8050. return e += v.length, v !== ")" ? null : {
  8051. evaluable: l.evaluable,
  8052. cursor: e
  8053. };
  8054. }
  8055. function Cr(n, e) {
  8056. var t;
  8057. return (t = Tt(n, e)) !== null && t !== void 0 ? t : Si(n, e);
  8058. }
  8059. function Ai(n, e) {
  8060. const t = Cr(n, e);
  8061. if (t)
  8062. return t;
  8063. const l = n.substr(e, 1);
  8064. if (e += l.length, l !== "+" && l !== "-" && l !== "~")
  8065. return null;
  8066. const v = Ai(n, e);
  8067. return v ? (e = v.cursor, {
  8068. cursor: e,
  8069. evaluable: new fr(l, v.evaluable)
  8070. }) : null;
  8071. }
  8072. function Pr(n, e, t) {
  8073. t += Vt(e, t).length;
  8074. const l = n.filter((v) => e.startsWith(v, t))[0];
  8075. return l ? (t += l.length, t += Vt(e, t).length, {
  8076. cursor: t,
  8077. operator: l
  8078. }) : null;
  8079. }
  8080. function Dt(n, e) {
  8081. return (t, l) => {
  8082. const v = n(t, l);
  8083. if (!v)
  8084. return null;
  8085. l = v.cursor;
  8086. let E = v.evaluable;
  8087. for (; ; ) {
  8088. const k2 = Pr(e, t, l);
  8089. if (!k2)
  8090. break;
  8091. l = k2.cursor;
  8092. const B2 = n(t, l);
  8093. if (!B2)
  8094. return null;
  8095. l = B2.cursor, E = new mr(k2.operator, E, B2.evaluable);
  8096. }
  8097. return E ? {
  8098. cursor: l,
  8099. evaluable: E
  8100. } : null;
  8101. };
  8102. }
  8103. const Es = [
  8104. ["**"],
  8105. ["*", "/", "%"],
  8106. ["+", "-"],
  8107. ["<<", ">>>", ">>"],
  8108. ["&"],
  8109. ["^"],
  8110. ["|"]
  8111. ].reduce((n, e) => Dt(n, e), Ai);
  8112. function ei(n, e) {
  8113. return e += Vt(n, e).length, Es(n, e);
  8114. }
  8115. function Cs(n) {
  8116. const e = ei(n, 0);
  8117. return !e || e.cursor + Vt(n, e.cursor).length !== n.length ? null : e.evaluable;
  8118. }
  8119. function pt(n) {
  8120. var e;
  8121. const t = Cs(n);
  8122. return (e = t == null ? void 0 : t.evaluate()) !== null && e !== void 0 ? e : null;
  8123. }
  8124. function _t(n) {
  8125. if (typeof n == "number")
  8126. return n;
  8127. if (typeof n == "string") {
  8128. const e = pt(n);
  8129. if (!_(e))
  8130. return e;
  8131. }
  8132. return 0;
  8133. }
  8134. function Tr(n) {
  8135. return String(n);
  8136. }
  8137. function Ie(n) {
  8138. return (e) => e.toFixed(Math.max(Math.min(n, 20), 0));
  8139. }
  8140. const Ps = Ie(0);
  8141. function wn(n) {
  8142. return Ps(n) + "%";
  8143. }
  8144. function Li(n) {
  8145. return String(n);
  8146. }
  8147. function kt(n) {
  8148. return n;
  8149. }
  8150. function Zt({ primary: n, secondary: e, forward: t, backward: l }) {
  8151. let v = false;
  8152. function E(k2) {
  8153. v || (v = true, k2(), v = false);
  8154. }
  8155. n.emitter.on("change", (k2) => {
  8156. E(() => {
  8157. e.setRawValue(t(n, e), k2.options);
  8158. });
  8159. }), e.emitter.on("change", (k2) => {
  8160. E(() => {
  8161. n.setRawValue(l(n, e), k2.options);
  8162. }), E(() => {
  8163. e.setRawValue(t(n, e), k2.options);
  8164. });
  8165. }), E(() => {
  8166. e.setRawValue(t(n, e), {
  8167. forceEmit: false,
  8168. last: true
  8169. });
  8170. });
  8171. }
  8172. function Ne2(n, e) {
  8173. const t = n * (e.altKey ? 0.1 : 1) * (e.shiftKey ? 10 : 1);
  8174. return e.upKey ? +t : e.downKey ? -t : 0;
  8175. }
  8176. function yn(n) {
  8177. return {
  8178. altKey: n.altKey,
  8179. downKey: n.key === "ArrowDown",
  8180. shiftKey: n.shiftKey,
  8181. upKey: n.key === "ArrowUp"
  8182. };
  8183. }
  8184. function ut2(n) {
  8185. return {
  8186. altKey: n.altKey,
  8187. downKey: n.key === "ArrowLeft",
  8188. shiftKey: n.shiftKey,
  8189. upKey: n.key === "ArrowRight"
  8190. };
  8191. }
  8192. function Ts(n) {
  8193. return n === "ArrowUp" || n === "ArrowDown";
  8194. }
  8195. function ti(n) {
  8196. return Ts(n) || n === "ArrowLeft" || n === "ArrowRight";
  8197. }
  8198. function Ri(n, e) {
  8199. var t, l;
  8200. const v = e.ownerDocument.defaultView, E = e.getBoundingClientRect();
  8201. return {
  8202. x: n.pageX - (((t = v && v.scrollX) !== null && t !== void 0 ? t : 0) + E.left),
  8203. y: n.pageY - (((l = v && v.scrollY) !== null && l !== void 0 ? l : 0) + E.top)
  8204. };
  8205. }
  8206. class Ot {
  8207. constructor(e) {
  8208. this.lastTouch_ = null, this.onDocumentMouseMove_ = this.onDocumentMouseMove_.bind(this), this.onDocumentMouseUp_ = this.onDocumentMouseUp_.bind(this), this.onMouseDown_ = this.onMouseDown_.bind(this), this.onTouchEnd_ = this.onTouchEnd_.bind(this), this.onTouchMove_ = this.onTouchMove_.bind(this), this.onTouchStart_ = this.onTouchStart_.bind(this), this.elem_ = e, this.emitter = new F(), e.addEventListener("touchstart", this.onTouchStart_, {
  8209. passive: false
  8210. }), e.addEventListener("touchmove", this.onTouchMove_, {
  8211. passive: true
  8212. }), e.addEventListener("touchend", this.onTouchEnd_), e.addEventListener("mousedown", this.onMouseDown_);
  8213. }
  8214. computePosition_(e) {
  8215. const t = this.elem_.getBoundingClientRect();
  8216. return {
  8217. bounds: {
  8218. width: t.width,
  8219. height: t.height
  8220. },
  8221. point: e ? {
  8222. x: e.x,
  8223. y: e.y
  8224. } : null
  8225. };
  8226. }
  8227. onMouseDown_(e) {
  8228. var t;
  8229. e.preventDefault(), (t = e.currentTarget) === null || t === void 0 || t.focus();
  8230. const l = this.elem_.ownerDocument;
  8231. l.addEventListener("mousemove", this.onDocumentMouseMove_), l.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  8232. altKey: e.altKey,
  8233. data: this.computePosition_(Ri(e, this.elem_)),
  8234. sender: this,
  8235. shiftKey: e.shiftKey
  8236. });
  8237. }
  8238. onDocumentMouseMove_(e) {
  8239. this.emitter.emit("move", {
  8240. altKey: e.altKey,
  8241. data: this.computePosition_(Ri(e, this.elem_)),
  8242. sender: this,
  8243. shiftKey: e.shiftKey
  8244. });
  8245. }
  8246. onDocumentMouseUp_(e) {
  8247. const t = this.elem_.ownerDocument;
  8248. t.removeEventListener("mousemove", this.onDocumentMouseMove_), t.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  8249. altKey: e.altKey,
  8250. data: this.computePosition_(Ri(e, this.elem_)),
  8251. sender: this,
  8252. shiftKey: e.shiftKey
  8253. });
  8254. }
  8255. onTouchStart_(e) {
  8256. e.preventDefault();
  8257. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  8258. this.emitter.emit("down", {
  8259. altKey: e.altKey,
  8260. data: this.computePosition_(t ? {
  8261. x: t.clientX - l.left,
  8262. y: t.clientY - l.top
  8263. } : void 0),
  8264. sender: this,
  8265. shiftKey: e.shiftKey
  8266. }), this.lastTouch_ = t;
  8267. }
  8268. onTouchMove_(e) {
  8269. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  8270. this.emitter.emit("move", {
  8271. altKey: e.altKey,
  8272. data: this.computePosition_(t ? {
  8273. x: t.clientX - l.left,
  8274. y: t.clientY - l.top
  8275. } : void 0),
  8276. sender: this,
  8277. shiftKey: e.shiftKey
  8278. }), this.lastTouch_ = t;
  8279. }
  8280. onTouchEnd_(e) {
  8281. var t;
  8282. const l = (t = e.targetTouches.item(0)) !== null && t !== void 0 ? t : this.lastTouch_, v = this.elem_.getBoundingClientRect();
  8283. this.emitter.emit("up", {
  8284. altKey: e.altKey,
  8285. data: this.computePosition_(l ? {
  8286. x: l.clientX - v.left,
  8287. y: l.clientY - v.top
  8288. } : void 0),
  8289. sender: this,
  8290. shiftKey: e.shiftKey
  8291. });
  8292. }
  8293. }
  8294. function we(n, e, t, l, v) {
  8295. const E = (n - e) / (t - e);
  8296. return l + E * (v - l);
  8297. }
  8298. function Ii(n) {
  8299. return String(n.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  8300. }
  8301. function Ae(n, e, t) {
  8302. return Math.min(Math.max(n, e), t);
  8303. }
  8304. function Wt(n, e) {
  8305. return (n % e + e) % e;
  8306. }
  8307. const Ke2 = D("txt");
  8308. class Vi {
  8309. constructor(e, t) {
  8310. this.onChange_ = this.onChange_.bind(this), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_), this.element = e.createElement("div"), this.element.classList.add(Ke2(), Ke2(void 0, "num")), t.arrayPosition && this.element.classList.add(Ke2(void 0, t.arrayPosition)), t.viewProps.bindClassModifiers(this.element);
  8311. const l = e.createElement("input");
  8312. l.classList.add(Ke2("i")), l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = t.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(Ke2()), this.inputElement.classList.add(Ke2("i"));
  8313. const v = e.createElement("div");
  8314. v.classList.add(Ke2("k")), this.element.appendChild(v), this.knobElement = v;
  8315. const E = e.createElementNS(Ue, "svg");
  8316. E.classList.add(Ke2("g")), this.knobElement.appendChild(E);
  8317. const k2 = e.createElementNS(Ue, "path");
  8318. k2.classList.add(Ke2("gb")), E.appendChild(k2), this.guideBodyElem_ = k2;
  8319. const B2 = e.createElementNS(Ue, "path");
  8320. B2.classList.add(Ke2("gh")), E.appendChild(B2), this.guideHeadElem_ = B2;
  8321. const Q = e.createElement("div");
  8322. Q.classList.add(D("tt")()), this.knobElement.appendChild(Q), this.tooltipElem_ = Q, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.refresh();
  8323. }
  8324. onDraggingChange_(e) {
  8325. if (e.rawValue === null) {
  8326. this.element.classList.remove(Ke2(void 0, "drg"));
  8327. return;
  8328. }
  8329. this.element.classList.add(Ke2(void 0, "drg"));
  8330. const t = e.rawValue / this.props_.get("draggingScale"), l = t + (t > 0 ? -1 : t < 0 ? 1 : 0), v = Ae(-l, -4, 4);
  8331. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${l + v},0 L${l},4 L${l + v},8`, `M ${t},-1 L${t},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${t},4`);
  8332. const E = this.props_.get("formatter");
  8333. this.tooltipElem_.textContent = E(this.value.rawValue), this.tooltipElem_.style.left = `${t}px`;
  8334. }
  8335. refresh() {
  8336. const e = this.props_.get("formatter");
  8337. this.inputElement.value = e(this.value.rawValue);
  8338. }
  8339. onChange_() {
  8340. this.refresh();
  8341. }
  8342. }
  8343. class xn {
  8344. constructor(e, t) {
  8345. var l;
  8346. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = t.baseStep, this.parser_ = t.parser, this.props = t.props, this.sliderProps_ = (l = t.sliderProps) !== null && l !== void 0 ? l : null, this.value = t.value, this.viewProps = t.viewProps, this.dragging_ = ee2(null), this.view = new Vi(e, {
  8347. arrayPosition: t.arrayPosition,
  8348. dragging: this.dragging_,
  8349. props: this.props,
  8350. value: this.value,
  8351. viewProps: this.viewProps
  8352. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  8353. const v = new Ot(this.view.knobElement);
  8354. v.emitter.on("down", this.onPointerDown_), v.emitter.on("move", this.onPointerMove_), v.emitter.on("up", this.onPointerUp_);
  8355. }
  8356. constrainValue_(e) {
  8357. var t, l;
  8358. const v = (t = this.sliderProps_) === null || t === void 0 ? void 0 : t.get("minValue"), E = (l = this.sliderProps_) === null || l === void 0 ? void 0 : l.get("maxValue");
  8359. let k2 = e;
  8360. return v !== void 0 && (k2 = Math.max(k2, v)), E !== void 0 && (k2 = Math.min(k2, E)), k2;
  8361. }
  8362. onInputChange_(e) {
  8363. const l = e.currentTarget.value, v = this.parser_(l);
  8364. _(v) || (this.value.rawValue = this.constrainValue_(v)), this.view.refresh();
  8365. }
  8366. onInputKeyDown_(e) {
  8367. const t = Ne2(this.baseStep_, yn(e));
  8368. t !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + t), {
  8369. forceEmit: false,
  8370. last: false
  8371. });
  8372. }
  8373. onInputKeyUp_(e) {
  8374. Ne2(this.baseStep_, yn(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8375. forceEmit: true,
  8376. last: true
  8377. });
  8378. }
  8379. onPointerDown_() {
  8380. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  8381. }
  8382. computeDraggingValue_(e) {
  8383. if (!e.point)
  8384. return null;
  8385. const t = e.point.x - e.bounds.width / 2;
  8386. return this.constrainValue_(this.originRawValue_ + t * this.props.get("draggingScale"));
  8387. }
  8388. onPointerMove_(e) {
  8389. const t = this.computeDraggingValue_(e.data);
  8390. t !== null && (this.value.setRawValue(t, {
  8391. forceEmit: false,
  8392. last: false
  8393. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  8394. }
  8395. onPointerUp_(e) {
  8396. const t = this.computeDraggingValue_(e.data);
  8397. t !== null && (this.value.setRawValue(t, {
  8398. forceEmit: true,
  8399. last: true
  8400. }), this.dragging_.rawValue = null);
  8401. }
  8402. }
  8403. const Di = D("sld");
  8404. class $e {
  8405. constructor(e, t) {
  8406. this.onChange_ = this.onChange_.bind(this), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_), this.element = e.createElement("div"), this.element.classList.add(Di()), t.viewProps.bindClassModifiers(this.element);
  8407. const l = e.createElement("div");
  8408. l.classList.add(Di("t")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.trackElement = l;
  8409. const v = e.createElement("div");
  8410. v.classList.add(Di("k")), this.trackElement.appendChild(v), this.knobElement = v, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.update_();
  8411. }
  8412. update_() {
  8413. const e = Ae(we(this.value.rawValue, this.props_.get("minValue"), this.props_.get("maxValue"), 0, 100), 0, 100);
  8414. this.knobElement.style.width = `${e}%`;
  8415. }
  8416. onChange_() {
  8417. this.update_();
  8418. }
  8419. }
  8420. class Oi {
  8421. constructor(e, t) {
  8422. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDownOrMove_ = this.onPointerDownOrMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = t.baseStep, this.value = t.value, this.viewProps = t.viewProps, this.props = t.props, this.view = new $e(e, {
  8423. props: this.props,
  8424. value: this.value,
  8425. viewProps: this.viewProps
  8426. }), this.ptHandler_ = new Ot(this.view.trackElement), this.ptHandler_.emitter.on("down", this.onPointerDownOrMove_), this.ptHandler_.emitter.on("move", this.onPointerDownOrMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.trackElement.addEventListener("keydown", this.onKeyDown_), this.view.trackElement.addEventListener("keyup", this.onKeyUp_);
  8427. }
  8428. handlePointerEvent_(e, t) {
  8429. e.point && this.value.setRawValue(we(Ae(e.point.x, 0, e.bounds.width), 0, e.bounds.width, this.props.get("minValue"), this.props.get("maxValue")), t);
  8430. }
  8431. onPointerDownOrMove_(e) {
  8432. this.handlePointerEvent_(e.data, {
  8433. forceEmit: false,
  8434. last: false
  8435. });
  8436. }
  8437. onPointerUp_(e) {
  8438. this.handlePointerEvent_(e.data, {
  8439. forceEmit: true,
  8440. last: true
  8441. });
  8442. }
  8443. onKeyDown_(e) {
  8444. const t = Ne2(this.baseStep_, ut2(e));
  8445. t !== 0 && this.value.setRawValue(this.value.rawValue + t, {
  8446. forceEmit: false,
  8447. last: false
  8448. });
  8449. }
  8450. onKeyUp_(e) {
  8451. Ne2(this.baseStep_, ut2(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8452. forceEmit: true,
  8453. last: true
  8454. });
  8455. }
  8456. }
  8457. const En = D("sldtxt");
  8458. class Ni {
  8459. constructor(e, t) {
  8460. this.element = e.createElement("div"), this.element.classList.add(En());
  8461. const l = e.createElement("div");
  8462. l.classList.add(En("s")), this.sliderView_ = t.sliderView, l.appendChild(this.sliderView_.element), this.element.appendChild(l);
  8463. const v = e.createElement("div");
  8464. v.classList.add(En("t")), this.textView_ = t.textView, v.appendChild(this.textView_.element), this.element.appendChild(v);
  8465. }
  8466. }
  8467. class ni {
  8468. constructor(e, t) {
  8469. this.value = t.value, this.viewProps = t.viewProps, this.sliderC_ = new Oi(e, {
  8470. baseStep: t.baseStep,
  8471. props: t.sliderProps,
  8472. value: t.value,
  8473. viewProps: this.viewProps
  8474. }), this.textC_ = new xn(e, {
  8475. baseStep: t.baseStep,
  8476. parser: t.parser,
  8477. props: t.textProps,
  8478. sliderProps: t.sliderProps,
  8479. value: t.value,
  8480. viewProps: t.viewProps
  8481. }), this.view = new Ni(e, {
  8482. sliderView: this.sliderC_.view,
  8483. textView: this.textC_.view
  8484. });
  8485. }
  8486. get sliderController() {
  8487. return this.sliderC_;
  8488. }
  8489. get textController() {
  8490. return this.textC_;
  8491. }
  8492. }
  8493. function st2(n, e) {
  8494. n.write(e);
  8495. }
  8496. function Cn(n) {
  8497. const e = M;
  8498. if (Array.isArray(n))
  8499. return e.required.array(e.required.object({
  8500. text: e.required.string,
  8501. value: e.required.raw
  8502. }))(n).value;
  8503. if (typeof n == "object")
  8504. return e.required.raw(n).value;
  8505. }
  8506. function Fi(n) {
  8507. if (n === "inline" || n === "popup")
  8508. return n;
  8509. }
  8510. function wt(n) {
  8511. const e = M;
  8512. return e.required.object({
  8513. max: e.optional.number,
  8514. min: e.optional.number,
  8515. step: e.optional.number
  8516. })(n).value;
  8517. }
  8518. function ks(n) {
  8519. if (Array.isArray(n))
  8520. return n;
  8521. const e = [];
  8522. return Object.keys(n).forEach((t) => {
  8523. e.push({ text: t, value: n[t] });
  8524. }), e;
  8525. }
  8526. function Bi(n) {
  8527. return _(n) ? null : new bn(ks(n));
  8528. }
  8529. function kr(n) {
  8530. const e = n ? it2(n, Wn) : null;
  8531. return e ? e.step : null;
  8532. }
  8533. function ii(n, e) {
  8534. const t = n && it2(n, Wn);
  8535. return t ? Ii(t.step) : Math.max(Ii(e), 2);
  8536. }
  8537. function Nt(n) {
  8538. const e = kr(n);
  8539. return e ?? 1;
  8540. }
  8541. function Ft(n, e) {
  8542. var t;
  8543. const l = n && it2(n, Wn), v = Math.abs((t = l == null ? void 0 : l.step) !== null && t !== void 0 ? t : e);
  8544. return v === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(v)) - 1);
  8545. }
  8546. const Pn = D("ckb");
  8547. class Tn {
  8548. constructor(e, t) {
  8549. this.onValueChange_ = this.onValueChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(Pn()), t.viewProps.bindClassModifiers(this.element);
  8550. const l = e.createElement("label");
  8551. l.classList.add(Pn("l")), this.element.appendChild(l);
  8552. const v = e.createElement("input");
  8553. v.classList.add(Pn("i")), v.type = "checkbox", l.appendChild(v), this.inputElement = v, t.viewProps.bindDisabled(this.inputElement);
  8554. const E = e.createElement("div");
  8555. E.classList.add(Pn("w")), l.appendChild(E);
  8556. const k2 = Ct(e, "check");
  8557. E.appendChild(k2), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  8558. }
  8559. update_() {
  8560. this.inputElement.checked = this.value.rawValue;
  8561. }
  8562. onValueChange_() {
  8563. this.update_();
  8564. }
  8565. }
  8566. class Ms {
  8567. constructor(e, t) {
  8568. this.onInputChange_ = this.onInputChange_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new Tn(e, {
  8569. value: this.value,
  8570. viewProps: this.viewProps
  8571. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  8572. }
  8573. onInputChange_(e) {
  8574. const t = e.currentTarget;
  8575. this.value.rawValue = t.checked;
  8576. }
  8577. }
  8578. function Ss(n) {
  8579. const e = [], t = Bi(n.options);
  8580. return t && e.push(t), new vn(e);
  8581. }
  8582. const si = {
  8583. id: "input-bool",
  8584. type: "input",
  8585. accept: (n, e) => {
  8586. if (typeof n != "boolean")
  8587. return null;
  8588. const l = ce2(e, {
  8589. options: M.optional.custom(Cn)
  8590. });
  8591. return l ? {
  8592. initialValue: n,
  8593. params: l
  8594. } : null;
  8595. },
  8596. binding: {
  8597. reader: (n) => vs,
  8598. constraint: (n) => Ss(n.params),
  8599. writer: (n) => st2
  8600. },
  8601. controller: (n) => {
  8602. const e = n.document, t = n.value, l = n.constraint, v = l && it2(l, bn);
  8603. return v ? new gn(e, {
  8604. props: new X({
  8605. options: v.values.value("options")
  8606. }),
  8607. value: t,
  8608. viewProps: n.viewProps
  8609. }) : new Ms(e, {
  8610. value: t,
  8611. viewProps: n.viewProps
  8612. });
  8613. }
  8614. }, Bt = D("col");
  8615. class ji {
  8616. constructor(e, t) {
  8617. this.element = e.createElement("div"), this.element.classList.add(Bt()), t.foldable.bindExpandedClass(this.element, Bt(void 0, "expanded")), O(t.foldable, "completed", K(this.element, Bt(void 0, "cpl")));
  8618. const l = e.createElement("div");
  8619. l.classList.add(Bt("h")), this.element.appendChild(l);
  8620. const v = e.createElement("div");
  8621. v.classList.add(Bt("s")), l.appendChild(v), this.swatchElement = v;
  8622. const E = e.createElement("div");
  8623. if (E.classList.add(Bt("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  8624. const k2 = e.createElement("div");
  8625. k2.classList.add(Bt("p")), this.element.appendChild(k2), this.pickerElement = k2;
  8626. } else
  8627. this.pickerElement = null;
  8628. }
  8629. }
  8630. function Mr(n, e, t) {
  8631. const l = Ae(n / 255, 0, 1), v = Ae(e / 255, 0, 1), E = Ae(t / 255, 0, 1), k2 = Math.max(l, v, E), B2 = Math.min(l, v, E), Q = k2 - B2;
  8632. let J = 0, me2 = 0;
  8633. const be = (B2 + k2) / 2;
  8634. return Q !== 0 && (me2 = Q / (1 - Math.abs(k2 + B2 - 1)), l === k2 ? J = (v - E) / Q : v === k2 ? J = 2 + (E - l) / Q : J = 4 + (l - v) / Q, J = J / 6 + (J < 0 ? 1 : 0)), [J * 360, me2 * 100, be * 100];
  8635. }
  8636. function Sr(n, e, t) {
  8637. const l = (n % 360 + 360) % 360, v = Ae(e / 100, 0, 1), E = Ae(t / 100, 0, 1), k2 = (1 - Math.abs(2 * E - 1)) * v, B2 = k2 * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k2 / 2;
  8638. let J, me2, be;
  8639. return l >= 0 && l < 60 ? [J, me2, be] = [k2, B2, 0] : l >= 60 && l < 120 ? [J, me2, be] = [B2, k2, 0] : l >= 120 && l < 180 ? [J, me2, be] = [0, k2, B2] : l >= 180 && l < 240 ? [J, me2, be] = [0, B2, k2] : l >= 240 && l < 300 ? [J, me2, be] = [B2, 0, k2] : [J, me2, be] = [k2, 0, B2], [(J + Q) * 255, (me2 + Q) * 255, (be + Q) * 255];
  8640. }
  8641. function Ar(n, e, t) {
  8642. const l = Ae(n / 255, 0, 1), v = Ae(e / 255, 0, 1), E = Ae(t / 255, 0, 1), k2 = Math.max(l, v, E), B2 = Math.min(l, v, E), Q = k2 - B2;
  8643. let J;
  8644. Q === 0 ? J = 0 : k2 === l ? J = 60 * (((v - E) / Q % 6 + 6) % 6) : k2 === v ? J = 60 * ((E - l) / Q + 2) : J = 60 * ((l - v) / Q + 4);
  8645. const me2 = k2 === 0 ? 0 : Q / k2, be = k2;
  8646. return [J, me2 * 100, be * 100];
  8647. }
  8648. function As(n, e, t) {
  8649. const l = Wt(n, 360), v = Ae(e / 100, 0, 1), E = Ae(t / 100, 0, 1), k2 = E * v, B2 = k2 * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k2;
  8650. let J, me2, be;
  8651. return l >= 0 && l < 60 ? [J, me2, be] = [k2, B2, 0] : l >= 60 && l < 120 ? [J, me2, be] = [B2, k2, 0] : l >= 120 && l < 180 ? [J, me2, be] = [0, k2, B2] : l >= 180 && l < 240 ? [J, me2, be] = [0, B2, k2] : l >= 240 && l < 300 ? [J, me2, be] = [B2, 0, k2] : [J, me2, be] = [k2, 0, B2], [(J + Q) * 255, (me2 + Q) * 255, (be + Q) * 255];
  8652. }
  8653. function m(n, e, t) {
  8654. const l = t + e * (100 - Math.abs(2 * t - 100)) / 200;
  8655. return [
  8656. n,
  8657. l !== 0 ? e * (100 - Math.abs(2 * t - 100)) / l : 0,
  8658. t + e * (100 - Math.abs(2 * t - 100)) / (2 * 100)
  8659. ];
  8660. }
  8661. function o(n, e, t) {
  8662. const l = 100 - Math.abs(t * (200 - e) / 100 - 100);
  8663. return [n, l !== 0 ? e * t / l : 0, t * (200 - e) / (2 * 100)];
  8664. }
  8665. function p(n) {
  8666. return [n[0], n[1], n[2]];
  8667. }
  8668. function f2(n, e) {
  8669. return [n[0], n[1], n[2], e];
  8670. }
  8671. const x = {
  8672. hsl: {
  8673. hsl: (n, e, t) => [n, e, t],
  8674. hsv: m,
  8675. rgb: Sr
  8676. },
  8677. hsv: {
  8678. hsl: o,
  8679. hsv: (n, e, t) => [n, e, t],
  8680. rgb: As
  8681. },
  8682. rgb: {
  8683. hsl: Mr,
  8684. hsv: Ar,
  8685. rgb: (n, e, t) => [n, e, t]
  8686. }
  8687. };
  8688. function P(n, e) {
  8689. return [
  8690. e === "float" ? 1 : n === "rgb" ? 255 : 360,
  8691. e === "float" ? 1 : n === "rgb" ? 255 : 100,
  8692. e === "float" ? 1 : n === "rgb" ? 255 : 100
  8693. ];
  8694. }
  8695. function L2(n, e) {
  8696. return n === e ? e : Wt(n, e);
  8697. }
  8698. function z(n, e, t) {
  8699. var l;
  8700. const v = P(e, t);
  8701. return [
  8702. e === "rgb" ? Ae(n[0], 0, v[0]) : L2(n[0], v[0]),
  8703. Ae(n[1], 0, v[1]),
  8704. Ae(n[2], 0, v[2]),
  8705. Ae((l = n[3]) !== null && l !== void 0 ? l : 1, 0, 1)
  8706. ];
  8707. }
  8708. function ae(n, e, t, l) {
  8709. const v = P(e, t), E = P(e, l);
  8710. return n.map((k2, B2) => k2 / v[B2] * E[B2]);
  8711. }
  8712. function Ze2(n, e, t) {
  8713. const l = ae(n, e.mode, e.type, "int"), v = x[e.mode][t.mode](...l);
  8714. return ae(v, t.mode, "int", t.type);
  8715. }
  8716. function We(n, e) {
  8717. return typeof n != "object" || _(n) ? false : e in n && typeof n[e] == "number";
  8718. }
  8719. class ne {
  8720. static black(e = "int") {
  8721. return new ne([0, 0, 0], "rgb", e);
  8722. }
  8723. static fromObject(e, t = "int") {
  8724. const l = "a" in e ? [e.r, e.g, e.b, e.a] : [e.r, e.g, e.b];
  8725. return new ne(l, "rgb", t);
  8726. }
  8727. static toRgbaObject(e, t = "int") {
  8728. return e.toRgbaObject(t);
  8729. }
  8730. static isRgbColorObject(e) {
  8731. return We(e, "r") && We(e, "g") && We(e, "b");
  8732. }
  8733. static isRgbaColorObject(e) {
  8734. return this.isRgbColorObject(e) && We(e, "a");
  8735. }
  8736. static isColorObject(e) {
  8737. return this.isRgbColorObject(e);
  8738. }
  8739. static equals(e, t) {
  8740. if (e.mode !== t.mode)
  8741. return false;
  8742. const l = e.comps_, v = t.comps_;
  8743. for (let E = 0; E < l.length; E++)
  8744. if (l[E] !== v[E])
  8745. return false;
  8746. return true;
  8747. }
  8748. constructor(e, t, l = "int") {
  8749. this.mode = t, this.type = l, this.comps_ = z(e, t, l);
  8750. }
  8751. getComponents(e, t = "int") {
  8752. return f2(Ze2(p(this.comps_), { mode: this.mode, type: this.type }, { mode: e ?? this.mode, type: t }), this.comps_[3]);
  8753. }
  8754. toRgbaObject(e = "int") {
  8755. const t = this.getComponents("rgb", e);
  8756. return {
  8757. r: t[0],
  8758. g: t[1],
  8759. b: t[2],
  8760. a: t[3]
  8761. };
  8762. }
  8763. }
  8764. const Mt = D("colp");
  8765. class Lr {
  8766. constructor(e, t) {
  8767. this.alphaViews_ = null, this.element = e.createElement("div"), this.element.classList.add(Mt()), t.viewProps.bindClassModifiers(this.element);
  8768. const l = e.createElement("div");
  8769. l.classList.add(Mt("hsv"));
  8770. const v = e.createElement("div");
  8771. v.classList.add(Mt("sv")), this.svPaletteView_ = t.svPaletteView, v.appendChild(this.svPaletteView_.element), l.appendChild(v);
  8772. const E = e.createElement("div");
  8773. E.classList.add(Mt("h")), this.hPaletteView_ = t.hPaletteView, E.appendChild(this.hPaletteView_.element), l.appendChild(E), this.element.appendChild(l);
  8774. const k2 = e.createElement("div");
  8775. if (k2.classList.add(Mt("rgb")), this.textView_ = t.textView, k2.appendChild(this.textView_.element), this.element.appendChild(k2), t.alphaViews) {
  8776. this.alphaViews_ = {
  8777. palette: t.alphaViews.palette,
  8778. text: t.alphaViews.text
  8779. };
  8780. const B2 = e.createElement("div");
  8781. B2.classList.add(Mt("a"));
  8782. const Q = e.createElement("div");
  8783. Q.classList.add(Mt("ap")), Q.appendChild(this.alphaViews_.palette.element), B2.appendChild(Q);
  8784. const J = e.createElement("div");
  8785. J.classList.add(Mt("at")), J.appendChild(this.alphaViews_.text.element), B2.appendChild(J), this.element.appendChild(B2);
  8786. }
  8787. }
  8788. get allFocusableElements() {
  8789. const e = [
  8790. this.svPaletteView_.element,
  8791. this.hPaletteView_.element,
  8792. this.textView_.modeSelectElement,
  8793. ...this.textView_.textViews.map((t) => t.inputElement)
  8794. ];
  8795. return this.alphaViews_ && e.push(this.alphaViews_.palette.element, this.alphaViews_.text.inputElement), e;
  8796. }
  8797. }
  8798. function rl(n) {
  8799. return n === "int" ? "int" : n === "float" ? "float" : void 0;
  8800. }
  8801. function Rr(n) {
  8802. const e = M;
  8803. return ce2(n, {
  8804. alpha: e.optional.boolean,
  8805. color: e.optional.object({
  8806. alpha: e.optional.boolean,
  8807. type: e.optional.custom(rl)
  8808. }),
  8809. expanded: e.optional.boolean,
  8810. picker: e.optional.custom(Fi)
  8811. });
  8812. }
  8813. function kn(n) {
  8814. return n ? 0.1 : 1;
  8815. }
  8816. function Mn(n) {
  8817. var e;
  8818. return (e = n.color) === null || e === void 0 ? void 0 : e.type;
  8819. }
  8820. function ol(n, e) {
  8821. return n.alpha === e.alpha && n.mode === e.mode && n.notation === e.notation && n.type === e.type;
  8822. }
  8823. function ht(n, e) {
  8824. const t = n.match(/^(.+)%$/);
  8825. return Math.min(t ? parseFloat(t[1]) * 0.01 * e : parseFloat(n), e);
  8826. }
  8827. const al = {
  8828. deg: (n) => n,
  8829. grad: (n) => n * 360 / 400,
  8830. rad: (n) => n * 360 / (2 * Math.PI),
  8831. turn: (n) => n * 360
  8832. };
  8833. function yo(n) {
  8834. const e = n.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);
  8835. if (!e)
  8836. return parseFloat(n);
  8837. const t = parseFloat(e[1]), l = e[2];
  8838. return al[l](t);
  8839. }
  8840. function xo(n) {
  8841. const e = n.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8842. if (!e)
  8843. return null;
  8844. const t = [
  8845. ht(e[1], 255),
  8846. ht(e[2], 255),
  8847. ht(e[3], 255)
  8848. ];
  8849. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8850. }
  8851. function Eo(n) {
  8852. return (e) => {
  8853. const t = xo(e);
  8854. return t ? new ne(t, "rgb", n) : null;
  8855. };
  8856. }
  8857. function Co(n) {
  8858. const e = n.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8859. if (!e)
  8860. return null;
  8861. const t = [
  8862. ht(e[1], 255),
  8863. ht(e[2], 255),
  8864. ht(e[3], 255),
  8865. ht(e[4], 1)
  8866. ];
  8867. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8868. }
  8869. function Po(n) {
  8870. return (e) => {
  8871. const t = Co(e);
  8872. return t ? new ne(t, "rgb", n) : null;
  8873. };
  8874. }
  8875. function To(n) {
  8876. const e = n.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8877. if (!e)
  8878. return null;
  8879. const t = [
  8880. yo(e[1]),
  8881. ht(e[2], 100),
  8882. ht(e[3], 100)
  8883. ];
  8884. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8885. }
  8886. function ko(n) {
  8887. return (e) => {
  8888. const t = To(e);
  8889. return t ? new ne(t, "hsl", n) : null;
  8890. };
  8891. }
  8892. function Mo(n) {
  8893. const e = n.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8894. if (!e)
  8895. return null;
  8896. const t = [
  8897. yo(e[1]),
  8898. ht(e[2], 100),
  8899. ht(e[3], 100),
  8900. ht(e[4], 1)
  8901. ];
  8902. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8903. }
  8904. function So(n) {
  8905. return (e) => {
  8906. const t = Mo(e);
  8907. return t ? new ne(t, "hsl", n) : null;
  8908. };
  8909. }
  8910. function Ao(n) {
  8911. const e = n.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8912. if (e)
  8913. return [
  8914. parseInt(e[1] + e[1], 16),
  8915. parseInt(e[2] + e[2], 16),
  8916. parseInt(e[3] + e[3], 16)
  8917. ];
  8918. const t = n.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8919. return t ? [
  8920. parseInt(t[1], 16),
  8921. parseInt(t[2], 16),
  8922. parseInt(t[3], 16)
  8923. ] : null;
  8924. }
  8925. function ll(n) {
  8926. const e = Ao(n);
  8927. return e ? new ne(e, "rgb", "int") : null;
  8928. }
  8929. function Lo(n) {
  8930. const e = n.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8931. if (e)
  8932. return [
  8933. parseInt(e[1] + e[1], 16),
  8934. parseInt(e[2] + e[2], 16),
  8935. parseInt(e[3] + e[3], 16),
  8936. we(parseInt(e[4] + e[4], 16), 0, 255, 0, 1)
  8937. ];
  8938. const t = n.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8939. return t ? [
  8940. parseInt(t[1], 16),
  8941. parseInt(t[2], 16),
  8942. parseInt(t[3], 16),
  8943. we(parseInt(t[4], 16), 0, 255, 0, 1)
  8944. ] : null;
  8945. }
  8946. function cl(n) {
  8947. const e = Lo(n);
  8948. return e ? new ne(e, "rgb", "int") : null;
  8949. }
  8950. function Ro(n) {
  8951. const e = n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8952. if (!e)
  8953. return null;
  8954. const t = [
  8955. parseFloat(e[1]),
  8956. parseFloat(e[2]),
  8957. parseFloat(e[3])
  8958. ];
  8959. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8960. }
  8961. function Io(n) {
  8962. return (e) => {
  8963. const t = Ro(e);
  8964. return t ? new ne(t, "rgb", n) : null;
  8965. };
  8966. }
  8967. function Vo(n) {
  8968. const e = n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8969. if (!e)
  8970. return null;
  8971. const t = [
  8972. parseFloat(e[1]),
  8973. parseFloat(e[2]),
  8974. parseFloat(e[3]),
  8975. parseFloat(e[4])
  8976. ];
  8977. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8978. }
  8979. function Do(n) {
  8980. return (e) => {
  8981. const t = Vo(e);
  8982. return t ? new ne(t, "rgb", n) : null;
  8983. };
  8984. }
  8985. const pl = [
  8986. {
  8987. parser: Ao,
  8988. result: {
  8989. alpha: false,
  8990. mode: "rgb",
  8991. notation: "hex"
  8992. }
  8993. },
  8994. {
  8995. parser: Lo,
  8996. result: {
  8997. alpha: true,
  8998. mode: "rgb",
  8999. notation: "hex"
  9000. }
  9001. },
  9002. {
  9003. parser: xo,
  9004. result: {
  9005. alpha: false,
  9006. mode: "rgb",
  9007. notation: "func"
  9008. }
  9009. },
  9010. {
  9011. parser: Co,
  9012. result: {
  9013. alpha: true,
  9014. mode: "rgb",
  9015. notation: "func"
  9016. }
  9017. },
  9018. {
  9019. parser: To,
  9020. result: {
  9021. alpha: false,
  9022. mode: "hsl",
  9023. notation: "func"
  9024. }
  9025. },
  9026. {
  9027. parser: Mo,
  9028. result: {
  9029. alpha: true,
  9030. mode: "hsl",
  9031. notation: "func"
  9032. }
  9033. },
  9034. {
  9035. parser: Ro,
  9036. result: {
  9037. alpha: false,
  9038. mode: "rgb",
  9039. notation: "object"
  9040. }
  9041. },
  9042. {
  9043. parser: Vo,
  9044. result: {
  9045. alpha: true,
  9046. mode: "rgb",
  9047. notation: "object"
  9048. }
  9049. }
  9050. ];
  9051. function ul(n) {
  9052. return pl.reduce((e, { parser: t, result: l }) => e || (t(n) ? l : null), null);
  9053. }
  9054. function Ir(n, e = "int") {
  9055. const t = ul(n);
  9056. return t ? t.notation === "hex" && e !== "float" ? Object.assign(Object.assign({}, t), { type: "int" }) : t.notation === "func" ? Object.assign(Object.assign({}, t), { type: e }) : null : null;
  9057. }
  9058. const Oo = {
  9059. int: [
  9060. ll,
  9061. cl,
  9062. Eo("int"),
  9063. Po("int"),
  9064. ko("int"),
  9065. So("int"),
  9066. Io("int"),
  9067. Do("int")
  9068. ],
  9069. float: [
  9070. Eo("float"),
  9071. Po("float"),
  9072. ko("float"),
  9073. So("float"),
  9074. Io("float"),
  9075. Do("float")
  9076. ]
  9077. };
  9078. function hl(n) {
  9079. const e = Oo[n];
  9080. return (t) => {
  9081. if (typeof t != "string")
  9082. return ne.black(n);
  9083. const l = e.reduce((v, E) => v || E(t), null);
  9084. return l ?? ne.black(n);
  9085. };
  9086. }
  9087. function Vr(n) {
  9088. const e = Oo[n];
  9089. return (t) => e.reduce((l, v) => l || v(t), null);
  9090. }
  9091. function No(n) {
  9092. const e = Ae(Math.floor(n), 0, 255).toString(16);
  9093. return e.length === 1 ? `0${e}` : e;
  9094. }
  9095. function Fo(n, e = "#") {
  9096. const t = p(n.getComponents("rgb")).map(No).join("");
  9097. return `${e}${t}`;
  9098. }
  9099. function Dr(n, e = "#") {
  9100. const t = n.getComponents("rgb"), l = [t[0], t[1], t[2], t[3] * 255].map(No).join("");
  9101. return `${e}${l}`;
  9102. }
  9103. function Bo(n, e) {
  9104. const t = Ie(e === "float" ? 2 : 0);
  9105. return `rgb(${p(n.getComponents("rgb", e)).map((v) => t(v)).join(", ")})`;
  9106. }
  9107. function dl(n) {
  9108. return (e) => Bo(e, n);
  9109. }
  9110. function Ls(n, e) {
  9111. const t = Ie(2), l = Ie(e === "float" ? 2 : 0);
  9112. return `rgba(${n.getComponents("rgb", e).map((E, k2) => (k2 === 3 ? t : l)(E)).join(", ")})`;
  9113. }
  9114. function ml(n) {
  9115. return (e) => Ls(e, n);
  9116. }
  9117. function fl(n) {
  9118. const e = [
  9119. Ie(0),
  9120. wn,
  9121. wn
  9122. ];
  9123. return `hsl(${p(n.getComponents("hsl")).map((l, v) => e[v](l)).join(", ")})`;
  9124. }
  9125. function vl(n) {
  9126. const e = [
  9127. Ie(0),
  9128. wn,
  9129. wn,
  9130. Ie(2)
  9131. ];
  9132. return `hsla(${n.getComponents("hsl").map((l, v) => e[v](l)).join(", ")})`;
  9133. }
  9134. function jo(n, e) {
  9135. const t = Ie(e === "float" ? 2 : 0), l = ["r", "g", "b"];
  9136. return `{${p(n.getComponents("rgb", e)).map((E, k2) => `${l[k2]}: ${t(E)}`).join(", ")}}`;
  9137. }
  9138. function bl(n) {
  9139. return (e) => jo(e, n);
  9140. }
  9141. function zo(n, e) {
  9142. const t = Ie(2), l = Ie(e === "float" ? 2 : 0), v = ["r", "g", "b", "a"];
  9143. return `{${n.getComponents("rgb", e).map((k2, B2) => {
  9144. const Q = B2 === 3 ? t : l;
  9145. return `${v[B2]}: ${Q(k2)}`;
  9146. }).join(", ")}}`;
  9147. }
  9148. function gl(n) {
  9149. return (e) => zo(e, n);
  9150. }
  9151. const _l = [
  9152. {
  9153. format: {
  9154. alpha: false,
  9155. mode: "rgb",
  9156. notation: "hex",
  9157. type: "int"
  9158. },
  9159. stringifier: Fo
  9160. },
  9161. {
  9162. format: {
  9163. alpha: true,
  9164. mode: "rgb",
  9165. notation: "hex",
  9166. type: "int"
  9167. },
  9168. stringifier: Dr
  9169. },
  9170. {
  9171. format: {
  9172. alpha: false,
  9173. mode: "hsl",
  9174. notation: "func",
  9175. type: "int"
  9176. },
  9177. stringifier: fl
  9178. },
  9179. {
  9180. format: {
  9181. alpha: true,
  9182. mode: "hsl",
  9183. notation: "func",
  9184. type: "int"
  9185. },
  9186. stringifier: vl
  9187. },
  9188. ...["int", "float"].reduce((n, e) => [
  9189. ...n,
  9190. {
  9191. format: {
  9192. alpha: false,
  9193. mode: "rgb",
  9194. notation: "func",
  9195. type: e
  9196. },
  9197. stringifier: dl(e)
  9198. },
  9199. {
  9200. format: {
  9201. alpha: true,
  9202. mode: "rgb",
  9203. notation: "func",
  9204. type: e
  9205. },
  9206. stringifier: ml(e)
  9207. },
  9208. {
  9209. format: {
  9210. alpha: false,
  9211. mode: "rgb",
  9212. notation: "object",
  9213. type: e
  9214. },
  9215. stringifier: bl(e)
  9216. },
  9217. {
  9218. format: {
  9219. alpha: true,
  9220. mode: "rgb",
  9221. notation: "object",
  9222. type: e
  9223. },
  9224. stringifier: gl(e)
  9225. }
  9226. ], [])
  9227. ];
  9228. function Or(n) {
  9229. return _l.reduce((e, t) => e || (ol(t.format, n) ? t.stringifier : null), null);
  9230. }
  9231. const zi = D("apl");
  9232. class wl {
  9233. constructor(e, t) {
  9234. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(zi()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  9235. const l = e.createElement("div");
  9236. l.classList.add(zi("b")), this.element.appendChild(l);
  9237. const v = e.createElement("div");
  9238. v.classList.add(zi("c")), l.appendChild(v), this.colorElem_ = v;
  9239. const E = e.createElement("div");
  9240. E.classList.add(zi("m")), this.element.appendChild(E), this.markerElem_ = E;
  9241. const k2 = e.createElement("div");
  9242. k2.classList.add(zi("p")), this.markerElem_.appendChild(k2), this.previewElem_ = k2, this.update_();
  9243. }
  9244. update_() {
  9245. const e = this.value.rawValue, t = e.getComponents("rgb"), l = new ne([t[0], t[1], t[2], 0], "rgb"), v = new ne([t[0], t[1], t[2], 255], "rgb"), E = [
  9246. "to right",
  9247. Ls(l),
  9248. Ls(v)
  9249. ];
  9250. this.colorElem_.style.background = `linear-gradient(${E.join(",")})`, this.previewElem_.style.backgroundColor = Ls(e);
  9251. const k2 = we(t[3], 0, 1, 0, 100);
  9252. this.markerElem_.style.left = `${k2}%`;
  9253. }
  9254. onValueChange_() {
  9255. this.update_();
  9256. }
  9257. }
  9258. class yl {
  9259. constructor(e, t) {
  9260. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new wl(e, {
  9261. value: this.value,
  9262. viewProps: this.viewProps
  9263. }), this.ptHandler_ = new Ot(this.view.element), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_);
  9264. }
  9265. handlePointerEvent_(e, t) {
  9266. if (!e.point)
  9267. return;
  9268. const l = e.point.x / e.bounds.width, v = this.value.rawValue, [E, k2, B2] = v.getComponents("hsv");
  9269. this.value.setRawValue(new ne([E, k2, B2, l], "hsv"), t);
  9270. }
  9271. onPointerDown_(e) {
  9272. this.handlePointerEvent_(e.data, {
  9273. forceEmit: false,
  9274. last: false
  9275. });
  9276. }
  9277. onPointerMove_(e) {
  9278. this.handlePointerEvent_(e.data, {
  9279. forceEmit: false,
  9280. last: false
  9281. });
  9282. }
  9283. onPointerUp_(e) {
  9284. this.handlePointerEvent_(e.data, {
  9285. forceEmit: true,
  9286. last: true
  9287. });
  9288. }
  9289. onKeyDown_(e) {
  9290. const t = Ne2(kn(true), ut2(e));
  9291. if (t === 0)
  9292. return;
  9293. const l = this.value.rawValue, [v, E, k2, B2] = l.getComponents("hsv");
  9294. this.value.setRawValue(new ne([v, E, k2, B2 + t], "hsv"), {
  9295. forceEmit: false,
  9296. last: false
  9297. });
  9298. }
  9299. onKeyUp_(e) {
  9300. Ne2(kn(true), ut2(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  9301. forceEmit: true,
  9302. last: true
  9303. });
  9304. }
  9305. }
  9306. const ri = D("coltxt");
  9307. function xl(n) {
  9308. const e = n.createElement("select"), t = [
  9309. { text: "RGB", value: "rgb" },
  9310. { text: "HSL", value: "hsl" },
  9311. { text: "HSV", value: "hsv" }
  9312. ];
  9313. return e.appendChild(t.reduce((l, v) => {
  9314. const E = n.createElement("option");
  9315. return E.textContent = v.text, E.value = v.value, l.appendChild(E), l;
  9316. }, n.createDocumentFragment())), e;
  9317. }
  9318. class El {
  9319. constructor(e, t) {
  9320. this.element = e.createElement("div"), this.element.classList.add(ri()), t.viewProps.bindClassModifiers(this.element);
  9321. const l = e.createElement("div");
  9322. l.classList.add(ri("m")), this.modeElem_ = xl(e), this.modeElem_.classList.add(ri("ms")), l.appendChild(this.modeSelectElement), t.viewProps.bindDisabled(this.modeElem_);
  9323. const v = e.createElement("div");
  9324. v.classList.add(ri("mm")), v.appendChild(Ct(e, "dropdown")), l.appendChild(v), this.element.appendChild(l);
  9325. const E = e.createElement("div");
  9326. E.classList.add(ri("w")), this.element.appendChild(E), this.textsElem_ = E, this.textViews_ = t.textViews, this.applyTextViews_(), N(t.colorMode, (k2) => {
  9327. this.modeElem_.value = k2;
  9328. });
  9329. }
  9330. get modeSelectElement() {
  9331. return this.modeElem_;
  9332. }
  9333. get textViews() {
  9334. return this.textViews_;
  9335. }
  9336. set textViews(e) {
  9337. this.textViews_ = e, this.applyTextViews_();
  9338. }
  9339. applyTextViews_() {
  9340. pn(this.textsElem_);
  9341. const e = this.element.ownerDocument;
  9342. this.textViews_.forEach((t) => {
  9343. const l = e.createElement("div");
  9344. l.classList.add(ri("c")), l.appendChild(t.element), this.textsElem_.appendChild(l);
  9345. });
  9346. }
  9347. }
  9348. function Cl(n) {
  9349. return Ie(n === "float" ? 2 : 0);
  9350. }
  9351. function Pl(n, e, t) {
  9352. const l = P(n, e)[t];
  9353. return new qt({
  9354. min: 0,
  9355. max: l
  9356. });
  9357. }
  9358. function Nr(n, e, t) {
  9359. return new xn(n, {
  9360. arrayPosition: t === 0 ? "fst" : t === 3 - 1 ? "lst" : "mid",
  9361. baseStep: kn(false),
  9362. parser: e.parser,
  9363. props: X.fromObject({
  9364. draggingScale: e.colorType === "float" ? 0.01 : 1,
  9365. formatter: Cl(e.colorType)
  9366. }),
  9367. value: ee2(0, {
  9368. constraint: Pl(e.colorMode, e.colorType, t)
  9369. }),
  9370. viewProps: e.viewProps
  9371. });
  9372. }
  9373. class Tl {
  9374. constructor(e, t) {
  9375. this.onModeSelectChange_ = this.onModeSelectChange_.bind(this), this.colorType_ = t.colorType, this.parser_ = t.parser, this.value = t.value, this.viewProps = t.viewProps, this.colorMode = ee2(this.value.rawValue.mode), this.ccs_ = this.createComponentControllers_(e), this.view = new El(e, {
  9376. colorMode: this.colorMode,
  9377. textViews: [this.ccs_[0].view, this.ccs_[1].view, this.ccs_[2].view],
  9378. viewProps: this.viewProps
  9379. }), this.view.modeSelectElement.addEventListener("change", this.onModeSelectChange_);
  9380. }
  9381. createComponentControllers_(e) {
  9382. const t = {
  9383. colorMode: this.colorMode.rawValue,
  9384. colorType: this.colorType_,
  9385. parser: this.parser_,
  9386. viewProps: this.viewProps
  9387. }, l = [
  9388. Nr(e, t, 0),
  9389. Nr(e, t, 1),
  9390. Nr(e, t, 2)
  9391. ];
  9392. return l.forEach((v, E) => {
  9393. Zt({
  9394. primary: this.value,
  9395. secondary: v.value,
  9396. forward: (k2) => k2.rawValue.getComponents(this.colorMode.rawValue, this.colorType_)[E],
  9397. backward: (k2, B2) => {
  9398. const Q = this.colorMode.rawValue, J = k2.rawValue.getComponents(Q, this.colorType_);
  9399. return J[E] = B2.rawValue, new ne(f2(p(J), J[3]), Q, this.colorType_);
  9400. }
  9401. });
  9402. }), l;
  9403. }
  9404. onModeSelectChange_(e) {
  9405. const t = e.currentTarget;
  9406. this.colorMode.rawValue = t.value, this.ccs_ = this.createComponentControllers_(this.view.element.ownerDocument), this.view.textViews = [
  9407. this.ccs_[0].view,
  9408. this.ccs_[1].view,
  9409. this.ccs_[2].view
  9410. ];
  9411. }
  9412. }
  9413. const Fr = D("hpl");
  9414. class kl {
  9415. constructor(e, t) {
  9416. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(Fr()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  9417. const l = e.createElement("div");
  9418. l.classList.add(Fr("c")), this.element.appendChild(l);
  9419. const v = e.createElement("div");
  9420. v.classList.add(Fr("m")), this.element.appendChild(v), this.markerElem_ = v, this.update_();
  9421. }
  9422. update_() {
  9423. const e = this.value.rawValue, [t] = e.getComponents("hsv");
  9424. this.markerElem_.style.backgroundColor = Bo(new ne([t, 100, 100], "hsv"));
  9425. const l = we(t, 0, 360, 0, 100);
  9426. this.markerElem_.style.left = `${l}%`;
  9427. }
  9428. onValueChange_() {
  9429. this.update_();
  9430. }
  9431. }
  9432. class Ml {
  9433. constructor(e, t) {
  9434. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new kl(e, {
  9435. value: this.value,
  9436. viewProps: this.viewProps
  9437. }), this.ptHandler_ = new Ot(this.view.element), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_);
  9438. }
  9439. handlePointerEvent_(e, t) {
  9440. if (!e.point)
  9441. return;
  9442. const l = we(Ae(e.point.x, 0, e.bounds.width), 0, e.bounds.width, 0, 360), v = this.value.rawValue, [, E, k2, B2] = v.getComponents("hsv");
  9443. this.value.setRawValue(new ne([l, E, k2, B2], "hsv"), t);
  9444. }
  9445. onPointerDown_(e) {
  9446. this.handlePointerEvent_(e.data, {
  9447. forceEmit: false,
  9448. last: false
  9449. });
  9450. }
  9451. onPointerMove_(e) {
  9452. this.handlePointerEvent_(e.data, {
  9453. forceEmit: false,
  9454. last: false
  9455. });
  9456. }
  9457. onPointerUp_(e) {
  9458. this.handlePointerEvent_(e.data, {
  9459. forceEmit: true,
  9460. last: true
  9461. });
  9462. }
  9463. onKeyDown_(e) {
  9464. const t = Ne2(kn(false), ut2(e));
  9465. if (t === 0)
  9466. return;
  9467. const l = this.value.rawValue, [v, E, k2, B2] = l.getComponents("hsv");
  9468. this.value.setRawValue(new ne([v + t, E, k2, B2], "hsv"), {
  9469. forceEmit: false,
  9470. last: false
  9471. });
  9472. }
  9473. onKeyUp_(e) {
  9474. Ne2(kn(false), ut2(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  9475. forceEmit: true,
  9476. last: true
  9477. });
  9478. }
  9479. }
  9480. const Br = D("svp"), Uo = 64;
  9481. class Sl {
  9482. constructor(e, t) {
  9483. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(Br()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  9484. const l = e.createElement("canvas");
  9485. l.height = Uo, l.width = Uo, l.classList.add(Br("c")), this.element.appendChild(l), this.canvasElement = l;
  9486. const v = e.createElement("div");
  9487. v.classList.add(Br("m")), this.element.appendChild(v), this.markerElem_ = v, this.update_();
  9488. }
  9489. update_() {
  9490. const e = Hn(this.canvasElement);
  9491. if (!e)
  9492. return;
  9493. const l = this.value.rawValue.getComponents("hsv"), v = this.canvasElement.width, E = this.canvasElement.height, k2 = e.getImageData(0, 0, v, E), B2 = k2.data;
  9494. for (let me2 = 0; me2 < E; me2++)
  9495. for (let be = 0; be < v; be++) {
  9496. const Sn = we(be, 0, v, 0, 100), Gi = we(me2, 0, E, 100, 0), Hi = As(l[0], Sn, Gi), Rs = (me2 * v + be) * 4;
  9497. B2[Rs] = Hi[0], B2[Rs + 1] = Hi[1], B2[Rs + 2] = Hi[2], B2[Rs + 3] = 255;
  9498. }
  9499. e.putImageData(k2, 0, 0);
  9500. const Q = we(l[1], 0, 100, 0, 100);
  9501. this.markerElem_.style.left = `${Q}%`;
  9502. const J = we(l[2], 0, 100, 100, 0);
  9503. this.markerElem_.style.top = `${J}%`;
  9504. }
  9505. onValueChange_() {
  9506. this.update_();
  9507. }
  9508. }
  9509. class Al {
  9510. constructor(e, t) {
  9511. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new Sl(e, {
  9512. value: this.value,
  9513. viewProps: this.viewProps
  9514. }), this.ptHandler_ = new Ot(this.view.element), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_);
  9515. }
  9516. handlePointerEvent_(e, t) {
  9517. if (!e.point)
  9518. return;
  9519. const l = we(e.point.x, 0, e.bounds.width, 0, 100), v = we(e.point.y, 0, e.bounds.height, 100, 0), [E, , , k2] = this.value.rawValue.getComponents("hsv");
  9520. this.value.setRawValue(new ne([E, l, v, k2], "hsv"), t);
  9521. }
  9522. onPointerDown_(e) {
  9523. this.handlePointerEvent_(e.data, {
  9524. forceEmit: false,
  9525. last: false
  9526. });
  9527. }
  9528. onPointerMove_(e) {
  9529. this.handlePointerEvent_(e.data, {
  9530. forceEmit: false,
  9531. last: false
  9532. });
  9533. }
  9534. onPointerUp_(e) {
  9535. this.handlePointerEvent_(e.data, {
  9536. forceEmit: true,
  9537. last: true
  9538. });
  9539. }
  9540. onKeyDown_(e) {
  9541. ti(e.key) && e.preventDefault();
  9542. const [t, l, v, E] = this.value.rawValue.getComponents("hsv"), k2 = kn(false), B2 = Ne2(k2, ut2(e)), Q = Ne2(k2, yn(e));
  9543. B2 === 0 && Q === 0 || this.value.setRawValue(new ne([t, l + B2, v + Q, E], "hsv"), {
  9544. forceEmit: false,
  9545. last: false
  9546. });
  9547. }
  9548. onKeyUp_(e) {
  9549. const t = kn(false), l = Ne2(t, ut2(e)), v = Ne2(t, yn(e));
  9550. l === 0 && v === 0 || this.value.setRawValue(this.value.rawValue, {
  9551. forceEmit: true,
  9552. last: true
  9553. });
  9554. }
  9555. }
  9556. class Ll {
  9557. constructor(e, t) {
  9558. this.value = t.value, this.viewProps = t.viewProps, this.hPaletteC_ = new Ml(e, {
  9559. value: this.value,
  9560. viewProps: this.viewProps
  9561. }), this.svPaletteC_ = new Al(e, {
  9562. value: this.value,
  9563. viewProps: this.viewProps
  9564. }), this.alphaIcs_ = t.supportsAlpha ? {
  9565. palette: new yl(e, {
  9566. value: this.value,
  9567. viewProps: this.viewProps
  9568. }),
  9569. text: new xn(e, {
  9570. parser: pt,
  9571. baseStep: 0.1,
  9572. props: X.fromObject({
  9573. draggingScale: 0.01,
  9574. formatter: Ie(2)
  9575. }),
  9576. value: ee2(0, {
  9577. constraint: new qt({ min: 0, max: 1 })
  9578. }),
  9579. viewProps: this.viewProps
  9580. })
  9581. } : null, this.alphaIcs_ && Zt({
  9582. primary: this.value,
  9583. secondary: this.alphaIcs_.text.value,
  9584. forward: (l) => l.rawValue.getComponents()[3],
  9585. backward: (l, v) => {
  9586. const E = l.rawValue.getComponents();
  9587. return E[3] = v.rawValue, new ne(E, l.rawValue.mode);
  9588. }
  9589. }), this.textC_ = new Tl(e, {
  9590. colorType: t.colorType,
  9591. parser: pt,
  9592. value: this.value,
  9593. viewProps: this.viewProps
  9594. }), this.view = new Lr(e, {
  9595. alphaViews: this.alphaIcs_ ? {
  9596. palette: this.alphaIcs_.palette.view,
  9597. text: this.alphaIcs_.text.view
  9598. } : null,
  9599. hPaletteView: this.hPaletteC_.view,
  9600. supportsAlpha: t.supportsAlpha,
  9601. svPaletteView: this.svPaletteC_.view,
  9602. textView: this.textC_.view,
  9603. viewProps: this.viewProps
  9604. });
  9605. }
  9606. get textController() {
  9607. return this.textC_;
  9608. }
  9609. }
  9610. const jr = D("colsw");
  9611. class Rl {
  9612. constructor(e, t) {
  9613. this.onValueChange_ = this.onValueChange_.bind(this), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.element = e.createElement("div"), this.element.classList.add(jr()), t.viewProps.bindClassModifiers(this.element);
  9614. const l = e.createElement("div");
  9615. l.classList.add(jr("sw")), this.element.appendChild(l), this.swatchElem_ = l;
  9616. const v = e.createElement("button");
  9617. v.classList.add(jr("b")), t.viewProps.bindDisabled(v), this.element.appendChild(v), this.buttonElement = v, this.update_();
  9618. }
  9619. update_() {
  9620. const e = this.value.rawValue;
  9621. this.swatchElem_.style.backgroundColor = Dr(e);
  9622. }
  9623. onValueChange_() {
  9624. this.update_();
  9625. }
  9626. }
  9627. class Il {
  9628. constructor(e, t) {
  9629. this.value = t.value, this.viewProps = t.viewProps, this.view = new Rl(e, {
  9630. value: this.value,
  9631. viewProps: this.viewProps
  9632. });
  9633. }
  9634. }
  9635. class zr {
  9636. constructor(e, t) {
  9637. this.onButtonBlur_ = this.onButtonBlur_.bind(this), this.onButtonClick_ = this.onButtonClick_.bind(this), this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.foldable_ = Oe.create(t.expanded), this.swatchC_ = new Il(e, {
  9638. value: this.value,
  9639. viewProps: this.viewProps
  9640. });
  9641. const l = this.swatchC_.view.buttonElement;
  9642. l.addEventListener("blur", this.onButtonBlur_), l.addEventListener("click", this.onButtonClick_), this.textC_ = new Jn(e, {
  9643. parser: t.parser,
  9644. props: X.fromObject({
  9645. formatter: t.formatter
  9646. }),
  9647. value: this.value,
  9648. viewProps: this.viewProps
  9649. }), this.view = new ji(e, {
  9650. foldable: this.foldable_,
  9651. pickerLayout: t.pickerLayout
  9652. }), this.view.swatchElement.appendChild(this.swatchC_.view.element), this.view.textElement.appendChild(this.textC_.view.element), this.popC_ = t.pickerLayout === "popup" ? new ms(e, {
  9653. viewProps: this.viewProps
  9654. }) : null;
  9655. const v = new Ll(e, {
  9656. colorType: t.colorType,
  9657. supportsAlpha: t.supportsAlpha,
  9658. value: this.value,
  9659. viewProps: this.viewProps
  9660. });
  9661. v.view.allFocusableElements.forEach((E) => {
  9662. E.addEventListener("blur", this.onPopupChildBlur_), E.addEventListener("keydown", this.onPopupChildKeydown_);
  9663. }), this.pickerC_ = v, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(v.view.element), Zt({
  9664. primary: this.foldable_.value("expanded"),
  9665. secondary: this.popC_.shows,
  9666. forward: (E) => E.rawValue,
  9667. backward: (E, k2) => k2.rawValue
  9668. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ge(this.foldable_, this.view.pickerElement));
  9669. }
  9670. get textController() {
  9671. return this.textC_;
  9672. }
  9673. onButtonBlur_(e) {
  9674. if (!this.popC_)
  9675. return;
  9676. const t = this.view.element, l = e.relatedTarget;
  9677. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  9678. }
  9679. onButtonClick_() {
  9680. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  9681. }
  9682. onPopupChildBlur_(e) {
  9683. if (!this.popC_)
  9684. return;
  9685. const t = this.popC_.view.element, l = Pt(e);
  9686. l && t.contains(l) || l && l === this.swatchC_.view.buttonElement && !bt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  9687. }
  9688. onPopupChildKeydown_(e) {
  9689. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.swatchC_.view.buttonElement.focus();
  9690. }
  9691. }
  9692. function Vl(n, e) {
  9693. return ne.isColorObject(n) ? ne.fromObject(n, e) : ne.black(e);
  9694. }
  9695. function Dl(n) {
  9696. return p(n.getComponents("rgb")).reduce((e, t) => e << 8 | Math.floor(t) & 255, 0);
  9697. }
  9698. function Ol(n) {
  9699. return n.getComponents("rgb").reduce((e, t, l) => {
  9700. const v = Math.floor(l === 3 ? t * 255 : t) & 255;
  9701. return e << 8 | v;
  9702. }, 0) >>> 0;
  9703. }
  9704. function Nl(n) {
  9705. return new ne([n >> 16 & 255, n >> 8 & 255, n & 255], "rgb");
  9706. }
  9707. function Fl(n) {
  9708. return new ne([
  9709. n >> 24 & 255,
  9710. n >> 16 & 255,
  9711. n >> 8 & 255,
  9712. we(n & 255, 0, 255, 0, 1)
  9713. ], "rgb");
  9714. }
  9715. function Bl(n) {
  9716. return typeof n != "number" ? ne.black() : Nl(n);
  9717. }
  9718. function jl(n) {
  9719. return typeof n != "number" ? ne.black() : Fl(n);
  9720. }
  9721. function zl(n) {
  9722. const e = Or(n);
  9723. return e ? (t, l) => {
  9724. st2(t, e(l));
  9725. } : null;
  9726. }
  9727. function Ul(n) {
  9728. const e = n ? Ol : Dl;
  9729. return (t, l) => {
  9730. st2(t, e(l));
  9731. };
  9732. }
  9733. function Gl(n, e, t) {
  9734. const l = e.toRgbaObject(t);
  9735. n.writeProperty("r", l.r), n.writeProperty("g", l.g), n.writeProperty("b", l.b), n.writeProperty("a", l.a);
  9736. }
  9737. function Hl(n, e, t) {
  9738. const l = e.toRgbaObject(t);
  9739. n.writeProperty("r", l.r), n.writeProperty("g", l.g), n.writeProperty("b", l.b);
  9740. }
  9741. function Kl(n, e) {
  9742. return (t, l) => {
  9743. n ? Gl(t, l, e) : Hl(t, l, e);
  9744. };
  9745. }
  9746. function Ur(n) {
  9747. var e;
  9748. return !!(n != null && n.alpha || !((e = n == null ? void 0 : n.color) === null || e === void 0) && e.alpha);
  9749. }
  9750. function $l(n) {
  9751. return n ? (e) => Dr(e, "0x") : (e) => Fo(e, "0x");
  9752. }
  9753. function Xl(n) {
  9754. return "color" in n || "view" in n && n.view === "color";
  9755. }
  9756. const Yl = {
  9757. id: "input-color-number",
  9758. type: "input",
  9759. accept: (n, e) => {
  9760. if (typeof n != "number" || !Xl(e))
  9761. return null;
  9762. const t = Rr(e);
  9763. return t ? {
  9764. initialValue: n,
  9765. params: t
  9766. } : null;
  9767. },
  9768. binding: {
  9769. reader: (n) => Ur(n.params) ? jl : Bl,
  9770. equals: ne.equals,
  9771. writer: (n) => Ul(Ur(n.params))
  9772. },
  9773. controller: (n) => {
  9774. const e = Ur(n.params), t = "expanded" in n.params ? n.params.expanded : void 0, l = "picker" in n.params ? n.params.picker : void 0;
  9775. return new zr(n.document, {
  9776. colorType: "int",
  9777. expanded: t ?? false,
  9778. formatter: $l(e),
  9779. parser: Vr("int"),
  9780. pickerLayout: l ?? "popup",
  9781. supportsAlpha: e,
  9782. value: n.value,
  9783. viewProps: n.viewProps
  9784. });
  9785. }
  9786. };
  9787. function ql(n) {
  9788. return ne.isRgbaColorObject(n);
  9789. }
  9790. function Ql(n) {
  9791. return (e) => Vl(e, n);
  9792. }
  9793. function Zl(n, e) {
  9794. return (t) => n ? zo(t, e) : jo(t, e);
  9795. }
  9796. const Wl = {
  9797. id: "input-color-object",
  9798. type: "input",
  9799. accept: (n, e) => {
  9800. if (!ne.isColorObject(n))
  9801. return null;
  9802. const t = Rr(e);
  9803. return t ? {
  9804. initialValue: n,
  9805. params: t
  9806. } : null;
  9807. },
  9808. binding: {
  9809. reader: (n) => Ql(Mn(n.params)),
  9810. equals: ne.equals,
  9811. writer: (n) => Kl(ql(n.initialValue), Mn(n.params))
  9812. },
  9813. controller: (n) => {
  9814. var e;
  9815. const t = ne.isRgbaColorObject(n.initialValue), l = "expanded" in n.params ? n.params.expanded : void 0, v = "picker" in n.params ? n.params.picker : void 0, E = (e = Mn(n.params)) !== null && e !== void 0 ? e : "int";
  9816. return new zr(n.document, {
  9817. colorType: E,
  9818. expanded: l ?? false,
  9819. formatter: Zl(t, E),
  9820. parser: Vr(E),
  9821. pickerLayout: v ?? "popup",
  9822. supportsAlpha: t,
  9823. value: n.value,
  9824. viewProps: n.viewProps
  9825. });
  9826. }
  9827. }, Jl = {
  9828. id: "input-color-string",
  9829. type: "input",
  9830. accept: (n, e) => {
  9831. if (typeof n != "string" || "view" in e && e.view === "text")
  9832. return null;
  9833. const t = Ir(n, Mn(e));
  9834. if (!t || !Or(t))
  9835. return null;
  9836. const v = Rr(e);
  9837. return v ? {
  9838. initialValue: n,
  9839. params: v
  9840. } : null;
  9841. },
  9842. binding: {
  9843. reader: (n) => {
  9844. var e;
  9845. return hl((e = Mn(n.params)) !== null && e !== void 0 ? e : "int");
  9846. },
  9847. equals: ne.equals,
  9848. writer: (n) => {
  9849. const e = Ir(n.initialValue, Mn(n.params));
  9850. if (!e)
  9851. throw S2.shouldNeverHappen();
  9852. const t = zl(e);
  9853. if (!t)
  9854. throw S2.notBindable();
  9855. return t;
  9856. }
  9857. },
  9858. controller: (n) => {
  9859. const e = Ir(n.initialValue, Mn(n.params));
  9860. if (!e)
  9861. throw S2.shouldNeverHappen();
  9862. const t = Or(e);
  9863. if (!t)
  9864. throw S2.shouldNeverHappen();
  9865. const l = "expanded" in n.params ? n.params.expanded : void 0, v = "picker" in n.params ? n.params.picker : void 0;
  9866. return new zr(n.document, {
  9867. colorType: e.type,
  9868. expanded: l ?? false,
  9869. formatter: t,
  9870. parser: Vr(e.type),
  9871. pickerLayout: v ?? "popup",
  9872. supportsAlpha: e.alpha,
  9873. value: n.value,
  9874. viewProps: n.viewProps
  9875. });
  9876. }
  9877. };
  9878. class Jt {
  9879. constructor(e) {
  9880. this.components = e.components, this.asm_ = e.assembly;
  9881. }
  9882. constrain(e) {
  9883. const t = this.asm_.toComponents(e).map((l, v) => {
  9884. var E, k2;
  9885. return (k2 = (E = this.components[v]) === null || E === void 0 ? void 0 : E.constrain(l)) !== null && k2 !== void 0 ? k2 : l;
  9886. });
  9887. return this.asm_.fromComponents(t);
  9888. }
  9889. }
  9890. const Go = D("pndtxt");
  9891. class ec {
  9892. constructor(e, t) {
  9893. this.textViews = t.textViews, this.element = e.createElement("div"), this.element.classList.add(Go()), this.textViews.forEach((l) => {
  9894. const v = e.createElement("div");
  9895. v.classList.add(Go("a")), v.appendChild(l.element), this.element.appendChild(v);
  9896. });
  9897. }
  9898. }
  9899. function tc(n, e, t) {
  9900. return new xn(n, {
  9901. arrayPosition: t === 0 ? "fst" : t === e.axes.length - 1 ? "lst" : "mid",
  9902. baseStep: e.axes[t].baseStep,
  9903. parser: e.parser,
  9904. props: e.axes[t].textProps,
  9905. value: ee2(0, {
  9906. constraint: e.axes[t].constraint
  9907. }),
  9908. viewProps: e.viewProps
  9909. });
  9910. }
  9911. class Gr {
  9912. constructor(e, t) {
  9913. this.value = t.value, this.viewProps = t.viewProps, this.acs_ = t.axes.map((l, v) => tc(e, t, v)), this.acs_.forEach((l, v) => {
  9914. Zt({
  9915. primary: this.value,
  9916. secondary: l.value,
  9917. forward: (E) => t.assembly.toComponents(E.rawValue)[v],
  9918. backward: (E, k2) => {
  9919. const B2 = t.assembly.toComponents(E.rawValue);
  9920. return B2[v] = k2.rawValue, t.assembly.fromComponents(B2);
  9921. }
  9922. });
  9923. }), this.view = new ec(e, {
  9924. textViews: this.acs_.map((l) => l.view)
  9925. });
  9926. }
  9927. }
  9928. function Ho(n, e) {
  9929. return "step" in n && !_(n.step) ? new Wn(n.step, e) : null;
  9930. }
  9931. function Ko(n) {
  9932. return !_(n.max) && !_(n.min) ? new qt({
  9933. max: n.max,
  9934. min: n.min
  9935. }) : !_(n.max) || !_(n.min) ? new Pi({
  9936. max: n.max,
  9937. min: n.min
  9938. }) : null;
  9939. }
  9940. function nc(n) {
  9941. const e = it2(n, qt);
  9942. if (e)
  9943. return [e.values.get("min"), e.values.get("max")];
  9944. const t = it2(n, Pi);
  9945. return t ? [t.minValue, t.maxValue] : [void 0, void 0];
  9946. }
  9947. function ic(n, e) {
  9948. const t = [], l = Ho(n, e);
  9949. l && t.push(l);
  9950. const v = Ko(n);
  9951. v && t.push(v);
  9952. const E = Bi(n.options);
  9953. return E && t.push(E), new vn(t);
  9954. }
  9955. const sc = {
  9956. id: "input-number",
  9957. type: "input",
  9958. accept: (n, e) => {
  9959. if (typeof n != "number")
  9960. return null;
  9961. const t = M, l = ce2(e, {
  9962. format: t.optional.function,
  9963. max: t.optional.number,
  9964. min: t.optional.number,
  9965. options: t.optional.custom(Cn),
  9966. step: t.optional.number
  9967. });
  9968. return l ? {
  9969. initialValue: n,
  9970. params: l
  9971. } : null;
  9972. },
  9973. binding: {
  9974. reader: (n) => _t,
  9975. constraint: (n) => ic(n.params, n.initialValue),
  9976. writer: (n) => st2
  9977. },
  9978. controller: (n) => {
  9979. var e;
  9980. const t = n.value, l = n.constraint, v = l && it2(l, bn);
  9981. if (v)
  9982. return new gn(n.document, {
  9983. props: new X({
  9984. options: v.values.value("options")
  9985. }),
  9986. value: t,
  9987. viewProps: n.viewProps
  9988. });
  9989. const E = (e = "format" in n.params ? n.params.format : void 0) !== null && e !== void 0 ? e : Ie(ii(l, t.rawValue)), k2 = l && it2(l, qt);
  9990. return k2 ? new ni(n.document, {
  9991. baseStep: Nt(l),
  9992. parser: pt,
  9993. sliderProps: new X({
  9994. maxValue: k2.values.value("max"),
  9995. minValue: k2.values.value("min")
  9996. }),
  9997. textProps: X.fromObject({
  9998. draggingScale: Ft(l, t.rawValue),
  9999. formatter: E
  10000. }),
  10001. value: t,
  10002. viewProps: n.viewProps
  10003. }) : new xn(n.document, {
  10004. baseStep: Nt(l),
  10005. parser: pt,
  10006. props: X.fromObject({
  10007. draggingScale: Ft(l, t.rawValue),
  10008. formatter: E
  10009. }),
  10010. value: t,
  10011. viewProps: n.viewProps
  10012. });
  10013. }
  10014. };
  10015. class en {
  10016. constructor(e = 0, t = 0) {
  10017. this.x = e, this.y = t;
  10018. }
  10019. getComponents() {
  10020. return [this.x, this.y];
  10021. }
  10022. static isObject(e) {
  10023. if (_(e))
  10024. return false;
  10025. const t = e.x, l = e.y;
  10026. return !(typeof t != "number" || typeof l != "number");
  10027. }
  10028. static equals(e, t) {
  10029. return e.x === t.x && e.y === t.y;
  10030. }
  10031. toObject() {
  10032. return {
  10033. x: this.x,
  10034. y: this.y
  10035. };
  10036. }
  10037. }
  10038. const $o = {
  10039. toComponents: (n) => n.getComponents(),
  10040. fromComponents: (n) => new en(...n)
  10041. }, oi = D("p2d");
  10042. class rc {
  10043. constructor(e, t) {
  10044. this.element = e.createElement("div"), this.element.classList.add(oi()), t.viewProps.bindClassModifiers(this.element), N(t.expanded, K(this.element, oi(void 0, "expanded")));
  10045. const l = e.createElement("div");
  10046. l.classList.add(oi("h")), this.element.appendChild(l);
  10047. const v = e.createElement("button");
  10048. v.classList.add(oi("b")), v.appendChild(Ct(e, "p2dpad")), t.viewProps.bindDisabled(v), l.appendChild(v), this.buttonElement = v;
  10049. const E = e.createElement("div");
  10050. if (E.classList.add(oi("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  10051. const k2 = e.createElement("div");
  10052. k2.classList.add(oi("p")), this.element.appendChild(k2), this.pickerElement = k2;
  10053. } else
  10054. this.pickerElement = null;
  10055. }
  10056. }
  10057. const tn = D("p2dp");
  10058. class oc {
  10059. constructor(e, t) {
  10060. this.onFoldableChange_ = this.onFoldableChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.invertsY_ = t.invertsY, this.maxValue_ = t.maxValue, this.element = e.createElement("div"), this.element.classList.add(tn()), t.layout === "popup" && this.element.classList.add(tn(void 0, "p")), t.viewProps.bindClassModifiers(this.element);
  10061. const l = e.createElement("div");
  10062. l.classList.add(tn("p")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.padElement = l;
  10063. const v = e.createElementNS(Ue, "svg");
  10064. v.classList.add(tn("g")), this.padElement.appendChild(v), this.svgElem_ = v;
  10065. const E = e.createElementNS(Ue, "line");
  10066. E.classList.add(tn("ax")), E.setAttributeNS(null, "x1", "0"), E.setAttributeNS(null, "y1", "50%"), E.setAttributeNS(null, "x2", "100%"), E.setAttributeNS(null, "y2", "50%"), this.svgElem_.appendChild(E);
  10067. const k2 = e.createElementNS(Ue, "line");
  10068. k2.classList.add(tn("ax")), k2.setAttributeNS(null, "x1", "50%"), k2.setAttributeNS(null, "y1", "0"), k2.setAttributeNS(null, "x2", "50%"), k2.setAttributeNS(null, "y2", "100%"), this.svgElem_.appendChild(k2);
  10069. const B2 = e.createElementNS(Ue, "line");
  10070. B2.classList.add(tn("l")), B2.setAttributeNS(null, "x1", "50%"), B2.setAttributeNS(null, "y1", "50%"), this.svgElem_.appendChild(B2), this.lineElem_ = B2;
  10071. const Q = e.createElement("div");
  10072. Q.classList.add(tn("m")), this.padElement.appendChild(Q), this.markerElem_ = Q, t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  10073. }
  10074. get allFocusableElements() {
  10075. return [this.padElement];
  10076. }
  10077. update_() {
  10078. const [e, t] = this.value.rawValue.getComponents(), l = this.maxValue_, v = we(e, -l, +l, 0, 100), E = we(t, -l, +l, 0, 100), k2 = this.invertsY_ ? 100 - E : E;
  10079. this.lineElem_.setAttributeNS(null, "x2", `${v}%`), this.lineElem_.setAttributeNS(null, "y2", `${k2}%`), this.markerElem_.style.left = `${v}%`, this.markerElem_.style.top = `${k2}%`;
  10080. }
  10081. onValueChange_() {
  10082. this.update_();
  10083. }
  10084. onFoldableChange_() {
  10085. this.update_();
  10086. }
  10087. }
  10088. function Xo(n, e, t) {
  10089. return [
  10090. Ne2(e[0], ut2(n)),
  10091. Ne2(e[1], yn(n)) * (t ? 1 : -1)
  10092. ];
  10093. }
  10094. class ac {
  10095. constructor(e, t) {
  10096. this.onPadKeyDown_ = this.onPadKeyDown_.bind(this), this.onPadKeyUp_ = this.onPadKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.baseSteps_ = t.baseSteps, this.maxValue_ = t.maxValue, this.invertsY_ = t.invertsY, this.view = new oc(e, {
  10097. invertsY: this.invertsY_,
  10098. layout: t.layout,
  10099. maxValue: this.maxValue_,
  10100. value: this.value,
  10101. viewProps: this.viewProps
  10102. }), this.ptHandler_ = new Ot(this.view.padElement), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.padElement.addEventListener("keydown", this.onPadKeyDown_), this.view.padElement.addEventListener("keyup", this.onPadKeyUp_);
  10103. }
  10104. handlePointerEvent_(e, t) {
  10105. if (!e.point)
  10106. return;
  10107. const l = this.maxValue_, v = we(e.point.x, 0, e.bounds.width, -l, +l), E = we(this.invertsY_ ? e.bounds.height - e.point.y : e.point.y, 0, e.bounds.height, -l, +l);
  10108. this.value.setRawValue(new en(v, E), t);
  10109. }
  10110. onPointerDown_(e) {
  10111. this.handlePointerEvent_(e.data, {
  10112. forceEmit: false,
  10113. last: false
  10114. });
  10115. }
  10116. onPointerMove_(e) {
  10117. this.handlePointerEvent_(e.data, {
  10118. forceEmit: false,
  10119. last: false
  10120. });
  10121. }
  10122. onPointerUp_(e) {
  10123. this.handlePointerEvent_(e.data, {
  10124. forceEmit: true,
  10125. last: true
  10126. });
  10127. }
  10128. onPadKeyDown_(e) {
  10129. ti(e.key) && e.preventDefault();
  10130. const [t, l] = Xo(e, this.baseSteps_, this.invertsY_);
  10131. t === 0 && l === 0 || this.value.setRawValue(new en(this.value.rawValue.x + t, this.value.rawValue.y + l), {
  10132. forceEmit: false,
  10133. last: false
  10134. });
  10135. }
  10136. onPadKeyUp_(e) {
  10137. const [t, l] = Xo(e, this.baseSteps_, this.invertsY_);
  10138. t === 0 && l === 0 || this.value.setRawValue(this.value.rawValue, {
  10139. forceEmit: true,
  10140. last: true
  10141. });
  10142. }
  10143. }
  10144. class lc {
  10145. constructor(e, t) {
  10146. var l, v;
  10147. this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.onPadButtonBlur_ = this.onPadButtonBlur_.bind(this), this.onPadButtonClick_ = this.onPadButtonClick_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.foldable_ = Oe.create(t.expanded), this.popC_ = t.pickerLayout === "popup" ? new ms(e, {
  10148. viewProps: this.viewProps
  10149. }) : null;
  10150. const E = new ac(e, {
  10151. baseSteps: [t.axes[0].baseStep, t.axes[1].baseStep],
  10152. invertsY: t.invertsY,
  10153. layout: t.pickerLayout,
  10154. maxValue: t.maxValue,
  10155. value: this.value,
  10156. viewProps: this.viewProps
  10157. });
  10158. E.view.allFocusableElements.forEach((k2) => {
  10159. k2.addEventListener("blur", this.onPopupChildBlur_), k2.addEventListener("keydown", this.onPopupChildKeydown_);
  10160. }), this.pickerC_ = E, this.textC_ = new Gr(e, {
  10161. assembly: $o,
  10162. axes: t.axes,
  10163. parser: t.parser,
  10164. value: this.value,
  10165. viewProps: this.viewProps
  10166. }), this.view = new rc(e, {
  10167. expanded: this.foldable_.value("expanded"),
  10168. pickerLayout: t.pickerLayout,
  10169. viewProps: this.viewProps
  10170. }), this.view.textElement.appendChild(this.textC_.view.element), (l = this.view.buttonElement) === null || l === void 0 || l.addEventListener("blur", this.onPadButtonBlur_), (v = this.view.buttonElement) === null || v === void 0 || v.addEventListener("click", this.onPadButtonClick_), this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), Zt({
  10171. primary: this.foldable_.value("expanded"),
  10172. secondary: this.popC_.shows,
  10173. forward: (k2) => k2.rawValue,
  10174. backward: (k2, B2) => B2.rawValue
  10175. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ge(this.foldable_, this.view.pickerElement));
  10176. }
  10177. onPadButtonBlur_(e) {
  10178. if (!this.popC_)
  10179. return;
  10180. const t = this.view.element, l = e.relatedTarget;
  10181. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  10182. }
  10183. onPadButtonClick_() {
  10184. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  10185. }
  10186. onPopupChildBlur_(e) {
  10187. if (!this.popC_)
  10188. return;
  10189. const t = this.popC_.view.element, l = Pt(e);
  10190. l && t.contains(l) || l && l === this.view.buttonElement && !bt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  10191. }
  10192. onPopupChildKeydown_(e) {
  10193. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.view.buttonElement.focus();
  10194. }
  10195. }
  10196. class ai {
  10197. constructor(e = 0, t = 0, l = 0) {
  10198. this.x = e, this.y = t, this.z = l;
  10199. }
  10200. getComponents() {
  10201. return [this.x, this.y, this.z];
  10202. }
  10203. static isObject(e) {
  10204. if (_(e))
  10205. return false;
  10206. const t = e.x, l = e.y, v = e.z;
  10207. return !(typeof t != "number" || typeof l != "number" || typeof v != "number");
  10208. }
  10209. static equals(e, t) {
  10210. return e.x === t.x && e.y === t.y && e.z === t.z;
  10211. }
  10212. toObject() {
  10213. return {
  10214. x: this.x,
  10215. y: this.y,
  10216. z: this.z
  10217. };
  10218. }
  10219. }
  10220. const Yo = {
  10221. toComponents: (n) => n.getComponents(),
  10222. fromComponents: (n) => new ai(...n)
  10223. };
  10224. function cc(n) {
  10225. return ai.isObject(n) ? new ai(n.x, n.y, n.z) : new ai();
  10226. }
  10227. function pc(n, e) {
  10228. n.writeProperty("x", e.x), n.writeProperty("y", e.y), n.writeProperty("z", e.z);
  10229. }
  10230. function uc(n, e) {
  10231. return new Jt({
  10232. assembly: Yo,
  10233. components: [
  10234. jt("x" in n ? n.x : void 0, e.x),
  10235. jt("y" in n ? n.y : void 0, e.y),
  10236. jt("z" in n ? n.z : void 0, e.z)
  10237. ]
  10238. });
  10239. }
  10240. function Hr(n, e) {
  10241. return {
  10242. baseStep: Nt(e),
  10243. constraint: e,
  10244. textProps: X.fromObject({
  10245. draggingScale: Ft(e, n),
  10246. formatter: Ie(ii(e, n))
  10247. })
  10248. };
  10249. }
  10250. const hc = {
  10251. id: "input-point3d",
  10252. type: "input",
  10253. accept: (n, e) => {
  10254. if (!ai.isObject(n))
  10255. return null;
  10256. const t = M, l = ce2(e, {
  10257. x: t.optional.custom(wt),
  10258. y: t.optional.custom(wt),
  10259. z: t.optional.custom(wt)
  10260. });
  10261. return l ? {
  10262. initialValue: n,
  10263. params: l
  10264. } : null;
  10265. },
  10266. binding: {
  10267. reader: (n) => cc,
  10268. constraint: (n) => uc(n.params, n.initialValue),
  10269. equals: ai.equals,
  10270. writer: (n) => pc
  10271. },
  10272. controller: (n) => {
  10273. const e = n.value, t = n.constraint;
  10274. if (!(t instanceof Jt))
  10275. throw S2.shouldNeverHappen();
  10276. return new Gr(n.document, {
  10277. assembly: Yo,
  10278. axes: [
  10279. Hr(e.rawValue.x, t.components[0]),
  10280. Hr(e.rawValue.y, t.components[1]),
  10281. Hr(e.rawValue.z, t.components[2])
  10282. ],
  10283. parser: pt,
  10284. value: e,
  10285. viewProps: n.viewProps
  10286. });
  10287. }
  10288. };
  10289. class li {
  10290. constructor(e = 0, t = 0, l = 0, v = 0) {
  10291. this.x = e, this.y = t, this.z = l, this.w = v;
  10292. }
  10293. getComponents() {
  10294. return [this.x, this.y, this.z, this.w];
  10295. }
  10296. static isObject(e) {
  10297. if (_(e))
  10298. return false;
  10299. const t = e.x, l = e.y, v = e.z, E = e.w;
  10300. return !(typeof t != "number" || typeof l != "number" || typeof v != "number" || typeof E != "number");
  10301. }
  10302. static equals(e, t) {
  10303. return e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w;
  10304. }
  10305. toObject() {
  10306. return {
  10307. x: this.x,
  10308. y: this.y,
  10309. z: this.z,
  10310. w: this.w
  10311. };
  10312. }
  10313. }
  10314. const qo = {
  10315. toComponents: (n) => n.getComponents(),
  10316. fromComponents: (n) => new li(...n)
  10317. };
  10318. function dc(n) {
  10319. return li.isObject(n) ? new li(n.x, n.y, n.z, n.w) : new li();
  10320. }
  10321. function mc(n, e) {
  10322. n.writeProperty("x", e.x), n.writeProperty("y", e.y), n.writeProperty("z", e.z), n.writeProperty("w", e.w);
  10323. }
  10324. function fc(n, e) {
  10325. return new Jt({
  10326. assembly: qo,
  10327. components: [
  10328. jt("x" in n ? n.x : void 0, e.x),
  10329. jt("y" in n ? n.y : void 0, e.y),
  10330. jt("z" in n ? n.z : void 0, e.z),
  10331. jt("w" in n ? n.w : void 0, e.w)
  10332. ]
  10333. });
  10334. }
  10335. function vc(n, e) {
  10336. return {
  10337. baseStep: Nt(e),
  10338. constraint: e,
  10339. textProps: X.fromObject({
  10340. draggingScale: Ft(e, n),
  10341. formatter: Ie(ii(e, n))
  10342. })
  10343. };
  10344. }
  10345. const bc = {
  10346. id: "input-point4d",
  10347. type: "input",
  10348. accept: (n, e) => {
  10349. if (!li.isObject(n))
  10350. return null;
  10351. const t = M, l = ce2(e, {
  10352. x: t.optional.custom(wt),
  10353. y: t.optional.custom(wt),
  10354. z: t.optional.custom(wt),
  10355. w: t.optional.custom(wt)
  10356. });
  10357. return l ? {
  10358. initialValue: n,
  10359. params: l
  10360. } : null;
  10361. },
  10362. binding: {
  10363. reader: (n) => dc,
  10364. constraint: (n) => fc(n.params, n.initialValue),
  10365. equals: li.equals,
  10366. writer: (n) => mc
  10367. },
  10368. controller: (n) => {
  10369. const e = n.value, t = n.constraint;
  10370. if (!(t instanceof Jt))
  10371. throw S2.shouldNeverHappen();
  10372. return new Gr(n.document, {
  10373. assembly: qo,
  10374. axes: e.rawValue.getComponents().map((l, v) => vc(l, t.components[v])),
  10375. parser: pt,
  10376. value: e,
  10377. viewProps: n.viewProps
  10378. });
  10379. }
  10380. };
  10381. function gc(n) {
  10382. const e = [], t = Bi(n.options);
  10383. return t && e.push(t), new vn(e);
  10384. }
  10385. const _c = {
  10386. id: "input-string",
  10387. type: "input",
  10388. accept: (n, e) => {
  10389. if (typeof n != "string")
  10390. return null;
  10391. const l = ce2(e, {
  10392. options: M.optional.custom(Cn)
  10393. });
  10394. return l ? {
  10395. initialValue: n,
  10396. params: l
  10397. } : null;
  10398. },
  10399. binding: {
  10400. reader: (n) => Li,
  10401. constraint: (n) => gc(n.params),
  10402. writer: (n) => st2
  10403. },
  10404. controller: (n) => {
  10405. const e = n.document, t = n.value, l = n.constraint, v = l && it2(l, bn);
  10406. return v ? new gn(e, {
  10407. props: new X({
  10408. options: v.values.value("options")
  10409. }),
  10410. value: t,
  10411. viewProps: n.viewProps
  10412. }) : new Jn(e, {
  10413. parser: (E) => E,
  10414. props: X.fromObject({
  10415. formatter: kt
  10416. }),
  10417. value: t,
  10418. viewProps: n.viewProps
  10419. });
  10420. }
  10421. }, Ui = {
  10422. monitor: {
  10423. defaultInterval: 200,
  10424. defaultLineCount: 3
  10425. }
  10426. }, Qo = D("mll");
  10427. class wc {
  10428. constructor(e, t) {
  10429. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(Qo()), t.viewProps.bindClassModifiers(this.element);
  10430. const l = e.createElement("textarea");
  10431. l.classList.add(Qo("i")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, l.readOnly = true, t.viewProps.bindDisabled(l), this.element.appendChild(l), this.textareaElem_ = l, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  10432. }
  10433. update_() {
  10434. const e = this.textareaElem_, t = e.scrollTop === e.scrollHeight - e.clientHeight, l = [];
  10435. this.value.rawValue.forEach((v) => {
  10436. v !== void 0 && l.push(this.formatter_(v));
  10437. }), e.textContent = l.join(`
  10438. `), t && (e.scrollTop = e.scrollHeight);
  10439. }
  10440. onValueUpdate_() {
  10441. this.update_();
  10442. }
  10443. }
  10444. class Kr {
  10445. constructor(e, t) {
  10446. this.value = t.value, this.viewProps = t.viewProps, this.view = new wc(e, {
  10447. formatter: t.formatter,
  10448. lineCount: t.lineCount,
  10449. value: this.value,
  10450. viewProps: this.viewProps
  10451. });
  10452. }
  10453. }
  10454. const Zo = D("sgl");
  10455. class yc {
  10456. constructor(e, t) {
  10457. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(Zo()), t.viewProps.bindClassModifiers(this.element);
  10458. const l = e.createElement("input");
  10459. l.classList.add(Zo("i")), l.readOnly = true, l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  10460. }
  10461. update_() {
  10462. const e = this.value.rawValue, t = e[e.length - 1];
  10463. this.inputElement.value = t !== void 0 ? this.formatter_(t) : "";
  10464. }
  10465. onValueUpdate_() {
  10466. this.update_();
  10467. }
  10468. }
  10469. class $r {
  10470. constructor(e, t) {
  10471. this.value = t.value, this.viewProps = t.viewProps, this.view = new yc(e, {
  10472. formatter: t.formatter,
  10473. value: this.value,
  10474. viewProps: this.viewProps
  10475. });
  10476. }
  10477. }
  10478. const xc = {
  10479. id: "monitor-bool",
  10480. type: "monitor",
  10481. accept: (n, e) => {
  10482. if (typeof n != "boolean")
  10483. return null;
  10484. const l = ce2(e, {
  10485. lineCount: M.optional.number
  10486. });
  10487. return l ? {
  10488. initialValue: n,
  10489. params: l
  10490. } : null;
  10491. },
  10492. binding: {
  10493. reader: (n) => vs
  10494. },
  10495. controller: (n) => {
  10496. var e;
  10497. return n.value.rawValue.length === 1 ? new $r(n.document, {
  10498. formatter: bs,
  10499. value: n.value,
  10500. viewProps: n.viewProps
  10501. }) : new Kr(n.document, {
  10502. formatter: bs,
  10503. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  10504. value: n.value,
  10505. viewProps: n.viewProps
  10506. });
  10507. }
  10508. }, nn = D("grl");
  10509. class Ec {
  10510. constructor(e, t) {
  10511. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = e.createElement("div"), this.element.classList.add(nn()), t.viewProps.bindClassModifiers(this.element), this.formatter_ = t.formatter, this.props_ = t.props, this.cursor_ = t.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  10512. const l = e.createElementNS(Ue, "svg");
  10513. l.classList.add(nn("g")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, this.element.appendChild(l), this.svgElem_ = l;
  10514. const v = e.createElementNS(Ue, "polyline");
  10515. this.svgElem_.appendChild(v), this.lineElem_ = v;
  10516. const E = e.createElement("div");
  10517. E.classList.add(nn("t"), D("tt")()), this.element.appendChild(E), this.tooltipElem_ = E, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  10518. }
  10519. get graphElement() {
  10520. return this.svgElem_;
  10521. }
  10522. update_() {
  10523. const e = this.svgElem_.getBoundingClientRect(), t = this.value.rawValue.length - 1, l = this.props_.get("minValue"), v = this.props_.get("maxValue"), E = [];
  10524. this.value.rawValue.forEach((me2, be) => {
  10525. if (me2 === void 0)
  10526. return;
  10527. const Sn = we(be, 0, t, 0, e.width), Gi = we(me2, l, v, e.height, 0);
  10528. E.push([Sn, Gi].join(","));
  10529. }), this.lineElem_.setAttributeNS(null, "points", E.join(" "));
  10530. const k2 = this.tooltipElem_, B2 = this.value.rawValue[this.cursor_.rawValue];
  10531. if (B2 === void 0) {
  10532. k2.classList.remove(nn("t", "a"));
  10533. return;
  10534. }
  10535. const Q = we(this.cursor_.rawValue, 0, t, 0, e.width), J = we(B2, l, v, e.height, 0);
  10536. k2.style.left = `${Q}px`, k2.style.top = `${J}px`, k2.textContent = `${this.formatter_(B2)}`, k2.classList.contains(nn("t", "a")) || (k2.classList.add(nn("t", "a"), nn("t", "in")), at2(k2), k2.classList.remove(nn("t", "in")));
  10537. }
  10538. onValueUpdate_() {
  10539. this.update_();
  10540. }
  10541. onCursorChange_() {
  10542. this.update_();
  10543. }
  10544. }
  10545. class Cc {
  10546. constructor(e, t) {
  10547. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = t.props, this.value = t.value, this.viewProps = t.viewProps, this.cursor_ = ee2(-1), this.view = new Ec(e, {
  10548. cursor: this.cursor_,
  10549. formatter: t.formatter,
  10550. lineCount: t.lineCount,
  10551. props: this.props_,
  10552. value: this.value,
  10553. viewProps: this.viewProps
  10554. }), !bt(e))
  10555. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  10556. else {
  10557. const l = new Ot(this.view.element);
  10558. l.emitter.on("down", this.onGraphPointerDown_), l.emitter.on("move", this.onGraphPointerMove_), l.emitter.on("up", this.onGraphPointerUp_);
  10559. }
  10560. }
  10561. onGraphMouseLeave_() {
  10562. this.cursor_.rawValue = -1;
  10563. }
  10564. onGraphMouseMove_(e) {
  10565. const t = this.view.element.getBoundingClientRect();
  10566. this.cursor_.rawValue = Math.floor(we(e.offsetX, 0, t.width, 0, this.value.rawValue.length));
  10567. }
  10568. onGraphPointerDown_(e) {
  10569. this.onGraphPointerMove_(e);
  10570. }
  10571. onGraphPointerMove_(e) {
  10572. if (!e.data.point) {
  10573. this.cursor_.rawValue = -1;
  10574. return;
  10575. }
  10576. this.cursor_.rawValue = Math.floor(we(e.data.point.x, 0, e.data.bounds.width, 0, this.value.rawValue.length));
  10577. }
  10578. onGraphPointerUp_() {
  10579. this.cursor_.rawValue = -1;
  10580. }
  10581. }
  10582. function Xr(n) {
  10583. return "format" in n && !_(n.format) ? n.format : Ie(2);
  10584. }
  10585. function Pc(n) {
  10586. var e;
  10587. return n.value.rawValue.length === 1 ? new $r(n.document, {
  10588. formatter: Xr(n.params),
  10589. value: n.value,
  10590. viewProps: n.viewProps
  10591. }) : new Kr(n.document, {
  10592. formatter: Xr(n.params),
  10593. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  10594. value: n.value,
  10595. viewProps: n.viewProps
  10596. });
  10597. }
  10598. function Tc(n) {
  10599. var e, t, l;
  10600. return new Cc(n.document, {
  10601. formatter: Xr(n.params),
  10602. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  10603. props: X.fromObject({
  10604. maxValue: (t = "max" in n.params ? n.params.max : null) !== null && t !== void 0 ? t : 100,
  10605. minValue: (l = "min" in n.params ? n.params.min : null) !== null && l !== void 0 ? l : 0
  10606. }),
  10607. value: n.value,
  10608. viewProps: n.viewProps
  10609. });
  10610. }
  10611. function Wo(n) {
  10612. return "view" in n && n.view === "graph";
  10613. }
  10614. const kc = {
  10615. id: "monitor-number",
  10616. type: "monitor",
  10617. accept: (n, e) => {
  10618. if (typeof n != "number")
  10619. return null;
  10620. const t = M, l = ce2(e, {
  10621. format: t.optional.function,
  10622. lineCount: t.optional.number,
  10623. max: t.optional.number,
  10624. min: t.optional.number,
  10625. view: t.optional.string
  10626. });
  10627. return l ? {
  10628. initialValue: n,
  10629. params: l
  10630. } : null;
  10631. },
  10632. binding: {
  10633. defaultBufferSize: (n) => Wo(n) ? 64 : 1,
  10634. reader: (n) => _t
  10635. },
  10636. controller: (n) => Wo(n.params) ? Tc(n) : Pc(n)
  10637. }, Mc = {
  10638. id: "monitor-string",
  10639. type: "monitor",
  10640. accept: (n, e) => {
  10641. if (typeof n != "string")
  10642. return null;
  10643. const t = M, l = ce2(e, {
  10644. lineCount: t.optional.number,
  10645. multiline: t.optional.boolean
  10646. });
  10647. return l ? {
  10648. initialValue: n,
  10649. params: l
  10650. } : null;
  10651. },
  10652. binding: {
  10653. reader: (n) => Li
  10654. },
  10655. controller: (n) => {
  10656. var e;
  10657. const t = n.value;
  10658. return t.rawValue.length > 1 || "multiline" in n.params && n.params.multiline ? new Kr(n.document, {
  10659. formatter: kt,
  10660. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  10661. value: t,
  10662. viewProps: n.viewProps
  10663. }) : new $r(n.document, {
  10664. formatter: kt,
  10665. value: t,
  10666. viewProps: n.viewProps
  10667. });
  10668. }
  10669. };
  10670. function Sc(n, e) {
  10671. var t;
  10672. const l = n.accept(e.target.read(), e.params);
  10673. if (_(l))
  10674. return null;
  10675. const v = M, E = {
  10676. target: e.target,
  10677. initialValue: l.initialValue,
  10678. params: l.params
  10679. }, k2 = n.binding.reader(E), B2 = n.binding.constraint ? n.binding.constraint(E) : void 0, Q = ee2(k2(l.initialValue), {
  10680. constraint: B2,
  10681. equals: n.binding.equals
  10682. }), J = new Zn({
  10683. reader: k2,
  10684. target: e.target,
  10685. value: Q,
  10686. writer: n.binding.writer(E)
  10687. }), me2 = v.optional.boolean(e.params.disabled).value, be = v.optional.boolean(e.params.hidden).value, Sn = n.controller({
  10688. constraint: B2,
  10689. document: e.document,
  10690. initialValue: l.initialValue,
  10691. params: l.params,
  10692. value: J.value,
  10693. viewProps: Ye2.create({
  10694. disabled: me2,
  10695. hidden: be
  10696. })
  10697. });
  10698. return new Be(e.document, {
  10699. binding: J,
  10700. blade: xe(),
  10701. props: X.fromObject({
  10702. label: "label" in e.params ? (t = v.optional.string(e.params.label).value) !== null && t !== void 0 ? t : null : e.target.key
  10703. }),
  10704. valueController: Sn
  10705. });
  10706. }
  10707. function Ac(n, e) {
  10708. return e === 0 ? new ps() : new Ci(n, e ?? Ui.monitor.defaultInterval);
  10709. }
  10710. function Lc(n, e) {
  10711. var t, l, v;
  10712. const E = M, k2 = n.accept(e.target.read(), e.params);
  10713. if (_(k2))
  10714. return null;
  10715. const B2 = {
  10716. target: e.target,
  10717. initialValue: k2.initialValue,
  10718. params: k2.params
  10719. }, Q = n.binding.reader(B2), J = (l = (t = E.optional.number(e.params.bufferSize).value) !== null && t !== void 0 ? t : n.binding.defaultBufferSize && n.binding.defaultBufferSize(k2.params)) !== null && l !== void 0 ? l : 1, me2 = E.optional.number(e.params.interval).value, be = new lr({
  10720. reader: Q,
  10721. target: e.target,
  10722. ticker: Ac(e.document, me2),
  10723. value: us(J)
  10724. }), Sn = E.optional.boolean(e.params.disabled).value, Gi = E.optional.boolean(e.params.hidden).value, Hi = n.controller({
  10725. document: e.document,
  10726. params: k2.params,
  10727. value: be.value,
  10728. viewProps: Ye2.create({
  10729. disabled: Sn,
  10730. hidden: Gi
  10731. })
  10732. });
  10733. return new lt2(e.document, {
  10734. binding: be,
  10735. blade: xe(),
  10736. props: X.fromObject({
  10737. label: "label" in e.params ? (v = E.optional.string(e.params.label).value) !== null && v !== void 0 ? v : null : e.target.key
  10738. }),
  10739. valueController: Hi
  10740. });
  10741. }
  10742. class Rc {
  10743. constructor() {
  10744. this.pluginsMap_ = {
  10745. blades: [],
  10746. inputs: [],
  10747. monitors: []
  10748. };
  10749. }
  10750. getAll() {
  10751. return [
  10752. ...this.pluginsMap_.blades,
  10753. ...this.pluginsMap_.inputs,
  10754. ...this.pluginsMap_.monitors
  10755. ];
  10756. }
  10757. register(e) {
  10758. e.type === "blade" ? this.pluginsMap_.blades.unshift(e) : e.type === "input" ? this.pluginsMap_.inputs.unshift(e) : e.type === "monitor" && this.pluginsMap_.monitors.unshift(e);
  10759. }
  10760. createInput(e, t, l) {
  10761. const v = t.read();
  10762. if (_(v))
  10763. throw new S2({
  10764. context: {
  10765. key: t.key
  10766. },
  10767. type: "nomatchingcontroller"
  10768. });
  10769. const E = this.pluginsMap_.inputs.reduce((k2, B2) => k2 ?? Sc(B2, {
  10770. document: e,
  10771. target: t,
  10772. params: l
  10773. }), null);
  10774. if (E)
  10775. return E;
  10776. throw new S2({
  10777. context: {
  10778. key: t.key
  10779. },
  10780. type: "nomatchingcontroller"
  10781. });
  10782. }
  10783. createMonitor(e, t, l) {
  10784. const v = this.pluginsMap_.monitors.reduce((E, k2) => E ?? Lc(k2, {
  10785. document: e,
  10786. params: l,
  10787. target: t
  10788. }), null);
  10789. if (v)
  10790. return v;
  10791. throw new S2({
  10792. context: {
  10793. key: t.key
  10794. },
  10795. type: "nomatchingcontroller"
  10796. });
  10797. }
  10798. createBlade(e, t) {
  10799. const l = this.pluginsMap_.blades.reduce((v, E) => v ?? ar(E, {
  10800. document: e,
  10801. params: t
  10802. }), null);
  10803. if (!l)
  10804. throw new S2({
  10805. type: "nomatchingview",
  10806. context: {
  10807. params: t
  10808. }
  10809. });
  10810. return l;
  10811. }
  10812. createBladeApi(e) {
  10813. if (e instanceof Be)
  10814. return new vi(e);
  10815. if (e instanceof lt2)
  10816. return new bi(e);
  10817. if (e instanceof dn)
  10818. return new Yn(e, this);
  10819. const t = this.pluginsMap_.blades.reduce((l, v) => l ?? v.api({
  10820. controller: e,
  10821. pool: this
  10822. }), null);
  10823. if (!t)
  10824. throw S2.shouldNeverHappen();
  10825. return t;
  10826. }
  10827. }
  10828. function Ic() {
  10829. const n = new Rc();
  10830. return [
  10831. Bc,
  10832. hc,
  10833. bc,
  10834. _c,
  10835. sc,
  10836. Jl,
  10837. Wl,
  10838. Yl,
  10839. si,
  10840. xc,
  10841. Mc,
  10842. kc,
  10843. W,
  10844. nr,
  10845. sr,
  10846. Ei
  10847. ].forEach((e) => {
  10848. n.register(e);
  10849. }), n;
  10850. }
  10851. function Vc(n) {
  10852. return en.isObject(n) ? new en(n.x, n.y) : new en();
  10853. }
  10854. function Dc(n, e) {
  10855. n.writeProperty("x", e.x), n.writeProperty("y", e.y);
  10856. }
  10857. function jt(n, e) {
  10858. if (!n)
  10859. return;
  10860. const t = [], l = Ho(n, e);
  10861. l && t.push(l);
  10862. const v = Ko(n);
  10863. return v && t.push(v), new vn(t);
  10864. }
  10865. function Oc(n, e) {
  10866. return new Jt({
  10867. assembly: $o,
  10868. components: [
  10869. jt("x" in n ? n.x : void 0, e.x),
  10870. jt("y" in n ? n.y : void 0, e.y)
  10871. ]
  10872. });
  10873. }
  10874. function Jo(n, e) {
  10875. const [t, l] = n ? nc(n) : [];
  10876. if (!_(t) || !_(l))
  10877. return Math.max(Math.abs(t ?? 0), Math.abs(l ?? 0));
  10878. const v = Nt(n);
  10879. return Math.max(Math.abs(v) * 10, Math.abs(e) * 10);
  10880. }
  10881. function Nc(n, e) {
  10882. const t = e instanceof Jt ? e.components[0] : void 0, l = e instanceof Jt ? e.components[1] : void 0, v = Jo(t, n.x), E = Jo(l, n.y);
  10883. return Math.max(v, E);
  10884. }
  10885. function ea(n, e) {
  10886. return {
  10887. baseStep: Nt(e),
  10888. constraint: e,
  10889. textProps: X.fromObject({
  10890. draggingScale: Ft(e, n),
  10891. formatter: Ie(ii(e, n))
  10892. })
  10893. };
  10894. }
  10895. function Fc(n) {
  10896. if (!("y" in n))
  10897. return false;
  10898. const e = n.y;
  10899. return e && "inverted" in e ? !!e.inverted : false;
  10900. }
  10901. const Bc = {
  10902. id: "input-point2d",
  10903. type: "input",
  10904. accept: (n, e) => {
  10905. if (!en.isObject(n))
  10906. return null;
  10907. const t = M, l = ce2(e, {
  10908. expanded: t.optional.boolean,
  10909. picker: t.optional.custom(Fi),
  10910. x: t.optional.custom(wt),
  10911. y: t.optional.object({
  10912. inverted: t.optional.boolean,
  10913. max: t.optional.number,
  10914. min: t.optional.number,
  10915. step: t.optional.number
  10916. })
  10917. });
  10918. return l ? {
  10919. initialValue: n,
  10920. params: l
  10921. } : null;
  10922. },
  10923. binding: {
  10924. reader: (n) => Vc,
  10925. constraint: (n) => Oc(n.params, n.initialValue),
  10926. equals: en.equals,
  10927. writer: (n) => Dc
  10928. },
  10929. controller: (n) => {
  10930. const e = n.document, t = n.value, l = n.constraint;
  10931. if (!(l instanceof Jt))
  10932. throw S2.shouldNeverHappen();
  10933. const v = "expanded" in n.params ? n.params.expanded : void 0, E = "picker" in n.params ? n.params.picker : void 0;
  10934. return new lc(e, {
  10935. axes: [
  10936. ea(t.rawValue.x, l.components[0]),
  10937. ea(t.rawValue.y, l.components[1])
  10938. ],
  10939. expanded: v ?? false,
  10940. invertsY: Fc(n.params),
  10941. maxValue: Nc(t.rawValue, l),
  10942. parser: pt,
  10943. pickerLayout: E ?? "popup",
  10944. value: t,
  10945. viewProps: n.viewProps
  10946. });
  10947. }
  10948. };
  10949. class ta extends a {
  10950. constructor(e) {
  10951. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10952. this.emitter_.emit("change", {
  10953. event: new u(this, t.rawValue)
  10954. });
  10955. });
  10956. }
  10957. get label() {
  10958. return this.controller_.props.get("label");
  10959. }
  10960. set label(e) {
  10961. this.controller_.props.set("label", e);
  10962. }
  10963. get options() {
  10964. return this.controller_.valueController.props.get("options");
  10965. }
  10966. set options(e) {
  10967. this.controller_.valueController.props.set("options", e);
  10968. }
  10969. get value() {
  10970. return this.controller_.valueController.value.rawValue;
  10971. }
  10972. set value(e) {
  10973. this.controller_.valueController.value.rawValue = e;
  10974. }
  10975. on(e, t) {
  10976. const l = t.bind(this);
  10977. return this.emitter_.on(e, (v) => {
  10978. l(v.event);
  10979. }), this;
  10980. }
  10981. }
  10982. class na extends a {
  10983. constructor(e) {
  10984. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10985. this.emitter_.emit("change", {
  10986. event: new u(this, t.rawValue)
  10987. });
  10988. });
  10989. }
  10990. get label() {
  10991. return this.controller_.props.get("label");
  10992. }
  10993. set label(e) {
  10994. this.controller_.props.set("label", e);
  10995. }
  10996. get maxValue() {
  10997. return this.controller_.valueController.sliderController.props.get("maxValue");
  10998. }
  10999. set maxValue(e) {
  11000. this.controller_.valueController.sliderController.props.set("maxValue", e);
  11001. }
  11002. get minValue() {
  11003. return this.controller_.valueController.sliderController.props.get("minValue");
  11004. }
  11005. set minValue(e) {
  11006. this.controller_.valueController.sliderController.props.set("minValue", e);
  11007. }
  11008. get value() {
  11009. return this.controller_.valueController.value.rawValue;
  11010. }
  11011. set value(e) {
  11012. this.controller_.valueController.value.rawValue = e;
  11013. }
  11014. on(e, t) {
  11015. const l = t.bind(this);
  11016. return this.emitter_.on(e, (v) => {
  11017. l(v.event);
  11018. }), this;
  11019. }
  11020. }
  11021. class ia extends a {
  11022. constructor(e) {
  11023. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  11024. this.emitter_.emit("change", {
  11025. event: new u(this, t.rawValue)
  11026. });
  11027. });
  11028. }
  11029. get label() {
  11030. return this.controller_.props.get("label");
  11031. }
  11032. set label(e) {
  11033. this.controller_.props.set("label", e);
  11034. }
  11035. get formatter() {
  11036. return this.controller_.valueController.props.get("formatter");
  11037. }
  11038. set formatter(e) {
  11039. this.controller_.valueController.props.set("formatter", e);
  11040. }
  11041. get value() {
  11042. return this.controller_.valueController.value.rawValue;
  11043. }
  11044. set value(e) {
  11045. this.controller_.valueController.value.rawValue = e;
  11046. }
  11047. on(e, t) {
  11048. const l = t.bind(this);
  11049. return this.emitter_.on(e, (v) => {
  11050. l(v.event);
  11051. }), this;
  11052. }
  11053. }
  11054. const jc = function() {
  11055. return {
  11056. id: "list",
  11057. type: "blade",
  11058. accept(n) {
  11059. const e = M, t = ce2(n, {
  11060. options: e.required.custom(Cn),
  11061. value: e.required.raw,
  11062. view: e.required.constant("list"),
  11063. label: e.optional.string
  11064. });
  11065. return t ? { params: t } : null;
  11066. },
  11067. controller(n) {
  11068. const e = new bn(ks(n.params.options)), t = ee2(n.params.value, {
  11069. constraint: e
  11070. }), l = new gn(n.document, {
  11071. props: new X({
  11072. options: e.values.value("options")
  11073. }),
  11074. value: t,
  11075. viewProps: n.viewProps
  11076. });
  11077. return new Kt(n.document, {
  11078. blade: n.blade,
  11079. props: X.fromObject({
  11080. label: n.params.label
  11081. }),
  11082. valueController: l
  11083. });
  11084. },
  11085. api(n) {
  11086. return !(n.controller instanceof Kt) || !(n.controller.valueController instanceof gn) ? null : new ta(n.controller);
  11087. }
  11088. };
  11089. }();
  11090. function zc(n) {
  11091. return n.reduce((e, t) => Object.assign(e, {
  11092. [t.presetKey]: t.read()
  11093. }), {});
  11094. }
  11095. function Uc(n, e) {
  11096. n.forEach((t) => {
  11097. const l = e[t.target.presetKey];
  11098. l !== void 0 && t.writer(t.target, t.reader(l));
  11099. });
  11100. }
  11101. class Gc extends gi {
  11102. /**
  11103. * @hidden
  11104. */
  11105. constructor(e, t) {
  11106. super(e, t);
  11107. }
  11108. get element() {
  11109. return this.controller_.view.element;
  11110. }
  11111. /**
  11112. * Imports a preset of all inputs.
  11113. * @param preset The preset object to import.
  11114. */
  11115. importPreset(e) {
  11116. const t = this.controller_.rackController.rack.find(Be).map((l) => l.binding);
  11117. Uc(t, e), this.refresh();
  11118. }
  11119. /**
  11120. * Exports a preset of all inputs.
  11121. * @return An exported preset object.
  11122. */
  11123. exportPreset() {
  11124. const e = this.controller_.rackController.rack.find(Be).map((t) => t.binding.target);
  11125. return zc(e);
  11126. }
  11127. /**
  11128. * Refreshes all bindings of the pane.
  11129. */
  11130. refresh() {
  11131. this.controller_.rackController.rack.find(Be).forEach((e) => {
  11132. e.binding.read();
  11133. }), this.controller_.rackController.rack.find(lt2).forEach((e) => {
  11134. e.binding.read();
  11135. });
  11136. }
  11137. }
  11138. class Hc extends qn {
  11139. constructor(e, t) {
  11140. super(e, {
  11141. expanded: t.expanded,
  11142. blade: t.blade,
  11143. props: t.props,
  11144. root: true,
  11145. viewProps: t.viewProps
  11146. });
  11147. }
  11148. }
  11149. const Kc = {
  11150. id: "slider",
  11151. type: "blade",
  11152. accept(n) {
  11153. const e = M, t = ce2(n, {
  11154. max: e.required.number,
  11155. min: e.required.number,
  11156. view: e.required.constant("slider"),
  11157. format: e.optional.function,
  11158. label: e.optional.string,
  11159. value: e.optional.number
  11160. });
  11161. return t ? { params: t } : null;
  11162. },
  11163. controller(n) {
  11164. var e, t;
  11165. const l = (e = n.params.value) !== null && e !== void 0 ? e : 0, v = new qt({
  11166. max: n.params.max,
  11167. min: n.params.min
  11168. }), E = new ni(n.document, {
  11169. baseStep: 1,
  11170. parser: pt,
  11171. sliderProps: new X({
  11172. maxValue: v.values.value("max"),
  11173. minValue: v.values.value("min")
  11174. }),
  11175. textProps: X.fromObject({
  11176. draggingScale: Ft(void 0, l),
  11177. formatter: (t = n.params.format) !== null && t !== void 0 ? t : Tr
  11178. }),
  11179. value: ee2(l, {
  11180. constraint: v
  11181. }),
  11182. viewProps: n.viewProps
  11183. });
  11184. return new Kt(n.document, {
  11185. blade: n.blade,
  11186. props: X.fromObject({
  11187. label: n.params.label
  11188. }),
  11189. valueController: E
  11190. });
  11191. },
  11192. api(n) {
  11193. return !(n.controller instanceof Kt) || !(n.controller.valueController instanceof ni) ? null : new na(n.controller);
  11194. }
  11195. }, $c = function() {
  11196. return {
  11197. id: "text",
  11198. type: "blade",
  11199. accept(n) {
  11200. const e = M, t = ce2(n, {
  11201. parse: e.required.function,
  11202. value: e.required.raw,
  11203. view: e.required.constant("text"),
  11204. format: e.optional.function,
  11205. label: e.optional.string
  11206. });
  11207. return t ? { params: t } : null;
  11208. },
  11209. controller(n) {
  11210. var e;
  11211. const t = new Jn(n.document, {
  11212. parser: n.params.parse,
  11213. props: X.fromObject({
  11214. formatter: (e = n.params.format) !== null && e !== void 0 ? e : (l) => String(l)
  11215. }),
  11216. value: ee2(n.params.value),
  11217. viewProps: n.viewProps
  11218. });
  11219. return new Kt(n.document, {
  11220. blade: n.blade,
  11221. props: X.fromObject({
  11222. label: n.params.label
  11223. }),
  11224. valueController: t
  11225. });
  11226. },
  11227. api(n) {
  11228. return !(n.controller instanceof Kt) || !(n.controller.valueController instanceof Jn) ? null : new ia(n.controller);
  11229. }
  11230. };
  11231. }();
  11232. function Xc(n) {
  11233. const e = n.createElement("div");
  11234. return e.classList.add(D("dfw")()), n.body && n.body.appendChild(e), e;
  11235. }
  11236. function sa(n, e, t) {
  11237. if (n.querySelector(`style[data-tp-style=${e}]`))
  11238. return;
  11239. const l = n.createElement("style");
  11240. l.dataset.tpStyle = e, l.textContent = t, n.head.appendChild(l);
  11241. }
  11242. class Yc extends Gc {
  11243. constructor(e) {
  11244. var t, l;
  11245. const v = e ?? {}, E = (t = v.document) !== null && t !== void 0 ? t : mi(), k2 = Ic(), B2 = new Hc(E, {
  11246. expanded: v.expanded,
  11247. blade: xe(),
  11248. props: X.fromObject({
  11249. title: v.title
  11250. }),
  11251. viewProps: Ye2.create()
  11252. });
  11253. super(B2, k2), this.pool_ = k2, this.containerElem_ = (l = v.container) !== null && l !== void 0 ? l : Xc(E), this.containerElem_.appendChild(this.element), this.doc_ = E, this.usesDefaultWrapper_ = !v.container, this.setUpDefaultPlugins_();
  11254. }
  11255. get document() {
  11256. if (!this.doc_)
  11257. throw S2.alreadyDisposed();
  11258. return this.doc_;
  11259. }
  11260. dispose() {
  11261. const e = this.containerElem_;
  11262. if (!e)
  11263. throw S2.alreadyDisposed();
  11264. if (this.usesDefaultWrapper_) {
  11265. const t = e.parentElement;
  11266. t && t.removeChild(e);
  11267. }
  11268. this.containerElem_ = null, this.doc_ = null, super.dispose();
  11269. }
  11270. registerPlugin(e) {
  11271. ("plugin" in e ? [e.plugin] : "plugins" in e ? e.plugins : []).forEach((l) => {
  11272. this.pool_.register(l), this.embedPluginStyle_(l);
  11273. });
  11274. }
  11275. embedPluginStyle_(e) {
  11276. e.css && sa(this.document, `plugin-${e.id}`, e.css);
  11277. }
  11278. setUpDefaultPlugins_() {
  11279. sa(this.document, "default", '.tp-tbiv_b,.tp-coltxtv_ms,.tp-ckbv_i,.tp-rotv_b,.tp-fldv_b,.tp-mllv_i,.tp-sglv_i,.tp-grlv_g,.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw,.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-p2dv_b:hover,.tp-btnv_b:hover,.tp-lstv_s:hover{background-color:var(--btn-bg-h)}.tp-p2dv_b:focus,.tp-btnv_b:focus,.tp-lstv_s:focus{background-color:var(--btn-bg-f)}.tp-p2dv_b:active,.tp-btnv_b:active,.tp-lstv_s:active{background-color:var(--btn-bg-a)}.tp-p2dv_b:disabled,.tp-btnv_b:disabled,.tp-lstv_s:disabled{opacity:.5}.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-txtv_i:hover,.tp-p2dpv_p:hover,.tp-colswv_sw:hover{background-color:var(--in-bg-h)}.tp-txtv_i:focus,.tp-p2dpv_p:focus,.tp-colswv_sw:focus{background-color:var(--in-bg-f)}.tp-txtv_i:active,.tp-p2dpv_p:active,.tp-colswv_sw:active{background-color:var(--in-bg-a)}.tp-txtv_i:disabled,.tp-p2dpv_p:disabled,.tp-colswv_sw:disabled{opacity:.5}.tp-mllv_i,.tp-sglv_i,.tp-grlv_g{background-color:var(--mo-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--mo-fg);height:var(--bld-us);scrollbar-color:currentColor rgba(0,0,0,0);scrollbar-width:thin;width:100%}.tp-mllv_i::-webkit-scrollbar,.tp-sglv_i::-webkit-scrollbar,.tp-grlv_g::-webkit-scrollbar{height:8px;width:8px}.tp-mllv_i::-webkit-scrollbar-corner,.tp-sglv_i::-webkit-scrollbar-corner,.tp-grlv_g::-webkit-scrollbar-corner{background-color:rgba(0,0,0,0)}.tp-mllv_i::-webkit-scrollbar-thumb,.tp-sglv_i::-webkit-scrollbar-thumb,.tp-grlv_g::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:currentColor;border:rgba(0,0,0,0) solid 2px;border-radius:4px}.tp-rotv{--font-family: var(--tp-font-family, Roboto Mono, Source Code Pro, Menlo, Courier, monospace);--bs-br: var(--tp-base-border-radius, 6px);--cnt-h-p: var(--tp-container-horizontal-padding, 4px);--cnt-v-p: var(--tp-container-vertical-padding, 4px);--elm-br: var(--tp-element-border-radius, 2px);--bld-s: var(--tp-blade-spacing, 4px);--bld-us: var(--tp-blade-unit-size, 20px);--bs-bg: var(--tp-base-background-color, hsl(230, 7%, 17%));--bs-sh: var(--tp-base-shadow-color, rgba(0, 0, 0, 0.2));--btn-bg: var(--tp-button-background-color, hsl(230, 7%, 70%));--btn-bg-a: var(--tp-button-background-color-active, #d6d7db);--btn-bg-f: var(--tp-button-background-color-focus, #c8cad0);--btn-bg-h: var(--tp-button-background-color-hover, #bbbcc4);--btn-fg: var(--tp-button-foreground-color, hsl(230, 7%, 17%));--cnt-bg: var(--tp-container-background-color, rgba(187, 188, 196, 0.1));--cnt-bg-a: var(--tp-container-background-color-active, rgba(187, 188, 196, 0.25));--cnt-bg-f: var(--tp-container-background-color-focus, rgba(187, 188, 196, 0.2));--cnt-bg-h: var(--tp-container-background-color-hover, rgba(187, 188, 196, 0.15));--cnt-fg: var(--tp-container-foreground-color, hsl(230, 7%, 75%));--in-bg: var(--tp-input-background-color, rgba(187, 188, 196, 0.1));--in-bg-a: var(--tp-input-background-color-active, rgba(187, 188, 196, 0.25));--in-bg-f: var(--tp-input-background-color-focus, rgba(187, 188, 196, 0.2));--in-bg-h: var(--tp-input-background-color-hover, rgba(187, 188, 196, 0.15));--in-fg: var(--tp-input-foreground-color, hsl(230, 7%, 75%));--lbl-fg: var(--tp-label-foreground-color, rgba(187, 188, 196, 0.7));--mo-bg: var(--tp-monitor-background-color, rgba(0, 0, 0, 0.2));--mo-fg: var(--tp-monitor-foreground-color, rgba(187, 188, 196, 0.7));--grv-fg: var(--tp-groove-foreground-color, rgba(187, 188, 196, 0.1))}.tp-rotv_c>.tp-cntv.tp-v-lst,.tp-tabv_c .tp-brkv>.tp-cntv.tp-v-lst,.tp-fldv_c>.tp-cntv.tp-v-lst{margin-bottom:calc(-1*var(--cnt-v-p))}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_c{border-bottom-left-radius:0}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_b{border-bottom-left-radius:0}.tp-rotv_c>*:not(.tp-v-fst),.tp-tabv_c .tp-brkv>*:not(.tp-v-fst),.tp-fldv_c>*:not(.tp-v-fst){margin-top:var(--bld-s)}.tp-rotv_c>.tp-sprv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-fst),.tp-fldv_c>.tp-sprv:not(.tp-v-fst),.tp-rotv_c>.tp-cntv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-fst),.tp-fldv_c>.tp-cntv:not(.tp-v-fst){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-sprv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-rotv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-cntv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-cntv+*:not(.tp-v-hidden){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-fldv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-rotv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-fldv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv{margin-top:0}.tp-tabv_c .tp-brkv>.tp-cntv,.tp-fldv_c>.tp-cntv{margin-left:4px}.tp-tabv_c .tp-brkv>.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-fldv>.tp-fldv_b{border-top-left-radius:var(--elm-br);border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-fldv.tp-fldv-expanded>.tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b{border-bottom-left-radius:0}.tp-tabv_c .tp-brkv .tp-fldv>.tp-fldv_c,.tp-fldv_c .tp-fldv>.tp-fldv_c{border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-cntv+.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-cntv+.tp-fldv>.tp-fldv_b{border-top-left-radius:0}.tp-tabv_c .tp-brkv>.tp-cntv+.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-cntv+.tp-tabv>.tp-tabv_t{border-top-left-radius:0}.tp-tabv_c .tp-brkv>.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-tabv>.tp-tabv_t{border-top-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv .tp-tabv>.tp-tabv_c,.tp-fldv_c .tp-tabv>.tp-tabv_c{border-bottom-left-radius:var(--elm-br)}.tp-rotv_b,.tp-fldv_b{background-color:var(--cnt-bg);color:var(--cnt-fg);cursor:pointer;display:block;height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);overflow:hidden;padding-left:var(--cnt-h-p);padding-right:calc(4px + var(--bld-us) + var(--cnt-h-p));position:relative;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:border-radius .2s ease-in-out .2s}.tp-rotv_b:hover,.tp-fldv_b:hover{background-color:var(--cnt-bg-h)}.tp-rotv_b:focus,.tp-fldv_b:focus{background-color:var(--cnt-bg-f)}.tp-rotv_b:active,.tp-fldv_b:active{background-color:var(--cnt-bg-a)}.tp-rotv_b:disabled,.tp-fldv_b:disabled{opacity:.5}.tp-rotv_m,.tp-fldv_m{background:linear-gradient(to left, var(--cnt-fg), var(--cnt-fg) 2px, transparent 2px, transparent 4px, var(--cnt-fg) 4px);border-radius:2px;bottom:0;content:"";display:block;height:6px;right:calc(var(--cnt-h-p) + (var(--bld-us) + 4px - 6px)/2 - 2px);margin:auto;opacity:.5;position:absolute;top:0;transform:rotate(90deg);transition:transform .2s ease-in-out;width:6px}.tp-rotv.tp-rotv-expanded .tp-rotv_m,.tp-fldv.tp-fldv-expanded>.tp-fldv_b>.tp-fldv_m{transform:none}.tp-rotv_c,.tp-fldv_c{box-sizing:border-box;height:0;opacity:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;transition:height .2s ease-in-out,opacity .2s linear,padding .2s ease-in-out}.tp-rotv.tp-rotv-cpl:not(.tp-rotv-expanded) .tp-rotv_c,.tp-fldv.tp-fldv-cpl:not(.tp-fldv-expanded)>.tp-fldv_c{display:none}.tp-rotv.tp-rotv-expanded .tp-rotv_c,.tp-fldv.tp-fldv-expanded>.tp-fldv_c{opacity:1;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p);transform:none;overflow:visible;transition:height .2s ease-in-out,opacity .2s linear .2s,padding .2s ease-in-out}.tp-lstv,.tp-coltxtv_m{position:relative}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m,.tp-coltxtv_mm{bottom:0;margin:auto;pointer-events:none;position:absolute;right:2px;top:0}.tp-lstv_m svg,.tp-coltxtv_mm svg{bottom:0;height:16px;margin:auto;position:absolute;right:0;top:0;width:16px}.tp-lstv_m svg path,.tp-coltxtv_mm svg path{fill:currentColor}.tp-pndtxtv,.tp-coltxtv_w{display:flex}.tp-pndtxtv_a,.tp-coltxtv_c{width:100%}.tp-pndtxtv_a+.tp-pndtxtv_a,.tp-coltxtv_c+.tp-pndtxtv_a,.tp-pndtxtv_a+.tp-coltxtv_c,.tp-coltxtv_c+.tp-coltxtv_c{margin-left:2px}.tp-btnv_b{width:100%}.tp-btnv_t{text-align:center}.tp-ckbv_l{display:block;position:relative}.tp-ckbv_i{left:0;opacity:0;position:absolute;top:0}.tp-ckbv_w{background-color:var(--in-bg);border-radius:var(--elm-br);cursor:pointer;display:block;height:var(--bld-us);position:relative;width:var(--bld-us)}.tp-ckbv_w svg{bottom:0;display:block;height:16px;left:0;margin:auto;opacity:0;position:absolute;right:0;top:0;width:16px}.tp-ckbv_w svg path{fill:none;stroke:var(--in-fg);stroke-width:2}.tp-ckbv_i:hover+.tp-ckbv_w{background-color:var(--in-bg-h)}.tp-ckbv_i:focus+.tp-ckbv_w{background-color:var(--in-bg-f)}.tp-ckbv_i:active+.tp-ckbv_w{background-color:var(--in-bg-a)}.tp-ckbv_i:checked+.tp-ckbv_w svg{opacity:1}.tp-ckbv.tp-v-disabled .tp-ckbv_w{opacity:.5}.tp-colv{position:relative}.tp-colv_h{display:flex}.tp-colv_s{flex-grow:0;flex-shrink:0;width:var(--bld-us)}.tp-colv_t{flex:1;margin-left:4px}.tp-colv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-colv.tp-colv-cpl .tp-colv_p{overflow:visible}.tp-colv.tp-colv-expanded .tp-colv_p{margin-top:var(--bld-s);opacity:1}.tp-colv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-colpv_h,.tp-colpv_ap{margin-left:6px;margin-right:6px}.tp-colpv_h{margin-top:var(--bld-s)}.tp-colpv_rgb{display:flex;margin-top:var(--bld-s);width:100%}.tp-colpv_a{display:flex;margin-top:var(--cnt-v-p);padding-top:calc(var(--cnt-v-p) + 2px);position:relative}.tp-colpv_a::before{background-color:var(--grv-fg);content:"";height:2px;left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:0}.tp-colpv.tp-v-disabled .tp-colpv_a::before{opacity:.5}.tp-colpv_ap{align-items:center;display:flex;flex:3}.tp-colpv_at{flex:1;margin-left:4px}.tp-svpv{border-radius:var(--elm-br);outline:none;overflow:hidden;position:relative}.tp-svpv.tp-v-disabled{opacity:.5}.tp-svpv_c{cursor:crosshair;display:block;height:calc(var(--bld-us)*4);width:100%}.tp-svpv_m{border-radius:100%;border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;filter:drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));height:12px;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;width:12px}.tp-svpv:focus .tp-svpv_m{border-color:#fff}.tp-hplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative}.tp-hplv.tp-v-disabled{opacity:.5}.tp-hplv_c{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAQ0lEQVQoU2P8z8Dwn0GCgQEDi2OK/RBgYHjBgIpfovFh8j8YBIgzFGQxuqEgPhaDOT5gOhPkdCxOZeBg+IDFZZiGAgCaSSMYtcRHLgAAAABJRU5ErkJggg==);background-position:left top;background-repeat:no-repeat;background-size:100% 100%;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;position:absolute;top:50%;width:100%}.tp-hplv_m{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-shadow:0 0 2px rgba(0,0,0,.1);box-sizing:border-box;height:12px;left:50%;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;top:50%;width:12px}.tp-hplv:focus .tp-hplv_m{border-color:#fff}.tp-aplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative;width:100%}.tp-aplv.tp-v-disabled{opacity:.5}.tp-aplv_b{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:4px 4px;background-position:0 0,2px 2px;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;overflow:hidden;position:absolute;top:50%;width:100%}.tp-aplv_c{bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv_m{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:12px 12px;background-position:0 0,6px 6px;border-radius:var(--elm-br);box-shadow:0 0 2px rgba(0,0,0,.1);height:12px;left:50%;margin-left:-6px;margin-top:-6px;overflow:hidden;pointer-events:none;position:absolute;top:50%;width:12px}.tp-aplv_p{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv:focus .tp-aplv_p{border-color:#fff}.tp-colswv{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:10px 10px;background-position:0 0,5px 5px;border-radius:var(--elm-br);overflow:hidden}.tp-colswv.tp-v-disabled{opacity:.5}.tp-colswv_sw{border-radius:0}.tp-colswv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;cursor:pointer;display:block;height:var(--bld-us);left:0;margin:0;outline:none;padding:0;position:absolute;top:0;width:var(--bld-us)}.tp-colswv_b:focus::after{border:rgba(255,255,255,.75) solid 2px;border-radius:var(--elm-br);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.tp-coltxtv{display:flex;width:100%}.tp-coltxtv_m{margin-right:4px}.tp-coltxtv_ms{border-radius:var(--elm-br);color:var(--lbl-fg);cursor:pointer;height:var(--bld-us);line-height:var(--bld-us);padding:0 18px 0 4px}.tp-coltxtv_ms:hover{background-color:var(--in-bg-h)}.tp-coltxtv_ms:focus{background-color:var(--in-bg-f)}.tp-coltxtv_ms:active{background-color:var(--in-bg-a)}.tp-coltxtv_mm{color:var(--lbl-fg)}.tp-coltxtv.tp-v-disabled .tp-coltxtv_mm{opacity:.5}.tp-coltxtv_w{flex:1}.tp-dfwv{position:absolute;top:8px;right:8px;width:256px}.tp-fldv{position:relative}.tp-fldv.tp-fldv-not .tp-fldv_b{display:none}.tp-fldv_t{padding-left:4px}.tp-fldv_b:disabled .tp-fldv_m{display:none}.tp-fldv_c{padding-left:4px}.tp-fldv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--bld-us) + 4px);width:var(--bs-br)}.tp-fldv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-fldv_b:hover+.tp-fldv_i{color:var(--cnt-bg-h)}.tp-fldv_b:focus+.tp-fldv_i{color:var(--cnt-bg-f)}.tp-fldv_b:active+.tp-fldv_i{color:var(--cnt-bg-a)}.tp-fldv.tp-v-disabled>.tp-fldv_i{opacity:.5}.tp-grlv{position:relative}.tp-grlv_g{display:block;height:calc(var(--bld-us)*3)}.tp-grlv_g polyline{fill:none;stroke:var(--mo-fg);stroke-linejoin:round}.tp-grlv_t{margin-top:-4px;transition:left .05s,top .05s;visibility:hidden}.tp-grlv_t.tp-grlv_t-a{visibility:visible}.tp-grlv_t.tp-grlv_t-in{transition:none}.tp-grlv.tp-v-disabled .tp-grlv_g{opacity:.5}.tp-grlv .tp-ttv{background-color:var(--mo-fg)}.tp-grlv .tp-ttv::before{border-top-color:var(--mo-fg)}.tp-lblv{align-items:center;display:flex;line-height:1.3;padding-left:var(--cnt-h-p);padding-right:var(--cnt-h-p)}.tp-lblv.tp-lblv-nol{display:block}.tp-lblv_l{color:var(--lbl-fg);flex:1;-webkit-hyphens:auto;hyphens:auto;overflow:hidden;padding-left:4px;padding-right:16px}.tp-lblv.tp-v-disabled .tp-lblv_l{opacity:.5}.tp-lblv.tp-lblv-nol .tp-lblv_l{display:none}.tp-lblv_v{align-self:flex-start;flex-grow:0;flex-shrink:0;width:160px}.tp-lblv.tp-lblv-nol .tp-lblv_v{width:100%}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m{color:var(--btn-fg)}.tp-sglv_i{padding:0 4px}.tp-sglv.tp-v-disabled .tp-sglv_i{opacity:.5}.tp-mllv_i{display:block;height:calc(var(--bld-us)*3);line-height:var(--bld-us);padding:0 4px;resize:none;white-space:pre}.tp-mllv.tp-v-disabled .tp-mllv_i{opacity:.5}.tp-p2dv{position:relative}.tp-p2dv_h{display:flex}.tp-p2dv_b{height:var(--bld-us);margin-right:4px;position:relative;width:var(--bld-us)}.tp-p2dv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-p2dv_b svg path{stroke:currentColor;stroke-width:2}.tp-p2dv_b svg circle{fill:currentColor}.tp-p2dv_t{flex:1}.tp-p2dv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-p2dv.tp-p2dv-expanded .tp-p2dv_p{margin-top:var(--bld-s);opacity:1}.tp-p2dv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-p2dpv{padding-left:calc(var(--bld-us) + 4px)}.tp-p2dpv_p{cursor:crosshair;height:0;overflow:hidden;padding-bottom:100%;position:relative}.tp-p2dpv.tp-v-disabled .tp-p2dpv_p{opacity:.5}.tp-p2dpv_g{display:block;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.tp-p2dpv_ax{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_l{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_m{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;position:absolute;width:4px}.tp-p2dpv_p:focus .tp-p2dpv_m{background-color:var(--in-fg);border-width:0}.tp-popv{background-color:var(--bs-bg);border-radius:6px;box-shadow:0 2px 4px var(--bs-sh);display:none;max-width:168px;padding:var(--cnt-v-p) var(--cnt-h-p);position:absolute;visibility:hidden;z-index:1000}.tp-popv.tp-popv-v{display:block;visibility:visible}.tp-sprv_r{background-color:var(--grv-fg);border-width:0;display:block;height:2px;margin:0;width:100%}.tp-sprv.tp-v-disabled .tp-sprv_r{opacity:.5}.tp-sldv.tp-v-disabled{opacity:.5}.tp-sldv_t{box-sizing:border-box;cursor:pointer;height:var(--bld-us);margin:0 6px;outline:none;position:relative}.tp-sldv_t::before{background-color:var(--in-bg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin:auto;position:absolute;right:0;top:0}.tp-sldv_k{height:100%;left:0;position:absolute;top:0}.tp-sldv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin-bottom:auto;margin-top:auto;position:absolute;right:0;top:0}.tp-sldv_k::after{background-color:var(--btn-bg);border-radius:var(--elm-br);bottom:0;content:"";display:block;height:12px;margin-bottom:auto;margin-top:auto;position:absolute;right:-6px;top:0;width:12px}.tp-sldv_t:hover .tp-sldv_k::after{background-color:var(--btn-bg-h)}.tp-sldv_t:focus .tp-sldv_k::after{background-color:var(--btn-bg-f)}.tp-sldv_t:active .tp-sldv_k::after{background-color:var(--btn-bg-a)}.tp-sldtxtv{display:flex}.tp-sldtxtv_s{flex:2}.tp-sldtxtv_t{flex:1;margin-left:4px}.tp-tabv{position:relative}.tp-tabv_t{align-items:flex-end;color:var(--cnt-bg);display:flex;overflow:hidden;position:relative}.tp-tabv_t:hover{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus){color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active){color:var(--cnt-bg-a)}.tp-tabv_t::before{background-color:currentColor;bottom:0;content:"";height:2px;left:0;pointer-events:none;position:absolute;right:0}.tp-tabv.tp-v-disabled .tp-tabv_t::before{opacity:.5}.tp-tabv.tp-tabv-nop .tp-tabv_t{height:calc(var(--bld-us) + 4px);position:relative}.tp-tabv.tp-tabv-nop .tp-tabv_t::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:0;position:absolute;right:0}.tp-tabv_c{padding-bottom:var(--cnt-v-p);padding-left:4px;padding-top:var(--cnt-v-p)}.tp-tabv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--bld-us) + 4px);width:var(--bs-br)}.tp-tabv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-tabv_t:hover+.tp-tabv_i{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus)+.tp-tabv_i{color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active)+.tp-tabv_i{color:var(--cnt-bg-a)}.tp-tabv.tp-v-disabled>.tp-tabv_i{opacity:.5}.tp-tbiv{flex:1;min-width:0;position:relative}.tp-tbiv+.tp-tbiv{margin-left:2px}.tp-tbiv+.tp-tbiv.tp-v-disabled::before{opacity:.5}.tp-tbiv_b{display:block;padding-left:calc(var(--cnt-h-p) + 4px);padding-right:calc(var(--cnt-h-p) + 4px);position:relative;width:100%}.tp-tbiv_b:disabled{opacity:.5}.tp-tbiv_b::before{background-color:var(--cnt-bg);bottom:2px;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.tp-tbiv_b:hover::before{background-color:var(--cnt-bg-h)}.tp-tbiv_b:focus::before{background-color:var(--cnt-bg-f)}.tp-tbiv_b:active::before{background-color:var(--cnt-bg-a)}.tp-tbiv_t{color:var(--cnt-fg);height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);opacity:.5;overflow:hidden;text-overflow:ellipsis}.tp-tbiv.tp-tbiv-sel .tp-tbiv_t{opacity:1}.tp-txtv{position:relative}.tp-txtv_i{padding:0 4px}.tp-txtv.tp-txtv-fst .tp-txtv_i{border-bottom-right-radius:0;border-top-right-radius:0}.tp-txtv.tp-txtv-mid .tp-txtv_i{border-radius:0}.tp-txtv.tp-txtv-lst .tp-txtv_i{border-bottom-left-radius:0;border-top-left-radius:0}.tp-txtv.tp-txtv-num .tp-txtv_i{text-align:right}.tp-txtv.tp-txtv-drg .tp-txtv_i{opacity:.3}.tp-txtv_k{cursor:pointer;height:100%;left:-3px;position:absolute;top:0;width:12px}.tp-txtv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";height:calc(var(--bld-us) - 4px);left:50%;margin-bottom:auto;margin-left:-1px;margin-top:auto;opacity:.1;position:absolute;top:0;transition:border-radius .1s,height .1s,transform .1s,width .1s;width:2px}.tp-txtv_k:hover::before,.tp-txtv.tp-txtv-drg .tp-txtv_k::before{opacity:1}.tp-txtv.tp-txtv-drg .tp-txtv_k::before{border-radius:50%;height:4px;transform:translateX(-1px);width:4px}.tp-txtv_g{bottom:0;display:block;height:8px;left:50%;margin:auto;overflow:visible;pointer-events:none;position:absolute;top:0;visibility:hidden;width:100%}.tp-txtv.tp-txtv-drg .tp-txtv_g{visibility:visible}.tp-txtv_gb{fill:none;stroke:var(--in-fg);stroke-dasharray:1}.tp-txtv_gh{fill:none;stroke:var(--in-fg)}.tp-txtv .tp-ttv{margin-left:6px;visibility:hidden}.tp-txtv.tp-txtv-drg .tp-ttv{visibility:visible}.tp-ttv{background-color:var(--in-fg);border-radius:var(--elm-br);color:var(--bs-bg);padding:2px 4px;pointer-events:none;position:absolute;transform:translate(-50%, -100%)}.tp-ttv::before{border-color:var(--in-fg) rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0);border-style:solid;border-width:2px;box-sizing:border-box;content:"";font-size:.9em;height:4px;left:50%;margin-left:-2px;position:absolute;top:100%;width:4px}.tp-rotv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);font-family:var(--font-family);font-size:11px;font-weight:500;line-height:1;text-align:left}.tp-rotv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br);border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br);padding-left:calc(4px + var(--bld-us) + var(--cnt-h-p));text-align:center}.tp-rotv.tp-rotv-expanded .tp-rotv_b{border-bottom-left-radius:0;border-bottom-right-radius:0}.tp-rotv.tp-rotv-not .tp-rotv_b{display:none}.tp-rotv_b:disabled .tp-rotv_m{display:none}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c .tp-fldv.tp-v-vlst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst>.tp-fldv_b{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst>.tp-tabv_t{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-v-disabled,.tp-rotv .tp-v-disabled{pointer-events:none}.tp-rotv.tp-v-hidden,.tp-rotv .tp-v-hidden{display:none}'), this.pool_.getAll().forEach((e) => {
  11280. this.embedPluginStyle_(e);
  11281. }), this.registerPlugin({
  11282. plugins: [
  11283. Kc,
  11284. jc,
  11285. Ei,
  11286. $c
  11287. ]
  11288. });
  11289. }
  11290. }
  11291. const qc = new s("3.1.7");
  11292. r.BladeApi = a, r.ButtonApi = j2, r.FolderApi = gi, r.InputBindingApi = vi, r.ListApi = ta, r.MonitorBindingApi = bi, r.Pane = Yc, r.SeparatorApi = os, r.SliderApi = na, r.TabApi = ls, r.TabPageApi = xi, r.TextApi = ia, r.TpChangeEvent = u, r.VERSION = qc, Object.defineProperty(r, "__esModule", { value: true });
  11293. });
  11294. })(Ph, Gs);
  11295. var ts = {};
  11296. var Th = {
  11297. get exports() {
  11298. return ts;
  11299. },
  11300. set exports(b2) {
  11301. ts = b2;
  11302. }
  11303. };
  11304. (function(b2, i) {
  11305. (function(r, s) {
  11306. s(i);
  11307. })(nl, function(r) {
  11308. class s {
  11309. constructor(o) {
  11310. this.controller_ = o;
  11311. }
  11312. get element() {
  11313. return this.controller_.view.element;
  11314. }
  11315. get disabled() {
  11316. return this.controller_.viewProps.get("disabled");
  11317. }
  11318. set disabled(o) {
  11319. this.controller_.viewProps.set("disabled", o);
  11320. }
  11321. get hidden() {
  11322. return this.controller_.viewProps.get("hidden");
  11323. }
  11324. set hidden(o) {
  11325. this.controller_.viewProps.set("hidden", o);
  11326. }
  11327. dispose() {
  11328. this.controller_.viewProps.set("disposed", true);
  11329. }
  11330. }
  11331. class a {
  11332. constructor(o) {
  11333. this.target = o;
  11334. }
  11335. }
  11336. class c extends a {
  11337. constructor(o, p, f2, x) {
  11338. super(o), this.value = p, this.presetKey = f2, this.last = x ?? true;
  11339. }
  11340. }
  11341. function u(m) {
  11342. return m;
  11343. }
  11344. function h2(m) {
  11345. return m == null;
  11346. }
  11347. const d = {
  11348. alreadydisposed: () => "View has been already disposed",
  11349. invalidparams: (m) => `Invalid parameters for '${m.name}'`,
  11350. nomatchingcontroller: (m) => `No matching controller for '${m.key}'`,
  11351. nomatchingview: (m) => `No matching view for '${JSON.stringify(m.params)}'`,
  11352. notbindable: () => "Value is not bindable",
  11353. propertynotfound: (m) => `Property '${m.name}' not found`,
  11354. shouldneverhappen: () => "This error should never happen"
  11355. };
  11356. class g {
  11357. constructor(o) {
  11358. var p;
  11359. this.message = (p = d[o.type](o.context)) !== null && p !== void 0 ? p : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = o.type;
  11360. }
  11361. static alreadyDisposed() {
  11362. return new g({ type: "alreadydisposed" });
  11363. }
  11364. static notBindable() {
  11365. return new g({
  11366. type: "notbindable"
  11367. });
  11368. }
  11369. static propertyNotFound(o) {
  11370. return new g({
  11371. type: "propertynotfound",
  11372. context: {
  11373. name: o
  11374. }
  11375. });
  11376. }
  11377. static shouldNeverHappen() {
  11378. return new g({ type: "shouldneverhappen" });
  11379. }
  11380. }
  11381. class w {
  11382. constructor() {
  11383. this.observers_ = {};
  11384. }
  11385. on(o, p) {
  11386. let f2 = this.observers_[o];
  11387. return f2 || (f2 = this.observers_[o] = []), f2.push({
  11388. handler: p
  11389. }), this;
  11390. }
  11391. off(o, p) {
  11392. const f2 = this.observers_[o];
  11393. return f2 && (this.observers_[o] = f2.filter((x) => x.handler !== p)), this;
  11394. }
  11395. emit(o, p) {
  11396. const f2 = this.observers_[o];
  11397. f2 && f2.forEach((x) => {
  11398. x.handler(p);
  11399. });
  11400. }
  11401. }
  11402. const _ = "tp";
  11403. function y2(m) {
  11404. return (p, f2) => [
  11405. _,
  11406. "-",
  11407. m,
  11408. "v",
  11409. p ? `_${p}` : "",
  11410. f2 ? `-${f2}` : ""
  11411. ].join("");
  11412. }
  11413. function C(m, o) {
  11414. return (p) => o(m(p));
  11415. }
  11416. function I2(m) {
  11417. return m.rawValue;
  11418. }
  11419. function S2(m, o) {
  11420. m.emitter.on("change", C(I2, o)), o(m.rawValue);
  11421. }
  11422. function R2(m, o, p) {
  11423. S2(m.value(o), p);
  11424. }
  11425. function j2(m, o, p) {
  11426. p ? m.classList.add(o) : m.classList.remove(o);
  11427. }
  11428. function F(m, o) {
  11429. return (p) => {
  11430. j2(m, o, p);
  11431. };
  11432. }
  11433. function V2(m, o) {
  11434. S2(m, (p) => {
  11435. o.textContent = p ?? "";
  11436. });
  11437. }
  11438. const D = y2("btn");
  11439. class Y {
  11440. constructor(o, p) {
  11441. this.element = o.createElement("div"), this.element.classList.add(D()), p.viewProps.bindClassModifiers(this.element);
  11442. const f2 = o.createElement("button");
  11443. f2.classList.add(D("b")), p.viewProps.bindDisabled(f2), this.element.appendChild(f2), this.buttonElement = f2;
  11444. const x = o.createElement("div");
  11445. x.classList.add(D("t")), V2(p.props.value("title"), x), this.buttonElement.appendChild(x);
  11446. }
  11447. }
  11448. class G2 {
  11449. constructor(o, p) {
  11450. this.emitter = new w(), this.onClick_ = this.onClick_.bind(this), this.props = p.props, this.viewProps = p.viewProps, this.view = new Y(o, {
  11451. props: this.props,
  11452. viewProps: this.viewProps
  11453. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  11454. }
  11455. onClick_() {
  11456. this.emitter.emit("click", {
  11457. sender: this
  11458. });
  11459. }
  11460. }
  11461. class N {
  11462. constructor(o, p) {
  11463. var f2;
  11464. this.constraint_ = p == null ? void 0 : p.constraint, this.equals_ = (f2 = p == null ? void 0 : p.equals) !== null && f2 !== void 0 ? f2 : (x, P) => x === P, this.emitter = new w(), this.rawValue_ = o;
  11465. }
  11466. get constraint() {
  11467. return this.constraint_;
  11468. }
  11469. get rawValue() {
  11470. return this.rawValue_;
  11471. }
  11472. set rawValue(o) {
  11473. this.setRawValue(o, {
  11474. forceEmit: false,
  11475. last: true
  11476. });
  11477. }
  11478. setRawValue(o, p) {
  11479. const f2 = p ?? {
  11480. forceEmit: false,
  11481. last: true
  11482. }, x = this.constraint_ ? this.constraint_.constrain(o) : o, P = this.rawValue_;
  11483. this.equals_(P, x) && !f2.forceEmit || (this.emitter.emit("beforechange", {
  11484. sender: this
  11485. }), this.rawValue_ = x, this.emitter.emit("change", {
  11486. options: f2,
  11487. previousRawValue: P,
  11488. rawValue: x,
  11489. sender: this
  11490. }));
  11491. }
  11492. }
  11493. class O {
  11494. constructor(o) {
  11495. this.emitter = new w(), this.value_ = o;
  11496. }
  11497. get rawValue() {
  11498. return this.value_;
  11499. }
  11500. set rawValue(o) {
  11501. this.setRawValue(o, {
  11502. forceEmit: false,
  11503. last: true
  11504. });
  11505. }
  11506. setRawValue(o, p) {
  11507. const f2 = p ?? {
  11508. forceEmit: false,
  11509. last: true
  11510. }, x = this.value_;
  11511. x === o && !f2.forceEmit || (this.emitter.emit("beforechange", {
  11512. sender: this
  11513. }), this.value_ = o, this.emitter.emit("change", {
  11514. options: f2,
  11515. previousRawValue: x,
  11516. rawValue: this.value_,
  11517. sender: this
  11518. }));
  11519. }
  11520. }
  11521. function H2(m, o) {
  11522. const p = o == null ? void 0 : o.constraint, f2 = o == null ? void 0 : o.equals;
  11523. return !p && !f2 ? new O(m) : new N(m, o);
  11524. }
  11525. class K {
  11526. constructor(o) {
  11527. this.emitter = new w(), this.valMap_ = o;
  11528. for (const p in this.valMap_)
  11529. this.valMap_[p].emitter.on("change", () => {
  11530. this.emitter.emit("change", {
  11531. key: p,
  11532. sender: this
  11533. });
  11534. });
  11535. }
  11536. static createCore(o) {
  11537. return Object.keys(o).reduce((f2, x) => Object.assign(f2, {
  11538. [x]: H2(o[x])
  11539. }), {});
  11540. }
  11541. static fromObject(o) {
  11542. const p = this.createCore(o);
  11543. return new K(p);
  11544. }
  11545. get(o) {
  11546. return this.valMap_[o].rawValue;
  11547. }
  11548. set(o, p) {
  11549. this.valMap_[o].rawValue = p;
  11550. }
  11551. value(o) {
  11552. return this.valMap_[o];
  11553. }
  11554. }
  11555. function q(m, o) {
  11556. const f2 = Object.keys(o).reduce((x, P) => {
  11557. if (x === void 0)
  11558. return;
  11559. const L2 = o[P], z = L2(m[P]);
  11560. return z.succeeded ? Object.assign(Object.assign({}, x), { [P]: z.value }) : void 0;
  11561. }, {});
  11562. return f2;
  11563. }
  11564. function he(m, o) {
  11565. return m.reduce((p, f2) => {
  11566. if (p === void 0)
  11567. return;
  11568. const x = o(f2);
  11569. if (!(!x.succeeded || x.value === void 0))
  11570. return [...p, x.value];
  11571. }, []);
  11572. }
  11573. function _e(m) {
  11574. return m === null ? false : typeof m == "object";
  11575. }
  11576. function pe2(m) {
  11577. return (o) => (p) => {
  11578. if (!o && p === void 0)
  11579. return {
  11580. succeeded: false,
  11581. value: void 0
  11582. };
  11583. if (o && p === void 0)
  11584. return {
  11585. succeeded: true,
  11586. value: void 0
  11587. };
  11588. const f2 = m(p);
  11589. return f2 !== void 0 ? {
  11590. succeeded: true,
  11591. value: f2
  11592. } : {
  11593. succeeded: false,
  11594. value: void 0
  11595. };
  11596. };
  11597. }
  11598. function fe2(m) {
  11599. return {
  11600. custom: (o) => pe2(o)(m),
  11601. boolean: pe2((o) => typeof o == "boolean" ? o : void 0)(m),
  11602. number: pe2((o) => typeof o == "number" ? o : void 0)(m),
  11603. string: pe2((o) => typeof o == "string" ? o : void 0)(m),
  11604. function: pe2((o) => typeof o == "function" ? o : void 0)(m),
  11605. constant: (o) => pe2((p) => p === o ? o : void 0)(m),
  11606. raw: pe2((o) => o)(m),
  11607. object: (o) => pe2((p) => {
  11608. if (_e(p))
  11609. return q(p, o);
  11610. })(m),
  11611. array: (o) => pe2((p) => {
  11612. if (Array.isArray(p))
  11613. return he(p, o);
  11614. })(m)
  11615. };
  11616. }
  11617. const de = {
  11618. optional: fe2(true),
  11619. required: fe2(false)
  11620. };
  11621. function ee2(m, o) {
  11622. const p = de.required.object(o)(m);
  11623. return p.succeeded ? p.value : void 0;
  11624. }
  11625. function X(m) {
  11626. console.warn([
  11627. `Missing '${m.key}' of ${m.target} in ${m.place}.`,
  11628. "Please rebuild plugins with the latest core package."
  11629. ].join(" "));
  11630. }
  11631. function Te(m) {
  11632. return m && m.parentElement && m.parentElement.removeChild(m), null;
  11633. }
  11634. class ve {
  11635. constructor(o) {
  11636. this.value_ = o;
  11637. }
  11638. static create(o) {
  11639. return [
  11640. new ve(o),
  11641. (p, f2) => {
  11642. o.setRawValue(p, f2);
  11643. }
  11644. ];
  11645. }
  11646. get emitter() {
  11647. return this.value_.emitter;
  11648. }
  11649. get rawValue() {
  11650. return this.value_.rawValue;
  11651. }
  11652. }
  11653. const le2 = y2("");
  11654. function ie(m, o) {
  11655. return F(m, le2(void 0, o));
  11656. }
  11657. class ge extends K {
  11658. constructor(o) {
  11659. var p;
  11660. super(o), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = ve.create(H2(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (p = this.get("parent")) === null || p === void 0 || p.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  11661. }
  11662. static create(o) {
  11663. var p, f2, x;
  11664. const P = o ?? {};
  11665. return new ge(K.createCore({
  11666. disabled: (p = P.disabled) !== null && p !== void 0 ? p : false,
  11667. disposed: false,
  11668. hidden: (f2 = P.hidden) !== null && f2 !== void 0 ? f2 : false,
  11669. parent: (x = P.parent) !== null && x !== void 0 ? x : null
  11670. }));
  11671. }
  11672. get globalDisabled() {
  11673. return this.globalDisabled_;
  11674. }
  11675. bindClassModifiers(o) {
  11676. S2(this.globalDisabled_, ie(o, "disabled")), R2(this, "hidden", ie(o, "hidden"));
  11677. }
  11678. bindDisabled(o) {
  11679. S2(this.globalDisabled_, (p) => {
  11680. o.disabled = p;
  11681. });
  11682. }
  11683. bindTabIndex(o) {
  11684. S2(this.globalDisabled_, (p) => {
  11685. o.tabIndex = p ? -1 : 0;
  11686. });
  11687. }
  11688. handleDispose(o) {
  11689. this.value("disposed").emitter.on("change", (p) => {
  11690. p && o();
  11691. });
  11692. }
  11693. getGlobalDisabled_() {
  11694. const o = this.get("parent");
  11695. return (o ? o.globalDisabled.rawValue : false) || this.get("disabled");
  11696. }
  11697. updateGlobalDisabled_() {
  11698. this.setGlobalDisabled_(this.getGlobalDisabled_());
  11699. }
  11700. onDisabledChange_() {
  11701. this.updateGlobalDisabled_();
  11702. }
  11703. onParentGlobalDisabledChange_() {
  11704. this.updateGlobalDisabled_();
  11705. }
  11706. onParentChange_(o) {
  11707. var p;
  11708. const f2 = o.previousRawValue;
  11709. f2 == null || f2.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (p = this.get("parent")) === null || p === void 0 || p.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  11710. }
  11711. }
  11712. function M() {
  11713. return ["veryfirst", "first", "last", "verylast"];
  11714. }
  11715. const ce2 = y2(""), De = {
  11716. veryfirst: "vfst",
  11717. first: "fst",
  11718. last: "lst",
  11719. verylast: "vlst"
  11720. };
  11721. class Fe {
  11722. constructor(o) {
  11723. this.parent_ = null, this.blade = o.blade, this.view = o.view, this.viewProps = o.viewProps;
  11724. const p = this.view.element;
  11725. this.blade.value("positions").emitter.on("change", () => {
  11726. M().forEach((f2) => {
  11727. p.classList.remove(ce2(void 0, De[f2]));
  11728. }), this.blade.get("positions").forEach((f2) => {
  11729. p.classList.add(ce2(void 0, De[f2]));
  11730. });
  11731. }), this.viewProps.handleDispose(() => {
  11732. Te(p);
  11733. });
  11734. }
  11735. get parent() {
  11736. return this.parent_;
  11737. }
  11738. set parent(o) {
  11739. if (this.parent_ = o, !("parent" in this.viewProps.valMap_)) {
  11740. X({
  11741. key: "parent",
  11742. target: ge.name,
  11743. place: "BladeController.parent"
  11744. });
  11745. return;
  11746. }
  11747. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  11748. }
  11749. }
  11750. const ye = "http://www.w3.org/2000/svg";
  11751. function ot2(m) {
  11752. m.offsetHeight;
  11753. }
  11754. function zn(m, o) {
  11755. const p = m.style.transition;
  11756. m.style.transition = "none", o(), m.style.transition = p;
  11757. }
  11758. function Ye2(m) {
  11759. return m.ontouchstart !== void 0;
  11760. }
  11761. function Un(m) {
  11762. for (; m.childNodes.length > 0; )
  11763. m.removeChild(m.childNodes[0]);
  11764. }
  11765. function ln(m) {
  11766. return m.relatedTarget ? m.relatedTarget : "explicitOriginalTarget" in m ? m.explicitOriginalTarget : null;
  11767. }
  11768. const vt = y2("lbl");
  11769. function At(m, o) {
  11770. const p = m.createDocumentFragment();
  11771. return o.split(`
  11772. `).map((x) => m.createTextNode(x)).forEach((x, P) => {
  11773. P > 0 && p.appendChild(m.createElement("br")), p.appendChild(x);
  11774. }), p;
  11775. }
  11776. class Ue {
  11777. constructor(o, p) {
  11778. this.element = o.createElement("div"), this.element.classList.add(vt()), p.viewProps.bindClassModifiers(this.element);
  11779. const f2 = o.createElement("div");
  11780. f2.classList.add(vt("l")), R2(p.props, "label", (P) => {
  11781. h2(P) ? this.element.classList.add(vt(void 0, "nol")) : (this.element.classList.remove(vt(void 0, "nol")), Un(f2), f2.appendChild(At(o, P)));
  11782. }), this.element.appendChild(f2), this.labelElement = f2;
  11783. const x = o.createElement("div");
  11784. x.classList.add(vt("v")), this.element.appendChild(x), this.valueElement = x;
  11785. }
  11786. }
  11787. class at2 extends Fe {
  11788. constructor(o, p) {
  11789. const f2 = p.valueController.viewProps;
  11790. super(Object.assign(Object.assign({}, p), { view: new Ue(o, {
  11791. props: p.props,
  11792. viewProps: f2
  11793. }), viewProps: f2 })), this.props = p.props, this.valueController = p.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11794. }
  11795. }
  11796. class cn extends Fe {
  11797. constructor(o) {
  11798. super(o), this.value = o.value;
  11799. }
  11800. }
  11801. class bt extends K {
  11802. constructor(o) {
  11803. super(o);
  11804. }
  11805. static create(o) {
  11806. const p = {
  11807. completed: true,
  11808. expanded: o,
  11809. expandedHeight: null,
  11810. shouldFixHeight: false,
  11811. temporaryExpanded: null
  11812. }, f2 = K.createCore(p);
  11813. return new bt(f2);
  11814. }
  11815. get styleExpanded() {
  11816. var o;
  11817. return (o = this.get("temporaryExpanded")) !== null && o !== void 0 ? o : this.get("expanded");
  11818. }
  11819. get styleHeight() {
  11820. if (!this.styleExpanded)
  11821. return "0";
  11822. const o = this.get("expandedHeight");
  11823. return this.get("shouldFixHeight") && !h2(o) ? `${o}px` : "auto";
  11824. }
  11825. bindExpandedClass(o, p) {
  11826. const f2 = () => {
  11827. this.styleExpanded ? o.classList.add(p) : o.classList.remove(p);
  11828. };
  11829. R2(this, "expanded", f2), R2(this, "temporaryExpanded", f2);
  11830. }
  11831. cleanUpTransition() {
  11832. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  11833. }
  11834. }
  11835. function Gn(m) {
  11836. return bt.create(m);
  11837. }
  11838. function mi(m, o) {
  11839. let p = 0;
  11840. return zn(o, () => {
  11841. m.set("expandedHeight", null), m.set("temporaryExpanded", true), ot2(o), p = o.clientHeight, m.set("temporaryExpanded", null), ot2(o);
  11842. }), p;
  11843. }
  11844. function Hn(m, o) {
  11845. o.style.height = m.styleHeight;
  11846. }
  11847. function Kn(m, o) {
  11848. m.value("expanded").emitter.on("beforechange", () => {
  11849. m.set("completed", false), h2(m.get("expandedHeight")) && m.set("expandedHeight", mi(m, o)), m.set("shouldFixHeight", true), ot2(o);
  11850. }), m.emitter.on("change", () => {
  11851. Hn(m, o);
  11852. }), Hn(m, o), o.addEventListener("transitionend", (p) => {
  11853. p.propertyName === "height" && m.cleanUpTransition();
  11854. });
  11855. }
  11856. class Ct {
  11857. constructor(o, p) {
  11858. const f2 = y2(p.viewName);
  11859. this.element = o.createElement("div"), this.element.classList.add(f2()), p.viewProps.bindClassModifiers(this.element);
  11860. }
  11861. }
  11862. class Lt extends cn {
  11863. constructor(o, p) {
  11864. const f2 = p.valueController.viewProps;
  11865. super(Object.assign(Object.assign({}, p), { value: p.valueController.value, view: new Ue(o, {
  11866. props: p.props,
  11867. viewProps: f2
  11868. }), viewProps: f2 })), this.props = p.props, this.valueController = p.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11869. }
  11870. }
  11871. class $n {
  11872. constructor() {
  11873. this.disabled = false, this.emitter = new w();
  11874. }
  11875. dispose() {
  11876. }
  11877. tick() {
  11878. this.disabled || this.emitter.emit("tick", {
  11879. sender: this
  11880. });
  11881. }
  11882. }
  11883. class pn {
  11884. constructor(o, p) {
  11885. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = o, this.emitter = new w(), this.interval_ = p, this.setTimer_();
  11886. }
  11887. get disabled() {
  11888. return this.disabled_;
  11889. }
  11890. set disabled(o) {
  11891. this.disabled_ = o, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  11892. }
  11893. dispose() {
  11894. this.clearTimer_();
  11895. }
  11896. clearTimer_() {
  11897. if (this.timerId_ === null)
  11898. return;
  11899. const o = this.doc_.defaultView;
  11900. o && o.clearInterval(this.timerId_), this.timerId_ = null;
  11901. }
  11902. setTimer_() {
  11903. if (this.clearTimer_(), this.interval_ <= 0)
  11904. return;
  11905. const o = this.doc_.defaultView;
  11906. o && (this.timerId_ = o.setInterval(this.onTick_, this.interval_));
  11907. }
  11908. onTick_() {
  11909. this.disabled_ || this.emitter.emit("tick", {
  11910. sender: this
  11911. });
  11912. }
  11913. }
  11914. class Xn {
  11915. constructor(o) {
  11916. this.constraints = o;
  11917. }
  11918. constrain(o) {
  11919. return this.constraints.reduce((p, f2) => f2.constrain(p), o);
  11920. }
  11921. }
  11922. function Pt(m, o) {
  11923. if (m instanceof o)
  11924. return m;
  11925. if (m instanceof Xn) {
  11926. const p = m.constraints.reduce((f2, x) => f2 || (x instanceof o ? x : null), null);
  11927. if (p)
  11928. return p;
  11929. }
  11930. return null;
  11931. }
  11932. class gt {
  11933. constructor(o) {
  11934. this.values = K.fromObject({
  11935. max: o.max,
  11936. min: o.min
  11937. });
  11938. }
  11939. constrain(o) {
  11940. const p = this.values.get("max"), f2 = this.values.get("min");
  11941. return Math.min(Math.max(o, f2), p);
  11942. }
  11943. }
  11944. class Rt {
  11945. constructor(o) {
  11946. this.values = K.fromObject({
  11947. max: o.max,
  11948. min: o.min
  11949. });
  11950. }
  11951. get maxValue() {
  11952. return this.values.get("max");
  11953. }
  11954. get minValue() {
  11955. return this.values.get("min");
  11956. }
  11957. constrain(o) {
  11958. const p = this.values.get("max"), f2 = this.values.get("min");
  11959. let x = o;
  11960. return h2(f2) || (x = Math.max(x, f2)), h2(p) || (x = Math.min(x, p)), x;
  11961. }
  11962. }
  11963. class A2 {
  11964. constructor(o, p = 0) {
  11965. this.step = o, this.origin = p;
  11966. }
  11967. constrain(o) {
  11968. const p = this.origin % this.step, f2 = Math.round((o - p) / this.step);
  11969. return p + f2 * this.step;
  11970. }
  11971. }
  11972. const U = y2("pop");
  11973. class W {
  11974. constructor(o, p) {
  11975. this.element = o.createElement("div"), this.element.classList.add(U()), p.viewProps.bindClassModifiers(this.element), S2(p.shows, F(this.element, U(void 0, "v")));
  11976. }
  11977. }
  11978. class se2 {
  11979. constructor(o, p) {
  11980. this.shows = H2(false), this.viewProps = p.viewProps, this.view = new W(o, {
  11981. shows: this.shows,
  11982. viewProps: this.viewProps
  11983. });
  11984. }
  11985. }
  11986. const xe = y2("txt");
  11987. class Oe {
  11988. constructor(o, p) {
  11989. this.onChange_ = this.onChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(xe()), p.viewProps.bindClassModifiers(this.element), this.props_ = p.props, this.props_.emitter.on("change", this.onChange_);
  11990. const f2 = o.createElement("input");
  11991. f2.classList.add(xe("i")), f2.type = "text", p.viewProps.bindDisabled(f2), this.element.appendChild(f2), this.inputElement = f2, p.value.emitter.on("change", this.onChange_), this.value_ = p.value, this.refresh();
  11992. }
  11993. refresh() {
  11994. const o = this.props_.get("formatter");
  11995. this.inputElement.value = o(this.value_.rawValue);
  11996. }
  11997. onChange_() {
  11998. this.refresh();
  11999. }
  12000. }
  12001. class Ht {
  12002. constructor(o, p) {
  12003. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = p.parser, this.props = p.props, this.value = p.value, this.viewProps = p.viewProps, this.view = new Oe(o, {
  12004. props: p.props,
  12005. value: this.value,
  12006. viewProps: this.viewProps
  12007. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  12008. }
  12009. onInputChange_(o) {
  12010. const f2 = o.currentTarget.value, x = this.parser_(f2);
  12011. h2(x) || (this.value.rawValue = x), this.view.refresh();
  12012. }
  12013. }
  12014. function un(m) {
  12015. return m === "false" ? false : !!m;
  12016. }
  12017. class Ge {
  12018. constructor(o) {
  12019. this.text = o;
  12020. }
  12021. evaluate() {
  12022. return Number(this.text);
  12023. }
  12024. toString() {
  12025. return this.text;
  12026. }
  12027. }
  12028. const He = {
  12029. "**": (m, o) => Math.pow(m, o),
  12030. "*": (m, o) => m * o,
  12031. "/": (m, o) => m / o,
  12032. "%": (m, o) => m % o,
  12033. "+": (m, o) => m + o,
  12034. "-": (m, o) => m - o,
  12035. "<<": (m, o) => m << o,
  12036. ">>": (m, o) => m >> o,
  12037. ">>>": (m, o) => m >>> o,
  12038. "&": (m, o) => m & o,
  12039. "^": (m, o) => m ^ o,
  12040. "|": (m, o) => m | o
  12041. };
  12042. class $s {
  12043. constructor(o, p, f2) {
  12044. this.left = p, this.operator = o, this.right = f2;
  12045. }
  12046. evaluate() {
  12047. const o = He[this.operator];
  12048. if (!o)
  12049. throw new Error(`unexpected binary operator: '${this.operator}`);
  12050. return o(this.left.evaluate(), this.right.evaluate());
  12051. }
  12052. toString() {
  12053. return [
  12054. "b(",
  12055. this.left.toString(),
  12056. this.operator,
  12057. this.right.toString(),
  12058. ")"
  12059. ].join(" ");
  12060. }
  12061. }
  12062. const Xs = {
  12063. "+": (m) => m,
  12064. "-": (m) => -m,
  12065. "~": (m) => ~m
  12066. };
  12067. class Ys {
  12068. constructor(o, p) {
  12069. this.operator = o, this.expression = p;
  12070. }
  12071. evaluate() {
  12072. const o = Xs[this.operator];
  12073. if (!o)
  12074. throw new Error(`unexpected unary operator: '${this.operator}`);
  12075. return o(this.expression.evaluate());
  12076. }
  12077. toString() {
  12078. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  12079. }
  12080. }
  12081. function fi(m) {
  12082. return (o, p) => {
  12083. for (let f2 = 0; f2 < m.length; f2++) {
  12084. const x = m[f2](o, p);
  12085. if (x !== "")
  12086. return x;
  12087. }
  12088. return "";
  12089. };
  12090. }
  12091. function It(m, o) {
  12092. var p;
  12093. const f2 = m.substr(o).match(/^\s+/);
  12094. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12095. }
  12096. function vi(m, o) {
  12097. const p = m.substr(o, 1);
  12098. return p.match(/^[1-9]$/) ? p : "";
  12099. }
  12100. function Be(m, o) {
  12101. var p;
  12102. const f2 = m.substr(o).match(/^[0-9]+/);
  12103. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12104. }
  12105. function bi(m, o) {
  12106. const p = Be(m, o);
  12107. if (p !== "")
  12108. return p;
  12109. const f2 = m.substr(o, 1);
  12110. if (o += 1, f2 !== "-" && f2 !== "+")
  12111. return "";
  12112. const x = Be(m, o);
  12113. return x === "" ? "" : f2 + x;
  12114. }
  12115. function lt2(m, o) {
  12116. const p = m.substr(o, 1);
  12117. if (o += 1, p.toLowerCase() !== "e")
  12118. return "";
  12119. const f2 = bi(m, o);
  12120. return f2 === "" ? "" : p + f2;
  12121. }
  12122. function is(m, o) {
  12123. const p = m.substr(o, 1);
  12124. if (p === "0")
  12125. return p;
  12126. const f2 = vi(m, o);
  12127. return o += f2.length, f2 === "" ? "" : f2 + Be(m, o);
  12128. }
  12129. function hn(m, o) {
  12130. const p = is(m, o);
  12131. if (o += p.length, p === "")
  12132. return "";
  12133. const f2 = m.substr(o, 1);
  12134. if (o += f2.length, f2 !== ".")
  12135. return "";
  12136. const x = Be(m, o);
  12137. return o += x.length, p + f2 + x + lt2(m, o);
  12138. }
  12139. function ss(m, o) {
  12140. const p = m.substr(o, 1);
  12141. if (o += p.length, p !== ".")
  12142. return "";
  12143. const f2 = Be(m, o);
  12144. return o += f2.length, f2 === "" ? "" : p + f2 + lt2(m, o);
  12145. }
  12146. function Yn(m, o) {
  12147. const p = is(m, o);
  12148. return o += p.length, p === "" ? "" : p + lt2(m, o);
  12149. }
  12150. const gi = fi([
  12151. hn,
  12152. ss,
  12153. Yn
  12154. ]);
  12155. function _i(m, o) {
  12156. var p;
  12157. const f2 = m.substr(o).match(/^[01]+/);
  12158. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12159. }
  12160. function qs(m, o) {
  12161. const p = m.substr(o, 2);
  12162. if (o += p.length, p.toLowerCase() !== "0b")
  12163. return "";
  12164. const f2 = _i(m, o);
  12165. return f2 === "" ? "" : p + f2;
  12166. }
  12167. function Qs(m, o) {
  12168. var p;
  12169. const f2 = m.substr(o).match(/^[0-7]+/);
  12170. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12171. }
  12172. function Zs(m, o) {
  12173. const p = m.substr(o, 2);
  12174. if (o += p.length, p.toLowerCase() !== "0o")
  12175. return "";
  12176. const f2 = Qs(m, o);
  12177. return f2 === "" ? "" : p + f2;
  12178. }
  12179. function Ws(m, o) {
  12180. var p;
  12181. const f2 = m.substr(o).match(/^[0-9a-f]+/i);
  12182. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12183. }
  12184. function wi(m, o) {
  12185. const p = m.substr(o, 2);
  12186. if (o += p.length, p.toLowerCase() !== "0x")
  12187. return "";
  12188. const f2 = Ws(m, o);
  12189. return f2 === "" ? "" : p + f2;
  12190. }
  12191. const Js = fi([
  12192. qs,
  12193. Zs,
  12194. wi
  12195. ]), er = fi([
  12196. Js,
  12197. gi
  12198. ]);
  12199. function dn(m, o) {
  12200. const p = er(m, o);
  12201. return o += p.length, p === "" ? null : {
  12202. evaluable: new Ge(p),
  12203. cursor: o
  12204. };
  12205. }
  12206. function rs(m, o) {
  12207. const p = m.substr(o, 1);
  12208. if (o += p.length, p !== "(")
  12209. return null;
  12210. const f2 = yi(m, o);
  12211. if (!f2)
  12212. return null;
  12213. o = f2.cursor, o += It(m, o).length;
  12214. const x = m.substr(o, 1);
  12215. return o += x.length, x !== ")" ? null : {
  12216. evaluable: f2.evaluable,
  12217. cursor: o
  12218. };
  12219. }
  12220. function tr(m, o) {
  12221. var p;
  12222. return (p = dn(m, o)) !== null && p !== void 0 ? p : rs(m, o);
  12223. }
  12224. function qn(m, o) {
  12225. const p = tr(m, o);
  12226. if (p)
  12227. return p;
  12228. const f2 = m.substr(o, 1);
  12229. if (o += f2.length, f2 !== "+" && f2 !== "-" && f2 !== "~")
  12230. return null;
  12231. const x = qn(m, o);
  12232. return x ? (o = x.cursor, {
  12233. cursor: o,
  12234. evaluable: new Ys(f2, x.evaluable)
  12235. }) : null;
  12236. }
  12237. function nr(m, o, p) {
  12238. p += It(o, p).length;
  12239. const f2 = m.filter((x) => o.startsWith(x, p))[0];
  12240. return f2 ? (p += f2.length, p += It(o, p).length, {
  12241. cursor: p,
  12242. operator: f2
  12243. }) : null;
  12244. }
  12245. function Kt(m, o) {
  12246. return (p, f2) => {
  12247. const x = m(p, f2);
  12248. if (!x)
  12249. return null;
  12250. f2 = x.cursor;
  12251. let P = x.evaluable;
  12252. for (; ; ) {
  12253. const L2 = nr(o, p, f2);
  12254. if (!L2)
  12255. break;
  12256. f2 = L2.cursor;
  12257. const z = m(p, f2);
  12258. if (!z)
  12259. return null;
  12260. f2 = z.cursor, P = new $s(L2.operator, P, z.evaluable);
  12261. }
  12262. return P ? {
  12263. cursor: f2,
  12264. evaluable: P
  12265. } : null;
  12266. };
  12267. }
  12268. const os = [
  12269. ["**"],
  12270. ["*", "/", "%"],
  12271. ["+", "-"],
  12272. ["<<", ">>>", ">>"],
  12273. ["&"],
  12274. ["^"],
  12275. ["|"]
  12276. ].reduce((m, o) => Kt(m, o), qn);
  12277. function yi(m, o) {
  12278. return o += It(m, o).length, os(m, o);
  12279. }
  12280. function ir(m) {
  12281. const o = yi(m, 0);
  12282. return !o || o.cursor + It(m, o.cursor).length !== m.length ? null : o.evaluable;
  12283. }
  12284. function mn(m) {
  12285. var o;
  12286. const p = ir(m);
  12287. return (o = p == null ? void 0 : p.evaluate()) !== null && o !== void 0 ? o : null;
  12288. }
  12289. function sr(m) {
  12290. if (typeof m == "number")
  12291. return m;
  12292. if (typeof m == "string") {
  12293. const o = mn(m);
  12294. if (!h2(o))
  12295. return o;
  12296. }
  12297. return 0;
  12298. }
  12299. function Re(m) {
  12300. return (o) => o.toFixed(Math.max(Math.min(m, 20), 0));
  12301. }
  12302. const rr = Re(0);
  12303. function Qn(m) {
  12304. return rr(m) + "%";
  12305. }
  12306. function as(m) {
  12307. return String(m);
  12308. }
  12309. function xi(m, o) {
  12310. for (; m.length < o; )
  12311. m.push(void 0);
  12312. }
  12313. function ls(m) {
  12314. const o = [];
  12315. return xi(o, m), H2(o);
  12316. }
  12317. function cs(m) {
  12318. const o = m.indexOf(void 0);
  12319. return o < 0 ? m : m.slice(0, o);
  12320. }
  12321. function or(m, o) {
  12322. const p = [...cs(m), o];
  12323. return p.length > m.length ? p.splice(0, p.length - m.length) : xi(p, m.length), p;
  12324. }
  12325. function $t({ primary: m, secondary: o, forward: p, backward: f2 }) {
  12326. let x = false;
  12327. function P(L2) {
  12328. x || (x = true, L2(), x = false);
  12329. }
  12330. m.emitter.on("change", (L2) => {
  12331. P(() => {
  12332. o.setRawValue(p(m, o), L2.options);
  12333. });
  12334. }), o.emitter.on("change", (L2) => {
  12335. P(() => {
  12336. m.setRawValue(f2(m, o), L2.options);
  12337. }), P(() => {
  12338. o.setRawValue(p(m, o), L2.options);
  12339. });
  12340. }), P(() => {
  12341. o.setRawValue(p(m, o), {
  12342. forceEmit: false,
  12343. last: true
  12344. });
  12345. });
  12346. }
  12347. function Xt(m, o) {
  12348. const p = m * (o.altKey ? 0.1 : 1) * (o.shiftKey ? 10 : 1);
  12349. return o.upKey ? +p : o.downKey ? -p : 0;
  12350. }
  12351. function fn(m) {
  12352. return {
  12353. altKey: m.altKey,
  12354. downKey: m.key === "ArrowDown",
  12355. shiftKey: m.shiftKey,
  12356. upKey: m.key === "ArrowUp"
  12357. };
  12358. }
  12359. function Ei(m) {
  12360. return {
  12361. altKey: m.altKey,
  12362. downKey: m.key === "ArrowLeft",
  12363. shiftKey: m.shiftKey,
  12364. upKey: m.key === "ArrowRight"
  12365. };
  12366. }
  12367. function ar(m) {
  12368. return m === "ArrowUp" || m === "ArrowDown";
  12369. }
  12370. function ps(m) {
  12371. return ar(m) || m === "ArrowLeft" || m === "ArrowRight";
  12372. }
  12373. function Ci(m, o) {
  12374. var p, f2;
  12375. const x = o.ownerDocument.defaultView, P = o.getBoundingClientRect();
  12376. return {
  12377. x: m.pageX - (((p = x && x.scrollX) !== null && p !== void 0 ? p : 0) + P.left),
  12378. y: m.pageY - (((f2 = x && x.scrollY) !== null && f2 !== void 0 ? f2 : 0) + P.top)
  12379. };
  12380. }
  12381. class Zn {
  12382. constructor(o) {
  12383. this.lastTouch_ = null, this.onDocumentMouseMove_ = this.onDocumentMouseMove_.bind(this), this.onDocumentMouseUp_ = this.onDocumentMouseUp_.bind(this), this.onMouseDown_ = this.onMouseDown_.bind(this), this.onTouchEnd_ = this.onTouchEnd_.bind(this), this.onTouchMove_ = this.onTouchMove_.bind(this), this.onTouchStart_ = this.onTouchStart_.bind(this), this.elem_ = o, this.emitter = new w(), o.addEventListener("touchstart", this.onTouchStart_, {
  12384. passive: false
  12385. }), o.addEventListener("touchmove", this.onTouchMove_, {
  12386. passive: true
  12387. }), o.addEventListener("touchend", this.onTouchEnd_), o.addEventListener("mousedown", this.onMouseDown_);
  12388. }
  12389. computePosition_(o) {
  12390. const p = this.elem_.getBoundingClientRect();
  12391. return {
  12392. bounds: {
  12393. width: p.width,
  12394. height: p.height
  12395. },
  12396. point: o ? {
  12397. x: o.x,
  12398. y: o.y
  12399. } : null
  12400. };
  12401. }
  12402. onMouseDown_(o) {
  12403. var p;
  12404. o.preventDefault(), (p = o.currentTarget) === null || p === void 0 || p.focus();
  12405. const f2 = this.elem_.ownerDocument;
  12406. f2.addEventListener("mousemove", this.onDocumentMouseMove_), f2.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  12407. altKey: o.altKey,
  12408. data: this.computePosition_(Ci(o, this.elem_)),
  12409. sender: this,
  12410. shiftKey: o.shiftKey
  12411. });
  12412. }
  12413. onDocumentMouseMove_(o) {
  12414. this.emitter.emit("move", {
  12415. altKey: o.altKey,
  12416. data: this.computePosition_(Ci(o, this.elem_)),
  12417. sender: this,
  12418. shiftKey: o.shiftKey
  12419. });
  12420. }
  12421. onDocumentMouseUp_(o) {
  12422. const p = this.elem_.ownerDocument;
  12423. p.removeEventListener("mousemove", this.onDocumentMouseMove_), p.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  12424. altKey: o.altKey,
  12425. data: this.computePosition_(Ci(o, this.elem_)),
  12426. sender: this,
  12427. shiftKey: o.shiftKey
  12428. });
  12429. }
  12430. onTouchStart_(o) {
  12431. o.preventDefault();
  12432. const p = o.targetTouches.item(0), f2 = this.elem_.getBoundingClientRect();
  12433. this.emitter.emit("down", {
  12434. altKey: o.altKey,
  12435. data: this.computePosition_(p ? {
  12436. x: p.clientX - f2.left,
  12437. y: p.clientY - f2.top
  12438. } : void 0),
  12439. sender: this,
  12440. shiftKey: o.shiftKey
  12441. }), this.lastTouch_ = p;
  12442. }
  12443. onTouchMove_(o) {
  12444. const p = o.targetTouches.item(0), f2 = this.elem_.getBoundingClientRect();
  12445. this.emitter.emit("move", {
  12446. altKey: o.altKey,
  12447. data: this.computePosition_(p ? {
  12448. x: p.clientX - f2.left,
  12449. y: p.clientY - f2.top
  12450. } : void 0),
  12451. sender: this,
  12452. shiftKey: o.shiftKey
  12453. }), this.lastTouch_ = p;
  12454. }
  12455. onTouchEnd_(o) {
  12456. var p;
  12457. const f2 = (p = o.targetTouches.item(0)) !== null && p !== void 0 ? p : this.lastTouch_, x = this.elem_.getBoundingClientRect();
  12458. this.emitter.emit("up", {
  12459. altKey: o.altKey,
  12460. data: this.computePosition_(f2 ? {
  12461. x: f2.clientX - x.left,
  12462. y: f2.clientY - x.top
  12463. } : void 0),
  12464. sender: this,
  12465. shiftKey: o.shiftKey
  12466. });
  12467. }
  12468. }
  12469. function Se(m, o, p, f2, x) {
  12470. const P = (m - o) / (p - o);
  12471. return f2 + P * (x - f2);
  12472. }
  12473. function us(m) {
  12474. return String(m.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  12475. }
  12476. function Yt(m, o, p) {
  12477. return Math.min(Math.max(m, o), p);
  12478. }
  12479. const qe2 = y2("txt");
  12480. class lr {
  12481. constructor(o, p) {
  12482. this.onChange_ = this.onChange_.bind(this), this.props_ = p.props, this.props_.emitter.on("change", this.onChange_), this.element = o.createElement("div"), this.element.classList.add(qe2(), qe2(void 0, "num")), p.arrayPosition && this.element.classList.add(qe2(void 0, p.arrayPosition)), p.viewProps.bindClassModifiers(this.element);
  12483. const f2 = o.createElement("input");
  12484. f2.classList.add(qe2("i")), f2.type = "text", p.viewProps.bindDisabled(f2), this.element.appendChild(f2), this.inputElement = f2, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = p.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(qe2()), this.inputElement.classList.add(qe2("i"));
  12485. const x = o.createElement("div");
  12486. x.classList.add(qe2("k")), this.element.appendChild(x), this.knobElement = x;
  12487. const P = o.createElementNS(ye, "svg");
  12488. P.classList.add(qe2("g")), this.knobElement.appendChild(P);
  12489. const L2 = o.createElementNS(ye, "path");
  12490. L2.classList.add(qe2("gb")), P.appendChild(L2), this.guideBodyElem_ = L2;
  12491. const z = o.createElementNS(ye, "path");
  12492. z.classList.add(qe2("gh")), P.appendChild(z), this.guideHeadElem_ = z;
  12493. const ae = o.createElement("div");
  12494. ae.classList.add(y2("tt")()), this.knobElement.appendChild(ae), this.tooltipElem_ = ae, p.value.emitter.on("change", this.onChange_), this.value = p.value, this.refresh();
  12495. }
  12496. onDraggingChange_(o) {
  12497. if (o.rawValue === null) {
  12498. this.element.classList.remove(qe2(void 0, "drg"));
  12499. return;
  12500. }
  12501. this.element.classList.add(qe2(void 0, "drg"));
  12502. const p = o.rawValue / this.props_.get("draggingScale"), f2 = p + (p > 0 ? -1 : p < 0 ? 1 : 0), x = Yt(-f2, -4, 4);
  12503. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${f2 + x},0 L${f2},4 L${f2 + x},8`, `M ${p},-1 L${p},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${p},4`);
  12504. const P = this.props_.get("formatter");
  12505. this.tooltipElem_.textContent = P(this.value.rawValue), this.tooltipElem_.style.left = `${p}px`;
  12506. }
  12507. refresh() {
  12508. const o = this.props_.get("formatter");
  12509. this.inputElement.value = o(this.value.rawValue);
  12510. }
  12511. onChange_() {
  12512. this.refresh();
  12513. }
  12514. }
  12515. class vn {
  12516. constructor(o, p) {
  12517. var f2;
  12518. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = p.baseStep, this.parser_ = p.parser, this.props = p.props, this.sliderProps_ = (f2 = p.sliderProps) !== null && f2 !== void 0 ? f2 : null, this.value = p.value, this.viewProps = p.viewProps, this.dragging_ = H2(null), this.view = new lr(o, {
  12519. arrayPosition: p.arrayPosition,
  12520. dragging: this.dragging_,
  12521. props: this.props,
  12522. value: this.value,
  12523. viewProps: this.viewProps
  12524. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  12525. const x = new Zn(this.view.knobElement);
  12526. x.emitter.on("down", this.onPointerDown_), x.emitter.on("move", this.onPointerMove_), x.emitter.on("up", this.onPointerUp_);
  12527. }
  12528. constrainValue_(o) {
  12529. var p, f2;
  12530. const x = (p = this.sliderProps_) === null || p === void 0 ? void 0 : p.get("minValue"), P = (f2 = this.sliderProps_) === null || f2 === void 0 ? void 0 : f2.get("maxValue");
  12531. let L2 = o;
  12532. return x !== void 0 && (L2 = Math.max(L2, x)), P !== void 0 && (L2 = Math.min(L2, P)), L2;
  12533. }
  12534. onInputChange_(o) {
  12535. const f2 = o.currentTarget.value, x = this.parser_(f2);
  12536. h2(x) || (this.value.rawValue = this.constrainValue_(x)), this.view.refresh();
  12537. }
  12538. onInputKeyDown_(o) {
  12539. const p = Xt(this.baseStep_, fn(o));
  12540. p !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + p), {
  12541. forceEmit: false,
  12542. last: false
  12543. });
  12544. }
  12545. onInputKeyUp_(o) {
  12546. Xt(this.baseStep_, fn(o)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  12547. forceEmit: true,
  12548. last: true
  12549. });
  12550. }
  12551. onPointerDown_() {
  12552. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  12553. }
  12554. computeDraggingValue_(o) {
  12555. if (!o.point)
  12556. return null;
  12557. const p = o.point.x - o.bounds.width / 2;
  12558. return this.constrainValue_(this.originRawValue_ + p * this.props.get("draggingScale"));
  12559. }
  12560. onPointerMove_(o) {
  12561. const p = this.computeDraggingValue_(o.data);
  12562. p !== null && (this.value.setRawValue(p, {
  12563. forceEmit: false,
  12564. last: false
  12565. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  12566. }
  12567. onPointerUp_(o) {
  12568. const p = this.computeDraggingValue_(o.data);
  12569. p !== null && (this.value.setRawValue(p, {
  12570. forceEmit: true,
  12571. last: true
  12572. }), this.dragging_.rawValue = null);
  12573. }
  12574. }
  12575. function it2(m, o) {
  12576. m.write(o);
  12577. }
  12578. function qt(m) {
  12579. const o = m ? Pt(m, A2) : null;
  12580. return o ? o.step : null;
  12581. }
  12582. function bn(m, o) {
  12583. const p = m && Pt(m, A2);
  12584. return p ? us(p.step) : Math.max(us(o), 2);
  12585. }
  12586. function Pi(m) {
  12587. const o = qt(m);
  12588. return o ?? 1;
  12589. }
  12590. function Wn(m, o) {
  12591. var p;
  12592. const f2 = m && Pt(m, A2), x = Math.abs((p = f2 == null ? void 0 : f2.step) !== null && p !== void 0 ? p : o);
  12593. return x === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(x)) - 1);
  12594. }
  12595. function Qt(m) {
  12596. return [m[0], m[1], m[2]];
  12597. }
  12598. function hs(m) {
  12599. const o = Yt(Math.floor(m), 0, 255).toString(16);
  12600. return o.length === 1 ? `0${o}` : o;
  12601. }
  12602. function gn(m, o = "#") {
  12603. const p = Qt(m.getComponents("rgb")).map(hs).join("");
  12604. return `${o}${p}`;
  12605. }
  12606. function ds(m, o = "#") {
  12607. const p = m.getComponents("rgb"), f2 = [p[0], p[1], p[2], p[3] * 255].map(hs).join("");
  12608. return `${o}${f2}`;
  12609. }
  12610. function cr(m, o) {
  12611. const p = Re(o === "float" ? 2 : 0);
  12612. return `rgb(${Qt(m.getComponents("rgb", o)).map((x) => p(x)).join(", ")})`;
  12613. }
  12614. function ms(m) {
  12615. return (o) => cr(o, m);
  12616. }
  12617. function fs(m, o) {
  12618. const p = Re(2), f2 = Re(o === "float" ? 2 : 0);
  12619. return `rgba(${m.getComponents("rgb", o).map((P, L2) => (L2 === 3 ? p : f2)(P)).join(", ")})`;
  12620. }
  12621. function pr(m) {
  12622. return (o) => fs(o, m);
  12623. }
  12624. function Jn(m) {
  12625. const o = [
  12626. Re(0),
  12627. Qn,
  12628. Qn
  12629. ];
  12630. return `hsl(${Qt(m.getComponents("hsl")).map((f2, x) => o[x](f2)).join(", ")})`;
  12631. }
  12632. function ur(m) {
  12633. const o = [
  12634. Re(0),
  12635. Qn,
  12636. Qn,
  12637. Re(2)
  12638. ];
  12639. return `hsla(${m.getComponents("hsl").map((f2, x) => o[x](f2)).join(", ")})`;
  12640. }
  12641. function vs(m, o) {
  12642. const p = Re(o === "float" ? 2 : 0), f2 = ["r", "g", "b"];
  12643. return `{${Qt(m.getComponents("rgb", o)).map((P, L2) => `${f2[L2]}: ${p(P)}`).join(", ")}}`;
  12644. }
  12645. function bs(m) {
  12646. return (o) => vs(o, m);
  12647. }
  12648. function hr(m, o) {
  12649. const p = Re(2), f2 = Re(o === "float" ? 2 : 0), x = ["r", "g", "b", "a"];
  12650. return `{${m.getComponents("rgb", o).map((L2, z) => {
  12651. const ae = z === 3 ? p : f2;
  12652. return `${x[z]}: ${ae(L2)}`;
  12653. }).join(", ")}}`;
  12654. }
  12655. function dr(m) {
  12656. return (o) => hr(o, m);
  12657. }
  12658. [
  12659. ...["int", "float"].reduce((m, o) => [
  12660. ...m,
  12661. {
  12662. format: {
  12663. alpha: false,
  12664. mode: "rgb",
  12665. notation: "func",
  12666. type: o
  12667. },
  12668. stringifier: ms(o)
  12669. },
  12670. {
  12671. format: {
  12672. alpha: true,
  12673. mode: "rgb",
  12674. notation: "func",
  12675. type: o
  12676. },
  12677. stringifier: pr(o)
  12678. },
  12679. {
  12680. format: {
  12681. alpha: false,
  12682. mode: "rgb",
  12683. notation: "object",
  12684. type: o
  12685. },
  12686. stringifier: bs(o)
  12687. },
  12688. {
  12689. format: {
  12690. alpha: true,
  12691. mode: "rgb",
  12692. notation: "object",
  12693. type: o
  12694. },
  12695. stringifier: dr(o)
  12696. }
  12697. ], [])
  12698. ];
  12699. class mr {
  12700. constructor(o) {
  12701. this.components = o.components, this.asm_ = o.assembly;
  12702. }
  12703. constrain(o) {
  12704. const p = this.asm_.toComponents(o).map((f2, x) => {
  12705. var P, L2;
  12706. return (L2 = (P = this.components[x]) === null || P === void 0 ? void 0 : P.constrain(f2)) !== null && L2 !== void 0 ? L2 : f2;
  12707. });
  12708. return this.asm_.fromComponents(p);
  12709. }
  12710. }
  12711. const gs = y2("pndtxt");
  12712. class fr {
  12713. constructor(o, p) {
  12714. this.textViews = p.textViews, this.element = o.createElement("div"), this.element.classList.add(gs()), this.textViews.forEach((f2) => {
  12715. const x = o.createElement("div");
  12716. x.classList.add(gs("a")), x.appendChild(f2.element), this.element.appendChild(x);
  12717. });
  12718. }
  12719. }
  12720. function Ti(m, o, p) {
  12721. return new vn(m, {
  12722. arrayPosition: p === 0 ? "fst" : p === o.axes.length - 1 ? "lst" : "mid",
  12723. baseStep: o.axes[p].baseStep,
  12724. parser: o.parser,
  12725. props: o.axes[p].textProps,
  12726. value: H2(0, {
  12727. constraint: o.axes[p].constraint
  12728. }),
  12729. viewProps: o.viewProps
  12730. });
  12731. }
  12732. class Vt {
  12733. constructor(o, p) {
  12734. this.value = p.value, this.viewProps = p.viewProps, this.acs_ = p.axes.map((f2, x) => Ti(o, p, x)), this.acs_.forEach((f2, x) => {
  12735. $t({
  12736. primary: this.value,
  12737. secondary: f2.value,
  12738. forward: (P) => p.assembly.toComponents(P.rawValue)[x],
  12739. backward: (P, L2) => {
  12740. const z = p.assembly.toComponents(P.rawValue);
  12741. return z[x] = L2.rawValue, p.assembly.fromComponents(z);
  12742. }
  12743. });
  12744. }), this.view = new fr(o, {
  12745. textViews: this.acs_.map((f2) => f2.view)
  12746. });
  12747. }
  12748. }
  12749. function vr(m, o) {
  12750. return "step" in m && !h2(m.step) ? new A2(m.step, o) : null;
  12751. }
  12752. function _n(m) {
  12753. return !h2(m.max) && !h2(m.min) ? new gt({
  12754. max: m.max,
  12755. min: m.min
  12756. }) : !h2(m.max) || !h2(m.min) ? new Rt({
  12757. max: m.max,
  12758. min: m.min
  12759. }) : null;
  12760. }
  12761. const br = {
  12762. monitor: {
  12763. defaultInterval: 200,
  12764. defaultLineCount: 3
  12765. }
  12766. }, ct2 = y2("grl");
  12767. class _s {
  12768. constructor(o, p) {
  12769. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = o.createElement("div"), this.element.classList.add(ct2()), p.viewProps.bindClassModifiers(this.element), this.formatter_ = p.formatter, this.props_ = p.props, this.cursor_ = p.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  12770. const f2 = o.createElementNS(ye, "svg");
  12771. f2.classList.add(ct2("g")), f2.style.height = `calc(var(--bld-us) * ${p.lineCount})`, this.element.appendChild(f2), this.svgElem_ = f2;
  12772. const x = o.createElementNS(ye, "polyline");
  12773. this.svgElem_.appendChild(x), this.lineElem_ = x;
  12774. const P = o.createElement("div");
  12775. P.classList.add(ct2("t"), y2("tt")()), this.element.appendChild(P), this.tooltipElem_ = P, p.value.emitter.on("change", this.onValueUpdate_), this.value = p.value, this.update_();
  12776. }
  12777. get graphElement() {
  12778. return this.svgElem_;
  12779. }
  12780. update_() {
  12781. const o = this.svgElem_.getBoundingClientRect(), p = this.value.rawValue.length - 1, f2 = this.props_.get("minValue"), x = this.props_.get("maxValue"), P = [];
  12782. this.value.rawValue.forEach((We, ne) => {
  12783. if (We === void 0)
  12784. return;
  12785. const Mt = Se(ne, 0, p, 0, o.width), Lr = Se(We, f2, x, o.height, 0);
  12786. P.push([Mt, Lr].join(","));
  12787. }), this.lineElem_.setAttributeNS(null, "points", P.join(" "));
  12788. const L2 = this.tooltipElem_, z = this.value.rawValue[this.cursor_.rawValue];
  12789. if (z === void 0) {
  12790. L2.classList.remove(ct2("t", "a"));
  12791. return;
  12792. }
  12793. const ae = Se(this.cursor_.rawValue, 0, p, 0, o.width), Ze2 = Se(z, f2, x, o.height, 0);
  12794. L2.style.left = `${ae}px`, L2.style.top = `${Ze2}px`, L2.textContent = `${this.formatter_(z)}`, L2.classList.contains(ct2("t", "a")) || (L2.classList.add(ct2("t", "a"), ct2("t", "in")), ot2(L2), L2.classList.remove(ct2("t", "in")));
  12795. }
  12796. onValueUpdate_() {
  12797. this.update_();
  12798. }
  12799. onCursorChange_() {
  12800. this.update_();
  12801. }
  12802. }
  12803. class gr {
  12804. constructor(o, p) {
  12805. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = p.props, this.value = p.value, this.viewProps = p.viewProps, this.cursor_ = H2(-1), this.view = new _s(o, {
  12806. cursor: this.cursor_,
  12807. formatter: p.formatter,
  12808. lineCount: p.lineCount,
  12809. props: this.props_,
  12810. value: this.value,
  12811. viewProps: this.viewProps
  12812. }), !Ye2(o))
  12813. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  12814. else {
  12815. const f2 = new Zn(this.view.element);
  12816. f2.emitter.on("down", this.onGraphPointerDown_), f2.emitter.on("move", this.onGraphPointerMove_), f2.emitter.on("up", this.onGraphPointerUp_);
  12817. }
  12818. }
  12819. onGraphMouseLeave_() {
  12820. this.cursor_.rawValue = -1;
  12821. }
  12822. onGraphMouseMove_(o) {
  12823. const p = this.view.element.getBoundingClientRect();
  12824. this.cursor_.rawValue = Math.floor(Se(o.offsetX, 0, p.width, 0, this.value.rawValue.length));
  12825. }
  12826. onGraphPointerDown_(o) {
  12827. this.onGraphPointerMove_(o);
  12828. }
  12829. onGraphPointerMove_(o) {
  12830. if (!o.data.point) {
  12831. this.cursor_.rawValue = -1;
  12832. return;
  12833. }
  12834. this.cursor_.rawValue = Math.floor(Se(o.data.point.x, 0, o.data.bounds.width, 0, this.value.rawValue.length));
  12835. }
  12836. onGraphPointerUp_() {
  12837. this.cursor_.rawValue = -1;
  12838. }
  12839. }
  12840. class ws {
  12841. constructor(o) {
  12842. this.controller_ = o;
  12843. }
  12844. get disabled() {
  12845. return this.controller_.viewProps.get("disabled");
  12846. }
  12847. set disabled(o) {
  12848. this.controller_.viewProps.set("disabled", o);
  12849. }
  12850. get title() {
  12851. var o;
  12852. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  12853. }
  12854. set title(o) {
  12855. this.controller_.props.set("title", o);
  12856. }
  12857. on(o, p) {
  12858. const f2 = p.bind(this);
  12859. return this.controller_.emitter.on(o, () => {
  12860. f2(new a(this));
  12861. }), this;
  12862. }
  12863. }
  12864. class _r extends a {
  12865. constructor(o, p, f2) {
  12866. super(o), this.cell = p, this.index = f2;
  12867. }
  12868. }
  12869. class ys extends s {
  12870. constructor(o) {
  12871. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.emitter_ = new w();
  12872. const p = this.controller_.valueController;
  12873. p.cellControllers.forEach((f2, x) => {
  12874. const P = new ws(f2);
  12875. this.cellToApiMap_.set(f2, P), f2.emitter.on("click", () => {
  12876. const L2 = x % p.size[0], z = Math.floor(x / p.size[0]);
  12877. this.emitter_.emit("click", {
  12878. event: new _r(this, P, [L2, z])
  12879. });
  12880. });
  12881. });
  12882. }
  12883. cell(o, p) {
  12884. const f2 = this.controller_.valueController, x = f2.cellControllers[p * f2.size[0] + o];
  12885. return this.cellToApiMap_.get(x);
  12886. }
  12887. on(o, p) {
  12888. const f2 = p.bind(this);
  12889. return this.emitter_.on(o, (x) => {
  12890. f2(x.event);
  12891. }), this;
  12892. }
  12893. }
  12894. class ki {
  12895. constructor(o, p) {
  12896. this.size = p.size;
  12897. const [f2, x] = this.size, P = [];
  12898. for (let L2 = 0; L2 < x; L2++)
  12899. for (let z = 0; z < f2; z++) {
  12900. const ae = new G2(o, {
  12901. props: K.fromObject(Object.assign({}, p.cellConfig(z, L2))),
  12902. viewProps: ge.create()
  12903. });
  12904. P.push(ae);
  12905. }
  12906. this.cellCs_ = P, this.viewProps = ge.create(), this.viewProps.handleDispose(() => {
  12907. this.cellCs_.forEach((L2) => {
  12908. L2.viewProps.set("disposed", true);
  12909. });
  12910. }), this.view = new Ct(o, {
  12911. viewProps: this.viewProps,
  12912. viewName: "btngrid"
  12913. }), this.view.element.style.gridTemplateColumns = `repeat(${f2}, 1fr)`, this.cellCs_.forEach((L2) => {
  12914. this.view.element.appendChild(L2.view.element);
  12915. });
  12916. }
  12917. get cellControllers() {
  12918. return this.cellCs_;
  12919. }
  12920. }
  12921. const wr = {
  12922. id: "buttongrid",
  12923. type: "blade",
  12924. // TODO:
  12925. css: '.tp-cbzgv,.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-radv_b:hover,.tp-rslv_k:hover,.tp-cbzv_b:hover{background-color:var(--btn-bg-h)}.tp-radv_b:focus,.tp-rslv_k:focus,.tp-cbzv_b:focus{background-color:var(--btn-bg-f)}.tp-radv_b:active,.tp-rslv_k:active,.tp-cbzv_b:active{background-color:var(--btn-bg-a)}.tp-radv_b:disabled,.tp-rslv_k:disabled,.tp-cbzv_b:disabled{opacity:.5}.tp-cbzgv{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-cbzgv:hover{background-color:var(--in-bg-h)}.tp-cbzgv:focus{background-color:var(--in-bg-f)}.tp-cbzgv:active{background-color:var(--in-bg-a)}.tp-cbzgv:disabled{opacity:.5}.tp-btngridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-btngridv.tp-v-disabled{opacity:.5}.tp-btngridv .tp-btnv_b:disabled{opacity:1}.tp-btngridv .tp-btnv_b:disabled .tp-btnv_t{opacity:.5}.tp-btngridv .tp-btnv_b{border-radius:0}.tp-cbzv{position:relative}.tp-cbzv_h{display:flex}.tp-cbzv_b{margin-right:4px;position:relative;width:var(--bld-us)}.tp-cbzv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-cbzv_b svg path{stroke:var(--bs-bg);stroke-width:2}.tp-cbzv_t{flex:1}.tp-cbzv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-cbzv.tp-cbzv-expanded .tp-cbzv_p{margin-top:var(--bld-s);opacity:1}.tp-cbzv.tp-cbzv-cpl .tp-cbzv_p{overflow:visible}.tp-cbzv .tp-popv{left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-cbzpv_t{margin-top:var(--bld-s)}.tp-cbzgv{height:auto;overflow:hidden;position:relative}.tp-cbzgv.tp-v-disabled{opacity:.5}.tp-cbzgv_p{left:16px;position:absolute;right:16px;top:0}.tp-cbzgv_g{cursor:pointer;display:block;height:calc(var(--bld-us)*5);width:100%}.tp-cbzgv_u{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_l{fill:rgba(0,0,0,0);stroke:var(--in-fg)}.tp-cbzgv_v{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_h{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;pointer-events:none;position:absolute;width:4px}.tp-cbzgv:focus .tp-cbzgv_h-sel{background-color:var(--in-fg);border-width:0}.tp-cbzprvv{cursor:pointer;height:4px;padding:4px 0;position:relative}.tp-cbzprvv_g{display:block;height:100%;overflow:visible;width:100%}.tp-cbzprvv_t{opacity:.5;stroke:var(--mo-fg)}.tp-cbzprvv_m{background-color:var(--mo-fg);border-radius:50%;height:4px;margin-left:-2px;margin-top:-2px;opacity:0;position:absolute;top:50%;transition:opacity .2s ease-out;width:4px}.tp-cbzprvv_m.tp-cbzprvv_m-a{opacity:1}.tp-fpsv{position:relative}.tp-fpsv_l{bottom:4px;color:var(--mo-fg);line-height:1;right:4px;pointer-events:none;position:absolute}.tp-fpsv_u{margin-left:.2em;opacity:.7}.tp-rslv{cursor:pointer;padding-left:8px;padding-right:8px}.tp-rslv.tp-v-disabled{opacity:.5}.tp-rslv_t{height:calc(var(--bld-us));position:relative}.tp-rslv_t::before{background-color:var(--in-bg);border-radius:1px;content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:-4px;right:-4px}.tp-rslv_b{bottom:0;top:0;position:absolute}.tp-rslv_b::before{background-color:var(--in-fg);content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:0;right:0}.tp-rslv_k{height:calc(var(--bld-us) - 8px);margin-top:calc((var(--bld-us) - 8px)/-2);position:absolute;top:50%;width:8px}.tp-rslv_k.tp-rslv_k-min{margin-left:-8px}.tp-rslv_k.tp-rslv_k-max{margin-left:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-min{border-bottom-right-radius:0;border-top-right-radius:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-max{border-bottom-left-radius:0;border-top-left-radius:0}.tp-rsltxtv{display:flex}.tp-rsltxtv_s{flex:1}.tp-rsltxtv_t{flex:1;margin-left:4px}.tp-radv_l{display:block;position:relative}.tp-radv_i{left:0;opacity:0;position:absolute;top:0}.tp-radv_b{opacity:.5}.tp-radv_i:hover+.tp-radv_b{background-color:var(--btn-bg-h)}.tp-radv_i:focus+.tp-radv_b{background-color:var(--btn-bg-f)}.tp-radv_i:active+.tp-radv_b{background-color:var(--btn-bg-a)}.tp-radv_i:checked+.tp-radv_b{opacity:1}.tp-radv_t{bottom:0;color:inherit;left:0;overflow:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0}.tp-radv_i:disabled+.tp-radv_b>.tp-radv_t{opacity:.5}.tp-radgridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-radgridv.tp-v-disabled{opacity:.5}.tp-radgridv .tp-radv_b{border-radius:0}',
  12926. accept(m) {
  12927. const o = de, p = ee2(m, {
  12928. cells: o.required.function,
  12929. size: o.required.array(o.required.number),
  12930. view: o.required.constant("buttongrid"),
  12931. label: o.optional.string
  12932. });
  12933. return p ? { params: p } : null;
  12934. },
  12935. controller(m) {
  12936. return new at2(m.document, {
  12937. blade: m.blade,
  12938. props: K.fromObject({
  12939. label: m.params.label
  12940. }),
  12941. valueController: new ki(m.document, {
  12942. cellConfig: m.params.cells,
  12943. size: m.params.size
  12944. })
  12945. });
  12946. },
  12947. api(m) {
  12948. return !(m.controller instanceof at2) || !(m.controller.valueController instanceof ki) ? null : new ys(m.controller);
  12949. }
  12950. };
  12951. class xs extends s {
  12952. get label() {
  12953. return this.controller_.props.get("label");
  12954. }
  12955. set label(o) {
  12956. this.controller_.props.set("label", o);
  12957. }
  12958. get value() {
  12959. return this.controller_.valueController.value.rawValue;
  12960. }
  12961. set value(o) {
  12962. this.controller_.valueController.value.rawValue = o;
  12963. }
  12964. on(o, p) {
  12965. const f2 = p.bind(this);
  12966. return this.controller_.valueController.value.emitter.on(o, (x) => {
  12967. f2(new c(this, x.rawValue, void 0, x.options.last));
  12968. }), this;
  12969. }
  12970. }
  12971. function Qe2(m, o, p) {
  12972. return m * (1 - p) + o * p;
  12973. }
  12974. const yr = 20, xr = 1e-3, Mi = 100;
  12975. function Er(m, o) {
  12976. let p = 0.25, f2 = 0.5, x = -1;
  12977. for (let P = 0; P < yr; P++) {
  12978. const [L2, z] = m.curve(f2);
  12979. if (f2 += p * (L2 < o ? 1 : -1), x = z, p *= 0.5, Math.abs(o - L2) < xr)
  12980. break;
  12981. }
  12982. return x;
  12983. }
  12984. class Tt {
  12985. constructor(o = 0, p = 0, f2 = 1, x = 1) {
  12986. this.cache_ = [], this.comps_ = [o, p, f2, x];
  12987. }
  12988. get x1() {
  12989. return this.comps_[0];
  12990. }
  12991. get y1() {
  12992. return this.comps_[1];
  12993. }
  12994. get x2() {
  12995. return this.comps_[2];
  12996. }
  12997. get y2() {
  12998. return this.comps_[3];
  12999. }
  13000. static isObject(o) {
  13001. return h2(o) || !Array.isArray(o) ? false : typeof o[0] == "number" && typeof o[1] == "number" && typeof o[2] == "number" && typeof o[3] == "number";
  13002. }
  13003. static equals(o, p) {
  13004. return o.x1 === p.x1 && o.y1 === p.y1 && o.x2 === p.x2 && o.y2 === p.y2;
  13005. }
  13006. curve(o) {
  13007. const p = Qe2(0, this.x1, o), f2 = Qe2(0, this.y1, o), x = Qe2(this.x1, this.x2, o), P = Qe2(this.y1, this.y2, o), L2 = Qe2(this.x2, 1, o), z = Qe2(this.y2, 1, o), ae = Qe2(p, x, o), Ze2 = Qe2(f2, P, o), We = Qe2(x, L2, o), ne = Qe2(P, z, o);
  13008. return [Qe2(ae, We, o), Qe2(Ze2, ne, o)];
  13009. }
  13010. y(o) {
  13011. if (this.cache_.length === 0) {
  13012. const p = [];
  13013. for (let f2 = 0; f2 < Mi; f2++)
  13014. p.push(Er(this, Se(f2, 0, Mi - 1, 0, 1)));
  13015. this.cache_ = p;
  13016. }
  13017. return this.cache_[Math.round(Se(Yt(o, 0, 1), 0, 1, 0, Mi - 1))];
  13018. }
  13019. toObject() {
  13020. return [this.comps_[0], this.comps_[1], this.comps_[2], this.comps_[3]];
  13021. }
  13022. }
  13023. const Si = {
  13024. toComponents: (m) => m.toObject(),
  13025. fromComponents: (m) => new Tt(...m)
  13026. };
  13027. function Cr(m) {
  13028. const o = Re(2);
  13029. return `cubic-bezier(${m.toObject().map((f2) => o(f2)).join(", ")})`;
  13030. }
  13031. const Ai = [0, 0.5, 0.5, 1];
  13032. function Pr(m) {
  13033. const o = m.match(/^cubic-bezier\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*\)$/);
  13034. if (!o)
  13035. return new Tt(...Ai);
  13036. const p = [o[1], o[2], o[3], o[4]].reduce((f2, x) => {
  13037. if (!f2)
  13038. return null;
  13039. const P = Number(x);
  13040. return isNaN(P) ? null : [...f2, P];
  13041. }, []);
  13042. return new Tt(...p ?? Ai);
  13043. }
  13044. const Dt = y2("cbz");
  13045. class Es {
  13046. constructor(o, p) {
  13047. this.element = o.createElement("div"), this.element.classList.add(Dt()), p.viewProps.bindClassModifiers(this.element), p.foldable.bindExpandedClass(this.element, Dt(void 0, "expanded")), R2(p.foldable, "completed", F(this.element, Dt(void 0, "cpl")));
  13048. const f2 = o.createElement("div");
  13049. f2.classList.add(Dt("h")), this.element.appendChild(f2);
  13050. const x = o.createElement("button");
  13051. x.classList.add(Dt("b")), p.viewProps.bindDisabled(x);
  13052. const P = o.createElementNS(ye, "svg");
  13053. P.innerHTML = '<path d="M2 13C8 13 8 3 14 3"/>', x.appendChild(P), f2.appendChild(x), this.buttonElement = x;
  13054. const L2 = o.createElement("div");
  13055. if (L2.classList.add(Dt("t")), f2.appendChild(L2), this.textElement = L2, p.pickerLayout === "inline") {
  13056. const z = o.createElement("div");
  13057. z.classList.add(Dt("p")), this.element.appendChild(z), this.pickerElement = z;
  13058. } else
  13059. this.pickerElement = null;
  13060. }
  13061. }
  13062. const ei = y2("cbzp");
  13063. class Cs {
  13064. constructor(o, p) {
  13065. this.element = o.createElement("div"), this.element.classList.add(ei()), p.viewProps.bindClassModifiers(this.element);
  13066. const f2 = o.createElement("div");
  13067. f2.classList.add(ei("g")), this.element.appendChild(f2), this.graphElement = f2;
  13068. const x = o.createElement("div");
  13069. x.classList.add(ei("t")), this.element.appendChild(x), this.textElement = x;
  13070. }
  13071. }
  13072. function pt(m, o) {
  13073. const p = new MutationObserver((x) => {
  13074. for (const P of x)
  13075. P.type === "childList" && P.addedNodes.forEach((L2) => {
  13076. L2.contains(L2) && (o(), p.disconnect());
  13077. });
  13078. }), f2 = m.ownerDocument;
  13079. p.observe(f2.body, {
  13080. attributes: true,
  13081. childList: true,
  13082. subtree: true
  13083. });
  13084. }
  13085. const _t = y2("cbzg");
  13086. function Tr(m, o) {
  13087. return (p) => o(m(p));
  13088. }
  13089. class Ie {
  13090. constructor(o, p) {
  13091. this.element = o.createElement("div"), this.element.classList.add(_t()), p.viewProps.bindClassModifiers(this.element), p.viewProps.bindTabIndex(this.element);
  13092. const f2 = o.createElement("div");
  13093. f2.classList.add(_t("p")), this.element.appendChild(f2), this.previewElement = f2;
  13094. const x = o.createElementNS(ye, "svg");
  13095. x.classList.add(_t("g")), this.element.appendChild(x), this.svgElem_ = x;
  13096. const P = o.createElementNS(ye, "path");
  13097. P.classList.add(_t("u")), this.svgElem_.appendChild(P), this.guideElem_ = P;
  13098. const L2 = o.createElementNS(ye, "polyline");
  13099. L2.classList.add(_t("l")), this.svgElem_.appendChild(L2), this.lineElem_ = L2, this.handleElems_ = [o.createElement("div"), o.createElement("div")], this.handleElems_.forEach((z) => {
  13100. z.classList.add(_t("h")), this.element.appendChild(z);
  13101. }), this.vectorElems_ = [
  13102. o.createElementNS(ye, "line"),
  13103. o.createElementNS(ye, "line")
  13104. ], this.vectorElems_.forEach((z) => {
  13105. z.classList.add(_t("v")), this.svgElem_.appendChild(z);
  13106. }), this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_.bind(this)), this.sel_ = p.selection, this.handleElems_.forEach((z, ae) => {
  13107. S2(this.sel_, Tr((Ze2) => Ze2 === ae, F(z, _t("h", "sel"))));
  13108. }), pt(this.element, () => {
  13109. this.refresh();
  13110. });
  13111. }
  13112. getVertMargin_(o) {
  13113. return o * 0.25;
  13114. }
  13115. valueToPosition(o, p) {
  13116. const f2 = this.element.getBoundingClientRect(), x = f2.width, P = f2.height, L2 = this.getVertMargin_(P);
  13117. return {
  13118. x: Se(o, 0, 1, 0, x),
  13119. y: Se(p, 0, 1, P - L2, L2)
  13120. };
  13121. }
  13122. positionToValue(o, p) {
  13123. const f2 = this.element.getBoundingClientRect(), x = f2.width, P = f2.height, L2 = this.getVertMargin_(P);
  13124. return {
  13125. x: Yt(Se(o, 0, x, 0, 1), 0, 1),
  13126. y: Se(p, P - L2, L2, 0, 1)
  13127. };
  13128. }
  13129. refresh() {
  13130. this.guideElem_.setAttributeNS(null, "d", [0, 1].map((P) => {
  13131. const L2 = this.valueToPosition(0, P), z = this.valueToPosition(1, P);
  13132. return [`M ${L2.x},${L2.y}`, `L ${z.x},${z.y}`].join(" ");
  13133. }).join(" "));
  13134. const o = this.value_.rawValue, p = [];
  13135. let f2 = 0;
  13136. for (; ; ) {
  13137. const P = this.valueToPosition(...o.curve(f2));
  13138. if (p.push([P.x, P.y].join(",")), f2 >= 1)
  13139. break;
  13140. f2 = Math.min(f2 + 0.05, 1);
  13141. }
  13142. this.lineElem_.setAttributeNS(null, "points", p.join(" "));
  13143. const x = o.toObject();
  13144. [0, 1].forEach((P) => {
  13145. const L2 = this.valueToPosition(P, P), z = this.valueToPosition(x[P * 2], x[P * 2 + 1]), ae = this.vectorElems_[P];
  13146. ae.setAttributeNS(null, "x1", String(L2.x)), ae.setAttributeNS(null, "y1", String(L2.y)), ae.setAttributeNS(null, "x2", String(z.x)), ae.setAttributeNS(null, "y2", String(z.y));
  13147. const Ze2 = this.handleElems_[P];
  13148. Ze2.style.left = `${z.x}px`, Ze2.style.top = `${z.y}px`;
  13149. });
  13150. }
  13151. onValueChange_() {
  13152. this.refresh();
  13153. }
  13154. }
  13155. const Ps = 24, wn = 400, Li = 1e3, kt = y2("cbzprv");
  13156. class Zt {
  13157. constructor(o, p) {
  13158. this.stopped_ = true, this.startTime_ = -1, this.onDispose_ = this.onDispose_.bind(this), this.onTimer_ = this.onTimer_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(kt()), p.viewProps.bindClassModifiers(this.element);
  13159. const f2 = o.createElementNS(ye, "svg");
  13160. f2.classList.add(kt("g")), this.element.appendChild(f2), this.svgElem_ = f2;
  13161. const x = o.createElementNS(ye, "path");
  13162. x.classList.add(kt("t")), this.svgElem_.appendChild(x), this.ticksElem_ = x;
  13163. const P = o.createElement("div");
  13164. P.classList.add(kt("m")), this.element.appendChild(P), this.markerElem_ = P, this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_), p.viewProps.handleDispose(this.onDispose_), pt(this.element, () => {
  13165. this.refresh();
  13166. });
  13167. }
  13168. play() {
  13169. this.stop(), this.updateMarker_(0), this.markerElem_.classList.add(kt("m", "a")), this.startTime_ = new Date().getTime() + wn, this.stopped_ = false, requestAnimationFrame(this.onTimer_);
  13170. }
  13171. stop() {
  13172. this.stopped_ = true, this.markerElem_.classList.remove(kt("m", "a"));
  13173. }
  13174. onDispose_() {
  13175. this.stop();
  13176. }
  13177. updateMarker_(o) {
  13178. const p = this.value_.rawValue.y(Yt(o, 0, 1));
  13179. this.markerElem_.style.left = `${p * 100}%`;
  13180. }
  13181. refresh() {
  13182. const o = this.svgElem_.getBoundingClientRect(), p = o.width, f2 = o.height, x = [], P = this.value_.rawValue;
  13183. for (let L2 = 0; L2 < Ps; L2++) {
  13184. const z = Se(L2, 0, Ps - 1, 0, 1), ae = Se(P.y(z), 0, 1, 0, p);
  13185. x.push(`M ${ae},0 v${f2}`);
  13186. }
  13187. this.ticksElem_.setAttributeNS(null, "d", x.join(" "));
  13188. }
  13189. onTimer_() {
  13190. if (this.startTime_ === null)
  13191. return;
  13192. const o = new Date().getTime() - this.startTime_, p = o / Li;
  13193. this.updateMarker_(p), o > Li + wn && this.stop(), this.stopped_ || requestAnimationFrame(this.onTimer_);
  13194. }
  13195. onValueChange_() {
  13196. this.refresh(), this.play();
  13197. }
  13198. }
  13199. function Ne2(m, o, p, f2) {
  13200. const x = p - m, P = f2 - o;
  13201. return Math.sqrt(x * x + P * P);
  13202. }
  13203. function yn(m, o, p, f2) {
  13204. const x = Ne2(m, o, p, f2), P = Math.atan2(f2 - o, p - m), L2 = Math.round(P / (Math.PI / 4)) * Math.PI / 4;
  13205. return {
  13206. x: m + Math.cos(L2) * x,
  13207. y: o + Math.sin(L2) * x
  13208. };
  13209. }
  13210. class ut2 {
  13211. constructor(o, p) {
  13212. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = p.baseStep, this.value = p.value, this.sel_ = H2(0), this.viewProps = p.viewProps, this.view = new Ie(o, {
  13213. selection: this.sel_,
  13214. value: this.value,
  13215. viewProps: this.viewProps
  13216. }), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_), this.prevView_ = new Zt(o, {
  13217. value: this.value,
  13218. viewProps: this.viewProps
  13219. }), this.prevView_.element.addEventListener("mousedown", (x) => {
  13220. x.stopImmediatePropagation(), x.preventDefault(), this.prevView_.play();
  13221. }), this.view.previewElement.appendChild(this.prevView_.element);
  13222. const f2 = new Zn(this.view.element);
  13223. f2.emitter.on("down", this.onPointerDown_), f2.emitter.on("move", this.onPointerMove_), f2.emitter.on("up", this.onPointerUp_);
  13224. }
  13225. refresh() {
  13226. this.view.refresh(), this.prevView_.refresh(), this.prevView_.play();
  13227. }
  13228. updateValue_(o, p, f2) {
  13229. const x = this.sel_.rawValue, P = this.value.rawValue.toObject(), L2 = this.view.positionToValue(o.x, o.y), z = p ? yn(x, x, L2.x, L2.y) : L2;
  13230. P[x * 2] = z.x, P[x * 2 + 1] = z.y, this.value.setRawValue(new Tt(...P), f2);
  13231. }
  13232. onPointerDown_(o) {
  13233. const p = o.data;
  13234. if (!p.point)
  13235. return;
  13236. const f2 = this.value.rawValue, x = this.view.valueToPosition(f2.x1, f2.y1), P = Ne2(p.point.x, p.point.y, x.x, x.y), L2 = this.view.valueToPosition(f2.x2, f2.y2), z = Ne2(p.point.x, p.point.y, L2.x, L2.y);
  13237. this.sel_.rawValue = P <= z ? 0 : 1, this.updateValue_(p.point, o.shiftKey, {
  13238. forceEmit: false,
  13239. last: false
  13240. });
  13241. }
  13242. onPointerMove_(o) {
  13243. const p = o.data;
  13244. p.point && this.updateValue_(p.point, o.shiftKey, {
  13245. forceEmit: false,
  13246. last: false
  13247. });
  13248. }
  13249. onPointerUp_(o) {
  13250. const p = o.data;
  13251. p.point && this.updateValue_(p.point, o.shiftKey, {
  13252. forceEmit: true,
  13253. last: true
  13254. });
  13255. }
  13256. onKeyDown_(o) {
  13257. ps(o.key) && o.preventDefault();
  13258. const p = this.sel_.rawValue, f2 = this.value.rawValue.toObject();
  13259. f2[p * 2] += Xt(this.baseStep_, Ei(o)), f2[p * 2 + 1] += Xt(this.baseStep_, fn(o)), this.value.setRawValue(new Tt(...f2), {
  13260. forceEmit: false,
  13261. last: false
  13262. });
  13263. }
  13264. onKeyUp_(o) {
  13265. ps(o.key) && o.preventDefault();
  13266. const p = Xt(this.baseStep_, Ei(o)), f2 = Xt(this.baseStep_, fn(o));
  13267. p === 0 && f2 === 0 || this.value.setRawValue(this.value.rawValue, {
  13268. forceEmit: true,
  13269. last: true
  13270. });
  13271. }
  13272. }
  13273. class Ts {
  13274. constructor(o, p) {
  13275. this.value = p.value, this.viewProps = p.viewProps, this.view = new Cs(o, {
  13276. viewProps: this.viewProps
  13277. }), this.gc_ = new ut2(o, {
  13278. baseStep: p.axis.baseStep,
  13279. value: this.value,
  13280. viewProps: this.viewProps
  13281. }), this.view.graphElement.appendChild(this.gc_.view.element);
  13282. const f2 = Object.assign(Object.assign({}, p.axis), { constraint: new Rt({ max: 1, min: 0 }) }), x = Object.assign(Object.assign({}, p.axis), { constraint: void 0 });
  13283. this.tc_ = new Vt(o, {
  13284. assembly: Si,
  13285. axes: [f2, x, f2, x],
  13286. parser: mn,
  13287. value: this.value,
  13288. viewProps: this.viewProps
  13289. }), this.view.textElement.appendChild(this.tc_.view.element);
  13290. }
  13291. get allFocusableElements() {
  13292. return [
  13293. this.gc_.view.element,
  13294. ...this.tc_.view.textViews.map((o) => o.inputElement)
  13295. ];
  13296. }
  13297. refresh() {
  13298. this.gc_.refresh();
  13299. }
  13300. }
  13301. class ti {
  13302. constructor(o, p) {
  13303. this.onButtonBlur_ = this.onButtonBlur_.bind(this), this.onButtonClick_ = this.onButtonClick_.bind(this), this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.value = p.value, this.viewProps = p.viewProps, this.foldable_ = Gn(p.expanded), this.view = new Es(o, {
  13304. foldable: this.foldable_,
  13305. pickerLayout: p.pickerLayout,
  13306. viewProps: this.viewProps
  13307. }), this.view.buttonElement.addEventListener("blur", this.onButtonBlur_), this.view.buttonElement.addEventListener("click", this.onButtonClick_), this.tc_ = new Ht(o, {
  13308. parser: Pr,
  13309. props: K.fromObject({
  13310. formatter: Cr
  13311. }),
  13312. value: this.value,
  13313. viewProps: this.viewProps
  13314. }), this.view.textElement.appendChild(this.tc_.view.element), this.popC_ = p.pickerLayout === "popup" ? new se2(o, {
  13315. viewProps: this.viewProps
  13316. }) : null;
  13317. const f2 = new Ts(o, {
  13318. axis: p.axis,
  13319. value: this.value,
  13320. viewProps: this.viewProps
  13321. });
  13322. f2.allFocusableElements.forEach((x) => {
  13323. x.addEventListener("blur", this.onPopupChildBlur_), x.addEventListener("keydown", this.onPopupChildKeydown_);
  13324. }), this.pickerC_ = f2, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), S2(this.popC_.shows, (x) => {
  13325. x && f2.refresh();
  13326. }), $t({
  13327. primary: this.foldable_.value("expanded"),
  13328. secondary: this.popC_.shows,
  13329. forward: (x) => x.rawValue,
  13330. backward: (x, P) => P.rawValue
  13331. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Kn(this.foldable_, this.view.pickerElement));
  13332. }
  13333. onButtonBlur_(o) {
  13334. if (!this.popC_)
  13335. return;
  13336. const p = o.relatedTarget;
  13337. (!p || !this.popC_.view.element.contains(p)) && (this.popC_.shows.rawValue = false);
  13338. }
  13339. onButtonClick_() {
  13340. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.allFocusableElements[0].focus();
  13341. }
  13342. onPopupChildBlur_(o) {
  13343. if (!this.popC_)
  13344. return;
  13345. const p = this.popC_.view.element, f2 = ln(o);
  13346. f2 && p.contains(f2) || f2 && f2 === this.view.buttonElement && !Ye2(p.ownerDocument) || (this.popC_.shows.rawValue = false);
  13347. }
  13348. onPopupChildKeydown_(o) {
  13349. this.popC_ && o.key === "Escape" && (this.popC_.shows.rawValue = false);
  13350. }
  13351. }
  13352. function Ri() {
  13353. return new mr({
  13354. assembly: Si,
  13355. components: [0, 1, 2, 3].map((m) => m % 2 === 0 ? new Rt({
  13356. min: 0,
  13357. max: 1
  13358. }) : void 0)
  13359. });
  13360. }
  13361. const Ot = {
  13362. id: "cubic-bezier",
  13363. type: "blade",
  13364. css: '.tp-cbzgv,.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-radv_b:hover,.tp-rslv_k:hover,.tp-cbzv_b:hover{background-color:var(--btn-bg-h)}.tp-radv_b:focus,.tp-rslv_k:focus,.tp-cbzv_b:focus{background-color:var(--btn-bg-f)}.tp-radv_b:active,.tp-rslv_k:active,.tp-cbzv_b:active{background-color:var(--btn-bg-a)}.tp-radv_b:disabled,.tp-rslv_k:disabled,.tp-cbzv_b:disabled{opacity:.5}.tp-cbzgv{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-cbzgv:hover{background-color:var(--in-bg-h)}.tp-cbzgv:focus{background-color:var(--in-bg-f)}.tp-cbzgv:active{background-color:var(--in-bg-a)}.tp-cbzgv:disabled{opacity:.5}.tp-btngridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-btngridv.tp-v-disabled{opacity:.5}.tp-btngridv .tp-btnv_b:disabled{opacity:1}.tp-btngridv .tp-btnv_b:disabled .tp-btnv_t{opacity:.5}.tp-btngridv .tp-btnv_b{border-radius:0}.tp-cbzv{position:relative}.tp-cbzv_h{display:flex}.tp-cbzv_b{margin-right:4px;position:relative;width:var(--bld-us)}.tp-cbzv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-cbzv_b svg path{stroke:var(--bs-bg);stroke-width:2}.tp-cbzv_t{flex:1}.tp-cbzv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-cbzv.tp-cbzv-expanded .tp-cbzv_p{margin-top:var(--bld-s);opacity:1}.tp-cbzv.tp-cbzv-cpl .tp-cbzv_p{overflow:visible}.tp-cbzv .tp-popv{left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-cbzpv_t{margin-top:var(--bld-s)}.tp-cbzgv{height:auto;overflow:hidden;position:relative}.tp-cbzgv.tp-v-disabled{opacity:.5}.tp-cbzgv_p{left:16px;position:absolute;right:16px;top:0}.tp-cbzgv_g{cursor:pointer;display:block;height:calc(var(--bld-us)*5);width:100%}.tp-cbzgv_u{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_l{fill:rgba(0,0,0,0);stroke:var(--in-fg)}.tp-cbzgv_v{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_h{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;pointer-events:none;position:absolute;width:4px}.tp-cbzgv:focus .tp-cbzgv_h-sel{background-color:var(--in-fg);border-width:0}.tp-cbzprvv{cursor:pointer;height:4px;padding:4px 0;position:relative}.tp-cbzprvv_g{display:block;height:100%;overflow:visible;width:100%}.tp-cbzprvv_t{opacity:.5;stroke:var(--mo-fg)}.tp-cbzprvv_m{background-color:var(--mo-fg);border-radius:50%;height:4px;margin-left:-2px;margin-top:-2px;opacity:0;position:absolute;top:50%;transition:opacity .2s ease-out;width:4px}.tp-cbzprvv_m.tp-cbzprvv_m-a{opacity:1}.tp-fpsv{position:relative}.tp-fpsv_l{bottom:4px;color:var(--mo-fg);line-height:1;right:4px;pointer-events:none;position:absolute}.tp-fpsv_u{margin-left:.2em;opacity:.7}.tp-rslv{cursor:pointer;padding-left:8px;padding-right:8px}.tp-rslv.tp-v-disabled{opacity:.5}.tp-rslv_t{height:calc(var(--bld-us));position:relative}.tp-rslv_t::before{background-color:var(--in-bg);border-radius:1px;content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:-4px;right:-4px}.tp-rslv_b{bottom:0;top:0;position:absolute}.tp-rslv_b::before{background-color:var(--in-fg);content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:0;right:0}.tp-rslv_k{height:calc(var(--bld-us) - 8px);margin-top:calc((var(--bld-us) - 8px)/-2);position:absolute;top:50%;width:8px}.tp-rslv_k.tp-rslv_k-min{margin-left:-8px}.tp-rslv_k.tp-rslv_k-max{margin-left:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-min{border-bottom-right-radius:0;border-top-right-radius:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-max{border-bottom-left-radius:0;border-top-left-radius:0}.tp-rsltxtv{display:flex}.tp-rsltxtv_s{flex:1}.tp-rsltxtv_t{flex:1;margin-left:4px}.tp-radv_l{display:block;position:relative}.tp-radv_i{left:0;opacity:0;position:absolute;top:0}.tp-radv_b{opacity:.5}.tp-radv_i:hover+.tp-radv_b{background-color:var(--btn-bg-h)}.tp-radv_i:focus+.tp-radv_b{background-color:var(--btn-bg-f)}.tp-radv_i:active+.tp-radv_b{background-color:var(--btn-bg-a)}.tp-radv_i:checked+.tp-radv_b{opacity:1}.tp-radv_t{bottom:0;color:inherit;left:0;overflow:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0}.tp-radv_i:disabled+.tp-radv_b>.tp-radv_t{opacity:.5}.tp-radgridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-radgridv.tp-v-disabled{opacity:.5}.tp-radgridv .tp-radv_b{border-radius:0}',
  13365. accept(m) {
  13366. const o = de, p = ee2(m, {
  13367. value: o.required.array(o.required.number),
  13368. view: o.required.constant("cubicbezier"),
  13369. expanded: o.optional.boolean,
  13370. label: o.optional.string,
  13371. picker: o.optional.custom((f2) => f2 === "inline" || f2 === "popup" ? f2 : void 0)
  13372. });
  13373. return p ? { params: p } : null;
  13374. },
  13375. controller(m) {
  13376. var o, p;
  13377. const f2 = new Tt(...m.params.value), x = H2(f2, {
  13378. constraint: Ri(),
  13379. equals: Tt.equals
  13380. }), P = new ti(m.document, {
  13381. axis: {
  13382. baseStep: 0.1,
  13383. textProps: K.fromObject({
  13384. draggingScale: 0.01,
  13385. formatter: Re(2)
  13386. })
  13387. },
  13388. expanded: (o = m.params.expanded) !== null && o !== void 0 ? o : false,
  13389. pickerLayout: (p = m.params.picker) !== null && p !== void 0 ? p : "popup",
  13390. value: x,
  13391. viewProps: m.viewProps
  13392. });
  13393. return new Lt(m.document, {
  13394. blade: m.blade,
  13395. props: K.fromObject({
  13396. label: m.params.label
  13397. }),
  13398. valueController: P
  13399. });
  13400. },
  13401. api(m) {
  13402. return !(m.controller instanceof Lt) || !(m.controller.valueController instanceof ti) ? null : new xs(m.controller);
  13403. }
  13404. };
  13405. class we extends s {
  13406. begin() {
  13407. this.controller_.valueController.begin();
  13408. }
  13409. end() {
  13410. this.controller_.valueController.end();
  13411. }
  13412. }
  13413. const Ii = 20;
  13414. class Ae {
  13415. constructor() {
  13416. this.start_ = null, this.duration_ = 0, this.fps_ = null, this.frameCount_ = 0, this.timestamps_ = [];
  13417. }
  13418. get duration() {
  13419. return this.duration_;
  13420. }
  13421. get fps() {
  13422. return this.fps_;
  13423. }
  13424. begin(o) {
  13425. this.start_ = o.getTime();
  13426. }
  13427. calculateFps_(o) {
  13428. if (this.timestamps_.length === 0)
  13429. return null;
  13430. const p = this.timestamps_[0];
  13431. return 1e3 * (this.frameCount_ - p.frameCount) / (o - p.time);
  13432. }
  13433. compactTimestamps_() {
  13434. if (this.timestamps_.length <= Ii)
  13435. return;
  13436. const o = this.timestamps_.length - Ii;
  13437. this.timestamps_.splice(0, o);
  13438. const p = this.timestamps_[0].frameCount;
  13439. this.timestamps_.forEach((f2) => {
  13440. f2.frameCount -= p;
  13441. }), this.frameCount_ -= p;
  13442. }
  13443. end(o) {
  13444. if (this.start_ === null)
  13445. return;
  13446. const p = o.getTime();
  13447. this.duration_ = p - this.start_, this.start_ = null, this.fps_ = this.calculateFps_(p), this.timestamps_.push({
  13448. frameCount: this.frameCount_,
  13449. time: p
  13450. }), ++this.frameCount_, this.compactTimestamps_();
  13451. }
  13452. }
  13453. const Wt = y2("fps");
  13454. class Ke2 {
  13455. constructor(o, p) {
  13456. this.element = o.createElement("div"), this.element.classList.add(Wt()), p.viewProps.bindClassModifiers(this.element), this.graphElement = o.createElement("div"), this.graphElement.classList.add(Wt("g")), this.element.appendChild(this.graphElement);
  13457. const f2 = o.createElement("div");
  13458. f2.classList.add(Wt("l")), this.element.appendChild(f2);
  13459. const x = o.createElement("span");
  13460. x.classList.add(Wt("v")), x.textContent = "--", f2.appendChild(x), this.valueElement = x;
  13461. const P = o.createElement("span");
  13462. P.classList.add(Wt("u")), P.textContent = "FPS", f2.appendChild(P);
  13463. }
  13464. }
  13465. class Vi {
  13466. constructor(o, p) {
  13467. this.stopwatch_ = new Ae(), this.onTick_ = this.onTick_.bind(this), this.ticker_ = p.ticker, this.ticker_.emitter.on("tick", this.onTick_), this.value_ = p.value, this.viewProps = p.viewProps, this.view = new Ke2(o, {
  13468. viewProps: this.viewProps
  13469. }), this.graphC_ = new gr(o, {
  13470. formatter: Re(0),
  13471. lineCount: p.lineCount,
  13472. props: K.fromObject({
  13473. maxValue: p.maxValue,
  13474. minValue: p.minValue
  13475. }),
  13476. value: this.value_,
  13477. viewProps: this.viewProps
  13478. }), this.view.graphElement.appendChild(this.graphC_.view.element), this.viewProps.handleDispose(() => {
  13479. this.graphC_.viewProps.set("disposed", true), this.ticker_.dispose();
  13480. });
  13481. }
  13482. begin() {
  13483. this.stopwatch_.begin(new Date());
  13484. }
  13485. end() {
  13486. this.stopwatch_.end(new Date());
  13487. }
  13488. onTick_() {
  13489. const o = this.stopwatch_.fps;
  13490. if (o !== null) {
  13491. const p = this.value_.rawValue;
  13492. this.value_.rawValue = or(p, o), this.view.valueElement.textContent = o.toFixed(0);
  13493. }
  13494. }
  13495. }
  13496. function xn(m, o) {
  13497. return o === 0 ? new $n() : new pn(m, o ?? br.monitor.defaultInterval);
  13498. }
  13499. const Di = {
  13500. id: "fpsgraph",
  13501. type: "blade",
  13502. accept(m) {
  13503. const o = de, p = ee2(m, {
  13504. view: o.required.constant("fpsgraph"),
  13505. interval: o.optional.number,
  13506. label: o.optional.string,
  13507. lineCount: o.optional.number,
  13508. max: o.optional.number,
  13509. min: o.optional.number
  13510. });
  13511. return p ? { params: p } : null;
  13512. },
  13513. controller(m) {
  13514. var o, p, f2, x;
  13515. const P = (o = m.params.interval) !== null && o !== void 0 ? o : 500;
  13516. return new at2(m.document, {
  13517. blade: m.blade,
  13518. props: K.fromObject({
  13519. label: m.params.label
  13520. }),
  13521. valueController: new Vi(m.document, {
  13522. lineCount: (p = m.params.lineCount) !== null && p !== void 0 ? p : 2,
  13523. maxValue: (f2 = m.params.max) !== null && f2 !== void 0 ? f2 : 90,
  13524. minValue: (x = m.params.min) !== null && x !== void 0 ? x : 0,
  13525. ticker: xn(m.document, P),
  13526. value: ls(80),
  13527. viewProps: m.viewProps
  13528. })
  13529. });
  13530. },
  13531. api(m) {
  13532. return !(m.controller instanceof at2) || !(m.controller.valueController instanceof Vi) ? null : new we(m.controller);
  13533. }
  13534. };
  13535. class $e {
  13536. constructor(o, p) {
  13537. this.min = o, this.max = p;
  13538. }
  13539. static isObject(o) {
  13540. if (typeof o != "object" || o === null)
  13541. return false;
  13542. const p = o.min, f2 = o.max;
  13543. return !(typeof p != "number" || typeof f2 != "number");
  13544. }
  13545. static equals(o, p) {
  13546. return o.min === p.min && o.max === p.max;
  13547. }
  13548. get length() {
  13549. return this.max - this.min;
  13550. }
  13551. toObject() {
  13552. return {
  13553. min: this.min,
  13554. max: this.max
  13555. };
  13556. }
  13557. }
  13558. const Oi = {
  13559. fromComponents: (m) => new $e(m[0], m[1]),
  13560. toComponents: (m) => [m.min, m.max]
  13561. };
  13562. class En {
  13563. constructor(o) {
  13564. this.edge = o;
  13565. }
  13566. constrain(o) {
  13567. var p, f2, x, P, L2, z, ae, Ze2;
  13568. if (o.min <= o.max)
  13569. return new $e((f2 = (p = this.edge) === null || p === void 0 ? void 0 : p.constrain(o.min)) !== null && f2 !== void 0 ? f2 : o.min, (P = (x = this.edge) === null || x === void 0 ? void 0 : x.constrain(o.max)) !== null && P !== void 0 ? P : o.max);
  13570. const We = (o.min + o.max) / 2;
  13571. return new $e((z = (L2 = this.edge) === null || L2 === void 0 ? void 0 : L2.constrain(We)) !== null && z !== void 0 ? z : We, (Ze2 = (ae = this.edge) === null || ae === void 0 ? void 0 : ae.constrain(We)) !== null && Ze2 !== void 0 ? Ze2 : We);
  13572. }
  13573. }
  13574. const Ni = y2("rsltxt");
  13575. class ni {
  13576. constructor(o, p) {
  13577. this.sliderView_ = p.sliderView, this.textView_ = p.textView, this.element = o.createElement("div"), this.element.classList.add(Ni());
  13578. const f2 = o.createElement("div");
  13579. f2.classList.add(Ni("s")), f2.appendChild(this.sliderView_.element), this.element.appendChild(f2);
  13580. const x = o.createElement("div");
  13581. x.classList.add(Ni("t")), x.appendChild(this.textView_.element), this.element.appendChild(x);
  13582. }
  13583. }
  13584. const st2 = y2("rsl");
  13585. class Cn {
  13586. constructor(o, p) {
  13587. this.onSliderPropsChange_ = this.onSliderPropsChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.sliderProps_ = p.sliderProps, this.sliderProps_.emitter.on("change", this.onSliderPropsChange_), this.element = o.createElement("div"), this.element.classList.add(st2()), p.viewProps.bindClassModifiers(this.element), this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_);
  13588. const f2 = o.createElement("div");
  13589. f2.classList.add(st2("t")), this.element.appendChild(f2), this.trackElement = f2;
  13590. const x = o.createElement("div");
  13591. x.classList.add(st2("b")), f2.appendChild(x), this.barElement = x;
  13592. const P = ["min", "max"].map((L2) => {
  13593. const z = o.createElement("div");
  13594. return z.classList.add(st2("k"), st2("k", L2)), f2.appendChild(z), z;
  13595. });
  13596. this.knobElements = [P[0], P[1]], this.update_();
  13597. }
  13598. valueToX_(o) {
  13599. const p = this.sliderProps_.get("minValue"), f2 = this.sliderProps_.get("maxValue");
  13600. return Yt(Se(o, p, f2, 0, 1), 0, 1) * 100;
  13601. }
  13602. update_() {
  13603. const o = this.value_.rawValue;
  13604. o.length === 0 ? this.element.classList.add(st2(void 0, "zero")) : this.element.classList.remove(st2(void 0, "zero"));
  13605. const p = [this.valueToX_(o.min), this.valueToX_(o.max)];
  13606. this.barElement.style.left = `${p[0]}%`, this.barElement.style.right = `${100 - p[1]}%`, this.knobElements.forEach((f2, x) => {
  13607. f2.style.left = `${p[x]}%`;
  13608. });
  13609. }
  13610. onSliderPropsChange_() {
  13611. this.update_();
  13612. }
  13613. onValueChange_() {
  13614. this.update_();
  13615. }
  13616. }
  13617. class Fi {
  13618. constructor(o, p) {
  13619. this.grabbing_ = null, this.grabOffset_ = 0, this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.sliderProps = p.sliderProps, this.viewProps = p.viewProps, this.value = p.value, this.view = new Cn(o, {
  13620. sliderProps: this.sliderProps,
  13621. value: this.value,
  13622. viewProps: p.viewProps
  13623. });
  13624. const f2 = new Zn(this.view.trackElement);
  13625. f2.emitter.on("down", this.onPointerDown_), f2.emitter.on("move", this.onPointerMove_), f2.emitter.on("up", this.onPointerUp_);
  13626. }
  13627. ofs_() {
  13628. return this.grabbing_ === "min" ? this.view.knobElements[0].getBoundingClientRect().width / 2 : this.grabbing_ === "max" ? -this.view.knobElements[1].getBoundingClientRect().width / 2 : 0;
  13629. }
  13630. valueFromData_(o) {
  13631. if (!o.point)
  13632. return null;
  13633. const p = (o.point.x + this.ofs_()) / o.bounds.width, f2 = this.sliderProps.get("minValue"), x = this.sliderProps.get("maxValue");
  13634. return Se(p, 0, 1, f2, x);
  13635. }
  13636. onPointerDown_(o) {
  13637. if (!o.data.point)
  13638. return;
  13639. const p = o.data.point.x / o.data.bounds.width, f2 = this.value.rawValue, x = this.sliderProps.get("minValue"), P = this.sliderProps.get("maxValue"), L2 = Se(f2.min, x, P, 0, 1), z = Se(f2.max, x, P, 0, 1);
  13640. Math.abs(z - p) <= 0.025 ? this.grabbing_ = "max" : Math.abs(L2 - p) <= 0.025 ? this.grabbing_ = "min" : p >= L2 && p <= z ? (this.grabbing_ = "length", this.grabOffset_ = Se(p - L2, 0, 1, 0, P - x)) : p < L2 ? (this.grabbing_ = "min", this.onPointerMove_(o)) : p > z && (this.grabbing_ = "max", this.onPointerMove_(o));
  13641. }
  13642. applyPointToValue_(o, p) {
  13643. const f2 = this.valueFromData_(o);
  13644. if (f2 === null)
  13645. return;
  13646. const x = this.sliderProps.get("minValue"), P = this.sliderProps.get("maxValue");
  13647. if (this.grabbing_ === "min")
  13648. this.value.setRawValue(new $e(f2, this.value.rawValue.max), p);
  13649. else if (this.grabbing_ === "max")
  13650. this.value.setRawValue(new $e(this.value.rawValue.min, f2), p);
  13651. else if (this.grabbing_ === "length") {
  13652. const L2 = this.value.rawValue.length;
  13653. let z = f2 - this.grabOffset_, ae = z + L2;
  13654. z < x ? (z = x, ae = x + L2) : ae > P && (z = P - L2, ae = P), this.value.setRawValue(new $e(z, ae), p);
  13655. }
  13656. }
  13657. onPointerMove_(o) {
  13658. this.applyPointToValue_(o.data, {
  13659. forceEmit: false,
  13660. last: false
  13661. });
  13662. }
  13663. onPointerUp_(o) {
  13664. this.applyPointToValue_(o.data, {
  13665. forceEmit: true,
  13666. last: true
  13667. }), this.grabbing_ = null;
  13668. }
  13669. }
  13670. class wt {
  13671. constructor(o, p) {
  13672. this.value = p.value, this.viewProps = p.viewProps, this.sc_ = new Fi(o, p);
  13673. const f2 = {
  13674. baseStep: p.baseStep,
  13675. constraint: p.constraint,
  13676. textProps: K.fromObject({
  13677. draggingScale: p.draggingScale,
  13678. formatter: p.formatter
  13679. })
  13680. };
  13681. this.tc_ = new Vt(o, {
  13682. assembly: Oi,
  13683. axes: [f2, f2],
  13684. parser: p.parser,
  13685. value: this.value,
  13686. viewProps: p.viewProps
  13687. }), this.view = new ni(o, {
  13688. sliderView: this.sc_.view,
  13689. textView: this.tc_.view
  13690. });
  13691. }
  13692. get textController() {
  13693. return this.tc_;
  13694. }
  13695. }
  13696. function ks(m) {
  13697. return $e.isObject(m) ? new $e(m.min, m.max) : new $e(0, 0);
  13698. }
  13699. function Bi(m, o) {
  13700. m.writeProperty("max", o.max), m.writeProperty("min", o.min);
  13701. }
  13702. function kr(m) {
  13703. const o = [], p = _n(m);
  13704. p && o.push(p);
  13705. const f2 = vr(m);
  13706. return f2 && o.push(f2), new En(new Xn(o));
  13707. }
  13708. const ii = {
  13709. id: "input-interval",
  13710. type: "input",
  13711. css: '.tp-cbzgv,.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-radv_b:hover,.tp-rslv_k:hover,.tp-cbzv_b:hover{background-color:var(--btn-bg-h)}.tp-radv_b:focus,.tp-rslv_k:focus,.tp-cbzv_b:focus{background-color:var(--btn-bg-f)}.tp-radv_b:active,.tp-rslv_k:active,.tp-cbzv_b:active{background-color:var(--btn-bg-a)}.tp-radv_b:disabled,.tp-rslv_k:disabled,.tp-cbzv_b:disabled{opacity:.5}.tp-cbzgv{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-cbzgv:hover{background-color:var(--in-bg-h)}.tp-cbzgv:focus{background-color:var(--in-bg-f)}.tp-cbzgv:active{background-color:var(--in-bg-a)}.tp-cbzgv:disabled{opacity:.5}.tp-btngridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-btngridv.tp-v-disabled{opacity:.5}.tp-btngridv .tp-btnv_b:disabled{opacity:1}.tp-btngridv .tp-btnv_b:disabled .tp-btnv_t{opacity:.5}.tp-btngridv .tp-btnv_b{border-radius:0}.tp-cbzv{position:relative}.tp-cbzv_h{display:flex}.tp-cbzv_b{margin-right:4px;position:relative;width:var(--bld-us)}.tp-cbzv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-cbzv_b svg path{stroke:var(--bs-bg);stroke-width:2}.tp-cbzv_t{flex:1}.tp-cbzv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-cbzv.tp-cbzv-expanded .tp-cbzv_p{margin-top:var(--bld-s);opacity:1}.tp-cbzv.tp-cbzv-cpl .tp-cbzv_p{overflow:visible}.tp-cbzv .tp-popv{left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-cbzpv_t{margin-top:var(--bld-s)}.tp-cbzgv{height:auto;overflow:hidden;position:relative}.tp-cbzgv.tp-v-disabled{opacity:.5}.tp-cbzgv_p{left:16px;position:absolute;right:16px;top:0}.tp-cbzgv_g{cursor:pointer;display:block;height:calc(var(--bld-us)*5);width:100%}.tp-cbzgv_u{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_l{fill:rgba(0,0,0,0);stroke:var(--in-fg)}.tp-cbzgv_v{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_h{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;pointer-events:none;position:absolute;width:4px}.tp-cbzgv:focus .tp-cbzgv_h-sel{background-color:var(--in-fg);border-width:0}.tp-cbzprvv{cursor:pointer;height:4px;padding:4px 0;position:relative}.tp-cbzprvv_g{display:block;height:100%;overflow:visible;width:100%}.tp-cbzprvv_t{opacity:.5;stroke:var(--mo-fg)}.tp-cbzprvv_m{background-color:var(--mo-fg);border-radius:50%;height:4px;margin-left:-2px;margin-top:-2px;opacity:0;position:absolute;top:50%;transition:opacity .2s ease-out;width:4px}.tp-cbzprvv_m.tp-cbzprvv_m-a{opacity:1}.tp-fpsv{position:relative}.tp-fpsv_l{bottom:4px;color:var(--mo-fg);line-height:1;right:4px;pointer-events:none;position:absolute}.tp-fpsv_u{margin-left:.2em;opacity:.7}.tp-rslv{cursor:pointer;padding-left:8px;padding-right:8px}.tp-rslv.tp-v-disabled{opacity:.5}.tp-rslv_t{height:calc(var(--bld-us));position:relative}.tp-rslv_t::before{background-color:var(--in-bg);border-radius:1px;content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:-4px;right:-4px}.tp-rslv_b{bottom:0;top:0;position:absolute}.tp-rslv_b::before{background-color:var(--in-fg);content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:0;right:0}.tp-rslv_k{height:calc(var(--bld-us) - 8px);margin-top:calc((var(--bld-us) - 8px)/-2);position:absolute;top:50%;width:8px}.tp-rslv_k.tp-rslv_k-min{margin-left:-8px}.tp-rslv_k.tp-rslv_k-max{margin-left:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-min{border-bottom-right-radius:0;border-top-right-radius:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-max{border-bottom-left-radius:0;border-top-left-radius:0}.tp-rsltxtv{display:flex}.tp-rsltxtv_s{flex:1}.tp-rsltxtv_t{flex:1;margin-left:4px}.tp-radv_l{display:block;position:relative}.tp-radv_i{left:0;opacity:0;position:absolute;top:0}.tp-radv_b{opacity:.5}.tp-radv_i:hover+.tp-radv_b{background-color:var(--btn-bg-h)}.tp-radv_i:focus+.tp-radv_b{background-color:var(--btn-bg-f)}.tp-radv_i:active+.tp-radv_b{background-color:var(--btn-bg-a)}.tp-radv_i:checked+.tp-radv_b{opacity:1}.tp-radv_t{bottom:0;color:inherit;left:0;overflow:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0}.tp-radv_i:disabled+.tp-radv_b>.tp-radv_t{opacity:.5}.tp-radgridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-radgridv.tp-v-disabled{opacity:.5}.tp-radgridv .tp-radv_b{border-radius:0}',
  13712. accept: (m, o) => {
  13713. if (!$e.isObject(m))
  13714. return null;
  13715. const p = de, f2 = ee2(o, {
  13716. format: p.optional.function,
  13717. max: p.optional.number,
  13718. min: p.optional.number,
  13719. step: p.optional.number
  13720. });
  13721. return f2 ? {
  13722. initialValue: new $e(m.min, m.max),
  13723. params: f2
  13724. } : null;
  13725. },
  13726. binding: {
  13727. reader: (m) => ks,
  13728. constraint: (m) => kr(m.params),
  13729. equals: $e.equals,
  13730. writer: (m) => Bi
  13731. },
  13732. controller(m) {
  13733. var o;
  13734. const p = m.value, f2 = m.constraint;
  13735. if (!(f2 instanceof En))
  13736. throw g.shouldNeverHappen();
  13737. const x = (p.rawValue.min + p.rawValue.max) / 2, P = (o = m.params.format) !== null && o !== void 0 ? o : Re(bn(f2.edge, x)), L2 = f2.edge && Pt(f2.edge, gt);
  13738. if (L2)
  13739. return new wt(m.document, {
  13740. baseStep: Pi(f2.edge),
  13741. constraint: f2.edge,
  13742. draggingScale: Wn(f2.edge, x),
  13743. formatter: P,
  13744. parser: mn,
  13745. sliderProps: new K({
  13746. maxValue: L2.values.value("max"),
  13747. minValue: L2.values.value("min")
  13748. }),
  13749. value: p,
  13750. viewProps: m.viewProps
  13751. });
  13752. const z = {
  13753. baseStep: Pi(f2.edge),
  13754. constraint: f2.edge,
  13755. textProps: K.fromObject({
  13756. draggingScale: x,
  13757. formatter: P
  13758. })
  13759. };
  13760. return new Vt(m.document, {
  13761. assembly: Oi,
  13762. axes: [z, z],
  13763. parser: mn,
  13764. value: p,
  13765. viewProps: m.viewProps
  13766. });
  13767. }
  13768. };
  13769. class Nt {
  13770. constructor(o) {
  13771. this.controller_ = o;
  13772. }
  13773. get disabled() {
  13774. return this.controller_.viewProps.get("disabled");
  13775. }
  13776. set disabled(o) {
  13777. this.controller_.viewProps.set("disabled", o);
  13778. }
  13779. get title() {
  13780. var o;
  13781. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  13782. }
  13783. set title(o) {
  13784. this.controller_.props.set("title", o);
  13785. }
  13786. }
  13787. class Ft extends c {
  13788. constructor(o, p, f2, x, P) {
  13789. super(o, x, P), this.cell = p, this.index = f2;
  13790. }
  13791. }
  13792. class Pn extends s {
  13793. constructor(o) {
  13794. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.controller_.valueController.cellControllers.forEach((f2) => {
  13795. const x = new Nt(f2);
  13796. this.cellToApiMap_.set(f2, x);
  13797. });
  13798. }
  13799. get value() {
  13800. return this.controller_.value;
  13801. }
  13802. cell(o, p) {
  13803. const f2 = this.controller_.valueController, x = f2.cellControllers[p * f2.size[0] + o];
  13804. return this.cellToApiMap_.get(x);
  13805. }
  13806. on(o, p) {
  13807. const f2 = p.bind(this);
  13808. this.controller_.value.emitter.on(o, (x) => {
  13809. const P = this.controller_.valueController, L2 = P.findCellByValue(x.rawValue);
  13810. if (!L2)
  13811. return;
  13812. const z = this.cellToApiMap_.get(L2);
  13813. if (!z)
  13814. return;
  13815. const ae = P.cellControllers.indexOf(L2);
  13816. f2(new Ft(this, z, [ae % P.size[0], Math.floor(ae / P.size[0])], x.rawValue, void 0));
  13817. });
  13818. }
  13819. }
  13820. const Tn = y2("rad");
  13821. class Ms {
  13822. constructor(o, p) {
  13823. this.element = o.createElement("div"), this.element.classList.add(Tn()), p.viewProps.bindClassModifiers(this.element);
  13824. const f2 = o.createElement("label");
  13825. f2.classList.add(Tn("l")), this.element.appendChild(f2);
  13826. const x = o.createElement("input");
  13827. x.classList.add(Tn("i")), x.name = p.name, x.type = "radio", p.viewProps.bindDisabled(x), f2.appendChild(x), this.inputElement = x;
  13828. const P = o.createElement("div");
  13829. P.classList.add(Tn("b")), f2.appendChild(P);
  13830. const L2 = o.createElement("div");
  13831. L2.classList.add(Tn("t")), P.appendChild(L2), R2(p.props, "title", (z) => {
  13832. L2.textContent = z;
  13833. });
  13834. }
  13835. }
  13836. class Ss {
  13837. constructor(o, p) {
  13838. this.props = p.props, this.viewProps = p.viewProps, this.view = new Ms(o, {
  13839. name: p.name,
  13840. props: this.props,
  13841. viewProps: this.viewProps
  13842. });
  13843. }
  13844. }
  13845. class si {
  13846. constructor(o, p) {
  13847. this.cellCs_ = [], this.cellValues_ = [], this.onCellInputChange_ = this.onCellInputChange_.bind(this), this.size = p.size;
  13848. const [f2, x] = this.size;
  13849. for (let P = 0; P < x; P++)
  13850. for (let L2 = 0; L2 < f2; L2++) {
  13851. const z = new Ss(o, {
  13852. name: p.groupName,
  13853. props: K.fromObject(Object.assign({}, p.cellConfig(L2, P))),
  13854. viewProps: ge.create()
  13855. });
  13856. this.cellCs_.push(z), this.cellValues_.push(p.cellConfig(L2, P).value);
  13857. }
  13858. this.value = p.value, S2(this.value, (P) => {
  13859. const L2 = this.findCellByValue(P);
  13860. L2 && (L2.view.inputElement.checked = true);
  13861. }), this.viewProps = ge.create(), this.view = new Ct(o, {
  13862. viewProps: this.viewProps,
  13863. viewName: "radgrid"
  13864. }), this.view.element.style.gridTemplateColumns = `repeat(${f2}, 1fr)`, this.cellCs_.forEach((P) => {
  13865. P.view.inputElement.addEventListener("change", this.onCellInputChange_), this.view.element.appendChild(P.view.element);
  13866. });
  13867. }
  13868. get cellControllers() {
  13869. return this.cellCs_;
  13870. }
  13871. findCellByValue(o) {
  13872. const p = this.cellValues_.findIndex((f2) => f2 === o);
  13873. return p < 0 ? null : this.cellCs_[p];
  13874. }
  13875. onCellInputChange_(o) {
  13876. const p = o.currentTarget, f2 = this.cellCs_.findIndex((x) => x.view.inputElement === p);
  13877. f2 < 0 || (this.value.rawValue = this.cellValues_[f2]);
  13878. }
  13879. }
  13880. const Bt = function() {
  13881. return {
  13882. id: "radiogrid",
  13883. type: "blade",
  13884. accept(m) {
  13885. const o = de, p = ee2(m, {
  13886. cells: o.required.function,
  13887. groupName: o.required.string,
  13888. size: o.required.array(o.required.number),
  13889. value: o.required.raw,
  13890. view: o.required.constant("radiogrid"),
  13891. label: o.optional.string
  13892. });
  13893. return p ? { params: p } : null;
  13894. },
  13895. controller(m) {
  13896. return new Lt(m.document, {
  13897. blade: m.blade,
  13898. props: K.fromObject({
  13899. label: m.params.label
  13900. }),
  13901. valueController: new si(m.document, {
  13902. groupName: m.params.groupName,
  13903. cellConfig: m.params.cells,
  13904. size: m.params.size,
  13905. value: H2(m.params.value)
  13906. })
  13907. });
  13908. },
  13909. api(m) {
  13910. return !(m.controller instanceof Lt) || !(m.controller.valueController instanceof si) ? null : new Pn(m.controller);
  13911. }
  13912. };
  13913. }();
  13914. function ji(m) {
  13915. return {
  13916. id: "input-radiogrid",
  13917. type: "input",
  13918. accept(o, p) {
  13919. if (!m.isType(o))
  13920. return null;
  13921. const f2 = de, x = ee2(p, {
  13922. cells: f2.required.function,
  13923. groupName: f2.required.string,
  13924. size: f2.required.array(f2.required.number),
  13925. view: f2.required.constant("radiogrid")
  13926. });
  13927. return x ? {
  13928. initialValue: o,
  13929. params: x
  13930. } : null;
  13931. },
  13932. binding: m.binding,
  13933. controller: (o) => new si(o.document, {
  13934. cellConfig: o.params.cells,
  13935. groupName: o.params.groupName,
  13936. size: o.params.size,
  13937. value: o.value
  13938. })
  13939. };
  13940. }
  13941. const Mr = ji({
  13942. isType: (m) => typeof m == "number",
  13943. binding: {
  13944. reader: (m) => sr,
  13945. writer: (m) => it2
  13946. }
  13947. }), Sr = ji({
  13948. isType: (m) => typeof m == "string",
  13949. binding: {
  13950. reader: (m) => as,
  13951. writer: (m) => it2
  13952. }
  13953. }), Ar = ji({
  13954. isType: (m) => typeof m == "boolean",
  13955. binding: {
  13956. reader: (m) => un,
  13957. writer: (m) => it2
  13958. }
  13959. }), As = [
  13960. wr,
  13961. Ot,
  13962. Di,
  13963. ii,
  13964. Bt,
  13965. Ar,
  13966. Mr,
  13967. Sr
  13968. ];
  13969. r.ButtonCellApi = ws, r.ButtonGridApi = ys, r.ButtonGridController = ki, r.CubicBezier = Tt, r.CubicBezierApi = xs, r.CubicBezierAssembly = Si, r.CubicBezierController = ti, r.CubicBezierGraphController = ut2, r.CubicBezierGraphView = Ie, r.CubicBezierPickerController = Ts, r.CubicBezierPickerView = Cs, r.CubicBezierPreviewView = Zt, r.CubicBezierView = Es, r.FpsGraphBladeApi = we, r.FpsGraphController = Vi, r.FpsView = Ke2, r.Fpswatch = Ae, r.Interval = $e, r.IntervalAssembly = Oi, r.IntervalConstraint = En, r.RadioCellApi = Nt, r.RadioController = Ss, r.RadioGridApi = Pn, r.RadioGridController = si, r.RadioView = Ms, r.RangeSliderController = Fi, r.RangeSliderTextController = wt, r.RangeSliderTextView = ni, r.RangeSliderView = Cn, r.TpRadioGridChangeEvent = Ft, r.plugins = As, Object.defineProperty(r, "__esModule", { value: true });
  13970. });
  13971. })(Th, ts);
  13972. var kh = rh(ts);
  13973. var Mh = Bp({
  13974. __proto__: null,
  13975. default: kh
  13976. }, [ts]);
  13977. var Rn;
  13978. var Ns;
  13979. var Bh = (b2 = "tres-container") => {
  13980. Rn || (Rn = new Gs.Pane({
  13981. container: document.querySelector(b2) || void 0
  13982. }), Rn.registerPlugin(Mh), Ns = Rn.addBlade({
  13983. view: "fpsgraph",
  13984. label: "fpsgraph"
  13985. }));
  13986. function i() {
  13987. Rn && Rn.dispose();
  13988. }
  13989. return onMounted(() => {
  13990. const { onBeforeLoop: r, onAfterLoop: s, resume: a } = $();
  13991. a(), r(() => Ns.begin()), s(() => Ns.end());
  13992. }), onUnmounted(() => {
  13993. i();
  13994. }), { pane: Rn, fpsGraph: Ns, disposeTweakPane: i };
  13995. };
  13996. function jh(b2, i) {
  13997. const r = ref(i), s = new AnimationMixer(r.value), a = shallowReactive({});
  13998. b2.forEach((u) => {
  13999. const h2 = s.clipAction(u, r.value);
  14000. a[u.name] = h2;
  14001. });
  14002. const { onLoop: c } = $();
  14003. return c(({ delta: u }) => {
  14004. s.update(u);
  14005. }), {
  14006. actions: a,
  14007. mixer: s
  14008. };
  14009. }
  14010. var Fs = null;
  14011. function Sh(b2, i) {
  14012. return (r) => {
  14013. i && i(r), b2.draco && (Fs || (Fs = new ah()), Fs.setDecoderPath(b2.decoderPath || "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"), r.setDRACOLoader(Fs));
  14014. };
  14015. }
  14016. async function Ah(b2, i = {
  14017. draco: false
  14018. }, r) {
  14019. return await dt(ou, b2, Sh(i, r));
  14020. }
  14021. var zh = defineComponent({
  14022. name: "GLTFModel",
  14023. props: ["path", "draco", "decoderPath"],
  14024. async setup(b2, { expose: i }) {
  14025. const { state: r } = jn();
  14026. function s() {
  14027. return a;
  14028. }
  14029. i({ getModel: s });
  14030. const { scene: a } = await Ah(b2.path, { draco: b2.draco, decoderPath: b2.decoderPath });
  14031. return r.scene && r.scene.add(a), () => {
  14032. };
  14033. }
  14034. });
  14035. async function Lh(b2) {
  14036. return await dt(Hu, b2);
  14037. }
  14038. var Uh = defineComponent({
  14039. name: "FBXModel",
  14040. props: ["path"],
  14041. async setup(b2, { expose: i }) {
  14042. const { state: r } = jn();
  14043. let s = null;
  14044. function a() {
  14045. return s;
  14046. }
  14047. return i({ getModel: a }), s = await Lh(b2.path), r.scene && s.isObject3D && r.scene.add(s), () => {
  14048. };
  14049. }
  14050. });
  14051. var Gh = defineComponent({
  14052. __name: "Text3D",
  14053. props: {
  14054. font: null,
  14055. text: null,
  14056. size: { default: 0.5 },
  14057. height: { default: 0.2 },
  14058. curveSegments: { default: 5 },
  14059. bevelEnabled: { type: Boolean, default: true },
  14060. bevelThickness: { default: 0.05 },
  14061. bevelSize: { default: 0.02 },
  14062. bevelOffset: { default: 0 },
  14063. bevelSegments: { default: 4 },
  14064. center: { type: Boolean, default: false }
  14065. },
  14066. async setup(b2) {
  14067. let i, r;
  14068. const s = b2, { extend: a } = jn();
  14069. a({ TextGeometry: Ou });
  14070. const c = new nh(), u = useSlots(), h2 = computed(() => {
  14071. var w;
  14072. return s.text ? s.text : u.default ? (w = u.default()[0].children) == null ? void 0 : w.trim() : "TresJS";
  14073. }), d = ([i, r] = withAsyncContext(() => new Promise((w, _) => {
  14074. try {
  14075. typeof s.font == "string" ? c.load(s.font, (y2) => {
  14076. w(y2);
  14077. }) : w(s.font);
  14078. } catch (y2) {
  14079. _(console.error("cientos", y2));
  14080. }
  14081. })), i = await i, r(), i), g = computed(() => ({
  14082. font: d,
  14083. size: s.size,
  14084. height: s.height,
  14085. curveSegments: s.curveSegments,
  14086. bevelEnabled: s.bevelEnabled,
  14087. bevelThickness: s.bevelThickness,
  14088. bevelSize: s.bevelSize,
  14089. bevelOffset: s.bevelOffset,
  14090. bevelSegments: s.bevelSegments
  14091. }));
  14092. return (w, _) => {
  14093. const y2 = resolveComponent("TresTextGeometry"), C = resolveComponent("TresMesh");
  14094. return unref(d) ? (openBlock(), createBlock(C, { key: 0 }, {
  14095. default: withCtx(() => [
  14096. unref(h2) ? (openBlock(), createBlock(y2, {
  14097. key: 0,
  14098. args: [unref(h2), unref(g)],
  14099. center: b2.center
  14100. }, null, 8, ["args", "center"])) : createCommentVNode("", true),
  14101. renderSlot(w.$slots, "default")
  14102. ]),
  14103. _: 3
  14104. })) : createCommentVNode("", true);
  14105. };
  14106. }
  14107. });
  14108. var Hh = defineComponent({
  14109. __name: "Plane",
  14110. props: {
  14111. args: { default: () => [1, 1] },
  14112. color: { default: "0xffffff" }
  14113. },
  14114. setup(b2, { expose: i }) {
  14115. const r = shallowRef();
  14116. return i({
  14117. value: r
  14118. }), (s, a) => {
  14119. const c = resolveComponent("TresPlaneGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14120. return openBlock(), createBlock(h2, mergeProps({
  14121. ref_key: "planeRef",
  14122. ref: r,
  14123. rotation: [-Math.PI / 2, 0, 0]
  14124. }, s.$attrs), {
  14125. default: withCtx(() => [
  14126. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14127. renderSlot(s.$slots, "default", {}, () => [
  14128. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14129. ])
  14130. ]),
  14131. _: 3
  14132. }, 16, ["rotation"]);
  14133. };
  14134. }
  14135. });
  14136. var Kh = defineComponent({
  14137. __name: "Box",
  14138. props: {
  14139. args: { default: () => [1, 1, 1] },
  14140. color: { default: "0xffffff" }
  14141. },
  14142. setup(b2, { expose: i }) {
  14143. const r = shallowRef();
  14144. return i({
  14145. value: r
  14146. }), (s, a) => {
  14147. const c = resolveComponent("TresBoxGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14148. return openBlock(), createBlock(h2, mergeProps({
  14149. ref_key: "boxRef",
  14150. ref: r
  14151. }, s.$attrs), {
  14152. default: withCtx(() => [
  14153. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14154. renderSlot(s.$slots, "default", {}, () => [
  14155. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14156. ])
  14157. ]),
  14158. _: 3
  14159. }, 16);
  14160. };
  14161. }
  14162. });
  14163. var $h = defineComponent({
  14164. __name: "Sphere",
  14165. props: {
  14166. args: { default: () => [2, 32, 16] },
  14167. color: { default: "0xffffff" }
  14168. },
  14169. setup(b2, { expose: i }) {
  14170. const r = shallowRef();
  14171. return i({
  14172. value: r
  14173. }), (s, a) => {
  14174. const c = resolveComponent("TresSphereGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14175. return openBlock(), createBlock(h2, mergeProps({
  14176. ref_key: "sphereRef",
  14177. ref: r
  14178. }, s.$attrs), {
  14179. default: withCtx(() => [
  14180. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14181. renderSlot(s.$slots, "default", {}, () => [
  14182. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14183. ])
  14184. ]),
  14185. _: 3
  14186. }, 16);
  14187. };
  14188. }
  14189. });
  14190. var Xh = defineComponent({
  14191. __name: "Torus",
  14192. props: {
  14193. args: { default: () => [1, 1, 16, 80] },
  14194. color: { default: "0xffffff" }
  14195. },
  14196. setup(b2, { expose: i }) {
  14197. const r = shallowRef();
  14198. return i({
  14199. value: r
  14200. }), (s, a) => {
  14201. const c = resolveComponent("TresTorusGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14202. return openBlock(), createBlock(h2, mergeProps({
  14203. ref_key: "torusRef",
  14204. ref: r
  14205. }, s.$attrs), {
  14206. default: withCtx(() => [
  14207. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14208. renderSlot(s.$slots, "default", {}, () => [
  14209. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14210. ])
  14211. ]),
  14212. _: 3
  14213. }, 16);
  14214. };
  14215. }
  14216. });
  14217. var Yh = defineComponent({
  14218. __name: "TorusKnot",
  14219. props: {
  14220. args: { default: () => [1, 0.4, 64, 8] },
  14221. color: { default: "0xffffff" }
  14222. },
  14223. setup(b2, { expose: i }) {
  14224. const r = shallowRef();
  14225. return i({
  14226. value: r
  14227. }), (s, a) => {
  14228. const c = resolveComponent("TresTorusKnotGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14229. return openBlock(), createBlock(h2, mergeProps({
  14230. ref_key: "torusKnotRef",
  14231. ref: r
  14232. }, s.$attrs), {
  14233. default: withCtx(() => [
  14234. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14235. renderSlot(s.$slots, "default", {}, () => [
  14236. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14237. ])
  14238. ]),
  14239. _: 3
  14240. }, 16);
  14241. };
  14242. }
  14243. });
  14244. var qh = defineComponent({
  14245. __name: "Circle",
  14246. props: {
  14247. args: { default: () => [1, 32, 0, Math.PI * 2] },
  14248. color: { default: "0xffffff" }
  14249. },
  14250. setup(b2, { expose: i }) {
  14251. const r = shallowRef();
  14252. return i({
  14253. value: r
  14254. }), (s, a) => {
  14255. const c = resolveComponent("TresCircleGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14256. return openBlock(), createBlock(h2, mergeProps({
  14257. ref_key: "circleRef",
  14258. ref: r
  14259. }, s.$attrs), {
  14260. default: withCtx(() => [
  14261. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14262. renderSlot(s.$slots, "default", {}, () => [
  14263. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14264. ])
  14265. ]),
  14266. _: 3
  14267. }, 16);
  14268. };
  14269. }
  14270. });
  14271. var Qh = defineComponent({
  14272. __name: "Cone",
  14273. props: {
  14274. args: { default: () => [1, 1, 12, false, 0, Math.PI * 2] },
  14275. color: { default: "0xffffff" }
  14276. },
  14277. setup(b2, { expose: i }) {
  14278. const r = shallowRef();
  14279. return i({
  14280. value: r
  14281. }), (s, a) => {
  14282. const c = resolveComponent("TresConeGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14283. return openBlock(), createBlock(h2, mergeProps({
  14284. ref_key: "coneRef",
  14285. ref: r
  14286. }, s.$attrs), {
  14287. default: withCtx(() => [
  14288. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14289. renderSlot(s.$slots, "default", {}, () => [
  14290. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14291. ])
  14292. ]),
  14293. _: 3
  14294. }, 16);
  14295. };
  14296. }
  14297. });
  14298. var Zh = defineComponent({
  14299. __name: "Tube",
  14300. props: {
  14301. args: { default: () => [
  14302. new QuadraticBezierCurve3(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),
  14303. 20,
  14304. 0.2,
  14305. 8,
  14306. false
  14307. ] },
  14308. color: { default: "0xffffff" }
  14309. },
  14310. setup(b2, { expose: i }) {
  14311. const r = shallowRef();
  14312. return i({
  14313. value: r
  14314. }), (s, a) => {
  14315. const c = resolveComponent("TresTubeGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14316. return openBlock(), createBlock(h2, mergeProps({
  14317. ref_key: "tubeRef",
  14318. ref: r
  14319. }, s.$attrs), {
  14320. default: withCtx(() => [
  14321. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14322. renderSlot(s.$slots, "default", {}, () => [
  14323. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14324. ])
  14325. ]),
  14326. _: 3
  14327. }, 16);
  14328. };
  14329. }
  14330. });
  14331. var Wh = defineComponent({
  14332. __name: "Ring",
  14333. props: {
  14334. args: { default: () => [0.5, 1, 32] },
  14335. color: { default: "0xffffff" }
  14336. },
  14337. setup(b2, { expose: i }) {
  14338. const r = shallowRef();
  14339. return i({
  14340. value: r
  14341. }), (s, a) => {
  14342. const c = resolveComponent("TresRingGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14343. return openBlock(), createBlock(h2, mergeProps({
  14344. ref_key: "ringRef",
  14345. ref: r
  14346. }, s.$attrs), {
  14347. default: withCtx(() => [
  14348. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14349. renderSlot(s.$slots, "default", {}, () => [
  14350. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14351. ])
  14352. ]),
  14353. _: 3
  14354. }, 16);
  14355. };
  14356. }
  14357. });
  14358. var Jh = defineComponent({
  14359. __name: "Tetrahedron",
  14360. props: {
  14361. args: { default: () => [1, 0] },
  14362. color: { default: "0xffffff" }
  14363. },
  14364. setup(b2, { expose: i }) {
  14365. const r = shallowRef();
  14366. return i({
  14367. value: r
  14368. }), (s, a) => {
  14369. const c = resolveComponent("TresTetrahedronGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14370. return openBlock(), createBlock(h2, mergeProps({
  14371. ref_key: "tetrahedronRef",
  14372. ref: r,
  14373. rotation: [-Math.PI / 2, 0, 0]
  14374. }, s.$attrs), {
  14375. default: withCtx(() => [
  14376. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14377. renderSlot(s.$slots, "default", {}, () => [
  14378. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14379. ])
  14380. ]),
  14381. _: 3
  14382. }, 16, ["rotation"]);
  14383. };
  14384. }
  14385. });
  14386. var ed = defineComponent({
  14387. __name: "Icosahedron",
  14388. props: {
  14389. args: { default: () => [1, 0] },
  14390. color: { default: "0xffffff" }
  14391. },
  14392. setup(b2, { expose: i }) {
  14393. const r = shallowRef();
  14394. return i({
  14395. value: r
  14396. }), (s, a) => {
  14397. const c = resolveComponent("TresIcosahedronGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14398. return openBlock(), createBlock(h2, mergeProps({
  14399. ref_key: "icosahedronRef",
  14400. ref: r
  14401. }, s.$attrs), {
  14402. default: withCtx(() => [
  14403. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14404. renderSlot(s.$slots, "default", {}, () => [
  14405. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14406. ])
  14407. ]),
  14408. _: 3
  14409. }, 16);
  14410. };
  14411. }
  14412. });
  14413. var td = defineComponent({
  14414. __name: "Octahedron",
  14415. props: {
  14416. args: { default: () => [1, 0] },
  14417. color: { default: "0xffffff" }
  14418. },
  14419. setup(b2, { expose: i }) {
  14420. const r = shallowRef();
  14421. return i({
  14422. value: r
  14423. }), (s, a) => {
  14424. const c = resolveComponent("TresOctahedronGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14425. return openBlock(), createBlock(h2, mergeProps({
  14426. ref_key: "octahedronRef",
  14427. ref: r
  14428. }, s.$attrs), {
  14429. default: withCtx(() => [
  14430. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14431. renderSlot(s.$slots, "default", {}, () => [
  14432. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14433. ])
  14434. ]),
  14435. _: 3
  14436. }, 16);
  14437. };
  14438. }
  14439. });
  14440. var nd = defineComponent({
  14441. __name: "Dodecahedron",
  14442. props: {
  14443. args: { default: () => [1, 0] },
  14444. color: { default: "0xffffff" }
  14445. },
  14446. setup(b2, { expose: i }) {
  14447. const r = shallowRef();
  14448. return i({
  14449. value: r
  14450. }), (s, a) => {
  14451. const c = resolveComponent("TresDodecahedronGeometry"), u = resolveComponent("TresMeshBasicMaterial"), h2 = resolveComponent("TresMesh");
  14452. return openBlock(), createBlock(h2, mergeProps({
  14453. ref_key: "dodecahedronRef",
  14454. ref: r
  14455. }, s.$attrs), {
  14456. default: withCtx(() => [
  14457. createVNode(c, { args: b2.args }, null, 8, ["args"]),
  14458. renderSlot(s.$slots, "default", {}, () => [
  14459. createVNode(u, { color: b2.color }, null, 8, ["color"])
  14460. ])
  14461. ]),
  14462. _: 3
  14463. }, 16);
  14464. };
  14465. }
  14466. });
  14467. var io = {
  14468. sunset: "venice/venice_sunset_4k.hdr"
  14469. };
  14470. async function Rh({
  14471. files: b2 = ["/px.png", "/nx.png", "/py.png", "/ny.png", "/pz.png", "/nz.png"],
  14472. blur: i = 0,
  14473. background: r = false,
  14474. path: s = "/",
  14475. preset: a = void 0,
  14476. encoding: c = void 0
  14477. }) {
  14478. const { state: u } = jn();
  14479. if (a) {
  14480. if (!(a in io))
  14481. throw new Error("Preset must be one of: " + Object.keys(io).join(", "));
  14482. b2 = io[a], s = "https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";
  14483. }
  14484. const h2 = Array.isArray(b2), g = await dt(
  14485. h2 ? CubeTextureLoader : oh,
  14486. h2 ? [b2] : b2,
  14487. (_) => {
  14488. s && _.setPath(s), c && (_.encoding = c);
  14489. }
  14490. ), w = h2 ? g[0] : g;
  14491. return w && (w.mapping = h2 ? CubeReflectionMapping : EquirectangularReflectionMapping, w.encoding = c ?? h2 ? sRGBEncoding : LinearEncoding), u.scene && (u.scene.environment = w, r !== void 0 && (u.scene.background = w), i && (u.scene.backgroundBlurriness = i | 0)), w;
  14492. }
  14493. var id = defineComponent({
  14494. name: "Environment",
  14495. props: ["background", "blur", "files", "encoding", "path", "preset"],
  14496. async setup(b2, { expose: i }) {
  14497. let r = null;
  14498. return i({ getTexture: () => r }), r = await Rh(b2), () => {
  14499. };
  14500. }
  14501. });
  14502. export {
  14503. Kh as Box,
  14504. qh as Circle,
  14505. Qh as Cone,
  14506. nd as Dodecahedron,
  14507. id as Environment,
  14508. Uh as FBXModel,
  14509. zh as GLTFModel,
  14510. ed as Icosahedron,
  14511. td as Octahedron,
  14512. Oh as OrbitControls,
  14513. Fh as PamCameraMouse,
  14514. Hh as Plane,
  14515. Wh as Ring,
  14516. $h as Sphere,
  14517. Jh as Tetrahedron,
  14518. Gh as Text3D,
  14519. Xh as Torus,
  14520. Yh as TorusKnot,
  14521. Nh as TransformControls,
  14522. Zh as Tube,
  14523. jh as useAnimations,
  14524. Rh as useEnvironment,
  14525. Lh as useFBX,
  14526. Ah as useGLTF,
  14527. Ch as usePamCameraMouse,
  14528. Bh as useTweakPane
  14529. };
  14530. /*! Bundled license information:
  14531. @tresjs/cientos/dist/trescientos.js:
  14532. (*! Tweakpane 3.1.7 (c) 2016 cocopon, licensed under the MIT license. *)
  14533. */
  14534. //# sourceMappingURL=@tresjs_cientos.js.map