@tresjs_cientos.js 544 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977
  1. import {
  2. D,
  3. Ee,
  4. Rt,
  5. _,
  6. xt
  7. } from "./chunk-4R2RUFTZ.js";
  8. import {
  9. Fragment,
  10. computed,
  11. createBaseVNode,
  12. createCommentVNode,
  13. createElementBlock,
  14. customRef,
  15. defineComponent,
  16. getCurrentInstance,
  17. getCurrentScope,
  18. guardReactiveProps,
  19. inject,
  20. mergeProps,
  21. nextTick,
  22. normalizeProps,
  23. onMounted,
  24. onScopeDispose,
  25. onUnmounted,
  26. openBlock,
  27. readonly,
  28. ref,
  29. renderList,
  30. renderSlot,
  31. shallowReactive,
  32. shallowRef,
  33. toRef,
  34. unref,
  35. useSlots,
  36. watch,
  37. watchEffect,
  38. withAsyncContext
  39. } from "./chunk-LZPJ5JBW.js";
  40. import {
  41. AmbientLight,
  42. AnimationClip,
  43. AnimationMixer,
  44. Bone,
  45. Box3,
  46. BoxGeometry,
  47. BufferAttribute,
  48. BufferGeometry,
  49. ClampToEdgeWrapping,
  50. Color,
  51. CubeReflectionMapping,
  52. CubeTextureLoader,
  53. Curve,
  54. CylinderGeometry,
  55. DataTextureLoader,
  56. DataUtils,
  57. DirectionalLight,
  58. DoubleSide,
  59. EquirectangularReflectionMapping,
  60. Euler,
  61. EventDispatcher,
  62. ExtrudeGeometry,
  63. FileLoader,
  64. Float32BufferAttribute,
  65. FloatType,
  66. FrontSide,
  67. Group,
  68. HalfFloatType,
  69. ImageBitmapLoader,
  70. InterleavedBuffer,
  71. InterleavedBufferAttribute,
  72. Interpolant,
  73. InterpolateDiscrete,
  74. InterpolateLinear,
  75. Line,
  76. LineBasicMaterial,
  77. LineLoop,
  78. LineSegments,
  79. LinearEncoding,
  80. LinearFilter,
  81. LinearMipmapLinearFilter,
  82. LinearMipmapNearestFilter,
  83. Loader,
  84. LoaderUtils,
  85. MOUSE,
  86. Material,
  87. MathUtils,
  88. Matrix3,
  89. Matrix4,
  90. Mesh,
  91. MeshBasicMaterial,
  92. MeshLambertMaterial,
  93. MeshPhongMaterial,
  94. MeshPhysicalMaterial,
  95. MeshStandardMaterial,
  96. MirroredRepeatWrapping,
  97. NearestFilter,
  98. NearestMipmapLinearFilter,
  99. NearestMipmapNearestFilter,
  100. NumberKeyframeTrack,
  101. Object3D,
  102. OctahedronGeometry,
  103. OrthographicCamera,
  104. PerspectiveCamera,
  105. PlaneGeometry,
  106. PointLight,
  107. Points,
  108. PointsMaterial,
  109. PropertyBinding,
  110. QuadraticBezierCurve3,
  111. Quaternion,
  112. QuaternionKeyframeTrack,
  113. Raycaster,
  114. RepeatWrapping,
  115. ShapePath,
  116. Skeleton,
  117. SkinnedMesh,
  118. Sphere,
  119. SphereGeometry,
  120. Spherical,
  121. SpotLight,
  122. TOUCH,
  123. TangentSpaceNormalMap,
  124. Texture,
  125. TextureLoader,
  126. TorusGeometry,
  127. TriangleFanDrawMode,
  128. TriangleStripDrawMode,
  129. Uint16BufferAttribute,
  130. Vector2,
  131. Vector3,
  132. Vector4,
  133. VectorKeyframeTrack,
  134. sRGBEncoding
  135. } from "./chunk-PDZK3SQX.js";
  136. import "./chunk-JC4IRQUL.js";
  137. // node_modules/.pnpm/@tresjs+cientos@2.0.0-beta.6_@tresjs+core@2.0.0-rc.2_three@0.152.2_vue@3.2.47/node_modules/@tresjs/cientos/dist/trescientos.js
  138. var Qc = Object.defineProperty;
  139. var Zc = (v, n, s) => n in v ? Qc(v, n, { enumerable: true, configurable: true, writable: true, value: s }) : v[n] = s;
  140. var Jr = (v, n, s) => (Zc(v, typeof n != "symbol" ? n + "" : n, s), s);
  141. function $u(v, n) {
  142. for (var s = 0; s < n.length; s++) {
  143. const r = n[s];
  144. if (typeof r != "string" && !Array.isArray(r)) {
  145. for (const o in r)
  146. if (o !== "default" && !(o in v)) {
  147. const c = Object.getOwnPropertyDescriptor(r, o);
  148. c && Object.defineProperty(v, o, c.get ? c : {
  149. enumerable: true,
  150. get: () => r[o]
  151. });
  152. }
  153. }
  154. }
  155. return Object.freeze(Object.defineProperty(v, Symbol.toStringTag, { value: "Module" }));
  156. }
  157. function Ji(v) {
  158. return Ji = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
  159. return typeof n;
  160. } : function(n) {
  161. return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
  162. }, Ji(v);
  163. }
  164. function Xu(v, n) {
  165. if (Ji(v) !== "object" || v === null)
  166. return v;
  167. var s = v[Symbol.toPrimitive];
  168. if (s !== void 0) {
  169. var r = s.call(v, n || "default");
  170. if (Ji(r) !== "object")
  171. return r;
  172. throw new TypeError("@@toPrimitive must return a primitive value.");
  173. }
  174. return (n === "string" ? String : Number)(v);
  175. }
  176. function Yu(v) {
  177. var n = Xu(v, "string");
  178. return Ji(n) === "symbol" ? n : String(n);
  179. }
  180. function C(v, n, s) {
  181. return n = Yu(n), n in v ? Object.defineProperty(v, n, {
  182. value: s,
  183. enumerable: true,
  184. configurable: true,
  185. writable: true
  186. }) : v[n] = s, v;
  187. }
  188. var mt = Uint8Array;
  189. var an = Uint16Array;
  190. var vo = Uint32Array;
  191. var ja = new mt([
  192. 0,
  193. 0,
  194. 0,
  195. 0,
  196. 0,
  197. 0,
  198. 0,
  199. 0,
  200. 1,
  201. 1,
  202. 1,
  203. 1,
  204. 2,
  205. 2,
  206. 2,
  207. 2,
  208. 3,
  209. 3,
  210. 3,
  211. 3,
  212. 4,
  213. 4,
  214. 4,
  215. 4,
  216. 5,
  217. 5,
  218. 5,
  219. 5,
  220. 0,
  221. /* unused */
  222. 0,
  223. 0,
  224. /* impossible */
  225. 0
  226. ]);
  227. var Ua = new mt([
  228. 0,
  229. 0,
  230. 0,
  231. 0,
  232. 1,
  233. 1,
  234. 2,
  235. 2,
  236. 3,
  237. 3,
  238. 4,
  239. 4,
  240. 5,
  241. 5,
  242. 6,
  243. 6,
  244. 7,
  245. 7,
  246. 8,
  247. 8,
  248. 9,
  249. 9,
  250. 10,
  251. 10,
  252. 11,
  253. 11,
  254. 12,
  255. 12,
  256. 13,
  257. 13,
  258. /* unused */
  259. 0,
  260. 0
  261. ]);
  262. var qu = new mt([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  263. var Ga = function(v, n) {
  264. for (var s = new an(31), r = 0; r < 31; ++r)
  265. s[r] = n += 1 << v[r - 1];
  266. for (var o = new vo(s[30]), r = 1; r < 30; ++r)
  267. for (var c = s[r]; c < s[r + 1]; ++c)
  268. o[c] = c - s[r] << 5 | r;
  269. return [s, o];
  270. };
  271. var Ha = Ga(ja, 2);
  272. var Ka = Ha[0];
  273. var Qu = Ha[1];
  274. Ka[28] = 258, Qu[258] = 28;
  275. var Zu = Ga(Ua, 0);
  276. var Wu = Zu[0];
  277. var bo = new an(32768);
  278. for (Ce = 0; Ce < 32768; ++Ce) {
  279. sn = (Ce & 43690) >>> 1 | (Ce & 21845) << 1;
  280. sn = (sn & 52428) >>> 2 | (sn & 13107) << 2, sn = (sn & 61680) >>> 4 | (sn & 3855) << 4, bo[Ce] = ((sn & 65280) >>> 8 | (sn & 255) << 8) >>> 1;
  281. }
  282. var sn;
  283. var Ce;
  284. var Qi = function(v, n, s) {
  285. for (var r = v.length, o = 0, c = new an(n); o < r; ++o)
  286. ++c[v[o] - 1];
  287. var p = new an(n);
  288. for (o = 0; o < n; ++o)
  289. p[o] = p[o - 1] + c[o - 1] << 1;
  290. var h;
  291. if (s) {
  292. h = new an(1 << n);
  293. var d = 15 - n;
  294. for (o = 0; o < r; ++o)
  295. if (v[o])
  296. for (var g = o << 4 | v[o], w = n - v[o], _2 = p[v[o] - 1]++ << w, y = _2 | (1 << w) - 1; _2 <= y; ++_2)
  297. h[bo[_2] >>> d] = g;
  298. } else
  299. for (h = new an(r), o = 0; o < r; ++o)
  300. v[o] && (h[o] = bo[p[v[o] - 1]++] >>> 15 - v[o]);
  301. return h;
  302. };
  303. var ss = new mt(288);
  304. for (Ce = 0; Ce < 144; ++Ce)
  305. ss[Ce] = 8;
  306. var Ce;
  307. for (Ce = 144; Ce < 256; ++Ce)
  308. ss[Ce] = 9;
  309. var Ce;
  310. for (Ce = 256; Ce < 280; ++Ce)
  311. ss[Ce] = 7;
  312. var Ce;
  313. for (Ce = 280; Ce < 288; ++Ce)
  314. ss[Ce] = 8;
  315. var Ce;
  316. var $a = new mt(32);
  317. for (Ce = 0; Ce < 32; ++Ce)
  318. $a[Ce] = 5;
  319. var Ce;
  320. var Ju = Qi(ss, 9, 1);
  321. var ep = Qi($a, 5, 1);
  322. var io = function(v) {
  323. for (var n = v[0], s = 1; s < v.length; ++s)
  324. v[s] > n && (n = v[s]);
  325. return n;
  326. };
  327. var xt2 = function(v, n, s) {
  328. var r = n / 8 | 0;
  329. return (v[r] | v[r + 1] << 8) >> (n & 7) & s;
  330. };
  331. var so = function(v, n) {
  332. var s = n / 8 | 0;
  333. return (v[s] | v[s + 1] << 8 | v[s + 2] << 16) >> (n & 7);
  334. };
  335. var tp = function(v) {
  336. return (v / 8 | 0) + (v & 7 && 1);
  337. };
  338. var np = function(v, n, s) {
  339. (n == null || n < 0) && (n = 0), (s == null || s > v.length) && (s = v.length);
  340. var r = new (v instanceof an ? an : v instanceof vo ? vo : mt)(s - n);
  341. return r.set(v.subarray(n, s)), r;
  342. };
  343. var ip = function(v, n, s) {
  344. var r = v.length;
  345. if (!r || s && !s.l && r < 5)
  346. return n || new mt(0);
  347. var o = !n || s, c = !s || s.i;
  348. s || (s = {}), n || (n = new mt(r * 3));
  349. var p = function(Fe) {
  350. var Ue = n.length;
  351. if (Fe > Ue) {
  352. var ye = new mt(Math.max(Ue * 2, Fe));
  353. ye.set(n), n = ye;
  354. }
  355. }, h = s.f || 0, d = s.p || 0, g = s.b || 0, w = s.l, _2 = s.d, y = s.m, P = s.n, R = r * 8;
  356. do {
  357. if (!w) {
  358. s.f = h = xt2(v, d, 1);
  359. var k = xt2(v, d + 1, 3);
  360. if (d += 3, k)
  361. if (k == 1)
  362. w = Ju, _2 = ep, y = 9, P = 5;
  363. else if (k == 2) {
  364. var I = xt2(v, d, 31) + 257, D2 = xt2(v, d + 10, 15) + 4, Y = I + xt2(v, d + 5, 31) + 1;
  365. d += 14;
  366. for (var G = new mt(Y), N = new mt(19), O = 0; O < D2; ++O)
  367. N[qu[O]] = xt2(v, d + O * 3, 7);
  368. d += D2 * 3;
  369. for (var H = io(N), K = (1 << H) - 1, q = Qi(N, H, 1), O = 0; O < Y; ) {
  370. var pe = q[xt2(v, d, K)];
  371. d += pe & 15;
  372. var A = pe >>> 4;
  373. if (A < 16)
  374. G[O++] = A;
  375. else {
  376. var _e = 0, ce = 0;
  377. for (A == 16 ? (ce = 3 + xt2(v, d, 3), d += 2, _e = G[O - 1]) : A == 17 ? (ce = 3 + xt2(v, d, 7), d += 3) : A == 18 && (ce = 11 + xt2(v, d, 127), d += 7); ce--; )
  378. G[O++] = _e;
  379. }
  380. }
  381. var me = G.subarray(0, I), he = G.subarray(I);
  382. y = io(me), P = io(he), w = Qi(me, y, 1), _2 = Qi(he, P, 1);
  383. } else
  384. throw "invalid block type";
  385. else {
  386. var A = tp(d) + 4, z = v[A - 4] | v[A - 3] << 8, F = A + z;
  387. if (F > r) {
  388. if (c)
  389. throw "unexpected EOF";
  390. break;
  391. }
  392. o && p(g + z), n.set(v.subarray(A, F), g), s.b = g += z, s.p = d = F * 8;
  393. continue;
  394. }
  395. if (d > R) {
  396. if (c)
  397. throw "unexpected EOF";
  398. break;
  399. }
  400. }
  401. o && p(g + 131072);
  402. for (var ee = (1 << y) - 1, X = (1 << P) - 1, Te = d; ; Te = d) {
  403. var _e = w[so(v, d) & ee], fe = _e >>> 4;
  404. if (d += _e & 15, d > R) {
  405. if (c)
  406. throw "unexpected EOF";
  407. break;
  408. }
  409. if (!_e)
  410. throw "invalid length/literal";
  411. if (fe < 256)
  412. n[g++] = fe;
  413. else if (fe == 256) {
  414. Te = d, w = null;
  415. break;
  416. } else {
  417. var ae = fe - 254;
  418. if (fe > 264) {
  419. var O = fe - 257, ne = ja[O];
  420. ae = xt2(v, d, (1 << ne) - 1) + Ka[O], d += ne;
  421. }
  422. var ge = _2[so(v, d) & X], S = ge >>> 4;
  423. if (!ge)
  424. throw "invalid distance";
  425. d += ge & 15;
  426. var he = Wu[S];
  427. if (S > 3) {
  428. var ne = Ua[S];
  429. he += so(v, d) & (1 << ne) - 1, d += ne;
  430. }
  431. if (d > R) {
  432. if (c)
  433. throw "unexpected EOF";
  434. break;
  435. }
  436. o && p(g + 131072);
  437. for (var le = g + ae; g < le; g += 4)
  438. n[g] = n[g - he], n[g + 1] = n[g + 1 - he], n[g + 2] = n[g + 2 - he], n[g + 3] = n[g + 3 - he];
  439. g = le;
  440. }
  441. }
  442. s.l = w, s.p = Te, s.b = g, w && (h = 1, s.m = y, s.d = _2, s.n = P);
  443. } while (!h);
  444. return g == n.length ? n : np(n, 0, g);
  445. };
  446. var sp = new mt(0);
  447. var rp = function(v) {
  448. if ((v[0] & 15) != 8 || v[0] >>> 4 > 7 || (v[0] << 8 | v[1]) % 31)
  449. throw "invalid zlib data";
  450. if (v[1] & 32)
  451. throw "invalid zlib data: preset dictionaries not supported";
  452. };
  453. function op(v, n) {
  454. return ip((rp(v), v.subarray(2, -4)), n);
  455. }
  456. var ap = typeof TextDecoder < "u" && new TextDecoder();
  457. var lp = 0;
  458. try {
  459. ap.decode(sp, { stream: true }), lp = 1;
  460. } catch {
  461. }
  462. var cp = class extends Object3D {
  463. // events
  464. constructor(n, s) {
  465. super(), C(this, "isTransformControls", true), C(this, "visible", false), C(this, "domElement", void 0), C(this, "raycaster", new Raycaster()), C(this, "gizmo", void 0), C(this, "plane", void 0), C(this, "tempVector", new Vector3()), C(this, "tempVector2", new Vector3()), C(this, "tempQuaternion", new Quaternion()), C(this, "unit", {
  466. X: new Vector3(1, 0, 0),
  467. Y: new Vector3(0, 1, 0),
  468. Z: new Vector3(0, 0, 1)
  469. }), C(this, "pointStart", new Vector3()), C(this, "pointEnd", new Vector3()), C(this, "offset", new Vector3()), C(this, "rotationAxis", new Vector3()), C(this, "startNorm", new Vector3()), C(this, "endNorm", new Vector3()), C(this, "rotationAngle", 0), C(this, "cameraPosition", new Vector3()), C(this, "cameraQuaternion", new Quaternion()), C(this, "cameraScale", new Vector3()), C(this, "parentPosition", new Vector3()), C(this, "parentQuaternion", new Quaternion()), C(this, "parentQuaternionInv", new Quaternion()), C(this, "parentScale", new Vector3()), C(this, "worldPositionStart", new Vector3()), C(this, "worldQuaternionStart", new Quaternion()), C(this, "worldScaleStart", new Vector3()), C(this, "worldPosition", new Vector3()), C(this, "worldQuaternion", new Quaternion()), C(this, "worldQuaternionInv", new Quaternion()), C(this, "worldScale", new Vector3()), C(this, "eye", new Vector3()), C(this, "positionStart", new Vector3()), C(this, "quaternionStart", new Quaternion()), C(this, "scaleStart", new Vector3()), C(this, "camera", void 0), C(this, "object", void 0), C(this, "enabled", true), C(this, "axis", null), C(this, "mode", "translate"), C(this, "translationSnap", null), C(this, "rotationSnap", null), C(this, "scaleSnap", null), C(this, "space", "world"), C(this, "size", 1), C(this, "dragging", false), C(this, "showX", true), C(this, "showY", true), C(this, "showZ", true), C(this, "changeEvent", {
  470. type: "change"
  471. }), C(this, "mouseDownEvent", {
  472. type: "mouseDown",
  473. mode: this.mode
  474. }), C(this, "mouseUpEvent", {
  475. type: "mouseUp",
  476. mode: this.mode
  477. }), C(this, "objectChangeEvent", {
  478. type: "objectChange"
  479. }), C(this, "intersectObjectWithRay", (o, c, p) => {
  480. const h = c.intersectObject(o, true);
  481. for (let d = 0; d < h.length; d++)
  482. if (h[d].object.visible || p)
  483. return h[d];
  484. return false;
  485. }), C(this, "attach", (o) => (this.object = o, this.visible = true, this)), C(this, "detach", () => (this.object = void 0, this.visible = false, this.axis = null, this)), C(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), C(this, "updateMatrixWorld", () => {
  486. 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();
  487. }), C(this, "pointerHover", (o) => {
  488. if (this.object === void 0 || this.dragging === true)
  489. return;
  490. this.raycaster.setFromCamera(o, this.camera);
  491. const c = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);
  492. c ? this.axis = c.object.name : this.axis = null;
  493. }), C(this, "pointerDown", (o) => {
  494. if (!(this.object === void 0 || this.dragging === true || o.button !== 0) && this.axis !== null) {
  495. this.raycaster.setFromCamera(o, this.camera);
  496. const c = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  497. if (c) {
  498. let p = this.space;
  499. if (this.mode === "scale" ? p = "local" : (this.axis === "E" || this.axis === "XYZE" || this.axis === "XYZ") && (p = "world"), p === "local" && this.mode === "rotate") {
  500. const h = this.rotationSnap;
  501. this.axis === "X" && h && (this.object.rotation.x = Math.round(this.object.rotation.x / h) * h), this.axis === "Y" && h && (this.object.rotation.y = Math.round(this.object.rotation.y / h) * h), this.axis === "Z" && h && (this.object.rotation.z = Math.round(this.object.rotation.z / h) * h);
  502. }
  503. 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);
  504. }
  505. this.dragging = true, this.mouseDownEvent.mode = this.mode, this.dispatchEvent(this.mouseDownEvent);
  506. }
  507. }), C(this, "pointerMove", (o) => {
  508. const c = this.axis, p = this.mode, h = this.object;
  509. let d = this.space;
  510. if (p === "scale" ? d = "local" : (c === "E" || c === "XYZE" || c === "XYZ") && (d = "world"), h === void 0 || c === null || this.dragging === false || o.button !== -1)
  511. return;
  512. this.raycaster.setFromCamera(o, this.camera);
  513. const g = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  514. if (g) {
  515. if (this.pointEnd.copy(g.point).sub(this.worldPositionStart), p === "translate")
  516. 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), h.position.copy(this.offset).add(this.positionStart), this.translationSnap && (d === "local" && (h.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()), c.search("X") !== -1 && (h.position.x = Math.round(h.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h.position.y = Math.round(h.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h.position.z = Math.round(h.position.z / this.translationSnap) * this.translationSnap), h.position.applyQuaternion(this.quaternionStart)), d === "world" && (h.parent && h.position.add(this.tempVector.setFromMatrixPosition(h.parent.matrixWorld)), c.search("X") !== -1 && (h.position.x = Math.round(h.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h.position.y = Math.round(h.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h.position.z = Math.round(h.position.z / this.translationSnap) * this.translationSnap), h.parent && h.position.sub(this.tempVector.setFromMatrixPosition(h.parent.matrixWorld))));
  517. else if (p === "scale") {
  518. if (c.search("XYZ") !== -1) {
  519. let w = this.pointEnd.length() / this.pointStart.length();
  520. this.pointEnd.dot(this.pointStart) < 0 && (w *= -1), this.tempVector2.set(w, w, w);
  521. } else
  522. 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);
  523. h.scale.copy(this.scaleStart).multiply(this.tempVector2), this.scaleSnap && this.object && (c.search("X") !== -1 && (this.object.scale.x = Math.round(h.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Y") !== -1 && (h.scale.y = Math.round(h.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Z") !== -1 && (h.scale.z = Math.round(h.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
  524. } else if (p === "rotate") {
  525. this.offset.copy(this.pointEnd).sub(this.pointStart);
  526. const w = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));
  527. 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" ? (h.quaternion.copy(this.quaternionStart), h.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this.parentQuaternionInv), h.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), h.quaternion.multiply(this.quaternionStart).normalize());
  528. }
  529. this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent);
  530. }
  531. }), C(this, "pointerUp", (o) => {
  532. o.button === 0 && (this.dragging && this.axis !== null && (this.mouseUpEvent.mode = this.mode, this.dispatchEvent(this.mouseUpEvent)), this.dragging = false, this.axis = null);
  533. }), C(this, "getPointer", (o) => {
  534. var c;
  535. if (this.domElement && (c = this.domElement.ownerDocument) !== null && c !== void 0 && c.pointerLockElement)
  536. return {
  537. x: 0,
  538. y: 0,
  539. button: o.button
  540. };
  541. {
  542. var p;
  543. const h = o.changedTouches ? o.changedTouches[0] : o, d = (p = this.domElement) === null || p === void 0 ? void 0 : p.getBoundingClientRect();
  544. return {
  545. x: (h.clientX - d.left) / d.width * 2 - 1,
  546. y: -(h.clientY - d.top) / d.height * 2 + 1,
  547. button: o.button
  548. };
  549. }
  550. }), C(this, "onPointerHover", (o) => {
  551. if (this.enabled)
  552. switch (o.pointerType) {
  553. case "mouse":
  554. case "pen":
  555. this.pointerHover(this.getPointer(o));
  556. break;
  557. }
  558. }), C(this, "onPointerDown", (o) => {
  559. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "none", this.domElement.ownerDocument.addEventListener("pointermove", this.onPointerMove), this.pointerHover(this.getPointer(o)), this.pointerDown(this.getPointer(o)));
  560. }), C(this, "onPointerMove", (o) => {
  561. this.enabled && this.pointerMove(this.getPointer(o));
  562. }), C(this, "onPointerUp", (o) => {
  563. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "", this.domElement.ownerDocument.removeEventListener("pointermove", this.onPointerMove), this.pointerUp(this.getPointer(o)));
  564. }), C(this, "getMode", () => this.mode), C(this, "setMode", (o) => {
  565. this.mode = o;
  566. }), C(this, "setTranslationSnap", (o) => {
  567. this.translationSnap = o;
  568. }), C(this, "setRotationSnap", (o) => {
  569. this.rotationSnap = o;
  570. }), C(this, "setScaleSnap", (o) => {
  571. this.scaleSnap = o;
  572. }), C(this, "setSize", (o) => {
  573. this.size = o;
  574. }), C(this, "setSpace", (o) => {
  575. this.space = o;
  576. }), C(this, "update", () => {
  577. console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.");
  578. }), C(this, "connect", (o) => {
  579. o === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), this.domElement = o, this.domElement.addEventListener("pointerdown", this.onPointerDown), this.domElement.addEventListener("pointermove", this.onPointerHover), this.domElement.ownerDocument.addEventListener("pointerup", this.onPointerUp);
  580. }), C(this, "dispose", () => {
  581. var o, c, p, h, d, g;
  582. (o = this.domElement) === null || o === void 0 || o.removeEventListener("pointerdown", this.onPointerDown), (c = this.domElement) === null || c === void 0 || c.removeEventListener("pointermove", this.onPointerHover), (p = this.domElement) === null || p === void 0 || (h = p.ownerDocument) === null || h === void 0 || h.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) => {
  583. const _2 = w;
  584. _2.geometry && _2.geometry.dispose(), _2.material && _2.material.dispose();
  585. });
  586. }), this.domElement = s, this.camera = n, this.gizmo = new up(), this.add(this.gizmo), this.plane = new pp(), this.add(this.plane);
  587. const r = (o, c) => {
  588. let p = c;
  589. Object.defineProperty(this, o, {
  590. get: function() {
  591. return p !== void 0 ? p : c;
  592. },
  593. set: function(h) {
  594. p !== h && (p = h, this.plane[o] = h, this.gizmo[o] = h, this.dispatchEvent({
  595. type: o + "-changed",
  596. value: h
  597. }), this.dispatchEvent(this.changeEvent));
  598. }
  599. }), this[o] = c, this.plane[o] = c, this.gizmo[o] = c;
  600. };
  601. r("camera", this.camera), r("object", this.object), r("enabled", this.enabled), r("axis", this.axis), r("mode", this.mode), r("translationSnap", this.translationSnap), r("rotationSnap", this.rotationSnap), r("scaleSnap", this.scaleSnap), r("space", this.space), r("size", this.size), r("dragging", this.dragging), r("showX", this.showX), r("showY", this.showY), r("showZ", this.showZ), r("worldPosition", this.worldPosition), r("worldPositionStart", this.worldPositionStart), r("worldQuaternion", this.worldQuaternion), r("worldQuaternionStart", this.worldQuaternionStart), r("cameraPosition", this.cameraPosition), r("cameraQuaternion", this.cameraQuaternion), r("pointStart", this.pointStart), r("pointEnd", this.pointEnd), r("rotationAxis", this.rotationAxis), r("rotationAngle", this.rotationAngle), r("eye", this.eye), s !== void 0 && this.connect(s);
  602. }
  603. };
  604. var up = class extends Object3D {
  605. // these are set from parent class TransformControls
  606. constructor() {
  607. super(), C(this, "isTransformControlsGizmo", true), C(this, "type", "TransformControlsGizmo"), C(this, "tempVector", new Vector3(0, 0, 0)), C(this, "tempEuler", new Euler()), C(this, "alignVector", new Vector3(0, 1, 0)), C(this, "zeroVector", new Vector3(0, 0, 0)), C(this, "lookAtMatrix", new Matrix4()), C(this, "tempQuaternion", new Quaternion()), C(this, "tempQuaternion2", new Quaternion()), C(this, "identityQuaternion", new Quaternion()), C(this, "unitX", new Vector3(1, 0, 0)), C(this, "unitY", new Vector3(0, 1, 0)), C(this, "unitZ", new Vector3(0, 0, 1)), C(this, "gizmo", void 0), C(this, "picker", void 0), C(this, "helper", void 0), C(this, "rotationAxis", new Vector3()), C(this, "cameraPosition", new Vector3()), C(this, "worldPositionStart", new Vector3()), C(this, "worldQuaternionStart", new Quaternion()), C(this, "worldPosition", new Vector3()), C(this, "worldQuaternion", new Quaternion()), C(this, "eye", new Vector3()), C(this, "camera", null), C(this, "enabled", true), C(this, "axis", null), C(this, "mode", "translate"), C(this, "space", "world"), C(this, "size", 1), C(this, "dragging", false), C(this, "showX", true), C(this, "showY", true), C(this, "showZ", true), C(this, "updateMatrixWorld", () => {
  608. let fe = this.space;
  609. this.mode === "scale" && (fe = "local");
  610. const ae = fe === "local" ? this.worldQuaternion : this.identityQuaternion;
  611. 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";
  612. let ne = [];
  613. ne = ne.concat(this.picker[this.mode].children), ne = ne.concat(this.gizmo[this.mode].children), ne = ne.concat(this.helper[this.mode].children);
  614. for (let ge = 0; ge < ne.length; ge++) {
  615. const S = ne[ge];
  616. S.visible = true, S.rotation.set(0, 0, 0), S.position.copy(this.worldPosition);
  617. let le;
  618. if (this.camera.isOrthographicCamera ? le = (this.camera.top - this.camera.bottom) / this.camera.zoom : le = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), S.scale.set(1, 1, 1).multiplyScalar(le * this.size / 7), S.tag === "helper") {
  619. S.visible = false, S.name === "AXIS" ? (S.position.copy(this.worldPositionStart), S.visible = !!this.axis, this.axis === "X" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, 0)), S.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) > 0.9 && (S.visible = false)), this.axis === "Y" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, Math.PI / 2)), S.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) > 0.9 && (S.visible = false)), this.axis === "Z" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), S.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) > 0.9 && (S.visible = false)), this.axis === "XYZE" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), this.alignVector.copy(this.rotationAxis), S.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector, this.alignVector, this.unitY)), S.quaternion.multiply(this.tempQuaternion), S.visible = this.dragging), this.axis === "E" && (S.visible = false)) : S.name === "START" ? (S.position.copy(this.worldPositionStart), S.visible = this.dragging) : S.name === "END" ? (S.position.copy(this.worldPosition), S.visible = this.dragging) : S.name === "DELTA" ? (S.position.copy(this.worldPositionStart), S.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()), S.scale.copy(this.tempVector), S.visible = this.dragging) : (S.quaternion.copy(ae), this.dragging ? S.position.copy(this.worldPositionStart) : S.position.copy(this.worldPosition), this.axis && (S.visible = this.axis.search(S.name) !== -1));
  620. continue;
  621. }
  622. S.quaternion.copy(ae), this.mode === "translate" || this.mode === "scale" ? ((S.name === "X" || S.name === "XYZX") && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) > 0.99 && (S.scale.set(1e-10, 1e-10, 1e-10), S.visible = false), (S.name === "Y" || S.name === "XYZY") && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) > 0.99 && (S.scale.set(1e-10, 1e-10, 1e-10), S.visible = false), (S.name === "Z" || S.name === "XYZZ") && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) > 0.99 && (S.scale.set(1e-10, 1e-10, 1e-10), S.visible = false), S.name === "XY" && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) < 0.2 && (S.scale.set(1e-10, 1e-10, 1e-10), S.visible = false), S.name === "YZ" && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) < 0.2 && (S.scale.set(1e-10, 1e-10, 1e-10), S.visible = false), S.name === "XZ" && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) < 0.2 && (S.scale.set(1e-10, 1e-10, 1e-10), S.visible = false), S.name.search("X") !== -1 && (this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye) < 0 ? S.tag === "fwd" ? S.visible = false : S.scale.x *= -1 : S.tag === "bwd" && (S.visible = false)), S.name.search("Y") !== -1 && (this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye) < 0 ? S.tag === "fwd" ? S.visible = false : S.scale.y *= -1 : S.tag === "bwd" && (S.visible = false)), S.name.search("Z") !== -1 && (this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye) < 0 ? S.tag === "fwd" ? S.visible = false : S.scale.z *= -1 : S.tag === "bwd" && (S.visible = false))) : this.mode === "rotate" && (this.tempQuaternion2.copy(ae), this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ae).invert()), S.name.search("E") !== -1 && S.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye, this.zeroVector, this.unitY)), S.name === "X" && (this.tempQuaternion.setFromAxisAngle(this.unitX, Math.atan2(-this.alignVector.y, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), S.quaternion.copy(this.tempQuaternion)), S.name === "Y" && (this.tempQuaternion.setFromAxisAngle(this.unitY, Math.atan2(this.alignVector.x, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), S.quaternion.copy(this.tempQuaternion)), S.name === "Z" && (this.tempQuaternion.setFromAxisAngle(this.unitZ, Math.atan2(this.alignVector.y, this.alignVector.x)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), S.quaternion.copy(this.tempQuaternion))), S.visible = S.visible && (S.name.indexOf("X") === -1 || this.showX), S.visible = S.visible && (S.name.indexOf("Y") === -1 || this.showY), S.visible = S.visible && (S.name.indexOf("Z") === -1 || this.showZ), S.visible = S.visible && (S.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), S.material.tempOpacity = S.material.tempOpacity || S.material.opacity, S.material.tempColor = S.material.tempColor || S.material.color.clone(), S.material.color.copy(S.material.tempColor), S.material.opacity = S.material.tempOpacity, this.enabled ? this.axis && (S.name === this.axis ? (S.material.opacity = 1, S.material.color.lerp(new Color(1, 1, 1), 0.5)) : this.axis.split("").some(function(Fe) {
  623. return S.name === Fe;
  624. }) ? (S.material.opacity = 1, S.material.color.lerp(new Color(1, 1, 1), 0.5)) : (S.material.opacity *= 0.25, S.material.color.lerp(new Color(1, 1, 1), 0.5))) : (S.material.opacity *= 0.5, S.material.color.lerp(new Color(1, 1, 1), 0.5));
  625. }
  626. super.updateMatrixWorld();
  627. });
  628. const n = new MeshBasicMaterial({
  629. depthTest: false,
  630. depthWrite: false,
  631. transparent: true,
  632. side: DoubleSide,
  633. fog: false,
  634. toneMapped: false
  635. }), s = new LineBasicMaterial({
  636. depthTest: false,
  637. depthWrite: false,
  638. transparent: true,
  639. linewidth: 1,
  640. fog: false,
  641. toneMapped: false
  642. }), r = n.clone();
  643. r.opacity = 0.15;
  644. const o = n.clone();
  645. o.opacity = 0.33;
  646. const c = n.clone();
  647. c.color.set(16711680);
  648. const p = n.clone();
  649. p.color.set(65280);
  650. const h = n.clone();
  651. h.color.set(255);
  652. const d = n.clone();
  653. d.opacity = 0.25;
  654. const g = d.clone();
  655. g.color.set(16776960);
  656. const w = d.clone();
  657. w.color.set(65535);
  658. const _2 = d.clone();
  659. _2.color.set(16711935), n.clone().color.set(16776960);
  660. const P = s.clone();
  661. P.color.set(16711680);
  662. const R = s.clone();
  663. R.color.set(65280);
  664. const k = s.clone();
  665. k.color.set(255);
  666. const A = s.clone();
  667. A.color.set(65535);
  668. const z = s.clone();
  669. z.color.set(16711935);
  670. const F = s.clone();
  671. F.color.set(16776960);
  672. const I = s.clone();
  673. I.color.set(7895160);
  674. const D2 = F.clone();
  675. D2.opacity = 0.25;
  676. const Y = new CylinderGeometry(0, 0.05, 0.2, 12, 1, false), G = new BoxGeometry(0.125, 0.125, 0.125), N = new BufferGeometry();
  677. N.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
  678. const O = (fe, ae) => {
  679. const ne = new BufferGeometry(), ge = [];
  680. for (let S = 0; S <= 64 * ae; ++S)
  681. ge.push(0, Math.cos(S / 32 * Math.PI) * fe, Math.sin(S / 32 * Math.PI) * fe);
  682. return ne.setAttribute("position", new Float32BufferAttribute(ge, 3)), ne;
  683. }, H = () => {
  684. const fe = new BufferGeometry();
  685. return fe.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3)), fe;
  686. }, K = {
  687. 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, P)]],
  688. Y: [[new Mesh(Y, p), [0, 1, 0], null, null, "fwd"], [new Mesh(Y, p), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"], [new Line(N, R), null, [0, 0, Math.PI / 2]]],
  689. Z: [[new Mesh(Y, h), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new Mesh(Y, h), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"], [new Line(N, k), null, [0, -Math.PI / 2, 0]]],
  690. XYZ: [[new Mesh(new OctahedronGeometry(0.1, 0), d.clone()), [0, 0, 0], [0, 0, 0]]],
  691. 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]]],
  692. YZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), w.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]], [new Line(N, A), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, A), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  693. XZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), _2.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]], [new Line(N, z), [0.18, 0, 0.3], null, [0.125, 1, 1]], [new Line(N, z), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]]
  694. }, q = {
  695. X: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), r), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],
  696. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), r), [0, 0.6, 0]]],
  697. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), r), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],
  698. XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), r)]],
  699. XY: [[new Mesh(new PlaneGeometry(0.4, 0.4), r), [0.2, 0.2, 0]]],
  700. YZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), r), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],
  701. XZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), r), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]
  702. }, pe = {
  703. START: [[new Mesh(new OctahedronGeometry(0.01, 2), o), null, null, null, "helper"]],
  704. END: [[new Mesh(new OctahedronGeometry(0.01, 2), o), null, null, null, "helper"]],
  705. DELTA: [[new Line(H(), o), null, null, null, "helper"]],
  706. X: [[new Line(N, o.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  707. Y: [[new Line(N, o.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  708. Z: [[new Line(N, o.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  709. }, _e = {
  710. X: [[new Line(O(1, 0.5), P)], [new Mesh(new OctahedronGeometry(0.04, 0), c), [0, 0, 0.99], null, [1, 3, 1]]],
  711. Y: [[new Line(O(1, 0.5), R), null, [0, 0, -Math.PI / 2]], [new Mesh(new OctahedronGeometry(0.04, 0), p), [0, 0, 0.99], null, [3, 1, 1]]],
  712. Z: [[new Line(O(1, 0.5), k), null, [0, Math.PI / 2, 0]], [new Mesh(new OctahedronGeometry(0.04, 0), h), [0.99, 0, 0], null, [1, 3, 1]]],
  713. E: [[new Line(O(1.25, 1), D2), null, [0, Math.PI / 2, 0]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D2), [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), D2), [-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), D2), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D2), [0, 1.17, 0], [0, 0, 0], [1, 1, 1e-3]]],
  714. XYZE: [[new Line(O(1, 1), I), null, [0, Math.PI / 2, 0]]]
  715. }, ce = {
  716. AXIS: [[new Line(N, o.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
  717. }, me = {
  718. X: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), r), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
  719. Y: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), r), [0, 0, 0], [Math.PI / 2, 0, 0]]],
  720. Z: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), r), [0, 0, 0], [0, 0, -Math.PI / 2]]],
  721. E: [[new Mesh(new TorusGeometry(1.25, 0.1, 2, 24), r)]],
  722. XYZE: [[new Mesh(new SphereGeometry(0.7, 10, 8), r)]]
  723. }, he = {
  724. X: [[new Mesh(G, c), [0.8, 0, 0], [0, 0, -Math.PI / 2]], [new Line(N, P), null, null, [0.8, 1, 1]]],
  725. Y: [[new Mesh(G, p), [0, 0.8, 0]], [new Line(N, R), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]],
  726. Z: [[new Mesh(G, h), [0, 0, 0.8], [Math.PI / 2, 0, 0]], [new Line(N, k), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]],
  727. XY: [[new Mesh(G, 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]]],
  728. YZ: [[new Mesh(G, w), [0, 0.85, 0.85], null, [0.2, 2, 2]], [new Line(N, A), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, A), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  729. XZ: [[new Mesh(G, _2), [0.85, 0, 0.85], null, [2, 0.2, 2]], [new Line(N, z), [0.855, 0, 0.98], null, [0.125, 1, 1]], [new Line(N, z), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  730. XYZX: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [1.1, 0, 0]]],
  731. XYZY: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 1.1, 0]]],
  732. XYZZ: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 0, 1.1]]]
  733. }, ee = {
  734. X: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), r), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],
  735. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), r), [0, 0.5, 0]]],
  736. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), r), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],
  737. XY: [[new Mesh(G, r), [0.85, 0.85, 0], null, [3, 3, 0.2]]],
  738. YZ: [[new Mesh(G, r), [0, 0.85, 0.85], null, [0.2, 3, 3]]],
  739. XZ: [[new Mesh(G, r), [0.85, 0, 0.85], null, [3, 0.2, 3]]],
  740. XYZX: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), r), [1.1, 0, 0]]],
  741. XYZY: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), r), [0, 1.1, 0]]],
  742. XYZZ: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), r), [0, 0, 1.1]]]
  743. }, X = {
  744. X: [[new Line(N, o.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  745. Y: [[new Line(N, o.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  746. Z: [[new Line(N, o.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  747. }, Te = (fe) => {
  748. const ae = new Object3D();
  749. for (let ne in fe)
  750. for (let ge = fe[ne].length; ge--; ) {
  751. const S = fe[ne][ge][0].clone(), le = fe[ne][ge][1], Fe = fe[ne][ge][2], Ue = fe[ne][ge][3], ye = fe[ne][ge][4];
  752. S.name = ne, S.tag = ye, le && S.position.set(le[0], le[1], le[2]), Fe && S.rotation.set(Fe[0], Fe[1], Fe[2]), Ue && S.scale.set(Ue[0], Ue[1], Ue[2]), S.updateMatrix();
  753. const rt = S.geometry.clone();
  754. rt.applyMatrix4(S.matrix), S.geometry = rt, S.renderOrder = 1 / 0, S.position.set(0, 0, 0), S.rotation.set(0, 0, 0), S.scale.set(1, 1, 1), ae.add(S);
  755. }
  756. return ae;
  757. };
  758. 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(he)), this.add(this.picker.translate = Te(q)), this.add(this.picker.rotate = Te(me)), this.add(this.picker.scale = Te(ee)), this.add(this.helper.translate = Te(pe)), this.add(this.helper.rotate = Te(ce)), this.add(this.helper.scale = Te(X)), this.picker.translate.visible = false, this.picker.rotate.visible = false, this.picker.scale.visible = false;
  759. }
  760. // updateMatrixWorld will update transformations and appearance of individual handles
  761. };
  762. var pp = class extends Mesh {
  763. constructor() {
  764. super(new PlaneGeometry(1e5, 1e5, 2, 2), new MeshBasicMaterial({
  765. visible: false,
  766. wireframe: true,
  767. side: DoubleSide,
  768. transparent: true,
  769. opacity: 0.1,
  770. toneMapped: false
  771. })), C(this, "isTransformControlsPlane", true), C(this, "type", "TransformControlsPlane"), C(this, "unitX", new Vector3(1, 0, 0)), C(this, "unitY", new Vector3(0, 1, 0)), C(this, "unitZ", new Vector3(0, 0, 1)), C(this, "tempVector", new Vector3()), C(this, "dirVector", new Vector3()), C(this, "alignVector", new Vector3()), C(this, "tempMatrix", new Matrix4()), C(this, "identityQuaternion", new Quaternion()), C(this, "cameraQuaternion", new Quaternion()), C(this, "worldPosition", new Vector3()), C(this, "worldQuaternion", new Quaternion()), C(this, "eye", new Vector3()), C(this, "axis", null), C(this, "mode", "translate"), C(this, "space", "world"), C(this, "updateMatrixWorld", () => {
  772. let n = this.space;
  773. switch (this.position.copy(this.worldPosition), this.mode === "scale" && (n = "local"), this.unitX.set(1, 0, 0).applyQuaternion(n === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitY.set(0, 1, 0).applyQuaternion(n === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitZ.set(0, 0, 1).applyQuaternion(n === "local" ? this.worldQuaternion : this.identityQuaternion), this.alignVector.copy(this.unitY), this.mode) {
  774. case "translate":
  775. case "scale":
  776. switch (this.axis) {
  777. case "X":
  778. this.alignVector.copy(this.eye).cross(this.unitX), this.dirVector.copy(this.unitX).cross(this.alignVector);
  779. break;
  780. case "Y":
  781. this.alignVector.copy(this.eye).cross(this.unitY), this.dirVector.copy(this.unitY).cross(this.alignVector);
  782. break;
  783. case "Z":
  784. this.alignVector.copy(this.eye).cross(this.unitZ), this.dirVector.copy(this.unitZ).cross(this.alignVector);
  785. break;
  786. case "XY":
  787. this.dirVector.copy(this.unitZ);
  788. break;
  789. case "YZ":
  790. this.dirVector.copy(this.unitX);
  791. break;
  792. case "XZ":
  793. this.alignVector.copy(this.unitZ), this.dirVector.copy(this.unitY);
  794. break;
  795. case "XYZ":
  796. case "E":
  797. this.dirVector.set(0, 0, 0);
  798. break;
  799. }
  800. break;
  801. case "rotate":
  802. default:
  803. this.dirVector.set(0, 0, 0);
  804. }
  805. 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();
  806. });
  807. }
  808. };
  809. var pi = new Euler(0, 0, 0, "YXZ");
  810. var hi = new Vector3();
  811. var hp = {
  812. type: "change"
  813. };
  814. var dp = {
  815. type: "lock"
  816. };
  817. var mp = {
  818. type: "unlock"
  819. };
  820. var pa = Math.PI / 2;
  821. var fp = class extends EventDispatcher {
  822. constructor(n, s) {
  823. super(), C(this, "camera", void 0), C(this, "domElement", void 0), C(this, "isLocked", void 0), C(this, "minPolarAngle", void 0), C(this, "maxPolarAngle", void 0), C(this, "pointerSpeed", void 0), C(this, "onMouseMove", (r) => {
  824. if (!this.domElement || this.isLocked === false)
  825. return;
  826. const o = r.movementX || r.mozMovementX || r.webkitMovementX || 0, c = r.movementY || r.mozMovementY || r.webkitMovementY || 0;
  827. pi.setFromQuaternion(this.camera.quaternion), pi.y -= o * 2e-3 * this.pointerSpeed, pi.x -= c * 2e-3 * this.pointerSpeed, pi.x = Math.max(pa - this.maxPolarAngle, Math.min(pa - this.minPolarAngle, pi.x)), this.camera.quaternion.setFromEuler(pi), this.dispatchEvent(hp);
  828. }), C(this, "onPointerlockChange", () => {
  829. this.domElement && (this.domElement.ownerDocument.pointerLockElement === this.domElement ? (this.dispatchEvent(dp), this.isLocked = true) : (this.dispatchEvent(mp), this.isLocked = false));
  830. }), C(this, "onPointerlockError", () => {
  831. console.error("THREE.PointerLockControls: Unable to use Pointer Lock API");
  832. }), C(this, "connect", (r) => {
  833. this.domElement = r || this.domElement, this.domElement && (this.domElement.ownerDocument.addEventListener("mousemove", this.onMouseMove), this.domElement.ownerDocument.addEventListener("pointerlockchange", this.onPointerlockChange), this.domElement.ownerDocument.addEventListener("pointerlockerror", this.onPointerlockError));
  834. }), C(this, "disconnect", () => {
  835. this.domElement && (this.domElement.ownerDocument.removeEventListener("mousemove", this.onMouseMove), this.domElement.ownerDocument.removeEventListener("pointerlockchange", this.onPointerlockChange), this.domElement.ownerDocument.removeEventListener("pointerlockerror", this.onPointerlockError));
  836. }), C(this, "dispose", () => {
  837. this.disconnect();
  838. }), C(this, "getObject", () => this.camera), C(this, "direction", new Vector3(0, 0, -1)), C(this, "getDirection", (r) => r.copy(this.direction).applyQuaternion(this.camera.quaternion)), C(this, "moveForward", (r) => {
  839. hi.setFromMatrixColumn(this.camera.matrix, 0), hi.crossVectors(this.camera.up, hi), this.camera.position.addScaledVector(hi, r);
  840. }), C(this, "moveRight", (r) => {
  841. hi.setFromMatrixColumn(this.camera.matrix, 0), this.camera.position.addScaledVector(hi, r);
  842. }), C(this, "lock", () => {
  843. this.domElement && this.domElement.requestPointerLock();
  844. }), C(this, "unlock", () => {
  845. this.domElement && this.domElement.ownerDocument.exitPointerLock();
  846. }), this.camera = n, this.domElement = s, this.isLocked = false, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.pointerSpeed = 1, s && this.connect(s);
  847. }
  848. };
  849. var ha = (v, n) => (v % n + n) % n;
  850. var vp = class extends EventDispatcher {
  851. // Set to false to disable this control
  852. // "target" sets the location of focus, where the object orbits around
  853. // How far you can dolly in and out ( PerspectiveCamera only )
  854. // How far you can zoom in and out ( OrthographicCamera only )
  855. // How far you can orbit vertically, upper and lower limits.
  856. // Range is 0 to Math.PI radians.
  857. // radians
  858. // radians
  859. // How far you can orbit horizontally, upper and lower limits.
  860. // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
  861. // radians
  862. // radians
  863. // Set to true to enable damping (inertia)
  864. // If damping is enabled, you must call controls.update() in your animation loop
  865. // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
  866. // Set to false to disable zooming
  867. // Set to false to disable rotating
  868. // Set to false to disable panning
  869. // if false, pan orthogonal to world-space direction camera.up
  870. // pixels moved per arrow key push
  871. // Set to true to automatically rotate around the target
  872. // If auto-rotate is enabled, you must call controls.update() in your animation loop
  873. // 30 seconds per orbit when fps is 60
  874. // true if you want to reverse the orbit to mouse drag from left to right = orbits left
  875. // The four arrow keys
  876. // Mouse buttons
  877. // Touch fingers
  878. // the target DOM element for key events
  879. constructor(n, s) {
  880. super(), C(this, "object", void 0), C(this, "domElement", void 0), C(this, "enabled", true), C(this, "target", new Vector3()), C(this, "minDistance", 0), C(this, "maxDistance", 1 / 0), C(this, "minZoom", 0), C(this, "maxZoom", 1 / 0), C(this, "minPolarAngle", 0), C(this, "maxPolarAngle", Math.PI), C(this, "minAzimuthAngle", -1 / 0), C(this, "maxAzimuthAngle", 1 / 0), C(this, "enableDamping", false), C(this, "dampingFactor", 0.05), C(this, "enableZoom", true), C(this, "zoomSpeed", 1), C(this, "enableRotate", true), C(this, "rotateSpeed", 1), C(this, "enablePan", true), C(this, "panSpeed", 1), C(this, "screenSpacePanning", true), C(this, "keyPanSpeed", 7), C(this, "autoRotate", false), C(this, "autoRotateSpeed", 2), C(this, "reverseOrbit", false), C(this, "keys", {
  881. LEFT: "ArrowLeft",
  882. UP: "ArrowUp",
  883. RIGHT: "ArrowRight",
  884. BOTTOM: "ArrowDown"
  885. }), C(this, "mouseButtons", {
  886. LEFT: MOUSE.ROTATE,
  887. MIDDLE: MOUSE.DOLLY,
  888. RIGHT: MOUSE.PAN
  889. }), C(this, "touches", {
  890. ONE: TOUCH.ROTATE,
  891. TWO: TOUCH.DOLLY_PAN
  892. }), C(this, "target0", void 0), C(this, "position0", void 0), C(this, "zoom0", void 0), C(this, "_domElementKeyEvents", null), C(this, "getPolarAngle", void 0), C(this, "getAzimuthalAngle", void 0), C(this, "setPolarAngle", void 0), C(this, "setAzimuthalAngle", void 0), C(this, "getDistance", void 0), C(this, "listenToKeyEvents", void 0), C(this, "saveState", void 0), C(this, "reset", void 0), C(this, "update", void 0), C(this, "connect", void 0), C(this, "dispose", void 0), this.object = n, this.domElement = s, 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 = (L) => {
  893. let U = ha(L, 2 * Math.PI), W = w.phi;
  894. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  895. let ie = Math.abs(U - W);
  896. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _2.phi = U - W, r.update();
  897. }, this.setAzimuthalAngle = (L) => {
  898. let U = ha(L, 2 * Math.PI), W = w.theta;
  899. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  900. let ie = Math.abs(U - W);
  901. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _2.theta = U - W, r.update();
  902. }, this.getDistance = () => r.object.position.distanceTo(r.target), this.listenToKeyEvents = (L) => {
  903. L.addEventListener("keydown", Et), this._domElementKeyEvents = L;
  904. }, this.saveState = () => {
  905. r.target0.copy(r.target), r.position0.copy(r.object.position), r.zoom0 = r.object instanceof PerspectiveCamera ? r.object.zoom : 1;
  906. }, this.reset = () => {
  907. r.target.copy(r.target0), r.object.position.copy(r.position0), r.object instanceof PerspectiveCamera && (r.object.zoom = r.zoom0, r.object.updateProjectionMatrix()), r.dispatchEvent(o), r.update(), d = h.NONE;
  908. }, this.update = (() => {
  909. const L = new Vector3(), U = new Quaternion().setFromUnitVectors(n.up, new Vector3(0, 1, 0)), W = U.clone().invert(), ie = new Vector3(), xe = new Quaternion(), Be = 2 * Math.PI;
  910. return function() {
  911. const hn = r.object.position;
  912. L.copy(hn).sub(r.target), L.applyQuaternion(U), w.setFromVector3(L), r.autoRotate && d === h.NONE && pe(K()), r.enableDamping ? (w.theta += _2.theta * r.dampingFactor, w.phi += _2.phi * r.dampingFactor) : (w.theta += _2.theta, w.phi += _2.phi);
  913. let $e = r.minAzimuthAngle, Xe = r.maxAzimuthAngle;
  914. return isFinite($e) && isFinite(Xe) && ($e < -Math.PI ? $e += Be : $e > Math.PI && ($e -= Be), Xe < -Math.PI ? Xe += Be : Xe > Math.PI && (Xe -= Be), $e <= Xe ? w.theta = Math.max($e, Math.min(Xe, w.theta)) : w.theta = w.theta > ($e + Xe) / 2 ? Math.max($e, w.theta) : Math.min(Xe, w.theta)), w.phi = Math.max(r.minPolarAngle, Math.min(r.maxPolarAngle, w.phi)), w.makeSafe(), w.radius *= y, w.radius = Math.max(r.minDistance, Math.min(r.maxDistance, w.radius)), r.enableDamping === true ? r.target.addScaledVector(P, r.dampingFactor) : r.target.add(P), L.setFromSpherical(w), L.applyQuaternion(W), hn.copy(r.target).add(L), r.object.lookAt(r.target), r.enableDamping === true ? (_2.theta *= 1 - r.dampingFactor, _2.phi *= 1 - r.dampingFactor, P.multiplyScalar(1 - r.dampingFactor)) : (_2.set(0, 0, 0), P.set(0, 0, 0)), y = 1, R || ie.distanceToSquared(r.object.position) > g || 8 * (1 - xe.dot(r.object.quaternion)) > g ? (r.dispatchEvent(o), ie.copy(r.object.position), xe.copy(r.object.quaternion), R = false, true) : false;
  915. };
  916. })(), this.connect = (L) => {
  917. L === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), r.domElement = L, r.domElement.style.touchAction = "none", r.domElement.addEventListener("contextmenu", pn), r.domElement.addEventListener("pointerdown", ot), r.domElement.addEventListener("pointercancel", Gn), r.domElement.addEventListener("wheel", Kn);
  918. }, this.dispose = () => {
  919. var L, U, W, ie, xe, Be;
  920. (L = r.domElement) === null || L === void 0 || L.removeEventListener("contextmenu", pn), (U = r.domElement) === null || U === void 0 || U.removeEventListener("pointerdown", ot), (W = r.domElement) === null || W === void 0 || W.removeEventListener("pointercancel", Gn), (ie = r.domElement) === null || ie === void 0 || ie.removeEventListener("wheel", Kn), (xe = r.domElement) === null || xe === void 0 || xe.ownerDocument.removeEventListener("pointermove", un), (Be = r.domElement) === null || Be === void 0 || Be.ownerDocument.removeEventListener("pointerup", bt), r._domElementKeyEvents !== null && r._domElementKeyEvents.removeEventListener("keydown", Et);
  921. };
  922. const r = this, o = {
  923. type: "change"
  924. }, c = {
  925. type: "start"
  926. }, p = {
  927. type: "end"
  928. }, h = {
  929. NONE: -1,
  930. ROTATE: 0,
  931. DOLLY: 1,
  932. PAN: 2,
  933. TOUCH_ROTATE: 3,
  934. TOUCH_PAN: 4,
  935. TOUCH_DOLLY_PAN: 5,
  936. TOUCH_DOLLY_ROTATE: 6
  937. };
  938. let d = h.NONE;
  939. const g = 1e-6, w = new Spherical(), _2 = new Spherical();
  940. let y = 1;
  941. const P = new Vector3();
  942. let R = false;
  943. const k = new Vector2(), A = new Vector2(), z = new Vector2(), F = new Vector2(), I = new Vector2(), D2 = new Vector2(), Y = new Vector2(), G = new Vector2(), N = new Vector2(), O = [], H = {};
  944. function K() {
  945. return 2 * Math.PI / 60 / 60 * r.autoRotateSpeed;
  946. }
  947. function q() {
  948. return Math.pow(0.95, r.zoomSpeed);
  949. }
  950. function pe(L) {
  951. r.reverseOrbit ? _2.theta += L : _2.theta -= L;
  952. }
  953. function _e(L) {
  954. r.reverseOrbit ? _2.phi += L : _2.phi -= L;
  955. }
  956. const ce = (() => {
  957. const L = new Vector3();
  958. return function(W, ie) {
  959. L.setFromMatrixColumn(ie, 0), L.multiplyScalar(-W), P.add(L);
  960. };
  961. })(), me = (() => {
  962. const L = new Vector3();
  963. return function(W, ie) {
  964. r.screenSpacePanning === true ? L.setFromMatrixColumn(ie, 1) : (L.setFromMatrixColumn(ie, 0), L.crossVectors(r.object.up, L)), L.multiplyScalar(W), P.add(L);
  965. };
  966. })(), he = (() => {
  967. const L = new Vector3();
  968. return function(W, ie) {
  969. const xe = r.domElement;
  970. if (xe && r.object instanceof PerspectiveCamera && r.object.isPerspectiveCamera) {
  971. const Be = r.object.position;
  972. L.copy(Be).sub(r.target);
  973. let Ht = L.length();
  974. Ht *= Math.tan(r.object.fov / 2 * Math.PI / 180), ce(2 * W * Ht / xe.clientHeight, r.object.matrix), me(2 * ie * Ht / xe.clientHeight, r.object.matrix);
  975. } else
  976. xe && r.object instanceof OrthographicCamera && r.object.isOrthographicCamera ? (ce(W * (r.object.right - r.object.left) / r.object.zoom / xe.clientWidth, r.object.matrix), me(ie * (r.object.top - r.object.bottom) / r.object.zoom / xe.clientHeight, r.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), r.enablePan = false);
  977. };
  978. })();
  979. function ee(L) {
  980. r.object instanceof PerspectiveCamera && r.object.isPerspectiveCamera ? y /= L : r.object instanceof OrthographicCamera && r.object.isOrthographicCamera ? (r.object.zoom = Math.max(r.minZoom, Math.min(r.maxZoom, r.object.zoom * L)), r.object.updateProjectionMatrix(), R = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), r.enableZoom = false);
  981. }
  982. function X(L) {
  983. r.object instanceof PerspectiveCamera && r.object.isPerspectiveCamera ? y *= L : r.object instanceof OrthographicCamera && r.object.isOrthographicCamera ? (r.object.zoom = Math.max(r.minZoom, Math.min(r.maxZoom, r.object.zoom / L)), r.object.updateProjectionMatrix(), R = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), r.enableZoom = false);
  984. }
  985. function Te(L) {
  986. k.set(L.clientX, L.clientY);
  987. }
  988. function fe(L) {
  989. Y.set(L.clientX, L.clientY);
  990. }
  991. function ae(L) {
  992. F.set(L.clientX, L.clientY);
  993. }
  994. function ne(L) {
  995. A.set(L.clientX, L.clientY), z.subVectors(A, k).multiplyScalar(r.rotateSpeed);
  996. const U = r.domElement;
  997. U && (pe(2 * Math.PI * z.x / U.clientHeight), _e(2 * Math.PI * z.y / U.clientHeight)), k.copy(A), r.update();
  998. }
  999. function ge(L) {
  1000. G.set(L.clientX, L.clientY), N.subVectors(G, Y), N.y > 0 ? ee(q()) : N.y < 0 && X(q()), Y.copy(G), r.update();
  1001. }
  1002. function S(L) {
  1003. I.set(L.clientX, L.clientY), D2.subVectors(I, F).multiplyScalar(r.panSpeed), he(D2.x, D2.y), F.copy(I), r.update();
  1004. }
  1005. function le(L) {
  1006. L.deltaY < 0 ? X(q()) : L.deltaY > 0 && ee(q()), r.update();
  1007. }
  1008. function Fe(L) {
  1009. let U = false;
  1010. switch (L.code) {
  1011. case r.keys.UP:
  1012. he(0, r.keyPanSpeed), U = true;
  1013. break;
  1014. case r.keys.BOTTOM:
  1015. he(0, -r.keyPanSpeed), U = true;
  1016. break;
  1017. case r.keys.LEFT:
  1018. he(r.keyPanSpeed, 0), U = true;
  1019. break;
  1020. case r.keys.RIGHT:
  1021. he(-r.keyPanSpeed, 0), U = true;
  1022. break;
  1023. }
  1024. U && (L.preventDefault(), r.update());
  1025. }
  1026. function Ue() {
  1027. if (O.length == 1)
  1028. k.set(O[0].pageX, O[0].pageY);
  1029. else {
  1030. const L = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1031. k.set(L, U);
  1032. }
  1033. }
  1034. function ye() {
  1035. if (O.length == 1)
  1036. F.set(O[0].pageX, O[0].pageY);
  1037. else {
  1038. const L = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1039. F.set(L, U);
  1040. }
  1041. }
  1042. function rt() {
  1043. const L = O[0].pageX - O[1].pageX, U = O[0].pageY - O[1].pageY, W = Math.sqrt(L * L + U * U);
  1044. Y.set(0, W);
  1045. }
  1046. function jn() {
  1047. r.enableZoom && rt(), r.enablePan && ye();
  1048. }
  1049. function Qe() {
  1050. r.enableZoom && rt(), r.enableRotate && Ue();
  1051. }
  1052. function Un(L) {
  1053. if (O.length == 1)
  1054. A.set(L.pageX, L.pageY);
  1055. else {
  1056. const W = Rt2(L), ie = 0.5 * (L.pageX + W.x), xe = 0.5 * (L.pageY + W.y);
  1057. A.set(ie, xe);
  1058. }
  1059. z.subVectors(A, k).multiplyScalar(r.rotateSpeed);
  1060. const U = r.domElement;
  1061. U && (pe(2 * Math.PI * z.x / U.clientHeight), _e(2 * Math.PI * z.y / U.clientHeight)), k.copy(A);
  1062. }
  1063. function cn(L) {
  1064. if (O.length == 1)
  1065. I.set(L.pageX, L.pageY);
  1066. else {
  1067. const U = Rt2(L), W = 0.5 * (L.pageX + U.x), ie = 0.5 * (L.pageY + U.y);
  1068. I.set(W, ie);
  1069. }
  1070. D2.subVectors(I, F).multiplyScalar(r.panSpeed), he(D2.x, D2.y), F.copy(I);
  1071. }
  1072. function vt(L) {
  1073. const U = Rt2(L), W = L.pageX - U.x, ie = L.pageY - U.y, xe = Math.sqrt(W * W + ie * ie);
  1074. G.set(0, xe), N.set(0, Math.pow(G.y / Y.y, r.zoomSpeed)), ee(N.y), Y.copy(G);
  1075. }
  1076. function Lt(L) {
  1077. r.enableZoom && vt(L), r.enablePan && cn(L);
  1078. }
  1079. function Ke(L) {
  1080. r.enableZoom && vt(L), r.enableRotate && Un(L);
  1081. }
  1082. function ot(L) {
  1083. if (r.enabled !== false) {
  1084. if (O.length === 0) {
  1085. var U, W;
  1086. (U = r.domElement) === null || U === void 0 || U.ownerDocument.addEventListener("pointermove", un), (W = r.domElement) === null || W === void 0 || W.ownerDocument.addEventListener("pointerup", bt);
  1087. }
  1088. Xn(L), L.pointerType === "touch" ? At(L) : fi(L);
  1089. }
  1090. }
  1091. function un(L) {
  1092. r.enabled !== false && (L.pointerType === "touch" ? $n(L) : Hn(L));
  1093. }
  1094. function bt(L) {
  1095. if (Ct(L), O.length === 0) {
  1096. var U, W, ie;
  1097. (U = r.domElement) === null || U === void 0 || U.releasePointerCapture(L.pointerId), (W = r.domElement) === null || W === void 0 || W.ownerDocument.removeEventListener("pointermove", un), (ie = r.domElement) === null || ie === void 0 || ie.ownerDocument.removeEventListener("pointerup", bt);
  1098. }
  1099. r.dispatchEvent(p), d = h.NONE;
  1100. }
  1101. function Gn(L) {
  1102. Ct(L);
  1103. }
  1104. function fi(L) {
  1105. let U;
  1106. switch (L.button) {
  1107. case 0:
  1108. U = r.mouseButtons.LEFT;
  1109. break;
  1110. case 1:
  1111. U = r.mouseButtons.MIDDLE;
  1112. break;
  1113. case 2:
  1114. U = r.mouseButtons.RIGHT;
  1115. break;
  1116. default:
  1117. U = -1;
  1118. }
  1119. switch (U) {
  1120. case MOUSE.DOLLY:
  1121. if (r.enableZoom === false)
  1122. return;
  1123. fe(L), d = h.DOLLY;
  1124. break;
  1125. case MOUSE.ROTATE:
  1126. if (L.ctrlKey || L.metaKey || L.shiftKey) {
  1127. if (r.enablePan === false)
  1128. return;
  1129. ae(L), d = h.PAN;
  1130. } else {
  1131. if (r.enableRotate === false)
  1132. return;
  1133. Te(L), d = h.ROTATE;
  1134. }
  1135. break;
  1136. case MOUSE.PAN:
  1137. if (L.ctrlKey || L.metaKey || L.shiftKey) {
  1138. if (r.enableRotate === false)
  1139. return;
  1140. Te(L), d = h.ROTATE;
  1141. } else {
  1142. if (r.enablePan === false)
  1143. return;
  1144. ae(L), d = h.PAN;
  1145. }
  1146. break;
  1147. default:
  1148. d = h.NONE;
  1149. }
  1150. d !== h.NONE && r.dispatchEvent(c);
  1151. }
  1152. function Hn(L) {
  1153. if (r.enabled !== false)
  1154. switch (d) {
  1155. case h.ROTATE:
  1156. if (r.enableRotate === false)
  1157. return;
  1158. ne(L);
  1159. break;
  1160. case h.DOLLY:
  1161. if (r.enableZoom === false)
  1162. return;
  1163. ge(L);
  1164. break;
  1165. case h.PAN:
  1166. if (r.enablePan === false)
  1167. return;
  1168. S(L);
  1169. break;
  1170. }
  1171. }
  1172. function Kn(L) {
  1173. r.enabled === false || r.enableZoom === false || d !== h.NONE && d !== h.ROTATE || (L.preventDefault(), r.dispatchEvent(c), le(L), r.dispatchEvent(p));
  1174. }
  1175. function Et(L) {
  1176. r.enabled === false || r.enablePan === false || Fe(L);
  1177. }
  1178. function At(L) {
  1179. switch (gt(L), O.length) {
  1180. case 1:
  1181. switch (r.touches.ONE) {
  1182. case TOUCH.ROTATE:
  1183. if (r.enableRotate === false)
  1184. return;
  1185. Ue(), d = h.TOUCH_ROTATE;
  1186. break;
  1187. case TOUCH.PAN:
  1188. if (r.enablePan === false)
  1189. return;
  1190. ye(), d = h.TOUCH_PAN;
  1191. break;
  1192. default:
  1193. d = h.NONE;
  1194. }
  1195. break;
  1196. case 2:
  1197. switch (r.touches.TWO) {
  1198. case TOUCH.DOLLY_PAN:
  1199. if (r.enableZoom === false && r.enablePan === false)
  1200. return;
  1201. jn(), d = h.TOUCH_DOLLY_PAN;
  1202. break;
  1203. case TOUCH.DOLLY_ROTATE:
  1204. if (r.enableZoom === false && r.enableRotate === false)
  1205. return;
  1206. Qe(), d = h.TOUCH_DOLLY_ROTATE;
  1207. break;
  1208. default:
  1209. d = h.NONE;
  1210. }
  1211. break;
  1212. default:
  1213. d = h.NONE;
  1214. }
  1215. d !== h.NONE && r.dispatchEvent(c);
  1216. }
  1217. function $n(L) {
  1218. switch (gt(L), d) {
  1219. case h.TOUCH_ROTATE:
  1220. if (r.enableRotate === false)
  1221. return;
  1222. Un(L), r.update();
  1223. break;
  1224. case h.TOUCH_PAN:
  1225. if (r.enablePan === false)
  1226. return;
  1227. cn(L), r.update();
  1228. break;
  1229. case h.TOUCH_DOLLY_PAN:
  1230. if (r.enableZoom === false && r.enablePan === false)
  1231. return;
  1232. Lt(L), r.update();
  1233. break;
  1234. case h.TOUCH_DOLLY_ROTATE:
  1235. if (r.enableZoom === false && r.enableRotate === false)
  1236. return;
  1237. Ke(L), r.update();
  1238. break;
  1239. default:
  1240. d = h.NONE;
  1241. }
  1242. }
  1243. function pn(L) {
  1244. r.enabled !== false && L.preventDefault();
  1245. }
  1246. function Xn(L) {
  1247. O.push(L);
  1248. }
  1249. function Ct(L) {
  1250. delete H[L.pointerId];
  1251. for (let U = 0; U < O.length; U++)
  1252. if (O[U].pointerId == L.pointerId) {
  1253. O.splice(U, 1);
  1254. return;
  1255. }
  1256. }
  1257. function gt(L) {
  1258. let U = H[L.pointerId];
  1259. U === void 0 && (U = new Vector2(), H[L.pointerId] = U), U.set(L.pageX, L.pageY);
  1260. }
  1261. function Rt2(L) {
  1262. const U = L.pointerId === O[0].pointerId ? O[1] : O[0];
  1263. return H[U.pointerId];
  1264. }
  1265. s !== void 0 && this.connect(s), this.update();
  1266. }
  1267. };
  1268. var bp = class extends Loader {
  1269. constructor(n) {
  1270. super(n), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(s) {
  1271. return new xp(s);
  1272. }), this.register(function(s) {
  1273. return new Sp(s);
  1274. }), this.register(function(s) {
  1275. return new Lp(s);
  1276. }), this.register(function(s) {
  1277. return new Cp(s);
  1278. }), this.register(function(s) {
  1279. return new Pp(s);
  1280. }), this.register(function(s) {
  1281. return new Tp(s);
  1282. }), this.register(function(s) {
  1283. return new kp(s);
  1284. }), this.register(function(s) {
  1285. return new yp(s);
  1286. }), this.register(function(s) {
  1287. return new Mp(s);
  1288. }), this.register(function(s) {
  1289. return new Ep(s);
  1290. }), this.register(function(s) {
  1291. return new _p(s);
  1292. }), this.register(function(s) {
  1293. return new Ap(s);
  1294. });
  1295. }
  1296. load(n, s, r, o) {
  1297. const c = this;
  1298. let p;
  1299. this.resourcePath !== "" ? p = this.resourcePath : this.path !== "" ? p = this.path : p = LoaderUtils.extractUrlBase(n), this.manager.itemStart(n);
  1300. const h = function(g) {
  1301. o ? o(g) : console.error(g), c.manager.itemError(n), c.manager.itemEnd(n);
  1302. }, d = new FileLoader(this.manager);
  1303. d.setPath(this.path), d.setResponseType("arraybuffer"), d.setRequestHeader(this.requestHeader), d.setWithCredentials(this.withCredentials), d.load(n, function(g) {
  1304. try {
  1305. c.parse(g, p, function(w) {
  1306. s(w), c.manager.itemEnd(n);
  1307. }, h);
  1308. } catch (w) {
  1309. h(w);
  1310. }
  1311. }, r, h);
  1312. }
  1313. setDRACOLoader(n) {
  1314. return this.dracoLoader = n, this;
  1315. }
  1316. setDDSLoader() {
  1317. throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
  1318. }
  1319. setKTX2Loader(n) {
  1320. return this.ktx2Loader = n, this;
  1321. }
  1322. setMeshoptDecoder(n) {
  1323. return this.meshoptDecoder = n, this;
  1324. }
  1325. register(n) {
  1326. return this.pluginCallbacks.indexOf(n) === -1 && this.pluginCallbacks.push(n), this;
  1327. }
  1328. unregister(n) {
  1329. return this.pluginCallbacks.indexOf(n) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n), 1), this;
  1330. }
  1331. parse(n, s, r, o) {
  1332. let c;
  1333. const p = {}, h = {};
  1334. if (typeof n == "string")
  1335. c = n;
  1336. else if (LoaderUtils.decodeText(new Uint8Array(n, 0, 4)) === Xa) {
  1337. try {
  1338. p[re.KHR_BINARY_GLTF] = new Rp(n);
  1339. } catch (_2) {
  1340. o && o(_2);
  1341. return;
  1342. }
  1343. c = p[re.KHR_BINARY_GLTF].content;
  1344. } else
  1345. c = LoaderUtils.decodeText(new Uint8Array(n));
  1346. const d = JSON.parse(c);
  1347. if (d.asset === void 0 || d.asset.version[0] < 2) {
  1348. o && o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
  1349. return;
  1350. }
  1351. const g = new Kp(d, {
  1352. path: s || this.resourcePath || "",
  1353. crossOrigin: this.crossOrigin,
  1354. requestHeader: this.requestHeader,
  1355. manager: this.manager,
  1356. ktx2Loader: this.ktx2Loader,
  1357. meshoptDecoder: this.meshoptDecoder
  1358. });
  1359. g.fileLoader.setRequestHeader(this.requestHeader);
  1360. for (let w = 0; w < this.pluginCallbacks.length; w++) {
  1361. const _2 = this.pluginCallbacks[w](g);
  1362. h[_2.name] = _2, p[_2.name] = true;
  1363. }
  1364. if (d.extensionsUsed)
  1365. for (let w = 0; w < d.extensionsUsed.length; ++w) {
  1366. const _2 = d.extensionsUsed[w], y = d.extensionsRequired || [];
  1367. switch (_2) {
  1368. case re.KHR_MATERIALS_UNLIT:
  1369. p[_2] = new wp();
  1370. break;
  1371. case re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
  1372. p[_2] = new Dp();
  1373. break;
  1374. case re.KHR_DRACO_MESH_COMPRESSION:
  1375. p[_2] = new Vp(d, this.dracoLoader);
  1376. break;
  1377. case re.KHR_TEXTURE_TRANSFORM:
  1378. p[_2] = new Ip();
  1379. break;
  1380. case re.KHR_MESH_QUANTIZATION:
  1381. p[_2] = new Op();
  1382. break;
  1383. default:
  1384. y.indexOf(_2) >= 0 && h[_2] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + _2 + '".');
  1385. }
  1386. }
  1387. g.setExtensions(p), g.setPlugins(h), g.parse(r, o);
  1388. }
  1389. parseAsync(n, s) {
  1390. const r = this;
  1391. return new Promise(function(o, c) {
  1392. r.parse(n, s, o, c);
  1393. });
  1394. }
  1395. };
  1396. function gp() {
  1397. let v = {};
  1398. return {
  1399. get: function(n) {
  1400. return v[n];
  1401. },
  1402. add: function(n, s) {
  1403. v[n] = s;
  1404. },
  1405. remove: function(n) {
  1406. delete v[n];
  1407. },
  1408. removeAll: function() {
  1409. v = {};
  1410. }
  1411. };
  1412. }
  1413. var re = {
  1414. KHR_BINARY_GLTF: "KHR_binary_glTF",
  1415. KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  1416. KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  1417. KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  1418. KHR_MATERIALS_IOR: "KHR_materials_ior",
  1419. KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  1420. KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
  1421. KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
  1422. KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  1423. KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
  1424. KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  1425. KHR_MATERIALS_VOLUME: "KHR_materials_volume",
  1426. KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  1427. KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  1428. KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  1429. KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
  1430. EXT_TEXTURE_WEBP: "EXT_texture_webp",
  1431. EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
  1432. };
  1433. var _p = class {
  1434. constructor(n) {
  1435. this.parser = n, this.name = re.KHR_LIGHTS_PUNCTUAL, this.cache = {
  1436. refs: {},
  1437. uses: {}
  1438. };
  1439. }
  1440. _markDefs() {
  1441. const n = this.parser, s = this.parser.json.nodes || [];
  1442. for (let r = 0, o = s.length; r < o; r++) {
  1443. const c = s[r];
  1444. c.extensions && c.extensions[this.name] && c.extensions[this.name].light !== void 0 && n._addNodeRef(this.cache, c.extensions[this.name].light);
  1445. }
  1446. }
  1447. _loadLight(n) {
  1448. const s = this.parser, r = "light:" + n;
  1449. let o = s.cache.get(r);
  1450. if (o)
  1451. return o;
  1452. const c = s.json, d = ((c.extensions && c.extensions[this.name] || {}).lights || [])[n];
  1453. let g;
  1454. const w = new Color(16777215);
  1455. d.color !== void 0 && w.fromArray(d.color);
  1456. const _2 = d.range !== void 0 ? d.range : 0;
  1457. switch (d.type) {
  1458. case "directional":
  1459. g = new DirectionalLight(w), g.target.position.set(0, 0, -1), g.add(g.target);
  1460. break;
  1461. case "point":
  1462. g = new PointLight(w), g.distance = _2;
  1463. break;
  1464. case "spot":
  1465. g = new SpotLight(w), g.distance = _2, 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);
  1466. break;
  1467. default:
  1468. throw new Error("THREE.GLTFLoader: Unexpected light type: " + d.type);
  1469. }
  1470. return g.position.set(0, 0, 0), g.decay = 2, d.intensity !== void 0 && (g.intensity = d.intensity), g.name = s.createUniqueName(d.name || "light_" + n), o = Promise.resolve(g), s.cache.add(r, o), o;
  1471. }
  1472. createNodeAttachment(n) {
  1473. const s = this, r = this.parser, c = r.json.nodes[n], h = (c.extensions && c.extensions[this.name] || {}).light;
  1474. return h === void 0 ? null : this._loadLight(h).then(function(d) {
  1475. return r._getNodeRef(s.cache, h, d);
  1476. });
  1477. }
  1478. };
  1479. var wp = class {
  1480. constructor() {
  1481. this.name = re.KHR_MATERIALS_UNLIT;
  1482. }
  1483. getMaterialType() {
  1484. return MeshBasicMaterial;
  1485. }
  1486. extendParams(n, s, r) {
  1487. const o = [];
  1488. n.color = new Color(1, 1, 1), n.opacity = 1;
  1489. const c = s.pbrMetallicRoughness;
  1490. if (c) {
  1491. if (Array.isArray(c.baseColorFactor)) {
  1492. const p = c.baseColorFactor;
  1493. n.color.fromArray(p), n.opacity = p[3];
  1494. }
  1495. c.baseColorTexture !== void 0 && o.push(r.assignTexture(n, "map", c.baseColorTexture, sRGBEncoding));
  1496. }
  1497. return Promise.all(o);
  1498. }
  1499. };
  1500. var yp = class {
  1501. constructor(n) {
  1502. this.parser = n, this.name = re.KHR_MATERIALS_EMISSIVE_STRENGTH;
  1503. }
  1504. extendMaterialParams(n, s) {
  1505. const o = this.parser.json.materials[n];
  1506. if (!o.extensions || !o.extensions[this.name])
  1507. return Promise.resolve();
  1508. const c = o.extensions[this.name].emissiveStrength;
  1509. return c !== void 0 && (s.emissiveIntensity = c), Promise.resolve();
  1510. }
  1511. };
  1512. var xp = class {
  1513. constructor(n) {
  1514. this.parser = n, this.name = re.KHR_MATERIALS_CLEARCOAT;
  1515. }
  1516. getMaterialType(n) {
  1517. const r = this.parser.json.materials[n];
  1518. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1519. }
  1520. extendMaterialParams(n, s) {
  1521. const r = this.parser, o = r.json.materials[n];
  1522. if (!o.extensions || !o.extensions[this.name])
  1523. return Promise.resolve();
  1524. const c = [], p = o.extensions[this.name];
  1525. if (p.clearcoatFactor !== void 0 && (s.clearcoat = p.clearcoatFactor), p.clearcoatTexture !== void 0 && c.push(r.assignTexture(s, "clearcoatMap", p.clearcoatTexture)), p.clearcoatRoughnessFactor !== void 0 && (s.clearcoatRoughness = p.clearcoatRoughnessFactor), p.clearcoatRoughnessTexture !== void 0 && c.push(r.assignTexture(s, "clearcoatRoughnessMap", p.clearcoatRoughnessTexture)), p.clearcoatNormalTexture !== void 0 && (c.push(r.assignTexture(s, "clearcoatNormalMap", p.clearcoatNormalTexture)), p.clearcoatNormalTexture.scale !== void 0)) {
  1526. const h = p.clearcoatNormalTexture.scale;
  1527. s.clearcoatNormalScale = new Vector2(h, h);
  1528. }
  1529. return Promise.all(c);
  1530. }
  1531. };
  1532. var Ep = class {
  1533. constructor(n) {
  1534. this.parser = n, this.name = re.KHR_MATERIALS_IRIDESCENCE;
  1535. }
  1536. getMaterialType(n) {
  1537. const r = this.parser.json.materials[n];
  1538. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1539. }
  1540. extendMaterialParams(n, s) {
  1541. const r = this.parser, o = r.json.materials[n];
  1542. if (!o.extensions || !o.extensions[this.name])
  1543. return Promise.resolve();
  1544. const c = [], p = o.extensions[this.name];
  1545. return p.iridescenceFactor !== void 0 && (s.iridescence = p.iridescenceFactor), p.iridescenceTexture !== void 0 && c.push(r.assignTexture(s, "iridescenceMap", p.iridescenceTexture)), p.iridescenceIor !== void 0 && (s.iridescenceIOR = p.iridescenceIor), s.iridescenceThicknessRange === void 0 && (s.iridescenceThicknessRange = [100, 400]), p.iridescenceThicknessMinimum !== void 0 && (s.iridescenceThicknessRange[0] = p.iridescenceThicknessMinimum), p.iridescenceThicknessMaximum !== void 0 && (s.iridescenceThicknessRange[1] = p.iridescenceThicknessMaximum), p.iridescenceThicknessTexture !== void 0 && c.push(r.assignTexture(s, "iridescenceThicknessMap", p.iridescenceThicknessTexture)), Promise.all(c);
  1546. }
  1547. };
  1548. var Cp = class {
  1549. constructor(n) {
  1550. this.parser = n, this.name = re.KHR_MATERIALS_SHEEN;
  1551. }
  1552. getMaterialType(n) {
  1553. const r = this.parser.json.materials[n];
  1554. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1555. }
  1556. extendMaterialParams(n, s) {
  1557. const r = this.parser, o = r.json.materials[n];
  1558. if (!o.extensions || !o.extensions[this.name])
  1559. return Promise.resolve();
  1560. const c = [];
  1561. s.sheenColor = new Color(0, 0, 0), s.sheenRoughness = 0, s.sheen = 1;
  1562. const p = o.extensions[this.name];
  1563. return p.sheenColorFactor !== void 0 && s.sheenColor.fromArray(p.sheenColorFactor), p.sheenRoughnessFactor !== void 0 && (s.sheenRoughness = p.sheenRoughnessFactor), p.sheenColorTexture !== void 0 && c.push(r.assignTexture(s, "sheenColorMap", p.sheenColorTexture, sRGBEncoding)), p.sheenRoughnessTexture !== void 0 && c.push(r.assignTexture(s, "sheenRoughnessMap", p.sheenRoughnessTexture)), Promise.all(c);
  1564. }
  1565. };
  1566. var Pp = class {
  1567. constructor(n) {
  1568. this.parser = n, this.name = re.KHR_MATERIALS_TRANSMISSION;
  1569. }
  1570. getMaterialType(n) {
  1571. const r = this.parser.json.materials[n];
  1572. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1573. }
  1574. extendMaterialParams(n, s) {
  1575. const r = this.parser, o = r.json.materials[n];
  1576. if (!o.extensions || !o.extensions[this.name])
  1577. return Promise.resolve();
  1578. const c = [], p = o.extensions[this.name];
  1579. return p.transmissionFactor !== void 0 && (s.transmission = p.transmissionFactor), p.transmissionTexture !== void 0 && c.push(r.assignTexture(s, "transmissionMap", p.transmissionTexture)), Promise.all(c);
  1580. }
  1581. };
  1582. var Tp = class {
  1583. constructor(n) {
  1584. this.parser = n, this.name = re.KHR_MATERIALS_VOLUME;
  1585. }
  1586. getMaterialType(n) {
  1587. const r = this.parser.json.materials[n];
  1588. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1589. }
  1590. extendMaterialParams(n, s) {
  1591. const r = this.parser, o = r.json.materials[n];
  1592. if (!o.extensions || !o.extensions[this.name])
  1593. return Promise.resolve();
  1594. const c = [], p = o.extensions[this.name];
  1595. s.thickness = p.thicknessFactor !== void 0 ? p.thicknessFactor : 0, p.thicknessTexture !== void 0 && c.push(r.assignTexture(s, "thicknessMap", p.thicknessTexture)), s.attenuationDistance = p.attenuationDistance || 1 / 0;
  1596. const h = p.attenuationColor || [1, 1, 1];
  1597. return s.attenuationColor = new Color(h[0], h[1], h[2]), Promise.all(c);
  1598. }
  1599. };
  1600. var kp = class {
  1601. constructor(n) {
  1602. this.parser = n, this.name = re.KHR_MATERIALS_IOR;
  1603. }
  1604. getMaterialType(n) {
  1605. const r = this.parser.json.materials[n];
  1606. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1607. }
  1608. extendMaterialParams(n, s) {
  1609. const o = this.parser.json.materials[n];
  1610. if (!o.extensions || !o.extensions[this.name])
  1611. return Promise.resolve();
  1612. const c = o.extensions[this.name];
  1613. return s.ior = c.ior !== void 0 ? c.ior : 1.5, Promise.resolve();
  1614. }
  1615. };
  1616. var Mp = class {
  1617. constructor(n) {
  1618. this.parser = n, this.name = re.KHR_MATERIALS_SPECULAR;
  1619. }
  1620. getMaterialType(n) {
  1621. const r = this.parser.json.materials[n];
  1622. return !r.extensions || !r.extensions[this.name] ? null : MeshPhysicalMaterial;
  1623. }
  1624. extendMaterialParams(n, s) {
  1625. const r = this.parser, o = r.json.materials[n];
  1626. if (!o.extensions || !o.extensions[this.name])
  1627. return Promise.resolve();
  1628. const c = [], p = o.extensions[this.name];
  1629. s.specularIntensity = p.specularFactor !== void 0 ? p.specularFactor : 1, p.specularTexture !== void 0 && c.push(r.assignTexture(s, "specularIntensityMap", p.specularTexture));
  1630. const h = p.specularColorFactor || [1, 1, 1];
  1631. return s.specularColor = new Color(h[0], h[1], h[2]), p.specularColorTexture !== void 0 && c.push(r.assignTexture(s, "specularColorMap", p.specularColorTexture, sRGBEncoding)), Promise.all(c);
  1632. }
  1633. };
  1634. var Sp = class {
  1635. constructor(n) {
  1636. this.parser = n, this.name = re.KHR_TEXTURE_BASISU;
  1637. }
  1638. loadTexture(n) {
  1639. const s = this.parser, r = s.json, o = r.textures[n];
  1640. if (!o.extensions || !o.extensions[this.name])
  1641. return null;
  1642. const c = o.extensions[this.name], p = s.options.ktx2Loader;
  1643. if (!p) {
  1644. if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
  1645. throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
  1646. return null;
  1647. }
  1648. return s.loadTextureImage(n, c.source, p);
  1649. }
  1650. };
  1651. var Lp = class {
  1652. constructor(n) {
  1653. this.parser = n, this.name = re.EXT_TEXTURE_WEBP, this.isSupported = null;
  1654. }
  1655. loadTexture(n) {
  1656. const s = this.name, r = this.parser, o = r.json, c = o.textures[n];
  1657. if (!c.extensions || !c.extensions[s])
  1658. return null;
  1659. const p = c.extensions[s], h = o.images[p.source];
  1660. let d = r.textureLoader;
  1661. if (h.uri) {
  1662. const g = r.options.manager.getHandler(h.uri);
  1663. g !== null && (d = g);
  1664. }
  1665. return this.detectSupport().then(function(g) {
  1666. if (g)
  1667. return r.loadTextureImage(n, p.source, d);
  1668. if (o.extensionsRequired && o.extensionsRequired.indexOf(s) >= 0)
  1669. throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
  1670. return r.loadTexture(n);
  1671. });
  1672. }
  1673. detectSupport() {
  1674. return this.isSupported || (this.isSupported = new Promise(function(n) {
  1675. const s = new Image();
  1676. s.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", s.onload = s.onerror = function() {
  1677. n(s.height === 1);
  1678. };
  1679. })), this.isSupported;
  1680. }
  1681. };
  1682. var Ap = class {
  1683. constructor(n) {
  1684. this.name = re.EXT_MESHOPT_COMPRESSION, this.parser = n;
  1685. }
  1686. loadBufferView(n) {
  1687. const s = this.parser.json, r = s.bufferViews[n];
  1688. if (r.extensions && r.extensions[this.name]) {
  1689. const o = r.extensions[this.name], c = this.parser.getDependency("buffer", o.buffer), p = this.parser.options.meshoptDecoder;
  1690. if (!p || !p.supported) {
  1691. if (s.extensionsRequired && s.extensionsRequired.indexOf(this.name) >= 0)
  1692. throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
  1693. return null;
  1694. }
  1695. return c.then(function(h) {
  1696. const d = o.byteOffset || 0, g = o.byteLength || 0, w = o.count, _2 = o.byteStride, y = new Uint8Array(h, d, g);
  1697. return p.decodeGltfBufferAsync ? p.decodeGltfBufferAsync(w, _2, y, o.mode, o.filter).then(function(P) {
  1698. return P.buffer;
  1699. }) : p.ready.then(function() {
  1700. const P = new ArrayBuffer(w * _2);
  1701. return p.decodeGltfBuffer(new Uint8Array(P), w, _2, y, o.mode, o.filter), P;
  1702. });
  1703. });
  1704. } else
  1705. return null;
  1706. }
  1707. };
  1708. var Xa = "glTF";
  1709. var $i = 12;
  1710. var da = {
  1711. JSON: 1313821514,
  1712. BIN: 5130562
  1713. };
  1714. var Rp = class {
  1715. constructor(n) {
  1716. this.name = re.KHR_BINARY_GLTF, this.content = null, this.body = null;
  1717. const s = new DataView(n, 0, $i);
  1718. if (this.header = {
  1719. magic: LoaderUtils.decodeText(new Uint8Array(n.slice(0, 4))),
  1720. version: s.getUint32(4, true),
  1721. length: s.getUint32(8, true)
  1722. }, this.header.magic !== Xa)
  1723. throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
  1724. if (this.header.version < 2)
  1725. throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
  1726. const r = this.header.length - $i, o = new DataView(n, $i);
  1727. let c = 0;
  1728. for (; c < r; ) {
  1729. const p = o.getUint32(c, true);
  1730. c += 4;
  1731. const h = o.getUint32(c, true);
  1732. if (c += 4, h === da.JSON) {
  1733. const d = new Uint8Array(n, $i + c, p);
  1734. this.content = LoaderUtils.decodeText(d);
  1735. } else if (h === da.BIN) {
  1736. const d = $i + c;
  1737. this.body = n.slice(d, d + p);
  1738. }
  1739. c += p;
  1740. }
  1741. if (this.content === null)
  1742. throw new Error("THREE.GLTFLoader: JSON content not found.");
  1743. }
  1744. };
  1745. var Vp = class {
  1746. constructor(n, s) {
  1747. if (!s)
  1748. throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
  1749. this.name = re.KHR_DRACO_MESH_COMPRESSION, this.json = n, this.dracoLoader = s, this.dracoLoader.preload();
  1750. }
  1751. decodePrimitive(n, s) {
  1752. const r = this.json, o = this.dracoLoader, c = n.extensions[this.name].bufferView, p = n.extensions[this.name].attributes, h = {}, d = {}, g = {};
  1753. for (const w in p) {
  1754. const _2 = _o[w] || w.toLowerCase();
  1755. h[_2] = p[w];
  1756. }
  1757. for (const w in n.attributes) {
  1758. const _2 = _o[w] || w.toLowerCase();
  1759. if (p[w] !== void 0) {
  1760. const y = r.accessors[n.attributes[w]], P = es[y.componentType];
  1761. g[_2] = P.name, d[_2] = y.normalized === true;
  1762. }
  1763. }
  1764. return s.getDependency("bufferView", c).then(function(w) {
  1765. return new Promise(function(_2) {
  1766. o.decodeDracoFile(w, function(y) {
  1767. for (const P in y.attributes) {
  1768. const R = y.attributes[P], k = d[P];
  1769. k !== void 0 && (R.normalized = k);
  1770. }
  1771. _2(y);
  1772. }, h, g);
  1773. });
  1774. });
  1775. }
  1776. };
  1777. var Ip = class {
  1778. constructor() {
  1779. this.name = re.KHR_TEXTURE_TRANSFORM;
  1780. }
  1781. extendTexture(n, s) {
  1782. return s.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), s.offset === void 0 && s.rotation === void 0 && s.scale === void 0 || (n = n.clone(), s.offset !== void 0 && n.offset.fromArray(s.offset), s.rotation !== void 0 && (n.rotation = s.rotation), s.scale !== void 0 && n.repeat.fromArray(s.scale), n.needsUpdate = true), n;
  1783. }
  1784. };
  1785. var go = class extends MeshStandardMaterial {
  1786. constructor(n) {
  1787. super(), this.isGLTFSpecularGlossinessMaterial = true;
  1788. const s = ["#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif"].join(`
  1789. `), r = ["#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif"].join(`
  1790. `), o = ["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(`
  1791. `), 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(`
  1792. `), p = ["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(`
  1793. `), h = {
  1794. specular: {
  1795. value: new Color().setHex(16777215)
  1796. },
  1797. glossiness: {
  1798. value: 1
  1799. },
  1800. specularMap: {
  1801. value: null
  1802. },
  1803. glossinessMap: {
  1804. value: null
  1805. }
  1806. };
  1807. this._extraUniforms = h, this.onBeforeCompile = function(d) {
  1808. for (const g in h)
  1809. d.uniforms[g] = h[g];
  1810. d.fragmentShader = d.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", s).replace("#include <metalnessmap_pars_fragment>", r).replace("#include <roughnessmap_fragment>", o).replace("#include <metalnessmap_fragment>", c).replace("#include <lights_physical_fragment>", p);
  1811. }, Object.defineProperties(this, {
  1812. specular: {
  1813. get: function() {
  1814. return h.specular.value;
  1815. },
  1816. set: function(d) {
  1817. h.specular.value = d;
  1818. }
  1819. },
  1820. specularMap: {
  1821. get: function() {
  1822. return h.specularMap.value;
  1823. },
  1824. set: function(d) {
  1825. h.specularMap.value = d, d ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP;
  1826. }
  1827. },
  1828. glossiness: {
  1829. get: function() {
  1830. return h.glossiness.value;
  1831. },
  1832. set: function(d) {
  1833. h.glossiness.value = d;
  1834. }
  1835. },
  1836. glossinessMap: {
  1837. get: function() {
  1838. return h.glossinessMap.value;
  1839. },
  1840. set: function(d) {
  1841. h.glossinessMap.value = d, d ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV);
  1842. }
  1843. }
  1844. }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(n);
  1845. }
  1846. copy(n) {
  1847. return super.copy(n), this.specularMap = n.specularMap, this.specular.copy(n.specular), this.glossinessMap = n.glossinessMap, this.glossiness = n.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this;
  1848. }
  1849. };
  1850. var Dp = class {
  1851. constructor() {
  1852. this.name = re.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"];
  1853. }
  1854. getMaterialType() {
  1855. return go;
  1856. }
  1857. extendParams(n, s, r) {
  1858. const o = s.extensions[this.name];
  1859. n.color = new Color(1, 1, 1), n.opacity = 1;
  1860. const c = [];
  1861. if (Array.isArray(o.diffuseFactor)) {
  1862. const p = o.diffuseFactor;
  1863. n.color.fromArray(p), n.opacity = p[3];
  1864. }
  1865. if (o.diffuseTexture !== void 0 && c.push(r.assignTexture(n, "map", o.diffuseTexture, sRGBEncoding)), n.emissive = new Color(0, 0, 0), n.glossiness = o.glossinessFactor !== void 0 ? o.glossinessFactor : 1, n.specular = new Color(1, 1, 1), Array.isArray(o.specularFactor) && n.specular.fromArray(o.specularFactor), o.specularGlossinessTexture !== void 0) {
  1866. const p = o.specularGlossinessTexture;
  1867. c.push(r.assignTexture(n, "glossinessMap", p)), c.push(r.assignTexture(n, "specularMap", p, sRGBEncoding));
  1868. }
  1869. return Promise.all(c);
  1870. }
  1871. createMaterial(n) {
  1872. const s = new go(n);
  1873. return s.fog = true, s.color = n.color, s.map = n.map === void 0 ? null : n.map, s.lightMap = null, s.lightMapIntensity = 1, s.aoMap = n.aoMap === void 0 ? null : n.aoMap, s.aoMapIntensity = 1, s.emissive = n.emissive, s.emissiveIntensity = n.emissiveIntensity === void 0 ? 1 : n.emissiveIntensity, s.emissiveMap = n.emissiveMap === void 0 ? null : n.emissiveMap, s.bumpMap = n.bumpMap === void 0 ? null : n.bumpMap, s.bumpScale = 1, s.normalMap = n.normalMap === void 0 ? null : n.normalMap, s.normalMapType = TangentSpaceNormalMap, n.normalScale && (s.normalScale = n.normalScale), s.displacementMap = null, s.displacementScale = 1, s.displacementBias = 0, s.specularMap = n.specularMap === void 0 ? null : n.specularMap, s.specular = n.specular, s.glossinessMap = n.glossinessMap === void 0 ? null : n.glossinessMap, s.glossiness = n.glossiness, s.alphaMap = null, s.envMap = n.envMap === void 0 ? null : n.envMap, s.envMapIntensity = 1, s.refractionRatio = 0.98, s;
  1874. }
  1875. };
  1876. var Op = class {
  1877. constructor() {
  1878. this.name = re.KHR_MESH_QUANTIZATION;
  1879. }
  1880. };
  1881. var Ya = class extends Interpolant {
  1882. constructor(n, s, r, o) {
  1883. super(n, s, r, o);
  1884. }
  1885. copySampleValue_(n) {
  1886. const s = this.resultBuffer, r = this.sampleValues, o = this.valueSize, c = n * o * 3 + o;
  1887. for (let p = 0; p !== o; p++)
  1888. s[p] = r[c + p];
  1889. return s;
  1890. }
  1891. interpolate_(n, s, r, o) {
  1892. const c = this.resultBuffer, p = this.sampleValues, h = this.valueSize, d = h * 2, g = h * 3, w = o - s, _2 = (r - s) / w, y = _2 * _2, P = y * _2, R = n * g, k = R - g, A = -2 * P + 3 * y, z = P - y, F = 1 - A, I = z - y + _2;
  1893. for (let D2 = 0; D2 !== h; D2++) {
  1894. const Y = p[k + D2 + h], G = p[k + D2 + d] * w, N = p[R + D2 + h], O = p[R + D2] * w;
  1895. c[D2] = F * Y + I * G + A * N + z * O;
  1896. }
  1897. return c;
  1898. }
  1899. };
  1900. var Fp = new Quaternion();
  1901. var Np = class extends Ya {
  1902. interpolate_(n, s, r, o) {
  1903. const c = super.interpolate_(n, s, r, o);
  1904. return Fp.fromArray(c).normalize().toArray(c), c;
  1905. }
  1906. };
  1907. var jt = {
  1908. FLOAT: 5126,
  1909. //FLOAT_MAT2: 35674,
  1910. FLOAT_MAT3: 35675,
  1911. FLOAT_MAT4: 35676,
  1912. FLOAT_VEC2: 35664,
  1913. FLOAT_VEC3: 35665,
  1914. FLOAT_VEC4: 35666,
  1915. LINEAR: 9729,
  1916. REPEAT: 10497,
  1917. SAMPLER_2D: 35678,
  1918. POINTS: 0,
  1919. LINES: 1,
  1920. LINE_LOOP: 2,
  1921. LINE_STRIP: 3,
  1922. TRIANGLES: 4,
  1923. TRIANGLE_STRIP: 5,
  1924. TRIANGLE_FAN: 6,
  1925. UNSIGNED_BYTE: 5121,
  1926. UNSIGNED_SHORT: 5123
  1927. };
  1928. var es = {
  1929. 5120: Int8Array,
  1930. 5121: Uint8Array,
  1931. 5122: Int16Array,
  1932. 5123: Uint16Array,
  1933. 5125: Uint32Array,
  1934. 5126: Float32Array
  1935. };
  1936. var ma = {
  1937. 9728: NearestFilter,
  1938. 9729: LinearFilter,
  1939. 9984: NearestMipmapNearestFilter,
  1940. 9985: LinearMipmapNearestFilter,
  1941. 9986: NearestMipmapLinearFilter,
  1942. 9987: LinearMipmapLinearFilter
  1943. };
  1944. var fa = {
  1945. 33071: ClampToEdgeWrapping,
  1946. 33648: MirroredRepeatWrapping,
  1947. 10497: RepeatWrapping
  1948. };
  1949. var va = {
  1950. SCALAR: 1,
  1951. VEC2: 2,
  1952. VEC3: 3,
  1953. VEC4: 4,
  1954. MAT2: 4,
  1955. MAT3: 9,
  1956. MAT4: 16
  1957. };
  1958. var _o = {
  1959. POSITION: "position",
  1960. NORMAL: "normal",
  1961. TANGENT: "tangent",
  1962. TEXCOORD_0: "uv",
  1963. TEXCOORD_1: "uv2",
  1964. COLOR_0: "color",
  1965. WEIGHTS_0: "skinWeight",
  1966. JOINTS_0: "skinIndex"
  1967. };
  1968. var rn = {
  1969. scale: "scale",
  1970. translation: "position",
  1971. rotation: "quaternion",
  1972. weights: "morphTargetInfluences"
  1973. };
  1974. var Bp = {
  1975. CUBICSPLINE: void 0,
  1976. // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  1977. // keyframe track will be initialized with a default interpolation type, then modified.
  1978. LINEAR: InterpolateLinear,
  1979. STEP: InterpolateDiscrete
  1980. };
  1981. var ro = {
  1982. OPAQUE: "OPAQUE",
  1983. MASK: "MASK",
  1984. BLEND: "BLEND"
  1985. };
  1986. function zp(v) {
  1987. return v.DefaultMaterial === void 0 && (v.DefaultMaterial = new MeshStandardMaterial({
  1988. color: 16777215,
  1989. emissive: 0,
  1990. metalness: 1,
  1991. roughness: 1,
  1992. transparent: false,
  1993. depthTest: true,
  1994. side: FrontSide
  1995. })), v.DefaultMaterial;
  1996. }
  1997. function Xi(v, n, s) {
  1998. for (const r in s.extensions)
  1999. v[r] === void 0 && (n.userData.gltfExtensions = n.userData.gltfExtensions || {}, n.userData.gltfExtensions[r] = s.extensions[r]);
  2000. }
  2001. function Dn(v, n) {
  2002. n.extras !== void 0 && (typeof n.extras == "object" ? Object.assign(v.userData, n.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + n.extras));
  2003. }
  2004. function jp(v, n, s) {
  2005. let r = false, o = false, c = false;
  2006. for (let g = 0, w = n.length; g < w; g++) {
  2007. const _2 = n[g];
  2008. if (_2.POSITION !== void 0 && (r = true), _2.NORMAL !== void 0 && (o = true), _2.COLOR_0 !== void 0 && (c = true), r && o && c)
  2009. break;
  2010. }
  2011. if (!r && !o && !c)
  2012. return Promise.resolve(v);
  2013. const p = [], h = [], d = [];
  2014. for (let g = 0, w = n.length; g < w; g++) {
  2015. const _2 = n[g];
  2016. if (r) {
  2017. const y = _2.POSITION !== void 0 ? s.getDependency("accessor", _2.POSITION) : v.attributes.position;
  2018. p.push(y);
  2019. }
  2020. if (o) {
  2021. const y = _2.NORMAL !== void 0 ? s.getDependency("accessor", _2.NORMAL) : v.attributes.normal;
  2022. h.push(y);
  2023. }
  2024. if (c) {
  2025. const y = _2.COLOR_0 !== void 0 ? s.getDependency("accessor", _2.COLOR_0) : v.attributes.color;
  2026. d.push(y);
  2027. }
  2028. }
  2029. return Promise.all([Promise.all(p), Promise.all(h), Promise.all(d)]).then(function(g) {
  2030. const w = g[0], _2 = g[1], y = g[2];
  2031. return r && (v.morphAttributes.position = w), o && (v.morphAttributes.normal = _2), c && (v.morphAttributes.color = y), v.morphTargetsRelative = true, v;
  2032. });
  2033. }
  2034. function Up(v, n) {
  2035. if (v.updateMorphTargets(), n.weights !== void 0)
  2036. for (let s = 0, r = n.weights.length; s < r; s++)
  2037. v.morphTargetInfluences[s] = n.weights[s];
  2038. if (n.extras && Array.isArray(n.extras.targetNames)) {
  2039. const s = n.extras.targetNames;
  2040. if (v.morphTargetInfluences.length === s.length) {
  2041. v.morphTargetDictionary = {};
  2042. for (let r = 0, o = s.length; r < o; r++)
  2043. v.morphTargetDictionary[s[r]] = r;
  2044. } else
  2045. console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
  2046. }
  2047. }
  2048. function Gp(v) {
  2049. const n = v.extensions && v.extensions[re.KHR_DRACO_MESH_COMPRESSION];
  2050. let s;
  2051. return n ? s = "draco:" + n.bufferView + ":" + n.indices + ":" + ba(n.attributes) : s = v.indices + ":" + ba(v.attributes) + ":" + v.mode, s;
  2052. }
  2053. function ba(v) {
  2054. let n = "";
  2055. const s = Object.keys(v).sort();
  2056. for (let r = 0, o = s.length; r < o; r++)
  2057. n += s[r] + ":" + v[s[r]] + ";";
  2058. return n;
  2059. }
  2060. function wo(v) {
  2061. switch (v) {
  2062. case Int8Array:
  2063. return 1 / 127;
  2064. case Uint8Array:
  2065. return 1 / 255;
  2066. case Int16Array:
  2067. return 1 / 32767;
  2068. case Uint16Array:
  2069. return 1 / 65535;
  2070. default:
  2071. throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
  2072. }
  2073. }
  2074. function Hp(v) {
  2075. return v.search(/\.jpe?g($|\?)/i) > 0 || v.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : v.search(/\.webp($|\?)/i) > 0 || v.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
  2076. }
  2077. var Kp = class {
  2078. constructor(n = {}, s = {}) {
  2079. var r, o;
  2080. this.json = n, this.extensions = {}, this.plugins = {}, this.options = s, this.cache = new gp(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = {
  2081. refs: {},
  2082. uses: {}
  2083. }, this.cameraCache = {
  2084. refs: {},
  2085. uses: {}
  2086. }, this.lightCache = {
  2087. refs: {},
  2088. uses: {}
  2089. }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
  2090. const c = typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true, p = typeof navigator < "u" && ((r = navigator.userAgent) === null || r === void 0 ? void 0 : r.indexOf("Firefox")) > -1, h = typeof navigator < "u" && p ? (o = navigator.userAgent) === null || o === void 0 ? void 0 : o.match(/Firefox\/([0-9]+)\./)[1] : -1;
  2091. typeof createImageBitmap > "u" || c || p && h < 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);
  2092. }
  2093. setExtensions(n) {
  2094. this.extensions = n;
  2095. }
  2096. setPlugins(n) {
  2097. this.plugins = n;
  2098. }
  2099. parse(n, s) {
  2100. const r = this, o = this.json, c = this.extensions;
  2101. this.cache.removeAll(), this._invokeAll(function(p) {
  2102. return p._markDefs && p._markDefs();
  2103. }), Promise.all(this._invokeAll(function(p) {
  2104. return p.beforeRoot && p.beforeRoot();
  2105. })).then(function() {
  2106. return Promise.all([r.getDependencies("scene"), r.getDependencies("animation"), r.getDependencies("camera")]);
  2107. }).then(function(p) {
  2108. const h = {
  2109. scene: p[0][o.scene || 0],
  2110. scenes: p[0],
  2111. animations: p[1],
  2112. cameras: p[2],
  2113. asset: o.asset,
  2114. parser: r,
  2115. userData: {}
  2116. };
  2117. Xi(c, h, o), Dn(h, o), Promise.all(r._invokeAll(function(d) {
  2118. return d.afterRoot && d.afterRoot(h);
  2119. })).then(function() {
  2120. n(h);
  2121. });
  2122. }).catch(s);
  2123. }
  2124. /**
  2125. * Marks the special nodes/meshes in json for efficient parse.
  2126. */
  2127. _markDefs() {
  2128. const n = this.json.nodes || [], s = this.json.skins || [], r = this.json.meshes || [];
  2129. for (let o = 0, c = s.length; o < c; o++) {
  2130. const p = s[o].joints;
  2131. for (let h = 0, d = p.length; h < d; h++)
  2132. n[p[h]].isBone = true;
  2133. }
  2134. for (let o = 0, c = n.length; o < c; o++) {
  2135. const p = n[o];
  2136. p.mesh !== void 0 && (this._addNodeRef(this.meshCache, p.mesh), p.skin !== void 0 && (r[p.mesh].isSkinnedMesh = true)), p.camera !== void 0 && this._addNodeRef(this.cameraCache, p.camera);
  2137. }
  2138. }
  2139. /**
  2140. * Counts references to shared node / Object3D resources. These resources
  2141. * can be reused, or "instantiated", at multiple nodes in the scene
  2142. * hierarchy. Mesh, Camera, and Light instances are instantiated and must
  2143. * be marked. Non-scenegraph resources (like Materials, Geometries, and
  2144. * Textures) can be reused directly and are not marked here.
  2145. *
  2146. * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
  2147. */
  2148. _addNodeRef(n, s) {
  2149. s !== void 0 && (n.refs[s] === void 0 && (n.refs[s] = n.uses[s] = 0), n.refs[s]++);
  2150. }
  2151. /** Returns a reference to a shared resource, cloning it if necessary. */
  2152. _getNodeRef(n, s, r) {
  2153. if (n.refs[s] <= 1)
  2154. return r;
  2155. const o = r.clone(), c = (p, h) => {
  2156. const d = this.associations.get(p);
  2157. d != null && this.associations.set(h, d);
  2158. for (const [g, w] of p.children.entries())
  2159. c(w, h.children[g]);
  2160. };
  2161. return c(r, o), o.name += "_instance_" + n.uses[s]++, o;
  2162. }
  2163. _invokeOne(n) {
  2164. const s = Object.values(this.plugins);
  2165. s.push(this);
  2166. for (let r = 0; r < s.length; r++) {
  2167. const o = n(s[r]);
  2168. if (o)
  2169. return o;
  2170. }
  2171. return null;
  2172. }
  2173. _invokeAll(n) {
  2174. const s = Object.values(this.plugins);
  2175. s.unshift(this);
  2176. const r = [];
  2177. for (let o = 0; o < s.length; o++) {
  2178. const c = n(s[o]);
  2179. c && r.push(c);
  2180. }
  2181. return r;
  2182. }
  2183. /**
  2184. * Requests the specified dependency asynchronously, with caching.
  2185. * @param {string} type
  2186. * @param {number} index
  2187. * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
  2188. */
  2189. getDependency(n, s) {
  2190. const r = n + ":" + s;
  2191. let o = this.cache.get(r);
  2192. if (!o) {
  2193. switch (n) {
  2194. case "scene":
  2195. o = this.loadScene(s);
  2196. break;
  2197. case "node":
  2198. o = this.loadNode(s);
  2199. break;
  2200. case "mesh":
  2201. o = this._invokeOne(function(c) {
  2202. return c.loadMesh && c.loadMesh(s);
  2203. });
  2204. break;
  2205. case "accessor":
  2206. o = this.loadAccessor(s);
  2207. break;
  2208. case "bufferView":
  2209. o = this._invokeOne(function(c) {
  2210. return c.loadBufferView && c.loadBufferView(s);
  2211. });
  2212. break;
  2213. case "buffer":
  2214. o = this.loadBuffer(s);
  2215. break;
  2216. case "material":
  2217. o = this._invokeOne(function(c) {
  2218. return c.loadMaterial && c.loadMaterial(s);
  2219. });
  2220. break;
  2221. case "texture":
  2222. o = this._invokeOne(function(c) {
  2223. return c.loadTexture && c.loadTexture(s);
  2224. });
  2225. break;
  2226. case "skin":
  2227. o = this.loadSkin(s);
  2228. break;
  2229. case "animation":
  2230. o = this._invokeOne(function(c) {
  2231. return c.loadAnimation && c.loadAnimation(s);
  2232. });
  2233. break;
  2234. case "camera":
  2235. o = this.loadCamera(s);
  2236. break;
  2237. default:
  2238. throw new Error("Unknown type: " + n);
  2239. }
  2240. this.cache.add(r, o);
  2241. }
  2242. return o;
  2243. }
  2244. /**
  2245. * Requests all dependencies of the specified type asynchronously, with caching.
  2246. * @param {string} type
  2247. * @return {Promise<Array<Object>>}
  2248. */
  2249. getDependencies(n) {
  2250. let s = this.cache.get(n);
  2251. if (!s) {
  2252. const r = this, o = this.json[n + (n === "mesh" ? "es" : "s")] || [];
  2253. s = Promise.all(o.map(function(c, p) {
  2254. return r.getDependency(n, p);
  2255. })), this.cache.add(n, s);
  2256. }
  2257. return s;
  2258. }
  2259. /**
  2260. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2261. * @param {number} bufferIndex
  2262. * @return {Promise<ArrayBuffer>}
  2263. */
  2264. loadBuffer(n) {
  2265. const s = this.json.buffers[n], r = this.fileLoader;
  2266. if (s.type && s.type !== "arraybuffer")
  2267. throw new Error("THREE.GLTFLoader: " + s.type + " buffer type is not supported.");
  2268. if (s.uri === void 0 && n === 0)
  2269. return Promise.resolve(this.extensions[re.KHR_BINARY_GLTF].body);
  2270. const o = this.options;
  2271. return new Promise(function(c, p) {
  2272. r.load(LoaderUtils.resolveURL(s.uri, o.path), c, void 0, function() {
  2273. p(new Error('THREE.GLTFLoader: Failed to load buffer "' + s.uri + '".'));
  2274. });
  2275. });
  2276. }
  2277. /**
  2278. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2279. * @param {number} bufferViewIndex
  2280. * @return {Promise<ArrayBuffer>}
  2281. */
  2282. loadBufferView(n) {
  2283. const s = this.json.bufferViews[n];
  2284. return this.getDependency("buffer", s.buffer).then(function(r) {
  2285. const o = s.byteLength || 0, c = s.byteOffset || 0;
  2286. return r.slice(c, c + o);
  2287. });
  2288. }
  2289. /**
  2290. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
  2291. * @param {number} accessorIndex
  2292. * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
  2293. */
  2294. loadAccessor(n) {
  2295. const s = this, r = this.json, o = this.json.accessors[n];
  2296. if (o.bufferView === void 0 && o.sparse === void 0)
  2297. return Promise.resolve(null);
  2298. const c = [];
  2299. return o.bufferView !== void 0 ? c.push(this.getDependency("bufferView", o.bufferView)) : c.push(null), o.sparse !== void 0 && (c.push(this.getDependency("bufferView", o.sparse.indices.bufferView)), c.push(this.getDependency("bufferView", o.sparse.values.bufferView))), Promise.all(c).then(function(p) {
  2300. const h = p[0], d = va[o.type], g = es[o.componentType], w = g.BYTES_PER_ELEMENT, _2 = w * d, y = o.byteOffset || 0, P = o.bufferView !== void 0 ? r.bufferViews[o.bufferView].byteStride : void 0, R = o.normalized === true;
  2301. let k, A;
  2302. if (P && P !== _2) {
  2303. const z = Math.floor(y / P), F = "InterleavedBuffer:" + o.bufferView + ":" + o.componentType + ":" + z + ":" + o.count;
  2304. let I = s.cache.get(F);
  2305. I || (k = new g(h, z * P, o.count * P / w), I = new InterleavedBuffer(k, P / w), s.cache.add(F, I)), A = new InterleavedBufferAttribute(I, d, y % P / w, R);
  2306. } else
  2307. h === null ? k = new g(o.count * d) : k = new g(h, y, o.count * d), A = new BufferAttribute(k, d, R);
  2308. if (o.sparse !== void 0) {
  2309. const z = va.SCALAR, F = es[o.sparse.indices.componentType], I = o.sparse.indices.byteOffset || 0, D2 = o.sparse.values.byteOffset || 0, Y = new F(p[1], I, o.sparse.count * z), G = new g(p[2], D2, o.sparse.count * d);
  2310. h !== null && (A = new BufferAttribute(A.array.slice(), A.itemSize, A.normalized));
  2311. for (let N = 0, O = Y.length; N < O; N++) {
  2312. const H = Y[N];
  2313. if (A.setX(H, G[N * d]), d >= 2 && A.setY(H, G[N * d + 1]), d >= 3 && A.setZ(H, G[N * d + 2]), d >= 4 && A.setW(H, G[N * d + 3]), d >= 5)
  2314. throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
  2315. }
  2316. }
  2317. return A;
  2318. });
  2319. }
  2320. /**
  2321. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
  2322. * @param {number} textureIndex
  2323. * @return {Promise<THREE.Texture>}
  2324. */
  2325. loadTexture(n) {
  2326. const s = this.json, r = this.options, c = s.textures[n].source, p = s.images[c];
  2327. let h = this.textureLoader;
  2328. if (p.uri) {
  2329. const d = r.manager.getHandler(p.uri);
  2330. d !== null && (h = d);
  2331. }
  2332. return this.loadTextureImage(n, c, h);
  2333. }
  2334. loadTextureImage(n, s, r) {
  2335. const o = this, c = this.json, p = c.textures[n], h = c.images[s], d = (h.uri || h.bufferView) + ":" + p.sampler;
  2336. if (this.textureCache[d])
  2337. return this.textureCache[d];
  2338. const g = this.loadImageSource(s, r).then(function(w) {
  2339. w.flipY = false, p.name && (w.name = p.name);
  2340. const y = (c.samplers || {})[p.sampler] || {};
  2341. return w.magFilter = ma[y.magFilter] || LinearFilter, w.minFilter = ma[y.minFilter] || LinearMipmapLinearFilter, w.wrapS = fa[y.wrapS] || RepeatWrapping, w.wrapT = fa[y.wrapT] || RepeatWrapping, o.associations.set(w, {
  2342. textures: n
  2343. }), w;
  2344. }).catch(function() {
  2345. return null;
  2346. });
  2347. return this.textureCache[d] = g, g;
  2348. }
  2349. loadImageSource(n, s) {
  2350. const r = this, o = this.json, c = this.options;
  2351. if (this.sourceCache[n] !== void 0)
  2352. return this.sourceCache[n].then((_2) => _2.clone());
  2353. const p = o.images[n], h = self.URL || self.webkitURL;
  2354. let d = p.uri || "", g = false;
  2355. if (p.bufferView !== void 0)
  2356. d = r.getDependency("bufferView", p.bufferView).then(function(_2) {
  2357. g = true;
  2358. const y = new Blob([_2], {
  2359. type: p.mimeType
  2360. });
  2361. return d = h.createObjectURL(y), d;
  2362. });
  2363. else if (p.uri === void 0)
  2364. throw new Error("THREE.GLTFLoader: Image " + n + " is missing URI and bufferView");
  2365. const w = Promise.resolve(d).then(function(_2) {
  2366. return new Promise(function(y, P) {
  2367. let R = y;
  2368. s.isImageBitmapLoader === true && (R = function(k) {
  2369. const A = new Texture(k);
  2370. A.needsUpdate = true, y(A);
  2371. }), s.load(LoaderUtils.resolveURL(_2, c.path), R, void 0, P);
  2372. });
  2373. }).then(function(_2) {
  2374. return g === true && h.revokeObjectURL(d), _2.userData.mimeType = p.mimeType || Hp(p.uri), _2;
  2375. }).catch(function(_2) {
  2376. throw console.error("THREE.GLTFLoader: Couldn't load texture", d), _2;
  2377. });
  2378. return this.sourceCache[n] = w, w;
  2379. }
  2380. /**
  2381. * Asynchronously assigns a texture to the given material parameters.
  2382. * @param {Object} materialParams
  2383. * @param {string} mapName
  2384. * @param {Object} mapDef
  2385. * @return {Promise<Texture>}
  2386. */
  2387. assignTexture(n, s, r, o) {
  2388. const c = this;
  2389. return this.getDependency("texture", r.index).then(function(p) {
  2390. if (r.texCoord !== void 0 && r.texCoord != 0 && !(s === "aoMap" && r.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + r.texCoord + " for texture " + s + " not yet supported."), c.extensions[re.KHR_TEXTURE_TRANSFORM]) {
  2391. const h = r.extensions !== void 0 ? r.extensions[re.KHR_TEXTURE_TRANSFORM] : void 0;
  2392. if (h) {
  2393. const d = c.associations.get(p);
  2394. p = c.extensions[re.KHR_TEXTURE_TRANSFORM].extendTexture(p, h), c.associations.set(p, d);
  2395. }
  2396. }
  2397. return o !== void 0 && (p.encoding = o), n[s] = p, p;
  2398. });
  2399. }
  2400. /**
  2401. * Assigns final material to a Mesh, Line, or Points instance. The instance
  2402. * already has a material (generated from the glTF material options alone)
  2403. * but reuse of the same glTF material may require multiple threejs materials
  2404. * to accommodate different primitive types, defines, etc. New materials will
  2405. * be created if necessary, and reused from a cache.
  2406. * @param {Object3D} mesh Mesh, Line, or Points instance.
  2407. */
  2408. assignFinalMaterial(n) {
  2409. const s = n.geometry;
  2410. let r = n.material;
  2411. const o = s.attributes.tangent === void 0, c = s.attributes.color !== void 0, p = s.attributes.normal === void 0;
  2412. if (n.isPoints) {
  2413. const h = "PointsMaterial:" + r.uuid;
  2414. let d = this.cache.get(h);
  2415. d || (d = new PointsMaterial(), Material.prototype.copy.call(d, r), d.color.copy(r.color), d.map = r.map, d.sizeAttenuation = false, this.cache.add(h, d)), r = d;
  2416. } else if (n.isLine) {
  2417. const h = "LineBasicMaterial:" + r.uuid;
  2418. let d = this.cache.get(h);
  2419. d || (d = new LineBasicMaterial(), Material.prototype.copy.call(d, r), d.color.copy(r.color), this.cache.add(h, d)), r = d;
  2420. }
  2421. if (o || c || p) {
  2422. let h = "ClonedMaterial:" + r.uuid + ":";
  2423. r.isGLTFSpecularGlossinessMaterial && (h += "specular-glossiness:"), o && (h += "derivative-tangents:"), c && (h += "vertex-colors:"), p && (h += "flat-shading:");
  2424. let d = this.cache.get(h);
  2425. d || (d = r.clone(), c && (d.vertexColors = true), p && (d.flatShading = true), o && (d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(h, d), this.associations.set(d, this.associations.get(r))), r = d;
  2426. }
  2427. r.aoMap && s.attributes.uv2 === void 0 && s.attributes.uv !== void 0 && s.setAttribute("uv2", s.attributes.uv), n.material = r;
  2428. }
  2429. getMaterialType() {
  2430. return MeshStandardMaterial;
  2431. }
  2432. /**
  2433. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
  2434. * @param {number} materialIndex
  2435. * @return {Promise<Material>}
  2436. */
  2437. loadMaterial(n) {
  2438. const s = this, r = this.json, o = this.extensions, c = r.materials[n];
  2439. let p;
  2440. const h = {}, d = c.extensions || {}, g = [];
  2441. if (d[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
  2442. const _2 = o[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
  2443. p = _2.getMaterialType(), g.push(_2.extendParams(h, c, s));
  2444. } else if (d[re.KHR_MATERIALS_UNLIT]) {
  2445. const _2 = o[re.KHR_MATERIALS_UNLIT];
  2446. p = _2.getMaterialType(), g.push(_2.extendParams(h, c, s));
  2447. } else {
  2448. const _2 = c.pbrMetallicRoughness || {};
  2449. if (h.color = new Color(1, 1, 1), h.opacity = 1, Array.isArray(_2.baseColorFactor)) {
  2450. const y = _2.baseColorFactor;
  2451. h.color.fromArray(y), h.opacity = y[3];
  2452. }
  2453. _2.baseColorTexture !== void 0 && g.push(s.assignTexture(h, "map", _2.baseColorTexture, sRGBEncoding)), h.metalness = _2.metallicFactor !== void 0 ? _2.metallicFactor : 1, h.roughness = _2.roughnessFactor !== void 0 ? _2.roughnessFactor : 1, _2.metallicRoughnessTexture !== void 0 && (g.push(s.assignTexture(h, "metalnessMap", _2.metallicRoughnessTexture)), g.push(s.assignTexture(h, "roughnessMap", _2.metallicRoughnessTexture))), p = this._invokeOne(function(y) {
  2454. return y.getMaterialType && y.getMaterialType(n);
  2455. }), g.push(Promise.all(this._invokeAll(function(y) {
  2456. return y.extendMaterialParams && y.extendMaterialParams(n, h);
  2457. })));
  2458. }
  2459. c.doubleSided === true && (h.side = DoubleSide);
  2460. const w = c.alphaMode || ro.OPAQUE;
  2461. if (w === ro.BLEND ? (h.transparent = true, h.depthWrite = false) : (h.transparent = false, w === ro.MASK && (h.alphaTest = c.alphaCutoff !== void 0 ? c.alphaCutoff : 0.5)), c.normalTexture !== void 0 && p !== MeshBasicMaterial && (g.push(s.assignTexture(h, "normalMap", c.normalTexture)), h.normalScale = new Vector2(1, 1), c.normalTexture.scale !== void 0)) {
  2462. const _2 = c.normalTexture.scale;
  2463. h.normalScale.set(_2, _2);
  2464. }
  2465. return c.occlusionTexture !== void 0 && p !== MeshBasicMaterial && (g.push(s.assignTexture(h, "aoMap", c.occlusionTexture)), c.occlusionTexture.strength !== void 0 && (h.aoMapIntensity = c.occlusionTexture.strength)), c.emissiveFactor !== void 0 && p !== MeshBasicMaterial && (h.emissive = new Color().fromArray(c.emissiveFactor)), c.emissiveTexture !== void 0 && p !== MeshBasicMaterial && g.push(s.assignTexture(h, "emissiveMap", c.emissiveTexture, sRGBEncoding)), Promise.all(g).then(function() {
  2466. let _2;
  2467. return p === go ? _2 = o[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(h) : _2 = new p(h), c.name && (_2.name = c.name), Dn(_2, c), s.associations.set(_2, {
  2468. materials: n
  2469. }), c.extensions && Xi(o, _2, c), _2;
  2470. });
  2471. }
  2472. /** When Object3D instances are targeted by animation, they need unique names. */
  2473. createUniqueName(n) {
  2474. const s = PropertyBinding.sanitizeNodeName(n || "");
  2475. let r = s;
  2476. for (let o = 1; this.nodeNamesUsed[r]; ++o)
  2477. r = s + "_" + o;
  2478. return this.nodeNamesUsed[r] = true, r;
  2479. }
  2480. /**
  2481. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
  2482. *
  2483. * Creates BufferGeometries from primitives.
  2484. *
  2485. * @param {Array<GLTF.Primitive>} primitives
  2486. * @return {Promise<Array<BufferGeometry>>}
  2487. */
  2488. loadGeometries(n) {
  2489. const s = this, r = this.extensions, o = this.primitiveCache;
  2490. function c(h) {
  2491. return r[re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h, s).then(function(d) {
  2492. return ga(d, h, s);
  2493. });
  2494. }
  2495. const p = [];
  2496. for (let h = 0, d = n.length; h < d; h++) {
  2497. const g = n[h], w = Gp(g), _2 = o[w];
  2498. if (_2)
  2499. p.push(_2.promise);
  2500. else {
  2501. let y;
  2502. g.extensions && g.extensions[re.KHR_DRACO_MESH_COMPRESSION] ? y = c(g) : y = ga(new BufferGeometry(), g, s), o[w] = {
  2503. primitive: g,
  2504. promise: y
  2505. }, p.push(y);
  2506. }
  2507. }
  2508. return Promise.all(p);
  2509. }
  2510. /**
  2511. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
  2512. * @param {number} meshIndex
  2513. * @return {Promise<Group|Mesh|SkinnedMesh>}
  2514. */
  2515. loadMesh(n) {
  2516. const s = this, r = this.json, o = this.extensions, c = r.meshes[n], p = c.primitives, h = [];
  2517. for (let d = 0, g = p.length; d < g; d++) {
  2518. const w = p[d].material === void 0 ? zp(this.cache) : this.getDependency("material", p[d].material);
  2519. h.push(w);
  2520. }
  2521. return h.push(s.loadGeometries(p)), Promise.all(h).then(function(d) {
  2522. const g = d.slice(0, d.length - 1), w = d[d.length - 1], _2 = [];
  2523. for (let P = 0, R = w.length; P < R; P++) {
  2524. const k = w[P], A = p[P];
  2525. let z;
  2526. const F = g[P];
  2527. if (A.mode === jt.TRIANGLES || A.mode === jt.TRIANGLE_STRIP || A.mode === jt.TRIANGLE_FAN || A.mode === void 0)
  2528. z = c.isSkinnedMesh === true ? new SkinnedMesh(k, F) : new Mesh(k, F), z.isSkinnedMesh === true && !z.geometry.attributes.skinWeight.normalized && z.normalizeSkinWeights(), A.mode === jt.TRIANGLE_STRIP ? z.geometry = _a(z.geometry, TriangleStripDrawMode) : A.mode === jt.TRIANGLE_FAN && (z.geometry = _a(z.geometry, TriangleFanDrawMode));
  2529. else if (A.mode === jt.LINES)
  2530. z = new LineSegments(k, F);
  2531. else if (A.mode === jt.LINE_STRIP)
  2532. z = new Line(k, F);
  2533. else if (A.mode === jt.LINE_LOOP)
  2534. z = new LineLoop(k, F);
  2535. else if (A.mode === jt.POINTS)
  2536. z = new Points(k, F);
  2537. else
  2538. throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + A.mode);
  2539. Object.keys(z.geometry.morphAttributes).length > 0 && Up(z, c), z.name = s.createUniqueName(c.name || "mesh_" + n), Dn(z, c), A.extensions && Xi(o, z, A), s.assignFinalMaterial(z), _2.push(z);
  2540. }
  2541. for (let P = 0, R = _2.length; P < R; P++)
  2542. s.associations.set(_2[P], {
  2543. meshes: n,
  2544. primitives: P
  2545. });
  2546. if (_2.length === 1)
  2547. return _2[0];
  2548. const y = new Group();
  2549. s.associations.set(y, {
  2550. meshes: n
  2551. });
  2552. for (let P = 0, R = _2.length; P < R; P++)
  2553. y.add(_2[P]);
  2554. return y;
  2555. });
  2556. }
  2557. /**
  2558. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
  2559. * @param {number} cameraIndex
  2560. * @return {Promise<THREE.Camera>}
  2561. */
  2562. loadCamera(n) {
  2563. let s;
  2564. const r = this.json.cameras[n], o = r[r.type];
  2565. if (!o) {
  2566. console.warn("THREE.GLTFLoader: Missing camera parameters.");
  2567. return;
  2568. }
  2569. return r.type === "perspective" ? s = new PerspectiveCamera(MathUtils.radToDeg(o.yfov), o.aspectRatio || 1, o.znear || 1, o.zfar || 2e6) : r.type === "orthographic" && (s = new OrthographicCamera(-o.xmag, o.xmag, o.ymag, -o.ymag, o.znear, o.zfar)), r.name && (s.name = this.createUniqueName(r.name)), Dn(s, r), Promise.resolve(s);
  2570. }
  2571. /**
  2572. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
  2573. * @param {number} skinIndex
  2574. * @return {Promise<Object>}
  2575. */
  2576. loadSkin(n) {
  2577. const s = this.json.skins[n], r = {
  2578. joints: s.joints
  2579. };
  2580. return s.inverseBindMatrices === void 0 ? Promise.resolve(r) : this.getDependency("accessor", s.inverseBindMatrices).then(function(o) {
  2581. return r.inverseBindMatrices = o, r;
  2582. });
  2583. }
  2584. /**
  2585. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
  2586. * @param {number} animationIndex
  2587. * @return {Promise<AnimationClip>}
  2588. */
  2589. loadAnimation(n) {
  2590. const r = this.json.animations[n], o = [], c = [], p = [], h = [], d = [];
  2591. for (let g = 0, w = r.channels.length; g < w; g++) {
  2592. const _2 = r.channels[g], y = r.samplers[_2.sampler], P = _2.target, R = P.node, k = r.parameters !== void 0 ? r.parameters[y.input] : y.input, A = r.parameters !== void 0 ? r.parameters[y.output] : y.output;
  2593. o.push(this.getDependency("node", R)), c.push(this.getDependency("accessor", k)), p.push(this.getDependency("accessor", A)), h.push(y), d.push(P);
  2594. }
  2595. return Promise.all([Promise.all(o), Promise.all(c), Promise.all(p), Promise.all(h), Promise.all(d)]).then(function(g) {
  2596. const w = g[0], _2 = g[1], y = g[2], P = g[3], R = g[4], k = [];
  2597. for (let z = 0, F = w.length; z < F; z++) {
  2598. const I = w[z], D2 = _2[z], Y = y[z], G = P[z], N = R[z];
  2599. if (I === void 0)
  2600. continue;
  2601. I.updateMatrix();
  2602. let O;
  2603. switch (rn[N.path]) {
  2604. case rn.weights:
  2605. O = NumberKeyframeTrack;
  2606. break;
  2607. case rn.rotation:
  2608. O = QuaternionKeyframeTrack;
  2609. break;
  2610. case rn.position:
  2611. case rn.scale:
  2612. default:
  2613. O = VectorKeyframeTrack;
  2614. break;
  2615. }
  2616. const H = I.name ? I.name : I.uuid, K = G.interpolation !== void 0 ? Bp[G.interpolation] : InterpolateLinear, q = [];
  2617. rn[N.path] === rn.weights ? I.traverse(function(_e) {
  2618. _e.morphTargetInfluences && q.push(_e.name ? _e.name : _e.uuid);
  2619. }) : q.push(H);
  2620. let pe = Y.array;
  2621. if (Y.normalized) {
  2622. const _e = wo(pe.constructor), ce = new Float32Array(pe.length);
  2623. for (let me = 0, he = pe.length; me < he; me++)
  2624. ce[me] = pe[me] * _e;
  2625. pe = ce;
  2626. }
  2627. for (let _e = 0, ce = q.length; _e < ce; _e++) {
  2628. const me = new O(q[_e] + "." + rn[N.path], D2.array, pe, K);
  2629. G.interpolation === "CUBICSPLINE" && (me.createInterpolant = function(ee) {
  2630. const X = this instanceof QuaternionKeyframeTrack ? Np : Ya;
  2631. return new X(this.times, this.values, this.getValueSize() / 3, ee);
  2632. }, me.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true), k.push(me);
  2633. }
  2634. }
  2635. const A = r.name ? r.name : "animation_" + n;
  2636. return new AnimationClip(A, void 0, k);
  2637. });
  2638. }
  2639. createNodeMesh(n) {
  2640. const s = this.json, r = this, o = s.nodes[n];
  2641. return o.mesh === void 0 ? null : r.getDependency("mesh", o.mesh).then(function(c) {
  2642. const p = r._getNodeRef(r.meshCache, o.mesh, c);
  2643. return o.weights !== void 0 && p.traverse(function(h) {
  2644. if (h.isMesh)
  2645. for (let d = 0, g = o.weights.length; d < g; d++)
  2646. h.morphTargetInfluences[d] = o.weights[d];
  2647. }), p;
  2648. });
  2649. }
  2650. /**
  2651. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
  2652. * @param {number} nodeIndex
  2653. * @return {Promise<Object3D>}
  2654. */
  2655. loadNode(n) {
  2656. const s = this.json, r = this.extensions, o = this, c = s.nodes[n], p = c.name ? o.createUniqueName(c.name) : "";
  2657. return function() {
  2658. const h = [], d = o._invokeOne(function(g) {
  2659. return g.createNodeMesh && g.createNodeMesh(n);
  2660. });
  2661. return d && h.push(d), c.camera !== void 0 && h.push(o.getDependency("camera", c.camera).then(function(g) {
  2662. return o._getNodeRef(o.cameraCache, c.camera, g);
  2663. })), o._invokeAll(function(g) {
  2664. return g.createNodeAttachment && g.createNodeAttachment(n);
  2665. }).forEach(function(g) {
  2666. h.push(g);
  2667. }), Promise.all(h);
  2668. }().then(function(h) {
  2669. let d;
  2670. if (c.isBone === true ? d = new Bone() : h.length > 1 ? d = new Group() : h.length === 1 ? d = h[0] : d = new Object3D(), d !== h[0])
  2671. for (let g = 0, w = h.length; g < w; g++)
  2672. d.add(h[g]);
  2673. if (c.name && (d.userData.name = c.name, d.name = p), Dn(d, c), c.extensions && Xi(r, d, c), c.matrix !== void 0) {
  2674. const g = new Matrix4();
  2675. g.fromArray(c.matrix), d.applyMatrix4(g);
  2676. } else
  2677. 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);
  2678. return o.associations.has(d) || o.associations.set(d, {}), o.associations.get(d).nodes = n, d;
  2679. });
  2680. }
  2681. /**
  2682. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
  2683. * @param {number} sceneIndex
  2684. * @return {Promise<Group>}
  2685. */
  2686. loadScene(n) {
  2687. const s = this.json, r = this.extensions, o = this.json.scenes[n], c = this, p = new Group();
  2688. o.name && (p.name = c.createUniqueName(o.name)), Dn(p, o), o.extensions && Xi(r, p, o);
  2689. const h = o.nodes || [], d = [];
  2690. for (let g = 0, w = h.length; g < w; g++)
  2691. d.push(qa(h[g], p, s, c));
  2692. return Promise.all(d).then(function() {
  2693. const g = (w) => {
  2694. const _2 = /* @__PURE__ */ new Map();
  2695. for (const [y, P] of c.associations)
  2696. (y instanceof Material || y instanceof Texture) && _2.set(y, P);
  2697. return w.traverse((y) => {
  2698. const P = c.associations.get(y);
  2699. P != null && _2.set(y, P);
  2700. }), _2;
  2701. };
  2702. return c.associations = g(p), p;
  2703. });
  2704. }
  2705. };
  2706. function qa(v, n, s, r) {
  2707. const o = s.nodes[v];
  2708. return r.getDependency("node", v).then(function(c) {
  2709. if (o.skin === void 0)
  2710. return c;
  2711. let p;
  2712. return r.getDependency("skin", o.skin).then(function(h) {
  2713. p = h;
  2714. const d = [];
  2715. for (let g = 0, w = p.joints.length; g < w; g++)
  2716. d.push(r.getDependency("node", p.joints[g]));
  2717. return Promise.all(d);
  2718. }).then(function(h) {
  2719. return c.traverse(function(d) {
  2720. if (!d.isMesh)
  2721. return;
  2722. const g = [], w = [];
  2723. for (let _2 = 0, y = h.length; _2 < y; _2++) {
  2724. const P = h[_2];
  2725. if (P) {
  2726. g.push(P);
  2727. const R = new Matrix4();
  2728. p.inverseBindMatrices !== void 0 && R.fromArray(p.inverseBindMatrices.array, _2 * 16), w.push(R);
  2729. } else
  2730. console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', p.joints[_2]);
  2731. }
  2732. d.bind(new Skeleton(g, w), d.matrixWorld);
  2733. }), c;
  2734. });
  2735. }).then(function(c) {
  2736. n.add(c);
  2737. const p = [];
  2738. if (o.children) {
  2739. const h = o.children;
  2740. for (let d = 0, g = h.length; d < g; d++) {
  2741. const w = h[d];
  2742. p.push(qa(w, c, s, r));
  2743. }
  2744. }
  2745. return Promise.all(p);
  2746. });
  2747. }
  2748. function $p(v, n, s) {
  2749. const r = n.attributes, o = new Box3();
  2750. if (r.POSITION !== void 0) {
  2751. const h = s.json.accessors[r.POSITION], d = h.min, g = h.max;
  2752. if (d !== void 0 && g !== void 0) {
  2753. if (o.set(new Vector3(d[0], d[1], d[2]), new Vector3(g[0], g[1], g[2])), h.normalized) {
  2754. const w = wo(es[h.componentType]);
  2755. o.min.multiplyScalar(w), o.max.multiplyScalar(w);
  2756. }
  2757. } else {
  2758. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  2759. return;
  2760. }
  2761. } else
  2762. return;
  2763. const c = n.targets;
  2764. if (c !== void 0) {
  2765. const h = new Vector3(), d = new Vector3();
  2766. for (let g = 0, w = c.length; g < w; g++) {
  2767. const _2 = c[g];
  2768. if (_2.POSITION !== void 0) {
  2769. const y = s.json.accessors[_2.POSITION], P = y.min, R = y.max;
  2770. if (P !== void 0 && R !== void 0) {
  2771. if (d.setX(Math.max(Math.abs(P[0]), Math.abs(R[0]))), d.setY(Math.max(Math.abs(P[1]), Math.abs(R[1]))), d.setZ(Math.max(Math.abs(P[2]), Math.abs(R[2]))), y.normalized) {
  2772. const k = wo(es[y.componentType]);
  2773. d.multiplyScalar(k);
  2774. }
  2775. h.max(d);
  2776. } else
  2777. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  2778. }
  2779. }
  2780. o.expandByVector(h);
  2781. }
  2782. v.boundingBox = o;
  2783. const p = new Sphere();
  2784. o.getCenter(p.center), p.radius = o.min.distanceTo(o.max) / 2, v.boundingSphere = p;
  2785. }
  2786. function ga(v, n, s) {
  2787. const r = n.attributes, o = [];
  2788. function c(p, h) {
  2789. return s.getDependency("accessor", p).then(function(d) {
  2790. v.setAttribute(h, d);
  2791. });
  2792. }
  2793. for (const p in r) {
  2794. const h = _o[p] || p.toLowerCase();
  2795. h in v.attributes || o.push(c(r[p], h));
  2796. }
  2797. if (n.indices !== void 0 && !v.index) {
  2798. const p = s.getDependency("accessor", n.indices).then(function(h) {
  2799. v.setIndex(h);
  2800. });
  2801. o.push(p);
  2802. }
  2803. return Dn(v, n), $p(v, n, s), Promise.all(o).then(function() {
  2804. return n.targets !== void 0 ? jp(v, n.targets, s) : v;
  2805. });
  2806. }
  2807. function _a(v, n) {
  2808. let s = v.getIndex();
  2809. if (s === null) {
  2810. const p = [], h = v.getAttribute("position");
  2811. if (h !== void 0) {
  2812. for (let d = 0; d < h.count; d++)
  2813. p.push(d);
  2814. v.setIndex(p), s = v.getIndex();
  2815. } else
  2816. return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), v;
  2817. }
  2818. const r = s.count - 2, o = [];
  2819. if (n === TriangleFanDrawMode)
  2820. for (let p = 1; p <= r; p++)
  2821. o.push(s.getX(0)), o.push(s.getX(p)), o.push(s.getX(p + 1));
  2822. else
  2823. for (let p = 0; p < r; p++)
  2824. p % 2 === 0 ? (o.push(s.getX(p)), o.push(s.getX(p + 1)), o.push(s.getX(p + 2))) : (o.push(s.getX(p + 2)), o.push(s.getX(p + 1)), o.push(s.getX(p)));
  2825. o.length / 3 !== r && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  2826. const c = v.clone();
  2827. return c.setIndex(o), c;
  2828. }
  2829. var Xp = class extends ExtrudeGeometry {
  2830. constructor(n, s = {}) {
  2831. const {
  2832. bevelEnabled: r = false,
  2833. bevelSize: o = 8,
  2834. bevelThickness: c = 10,
  2835. font: p,
  2836. height: h = 50,
  2837. size: d = 100,
  2838. lineHeight: g = 1,
  2839. letterSpacing: w = 0,
  2840. ..._2
  2841. } = s;
  2842. if (p === void 0)
  2843. super();
  2844. else {
  2845. const y = p.generateShapes(n, d, {
  2846. lineHeight: g,
  2847. letterSpacing: w
  2848. });
  2849. super(y, {
  2850. ..._2,
  2851. bevelEnabled: r,
  2852. bevelSize: o,
  2853. bevelThickness: c,
  2854. depth: h
  2855. });
  2856. }
  2857. this.type = "TextGeometry";
  2858. }
  2859. };
  2860. function Qa(v, n, s) {
  2861. const r = s.length - v - 1;
  2862. if (n >= s[r])
  2863. return r - 1;
  2864. if (n <= s[v])
  2865. return v;
  2866. let o = v, c = r, p = Math.floor((o + c) / 2);
  2867. for (; n < s[p] || n >= s[p + 1]; )
  2868. n < s[p] ? c = p : o = p, p = Math.floor((o + c) / 2);
  2869. return p;
  2870. }
  2871. function Yp(v, n, s, r) {
  2872. const o = [], c = [], p = [];
  2873. o[0] = 1;
  2874. for (let h = 1; h <= s; ++h) {
  2875. c[h] = n - r[v + 1 - h], p[h] = r[v + h] - n;
  2876. let d = 0;
  2877. for (let g = 0; g < h; ++g) {
  2878. const w = p[g + 1], _2 = c[h - g], y = o[g] / (w + _2);
  2879. o[g] = d + w * y, d = _2 * y;
  2880. }
  2881. o[h] = d;
  2882. }
  2883. return o;
  2884. }
  2885. function qp(v, n, s, r) {
  2886. const o = Qa(v, r, n), c = Yp(o, r, v, n), p = new Vector4(0, 0, 0, 0);
  2887. for (let h = 0; h <= v; ++h) {
  2888. const d = s[o - v + h], g = c[h], w = d.w * g;
  2889. p.x += d.x * w, p.y += d.y * w, p.z += d.z * w, p.w += d.w * g;
  2890. }
  2891. return p;
  2892. }
  2893. function Qp(v, n, s, r, o) {
  2894. const c = [];
  2895. for (let y = 0; y <= s; ++y)
  2896. c[y] = 0;
  2897. const p = [];
  2898. for (let y = 0; y <= r; ++y)
  2899. p[y] = c.slice(0);
  2900. const h = [];
  2901. for (let y = 0; y <= s; ++y)
  2902. h[y] = c.slice(0);
  2903. h[0][0] = 1;
  2904. const d = c.slice(0), g = c.slice(0);
  2905. for (let y = 1; y <= s; ++y) {
  2906. d[y] = n - o[v + 1 - y], g[y] = o[v + y] - n;
  2907. let P = 0;
  2908. for (let R = 0; R < y; ++R) {
  2909. const k = g[R + 1], A = d[y - R];
  2910. h[y][R] = k + A;
  2911. const z = h[R][y - 1] / h[y][R];
  2912. h[R][y] = P + k * z, P = A * z;
  2913. }
  2914. h[y][y] = P;
  2915. }
  2916. for (let y = 0; y <= s; ++y)
  2917. p[0][y] = h[y][s];
  2918. for (let y = 0; y <= s; ++y) {
  2919. let P = 0, R = 1;
  2920. const k = [];
  2921. for (let A = 0; A <= s; ++A)
  2922. k[A] = c.slice(0);
  2923. k[0][0] = 1;
  2924. for (let A = 1; A <= r; ++A) {
  2925. let z = 0;
  2926. const F = y - A, I = s - A;
  2927. y >= A && (k[R][0] = k[P][0] / h[I + 1][F], z = k[R][0] * h[F][I]);
  2928. const D2 = F >= -1 ? 1 : -F, Y = y - 1 <= I ? A - 1 : s - y;
  2929. for (let G = D2; G <= Y; ++G)
  2930. k[R][G] = (k[P][G] - k[P][G - 1]) / h[I + 1][F + G], z += k[R][G] * h[F + G][I];
  2931. y <= I && (k[R][A] = -k[P][A - 1] / h[I + 1][y], z += k[R][A] * h[y][I]), p[A][y] = z;
  2932. var w = P;
  2933. P = R, R = w;
  2934. }
  2935. }
  2936. var _2 = s;
  2937. for (let y = 1; y <= r; ++y) {
  2938. for (let P = 0; P <= s; ++P)
  2939. p[y][P] *= _2;
  2940. _2 *= s - y;
  2941. }
  2942. return p;
  2943. }
  2944. function Zp(v, n, s, r, o) {
  2945. const c = o < v ? o : v, p = [], h = Qa(v, r, n), d = Qp(h, r, v, c, n), g = [];
  2946. for (let _2 = 0; _2 < s.length; ++_2) {
  2947. var w = s[_2].clone();
  2948. const y = w.w;
  2949. w.x *= y, w.y *= y, w.z *= y, g[_2] = w;
  2950. }
  2951. for (let _2 = 0; _2 <= c; ++_2) {
  2952. var w = g[h - v].clone().multiplyScalar(d[_2][0]);
  2953. for (let P = 1; P <= v; ++P)
  2954. w.add(g[h - v + P].clone().multiplyScalar(d[_2][P]));
  2955. p[_2] = w;
  2956. }
  2957. for (let _2 = c + 1; _2 <= o + 1; ++_2)
  2958. p[_2] = new Vector4(0, 0, 0);
  2959. return p;
  2960. }
  2961. function Wp(v, n) {
  2962. let s = 1;
  2963. for (let o = 2; o <= v; ++o)
  2964. s *= o;
  2965. let r = 1;
  2966. for (let o = 2; o <= n; ++o)
  2967. r *= o;
  2968. for (let o = 2; o <= v - n; ++o)
  2969. r *= o;
  2970. return s / r;
  2971. }
  2972. function Jp(v) {
  2973. const n = v.length, s = [], r = [];
  2974. for (let c = 0; c < n; ++c) {
  2975. const p = v[c];
  2976. s[c] = new Vector3(p.x, p.y, p.z), r[c] = p.w;
  2977. }
  2978. const o = [];
  2979. for (let c = 0; c < n; ++c) {
  2980. const p = s[c].clone();
  2981. for (let h = 1; h <= c; ++h)
  2982. p.sub(o[c - h].clone().multiplyScalar(Wp(c, h) * r[h]));
  2983. o[c] = p.divideScalar(r[0]);
  2984. }
  2985. return o;
  2986. }
  2987. function eh(v, n, s, r, o) {
  2988. const c = Zp(v, n, s, r, o);
  2989. return Jp(c);
  2990. }
  2991. var wa = class extends Curve {
  2992. constructor(n, s, r, o, c) {
  2993. super(), this.degree = n, this.knots = s, this.controlPoints = [], this.startKnot = o || 0, this.endKnot = c || this.knots.length - 1;
  2994. for (let p = 0; p < r.length; ++p) {
  2995. const h = r[p];
  2996. this.controlPoints[p] = new Vector4(h.x, h.y, h.z, h.w);
  2997. }
  2998. }
  2999. getPoint(n, s) {
  3000. const r = s || new Vector3(), o = this.knots[this.startKnot] + n * (this.knots[this.endKnot] - this.knots[this.startKnot]), c = qp(this.degree, this.knots, this.controlPoints, o);
  3001. return c.w != 1 && c.divideScalar(c.w), r.set(c.x, c.y, c.z);
  3002. }
  3003. getTangent(n, s) {
  3004. const r = s || new Vector3(), o = this.knots[0] + n * (this.knots[this.knots.length - 1] - this.knots[0]), c = eh(this.degree, this.knots, this.controlPoints, o, 1);
  3005. return r.copy(c[1]).normalize(), r;
  3006. }
  3007. };
  3008. var se;
  3009. var Ve;
  3010. var tt;
  3011. var th = class extends Loader {
  3012. constructor(n) {
  3013. super(n);
  3014. }
  3015. load(n, s, r, o) {
  3016. const c = this, p = c.path === "" ? LoaderUtils.extractUrlBase(n) : c.path, h = new FileLoader(this.manager);
  3017. h.setPath(c.path), h.setResponseType("arraybuffer"), h.setRequestHeader(c.requestHeader), h.setWithCredentials(c.withCredentials), h.load(n, function(d) {
  3018. try {
  3019. s(c.parse(d, p));
  3020. } catch (g) {
  3021. o ? o(g) : console.error(g), c.manager.itemError(n);
  3022. }
  3023. }, r, o);
  3024. }
  3025. parse(n, s) {
  3026. if (ah(n))
  3027. se = new oh().parse(n);
  3028. else {
  3029. const o = el(n);
  3030. if (!lh(o))
  3031. throw new Error("THREE.FBXLoader: Unknown format.");
  3032. if (xa(o) < 7e3)
  3033. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + xa(o));
  3034. se = new rh().parse(o);
  3035. }
  3036. const r = new TextureLoader(this.manager).setPath(this.resourcePath || s).setCrossOrigin(this.crossOrigin);
  3037. return new nh(r, this.manager).parse(se);
  3038. }
  3039. };
  3040. var nh = class {
  3041. constructor(n, s) {
  3042. this.textureLoader = n, this.manager = s;
  3043. }
  3044. parse() {
  3045. Ve = this.parseConnections();
  3046. const n = this.parseImages(), s = this.parseTextures(n), r = this.parseMaterials(s), o = this.parseDeformers(), c = new ih().parse(o);
  3047. return this.parseScene(o, c, r), tt;
  3048. }
  3049. // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
  3050. // and details the connection type
  3051. parseConnections() {
  3052. const n = /* @__PURE__ */ new Map();
  3053. return "Connections" in se && se.Connections.connections.forEach(function(r) {
  3054. const o = r[0], c = r[1], p = r[2];
  3055. n.has(o) || n.set(o, {
  3056. parents: [],
  3057. children: []
  3058. });
  3059. const h = {
  3060. ID: c,
  3061. relationship: p
  3062. };
  3063. n.get(o).parents.push(h), n.has(c) || n.set(c, {
  3064. parents: [],
  3065. children: []
  3066. });
  3067. const d = {
  3068. ID: o,
  3069. relationship: p
  3070. };
  3071. n.get(c).children.push(d);
  3072. }), n;
  3073. }
  3074. // Parse FBXTree.Objects.Video for embedded image data
  3075. // These images are connected to textures in FBXTree.Objects.Textures
  3076. // via FBXTree.Connections.
  3077. parseImages() {
  3078. const n = {}, s = {};
  3079. if ("Video" in se.Objects) {
  3080. const r = se.Objects.Video;
  3081. for (const o in r) {
  3082. const c = r[o], p = parseInt(o);
  3083. if (n[p] = c.RelativeFilename || c.Filename, "Content" in c) {
  3084. const h = c.Content instanceof ArrayBuffer && c.Content.byteLength > 0, d = typeof c.Content == "string" && c.Content !== "";
  3085. if (h || d) {
  3086. const g = this.parseImage(r[o]);
  3087. s[c.RelativeFilename || c.Filename] = g;
  3088. }
  3089. }
  3090. }
  3091. }
  3092. for (const r in n) {
  3093. const o = n[r];
  3094. s[o] !== void 0 ? n[r] = s[o] : n[r] = n[r].split("\\").pop();
  3095. }
  3096. return n;
  3097. }
  3098. // Parse embedded image data in FBXTree.Video.Content
  3099. parseImage(n) {
  3100. const s = n.Content, r = n.RelativeFilename || n.Filename, o = r.slice(r.lastIndexOf(".") + 1).toLowerCase();
  3101. let c;
  3102. switch (o) {
  3103. case "bmp":
  3104. c = "image/bmp";
  3105. break;
  3106. case "jpg":
  3107. case "jpeg":
  3108. c = "image/jpeg";
  3109. break;
  3110. case "png":
  3111. c = "image/png";
  3112. break;
  3113. case "tif":
  3114. c = "image/tiff";
  3115. break;
  3116. case "tga":
  3117. this.manager.getHandler(".tga") === null && console.warn("FBXLoader: TGA loader not found, skipping ", r), c = "image/tga";
  3118. break;
  3119. default:
  3120. console.warn('FBXLoader: Image type "' + o + '" is not supported.');
  3121. return;
  3122. }
  3123. if (typeof s == "string")
  3124. return "data:" + c + ";base64," + s;
  3125. {
  3126. const p = new Uint8Array(s);
  3127. return window.URL.createObjectURL(new Blob([p], {
  3128. type: c
  3129. }));
  3130. }
  3131. }
  3132. // Parse nodes in FBXTree.Objects.Texture
  3133. // These contain details such as UV scaling, cropping, rotation etc and are connected
  3134. // to images in FBXTree.Objects.Video
  3135. parseTextures(n) {
  3136. const s = /* @__PURE__ */ new Map();
  3137. if ("Texture" in se.Objects) {
  3138. const r = se.Objects.Texture;
  3139. for (const o in r) {
  3140. const c = this.parseTexture(r[o], n);
  3141. s.set(parseInt(o), c);
  3142. }
  3143. }
  3144. return s;
  3145. }
  3146. // Parse individual node in FBXTree.Objects.Texture
  3147. parseTexture(n, s) {
  3148. const r = this.loadTexture(n, s);
  3149. r.ID = n.id, r.name = n.attrName;
  3150. const o = n.WrapModeU, c = n.WrapModeV, p = o !== void 0 ? o.value : 0, h = c !== void 0 ? c.value : 0;
  3151. if (r.wrapS = p === 0 ? RepeatWrapping : ClampToEdgeWrapping, r.wrapT = h === 0 ? RepeatWrapping : ClampToEdgeWrapping, "Scaling" in n) {
  3152. const d = n.Scaling.value;
  3153. r.repeat.x = d[0], r.repeat.y = d[1];
  3154. }
  3155. return r;
  3156. }
  3157. // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
  3158. loadTexture(n, s) {
  3159. let r;
  3160. const o = this.textureLoader.path, c = Ve.get(n.id).children;
  3161. c !== void 0 && c.length > 0 && s[c[0].ID] !== void 0 && (r = s[c[0].ID], (r.indexOf("blob:") === 0 || r.indexOf("data:") === 0) && this.textureLoader.setPath(void 0));
  3162. let p;
  3163. const h = n.FileName.slice(-3).toLowerCase();
  3164. if (h === "tga") {
  3165. const d = this.manager.getHandler(".tga");
  3166. d === null ? (console.warn("FBXLoader: TGA loader not found, creating placeholder texture for", n.RelativeFilename), p = new Texture()) : (d.setPath(this.textureLoader.path), p = d.load(r));
  3167. } else
  3168. h === "psd" ? (console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for", n.RelativeFilename), p = new Texture()) : p = this.textureLoader.load(r);
  3169. return this.textureLoader.setPath(o), p;
  3170. }
  3171. // Parse nodes in FBXTree.Objects.Material
  3172. parseMaterials(n) {
  3173. const s = /* @__PURE__ */ new Map();
  3174. if ("Material" in se.Objects) {
  3175. const r = se.Objects.Material;
  3176. for (const o in r) {
  3177. const c = this.parseMaterial(r[o], n);
  3178. c !== null && s.set(parseInt(o), c);
  3179. }
  3180. }
  3181. return s;
  3182. }
  3183. // Parse single node in FBXTree.Objects.Material
  3184. // Materials are connected to texture maps in FBXTree.Objects.Textures
  3185. // FBX format currently only supports Lambert and Phong shading models
  3186. parseMaterial(n, s) {
  3187. const r = n.id, o = n.attrName;
  3188. let c = n.ShadingModel;
  3189. if (typeof c == "object" && (c = c.value), !Ve.has(r))
  3190. return null;
  3191. const p = this.parseParameters(n, s, r);
  3192. let h;
  3193. switch (c.toLowerCase()) {
  3194. case "phong":
  3195. h = new MeshPhongMaterial();
  3196. break;
  3197. case "lambert":
  3198. h = new MeshLambertMaterial();
  3199. break;
  3200. default:
  3201. console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', c), h = new MeshPhongMaterial();
  3202. break;
  3203. }
  3204. return h.setValues(p), h.name = o, h;
  3205. }
  3206. // Parse FBX material and return parameters suitable for a three.js material
  3207. // Also parse the texture map and return any textures associated with the material
  3208. parseParameters(n, s, r) {
  3209. const o = {};
  3210. n.BumpFactor && (o.bumpScale = n.BumpFactor.value), n.Diffuse ? o.color = new Color().fromArray(n.Diffuse.value) : n.DiffuseColor && (n.DiffuseColor.type === "Color" || n.DiffuseColor.type === "ColorRGB") && (o.color = new Color().fromArray(n.DiffuseColor.value)), n.DisplacementFactor && (o.displacementScale = n.DisplacementFactor.value), n.Emissive ? o.emissive = new Color().fromArray(n.Emissive.value) : n.EmissiveColor && (n.EmissiveColor.type === "Color" || n.EmissiveColor.type === "ColorRGB") && (o.emissive = new Color().fromArray(n.EmissiveColor.value)), n.EmissiveFactor && (o.emissiveIntensity = parseFloat(n.EmissiveFactor.value)), n.Opacity && (o.opacity = parseFloat(n.Opacity.value)), o.opacity < 1 && (o.transparent = true), n.ReflectionFactor && (o.reflectivity = n.ReflectionFactor.value), n.Shininess && (o.shininess = n.Shininess.value), n.Specular ? o.specular = new Color().fromArray(n.Specular.value) : n.SpecularColor && n.SpecularColor.type === "Color" && (o.specular = new Color().fromArray(n.SpecularColor.value));
  3211. const c = this;
  3212. return Ve.get(r).children.forEach(function(p) {
  3213. const h = p.relationship;
  3214. switch (h) {
  3215. case "Bump":
  3216. o.bumpMap = c.getTexture(s, p.ID);
  3217. break;
  3218. case "Maya|TEX_ao_map":
  3219. o.aoMap = c.getTexture(s, p.ID);
  3220. break;
  3221. case "DiffuseColor":
  3222. case "Maya|TEX_color_map":
  3223. o.map = c.getTexture(s, p.ID), o.map !== void 0 && (o.map.encoding = sRGBEncoding);
  3224. break;
  3225. case "DisplacementColor":
  3226. o.displacementMap = c.getTexture(s, p.ID);
  3227. break;
  3228. case "EmissiveColor":
  3229. o.emissiveMap = c.getTexture(s, p.ID), o.emissiveMap !== void 0 && (o.emissiveMap.encoding = sRGBEncoding);
  3230. break;
  3231. case "NormalMap":
  3232. case "Maya|TEX_normal_map":
  3233. o.normalMap = c.getTexture(s, p.ID);
  3234. break;
  3235. case "ReflectionColor":
  3236. o.envMap = c.getTexture(s, p.ID), o.envMap !== void 0 && (o.envMap.mapping = EquirectangularReflectionMapping, o.envMap.encoding = sRGBEncoding);
  3237. break;
  3238. case "SpecularColor":
  3239. o.specularMap = c.getTexture(s, p.ID), o.specularMap !== void 0 && (o.specularMap.encoding = sRGBEncoding);
  3240. break;
  3241. case "TransparentColor":
  3242. case "TransparencyFactor":
  3243. o.alphaMap = c.getTexture(s, p.ID), o.transparent = true;
  3244. break;
  3245. case "AmbientColor":
  3246. case "ShininessExponent":
  3247. case "SpecularFactor":
  3248. case "VectorDisplacementColor":
  3249. default:
  3250. console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", h);
  3251. break;
  3252. }
  3253. }), o;
  3254. }
  3255. // get a texture from the textureMap for use by a material.
  3256. getTexture(n, s) {
  3257. return "LayeredTexture" in se.Objects && s in se.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), s = Ve.get(s).children[0].ID), n.get(s);
  3258. }
  3259. // Parse nodes in FBXTree.Objects.Deformer
  3260. // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
  3261. // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
  3262. parseDeformers() {
  3263. const n = {}, s = {};
  3264. if ("Deformer" in se.Objects) {
  3265. const r = se.Objects.Deformer;
  3266. for (const o in r) {
  3267. const c = r[o], p = Ve.get(parseInt(o));
  3268. if (c.attrType === "Skin") {
  3269. const h = this.parseSkeleton(p, r);
  3270. h.ID = o, p.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), h.geometryID = p.parents[0].ID, n[o] = h;
  3271. } else if (c.attrType === "BlendShape") {
  3272. const h = {
  3273. id: o
  3274. };
  3275. h.rawTargets = this.parseMorphTargets(p, r), h.id = o, p.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), s[o] = h;
  3276. }
  3277. }
  3278. }
  3279. return {
  3280. skeletons: n,
  3281. morphTargets: s
  3282. };
  3283. }
  3284. // Parse single nodes in FBXTree.Objects.Deformer
  3285. // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
  3286. // Each skin node represents a skeleton and each cluster node represents a bone
  3287. parseSkeleton(n, s) {
  3288. const r = [];
  3289. return n.children.forEach(function(o) {
  3290. const c = s[o.ID];
  3291. if (c.attrType !== "Cluster")
  3292. return;
  3293. const p = {
  3294. ID: o.ID,
  3295. indices: [],
  3296. weights: [],
  3297. transformLink: new Matrix4().fromArray(c.TransformLink.a)
  3298. // transform: new Matrix4().fromArray( boneNode.Transform.a ),
  3299. // linkMode: boneNode.Mode,
  3300. };
  3301. "Indexes" in c && (p.indices = c.Indexes.a, p.weights = c.Weights.a), r.push(p);
  3302. }), {
  3303. rawBones: r,
  3304. bones: []
  3305. };
  3306. }
  3307. // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
  3308. parseMorphTargets(n, s) {
  3309. const r = [];
  3310. for (let o = 0; o < n.children.length; o++) {
  3311. const c = n.children[o], p = s[c.ID], h = {
  3312. name: p.attrName,
  3313. initialWeight: p.DeformPercent,
  3314. id: p.id,
  3315. fullWeights: p.FullWeights.a
  3316. };
  3317. if (p.attrType !== "BlendShapeChannel")
  3318. return;
  3319. h.geoID = Ve.get(parseInt(c.ID)).children.filter(function(d) {
  3320. return d.relationship === void 0;
  3321. })[0].ID, r.push(h);
  3322. }
  3323. return r;
  3324. }
  3325. // create the main Group() to be returned by the loader
  3326. parseScene(n, s, r) {
  3327. tt = new Group();
  3328. const o = this.parseModels(n.skeletons, s, r), c = se.Objects.Model, p = this;
  3329. o.forEach(function(d) {
  3330. const g = c[d.ID];
  3331. p.setLookAtProperties(d, g), Ve.get(d.ID).parents.forEach(function(_2) {
  3332. const y = o.get(_2.ID);
  3333. y !== void 0 && y.add(d);
  3334. }), d.parent === null && tt.add(d);
  3335. }), this.bindSkeleton(n.skeletons, s, o), this.createAmbientLight(), tt.traverse(function(d) {
  3336. if (d.userData.transformData) {
  3337. d.parent && (d.userData.transformData.parentMatrix = d.parent.matrix, d.userData.transformData.parentMatrixWorld = d.parent.matrixWorld);
  3338. const g = Wa(d.userData.transformData);
  3339. d.applyMatrix4(g), d.updateWorldMatrix();
  3340. }
  3341. });
  3342. const h = new sh().parse();
  3343. tt.children.length === 1 && tt.children[0].isGroup && (tt.children[0].animations = h, tt = tt.children[0]), tt.animations = h;
  3344. }
  3345. // parse nodes in FBXTree.Objects.Model
  3346. parseModels(n, s, r) {
  3347. const o = /* @__PURE__ */ new Map(), c = se.Objects.Model;
  3348. for (const p in c) {
  3349. const h = parseInt(p), d = c[p], g = Ve.get(h);
  3350. let w = this.buildSkeleton(g, n, h, d.attrName);
  3351. if (!w) {
  3352. switch (d.attrType) {
  3353. case "Camera":
  3354. w = this.createCamera(g);
  3355. break;
  3356. case "Light":
  3357. w = this.createLight(g);
  3358. break;
  3359. case "Mesh":
  3360. w = this.createMesh(g, s, r);
  3361. break;
  3362. case "NurbsCurve":
  3363. w = this.createCurve(g, s);
  3364. break;
  3365. case "LimbNode":
  3366. case "Root":
  3367. w = new Bone();
  3368. break;
  3369. case "Null":
  3370. default:
  3371. w = new Group();
  3372. break;
  3373. }
  3374. w.name = d.attrName ? PropertyBinding.sanitizeNodeName(d.attrName) : "", w.ID = h;
  3375. }
  3376. this.getTransformData(w, d), o.set(h, w);
  3377. }
  3378. return o;
  3379. }
  3380. buildSkeleton(n, s, r, o) {
  3381. let c = null;
  3382. return n.parents.forEach(function(p) {
  3383. for (const h in s) {
  3384. const d = s[h];
  3385. d.rawBones.forEach(function(g, w) {
  3386. if (g.ID === p.ID) {
  3387. const _2 = c;
  3388. c = new Bone(), c.matrixWorld.copy(g.transformLink), c.name = o ? PropertyBinding.sanitizeNodeName(o) : "", c.ID = r, d.bones[w] = c, _2 !== null && c.add(_2);
  3389. }
  3390. });
  3391. }
  3392. }), c;
  3393. }
  3394. // create a PerspectiveCamera or OrthographicCamera
  3395. createCamera(n) {
  3396. let s, r;
  3397. if (n.children.forEach(function(o) {
  3398. const c = se.Objects.NodeAttribute[o.ID];
  3399. c !== void 0 && (r = c);
  3400. }), r === void 0)
  3401. s = new Object3D();
  3402. else {
  3403. let o = 0;
  3404. r.CameraProjectionType !== void 0 && r.CameraProjectionType.value === 1 && (o = 1);
  3405. let c = 1;
  3406. r.NearPlane !== void 0 && (c = r.NearPlane.value / 1e3);
  3407. let p = 1e3;
  3408. r.FarPlane !== void 0 && (p = r.FarPlane.value / 1e3);
  3409. let h = window.innerWidth, d = window.innerHeight;
  3410. r.AspectWidth !== void 0 && r.AspectHeight !== void 0 && (h = r.AspectWidth.value, d = r.AspectHeight.value);
  3411. const g = h / d;
  3412. let w = 45;
  3413. r.FieldOfView !== void 0 && (w = r.FieldOfView.value);
  3414. const _2 = r.FocalLength ? r.FocalLength.value : null;
  3415. switch (o) {
  3416. case 0:
  3417. s = new PerspectiveCamera(w, g, c, p), _2 !== null && s.setFocalLength(_2);
  3418. break;
  3419. case 1:
  3420. s = new OrthographicCamera(-h / 2, h / 2, d / 2, -d / 2, c, p);
  3421. break;
  3422. default:
  3423. console.warn("THREE.FBXLoader: Unknown camera type " + o + "."), s = new Object3D();
  3424. break;
  3425. }
  3426. }
  3427. return s;
  3428. }
  3429. // Create a DirectionalLight, PointLight or SpotLight
  3430. createLight(n) {
  3431. let s, r;
  3432. if (n.children.forEach(function(o) {
  3433. const c = se.Objects.NodeAttribute[o.ID];
  3434. c !== void 0 && (r = c);
  3435. }), r === void 0)
  3436. s = new Object3D();
  3437. else {
  3438. let o;
  3439. r.LightType === void 0 ? o = 0 : o = r.LightType.value;
  3440. let c = 16777215;
  3441. r.Color !== void 0 && (c = new Color().fromArray(r.Color.value));
  3442. let p = r.Intensity === void 0 ? 1 : r.Intensity.value / 100;
  3443. r.CastLightOnObject !== void 0 && r.CastLightOnObject.value === 0 && (p = 0);
  3444. let h = 0;
  3445. r.FarAttenuationEnd !== void 0 && (r.EnableFarAttenuation !== void 0 && r.EnableFarAttenuation.value === 0 ? h = 0 : h = r.FarAttenuationEnd.value);
  3446. const d = 1;
  3447. switch (o) {
  3448. case 0:
  3449. s = new PointLight(c, p, h, d);
  3450. break;
  3451. case 1:
  3452. s = new DirectionalLight(c, p);
  3453. break;
  3454. case 2:
  3455. let g = Math.PI / 3;
  3456. r.InnerAngle !== void 0 && (g = MathUtils.degToRad(r.InnerAngle.value));
  3457. let w = 0;
  3458. r.OuterAngle !== void 0 && (w = MathUtils.degToRad(r.OuterAngle.value), w = Math.max(w, 1)), s = new SpotLight(c, p, h, g, w, d);
  3459. break;
  3460. default:
  3461. console.warn("THREE.FBXLoader: Unknown light type " + r.LightType.value + ", defaulting to a PointLight."), s = new PointLight(c, p);
  3462. break;
  3463. }
  3464. r.CastShadows !== void 0 && r.CastShadows.value === 1 && (s.castShadow = true);
  3465. }
  3466. return s;
  3467. }
  3468. createMesh(n, s, r) {
  3469. let o, c = null, p = null;
  3470. const h = [];
  3471. return n.children.forEach(function(d) {
  3472. s.has(d.ID) && (c = s.get(d.ID)), r.has(d.ID) && h.push(r.get(d.ID));
  3473. }), h.length > 1 ? p = h : h.length > 0 ? p = h[0] : (p = new MeshPhongMaterial({
  3474. color: 13421772
  3475. }), h.push(p)), "color" in c.attributes && h.forEach(function(d) {
  3476. d.vertexColors = true;
  3477. }), c.FBX_Deformer ? (o = new SkinnedMesh(c, p), o.normalizeSkinWeights()) : o = new Mesh(c, p), o;
  3478. }
  3479. createCurve(n, s) {
  3480. const r = n.children.reduce(function(c, p) {
  3481. return s.has(p.ID) && (c = s.get(p.ID)), c;
  3482. }, null), o = new LineBasicMaterial({
  3483. color: 3342591,
  3484. linewidth: 1
  3485. });
  3486. return new Line(r, o);
  3487. }
  3488. // parse the model node for transform data
  3489. getTransformData(n, s) {
  3490. const r = {};
  3491. "InheritType" in s && (r.inheritType = parseInt(s.InheritType.value)), "RotationOrder" in s ? r.eulerOrder = Ja(s.RotationOrder.value) : r.eulerOrder = "ZYX", "Lcl_Translation" in s && (r.translation = s.Lcl_Translation.value), "PreRotation" in s && (r.preRotation = s.PreRotation.value), "Lcl_Rotation" in s && (r.rotation = s.Lcl_Rotation.value), "PostRotation" in s && (r.postRotation = s.PostRotation.value), "Lcl_Scaling" in s && (r.scale = s.Lcl_Scaling.value), "ScalingOffset" in s && (r.scalingOffset = s.ScalingOffset.value), "ScalingPivot" in s && (r.scalingPivot = s.ScalingPivot.value), "RotationOffset" in s && (r.rotationOffset = s.RotationOffset.value), "RotationPivot" in s && (r.rotationPivot = s.RotationPivot.value), n.userData.transformData = r;
  3492. }
  3493. setLookAtProperties(n, s) {
  3494. "LookAtProperty" in s && Ve.get(n.ID).children.forEach(function(o) {
  3495. if (o.relationship === "LookAtProperty") {
  3496. const c = se.Objects.Model[o.ID];
  3497. if ("Lcl_Translation" in c) {
  3498. const p = c.Lcl_Translation.value;
  3499. n.target !== void 0 ? (n.target.position.fromArray(p), tt.add(n.target)) : n.lookAt(new Vector3().fromArray(p));
  3500. }
  3501. }
  3502. });
  3503. }
  3504. bindSkeleton(n, s, r) {
  3505. const o = this.parsePoseNodes();
  3506. for (const c in n) {
  3507. const p = n[c];
  3508. Ve.get(parseInt(p.ID)).parents.forEach(function(d) {
  3509. if (s.has(d.ID)) {
  3510. const g = d.ID;
  3511. Ve.get(g).parents.forEach(function(_2) {
  3512. r.has(_2.ID) && r.get(_2.ID).bind(new Skeleton(p.bones), o[_2.ID]);
  3513. });
  3514. }
  3515. });
  3516. }
  3517. }
  3518. parsePoseNodes() {
  3519. const n = {};
  3520. if ("Pose" in se.Objects) {
  3521. const s = se.Objects.Pose;
  3522. for (const r in s)
  3523. if (s[r].attrType === "BindPose" && s[r].NbPoseNodes > 0) {
  3524. const o = s[r].PoseNode;
  3525. Array.isArray(o) ? o.forEach(function(c) {
  3526. n[c.Node] = new Matrix4().fromArray(c.Matrix.a);
  3527. }) : n[o.Node] = new Matrix4().fromArray(o.Matrix.a);
  3528. }
  3529. }
  3530. return n;
  3531. }
  3532. // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
  3533. createAmbientLight() {
  3534. if ("GlobalSettings" in se && "AmbientColor" in se.GlobalSettings) {
  3535. const n = se.GlobalSettings.AmbientColor.value, s = n[0], r = n[1], o = n[2];
  3536. if (s !== 0 || r !== 0 || o !== 0) {
  3537. const c = new Color(s, r, o);
  3538. tt.add(new AmbientLight(c, 1));
  3539. }
  3540. }
  3541. }
  3542. };
  3543. var ih = class {
  3544. // Parse nodes in FBXTree.Objects.Geometry
  3545. parse(n) {
  3546. const s = /* @__PURE__ */ new Map();
  3547. if ("Geometry" in se.Objects) {
  3548. const r = se.Objects.Geometry;
  3549. for (const o in r) {
  3550. const c = Ve.get(parseInt(o)), p = this.parseGeometry(c, r[o], n);
  3551. s.set(parseInt(o), p);
  3552. }
  3553. }
  3554. return s;
  3555. }
  3556. // Parse single node in FBXTree.Objects.Geometry
  3557. parseGeometry(n, s, r) {
  3558. switch (s.attrType) {
  3559. case "Mesh":
  3560. return this.parseMeshGeometry(n, s, r);
  3561. case "NurbsCurve":
  3562. return this.parseNurbsGeometry(s);
  3563. }
  3564. }
  3565. // Parse single node mesh geometry in FBXTree.Objects.Geometry
  3566. parseMeshGeometry(n, s, r) {
  3567. const o = r.skeletons, c = [], p = n.parents.map(function(_2) {
  3568. return se.Objects.Model[_2.ID];
  3569. });
  3570. if (p.length === 0)
  3571. return;
  3572. const h = n.children.reduce(function(_2, y) {
  3573. return o[y.ID] !== void 0 && (_2 = o[y.ID]), _2;
  3574. }, null);
  3575. n.children.forEach(function(_2) {
  3576. r.morphTargets[_2.ID] !== void 0 && c.push(r.morphTargets[_2.ID]);
  3577. });
  3578. const d = p[0], g = {};
  3579. "RotationOrder" in d && (g.eulerOrder = Ja(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);
  3580. const w = Wa(g);
  3581. return this.genGeometry(s, h, c, w);
  3582. }
  3583. // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
  3584. genGeometry(n, s, r, o) {
  3585. const c = new BufferGeometry();
  3586. n.attrName && (c.name = n.attrName);
  3587. const p = this.parseGeoNode(n, s), h = this.genBuffers(p), d = new Float32BufferAttribute(h.vertex, 3);
  3588. if (d.applyMatrix4(o), c.setAttribute("position", d), h.colors.length > 0 && c.setAttribute("color", new Float32BufferAttribute(h.colors, 3)), s && (c.setAttribute("skinIndex", new Uint16BufferAttribute(h.weightsIndices, 4)), c.setAttribute("skinWeight", new Float32BufferAttribute(h.vertexWeights, 4)), c.FBX_Deformer = s), h.normal.length > 0) {
  3589. const g = new Matrix3().getNormalMatrix(o), w = new Float32BufferAttribute(h.normal, 3);
  3590. w.applyNormalMatrix(g), c.setAttribute("normal", w);
  3591. }
  3592. if (h.uvs.forEach(function(g, w) {
  3593. let _2 = "uv" + (w + 1).toString();
  3594. w === 0 && (_2 = "uv"), c.setAttribute(_2, new Float32BufferAttribute(h.uvs[w], 2));
  3595. }), p.material && p.material.mappingType !== "AllSame") {
  3596. let g = h.materialIndex[0], w = 0;
  3597. if (h.materialIndex.forEach(function(_2, y) {
  3598. _2 !== g && (c.addGroup(w, y - w, g), g = _2, w = y);
  3599. }), c.groups.length > 0) {
  3600. const _2 = c.groups[c.groups.length - 1], y = _2.start + _2.count;
  3601. y !== h.materialIndex.length && c.addGroup(y, h.materialIndex.length - y, g);
  3602. }
  3603. c.groups.length === 0 && c.addGroup(0, h.materialIndex.length, h.materialIndex[0]);
  3604. }
  3605. return this.addMorphTargets(c, n, r, o), c;
  3606. }
  3607. parseGeoNode(n, s) {
  3608. const r = {};
  3609. if (r.vertexPositions = n.Vertices !== void 0 ? n.Vertices.a : [], r.vertexIndices = n.PolygonVertexIndex !== void 0 ? n.PolygonVertexIndex.a : [], n.LayerElementColor && (r.color = this.parseVertexColors(n.LayerElementColor[0])), n.LayerElementMaterial && (r.material = this.parseMaterialIndices(n.LayerElementMaterial[0])), n.LayerElementNormal && (r.normal = this.parseNormals(n.LayerElementNormal[0])), n.LayerElementUV) {
  3610. r.uv = [];
  3611. let o = 0;
  3612. for (; n.LayerElementUV[o]; )
  3613. n.LayerElementUV[o].UV && r.uv.push(this.parseUVs(n.LayerElementUV[o])), o++;
  3614. }
  3615. return r.weightTable = {}, s !== null && (r.skeleton = s, s.rawBones.forEach(function(o, c) {
  3616. o.indices.forEach(function(p, h) {
  3617. r.weightTable[p] === void 0 && (r.weightTable[p] = []), r.weightTable[p].push({
  3618. id: c,
  3619. weight: o.weights[h]
  3620. });
  3621. });
  3622. })), r;
  3623. }
  3624. genBuffers(n) {
  3625. const s = {
  3626. vertex: [],
  3627. normal: [],
  3628. colors: [],
  3629. uvs: [],
  3630. materialIndex: [],
  3631. vertexWeights: [],
  3632. weightsIndices: []
  3633. };
  3634. let r = 0, o = 0, c = false, p = [], h = [], d = [], g = [], w = [], _2 = [];
  3635. const y = this;
  3636. return n.vertexIndices.forEach(function(P, R) {
  3637. let k, A = false;
  3638. P < 0 && (P = P ^ -1, A = true);
  3639. let z = [], F = [];
  3640. if (p.push(P * 3, P * 3 + 1, P * 3 + 2), n.color) {
  3641. const I = Ns(R, r, P, n.color);
  3642. d.push(I[0], I[1], I[2]);
  3643. }
  3644. if (n.skeleton) {
  3645. if (n.weightTable[P] !== void 0 && n.weightTable[P].forEach(function(I) {
  3646. F.push(I.weight), z.push(I.id);
  3647. }), F.length > 4) {
  3648. c || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), c = true);
  3649. const I = [0, 0, 0, 0], D2 = [0, 0, 0, 0];
  3650. F.forEach(function(Y, G) {
  3651. let N = Y, O = z[G];
  3652. D2.forEach(function(H, K, q) {
  3653. if (N > H) {
  3654. q[K] = N, N = H;
  3655. const pe = I[K];
  3656. I[K] = O, O = pe;
  3657. }
  3658. });
  3659. }), z = I, F = D2;
  3660. }
  3661. for (; F.length < 4; )
  3662. F.push(0), z.push(0);
  3663. for (let I = 0; I < 4; ++I)
  3664. w.push(F[I]), _2.push(z[I]);
  3665. }
  3666. if (n.normal) {
  3667. const I = Ns(R, r, P, n.normal);
  3668. h.push(I[0], I[1], I[2]);
  3669. }
  3670. n.material && n.material.mappingType !== "AllSame" && (k = Ns(R, r, P, n.material)[0]), n.uv && n.uv.forEach(function(I, D2) {
  3671. const Y = Ns(R, r, P, I);
  3672. g[D2] === void 0 && (g[D2] = []), g[D2].push(Y[0]), g[D2].push(Y[1]);
  3673. }), o++, A && (y.genFace(s, n, p, k, h, d, g, w, _2, o), r++, o = 0, p = [], h = [], d = [], g = [], w = [], _2 = []);
  3674. }), s;
  3675. }
  3676. // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
  3677. genFace(n, s, r, o, c, p, h, d, g, w) {
  3678. for (let _2 = 2; _2 < w; _2++)
  3679. n.vertex.push(s.vertexPositions[r[0]]), n.vertex.push(s.vertexPositions[r[1]]), n.vertex.push(s.vertexPositions[r[2]]), n.vertex.push(s.vertexPositions[r[(_2 - 1) * 3]]), n.vertex.push(s.vertexPositions[r[(_2 - 1) * 3 + 1]]), n.vertex.push(s.vertexPositions[r[(_2 - 1) * 3 + 2]]), n.vertex.push(s.vertexPositions[r[_2 * 3]]), n.vertex.push(s.vertexPositions[r[_2 * 3 + 1]]), n.vertex.push(s.vertexPositions[r[_2 * 3 + 2]]), s.skeleton && (n.vertexWeights.push(d[0]), n.vertexWeights.push(d[1]), n.vertexWeights.push(d[2]), n.vertexWeights.push(d[3]), n.vertexWeights.push(d[(_2 - 1) * 4]), n.vertexWeights.push(d[(_2 - 1) * 4 + 1]), n.vertexWeights.push(d[(_2 - 1) * 4 + 2]), n.vertexWeights.push(d[(_2 - 1) * 4 + 3]), n.vertexWeights.push(d[_2 * 4]), n.vertexWeights.push(d[_2 * 4 + 1]), n.vertexWeights.push(d[_2 * 4 + 2]), n.vertexWeights.push(d[_2 * 4 + 3]), n.weightsIndices.push(g[0]), n.weightsIndices.push(g[1]), n.weightsIndices.push(g[2]), n.weightsIndices.push(g[3]), n.weightsIndices.push(g[(_2 - 1) * 4]), n.weightsIndices.push(g[(_2 - 1) * 4 + 1]), n.weightsIndices.push(g[(_2 - 1) * 4 + 2]), n.weightsIndices.push(g[(_2 - 1) * 4 + 3]), n.weightsIndices.push(g[_2 * 4]), n.weightsIndices.push(g[_2 * 4 + 1]), n.weightsIndices.push(g[_2 * 4 + 2]), n.weightsIndices.push(g[_2 * 4 + 3])), s.color && (n.colors.push(p[0]), n.colors.push(p[1]), n.colors.push(p[2]), n.colors.push(p[(_2 - 1) * 3]), n.colors.push(p[(_2 - 1) * 3 + 1]), n.colors.push(p[(_2 - 1) * 3 + 2]), n.colors.push(p[_2 * 3]), n.colors.push(p[_2 * 3 + 1]), n.colors.push(p[_2 * 3 + 2])), s.material && s.material.mappingType !== "AllSame" && (n.materialIndex.push(o), n.materialIndex.push(o), n.materialIndex.push(o)), s.normal && (n.normal.push(c[0]), n.normal.push(c[1]), n.normal.push(c[2]), n.normal.push(c[(_2 - 1) * 3]), n.normal.push(c[(_2 - 1) * 3 + 1]), n.normal.push(c[(_2 - 1) * 3 + 2]), n.normal.push(c[_2 * 3]), n.normal.push(c[_2 * 3 + 1]), n.normal.push(c[_2 * 3 + 2])), s.uv && s.uv.forEach(function(y, P) {
  3680. n.uvs[P] === void 0 && (n.uvs[P] = []), n.uvs[P].push(h[P][0]), n.uvs[P].push(h[P][1]), n.uvs[P].push(h[P][(_2 - 1) * 2]), n.uvs[P].push(h[P][(_2 - 1) * 2 + 1]), n.uvs[P].push(h[P][_2 * 2]), n.uvs[P].push(h[P][_2 * 2 + 1]);
  3681. });
  3682. }
  3683. addMorphTargets(n, s, r, o) {
  3684. if (r.length === 0)
  3685. return;
  3686. n.morphTargetsRelative = true, n.morphAttributes.position = [];
  3687. const c = this;
  3688. r.forEach(function(p) {
  3689. p.rawTargets.forEach(function(h) {
  3690. const d = se.Objects.Geometry[h.geoID];
  3691. d !== void 0 && c.genMorphGeometry(n, s, d, o, h.name);
  3692. });
  3693. });
  3694. }
  3695. // a morph geometry node is similar to a standard node, and the node is also contained
  3696. // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
  3697. // and a special attribute Index defining which vertices of the original geometry are affected
  3698. // Normal and position attributes only have data for the vertices that are affected by the morph
  3699. genMorphGeometry(n, s, r, o, c) {
  3700. const p = s.PolygonVertexIndex !== void 0 ? s.PolygonVertexIndex.a : [], h = r.Vertices !== void 0 ? r.Vertices.a : [], d = r.Indexes !== void 0 ? r.Indexes.a : [], g = n.attributes.position.count * 3, w = new Float32Array(g);
  3701. for (let R = 0; R < d.length; R++) {
  3702. const k = d[R] * 3;
  3703. w[k] = h[R * 3], w[k + 1] = h[R * 3 + 1], w[k + 2] = h[R * 3 + 2];
  3704. }
  3705. const _2 = {
  3706. vertexIndices: p,
  3707. vertexPositions: w
  3708. }, y = this.genBuffers(_2), P = new Float32BufferAttribute(y.vertex, 3);
  3709. P.name = c || r.attrName, P.applyMatrix4(o), n.morphAttributes.position.push(P);
  3710. }
  3711. // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
  3712. parseNormals(n) {
  3713. const s = n.MappingInformationType, r = n.ReferenceInformationType, o = n.Normals.a;
  3714. let c = [];
  3715. return r === "IndexToDirect" && ("NormalIndex" in n ? c = n.NormalIndex.a : "NormalsIndex" in n && (c = n.NormalsIndex.a)), {
  3716. dataSize: 3,
  3717. buffer: o,
  3718. indices: c,
  3719. mappingType: s,
  3720. referenceType: r
  3721. };
  3722. }
  3723. // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
  3724. parseUVs(n) {
  3725. const s = n.MappingInformationType, r = n.ReferenceInformationType, o = n.UV.a;
  3726. let c = [];
  3727. return r === "IndexToDirect" && (c = n.UVIndex.a), {
  3728. dataSize: 2,
  3729. buffer: o,
  3730. indices: c,
  3731. mappingType: s,
  3732. referenceType: r
  3733. };
  3734. }
  3735. // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
  3736. parseVertexColors(n) {
  3737. const s = n.MappingInformationType, r = n.ReferenceInformationType, o = n.Colors.a;
  3738. let c = [];
  3739. return r === "IndexToDirect" && (c = n.ColorIndex.a), {
  3740. dataSize: 4,
  3741. buffer: o,
  3742. indices: c,
  3743. mappingType: s,
  3744. referenceType: r
  3745. };
  3746. }
  3747. // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
  3748. parseMaterialIndices(n) {
  3749. const s = n.MappingInformationType, r = n.ReferenceInformationType;
  3750. if (s === "NoMappingInformation")
  3751. return {
  3752. dataSize: 1,
  3753. buffer: [0],
  3754. indices: [0],
  3755. mappingType: "AllSame",
  3756. referenceType: r
  3757. };
  3758. const o = n.Materials.a, c = [];
  3759. for (let p = 0; p < o.length; ++p)
  3760. c.push(p);
  3761. return {
  3762. dataSize: 1,
  3763. buffer: o,
  3764. indices: c,
  3765. mappingType: s,
  3766. referenceType: r
  3767. };
  3768. }
  3769. // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
  3770. parseNurbsGeometry(n) {
  3771. if (wa === void 0)
  3772. 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();
  3773. const s = parseInt(n.Order);
  3774. if (isNaN(s))
  3775. return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", n.Order, n.id), new BufferGeometry();
  3776. const r = s - 1, o = n.KnotVector.a, c = [], p = n.Points.a;
  3777. for (let _2 = 0, y = p.length; _2 < y; _2 += 4)
  3778. c.push(new Vector4().fromArray(p, _2));
  3779. let h, d;
  3780. if (n.Form === "Closed")
  3781. c.push(c[0]);
  3782. else if (n.Form === "Periodic") {
  3783. h = r, d = o.length - 1 - h;
  3784. for (let _2 = 0; _2 < r; ++_2)
  3785. c.push(c[_2]);
  3786. }
  3787. const w = new wa(r, o, c, h, d).getPoints(c.length * 12);
  3788. return new BufferGeometry().setFromPoints(w);
  3789. }
  3790. };
  3791. var sh = class {
  3792. // take raw animation clips and turn them into three.js animation clips
  3793. parse() {
  3794. const n = [], s = this.parseClips();
  3795. if (s !== void 0)
  3796. for (const r in s) {
  3797. const o = s[r], c = this.addClip(o);
  3798. n.push(c);
  3799. }
  3800. return n;
  3801. }
  3802. parseClips() {
  3803. if (se.Objects.AnimationCurve === void 0)
  3804. return;
  3805. const n = this.parseAnimationCurveNodes();
  3806. this.parseAnimationCurves(n);
  3807. const s = this.parseAnimationLayers(n);
  3808. return this.parseAnimStacks(s);
  3809. }
  3810. // parse nodes in FBXTree.Objects.AnimationCurveNode
  3811. // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
  3812. // and is referenced by an AnimationLayer
  3813. parseAnimationCurveNodes() {
  3814. const n = se.Objects.AnimationCurveNode, s = /* @__PURE__ */ new Map();
  3815. for (const r in n) {
  3816. const o = n[r];
  3817. if (o.attrName.match(/S|R|T|DeformPercent/) !== null) {
  3818. const c = {
  3819. id: o.id,
  3820. attr: o.attrName,
  3821. curves: {}
  3822. };
  3823. s.set(c.id, c);
  3824. }
  3825. }
  3826. return s;
  3827. }
  3828. // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
  3829. // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
  3830. // axis ( e.g. times and values of x rotation)
  3831. parseAnimationCurves(n) {
  3832. const s = se.Objects.AnimationCurve;
  3833. for (const r in s) {
  3834. const o = {
  3835. id: s[r].id,
  3836. times: s[r].KeyTime.a.map(ch),
  3837. values: s[r].KeyValueFloat.a
  3838. }, c = Ve.get(o.id);
  3839. if (c !== void 0) {
  3840. const p = c.parents[0].ID, h = c.parents[0].relationship;
  3841. h.match(/X/) ? n.get(p).curves.x = o : h.match(/Y/) ? n.get(p).curves.y = o : h.match(/Z/) ? n.get(p).curves.z = o : h.match(/d|DeformPercent/) && n.has(p) && (n.get(p).curves.morph = o);
  3842. }
  3843. }
  3844. }
  3845. // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
  3846. // to various AnimationCurveNodes and is referenced by an AnimationStack node
  3847. // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
  3848. parseAnimationLayers(n) {
  3849. const s = se.Objects.AnimationLayer, r = /* @__PURE__ */ new Map();
  3850. for (const o in s) {
  3851. const c = [], p = Ve.get(parseInt(o));
  3852. p !== void 0 && (p.children.forEach(function(d, g) {
  3853. if (n.has(d.ID)) {
  3854. const w = n.get(d.ID);
  3855. if (w.curves.x !== void 0 || w.curves.y !== void 0 || w.curves.z !== void 0) {
  3856. if (c[g] === void 0) {
  3857. const _2 = Ve.get(d.ID).parents.filter(function(y) {
  3858. return y.relationship !== void 0;
  3859. })[0].ID;
  3860. if (_2 !== void 0) {
  3861. const y = se.Objects.Model[_2.toString()];
  3862. if (y === void 0) {
  3863. console.warn("THREE.FBXLoader: Encountered a unused curve.", d);
  3864. return;
  3865. }
  3866. const P = {
  3867. modelName: y.attrName ? PropertyBinding.sanitizeNodeName(y.attrName) : "",
  3868. ID: y.id,
  3869. initialPosition: [0, 0, 0],
  3870. initialRotation: [0, 0, 0],
  3871. initialScale: [1, 1, 1]
  3872. };
  3873. tt.traverse(function(R) {
  3874. R.ID === y.id && (P.transform = R.matrix, R.userData.transformData && (P.eulerOrder = R.userData.transformData.eulerOrder));
  3875. }), P.transform || (P.transform = new Matrix4()), "PreRotation" in y && (P.preRotation = y.PreRotation.value), "PostRotation" in y && (P.postRotation = y.PostRotation.value), c[g] = P;
  3876. }
  3877. }
  3878. c[g] && (c[g][w.attr] = w);
  3879. } else if (w.curves.morph !== void 0) {
  3880. if (c[g] === void 0) {
  3881. const _2 = Ve.get(d.ID).parents.filter(function(z) {
  3882. return z.relationship !== void 0;
  3883. })[0].ID, y = Ve.get(_2).parents[0].ID, P = Ve.get(y).parents[0].ID, R = Ve.get(P).parents[0].ID, k = se.Objects.Model[R], A = {
  3884. modelName: k.attrName ? PropertyBinding.sanitizeNodeName(k.attrName) : "",
  3885. morphName: se.Objects.Deformer[_2].attrName
  3886. };
  3887. c[g] = A;
  3888. }
  3889. c[g][w.attr] = w;
  3890. }
  3891. }
  3892. }), r.set(parseInt(o), c));
  3893. }
  3894. return r;
  3895. }
  3896. // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
  3897. // hierarchy. Each Stack node will be used to create a AnimationClip
  3898. parseAnimStacks(n) {
  3899. const s = se.Objects.AnimationStack, r = {};
  3900. for (const o in s) {
  3901. const c = Ve.get(parseInt(o)).children;
  3902. c.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
  3903. const p = n.get(c[0].ID);
  3904. r[o] = {
  3905. name: s[o].attrName,
  3906. layer: p
  3907. };
  3908. }
  3909. return r;
  3910. }
  3911. addClip(n) {
  3912. let s = [];
  3913. const r = this;
  3914. return n.layer.forEach(function(o) {
  3915. s = s.concat(r.generateTracks(o));
  3916. }), new AnimationClip(n.name, -1, s);
  3917. }
  3918. generateTracks(n) {
  3919. const s = [];
  3920. let r = new Vector3(), o = new Quaternion(), c = new Vector3();
  3921. if (n.transform && n.transform.decompose(r, o, c), r = r.toArray(), o = new Euler().setFromQuaternion(o, n.eulerOrder).toArray(), c = c.toArray(), n.T !== void 0 && Object.keys(n.T.curves).length > 0) {
  3922. const p = this.generateVectorTrack(n.modelName, n.T.curves, r, "position");
  3923. p !== void 0 && s.push(p);
  3924. }
  3925. if (n.R !== void 0 && Object.keys(n.R.curves).length > 0) {
  3926. const p = this.generateRotationTrack(n.modelName, n.R.curves, o, n.preRotation, n.postRotation, n.eulerOrder);
  3927. p !== void 0 && s.push(p);
  3928. }
  3929. if (n.S !== void 0 && Object.keys(n.S.curves).length > 0) {
  3930. const p = this.generateVectorTrack(n.modelName, n.S.curves, c, "scale");
  3931. p !== void 0 && s.push(p);
  3932. }
  3933. if (n.DeformPercent !== void 0) {
  3934. const p = this.generateMorphTrack(n);
  3935. p !== void 0 && s.push(p);
  3936. }
  3937. return s;
  3938. }
  3939. generateVectorTrack(n, s, r, o) {
  3940. const c = this.getTimesForAllAxes(s), p = this.getKeyframeTrackValues(c, s, r);
  3941. return new VectorKeyframeTrack(n + "." + o, c, p);
  3942. }
  3943. generateRotationTrack(n, s, r, o, c, p) {
  3944. s.x !== void 0 && (this.interpolateRotations(s.x), s.x.values = s.x.values.map(MathUtils.degToRad)), s.y !== void 0 && (this.interpolateRotations(s.y), s.y.values = s.y.values.map(MathUtils.degToRad)), s.z !== void 0 && (this.interpolateRotations(s.z), s.z.values = s.z.values.map(MathUtils.degToRad));
  3945. const h = this.getTimesForAllAxes(s), d = this.getKeyframeTrackValues(h, s, r);
  3946. o !== void 0 && (o = o.map(MathUtils.degToRad), o.push(p), o = new Euler().fromArray(o), o = new Quaternion().setFromEuler(o)), c !== void 0 && (c = c.map(MathUtils.degToRad), c.push(p), c = new Euler().fromArray(c), c = new Quaternion().setFromEuler(c).invert());
  3947. const g = new Quaternion(), w = new Euler(), _2 = [];
  3948. for (let y = 0; y < d.length; y += 3)
  3949. w.set(d[y], d[y + 1], d[y + 2], p), g.setFromEuler(w), o !== void 0 && g.premultiply(o), c !== void 0 && g.multiply(c), g.toArray(_2, y / 3 * 4);
  3950. return new QuaternionKeyframeTrack(n + ".quaternion", h, _2);
  3951. }
  3952. generateMorphTrack(n) {
  3953. const s = n.DeformPercent.curves.morph, r = s.values.map(function(c) {
  3954. return c / 100;
  3955. }), o = tt.getObjectByName(n.modelName).morphTargetDictionary[n.morphName];
  3956. return new NumberKeyframeTrack(n.modelName + ".morphTargetInfluences[" + o + "]", s.times, r);
  3957. }
  3958. // For all animated objects, times are defined separately for each axis
  3959. // Here we'll combine the times into one sorted array without duplicates
  3960. getTimesForAllAxes(n) {
  3961. let s = [];
  3962. if (n.x !== void 0 && (s = s.concat(n.x.times)), n.y !== void 0 && (s = s.concat(n.y.times)), n.z !== void 0 && (s = s.concat(n.z.times)), s = s.sort(function(r, o) {
  3963. return r - o;
  3964. }), s.length > 1) {
  3965. let r = 1, o = s[0];
  3966. for (let c = 1; c < s.length; c++) {
  3967. const p = s[c];
  3968. p !== o && (s[r] = p, o = p, r++);
  3969. }
  3970. s = s.slice(0, r);
  3971. }
  3972. return s;
  3973. }
  3974. getKeyframeTrackValues(n, s, r) {
  3975. const o = r, c = [];
  3976. let p = -1, h = -1, d = -1;
  3977. return n.forEach(function(g) {
  3978. if (s.x && (p = s.x.times.indexOf(g)), s.y && (h = s.y.times.indexOf(g)), s.z && (d = s.z.times.indexOf(g)), p !== -1) {
  3979. const w = s.x.values[p];
  3980. c.push(w), o[0] = w;
  3981. } else
  3982. c.push(o[0]);
  3983. if (h !== -1) {
  3984. const w = s.y.values[h];
  3985. c.push(w), o[1] = w;
  3986. } else
  3987. c.push(o[1]);
  3988. if (d !== -1) {
  3989. const w = s.z.values[d];
  3990. c.push(w), o[2] = w;
  3991. } else
  3992. c.push(o[2]);
  3993. }), c;
  3994. }
  3995. // Rotations are defined as Euler angles which can have values of any size
  3996. // These will be converted to quaternions which don't support values greater than
  3997. // PI, so we'll interpolate large rotations
  3998. interpolateRotations(n) {
  3999. for (let s = 1; s < n.values.length; s++) {
  4000. const r = n.values[s - 1], o = n.values[s] - r, c = Math.abs(o);
  4001. if (c >= 180) {
  4002. const p = c / 180, h = o / p;
  4003. let d = r + h;
  4004. const g = n.times[s - 1], _2 = (n.times[s] - g) / p;
  4005. let y = g + _2;
  4006. const P = [], R = [];
  4007. for (; y < n.times[s]; )
  4008. P.push(y), y += _2, R.push(d), d += h;
  4009. n.times = Ea(n.times, s, P), n.values = Ea(n.values, s, R);
  4010. }
  4011. }
  4012. }
  4013. };
  4014. var rh = class {
  4015. getPrevNode() {
  4016. return this.nodeStack[this.currentIndent - 2];
  4017. }
  4018. getCurrentNode() {
  4019. return this.nodeStack[this.currentIndent - 1];
  4020. }
  4021. getCurrentProp() {
  4022. return this.currentProp;
  4023. }
  4024. pushStack(n) {
  4025. this.nodeStack.push(n), this.currentIndent += 1;
  4026. }
  4027. popStack() {
  4028. this.nodeStack.pop(), this.currentIndent -= 1;
  4029. }
  4030. setCurrentProp(n, s) {
  4031. this.currentProp = n, this.currentPropName = s;
  4032. }
  4033. parse(n) {
  4034. this.currentIndent = 0, this.allNodes = new Za(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
  4035. const s = this, r = n.split(/[\r\n]+/);
  4036. return r.forEach(function(o, c) {
  4037. const p = o.match(/^[\s\t]*;/), h = o.match(/^[\s\t]*$/);
  4038. if (p || h)
  4039. return;
  4040. const d = o.match("^\\t{" + s.currentIndent + "}(\\w+):(.*){", ""), g = o.match("^\\t{" + s.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"), w = o.match("^\\t{" + (s.currentIndent - 1) + "}}");
  4041. d ? s.parseNodeBegin(o, d) : g ? s.parseNodeProperty(o, g, r[++c]) : w ? s.popStack() : o.match(/^[^\s\t}]/) && s.parseNodePropertyContinued(o);
  4042. }), this.allNodes;
  4043. }
  4044. parseNodeBegin(n, s) {
  4045. const r = s[1].trim().replace(/^"/, "").replace(/"$/, ""), o = s[2].split(",").map(function(d) {
  4046. return d.trim().replace(/^"/, "").replace(/"$/, "");
  4047. }), c = {
  4048. name: r
  4049. }, p = this.parseNodeAttr(o), h = this.getCurrentNode();
  4050. this.currentIndent === 0 ? this.allNodes.add(r, c) : r in h ? (r === "PoseNode" ? h.PoseNode.push(c) : h[r].id !== void 0 && (h[r] = {}, h[r][h[r].id] = h[r]), p.id !== "" && (h[r][p.id] = c)) : typeof p.id == "number" ? (h[r] = {}, h[r][p.id] = c) : r !== "Properties70" && (r === "PoseNode" ? h[r] = [c] : h[r] = c), typeof p.id == "number" && (c.id = p.id), p.name !== "" && (c.attrName = p.name), p.type !== "" && (c.attrType = p.type), this.pushStack(c);
  4051. }
  4052. parseNodeAttr(n) {
  4053. let s = n[0];
  4054. n[0] !== "" && (s = parseInt(n[0]), isNaN(s) && (s = n[0]));
  4055. let r = "", o = "";
  4056. return n.length > 1 && (r = n[1].replace(/^(\w+)::/, ""), o = n[2]), {
  4057. id: s,
  4058. name: r,
  4059. type: o
  4060. };
  4061. }
  4062. parseNodeProperty(n, s, r) {
  4063. let o = s[1].replace(/^"/, "").replace(/"$/, "").trim(), c = s[2].replace(/^"/, "").replace(/"$/, "").trim();
  4064. o === "Content" && c === "," && (c = r.replace(/"/g, "").replace(/,$/, "").trim());
  4065. const p = this.getCurrentNode();
  4066. if (p.name === "Properties70") {
  4067. this.parseNodeSpecialProperty(n, o, c);
  4068. return;
  4069. }
  4070. if (o === "C") {
  4071. const d = c.split(",").slice(1), g = parseInt(d[0]), w = parseInt(d[1]);
  4072. let _2 = c.split(",").slice(3);
  4073. _2 = _2.map(function(y) {
  4074. return y.trim().replace(/^"/, "");
  4075. }), o = "connections", c = [g, w], ph(c, _2), p[o] === void 0 && (p[o] = []);
  4076. }
  4077. o === "Node" && (p.id = c), o in p && Array.isArray(p[o]) ? p[o].push(c) : o !== "a" ? p[o] = c : p.a = c, this.setCurrentProp(p, o), o === "a" && c.slice(-1) !== "," && (p.a = ao(c));
  4078. }
  4079. parseNodePropertyContinued(n) {
  4080. const s = this.getCurrentNode();
  4081. s.a += n, n.slice(-1) !== "," && (s.a = ao(s.a));
  4082. }
  4083. // parse "Property70"
  4084. parseNodeSpecialProperty(n, s, r) {
  4085. const o = r.split('",').map(function(w) {
  4086. return w.trim().replace(/^\"/, "").replace(/\s/, "_");
  4087. }), c = o[0], p = o[1], h = o[2], d = o[3];
  4088. let g = o[4];
  4089. switch (p) {
  4090. case "int":
  4091. case "enum":
  4092. case "bool":
  4093. case "ULongLong":
  4094. case "double":
  4095. case "Number":
  4096. case "FieldOfView":
  4097. g = parseFloat(g);
  4098. break;
  4099. case "Color":
  4100. case "ColorRGB":
  4101. case "Vector3D":
  4102. case "Lcl_Translation":
  4103. case "Lcl_Rotation":
  4104. case "Lcl_Scaling":
  4105. g = ao(g);
  4106. break;
  4107. }
  4108. this.getPrevNode()[c] = {
  4109. type: p,
  4110. type2: h,
  4111. flag: d,
  4112. value: g
  4113. }, this.setCurrentProp(this.getPrevNode(), c);
  4114. }
  4115. };
  4116. var oh = class {
  4117. parse(n) {
  4118. const s = new ya(n);
  4119. s.skip(23);
  4120. const r = s.getUint32();
  4121. if (r < 6400)
  4122. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + r);
  4123. const o = new Za();
  4124. for (; !this.endOfContent(s); ) {
  4125. const c = this.parseNode(s, r);
  4126. c !== null && o.add(c.name, c);
  4127. }
  4128. return o;
  4129. }
  4130. // Check if reader has reached the end of content.
  4131. endOfContent(n) {
  4132. return n.size() % 16 === 0 ? (n.getOffset() + 160 + 16 & -16) >= n.size() : n.getOffset() + 160 + 16 >= n.size();
  4133. }
  4134. // recursively parse nodes until the end of the file is reached
  4135. parseNode(n, s) {
  4136. const r = {}, o = s >= 7500 ? n.getUint64() : n.getUint32(), c = s >= 7500 ? n.getUint64() : n.getUint32();
  4137. s >= 7500 ? n.getUint64() : n.getUint32();
  4138. const p = n.getUint8(), h = n.getString(p);
  4139. if (o === 0)
  4140. return null;
  4141. const d = [];
  4142. for (let y = 0; y < c; y++)
  4143. d.push(this.parseProperty(n));
  4144. const g = d.length > 0 ? d[0] : "", w = d.length > 1 ? d[1] : "", _2 = d.length > 2 ? d[2] : "";
  4145. for (r.singleProperty = c === 1 && n.getOffset() === o; o > n.getOffset(); ) {
  4146. const y = this.parseNode(n, s);
  4147. y !== null && this.parseSubNode(h, r, y);
  4148. }
  4149. return r.propertyList = d, typeof g == "number" && (r.id = g), w !== "" && (r.attrName = w), _2 !== "" && (r.attrType = _2), h !== "" && (r.name = h), r;
  4150. }
  4151. parseSubNode(n, s, r) {
  4152. if (r.singleProperty === true) {
  4153. const o = r.propertyList[0];
  4154. Array.isArray(o) ? (s[r.name] = r, r.a = o) : s[r.name] = o;
  4155. } else if (n === "Connections" && r.name === "C") {
  4156. const o = [];
  4157. r.propertyList.forEach(function(c, p) {
  4158. p !== 0 && o.push(c);
  4159. }), s.connections === void 0 && (s.connections = []), s.connections.push(o);
  4160. } else if (r.name === "Properties70")
  4161. Object.keys(r).forEach(function(c) {
  4162. s[c] = r[c];
  4163. });
  4164. else if (n === "Properties70" && r.name === "P") {
  4165. let o = r.propertyList[0], c = r.propertyList[1];
  4166. const p = r.propertyList[2], h = r.propertyList[3];
  4167. let d;
  4168. o.indexOf("Lcl ") === 0 && (o = o.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 = [r.propertyList[4], r.propertyList[5], r.propertyList[6]] : d = r.propertyList[4], s[o] = {
  4169. type: c,
  4170. type2: p,
  4171. flag: h,
  4172. value: d
  4173. };
  4174. } else
  4175. s[r.name] === void 0 ? typeof r.id == "number" ? (s[r.name] = {}, s[r.name][r.id] = r) : s[r.name] = r : r.name === "PoseNode" ? (Array.isArray(s[r.name]) || (s[r.name] = [s[r.name]]), s[r.name].push(r)) : s[r.name][r.id] === void 0 && (s[r.name][r.id] = r);
  4176. }
  4177. parseProperty(n) {
  4178. const s = n.getString(1);
  4179. let r;
  4180. switch (s) {
  4181. case "C":
  4182. return n.getBoolean();
  4183. case "D":
  4184. return n.getFloat64();
  4185. case "F":
  4186. return n.getFloat32();
  4187. case "I":
  4188. return n.getInt32();
  4189. case "L":
  4190. return n.getInt64();
  4191. case "R":
  4192. return r = n.getUint32(), n.getArrayBuffer(r);
  4193. case "S":
  4194. return r = n.getUint32(), n.getString(r);
  4195. case "Y":
  4196. return n.getInt16();
  4197. case "b":
  4198. case "c":
  4199. case "d":
  4200. case "f":
  4201. case "i":
  4202. case "l":
  4203. const o = n.getUint32(), c = n.getUint32(), p = n.getUint32();
  4204. if (c === 0)
  4205. switch (s) {
  4206. case "b":
  4207. case "c":
  4208. return n.getBooleanArray(o);
  4209. case "d":
  4210. return n.getFloat64Array(o);
  4211. case "f":
  4212. return n.getFloat32Array(o);
  4213. case "i":
  4214. return n.getInt32Array(o);
  4215. case "l":
  4216. return n.getInt64Array(o);
  4217. }
  4218. const h = op(new Uint8Array(n.getArrayBuffer(p))), d = new ya(h.buffer);
  4219. switch (s) {
  4220. case "b":
  4221. case "c":
  4222. return d.getBooleanArray(o);
  4223. case "d":
  4224. return d.getFloat64Array(o);
  4225. case "f":
  4226. return d.getFloat32Array(o);
  4227. case "i":
  4228. return d.getInt32Array(o);
  4229. case "l":
  4230. return d.getInt64Array(o);
  4231. }
  4232. default:
  4233. throw new Error("THREE.FBXLoader: Unknown property type " + s);
  4234. }
  4235. }
  4236. };
  4237. var ya = class {
  4238. constructor(n, s) {
  4239. this.dv = new DataView(n), this.offset = 0, this.littleEndian = s !== void 0 ? s : true;
  4240. }
  4241. getOffset() {
  4242. return this.offset;
  4243. }
  4244. size() {
  4245. return this.dv.buffer.byteLength;
  4246. }
  4247. skip(n) {
  4248. this.offset += n;
  4249. }
  4250. // seems like true/false representation depends on exporter.
  4251. // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
  4252. // then sees LSB.
  4253. getBoolean() {
  4254. return (this.getUint8() & 1) === 1;
  4255. }
  4256. getBooleanArray(n) {
  4257. const s = [];
  4258. for (let r = 0; r < n; r++)
  4259. s.push(this.getBoolean());
  4260. return s;
  4261. }
  4262. getUint8() {
  4263. const n = this.dv.getUint8(this.offset);
  4264. return this.offset += 1, n;
  4265. }
  4266. getInt16() {
  4267. const n = this.dv.getInt16(this.offset, this.littleEndian);
  4268. return this.offset += 2, n;
  4269. }
  4270. getInt32() {
  4271. const n = this.dv.getInt32(this.offset, this.littleEndian);
  4272. return this.offset += 4, n;
  4273. }
  4274. getInt32Array(n) {
  4275. const s = [];
  4276. for (let r = 0; r < n; r++)
  4277. s.push(this.getInt32());
  4278. return s;
  4279. }
  4280. getUint32() {
  4281. const n = this.dv.getUint32(this.offset, this.littleEndian);
  4282. return this.offset += 4, n;
  4283. }
  4284. // JavaScript doesn't support 64-bit integer so calculate this here
  4285. // 1 << 32 will return 1 so using multiply operation instead here.
  4286. // There's a possibility that this method returns wrong value if the value
  4287. // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
  4288. // TODO: safely handle 64-bit integer
  4289. getInt64() {
  4290. let n, s;
  4291. return this.littleEndian ? (n = this.getUint32(), s = this.getUint32()) : (s = this.getUint32(), n = this.getUint32()), s & 2147483648 ? (s = ~s & 4294967295, n = ~n & 4294967295, n === 4294967295 && (s = s + 1 & 4294967295), n = n + 1 & 4294967295, -(s * 4294967296 + n)) : s * 4294967296 + n;
  4292. }
  4293. getInt64Array(n) {
  4294. const s = [];
  4295. for (let r = 0; r < n; r++)
  4296. s.push(this.getInt64());
  4297. return s;
  4298. }
  4299. // Note: see getInt64() comment
  4300. getUint64() {
  4301. let n, s;
  4302. return this.littleEndian ? (n = this.getUint32(), s = this.getUint32()) : (s = this.getUint32(), n = this.getUint32()), s * 4294967296 + n;
  4303. }
  4304. getFloat32() {
  4305. const n = this.dv.getFloat32(this.offset, this.littleEndian);
  4306. return this.offset += 4, n;
  4307. }
  4308. getFloat32Array(n) {
  4309. const s = [];
  4310. for (let r = 0; r < n; r++)
  4311. s.push(this.getFloat32());
  4312. return s;
  4313. }
  4314. getFloat64() {
  4315. const n = this.dv.getFloat64(this.offset, this.littleEndian);
  4316. return this.offset += 8, n;
  4317. }
  4318. getFloat64Array(n) {
  4319. const s = [];
  4320. for (let r = 0; r < n; r++)
  4321. s.push(this.getFloat64());
  4322. return s;
  4323. }
  4324. getArrayBuffer(n) {
  4325. const s = this.dv.buffer.slice(this.offset, this.offset + n);
  4326. return this.offset += n, s;
  4327. }
  4328. getString(n) {
  4329. let s = [];
  4330. for (let o = 0; o < n; o++)
  4331. s[o] = this.getUint8();
  4332. const r = s.indexOf(0);
  4333. return r >= 0 && (s = s.slice(0, r)), LoaderUtils.decodeText(new Uint8Array(s));
  4334. }
  4335. };
  4336. var Za = class {
  4337. add(n, s) {
  4338. this[n] = s;
  4339. }
  4340. };
  4341. function ah(v) {
  4342. const n = "Kaydara FBX Binary \0";
  4343. return v.byteLength >= n.length && n === el(v, 0, n.length);
  4344. }
  4345. function lh(v) {
  4346. const n = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
  4347. let s = 0;
  4348. function r(o) {
  4349. const c = v[o - 1];
  4350. return v = v.slice(s + o), s++, c;
  4351. }
  4352. for (let o = 0; o < n.length; ++o)
  4353. if (r(1) === n[o])
  4354. return false;
  4355. return true;
  4356. }
  4357. function xa(v) {
  4358. const n = /FBXVersion: (\d+)/, s = v.match(n);
  4359. if (s)
  4360. return parseInt(s[1]);
  4361. throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
  4362. }
  4363. function ch(v) {
  4364. return v / 46186158e3;
  4365. }
  4366. var uh = [];
  4367. function Ns(v, n, s, r) {
  4368. let o;
  4369. switch (r.mappingType) {
  4370. case "ByPolygonVertex":
  4371. o = v;
  4372. break;
  4373. case "ByPolygon":
  4374. o = n;
  4375. break;
  4376. case "ByVertice":
  4377. o = s;
  4378. break;
  4379. case "AllSame":
  4380. o = r.indices[0];
  4381. break;
  4382. default:
  4383. console.warn("THREE.FBXLoader: unknown attribute mapping type " + r.mappingType);
  4384. }
  4385. r.referenceType === "IndexToDirect" && (o = r.indices[o]);
  4386. const c = o * r.dataSize, p = c + r.dataSize;
  4387. return hh(uh, r.buffer, c, p);
  4388. }
  4389. var oo = new Euler();
  4390. var di = new Vector3();
  4391. function Wa(v) {
  4392. const n = new Matrix4(), s = new Matrix4(), r = new Matrix4(), o = new Matrix4(), c = new Matrix4(), p = new Matrix4(), h = new Matrix4(), d = new Matrix4(), g = new Matrix4(), w = new Matrix4(), _2 = new Matrix4(), y = new Matrix4(), P = v.inheritType ? v.inheritType : 0;
  4393. if (v.translation && n.setPosition(di.fromArray(v.translation)), v.preRotation) {
  4394. const K = v.preRotation.map(MathUtils.degToRad);
  4395. K.push(v.eulerOrder), s.makeRotationFromEuler(oo.fromArray(K));
  4396. }
  4397. if (v.rotation) {
  4398. const K = v.rotation.map(MathUtils.degToRad);
  4399. K.push(v.eulerOrder), r.makeRotationFromEuler(oo.fromArray(K));
  4400. }
  4401. if (v.postRotation) {
  4402. const K = v.postRotation.map(MathUtils.degToRad);
  4403. K.push(v.eulerOrder), o.makeRotationFromEuler(oo.fromArray(K)), o.invert();
  4404. }
  4405. v.scale && c.scale(di.fromArray(v.scale)), v.scalingOffset && h.setPosition(di.fromArray(v.scalingOffset)), v.scalingPivot && p.setPosition(di.fromArray(v.scalingPivot)), v.rotationOffset && d.setPosition(di.fromArray(v.rotationOffset)), v.rotationPivot && g.setPosition(di.fromArray(v.rotationPivot)), v.parentMatrixWorld && (_2.copy(v.parentMatrix), w.copy(v.parentMatrixWorld));
  4406. const R = s.clone().multiply(r).multiply(o), k = new Matrix4();
  4407. k.extractRotation(w);
  4408. const A = new Matrix4();
  4409. A.copyPosition(w);
  4410. const z = A.clone().invert().multiply(w), F = k.clone().invert().multiply(z), I = c, D2 = new Matrix4();
  4411. if (P === 0)
  4412. D2.copy(k).multiply(R).multiply(F).multiply(I);
  4413. else if (P === 1)
  4414. D2.copy(k).multiply(F).multiply(R).multiply(I);
  4415. else {
  4416. const q = new Matrix4().scale(new Vector3().setFromMatrixScale(_2)).clone().invert(), pe = F.clone().multiply(q);
  4417. D2.copy(k).multiply(R).multiply(pe).multiply(I);
  4418. }
  4419. const Y = g.clone().invert(), G = p.clone().invert();
  4420. let N = n.clone().multiply(d).multiply(g).multiply(s).multiply(r).multiply(o).multiply(Y).multiply(h).multiply(p).multiply(c).multiply(G);
  4421. const O = new Matrix4().copyPosition(N), H = w.clone().multiply(O);
  4422. return y.copyPosition(H), N = y.clone().multiply(D2), N.premultiply(w.invert()), N;
  4423. }
  4424. function Ja(v) {
  4425. v = v || 0;
  4426. const n = [
  4427. "ZYX",
  4428. // -> XYZ extrinsic
  4429. "YZX",
  4430. // -> XZY extrinsic
  4431. "XZY",
  4432. // -> YZX extrinsic
  4433. "ZXY",
  4434. // -> YXZ extrinsic
  4435. "YXZ",
  4436. // -> ZXY extrinsic
  4437. "XYZ"
  4438. // -> ZYX extrinsic
  4439. //'SphericXYZ', // not possible to support
  4440. ];
  4441. return v === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), n[0]) : n[v];
  4442. }
  4443. function ao(v) {
  4444. return v.split(",").map(function(s) {
  4445. return parseFloat(s);
  4446. });
  4447. }
  4448. function el(v, n, s) {
  4449. return n === void 0 && (n = 0), s === void 0 && (s = v.byteLength), LoaderUtils.decodeText(new Uint8Array(v, n, s));
  4450. }
  4451. function ph(v, n) {
  4452. for (let s = 0, r = v.length, o = n.length; s < o; s++, r++)
  4453. v[r] = n[s];
  4454. }
  4455. function hh(v, n, s, r) {
  4456. for (let o = s, c = 0; o < r; o++, c++)
  4457. v[c] = n[o];
  4458. return v;
  4459. }
  4460. function Ea(v, n, s) {
  4461. return v.slice(0, n).concat(s).concat(v.slice(n));
  4462. }
  4463. var dh = class extends Loader {
  4464. constructor(n) {
  4465. super(n);
  4466. }
  4467. load(n, s, r, o) {
  4468. const c = new FileLoader(this.manager);
  4469. c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(n, (p) => {
  4470. if (typeof p != "string")
  4471. throw new Error("unsupported data type");
  4472. const h = JSON.parse(p), d = this.parse(h);
  4473. s && s(d);
  4474. }, r, o);
  4475. }
  4476. parse(n) {
  4477. return new Po(n);
  4478. }
  4479. };
  4480. var Po = class {
  4481. constructor(n) {
  4482. C(this, "data", void 0), this.data = n;
  4483. }
  4484. generateShapes(n, s = 100, r) {
  4485. const o = [], c = {
  4486. letterSpacing: 0,
  4487. lineHeight: 1,
  4488. ...r
  4489. }, p = mh(n, s, this.data, c);
  4490. for (let h = 0, d = p.length; h < d; h++)
  4491. Array.prototype.push.apply(o, p[h].toShapes(false));
  4492. return o;
  4493. }
  4494. };
  4495. C(Po, "isFont", void 0);
  4496. C(Po, "type", void 0);
  4497. function mh(v, n, s, r) {
  4498. const o = Array.from(v), c = n / s.resolution, p = (s.boundingBox.yMax - s.boundingBox.yMin + s.underlineThickness) * c, h = [];
  4499. let d = 0, g = 0;
  4500. for (let w = 0; w < o.length; w++) {
  4501. const _2 = o[w];
  4502. if (_2 === `
  4503. `)
  4504. d = 0, g -= p * r.lineHeight;
  4505. else {
  4506. const y = fh(_2, c, d, g, s);
  4507. y && (d += y.offsetX + r.letterSpacing, h.push(y.path));
  4508. }
  4509. }
  4510. return h;
  4511. }
  4512. function fh(v, n, s, r, o) {
  4513. const c = o.glyphs[v] || o.glyphs["?"];
  4514. if (!c) {
  4515. console.error('THREE.Font: character "' + v + '" does not exists in font family ' + o.familyName + ".");
  4516. return;
  4517. }
  4518. const p = new ShapePath();
  4519. let h, d, g, w, _2, y, P, R;
  4520. if (c.o) {
  4521. const k = c._cachedOutline || (c._cachedOutline = c.o.split(" "));
  4522. for (let A = 0, z = k.length; A < z; )
  4523. switch (k[A++]) {
  4524. case "m":
  4525. h = parseInt(k[A++]) * n + s, d = parseInt(k[A++]) * n + r, p.moveTo(h, d);
  4526. break;
  4527. case "l":
  4528. h = parseInt(k[A++]) * n + s, d = parseInt(k[A++]) * n + r, p.lineTo(h, d);
  4529. break;
  4530. case "q":
  4531. g = parseInt(k[A++]) * n + s, w = parseInt(k[A++]) * n + r, _2 = parseInt(k[A++]) * n + s, y = parseInt(k[A++]) * n + r, p.quadraticCurveTo(_2, y, g, w);
  4532. break;
  4533. case "b":
  4534. g = parseInt(k[A++]) * n + s, w = parseInt(k[A++]) * n + r, _2 = parseInt(k[A++]) * n + s, y = parseInt(k[A++]) * n + r, P = parseInt(k[A++]) * n + s, R = parseInt(k[A++]) * n + r, p.bezierCurveTo(_2, y, P, R, g, w);
  4535. break;
  4536. }
  4537. }
  4538. return {
  4539. offsetX: c.ha * n,
  4540. path: p
  4541. };
  4542. }
  4543. var tl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  4544. function vh(v) {
  4545. return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
  4546. }
  4547. var bh = class extends DataTextureLoader {
  4548. constructor(n) {
  4549. super(n), this.type = HalfFloatType;
  4550. }
  4551. // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
  4552. parse(n) {
  4553. const h = function(I, D2) {
  4554. switch (I) {
  4555. case 1:
  4556. console.error("THREE.RGBELoader Read Error: " + (D2 || ""));
  4557. break;
  4558. case 2:
  4559. console.error("THREE.RGBELoader Write Error: " + (D2 || ""));
  4560. break;
  4561. case 3:
  4562. console.error("THREE.RGBELoader Bad File Format: " + (D2 || ""));
  4563. break;
  4564. default:
  4565. case 4:
  4566. console.error("THREE.RGBELoader: Error: " + (D2 || ""));
  4567. }
  4568. return -1;
  4569. }, _2 = `
  4570. `, y = function(I, D2, Y) {
  4571. D2 = D2 || 1024;
  4572. let N = I.pos, O = -1, H = 0, K = "", q = String.fromCharCode.apply(null, new Uint16Array(I.subarray(N, N + 128)));
  4573. for (; 0 > (O = q.indexOf(_2)) && H < D2 && N < I.byteLength; )
  4574. K += q, H += q.length, N += 128, q += String.fromCharCode.apply(null, new Uint16Array(I.subarray(N, N + 128)));
  4575. return -1 < O ? (Y !== false && (I.pos += H + O + 1), K + q.slice(0, O)) : false;
  4576. }, P = function(I) {
  4577. const D2 = /^#\?(\S+)/, Y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, G = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, O = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, H = {
  4578. valid: 0,
  4579. string: "",
  4580. comments: "",
  4581. programtype: "RGBE",
  4582. format: "",
  4583. gamma: 1,
  4584. exposure: 1,
  4585. width: 0,
  4586. height: 0
  4587. /* image dimensions, width/height */
  4588. };
  4589. let K, q;
  4590. if (I.pos >= I.byteLength || !(K = y(I)))
  4591. return h(1, "no header found");
  4592. if (!(q = K.match(D2)))
  4593. return h(3, "bad initial token");
  4594. for (H.valid |= 1, H.programtype = q[1], H.string += K + `
  4595. `; K = y(I), K !== false; ) {
  4596. if (H.string += K + `
  4597. `, K.charAt(0) === "#") {
  4598. H.comments += K + `
  4599. `;
  4600. continue;
  4601. }
  4602. if ((q = K.match(Y)) && (H.gamma = parseFloat(q[1])), (q = K.match(G)) && (H.exposure = parseFloat(q[1])), (q = K.match(N)) && (H.valid |= 2, H.format = q[1]), (q = K.match(O)) && (H.valid |= 4, H.height = parseInt(q[1], 10), H.width = parseInt(q[2], 10)), H.valid & 2 && H.valid & 4)
  4603. break;
  4604. }
  4605. return H.valid & 2 ? H.valid & 4 ? H : h(3, "missing image size specifier") : h(3, "missing format specifier");
  4606. }, R = function(I, D2, Y) {
  4607. const G = D2;
  4608. if (
  4609. // run length encoding is not allowed so read flat
  4610. G < 8 || G > 32767 || // this file is not run length encoded
  4611. I[0] !== 2 || I[1] !== 2 || I[2] & 128
  4612. )
  4613. return new Uint8Array(I);
  4614. if (G !== (I[2] << 8 | I[3]))
  4615. return h(3, "wrong scanline width");
  4616. const N = new Uint8Array(4 * D2 * Y);
  4617. if (!N.length)
  4618. return h(4, "unable to allocate buffer space");
  4619. let O = 0, H = 0;
  4620. const K = 4 * G, q = new Uint8Array(4), pe = new Uint8Array(K);
  4621. let _e = Y;
  4622. for (; _e > 0 && H < I.byteLength; ) {
  4623. if (H + 4 > I.byteLength)
  4624. return h(1);
  4625. if (q[0] = I[H++], q[1] = I[H++], q[2] = I[H++], q[3] = I[H++], q[0] != 2 || q[1] != 2 || (q[2] << 8 | q[3]) != G)
  4626. return h(3, "bad rgbe scanline format");
  4627. let ce = 0, me;
  4628. for (; ce < K && H < I.byteLength; ) {
  4629. me = I[H++];
  4630. const ee = me > 128;
  4631. if (ee && (me -= 128), me === 0 || ce + me > K)
  4632. return h(3, "bad scanline data");
  4633. if (ee) {
  4634. const X = I[H++];
  4635. for (let Te = 0; Te < me; Te++)
  4636. pe[ce++] = X;
  4637. } else
  4638. pe.set(I.subarray(H, H + me), ce), ce += me, H += me;
  4639. }
  4640. const he = G;
  4641. for (let ee = 0; ee < he; ee++) {
  4642. let X = 0;
  4643. N[O] = pe[ee + X], X += G, N[O + 1] = pe[ee + X], X += G, N[O + 2] = pe[ee + X], X += G, N[O + 3] = pe[ee + X], O += 4;
  4644. }
  4645. _e--;
  4646. }
  4647. return N;
  4648. }, k = function(I, D2, Y, G) {
  4649. const N = I[D2 + 3], O = Math.pow(2, N - 128) / 255;
  4650. Y[G + 0] = I[D2 + 0] * O, Y[G + 1] = I[D2 + 1] * O, Y[G + 2] = I[D2 + 2] * O, Y[G + 3] = 1;
  4651. }, A = function(I, D2, Y, G) {
  4652. const N = I[D2 + 3], O = Math.pow(2, N - 128) / 255;
  4653. Y[G + 0] = DataUtils.toHalfFloat(Math.min(I[D2 + 0] * O, 65504)), Y[G + 1] = DataUtils.toHalfFloat(Math.min(I[D2 + 1] * O, 65504)), Y[G + 2] = DataUtils.toHalfFloat(Math.min(I[D2 + 2] * O, 65504)), Y[G + 3] = DataUtils.toHalfFloat(1);
  4654. }, z = new Uint8Array(n);
  4655. z.pos = 0;
  4656. const F = P(z);
  4657. if (F !== -1) {
  4658. const I = F.width, D2 = F.height, Y = R(z.subarray(z.pos), I, D2);
  4659. if (Y !== -1) {
  4660. let G, N, O;
  4661. switch (this.type) {
  4662. case FloatType:
  4663. O = Y.length / 4;
  4664. const H = new Float32Array(O * 4);
  4665. for (let q = 0; q < O; q++)
  4666. k(Y, q * 4, H, q * 4);
  4667. G = H, N = FloatType;
  4668. break;
  4669. case HalfFloatType:
  4670. O = Y.length / 4;
  4671. const K = new Uint16Array(O * 4);
  4672. for (let q = 0; q < O; q++)
  4673. A(Y, q * 4, K, q * 4);
  4674. G = K, N = HalfFloatType;
  4675. break;
  4676. default:
  4677. console.error("THREE.RGBELoader: unsupported type: ", this.type);
  4678. break;
  4679. }
  4680. return {
  4681. width: I,
  4682. height: D2,
  4683. data: G,
  4684. header: F.string,
  4685. gamma: F.gamma,
  4686. exposure: F.exposure,
  4687. type: N
  4688. };
  4689. }
  4690. }
  4691. return null;
  4692. }
  4693. setDataType(n) {
  4694. return this.type = n, this;
  4695. }
  4696. load(n, s, r, o) {
  4697. function c(p, h) {
  4698. switch (p.type) {
  4699. case FloatType:
  4700. case HalfFloatType:
  4701. p.encoding = LinearEncoding, p.minFilter = LinearFilter, p.magFilter = LinearFilter, p.generateMipmaps = false, p.flipY = true;
  4702. break;
  4703. }
  4704. s && s(p, h);
  4705. }
  4706. return super.load(n, c, r, o);
  4707. }
  4708. };
  4709. var lo = /* @__PURE__ */ new WeakMap();
  4710. var gh = class extends Loader {
  4711. constructor(n) {
  4712. super(n), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
  4713. position: "POSITION",
  4714. normal: "NORMAL",
  4715. color: "COLOR",
  4716. uv: "TEX_COORD"
  4717. }, this.defaultAttributeTypes = {
  4718. position: "Float32Array",
  4719. normal: "Float32Array",
  4720. color: "Float32Array",
  4721. uv: "Float32Array"
  4722. };
  4723. }
  4724. setDecoderPath(n) {
  4725. return this.decoderPath = n, this;
  4726. }
  4727. setDecoderConfig(n) {
  4728. return this.decoderConfig = n, this;
  4729. }
  4730. setWorkerLimit(n) {
  4731. return this.workerLimit = n, this;
  4732. }
  4733. load(n, s, r, o) {
  4734. const c = new FileLoader(this.manager);
  4735. c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(n, (p) => {
  4736. const h = {
  4737. attributeIDs: this.defaultAttributeIDs,
  4738. attributeTypes: this.defaultAttributeTypes,
  4739. useUniqueIDs: false
  4740. };
  4741. this.decodeGeometry(p, h).then(s).catch(o);
  4742. }, r, o);
  4743. }
  4744. /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
  4745. decodeDracoFile(n, s, r, o) {
  4746. const c = {
  4747. attributeIDs: r || this.defaultAttributeIDs,
  4748. attributeTypes: o || this.defaultAttributeTypes,
  4749. useUniqueIDs: !!r
  4750. };
  4751. this.decodeGeometry(n, c).then(s);
  4752. }
  4753. decodeGeometry(n, s) {
  4754. for (const d in s.attributeTypes) {
  4755. const g = s.attributeTypes[d];
  4756. g.BYTES_PER_ELEMENT !== void 0 && (s.attributeTypes[d] = g.name);
  4757. }
  4758. const r = JSON.stringify(s);
  4759. if (lo.has(n)) {
  4760. const d = lo.get(n);
  4761. if (d.key === r)
  4762. return d.promise;
  4763. if (n.byteLength === 0)
  4764. throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
  4765. }
  4766. let o;
  4767. const c = this.workerNextTaskID++, p = n.byteLength, h = this._getWorker(c, p).then((d) => (o = d, new Promise((g, w) => {
  4768. o._callbacks[c] = {
  4769. resolve: g,
  4770. reject: w
  4771. }, o.postMessage({
  4772. type: "decode",
  4773. id: c,
  4774. taskConfig: s,
  4775. buffer: n
  4776. }, [n]);
  4777. }))).then((d) => this._createGeometry(d.geometry));
  4778. return h.catch(() => true).then(() => {
  4779. o && c && this._releaseTask(o, c);
  4780. }), lo.set(n, {
  4781. key: r,
  4782. promise: h
  4783. }), h;
  4784. }
  4785. _createGeometry(n) {
  4786. const s = new BufferGeometry();
  4787. n.index && s.setIndex(new BufferAttribute(n.index.array, 1));
  4788. for (let r = 0; r < n.attributes.length; r++) {
  4789. const o = n.attributes[r], c = o.name, p = o.array, h = o.itemSize;
  4790. s.setAttribute(c, new BufferAttribute(p, h));
  4791. }
  4792. return s;
  4793. }
  4794. _loadLibrary(n, s) {
  4795. const r = new FileLoader(this.manager);
  4796. return r.setPath(this.decoderPath), r.setResponseType(s), r.setWithCredentials(this.withCredentials), new Promise((o, c) => {
  4797. r.load(n, o, void 0, c);
  4798. });
  4799. }
  4800. preload() {
  4801. return this._initDecoder(), this;
  4802. }
  4803. _initDecoder() {
  4804. if (this.decoderPending)
  4805. return this.decoderPending;
  4806. const n = typeof WebAssembly != "object" || this.decoderConfig.type === "js", s = [];
  4807. return n ? s.push(this._loadLibrary("draco_decoder.js", "text")) : (s.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), s.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(s).then((r) => {
  4808. const o = r[0];
  4809. n || (this.decoderConfig.wasmBinary = r[1]);
  4810. const c = _h.toString(), p = ["/* draco decoder */", o, "", "/* worker */", c.substring(c.indexOf("{") + 1, c.lastIndexOf("}"))].join(`
  4811. `);
  4812. this.workerSourceURL = URL.createObjectURL(new Blob([p]));
  4813. }), this.decoderPending;
  4814. }
  4815. _getWorker(n, s) {
  4816. return this._initDecoder().then(() => {
  4817. if (this.workerPool.length < this.workerLimit) {
  4818. const o = new Worker(this.workerSourceURL);
  4819. o._callbacks = {}, o._taskCosts = {}, o._taskLoad = 0, o.postMessage({
  4820. type: "init",
  4821. decoderConfig: this.decoderConfig
  4822. }), o.onmessage = function(c) {
  4823. const p = c.data;
  4824. switch (p.type) {
  4825. case "decode":
  4826. o._callbacks[p.id].resolve(p);
  4827. break;
  4828. case "error":
  4829. o._callbacks[p.id].reject(p);
  4830. break;
  4831. default:
  4832. console.error('THREE.DRACOLoader: Unexpected message, "' + p.type + '"');
  4833. }
  4834. }, this.workerPool.push(o);
  4835. } else
  4836. this.workerPool.sort(function(o, c) {
  4837. return o._taskLoad > c._taskLoad ? -1 : 1;
  4838. });
  4839. const r = this.workerPool[this.workerPool.length - 1];
  4840. return r._taskCosts[n] = s, r._taskLoad += s, r;
  4841. });
  4842. }
  4843. _releaseTask(n, s) {
  4844. n._taskLoad -= n._taskCosts[s], delete n._callbacks[s], delete n._taskCosts[s];
  4845. }
  4846. debug() {
  4847. console.log("Task load: ", this.workerPool.map((n) => n._taskLoad));
  4848. }
  4849. dispose() {
  4850. for (let n = 0; n < this.workerPool.length; ++n)
  4851. this.workerPool[n].terminate();
  4852. return this.workerPool.length = 0, this;
  4853. }
  4854. };
  4855. function _h() {
  4856. let v, n;
  4857. onmessage = function(p) {
  4858. const h = p.data;
  4859. switch (h.type) {
  4860. case "init":
  4861. v = h.decoderConfig, n = new Promise(function(w) {
  4862. v.onModuleLoaded = function(_2) {
  4863. w({
  4864. draco: _2
  4865. });
  4866. }, DracoDecoderModule(v);
  4867. });
  4868. break;
  4869. case "decode":
  4870. const d = h.buffer, g = h.taskConfig;
  4871. n.then((w) => {
  4872. const _2 = w.draco, y = new _2.Decoder(), P = new _2.DecoderBuffer();
  4873. P.Init(new Int8Array(d), d.byteLength);
  4874. try {
  4875. const R = s(_2, y, P, g), k = R.attributes.map((A) => A.array.buffer);
  4876. R.index && k.push(R.index.array.buffer), self.postMessage({
  4877. type: "decode",
  4878. id: h.id,
  4879. geometry: R
  4880. }, k);
  4881. } catch (R) {
  4882. console.error(R), self.postMessage({
  4883. type: "error",
  4884. id: h.id,
  4885. error: R.message
  4886. });
  4887. } finally {
  4888. _2.destroy(P), _2.destroy(y);
  4889. }
  4890. });
  4891. break;
  4892. }
  4893. };
  4894. function s(p, h, d, g) {
  4895. const w = g.attributeIDs, _2 = g.attributeTypes;
  4896. let y, P;
  4897. const R = h.GetEncodedGeometryType(d);
  4898. if (R === p.TRIANGULAR_MESH)
  4899. y = new p.Mesh(), P = h.DecodeBufferToMesh(d, y);
  4900. else if (R === p.POINT_CLOUD)
  4901. y = new p.PointCloud(), P = h.DecodeBufferToPointCloud(d, y);
  4902. else
  4903. throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
  4904. if (!P.ok() || y.ptr === 0)
  4905. throw new Error("THREE.DRACOLoader: Decoding failed: " + P.error_msg());
  4906. const k = {
  4907. index: null,
  4908. attributes: []
  4909. };
  4910. for (const A in w) {
  4911. const z = self[_2[A]];
  4912. let F, I;
  4913. if (g.useUniqueIDs)
  4914. I = w[A], F = h.GetAttributeByUniqueId(y, I);
  4915. else {
  4916. if (I = h.GetAttributeId(y, p[w[A]]), I === -1)
  4917. continue;
  4918. F = h.GetAttribute(y, I);
  4919. }
  4920. k.attributes.push(o(p, h, y, A, z, F));
  4921. }
  4922. return R === p.TRIANGULAR_MESH && (k.index = r(p, h, y)), p.destroy(y), k;
  4923. }
  4924. function r(p, h, d) {
  4925. const w = d.num_faces() * 3, _2 = w * 4, y = p._malloc(_2);
  4926. h.GetTrianglesUInt32Array(d, _2, y);
  4927. const P = new Uint32Array(p.HEAPF32.buffer, y, w).slice();
  4928. return p._free(y), {
  4929. array: P,
  4930. itemSize: 1
  4931. };
  4932. }
  4933. function o(p, h, d, g, w, _2) {
  4934. const y = _2.num_components(), R = d.num_points() * y, k = R * w.BYTES_PER_ELEMENT, A = c(p, w), z = p._malloc(k);
  4935. h.GetAttributeDataArrayForAllPoints(d, _2, A, k, z);
  4936. const F = new w(p.HEAPF32.buffer, z, R).slice();
  4937. return p._free(z), {
  4938. name: g,
  4939. array: F,
  4940. itemSize: y
  4941. };
  4942. }
  4943. function c(p, h) {
  4944. switch (h) {
  4945. case Float32Array:
  4946. return p.DT_FLOAT32;
  4947. case Int8Array:
  4948. return p.DT_INT8;
  4949. case Int16Array:
  4950. return p.DT_INT16;
  4951. case Int32Array:
  4952. return p.DT_INT32;
  4953. case Uint8Array:
  4954. return p.DT_UINT8;
  4955. case Uint16Array:
  4956. return p.DT_UINT16;
  4957. case Uint32Array:
  4958. return p.DT_UINT32;
  4959. }
  4960. }
  4961. }
  4962. function St() {
  4963. const { state: v, setState: n } = inject("useTres", _()), s = inject("extend") || (() => {
  4964. });
  4965. return {
  4966. state: v,
  4967. setState: n,
  4968. extend: s
  4969. };
  4970. }
  4971. var wh = ["args"];
  4972. var Md = defineComponent({
  4973. __name: "OrbitControls",
  4974. props: {
  4975. makeDefault: { type: Boolean, default: false },
  4976. camera: null,
  4977. domElement: null,
  4978. target: null,
  4979. enableDamping: { type: Boolean }
  4980. },
  4981. setup(v) {
  4982. const n = v, { state: s, setState: r, extend: o } = St(), c = ref(null);
  4983. return o({ OrbitControls: vp }), watch(c, (p) => {
  4984. p && n.makeDefault ? r("controls", p) : r("controls", null);
  4985. }), (p, h) => {
  4986. var d;
  4987. return unref(s).camera && unref(s).renderer ? (openBlock(), createElementBlock("TresOrbitControls", {
  4988. key: 0,
  4989. ref_key: "controls",
  4990. ref: c,
  4991. args: [unref(s).camera || v.camera, ((d = unref(s).renderer) == null ? void 0 : d.domElement) || v.domElement]
  4992. }, null, 8, wh)) : createCommentVNode("", true);
  4993. };
  4994. }
  4995. });
  4996. function nl(v) {
  4997. return getCurrentScope() ? (onScopeDispose(v), true) : false;
  4998. }
  4999. function il(v) {
  5000. return typeof v == "function" ? v() : unref(v);
  5001. }
  5002. var yh = typeof window < "u";
  5003. var sl = () => {
  5004. };
  5005. function xh(...v) {
  5006. if (v.length !== 1)
  5007. return toRef(...v);
  5008. const n = v[0];
  5009. return typeof n == "function" ? readonly(customRef(() => ({ get: n, set: sl }))) : ref(n);
  5010. }
  5011. function Eh(v, n = true) {
  5012. getCurrentInstance() ? onMounted(v) : n ? v() : nextTick(v);
  5013. }
  5014. function Ch(v) {
  5015. var n;
  5016. const s = il(v);
  5017. return (n = s == null ? void 0 : s.$el) != null ? n : s;
  5018. }
  5019. var Qs = yh ? window : void 0;
  5020. function On(...v) {
  5021. let n, s, r, o;
  5022. if (typeof v[0] == "string" || Array.isArray(v[0]) ? ([s, r, o] = v, n = Qs) : [n, s, r, o] = v, !n)
  5023. return sl;
  5024. Array.isArray(s) || (s = [s]), Array.isArray(r) || (r = [r]);
  5025. const c = [], p = () => {
  5026. c.forEach((w) => w()), c.length = 0;
  5027. }, h = (w, _2, y, P) => (w.addEventListener(_2, y, P), () => w.removeEventListener(_2, y, P)), d = watch(
  5028. () => [Ch(n), il(o)],
  5029. ([w, _2]) => {
  5030. p(), w && c.push(
  5031. ...s.flatMap((y) => r.map((P) => h(w, y, P, _2)))
  5032. );
  5033. },
  5034. { immediate: true, flush: "post" }
  5035. ), g = () => {
  5036. d(), p();
  5037. };
  5038. return nl(g), g;
  5039. }
  5040. function Ph() {
  5041. const v = ref(false);
  5042. return getCurrentInstance() && onMounted(() => {
  5043. v.value = true;
  5044. }), v;
  5045. }
  5046. function Th(v) {
  5047. const n = Ph();
  5048. return computed(() => (n.value, !!v()));
  5049. }
  5050. function kh(v, n = {}) {
  5051. const { window: s = Qs } = n, r = Th(() => s && "matchMedia" in s && typeof s.matchMedia == "function");
  5052. let o;
  5053. const c = ref(false), p = () => {
  5054. o && ("removeEventListener" in o ? o.removeEventListener("change", h) : o.removeListener(h));
  5055. }, h = () => {
  5056. r.value && (p(), o = s.matchMedia(xh(v).value), c.value = !!(o != null && o.matches), o && ("addEventListener" in o ? o.addEventListener("change", h) : o.addListener(h)));
  5057. };
  5058. return watchEffect(h), nl(() => p()), c;
  5059. }
  5060. function Mh(v = {}) {
  5061. const {
  5062. type: n = "page",
  5063. touch: s = true,
  5064. resetOnTouchEnds: r = false,
  5065. initialValue: o = { x: 0, y: 0 },
  5066. window: c = Qs,
  5067. eventFilter: p
  5068. } = v, h = ref(o.x), d = ref(o.y), g = ref(null), w = (k) => {
  5069. n === "page" ? (h.value = k.pageX, d.value = k.pageY) : n === "client" ? (h.value = k.clientX, d.value = k.clientY) : n === "screen" ? (h.value = k.screenX, d.value = k.screenY) : n === "movement" && (h.value = k.movementX, d.value = k.movementY), g.value = "mouse";
  5070. }, _2 = () => {
  5071. h.value = o.x, d.value = o.y;
  5072. }, y = (k) => {
  5073. if (k.touches.length > 0) {
  5074. const A = k.touches[0];
  5075. n === "page" ? (h.value = A.pageX, d.value = A.pageY) : n === "client" ? (h.value = A.clientX, d.value = A.clientY) : n === "screen" && (h.value = A.screenX, d.value = A.screenY), g.value = "touch";
  5076. }
  5077. }, P = (k) => p === void 0 ? w(k) : p(() => w(k), {}), R = (k) => p === void 0 ? y(k) : p(() => y(k), {});
  5078. return c && (On(c, "mousemove", P, { passive: true }), On(c, "dragover", P, { passive: true }), s && n !== "movement" && (On(c, "touchstart", R, { passive: true }), On(c, "touchmove", R, { passive: true }), r && On(c, "touchend", _2, { passive: true }))), {
  5079. x: h,
  5080. y: d,
  5081. sourceType: g
  5082. };
  5083. }
  5084. function Sh(v = {}) {
  5085. const {
  5086. window: n = Qs,
  5087. initialWidth: s = 1 / 0,
  5088. initialHeight: r = 1 / 0,
  5089. listenOrientation: o = true,
  5090. includeScrollbar: c = true
  5091. } = v, p = ref(s), h = ref(r), d = () => {
  5092. n && (c ? (p.value = n.innerWidth, h.value = n.innerHeight) : (p.value = n.document.documentElement.clientWidth, h.value = n.document.documentElement.clientHeight));
  5093. };
  5094. if (d(), Eh(d), On("resize", d, { passive: true }), o) {
  5095. const g = kh("(orientation: portrait)");
  5096. watch(g, () => d());
  5097. }
  5098. return { width: p, height: h };
  5099. }
  5100. var Lh = ["args"];
  5101. var Sd = defineComponent({
  5102. __name: "PointerLockControls",
  5103. props: {
  5104. makeDefault: { type: Boolean, default: false },
  5105. camera: null,
  5106. domElement: null,
  5107. selector: null
  5108. },
  5109. setup(v, { expose: n }) {
  5110. const s = v, { state: r, setState: o, extend: c } = St(), p = ref(null);
  5111. let h;
  5112. return c({ PointerLockControls: fp }), watch(p, (d) => {
  5113. var w;
  5114. d && s.makeDefault ? o("controls", d) : o("controls", null);
  5115. const g = document.getElementById(s.selector || "");
  5116. h = g || ((w = r.renderer) == null ? void 0 : w.domElement), On(h, "click", () => {
  5117. var _2;
  5118. (_2 = p.value) == null || _2.lock();
  5119. });
  5120. }), n({
  5121. value: p
  5122. }), (d, g) => {
  5123. var w;
  5124. return unref(r).camera && unref(r).renderer ? (openBlock(), createElementBlock("TresPointerLockControls", {
  5125. key: 0,
  5126. ref_key: "controls",
  5127. ref: p,
  5128. args: [unref(r).camera || v.camera, ((w = unref(r).renderer) == null ? void 0 : w.domElement) || v.domElement]
  5129. }, null, 8, Lh)) : createCommentVNode("", true);
  5130. };
  5131. }
  5132. });
  5133. function Ah(v, n) {
  5134. const s = {};
  5135. for (const r of n)
  5136. Object.prototype.hasOwnProperty.call(v, r) && (s[r] = v[r]);
  5137. return s;
  5138. }
  5139. function Rh(v, n) {
  5140. const s = `set${n[0].toUpperCase()}${n.slice(1)}`;
  5141. return v[s] !== void 0;
  5142. }
  5143. var Ld = defineComponent({
  5144. __name: "TransformControls",
  5145. props: {
  5146. object: null,
  5147. mode: null,
  5148. enabled: { type: Boolean, default: true },
  5149. axis: null,
  5150. translationSnap: null,
  5151. rotationSnap: null,
  5152. scaleSnap: null,
  5153. space: null,
  5154. size: null,
  5155. showX: { type: Boolean },
  5156. showY: { type: Boolean },
  5157. showZ: { type: Boolean }
  5158. },
  5159. emits: ["dragging", "change", "mouseDown", "mouseUp", "objectChange"],
  5160. setup(v, { emit: n }) {
  5161. const s = v;
  5162. let r = shallowRef();
  5163. const { state: o } = St(), c = computed(
  5164. () => Ah(s, [
  5165. "enabled",
  5166. "axis",
  5167. "mode",
  5168. "translationSnap",
  5169. "rotationSnap",
  5170. "scaleSnap",
  5171. "space",
  5172. "size",
  5173. "showX",
  5174. "showY",
  5175. "showZ"
  5176. ])
  5177. ), p = () => n("change", r.value), h = () => n("mouseDown", r.value), d = () => n("mouseUp", r.value), g = () => n("objectChange", r.value), w = (y) => {
  5178. o.controls && (o.controls.enabled = !y.value), n("dragging", y.value);
  5179. };
  5180. function _2(y) {
  5181. y.addEventListener("dragging-changed", w), y.addEventListener("change", p), y.addEventListener("mouseDown", h), y.addEventListener("mouseUp", d), y.addEventListener("objectChange", g);
  5182. }
  5183. return watchEffect(() => {
  5184. o.camera && o.renderer && o.scene && s.object && (r.value = new cp(o.camera, o.renderer.domElement), r.value.attach(s.object), o.scene.add(r.value), _2(r.value));
  5185. }), watch(
  5186. [c, r],
  5187. // TODO: properly type this
  5188. ([y, P]) => {
  5189. if (y && P)
  5190. for (const R in y)
  5191. if (!Rh(P, R))
  5192. P[R] = y[R];
  5193. else {
  5194. const k = `set${R[0].toUpperCase()}${R.slice(1)}`;
  5195. typeof P[k] == "function" && y[R] !== void 0 && P[k](y[R]);
  5196. }
  5197. },
  5198. {
  5199. immediate: true
  5200. }
  5201. ), onUnmounted(() => {
  5202. r.value && (r.value.removeEventListener("dragging-changed", w), r.value.removeEventListener("change", p), r.value.removeEventListener("mouseDown", h), r.value.removeEventListener("mouseUp", d), r.value.removeEventListener("objectChange", g));
  5203. }), (y, P) => renderSlot(y.$slots, "default");
  5204. }
  5205. });
  5206. function Vh(v = false, n = 5, s) {
  5207. const { x: r, y: o } = Mh(), { logWarning: c } = D(), { width: p, height: h } = Sh(), d = computed(() => (r.value / p.value - 0.5) * n), g = computed(() => -(o.value / h.value - 0.5) * n);
  5208. if (s) {
  5209. const { x: w, y: _2 } = s.position;
  5210. watchEffect(() => {
  5211. v || s && (s.position.x = w + d.value, s.position.y = _2 + g.value);
  5212. });
  5213. } else
  5214. c("Scene must contain a Camera component to use this composable");
  5215. }
  5216. var Ad = defineComponent({
  5217. name: "PamCameraMouse",
  5218. props: ["disabled", "factor"],
  5219. setup(v) {
  5220. const { state: n } = St();
  5221. return watchEffect(() => {
  5222. if (n != null && n.camera) {
  5223. const s = n == null ? void 0 : n.camera;
  5224. Vh(v.disabled, v.factor, s);
  5225. }
  5226. }), () => {
  5227. };
  5228. }
  5229. });
  5230. var Ks = {};
  5231. var Ih = {
  5232. get exports() {
  5233. return Ks;
  5234. },
  5235. set exports(v) {
  5236. Ks = v;
  5237. }
  5238. };
  5239. (function(v, n) {
  5240. (function(s, r) {
  5241. r(n);
  5242. })(tl, function(s) {
  5243. class r {
  5244. /**
  5245. * @hidden
  5246. */
  5247. constructor(e) {
  5248. const [t, l] = e.split("-"), b = t.split(".");
  5249. this.major = parseInt(b[0], 10), this.minor = parseInt(b[1], 10), this.patch = parseInt(b[2], 10), this.prerelease = l ?? null;
  5250. }
  5251. toString() {
  5252. const e = [this.major, this.minor, this.patch].join(".");
  5253. return this.prerelease !== null ? [e, this.prerelease].join("-") : e;
  5254. }
  5255. }
  5256. class o {
  5257. constructor(e) {
  5258. this.controller_ = e;
  5259. }
  5260. get element() {
  5261. return this.controller_.view.element;
  5262. }
  5263. get disabled() {
  5264. return this.controller_.viewProps.get("disabled");
  5265. }
  5266. set disabled(e) {
  5267. this.controller_.viewProps.set("disabled", e);
  5268. }
  5269. get hidden() {
  5270. return this.controller_.viewProps.get("hidden");
  5271. }
  5272. set hidden(e) {
  5273. this.controller_.viewProps.set("hidden", e);
  5274. }
  5275. dispose() {
  5276. this.controller_.viewProps.set("disposed", true);
  5277. }
  5278. }
  5279. class c {
  5280. constructor(e) {
  5281. this.target = e;
  5282. }
  5283. }
  5284. class p extends c {
  5285. constructor(e, t, l, b) {
  5286. super(e), this.value = t, this.presetKey = l, this.last = b ?? true;
  5287. }
  5288. }
  5289. class h extends c {
  5290. constructor(e, t, l) {
  5291. super(e), this.value = t, this.presetKey = l;
  5292. }
  5293. }
  5294. class d extends c {
  5295. constructor(e, t) {
  5296. super(e), this.expanded = t;
  5297. }
  5298. }
  5299. class g extends c {
  5300. constructor(e, t) {
  5301. super(e), this.index = t;
  5302. }
  5303. }
  5304. function w(i) {
  5305. return i;
  5306. }
  5307. function _2(i) {
  5308. return i == null;
  5309. }
  5310. function y(i, e) {
  5311. if (i.length !== e.length)
  5312. return false;
  5313. for (let t = 0; t < i.length; t++)
  5314. if (i[t] !== e[t])
  5315. return false;
  5316. return true;
  5317. }
  5318. function P(i, e) {
  5319. let t = i;
  5320. do {
  5321. const l = Object.getOwnPropertyDescriptor(t, e);
  5322. if (l && (l.set !== void 0 || l.writable === true))
  5323. return true;
  5324. t = Object.getPrototypeOf(t);
  5325. } while (t !== null);
  5326. return false;
  5327. }
  5328. const R = {
  5329. alreadydisposed: () => "View has been already disposed",
  5330. invalidparams: (i) => `Invalid parameters for '${i.name}'`,
  5331. nomatchingcontroller: (i) => `No matching controller for '${i.key}'`,
  5332. nomatchingview: (i) => `No matching view for '${JSON.stringify(i.params)}'`,
  5333. notbindable: () => "Value is not bindable",
  5334. propertynotfound: (i) => `Property '${i.name}' not found`,
  5335. shouldneverhappen: () => "This error should never happen"
  5336. };
  5337. class k {
  5338. static alreadyDisposed() {
  5339. return new k({ type: "alreadydisposed" });
  5340. }
  5341. static notBindable() {
  5342. return new k({
  5343. type: "notbindable"
  5344. });
  5345. }
  5346. static propertyNotFound(e) {
  5347. return new k({
  5348. type: "propertynotfound",
  5349. context: {
  5350. name: e
  5351. }
  5352. });
  5353. }
  5354. static shouldNeverHappen() {
  5355. return new k({ type: "shouldneverhappen" });
  5356. }
  5357. constructor(e) {
  5358. var t;
  5359. this.message = (t = R[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;
  5360. }
  5361. }
  5362. class A {
  5363. constructor(e, t, l) {
  5364. this.obj_ = e, this.key_ = t, this.presetKey_ = l ?? t;
  5365. }
  5366. static isBindable(e) {
  5367. return !(e === null || typeof e != "object");
  5368. }
  5369. get key() {
  5370. return this.key_;
  5371. }
  5372. get presetKey() {
  5373. return this.presetKey_;
  5374. }
  5375. read() {
  5376. return this.obj_[this.key_];
  5377. }
  5378. write(e) {
  5379. this.obj_[this.key_] = e;
  5380. }
  5381. writeProperty(e, t) {
  5382. const l = this.read();
  5383. if (!A.isBindable(l))
  5384. throw k.notBindable();
  5385. if (!(e in l))
  5386. throw k.propertyNotFound(e);
  5387. l[e] = t;
  5388. }
  5389. }
  5390. class z extends o {
  5391. get label() {
  5392. return this.controller_.props.get("label");
  5393. }
  5394. set label(e) {
  5395. this.controller_.props.set("label", e);
  5396. }
  5397. get title() {
  5398. var e;
  5399. return (e = this.controller_.valueController.props.get("title")) !== null && e !== void 0 ? e : "";
  5400. }
  5401. set title(e) {
  5402. this.controller_.valueController.props.set("title", e);
  5403. }
  5404. on(e, t) {
  5405. const l = t.bind(this);
  5406. return this.controller_.valueController.emitter.on(e, () => {
  5407. l(new c(this));
  5408. }), this;
  5409. }
  5410. }
  5411. class F {
  5412. constructor() {
  5413. this.observers_ = {};
  5414. }
  5415. on(e, t) {
  5416. let l = this.observers_[e];
  5417. return l || (l = this.observers_[e] = []), l.push({
  5418. handler: t
  5419. }), this;
  5420. }
  5421. off(e, t) {
  5422. const l = this.observers_[e];
  5423. return l && (this.observers_[e] = l.filter((b) => b.handler !== t)), this;
  5424. }
  5425. emit(e, t) {
  5426. const l = this.observers_[e];
  5427. l && l.forEach((b) => {
  5428. b.handler(t);
  5429. });
  5430. }
  5431. }
  5432. const I = "tp";
  5433. function D2(i) {
  5434. return (t, l) => [
  5435. I,
  5436. "-",
  5437. i,
  5438. "v",
  5439. t ? `_${t}` : "",
  5440. l ? `-${l}` : ""
  5441. ].join("");
  5442. }
  5443. function Y(i, e) {
  5444. return (t) => e(i(t));
  5445. }
  5446. function G(i) {
  5447. return i.rawValue;
  5448. }
  5449. function N(i, e) {
  5450. i.emitter.on("change", Y(G, e)), e(i.rawValue);
  5451. }
  5452. function O(i, e, t) {
  5453. N(i.value(e), t);
  5454. }
  5455. function H(i, e, t) {
  5456. t ? i.classList.add(e) : i.classList.remove(e);
  5457. }
  5458. function K(i, e) {
  5459. return (t) => {
  5460. H(i, e, t);
  5461. };
  5462. }
  5463. function q(i, e) {
  5464. N(i, (t) => {
  5465. e.textContent = t ?? "";
  5466. });
  5467. }
  5468. const pe = D2("btn");
  5469. class _e {
  5470. constructor(e, t) {
  5471. this.element = e.createElement("div"), this.element.classList.add(pe()), t.viewProps.bindClassModifiers(this.element);
  5472. const l = e.createElement("button");
  5473. l.classList.add(pe("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  5474. const b = e.createElement("div");
  5475. b.classList.add(pe("t")), q(t.props.value("title"), b), this.buttonElement.appendChild(b);
  5476. }
  5477. }
  5478. class ce {
  5479. constructor(e, t) {
  5480. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new _e(e, {
  5481. props: this.props,
  5482. viewProps: this.viewProps
  5483. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  5484. }
  5485. onClick_() {
  5486. this.emitter.emit("click", {
  5487. sender: this
  5488. });
  5489. }
  5490. }
  5491. class me {
  5492. constructor(e, t) {
  5493. var l;
  5494. this.constraint_ = t == null ? void 0 : t.constraint, this.equals_ = (l = t == null ? void 0 : t.equals) !== null && l !== void 0 ? l : (b, E) => b === E, this.emitter = new F(), this.rawValue_ = e;
  5495. }
  5496. get constraint() {
  5497. return this.constraint_;
  5498. }
  5499. get rawValue() {
  5500. return this.rawValue_;
  5501. }
  5502. set rawValue(e) {
  5503. this.setRawValue(e, {
  5504. forceEmit: false,
  5505. last: true
  5506. });
  5507. }
  5508. setRawValue(e, t) {
  5509. const l = t ?? {
  5510. forceEmit: false,
  5511. last: true
  5512. }, b = this.constraint_ ? this.constraint_.constrain(e) : e, E = this.rawValue_;
  5513. this.equals_(E, b) && !l.forceEmit || (this.emitter.emit("beforechange", {
  5514. sender: this
  5515. }), this.rawValue_ = b, this.emitter.emit("change", {
  5516. options: l,
  5517. previousRawValue: E,
  5518. rawValue: b,
  5519. sender: this
  5520. }));
  5521. }
  5522. }
  5523. class he {
  5524. constructor(e) {
  5525. this.emitter = new F(), this.value_ = e;
  5526. }
  5527. get rawValue() {
  5528. return this.value_;
  5529. }
  5530. set rawValue(e) {
  5531. this.setRawValue(e, {
  5532. forceEmit: false,
  5533. last: true
  5534. });
  5535. }
  5536. setRawValue(e, t) {
  5537. const l = t ?? {
  5538. forceEmit: false,
  5539. last: true
  5540. }, b = this.value_;
  5541. b === e && !l.forceEmit || (this.emitter.emit("beforechange", {
  5542. sender: this
  5543. }), this.value_ = e, this.emitter.emit("change", {
  5544. options: l,
  5545. previousRawValue: b,
  5546. rawValue: this.value_,
  5547. sender: this
  5548. }));
  5549. }
  5550. }
  5551. function ee(i, e) {
  5552. const t = e == null ? void 0 : e.constraint, l = e == null ? void 0 : e.equals;
  5553. return !t && !l ? new he(i) : new me(i, e);
  5554. }
  5555. class X {
  5556. constructor(e) {
  5557. this.emitter = new F(), this.valMap_ = e;
  5558. for (const t in this.valMap_)
  5559. this.valMap_[t].emitter.on("change", () => {
  5560. this.emitter.emit("change", {
  5561. key: t,
  5562. sender: this
  5563. });
  5564. });
  5565. }
  5566. static createCore(e) {
  5567. return Object.keys(e).reduce((l, b) => Object.assign(l, {
  5568. [b]: ee(e[b])
  5569. }), {});
  5570. }
  5571. static fromObject(e) {
  5572. const t = this.createCore(e);
  5573. return new X(t);
  5574. }
  5575. get(e) {
  5576. return this.valMap_[e].rawValue;
  5577. }
  5578. set(e, t) {
  5579. this.valMap_[e].rawValue = t;
  5580. }
  5581. value(e) {
  5582. return this.valMap_[e];
  5583. }
  5584. }
  5585. function Te(i, e) {
  5586. const l = Object.keys(e).reduce((b, E) => {
  5587. if (b === void 0)
  5588. return;
  5589. const M = e[E], B = M(i[E]);
  5590. return B.succeeded ? Object.assign(Object.assign({}, b), { [E]: B.value }) : void 0;
  5591. }, {});
  5592. return l;
  5593. }
  5594. function fe(i, e) {
  5595. return i.reduce((t, l) => {
  5596. if (t === void 0)
  5597. return;
  5598. const b = e(l);
  5599. if (!(!b.succeeded || b.value === void 0))
  5600. return [...t, b.value];
  5601. }, []);
  5602. }
  5603. function ae(i) {
  5604. return i === null ? false : typeof i == "object";
  5605. }
  5606. function ne(i) {
  5607. return (e) => (t) => {
  5608. if (!e && t === void 0)
  5609. return {
  5610. succeeded: false,
  5611. value: void 0
  5612. };
  5613. if (e && t === void 0)
  5614. return {
  5615. succeeded: true,
  5616. value: void 0
  5617. };
  5618. const l = i(t);
  5619. return l !== void 0 ? {
  5620. succeeded: true,
  5621. value: l
  5622. } : {
  5623. succeeded: false,
  5624. value: void 0
  5625. };
  5626. };
  5627. }
  5628. function ge(i) {
  5629. return {
  5630. custom: (e) => ne(e)(i),
  5631. boolean: ne((e) => typeof e == "boolean" ? e : void 0)(i),
  5632. number: ne((e) => typeof e == "number" ? e : void 0)(i),
  5633. string: ne((e) => typeof e == "string" ? e : void 0)(i),
  5634. function: ne((e) => typeof e == "function" ? e : void 0)(i),
  5635. constant: (e) => ne((t) => t === e ? e : void 0)(i),
  5636. raw: ne((e) => e)(i),
  5637. object: (e) => ne((t) => {
  5638. if (ae(t))
  5639. return Te(t, e);
  5640. })(i),
  5641. array: (e) => ne((t) => {
  5642. if (Array.isArray(t))
  5643. return fe(t, e);
  5644. })(i)
  5645. };
  5646. }
  5647. const S = {
  5648. optional: ge(true),
  5649. required: ge(false)
  5650. };
  5651. function le(i, e) {
  5652. const t = S.required.object(e)(i);
  5653. return t.succeeded ? t.value : void 0;
  5654. }
  5655. function Fe(i) {
  5656. console.warn([
  5657. `Missing '${i.key}' of ${i.target} in ${i.place}.`,
  5658. "Please rebuild plugins with the latest core package."
  5659. ].join(" "));
  5660. }
  5661. function Ue(i) {
  5662. return i && i.parentElement && i.parentElement.removeChild(i), null;
  5663. }
  5664. class ye {
  5665. constructor(e) {
  5666. this.value_ = e;
  5667. }
  5668. static create(e) {
  5669. return [
  5670. new ye(e),
  5671. (t, l) => {
  5672. e.setRawValue(t, l);
  5673. }
  5674. ];
  5675. }
  5676. get emitter() {
  5677. return this.value_.emitter;
  5678. }
  5679. get rawValue() {
  5680. return this.value_.rawValue;
  5681. }
  5682. }
  5683. const rt = D2("");
  5684. function jn(i, e) {
  5685. return K(i, rt(void 0, e));
  5686. }
  5687. class Qe extends X {
  5688. constructor(e) {
  5689. var t;
  5690. 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(ee(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_);
  5691. }
  5692. static create(e) {
  5693. var t, l, b;
  5694. const E = e ?? {};
  5695. return new Qe(X.createCore({
  5696. disabled: (t = E.disabled) !== null && t !== void 0 ? t : false,
  5697. disposed: false,
  5698. hidden: (l = E.hidden) !== null && l !== void 0 ? l : false,
  5699. parent: (b = E.parent) !== null && b !== void 0 ? b : null
  5700. }));
  5701. }
  5702. get globalDisabled() {
  5703. return this.globalDisabled_;
  5704. }
  5705. bindClassModifiers(e) {
  5706. N(this.globalDisabled_, jn(e, "disabled")), O(this, "hidden", jn(e, "hidden"));
  5707. }
  5708. bindDisabled(e) {
  5709. N(this.globalDisabled_, (t) => {
  5710. e.disabled = t;
  5711. });
  5712. }
  5713. bindTabIndex(e) {
  5714. N(this.globalDisabled_, (t) => {
  5715. e.tabIndex = t ? -1 : 0;
  5716. });
  5717. }
  5718. handleDispose(e) {
  5719. this.value("disposed").emitter.on("change", (t) => {
  5720. t && e();
  5721. });
  5722. }
  5723. getGlobalDisabled_() {
  5724. const e = this.get("parent");
  5725. return (e ? e.globalDisabled.rawValue : false) || this.get("disabled");
  5726. }
  5727. updateGlobalDisabled_() {
  5728. this.setGlobalDisabled_(this.getGlobalDisabled_());
  5729. }
  5730. onDisabledChange_() {
  5731. this.updateGlobalDisabled_();
  5732. }
  5733. onParentGlobalDisabledChange_() {
  5734. this.updateGlobalDisabled_();
  5735. }
  5736. onParentChange_(e) {
  5737. var t;
  5738. const l = e.previousRawValue;
  5739. 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_();
  5740. }
  5741. }
  5742. function Un() {
  5743. return ["veryfirst", "first", "last", "verylast"];
  5744. }
  5745. const cn = D2(""), vt = {
  5746. veryfirst: "vfst",
  5747. first: "fst",
  5748. last: "lst",
  5749. verylast: "vlst"
  5750. };
  5751. class Lt {
  5752. constructor(e) {
  5753. this.parent_ = null, this.blade = e.blade, this.view = e.view, this.viewProps = e.viewProps;
  5754. const t = this.view.element;
  5755. this.blade.value("positions").emitter.on("change", () => {
  5756. Un().forEach((l) => {
  5757. t.classList.remove(cn(void 0, vt[l]));
  5758. }), this.blade.get("positions").forEach((l) => {
  5759. t.classList.add(cn(void 0, vt[l]));
  5760. });
  5761. }), this.viewProps.handleDispose(() => {
  5762. Ue(t);
  5763. });
  5764. }
  5765. get parent() {
  5766. return this.parent_;
  5767. }
  5768. set parent(e) {
  5769. if (this.parent_ = e, !("parent" in this.viewProps.valMap_)) {
  5770. Fe({
  5771. key: "parent",
  5772. target: Qe.name,
  5773. place: "BladeController.parent"
  5774. });
  5775. return;
  5776. }
  5777. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  5778. }
  5779. }
  5780. const Ke = "http://www.w3.org/2000/svg";
  5781. function ot(i) {
  5782. i.offsetHeight;
  5783. }
  5784. function un(i, e) {
  5785. const t = i.style.transition;
  5786. i.style.transition = "none", e(), i.style.transition = t;
  5787. }
  5788. function bt(i) {
  5789. return i.ontouchstart !== void 0;
  5790. }
  5791. function Gn() {
  5792. return globalThis;
  5793. }
  5794. function fi() {
  5795. return Gn().document;
  5796. }
  5797. function Hn(i) {
  5798. const e = i.ownerDocument.defaultView;
  5799. return e && "document" in e ? i.getContext("2d", {
  5800. willReadFrequently: true
  5801. }) : null;
  5802. }
  5803. const Kn = {
  5804. check: '<path d="M2 8l4 4l8 -8"/>',
  5805. dropdown: '<path d="M5 7h6l-3 3 z"/>',
  5806. p2dpad: '<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'
  5807. };
  5808. function Et(i, e) {
  5809. const t = i.createElementNS(Ke, "svg");
  5810. return t.innerHTML = Kn[e], t;
  5811. }
  5812. function At(i, e, t) {
  5813. i.insertBefore(e, i.children[t]);
  5814. }
  5815. function $n(i) {
  5816. i.parentElement && i.parentElement.removeChild(i);
  5817. }
  5818. function pn(i) {
  5819. for (; i.children.length > 0; )
  5820. i.removeChild(i.children[0]);
  5821. }
  5822. function Xn(i) {
  5823. for (; i.childNodes.length > 0; )
  5824. i.removeChild(i.childNodes[0]);
  5825. }
  5826. function Ct(i) {
  5827. return i.relatedTarget ? i.relatedTarget : "explicitOriginalTarget" in i ? i.explicitOriginalTarget : null;
  5828. }
  5829. const gt = D2("lbl");
  5830. function Rt2(i, e) {
  5831. const t = i.createDocumentFragment();
  5832. return e.split(`
  5833. `).map((b) => i.createTextNode(b)).forEach((b, E) => {
  5834. E > 0 && t.appendChild(i.createElement("br")), t.appendChild(b);
  5835. }), t;
  5836. }
  5837. class L {
  5838. constructor(e, t) {
  5839. this.element = e.createElement("div"), this.element.classList.add(gt()), t.viewProps.bindClassModifiers(this.element);
  5840. const l = e.createElement("div");
  5841. l.classList.add(gt("l")), O(t.props, "label", (E) => {
  5842. _2(E) ? this.element.classList.add(gt(void 0, "nol")) : (this.element.classList.remove(gt(void 0, "nol")), Xn(l), l.appendChild(Rt2(e, E)));
  5843. }), this.element.appendChild(l), this.labelElement = l;
  5844. const b = e.createElement("div");
  5845. b.classList.add(gt("v")), this.element.appendChild(b), this.valueElement = b;
  5846. }
  5847. }
  5848. class U extends Lt {
  5849. constructor(e, t) {
  5850. const l = t.valueController.viewProps;
  5851. super(Object.assign(Object.assign({}, t), { view: new L(e, {
  5852. props: t.props,
  5853. viewProps: l
  5854. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  5855. }
  5856. }
  5857. const W = {
  5858. id: "button",
  5859. type: "blade",
  5860. accept(i) {
  5861. const e = S, t = le(i, {
  5862. title: e.required.string,
  5863. view: e.required.constant("button"),
  5864. label: e.optional.string
  5865. });
  5866. return t ? { params: t } : null;
  5867. },
  5868. controller(i) {
  5869. return new U(i.document, {
  5870. blade: i.blade,
  5871. props: X.fromObject({
  5872. label: i.params.label
  5873. }),
  5874. valueController: new ce(i.document, {
  5875. props: X.fromObject({
  5876. title: i.params.title
  5877. }),
  5878. viewProps: i.viewProps
  5879. })
  5880. });
  5881. },
  5882. api(i) {
  5883. return !(i.controller instanceof U) || !(i.controller.valueController instanceof ce) ? null : new z(i.controller);
  5884. }
  5885. };
  5886. class ie extends Lt {
  5887. constructor(e) {
  5888. super(e), this.value = e.value;
  5889. }
  5890. }
  5891. function xe() {
  5892. return new X({
  5893. positions: ee([], {
  5894. equals: y
  5895. })
  5896. });
  5897. }
  5898. class Be extends X {
  5899. constructor(e) {
  5900. super(e);
  5901. }
  5902. static create(e) {
  5903. const t = {
  5904. completed: true,
  5905. expanded: e,
  5906. expandedHeight: null,
  5907. shouldFixHeight: false,
  5908. temporaryExpanded: null
  5909. }, l = X.createCore(t);
  5910. return new Be(l);
  5911. }
  5912. get styleExpanded() {
  5913. var e;
  5914. return (e = this.get("temporaryExpanded")) !== null && e !== void 0 ? e : this.get("expanded");
  5915. }
  5916. get styleHeight() {
  5917. if (!this.styleExpanded)
  5918. return "0";
  5919. const e = this.get("expandedHeight");
  5920. return this.get("shouldFixHeight") && !_2(e) ? `${e}px` : "auto";
  5921. }
  5922. bindExpandedClass(e, t) {
  5923. const l = () => {
  5924. this.styleExpanded ? e.classList.add(t) : e.classList.remove(t);
  5925. };
  5926. O(this, "expanded", l), O(this, "temporaryExpanded", l);
  5927. }
  5928. cleanUpTransition() {
  5929. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  5930. }
  5931. }
  5932. function Ht(i, e) {
  5933. let t = 0;
  5934. return un(e, () => {
  5935. i.set("expandedHeight", null), i.set("temporaryExpanded", true), ot(e), t = e.clientHeight, i.set("temporaryExpanded", null), ot(e);
  5936. }), t;
  5937. }
  5938. function hn(i, e) {
  5939. e.style.height = i.styleHeight;
  5940. }
  5941. function $e(i, e) {
  5942. i.value("expanded").emitter.on("beforechange", () => {
  5943. if (i.set("completed", false), _2(i.get("expandedHeight"))) {
  5944. const t = Ht(i, e);
  5945. t > 0 && i.set("expandedHeight", t);
  5946. }
  5947. i.set("shouldFixHeight", true), ot(e);
  5948. }), i.emitter.on("change", () => {
  5949. hn(i, e);
  5950. }), hn(i, e), e.addEventListener("transitionend", (t) => {
  5951. t.propertyName === "height" && i.cleanUpTransition();
  5952. });
  5953. }
  5954. class Xe extends o {
  5955. constructor(e, t) {
  5956. super(e), this.rackApi_ = t;
  5957. }
  5958. }
  5959. function Zs(i, e) {
  5960. return i.addBlade(Object.assign(Object.assign({}, e), { view: "button" }));
  5961. }
  5962. function Ws(i, e) {
  5963. return i.addBlade(Object.assign(Object.assign({}, e), { view: "folder" }));
  5964. }
  5965. function Js(i, e) {
  5966. const t = e ?? {};
  5967. return i.addBlade(Object.assign(Object.assign({}, t), { view: "separator" }));
  5968. }
  5969. function vi(i, e) {
  5970. return i.addBlade(Object.assign(Object.assign({}, e), { view: "tab" }));
  5971. }
  5972. class Vt {
  5973. constructor(e) {
  5974. 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;
  5975. }
  5976. get items() {
  5977. return this.items_;
  5978. }
  5979. allItems() {
  5980. return Array.from(this.cache_);
  5981. }
  5982. find(e) {
  5983. for (const t of this.allItems())
  5984. if (e(t))
  5985. return t;
  5986. return null;
  5987. }
  5988. includes(e) {
  5989. return this.cache_.has(e);
  5990. }
  5991. add(e, t) {
  5992. if (this.includes(e))
  5993. throw k.shouldNeverHappen();
  5994. const l = t !== void 0 ? t : this.items_.length;
  5995. this.items_.splice(l, 0, e), this.cache_.add(e);
  5996. const b = this.extract_(e);
  5997. b && (b.emitter.on("add", this.onSubListAdd_), b.emitter.on("remove", this.onSubListRemove_), b.allItems().forEach((E) => {
  5998. this.cache_.add(E);
  5999. })), this.emitter.emit("add", {
  6000. index: l,
  6001. item: e,
  6002. root: this,
  6003. target: this
  6004. });
  6005. }
  6006. remove(e) {
  6007. const t = this.items_.indexOf(e);
  6008. if (t < 0)
  6009. return;
  6010. this.items_.splice(t, 1), this.cache_.delete(e);
  6011. const l = this.extract_(e);
  6012. l && (l.emitter.off("add", this.onSubListAdd_), l.emitter.off("remove", this.onSubListRemove_)), this.emitter.emit("remove", {
  6013. index: t,
  6014. item: e,
  6015. root: this,
  6016. target: this
  6017. });
  6018. }
  6019. onSubListAdd_(e) {
  6020. this.cache_.add(e.item), this.emitter.emit("add", {
  6021. index: e.index,
  6022. item: e.item,
  6023. root: this,
  6024. target: e.target
  6025. });
  6026. }
  6027. onSubListRemove_(e) {
  6028. this.cache_.delete(e.item), this.emitter.emit("remove", {
  6029. index: e.index,
  6030. item: e.item,
  6031. root: this,
  6032. target: e.target
  6033. });
  6034. }
  6035. }
  6036. class bi extends o {
  6037. constructor(e) {
  6038. super(e), this.onBindingChange_ = this.onBindingChange_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("change", this.onBindingChange_);
  6039. }
  6040. get label() {
  6041. return this.controller_.props.get("label");
  6042. }
  6043. set label(e) {
  6044. this.controller_.props.set("label", e);
  6045. }
  6046. on(e, t) {
  6047. const l = t.bind(this);
  6048. return this.emitter_.on(e, (b) => {
  6049. l(b.event);
  6050. }), this;
  6051. }
  6052. refresh() {
  6053. this.controller_.binding.read();
  6054. }
  6055. onBindingChange_(e) {
  6056. const t = e.sender.target.read();
  6057. this.emitter_.emit("change", {
  6058. event: new p(this, t, this.controller_.binding.target.presetKey, e.options.last)
  6059. });
  6060. }
  6061. }
  6062. class Ge extends U {
  6063. constructor(e, t) {
  6064. super(e, t), this.binding = t.binding;
  6065. }
  6066. }
  6067. class gi extends o {
  6068. constructor(e) {
  6069. super(e), this.onBindingUpdate_ = this.onBindingUpdate_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("update", this.onBindingUpdate_);
  6070. }
  6071. get label() {
  6072. return this.controller_.props.get("label");
  6073. }
  6074. set label(e) {
  6075. this.controller_.props.set("label", e);
  6076. }
  6077. on(e, t) {
  6078. const l = t.bind(this);
  6079. return this.emitter_.on(e, (b) => {
  6080. l(b.event);
  6081. }), this;
  6082. }
  6083. refresh() {
  6084. this.controller_.binding.read();
  6085. }
  6086. onBindingUpdate_(e) {
  6087. const t = e.sender.target.read();
  6088. this.emitter_.emit("update", {
  6089. event: new h(this, t, this.controller_.binding.target.presetKey)
  6090. });
  6091. }
  6092. }
  6093. class at extends U {
  6094. constructor(e, t) {
  6095. super(e, t), this.binding = t.binding, this.viewProps.bindDisabled(this.binding.ticker), this.viewProps.handleDispose(() => {
  6096. this.binding.dispose();
  6097. });
  6098. }
  6099. }
  6100. function rs(i) {
  6101. return i instanceof Yn ? i.apiSet_ : i instanceof Xe ? i.rackApi_.apiSet_ : null;
  6102. }
  6103. function dn(i, e) {
  6104. const t = i.find((l) => l.controller_ === e);
  6105. if (!t)
  6106. throw k.shouldNeverHappen();
  6107. return t;
  6108. }
  6109. function os(i, e, t) {
  6110. if (!A.isBindable(i))
  6111. throw k.notBindable();
  6112. return new A(i, e, t);
  6113. }
  6114. class Yn extends o {
  6115. constructor(e, t) {
  6116. 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 Vt(rs), this.pool_ = t;
  6117. const l = this.controller_.rack;
  6118. 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((b) => {
  6119. this.setUpApi_(b);
  6120. });
  6121. }
  6122. get children() {
  6123. return this.controller_.rack.children.map((e) => dn(this.apiSet_, e));
  6124. }
  6125. addInput(e, t, l) {
  6126. const b = l ?? {}, E = this.controller_.view.element.ownerDocument, M = this.pool_.createInput(E, os(e, t, b.presetKey), b), B = new bi(M);
  6127. return this.add(B, b.index);
  6128. }
  6129. addMonitor(e, t, l) {
  6130. const b = l ?? {}, E = this.controller_.view.element.ownerDocument, M = this.pool_.createMonitor(E, os(e, t), b), B = new gi(M);
  6131. return this.add(B, b.index);
  6132. }
  6133. addFolder(e) {
  6134. return Ws(this, e);
  6135. }
  6136. addButton(e) {
  6137. return Zs(this, e);
  6138. }
  6139. addSeparator(e) {
  6140. return Js(this, e);
  6141. }
  6142. addTab(e) {
  6143. return vi(this, e);
  6144. }
  6145. add(e, t) {
  6146. this.controller_.rack.add(e.controller_, t);
  6147. const l = this.apiSet_.find((b) => b.controller_ === e.controller_);
  6148. return l && this.apiSet_.remove(l), this.apiSet_.add(e), e;
  6149. }
  6150. remove(e) {
  6151. this.controller_.rack.remove(e.controller_);
  6152. }
  6153. addBlade(e) {
  6154. const t = this.controller_.view.element.ownerDocument, l = this.pool_.createBlade(t, e), b = this.pool_.createBladeApi(l);
  6155. return this.add(b, e.index);
  6156. }
  6157. on(e, t) {
  6158. const l = t.bind(this);
  6159. return this.emitter_.on(e, (b) => {
  6160. l(b.event);
  6161. }), this;
  6162. }
  6163. setUpApi_(e) {
  6164. this.apiSet_.find((l) => l.controller_ === e) || this.apiSet_.add(this.pool_.createBladeApi(e));
  6165. }
  6166. onRackAdd_(e) {
  6167. this.setUpApi_(e.bladeController);
  6168. }
  6169. onRackRemove_(e) {
  6170. if (e.isRoot) {
  6171. const t = dn(this.apiSet_, e.bladeController);
  6172. this.apiSet_.remove(t);
  6173. }
  6174. }
  6175. onRackInputChange_(e) {
  6176. const t = e.bladeController;
  6177. if (t instanceof Ge) {
  6178. const l = dn(this.apiSet_, t), b = t.binding;
  6179. this.emitter_.emit("change", {
  6180. event: new p(l, b.target.read(), b.target.presetKey, e.options.last)
  6181. });
  6182. } else if (t instanceof ie) {
  6183. const l = dn(this.apiSet_, t);
  6184. this.emitter_.emit("change", {
  6185. event: new p(l, t.value.rawValue, void 0, e.options.last)
  6186. });
  6187. }
  6188. }
  6189. onRackMonitorUpdate_(e) {
  6190. if (!(e.bladeController instanceof at))
  6191. throw k.shouldNeverHappen();
  6192. const t = dn(this.apiSet_, e.bladeController), l = e.bladeController.binding;
  6193. this.emitter_.emit("update", {
  6194. event: new h(t, l.target.read(), l.target.presetKey)
  6195. });
  6196. }
  6197. }
  6198. class _i extends Xe {
  6199. constructor(e, t) {
  6200. super(e, new Yn(e.rackController, t)), this.emitter_ = new F(), this.controller_.foldable.value("expanded").emitter.on("change", (l) => {
  6201. this.emitter_.emit("fold", {
  6202. event: new d(this, l.sender.rawValue)
  6203. });
  6204. }), this.rackApi_.on("change", (l) => {
  6205. this.emitter_.emit("change", {
  6206. event: l
  6207. });
  6208. }), this.rackApi_.on("update", (l) => {
  6209. this.emitter_.emit("update", {
  6210. event: l
  6211. });
  6212. });
  6213. }
  6214. get expanded() {
  6215. return this.controller_.foldable.get("expanded");
  6216. }
  6217. set expanded(e) {
  6218. this.controller_.foldable.set("expanded", e);
  6219. }
  6220. get title() {
  6221. return this.controller_.props.get("title");
  6222. }
  6223. set title(e) {
  6224. this.controller_.props.set("title", e);
  6225. }
  6226. get children() {
  6227. return this.rackApi_.children;
  6228. }
  6229. addInput(e, t, l) {
  6230. return this.rackApi_.addInput(e, t, l);
  6231. }
  6232. addMonitor(e, t, l) {
  6233. return this.rackApi_.addMonitor(e, t, l);
  6234. }
  6235. addFolder(e) {
  6236. return this.rackApi_.addFolder(e);
  6237. }
  6238. addButton(e) {
  6239. return this.rackApi_.addButton(e);
  6240. }
  6241. addSeparator(e) {
  6242. return this.rackApi_.addSeparator(e);
  6243. }
  6244. addTab(e) {
  6245. return this.rackApi_.addTab(e);
  6246. }
  6247. add(e, t) {
  6248. return this.rackApi_.add(e, t);
  6249. }
  6250. remove(e) {
  6251. this.rackApi_.remove(e);
  6252. }
  6253. addBlade(e) {
  6254. return this.rackApi_.addBlade(e);
  6255. }
  6256. on(e, t) {
  6257. const l = t.bind(this);
  6258. return this.emitter_.on(e, (b) => {
  6259. l(b.event);
  6260. }), this;
  6261. }
  6262. }
  6263. class wi extends Lt {
  6264. constructor(e) {
  6265. super({
  6266. blade: e.blade,
  6267. view: e.view,
  6268. viewProps: e.rackController.viewProps
  6269. }), this.rackController = e.rackController;
  6270. }
  6271. }
  6272. class er {
  6273. constructor(e, t) {
  6274. const l = D2(t.viewName);
  6275. this.element = e.createElement("div"), this.element.classList.add(l()), t.viewProps.bindClassModifiers(this.element);
  6276. }
  6277. }
  6278. function tr(i, e) {
  6279. for (let t = 0; t < i.length; t++) {
  6280. const l = i[t];
  6281. if (l instanceof Ge && l.binding === e)
  6282. return l;
  6283. }
  6284. return null;
  6285. }
  6286. function nr(i, e) {
  6287. for (let t = 0; t < i.length; t++) {
  6288. const l = i[t];
  6289. if (l instanceof at && l.binding === e)
  6290. return l;
  6291. }
  6292. return null;
  6293. }
  6294. function ir(i, e) {
  6295. for (let t = 0; t < i.length; t++) {
  6296. const l = i[t];
  6297. if (l instanceof ie && l.value === e)
  6298. return l;
  6299. }
  6300. return null;
  6301. }
  6302. function yi(i) {
  6303. return i instanceof mn ? i.rack : i instanceof wi ? i.rackController.rack : null;
  6304. }
  6305. function sr(i) {
  6306. const e = yi(i);
  6307. return e ? e.bcSet_ : null;
  6308. }
  6309. class rr {
  6310. constructor(e) {
  6311. var t, l;
  6312. 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 Vt(sr), this.bcSet_.emitter.on("add", this.onSetAdd_), this.bcSet_.emitter.on("remove", this.onSetRemove_);
  6313. }
  6314. get children() {
  6315. return this.bcSet_.items;
  6316. }
  6317. add(e, t) {
  6318. var l;
  6319. (l = e.parent) === null || l === void 0 || l.remove(e), P(e, "parent") ? e.parent = this : (e.parent_ = this, Fe({
  6320. key: "parent",
  6321. target: "BladeController",
  6322. place: "BladeRack.add"
  6323. })), this.bcSet_.add(e, t);
  6324. }
  6325. remove(e) {
  6326. P(e, "parent") ? e.parent = null : (e.parent_ = null, Fe({
  6327. key: "parent",
  6328. target: "BladeController",
  6329. place: "BladeRack.remove"
  6330. })), this.bcSet_.remove(e);
  6331. }
  6332. find(e) {
  6333. return this.bcSet_.allItems().filter((t) => t instanceof e);
  6334. }
  6335. onSetAdd_(e) {
  6336. this.updatePositions_();
  6337. const t = e.target === e.root;
  6338. if (this.emitter.emit("add", {
  6339. bladeController: e.item,
  6340. index: e.index,
  6341. isRoot: t,
  6342. sender: this
  6343. }), !t)
  6344. return;
  6345. const l = e.item;
  6346. if (l.viewProps.emitter.on("change", this.onChildViewPropsChange_), l.blade.value("positions").emitter.on("change", this.onChildPositionsChange_), l.viewProps.handleDispose(this.onChildDispose_), l instanceof Ge)
  6347. l.binding.emitter.on("change", this.onChildInputChange_);
  6348. else if (l instanceof at)
  6349. l.binding.emitter.on("update", this.onChildMonitorUpdate_);
  6350. else if (l instanceof ie)
  6351. l.value.emitter.on("change", this.onChildValueChange_);
  6352. else {
  6353. const b = yi(l);
  6354. if (b) {
  6355. const E = b.emitter;
  6356. E.on("layout", this.onDescendantLayout_), E.on("inputchange", this.onDescendantInputChange_), E.on("monitorupdate", this.onDescendantMonitorUpdate_);
  6357. }
  6358. }
  6359. }
  6360. onSetRemove_(e) {
  6361. this.updatePositions_();
  6362. const t = e.target === e.root;
  6363. if (this.emitter.emit("remove", {
  6364. bladeController: e.item,
  6365. isRoot: t,
  6366. sender: this
  6367. }), !t)
  6368. return;
  6369. const l = e.item;
  6370. if (l instanceof Ge)
  6371. l.binding.emitter.off("change", this.onChildInputChange_);
  6372. else if (l instanceof at)
  6373. l.binding.emitter.off("update", this.onChildMonitorUpdate_);
  6374. else if (l instanceof ie)
  6375. l.value.emitter.off("change", this.onChildValueChange_);
  6376. else {
  6377. const b = yi(l);
  6378. if (b) {
  6379. const E = b.emitter;
  6380. E.off("layout", this.onDescendantLayout_), E.off("inputchange", this.onDescendantInputChange_), E.off("monitorupdate", this.onDescendantMonitorUpdate_);
  6381. }
  6382. }
  6383. }
  6384. updatePositions_() {
  6385. const e = this.bcSet_.items.filter((b) => !b.viewProps.get("hidden")), t = e[0], l = e[e.length - 1];
  6386. this.bcSet_.items.forEach((b) => {
  6387. const E = [];
  6388. b === t && (E.push("first"), (!this.blade_ || this.blade_.get("positions").includes("veryfirst")) && E.push("veryfirst")), b === l && (E.push("last"), (!this.blade_ || this.blade_.get("positions").includes("verylast")) && E.push("verylast")), b.blade.set("positions", E);
  6389. });
  6390. }
  6391. onChildPositionsChange_() {
  6392. this.updatePositions_(), this.emitter.emit("layout", {
  6393. sender: this
  6394. });
  6395. }
  6396. onChildViewPropsChange_(e) {
  6397. this.updatePositions_(), this.emitter.emit("layout", {
  6398. sender: this
  6399. });
  6400. }
  6401. onChildDispose_() {
  6402. this.bcSet_.items.filter((t) => t.viewProps.get("disposed")).forEach((t) => {
  6403. this.bcSet_.remove(t);
  6404. });
  6405. }
  6406. onChildInputChange_(e) {
  6407. const t = tr(this.find(Ge), e.sender);
  6408. if (!t)
  6409. throw k.alreadyDisposed();
  6410. this.emitter.emit("inputchange", {
  6411. bladeController: t,
  6412. options: e.options,
  6413. sender: this
  6414. });
  6415. }
  6416. onChildMonitorUpdate_(e) {
  6417. const t = nr(this.find(at), e.sender);
  6418. if (!t)
  6419. throw k.alreadyDisposed();
  6420. this.emitter.emit("monitorupdate", {
  6421. bladeController: t,
  6422. sender: this
  6423. });
  6424. }
  6425. onChildValueChange_(e) {
  6426. const t = ir(this.find(ie), e.sender);
  6427. if (!t)
  6428. throw k.alreadyDisposed();
  6429. this.emitter.emit("inputchange", {
  6430. bladeController: t,
  6431. options: e.options,
  6432. sender: this
  6433. });
  6434. }
  6435. onDescendantLayout_(e) {
  6436. this.updatePositions_(), this.emitter.emit("layout", {
  6437. sender: this
  6438. });
  6439. }
  6440. onDescendantInputChange_(e) {
  6441. this.emitter.emit("inputchange", {
  6442. bladeController: e.bladeController,
  6443. options: e.options,
  6444. sender: this
  6445. });
  6446. }
  6447. onDescendantMonitorUpdate_(e) {
  6448. this.emitter.emit("monitorupdate", {
  6449. bladeController: e.bladeController,
  6450. sender: this
  6451. });
  6452. }
  6453. onBladePositionsChange_() {
  6454. this.updatePositions_();
  6455. }
  6456. }
  6457. class mn extends Lt {
  6458. constructor(e, t) {
  6459. super(Object.assign(Object.assign({}, t), { view: new er(e, {
  6460. viewName: "brk",
  6461. viewProps: t.viewProps
  6462. }) })), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this);
  6463. const l = new rr({
  6464. blade: t.root ? void 0 : t.blade,
  6465. viewProps: t.viewProps
  6466. });
  6467. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), this.rack = l, this.viewProps.handleDispose(() => {
  6468. for (let b = this.rack.children.length - 1; b >= 0; b--)
  6469. this.rack.children[b].viewProps.set("disposed", true);
  6470. });
  6471. }
  6472. onRackAdd_(e) {
  6473. e.isRoot && At(this.view.element, e.bladeController.view.element, e.index);
  6474. }
  6475. onRackRemove_(e) {
  6476. e.isRoot && $n(e.bladeController.view.element);
  6477. }
  6478. }
  6479. const as = D2("cnt");
  6480. class or {
  6481. constructor(e, t) {
  6482. var l;
  6483. this.className_ = D2((l = t.viewName) !== null && l !== void 0 ? l : "fld"), this.element = e.createElement("div"), this.element.classList.add(this.className_(), as()), 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")));
  6484. const b = e.createElement("button");
  6485. b.classList.add(this.className_("b")), O(t.props, "title", (J) => {
  6486. _2(J) ? this.element.classList.add(this.className_(void 0, "not")) : this.element.classList.remove(this.className_(void 0, "not"));
  6487. }), t.viewProps.bindDisabled(b), this.element.appendChild(b), this.buttonElement = b;
  6488. const E = e.createElement("div");
  6489. E.classList.add(this.className_("i")), this.element.appendChild(E);
  6490. const M = e.createElement("div");
  6491. M.classList.add(this.className_("t")), q(t.props.value("title"), M), this.buttonElement.appendChild(M), this.titleElement = M;
  6492. const B = e.createElement("div");
  6493. B.classList.add(this.className_("m")), this.buttonElement.appendChild(B);
  6494. const Q = t.containerElement;
  6495. Q.classList.add(this.className_("c")), this.element.appendChild(Q), this.containerElement = Q;
  6496. }
  6497. }
  6498. class qn extends wi {
  6499. constructor(e, t) {
  6500. var l;
  6501. const b = Be.create((l = t.expanded) !== null && l !== void 0 ? l : true), E = new mn(e, {
  6502. blade: t.blade,
  6503. root: t.root,
  6504. viewProps: t.viewProps
  6505. });
  6506. super(Object.assign(Object.assign({}, t), { rackController: E, view: new or(e, {
  6507. containerElement: E.view.element,
  6508. foldable: b,
  6509. props: t.props,
  6510. viewName: t.root ? "rot" : void 0,
  6511. viewProps: t.viewProps
  6512. }) })), this.onTitleClick_ = this.onTitleClick_.bind(this), this.props = t.props, this.foldable = b, $e(this.foldable, this.view.containerElement), this.rackController.rack.emitter.on("add", () => {
  6513. this.foldable.cleanUpTransition();
  6514. }), this.rackController.rack.emitter.on("remove", () => {
  6515. this.foldable.cleanUpTransition();
  6516. }), this.view.buttonElement.addEventListener("click", this.onTitleClick_);
  6517. }
  6518. get document() {
  6519. return this.view.element.ownerDocument;
  6520. }
  6521. onTitleClick_() {
  6522. this.foldable.set("expanded", !this.foldable.get("expanded"));
  6523. }
  6524. }
  6525. const ar = {
  6526. id: "folder",
  6527. type: "blade",
  6528. accept(i) {
  6529. const e = S, t = le(i, {
  6530. title: e.required.string,
  6531. view: e.required.constant("folder"),
  6532. expanded: e.optional.boolean
  6533. });
  6534. return t ? { params: t } : null;
  6535. },
  6536. controller(i) {
  6537. return new qn(i.document, {
  6538. blade: i.blade,
  6539. expanded: i.params.expanded,
  6540. props: X.fromObject({
  6541. title: i.params.title
  6542. }),
  6543. viewProps: i.viewProps
  6544. });
  6545. },
  6546. api(i) {
  6547. return i.controller instanceof qn ? new _i(i.controller, i.pool) : null;
  6548. }
  6549. };
  6550. class Kt extends ie {
  6551. constructor(e, t) {
  6552. const l = t.valueController.viewProps;
  6553. super(Object.assign(Object.assign({}, t), { value: t.valueController.value, view: new L(e, {
  6554. props: t.props,
  6555. viewProps: l
  6556. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  6557. }
  6558. }
  6559. class ls extends o {
  6560. }
  6561. const xi = D2("spr");
  6562. class lr {
  6563. constructor(e, t) {
  6564. this.element = e.createElement("div"), this.element.classList.add(xi()), t.viewProps.bindClassModifiers(this.element);
  6565. const l = e.createElement("hr");
  6566. l.classList.add(xi("r")), this.element.appendChild(l);
  6567. }
  6568. }
  6569. class fn extends Lt {
  6570. constructor(e, t) {
  6571. super(Object.assign(Object.assign({}, t), { view: new lr(e, {
  6572. viewProps: t.viewProps
  6573. }) }));
  6574. }
  6575. }
  6576. const cr = {
  6577. id: "separator",
  6578. type: "blade",
  6579. accept(i) {
  6580. const t = le(i, {
  6581. view: S.required.constant("separator")
  6582. });
  6583. return t ? { params: t } : null;
  6584. },
  6585. controller(i) {
  6586. return new fn(i.document, {
  6587. blade: i.blade,
  6588. viewProps: i.viewProps
  6589. });
  6590. },
  6591. api(i) {
  6592. return i.controller instanceof fn ? new ls(i.controller) : null;
  6593. }
  6594. }, Ie = D2("tbi");
  6595. class ur {
  6596. constructor(e, t) {
  6597. this.element = e.createElement("div"), this.element.classList.add(Ie()), t.viewProps.bindClassModifiers(this.element), O(t.props, "selected", (E) => {
  6598. E ? this.element.classList.add(Ie(void 0, "sel")) : this.element.classList.remove(Ie(void 0, "sel"));
  6599. });
  6600. const l = e.createElement("button");
  6601. l.classList.add(Ie("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  6602. const b = e.createElement("div");
  6603. b.classList.add(Ie("t")), q(t.props.value("title"), b), this.buttonElement.appendChild(b), this.titleElement = b;
  6604. }
  6605. }
  6606. class Qn {
  6607. constructor(e, t) {
  6608. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new ur(e, {
  6609. props: t.props,
  6610. viewProps: t.viewProps
  6611. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  6612. }
  6613. onClick_() {
  6614. this.emitter.emit("click", {
  6615. sender: this
  6616. });
  6617. }
  6618. }
  6619. class cs {
  6620. constructor(e, t) {
  6621. this.onItemClick_ = this.onItemClick_.bind(this), this.ic_ = new Qn(e, {
  6622. props: t.itemProps,
  6623. viewProps: Qe.create()
  6624. }), this.ic_.emitter.on("click", this.onItemClick_), this.cc_ = new mn(e, {
  6625. blade: xe(),
  6626. viewProps: Qe.create()
  6627. }), this.props = t.props, O(this.props, "selected", (l) => {
  6628. this.itemController.props.set("selected", l), this.contentController.viewProps.set("hidden", !l);
  6629. });
  6630. }
  6631. get itemController() {
  6632. return this.ic_;
  6633. }
  6634. get contentController() {
  6635. return this.cc_;
  6636. }
  6637. onItemClick_() {
  6638. this.props.set("selected", true);
  6639. }
  6640. }
  6641. class Ei {
  6642. constructor(e, t) {
  6643. this.controller_ = e, this.rackApi_ = t;
  6644. }
  6645. get title() {
  6646. var e;
  6647. return (e = this.controller_.itemController.props.get("title")) !== null && e !== void 0 ? e : "";
  6648. }
  6649. set title(e) {
  6650. this.controller_.itemController.props.set("title", e);
  6651. }
  6652. get selected() {
  6653. return this.controller_.props.get("selected");
  6654. }
  6655. set selected(e) {
  6656. this.controller_.props.set("selected", e);
  6657. }
  6658. get children() {
  6659. return this.rackApi_.children;
  6660. }
  6661. addButton(e) {
  6662. return this.rackApi_.addButton(e);
  6663. }
  6664. addFolder(e) {
  6665. return this.rackApi_.addFolder(e);
  6666. }
  6667. addSeparator(e) {
  6668. return this.rackApi_.addSeparator(e);
  6669. }
  6670. addTab(e) {
  6671. return this.rackApi_.addTab(e);
  6672. }
  6673. add(e, t) {
  6674. this.rackApi_.add(e, t);
  6675. }
  6676. remove(e) {
  6677. this.rackApi_.remove(e);
  6678. }
  6679. addInput(e, t, l) {
  6680. return this.rackApi_.addInput(e, t, l);
  6681. }
  6682. addMonitor(e, t, l) {
  6683. return this.rackApi_.addMonitor(e, t, l);
  6684. }
  6685. addBlade(e) {
  6686. return this.rackApi_.addBlade(e);
  6687. }
  6688. }
  6689. class us extends Xe {
  6690. constructor(e, t) {
  6691. 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) => {
  6692. this.emitter_.emit("change", {
  6693. event: l
  6694. });
  6695. }), this.rackApi_.on("update", (l) => {
  6696. this.emitter_.emit("update", {
  6697. event: l
  6698. });
  6699. }), 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) => {
  6700. this.setUpPageApi_(l);
  6701. });
  6702. }
  6703. get pages() {
  6704. return this.controller_.pageSet.items.map((e) => {
  6705. const t = this.pageApiMap_.get(e);
  6706. if (!t)
  6707. throw k.shouldNeverHappen();
  6708. return t;
  6709. });
  6710. }
  6711. addPage(e) {
  6712. const t = this.controller_.view.element.ownerDocument, l = new cs(t, {
  6713. itemProps: X.fromObject({
  6714. selected: false,
  6715. title: e.title
  6716. }),
  6717. props: X.fromObject({
  6718. selected: false
  6719. })
  6720. });
  6721. this.controller_.add(l, e.index);
  6722. const b = this.pageApiMap_.get(l);
  6723. if (!b)
  6724. throw k.shouldNeverHappen();
  6725. return b;
  6726. }
  6727. removePage(e) {
  6728. this.controller_.remove(e);
  6729. }
  6730. on(e, t) {
  6731. const l = t.bind(this);
  6732. return this.emitter_.on(e, (b) => {
  6733. l(b.event);
  6734. }), this;
  6735. }
  6736. setUpPageApi_(e) {
  6737. const t = this.rackApi_.apiSet_.find((b) => b.controller_ === e.contentController);
  6738. if (!t)
  6739. throw k.shouldNeverHappen();
  6740. const l = new Ei(e, t);
  6741. this.pageApiMap_.set(e, l);
  6742. }
  6743. onPageAdd_(e) {
  6744. this.setUpPageApi_(e.item);
  6745. }
  6746. onPageRemove_(e) {
  6747. if (!this.pageApiMap_.get(e.item))
  6748. throw k.shouldNeverHappen();
  6749. this.pageApiMap_.delete(e.item);
  6750. }
  6751. onSelect_(e) {
  6752. this.emitter_.emit("select", {
  6753. event: new g(this, e.rawValue)
  6754. });
  6755. }
  6756. }
  6757. const ps = -1;
  6758. class pr {
  6759. constructor() {
  6760. this.onItemSelectedChange_ = this.onItemSelectedChange_.bind(this), this.empty = ee(true), this.selectedIndex = ee(ps), this.items_ = [];
  6761. }
  6762. add(e, t) {
  6763. const l = t ?? this.items_.length;
  6764. this.items_.splice(l, 0, e), e.emitter.on("change", this.onItemSelectedChange_), this.keepSelection_();
  6765. }
  6766. remove(e) {
  6767. const t = this.items_.indexOf(e);
  6768. t < 0 || (this.items_.splice(t, 1), e.emitter.off("change", this.onItemSelectedChange_), this.keepSelection_());
  6769. }
  6770. keepSelection_() {
  6771. if (this.items_.length === 0) {
  6772. this.selectedIndex.rawValue = ps, this.empty.rawValue = true;
  6773. return;
  6774. }
  6775. const e = this.items_.findIndex((t) => t.rawValue);
  6776. e < 0 ? (this.items_.forEach((t, l) => {
  6777. t.rawValue = l === 0;
  6778. }), this.selectedIndex.rawValue = 0) : (this.items_.forEach((t, l) => {
  6779. t.rawValue = l === e;
  6780. }), this.selectedIndex.rawValue = e), this.empty.rawValue = false;
  6781. }
  6782. onItemSelectedChange_(e) {
  6783. if (e.rawValue) {
  6784. const t = this.items_.findIndex((l) => l === e.sender);
  6785. this.items_.forEach((l, b) => {
  6786. l.rawValue = b === t;
  6787. }), this.selectedIndex.rawValue = t;
  6788. } else
  6789. this.keepSelection_();
  6790. }
  6791. }
  6792. const $t = D2("tab");
  6793. class Xt {
  6794. constructor(e, t) {
  6795. this.element = e.createElement("div"), this.element.classList.add($t(), as()), t.viewProps.bindClassModifiers(this.element), N(t.empty, K(this.element, $t(void 0, "nop")));
  6796. const l = e.createElement("div");
  6797. l.classList.add($t("t")), this.element.appendChild(l), this.itemsElement = l;
  6798. const b = e.createElement("div");
  6799. b.classList.add($t("i")), this.element.appendChild(b);
  6800. const E = t.contentsElement;
  6801. E.classList.add($t("c")), this.element.appendChild(E), this.contentsElement = E;
  6802. }
  6803. }
  6804. class vn extends wi {
  6805. constructor(e, t) {
  6806. const l = new mn(e, {
  6807. blade: t.blade,
  6808. viewProps: t.viewProps
  6809. }), b = new pr();
  6810. super({
  6811. blade: t.blade,
  6812. rackController: l,
  6813. view: new Xt(e, {
  6814. contentsElement: l.view.element,
  6815. empty: b.empty,
  6816. viewProps: t.viewProps
  6817. })
  6818. }), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.pageSet_ = new Vt(() => null), this.pageSet_.emitter.on("add", this.onPageAdd_), this.pageSet_.emitter.on("remove", this.onPageRemove_), this.tab = b;
  6819. }
  6820. get pageSet() {
  6821. return this.pageSet_;
  6822. }
  6823. add(e, t) {
  6824. this.pageSet_.add(e, t);
  6825. }
  6826. remove(e) {
  6827. this.pageSet_.remove(this.pageSet_.items[e]);
  6828. }
  6829. onPageAdd_(e) {
  6830. const t = e.item;
  6831. At(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"));
  6832. }
  6833. onPageRemove_(e) {
  6834. const t = e.item;
  6835. $n(t.itemController.view.element), t.itemController.viewProps.set("parent", null), this.rackController.rack.remove(t.contentController), this.tab.remove(t.props.value("selected"));
  6836. }
  6837. }
  6838. const Ci = {
  6839. id: "tab",
  6840. type: "blade",
  6841. accept(i) {
  6842. const e = S, t = le(i, {
  6843. pages: e.required.array(e.required.object({ title: e.required.string })),
  6844. view: e.required.constant("tab")
  6845. });
  6846. return !t || t.pages.length === 0 ? null : { params: t };
  6847. },
  6848. controller(i) {
  6849. const e = new vn(i.document, {
  6850. blade: i.blade,
  6851. viewProps: i.viewProps
  6852. });
  6853. return i.params.pages.forEach((t) => {
  6854. const l = new cs(i.document, {
  6855. itemProps: X.fromObject({
  6856. selected: false,
  6857. title: t.title
  6858. }),
  6859. props: X.fromObject({
  6860. selected: false
  6861. })
  6862. });
  6863. e.add(l);
  6864. }), e;
  6865. },
  6866. api(i) {
  6867. return i.controller instanceof vn ? new us(i.controller, i.pool) : null;
  6868. }
  6869. };
  6870. function hr(i, e) {
  6871. const t = i.accept(e.params);
  6872. if (!t)
  6873. return null;
  6874. const l = S.optional.boolean(e.params.disabled).value, b = S.optional.boolean(e.params.hidden).value;
  6875. return i.controller({
  6876. blade: xe(),
  6877. document: e.document,
  6878. params: Object.assign(Object.assign({}, t.params), { disabled: l, hidden: b }),
  6879. viewProps: Qe.create({
  6880. disabled: l,
  6881. hidden: b
  6882. })
  6883. });
  6884. }
  6885. class hs {
  6886. constructor() {
  6887. this.disabled = false, this.emitter = new F();
  6888. }
  6889. dispose() {
  6890. }
  6891. tick() {
  6892. this.disabled || this.emitter.emit("tick", {
  6893. sender: this
  6894. });
  6895. }
  6896. }
  6897. class Pi {
  6898. constructor(e, t) {
  6899. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = e, this.emitter = new F(), this.interval_ = t, this.setTimer_();
  6900. }
  6901. get disabled() {
  6902. return this.disabled_;
  6903. }
  6904. set disabled(e) {
  6905. this.disabled_ = e, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  6906. }
  6907. dispose() {
  6908. this.clearTimer_();
  6909. }
  6910. clearTimer_() {
  6911. if (this.timerId_ === null)
  6912. return;
  6913. const e = this.doc_.defaultView;
  6914. e && e.clearInterval(this.timerId_), this.timerId_ = null;
  6915. }
  6916. setTimer_() {
  6917. if (this.clearTimer_(), this.interval_ <= 0)
  6918. return;
  6919. const e = this.doc_.defaultView;
  6920. e && (this.timerId_ = e.setInterval(this.onTick_, this.interval_));
  6921. }
  6922. onTick_() {
  6923. this.disabled_ || this.emitter.emit("tick", {
  6924. sender: this
  6925. });
  6926. }
  6927. }
  6928. class Zn {
  6929. constructor(e) {
  6930. 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();
  6931. }
  6932. read() {
  6933. const e = this.target.read();
  6934. e !== void 0 && (this.value.rawValue = this.reader(e));
  6935. }
  6936. write_(e) {
  6937. this.writer(this.target, e);
  6938. }
  6939. onValueChange_(e) {
  6940. this.write_(e.rawValue), this.emitter.emit("change", {
  6941. options: e.options,
  6942. rawValue: e.rawValue,
  6943. sender: this
  6944. });
  6945. }
  6946. }
  6947. function Ae(i, e) {
  6948. for (; i.length < e; )
  6949. i.push(void 0);
  6950. }
  6951. function ds(i) {
  6952. const e = [];
  6953. return Ae(e, i), ee(e);
  6954. }
  6955. function Yt(i) {
  6956. const e = i.indexOf(void 0);
  6957. return e < 0 ? i : i.slice(0, e);
  6958. }
  6959. function Ze(i, e) {
  6960. const t = [...Yt(i), e];
  6961. return t.length > i.length ? t.splice(0, t.length - i.length) : Ae(t, i.length), t;
  6962. }
  6963. class dr {
  6964. constructor(e) {
  6965. 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();
  6966. }
  6967. dispose() {
  6968. this.ticker.dispose();
  6969. }
  6970. read() {
  6971. const e = this.target.read();
  6972. if (e === void 0)
  6973. return;
  6974. const t = this.value.rawValue, l = this.reader_(e);
  6975. this.value.rawValue = Ze(t, l), this.emitter.emit("update", {
  6976. rawValue: l,
  6977. sender: this
  6978. });
  6979. }
  6980. onTick_(e) {
  6981. this.read();
  6982. }
  6983. }
  6984. class bn {
  6985. constructor(e) {
  6986. this.constraints = e;
  6987. }
  6988. constrain(e) {
  6989. return this.constraints.reduce((t, l) => l.constrain(t), e);
  6990. }
  6991. }
  6992. function nt(i, e) {
  6993. if (i instanceof e)
  6994. return i;
  6995. if (i instanceof bn) {
  6996. const t = i.constraints.reduce((l, b) => l || (b instanceof e ? b : null), null);
  6997. if (t)
  6998. return t;
  6999. }
  7000. return null;
  7001. }
  7002. class qt {
  7003. constructor(e) {
  7004. this.values = X.fromObject({
  7005. max: e.max,
  7006. min: e.min
  7007. });
  7008. }
  7009. constrain(e) {
  7010. const t = this.values.get("max"), l = this.values.get("min");
  7011. return Math.min(Math.max(e, l), t);
  7012. }
  7013. }
  7014. class gn {
  7015. constructor(e) {
  7016. this.values = X.fromObject({
  7017. options: e
  7018. });
  7019. }
  7020. get options() {
  7021. return this.values.get("options");
  7022. }
  7023. constrain(e) {
  7024. const t = this.values.get("options");
  7025. return t.length === 0 || t.filter((b) => b.value === e).length > 0 ? e : t[0].value;
  7026. }
  7027. }
  7028. class Ti {
  7029. constructor(e) {
  7030. this.values = X.fromObject({
  7031. max: e.max,
  7032. min: e.min
  7033. });
  7034. }
  7035. get maxValue() {
  7036. return this.values.get("max");
  7037. }
  7038. get minValue() {
  7039. return this.values.get("min");
  7040. }
  7041. constrain(e) {
  7042. const t = this.values.get("max"), l = this.values.get("min");
  7043. let b = e;
  7044. return _2(l) || (b = Math.max(b, l)), _2(t) || (b = Math.min(b, t)), b;
  7045. }
  7046. }
  7047. class Wn {
  7048. constructor(e, t = 0) {
  7049. this.step = e, this.origin = t;
  7050. }
  7051. constrain(e) {
  7052. const t = this.origin % this.step, l = Math.round((e - t) / this.step);
  7053. return t + l * this.step;
  7054. }
  7055. }
  7056. const Qt = D2("lst");
  7057. class ms {
  7058. constructor(e, t) {
  7059. 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);
  7060. const l = e.createElement("select");
  7061. l.classList.add(Qt("s")), O(this.props_, "options", (E) => {
  7062. pn(l), E.forEach((M, B) => {
  7063. const Q = e.createElement("option");
  7064. Q.dataset.index = String(B), Q.textContent = M.text, Q.value = String(M.value), l.appendChild(Q);
  7065. });
  7066. }), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.selectElement = l;
  7067. const b = e.createElement("div");
  7068. b.classList.add(Qt("m")), b.appendChild(Et(e, "dropdown")), this.element.appendChild(b), t.value.emitter.on("change", this.onValueChange_), this.value_ = t.value, this.update_();
  7069. }
  7070. update_() {
  7071. this.selectElement.value = String(this.value_.rawValue);
  7072. }
  7073. onValueChange_() {
  7074. this.update_();
  7075. }
  7076. }
  7077. class _n {
  7078. constructor(e, t) {
  7079. this.onSelectChange_ = this.onSelectChange_.bind(this), this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new ms(e, {
  7080. props: this.props,
  7081. value: this.value,
  7082. viewProps: this.viewProps
  7083. }), this.view.selectElement.addEventListener("change", this.onSelectChange_);
  7084. }
  7085. onSelectChange_(e) {
  7086. const l = e.currentTarget.selectedOptions.item(0);
  7087. if (!l)
  7088. return;
  7089. const b = Number(l.dataset.index);
  7090. this.value.rawValue = this.props.get("options")[b].value;
  7091. }
  7092. }
  7093. const fs = D2("pop");
  7094. class mr {
  7095. constructor(e, t) {
  7096. this.element = e.createElement("div"), this.element.classList.add(fs()), t.viewProps.bindClassModifiers(this.element), N(t.shows, K(this.element, fs(void 0, "v")));
  7097. }
  7098. }
  7099. class vs {
  7100. constructor(e, t) {
  7101. this.shows = ee(false), this.viewProps = t.viewProps, this.view = new mr(e, {
  7102. shows: this.shows,
  7103. viewProps: this.viewProps
  7104. });
  7105. }
  7106. }
  7107. const bs = D2("txt");
  7108. class fr {
  7109. constructor(e, t) {
  7110. this.onChange_ = this.onChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(bs()), t.viewProps.bindClassModifiers(this.element), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_);
  7111. const l = e.createElement("input");
  7112. l.classList.add(bs("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();
  7113. }
  7114. refresh() {
  7115. const e = this.props_.get("formatter");
  7116. this.inputElement.value = e(this.value_.rawValue);
  7117. }
  7118. onChange_() {
  7119. this.refresh();
  7120. }
  7121. }
  7122. class Jn {
  7123. constructor(e, t) {
  7124. 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 fr(e, {
  7125. props: t.props,
  7126. value: this.value,
  7127. viewProps: this.viewProps
  7128. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7129. }
  7130. onInputChange_(e) {
  7131. const l = e.currentTarget.value, b = this.parser_(l);
  7132. _2(b) || (this.value.rawValue = b), this.view.refresh();
  7133. }
  7134. }
  7135. function vr(i) {
  7136. return String(i);
  7137. }
  7138. function gs(i) {
  7139. return i === "false" ? false : !!i;
  7140. }
  7141. function _s(i) {
  7142. return vr(i);
  7143. }
  7144. class br {
  7145. constructor(e) {
  7146. this.text = e;
  7147. }
  7148. evaluate() {
  7149. return Number(this.text);
  7150. }
  7151. toString() {
  7152. return this.text;
  7153. }
  7154. }
  7155. const gr = {
  7156. "**": (i, e) => Math.pow(i, e),
  7157. "*": (i, e) => i * e,
  7158. "/": (i, e) => i / e,
  7159. "%": (i, e) => i % e,
  7160. "+": (i, e) => i + e,
  7161. "-": (i, e) => i - e,
  7162. "<<": (i, e) => i << e,
  7163. ">>": (i, e) => i >> e,
  7164. ">>>": (i, e) => i >>> e,
  7165. "&": (i, e) => i & e,
  7166. "^": (i, e) => i ^ e,
  7167. "|": (i, e) => i | e
  7168. };
  7169. class _r {
  7170. constructor(e, t, l) {
  7171. this.left = t, this.operator = e, this.right = l;
  7172. }
  7173. evaluate() {
  7174. const e = gr[this.operator];
  7175. if (!e)
  7176. throw new Error(`unexpected binary operator: '${this.operator}`);
  7177. return e(this.left.evaluate(), this.right.evaluate());
  7178. }
  7179. toString() {
  7180. return [
  7181. "b(",
  7182. this.left.toString(),
  7183. this.operator,
  7184. this.right.toString(),
  7185. ")"
  7186. ].join(" ");
  7187. }
  7188. }
  7189. const ws = {
  7190. "+": (i) => i,
  7191. "-": (i) => -i,
  7192. "~": (i) => ~i
  7193. };
  7194. class wr {
  7195. constructor(e, t) {
  7196. this.operator = e, this.expression = t;
  7197. }
  7198. evaluate() {
  7199. const e = ws[this.operator];
  7200. if (!e)
  7201. throw new Error(`unexpected unary operator: '${this.operator}`);
  7202. return e(this.expression.evaluate());
  7203. }
  7204. toString() {
  7205. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  7206. }
  7207. }
  7208. function ki(i) {
  7209. return (e, t) => {
  7210. for (let l = 0; l < i.length; l++) {
  7211. const b = i[l](e, t);
  7212. if (b !== "")
  7213. return b;
  7214. }
  7215. return "";
  7216. };
  7217. }
  7218. function It(i, e) {
  7219. var t;
  7220. const l = i.substr(e).match(/^\s+/);
  7221. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7222. }
  7223. function yr(i, e) {
  7224. const t = i.substr(e, 1);
  7225. return t.match(/^[1-9]$/) ? t : "";
  7226. }
  7227. function wn(i, e) {
  7228. var t;
  7229. const l = i.substr(e).match(/^[0-9]+/);
  7230. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7231. }
  7232. function xr(i, e) {
  7233. const t = wn(i, e);
  7234. if (t !== "")
  7235. return t;
  7236. const l = i.substr(e, 1);
  7237. if (e += 1, l !== "-" && l !== "+")
  7238. return "";
  7239. const b = wn(i, e);
  7240. return b === "" ? "" : l + b;
  7241. }
  7242. function lt(i, e) {
  7243. const t = i.substr(e, 1);
  7244. if (e += 1, t.toLowerCase() !== "e")
  7245. return "";
  7246. const l = xr(i, e);
  7247. return l === "" ? "" : t + l;
  7248. }
  7249. function ys(i, e) {
  7250. const t = i.substr(e, 1);
  7251. if (t === "0")
  7252. return t;
  7253. const l = yr(i, e);
  7254. return e += l.length, l === "" ? "" : l + wn(i, e);
  7255. }
  7256. function Er(i, e) {
  7257. const t = ys(i, e);
  7258. if (e += t.length, t === "")
  7259. return "";
  7260. const l = i.substr(e, 1);
  7261. if (e += l.length, l !== ".")
  7262. return "";
  7263. const b = wn(i, e);
  7264. return e += b.length, t + l + b + lt(i, e);
  7265. }
  7266. function xs(i, e) {
  7267. const t = i.substr(e, 1);
  7268. if (e += t.length, t !== ".")
  7269. return "";
  7270. const l = wn(i, e);
  7271. return e += l.length, l === "" ? "" : t + l + lt(i, e);
  7272. }
  7273. function Cr(i, e) {
  7274. const t = ys(i, e);
  7275. return e += t.length, t === "" ? "" : t + lt(i, e);
  7276. }
  7277. const Es = ki([
  7278. Er,
  7279. xs,
  7280. Cr
  7281. ]);
  7282. function Mi(i, e) {
  7283. var t;
  7284. const l = i.substr(e).match(/^[01]+/);
  7285. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7286. }
  7287. function Pr(i, e) {
  7288. const t = i.substr(e, 2);
  7289. if (e += t.length, t.toLowerCase() !== "0b")
  7290. return "";
  7291. const l = Mi(i, e);
  7292. return l === "" ? "" : t + l;
  7293. }
  7294. function Cs(i, e) {
  7295. var t;
  7296. const l = i.substr(e).match(/^[0-7]+/);
  7297. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7298. }
  7299. function We(i, e) {
  7300. const t = i.substr(e, 2);
  7301. if (e += t.length, t.toLowerCase() !== "0o")
  7302. return "";
  7303. const l = Cs(i, e);
  7304. return l === "" ? "" : t + l;
  7305. }
  7306. function Tr(i, e) {
  7307. var t;
  7308. const l = i.substr(e).match(/^[0-9a-f]+/i);
  7309. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7310. }
  7311. function kr(i, e) {
  7312. const t = i.substr(e, 2);
  7313. if (e += t.length, t.toLowerCase() !== "0x")
  7314. return "";
  7315. const l = Tr(i, e);
  7316. return l === "" ? "" : t + l;
  7317. }
  7318. const Si = ki([
  7319. Pr,
  7320. We,
  7321. kr
  7322. ]), Mr = ki([
  7323. Si,
  7324. Es
  7325. ]);
  7326. function Pt(i, e) {
  7327. const t = Mr(i, e);
  7328. return e += t.length, t === "" ? null : {
  7329. evaluable: new br(t),
  7330. cursor: e
  7331. };
  7332. }
  7333. function Li(i, e) {
  7334. const t = i.substr(e, 1);
  7335. if (e += t.length, t !== "(")
  7336. return null;
  7337. const l = ei(i, e);
  7338. if (!l)
  7339. return null;
  7340. e = l.cursor, e += It(i, e).length;
  7341. const b = i.substr(e, 1);
  7342. return e += b.length, b !== ")" ? null : {
  7343. evaluable: l.evaluable,
  7344. cursor: e
  7345. };
  7346. }
  7347. function Sr(i, e) {
  7348. var t;
  7349. return (t = Pt(i, e)) !== null && t !== void 0 ? t : Li(i, e);
  7350. }
  7351. function Ai(i, e) {
  7352. const t = Sr(i, e);
  7353. if (t)
  7354. return t;
  7355. const l = i.substr(e, 1);
  7356. if (e += l.length, l !== "+" && l !== "-" && l !== "~")
  7357. return null;
  7358. const b = Ai(i, e);
  7359. return b ? (e = b.cursor, {
  7360. cursor: e,
  7361. evaluable: new wr(l, b.evaluable)
  7362. }) : null;
  7363. }
  7364. function Lr(i, e, t) {
  7365. t += It(e, t).length;
  7366. const l = i.filter((b) => e.startsWith(b, t))[0];
  7367. return l ? (t += l.length, t += It(e, t).length, {
  7368. cursor: t,
  7369. operator: l
  7370. }) : null;
  7371. }
  7372. function Dt(i, e) {
  7373. return (t, l) => {
  7374. const b = i(t, l);
  7375. if (!b)
  7376. return null;
  7377. l = b.cursor;
  7378. let E = b.evaluable;
  7379. for (; ; ) {
  7380. const M = Lr(e, t, l);
  7381. if (!M)
  7382. break;
  7383. l = M.cursor;
  7384. const B = i(t, l);
  7385. if (!B)
  7386. return null;
  7387. l = B.cursor, E = new _r(M.operator, E, B.evaluable);
  7388. }
  7389. return E ? {
  7390. cursor: l,
  7391. evaluable: E
  7392. } : null;
  7393. };
  7394. }
  7395. const Ps = [
  7396. ["**"],
  7397. ["*", "/", "%"],
  7398. ["+", "-"],
  7399. ["<<", ">>>", ">>"],
  7400. ["&"],
  7401. ["^"],
  7402. ["|"]
  7403. ].reduce((i, e) => Dt(i, e), Ai);
  7404. function ei(i, e) {
  7405. return e += It(i, e).length, Ps(i, e);
  7406. }
  7407. function Ts(i) {
  7408. const e = ei(i, 0);
  7409. return !e || e.cursor + It(i, e.cursor).length !== i.length ? null : e.evaluable;
  7410. }
  7411. function ct(i) {
  7412. var e;
  7413. const t = Ts(i);
  7414. return (e = t == null ? void 0 : t.evaluate()) !== null && e !== void 0 ? e : null;
  7415. }
  7416. function _t(i) {
  7417. if (typeof i == "number")
  7418. return i;
  7419. if (typeof i == "string") {
  7420. const e = ct(i);
  7421. if (!_2(e))
  7422. return e;
  7423. }
  7424. return 0;
  7425. }
  7426. function Ar(i) {
  7427. return String(i);
  7428. }
  7429. function De(i) {
  7430. return (e) => e.toFixed(Math.max(Math.min(i, 20), 0));
  7431. }
  7432. const ks = De(0);
  7433. function yn(i) {
  7434. return ks(i) + "%";
  7435. }
  7436. function Ri(i) {
  7437. return String(i);
  7438. }
  7439. function Tt(i) {
  7440. return i;
  7441. }
  7442. function Zt({ primary: i, secondary: e, forward: t, backward: l }) {
  7443. let b = false;
  7444. function E(M) {
  7445. b || (b = true, M(), b = false);
  7446. }
  7447. i.emitter.on("change", (M) => {
  7448. E(() => {
  7449. e.setRawValue(t(i, e), M.options);
  7450. });
  7451. }), e.emitter.on("change", (M) => {
  7452. E(() => {
  7453. i.setRawValue(l(i, e), M.options);
  7454. }), E(() => {
  7455. e.setRawValue(t(i, e), M.options);
  7456. });
  7457. }), E(() => {
  7458. e.setRawValue(t(i, e), {
  7459. forceEmit: false,
  7460. last: true
  7461. });
  7462. });
  7463. }
  7464. function ze(i, e) {
  7465. const t = i * (e.altKey ? 0.1 : 1) * (e.shiftKey ? 10 : 1);
  7466. return e.upKey ? +t : e.downKey ? -t : 0;
  7467. }
  7468. function xn(i) {
  7469. return {
  7470. altKey: i.altKey,
  7471. downKey: i.key === "ArrowDown",
  7472. shiftKey: i.shiftKey,
  7473. upKey: i.key === "ArrowUp"
  7474. };
  7475. }
  7476. function ut(i) {
  7477. return {
  7478. altKey: i.altKey,
  7479. downKey: i.key === "ArrowLeft",
  7480. shiftKey: i.shiftKey,
  7481. upKey: i.key === "ArrowRight"
  7482. };
  7483. }
  7484. function Ms(i) {
  7485. return i === "ArrowUp" || i === "ArrowDown";
  7486. }
  7487. function ti(i) {
  7488. return Ms(i) || i === "ArrowLeft" || i === "ArrowRight";
  7489. }
  7490. function Vi(i, e) {
  7491. var t, l;
  7492. const b = e.ownerDocument.defaultView, E = e.getBoundingClientRect();
  7493. return {
  7494. x: i.pageX - (((t = b && b.scrollX) !== null && t !== void 0 ? t : 0) + E.left),
  7495. y: i.pageY - (((l = b && b.scrollY) !== null && l !== void 0 ? l : 0) + E.top)
  7496. };
  7497. }
  7498. class Ot {
  7499. constructor(e) {
  7500. 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_, {
  7501. passive: false
  7502. }), e.addEventListener("touchmove", this.onTouchMove_, {
  7503. passive: true
  7504. }), e.addEventListener("touchend", this.onTouchEnd_), e.addEventListener("mousedown", this.onMouseDown_);
  7505. }
  7506. computePosition_(e) {
  7507. const t = this.elem_.getBoundingClientRect();
  7508. return {
  7509. bounds: {
  7510. width: t.width,
  7511. height: t.height
  7512. },
  7513. point: e ? {
  7514. x: e.x,
  7515. y: e.y
  7516. } : null
  7517. };
  7518. }
  7519. onMouseDown_(e) {
  7520. var t;
  7521. e.preventDefault(), (t = e.currentTarget) === null || t === void 0 || t.focus();
  7522. const l = this.elem_.ownerDocument;
  7523. l.addEventListener("mousemove", this.onDocumentMouseMove_), l.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  7524. altKey: e.altKey,
  7525. data: this.computePosition_(Vi(e, this.elem_)),
  7526. sender: this,
  7527. shiftKey: e.shiftKey
  7528. });
  7529. }
  7530. onDocumentMouseMove_(e) {
  7531. this.emitter.emit("move", {
  7532. altKey: e.altKey,
  7533. data: this.computePosition_(Vi(e, this.elem_)),
  7534. sender: this,
  7535. shiftKey: e.shiftKey
  7536. });
  7537. }
  7538. onDocumentMouseUp_(e) {
  7539. const t = this.elem_.ownerDocument;
  7540. t.removeEventListener("mousemove", this.onDocumentMouseMove_), t.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  7541. altKey: e.altKey,
  7542. data: this.computePosition_(Vi(e, this.elem_)),
  7543. sender: this,
  7544. shiftKey: e.shiftKey
  7545. });
  7546. }
  7547. onTouchStart_(e) {
  7548. e.preventDefault();
  7549. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  7550. this.emitter.emit("down", {
  7551. altKey: e.altKey,
  7552. data: this.computePosition_(t ? {
  7553. x: t.clientX - l.left,
  7554. y: t.clientY - l.top
  7555. } : void 0),
  7556. sender: this,
  7557. shiftKey: e.shiftKey
  7558. }), this.lastTouch_ = t;
  7559. }
  7560. onTouchMove_(e) {
  7561. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  7562. this.emitter.emit("move", {
  7563. altKey: e.altKey,
  7564. data: this.computePosition_(t ? {
  7565. x: t.clientX - l.left,
  7566. y: t.clientY - l.top
  7567. } : void 0),
  7568. sender: this,
  7569. shiftKey: e.shiftKey
  7570. }), this.lastTouch_ = t;
  7571. }
  7572. onTouchEnd_(e) {
  7573. var t;
  7574. const l = (t = e.targetTouches.item(0)) !== null && t !== void 0 ? t : this.lastTouch_, b = this.elem_.getBoundingClientRect();
  7575. this.emitter.emit("up", {
  7576. altKey: e.altKey,
  7577. data: this.computePosition_(l ? {
  7578. x: l.clientX - b.left,
  7579. y: l.clientY - b.top
  7580. } : void 0),
  7581. sender: this,
  7582. shiftKey: e.shiftKey
  7583. });
  7584. }
  7585. }
  7586. function we(i, e, t, l, b) {
  7587. const E = (i - e) / (t - e);
  7588. return l + E * (b - l);
  7589. }
  7590. function Ii(i) {
  7591. return String(i.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  7592. }
  7593. function Re(i, e, t) {
  7594. return Math.min(Math.max(i, e), t);
  7595. }
  7596. function Wt(i, e) {
  7597. return (i % e + e) % e;
  7598. }
  7599. const Ye = D2("txt");
  7600. class Di {
  7601. constructor(e, t) {
  7602. 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(Ye(), Ye(void 0, "num")), t.arrayPosition && this.element.classList.add(Ye(void 0, t.arrayPosition)), t.viewProps.bindClassModifiers(this.element);
  7603. const l = e.createElement("input");
  7604. l.classList.add(Ye("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(Ye()), this.inputElement.classList.add(Ye("i"));
  7605. const b = e.createElement("div");
  7606. b.classList.add(Ye("k")), this.element.appendChild(b), this.knobElement = b;
  7607. const E = e.createElementNS(Ke, "svg");
  7608. E.classList.add(Ye("g")), this.knobElement.appendChild(E);
  7609. const M = e.createElementNS(Ke, "path");
  7610. M.classList.add(Ye("gb")), E.appendChild(M), this.guideBodyElem_ = M;
  7611. const B = e.createElementNS(Ke, "path");
  7612. B.classList.add(Ye("gh")), E.appendChild(B), this.guideHeadElem_ = B;
  7613. const Q = e.createElement("div");
  7614. Q.classList.add(D2("tt")()), this.knobElement.appendChild(Q), this.tooltipElem_ = Q, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.refresh();
  7615. }
  7616. onDraggingChange_(e) {
  7617. if (e.rawValue === null) {
  7618. this.element.classList.remove(Ye(void 0, "drg"));
  7619. return;
  7620. }
  7621. this.element.classList.add(Ye(void 0, "drg"));
  7622. const t = e.rawValue / this.props_.get("draggingScale"), l = t + (t > 0 ? -1 : t < 0 ? 1 : 0), b = Re(-l, -4, 4);
  7623. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${l + b},0 L${l},4 L${l + b},8`, `M ${t},-1 L${t},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${t},4`);
  7624. const E = this.props_.get("formatter");
  7625. this.tooltipElem_.textContent = E(this.value.rawValue), this.tooltipElem_.style.left = `${t}px`;
  7626. }
  7627. refresh() {
  7628. const e = this.props_.get("formatter");
  7629. this.inputElement.value = e(this.value.rawValue);
  7630. }
  7631. onChange_() {
  7632. this.refresh();
  7633. }
  7634. }
  7635. class En {
  7636. constructor(e, t) {
  7637. var l;
  7638. 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_ = ee(null), this.view = new Di(e, {
  7639. arrayPosition: t.arrayPosition,
  7640. dragging: this.dragging_,
  7641. props: this.props,
  7642. value: this.value,
  7643. viewProps: this.viewProps
  7644. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  7645. const b = new Ot(this.view.knobElement);
  7646. b.emitter.on("down", this.onPointerDown_), b.emitter.on("move", this.onPointerMove_), b.emitter.on("up", this.onPointerUp_);
  7647. }
  7648. constrainValue_(e) {
  7649. var t, l;
  7650. const b = (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");
  7651. let M = e;
  7652. return b !== void 0 && (M = Math.max(M, b)), E !== void 0 && (M = Math.min(M, E)), M;
  7653. }
  7654. onInputChange_(e) {
  7655. const l = e.currentTarget.value, b = this.parser_(l);
  7656. _2(b) || (this.value.rawValue = this.constrainValue_(b)), this.view.refresh();
  7657. }
  7658. onInputKeyDown_(e) {
  7659. const t = ze(this.baseStep_, xn(e));
  7660. t !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + t), {
  7661. forceEmit: false,
  7662. last: false
  7663. });
  7664. }
  7665. onInputKeyUp_(e) {
  7666. ze(this.baseStep_, xn(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  7667. forceEmit: true,
  7668. last: true
  7669. });
  7670. }
  7671. onPointerDown_() {
  7672. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  7673. }
  7674. computeDraggingValue_(e) {
  7675. if (!e.point)
  7676. return null;
  7677. const t = e.point.x - e.bounds.width / 2;
  7678. return this.constrainValue_(this.originRawValue_ + t * this.props.get("draggingScale"));
  7679. }
  7680. onPointerMove_(e) {
  7681. const t = this.computeDraggingValue_(e.data);
  7682. t !== null && (this.value.setRawValue(t, {
  7683. forceEmit: false,
  7684. last: false
  7685. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  7686. }
  7687. onPointerUp_(e) {
  7688. const t = this.computeDraggingValue_(e.data);
  7689. t !== null && (this.value.setRawValue(t, {
  7690. forceEmit: true,
  7691. last: true
  7692. }), this.dragging_.rawValue = null);
  7693. }
  7694. }
  7695. const Oi = D2("sld");
  7696. class qe {
  7697. constructor(e, t) {
  7698. 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(Oi()), t.viewProps.bindClassModifiers(this.element);
  7699. const l = e.createElement("div");
  7700. l.classList.add(Oi("t")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.trackElement = l;
  7701. const b = e.createElement("div");
  7702. b.classList.add(Oi("k")), this.trackElement.appendChild(b), this.knobElement = b, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.update_();
  7703. }
  7704. update_() {
  7705. const e = Re(we(this.value.rawValue, this.props_.get("minValue"), this.props_.get("maxValue"), 0, 100), 0, 100);
  7706. this.knobElement.style.width = `${e}%`;
  7707. }
  7708. onChange_() {
  7709. this.update_();
  7710. }
  7711. }
  7712. class Fi {
  7713. constructor(e, t) {
  7714. 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 qe(e, {
  7715. props: this.props,
  7716. value: this.value,
  7717. viewProps: this.viewProps
  7718. }), 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_);
  7719. }
  7720. handlePointerEvent_(e, t) {
  7721. e.point && this.value.setRawValue(we(Re(e.point.x, 0, e.bounds.width), 0, e.bounds.width, this.props.get("minValue"), this.props.get("maxValue")), t);
  7722. }
  7723. onPointerDownOrMove_(e) {
  7724. this.handlePointerEvent_(e.data, {
  7725. forceEmit: false,
  7726. last: false
  7727. });
  7728. }
  7729. onPointerUp_(e) {
  7730. this.handlePointerEvent_(e.data, {
  7731. forceEmit: true,
  7732. last: true
  7733. });
  7734. }
  7735. onKeyDown_(e) {
  7736. const t = ze(this.baseStep_, ut(e));
  7737. t !== 0 && this.value.setRawValue(this.value.rawValue + t, {
  7738. forceEmit: false,
  7739. last: false
  7740. });
  7741. }
  7742. onKeyUp_(e) {
  7743. ze(this.baseStep_, ut(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  7744. forceEmit: true,
  7745. last: true
  7746. });
  7747. }
  7748. }
  7749. const Cn = D2("sldtxt");
  7750. class Ni {
  7751. constructor(e, t) {
  7752. this.element = e.createElement("div"), this.element.classList.add(Cn());
  7753. const l = e.createElement("div");
  7754. l.classList.add(Cn("s")), this.sliderView_ = t.sliderView, l.appendChild(this.sliderView_.element), this.element.appendChild(l);
  7755. const b = e.createElement("div");
  7756. b.classList.add(Cn("t")), this.textView_ = t.textView, b.appendChild(this.textView_.element), this.element.appendChild(b);
  7757. }
  7758. }
  7759. class ni {
  7760. constructor(e, t) {
  7761. this.value = t.value, this.viewProps = t.viewProps, this.sliderC_ = new Fi(e, {
  7762. baseStep: t.baseStep,
  7763. props: t.sliderProps,
  7764. value: t.value,
  7765. viewProps: this.viewProps
  7766. }), this.textC_ = new En(e, {
  7767. baseStep: t.baseStep,
  7768. parser: t.parser,
  7769. props: t.textProps,
  7770. sliderProps: t.sliderProps,
  7771. value: t.value,
  7772. viewProps: t.viewProps
  7773. }), this.view = new Ni(e, {
  7774. sliderView: this.sliderC_.view,
  7775. textView: this.textC_.view
  7776. });
  7777. }
  7778. get sliderController() {
  7779. return this.sliderC_;
  7780. }
  7781. get textController() {
  7782. return this.textC_;
  7783. }
  7784. }
  7785. function it(i, e) {
  7786. i.write(e);
  7787. }
  7788. function Pn(i) {
  7789. const e = S;
  7790. if (Array.isArray(i))
  7791. return e.required.array(e.required.object({
  7792. text: e.required.string,
  7793. value: e.required.raw
  7794. }))(i).value;
  7795. if (typeof i == "object")
  7796. return e.required.raw(i).value;
  7797. }
  7798. function Bi(i) {
  7799. if (i === "inline" || i === "popup")
  7800. return i;
  7801. }
  7802. function wt(i) {
  7803. const e = S;
  7804. return e.required.object({
  7805. max: e.optional.number,
  7806. min: e.optional.number,
  7807. step: e.optional.number
  7808. })(i).value;
  7809. }
  7810. function Ss(i) {
  7811. if (Array.isArray(i))
  7812. return i;
  7813. const e = [];
  7814. return Object.keys(i).forEach((t) => {
  7815. e.push({ text: t, value: i[t] });
  7816. }), e;
  7817. }
  7818. function zi(i) {
  7819. return _2(i) ? null : new gn(Ss(i));
  7820. }
  7821. function Rr(i) {
  7822. const e = i ? nt(i, Wn) : null;
  7823. return e ? e.step : null;
  7824. }
  7825. function ii(i, e) {
  7826. const t = i && nt(i, Wn);
  7827. return t ? Ii(t.step) : Math.max(Ii(e), 2);
  7828. }
  7829. function Ft(i) {
  7830. const e = Rr(i);
  7831. return e ?? 1;
  7832. }
  7833. function Nt(i, e) {
  7834. var t;
  7835. const l = i && nt(i, Wn), b = Math.abs((t = l == null ? void 0 : l.step) !== null && t !== void 0 ? t : e);
  7836. return b === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(b)) - 1);
  7837. }
  7838. const Tn = D2("ckb");
  7839. class kn {
  7840. constructor(e, t) {
  7841. this.onValueChange_ = this.onValueChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(Tn()), t.viewProps.bindClassModifiers(this.element);
  7842. const l = e.createElement("label");
  7843. l.classList.add(Tn("l")), this.element.appendChild(l);
  7844. const b = e.createElement("input");
  7845. b.classList.add(Tn("i")), b.type = "checkbox", l.appendChild(b), this.inputElement = b, t.viewProps.bindDisabled(this.inputElement);
  7846. const E = e.createElement("div");
  7847. E.classList.add(Tn("w")), l.appendChild(E);
  7848. const M = Et(e, "check");
  7849. E.appendChild(M), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  7850. }
  7851. update_() {
  7852. this.inputElement.checked = this.value.rawValue;
  7853. }
  7854. onValueChange_() {
  7855. this.update_();
  7856. }
  7857. }
  7858. class Ls {
  7859. constructor(e, t) {
  7860. this.onInputChange_ = this.onInputChange_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new kn(e, {
  7861. value: this.value,
  7862. viewProps: this.viewProps
  7863. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7864. }
  7865. onInputChange_(e) {
  7866. const t = e.currentTarget;
  7867. this.value.rawValue = t.checked;
  7868. }
  7869. }
  7870. function As(i) {
  7871. const e = [], t = zi(i.options);
  7872. return t && e.push(t), new bn(e);
  7873. }
  7874. const si = {
  7875. id: "input-bool",
  7876. type: "input",
  7877. accept: (i, e) => {
  7878. if (typeof i != "boolean")
  7879. return null;
  7880. const l = le(e, {
  7881. options: S.optional.custom(Pn)
  7882. });
  7883. return l ? {
  7884. initialValue: i,
  7885. params: l
  7886. } : null;
  7887. },
  7888. binding: {
  7889. reader: (i) => gs,
  7890. constraint: (i) => As(i.params),
  7891. writer: (i) => it
  7892. },
  7893. controller: (i) => {
  7894. const e = i.document, t = i.value, l = i.constraint, b = l && nt(l, gn);
  7895. return b ? new _n(e, {
  7896. props: new X({
  7897. options: b.values.value("options")
  7898. }),
  7899. value: t,
  7900. viewProps: i.viewProps
  7901. }) : new Ls(e, {
  7902. value: t,
  7903. viewProps: i.viewProps
  7904. });
  7905. }
  7906. }, Bt = D2("col");
  7907. class ji {
  7908. constructor(e, t) {
  7909. 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")));
  7910. const l = e.createElement("div");
  7911. l.classList.add(Bt("h")), this.element.appendChild(l);
  7912. const b = e.createElement("div");
  7913. b.classList.add(Bt("s")), l.appendChild(b), this.swatchElement = b;
  7914. const E = e.createElement("div");
  7915. if (E.classList.add(Bt("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  7916. const M = e.createElement("div");
  7917. M.classList.add(Bt("p")), this.element.appendChild(M), this.pickerElement = M;
  7918. } else
  7919. this.pickerElement = null;
  7920. }
  7921. }
  7922. function Vr(i, e, t) {
  7923. const l = Re(i / 255, 0, 1), b = Re(e / 255, 0, 1), E = Re(t / 255, 0, 1), M = Math.max(l, b, E), B = Math.min(l, b, E), Q = M - B;
  7924. let J = 0, de = 0;
  7925. const ve = (B + M) / 2;
  7926. return Q !== 0 && (de = Q / (1 - Math.abs(M + B - 1)), l === M ? J = (b - E) / Q : b === M ? J = 2 + (E - l) / Q : J = 4 + (l - b) / Q, J = J / 6 + (J < 0 ? 1 : 0)), [J * 360, de * 100, ve * 100];
  7927. }
  7928. function Ir(i, e, t) {
  7929. const l = (i % 360 + 360) % 360, b = Re(e / 100, 0, 1), E = Re(t / 100, 0, 1), M = (1 - Math.abs(2 * E - 1)) * b, B = M * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - M / 2;
  7930. let J, de, ve;
  7931. return l >= 0 && l < 60 ? [J, de, ve] = [M, B, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B, M, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, M, B] : l >= 180 && l < 240 ? [J, de, ve] = [0, B, M] : l >= 240 && l < 300 ? [J, de, ve] = [B, 0, M] : [J, de, ve] = [M, 0, B], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  7932. }
  7933. function Dr(i, e, t) {
  7934. const l = Re(i / 255, 0, 1), b = Re(e / 255, 0, 1), E = Re(t / 255, 0, 1), M = Math.max(l, b, E), B = Math.min(l, b, E), Q = M - B;
  7935. let J;
  7936. Q === 0 ? J = 0 : M === l ? J = 60 * (((b - E) / Q % 6 + 6) % 6) : M === b ? J = 60 * ((E - l) / Q + 2) : J = 60 * ((l - b) / Q + 4);
  7937. const de = M === 0 ? 0 : Q / M, ve = M;
  7938. return [J, de * 100, ve * 100];
  7939. }
  7940. function Rs(i, e, t) {
  7941. const l = Wt(i, 360), b = Re(e / 100, 0, 1), E = Re(t / 100, 0, 1), M = E * b, B = M * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - M;
  7942. let J, de, ve;
  7943. return l >= 0 && l < 60 ? [J, de, ve] = [M, B, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B, M, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, M, B] : l >= 180 && l < 240 ? [J, de, ve] = [0, B, M] : l >= 240 && l < 300 ? [J, de, ve] = [B, 0, M] : [J, de, ve] = [M, 0, B], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  7944. }
  7945. function m(i, e, t) {
  7946. const l = t + e * (100 - Math.abs(2 * t - 100)) / 200;
  7947. return [
  7948. i,
  7949. l !== 0 ? e * (100 - Math.abs(2 * t - 100)) / l : 0,
  7950. t + e * (100 - Math.abs(2 * t - 100)) / (2 * 100)
  7951. ];
  7952. }
  7953. function a(i, e, t) {
  7954. const l = 100 - Math.abs(t * (200 - e) / 100 - 100);
  7955. return [i, l !== 0 ? e * t / l : 0, t * (200 - e) / (2 * 100)];
  7956. }
  7957. function u(i) {
  7958. return [i[0], i[1], i[2]];
  7959. }
  7960. function f(i, e) {
  7961. return [i[0], i[1], i[2], e];
  7962. }
  7963. const x = {
  7964. hsl: {
  7965. hsl: (i, e, t) => [i, e, t],
  7966. hsv: m,
  7967. rgb: Ir
  7968. },
  7969. hsv: {
  7970. hsl: a,
  7971. hsv: (i, e, t) => [i, e, t],
  7972. rgb: Rs
  7973. },
  7974. rgb: {
  7975. hsl: Vr,
  7976. hsv: Dr,
  7977. rgb: (i, e, t) => [i, e, t]
  7978. }
  7979. };
  7980. function T(i, e) {
  7981. return [
  7982. e === "float" ? 1 : i === "rgb" ? 255 : 360,
  7983. e === "float" ? 1 : i === "rgb" ? 255 : 100,
  7984. e === "float" ? 1 : i === "rgb" ? 255 : 100
  7985. ];
  7986. }
  7987. function V(i, e) {
  7988. return i === e ? e : Wt(i, e);
  7989. }
  7990. function j(i, e, t) {
  7991. var l;
  7992. const b = T(e, t);
  7993. return [
  7994. e === "rgb" ? Re(i[0], 0, b[0]) : V(i[0], b[0]),
  7995. Re(i[1], 0, b[1]),
  7996. Re(i[2], 0, b[2]),
  7997. Re((l = i[3]) !== null && l !== void 0 ? l : 1, 0, 1)
  7998. ];
  7999. }
  8000. function oe(i, e, t, l) {
  8001. const b = T(e, t), E = T(e, l);
  8002. return i.map((M, B) => M / b[B] * E[B]);
  8003. }
  8004. function Je(i, e, t) {
  8005. const l = oe(i, e.mode, e.type, "int"), b = x[e.mode][t.mode](...l);
  8006. return oe(b, t.mode, "int", t.type);
  8007. }
  8008. function et(i, e) {
  8009. return typeof i != "object" || _2(i) ? false : e in i && typeof i[e] == "number";
  8010. }
  8011. class te {
  8012. static black(e = "int") {
  8013. return new te([0, 0, 0], "rgb", e);
  8014. }
  8015. static fromObject(e, t = "int") {
  8016. const l = "a" in e ? [e.r, e.g, e.b, e.a] : [e.r, e.g, e.b];
  8017. return new te(l, "rgb", t);
  8018. }
  8019. static toRgbaObject(e, t = "int") {
  8020. return e.toRgbaObject(t);
  8021. }
  8022. static isRgbColorObject(e) {
  8023. return et(e, "r") && et(e, "g") && et(e, "b");
  8024. }
  8025. static isRgbaColorObject(e) {
  8026. return this.isRgbColorObject(e) && et(e, "a");
  8027. }
  8028. static isColorObject(e) {
  8029. return this.isRgbColorObject(e);
  8030. }
  8031. static equals(e, t) {
  8032. if (e.mode !== t.mode)
  8033. return false;
  8034. const l = e.comps_, b = t.comps_;
  8035. for (let E = 0; E < l.length; E++)
  8036. if (l[E] !== b[E])
  8037. return false;
  8038. return true;
  8039. }
  8040. constructor(e, t, l = "int") {
  8041. this.mode = t, this.type = l, this.comps_ = j(e, t, l);
  8042. }
  8043. getComponents(e, t = "int") {
  8044. return f(Je(u(this.comps_), { mode: this.mode, type: this.type }, { mode: e ?? this.mode, type: t }), this.comps_[3]);
  8045. }
  8046. toRgbaObject(e = "int") {
  8047. const t = this.getComponents("rgb", e);
  8048. return {
  8049. r: t[0],
  8050. g: t[1],
  8051. b: t[2],
  8052. a: t[3]
  8053. };
  8054. }
  8055. }
  8056. const kt = D2("colp");
  8057. class Or {
  8058. constructor(e, t) {
  8059. this.alphaViews_ = null, this.element = e.createElement("div"), this.element.classList.add(kt()), t.viewProps.bindClassModifiers(this.element);
  8060. const l = e.createElement("div");
  8061. l.classList.add(kt("hsv"));
  8062. const b = e.createElement("div");
  8063. b.classList.add(kt("sv")), this.svPaletteView_ = t.svPaletteView, b.appendChild(this.svPaletteView_.element), l.appendChild(b);
  8064. const E = e.createElement("div");
  8065. E.classList.add(kt("h")), this.hPaletteView_ = t.hPaletteView, E.appendChild(this.hPaletteView_.element), l.appendChild(E), this.element.appendChild(l);
  8066. const M = e.createElement("div");
  8067. if (M.classList.add(kt("rgb")), this.textView_ = t.textView, M.appendChild(this.textView_.element), this.element.appendChild(M), t.alphaViews) {
  8068. this.alphaViews_ = {
  8069. palette: t.alphaViews.palette,
  8070. text: t.alphaViews.text
  8071. };
  8072. const B = e.createElement("div");
  8073. B.classList.add(kt("a"));
  8074. const Q = e.createElement("div");
  8075. Q.classList.add(kt("ap")), Q.appendChild(this.alphaViews_.palette.element), B.appendChild(Q);
  8076. const J = e.createElement("div");
  8077. J.classList.add(kt("at")), J.appendChild(this.alphaViews_.text.element), B.appendChild(J), this.element.appendChild(B);
  8078. }
  8079. }
  8080. get allFocusableElements() {
  8081. const e = [
  8082. this.svPaletteView_.element,
  8083. this.hPaletteView_.element,
  8084. this.textView_.modeSelectElement,
  8085. ...this.textView_.textViews.map((t) => t.inputElement)
  8086. ];
  8087. return this.alphaViews_ && e.push(this.alphaViews_.palette.element, this.alphaViews_.text.inputElement), e;
  8088. }
  8089. }
  8090. function rl(i) {
  8091. return i === "int" ? "int" : i === "float" ? "float" : void 0;
  8092. }
  8093. function Fr(i) {
  8094. const e = S;
  8095. return le(i, {
  8096. alpha: e.optional.boolean,
  8097. color: e.optional.object({
  8098. alpha: e.optional.boolean,
  8099. type: e.optional.custom(rl)
  8100. }),
  8101. expanded: e.optional.boolean,
  8102. picker: e.optional.custom(Bi)
  8103. });
  8104. }
  8105. function Mn(i) {
  8106. return i ? 0.1 : 1;
  8107. }
  8108. function Sn(i) {
  8109. var e;
  8110. return (e = i.color) === null || e === void 0 ? void 0 : e.type;
  8111. }
  8112. function ol(i, e) {
  8113. return i.alpha === e.alpha && i.mode === e.mode && i.notation === e.notation && i.type === e.type;
  8114. }
  8115. function pt(i, e) {
  8116. const t = i.match(/^(.+)%$/);
  8117. return Math.min(t ? parseFloat(t[1]) * 0.01 * e : parseFloat(i), e);
  8118. }
  8119. const al = {
  8120. deg: (i) => i,
  8121. grad: (i) => i * 360 / 400,
  8122. rad: (i) => i * 360 / (2 * Math.PI),
  8123. turn: (i) => i * 360
  8124. };
  8125. function To(i) {
  8126. const e = i.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);
  8127. if (!e)
  8128. return parseFloat(i);
  8129. const t = parseFloat(e[1]), l = e[2];
  8130. return al[l](t);
  8131. }
  8132. function ko(i) {
  8133. const e = i.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8134. if (!e)
  8135. return null;
  8136. const t = [
  8137. pt(e[1], 255),
  8138. pt(e[2], 255),
  8139. pt(e[3], 255)
  8140. ];
  8141. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8142. }
  8143. function Mo(i) {
  8144. return (e) => {
  8145. const t = ko(e);
  8146. return t ? new te(t, "rgb", i) : null;
  8147. };
  8148. }
  8149. function So(i) {
  8150. const e = i.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*\)$/);
  8151. if (!e)
  8152. return null;
  8153. const t = [
  8154. pt(e[1], 255),
  8155. pt(e[2], 255),
  8156. pt(e[3], 255),
  8157. pt(e[4], 1)
  8158. ];
  8159. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8160. }
  8161. function Lo(i) {
  8162. return (e) => {
  8163. const t = So(e);
  8164. return t ? new te(t, "rgb", i) : null;
  8165. };
  8166. }
  8167. function Ao(i) {
  8168. const e = i.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8169. if (!e)
  8170. return null;
  8171. const t = [
  8172. To(e[1]),
  8173. pt(e[2], 100),
  8174. pt(e[3], 100)
  8175. ];
  8176. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8177. }
  8178. function Ro(i) {
  8179. return (e) => {
  8180. const t = Ao(e);
  8181. return t ? new te(t, "hsl", i) : null;
  8182. };
  8183. }
  8184. function Vo(i) {
  8185. const e = i.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*\)$/);
  8186. if (!e)
  8187. return null;
  8188. const t = [
  8189. To(e[1]),
  8190. pt(e[2], 100),
  8191. pt(e[3], 100),
  8192. pt(e[4], 1)
  8193. ];
  8194. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8195. }
  8196. function Io(i) {
  8197. return (e) => {
  8198. const t = Vo(e);
  8199. return t ? new te(t, "hsl", i) : null;
  8200. };
  8201. }
  8202. function Do(i) {
  8203. const e = i.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8204. if (e)
  8205. return [
  8206. parseInt(e[1] + e[1], 16),
  8207. parseInt(e[2] + e[2], 16),
  8208. parseInt(e[3] + e[3], 16)
  8209. ];
  8210. const t = i.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8211. return t ? [
  8212. parseInt(t[1], 16),
  8213. parseInt(t[2], 16),
  8214. parseInt(t[3], 16)
  8215. ] : null;
  8216. }
  8217. function ll(i) {
  8218. const e = Do(i);
  8219. return e ? new te(e, "rgb", "int") : null;
  8220. }
  8221. function Oo(i) {
  8222. const e = i.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8223. if (e)
  8224. return [
  8225. parseInt(e[1] + e[1], 16),
  8226. parseInt(e[2] + e[2], 16),
  8227. parseInt(e[3] + e[3], 16),
  8228. we(parseInt(e[4] + e[4], 16), 0, 255, 0, 1)
  8229. ];
  8230. const t = i.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8231. return t ? [
  8232. parseInt(t[1], 16),
  8233. parseInt(t[2], 16),
  8234. parseInt(t[3], 16),
  8235. we(parseInt(t[4], 16), 0, 255, 0, 1)
  8236. ] : null;
  8237. }
  8238. function cl(i) {
  8239. const e = Oo(i);
  8240. return e ? new te(e, "rgb", "int") : null;
  8241. }
  8242. function Fo(i) {
  8243. const e = i.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*\}$/);
  8244. if (!e)
  8245. return null;
  8246. const t = [
  8247. parseFloat(e[1]),
  8248. parseFloat(e[2]),
  8249. parseFloat(e[3])
  8250. ];
  8251. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8252. }
  8253. function No(i) {
  8254. return (e) => {
  8255. const t = Fo(e);
  8256. return t ? new te(t, "rgb", i) : null;
  8257. };
  8258. }
  8259. function Bo(i) {
  8260. const e = i.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*\}$/);
  8261. if (!e)
  8262. return null;
  8263. const t = [
  8264. parseFloat(e[1]),
  8265. parseFloat(e[2]),
  8266. parseFloat(e[3]),
  8267. parseFloat(e[4])
  8268. ];
  8269. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8270. }
  8271. function zo(i) {
  8272. return (e) => {
  8273. const t = Bo(e);
  8274. return t ? new te(t, "rgb", i) : null;
  8275. };
  8276. }
  8277. const ul = [
  8278. {
  8279. parser: Do,
  8280. result: {
  8281. alpha: false,
  8282. mode: "rgb",
  8283. notation: "hex"
  8284. }
  8285. },
  8286. {
  8287. parser: Oo,
  8288. result: {
  8289. alpha: true,
  8290. mode: "rgb",
  8291. notation: "hex"
  8292. }
  8293. },
  8294. {
  8295. parser: ko,
  8296. result: {
  8297. alpha: false,
  8298. mode: "rgb",
  8299. notation: "func"
  8300. }
  8301. },
  8302. {
  8303. parser: So,
  8304. result: {
  8305. alpha: true,
  8306. mode: "rgb",
  8307. notation: "func"
  8308. }
  8309. },
  8310. {
  8311. parser: Ao,
  8312. result: {
  8313. alpha: false,
  8314. mode: "hsl",
  8315. notation: "func"
  8316. }
  8317. },
  8318. {
  8319. parser: Vo,
  8320. result: {
  8321. alpha: true,
  8322. mode: "hsl",
  8323. notation: "func"
  8324. }
  8325. },
  8326. {
  8327. parser: Fo,
  8328. result: {
  8329. alpha: false,
  8330. mode: "rgb",
  8331. notation: "object"
  8332. }
  8333. },
  8334. {
  8335. parser: Bo,
  8336. result: {
  8337. alpha: true,
  8338. mode: "rgb",
  8339. notation: "object"
  8340. }
  8341. }
  8342. ];
  8343. function pl(i) {
  8344. return ul.reduce((e, { parser: t, result: l }) => e || (t(i) ? l : null), null);
  8345. }
  8346. function Nr(i, e = "int") {
  8347. const t = pl(i);
  8348. 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;
  8349. }
  8350. const jo = {
  8351. int: [
  8352. ll,
  8353. cl,
  8354. Mo("int"),
  8355. Lo("int"),
  8356. Ro("int"),
  8357. Io("int"),
  8358. No("int"),
  8359. zo("int")
  8360. ],
  8361. float: [
  8362. Mo("float"),
  8363. Lo("float"),
  8364. Ro("float"),
  8365. Io("float"),
  8366. No("float"),
  8367. zo("float")
  8368. ]
  8369. };
  8370. function hl(i) {
  8371. const e = jo[i];
  8372. return (t) => {
  8373. if (typeof t != "string")
  8374. return te.black(i);
  8375. const l = e.reduce((b, E) => b || E(t), null);
  8376. return l ?? te.black(i);
  8377. };
  8378. }
  8379. function Br(i) {
  8380. const e = jo[i];
  8381. return (t) => e.reduce((l, b) => l || b(t), null);
  8382. }
  8383. function Uo(i) {
  8384. const e = Re(Math.floor(i), 0, 255).toString(16);
  8385. return e.length === 1 ? `0${e}` : e;
  8386. }
  8387. function Go(i, e = "#") {
  8388. const t = u(i.getComponents("rgb")).map(Uo).join("");
  8389. return `${e}${t}`;
  8390. }
  8391. function zr(i, e = "#") {
  8392. const t = i.getComponents("rgb"), l = [t[0], t[1], t[2], t[3] * 255].map(Uo).join("");
  8393. return `${e}${l}`;
  8394. }
  8395. function Ho(i, e) {
  8396. const t = De(e === "float" ? 2 : 0);
  8397. return `rgb(${u(i.getComponents("rgb", e)).map((b) => t(b)).join(", ")})`;
  8398. }
  8399. function dl(i) {
  8400. return (e) => Ho(e, i);
  8401. }
  8402. function Vs(i, e) {
  8403. const t = De(2), l = De(e === "float" ? 2 : 0);
  8404. return `rgba(${i.getComponents("rgb", e).map((E, M) => (M === 3 ? t : l)(E)).join(", ")})`;
  8405. }
  8406. function ml(i) {
  8407. return (e) => Vs(e, i);
  8408. }
  8409. function fl(i) {
  8410. const e = [
  8411. De(0),
  8412. yn,
  8413. yn
  8414. ];
  8415. return `hsl(${u(i.getComponents("hsl")).map((l, b) => e[b](l)).join(", ")})`;
  8416. }
  8417. function vl(i) {
  8418. const e = [
  8419. De(0),
  8420. yn,
  8421. yn,
  8422. De(2)
  8423. ];
  8424. return `hsla(${i.getComponents("hsl").map((l, b) => e[b](l)).join(", ")})`;
  8425. }
  8426. function Ko(i, e) {
  8427. const t = De(e === "float" ? 2 : 0), l = ["r", "g", "b"];
  8428. return `{${u(i.getComponents("rgb", e)).map((E, M) => `${l[M]}: ${t(E)}`).join(", ")}}`;
  8429. }
  8430. function bl(i) {
  8431. return (e) => Ko(e, i);
  8432. }
  8433. function $o(i, e) {
  8434. const t = De(2), l = De(e === "float" ? 2 : 0), b = ["r", "g", "b", "a"];
  8435. return `{${i.getComponents("rgb", e).map((M, B) => {
  8436. const Q = B === 3 ? t : l;
  8437. return `${b[B]}: ${Q(M)}`;
  8438. }).join(", ")}}`;
  8439. }
  8440. function gl(i) {
  8441. return (e) => $o(e, i);
  8442. }
  8443. const _l = [
  8444. {
  8445. format: {
  8446. alpha: false,
  8447. mode: "rgb",
  8448. notation: "hex",
  8449. type: "int"
  8450. },
  8451. stringifier: Go
  8452. },
  8453. {
  8454. format: {
  8455. alpha: true,
  8456. mode: "rgb",
  8457. notation: "hex",
  8458. type: "int"
  8459. },
  8460. stringifier: zr
  8461. },
  8462. {
  8463. format: {
  8464. alpha: false,
  8465. mode: "hsl",
  8466. notation: "func",
  8467. type: "int"
  8468. },
  8469. stringifier: fl
  8470. },
  8471. {
  8472. format: {
  8473. alpha: true,
  8474. mode: "hsl",
  8475. notation: "func",
  8476. type: "int"
  8477. },
  8478. stringifier: vl
  8479. },
  8480. ...["int", "float"].reduce((i, e) => [
  8481. ...i,
  8482. {
  8483. format: {
  8484. alpha: false,
  8485. mode: "rgb",
  8486. notation: "func",
  8487. type: e
  8488. },
  8489. stringifier: dl(e)
  8490. },
  8491. {
  8492. format: {
  8493. alpha: true,
  8494. mode: "rgb",
  8495. notation: "func",
  8496. type: e
  8497. },
  8498. stringifier: ml(e)
  8499. },
  8500. {
  8501. format: {
  8502. alpha: false,
  8503. mode: "rgb",
  8504. notation: "object",
  8505. type: e
  8506. },
  8507. stringifier: bl(e)
  8508. },
  8509. {
  8510. format: {
  8511. alpha: true,
  8512. mode: "rgb",
  8513. notation: "object",
  8514. type: e
  8515. },
  8516. stringifier: gl(e)
  8517. }
  8518. ], [])
  8519. ];
  8520. function jr(i) {
  8521. return _l.reduce((e, t) => e || (ol(t.format, i) ? t.stringifier : null), null);
  8522. }
  8523. const Ui = D2("apl");
  8524. class wl {
  8525. constructor(e, t) {
  8526. 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(Ui()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8527. const l = e.createElement("div");
  8528. l.classList.add(Ui("b")), this.element.appendChild(l);
  8529. const b = e.createElement("div");
  8530. b.classList.add(Ui("c")), l.appendChild(b), this.colorElem_ = b;
  8531. const E = e.createElement("div");
  8532. E.classList.add(Ui("m")), this.element.appendChild(E), this.markerElem_ = E;
  8533. const M = e.createElement("div");
  8534. M.classList.add(Ui("p")), this.markerElem_.appendChild(M), this.previewElem_ = M, this.update_();
  8535. }
  8536. update_() {
  8537. const e = this.value.rawValue, t = e.getComponents("rgb"), l = new te([t[0], t[1], t[2], 0], "rgb"), b = new te([t[0], t[1], t[2], 255], "rgb"), E = [
  8538. "to right",
  8539. Vs(l),
  8540. Vs(b)
  8541. ];
  8542. this.colorElem_.style.background = `linear-gradient(${E.join(",")})`, this.previewElem_.style.backgroundColor = Vs(e);
  8543. const M = we(t[3], 0, 1, 0, 100);
  8544. this.markerElem_.style.left = `${M}%`;
  8545. }
  8546. onValueChange_() {
  8547. this.update_();
  8548. }
  8549. }
  8550. class yl {
  8551. constructor(e, t) {
  8552. 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, {
  8553. value: this.value,
  8554. viewProps: this.viewProps
  8555. }), 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_);
  8556. }
  8557. handlePointerEvent_(e, t) {
  8558. if (!e.point)
  8559. return;
  8560. const l = e.point.x / e.bounds.width, b = this.value.rawValue, [E, M, B] = b.getComponents("hsv");
  8561. this.value.setRawValue(new te([E, M, B, l], "hsv"), t);
  8562. }
  8563. onPointerDown_(e) {
  8564. this.handlePointerEvent_(e.data, {
  8565. forceEmit: false,
  8566. last: false
  8567. });
  8568. }
  8569. onPointerMove_(e) {
  8570. this.handlePointerEvent_(e.data, {
  8571. forceEmit: false,
  8572. last: false
  8573. });
  8574. }
  8575. onPointerUp_(e) {
  8576. this.handlePointerEvent_(e.data, {
  8577. forceEmit: true,
  8578. last: true
  8579. });
  8580. }
  8581. onKeyDown_(e) {
  8582. const t = ze(Mn(true), ut(e));
  8583. if (t === 0)
  8584. return;
  8585. const l = this.value.rawValue, [b, E, M, B] = l.getComponents("hsv");
  8586. this.value.setRawValue(new te([b, E, M, B + t], "hsv"), {
  8587. forceEmit: false,
  8588. last: false
  8589. });
  8590. }
  8591. onKeyUp_(e) {
  8592. ze(Mn(true), ut(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8593. forceEmit: true,
  8594. last: true
  8595. });
  8596. }
  8597. }
  8598. const ri = D2("coltxt");
  8599. function xl(i) {
  8600. const e = i.createElement("select"), t = [
  8601. { text: "RGB", value: "rgb" },
  8602. { text: "HSL", value: "hsl" },
  8603. { text: "HSV", value: "hsv" }
  8604. ];
  8605. return e.appendChild(t.reduce((l, b) => {
  8606. const E = i.createElement("option");
  8607. return E.textContent = b.text, E.value = b.value, l.appendChild(E), l;
  8608. }, i.createDocumentFragment())), e;
  8609. }
  8610. class El {
  8611. constructor(e, t) {
  8612. this.element = e.createElement("div"), this.element.classList.add(ri()), t.viewProps.bindClassModifiers(this.element);
  8613. const l = e.createElement("div");
  8614. l.classList.add(ri("m")), this.modeElem_ = xl(e), this.modeElem_.classList.add(ri("ms")), l.appendChild(this.modeSelectElement), t.viewProps.bindDisabled(this.modeElem_);
  8615. const b = e.createElement("div");
  8616. b.classList.add(ri("mm")), b.appendChild(Et(e, "dropdown")), l.appendChild(b), this.element.appendChild(l);
  8617. const E = e.createElement("div");
  8618. E.classList.add(ri("w")), this.element.appendChild(E), this.textsElem_ = E, this.textViews_ = t.textViews, this.applyTextViews_(), N(t.colorMode, (M) => {
  8619. this.modeElem_.value = M;
  8620. });
  8621. }
  8622. get modeSelectElement() {
  8623. return this.modeElem_;
  8624. }
  8625. get textViews() {
  8626. return this.textViews_;
  8627. }
  8628. set textViews(e) {
  8629. this.textViews_ = e, this.applyTextViews_();
  8630. }
  8631. applyTextViews_() {
  8632. pn(this.textsElem_);
  8633. const e = this.element.ownerDocument;
  8634. this.textViews_.forEach((t) => {
  8635. const l = e.createElement("div");
  8636. l.classList.add(ri("c")), l.appendChild(t.element), this.textsElem_.appendChild(l);
  8637. });
  8638. }
  8639. }
  8640. function Cl(i) {
  8641. return De(i === "float" ? 2 : 0);
  8642. }
  8643. function Pl(i, e, t) {
  8644. const l = T(i, e)[t];
  8645. return new qt({
  8646. min: 0,
  8647. max: l
  8648. });
  8649. }
  8650. function Ur(i, e, t) {
  8651. return new En(i, {
  8652. arrayPosition: t === 0 ? "fst" : t === 3 - 1 ? "lst" : "mid",
  8653. baseStep: Mn(false),
  8654. parser: e.parser,
  8655. props: X.fromObject({
  8656. draggingScale: e.colorType === "float" ? 0.01 : 1,
  8657. formatter: Cl(e.colorType)
  8658. }),
  8659. value: ee(0, {
  8660. constraint: Pl(e.colorMode, e.colorType, t)
  8661. }),
  8662. viewProps: e.viewProps
  8663. });
  8664. }
  8665. class Tl {
  8666. constructor(e, t) {
  8667. this.onModeSelectChange_ = this.onModeSelectChange_.bind(this), this.colorType_ = t.colorType, this.parser_ = t.parser, this.value = t.value, this.viewProps = t.viewProps, this.colorMode = ee(this.value.rawValue.mode), this.ccs_ = this.createComponentControllers_(e), this.view = new El(e, {
  8668. colorMode: this.colorMode,
  8669. textViews: [this.ccs_[0].view, this.ccs_[1].view, this.ccs_[2].view],
  8670. viewProps: this.viewProps
  8671. }), this.view.modeSelectElement.addEventListener("change", this.onModeSelectChange_);
  8672. }
  8673. createComponentControllers_(e) {
  8674. const t = {
  8675. colorMode: this.colorMode.rawValue,
  8676. colorType: this.colorType_,
  8677. parser: this.parser_,
  8678. viewProps: this.viewProps
  8679. }, l = [
  8680. Ur(e, t, 0),
  8681. Ur(e, t, 1),
  8682. Ur(e, t, 2)
  8683. ];
  8684. return l.forEach((b, E) => {
  8685. Zt({
  8686. primary: this.value,
  8687. secondary: b.value,
  8688. forward: (M) => M.rawValue.getComponents(this.colorMode.rawValue, this.colorType_)[E],
  8689. backward: (M, B) => {
  8690. const Q = this.colorMode.rawValue, J = M.rawValue.getComponents(Q, this.colorType_);
  8691. return J[E] = B.rawValue, new te(f(u(J), J[3]), Q, this.colorType_);
  8692. }
  8693. });
  8694. }), l;
  8695. }
  8696. onModeSelectChange_(e) {
  8697. const t = e.currentTarget;
  8698. this.colorMode.rawValue = t.value, this.ccs_ = this.createComponentControllers_(this.view.element.ownerDocument), this.view.textViews = [
  8699. this.ccs_[0].view,
  8700. this.ccs_[1].view,
  8701. this.ccs_[2].view
  8702. ];
  8703. }
  8704. }
  8705. const Gr = D2("hpl");
  8706. class kl {
  8707. constructor(e, t) {
  8708. 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(Gr()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8709. const l = e.createElement("div");
  8710. l.classList.add(Gr("c")), this.element.appendChild(l);
  8711. const b = e.createElement("div");
  8712. b.classList.add(Gr("m")), this.element.appendChild(b), this.markerElem_ = b, this.update_();
  8713. }
  8714. update_() {
  8715. const e = this.value.rawValue, [t] = e.getComponents("hsv");
  8716. this.markerElem_.style.backgroundColor = Ho(new te([t, 100, 100], "hsv"));
  8717. const l = we(t, 0, 360, 0, 100);
  8718. this.markerElem_.style.left = `${l}%`;
  8719. }
  8720. onValueChange_() {
  8721. this.update_();
  8722. }
  8723. }
  8724. class Ml {
  8725. constructor(e, t) {
  8726. 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, {
  8727. value: this.value,
  8728. viewProps: this.viewProps
  8729. }), 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_);
  8730. }
  8731. handlePointerEvent_(e, t) {
  8732. if (!e.point)
  8733. return;
  8734. const l = we(Re(e.point.x, 0, e.bounds.width), 0, e.bounds.width, 0, 360), b = this.value.rawValue, [, E, M, B] = b.getComponents("hsv");
  8735. this.value.setRawValue(new te([l, E, M, B], "hsv"), t);
  8736. }
  8737. onPointerDown_(e) {
  8738. this.handlePointerEvent_(e.data, {
  8739. forceEmit: false,
  8740. last: false
  8741. });
  8742. }
  8743. onPointerMove_(e) {
  8744. this.handlePointerEvent_(e.data, {
  8745. forceEmit: false,
  8746. last: false
  8747. });
  8748. }
  8749. onPointerUp_(e) {
  8750. this.handlePointerEvent_(e.data, {
  8751. forceEmit: true,
  8752. last: true
  8753. });
  8754. }
  8755. onKeyDown_(e) {
  8756. const t = ze(Mn(false), ut(e));
  8757. if (t === 0)
  8758. return;
  8759. const l = this.value.rawValue, [b, E, M, B] = l.getComponents("hsv");
  8760. this.value.setRawValue(new te([b + t, E, M, B], "hsv"), {
  8761. forceEmit: false,
  8762. last: false
  8763. });
  8764. }
  8765. onKeyUp_(e) {
  8766. ze(Mn(false), ut(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8767. forceEmit: true,
  8768. last: true
  8769. });
  8770. }
  8771. }
  8772. const Hr = D2("svp"), Xo = 64;
  8773. class Sl {
  8774. constructor(e, t) {
  8775. 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(Hr()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8776. const l = e.createElement("canvas");
  8777. l.height = Xo, l.width = Xo, l.classList.add(Hr("c")), this.element.appendChild(l), this.canvasElement = l;
  8778. const b = e.createElement("div");
  8779. b.classList.add(Hr("m")), this.element.appendChild(b), this.markerElem_ = b, this.update_();
  8780. }
  8781. update_() {
  8782. const e = Hn(this.canvasElement);
  8783. if (!e)
  8784. return;
  8785. const l = this.value.rawValue.getComponents("hsv"), b = this.canvasElement.width, E = this.canvasElement.height, M = e.getImageData(0, 0, b, E), B = M.data;
  8786. for (let de = 0; de < E; de++)
  8787. for (let ve = 0; ve < b; ve++) {
  8788. const Ln = we(ve, 0, b, 0, 100), Hi = we(de, 0, E, 100, 0), Ki = Rs(l[0], Ln, Hi), Is = (de * b + ve) * 4;
  8789. B[Is] = Ki[0], B[Is + 1] = Ki[1], B[Is + 2] = Ki[2], B[Is + 3] = 255;
  8790. }
  8791. e.putImageData(M, 0, 0);
  8792. const Q = we(l[1], 0, 100, 0, 100);
  8793. this.markerElem_.style.left = `${Q}%`;
  8794. const J = we(l[2], 0, 100, 100, 0);
  8795. this.markerElem_.style.top = `${J}%`;
  8796. }
  8797. onValueChange_() {
  8798. this.update_();
  8799. }
  8800. }
  8801. class Ll {
  8802. constructor(e, t) {
  8803. 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, {
  8804. value: this.value,
  8805. viewProps: this.viewProps
  8806. }), 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_);
  8807. }
  8808. handlePointerEvent_(e, t) {
  8809. if (!e.point)
  8810. return;
  8811. const l = we(e.point.x, 0, e.bounds.width, 0, 100), b = we(e.point.y, 0, e.bounds.height, 100, 0), [E, , , M] = this.value.rawValue.getComponents("hsv");
  8812. this.value.setRawValue(new te([E, l, b, M], "hsv"), t);
  8813. }
  8814. onPointerDown_(e) {
  8815. this.handlePointerEvent_(e.data, {
  8816. forceEmit: false,
  8817. last: false
  8818. });
  8819. }
  8820. onPointerMove_(e) {
  8821. this.handlePointerEvent_(e.data, {
  8822. forceEmit: false,
  8823. last: false
  8824. });
  8825. }
  8826. onPointerUp_(e) {
  8827. this.handlePointerEvent_(e.data, {
  8828. forceEmit: true,
  8829. last: true
  8830. });
  8831. }
  8832. onKeyDown_(e) {
  8833. ti(e.key) && e.preventDefault();
  8834. const [t, l, b, E] = this.value.rawValue.getComponents("hsv"), M = Mn(false), B = ze(M, ut(e)), Q = ze(M, xn(e));
  8835. B === 0 && Q === 0 || this.value.setRawValue(new te([t, l + B, b + Q, E], "hsv"), {
  8836. forceEmit: false,
  8837. last: false
  8838. });
  8839. }
  8840. onKeyUp_(e) {
  8841. const t = Mn(false), l = ze(t, ut(e)), b = ze(t, xn(e));
  8842. l === 0 && b === 0 || this.value.setRawValue(this.value.rawValue, {
  8843. forceEmit: true,
  8844. last: true
  8845. });
  8846. }
  8847. }
  8848. class Al {
  8849. constructor(e, t) {
  8850. this.value = t.value, this.viewProps = t.viewProps, this.hPaletteC_ = new Ml(e, {
  8851. value: this.value,
  8852. viewProps: this.viewProps
  8853. }), this.svPaletteC_ = new Ll(e, {
  8854. value: this.value,
  8855. viewProps: this.viewProps
  8856. }), this.alphaIcs_ = t.supportsAlpha ? {
  8857. palette: new yl(e, {
  8858. value: this.value,
  8859. viewProps: this.viewProps
  8860. }),
  8861. text: new En(e, {
  8862. parser: ct,
  8863. baseStep: 0.1,
  8864. props: X.fromObject({
  8865. draggingScale: 0.01,
  8866. formatter: De(2)
  8867. }),
  8868. value: ee(0, {
  8869. constraint: new qt({ min: 0, max: 1 })
  8870. }),
  8871. viewProps: this.viewProps
  8872. })
  8873. } : null, this.alphaIcs_ && Zt({
  8874. primary: this.value,
  8875. secondary: this.alphaIcs_.text.value,
  8876. forward: (l) => l.rawValue.getComponents()[3],
  8877. backward: (l, b) => {
  8878. const E = l.rawValue.getComponents();
  8879. return E[3] = b.rawValue, new te(E, l.rawValue.mode);
  8880. }
  8881. }), this.textC_ = new Tl(e, {
  8882. colorType: t.colorType,
  8883. parser: ct,
  8884. value: this.value,
  8885. viewProps: this.viewProps
  8886. }), this.view = new Or(e, {
  8887. alphaViews: this.alphaIcs_ ? {
  8888. palette: this.alphaIcs_.palette.view,
  8889. text: this.alphaIcs_.text.view
  8890. } : null,
  8891. hPaletteView: this.hPaletteC_.view,
  8892. supportsAlpha: t.supportsAlpha,
  8893. svPaletteView: this.svPaletteC_.view,
  8894. textView: this.textC_.view,
  8895. viewProps: this.viewProps
  8896. });
  8897. }
  8898. get textController() {
  8899. return this.textC_;
  8900. }
  8901. }
  8902. const Kr = D2("colsw");
  8903. class Rl {
  8904. constructor(e, t) {
  8905. 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(Kr()), t.viewProps.bindClassModifiers(this.element);
  8906. const l = e.createElement("div");
  8907. l.classList.add(Kr("sw")), this.element.appendChild(l), this.swatchElem_ = l;
  8908. const b = e.createElement("button");
  8909. b.classList.add(Kr("b")), t.viewProps.bindDisabled(b), this.element.appendChild(b), this.buttonElement = b, this.update_();
  8910. }
  8911. update_() {
  8912. const e = this.value.rawValue;
  8913. this.swatchElem_.style.backgroundColor = zr(e);
  8914. }
  8915. onValueChange_() {
  8916. this.update_();
  8917. }
  8918. }
  8919. class Vl {
  8920. constructor(e, t) {
  8921. this.value = t.value, this.viewProps = t.viewProps, this.view = new Rl(e, {
  8922. value: this.value,
  8923. viewProps: this.viewProps
  8924. });
  8925. }
  8926. }
  8927. class $r {
  8928. constructor(e, t) {
  8929. 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_ = Be.create(t.expanded), this.swatchC_ = new Vl(e, {
  8930. value: this.value,
  8931. viewProps: this.viewProps
  8932. });
  8933. const l = this.swatchC_.view.buttonElement;
  8934. l.addEventListener("blur", this.onButtonBlur_), l.addEventListener("click", this.onButtonClick_), this.textC_ = new Jn(e, {
  8935. parser: t.parser,
  8936. props: X.fromObject({
  8937. formatter: t.formatter
  8938. }),
  8939. value: this.value,
  8940. viewProps: this.viewProps
  8941. }), this.view = new ji(e, {
  8942. foldable: this.foldable_,
  8943. pickerLayout: t.pickerLayout
  8944. }), this.view.swatchElement.appendChild(this.swatchC_.view.element), this.view.textElement.appendChild(this.textC_.view.element), this.popC_ = t.pickerLayout === "popup" ? new vs(e, {
  8945. viewProps: this.viewProps
  8946. }) : null;
  8947. const b = new Al(e, {
  8948. colorType: t.colorType,
  8949. supportsAlpha: t.supportsAlpha,
  8950. value: this.value,
  8951. viewProps: this.viewProps
  8952. });
  8953. b.view.allFocusableElements.forEach((E) => {
  8954. E.addEventListener("blur", this.onPopupChildBlur_), E.addEventListener("keydown", this.onPopupChildKeydown_);
  8955. }), this.pickerC_ = b, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(b.view.element), Zt({
  8956. primary: this.foldable_.value("expanded"),
  8957. secondary: this.popC_.shows,
  8958. forward: (E) => E.rawValue,
  8959. backward: (E, M) => M.rawValue
  8960. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), $e(this.foldable_, this.view.pickerElement));
  8961. }
  8962. get textController() {
  8963. return this.textC_;
  8964. }
  8965. onButtonBlur_(e) {
  8966. if (!this.popC_)
  8967. return;
  8968. const t = this.view.element, l = e.relatedTarget;
  8969. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  8970. }
  8971. onButtonClick_() {
  8972. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  8973. }
  8974. onPopupChildBlur_(e) {
  8975. if (!this.popC_)
  8976. return;
  8977. const t = this.popC_.view.element, l = Ct(e);
  8978. l && t.contains(l) || l && l === this.swatchC_.view.buttonElement && !bt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  8979. }
  8980. onPopupChildKeydown_(e) {
  8981. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.swatchC_.view.buttonElement.focus();
  8982. }
  8983. }
  8984. function Il(i, e) {
  8985. return te.isColorObject(i) ? te.fromObject(i, e) : te.black(e);
  8986. }
  8987. function Dl(i) {
  8988. return u(i.getComponents("rgb")).reduce((e, t) => e << 8 | Math.floor(t) & 255, 0);
  8989. }
  8990. function Ol(i) {
  8991. return i.getComponents("rgb").reduce((e, t, l) => {
  8992. const b = Math.floor(l === 3 ? t * 255 : t) & 255;
  8993. return e << 8 | b;
  8994. }, 0) >>> 0;
  8995. }
  8996. function Fl(i) {
  8997. return new te([i >> 16 & 255, i >> 8 & 255, i & 255], "rgb");
  8998. }
  8999. function Nl(i) {
  9000. return new te([
  9001. i >> 24 & 255,
  9002. i >> 16 & 255,
  9003. i >> 8 & 255,
  9004. we(i & 255, 0, 255, 0, 1)
  9005. ], "rgb");
  9006. }
  9007. function Bl(i) {
  9008. return typeof i != "number" ? te.black() : Fl(i);
  9009. }
  9010. function zl(i) {
  9011. return typeof i != "number" ? te.black() : Nl(i);
  9012. }
  9013. function jl(i) {
  9014. const e = jr(i);
  9015. return e ? (t, l) => {
  9016. it(t, e(l));
  9017. } : null;
  9018. }
  9019. function Ul(i) {
  9020. const e = i ? Ol : Dl;
  9021. return (t, l) => {
  9022. it(t, e(l));
  9023. };
  9024. }
  9025. function Gl(i, e, t) {
  9026. const l = e.toRgbaObject(t);
  9027. i.writeProperty("r", l.r), i.writeProperty("g", l.g), i.writeProperty("b", l.b), i.writeProperty("a", l.a);
  9028. }
  9029. function Hl(i, e, t) {
  9030. const l = e.toRgbaObject(t);
  9031. i.writeProperty("r", l.r), i.writeProperty("g", l.g), i.writeProperty("b", l.b);
  9032. }
  9033. function Kl(i, e) {
  9034. return (t, l) => {
  9035. i ? Gl(t, l, e) : Hl(t, l, e);
  9036. };
  9037. }
  9038. function Xr(i) {
  9039. var e;
  9040. return !!(i != null && i.alpha || !((e = i == null ? void 0 : i.color) === null || e === void 0) && e.alpha);
  9041. }
  9042. function $l(i) {
  9043. return i ? (e) => zr(e, "0x") : (e) => Go(e, "0x");
  9044. }
  9045. function Xl(i) {
  9046. return "color" in i || "view" in i && i.view === "color";
  9047. }
  9048. const Yl = {
  9049. id: "input-color-number",
  9050. type: "input",
  9051. accept: (i, e) => {
  9052. if (typeof i != "number" || !Xl(e))
  9053. return null;
  9054. const t = Fr(e);
  9055. return t ? {
  9056. initialValue: i,
  9057. params: t
  9058. } : null;
  9059. },
  9060. binding: {
  9061. reader: (i) => Xr(i.params) ? zl : Bl,
  9062. equals: te.equals,
  9063. writer: (i) => Ul(Xr(i.params))
  9064. },
  9065. controller: (i) => {
  9066. const e = Xr(i.params), t = "expanded" in i.params ? i.params.expanded : void 0, l = "picker" in i.params ? i.params.picker : void 0;
  9067. return new $r(i.document, {
  9068. colorType: "int",
  9069. expanded: t ?? false,
  9070. formatter: $l(e),
  9071. parser: Br("int"),
  9072. pickerLayout: l ?? "popup",
  9073. supportsAlpha: e,
  9074. value: i.value,
  9075. viewProps: i.viewProps
  9076. });
  9077. }
  9078. };
  9079. function ql(i) {
  9080. return te.isRgbaColorObject(i);
  9081. }
  9082. function Ql(i) {
  9083. return (e) => Il(e, i);
  9084. }
  9085. function Zl(i, e) {
  9086. return (t) => i ? $o(t, e) : Ko(t, e);
  9087. }
  9088. const Wl = {
  9089. id: "input-color-object",
  9090. type: "input",
  9091. accept: (i, e) => {
  9092. if (!te.isColorObject(i))
  9093. return null;
  9094. const t = Fr(e);
  9095. return t ? {
  9096. initialValue: i,
  9097. params: t
  9098. } : null;
  9099. },
  9100. binding: {
  9101. reader: (i) => Ql(Sn(i.params)),
  9102. equals: te.equals,
  9103. writer: (i) => Kl(ql(i.initialValue), Sn(i.params))
  9104. },
  9105. controller: (i) => {
  9106. var e;
  9107. const t = te.isRgbaColorObject(i.initialValue), l = "expanded" in i.params ? i.params.expanded : void 0, b = "picker" in i.params ? i.params.picker : void 0, E = (e = Sn(i.params)) !== null && e !== void 0 ? e : "int";
  9108. return new $r(i.document, {
  9109. colorType: E,
  9110. expanded: l ?? false,
  9111. formatter: Zl(t, E),
  9112. parser: Br(E),
  9113. pickerLayout: b ?? "popup",
  9114. supportsAlpha: t,
  9115. value: i.value,
  9116. viewProps: i.viewProps
  9117. });
  9118. }
  9119. }, Jl = {
  9120. id: "input-color-string",
  9121. type: "input",
  9122. accept: (i, e) => {
  9123. if (typeof i != "string" || "view" in e && e.view === "text")
  9124. return null;
  9125. const t = Nr(i, Sn(e));
  9126. if (!t || !jr(t))
  9127. return null;
  9128. const b = Fr(e);
  9129. return b ? {
  9130. initialValue: i,
  9131. params: b
  9132. } : null;
  9133. },
  9134. binding: {
  9135. reader: (i) => {
  9136. var e;
  9137. return hl((e = Sn(i.params)) !== null && e !== void 0 ? e : "int");
  9138. },
  9139. equals: te.equals,
  9140. writer: (i) => {
  9141. const e = Nr(i.initialValue, Sn(i.params));
  9142. if (!e)
  9143. throw k.shouldNeverHappen();
  9144. const t = jl(e);
  9145. if (!t)
  9146. throw k.notBindable();
  9147. return t;
  9148. }
  9149. },
  9150. controller: (i) => {
  9151. const e = Nr(i.initialValue, Sn(i.params));
  9152. if (!e)
  9153. throw k.shouldNeverHappen();
  9154. const t = jr(e);
  9155. if (!t)
  9156. throw k.shouldNeverHappen();
  9157. const l = "expanded" in i.params ? i.params.expanded : void 0, b = "picker" in i.params ? i.params.picker : void 0;
  9158. return new $r(i.document, {
  9159. colorType: e.type,
  9160. expanded: l ?? false,
  9161. formatter: t,
  9162. parser: Br(e.type),
  9163. pickerLayout: b ?? "popup",
  9164. supportsAlpha: e.alpha,
  9165. value: i.value,
  9166. viewProps: i.viewProps
  9167. });
  9168. }
  9169. };
  9170. class Jt {
  9171. constructor(e) {
  9172. this.components = e.components, this.asm_ = e.assembly;
  9173. }
  9174. constrain(e) {
  9175. const t = this.asm_.toComponents(e).map((l, b) => {
  9176. var E, M;
  9177. return (M = (E = this.components[b]) === null || E === void 0 ? void 0 : E.constrain(l)) !== null && M !== void 0 ? M : l;
  9178. });
  9179. return this.asm_.fromComponents(t);
  9180. }
  9181. }
  9182. const Yo = D2("pndtxt");
  9183. class ec {
  9184. constructor(e, t) {
  9185. this.textViews = t.textViews, this.element = e.createElement("div"), this.element.classList.add(Yo()), this.textViews.forEach((l) => {
  9186. const b = e.createElement("div");
  9187. b.classList.add(Yo("a")), b.appendChild(l.element), this.element.appendChild(b);
  9188. });
  9189. }
  9190. }
  9191. function tc(i, e, t) {
  9192. return new En(i, {
  9193. arrayPosition: t === 0 ? "fst" : t === e.axes.length - 1 ? "lst" : "mid",
  9194. baseStep: e.axes[t].baseStep,
  9195. parser: e.parser,
  9196. props: e.axes[t].textProps,
  9197. value: ee(0, {
  9198. constraint: e.axes[t].constraint
  9199. }),
  9200. viewProps: e.viewProps
  9201. });
  9202. }
  9203. class Yr {
  9204. constructor(e, t) {
  9205. this.value = t.value, this.viewProps = t.viewProps, this.acs_ = t.axes.map((l, b) => tc(e, t, b)), this.acs_.forEach((l, b) => {
  9206. Zt({
  9207. primary: this.value,
  9208. secondary: l.value,
  9209. forward: (E) => t.assembly.toComponents(E.rawValue)[b],
  9210. backward: (E, M) => {
  9211. const B = t.assembly.toComponents(E.rawValue);
  9212. return B[b] = M.rawValue, t.assembly.fromComponents(B);
  9213. }
  9214. });
  9215. }), this.view = new ec(e, {
  9216. textViews: this.acs_.map((l) => l.view)
  9217. });
  9218. }
  9219. }
  9220. function qo(i, e) {
  9221. return "step" in i && !_2(i.step) ? new Wn(i.step, e) : null;
  9222. }
  9223. function Qo(i) {
  9224. return !_2(i.max) && !_2(i.min) ? new qt({
  9225. max: i.max,
  9226. min: i.min
  9227. }) : !_2(i.max) || !_2(i.min) ? new Ti({
  9228. max: i.max,
  9229. min: i.min
  9230. }) : null;
  9231. }
  9232. function nc(i) {
  9233. const e = nt(i, qt);
  9234. if (e)
  9235. return [e.values.get("min"), e.values.get("max")];
  9236. const t = nt(i, Ti);
  9237. return t ? [t.minValue, t.maxValue] : [void 0, void 0];
  9238. }
  9239. function ic(i, e) {
  9240. const t = [], l = qo(i, e);
  9241. l && t.push(l);
  9242. const b = Qo(i);
  9243. b && t.push(b);
  9244. const E = zi(i.options);
  9245. return E && t.push(E), new bn(t);
  9246. }
  9247. const sc = {
  9248. id: "input-number",
  9249. type: "input",
  9250. accept: (i, e) => {
  9251. if (typeof i != "number")
  9252. return null;
  9253. const t = S, l = le(e, {
  9254. format: t.optional.function,
  9255. max: t.optional.number,
  9256. min: t.optional.number,
  9257. options: t.optional.custom(Pn),
  9258. step: t.optional.number
  9259. });
  9260. return l ? {
  9261. initialValue: i,
  9262. params: l
  9263. } : null;
  9264. },
  9265. binding: {
  9266. reader: (i) => _t,
  9267. constraint: (i) => ic(i.params, i.initialValue),
  9268. writer: (i) => it
  9269. },
  9270. controller: (i) => {
  9271. var e;
  9272. const t = i.value, l = i.constraint, b = l && nt(l, gn);
  9273. if (b)
  9274. return new _n(i.document, {
  9275. props: new X({
  9276. options: b.values.value("options")
  9277. }),
  9278. value: t,
  9279. viewProps: i.viewProps
  9280. });
  9281. const E = (e = "format" in i.params ? i.params.format : void 0) !== null && e !== void 0 ? e : De(ii(l, t.rawValue)), M = l && nt(l, qt);
  9282. return M ? new ni(i.document, {
  9283. baseStep: Ft(l),
  9284. parser: ct,
  9285. sliderProps: new X({
  9286. maxValue: M.values.value("max"),
  9287. minValue: M.values.value("min")
  9288. }),
  9289. textProps: X.fromObject({
  9290. draggingScale: Nt(l, t.rawValue),
  9291. formatter: E
  9292. }),
  9293. value: t,
  9294. viewProps: i.viewProps
  9295. }) : new En(i.document, {
  9296. baseStep: Ft(l),
  9297. parser: ct,
  9298. props: X.fromObject({
  9299. draggingScale: Nt(l, t.rawValue),
  9300. formatter: E
  9301. }),
  9302. value: t,
  9303. viewProps: i.viewProps
  9304. });
  9305. }
  9306. };
  9307. class en {
  9308. constructor(e = 0, t = 0) {
  9309. this.x = e, this.y = t;
  9310. }
  9311. getComponents() {
  9312. return [this.x, this.y];
  9313. }
  9314. static isObject(e) {
  9315. if (_2(e))
  9316. return false;
  9317. const t = e.x, l = e.y;
  9318. return !(typeof t != "number" || typeof l != "number");
  9319. }
  9320. static equals(e, t) {
  9321. return e.x === t.x && e.y === t.y;
  9322. }
  9323. toObject() {
  9324. return {
  9325. x: this.x,
  9326. y: this.y
  9327. };
  9328. }
  9329. }
  9330. const Zo = {
  9331. toComponents: (i) => i.getComponents(),
  9332. fromComponents: (i) => new en(...i)
  9333. }, oi = D2("p2d");
  9334. class rc {
  9335. constructor(e, t) {
  9336. 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")));
  9337. const l = e.createElement("div");
  9338. l.classList.add(oi("h")), this.element.appendChild(l);
  9339. const b = e.createElement("button");
  9340. b.classList.add(oi("b")), b.appendChild(Et(e, "p2dpad")), t.viewProps.bindDisabled(b), l.appendChild(b), this.buttonElement = b;
  9341. const E = e.createElement("div");
  9342. if (E.classList.add(oi("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  9343. const M = e.createElement("div");
  9344. M.classList.add(oi("p")), this.element.appendChild(M), this.pickerElement = M;
  9345. } else
  9346. this.pickerElement = null;
  9347. }
  9348. }
  9349. const tn = D2("p2dp");
  9350. class oc {
  9351. constructor(e, t) {
  9352. 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);
  9353. const l = e.createElement("div");
  9354. l.classList.add(tn("p")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.padElement = l;
  9355. const b = e.createElementNS(Ke, "svg");
  9356. b.classList.add(tn("g")), this.padElement.appendChild(b), this.svgElem_ = b;
  9357. const E = e.createElementNS(Ke, "line");
  9358. 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);
  9359. const M = e.createElementNS(Ke, "line");
  9360. M.classList.add(tn("ax")), M.setAttributeNS(null, "x1", "50%"), M.setAttributeNS(null, "y1", "0"), M.setAttributeNS(null, "x2", "50%"), M.setAttributeNS(null, "y2", "100%"), this.svgElem_.appendChild(M);
  9361. const B = e.createElementNS(Ke, "line");
  9362. B.classList.add(tn("l")), B.setAttributeNS(null, "x1", "50%"), B.setAttributeNS(null, "y1", "50%"), this.svgElem_.appendChild(B), this.lineElem_ = B;
  9363. const Q = e.createElement("div");
  9364. 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_();
  9365. }
  9366. get allFocusableElements() {
  9367. return [this.padElement];
  9368. }
  9369. update_() {
  9370. const [e, t] = this.value.rawValue.getComponents(), l = this.maxValue_, b = we(e, -l, +l, 0, 100), E = we(t, -l, +l, 0, 100), M = this.invertsY_ ? 100 - E : E;
  9371. this.lineElem_.setAttributeNS(null, "x2", `${b}%`), this.lineElem_.setAttributeNS(null, "y2", `${M}%`), this.markerElem_.style.left = `${b}%`, this.markerElem_.style.top = `${M}%`;
  9372. }
  9373. onValueChange_() {
  9374. this.update_();
  9375. }
  9376. onFoldableChange_() {
  9377. this.update_();
  9378. }
  9379. }
  9380. function Wo(i, e, t) {
  9381. return [
  9382. ze(e[0], ut(i)),
  9383. ze(e[1], xn(i)) * (t ? 1 : -1)
  9384. ];
  9385. }
  9386. class ac {
  9387. constructor(e, t) {
  9388. 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, {
  9389. invertsY: this.invertsY_,
  9390. layout: t.layout,
  9391. maxValue: this.maxValue_,
  9392. value: this.value,
  9393. viewProps: this.viewProps
  9394. }), 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_);
  9395. }
  9396. handlePointerEvent_(e, t) {
  9397. if (!e.point)
  9398. return;
  9399. const l = this.maxValue_, b = 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);
  9400. this.value.setRawValue(new en(b, E), t);
  9401. }
  9402. onPointerDown_(e) {
  9403. this.handlePointerEvent_(e.data, {
  9404. forceEmit: false,
  9405. last: false
  9406. });
  9407. }
  9408. onPointerMove_(e) {
  9409. this.handlePointerEvent_(e.data, {
  9410. forceEmit: false,
  9411. last: false
  9412. });
  9413. }
  9414. onPointerUp_(e) {
  9415. this.handlePointerEvent_(e.data, {
  9416. forceEmit: true,
  9417. last: true
  9418. });
  9419. }
  9420. onPadKeyDown_(e) {
  9421. ti(e.key) && e.preventDefault();
  9422. const [t, l] = Wo(e, this.baseSteps_, this.invertsY_);
  9423. t === 0 && l === 0 || this.value.setRawValue(new en(this.value.rawValue.x + t, this.value.rawValue.y + l), {
  9424. forceEmit: false,
  9425. last: false
  9426. });
  9427. }
  9428. onPadKeyUp_(e) {
  9429. const [t, l] = Wo(e, this.baseSteps_, this.invertsY_);
  9430. t === 0 && l === 0 || this.value.setRawValue(this.value.rawValue, {
  9431. forceEmit: true,
  9432. last: true
  9433. });
  9434. }
  9435. }
  9436. class lc {
  9437. constructor(e, t) {
  9438. var l, b;
  9439. 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_ = Be.create(t.expanded), this.popC_ = t.pickerLayout === "popup" ? new vs(e, {
  9440. viewProps: this.viewProps
  9441. }) : null;
  9442. const E = new ac(e, {
  9443. baseSteps: [t.axes[0].baseStep, t.axes[1].baseStep],
  9444. invertsY: t.invertsY,
  9445. layout: t.pickerLayout,
  9446. maxValue: t.maxValue,
  9447. value: this.value,
  9448. viewProps: this.viewProps
  9449. });
  9450. E.view.allFocusableElements.forEach((M) => {
  9451. M.addEventListener("blur", this.onPopupChildBlur_), M.addEventListener("keydown", this.onPopupChildKeydown_);
  9452. }), this.pickerC_ = E, this.textC_ = new Yr(e, {
  9453. assembly: Zo,
  9454. axes: t.axes,
  9455. parser: t.parser,
  9456. value: this.value,
  9457. viewProps: this.viewProps
  9458. }), this.view = new rc(e, {
  9459. expanded: this.foldable_.value("expanded"),
  9460. pickerLayout: t.pickerLayout,
  9461. viewProps: this.viewProps
  9462. }), this.view.textElement.appendChild(this.textC_.view.element), (l = this.view.buttonElement) === null || l === void 0 || l.addEventListener("blur", this.onPadButtonBlur_), (b = this.view.buttonElement) === null || b === void 0 || b.addEventListener("click", this.onPadButtonClick_), this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), Zt({
  9463. primary: this.foldable_.value("expanded"),
  9464. secondary: this.popC_.shows,
  9465. forward: (M) => M.rawValue,
  9466. backward: (M, B) => B.rawValue
  9467. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), $e(this.foldable_, this.view.pickerElement));
  9468. }
  9469. onPadButtonBlur_(e) {
  9470. if (!this.popC_)
  9471. return;
  9472. const t = this.view.element, l = e.relatedTarget;
  9473. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  9474. }
  9475. onPadButtonClick_() {
  9476. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  9477. }
  9478. onPopupChildBlur_(e) {
  9479. if (!this.popC_)
  9480. return;
  9481. const t = this.popC_.view.element, l = Ct(e);
  9482. l && t.contains(l) || l && l === this.view.buttonElement && !bt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  9483. }
  9484. onPopupChildKeydown_(e) {
  9485. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.view.buttonElement.focus();
  9486. }
  9487. }
  9488. class ai {
  9489. constructor(e = 0, t = 0, l = 0) {
  9490. this.x = e, this.y = t, this.z = l;
  9491. }
  9492. getComponents() {
  9493. return [this.x, this.y, this.z];
  9494. }
  9495. static isObject(e) {
  9496. if (_2(e))
  9497. return false;
  9498. const t = e.x, l = e.y, b = e.z;
  9499. return !(typeof t != "number" || typeof l != "number" || typeof b != "number");
  9500. }
  9501. static equals(e, t) {
  9502. return e.x === t.x && e.y === t.y && e.z === t.z;
  9503. }
  9504. toObject() {
  9505. return {
  9506. x: this.x,
  9507. y: this.y,
  9508. z: this.z
  9509. };
  9510. }
  9511. }
  9512. const Jo = {
  9513. toComponents: (i) => i.getComponents(),
  9514. fromComponents: (i) => new ai(...i)
  9515. };
  9516. function cc(i) {
  9517. return ai.isObject(i) ? new ai(i.x, i.y, i.z) : new ai();
  9518. }
  9519. function uc(i, e) {
  9520. i.writeProperty("x", e.x), i.writeProperty("y", e.y), i.writeProperty("z", e.z);
  9521. }
  9522. function pc(i, e) {
  9523. return new Jt({
  9524. assembly: Jo,
  9525. components: [
  9526. zt("x" in i ? i.x : void 0, e.x),
  9527. zt("y" in i ? i.y : void 0, e.y),
  9528. zt("z" in i ? i.z : void 0, e.z)
  9529. ]
  9530. });
  9531. }
  9532. function qr(i, e) {
  9533. return {
  9534. baseStep: Ft(e),
  9535. constraint: e,
  9536. textProps: X.fromObject({
  9537. draggingScale: Nt(e, i),
  9538. formatter: De(ii(e, i))
  9539. })
  9540. };
  9541. }
  9542. const hc = {
  9543. id: "input-point3d",
  9544. type: "input",
  9545. accept: (i, e) => {
  9546. if (!ai.isObject(i))
  9547. return null;
  9548. const t = S, l = le(e, {
  9549. x: t.optional.custom(wt),
  9550. y: t.optional.custom(wt),
  9551. z: t.optional.custom(wt)
  9552. });
  9553. return l ? {
  9554. initialValue: i,
  9555. params: l
  9556. } : null;
  9557. },
  9558. binding: {
  9559. reader: (i) => cc,
  9560. constraint: (i) => pc(i.params, i.initialValue),
  9561. equals: ai.equals,
  9562. writer: (i) => uc
  9563. },
  9564. controller: (i) => {
  9565. const e = i.value, t = i.constraint;
  9566. if (!(t instanceof Jt))
  9567. throw k.shouldNeverHappen();
  9568. return new Yr(i.document, {
  9569. assembly: Jo,
  9570. axes: [
  9571. qr(e.rawValue.x, t.components[0]),
  9572. qr(e.rawValue.y, t.components[1]),
  9573. qr(e.rawValue.z, t.components[2])
  9574. ],
  9575. parser: ct,
  9576. value: e,
  9577. viewProps: i.viewProps
  9578. });
  9579. }
  9580. };
  9581. class li {
  9582. constructor(e = 0, t = 0, l = 0, b = 0) {
  9583. this.x = e, this.y = t, this.z = l, this.w = b;
  9584. }
  9585. getComponents() {
  9586. return [this.x, this.y, this.z, this.w];
  9587. }
  9588. static isObject(e) {
  9589. if (_2(e))
  9590. return false;
  9591. const t = e.x, l = e.y, b = e.z, E = e.w;
  9592. return !(typeof t != "number" || typeof l != "number" || typeof b != "number" || typeof E != "number");
  9593. }
  9594. static equals(e, t) {
  9595. return e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w;
  9596. }
  9597. toObject() {
  9598. return {
  9599. x: this.x,
  9600. y: this.y,
  9601. z: this.z,
  9602. w: this.w
  9603. };
  9604. }
  9605. }
  9606. const ea = {
  9607. toComponents: (i) => i.getComponents(),
  9608. fromComponents: (i) => new li(...i)
  9609. };
  9610. function dc(i) {
  9611. return li.isObject(i) ? new li(i.x, i.y, i.z, i.w) : new li();
  9612. }
  9613. function mc(i, e) {
  9614. i.writeProperty("x", e.x), i.writeProperty("y", e.y), i.writeProperty("z", e.z), i.writeProperty("w", e.w);
  9615. }
  9616. function fc(i, e) {
  9617. return new Jt({
  9618. assembly: ea,
  9619. components: [
  9620. zt("x" in i ? i.x : void 0, e.x),
  9621. zt("y" in i ? i.y : void 0, e.y),
  9622. zt("z" in i ? i.z : void 0, e.z),
  9623. zt("w" in i ? i.w : void 0, e.w)
  9624. ]
  9625. });
  9626. }
  9627. function vc(i, e) {
  9628. return {
  9629. baseStep: Ft(e),
  9630. constraint: e,
  9631. textProps: X.fromObject({
  9632. draggingScale: Nt(e, i),
  9633. formatter: De(ii(e, i))
  9634. })
  9635. };
  9636. }
  9637. const bc = {
  9638. id: "input-point4d",
  9639. type: "input",
  9640. accept: (i, e) => {
  9641. if (!li.isObject(i))
  9642. return null;
  9643. const t = S, l = le(e, {
  9644. x: t.optional.custom(wt),
  9645. y: t.optional.custom(wt),
  9646. z: t.optional.custom(wt),
  9647. w: t.optional.custom(wt)
  9648. });
  9649. return l ? {
  9650. initialValue: i,
  9651. params: l
  9652. } : null;
  9653. },
  9654. binding: {
  9655. reader: (i) => dc,
  9656. constraint: (i) => fc(i.params, i.initialValue),
  9657. equals: li.equals,
  9658. writer: (i) => mc
  9659. },
  9660. controller: (i) => {
  9661. const e = i.value, t = i.constraint;
  9662. if (!(t instanceof Jt))
  9663. throw k.shouldNeverHappen();
  9664. return new Yr(i.document, {
  9665. assembly: ea,
  9666. axes: e.rawValue.getComponents().map((l, b) => vc(l, t.components[b])),
  9667. parser: ct,
  9668. value: e,
  9669. viewProps: i.viewProps
  9670. });
  9671. }
  9672. };
  9673. function gc(i) {
  9674. const e = [], t = zi(i.options);
  9675. return t && e.push(t), new bn(e);
  9676. }
  9677. const _c = {
  9678. id: "input-string",
  9679. type: "input",
  9680. accept: (i, e) => {
  9681. if (typeof i != "string")
  9682. return null;
  9683. const l = le(e, {
  9684. options: S.optional.custom(Pn)
  9685. });
  9686. return l ? {
  9687. initialValue: i,
  9688. params: l
  9689. } : null;
  9690. },
  9691. binding: {
  9692. reader: (i) => Ri,
  9693. constraint: (i) => gc(i.params),
  9694. writer: (i) => it
  9695. },
  9696. controller: (i) => {
  9697. const e = i.document, t = i.value, l = i.constraint, b = l && nt(l, gn);
  9698. return b ? new _n(e, {
  9699. props: new X({
  9700. options: b.values.value("options")
  9701. }),
  9702. value: t,
  9703. viewProps: i.viewProps
  9704. }) : new Jn(e, {
  9705. parser: (E) => E,
  9706. props: X.fromObject({
  9707. formatter: Tt
  9708. }),
  9709. value: t,
  9710. viewProps: i.viewProps
  9711. });
  9712. }
  9713. }, Gi = {
  9714. monitor: {
  9715. defaultInterval: 200,
  9716. defaultLineCount: 3
  9717. }
  9718. }, ta = D2("mll");
  9719. class wc {
  9720. constructor(e, t) {
  9721. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(ta()), t.viewProps.bindClassModifiers(this.element);
  9722. const l = e.createElement("textarea");
  9723. l.classList.add(ta("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_();
  9724. }
  9725. update_() {
  9726. const e = this.textareaElem_, t = e.scrollTop === e.scrollHeight - e.clientHeight, l = [];
  9727. this.value.rawValue.forEach((b) => {
  9728. b !== void 0 && l.push(this.formatter_(b));
  9729. }), e.textContent = l.join(`
  9730. `), t && (e.scrollTop = e.scrollHeight);
  9731. }
  9732. onValueUpdate_() {
  9733. this.update_();
  9734. }
  9735. }
  9736. class Qr {
  9737. constructor(e, t) {
  9738. this.value = t.value, this.viewProps = t.viewProps, this.view = new wc(e, {
  9739. formatter: t.formatter,
  9740. lineCount: t.lineCount,
  9741. value: this.value,
  9742. viewProps: this.viewProps
  9743. });
  9744. }
  9745. }
  9746. const na = D2("sgl");
  9747. class yc {
  9748. constructor(e, t) {
  9749. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(na()), t.viewProps.bindClassModifiers(this.element);
  9750. const l = e.createElement("input");
  9751. l.classList.add(na("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_();
  9752. }
  9753. update_() {
  9754. const e = this.value.rawValue, t = e[e.length - 1];
  9755. this.inputElement.value = t !== void 0 ? this.formatter_(t) : "";
  9756. }
  9757. onValueUpdate_() {
  9758. this.update_();
  9759. }
  9760. }
  9761. class Zr {
  9762. constructor(e, t) {
  9763. this.value = t.value, this.viewProps = t.viewProps, this.view = new yc(e, {
  9764. formatter: t.formatter,
  9765. value: this.value,
  9766. viewProps: this.viewProps
  9767. });
  9768. }
  9769. }
  9770. const xc = {
  9771. id: "monitor-bool",
  9772. type: "monitor",
  9773. accept: (i, e) => {
  9774. if (typeof i != "boolean")
  9775. return null;
  9776. const l = le(e, {
  9777. lineCount: S.optional.number
  9778. });
  9779. return l ? {
  9780. initialValue: i,
  9781. params: l
  9782. } : null;
  9783. },
  9784. binding: {
  9785. reader: (i) => gs
  9786. },
  9787. controller: (i) => {
  9788. var e;
  9789. return i.value.rawValue.length === 1 ? new Zr(i.document, {
  9790. formatter: _s,
  9791. value: i.value,
  9792. viewProps: i.viewProps
  9793. }) : new Qr(i.document, {
  9794. formatter: _s,
  9795. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Gi.monitor.defaultLineCount,
  9796. value: i.value,
  9797. viewProps: i.viewProps
  9798. });
  9799. }
  9800. }, nn = D2("grl");
  9801. class Ec {
  9802. constructor(e, t) {
  9803. 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_);
  9804. const l = e.createElementNS(Ke, "svg");
  9805. l.classList.add(nn("g")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, this.element.appendChild(l), this.svgElem_ = l;
  9806. const b = e.createElementNS(Ke, "polyline");
  9807. this.svgElem_.appendChild(b), this.lineElem_ = b;
  9808. const E = e.createElement("div");
  9809. E.classList.add(nn("t"), D2("tt")()), this.element.appendChild(E), this.tooltipElem_ = E, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  9810. }
  9811. get graphElement() {
  9812. return this.svgElem_;
  9813. }
  9814. update_() {
  9815. const e = this.svgElem_.getBoundingClientRect(), t = this.value.rawValue.length - 1, l = this.props_.get("minValue"), b = this.props_.get("maxValue"), E = [];
  9816. this.value.rawValue.forEach((de, ve) => {
  9817. if (de === void 0)
  9818. return;
  9819. const Ln = we(ve, 0, t, 0, e.width), Hi = we(de, l, b, e.height, 0);
  9820. E.push([Ln, Hi].join(","));
  9821. }), this.lineElem_.setAttributeNS(null, "points", E.join(" "));
  9822. const M = this.tooltipElem_, B = this.value.rawValue[this.cursor_.rawValue];
  9823. if (B === void 0) {
  9824. M.classList.remove(nn("t", "a"));
  9825. return;
  9826. }
  9827. const Q = we(this.cursor_.rawValue, 0, t, 0, e.width), J = we(B, l, b, e.height, 0);
  9828. M.style.left = `${Q}px`, M.style.top = `${J}px`, M.textContent = `${this.formatter_(B)}`, M.classList.contains(nn("t", "a")) || (M.classList.add(nn("t", "a"), nn("t", "in")), ot(M), M.classList.remove(nn("t", "in")));
  9829. }
  9830. onValueUpdate_() {
  9831. this.update_();
  9832. }
  9833. onCursorChange_() {
  9834. this.update_();
  9835. }
  9836. }
  9837. class Cc {
  9838. constructor(e, t) {
  9839. 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_ = ee(-1), this.view = new Ec(e, {
  9840. cursor: this.cursor_,
  9841. formatter: t.formatter,
  9842. lineCount: t.lineCount,
  9843. props: this.props_,
  9844. value: this.value,
  9845. viewProps: this.viewProps
  9846. }), !bt(e))
  9847. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  9848. else {
  9849. const l = new Ot(this.view.element);
  9850. l.emitter.on("down", this.onGraphPointerDown_), l.emitter.on("move", this.onGraphPointerMove_), l.emitter.on("up", this.onGraphPointerUp_);
  9851. }
  9852. }
  9853. onGraphMouseLeave_() {
  9854. this.cursor_.rawValue = -1;
  9855. }
  9856. onGraphMouseMove_(e) {
  9857. const t = this.view.element.getBoundingClientRect();
  9858. this.cursor_.rawValue = Math.floor(we(e.offsetX, 0, t.width, 0, this.value.rawValue.length));
  9859. }
  9860. onGraphPointerDown_(e) {
  9861. this.onGraphPointerMove_(e);
  9862. }
  9863. onGraphPointerMove_(e) {
  9864. if (!e.data.point) {
  9865. this.cursor_.rawValue = -1;
  9866. return;
  9867. }
  9868. this.cursor_.rawValue = Math.floor(we(e.data.point.x, 0, e.data.bounds.width, 0, this.value.rawValue.length));
  9869. }
  9870. onGraphPointerUp_() {
  9871. this.cursor_.rawValue = -1;
  9872. }
  9873. }
  9874. function Wr(i) {
  9875. return "format" in i && !_2(i.format) ? i.format : De(2);
  9876. }
  9877. function Pc(i) {
  9878. var e;
  9879. return i.value.rawValue.length === 1 ? new Zr(i.document, {
  9880. formatter: Wr(i.params),
  9881. value: i.value,
  9882. viewProps: i.viewProps
  9883. }) : new Qr(i.document, {
  9884. formatter: Wr(i.params),
  9885. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Gi.monitor.defaultLineCount,
  9886. value: i.value,
  9887. viewProps: i.viewProps
  9888. });
  9889. }
  9890. function Tc(i) {
  9891. var e, t, l;
  9892. return new Cc(i.document, {
  9893. formatter: Wr(i.params),
  9894. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Gi.monitor.defaultLineCount,
  9895. props: X.fromObject({
  9896. maxValue: (t = "max" in i.params ? i.params.max : null) !== null && t !== void 0 ? t : 100,
  9897. minValue: (l = "min" in i.params ? i.params.min : null) !== null && l !== void 0 ? l : 0
  9898. }),
  9899. value: i.value,
  9900. viewProps: i.viewProps
  9901. });
  9902. }
  9903. function ia(i) {
  9904. return "view" in i && i.view === "graph";
  9905. }
  9906. const kc = {
  9907. id: "monitor-number",
  9908. type: "monitor",
  9909. accept: (i, e) => {
  9910. if (typeof i != "number")
  9911. return null;
  9912. const t = S, l = le(e, {
  9913. format: t.optional.function,
  9914. lineCount: t.optional.number,
  9915. max: t.optional.number,
  9916. min: t.optional.number,
  9917. view: t.optional.string
  9918. });
  9919. return l ? {
  9920. initialValue: i,
  9921. params: l
  9922. } : null;
  9923. },
  9924. binding: {
  9925. defaultBufferSize: (i) => ia(i) ? 64 : 1,
  9926. reader: (i) => _t
  9927. },
  9928. controller: (i) => ia(i.params) ? Tc(i) : Pc(i)
  9929. }, Mc = {
  9930. id: "monitor-string",
  9931. type: "monitor",
  9932. accept: (i, e) => {
  9933. if (typeof i != "string")
  9934. return null;
  9935. const t = S, l = le(e, {
  9936. lineCount: t.optional.number,
  9937. multiline: t.optional.boolean
  9938. });
  9939. return l ? {
  9940. initialValue: i,
  9941. params: l
  9942. } : null;
  9943. },
  9944. binding: {
  9945. reader: (i) => Ri
  9946. },
  9947. controller: (i) => {
  9948. var e;
  9949. const t = i.value;
  9950. return t.rawValue.length > 1 || "multiline" in i.params && i.params.multiline ? new Qr(i.document, {
  9951. formatter: Tt,
  9952. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Gi.monitor.defaultLineCount,
  9953. value: t,
  9954. viewProps: i.viewProps
  9955. }) : new Zr(i.document, {
  9956. formatter: Tt,
  9957. value: t,
  9958. viewProps: i.viewProps
  9959. });
  9960. }
  9961. };
  9962. function Sc(i, e) {
  9963. var t;
  9964. const l = i.accept(e.target.read(), e.params);
  9965. if (_2(l))
  9966. return null;
  9967. const b = S, E = {
  9968. target: e.target,
  9969. initialValue: l.initialValue,
  9970. params: l.params
  9971. }, M = i.binding.reader(E), B = i.binding.constraint ? i.binding.constraint(E) : void 0, Q = ee(M(l.initialValue), {
  9972. constraint: B,
  9973. equals: i.binding.equals
  9974. }), J = new Zn({
  9975. reader: M,
  9976. target: e.target,
  9977. value: Q,
  9978. writer: i.binding.writer(E)
  9979. }), de = b.optional.boolean(e.params.disabled).value, ve = b.optional.boolean(e.params.hidden).value, Ln = i.controller({
  9980. constraint: B,
  9981. document: e.document,
  9982. initialValue: l.initialValue,
  9983. params: l.params,
  9984. value: J.value,
  9985. viewProps: Qe.create({
  9986. disabled: de,
  9987. hidden: ve
  9988. })
  9989. });
  9990. return new Ge(e.document, {
  9991. binding: J,
  9992. blade: xe(),
  9993. props: X.fromObject({
  9994. label: "label" in e.params ? (t = b.optional.string(e.params.label).value) !== null && t !== void 0 ? t : null : e.target.key
  9995. }),
  9996. valueController: Ln
  9997. });
  9998. }
  9999. function Lc(i, e) {
  10000. return e === 0 ? new hs() : new Pi(i, e ?? Gi.monitor.defaultInterval);
  10001. }
  10002. function Ac(i, e) {
  10003. var t, l, b;
  10004. const E = S, M = i.accept(e.target.read(), e.params);
  10005. if (_2(M))
  10006. return null;
  10007. const B = {
  10008. target: e.target,
  10009. initialValue: M.initialValue,
  10010. params: M.params
  10011. }, Q = i.binding.reader(B), J = (l = (t = E.optional.number(e.params.bufferSize).value) !== null && t !== void 0 ? t : i.binding.defaultBufferSize && i.binding.defaultBufferSize(M.params)) !== null && l !== void 0 ? l : 1, de = E.optional.number(e.params.interval).value, ve = new dr({
  10012. reader: Q,
  10013. target: e.target,
  10014. ticker: Lc(e.document, de),
  10015. value: ds(J)
  10016. }), Ln = E.optional.boolean(e.params.disabled).value, Hi = E.optional.boolean(e.params.hidden).value, Ki = i.controller({
  10017. document: e.document,
  10018. params: M.params,
  10019. value: ve.value,
  10020. viewProps: Qe.create({
  10021. disabled: Ln,
  10022. hidden: Hi
  10023. })
  10024. });
  10025. return new at(e.document, {
  10026. binding: ve,
  10027. blade: xe(),
  10028. props: X.fromObject({
  10029. label: "label" in e.params ? (b = E.optional.string(e.params.label).value) !== null && b !== void 0 ? b : null : e.target.key
  10030. }),
  10031. valueController: Ki
  10032. });
  10033. }
  10034. class Rc {
  10035. constructor() {
  10036. this.pluginsMap_ = {
  10037. blades: [],
  10038. inputs: [],
  10039. monitors: []
  10040. };
  10041. }
  10042. getAll() {
  10043. return [
  10044. ...this.pluginsMap_.blades,
  10045. ...this.pluginsMap_.inputs,
  10046. ...this.pluginsMap_.monitors
  10047. ];
  10048. }
  10049. register(e) {
  10050. e.type === "blade" ? this.pluginsMap_.blades.unshift(e) : e.type === "input" ? this.pluginsMap_.inputs.unshift(e) : e.type === "monitor" && this.pluginsMap_.monitors.unshift(e);
  10051. }
  10052. createInput(e, t, l) {
  10053. const b = t.read();
  10054. if (_2(b))
  10055. throw new k({
  10056. context: {
  10057. key: t.key
  10058. },
  10059. type: "nomatchingcontroller"
  10060. });
  10061. const E = this.pluginsMap_.inputs.reduce((M, B) => M ?? Sc(B, {
  10062. document: e,
  10063. target: t,
  10064. params: l
  10065. }), null);
  10066. if (E)
  10067. return E;
  10068. throw new k({
  10069. context: {
  10070. key: t.key
  10071. },
  10072. type: "nomatchingcontroller"
  10073. });
  10074. }
  10075. createMonitor(e, t, l) {
  10076. const b = this.pluginsMap_.monitors.reduce((E, M) => E ?? Ac(M, {
  10077. document: e,
  10078. params: l,
  10079. target: t
  10080. }), null);
  10081. if (b)
  10082. return b;
  10083. throw new k({
  10084. context: {
  10085. key: t.key
  10086. },
  10087. type: "nomatchingcontroller"
  10088. });
  10089. }
  10090. createBlade(e, t) {
  10091. const l = this.pluginsMap_.blades.reduce((b, E) => b ?? hr(E, {
  10092. document: e,
  10093. params: t
  10094. }), null);
  10095. if (!l)
  10096. throw new k({
  10097. type: "nomatchingview",
  10098. context: {
  10099. params: t
  10100. }
  10101. });
  10102. return l;
  10103. }
  10104. createBladeApi(e) {
  10105. if (e instanceof Ge)
  10106. return new bi(e);
  10107. if (e instanceof at)
  10108. return new gi(e);
  10109. if (e instanceof mn)
  10110. return new Yn(e, this);
  10111. const t = this.pluginsMap_.blades.reduce((l, b) => l ?? b.api({
  10112. controller: e,
  10113. pool: this
  10114. }), null);
  10115. if (!t)
  10116. throw k.shouldNeverHappen();
  10117. return t;
  10118. }
  10119. }
  10120. function Vc() {
  10121. const i = new Rc();
  10122. return [
  10123. Bc,
  10124. hc,
  10125. bc,
  10126. _c,
  10127. sc,
  10128. Jl,
  10129. Wl,
  10130. Yl,
  10131. si,
  10132. xc,
  10133. Mc,
  10134. kc,
  10135. W,
  10136. ar,
  10137. cr,
  10138. Ci
  10139. ].forEach((e) => {
  10140. i.register(e);
  10141. }), i;
  10142. }
  10143. function Ic(i) {
  10144. return en.isObject(i) ? new en(i.x, i.y) : new en();
  10145. }
  10146. function Dc(i, e) {
  10147. i.writeProperty("x", e.x), i.writeProperty("y", e.y);
  10148. }
  10149. function zt(i, e) {
  10150. if (!i)
  10151. return;
  10152. const t = [], l = qo(i, e);
  10153. l && t.push(l);
  10154. const b = Qo(i);
  10155. return b && t.push(b), new bn(t);
  10156. }
  10157. function Oc(i, e) {
  10158. return new Jt({
  10159. assembly: Zo,
  10160. components: [
  10161. zt("x" in i ? i.x : void 0, e.x),
  10162. zt("y" in i ? i.y : void 0, e.y)
  10163. ]
  10164. });
  10165. }
  10166. function sa(i, e) {
  10167. const [t, l] = i ? nc(i) : [];
  10168. if (!_2(t) || !_2(l))
  10169. return Math.max(Math.abs(t ?? 0), Math.abs(l ?? 0));
  10170. const b = Ft(i);
  10171. return Math.max(Math.abs(b) * 10, Math.abs(e) * 10);
  10172. }
  10173. function Fc(i, e) {
  10174. const t = e instanceof Jt ? e.components[0] : void 0, l = e instanceof Jt ? e.components[1] : void 0, b = sa(t, i.x), E = sa(l, i.y);
  10175. return Math.max(b, E);
  10176. }
  10177. function ra(i, e) {
  10178. return {
  10179. baseStep: Ft(e),
  10180. constraint: e,
  10181. textProps: X.fromObject({
  10182. draggingScale: Nt(e, i),
  10183. formatter: De(ii(e, i))
  10184. })
  10185. };
  10186. }
  10187. function Nc(i) {
  10188. if (!("y" in i))
  10189. return false;
  10190. const e = i.y;
  10191. return e && "inverted" in e ? !!e.inverted : false;
  10192. }
  10193. const Bc = {
  10194. id: "input-point2d",
  10195. type: "input",
  10196. accept: (i, e) => {
  10197. if (!en.isObject(i))
  10198. return null;
  10199. const t = S, l = le(e, {
  10200. expanded: t.optional.boolean,
  10201. picker: t.optional.custom(Bi),
  10202. x: t.optional.custom(wt),
  10203. y: t.optional.object({
  10204. inverted: t.optional.boolean,
  10205. max: t.optional.number,
  10206. min: t.optional.number,
  10207. step: t.optional.number
  10208. })
  10209. });
  10210. return l ? {
  10211. initialValue: i,
  10212. params: l
  10213. } : null;
  10214. },
  10215. binding: {
  10216. reader: (i) => Ic,
  10217. constraint: (i) => Oc(i.params, i.initialValue),
  10218. equals: en.equals,
  10219. writer: (i) => Dc
  10220. },
  10221. controller: (i) => {
  10222. const e = i.document, t = i.value, l = i.constraint;
  10223. if (!(l instanceof Jt))
  10224. throw k.shouldNeverHappen();
  10225. const b = "expanded" in i.params ? i.params.expanded : void 0, E = "picker" in i.params ? i.params.picker : void 0;
  10226. return new lc(e, {
  10227. axes: [
  10228. ra(t.rawValue.x, l.components[0]),
  10229. ra(t.rawValue.y, l.components[1])
  10230. ],
  10231. expanded: b ?? false,
  10232. invertsY: Nc(i.params),
  10233. maxValue: Fc(t.rawValue, l),
  10234. parser: ct,
  10235. pickerLayout: E ?? "popup",
  10236. value: t,
  10237. viewProps: i.viewProps
  10238. });
  10239. }
  10240. };
  10241. class oa extends o {
  10242. constructor(e) {
  10243. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10244. this.emitter_.emit("change", {
  10245. event: new p(this, t.rawValue)
  10246. });
  10247. });
  10248. }
  10249. get label() {
  10250. return this.controller_.props.get("label");
  10251. }
  10252. set label(e) {
  10253. this.controller_.props.set("label", e);
  10254. }
  10255. get options() {
  10256. return this.controller_.valueController.props.get("options");
  10257. }
  10258. set options(e) {
  10259. this.controller_.valueController.props.set("options", e);
  10260. }
  10261. get value() {
  10262. return this.controller_.valueController.value.rawValue;
  10263. }
  10264. set value(e) {
  10265. this.controller_.valueController.value.rawValue = e;
  10266. }
  10267. on(e, t) {
  10268. const l = t.bind(this);
  10269. return this.emitter_.on(e, (b) => {
  10270. l(b.event);
  10271. }), this;
  10272. }
  10273. }
  10274. class aa extends o {
  10275. constructor(e) {
  10276. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10277. this.emitter_.emit("change", {
  10278. event: new p(this, t.rawValue)
  10279. });
  10280. });
  10281. }
  10282. get label() {
  10283. return this.controller_.props.get("label");
  10284. }
  10285. set label(e) {
  10286. this.controller_.props.set("label", e);
  10287. }
  10288. get maxValue() {
  10289. return this.controller_.valueController.sliderController.props.get("maxValue");
  10290. }
  10291. set maxValue(e) {
  10292. this.controller_.valueController.sliderController.props.set("maxValue", e);
  10293. }
  10294. get minValue() {
  10295. return this.controller_.valueController.sliderController.props.get("minValue");
  10296. }
  10297. set minValue(e) {
  10298. this.controller_.valueController.sliderController.props.set("minValue", e);
  10299. }
  10300. get value() {
  10301. return this.controller_.valueController.value.rawValue;
  10302. }
  10303. set value(e) {
  10304. this.controller_.valueController.value.rawValue = e;
  10305. }
  10306. on(e, t) {
  10307. const l = t.bind(this);
  10308. return this.emitter_.on(e, (b) => {
  10309. l(b.event);
  10310. }), this;
  10311. }
  10312. }
  10313. class la extends o {
  10314. constructor(e) {
  10315. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10316. this.emitter_.emit("change", {
  10317. event: new p(this, t.rawValue)
  10318. });
  10319. });
  10320. }
  10321. get label() {
  10322. return this.controller_.props.get("label");
  10323. }
  10324. set label(e) {
  10325. this.controller_.props.set("label", e);
  10326. }
  10327. get formatter() {
  10328. return this.controller_.valueController.props.get("formatter");
  10329. }
  10330. set formatter(e) {
  10331. this.controller_.valueController.props.set("formatter", e);
  10332. }
  10333. get value() {
  10334. return this.controller_.valueController.value.rawValue;
  10335. }
  10336. set value(e) {
  10337. this.controller_.valueController.value.rawValue = e;
  10338. }
  10339. on(e, t) {
  10340. const l = t.bind(this);
  10341. return this.emitter_.on(e, (b) => {
  10342. l(b.event);
  10343. }), this;
  10344. }
  10345. }
  10346. const zc = function() {
  10347. return {
  10348. id: "list",
  10349. type: "blade",
  10350. accept(i) {
  10351. const e = S, t = le(i, {
  10352. options: e.required.custom(Pn),
  10353. value: e.required.raw,
  10354. view: e.required.constant("list"),
  10355. label: e.optional.string
  10356. });
  10357. return t ? { params: t } : null;
  10358. },
  10359. controller(i) {
  10360. const e = new gn(Ss(i.params.options)), t = ee(i.params.value, {
  10361. constraint: e
  10362. }), l = new _n(i.document, {
  10363. props: new X({
  10364. options: e.values.value("options")
  10365. }),
  10366. value: t,
  10367. viewProps: i.viewProps
  10368. });
  10369. return new Kt(i.document, {
  10370. blade: i.blade,
  10371. props: X.fromObject({
  10372. label: i.params.label
  10373. }),
  10374. valueController: l
  10375. });
  10376. },
  10377. api(i) {
  10378. return !(i.controller instanceof Kt) || !(i.controller.valueController instanceof _n) ? null : new oa(i.controller);
  10379. }
  10380. };
  10381. }();
  10382. function jc(i) {
  10383. return i.reduce((e, t) => Object.assign(e, {
  10384. [t.presetKey]: t.read()
  10385. }), {});
  10386. }
  10387. function Uc(i, e) {
  10388. i.forEach((t) => {
  10389. const l = e[t.target.presetKey];
  10390. l !== void 0 && t.writer(t.target, t.reader(l));
  10391. });
  10392. }
  10393. class Gc extends _i {
  10394. /**
  10395. * @hidden
  10396. */
  10397. constructor(e, t) {
  10398. super(e, t);
  10399. }
  10400. get element() {
  10401. return this.controller_.view.element;
  10402. }
  10403. /**
  10404. * Imports a preset of all inputs.
  10405. * @param preset The preset object to import.
  10406. */
  10407. importPreset(e) {
  10408. const t = this.controller_.rackController.rack.find(Ge).map((l) => l.binding);
  10409. Uc(t, e), this.refresh();
  10410. }
  10411. /**
  10412. * Exports a preset of all inputs.
  10413. * @return An exported preset object.
  10414. */
  10415. exportPreset() {
  10416. const e = this.controller_.rackController.rack.find(Ge).map((t) => t.binding.target);
  10417. return jc(e);
  10418. }
  10419. /**
  10420. * Refreshes all bindings of the pane.
  10421. */
  10422. refresh() {
  10423. this.controller_.rackController.rack.find(Ge).forEach((e) => {
  10424. e.binding.read();
  10425. }), this.controller_.rackController.rack.find(at).forEach((e) => {
  10426. e.binding.read();
  10427. });
  10428. }
  10429. }
  10430. class Hc extends qn {
  10431. constructor(e, t) {
  10432. super(e, {
  10433. expanded: t.expanded,
  10434. blade: t.blade,
  10435. props: t.props,
  10436. root: true,
  10437. viewProps: t.viewProps
  10438. });
  10439. }
  10440. }
  10441. const Kc = {
  10442. id: "slider",
  10443. type: "blade",
  10444. accept(i) {
  10445. const e = S, t = le(i, {
  10446. max: e.required.number,
  10447. min: e.required.number,
  10448. view: e.required.constant("slider"),
  10449. format: e.optional.function,
  10450. label: e.optional.string,
  10451. value: e.optional.number
  10452. });
  10453. return t ? { params: t } : null;
  10454. },
  10455. controller(i) {
  10456. var e, t;
  10457. const l = (e = i.params.value) !== null && e !== void 0 ? e : 0, b = new qt({
  10458. max: i.params.max,
  10459. min: i.params.min
  10460. }), E = new ni(i.document, {
  10461. baseStep: 1,
  10462. parser: ct,
  10463. sliderProps: new X({
  10464. maxValue: b.values.value("max"),
  10465. minValue: b.values.value("min")
  10466. }),
  10467. textProps: X.fromObject({
  10468. draggingScale: Nt(void 0, l),
  10469. formatter: (t = i.params.format) !== null && t !== void 0 ? t : Ar
  10470. }),
  10471. value: ee(l, {
  10472. constraint: b
  10473. }),
  10474. viewProps: i.viewProps
  10475. });
  10476. return new Kt(i.document, {
  10477. blade: i.blade,
  10478. props: X.fromObject({
  10479. label: i.params.label
  10480. }),
  10481. valueController: E
  10482. });
  10483. },
  10484. api(i) {
  10485. return !(i.controller instanceof Kt) || !(i.controller.valueController instanceof ni) ? null : new aa(i.controller);
  10486. }
  10487. }, $c = function() {
  10488. return {
  10489. id: "text",
  10490. type: "blade",
  10491. accept(i) {
  10492. const e = S, t = le(i, {
  10493. parse: e.required.function,
  10494. value: e.required.raw,
  10495. view: e.required.constant("text"),
  10496. format: e.optional.function,
  10497. label: e.optional.string
  10498. });
  10499. return t ? { params: t } : null;
  10500. },
  10501. controller(i) {
  10502. var e;
  10503. const t = new Jn(i.document, {
  10504. parser: i.params.parse,
  10505. props: X.fromObject({
  10506. formatter: (e = i.params.format) !== null && e !== void 0 ? e : (l) => String(l)
  10507. }),
  10508. value: ee(i.params.value),
  10509. viewProps: i.viewProps
  10510. });
  10511. return new Kt(i.document, {
  10512. blade: i.blade,
  10513. props: X.fromObject({
  10514. label: i.params.label
  10515. }),
  10516. valueController: t
  10517. });
  10518. },
  10519. api(i) {
  10520. return !(i.controller instanceof Kt) || !(i.controller.valueController instanceof Jn) ? null : new la(i.controller);
  10521. }
  10522. };
  10523. }();
  10524. function Xc(i) {
  10525. const e = i.createElement("div");
  10526. return e.classList.add(D2("dfw")()), i.body && i.body.appendChild(e), e;
  10527. }
  10528. function ca(i, e, t) {
  10529. if (i.querySelector(`style[data-tp-style=${e}]`))
  10530. return;
  10531. const l = i.createElement("style");
  10532. l.dataset.tpStyle = e, l.textContent = t, i.head.appendChild(l);
  10533. }
  10534. class Yc extends Gc {
  10535. constructor(e) {
  10536. var t, l;
  10537. const b = e ?? {}, E = (t = b.document) !== null && t !== void 0 ? t : fi(), M = Vc(), B = new Hc(E, {
  10538. expanded: b.expanded,
  10539. blade: xe(),
  10540. props: X.fromObject({
  10541. title: b.title
  10542. }),
  10543. viewProps: Qe.create()
  10544. });
  10545. super(B, M), this.pool_ = M, this.containerElem_ = (l = b.container) !== null && l !== void 0 ? l : Xc(E), this.containerElem_.appendChild(this.element), this.doc_ = E, this.usesDefaultWrapper_ = !b.container, this.setUpDefaultPlugins_();
  10546. }
  10547. get document() {
  10548. if (!this.doc_)
  10549. throw k.alreadyDisposed();
  10550. return this.doc_;
  10551. }
  10552. dispose() {
  10553. const e = this.containerElem_;
  10554. if (!e)
  10555. throw k.alreadyDisposed();
  10556. if (this.usesDefaultWrapper_) {
  10557. const t = e.parentElement;
  10558. t && t.removeChild(e);
  10559. }
  10560. this.containerElem_ = null, this.doc_ = null, super.dispose();
  10561. }
  10562. registerPlugin(e) {
  10563. ("plugin" in e ? [e.plugin] : "plugins" in e ? e.plugins : []).forEach((l) => {
  10564. this.pool_.register(l), this.embedPluginStyle_(l);
  10565. });
  10566. }
  10567. embedPluginStyle_(e) {
  10568. e.css && ca(this.document, `plugin-${e.id}`, e.css);
  10569. }
  10570. setUpDefaultPlugins_() {
  10571. ca(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) => {
  10572. this.embedPluginStyle_(e);
  10573. }), this.registerPlugin({
  10574. plugins: [
  10575. Kc,
  10576. zc,
  10577. Ci,
  10578. $c
  10579. ]
  10580. });
  10581. }
  10582. }
  10583. const qc = new r("3.1.7");
  10584. s.BladeApi = o, s.ButtonApi = z, s.FolderApi = _i, s.InputBindingApi = bi, s.ListApi = oa, s.MonitorBindingApi = gi, s.Pane = Yc, s.SeparatorApi = ls, s.SliderApi = aa, s.TabApi = us, s.TabPageApi = Ei, s.TextApi = la, s.TpChangeEvent = p, s.VERSION = qc, Object.defineProperty(s, "__esModule", { value: true });
  10585. });
  10586. })(Ih, Ks);
  10587. var ts = {};
  10588. var Dh = {
  10589. get exports() {
  10590. return ts;
  10591. },
  10592. set exports(v) {
  10593. ts = v;
  10594. }
  10595. };
  10596. (function(v, n) {
  10597. (function(s, r) {
  10598. r(n);
  10599. })(tl, function(s) {
  10600. class r {
  10601. constructor(a) {
  10602. this.controller_ = a;
  10603. }
  10604. get element() {
  10605. return this.controller_.view.element;
  10606. }
  10607. get disabled() {
  10608. return this.controller_.viewProps.get("disabled");
  10609. }
  10610. set disabled(a) {
  10611. this.controller_.viewProps.set("disabled", a);
  10612. }
  10613. get hidden() {
  10614. return this.controller_.viewProps.get("hidden");
  10615. }
  10616. set hidden(a) {
  10617. this.controller_.viewProps.set("hidden", a);
  10618. }
  10619. dispose() {
  10620. this.controller_.viewProps.set("disposed", true);
  10621. }
  10622. }
  10623. class o {
  10624. constructor(a) {
  10625. this.target = a;
  10626. }
  10627. }
  10628. class c extends o {
  10629. constructor(a, u, f, x) {
  10630. super(a), this.value = u, this.presetKey = f, this.last = x ?? true;
  10631. }
  10632. }
  10633. function p(m) {
  10634. return m;
  10635. }
  10636. function h(m) {
  10637. return m == null;
  10638. }
  10639. const d = {
  10640. alreadydisposed: () => "View has been already disposed",
  10641. invalidparams: (m) => `Invalid parameters for '${m.name}'`,
  10642. nomatchingcontroller: (m) => `No matching controller for '${m.key}'`,
  10643. nomatchingview: (m) => `No matching view for '${JSON.stringify(m.params)}'`,
  10644. notbindable: () => "Value is not bindable",
  10645. propertynotfound: (m) => `Property '${m.name}' not found`,
  10646. shouldneverhappen: () => "This error should never happen"
  10647. };
  10648. class g {
  10649. constructor(a) {
  10650. var u;
  10651. this.message = (u = d[a.type](a.context)) !== null && u !== void 0 ? u : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = a.type;
  10652. }
  10653. static alreadyDisposed() {
  10654. return new g({ type: "alreadydisposed" });
  10655. }
  10656. static notBindable() {
  10657. return new g({
  10658. type: "notbindable"
  10659. });
  10660. }
  10661. static propertyNotFound(a) {
  10662. return new g({
  10663. type: "propertynotfound",
  10664. context: {
  10665. name: a
  10666. }
  10667. });
  10668. }
  10669. static shouldNeverHappen() {
  10670. return new g({ type: "shouldneverhappen" });
  10671. }
  10672. }
  10673. class w {
  10674. constructor() {
  10675. this.observers_ = {};
  10676. }
  10677. on(a, u) {
  10678. let f = this.observers_[a];
  10679. return f || (f = this.observers_[a] = []), f.push({
  10680. handler: u
  10681. }), this;
  10682. }
  10683. off(a, u) {
  10684. const f = this.observers_[a];
  10685. return f && (this.observers_[a] = f.filter((x) => x.handler !== u)), this;
  10686. }
  10687. emit(a, u) {
  10688. const f = this.observers_[a];
  10689. f && f.forEach((x) => {
  10690. x.handler(u);
  10691. });
  10692. }
  10693. }
  10694. const _2 = "tp";
  10695. function y(m) {
  10696. return (u, f) => [
  10697. _2,
  10698. "-",
  10699. m,
  10700. "v",
  10701. u ? `_${u}` : "",
  10702. f ? `-${f}` : ""
  10703. ].join("");
  10704. }
  10705. function P(m, a) {
  10706. return (u) => a(m(u));
  10707. }
  10708. function R(m) {
  10709. return m.rawValue;
  10710. }
  10711. function k(m, a) {
  10712. m.emitter.on("change", P(R, a)), a(m.rawValue);
  10713. }
  10714. function A(m, a, u) {
  10715. k(m.value(a), u);
  10716. }
  10717. function z(m, a, u) {
  10718. u ? m.classList.add(a) : m.classList.remove(a);
  10719. }
  10720. function F(m, a) {
  10721. return (u) => {
  10722. z(m, a, u);
  10723. };
  10724. }
  10725. function I(m, a) {
  10726. k(m, (u) => {
  10727. a.textContent = u ?? "";
  10728. });
  10729. }
  10730. const D2 = y("btn");
  10731. class Y {
  10732. constructor(a, u) {
  10733. this.element = a.createElement("div"), this.element.classList.add(D2()), u.viewProps.bindClassModifiers(this.element);
  10734. const f = a.createElement("button");
  10735. f.classList.add(D2("b")), u.viewProps.bindDisabled(f), this.element.appendChild(f), this.buttonElement = f;
  10736. const x = a.createElement("div");
  10737. x.classList.add(D2("t")), I(u.props.value("title"), x), this.buttonElement.appendChild(x);
  10738. }
  10739. }
  10740. class G {
  10741. constructor(a, u) {
  10742. this.emitter = new w(), this.onClick_ = this.onClick_.bind(this), this.props = u.props, this.viewProps = u.viewProps, this.view = new Y(a, {
  10743. props: this.props,
  10744. viewProps: this.viewProps
  10745. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  10746. }
  10747. onClick_() {
  10748. this.emitter.emit("click", {
  10749. sender: this
  10750. });
  10751. }
  10752. }
  10753. class N {
  10754. constructor(a, u) {
  10755. var f;
  10756. this.constraint_ = u == null ? void 0 : u.constraint, this.equals_ = (f = u == null ? void 0 : u.equals) !== null && f !== void 0 ? f : (x, T) => x === T, this.emitter = new w(), this.rawValue_ = a;
  10757. }
  10758. get constraint() {
  10759. return this.constraint_;
  10760. }
  10761. get rawValue() {
  10762. return this.rawValue_;
  10763. }
  10764. set rawValue(a) {
  10765. this.setRawValue(a, {
  10766. forceEmit: false,
  10767. last: true
  10768. });
  10769. }
  10770. setRawValue(a, u) {
  10771. const f = u ?? {
  10772. forceEmit: false,
  10773. last: true
  10774. }, x = this.constraint_ ? this.constraint_.constrain(a) : a, T = this.rawValue_;
  10775. this.equals_(T, x) && !f.forceEmit || (this.emitter.emit("beforechange", {
  10776. sender: this
  10777. }), this.rawValue_ = x, this.emitter.emit("change", {
  10778. options: f,
  10779. previousRawValue: T,
  10780. rawValue: x,
  10781. sender: this
  10782. }));
  10783. }
  10784. }
  10785. class O {
  10786. constructor(a) {
  10787. this.emitter = new w(), this.value_ = a;
  10788. }
  10789. get rawValue() {
  10790. return this.value_;
  10791. }
  10792. set rawValue(a) {
  10793. this.setRawValue(a, {
  10794. forceEmit: false,
  10795. last: true
  10796. });
  10797. }
  10798. setRawValue(a, u) {
  10799. const f = u ?? {
  10800. forceEmit: false,
  10801. last: true
  10802. }, x = this.value_;
  10803. x === a && !f.forceEmit || (this.emitter.emit("beforechange", {
  10804. sender: this
  10805. }), this.value_ = a, this.emitter.emit("change", {
  10806. options: f,
  10807. previousRawValue: x,
  10808. rawValue: this.value_,
  10809. sender: this
  10810. }));
  10811. }
  10812. }
  10813. function H(m, a) {
  10814. const u = a == null ? void 0 : a.constraint, f = a == null ? void 0 : a.equals;
  10815. return !u && !f ? new O(m) : new N(m, a);
  10816. }
  10817. class K {
  10818. constructor(a) {
  10819. this.emitter = new w(), this.valMap_ = a;
  10820. for (const u in this.valMap_)
  10821. this.valMap_[u].emitter.on("change", () => {
  10822. this.emitter.emit("change", {
  10823. key: u,
  10824. sender: this
  10825. });
  10826. });
  10827. }
  10828. static createCore(a) {
  10829. return Object.keys(a).reduce((f, x) => Object.assign(f, {
  10830. [x]: H(a[x])
  10831. }), {});
  10832. }
  10833. static fromObject(a) {
  10834. const u = this.createCore(a);
  10835. return new K(u);
  10836. }
  10837. get(a) {
  10838. return this.valMap_[a].rawValue;
  10839. }
  10840. set(a, u) {
  10841. this.valMap_[a].rawValue = u;
  10842. }
  10843. value(a) {
  10844. return this.valMap_[a];
  10845. }
  10846. }
  10847. function q(m, a) {
  10848. const f = Object.keys(a).reduce((x, T) => {
  10849. if (x === void 0)
  10850. return;
  10851. const V = a[T], j = V(m[T]);
  10852. return j.succeeded ? Object.assign(Object.assign({}, x), { [T]: j.value }) : void 0;
  10853. }, {});
  10854. return f;
  10855. }
  10856. function pe(m, a) {
  10857. return m.reduce((u, f) => {
  10858. if (u === void 0)
  10859. return;
  10860. const x = a(f);
  10861. if (!(!x.succeeded || x.value === void 0))
  10862. return [...u, x.value];
  10863. }, []);
  10864. }
  10865. function _e(m) {
  10866. return m === null ? false : typeof m == "object";
  10867. }
  10868. function ce(m) {
  10869. return (a) => (u) => {
  10870. if (!a && u === void 0)
  10871. return {
  10872. succeeded: false,
  10873. value: void 0
  10874. };
  10875. if (a && u === void 0)
  10876. return {
  10877. succeeded: true,
  10878. value: void 0
  10879. };
  10880. const f = m(u);
  10881. return f !== void 0 ? {
  10882. succeeded: true,
  10883. value: f
  10884. } : {
  10885. succeeded: false,
  10886. value: void 0
  10887. };
  10888. };
  10889. }
  10890. function me(m) {
  10891. return {
  10892. custom: (a) => ce(a)(m),
  10893. boolean: ce((a) => typeof a == "boolean" ? a : void 0)(m),
  10894. number: ce((a) => typeof a == "number" ? a : void 0)(m),
  10895. string: ce((a) => typeof a == "string" ? a : void 0)(m),
  10896. function: ce((a) => typeof a == "function" ? a : void 0)(m),
  10897. constant: (a) => ce((u) => u === a ? a : void 0)(m),
  10898. raw: ce((a) => a)(m),
  10899. object: (a) => ce((u) => {
  10900. if (_e(u))
  10901. return q(u, a);
  10902. })(m),
  10903. array: (a) => ce((u) => {
  10904. if (Array.isArray(u))
  10905. return pe(u, a);
  10906. })(m)
  10907. };
  10908. }
  10909. const he = {
  10910. optional: me(true),
  10911. required: me(false)
  10912. };
  10913. function ee(m, a) {
  10914. const u = he.required.object(a)(m);
  10915. return u.succeeded ? u.value : void 0;
  10916. }
  10917. function X(m) {
  10918. console.warn([
  10919. `Missing '${m.key}' of ${m.target} in ${m.place}.`,
  10920. "Please rebuild plugins with the latest core package."
  10921. ].join(" "));
  10922. }
  10923. function Te(m) {
  10924. return m && m.parentElement && m.parentElement.removeChild(m), null;
  10925. }
  10926. class fe {
  10927. constructor(a) {
  10928. this.value_ = a;
  10929. }
  10930. static create(a) {
  10931. return [
  10932. new fe(a),
  10933. (u, f) => {
  10934. a.setRawValue(u, f);
  10935. }
  10936. ];
  10937. }
  10938. get emitter() {
  10939. return this.value_.emitter;
  10940. }
  10941. get rawValue() {
  10942. return this.value_.rawValue;
  10943. }
  10944. }
  10945. const ae = y("");
  10946. function ne(m, a) {
  10947. return F(m, ae(void 0, a));
  10948. }
  10949. class ge extends K {
  10950. constructor(a) {
  10951. var u;
  10952. super(a), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = fe.create(H(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (u = this.get("parent")) === null || u === void 0 || u.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  10953. }
  10954. static create(a) {
  10955. var u, f, x;
  10956. const T = a ?? {};
  10957. return new ge(K.createCore({
  10958. disabled: (u = T.disabled) !== null && u !== void 0 ? u : false,
  10959. disposed: false,
  10960. hidden: (f = T.hidden) !== null && f !== void 0 ? f : false,
  10961. parent: (x = T.parent) !== null && x !== void 0 ? x : null
  10962. }));
  10963. }
  10964. get globalDisabled() {
  10965. return this.globalDisabled_;
  10966. }
  10967. bindClassModifiers(a) {
  10968. k(this.globalDisabled_, ne(a, "disabled")), A(this, "hidden", ne(a, "hidden"));
  10969. }
  10970. bindDisabled(a) {
  10971. k(this.globalDisabled_, (u) => {
  10972. a.disabled = u;
  10973. });
  10974. }
  10975. bindTabIndex(a) {
  10976. k(this.globalDisabled_, (u) => {
  10977. a.tabIndex = u ? -1 : 0;
  10978. });
  10979. }
  10980. handleDispose(a) {
  10981. this.value("disposed").emitter.on("change", (u) => {
  10982. u && a();
  10983. });
  10984. }
  10985. getGlobalDisabled_() {
  10986. const a = this.get("parent");
  10987. return (a ? a.globalDisabled.rawValue : false) || this.get("disabled");
  10988. }
  10989. updateGlobalDisabled_() {
  10990. this.setGlobalDisabled_(this.getGlobalDisabled_());
  10991. }
  10992. onDisabledChange_() {
  10993. this.updateGlobalDisabled_();
  10994. }
  10995. onParentGlobalDisabledChange_() {
  10996. this.updateGlobalDisabled_();
  10997. }
  10998. onParentChange_(a) {
  10999. var u;
  11000. const f = a.previousRawValue;
  11001. f == null || f.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (u = this.get("parent")) === null || u === void 0 || u.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  11002. }
  11003. }
  11004. function S() {
  11005. return ["veryfirst", "first", "last", "verylast"];
  11006. }
  11007. const le = y(""), Fe = {
  11008. veryfirst: "vfst",
  11009. first: "fst",
  11010. last: "lst",
  11011. verylast: "vlst"
  11012. };
  11013. class Ue {
  11014. constructor(a) {
  11015. this.parent_ = null, this.blade = a.blade, this.view = a.view, this.viewProps = a.viewProps;
  11016. const u = this.view.element;
  11017. this.blade.value("positions").emitter.on("change", () => {
  11018. S().forEach((f) => {
  11019. u.classList.remove(le(void 0, Fe[f]));
  11020. }), this.blade.get("positions").forEach((f) => {
  11021. u.classList.add(le(void 0, Fe[f]));
  11022. });
  11023. }), this.viewProps.handleDispose(() => {
  11024. Te(u);
  11025. });
  11026. }
  11027. get parent() {
  11028. return this.parent_;
  11029. }
  11030. set parent(a) {
  11031. if (this.parent_ = a, !("parent" in this.viewProps.valMap_)) {
  11032. X({
  11033. key: "parent",
  11034. target: ge.name,
  11035. place: "BladeController.parent"
  11036. });
  11037. return;
  11038. }
  11039. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  11040. }
  11041. }
  11042. const ye = "http://www.w3.org/2000/svg";
  11043. function rt(m) {
  11044. m.offsetHeight;
  11045. }
  11046. function jn(m, a) {
  11047. const u = m.style.transition;
  11048. m.style.transition = "none", a(), m.style.transition = u;
  11049. }
  11050. function Qe(m) {
  11051. return m.ontouchstart !== void 0;
  11052. }
  11053. function Un(m) {
  11054. for (; m.childNodes.length > 0; )
  11055. m.removeChild(m.childNodes[0]);
  11056. }
  11057. function cn(m) {
  11058. return m.relatedTarget ? m.relatedTarget : "explicitOriginalTarget" in m ? m.explicitOriginalTarget : null;
  11059. }
  11060. const vt = y("lbl");
  11061. function Lt(m, a) {
  11062. const u = m.createDocumentFragment();
  11063. return a.split(`
  11064. `).map((x) => m.createTextNode(x)).forEach((x, T) => {
  11065. T > 0 && u.appendChild(m.createElement("br")), u.appendChild(x);
  11066. }), u;
  11067. }
  11068. class Ke {
  11069. constructor(a, u) {
  11070. this.element = a.createElement("div"), this.element.classList.add(vt()), u.viewProps.bindClassModifiers(this.element);
  11071. const f = a.createElement("div");
  11072. f.classList.add(vt("l")), A(u.props, "label", (T) => {
  11073. h(T) ? this.element.classList.add(vt(void 0, "nol")) : (this.element.classList.remove(vt(void 0, "nol")), Un(f), f.appendChild(Lt(a, T)));
  11074. }), this.element.appendChild(f), this.labelElement = f;
  11075. const x = a.createElement("div");
  11076. x.classList.add(vt("v")), this.element.appendChild(x), this.valueElement = x;
  11077. }
  11078. }
  11079. class ot extends Ue {
  11080. constructor(a, u) {
  11081. const f = u.valueController.viewProps;
  11082. super(Object.assign(Object.assign({}, u), { view: new Ke(a, {
  11083. props: u.props,
  11084. viewProps: f
  11085. }), viewProps: f })), this.props = u.props, this.valueController = u.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11086. }
  11087. }
  11088. class un extends Ue {
  11089. constructor(a) {
  11090. super(a), this.value = a.value;
  11091. }
  11092. }
  11093. class bt extends K {
  11094. constructor(a) {
  11095. super(a);
  11096. }
  11097. static create(a) {
  11098. const u = {
  11099. completed: true,
  11100. expanded: a,
  11101. expandedHeight: null,
  11102. shouldFixHeight: false,
  11103. temporaryExpanded: null
  11104. }, f = K.createCore(u);
  11105. return new bt(f);
  11106. }
  11107. get styleExpanded() {
  11108. var a;
  11109. return (a = this.get("temporaryExpanded")) !== null && a !== void 0 ? a : this.get("expanded");
  11110. }
  11111. get styleHeight() {
  11112. if (!this.styleExpanded)
  11113. return "0";
  11114. const a = this.get("expandedHeight");
  11115. return this.get("shouldFixHeight") && !h(a) ? `${a}px` : "auto";
  11116. }
  11117. bindExpandedClass(a, u) {
  11118. const f = () => {
  11119. this.styleExpanded ? a.classList.add(u) : a.classList.remove(u);
  11120. };
  11121. A(this, "expanded", f), A(this, "temporaryExpanded", f);
  11122. }
  11123. cleanUpTransition() {
  11124. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  11125. }
  11126. }
  11127. function Gn(m) {
  11128. return bt.create(m);
  11129. }
  11130. function fi(m, a) {
  11131. let u = 0;
  11132. return jn(a, () => {
  11133. m.set("expandedHeight", null), m.set("temporaryExpanded", true), rt(a), u = a.clientHeight, m.set("temporaryExpanded", null), rt(a);
  11134. }), u;
  11135. }
  11136. function Hn(m, a) {
  11137. a.style.height = m.styleHeight;
  11138. }
  11139. function Kn(m, a) {
  11140. m.value("expanded").emitter.on("beforechange", () => {
  11141. m.set("completed", false), h(m.get("expandedHeight")) && m.set("expandedHeight", fi(m, a)), m.set("shouldFixHeight", true), rt(a);
  11142. }), m.emitter.on("change", () => {
  11143. Hn(m, a);
  11144. }), Hn(m, a), a.addEventListener("transitionend", (u) => {
  11145. u.propertyName === "height" && m.cleanUpTransition();
  11146. });
  11147. }
  11148. class Et {
  11149. constructor(a, u) {
  11150. const f = y(u.viewName);
  11151. this.element = a.createElement("div"), this.element.classList.add(f()), u.viewProps.bindClassModifiers(this.element);
  11152. }
  11153. }
  11154. class At extends un {
  11155. constructor(a, u) {
  11156. const f = u.valueController.viewProps;
  11157. super(Object.assign(Object.assign({}, u), { value: u.valueController.value, view: new Ke(a, {
  11158. props: u.props,
  11159. viewProps: f
  11160. }), viewProps: f })), this.props = u.props, this.valueController = u.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11161. }
  11162. }
  11163. class $n {
  11164. constructor() {
  11165. this.disabled = false, this.emitter = new w();
  11166. }
  11167. dispose() {
  11168. }
  11169. tick() {
  11170. this.disabled || this.emitter.emit("tick", {
  11171. sender: this
  11172. });
  11173. }
  11174. }
  11175. class pn {
  11176. constructor(a, u) {
  11177. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = a, this.emitter = new w(), this.interval_ = u, this.setTimer_();
  11178. }
  11179. get disabled() {
  11180. return this.disabled_;
  11181. }
  11182. set disabled(a) {
  11183. this.disabled_ = a, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  11184. }
  11185. dispose() {
  11186. this.clearTimer_();
  11187. }
  11188. clearTimer_() {
  11189. if (this.timerId_ === null)
  11190. return;
  11191. const a = this.doc_.defaultView;
  11192. a && a.clearInterval(this.timerId_), this.timerId_ = null;
  11193. }
  11194. setTimer_() {
  11195. if (this.clearTimer_(), this.interval_ <= 0)
  11196. return;
  11197. const a = this.doc_.defaultView;
  11198. a && (this.timerId_ = a.setInterval(this.onTick_, this.interval_));
  11199. }
  11200. onTick_() {
  11201. this.disabled_ || this.emitter.emit("tick", {
  11202. sender: this
  11203. });
  11204. }
  11205. }
  11206. class Xn {
  11207. constructor(a) {
  11208. this.constraints = a;
  11209. }
  11210. constrain(a) {
  11211. return this.constraints.reduce((u, f) => f.constrain(u), a);
  11212. }
  11213. }
  11214. function Ct(m, a) {
  11215. if (m instanceof a)
  11216. return m;
  11217. if (m instanceof Xn) {
  11218. const u = m.constraints.reduce((f, x) => f || (x instanceof a ? x : null), null);
  11219. if (u)
  11220. return u;
  11221. }
  11222. return null;
  11223. }
  11224. class gt {
  11225. constructor(a) {
  11226. this.values = K.fromObject({
  11227. max: a.max,
  11228. min: a.min
  11229. });
  11230. }
  11231. constrain(a) {
  11232. const u = this.values.get("max"), f = this.values.get("min");
  11233. return Math.min(Math.max(a, f), u);
  11234. }
  11235. }
  11236. class Rt2 {
  11237. constructor(a) {
  11238. this.values = K.fromObject({
  11239. max: a.max,
  11240. min: a.min
  11241. });
  11242. }
  11243. get maxValue() {
  11244. return this.values.get("max");
  11245. }
  11246. get minValue() {
  11247. return this.values.get("min");
  11248. }
  11249. constrain(a) {
  11250. const u = this.values.get("max"), f = this.values.get("min");
  11251. let x = a;
  11252. return h(f) || (x = Math.max(x, f)), h(u) || (x = Math.min(x, u)), x;
  11253. }
  11254. }
  11255. class L {
  11256. constructor(a, u = 0) {
  11257. this.step = a, this.origin = u;
  11258. }
  11259. constrain(a) {
  11260. const u = this.origin % this.step, f = Math.round((a - u) / this.step);
  11261. return u + f * this.step;
  11262. }
  11263. }
  11264. const U = y("pop");
  11265. class W {
  11266. constructor(a, u) {
  11267. this.element = a.createElement("div"), this.element.classList.add(U()), u.viewProps.bindClassModifiers(this.element), k(u.shows, F(this.element, U(void 0, "v")));
  11268. }
  11269. }
  11270. class ie {
  11271. constructor(a, u) {
  11272. this.shows = H(false), this.viewProps = u.viewProps, this.view = new W(a, {
  11273. shows: this.shows,
  11274. viewProps: this.viewProps
  11275. });
  11276. }
  11277. }
  11278. const xe = y("txt");
  11279. class Be {
  11280. constructor(a, u) {
  11281. this.onChange_ = this.onChange_.bind(this), this.element = a.createElement("div"), this.element.classList.add(xe()), u.viewProps.bindClassModifiers(this.element), this.props_ = u.props, this.props_.emitter.on("change", this.onChange_);
  11282. const f = a.createElement("input");
  11283. f.classList.add(xe("i")), f.type = "text", u.viewProps.bindDisabled(f), this.element.appendChild(f), this.inputElement = f, u.value.emitter.on("change", this.onChange_), this.value_ = u.value, this.refresh();
  11284. }
  11285. refresh() {
  11286. const a = this.props_.get("formatter");
  11287. this.inputElement.value = a(this.value_.rawValue);
  11288. }
  11289. onChange_() {
  11290. this.refresh();
  11291. }
  11292. }
  11293. class Ht {
  11294. constructor(a, u) {
  11295. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = u.parser, this.props = u.props, this.value = u.value, this.viewProps = u.viewProps, this.view = new Be(a, {
  11296. props: u.props,
  11297. value: this.value,
  11298. viewProps: this.viewProps
  11299. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  11300. }
  11301. onInputChange_(a) {
  11302. const f = a.currentTarget.value, x = this.parser_(f);
  11303. h(x) || (this.value.rawValue = x), this.view.refresh();
  11304. }
  11305. }
  11306. function hn(m) {
  11307. return m === "false" ? false : !!m;
  11308. }
  11309. class $e {
  11310. constructor(a) {
  11311. this.text = a;
  11312. }
  11313. evaluate() {
  11314. return Number(this.text);
  11315. }
  11316. toString() {
  11317. return this.text;
  11318. }
  11319. }
  11320. const Xe = {
  11321. "**": (m, a) => Math.pow(m, a),
  11322. "*": (m, a) => m * a,
  11323. "/": (m, a) => m / a,
  11324. "%": (m, a) => m % a,
  11325. "+": (m, a) => m + a,
  11326. "-": (m, a) => m - a,
  11327. "<<": (m, a) => m << a,
  11328. ">>": (m, a) => m >> a,
  11329. ">>>": (m, a) => m >>> a,
  11330. "&": (m, a) => m & a,
  11331. "^": (m, a) => m ^ a,
  11332. "|": (m, a) => m | a
  11333. };
  11334. class Zs {
  11335. constructor(a, u, f) {
  11336. this.left = u, this.operator = a, this.right = f;
  11337. }
  11338. evaluate() {
  11339. const a = Xe[this.operator];
  11340. if (!a)
  11341. throw new Error(`unexpected binary operator: '${this.operator}`);
  11342. return a(this.left.evaluate(), this.right.evaluate());
  11343. }
  11344. toString() {
  11345. return [
  11346. "b(",
  11347. this.left.toString(),
  11348. this.operator,
  11349. this.right.toString(),
  11350. ")"
  11351. ].join(" ");
  11352. }
  11353. }
  11354. const Ws = {
  11355. "+": (m) => m,
  11356. "-": (m) => -m,
  11357. "~": (m) => ~m
  11358. };
  11359. class Js {
  11360. constructor(a, u) {
  11361. this.operator = a, this.expression = u;
  11362. }
  11363. evaluate() {
  11364. const a = Ws[this.operator];
  11365. if (!a)
  11366. throw new Error(`unexpected unary operator: '${this.operator}`);
  11367. return a(this.expression.evaluate());
  11368. }
  11369. toString() {
  11370. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  11371. }
  11372. }
  11373. function vi(m) {
  11374. return (a, u) => {
  11375. for (let f = 0; f < m.length; f++) {
  11376. const x = m[f](a, u);
  11377. if (x !== "")
  11378. return x;
  11379. }
  11380. return "";
  11381. };
  11382. }
  11383. function Vt(m, a) {
  11384. var u;
  11385. const f = m.substr(a).match(/^\s+/);
  11386. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11387. }
  11388. function bi(m, a) {
  11389. const u = m.substr(a, 1);
  11390. return u.match(/^[1-9]$/) ? u : "";
  11391. }
  11392. function Ge(m, a) {
  11393. var u;
  11394. const f = m.substr(a).match(/^[0-9]+/);
  11395. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11396. }
  11397. function gi(m, a) {
  11398. const u = Ge(m, a);
  11399. if (u !== "")
  11400. return u;
  11401. const f = m.substr(a, 1);
  11402. if (a += 1, f !== "-" && f !== "+")
  11403. return "";
  11404. const x = Ge(m, a);
  11405. return x === "" ? "" : f + x;
  11406. }
  11407. function at(m, a) {
  11408. const u = m.substr(a, 1);
  11409. if (a += 1, u.toLowerCase() !== "e")
  11410. return "";
  11411. const f = gi(m, a);
  11412. return f === "" ? "" : u + f;
  11413. }
  11414. function rs(m, a) {
  11415. const u = m.substr(a, 1);
  11416. if (u === "0")
  11417. return u;
  11418. const f = bi(m, a);
  11419. return a += f.length, f === "" ? "" : f + Ge(m, a);
  11420. }
  11421. function dn(m, a) {
  11422. const u = rs(m, a);
  11423. if (a += u.length, u === "")
  11424. return "";
  11425. const f = m.substr(a, 1);
  11426. if (a += f.length, f !== ".")
  11427. return "";
  11428. const x = Ge(m, a);
  11429. return a += x.length, u + f + x + at(m, a);
  11430. }
  11431. function os(m, a) {
  11432. const u = m.substr(a, 1);
  11433. if (a += u.length, u !== ".")
  11434. return "";
  11435. const f = Ge(m, a);
  11436. return a += f.length, f === "" ? "" : u + f + at(m, a);
  11437. }
  11438. function Yn(m, a) {
  11439. const u = rs(m, a);
  11440. return a += u.length, u === "" ? "" : u + at(m, a);
  11441. }
  11442. const _i = vi([
  11443. dn,
  11444. os,
  11445. Yn
  11446. ]);
  11447. function wi(m, a) {
  11448. var u;
  11449. const f = m.substr(a).match(/^[01]+/);
  11450. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11451. }
  11452. function er(m, a) {
  11453. const u = m.substr(a, 2);
  11454. if (a += u.length, u.toLowerCase() !== "0b")
  11455. return "";
  11456. const f = wi(m, a);
  11457. return f === "" ? "" : u + f;
  11458. }
  11459. function tr(m, a) {
  11460. var u;
  11461. const f = m.substr(a).match(/^[0-7]+/);
  11462. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11463. }
  11464. function nr(m, a) {
  11465. const u = m.substr(a, 2);
  11466. if (a += u.length, u.toLowerCase() !== "0o")
  11467. return "";
  11468. const f = tr(m, a);
  11469. return f === "" ? "" : u + f;
  11470. }
  11471. function ir(m, a) {
  11472. var u;
  11473. const f = m.substr(a).match(/^[0-9a-f]+/i);
  11474. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11475. }
  11476. function yi(m, a) {
  11477. const u = m.substr(a, 2);
  11478. if (a += u.length, u.toLowerCase() !== "0x")
  11479. return "";
  11480. const f = ir(m, a);
  11481. return f === "" ? "" : u + f;
  11482. }
  11483. const sr = vi([
  11484. er,
  11485. nr,
  11486. yi
  11487. ]), rr = vi([
  11488. sr,
  11489. _i
  11490. ]);
  11491. function mn(m, a) {
  11492. const u = rr(m, a);
  11493. return a += u.length, u === "" ? null : {
  11494. evaluable: new $e(u),
  11495. cursor: a
  11496. };
  11497. }
  11498. function as(m, a) {
  11499. const u = m.substr(a, 1);
  11500. if (a += u.length, u !== "(")
  11501. return null;
  11502. const f = xi(m, a);
  11503. if (!f)
  11504. return null;
  11505. a = f.cursor, a += Vt(m, a).length;
  11506. const x = m.substr(a, 1);
  11507. return a += x.length, x !== ")" ? null : {
  11508. evaluable: f.evaluable,
  11509. cursor: a
  11510. };
  11511. }
  11512. function or(m, a) {
  11513. var u;
  11514. return (u = mn(m, a)) !== null && u !== void 0 ? u : as(m, a);
  11515. }
  11516. function qn(m, a) {
  11517. const u = or(m, a);
  11518. if (u)
  11519. return u;
  11520. const f = m.substr(a, 1);
  11521. if (a += f.length, f !== "+" && f !== "-" && f !== "~")
  11522. return null;
  11523. const x = qn(m, a);
  11524. return x ? (a = x.cursor, {
  11525. cursor: a,
  11526. evaluable: new Js(f, x.evaluable)
  11527. }) : null;
  11528. }
  11529. function ar(m, a, u) {
  11530. u += Vt(a, u).length;
  11531. const f = m.filter((x) => a.startsWith(x, u))[0];
  11532. return f ? (u += f.length, u += Vt(a, u).length, {
  11533. cursor: u,
  11534. operator: f
  11535. }) : null;
  11536. }
  11537. function Kt(m, a) {
  11538. return (u, f) => {
  11539. const x = m(u, f);
  11540. if (!x)
  11541. return null;
  11542. f = x.cursor;
  11543. let T = x.evaluable;
  11544. for (; ; ) {
  11545. const V = ar(a, u, f);
  11546. if (!V)
  11547. break;
  11548. f = V.cursor;
  11549. const j = m(u, f);
  11550. if (!j)
  11551. return null;
  11552. f = j.cursor, T = new Zs(V.operator, T, j.evaluable);
  11553. }
  11554. return T ? {
  11555. cursor: f,
  11556. evaluable: T
  11557. } : null;
  11558. };
  11559. }
  11560. const ls = [
  11561. ["**"],
  11562. ["*", "/", "%"],
  11563. ["+", "-"],
  11564. ["<<", ">>>", ">>"],
  11565. ["&"],
  11566. ["^"],
  11567. ["|"]
  11568. ].reduce((m, a) => Kt(m, a), qn);
  11569. function xi(m, a) {
  11570. return a += Vt(m, a).length, ls(m, a);
  11571. }
  11572. function lr(m) {
  11573. const a = xi(m, 0);
  11574. return !a || a.cursor + Vt(m, a.cursor).length !== m.length ? null : a.evaluable;
  11575. }
  11576. function fn(m) {
  11577. var a;
  11578. const u = lr(m);
  11579. return (a = u == null ? void 0 : u.evaluate()) !== null && a !== void 0 ? a : null;
  11580. }
  11581. function cr(m) {
  11582. if (typeof m == "number")
  11583. return m;
  11584. if (typeof m == "string") {
  11585. const a = fn(m);
  11586. if (!h(a))
  11587. return a;
  11588. }
  11589. return 0;
  11590. }
  11591. function Ie(m) {
  11592. return (a) => a.toFixed(Math.max(Math.min(m, 20), 0));
  11593. }
  11594. const ur = Ie(0);
  11595. function Qn(m) {
  11596. return ur(m) + "%";
  11597. }
  11598. function cs(m) {
  11599. return String(m);
  11600. }
  11601. function Ei(m, a) {
  11602. for (; m.length < a; )
  11603. m.push(void 0);
  11604. }
  11605. function us(m) {
  11606. const a = [];
  11607. return Ei(a, m), H(a);
  11608. }
  11609. function ps(m) {
  11610. const a = m.indexOf(void 0);
  11611. return a < 0 ? m : m.slice(0, a);
  11612. }
  11613. function pr(m, a) {
  11614. const u = [...ps(m), a];
  11615. return u.length > m.length ? u.splice(0, u.length - m.length) : Ei(u, m.length), u;
  11616. }
  11617. function $t({ primary: m, secondary: a, forward: u, backward: f }) {
  11618. let x = false;
  11619. function T(V) {
  11620. x || (x = true, V(), x = false);
  11621. }
  11622. m.emitter.on("change", (V) => {
  11623. T(() => {
  11624. a.setRawValue(u(m, a), V.options);
  11625. });
  11626. }), a.emitter.on("change", (V) => {
  11627. T(() => {
  11628. m.setRawValue(f(m, a), V.options);
  11629. }), T(() => {
  11630. a.setRawValue(u(m, a), V.options);
  11631. });
  11632. }), T(() => {
  11633. a.setRawValue(u(m, a), {
  11634. forceEmit: false,
  11635. last: true
  11636. });
  11637. });
  11638. }
  11639. function Xt(m, a) {
  11640. const u = m * (a.altKey ? 0.1 : 1) * (a.shiftKey ? 10 : 1);
  11641. return a.upKey ? +u : a.downKey ? -u : 0;
  11642. }
  11643. function vn(m) {
  11644. return {
  11645. altKey: m.altKey,
  11646. downKey: m.key === "ArrowDown",
  11647. shiftKey: m.shiftKey,
  11648. upKey: m.key === "ArrowUp"
  11649. };
  11650. }
  11651. function Ci(m) {
  11652. return {
  11653. altKey: m.altKey,
  11654. downKey: m.key === "ArrowLeft",
  11655. shiftKey: m.shiftKey,
  11656. upKey: m.key === "ArrowRight"
  11657. };
  11658. }
  11659. function hr(m) {
  11660. return m === "ArrowUp" || m === "ArrowDown";
  11661. }
  11662. function hs(m) {
  11663. return hr(m) || m === "ArrowLeft" || m === "ArrowRight";
  11664. }
  11665. function Pi(m, a) {
  11666. var u, f;
  11667. const x = a.ownerDocument.defaultView, T = a.getBoundingClientRect();
  11668. return {
  11669. x: m.pageX - (((u = x && x.scrollX) !== null && u !== void 0 ? u : 0) + T.left),
  11670. y: m.pageY - (((f = x && x.scrollY) !== null && f !== void 0 ? f : 0) + T.top)
  11671. };
  11672. }
  11673. class Zn {
  11674. constructor(a) {
  11675. 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_ = a, this.emitter = new w(), a.addEventListener("touchstart", this.onTouchStart_, {
  11676. passive: false
  11677. }), a.addEventListener("touchmove", this.onTouchMove_, {
  11678. passive: true
  11679. }), a.addEventListener("touchend", this.onTouchEnd_), a.addEventListener("mousedown", this.onMouseDown_);
  11680. }
  11681. computePosition_(a) {
  11682. const u = this.elem_.getBoundingClientRect();
  11683. return {
  11684. bounds: {
  11685. width: u.width,
  11686. height: u.height
  11687. },
  11688. point: a ? {
  11689. x: a.x,
  11690. y: a.y
  11691. } : null
  11692. };
  11693. }
  11694. onMouseDown_(a) {
  11695. var u;
  11696. a.preventDefault(), (u = a.currentTarget) === null || u === void 0 || u.focus();
  11697. const f = this.elem_.ownerDocument;
  11698. f.addEventListener("mousemove", this.onDocumentMouseMove_), f.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  11699. altKey: a.altKey,
  11700. data: this.computePosition_(Pi(a, this.elem_)),
  11701. sender: this,
  11702. shiftKey: a.shiftKey
  11703. });
  11704. }
  11705. onDocumentMouseMove_(a) {
  11706. this.emitter.emit("move", {
  11707. altKey: a.altKey,
  11708. data: this.computePosition_(Pi(a, this.elem_)),
  11709. sender: this,
  11710. shiftKey: a.shiftKey
  11711. });
  11712. }
  11713. onDocumentMouseUp_(a) {
  11714. const u = this.elem_.ownerDocument;
  11715. u.removeEventListener("mousemove", this.onDocumentMouseMove_), u.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  11716. altKey: a.altKey,
  11717. data: this.computePosition_(Pi(a, this.elem_)),
  11718. sender: this,
  11719. shiftKey: a.shiftKey
  11720. });
  11721. }
  11722. onTouchStart_(a) {
  11723. a.preventDefault();
  11724. const u = a.targetTouches.item(0), f = this.elem_.getBoundingClientRect();
  11725. this.emitter.emit("down", {
  11726. altKey: a.altKey,
  11727. data: this.computePosition_(u ? {
  11728. x: u.clientX - f.left,
  11729. y: u.clientY - f.top
  11730. } : void 0),
  11731. sender: this,
  11732. shiftKey: a.shiftKey
  11733. }), this.lastTouch_ = u;
  11734. }
  11735. onTouchMove_(a) {
  11736. const u = a.targetTouches.item(0), f = this.elem_.getBoundingClientRect();
  11737. this.emitter.emit("move", {
  11738. altKey: a.altKey,
  11739. data: this.computePosition_(u ? {
  11740. x: u.clientX - f.left,
  11741. y: u.clientY - f.top
  11742. } : void 0),
  11743. sender: this,
  11744. shiftKey: a.shiftKey
  11745. }), this.lastTouch_ = u;
  11746. }
  11747. onTouchEnd_(a) {
  11748. var u;
  11749. const f = (u = a.targetTouches.item(0)) !== null && u !== void 0 ? u : this.lastTouch_, x = this.elem_.getBoundingClientRect();
  11750. this.emitter.emit("up", {
  11751. altKey: a.altKey,
  11752. data: this.computePosition_(f ? {
  11753. x: f.clientX - x.left,
  11754. y: f.clientY - x.top
  11755. } : void 0),
  11756. sender: this,
  11757. shiftKey: a.shiftKey
  11758. });
  11759. }
  11760. }
  11761. function Ae(m, a, u, f, x) {
  11762. const T = (m - a) / (u - a);
  11763. return f + T * (x - f);
  11764. }
  11765. function ds(m) {
  11766. return String(m.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  11767. }
  11768. function Yt(m, a, u) {
  11769. return Math.min(Math.max(m, a), u);
  11770. }
  11771. const Ze = y("txt");
  11772. class dr {
  11773. constructor(a, u) {
  11774. this.onChange_ = this.onChange_.bind(this), this.props_ = u.props, this.props_.emitter.on("change", this.onChange_), this.element = a.createElement("div"), this.element.classList.add(Ze(), Ze(void 0, "num")), u.arrayPosition && this.element.classList.add(Ze(void 0, u.arrayPosition)), u.viewProps.bindClassModifiers(this.element);
  11775. const f = a.createElement("input");
  11776. f.classList.add(Ze("i")), f.type = "text", u.viewProps.bindDisabled(f), this.element.appendChild(f), this.inputElement = f, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = u.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(Ze()), this.inputElement.classList.add(Ze("i"));
  11777. const x = a.createElement("div");
  11778. x.classList.add(Ze("k")), this.element.appendChild(x), this.knobElement = x;
  11779. const T = a.createElementNS(ye, "svg");
  11780. T.classList.add(Ze("g")), this.knobElement.appendChild(T);
  11781. const V = a.createElementNS(ye, "path");
  11782. V.classList.add(Ze("gb")), T.appendChild(V), this.guideBodyElem_ = V;
  11783. const j = a.createElementNS(ye, "path");
  11784. j.classList.add(Ze("gh")), T.appendChild(j), this.guideHeadElem_ = j;
  11785. const oe = a.createElement("div");
  11786. oe.classList.add(y("tt")()), this.knobElement.appendChild(oe), this.tooltipElem_ = oe, u.value.emitter.on("change", this.onChange_), this.value = u.value, this.refresh();
  11787. }
  11788. onDraggingChange_(a) {
  11789. if (a.rawValue === null) {
  11790. this.element.classList.remove(Ze(void 0, "drg"));
  11791. return;
  11792. }
  11793. this.element.classList.add(Ze(void 0, "drg"));
  11794. const u = a.rawValue / this.props_.get("draggingScale"), f = u + (u > 0 ? -1 : u < 0 ? 1 : 0), x = Yt(-f, -4, 4);
  11795. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${f + x},0 L${f},4 L${f + x},8`, `M ${u},-1 L${u},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${u},4`);
  11796. const T = this.props_.get("formatter");
  11797. this.tooltipElem_.textContent = T(this.value.rawValue), this.tooltipElem_.style.left = `${u}px`;
  11798. }
  11799. refresh() {
  11800. const a = this.props_.get("formatter");
  11801. this.inputElement.value = a(this.value.rawValue);
  11802. }
  11803. onChange_() {
  11804. this.refresh();
  11805. }
  11806. }
  11807. class bn {
  11808. constructor(a, u) {
  11809. var f;
  11810. 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_ = u.baseStep, this.parser_ = u.parser, this.props = u.props, this.sliderProps_ = (f = u.sliderProps) !== null && f !== void 0 ? f : null, this.value = u.value, this.viewProps = u.viewProps, this.dragging_ = H(null), this.view = new dr(a, {
  11811. arrayPosition: u.arrayPosition,
  11812. dragging: this.dragging_,
  11813. props: this.props,
  11814. value: this.value,
  11815. viewProps: this.viewProps
  11816. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  11817. const x = new Zn(this.view.knobElement);
  11818. x.emitter.on("down", this.onPointerDown_), x.emitter.on("move", this.onPointerMove_), x.emitter.on("up", this.onPointerUp_);
  11819. }
  11820. constrainValue_(a) {
  11821. var u, f;
  11822. const x = (u = this.sliderProps_) === null || u === void 0 ? void 0 : u.get("minValue"), T = (f = this.sliderProps_) === null || f === void 0 ? void 0 : f.get("maxValue");
  11823. let V = a;
  11824. return x !== void 0 && (V = Math.max(V, x)), T !== void 0 && (V = Math.min(V, T)), V;
  11825. }
  11826. onInputChange_(a) {
  11827. const f = a.currentTarget.value, x = this.parser_(f);
  11828. h(x) || (this.value.rawValue = this.constrainValue_(x)), this.view.refresh();
  11829. }
  11830. onInputKeyDown_(a) {
  11831. const u = Xt(this.baseStep_, vn(a));
  11832. u !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + u), {
  11833. forceEmit: false,
  11834. last: false
  11835. });
  11836. }
  11837. onInputKeyUp_(a) {
  11838. Xt(this.baseStep_, vn(a)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  11839. forceEmit: true,
  11840. last: true
  11841. });
  11842. }
  11843. onPointerDown_() {
  11844. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  11845. }
  11846. computeDraggingValue_(a) {
  11847. if (!a.point)
  11848. return null;
  11849. const u = a.point.x - a.bounds.width / 2;
  11850. return this.constrainValue_(this.originRawValue_ + u * this.props.get("draggingScale"));
  11851. }
  11852. onPointerMove_(a) {
  11853. const u = this.computeDraggingValue_(a.data);
  11854. u !== null && (this.value.setRawValue(u, {
  11855. forceEmit: false,
  11856. last: false
  11857. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  11858. }
  11859. onPointerUp_(a) {
  11860. const u = this.computeDraggingValue_(a.data);
  11861. u !== null && (this.value.setRawValue(u, {
  11862. forceEmit: true,
  11863. last: true
  11864. }), this.dragging_.rawValue = null);
  11865. }
  11866. }
  11867. function nt(m, a) {
  11868. m.write(a);
  11869. }
  11870. function qt(m) {
  11871. const a = m ? Ct(m, L) : null;
  11872. return a ? a.step : null;
  11873. }
  11874. function gn(m, a) {
  11875. const u = m && Ct(m, L);
  11876. return u ? ds(u.step) : Math.max(ds(a), 2);
  11877. }
  11878. function Ti(m) {
  11879. const a = qt(m);
  11880. return a ?? 1;
  11881. }
  11882. function Wn(m, a) {
  11883. var u;
  11884. const f = m && Ct(m, L), x = Math.abs((u = f == null ? void 0 : f.step) !== null && u !== void 0 ? u : a);
  11885. return x === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(x)) - 1);
  11886. }
  11887. function Qt(m) {
  11888. return [m[0], m[1], m[2]];
  11889. }
  11890. function ms(m) {
  11891. const a = Yt(Math.floor(m), 0, 255).toString(16);
  11892. return a.length === 1 ? `0${a}` : a;
  11893. }
  11894. function _n(m, a = "#") {
  11895. const u = Qt(m.getComponents("rgb")).map(ms).join("");
  11896. return `${a}${u}`;
  11897. }
  11898. function fs(m, a = "#") {
  11899. const u = m.getComponents("rgb"), f = [u[0], u[1], u[2], u[3] * 255].map(ms).join("");
  11900. return `${a}${f}`;
  11901. }
  11902. function mr(m, a) {
  11903. const u = Ie(a === "float" ? 2 : 0);
  11904. return `rgb(${Qt(m.getComponents("rgb", a)).map((x) => u(x)).join(", ")})`;
  11905. }
  11906. function vs(m) {
  11907. return (a) => mr(a, m);
  11908. }
  11909. function bs(m, a) {
  11910. const u = Ie(2), f = Ie(a === "float" ? 2 : 0);
  11911. return `rgba(${m.getComponents("rgb", a).map((T, V) => (V === 3 ? u : f)(T)).join(", ")})`;
  11912. }
  11913. function fr(m) {
  11914. return (a) => bs(a, m);
  11915. }
  11916. function Jn(m) {
  11917. const a = [
  11918. Ie(0),
  11919. Qn,
  11920. Qn
  11921. ];
  11922. return `hsl(${Qt(m.getComponents("hsl")).map((f, x) => a[x](f)).join(", ")})`;
  11923. }
  11924. function vr(m) {
  11925. const a = [
  11926. Ie(0),
  11927. Qn,
  11928. Qn,
  11929. Ie(2)
  11930. ];
  11931. return `hsla(${m.getComponents("hsl").map((f, x) => a[x](f)).join(", ")})`;
  11932. }
  11933. function gs(m, a) {
  11934. const u = Ie(a === "float" ? 2 : 0), f = ["r", "g", "b"];
  11935. return `{${Qt(m.getComponents("rgb", a)).map((T, V) => `${f[V]}: ${u(T)}`).join(", ")}}`;
  11936. }
  11937. function _s(m) {
  11938. return (a) => gs(a, m);
  11939. }
  11940. function br(m, a) {
  11941. const u = Ie(2), f = Ie(a === "float" ? 2 : 0), x = ["r", "g", "b", "a"];
  11942. return `{${m.getComponents("rgb", a).map((V, j) => {
  11943. const oe = j === 3 ? u : f;
  11944. return `${x[j]}: ${oe(V)}`;
  11945. }).join(", ")}}`;
  11946. }
  11947. function gr(m) {
  11948. return (a) => br(a, m);
  11949. }
  11950. [
  11951. ...["int", "float"].reduce((m, a) => [
  11952. ...m,
  11953. {
  11954. format: {
  11955. alpha: false,
  11956. mode: "rgb",
  11957. notation: "func",
  11958. type: a
  11959. },
  11960. stringifier: vs(a)
  11961. },
  11962. {
  11963. format: {
  11964. alpha: true,
  11965. mode: "rgb",
  11966. notation: "func",
  11967. type: a
  11968. },
  11969. stringifier: fr(a)
  11970. },
  11971. {
  11972. format: {
  11973. alpha: false,
  11974. mode: "rgb",
  11975. notation: "object",
  11976. type: a
  11977. },
  11978. stringifier: _s(a)
  11979. },
  11980. {
  11981. format: {
  11982. alpha: true,
  11983. mode: "rgb",
  11984. notation: "object",
  11985. type: a
  11986. },
  11987. stringifier: gr(a)
  11988. }
  11989. ], [])
  11990. ];
  11991. class _r {
  11992. constructor(a) {
  11993. this.components = a.components, this.asm_ = a.assembly;
  11994. }
  11995. constrain(a) {
  11996. const u = this.asm_.toComponents(a).map((f, x) => {
  11997. var T, V;
  11998. return (V = (T = this.components[x]) === null || T === void 0 ? void 0 : T.constrain(f)) !== null && V !== void 0 ? V : f;
  11999. });
  12000. return this.asm_.fromComponents(u);
  12001. }
  12002. }
  12003. const ws = y("pndtxt");
  12004. class wr {
  12005. constructor(a, u) {
  12006. this.textViews = u.textViews, this.element = a.createElement("div"), this.element.classList.add(ws()), this.textViews.forEach((f) => {
  12007. const x = a.createElement("div");
  12008. x.classList.add(ws("a")), x.appendChild(f.element), this.element.appendChild(x);
  12009. });
  12010. }
  12011. }
  12012. function ki(m, a, u) {
  12013. return new bn(m, {
  12014. arrayPosition: u === 0 ? "fst" : u === a.axes.length - 1 ? "lst" : "mid",
  12015. baseStep: a.axes[u].baseStep,
  12016. parser: a.parser,
  12017. props: a.axes[u].textProps,
  12018. value: H(0, {
  12019. constraint: a.axes[u].constraint
  12020. }),
  12021. viewProps: a.viewProps
  12022. });
  12023. }
  12024. class It {
  12025. constructor(a, u) {
  12026. this.value = u.value, this.viewProps = u.viewProps, this.acs_ = u.axes.map((f, x) => ki(a, u, x)), this.acs_.forEach((f, x) => {
  12027. $t({
  12028. primary: this.value,
  12029. secondary: f.value,
  12030. forward: (T) => u.assembly.toComponents(T.rawValue)[x],
  12031. backward: (T, V) => {
  12032. const j = u.assembly.toComponents(T.rawValue);
  12033. return j[x] = V.rawValue, u.assembly.fromComponents(j);
  12034. }
  12035. });
  12036. }), this.view = new wr(a, {
  12037. textViews: this.acs_.map((f) => f.view)
  12038. });
  12039. }
  12040. }
  12041. function yr(m, a) {
  12042. return "step" in m && !h(m.step) ? new L(m.step, a) : null;
  12043. }
  12044. function wn(m) {
  12045. return !h(m.max) && !h(m.min) ? new gt({
  12046. max: m.max,
  12047. min: m.min
  12048. }) : !h(m.max) || !h(m.min) ? new Rt2({
  12049. max: m.max,
  12050. min: m.min
  12051. }) : null;
  12052. }
  12053. const xr = {
  12054. monitor: {
  12055. defaultInterval: 200,
  12056. defaultLineCount: 3
  12057. }
  12058. }, lt = y("grl");
  12059. class ys {
  12060. constructor(a, u) {
  12061. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = a.createElement("div"), this.element.classList.add(lt()), u.viewProps.bindClassModifiers(this.element), this.formatter_ = u.formatter, this.props_ = u.props, this.cursor_ = u.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  12062. const f = a.createElementNS(ye, "svg");
  12063. f.classList.add(lt("g")), f.style.height = `calc(var(--bld-us) * ${u.lineCount})`, this.element.appendChild(f), this.svgElem_ = f;
  12064. const x = a.createElementNS(ye, "polyline");
  12065. this.svgElem_.appendChild(x), this.lineElem_ = x;
  12066. const T = a.createElement("div");
  12067. T.classList.add(lt("t"), y("tt")()), this.element.appendChild(T), this.tooltipElem_ = T, u.value.emitter.on("change", this.onValueUpdate_), this.value = u.value, this.update_();
  12068. }
  12069. get graphElement() {
  12070. return this.svgElem_;
  12071. }
  12072. update_() {
  12073. const a = this.svgElem_.getBoundingClientRect(), u = this.value.rawValue.length - 1, f = this.props_.get("minValue"), x = this.props_.get("maxValue"), T = [];
  12074. this.value.rawValue.forEach((et, te) => {
  12075. if (et === void 0)
  12076. return;
  12077. const kt = Ae(te, 0, u, 0, a.width), Or = Ae(et, f, x, a.height, 0);
  12078. T.push([kt, Or].join(","));
  12079. }), this.lineElem_.setAttributeNS(null, "points", T.join(" "));
  12080. const V = this.tooltipElem_, j = this.value.rawValue[this.cursor_.rawValue];
  12081. if (j === void 0) {
  12082. V.classList.remove(lt("t", "a"));
  12083. return;
  12084. }
  12085. const oe = Ae(this.cursor_.rawValue, 0, u, 0, a.width), Je = Ae(j, f, x, a.height, 0);
  12086. V.style.left = `${oe}px`, V.style.top = `${Je}px`, V.textContent = `${this.formatter_(j)}`, V.classList.contains(lt("t", "a")) || (V.classList.add(lt("t", "a"), lt("t", "in")), rt(V), V.classList.remove(lt("t", "in")));
  12087. }
  12088. onValueUpdate_() {
  12089. this.update_();
  12090. }
  12091. onCursorChange_() {
  12092. this.update_();
  12093. }
  12094. }
  12095. class Er {
  12096. constructor(a, u) {
  12097. 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_ = u.props, this.value = u.value, this.viewProps = u.viewProps, this.cursor_ = H(-1), this.view = new ys(a, {
  12098. cursor: this.cursor_,
  12099. formatter: u.formatter,
  12100. lineCount: u.lineCount,
  12101. props: this.props_,
  12102. value: this.value,
  12103. viewProps: this.viewProps
  12104. }), !Qe(a))
  12105. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  12106. else {
  12107. const f = new Zn(this.view.element);
  12108. f.emitter.on("down", this.onGraphPointerDown_), f.emitter.on("move", this.onGraphPointerMove_), f.emitter.on("up", this.onGraphPointerUp_);
  12109. }
  12110. }
  12111. onGraphMouseLeave_() {
  12112. this.cursor_.rawValue = -1;
  12113. }
  12114. onGraphMouseMove_(a) {
  12115. const u = this.view.element.getBoundingClientRect();
  12116. this.cursor_.rawValue = Math.floor(Ae(a.offsetX, 0, u.width, 0, this.value.rawValue.length));
  12117. }
  12118. onGraphPointerDown_(a) {
  12119. this.onGraphPointerMove_(a);
  12120. }
  12121. onGraphPointerMove_(a) {
  12122. if (!a.data.point) {
  12123. this.cursor_.rawValue = -1;
  12124. return;
  12125. }
  12126. this.cursor_.rawValue = Math.floor(Ae(a.data.point.x, 0, a.data.bounds.width, 0, this.value.rawValue.length));
  12127. }
  12128. onGraphPointerUp_() {
  12129. this.cursor_.rawValue = -1;
  12130. }
  12131. }
  12132. class xs {
  12133. constructor(a) {
  12134. this.controller_ = a;
  12135. }
  12136. get disabled() {
  12137. return this.controller_.viewProps.get("disabled");
  12138. }
  12139. set disabled(a) {
  12140. this.controller_.viewProps.set("disabled", a);
  12141. }
  12142. get title() {
  12143. var a;
  12144. return (a = this.controller_.props.get("title")) !== null && a !== void 0 ? a : "";
  12145. }
  12146. set title(a) {
  12147. this.controller_.props.set("title", a);
  12148. }
  12149. on(a, u) {
  12150. const f = u.bind(this);
  12151. return this.controller_.emitter.on(a, () => {
  12152. f(new o(this));
  12153. }), this;
  12154. }
  12155. }
  12156. class Cr extends o {
  12157. constructor(a, u, f) {
  12158. super(a), this.cell = u, this.index = f;
  12159. }
  12160. }
  12161. class Es extends r {
  12162. constructor(a) {
  12163. super(a), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.emitter_ = new w();
  12164. const u = this.controller_.valueController;
  12165. u.cellControllers.forEach((f, x) => {
  12166. const T = new xs(f);
  12167. this.cellToApiMap_.set(f, T), f.emitter.on("click", () => {
  12168. const V = x % u.size[0], j = Math.floor(x / u.size[0]);
  12169. this.emitter_.emit("click", {
  12170. event: new Cr(this, T, [V, j])
  12171. });
  12172. });
  12173. });
  12174. }
  12175. cell(a, u) {
  12176. const f = this.controller_.valueController, x = f.cellControllers[u * f.size[0] + a];
  12177. return this.cellToApiMap_.get(x);
  12178. }
  12179. on(a, u) {
  12180. const f = u.bind(this);
  12181. return this.emitter_.on(a, (x) => {
  12182. f(x.event);
  12183. }), this;
  12184. }
  12185. }
  12186. class Mi {
  12187. constructor(a, u) {
  12188. this.size = u.size;
  12189. const [f, x] = this.size, T = [];
  12190. for (let V = 0; V < x; V++)
  12191. for (let j = 0; j < f; j++) {
  12192. const oe = new G(a, {
  12193. props: K.fromObject(Object.assign({}, u.cellConfig(j, V))),
  12194. viewProps: ge.create()
  12195. });
  12196. T.push(oe);
  12197. }
  12198. this.cellCs_ = T, this.viewProps = ge.create(), this.viewProps.handleDispose(() => {
  12199. this.cellCs_.forEach((V) => {
  12200. V.viewProps.set("disposed", true);
  12201. });
  12202. }), this.view = new Et(a, {
  12203. viewProps: this.viewProps,
  12204. viewName: "btngrid"
  12205. }), this.view.element.style.gridTemplateColumns = `repeat(${f}, 1fr)`, this.cellCs_.forEach((V) => {
  12206. this.view.element.appendChild(V.view.element);
  12207. });
  12208. }
  12209. get cellControllers() {
  12210. return this.cellCs_;
  12211. }
  12212. }
  12213. const Pr = {
  12214. id: "buttongrid",
  12215. type: "blade",
  12216. // TODO:
  12217. 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}',
  12218. accept(m) {
  12219. const a = he, u = ee(m, {
  12220. cells: a.required.function,
  12221. size: a.required.array(a.required.number),
  12222. view: a.required.constant("buttongrid"),
  12223. label: a.optional.string
  12224. });
  12225. return u ? { params: u } : null;
  12226. },
  12227. controller(m) {
  12228. return new ot(m.document, {
  12229. blade: m.blade,
  12230. props: K.fromObject({
  12231. label: m.params.label
  12232. }),
  12233. valueController: new Mi(m.document, {
  12234. cellConfig: m.params.cells,
  12235. size: m.params.size
  12236. })
  12237. });
  12238. },
  12239. api(m) {
  12240. return !(m.controller instanceof ot) || !(m.controller.valueController instanceof Mi) ? null : new Es(m.controller);
  12241. }
  12242. };
  12243. class Cs extends r {
  12244. get label() {
  12245. return this.controller_.props.get("label");
  12246. }
  12247. set label(a) {
  12248. this.controller_.props.set("label", a);
  12249. }
  12250. get value() {
  12251. return this.controller_.valueController.value.rawValue;
  12252. }
  12253. set value(a) {
  12254. this.controller_.valueController.value.rawValue = a;
  12255. }
  12256. on(a, u) {
  12257. const f = u.bind(this);
  12258. return this.controller_.valueController.value.emitter.on(a, (x) => {
  12259. f(new c(this, x.rawValue, void 0, x.options.last));
  12260. }), this;
  12261. }
  12262. }
  12263. function We(m, a, u) {
  12264. return m * (1 - u) + a * u;
  12265. }
  12266. const Tr = 20, kr = 1e-3, Si = 100;
  12267. function Mr(m, a) {
  12268. let u = 0.25, f = 0.5, x = -1;
  12269. for (let T = 0; T < Tr; T++) {
  12270. const [V, j] = m.curve(f);
  12271. if (f += u * (V < a ? 1 : -1), x = j, u *= 0.5, Math.abs(a - V) < kr)
  12272. break;
  12273. }
  12274. return x;
  12275. }
  12276. class Pt {
  12277. constructor(a = 0, u = 0, f = 1, x = 1) {
  12278. this.cache_ = [], this.comps_ = [a, u, f, x];
  12279. }
  12280. get x1() {
  12281. return this.comps_[0];
  12282. }
  12283. get y1() {
  12284. return this.comps_[1];
  12285. }
  12286. get x2() {
  12287. return this.comps_[2];
  12288. }
  12289. get y2() {
  12290. return this.comps_[3];
  12291. }
  12292. static isObject(a) {
  12293. return h(a) || !Array.isArray(a) ? false : typeof a[0] == "number" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number";
  12294. }
  12295. static equals(a, u) {
  12296. return a.x1 === u.x1 && a.y1 === u.y1 && a.x2 === u.x2 && a.y2 === u.y2;
  12297. }
  12298. curve(a) {
  12299. const u = We(0, this.x1, a), f = We(0, this.y1, a), x = We(this.x1, this.x2, a), T = We(this.y1, this.y2, a), V = We(this.x2, 1, a), j = We(this.y2, 1, a), oe = We(u, x, a), Je = We(f, T, a), et = We(x, V, a), te = We(T, j, a);
  12300. return [We(oe, et, a), We(Je, te, a)];
  12301. }
  12302. y(a) {
  12303. if (this.cache_.length === 0) {
  12304. const u = [];
  12305. for (let f = 0; f < Si; f++)
  12306. u.push(Mr(this, Ae(f, 0, Si - 1, 0, 1)));
  12307. this.cache_ = u;
  12308. }
  12309. return this.cache_[Math.round(Ae(Yt(a, 0, 1), 0, 1, 0, Si - 1))];
  12310. }
  12311. toObject() {
  12312. return [this.comps_[0], this.comps_[1], this.comps_[2], this.comps_[3]];
  12313. }
  12314. }
  12315. const Li = {
  12316. toComponents: (m) => m.toObject(),
  12317. fromComponents: (m) => new Pt(...m)
  12318. };
  12319. function Sr(m) {
  12320. const a = Ie(2);
  12321. return `cubic-bezier(${m.toObject().map((f) => a(f)).join(", ")})`;
  12322. }
  12323. const Ai = [0, 0.5, 0.5, 1];
  12324. function Lr(m) {
  12325. const a = m.match(/^cubic-bezier\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*\)$/);
  12326. if (!a)
  12327. return new Pt(...Ai);
  12328. const u = [a[1], a[2], a[3], a[4]].reduce((f, x) => {
  12329. if (!f)
  12330. return null;
  12331. const T = Number(x);
  12332. return isNaN(T) ? null : [...f, T];
  12333. }, []);
  12334. return new Pt(...u ?? Ai);
  12335. }
  12336. const Dt = y("cbz");
  12337. class Ps {
  12338. constructor(a, u) {
  12339. this.element = a.createElement("div"), this.element.classList.add(Dt()), u.viewProps.bindClassModifiers(this.element), u.foldable.bindExpandedClass(this.element, Dt(void 0, "expanded")), A(u.foldable, "completed", F(this.element, Dt(void 0, "cpl")));
  12340. const f = a.createElement("div");
  12341. f.classList.add(Dt("h")), this.element.appendChild(f);
  12342. const x = a.createElement("button");
  12343. x.classList.add(Dt("b")), u.viewProps.bindDisabled(x);
  12344. const T = a.createElementNS(ye, "svg");
  12345. T.innerHTML = '<path d="M2 13C8 13 8 3 14 3"/>', x.appendChild(T), f.appendChild(x), this.buttonElement = x;
  12346. const V = a.createElement("div");
  12347. if (V.classList.add(Dt("t")), f.appendChild(V), this.textElement = V, u.pickerLayout === "inline") {
  12348. const j = a.createElement("div");
  12349. j.classList.add(Dt("p")), this.element.appendChild(j), this.pickerElement = j;
  12350. } else
  12351. this.pickerElement = null;
  12352. }
  12353. }
  12354. const ei = y("cbzp");
  12355. class Ts {
  12356. constructor(a, u) {
  12357. this.element = a.createElement("div"), this.element.classList.add(ei()), u.viewProps.bindClassModifiers(this.element);
  12358. const f = a.createElement("div");
  12359. f.classList.add(ei("g")), this.element.appendChild(f), this.graphElement = f;
  12360. const x = a.createElement("div");
  12361. x.classList.add(ei("t")), this.element.appendChild(x), this.textElement = x;
  12362. }
  12363. }
  12364. function ct(m, a) {
  12365. const u = new MutationObserver((x) => {
  12366. for (const T of x)
  12367. T.type === "childList" && T.addedNodes.forEach((V) => {
  12368. V.contains(V) && (a(), u.disconnect());
  12369. });
  12370. }), f = m.ownerDocument;
  12371. u.observe(f.body, {
  12372. attributes: true,
  12373. childList: true,
  12374. subtree: true
  12375. });
  12376. }
  12377. const _t = y("cbzg");
  12378. function Ar(m, a) {
  12379. return (u) => a(m(u));
  12380. }
  12381. class De {
  12382. constructor(a, u) {
  12383. this.element = a.createElement("div"), this.element.classList.add(_t()), u.viewProps.bindClassModifiers(this.element), u.viewProps.bindTabIndex(this.element);
  12384. const f = a.createElement("div");
  12385. f.classList.add(_t("p")), this.element.appendChild(f), this.previewElement = f;
  12386. const x = a.createElementNS(ye, "svg");
  12387. x.classList.add(_t("g")), this.element.appendChild(x), this.svgElem_ = x;
  12388. const T = a.createElementNS(ye, "path");
  12389. T.classList.add(_t("u")), this.svgElem_.appendChild(T), this.guideElem_ = T;
  12390. const V = a.createElementNS(ye, "polyline");
  12391. V.classList.add(_t("l")), this.svgElem_.appendChild(V), this.lineElem_ = V, this.handleElems_ = [a.createElement("div"), a.createElement("div")], this.handleElems_.forEach((j) => {
  12392. j.classList.add(_t("h")), this.element.appendChild(j);
  12393. }), this.vectorElems_ = [
  12394. a.createElementNS(ye, "line"),
  12395. a.createElementNS(ye, "line")
  12396. ], this.vectorElems_.forEach((j) => {
  12397. j.classList.add(_t("v")), this.svgElem_.appendChild(j);
  12398. }), this.value_ = u.value, this.value_.emitter.on("change", this.onValueChange_.bind(this)), this.sel_ = u.selection, this.handleElems_.forEach((j, oe) => {
  12399. k(this.sel_, Ar((Je) => Je === oe, F(j, _t("h", "sel"))));
  12400. }), ct(this.element, () => {
  12401. this.refresh();
  12402. });
  12403. }
  12404. getVertMargin_(a) {
  12405. return a * 0.25;
  12406. }
  12407. valueToPosition(a, u) {
  12408. const f = this.element.getBoundingClientRect(), x = f.width, T = f.height, V = this.getVertMargin_(T);
  12409. return {
  12410. x: Ae(a, 0, 1, 0, x),
  12411. y: Ae(u, 0, 1, T - V, V)
  12412. };
  12413. }
  12414. positionToValue(a, u) {
  12415. const f = this.element.getBoundingClientRect(), x = f.width, T = f.height, V = this.getVertMargin_(T);
  12416. return {
  12417. x: Yt(Ae(a, 0, x, 0, 1), 0, 1),
  12418. y: Ae(u, T - V, V, 0, 1)
  12419. };
  12420. }
  12421. refresh() {
  12422. this.guideElem_.setAttributeNS(null, "d", [0, 1].map((T) => {
  12423. const V = this.valueToPosition(0, T), j = this.valueToPosition(1, T);
  12424. return [`M ${V.x},${V.y}`, `L ${j.x},${j.y}`].join(" ");
  12425. }).join(" "));
  12426. const a = this.value_.rawValue, u = [];
  12427. let f = 0;
  12428. for (; ; ) {
  12429. const T = this.valueToPosition(...a.curve(f));
  12430. if (u.push([T.x, T.y].join(",")), f >= 1)
  12431. break;
  12432. f = Math.min(f + 0.05, 1);
  12433. }
  12434. this.lineElem_.setAttributeNS(null, "points", u.join(" "));
  12435. const x = a.toObject();
  12436. [0, 1].forEach((T) => {
  12437. const V = this.valueToPosition(T, T), j = this.valueToPosition(x[T * 2], x[T * 2 + 1]), oe = this.vectorElems_[T];
  12438. oe.setAttributeNS(null, "x1", String(V.x)), oe.setAttributeNS(null, "y1", String(V.y)), oe.setAttributeNS(null, "x2", String(j.x)), oe.setAttributeNS(null, "y2", String(j.y));
  12439. const Je = this.handleElems_[T];
  12440. Je.style.left = `${j.x}px`, Je.style.top = `${j.y}px`;
  12441. });
  12442. }
  12443. onValueChange_() {
  12444. this.refresh();
  12445. }
  12446. }
  12447. const ks = 24, yn = 400, Ri = 1e3, Tt = y("cbzprv");
  12448. class Zt {
  12449. constructor(a, u) {
  12450. 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 = a.createElement("div"), this.element.classList.add(Tt()), u.viewProps.bindClassModifiers(this.element);
  12451. const f = a.createElementNS(ye, "svg");
  12452. f.classList.add(Tt("g")), this.element.appendChild(f), this.svgElem_ = f;
  12453. const x = a.createElementNS(ye, "path");
  12454. x.classList.add(Tt("t")), this.svgElem_.appendChild(x), this.ticksElem_ = x;
  12455. const T = a.createElement("div");
  12456. T.classList.add(Tt("m")), this.element.appendChild(T), this.markerElem_ = T, this.value_ = u.value, this.value_.emitter.on("change", this.onValueChange_), u.viewProps.handleDispose(this.onDispose_), ct(this.element, () => {
  12457. this.refresh();
  12458. });
  12459. }
  12460. play() {
  12461. this.stop(), this.updateMarker_(0), this.markerElem_.classList.add(Tt("m", "a")), this.startTime_ = (/* @__PURE__ */ new Date()).getTime() + yn, this.stopped_ = false, requestAnimationFrame(this.onTimer_);
  12462. }
  12463. stop() {
  12464. this.stopped_ = true, this.markerElem_.classList.remove(Tt("m", "a"));
  12465. }
  12466. onDispose_() {
  12467. this.stop();
  12468. }
  12469. updateMarker_(a) {
  12470. const u = this.value_.rawValue.y(Yt(a, 0, 1));
  12471. this.markerElem_.style.left = `${u * 100}%`;
  12472. }
  12473. refresh() {
  12474. const a = this.svgElem_.getBoundingClientRect(), u = a.width, f = a.height, x = [], T = this.value_.rawValue;
  12475. for (let V = 0; V < ks; V++) {
  12476. const j = Ae(V, 0, ks - 1, 0, 1), oe = Ae(T.y(j), 0, 1, 0, u);
  12477. x.push(`M ${oe},0 v${f}`);
  12478. }
  12479. this.ticksElem_.setAttributeNS(null, "d", x.join(" "));
  12480. }
  12481. onTimer_() {
  12482. if (this.startTime_ === null)
  12483. return;
  12484. const a = (/* @__PURE__ */ new Date()).getTime() - this.startTime_, u = a / Ri;
  12485. this.updateMarker_(u), a > Ri + yn && this.stop(), this.stopped_ || requestAnimationFrame(this.onTimer_);
  12486. }
  12487. onValueChange_() {
  12488. this.refresh(), this.play();
  12489. }
  12490. }
  12491. function ze(m, a, u, f) {
  12492. const x = u - m, T = f - a;
  12493. return Math.sqrt(x * x + T * T);
  12494. }
  12495. function xn(m, a, u, f) {
  12496. const x = ze(m, a, u, f), T = Math.atan2(f - a, u - m), V = Math.round(T / (Math.PI / 4)) * Math.PI / 4;
  12497. return {
  12498. x: m + Math.cos(V) * x,
  12499. y: a + Math.sin(V) * x
  12500. };
  12501. }
  12502. class ut {
  12503. constructor(a, u) {
  12504. 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_ = u.baseStep, this.value = u.value, this.sel_ = H(0), this.viewProps = u.viewProps, this.view = new De(a, {
  12505. selection: this.sel_,
  12506. value: this.value,
  12507. viewProps: this.viewProps
  12508. }), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_), this.prevView_ = new Zt(a, {
  12509. value: this.value,
  12510. viewProps: this.viewProps
  12511. }), this.prevView_.element.addEventListener("mousedown", (x) => {
  12512. x.stopImmediatePropagation(), x.preventDefault(), this.prevView_.play();
  12513. }), this.view.previewElement.appendChild(this.prevView_.element);
  12514. const f = new Zn(this.view.element);
  12515. f.emitter.on("down", this.onPointerDown_), f.emitter.on("move", this.onPointerMove_), f.emitter.on("up", this.onPointerUp_);
  12516. }
  12517. refresh() {
  12518. this.view.refresh(), this.prevView_.refresh(), this.prevView_.play();
  12519. }
  12520. updateValue_(a, u, f) {
  12521. const x = this.sel_.rawValue, T = this.value.rawValue.toObject(), V = this.view.positionToValue(a.x, a.y), j = u ? xn(x, x, V.x, V.y) : V;
  12522. T[x * 2] = j.x, T[x * 2 + 1] = j.y, this.value.setRawValue(new Pt(...T), f);
  12523. }
  12524. onPointerDown_(a) {
  12525. const u = a.data;
  12526. if (!u.point)
  12527. return;
  12528. const f = this.value.rawValue, x = this.view.valueToPosition(f.x1, f.y1), T = ze(u.point.x, u.point.y, x.x, x.y), V = this.view.valueToPosition(f.x2, f.y2), j = ze(u.point.x, u.point.y, V.x, V.y);
  12529. this.sel_.rawValue = T <= j ? 0 : 1, this.updateValue_(u.point, a.shiftKey, {
  12530. forceEmit: false,
  12531. last: false
  12532. });
  12533. }
  12534. onPointerMove_(a) {
  12535. const u = a.data;
  12536. u.point && this.updateValue_(u.point, a.shiftKey, {
  12537. forceEmit: false,
  12538. last: false
  12539. });
  12540. }
  12541. onPointerUp_(a) {
  12542. const u = a.data;
  12543. u.point && this.updateValue_(u.point, a.shiftKey, {
  12544. forceEmit: true,
  12545. last: true
  12546. });
  12547. }
  12548. onKeyDown_(a) {
  12549. hs(a.key) && a.preventDefault();
  12550. const u = this.sel_.rawValue, f = this.value.rawValue.toObject();
  12551. f[u * 2] += Xt(this.baseStep_, Ci(a)), f[u * 2 + 1] += Xt(this.baseStep_, vn(a)), this.value.setRawValue(new Pt(...f), {
  12552. forceEmit: false,
  12553. last: false
  12554. });
  12555. }
  12556. onKeyUp_(a) {
  12557. hs(a.key) && a.preventDefault();
  12558. const u = Xt(this.baseStep_, Ci(a)), f = Xt(this.baseStep_, vn(a));
  12559. u === 0 && f === 0 || this.value.setRawValue(this.value.rawValue, {
  12560. forceEmit: true,
  12561. last: true
  12562. });
  12563. }
  12564. }
  12565. class Ms {
  12566. constructor(a, u) {
  12567. this.value = u.value, this.viewProps = u.viewProps, this.view = new Ts(a, {
  12568. viewProps: this.viewProps
  12569. }), this.gc_ = new ut(a, {
  12570. baseStep: u.axis.baseStep,
  12571. value: this.value,
  12572. viewProps: this.viewProps
  12573. }), this.view.graphElement.appendChild(this.gc_.view.element);
  12574. const f = Object.assign(Object.assign({}, u.axis), { constraint: new Rt2({ max: 1, min: 0 }) }), x = Object.assign(Object.assign({}, u.axis), { constraint: void 0 });
  12575. this.tc_ = new It(a, {
  12576. assembly: Li,
  12577. axes: [f, x, f, x],
  12578. parser: fn,
  12579. value: this.value,
  12580. viewProps: this.viewProps
  12581. }), this.view.textElement.appendChild(this.tc_.view.element);
  12582. }
  12583. get allFocusableElements() {
  12584. return [
  12585. this.gc_.view.element,
  12586. ...this.tc_.view.textViews.map((a) => a.inputElement)
  12587. ];
  12588. }
  12589. refresh() {
  12590. this.gc_.refresh();
  12591. }
  12592. }
  12593. class ti {
  12594. constructor(a, u) {
  12595. 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 = u.value, this.viewProps = u.viewProps, this.foldable_ = Gn(u.expanded), this.view = new Ps(a, {
  12596. foldable: this.foldable_,
  12597. pickerLayout: u.pickerLayout,
  12598. viewProps: this.viewProps
  12599. }), this.view.buttonElement.addEventListener("blur", this.onButtonBlur_), this.view.buttonElement.addEventListener("click", this.onButtonClick_), this.tc_ = new Ht(a, {
  12600. parser: Lr,
  12601. props: K.fromObject({
  12602. formatter: Sr
  12603. }),
  12604. value: this.value,
  12605. viewProps: this.viewProps
  12606. }), this.view.textElement.appendChild(this.tc_.view.element), this.popC_ = u.pickerLayout === "popup" ? new ie(a, {
  12607. viewProps: this.viewProps
  12608. }) : null;
  12609. const f = new Ms(a, {
  12610. axis: u.axis,
  12611. value: this.value,
  12612. viewProps: this.viewProps
  12613. });
  12614. f.allFocusableElements.forEach((x) => {
  12615. x.addEventListener("blur", this.onPopupChildBlur_), x.addEventListener("keydown", this.onPopupChildKeydown_);
  12616. }), this.pickerC_ = f, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), k(this.popC_.shows, (x) => {
  12617. x && f.refresh();
  12618. }), $t({
  12619. primary: this.foldable_.value("expanded"),
  12620. secondary: this.popC_.shows,
  12621. forward: (x) => x.rawValue,
  12622. backward: (x, T) => T.rawValue
  12623. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Kn(this.foldable_, this.view.pickerElement));
  12624. }
  12625. onButtonBlur_(a) {
  12626. if (!this.popC_)
  12627. return;
  12628. const u = a.relatedTarget;
  12629. (!u || !this.popC_.view.element.contains(u)) && (this.popC_.shows.rawValue = false);
  12630. }
  12631. onButtonClick_() {
  12632. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.allFocusableElements[0].focus();
  12633. }
  12634. onPopupChildBlur_(a) {
  12635. if (!this.popC_)
  12636. return;
  12637. const u = this.popC_.view.element, f = cn(a);
  12638. f && u.contains(f) || f && f === this.view.buttonElement && !Qe(u.ownerDocument) || (this.popC_.shows.rawValue = false);
  12639. }
  12640. onPopupChildKeydown_(a) {
  12641. this.popC_ && a.key === "Escape" && (this.popC_.shows.rawValue = false);
  12642. }
  12643. }
  12644. function Vi() {
  12645. return new _r({
  12646. assembly: Li,
  12647. components: [0, 1, 2, 3].map((m) => m % 2 === 0 ? new Rt2({
  12648. min: 0,
  12649. max: 1
  12650. }) : void 0)
  12651. });
  12652. }
  12653. const Ot = {
  12654. id: "cubic-bezier",
  12655. type: "blade",
  12656. 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}',
  12657. accept(m) {
  12658. const a = he, u = ee(m, {
  12659. value: a.required.array(a.required.number),
  12660. view: a.required.constant("cubicbezier"),
  12661. expanded: a.optional.boolean,
  12662. label: a.optional.string,
  12663. picker: a.optional.custom((f) => f === "inline" || f === "popup" ? f : void 0)
  12664. });
  12665. return u ? { params: u } : null;
  12666. },
  12667. controller(m) {
  12668. var a, u;
  12669. const f = new Pt(...m.params.value), x = H(f, {
  12670. constraint: Vi(),
  12671. equals: Pt.equals
  12672. }), T = new ti(m.document, {
  12673. axis: {
  12674. baseStep: 0.1,
  12675. textProps: K.fromObject({
  12676. draggingScale: 0.01,
  12677. formatter: Ie(2)
  12678. })
  12679. },
  12680. expanded: (a = m.params.expanded) !== null && a !== void 0 ? a : false,
  12681. pickerLayout: (u = m.params.picker) !== null && u !== void 0 ? u : "popup",
  12682. value: x,
  12683. viewProps: m.viewProps
  12684. });
  12685. return new At(m.document, {
  12686. blade: m.blade,
  12687. props: K.fromObject({
  12688. label: m.params.label
  12689. }),
  12690. valueController: T
  12691. });
  12692. },
  12693. api(m) {
  12694. return !(m.controller instanceof At) || !(m.controller.valueController instanceof ti) ? null : new Cs(m.controller);
  12695. }
  12696. };
  12697. class we extends r {
  12698. begin() {
  12699. this.controller_.valueController.begin();
  12700. }
  12701. end() {
  12702. this.controller_.valueController.end();
  12703. }
  12704. }
  12705. const Ii = 20;
  12706. class Re {
  12707. constructor() {
  12708. this.start_ = null, this.duration_ = 0, this.fps_ = null, this.frameCount_ = 0, this.timestamps_ = [];
  12709. }
  12710. get duration() {
  12711. return this.duration_;
  12712. }
  12713. get fps() {
  12714. return this.fps_;
  12715. }
  12716. begin(a) {
  12717. this.start_ = a.getTime();
  12718. }
  12719. calculateFps_(a) {
  12720. if (this.timestamps_.length === 0)
  12721. return null;
  12722. const u = this.timestamps_[0];
  12723. return 1e3 * (this.frameCount_ - u.frameCount) / (a - u.time);
  12724. }
  12725. compactTimestamps_() {
  12726. if (this.timestamps_.length <= Ii)
  12727. return;
  12728. const a = this.timestamps_.length - Ii;
  12729. this.timestamps_.splice(0, a);
  12730. const u = this.timestamps_[0].frameCount;
  12731. this.timestamps_.forEach((f) => {
  12732. f.frameCount -= u;
  12733. }), this.frameCount_ -= u;
  12734. }
  12735. end(a) {
  12736. if (this.start_ === null)
  12737. return;
  12738. const u = a.getTime();
  12739. this.duration_ = u - this.start_, this.start_ = null, this.fps_ = this.calculateFps_(u), this.timestamps_.push({
  12740. frameCount: this.frameCount_,
  12741. time: u
  12742. }), ++this.frameCount_, this.compactTimestamps_();
  12743. }
  12744. }
  12745. const Wt = y("fps");
  12746. class Ye {
  12747. constructor(a, u) {
  12748. this.element = a.createElement("div"), this.element.classList.add(Wt()), u.viewProps.bindClassModifiers(this.element), this.graphElement = a.createElement("div"), this.graphElement.classList.add(Wt("g")), this.element.appendChild(this.graphElement);
  12749. const f = a.createElement("div");
  12750. f.classList.add(Wt("l")), this.element.appendChild(f);
  12751. const x = a.createElement("span");
  12752. x.classList.add(Wt("v")), x.textContent = "--", f.appendChild(x), this.valueElement = x;
  12753. const T = a.createElement("span");
  12754. T.classList.add(Wt("u")), T.textContent = "FPS", f.appendChild(T);
  12755. }
  12756. }
  12757. class Di {
  12758. constructor(a, u) {
  12759. this.stopwatch_ = new Re(), this.onTick_ = this.onTick_.bind(this), this.ticker_ = u.ticker, this.ticker_.emitter.on("tick", this.onTick_), this.value_ = u.value, this.viewProps = u.viewProps, this.view = new Ye(a, {
  12760. viewProps: this.viewProps
  12761. }), this.graphC_ = new Er(a, {
  12762. formatter: Ie(0),
  12763. lineCount: u.lineCount,
  12764. props: K.fromObject({
  12765. maxValue: u.maxValue,
  12766. minValue: u.minValue
  12767. }),
  12768. value: this.value_,
  12769. viewProps: this.viewProps
  12770. }), this.view.graphElement.appendChild(this.graphC_.view.element), this.viewProps.handleDispose(() => {
  12771. this.graphC_.viewProps.set("disposed", true), this.ticker_.dispose();
  12772. });
  12773. }
  12774. begin() {
  12775. this.stopwatch_.begin(/* @__PURE__ */ new Date());
  12776. }
  12777. end() {
  12778. this.stopwatch_.end(/* @__PURE__ */ new Date());
  12779. }
  12780. onTick_() {
  12781. const a = this.stopwatch_.fps;
  12782. if (a !== null) {
  12783. const u = this.value_.rawValue;
  12784. this.value_.rawValue = pr(u, a), this.view.valueElement.textContent = a.toFixed(0);
  12785. }
  12786. }
  12787. }
  12788. function En(m, a) {
  12789. return a === 0 ? new $n() : new pn(m, a ?? xr.monitor.defaultInterval);
  12790. }
  12791. const Oi = {
  12792. id: "fpsgraph",
  12793. type: "blade",
  12794. accept(m) {
  12795. const a = he, u = ee(m, {
  12796. view: a.required.constant("fpsgraph"),
  12797. interval: a.optional.number,
  12798. label: a.optional.string,
  12799. lineCount: a.optional.number,
  12800. max: a.optional.number,
  12801. min: a.optional.number
  12802. });
  12803. return u ? { params: u } : null;
  12804. },
  12805. controller(m) {
  12806. var a, u, f, x;
  12807. const T = (a = m.params.interval) !== null && a !== void 0 ? a : 500;
  12808. return new ot(m.document, {
  12809. blade: m.blade,
  12810. props: K.fromObject({
  12811. label: m.params.label
  12812. }),
  12813. valueController: new Di(m.document, {
  12814. lineCount: (u = m.params.lineCount) !== null && u !== void 0 ? u : 2,
  12815. maxValue: (f = m.params.max) !== null && f !== void 0 ? f : 90,
  12816. minValue: (x = m.params.min) !== null && x !== void 0 ? x : 0,
  12817. ticker: En(m.document, T),
  12818. value: us(80),
  12819. viewProps: m.viewProps
  12820. })
  12821. });
  12822. },
  12823. api(m) {
  12824. return !(m.controller instanceof ot) || !(m.controller.valueController instanceof Di) ? null : new we(m.controller);
  12825. }
  12826. };
  12827. class qe {
  12828. constructor(a, u) {
  12829. this.min = a, this.max = u;
  12830. }
  12831. static isObject(a) {
  12832. if (typeof a != "object" || a === null)
  12833. return false;
  12834. const u = a.min, f = a.max;
  12835. return !(typeof u != "number" || typeof f != "number");
  12836. }
  12837. static equals(a, u) {
  12838. return a.min === u.min && a.max === u.max;
  12839. }
  12840. get length() {
  12841. return this.max - this.min;
  12842. }
  12843. toObject() {
  12844. return {
  12845. min: this.min,
  12846. max: this.max
  12847. };
  12848. }
  12849. }
  12850. const Fi = {
  12851. fromComponents: (m) => new qe(m[0], m[1]),
  12852. toComponents: (m) => [m.min, m.max]
  12853. };
  12854. class Cn {
  12855. constructor(a) {
  12856. this.edge = a;
  12857. }
  12858. constrain(a) {
  12859. var u, f, x, T, V, j, oe, Je;
  12860. if (a.min <= a.max)
  12861. return new qe((f = (u = this.edge) === null || u === void 0 ? void 0 : u.constrain(a.min)) !== null && f !== void 0 ? f : a.min, (T = (x = this.edge) === null || x === void 0 ? void 0 : x.constrain(a.max)) !== null && T !== void 0 ? T : a.max);
  12862. const et = (a.min + a.max) / 2;
  12863. return new qe((j = (V = this.edge) === null || V === void 0 ? void 0 : V.constrain(et)) !== null && j !== void 0 ? j : et, (Je = (oe = this.edge) === null || oe === void 0 ? void 0 : oe.constrain(et)) !== null && Je !== void 0 ? Je : et);
  12864. }
  12865. }
  12866. const Ni = y("rsltxt");
  12867. class ni {
  12868. constructor(a, u) {
  12869. this.sliderView_ = u.sliderView, this.textView_ = u.textView, this.element = a.createElement("div"), this.element.classList.add(Ni());
  12870. const f = a.createElement("div");
  12871. f.classList.add(Ni("s")), f.appendChild(this.sliderView_.element), this.element.appendChild(f);
  12872. const x = a.createElement("div");
  12873. x.classList.add(Ni("t")), x.appendChild(this.textView_.element), this.element.appendChild(x);
  12874. }
  12875. }
  12876. const it = y("rsl");
  12877. class Pn {
  12878. constructor(a, u) {
  12879. this.onSliderPropsChange_ = this.onSliderPropsChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.sliderProps_ = u.sliderProps, this.sliderProps_.emitter.on("change", this.onSliderPropsChange_), this.element = a.createElement("div"), this.element.classList.add(it()), u.viewProps.bindClassModifiers(this.element), this.value_ = u.value, this.value_.emitter.on("change", this.onValueChange_);
  12880. const f = a.createElement("div");
  12881. f.classList.add(it("t")), this.element.appendChild(f), this.trackElement = f;
  12882. const x = a.createElement("div");
  12883. x.classList.add(it("b")), f.appendChild(x), this.barElement = x;
  12884. const T = ["min", "max"].map((V) => {
  12885. const j = a.createElement("div");
  12886. return j.classList.add(it("k"), it("k", V)), f.appendChild(j), j;
  12887. });
  12888. this.knobElements = [T[0], T[1]], this.update_();
  12889. }
  12890. valueToX_(a) {
  12891. const u = this.sliderProps_.get("minValue"), f = this.sliderProps_.get("maxValue");
  12892. return Yt(Ae(a, u, f, 0, 1), 0, 1) * 100;
  12893. }
  12894. update_() {
  12895. const a = this.value_.rawValue;
  12896. a.length === 0 ? this.element.classList.add(it(void 0, "zero")) : this.element.classList.remove(it(void 0, "zero"));
  12897. const u = [this.valueToX_(a.min), this.valueToX_(a.max)];
  12898. this.barElement.style.left = `${u[0]}%`, this.barElement.style.right = `${100 - u[1]}%`, this.knobElements.forEach((f, x) => {
  12899. f.style.left = `${u[x]}%`;
  12900. });
  12901. }
  12902. onSliderPropsChange_() {
  12903. this.update_();
  12904. }
  12905. onValueChange_() {
  12906. this.update_();
  12907. }
  12908. }
  12909. class Bi {
  12910. constructor(a, u) {
  12911. 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 = u.sliderProps, this.viewProps = u.viewProps, this.value = u.value, this.view = new Pn(a, {
  12912. sliderProps: this.sliderProps,
  12913. value: this.value,
  12914. viewProps: u.viewProps
  12915. });
  12916. const f = new Zn(this.view.trackElement);
  12917. f.emitter.on("down", this.onPointerDown_), f.emitter.on("move", this.onPointerMove_), f.emitter.on("up", this.onPointerUp_);
  12918. }
  12919. ofs_() {
  12920. return this.grabbing_ === "min" ? this.view.knobElements[0].getBoundingClientRect().width / 2 : this.grabbing_ === "max" ? -this.view.knobElements[1].getBoundingClientRect().width / 2 : 0;
  12921. }
  12922. valueFromData_(a) {
  12923. if (!a.point)
  12924. return null;
  12925. const u = (a.point.x + this.ofs_()) / a.bounds.width, f = this.sliderProps.get("minValue"), x = this.sliderProps.get("maxValue");
  12926. return Ae(u, 0, 1, f, x);
  12927. }
  12928. onPointerDown_(a) {
  12929. if (!a.data.point)
  12930. return;
  12931. const u = a.data.point.x / a.data.bounds.width, f = this.value.rawValue, x = this.sliderProps.get("minValue"), T = this.sliderProps.get("maxValue"), V = Ae(f.min, x, T, 0, 1), j = Ae(f.max, x, T, 0, 1);
  12932. Math.abs(j - u) <= 0.025 ? this.grabbing_ = "max" : Math.abs(V - u) <= 0.025 ? this.grabbing_ = "min" : u >= V && u <= j ? (this.grabbing_ = "length", this.grabOffset_ = Ae(u - V, 0, 1, 0, T - x)) : u < V ? (this.grabbing_ = "min", this.onPointerMove_(a)) : u > j && (this.grabbing_ = "max", this.onPointerMove_(a));
  12933. }
  12934. applyPointToValue_(a, u) {
  12935. const f = this.valueFromData_(a);
  12936. if (f === null)
  12937. return;
  12938. const x = this.sliderProps.get("minValue"), T = this.sliderProps.get("maxValue");
  12939. if (this.grabbing_ === "min")
  12940. this.value.setRawValue(new qe(f, this.value.rawValue.max), u);
  12941. else if (this.grabbing_ === "max")
  12942. this.value.setRawValue(new qe(this.value.rawValue.min, f), u);
  12943. else if (this.grabbing_ === "length") {
  12944. const V = this.value.rawValue.length;
  12945. let j = f - this.grabOffset_, oe = j + V;
  12946. j < x ? (j = x, oe = x + V) : oe > T && (j = T - V, oe = T), this.value.setRawValue(new qe(j, oe), u);
  12947. }
  12948. }
  12949. onPointerMove_(a) {
  12950. this.applyPointToValue_(a.data, {
  12951. forceEmit: false,
  12952. last: false
  12953. });
  12954. }
  12955. onPointerUp_(a) {
  12956. this.applyPointToValue_(a.data, {
  12957. forceEmit: true,
  12958. last: true
  12959. }), this.grabbing_ = null;
  12960. }
  12961. }
  12962. class wt {
  12963. constructor(a, u) {
  12964. this.value = u.value, this.viewProps = u.viewProps, this.sc_ = new Bi(a, u);
  12965. const f = {
  12966. baseStep: u.baseStep,
  12967. constraint: u.constraint,
  12968. textProps: K.fromObject({
  12969. draggingScale: u.draggingScale,
  12970. formatter: u.formatter
  12971. })
  12972. };
  12973. this.tc_ = new It(a, {
  12974. assembly: Fi,
  12975. axes: [f, f],
  12976. parser: u.parser,
  12977. value: this.value,
  12978. viewProps: u.viewProps
  12979. }), this.view = new ni(a, {
  12980. sliderView: this.sc_.view,
  12981. textView: this.tc_.view
  12982. });
  12983. }
  12984. get textController() {
  12985. return this.tc_;
  12986. }
  12987. }
  12988. function Ss(m) {
  12989. return qe.isObject(m) ? new qe(m.min, m.max) : new qe(0, 0);
  12990. }
  12991. function zi(m, a) {
  12992. m.writeProperty("max", a.max), m.writeProperty("min", a.min);
  12993. }
  12994. function Rr(m) {
  12995. const a = [], u = wn(m);
  12996. u && a.push(u);
  12997. const f = yr(m);
  12998. return f && a.push(f), new Cn(new Xn(a));
  12999. }
  13000. const ii = {
  13001. id: "input-interval",
  13002. type: "input",
  13003. 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}',
  13004. accept: (m, a) => {
  13005. if (!qe.isObject(m))
  13006. return null;
  13007. const u = he, f = ee(a, {
  13008. format: u.optional.function,
  13009. max: u.optional.number,
  13010. min: u.optional.number,
  13011. step: u.optional.number
  13012. });
  13013. return f ? {
  13014. initialValue: new qe(m.min, m.max),
  13015. params: f
  13016. } : null;
  13017. },
  13018. binding: {
  13019. reader: (m) => Ss,
  13020. constraint: (m) => Rr(m.params),
  13021. equals: qe.equals,
  13022. writer: (m) => zi
  13023. },
  13024. controller(m) {
  13025. var a;
  13026. const u = m.value, f = m.constraint;
  13027. if (!(f instanceof Cn))
  13028. throw g.shouldNeverHappen();
  13029. const x = (u.rawValue.min + u.rawValue.max) / 2, T = (a = m.params.format) !== null && a !== void 0 ? a : Ie(gn(f.edge, x)), V = f.edge && Ct(f.edge, gt);
  13030. if (V)
  13031. return new wt(m.document, {
  13032. baseStep: Ti(f.edge),
  13033. constraint: f.edge,
  13034. draggingScale: Wn(f.edge, x),
  13035. formatter: T,
  13036. parser: fn,
  13037. sliderProps: new K({
  13038. maxValue: V.values.value("max"),
  13039. minValue: V.values.value("min")
  13040. }),
  13041. value: u,
  13042. viewProps: m.viewProps
  13043. });
  13044. const j = {
  13045. baseStep: Ti(f.edge),
  13046. constraint: f.edge,
  13047. textProps: K.fromObject({
  13048. draggingScale: x,
  13049. formatter: T
  13050. })
  13051. };
  13052. return new It(m.document, {
  13053. assembly: Fi,
  13054. axes: [j, j],
  13055. parser: fn,
  13056. value: u,
  13057. viewProps: m.viewProps
  13058. });
  13059. }
  13060. };
  13061. class Ft {
  13062. constructor(a) {
  13063. this.controller_ = a;
  13064. }
  13065. get disabled() {
  13066. return this.controller_.viewProps.get("disabled");
  13067. }
  13068. set disabled(a) {
  13069. this.controller_.viewProps.set("disabled", a);
  13070. }
  13071. get title() {
  13072. var a;
  13073. return (a = this.controller_.props.get("title")) !== null && a !== void 0 ? a : "";
  13074. }
  13075. set title(a) {
  13076. this.controller_.props.set("title", a);
  13077. }
  13078. }
  13079. class Nt extends c {
  13080. constructor(a, u, f, x, T) {
  13081. super(a, x, T), this.cell = u, this.index = f;
  13082. }
  13083. }
  13084. class Tn extends r {
  13085. constructor(a) {
  13086. super(a), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.controller_.valueController.cellControllers.forEach((f) => {
  13087. const x = new Ft(f);
  13088. this.cellToApiMap_.set(f, x);
  13089. });
  13090. }
  13091. get value() {
  13092. return this.controller_.value;
  13093. }
  13094. cell(a, u) {
  13095. const f = this.controller_.valueController, x = f.cellControllers[u * f.size[0] + a];
  13096. return this.cellToApiMap_.get(x);
  13097. }
  13098. on(a, u) {
  13099. const f = u.bind(this);
  13100. this.controller_.value.emitter.on(a, (x) => {
  13101. const T = this.controller_.valueController, V = T.findCellByValue(x.rawValue);
  13102. if (!V)
  13103. return;
  13104. const j = this.cellToApiMap_.get(V);
  13105. if (!j)
  13106. return;
  13107. const oe = T.cellControllers.indexOf(V);
  13108. f(new Nt(this, j, [oe % T.size[0], Math.floor(oe / T.size[0])], x.rawValue, void 0));
  13109. });
  13110. }
  13111. }
  13112. const kn = y("rad");
  13113. class Ls {
  13114. constructor(a, u) {
  13115. this.element = a.createElement("div"), this.element.classList.add(kn()), u.viewProps.bindClassModifiers(this.element);
  13116. const f = a.createElement("label");
  13117. f.classList.add(kn("l")), this.element.appendChild(f);
  13118. const x = a.createElement("input");
  13119. x.classList.add(kn("i")), x.name = u.name, x.type = "radio", u.viewProps.bindDisabled(x), f.appendChild(x), this.inputElement = x;
  13120. const T = a.createElement("div");
  13121. T.classList.add(kn("b")), f.appendChild(T);
  13122. const V = a.createElement("div");
  13123. V.classList.add(kn("t")), T.appendChild(V), A(u.props, "title", (j) => {
  13124. V.textContent = j;
  13125. });
  13126. }
  13127. }
  13128. class As {
  13129. constructor(a, u) {
  13130. this.props = u.props, this.viewProps = u.viewProps, this.view = new Ls(a, {
  13131. name: u.name,
  13132. props: this.props,
  13133. viewProps: this.viewProps
  13134. });
  13135. }
  13136. }
  13137. class si {
  13138. constructor(a, u) {
  13139. this.cellCs_ = [], this.cellValues_ = [], this.onCellInputChange_ = this.onCellInputChange_.bind(this), this.size = u.size;
  13140. const [f, x] = this.size;
  13141. for (let T = 0; T < x; T++)
  13142. for (let V = 0; V < f; V++) {
  13143. const j = new As(a, {
  13144. name: u.groupName,
  13145. props: K.fromObject(Object.assign({}, u.cellConfig(V, T))),
  13146. viewProps: ge.create()
  13147. });
  13148. this.cellCs_.push(j), this.cellValues_.push(u.cellConfig(V, T).value);
  13149. }
  13150. this.value = u.value, k(this.value, (T) => {
  13151. const V = this.findCellByValue(T);
  13152. V && (V.view.inputElement.checked = true);
  13153. }), this.viewProps = ge.create(), this.view = new Et(a, {
  13154. viewProps: this.viewProps,
  13155. viewName: "radgrid"
  13156. }), this.view.element.style.gridTemplateColumns = `repeat(${f}, 1fr)`, this.cellCs_.forEach((T) => {
  13157. T.view.inputElement.addEventListener("change", this.onCellInputChange_), this.view.element.appendChild(T.view.element);
  13158. });
  13159. }
  13160. get cellControllers() {
  13161. return this.cellCs_;
  13162. }
  13163. findCellByValue(a) {
  13164. const u = this.cellValues_.findIndex((f) => f === a);
  13165. return u < 0 ? null : this.cellCs_[u];
  13166. }
  13167. onCellInputChange_(a) {
  13168. const u = a.currentTarget, f = this.cellCs_.findIndex((x) => x.view.inputElement === u);
  13169. f < 0 || (this.value.rawValue = this.cellValues_[f]);
  13170. }
  13171. }
  13172. const Bt = function() {
  13173. return {
  13174. id: "radiogrid",
  13175. type: "blade",
  13176. accept(m) {
  13177. const a = he, u = ee(m, {
  13178. cells: a.required.function,
  13179. groupName: a.required.string,
  13180. size: a.required.array(a.required.number),
  13181. value: a.required.raw,
  13182. view: a.required.constant("radiogrid"),
  13183. label: a.optional.string
  13184. });
  13185. return u ? { params: u } : null;
  13186. },
  13187. controller(m) {
  13188. return new At(m.document, {
  13189. blade: m.blade,
  13190. props: K.fromObject({
  13191. label: m.params.label
  13192. }),
  13193. valueController: new si(m.document, {
  13194. groupName: m.params.groupName,
  13195. cellConfig: m.params.cells,
  13196. size: m.params.size,
  13197. value: H(m.params.value)
  13198. })
  13199. });
  13200. },
  13201. api(m) {
  13202. return !(m.controller instanceof At) || !(m.controller.valueController instanceof si) ? null : new Tn(m.controller);
  13203. }
  13204. };
  13205. }();
  13206. function ji(m) {
  13207. return {
  13208. id: "input-radiogrid",
  13209. type: "input",
  13210. accept(a, u) {
  13211. if (!m.isType(a))
  13212. return null;
  13213. const f = he, x = ee(u, {
  13214. cells: f.required.function,
  13215. groupName: f.required.string,
  13216. size: f.required.array(f.required.number),
  13217. view: f.required.constant("radiogrid")
  13218. });
  13219. return x ? {
  13220. initialValue: a,
  13221. params: x
  13222. } : null;
  13223. },
  13224. binding: m.binding,
  13225. controller: (a) => new si(a.document, {
  13226. cellConfig: a.params.cells,
  13227. groupName: a.params.groupName,
  13228. size: a.params.size,
  13229. value: a.value
  13230. })
  13231. };
  13232. }
  13233. const Vr = ji({
  13234. isType: (m) => typeof m == "number",
  13235. binding: {
  13236. reader: (m) => cr,
  13237. writer: (m) => nt
  13238. }
  13239. }), Ir = ji({
  13240. isType: (m) => typeof m == "string",
  13241. binding: {
  13242. reader: (m) => cs,
  13243. writer: (m) => nt
  13244. }
  13245. }), Dr = ji({
  13246. isType: (m) => typeof m == "boolean",
  13247. binding: {
  13248. reader: (m) => hn,
  13249. writer: (m) => nt
  13250. }
  13251. }), Rs = [
  13252. Pr,
  13253. Ot,
  13254. Oi,
  13255. ii,
  13256. Bt,
  13257. Dr,
  13258. Vr,
  13259. Ir
  13260. ];
  13261. s.ButtonCellApi = xs, s.ButtonGridApi = Es, s.ButtonGridController = Mi, s.CubicBezier = Pt, s.CubicBezierApi = Cs, s.CubicBezierAssembly = Li, s.CubicBezierController = ti, s.CubicBezierGraphController = ut, s.CubicBezierGraphView = De, s.CubicBezierPickerController = Ms, s.CubicBezierPickerView = Ts, s.CubicBezierPreviewView = Zt, s.CubicBezierView = Ps, s.FpsGraphBladeApi = we, s.FpsGraphController = Di, s.FpsView = Ye, s.Fpswatch = Re, s.Interval = qe, s.IntervalAssembly = Fi, s.IntervalConstraint = Cn, s.RadioCellApi = Ft, s.RadioController = As, s.RadioGridApi = Tn, s.RadioGridController = si, s.RadioView = Ls, s.RangeSliderController = Bi, s.RangeSliderTextController = wt, s.RangeSliderTextView = ni, s.RangeSliderView = Pn, s.TpRadioGridChangeEvent = Nt, s.plugins = Rs, Object.defineProperty(s, "__esModule", { value: true });
  13262. });
  13263. })(Dh, ts);
  13264. var Oh = vh(ts);
  13265. var Fh = $u({
  13266. __proto__: null,
  13267. default: Oh
  13268. }, [ts]);
  13269. var Vn;
  13270. var Bs;
  13271. var Rd = (v = "tres-container") => {
  13272. Vn || (Vn = new Ks.Pane({
  13273. container: document.querySelector(v) || void 0
  13274. }), Vn.registerPlugin(Fh), Bs = Vn.addBlade({
  13275. view: "fpsgraph",
  13276. label: "fpsgraph"
  13277. }));
  13278. function n() {
  13279. Vn && Vn.dispose();
  13280. }
  13281. return onMounted(() => {
  13282. const { onBeforeLoop: s, onAfterLoop: r, resume: o } = Ee();
  13283. o(), s(() => Bs.begin()), r(() => Bs.end());
  13284. }), onUnmounted(() => {
  13285. n();
  13286. }), { pane: Vn, fpsGraph: Bs, disposeTweakPane: n };
  13287. };
  13288. function Vd(v, n) {
  13289. const s = ref(n), r = new AnimationMixer(s.value), o = shallowReactive({});
  13290. v.forEach((p) => {
  13291. const h = r.clipAction(p, s.value);
  13292. o[p.name] = h;
  13293. });
  13294. const { onLoop: c } = Ee();
  13295. return c(({ delta: p }) => {
  13296. r.update(p);
  13297. }), {
  13298. actions: o,
  13299. mixer: r
  13300. };
  13301. }
  13302. var zs = null;
  13303. function Nh(v, n) {
  13304. return (s) => {
  13305. n && n(s), v.draco && (zs || (zs = new gh()), zs.setDecoderPath(v.decoderPath || "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"), s.setDRACOLoader(zs));
  13306. };
  13307. }
  13308. async function Bh(v, n = {
  13309. draco: false
  13310. }, s) {
  13311. return await xt(bp, v, Nh(n, s));
  13312. }
  13313. var Id = defineComponent({
  13314. name: "GLTFModel",
  13315. props: ["path", "draco", "decoderPath"],
  13316. async setup(v, { expose: n }) {
  13317. const { state: s } = St(), r = ref();
  13318. n({ model: r });
  13319. const { scene: o } = await Bh(v.path, { draco: v.draco, decoderPath: v.decoderPath });
  13320. return r.value = o, s.scene && s.scene.add(o), () => {
  13321. };
  13322. }
  13323. });
  13324. async function zh(v) {
  13325. return await xt(th, v);
  13326. }
  13327. var Dd = defineComponent({
  13328. name: "FBXModel",
  13329. props: ["path"],
  13330. async setup(v, { expose: n }) {
  13331. const { state: s } = St();
  13332. let r = null;
  13333. function o() {
  13334. return r;
  13335. }
  13336. return n({ getModel: o }), r = await zh(v.path), s.scene && r.isObject3D && s.scene.add(r), () => {
  13337. };
  13338. }
  13339. });
  13340. var jh = ["position", "a-scale"];
  13341. var Od = defineComponent({
  13342. __name: "Stars",
  13343. props: {
  13344. size: { default: 0.1 },
  13345. sizeAttenuation: { type: Boolean, default: true },
  13346. transparent: { type: Boolean, default: true },
  13347. alphaTest: { default: 0.01 },
  13348. count: { default: 5e3 },
  13349. depth: { default: 50 },
  13350. radius: { default: 100 },
  13351. factor: { default: 4 },
  13352. alphaMap: { default: null }
  13353. },
  13354. setup(v, { expose: n }) {
  13355. const s = v;
  13356. let r = s.radius + s.depth;
  13357. const o = s.depth / s.count, c = [], p = Array.from({ length: s.count }, () => (0.5 + 0.5 * Math.random()) * s.factor), h = (y) => new Vector3().setFromSpherical(new Spherical(y, Math.acos(1 - Math.random() * 2), Math.random() * 2 * Math.PI));
  13358. for (let y = 0; y < s.count; y++)
  13359. r -= o * Math.random(), c.push(...h(r).toArray());
  13360. const d = new Float32Array(c), g = new Float32Array(p), w = computed(() => ({
  13361. size: s.size,
  13362. sizeAttenuation: s.sizeAttenuation,
  13363. transparent: s.transparent,
  13364. alphaTest: s.alphaTest,
  13365. alphaMap: s.alphaMap
  13366. })), _2 = shallowRef();
  13367. return n({
  13368. value: _2
  13369. }), (y, P) => (openBlock(), createElementBlock("TresPoints", {
  13370. ref_key: "starsRef",
  13371. ref: _2
  13372. }, [
  13373. createBaseVNode("TresBufferGeometry", {
  13374. position: [unref(d), 3],
  13375. "a-scale": [unref(g), 1]
  13376. }, null, 8, jh),
  13377. createBaseVNode("TresPointsMaterial", normalizeProps(guardReactiveProps(unref(w))), null, 16)
  13378. ], 512));
  13379. }
  13380. });
  13381. var Uh = ["args", "center"];
  13382. var Fd = defineComponent({
  13383. __name: "Text3D",
  13384. props: {
  13385. font: null,
  13386. text: null,
  13387. size: { default: 0.5 },
  13388. height: { default: 0.2 },
  13389. curveSegments: { default: 5 },
  13390. bevelEnabled: { type: Boolean, default: true },
  13391. bevelThickness: { default: 0.05 },
  13392. bevelSize: { default: 0.02 },
  13393. bevelOffset: { default: 0 },
  13394. bevelSegments: { default: 4 },
  13395. center: { type: Boolean, default: false }
  13396. },
  13397. async setup(v, { expose: n }) {
  13398. let s, r;
  13399. const o = v, { extend: c } = St();
  13400. c({ TextGeometry: Xp });
  13401. const p = new dh(), h = useSlots(), d = computed(() => {
  13402. var y;
  13403. return o.text ? o.text : h.default ? (y = h.default()[0].children) == null ? void 0 : y.trim() : "TresJS";
  13404. }), g = shallowRef();
  13405. n({
  13406. value: g
  13407. });
  13408. const w = ([s, r] = withAsyncContext(() => new Promise((y, P) => {
  13409. try {
  13410. typeof o.font == "string" ? p.load(o.font, (R) => {
  13411. y(R);
  13412. }) : y(o.font);
  13413. } catch (R) {
  13414. P(console.error("cientos", R));
  13415. }
  13416. })), s = await s, r(), s), _2 = computed(() => ({
  13417. font: w,
  13418. size: o.size,
  13419. height: o.height,
  13420. curveSegments: o.curveSegments,
  13421. bevelEnabled: o.bevelEnabled,
  13422. bevelThickness: o.bevelThickness,
  13423. bevelSize: o.bevelSize,
  13424. bevelOffset: o.bevelOffset,
  13425. bevelSegments: o.bevelSegments
  13426. }));
  13427. return (y, P) => unref(w) ? (openBlock(), createElementBlock("TresMesh", mergeProps({
  13428. key: 0,
  13429. ref_key: "textRef",
  13430. ref: g
  13431. }, y.$attrs), [
  13432. unref(d) ? (openBlock(), createElementBlock("TresTextGeometry", {
  13433. key: 0,
  13434. args: [unref(d), unref(_2)],
  13435. center: v.center
  13436. }, null, 8, Uh)) : createCommentVNode("", true),
  13437. renderSlot(y.$slots, "default")
  13438. ], 16)) : createCommentVNode("", true);
  13439. }
  13440. });
  13441. var Gh = ["rotation"];
  13442. var Hh = ["args"];
  13443. var Kh = ["color"];
  13444. var Nd = defineComponent({
  13445. __name: "Plane",
  13446. props: {
  13447. args: { default: () => [1, 1] },
  13448. color: { default: "0xffffff" }
  13449. },
  13450. setup(v, { expose: n }) {
  13451. const s = shallowRef();
  13452. return n({
  13453. value: s
  13454. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13455. ref_key: "planeRef",
  13456. ref: s,
  13457. rotation: [-Math.PI / 2, 0, 0]
  13458. }, r.$attrs), [
  13459. createBaseVNode("TresPlaneGeometry", { args: v.args }, null, 8, Hh),
  13460. renderSlot(r.$slots, "default", {}, () => [
  13461. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Kh)
  13462. ])
  13463. ], 16, Gh));
  13464. }
  13465. });
  13466. var $h = ["args"];
  13467. var Xh = ["color"];
  13468. var Bd = defineComponent({
  13469. __name: "Box",
  13470. props: {
  13471. args: { default: () => [1, 1, 1] },
  13472. color: { default: "0xffffff" }
  13473. },
  13474. setup(v, { expose: n }) {
  13475. const s = shallowRef();
  13476. return n({
  13477. value: s
  13478. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13479. ref_key: "boxRef",
  13480. ref: s
  13481. }, r.$attrs), [
  13482. createBaseVNode("TresBoxGeometry", { args: v.args }, null, 8, $h),
  13483. renderSlot(r.$slots, "default", {}, () => [
  13484. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Xh)
  13485. ])
  13486. ], 16));
  13487. }
  13488. });
  13489. var Yh = ["args"];
  13490. var qh = ["color"];
  13491. var zd = defineComponent({
  13492. __name: "Sphere",
  13493. props: {
  13494. args: { default: () => [2, 32, 16] },
  13495. color: { default: "0xffffff" }
  13496. },
  13497. setup(v, { expose: n }) {
  13498. const s = shallowRef();
  13499. return n({
  13500. value: s
  13501. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13502. ref_key: "sphereRef",
  13503. ref: s
  13504. }, r.$attrs), [
  13505. createBaseVNode("TresSphereGeometry", { args: v.args }, null, 8, Yh),
  13506. renderSlot(r.$slots, "default", {}, () => [
  13507. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, qh)
  13508. ])
  13509. ], 16));
  13510. }
  13511. });
  13512. var Qh = ["args"];
  13513. var Zh = ["color"];
  13514. var jd = defineComponent({
  13515. __name: "Torus",
  13516. props: {
  13517. args: { default: () => [1, 1, 16, 80] },
  13518. color: { default: "0xffffff" }
  13519. },
  13520. setup(v, { expose: n }) {
  13521. const s = shallowRef();
  13522. return n({
  13523. value: s
  13524. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13525. ref_key: "torusRef",
  13526. ref: s
  13527. }, r.$attrs), [
  13528. createBaseVNode("TresTorusGeometry", { args: v.args }, null, 8, Qh),
  13529. renderSlot(r.$slots, "default", {}, () => [
  13530. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Zh)
  13531. ])
  13532. ], 16));
  13533. }
  13534. });
  13535. var Wh = ["args"];
  13536. var Jh = ["color"];
  13537. var Ud = defineComponent({
  13538. __name: "TorusKnot",
  13539. props: {
  13540. args: { default: () => [1, 0.4, 64, 8] },
  13541. color: { default: "0xffffff" }
  13542. },
  13543. setup(v, { expose: n }) {
  13544. const s = shallowRef();
  13545. return n({
  13546. value: s
  13547. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13548. ref_key: "torusKnotRef",
  13549. ref: s
  13550. }, r.$attrs), [
  13551. createBaseVNode("TresTorusKnotGeometry", { args: v.args }, null, 8, Wh),
  13552. renderSlot(r.$slots, "default", {}, () => [
  13553. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Jh)
  13554. ])
  13555. ], 16));
  13556. }
  13557. });
  13558. var ed = ["args"];
  13559. var td = ["color"];
  13560. var Gd = defineComponent({
  13561. __name: "Circle",
  13562. props: {
  13563. args: { default: () => [1, 32, 0, Math.PI * 2] },
  13564. color: { default: "0xffffff" }
  13565. },
  13566. setup(v, { expose: n }) {
  13567. const s = shallowRef();
  13568. return n({
  13569. value: s
  13570. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13571. ref_key: "circleRef",
  13572. ref: s
  13573. }, r.$attrs), [
  13574. createBaseVNode("TresCircleGeometry", { args: v.args }, null, 8, ed),
  13575. renderSlot(r.$slots, "default", {}, () => [
  13576. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, td)
  13577. ])
  13578. ], 16));
  13579. }
  13580. });
  13581. var nd = ["args"];
  13582. var id = ["color"];
  13583. var Hd = defineComponent({
  13584. __name: "Cone",
  13585. props: {
  13586. args: { default: () => [1, 1, 12, false, 0, Math.PI * 2] },
  13587. color: { default: "0xffffff" }
  13588. },
  13589. setup(v, { expose: n }) {
  13590. const s = shallowRef();
  13591. return n({
  13592. value: s
  13593. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13594. ref_key: "coneRef",
  13595. ref: s
  13596. }, r.$attrs), [
  13597. createBaseVNode("TresConeGeometry", { args: v.args }, null, 8, nd),
  13598. renderSlot(r.$slots, "default", {}, () => [
  13599. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, id)
  13600. ])
  13601. ], 16));
  13602. }
  13603. });
  13604. var sd = ["args"];
  13605. var rd = ["color"];
  13606. var Kd = defineComponent({
  13607. __name: "Tube",
  13608. props: {
  13609. args: { default: () => [
  13610. new QuadraticBezierCurve3(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),
  13611. 20,
  13612. 0.2,
  13613. 8,
  13614. false
  13615. ] },
  13616. color: { default: "0xffffff" }
  13617. },
  13618. setup(v, { expose: n }) {
  13619. const s = shallowRef();
  13620. return n({
  13621. value: s
  13622. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13623. ref_key: "tubeRef",
  13624. ref: s
  13625. }, r.$attrs), [
  13626. createBaseVNode("TresTubeGeometry", { args: v.args }, null, 8, sd),
  13627. renderSlot(r.$slots, "default", {}, () => [
  13628. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, rd)
  13629. ])
  13630. ], 16));
  13631. }
  13632. });
  13633. var od = ["args"];
  13634. var ad = ["color"];
  13635. var $d = defineComponent({
  13636. __name: "Ring",
  13637. props: {
  13638. args: { default: () => [0.5, 1, 32] },
  13639. color: { default: "0xffffff" }
  13640. },
  13641. setup(v, { expose: n }) {
  13642. const s = shallowRef();
  13643. return n({
  13644. value: s
  13645. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13646. ref_key: "ringRef",
  13647. ref: s
  13648. }, r.$attrs), [
  13649. createBaseVNode("TresRingGeometry", { args: v.args }, null, 8, od),
  13650. renderSlot(r.$slots, "default", {}, () => [
  13651. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, ad)
  13652. ])
  13653. ], 16));
  13654. }
  13655. });
  13656. var ld = ["rotation"];
  13657. var cd = ["args"];
  13658. var ud = ["color"];
  13659. var Xd = defineComponent({
  13660. __name: "Tetrahedron",
  13661. props: {
  13662. args: { default: () => [1, 0] },
  13663. color: { default: "0xffffff" }
  13664. },
  13665. setup(v, { expose: n }) {
  13666. const s = shallowRef();
  13667. return n({
  13668. value: s
  13669. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13670. ref_key: "tetrahedronRef",
  13671. ref: s,
  13672. rotation: [-Math.PI / 2, 0, 0]
  13673. }, r.$attrs), [
  13674. createBaseVNode("TresTetrahedronGeometry", { args: v.args }, null, 8, cd),
  13675. renderSlot(r.$slots, "default", {}, () => [
  13676. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, ud)
  13677. ])
  13678. ], 16, ld));
  13679. }
  13680. });
  13681. var pd = ["args"];
  13682. var hd = ["color"];
  13683. var Yd = defineComponent({
  13684. __name: "Icosahedron",
  13685. props: {
  13686. args: { default: () => [1, 0] },
  13687. color: { default: "0xffffff" }
  13688. },
  13689. setup(v, { expose: n }) {
  13690. const s = shallowRef();
  13691. return n({
  13692. value: s
  13693. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13694. ref_key: "icosahedronRef",
  13695. ref: s
  13696. }, r.$attrs), [
  13697. createBaseVNode("TresIcosahedronGeometry", { args: v.args }, null, 8, pd),
  13698. renderSlot(r.$slots, "default", {}, () => [
  13699. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, hd)
  13700. ])
  13701. ], 16));
  13702. }
  13703. });
  13704. var dd = ["args"];
  13705. var md = ["color"];
  13706. var qd = defineComponent({
  13707. __name: "Octahedron",
  13708. props: {
  13709. args: { default: () => [1, 0] },
  13710. color: { default: "0xffffff" }
  13711. },
  13712. setup(v, { expose: n }) {
  13713. const s = shallowRef();
  13714. return n({
  13715. value: s
  13716. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13717. ref_key: "octahedronRef",
  13718. ref: s
  13719. }, r.$attrs), [
  13720. createBaseVNode("TresOctahedronGeometry", { args: v.args }, null, 8, dd),
  13721. renderSlot(r.$slots, "default", {}, () => [
  13722. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, md)
  13723. ])
  13724. ], 16));
  13725. }
  13726. });
  13727. var fd = ["args"];
  13728. var vd = ["color"];
  13729. var Qd = defineComponent({
  13730. __name: "Dodecahedron",
  13731. props: {
  13732. args: { default: () => [1, 0] },
  13733. color: { default: "0xffffff" }
  13734. },
  13735. setup(v, { expose: n }) {
  13736. const s = shallowRef();
  13737. return n({
  13738. value: s
  13739. }), (r, o) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13740. ref_key: "dodecahedronRef",
  13741. ref: s
  13742. }, r.$attrs), [
  13743. createBaseVNode("TresDodecahedronGeometry", { args: v.args }, null, 8, fd),
  13744. renderSlot(r.$slots, "default", {}, () => [
  13745. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, vd)
  13746. ])
  13747. ], 16));
  13748. }
  13749. });
  13750. var co = {
  13751. sunset: "venice/venice_sunset_4k.hdr"
  13752. };
  13753. async function bd({
  13754. files: v = ["/px.png", "/nx.png", "/py.png", "/ny.png", "/pz.png", "/nz.png"],
  13755. blur: n = 0,
  13756. background: s = false,
  13757. path: r = "/",
  13758. preset: o = void 0,
  13759. encoding: c = void 0
  13760. }) {
  13761. const { state: p } = St();
  13762. if (o) {
  13763. if (!(o in co))
  13764. throw new Error("Preset must be one of: " + Object.keys(co).join(", "));
  13765. v = co[o], r = "https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";
  13766. }
  13767. const h = Array.isArray(v), g = await xt(
  13768. h ? CubeTextureLoader : bh,
  13769. h ? [v] : v,
  13770. (_2) => {
  13771. r && _2.setPath(r), c && (_2.encoding = c);
  13772. }
  13773. ), w = h ? g[0] : g;
  13774. return w && (w.mapping = h ? CubeReflectionMapping : EquirectangularReflectionMapping, w.encoding = c ?? h ? sRGBEncoding : LinearEncoding), p.scene && (p.scene.environment = w, s !== void 0 && (p.scene.background = w), n && (p.scene.backgroundBlurriness = n | 0)), w;
  13775. }
  13776. var Zd = defineComponent({
  13777. name: "Environment",
  13778. props: ["background", "blur", "files", "encoding", "path", "preset"],
  13779. async setup(v, { expose: n }) {
  13780. let s = null;
  13781. return n({ getTexture: () => s }), s = await bd(v), () => {
  13782. };
  13783. }
  13784. });
  13785. var gd = ["position"];
  13786. var _d = ["position"];
  13787. var wd = ["scale"];
  13788. var yd = ["map", "map-encoding", "depth-test", "color", "opacity"];
  13789. var Wd = defineComponent({
  13790. __name: "Smoke",
  13791. props: {
  13792. color: { default: "#ffffff" },
  13793. opacity: { default: 0.5 },
  13794. speed: { default: 0.4 },
  13795. width: { default: 10 },
  13796. depth: { default: 1.5 },
  13797. segments: { default: 20 },
  13798. texture: { default: "https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png" },
  13799. depthTest: { type: Boolean, default: true }
  13800. },
  13801. async setup(v, { expose: n }) {
  13802. let s, r;
  13803. const o = v, c = shallowRef(), p = shallowRef();
  13804. n({
  13805. value: c
  13806. });
  13807. const h = [...new Array(o.segments)].map((P, R) => ({
  13808. x: o.width / 2 - Math.random() * o.width,
  13809. y: o.width / 2 - Math.random() * o.width,
  13810. scale: 0.4 + Math.sin((R + 1) / o.segments * Math.PI) * ((0.2 + Math.random()) * 10),
  13811. density: Math.max(0.2, Math.random()),
  13812. rotation: Math.max(2e-3, 5e-3 * Math.random()) * o.speed
  13813. })), d = (P, R) => P / 6 * R * o.opacity, { map: g } = ([s, r] = withAsyncContext(() => Rt({ map: o.texture })), s = await s, r(), s), { state: w } = St(), _2 = computed(() => {
  13814. var P;
  13815. return (P = w.renderer) == null ? void 0 : P.outputEncoding;
  13816. }), { onLoop: y } = Ee();
  13817. return y(() => {
  13818. var P, R;
  13819. c.value && w.camera && p.value && ((P = p.value) == null || P.children.forEach((k, A) => {
  13820. k.rotation.z += h[A].rotation;
  13821. }), c.value.lookAt((R = w.camera) == null ? void 0 : R.position));
  13822. }), (P, R) => (openBlock(), createElementBlock("TresGroup", mergeProps({
  13823. ref_key: "smokeRef",
  13824. ref: c
  13825. }, P.$attrs), [
  13826. createBaseVNode("TresGroup", {
  13827. ref_key: "groupRef",
  13828. ref: p,
  13829. position: [0, 0, v.segments / 2 * v.depth]
  13830. }, [
  13831. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(h), ({ scale: k, x: A, y: z, density: F }, I) => (openBlock(), createElementBlock("TresMesh", {
  13832. key: I,
  13833. position: [A, z, -I * v.depth]
  13834. }, [
  13835. createBaseVNode("TresPlaneGeometry", {
  13836. scale: [k, k, k],
  13837. rotation: [0, 0, 0]
  13838. }, null, 8, wd),
  13839. createBaseVNode("TresMeshStandardMaterial", {
  13840. map: unref(g),
  13841. "map-encoding": unref(_2),
  13842. "depth-test": v.depthTest,
  13843. color: v.color,
  13844. "depth-write": false,
  13845. transparent: "",
  13846. opacity: d(k, F)
  13847. }, null, 8, yd)
  13848. ], 8, _d))), 128))
  13849. ], 8, gd)
  13850. ], 16));
  13851. }
  13852. });
  13853. var Jd = defineComponent({
  13854. __name: "Levioso",
  13855. props: {
  13856. speed: { default: 1 },
  13857. rotationFactor: { default: 1 },
  13858. floatFactor: { default: 1 },
  13859. range: { default: () => [-0.1, 0.1] }
  13860. },
  13861. setup(v, { expose: n }) {
  13862. const s = v, r = shallowRef();
  13863. n({
  13864. value: r
  13865. });
  13866. const { onLoop: o } = Ee(), c = ref(Math.random() * 1e4);
  13867. return o(({ elapsed: p }) => {
  13868. var g, w;
  13869. if (!r.value)
  13870. return;
  13871. const h = c.value + p;
  13872. r.value.rotation.x = Math.cos(h / 4 * s.speed) / 8 * s.rotationFactor, r.value.rotation.y = Math.sin(h / 4 * s.speed) / 8 * s.rotationFactor, r.value.rotation.z = Math.sin(h / 4 * s.speed) / 20 * s.rotationFactor;
  13873. let d = Math.sin(h / 4 * s.speed) / 10;
  13874. d = MathUtils.mapLinear(d, -0.1, 0.1, ((g = s.range) == null ? void 0 : g[0]) ?? -0.1, ((w = s.range) == null ? void 0 : w[1]) ?? 0.1), r.value.position.y = d * s.floatFactor;
  13875. }), (p, h) => (openBlock(), createElementBlock("TresGroup", mergeProps(p.$attrs, {
  13876. ref_key: "groupRef",
  13877. ref: r
  13878. }), [
  13879. renderSlot(p.$slots, "default")
  13880. ], 16));
  13881. }
  13882. });
  13883. var xd = class extends MeshStandardMaterial {
  13884. constructor(s = {}) {
  13885. super(s);
  13886. Jr(this, "_time");
  13887. Jr(this, "_factor");
  13888. this.setValues(s), this._time = { value: 0 }, this._factor = { value: 1 };
  13889. }
  13890. onBeforeCompile(s) {
  13891. s.uniforms || (s.uniforms = {}), s.uniforms.time = this._time, s.uniforms.factor = this._factor, s.vertexShader = `
  13892. uniform float time;
  13893. uniform float factor;
  13894. ${s.vertexShader}
  13895. `, s.vertexShader = s.vertexShader.replace(
  13896. "#include <begin_vertex>",
  13897. `float theta = sin( time + position.y ) / 2.0 * factor;
  13898. float c = cos( theta );
  13899. float s = sin( theta );
  13900. mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
  13901. vec3 transformed = vec3( position ) * m;
  13902. vNormal = vNormal * m;`
  13903. );
  13904. }
  13905. get time() {
  13906. return this._time.value;
  13907. }
  13908. set time(s) {
  13909. this._time.value = s;
  13910. }
  13911. get factor() {
  13912. return this._factor.value;
  13913. }
  13914. set factor(s) {
  13915. this._factor.value = s;
  13916. }
  13917. };
  13918. var Ed = ["factor"];
  13919. var em = defineComponent({
  13920. __name: "index",
  13921. props: {
  13922. speed: { default: 1 },
  13923. factor: { default: 1 }
  13924. },
  13925. setup(v) {
  13926. const n = v, s = shallowRef(), { extend: r } = St();
  13927. r({ MeshWobbleMaterial: xd });
  13928. const { onLoop: o } = Ee();
  13929. return o(({ elapsed: c }) => {
  13930. s.value && (s.value.time = c * (n == null ? void 0 : n.speed));
  13931. }), (c, p) => (openBlock(), createElementBlock("TresMeshWobbleMaterial", mergeProps({
  13932. ref_key: "materialRef",
  13933. ref: s,
  13934. factor: v.factor
  13935. }, c.$attrs), null, 16, Ed));
  13936. }
  13937. });
  13938. export {
  13939. Bd as Box,
  13940. Gd as Circle,
  13941. Hd as Cone,
  13942. Qd as Dodecahedron,
  13943. Zd as Environment,
  13944. Dd as FBXModel,
  13945. Id as GLTFModel,
  13946. Yd as Icosahedron,
  13947. Jd as Levioso,
  13948. em as MeshWobbleMaterial,
  13949. qd as Octahedron,
  13950. Md as OrbitControls,
  13951. Ad as PamCameraMouse,
  13952. Nd as Plane,
  13953. Sd as PointerLockControls,
  13954. $d as Ring,
  13955. Wd as Smoke,
  13956. zd as Sphere,
  13957. Od as Stars,
  13958. Xd as Tetrahedron,
  13959. Fd as Text3D,
  13960. jd as Torus,
  13961. Ud as TorusKnot,
  13962. Ld as TransformControls,
  13963. Kd as Tube,
  13964. Vd as useAnimations,
  13965. bd as useEnvironment,
  13966. zh as useFBX,
  13967. Bh as useGLTF,
  13968. Vh as usePamCameraMouse,
  13969. Rd as useTweakPane
  13970. };
  13971. /*! Bundled license information:
  13972. @tresjs/cientos/dist/trescientos.js:
  13973. (*! Tweakpane 3.1.7 (c) 2016 cocopon, licensed under the MIT license. *)
  13974. */
  13975. //# sourceMappingURL=@tresjs_cientos.js.map