@tresjs_cientos.js 561 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474
  1. import {
  2. ACESFilmicToneMapping,
  3. AmbientLight,
  4. AnimationClip,
  5. AnimationMixer,
  6. Bone,
  7. Box3,
  8. BoxGeometry,
  9. BufferAttribute,
  10. BufferGeometry,
  11. ClampToEdgeWrapping,
  12. Clock,
  13. Color,
  14. CubeReflectionMapping,
  15. CubeTextureLoader,
  16. Curve,
  17. CylinderGeometry,
  18. DataTextureLoader,
  19. DataUtils,
  20. DirectionalLight,
  21. DoubleSide,
  22. EquirectangularReflectionMapping,
  23. Euler,
  24. EventDispatcher,
  25. ExtrudeGeometry,
  26. FileLoader,
  27. Float32BufferAttribute,
  28. FloatType,
  29. FrontSide,
  30. Group,
  31. HalfFloatType,
  32. ImageBitmapLoader,
  33. InterleavedBuffer,
  34. InterleavedBufferAttribute,
  35. Interpolant,
  36. InterpolateDiscrete,
  37. InterpolateLinear,
  38. Line,
  39. LineBasicMaterial,
  40. LineLoop,
  41. LineSegments,
  42. LinearEncoding,
  43. LinearFilter,
  44. LinearMipmapLinearFilter,
  45. LinearMipmapNearestFilter,
  46. Loader,
  47. LoaderUtils,
  48. MOUSE,
  49. Material,
  50. MathUtils,
  51. Matrix3,
  52. Matrix4,
  53. Mesh,
  54. MeshBasicMaterial,
  55. MeshLambertMaterial,
  56. MeshPhongMaterial,
  57. MeshPhysicalMaterial,
  58. MeshStandardMaterial,
  59. MirroredRepeatWrapping,
  60. NearestFilter,
  61. NearestMipmapLinearFilter,
  62. NearestMipmapNearestFilter,
  63. NoToneMapping,
  64. NumberKeyframeTrack,
  65. Object3D,
  66. OctahedronGeometry,
  67. OrthographicCamera,
  68. PCFShadowMap,
  69. PCFSoftShadowMap,
  70. PerspectiveCamera,
  71. PlaneGeometry,
  72. PointLight,
  73. Points,
  74. PointsMaterial,
  75. PropertyBinding,
  76. QuadraticBezierCurve3,
  77. Quaternion,
  78. QuaternionKeyframeTrack,
  79. Raycaster,
  80. RepeatWrapping,
  81. Scene,
  82. ShapePath,
  83. Skeleton,
  84. SkinnedMesh,
  85. Sphere,
  86. SphereGeometry,
  87. Spherical,
  88. SpotLight,
  89. TOUCH,
  90. TangentSpaceNormalMap,
  91. Texture,
  92. TextureLoader,
  93. TorusGeometry,
  94. TriangleFanDrawMode,
  95. TriangleStripDrawMode,
  96. Uint16BufferAttribute,
  97. Vector2,
  98. Vector3,
  99. Vector4,
  100. VectorKeyframeTrack,
  101. WebGLRenderer,
  102. sRGBEncoding,
  103. three_module_exports
  104. } from "./chunk-4QXXOI63.js";
  105. import {
  106. computed,
  107. createBaseVNode,
  108. createCommentVNode,
  109. createElementBlock,
  110. createRenderer,
  111. defineComponent,
  112. getCurrentInstance,
  113. getCurrentScope,
  114. h,
  115. inject,
  116. mergeProps,
  117. nextTick,
  118. onMounted,
  119. onScopeDispose,
  120. onUnmounted,
  121. openBlock,
  122. readonly,
  123. ref,
  124. renderSlot,
  125. shallowReactive,
  126. shallowRef,
  127. toRef,
  128. toRefs,
  129. unref,
  130. useSlots,
  131. watch,
  132. watchEffect,
  133. withAsyncContext
  134. } from "./chunk-LZPJ5JBW.js";
  135. import "./chunk-JC4IRQUL.js";
  136. // node_modules/.pnpm/@vueuse+shared@9.13.0_vue@3.2.47/node_modules/@vueuse/shared/index.mjs
  137. var _a;
  138. var isClient = typeof window !== "undefined";
  139. var isFunction = (val) => typeof val === "function";
  140. var isString = (val) => typeof val === "string";
  141. var noop = () => {
  142. };
  143. var isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  144. function resolveUnref(r) {
  145. return typeof r === "function" ? r() : unref(r);
  146. }
  147. function identity(arg) {
  148. return arg;
  149. }
  150. function tryOnScopeDispose(fn) {
  151. if (getCurrentScope()) {
  152. onScopeDispose(fn);
  153. return true;
  154. }
  155. return false;
  156. }
  157. function createEventHook() {
  158. const fns = [];
  159. const off = (fn) => {
  160. const index = fns.indexOf(fn);
  161. if (index !== -1)
  162. fns.splice(index, 1);
  163. };
  164. const on = (fn) => {
  165. fns.push(fn);
  166. const offFn = () => off(fn);
  167. tryOnScopeDispose(offFn);
  168. return {
  169. off: offFn
  170. };
  171. };
  172. const trigger = (param) => {
  173. fns.forEach((fn) => fn(param));
  174. };
  175. return {
  176. on,
  177. off,
  178. trigger
  179. };
  180. }
  181. function tryOnMounted(fn, sync = true) {
  182. if (getCurrentInstance())
  183. onMounted(fn);
  184. else if (sync)
  185. fn();
  186. else
  187. nextTick(fn);
  188. }
  189. // node_modules/.pnpm/@vueuse+core@9.13.0_vue@3.2.47/node_modules/@vueuse/core/index.mjs
  190. function unrefElement(elRef) {
  191. var _a3;
  192. const plain = resolveUnref(elRef);
  193. return (_a3 = plain == null ? void 0 : plain.$el) != null ? _a3 : plain;
  194. }
  195. var defaultWindow = isClient ? window : void 0;
  196. var defaultDocument = isClient ? window.document : void 0;
  197. var defaultNavigator = isClient ? window.navigator : void 0;
  198. var defaultLocation = isClient ? window.location : void 0;
  199. function useEventListener(...args) {
  200. let target;
  201. let events;
  202. let listeners;
  203. let options;
  204. if (isString(args[0]) || Array.isArray(args[0])) {
  205. [events, listeners, options] = args;
  206. target = defaultWindow;
  207. } else {
  208. [target, events, listeners, options] = args;
  209. }
  210. if (!target)
  211. return noop;
  212. if (!Array.isArray(events))
  213. events = [events];
  214. if (!Array.isArray(listeners))
  215. listeners = [listeners];
  216. const cleanups = [];
  217. const cleanup = () => {
  218. cleanups.forEach((fn) => fn());
  219. cleanups.length = 0;
  220. };
  221. const register = (el2, event, listener, options2) => {
  222. el2.addEventListener(event, listener, options2);
  223. return () => el2.removeEventListener(event, listener, options2);
  224. };
  225. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el2, options2]) => {
  226. cleanup();
  227. if (!el2)
  228. return;
  229. cleanups.push(...events.flatMap((event) => {
  230. return listeners.map((listener) => register(el2, event, listener, options2));
  231. }));
  232. }, { immediate: true, flush: "post" });
  233. const stop = () => {
  234. stopWatch();
  235. cleanup();
  236. };
  237. tryOnScopeDispose(stop);
  238. return stop;
  239. }
  240. function useSupported(callback, sync = false) {
  241. const isSupported = ref();
  242. const update = () => isSupported.value = Boolean(callback());
  243. update();
  244. tryOnMounted(update, sync);
  245. return isSupported;
  246. }
  247. var _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  248. var globalKey = "__vueuse_ssr_handlers__";
  249. _global[globalKey] = _global[globalKey] || {};
  250. var handlers = _global[globalKey];
  251. function useDevicePixelRatio({
  252. window: window2 = defaultWindow
  253. } = {}) {
  254. const pixelRatio = ref(1);
  255. if (window2) {
  256. let observe = function() {
  257. pixelRatio.value = window2.devicePixelRatio;
  258. cleanup();
  259. media = window2.matchMedia(`(resolution: ${pixelRatio.value}dppx)`);
  260. media.addEventListener("change", observe, { once: true });
  261. }, cleanup = function() {
  262. media == null ? void 0 : media.removeEventListener("change", observe);
  263. };
  264. let media;
  265. observe();
  266. tryOnScopeDispose(cleanup);
  267. }
  268. return { pixelRatio };
  269. }
  270. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  271. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  272. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  273. var __objRest$2 = (source, exclude) => {
  274. var target = {};
  275. for (var prop in source)
  276. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  277. target[prop] = source[prop];
  278. if (source != null && __getOwnPropSymbols$g)
  279. for (var prop of __getOwnPropSymbols$g(source)) {
  280. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  281. target[prop] = source[prop];
  282. }
  283. return target;
  284. };
  285. function useResizeObserver(target, callback, options = {}) {
  286. const _a3 = options, { window: window2 = defaultWindow } = _a3, observerOptions = __objRest$2(_a3, ["window"]);
  287. let observer;
  288. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  289. const cleanup = () => {
  290. if (observer) {
  291. observer.disconnect();
  292. observer = void 0;
  293. }
  294. };
  295. const stopWatch = watch(() => unrefElement(target), (el2) => {
  296. cleanup();
  297. if (isSupported.value && window2 && el2) {
  298. observer = new ResizeObserver(callback);
  299. observer.observe(el2, observerOptions);
  300. }
  301. }, { immediate: true, flush: "post" });
  302. const stop = () => {
  303. cleanup();
  304. stopWatch();
  305. };
  306. tryOnScopeDispose(stop);
  307. return {
  308. isSupported,
  309. stop
  310. };
  311. }
  312. function useRafFn(fn, options = {}) {
  313. const {
  314. immediate = true,
  315. window: window2 = defaultWindow
  316. } = options;
  317. const isActive = ref(false);
  318. let previousFrameTimestamp = 0;
  319. let rafId = null;
  320. function loop(timestamp2) {
  321. if (!isActive.value || !window2)
  322. return;
  323. const delta = timestamp2 - previousFrameTimestamp;
  324. fn({ delta, timestamp: timestamp2 });
  325. previousFrameTimestamp = timestamp2;
  326. rafId = window2.requestAnimationFrame(loop);
  327. }
  328. function resume() {
  329. if (!isActive.value && window2) {
  330. isActive.value = true;
  331. rafId = window2.requestAnimationFrame(loop);
  332. }
  333. }
  334. function pause() {
  335. isActive.value = false;
  336. if (rafId != null && window2) {
  337. window2.cancelAnimationFrame(rafId);
  338. rafId = null;
  339. }
  340. }
  341. if (immediate)
  342. resume();
  343. tryOnScopeDispose(pause);
  344. return {
  345. isActive: readonly(isActive),
  346. pause,
  347. resume
  348. };
  349. }
  350. function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
  351. const { window: window2 = defaultWindow, box = "content-box" } = options;
  352. const isSVG = computed(() => {
  353. var _a3, _b;
  354. return (_b = (_a3 = unrefElement(target)) == null ? void 0 : _a3.namespaceURI) == null ? void 0 : _b.includes("svg");
  355. });
  356. const width = ref(initialSize.width);
  357. const height = ref(initialSize.height);
  358. useResizeObserver(target, ([entry]) => {
  359. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  360. if (window2 && isSVG.value) {
  361. const $elem = unrefElement(target);
  362. if ($elem) {
  363. const styles = window2.getComputedStyle($elem);
  364. width.value = parseFloat(styles.width);
  365. height.value = parseFloat(styles.height);
  366. }
  367. } else {
  368. if (boxSize) {
  369. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  370. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  371. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  372. } else {
  373. width.value = entry.contentRect.width;
  374. height.value = entry.contentRect.height;
  375. }
  376. }
  377. }, options);
  378. watch(() => unrefElement(target), (ele) => {
  379. width.value = ele ? initialSize.width : 0;
  380. height.value = ele ? initialSize.height : 0;
  381. });
  382. return {
  383. width,
  384. height
  385. };
  386. }
  387. var defaultState = {
  388. x: 0,
  389. y: 0,
  390. pointerId: 0,
  391. pressure: 0,
  392. tiltX: 0,
  393. tiltY: 0,
  394. width: 0,
  395. height: 0,
  396. twist: 0,
  397. pointerType: null
  398. };
  399. var keys = Object.keys(defaultState);
  400. var SwipeDirection;
  401. (function(SwipeDirection2) {
  402. SwipeDirection2["UP"] = "UP";
  403. SwipeDirection2["RIGHT"] = "RIGHT";
  404. SwipeDirection2["DOWN"] = "DOWN";
  405. SwipeDirection2["LEFT"] = "LEFT";
  406. SwipeDirection2["NONE"] = "NONE";
  407. })(SwipeDirection || (SwipeDirection = {}));
  408. var __defProp = Object.defineProperty;
  409. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  410. var __hasOwnProp = Object.prototype.hasOwnProperty;
  411. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  412. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  413. var __spreadValues = (a, b2) => {
  414. for (var prop in b2 || (b2 = {}))
  415. if (__hasOwnProp.call(b2, prop))
  416. __defNormalProp(a, prop, b2[prop]);
  417. if (__getOwnPropSymbols)
  418. for (var prop of __getOwnPropSymbols(b2)) {
  419. if (__propIsEnum.call(b2, prop))
  420. __defNormalProp(a, prop, b2[prop]);
  421. }
  422. return a;
  423. };
  424. var _TransitionPresets = {
  425. easeInSine: [0.12, 0, 0.39, 0],
  426. easeOutSine: [0.61, 1, 0.88, 1],
  427. easeInOutSine: [0.37, 0, 0.63, 1],
  428. easeInQuad: [0.11, 0, 0.5, 0],
  429. easeOutQuad: [0.5, 1, 0.89, 1],
  430. easeInOutQuad: [0.45, 0, 0.55, 1],
  431. easeInCubic: [0.32, 0, 0.67, 0],
  432. easeOutCubic: [0.33, 1, 0.68, 1],
  433. easeInOutCubic: [0.65, 0, 0.35, 1],
  434. easeInQuart: [0.5, 0, 0.75, 0],
  435. easeOutQuart: [0.25, 1, 0.5, 1],
  436. easeInOutQuart: [0.76, 0, 0.24, 1],
  437. easeInQuint: [0.64, 0, 0.78, 0],
  438. easeOutQuint: [0.22, 1, 0.36, 1],
  439. easeInOutQuint: [0.83, 0, 0.17, 1],
  440. easeInExpo: [0.7, 0, 0.84, 0],
  441. easeOutExpo: [0.16, 1, 0.3, 1],
  442. easeInOutExpo: [0.87, 0, 0.13, 1],
  443. easeInCirc: [0.55, 0, 1, 0.45],
  444. easeOutCirc: [0, 0.55, 0.45, 1],
  445. easeInOutCirc: [0.85, 0, 0.15, 1],
  446. easeInBack: [0.36, 0, 0.66, -0.56],
  447. easeOutBack: [0.34, 1.56, 0.64, 1],
  448. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  449. };
  450. var TransitionPresets = __spreadValues({
  451. linear: identity
  452. }, _TransitionPresets);
  453. function useWindowSize(options = {}) {
  454. const {
  455. window: window2 = defaultWindow,
  456. initialWidth = Infinity,
  457. initialHeight = Infinity,
  458. listenOrientation = true,
  459. includeScrollbar = true
  460. } = options;
  461. const width = ref(initialWidth);
  462. const height = ref(initialHeight);
  463. const update = () => {
  464. if (window2) {
  465. if (includeScrollbar) {
  466. width.value = window2.innerWidth;
  467. height.value = window2.innerHeight;
  468. } else {
  469. width.value = window2.document.documentElement.clientWidth;
  470. height.value = window2.document.documentElement.clientHeight;
  471. }
  472. }
  473. };
  474. update();
  475. tryOnMounted(update);
  476. useEventListener("resize", update, { passive: true });
  477. if (listenOrientation)
  478. useEventListener("orientationchange", update, { passive: true });
  479. return { width, height };
  480. }
  481. // node_modules/.pnpm/@tresjs+core@2.0.0-alpha.1_three@0.150.1+vue@3.2.47/node_modules/@tresjs/core/dist/tres.js
  482. var G = ref({ uuid: MathUtils.generateUUID() });
  483. var se = (e) => void Object.assign(G.value, e);
  484. var Ne = ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Ne || {});
  485. var qe = 45;
  486. var y;
  487. function ce() {
  488. const { state: e, setState: t, aspectRatio: r } = L();
  489. function o(a = "Perspective", s) {
  490. var l, p, m;
  491. if (a === "Perspective") {
  492. const { near: d, far: w, fov: v } = s || {
  493. near: 0.1,
  494. far: 1e3,
  495. fov: qe
  496. };
  497. y = new PerspectiveCamera(v, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, d, w), (p = e.cameras) == null || p.push(y);
  498. } else {
  499. const { left: d, right: w, top: v, bottom: g, near: E, far: x } = s || {
  500. left: -100,
  501. right: 100,
  502. top: 100,
  503. bottom: -100,
  504. near: 0.1,
  505. far: 1e3
  506. };
  507. y = new OrthographicCamera(d, w, v, g, E, x), (m = e.cameras) == null || m.push(y);
  508. }
  509. return e.camera = y, t("camera", e.camera), y;
  510. }
  511. function n() {
  512. var a;
  513. e.camera instanceof PerspectiveCamera && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (a = e.camera) == null || a.updateProjectionMatrix();
  514. }
  515. function i(a) {
  516. var s;
  517. (s = e.cameras) == null || s.push(a), a instanceof PerspectiveCamera && e.aspectRatio && (a.aspect = e.aspectRatio.value), a.updateProjectionMatrix(), t("camera", a);
  518. }
  519. function c() {
  520. e.cameras = [];
  521. }
  522. return watchEffect(() => {
  523. r != null && r.value && n();
  524. }), {
  525. activeCamera: toRef(e, "camera"),
  526. createCamera: o,
  527. updateCamera: n,
  528. pushCamera: i,
  529. clearCameras: c
  530. };
  531. }
  532. var ue = createEventHook();
  533. var le = createEventHook();
  534. var V = createEventHook();
  535. var b = new Clock();
  536. var A = 0;
  537. var k = 0;
  538. var { pause: Je, resume: Ke, isActive: Xe } = useRafFn(
  539. () => {
  540. ue.trigger({ delta: A, elapsed: k, clock: b }), le.trigger({ delta: A, elapsed: k, clock: b }), V.trigger({ delta: A, elapsed: k, clock: b });
  541. },
  542. { immediate: false }
  543. );
  544. V.on(() => {
  545. A = b.getDelta(), k = b.getElapsedTime();
  546. });
  547. function $() {
  548. return {
  549. onBeforeLoop: ue.on,
  550. onLoop: le.on,
  551. onAfterLoop: V.on,
  552. pause: Je,
  553. resume: Ke,
  554. isActive: Xe
  555. };
  556. }
  557. function Ye(e) {
  558. return e instanceof Color ? e : Array.isArray(e) ? new Color(...e) : new Color(e);
  559. }
  560. var B = {
  561. realistic: {
  562. outputEncoding: sRGBEncoding,
  563. toneMapping: ACESFilmicToneMapping,
  564. toneMappingExposure: 3,
  565. shadowMap: {
  566. enabled: true,
  567. type: PCFSoftShadowMap
  568. }
  569. }
  570. };
  571. var fe = (e, t) => {
  572. for (const r of Object.keys(t))
  573. t[r] instanceof Object && Object.assign(t[r], fe(e[r], t[r]));
  574. return Object.assign(e || {}, t), e;
  575. };
  576. var Qe = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  577. var Ze = et(Qe);
  578. function I(e) {
  579. return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
  580. }
  581. function et(e, t) {
  582. const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
  583. for (let n = 0; n < o.length; n++)
  584. r[o[n]] = true;
  585. return t ? (n) => !!r[n.toLowerCase()] : (n) => !!r[n];
  586. }
  587. var f = shallowRef();
  588. var H = ref(false);
  589. function tt(e, t, r) {
  590. const {
  591. alpha: o = true,
  592. antialias: n = true,
  593. depth: i,
  594. logarithmicDepthBuffer: c,
  595. failIfMajorPerformanceCaveat: a,
  596. precision: s,
  597. premultipliedAlpha: l,
  598. stencil: p,
  599. shadows: m = false,
  600. shadowMapType: d = PCFShadowMap,
  601. physicallyCorrectLights: w = false,
  602. useLegacyLights: v = false,
  603. outputEncoding: g = LinearEncoding,
  604. toneMapping: E = NoToneMapping,
  605. toneMappingExposure: x = 1,
  606. context: de = void 0,
  607. powerPreference: ve = "default",
  608. preserveDrawingBuffer: ge = false,
  609. clearColor: C,
  610. windowSize: we = false,
  611. preset: he = void 0
  612. } = toRefs(r), { setState: D } = L(), { width: N, height: q } = resolveUnref(we) ? useWindowSize() : useElementSize(t), { logError: ye } = j(), { pixelRatio: J } = useDevicePixelRatio(), { pause: Me, resume: Ce } = $(), F = computed(() => N.value / q.value), K = () => {
  613. f.value && (f.value.setSize(N.value, q.value), f.value.setPixelRatio(Math.min(J.value, 2)));
  614. }, X = () => {
  615. if (!f.value)
  616. return;
  617. const h2 = resolveUnref(he);
  618. if (h2) {
  619. h2 in B || ye("Renderer Preset must be one of these: " + Object.keys(B).join(", ")), fe(f.value, B[h2]);
  620. return;
  621. }
  622. f.value.shadowMap.enabled = resolveUnref(m), f.value.shadowMap.type = resolveUnref(d), f.value.toneMapping = resolveUnref(E) || NoToneMapping, f.value.toneMappingExposure = resolveUnref(x), f.value.outputEncoding = resolveUnref(g) || LinearEncoding, C != null && C.value && f.value.setClearColor(Ye(resolveUnref(C))), f.value.useLegacyLights = resolveUnref(v);
  623. }, be = () => {
  624. const h2 = unrefElement(e);
  625. h2 && (f.value = new WebGLRenderer({
  626. canvas: h2,
  627. alpha: resolveUnref(o),
  628. antialias: resolveUnref(n),
  629. context: resolveUnref(de),
  630. depth: resolveUnref(i),
  631. failIfMajorPerformanceCaveat: resolveUnref(a),
  632. logarithmicDepthBuffer: resolveUnref(c),
  633. powerPreference: resolveUnref(ve),
  634. precision: resolveUnref(s),
  635. stencil: resolveUnref(p),
  636. preserveDrawingBuffer: resolveUnref(ge),
  637. premultipliedAlpha: resolveUnref(l)
  638. }), D("renderer", f.value), D("clock", new Clock()), D("aspectRatio", F), X(), K(), Ce(), H.value = true);
  639. }, Le = () => {
  640. f.value && (f.value.dispose(), f.value = void 0, H.value = false, Me());
  641. };
  642. return watch([F, J], K), watch(
  643. [m, d, g, v, E, x, C],
  644. X
  645. ), watch(
  646. () => [e, t],
  647. () => {
  648. unrefElement(e) && unrefElement(t) && be();
  649. },
  650. { immediate: true, deep: true }
  651. ), {
  652. renderer: f,
  653. isReady: H,
  654. dispose: Le,
  655. aspectRatio: F
  656. };
  657. }
  658. var pe = (e) => !!e && e.constructor === Array;
  659. function nt(e) {
  660. const t = { nodes: {}, materials: {} };
  661. return e && e.traverse((r) => {
  662. r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
  663. }), t;
  664. }
  665. async function dt(e, t, r, o, n) {
  666. const { logError: i } = j(), c = new e();
  667. n && n(c), r && r(c);
  668. const s = (Array.isArray(t) ? t : [t]).map(
  669. (l) => new Promise((p, m) => {
  670. c.load(
  671. l,
  672. (d) => {
  673. d.scene && Object.assign(d, nt(d.scene)), p(d);
  674. },
  675. o,
  676. (d) => m(i("[useLoader] - Failed to load resource", d))
  677. );
  678. })
  679. );
  680. return pe(t) ? await Promise.all(s) : await s[0];
  681. }
  682. var R = shallowReactive({
  683. camera: void 0,
  684. cameras: [],
  685. aspectRatio: computed(() => window.innerWidth / window.innerHeight)
  686. });
  687. function L() {
  688. function e(r) {
  689. return R[r];
  690. }
  691. function t(r, o) {
  692. R[r] = o;
  693. }
  694. return {
  695. state: R,
  696. ...toRefs(R),
  697. getState: e,
  698. setState: t
  699. };
  700. }
  701. var ee = shallowRef(new Raycaster());
  702. var S = ref(new Vector2());
  703. var at = ref(null);
  704. function me() {
  705. const { setState: e } = L();
  706. e("raycaster", ee.value), e("pointer", S), e("currentInstance", at);
  707. function t(r) {
  708. S.value.x = r.clientX / window.innerWidth * 2 - 1, S.value.y = -(r.clientY / window.innerHeight) * 2 + 1;
  709. }
  710. return window.addEventListener("pointermove", t), {
  711. raycaster: ee,
  712. pointer: S
  713. };
  714. }
  715. var te = "[TresJS ▲ ■ ●] ";
  716. function j() {
  717. function e(o, n) {
  718. console.error(`${te} ${o}`, n || "");
  719. }
  720. function t(o) {
  721. console.warn(`${te} ${o}`);
  722. }
  723. function r(o, n) {
  724. }
  725. return {
  726. logError: e,
  727. logWarning: t,
  728. logMessage: r
  729. };
  730. }
  731. var { logWarning: rt } = j();
  732. function ot(e) {
  733. for (const t in e)
  734. if (t.indexOf("on") === 0)
  735. return true;
  736. return false;
  737. }
  738. var T = null;
  739. var it = {
  740. createElement(e, t, r, o) {
  741. if (e === "template" || Ze(e))
  742. return null;
  743. let n;
  744. if (o === null && (o = {}), o != null && o.args ? n = new G.value[e.replace("Tres", "")](...o.args) : n = new G.value[e.replace("Tres", "")](), n.isCamera) {
  745. (!(o != null && o.position) || o != null && o.position.every((c) => c == 0)) && rt(
  746. // eslint-disable-next-line max-len
  747. "Camera is positioned at the center of the scene [0,0,0], if this is not intentional try setting a position if your scene seems empty 🤗"
  748. );
  749. const { pushCamera: i } = ce();
  750. i(n);
  751. }
  752. return (o == null ? void 0 : o.attach) === void 0 && (n.isMaterial ? n.attach = "material" : n.isBufferGeometry && (n.attach = "geometry")), n;
  753. },
  754. insert(e, t, r) {
  755. if (T === null && t.isScene && (T = t), t === null && (t = T), t != null && t.isObject3D && (e != null && e.isObject3D)) {
  756. const a = r ? t.children.indexOf(r) : 0;
  757. e.parent = t, t.children.splice(a, 0, e), e.dispatchEvent({ type: "added" });
  758. } else
  759. typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
  760. const { onLoop: o } = $();
  761. let n = null, i = null;
  762. const { raycaster: c } = me();
  763. e && e instanceof Mesh && ot(e) && (o(() => {
  764. var a, s, l;
  765. if (t != null && t.children && e && c) {
  766. const p = c.value.intersectObjects(t.children);
  767. p.length > 0 && p[0].object.uuid === e.uuid ? (i = p[0], (n === null || n.object.uuid !== (i == null ? void 0 : i.object.uuid)) && ((a = e.onPointerEnter) == null || a.call(e, i)), (s = e.onPointerMove) == null || s.call(e, i)) : (i = null, n !== null && ((l = e.onPointerLeave) == null || l.call(e, n))), n = i;
  768. }
  769. }), useEventListener(window, "click", () => {
  770. var a;
  771. i !== null && ((a = e.onClick) == null || a.call(e, i));
  772. }));
  773. },
  774. remove(e) {
  775. if (!e)
  776. return;
  777. const t = e.parentNode;
  778. t && t.removeChild(e);
  779. },
  780. patchProp(e, t, r, o) {
  781. if (e) {
  782. let n = e, i = t;
  783. const c = I(i);
  784. let a = n == null ? void 0 : n[c];
  785. if (e.parent || (e.parent = T), i.includes("-") && a === void 0) {
  786. const l = i.split("-");
  787. a = l.reduce((p, m) => p[I(m)], n), i = l.pop(), a != null && a.set || (n = l.reduce((p, m) => p[I(m)], n));
  788. }
  789. let s = o;
  790. if (s === "" && (s = true), isFunction(a))
  791. return;
  792. !(a != null && a.set) && !isFunction(a) ? n[c] = s : a.constructor === s.constructor && (a != null && a.copy) ? a == null || a.copy(s) : Array.isArray(s) ? a.set(...s) : !a.isColor && a.setScalar ? a.setScalar(s) : a.set(s);
  793. }
  794. },
  795. parentNode(e) {
  796. return (e == null ? void 0 : e.parent) || null;
  797. },
  798. createText: () => void 0,
  799. createComment: () => void 0,
  800. setText: () => void 0,
  801. setElementText: () => void 0,
  802. nextSibling: () => void 0,
  803. querySelector: () => void 0,
  804. setScopeId: () => void 0,
  805. cloneNode: () => void 0,
  806. insertStaticContent: () => void 0
  807. };
  808. var { createApp: st } = createRenderer(it);
  809. var ct = (e) => {
  810. const t = st(r);
  811. function r() {
  812. return e && e.default ? e.default() : [];
  813. }
  814. return t;
  815. };
  816. se(three_module_exports);
  817. var { logWarning: ut } = j();
  818. var lt = defineComponent({
  819. name: "TresCanvas",
  820. props: [
  821. "shadows",
  822. "shadowMapType",
  823. "physicallyCorrectLights",
  824. "useLegacyLights",
  825. "outputEncoding",
  826. "toneMapping",
  827. "toneMappingExposure",
  828. "context",
  829. "powerPreference",
  830. "preserveDrawingBuffer",
  831. "clearColor",
  832. "windowSize",
  833. "preset"
  834. ],
  835. setup(e, { slots: t, expose: r }) {
  836. e.physicallyCorrectLights === true && ut("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
  837. const o = ref(), n = ref(), i = new Scene(), { setState: c } = L();
  838. c("scene", i);
  839. function a() {
  840. const { renderer: p } = tt(n, o, e), { activeCamera: m } = ce(), { onLoop: d } = $(), { raycaster: w, pointer: v } = me();
  841. d(() => {
  842. var g;
  843. m.value && (w.value.setFromCamera(v.value, m.value), (g = p.value) == null || g.render(i, m.value));
  844. });
  845. }
  846. watch(n, a);
  847. let s;
  848. function l() {
  849. s = ct(t), s.provide("useTres", L()), s.provide("extend", se), s.mount(i);
  850. }
  851. return l(), r({
  852. scene: i
  853. }), () => h(
  854. h(
  855. "div",
  856. {
  857. ref: o,
  858. style: {
  859. position: "relative",
  860. width: "100%",
  861. height: "100%",
  862. pointerEvents: "auto",
  863. touchAction: "none"
  864. }
  865. },
  866. [
  867. h(
  868. "div",
  869. {
  870. style: {
  871. width: "100%",
  872. height: "100%"
  873. }
  874. },
  875. [
  876. h("canvas", {
  877. ref: n,
  878. style: {
  879. display: "block",
  880. width: "100%",
  881. height: "100%",
  882. position: e.windowSize ? "fixed" : "absolute",
  883. top: 0,
  884. left: 0
  885. }
  886. })
  887. ]
  888. )
  889. ]
  890. )
  891. );
  892. }
  893. });
  894. // node_modules/.pnpm/@tresjs+cientos@2.0.0-alpha.5_three@0.150.1/node_modules/@tresjs/cientos/dist/trescientos.js
  895. function Np(b2, i) {
  896. for (var r = 0; r < i.length; r++) {
  897. const s = i[r];
  898. if (typeof s != "string" && !Array.isArray(s)) {
  899. for (const a in s)
  900. if (a !== "default" && !(a in b2)) {
  901. const c = Object.getOwnPropertyDescriptor(s, a);
  902. c && Object.defineProperty(b2, a, c.get ? c : {
  903. enumerable: true,
  904. get: () => s[a]
  905. });
  906. }
  907. }
  908. }
  909. return Object.freeze(Object.defineProperty(b2, Symbol.toStringTag, { value: "Module" }));
  910. }
  911. function Zi(b2) {
  912. return Zi = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
  913. return typeof i;
  914. } : function(i) {
  915. return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
  916. }, Zi(b2);
  917. }
  918. function Fp(b2, i) {
  919. if (Zi(b2) !== "object" || b2 === null)
  920. return b2;
  921. var r = b2[Symbol.toPrimitive];
  922. if (r !== void 0) {
  923. var s = r.call(b2, i || "default");
  924. if (Zi(s) !== "object")
  925. return s;
  926. throw new TypeError("@@toPrimitive must return a primitive value.");
  927. }
  928. return (i === "string" ? String : Number)(b2);
  929. }
  930. function Bp(b2) {
  931. var i = Fp(b2, "string");
  932. return Zi(i) === "symbol" ? i : String(i);
  933. }
  934. function T2(b2, i, r) {
  935. return i = Bp(i), i in b2 ? Object.defineProperty(b2, i, {
  936. value: r,
  937. enumerable: true,
  938. configurable: true,
  939. writable: true
  940. }) : b2[i] = r, b2;
  941. }
  942. var ut2 = Uint8Array;
  943. var rn = Uint16Array;
  944. var oo = Uint32Array;
  945. var ja = new ut2([
  946. 0,
  947. 0,
  948. 0,
  949. 0,
  950. 0,
  951. 0,
  952. 0,
  953. 0,
  954. 1,
  955. 1,
  956. 1,
  957. 1,
  958. 2,
  959. 2,
  960. 2,
  961. 2,
  962. 3,
  963. 3,
  964. 3,
  965. 3,
  966. 4,
  967. 4,
  968. 4,
  969. 4,
  970. 5,
  971. 5,
  972. 5,
  973. 5,
  974. 0,
  975. /* unused */
  976. 0,
  977. 0,
  978. /* impossible */
  979. 0
  980. ]);
  981. var za = new ut2([
  982. 0,
  983. 0,
  984. 0,
  985. 0,
  986. 1,
  987. 1,
  988. 2,
  989. 2,
  990. 3,
  991. 3,
  992. 4,
  993. 4,
  994. 5,
  995. 5,
  996. 6,
  997. 6,
  998. 7,
  999. 7,
  1000. 8,
  1001. 8,
  1002. 9,
  1003. 9,
  1004. 10,
  1005. 10,
  1006. 11,
  1007. 11,
  1008. 12,
  1009. 12,
  1010. 13,
  1011. 13,
  1012. /* unused */
  1013. 0,
  1014. 0
  1015. ]);
  1016. var jp = new ut2([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  1017. var Ua = function(b2, i) {
  1018. for (var r = new rn(31), s = 0; s < 31; ++s)
  1019. r[s] = i += 1 << b2[s - 1];
  1020. for (var a = new oo(r[30]), s = 1; s < 30; ++s)
  1021. for (var c = r[s]; c < r[s + 1]; ++c)
  1022. a[c] = c - r[s] << 5 | s;
  1023. return [r, a];
  1024. };
  1025. var Ga = Ua(ja, 2);
  1026. var Ha = Ga[0];
  1027. var zp = Ga[1];
  1028. Ha[28] = 258, zp[258] = 28;
  1029. var Up = Ua(za, 0);
  1030. var Gp = Up[0];
  1031. var ao = new rn(32768);
  1032. for (Ce = 0; Ce < 32768; ++Ce) {
  1033. tn = (Ce & 43690) >>> 1 | (Ce & 21845) << 1;
  1034. tn = (tn & 52428) >>> 2 | (tn & 13107) << 2, tn = (tn & 61680) >>> 4 | (tn & 3855) << 4, ao[Ce] = ((tn & 65280) >>> 8 | (tn & 255) << 8) >>> 1;
  1035. }
  1036. var tn;
  1037. var Ce;
  1038. var Xi = function(b2, i, r) {
  1039. for (var s = b2.length, a = 0, c = new rn(i); a < s; ++a)
  1040. ++c[b2[a] - 1];
  1041. var u = new rn(i);
  1042. for (a = 0; a < i; ++a)
  1043. u[a] = u[a - 1] + c[a - 1] << 1;
  1044. var h2;
  1045. if (r) {
  1046. h2 = new rn(1 << i);
  1047. var d = 15 - i;
  1048. for (a = 0; a < s; ++a)
  1049. if (b2[a])
  1050. for (var g = a << 4 | b2[a], w = i - b2[a], _ = u[b2[a] - 1]++ << w, y2 = _ | (1 << w) - 1; _ <= y2; ++_)
  1051. h2[ao[_] >>> d] = g;
  1052. } else
  1053. for (h2 = new rn(s), a = 0; a < s; ++a)
  1054. b2[a] && (h2[a] = ao[u[b2[a] - 1]++] >>> 15 - b2[a]);
  1055. return h2;
  1056. };
  1057. var es = new ut2(288);
  1058. for (Ce = 0; Ce < 144; ++Ce)
  1059. es[Ce] = 8;
  1060. var Ce;
  1061. for (Ce = 144; Ce < 256; ++Ce)
  1062. es[Ce] = 9;
  1063. var Ce;
  1064. for (Ce = 256; Ce < 280; ++Ce)
  1065. es[Ce] = 7;
  1066. var Ce;
  1067. for (Ce = 280; Ce < 288; ++Ce)
  1068. es[Ce] = 8;
  1069. var Ce;
  1070. var Ka = new ut2(32);
  1071. for (Ce = 0; Ce < 32; ++Ce)
  1072. Ka[Ce] = 5;
  1073. var Ce;
  1074. var Hp = Xi(es, 9, 1);
  1075. var Kp = Xi(Ka, 5, 1);
  1076. var Yr = function(b2) {
  1077. for (var i = b2[0], r = 1; r < b2.length; ++r)
  1078. b2[r] > i && (i = b2[r]);
  1079. return i;
  1080. };
  1081. var _t = function(b2, i, r) {
  1082. var s = i / 8 | 0;
  1083. return (b2[s] | b2[s + 1] << 8) >> (i & 7) & r;
  1084. };
  1085. var qr = function(b2, i) {
  1086. var r = i / 8 | 0;
  1087. return (b2[r] | b2[r + 1] << 8 | b2[r + 2] << 16) >> (i & 7);
  1088. };
  1089. var $p = function(b2) {
  1090. return (b2 / 8 | 0) + (b2 & 7 && 1);
  1091. };
  1092. var Xp = function(b2, i, r) {
  1093. (i == null || i < 0) && (i = 0), (r == null || r > b2.length) && (r = b2.length);
  1094. var s = new (b2 instanceof rn ? rn : b2 instanceof oo ? oo : ut2)(r - i);
  1095. return s.set(b2.subarray(i, r)), s;
  1096. };
  1097. var Yp = function(b2, i, r) {
  1098. var s = b2.length;
  1099. if (!s || r && !r.l && s < 5)
  1100. return i || new ut2(0);
  1101. var a = !i || r, c = !r || r.i;
  1102. r || (r = {}), i || (i = new ut2(s * 3));
  1103. var u = function(Ve) {
  1104. var Ne2 = i.length;
  1105. if (Ve > Ne2) {
  1106. var we = new ut2(Math.max(Ne2 * 2, Ve));
  1107. we.set(i), i = we;
  1108. }
  1109. }, h2 = r.f || 0, d = r.p || 0, g = r.b || 0, w = r.l, _ = r.d, y2 = r.m, C = r.n, I2 = s * 8;
  1110. do {
  1111. if (!w) {
  1112. r.f = h2 = _t(b2, d, 1);
  1113. var S2 = _t(b2, d + 1, 3);
  1114. if (d += 3, S2)
  1115. if (S2 == 1)
  1116. w = Hp, _ = Kp, y2 = 9, C = 5;
  1117. else if (S2 == 2) {
  1118. var V2 = _t(b2, d, 31) + 257, D = _t(b2, d + 10, 15) + 4, Y = V2 + _t(b2, d + 5, 31) + 1;
  1119. d += 14;
  1120. for (var G2 = new ut2(Y), N = new ut2(19), O = 0; O < D; ++O)
  1121. N[jp[O]] = _t(b2, d + O * 3, 7);
  1122. d += D * 3;
  1123. for (var H2 = Yr(N), K = (1 << H2) - 1, q = Xi(N, H2, 1), O = 0; O < Y; ) {
  1124. var ue2 = q[_t(b2, d, K)];
  1125. d += ue2 & 15;
  1126. var R2 = ue2 >>> 4;
  1127. if (R2 < 16)
  1128. G2[O++] = R2;
  1129. else {
  1130. var ge = 0, ce2 = 0;
  1131. for (R2 == 16 ? (ce2 = 3 + _t(b2, d, 3), d += 2, ge = G2[O - 1]) : R2 == 17 ? (ce2 = 3 + _t(b2, d, 7), d += 3) : R2 == 18 && (ce2 = 11 + _t(b2, d, 127), d += 7); ce2--; )
  1132. G2[O++] = ge;
  1133. }
  1134. }
  1135. var me2 = G2.subarray(0, V2), he = G2.subarray(V2);
  1136. y2 = Yr(me2), C = Yr(he), w = Xi(me2, y2, 1), _ = Xi(he, C, 1);
  1137. } else
  1138. throw "invalid block type";
  1139. else {
  1140. var R2 = $p(d) + 4, j2 = b2[R2 - 4] | b2[R2 - 3] << 8, F = R2 + j2;
  1141. if (F > s) {
  1142. if (c)
  1143. throw "unexpected EOF";
  1144. break;
  1145. }
  1146. a && u(g + j2), i.set(b2.subarray(R2, F), g), r.b = g += j2, r.p = d = F * 8;
  1147. continue;
  1148. }
  1149. if (d > I2) {
  1150. if (c)
  1151. throw "unexpected EOF";
  1152. break;
  1153. }
  1154. }
  1155. a && u(g + 131072);
  1156. for (var ee2 = (1 << y2) - 1, X = (1 << C) - 1, Pe = d; ; Pe = d) {
  1157. var ge = w[qr(b2, d) & ee2], fe2 = ge >>> 4;
  1158. if (d += ge & 15, d > I2) {
  1159. if (c)
  1160. throw "unexpected EOF";
  1161. break;
  1162. }
  1163. if (!ge)
  1164. throw "invalid length/literal";
  1165. if (fe2 < 256)
  1166. i[g++] = fe2;
  1167. else if (fe2 == 256) {
  1168. Pe = d, w = null;
  1169. break;
  1170. } else {
  1171. var ae = fe2 - 254;
  1172. if (fe2 > 264) {
  1173. var O = fe2 - 257, ne = ja[O];
  1174. ae = _t(b2, d, (1 << ne) - 1) + Ha[O], d += ne;
  1175. }
  1176. var be = _[qr(b2, d) & X], M = be >>> 4;
  1177. if (!be)
  1178. throw "invalid distance";
  1179. d += be & 15;
  1180. var he = Gp[M];
  1181. if (M > 3) {
  1182. var ne = za[M];
  1183. he += qr(b2, d) & (1 << ne) - 1, d += ne;
  1184. }
  1185. if (d > I2) {
  1186. if (c)
  1187. throw "unexpected EOF";
  1188. break;
  1189. }
  1190. a && u(g + 131072);
  1191. for (var le2 = g + ae; g < le2; g += 4)
  1192. i[g] = i[g - he], i[g + 1] = i[g + 1 - he], i[g + 2] = i[g + 2 - he], i[g + 3] = i[g + 3 - he];
  1193. g = le2;
  1194. }
  1195. }
  1196. r.l = w, r.p = Pe, r.b = g, w && (h2 = 1, r.m = y2, r.d = _, r.n = C);
  1197. } while (!h2);
  1198. return g == i.length ? i : Xp(i, 0, g);
  1199. };
  1200. var qp = new ut2(0);
  1201. var Qp = function(b2) {
  1202. if ((b2[0] & 15) != 8 || b2[0] >>> 4 > 7 || (b2[0] << 8 | b2[1]) % 31)
  1203. throw "invalid zlib data";
  1204. if (b2[1] & 32)
  1205. throw "invalid zlib data: preset dictionaries not supported";
  1206. };
  1207. function Zp(b2, i) {
  1208. return Yp((Qp(b2), b2.subarray(2, -4)), i);
  1209. }
  1210. var Wp = typeof TextDecoder < "u" && new TextDecoder();
  1211. var Jp = 0;
  1212. try {
  1213. Wp.decode(qp, { stream: true }), Jp = 1;
  1214. } catch {
  1215. }
  1216. var eu = class extends Object3D {
  1217. // events
  1218. constructor(i, r) {
  1219. super(), T2(this, "isTransformControls", true), T2(this, "visible", false), T2(this, "domElement", void 0), T2(this, "raycaster", new Raycaster()), T2(this, "gizmo", void 0), T2(this, "plane", void 0), T2(this, "tempVector", new Vector3()), T2(this, "tempVector2", new Vector3()), T2(this, "tempQuaternion", new Quaternion()), T2(this, "unit", {
  1220. X: new Vector3(1, 0, 0),
  1221. Y: new Vector3(0, 1, 0),
  1222. Z: new Vector3(0, 0, 1)
  1223. }), T2(this, "pointStart", new Vector3()), T2(this, "pointEnd", new Vector3()), T2(this, "offset", new Vector3()), T2(this, "rotationAxis", new Vector3()), T2(this, "startNorm", new Vector3()), T2(this, "endNorm", new Vector3()), T2(this, "rotationAngle", 0), T2(this, "cameraPosition", new Vector3()), T2(this, "cameraQuaternion", new Quaternion()), T2(this, "cameraScale", new Vector3()), T2(this, "parentPosition", new Vector3()), T2(this, "parentQuaternion", new Quaternion()), T2(this, "parentQuaternionInv", new Quaternion()), T2(this, "parentScale", new Vector3()), T2(this, "worldPositionStart", new Vector3()), T2(this, "worldQuaternionStart", new Quaternion()), T2(this, "worldScaleStart", new Vector3()), T2(this, "worldPosition", new Vector3()), T2(this, "worldQuaternion", new Quaternion()), T2(this, "worldQuaternionInv", new Quaternion()), T2(this, "worldScale", new Vector3()), T2(this, "eye", new Vector3()), T2(this, "positionStart", new Vector3()), T2(this, "quaternionStart", new Quaternion()), T2(this, "scaleStart", new Vector3()), T2(this, "camera", void 0), T2(this, "object", void 0), T2(this, "enabled", true), T2(this, "axis", null), T2(this, "mode", "translate"), T2(this, "translationSnap", null), T2(this, "rotationSnap", null), T2(this, "scaleSnap", null), T2(this, "space", "world"), T2(this, "size", 1), T2(this, "dragging", false), T2(this, "showX", true), T2(this, "showY", true), T2(this, "showZ", true), T2(this, "changeEvent", {
  1224. type: "change"
  1225. }), T2(this, "mouseDownEvent", {
  1226. type: "mouseDown",
  1227. mode: this.mode
  1228. }), T2(this, "mouseUpEvent", {
  1229. type: "mouseUp",
  1230. mode: this.mode
  1231. }), T2(this, "objectChangeEvent", {
  1232. type: "objectChange"
  1233. }), T2(this, "intersectObjectWithRay", (a, c, u) => {
  1234. const h2 = c.intersectObject(a, true);
  1235. for (let d = 0; d < h2.length; d++)
  1236. if (h2[d].object.visible || u)
  1237. return h2[d];
  1238. return false;
  1239. }), T2(this, "attach", (a) => (this.object = a, this.visible = true, this)), T2(this, "detach", () => (this.object = void 0, this.visible = false, this.axis = null, this)), T2(this, "reset", () => this.enabled ? (this.dragging && this.object !== void 0 && (this.object.position.copy(this.positionStart), this.object.quaternion.copy(this.quaternionStart), this.object.scale.copy(this.scaleStart), this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent), this.pointStart.copy(this.pointEnd)), this) : this), T2(this, "updateMatrixWorld", () => {
  1240. 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();
  1241. }), T2(this, "pointerHover", (a) => {
  1242. if (this.object === void 0 || this.dragging === true)
  1243. return;
  1244. this.raycaster.setFromCamera(a, this.camera);
  1245. const c = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);
  1246. c ? this.axis = c.object.name : this.axis = null;
  1247. }), T2(this, "pointerDown", (a) => {
  1248. if (!(this.object === void 0 || this.dragging === true || a.button !== 0) && this.axis !== null) {
  1249. this.raycaster.setFromCamera(a, this.camera);
  1250. const c = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  1251. if (c) {
  1252. let u = this.space;
  1253. if (this.mode === "scale" ? u = "local" : (this.axis === "E" || this.axis === "XYZE" || this.axis === "XYZ") && (u = "world"), u === "local" && this.mode === "rotate") {
  1254. const h2 = this.rotationSnap;
  1255. this.axis === "X" && h2 && (this.object.rotation.x = Math.round(this.object.rotation.x / h2) * h2), this.axis === "Y" && h2 && (this.object.rotation.y = Math.round(this.object.rotation.y / h2) * h2), this.axis === "Z" && h2 && (this.object.rotation.z = Math.round(this.object.rotation.z / h2) * h2);
  1256. }
  1257. 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);
  1258. }
  1259. this.dragging = true, this.mouseDownEvent.mode = this.mode, this.dispatchEvent(this.mouseDownEvent);
  1260. }
  1261. }), T2(this, "pointerMove", (a) => {
  1262. const c = this.axis, u = this.mode, h2 = this.object;
  1263. let d = this.space;
  1264. if (u === "scale" ? d = "local" : (c === "E" || c === "XYZE" || c === "XYZ") && (d = "world"), h2 === void 0 || c === null || this.dragging === false || a.button !== -1)
  1265. return;
  1266. this.raycaster.setFromCamera(a, this.camera);
  1267. const g = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  1268. if (g) {
  1269. if (this.pointEnd.copy(g.point).sub(this.worldPositionStart), u === "translate")
  1270. this.offset.copy(this.pointEnd).sub(this.pointStart), d === "local" && c !== "XYZ" && this.offset.applyQuaternion(this.worldQuaternionInv), c.indexOf("X") === -1 && (this.offset.x = 0), c.indexOf("Y") === -1 && (this.offset.y = 0), c.indexOf("Z") === -1 && (this.offset.z = 0), d === "local" && c !== "XYZ" ? this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale) : this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale), h2.position.copy(this.offset).add(this.positionStart), this.translationSnap && (d === "local" && (h2.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()), c.search("X") !== -1 && (h2.position.x = Math.round(h2.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h2.position.y = Math.round(h2.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h2.position.z = Math.round(h2.position.z / this.translationSnap) * this.translationSnap), h2.position.applyQuaternion(this.quaternionStart)), d === "world" && (h2.parent && h2.position.add(this.tempVector.setFromMatrixPosition(h2.parent.matrixWorld)), c.search("X") !== -1 && (h2.position.x = Math.round(h2.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h2.position.y = Math.round(h2.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h2.position.z = Math.round(h2.position.z / this.translationSnap) * this.translationSnap), h2.parent && h2.position.sub(this.tempVector.setFromMatrixPosition(h2.parent.matrixWorld))));
  1271. else if (u === "scale") {
  1272. if (c.search("XYZ") !== -1) {
  1273. let w = this.pointEnd.length() / this.pointStart.length();
  1274. this.pointEnd.dot(this.pointStart) < 0 && (w *= -1), this.tempVector2.set(w, w, w);
  1275. } else
  1276. 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);
  1277. h2.scale.copy(this.scaleStart).multiply(this.tempVector2), this.scaleSnap && this.object && (c.search("X") !== -1 && (this.object.scale.x = Math.round(h2.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Y") !== -1 && (h2.scale.y = Math.round(h2.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Z") !== -1 && (h2.scale.z = Math.round(h2.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
  1278. } else if (u === "rotate") {
  1279. this.offset.copy(this.pointEnd).sub(this.pointStart);
  1280. const w = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));
  1281. c === "E" ? (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this.startNorm.copy(this.pointStart).normalize(), this.endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this.endNorm.cross(this.startNorm).dot(this.eye) < 0 ? 1 : -1) : c === "XYZE" ? (this.rotationAxis.copy(this.offset).cross(this.eye).normalize(), this.rotationAngle = this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye)) * w) : (c === "X" || c === "Y" || c === "Z") && (this.rotationAxis.copy(this.unit[c]), this.tempVector.copy(this.unit[c]), d === "local" && this.tempVector.applyQuaternion(this.worldQuaternion), this.rotationAngle = this.offset.dot(this.tempVector.cross(this.eye).normalize()) * w), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), d === "local" && c !== "E" && c !== "XYZE" ? (h2.quaternion.copy(this.quaternionStart), h2.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this.parentQuaternionInv), h2.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), h2.quaternion.multiply(this.quaternionStart).normalize());
  1282. }
  1283. this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent);
  1284. }
  1285. }), T2(this, "pointerUp", (a) => {
  1286. a.button === 0 && (this.dragging && this.axis !== null && (this.mouseUpEvent.mode = this.mode, this.dispatchEvent(this.mouseUpEvent)), this.dragging = false, this.axis = null);
  1287. }), T2(this, "getPointer", (a) => {
  1288. var c;
  1289. if (this.domElement && (c = this.domElement.ownerDocument) !== null && c !== void 0 && c.pointerLockElement)
  1290. return {
  1291. x: 0,
  1292. y: 0,
  1293. button: a.button
  1294. };
  1295. {
  1296. var u;
  1297. const h2 = a.changedTouches ? a.changedTouches[0] : a, d = (u = this.domElement) === null || u === void 0 ? void 0 : u.getBoundingClientRect();
  1298. return {
  1299. x: (h2.clientX - d.left) / d.width * 2 - 1,
  1300. y: -(h2.clientY - d.top) / d.height * 2 + 1,
  1301. button: a.button
  1302. };
  1303. }
  1304. }), T2(this, "onPointerHover", (a) => {
  1305. if (this.enabled)
  1306. switch (a.pointerType) {
  1307. case "mouse":
  1308. case "pen":
  1309. this.pointerHover(this.getPointer(a));
  1310. break;
  1311. }
  1312. }), T2(this, "onPointerDown", (a) => {
  1313. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "none", this.domElement.ownerDocument.addEventListener("pointermove", this.onPointerMove), this.pointerHover(this.getPointer(a)), this.pointerDown(this.getPointer(a)));
  1314. }), T2(this, "onPointerMove", (a) => {
  1315. this.enabled && this.pointerMove(this.getPointer(a));
  1316. }), T2(this, "onPointerUp", (a) => {
  1317. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "", this.domElement.ownerDocument.removeEventListener("pointermove", this.onPointerMove), this.pointerUp(this.getPointer(a)));
  1318. }), T2(this, "getMode", () => this.mode), T2(this, "setMode", (a) => {
  1319. this.mode = a;
  1320. }), T2(this, "setTranslationSnap", (a) => {
  1321. this.translationSnap = a;
  1322. }), T2(this, "setRotationSnap", (a) => {
  1323. this.rotationSnap = a;
  1324. }), T2(this, "setScaleSnap", (a) => {
  1325. this.scaleSnap = a;
  1326. }), T2(this, "setSize", (a) => {
  1327. this.size = a;
  1328. }), T2(this, "setSpace", (a) => {
  1329. this.space = a;
  1330. }), T2(this, "update", () => {
  1331. console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.");
  1332. }), T2(this, "connect", (a) => {
  1333. a === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), this.domElement = a, this.domElement.addEventListener("pointerdown", this.onPointerDown), this.domElement.addEventListener("pointermove", this.onPointerHover), this.domElement.ownerDocument.addEventListener("pointerup", this.onPointerUp);
  1334. }), T2(this, "dispose", () => {
  1335. var a, c, u, h2, d, g;
  1336. (a = this.domElement) === null || a === void 0 || a.removeEventListener("pointerdown", this.onPointerDown), (c = this.domElement) === null || c === void 0 || c.removeEventListener("pointermove", this.onPointerHover), (u = this.domElement) === null || u === void 0 || (h2 = u.ownerDocument) === null || h2 === void 0 || h2.removeEventListener("pointermove", this.onPointerMove), (d = this.domElement) === null || d === void 0 || (g = d.ownerDocument) === null || g === void 0 || g.removeEventListener("pointerup", this.onPointerUp), this.traverse((w) => {
  1337. const _ = w;
  1338. _.geometry && _.geometry.dispose(), _.material && _.material.dispose();
  1339. });
  1340. }), this.domElement = r, this.camera = i, this.gizmo = new tu(), this.add(this.gizmo), this.plane = new nu(), this.add(this.plane);
  1341. const s = (a, c) => {
  1342. let u = c;
  1343. Object.defineProperty(this, a, {
  1344. get: function() {
  1345. return u !== void 0 ? u : c;
  1346. },
  1347. set: function(h2) {
  1348. u !== h2 && (u = h2, this.plane[a] = h2, this.gizmo[a] = h2, this.dispatchEvent({
  1349. type: a + "-changed",
  1350. value: h2
  1351. }), this.dispatchEvent(this.changeEvent));
  1352. }
  1353. }), this[a] = c, this.plane[a] = c, this.gizmo[a] = c;
  1354. };
  1355. s("camera", this.camera), s("object", this.object), s("enabled", this.enabled), s("axis", this.axis), s("mode", this.mode), s("translationSnap", this.translationSnap), s("rotationSnap", this.rotationSnap), s("scaleSnap", this.scaleSnap), s("space", this.space), s("size", this.size), s("dragging", this.dragging), s("showX", this.showX), s("showY", this.showY), s("showZ", this.showZ), s("worldPosition", this.worldPosition), s("worldPositionStart", this.worldPositionStart), s("worldQuaternion", this.worldQuaternion), s("worldQuaternionStart", this.worldQuaternionStart), s("cameraPosition", this.cameraPosition), s("cameraQuaternion", this.cameraQuaternion), s("pointStart", this.pointStart), s("pointEnd", this.pointEnd), s("rotationAxis", this.rotationAxis), s("rotationAngle", this.rotationAngle), s("eye", this.eye), r !== void 0 && this.connect(r);
  1356. }
  1357. };
  1358. var tu = class extends Object3D {
  1359. // these are set from parent class TransformControls
  1360. constructor() {
  1361. super(), T2(this, "isTransformControlsGizmo", true), T2(this, "type", "TransformControlsGizmo"), T2(this, "tempVector", new Vector3(0, 0, 0)), T2(this, "tempEuler", new Euler()), T2(this, "alignVector", new Vector3(0, 1, 0)), T2(this, "zeroVector", new Vector3(0, 0, 0)), T2(this, "lookAtMatrix", new Matrix4()), T2(this, "tempQuaternion", new Quaternion()), T2(this, "tempQuaternion2", new Quaternion()), T2(this, "identityQuaternion", new Quaternion()), T2(this, "unitX", new Vector3(1, 0, 0)), T2(this, "unitY", new Vector3(0, 1, 0)), T2(this, "unitZ", new Vector3(0, 0, 1)), T2(this, "gizmo", void 0), T2(this, "picker", void 0), T2(this, "helper", void 0), T2(this, "rotationAxis", new Vector3()), T2(this, "cameraPosition", new Vector3()), T2(this, "worldPositionStart", new Vector3()), T2(this, "worldQuaternionStart", new Quaternion()), T2(this, "worldPosition", new Vector3()), T2(this, "worldQuaternion", new Quaternion()), T2(this, "eye", new Vector3()), T2(this, "camera", null), T2(this, "enabled", true), T2(this, "axis", null), T2(this, "mode", "translate"), T2(this, "space", "world"), T2(this, "size", 1), T2(this, "dragging", false), T2(this, "showX", true), T2(this, "showY", true), T2(this, "showZ", true), T2(this, "updateMatrixWorld", () => {
  1362. let fe2 = this.space;
  1363. this.mode === "scale" && (fe2 = "local");
  1364. const ae = fe2 === "local" ? this.worldQuaternion : this.identityQuaternion;
  1365. 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";
  1366. let ne = [];
  1367. ne = ne.concat(this.picker[this.mode].children), ne = ne.concat(this.gizmo[this.mode].children), ne = ne.concat(this.helper[this.mode].children);
  1368. for (let be = 0; be < ne.length; be++) {
  1369. const M = ne[be];
  1370. M.visible = true, M.rotation.set(0, 0, 0), M.position.copy(this.worldPosition);
  1371. let le2;
  1372. if (this.camera.isOrthographicCamera ? le2 = (this.camera.top - this.camera.bottom) / this.camera.zoom : le2 = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), M.scale.set(1, 1, 1).multiplyScalar(le2 * this.size / 7), M.tag === "helper") {
  1373. M.visible = false, M.name === "AXIS" ? (M.position.copy(this.worldPositionStart), M.visible = !!this.axis, this.axis === "X" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, 0)), M.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "Y" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, Math.PI / 2)), M.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "Z" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), M.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "XYZE" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), this.alignVector.copy(this.rotationAxis), M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector, this.alignVector, this.unitY)), M.quaternion.multiply(this.tempQuaternion), M.visible = this.dragging), this.axis === "E" && (M.visible = false)) : M.name === "START" ? (M.position.copy(this.worldPositionStart), M.visible = this.dragging) : M.name === "END" ? (M.position.copy(this.worldPosition), M.visible = this.dragging) : M.name === "DELTA" ? (M.position.copy(this.worldPositionStart), M.quaternion.copy(this.worldQuaternionStart), this.tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()), M.scale.copy(this.tempVector), M.visible = this.dragging) : (M.quaternion.copy(ae), this.dragging ? M.position.copy(this.worldPositionStart) : M.position.copy(this.worldPosition), this.axis && (M.visible = this.axis.search(M.name) !== -1));
  1374. continue;
  1375. }
  1376. M.quaternion.copy(ae), this.mode === "translate" || this.mode === "scale" ? ((M.name === "X" || M.name === "XYZX") && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), (M.name === "Y" || M.name === "XYZY") && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), (M.name === "Z" || M.name === "XYZZ") && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "XY" && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "YZ" && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "XZ" && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name.search("X") !== -1 && (this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.x *= -1 : M.tag === "bwd" && (M.visible = false)), M.name.search("Y") !== -1 && (this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.y *= -1 : M.tag === "bwd" && (M.visible = false)), M.name.search("Z") !== -1 && (this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.z *= -1 : M.tag === "bwd" && (M.visible = false))) : this.mode === "rotate" && (this.tempQuaternion2.copy(ae), this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ae).invert()), M.name.search("E") !== -1 && M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye, this.zeroVector, this.unitY)), M.name === "X" && (this.tempQuaternion.setFromAxisAngle(this.unitX, Math.atan2(-this.alignVector.y, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion)), M.name === "Y" && (this.tempQuaternion.setFromAxisAngle(this.unitY, Math.atan2(this.alignVector.x, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion)), M.name === "Z" && (this.tempQuaternion.setFromAxisAngle(this.unitZ, Math.atan2(this.alignVector.y, this.alignVector.x)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion))), M.visible = M.visible && (M.name.indexOf("X") === -1 || this.showX), M.visible = M.visible && (M.name.indexOf("Y") === -1 || this.showY), M.visible = M.visible && (M.name.indexOf("Z") === -1 || this.showZ), M.visible = M.visible && (M.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), M.material.tempOpacity = M.material.tempOpacity || M.material.opacity, M.material.tempColor = M.material.tempColor || M.material.color.clone(), M.material.color.copy(M.material.tempColor), M.material.opacity = M.material.tempOpacity, this.enabled ? this.axis && (M.name === this.axis ? (M.material.opacity = 1, M.material.color.lerp(new Color(1, 1, 1), 0.5)) : this.axis.split("").some(function(Ve) {
  1377. return M.name === Ve;
  1378. }) ? (M.material.opacity = 1, M.material.color.lerp(new Color(1, 1, 1), 0.5)) : (M.material.opacity *= 0.25, M.material.color.lerp(new Color(1, 1, 1), 0.5))) : (M.material.opacity *= 0.5, M.material.color.lerp(new Color(1, 1, 1), 0.5));
  1379. }
  1380. super.updateMatrixWorld();
  1381. });
  1382. const i = new MeshBasicMaterial({
  1383. depthTest: false,
  1384. depthWrite: false,
  1385. transparent: true,
  1386. side: DoubleSide,
  1387. fog: false,
  1388. toneMapped: false
  1389. }), r = new LineBasicMaterial({
  1390. depthTest: false,
  1391. depthWrite: false,
  1392. transparent: true,
  1393. linewidth: 1,
  1394. fog: false,
  1395. toneMapped: false
  1396. }), s = i.clone();
  1397. s.opacity = 0.15;
  1398. const a = i.clone();
  1399. a.opacity = 0.33;
  1400. const c = i.clone();
  1401. c.color.set(16711680);
  1402. const u = i.clone();
  1403. u.color.set(65280);
  1404. const h2 = i.clone();
  1405. h2.color.set(255);
  1406. const d = i.clone();
  1407. d.opacity = 0.25;
  1408. const g = d.clone();
  1409. g.color.set(16776960);
  1410. const w = d.clone();
  1411. w.color.set(65535);
  1412. const _ = d.clone();
  1413. _.color.set(16711935), i.clone().color.set(16776960);
  1414. const C = r.clone();
  1415. C.color.set(16711680);
  1416. const I2 = r.clone();
  1417. I2.color.set(65280);
  1418. const S2 = r.clone();
  1419. S2.color.set(255);
  1420. const R2 = r.clone();
  1421. R2.color.set(65535);
  1422. const j2 = r.clone();
  1423. j2.color.set(16711935);
  1424. const F = r.clone();
  1425. F.color.set(16776960);
  1426. const V2 = r.clone();
  1427. V2.color.set(7895160);
  1428. const D = F.clone();
  1429. D.opacity = 0.25;
  1430. const Y = new CylinderGeometry(0, 0.05, 0.2, 12, 1, false), G2 = new BoxGeometry(0.125, 0.125, 0.125), N = new BufferGeometry();
  1431. N.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
  1432. const O = (fe2, ae) => {
  1433. const ne = new BufferGeometry(), be = [];
  1434. for (let M = 0; M <= 64 * ae; ++M)
  1435. be.push(0, Math.cos(M / 32 * Math.PI) * fe2, Math.sin(M / 32 * Math.PI) * fe2);
  1436. return ne.setAttribute("position", new Float32BufferAttribute(be, 3)), ne;
  1437. }, H2 = () => {
  1438. const fe2 = new BufferGeometry();
  1439. return fe2.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3)), fe2;
  1440. }, K = {
  1441. X: [[new Mesh(Y, c), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new Mesh(Y, c), [1, 0, 0], [0, 0, Math.PI / 2], null, "bwd"], [new Line(N, C)]],
  1442. Y: [[new Mesh(Y, u), [0, 1, 0], null, null, "fwd"], [new Mesh(Y, u), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"], [new Line(N, I2), null, [0, 0, Math.PI / 2]]],
  1443. Z: [[new Mesh(Y, h2), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new Mesh(Y, h2), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"], [new Line(N, S2), null, [0, -Math.PI / 2, 0]]],
  1444. XYZ: [[new Mesh(new OctahedronGeometry(0.1, 0), d.clone()), [0, 0, 0], [0, 0, 0]]],
  1445. 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]]],
  1446. YZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), w.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]], [new Line(N, R2), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R2), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  1447. XZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), _.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]], [new Line(N, j2), [0.18, 0, 0.3], null, [0.125, 1, 1]], [new Line(N, j2), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]]
  1448. }, q = {
  1449. X: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],
  1450. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0.6, 0]]],
  1451. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],
  1452. XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), s)]],
  1453. XY: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0.2, 0]]],
  1454. YZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],
  1455. XZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]
  1456. }, ue2 = {
  1457. START: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  1458. END: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  1459. DELTA: [[new Line(H2(), a), null, null, null, "helper"]],
  1460. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  1461. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  1462. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  1463. }, ge = {
  1464. X: [[new Line(O(1, 0.5), C)], [new Mesh(new OctahedronGeometry(0.04, 0), c), [0, 0, 0.99], null, [1, 3, 1]]],
  1465. Y: [[new Line(O(1, 0.5), I2), null, [0, 0, -Math.PI / 2]], [new Mesh(new OctahedronGeometry(0.04, 0), u), [0, 0, 0.99], null, [3, 1, 1]]],
  1466. Z: [[new Line(O(1, 0.5), S2), null, [0, Math.PI / 2, 0]], [new Mesh(new OctahedronGeometry(0.04, 0), h2), [0.99, 0, 0], null, [1, 3, 1]]],
  1467. E: [[new Line(O(1.25, 1), D), null, [0, Math.PI / 2, 0]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [0, 1.17, 0], [0, 0, 0], [1, 1, 1e-3]]],
  1468. XYZE: [[new Line(O(1, 1), V2), null, [0, Math.PI / 2, 0]]]
  1469. }, ce2 = {
  1470. AXIS: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
  1471. }, me2 = {
  1472. X: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
  1473. Y: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [Math.PI / 2, 0, 0]]],
  1474. Z: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, 0, -Math.PI / 2]]],
  1475. E: [[new Mesh(new TorusGeometry(1.25, 0.1, 2, 24), s)]],
  1476. XYZE: [[new Mesh(new SphereGeometry(0.7, 10, 8), s)]]
  1477. }, he = {
  1478. X: [[new Mesh(G2, c), [0.8, 0, 0], [0, 0, -Math.PI / 2]], [new Line(N, C), null, null, [0.8, 1, 1]]],
  1479. Y: [[new Mesh(G2, u), [0, 0.8, 0]], [new Line(N, I2), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]],
  1480. Z: [[new Mesh(G2, h2), [0, 0, 0.8], [Math.PI / 2, 0, 0]], [new Line(N, S2), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]],
  1481. XY: [[new Mesh(G2, g), [0.85, 0.85, 0], null, [2, 2, 0.2]], [new Line(N, F), [0.855, 0.98, 0], null, [0.125, 1, 1]], [new Line(N, F), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]],
  1482. YZ: [[new Mesh(G2, w), [0, 0.85, 0.85], null, [0.2, 2, 2]], [new Line(N, R2), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R2), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  1483. XZ: [[new Mesh(G2, _), [0.85, 0, 0.85], null, [2, 0.2, 2]], [new Line(N, j2), [0.855, 0, 0.98], null, [0.125, 1, 1]], [new Line(N, j2), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  1484. XYZX: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [1.1, 0, 0]]],
  1485. XYZY: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 1.1, 0]]],
  1486. XYZZ: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 0, 1.1]]]
  1487. }, ee2 = {
  1488. X: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],
  1489. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0.5, 0]]],
  1490. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],
  1491. XY: [[new Mesh(G2, s), [0.85, 0.85, 0], null, [3, 3, 0.2]]],
  1492. YZ: [[new Mesh(G2, s), [0, 0.85, 0.85], null, [0.2, 3, 3]]],
  1493. XZ: [[new Mesh(G2, s), [0.85, 0, 0.85], null, [3, 0.2, 3]]],
  1494. XYZX: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [1.1, 0, 0]]],
  1495. XYZY: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 1.1, 0]]],
  1496. XYZZ: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 0, 1.1]]]
  1497. }, X = {
  1498. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  1499. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  1500. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  1501. }, Pe = (fe2) => {
  1502. const ae = new Object3D();
  1503. for (let ne in fe2)
  1504. for (let be = fe2[ne].length; be--; ) {
  1505. const M = fe2[ne][be][0].clone(), le2 = fe2[ne][be][1], Ve = fe2[ne][be][2], Ne2 = fe2[ne][be][3], we = fe2[ne][be][4];
  1506. M.name = ne, M.tag = we, le2 && M.position.set(le2[0], le2[1], le2[2]), Ve && M.rotation.set(Ve[0], Ve[1], Ve[2]), Ne2 && M.scale.set(Ne2[0], Ne2[1], Ne2[2]), M.updateMatrix();
  1507. const it2 = M.geometry.clone();
  1508. it2.applyMatrix4(M.matrix), M.geometry = it2, M.renderOrder = 1 / 0, M.position.set(0, 0, 0), M.rotation.set(0, 0, 0), M.scale.set(1, 1, 1), ae.add(M);
  1509. }
  1510. return ae;
  1511. };
  1512. this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = Pe(K)), this.add(this.gizmo.rotate = Pe(ge)), this.add(this.gizmo.scale = Pe(he)), this.add(this.picker.translate = Pe(q)), this.add(this.picker.rotate = Pe(me2)), this.add(this.picker.scale = Pe(ee2)), this.add(this.helper.translate = Pe(ue2)), this.add(this.helper.rotate = Pe(ce2)), this.add(this.helper.scale = Pe(X)), this.picker.translate.visible = false, this.picker.rotate.visible = false, this.picker.scale.visible = false;
  1513. }
  1514. // updateMatrixWorld will update transformations and appearance of individual handles
  1515. };
  1516. var nu = class extends Mesh {
  1517. constructor() {
  1518. super(new PlaneGeometry(1e5, 1e5, 2, 2), new MeshBasicMaterial({
  1519. visible: false,
  1520. wireframe: true,
  1521. side: DoubleSide,
  1522. transparent: true,
  1523. opacity: 0.1,
  1524. toneMapped: false
  1525. })), T2(this, "isTransformControlsPlane", true), T2(this, "type", "TransformControlsPlane"), T2(this, "unitX", new Vector3(1, 0, 0)), T2(this, "unitY", new Vector3(0, 1, 0)), T2(this, "unitZ", new Vector3(0, 0, 1)), T2(this, "tempVector", new Vector3()), T2(this, "dirVector", new Vector3()), T2(this, "alignVector", new Vector3()), T2(this, "tempMatrix", new Matrix4()), T2(this, "identityQuaternion", new Quaternion()), T2(this, "cameraQuaternion", new Quaternion()), T2(this, "worldPosition", new Vector3()), T2(this, "worldQuaternion", new Quaternion()), T2(this, "eye", new Vector3()), T2(this, "axis", null), T2(this, "mode", "translate"), T2(this, "space", "world"), T2(this, "updateMatrixWorld", () => {
  1526. let i = this.space;
  1527. switch (this.position.copy(this.worldPosition), this.mode === "scale" && (i = "local"), this.unitX.set(1, 0, 0).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitY.set(0, 1, 0).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitZ.set(0, 0, 1).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.alignVector.copy(this.unitY), this.mode) {
  1528. case "translate":
  1529. case "scale":
  1530. switch (this.axis) {
  1531. case "X":
  1532. this.alignVector.copy(this.eye).cross(this.unitX), this.dirVector.copy(this.unitX).cross(this.alignVector);
  1533. break;
  1534. case "Y":
  1535. this.alignVector.copy(this.eye).cross(this.unitY), this.dirVector.copy(this.unitY).cross(this.alignVector);
  1536. break;
  1537. case "Z":
  1538. this.alignVector.copy(this.eye).cross(this.unitZ), this.dirVector.copy(this.unitZ).cross(this.alignVector);
  1539. break;
  1540. case "XY":
  1541. this.dirVector.copy(this.unitZ);
  1542. break;
  1543. case "YZ":
  1544. this.dirVector.copy(this.unitX);
  1545. break;
  1546. case "XZ":
  1547. this.alignVector.copy(this.unitZ), this.dirVector.copy(this.unitY);
  1548. break;
  1549. case "XYZ":
  1550. case "E":
  1551. this.dirVector.set(0, 0, 0);
  1552. break;
  1553. }
  1554. break;
  1555. case "rotate":
  1556. default:
  1557. this.dirVector.set(0, 0, 0);
  1558. }
  1559. 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();
  1560. });
  1561. }
  1562. };
  1563. var oa = (b2, i) => (b2 % i + i) % i;
  1564. var iu = class extends EventDispatcher {
  1565. // Set to false to disable this control
  1566. // "target" sets the location of focus, where the object orbits around
  1567. // How far you can dolly in and out ( PerspectiveCamera only )
  1568. // How far you can zoom in and out ( OrthographicCamera only )
  1569. // How far you can orbit vertically, upper and lower limits.
  1570. // Range is 0 to Math.PI radians.
  1571. // radians
  1572. // radians
  1573. // How far you can orbit horizontally, upper and lower limits.
  1574. // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
  1575. // radians
  1576. // radians
  1577. // Set to true to enable damping (inertia)
  1578. // If damping is enabled, you must call controls.update() in your animation loop
  1579. // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
  1580. // Set to false to disable zooming
  1581. // Set to false to disable rotating
  1582. // Set to false to disable panning
  1583. // if false, pan orthogonal to world-space direction camera.up
  1584. // pixels moved per arrow key push
  1585. // Set to true to automatically rotate around the target
  1586. // If auto-rotate is enabled, you must call controls.update() in your animation loop
  1587. // 30 seconds per orbit when fps is 60
  1588. // true if you want to reverse the orbit to mouse drag from left to right = orbits left
  1589. // The four arrow keys
  1590. // Mouse buttons
  1591. // Touch fingers
  1592. // the target DOM element for key events
  1593. constructor(i, r) {
  1594. super(), T2(this, "object", void 0), T2(this, "domElement", void 0), T2(this, "enabled", true), T2(this, "target", new Vector3()), T2(this, "minDistance", 0), T2(this, "maxDistance", 1 / 0), T2(this, "minZoom", 0), T2(this, "maxZoom", 1 / 0), T2(this, "minPolarAngle", 0), T2(this, "maxPolarAngle", Math.PI), T2(this, "minAzimuthAngle", -1 / 0), T2(this, "maxAzimuthAngle", 1 / 0), T2(this, "enableDamping", false), T2(this, "dampingFactor", 0.05), T2(this, "enableZoom", true), T2(this, "zoomSpeed", 1), T2(this, "enableRotate", true), T2(this, "rotateSpeed", 1), T2(this, "enablePan", true), T2(this, "panSpeed", 1), T2(this, "screenSpacePanning", true), T2(this, "keyPanSpeed", 7), T2(this, "autoRotate", false), T2(this, "autoRotateSpeed", 2), T2(this, "reverseOrbit", false), T2(this, "keys", {
  1595. LEFT: "ArrowLeft",
  1596. UP: "ArrowUp",
  1597. RIGHT: "ArrowRight",
  1598. BOTTOM: "ArrowDown"
  1599. }), T2(this, "mouseButtons", {
  1600. LEFT: MOUSE.ROTATE,
  1601. MIDDLE: MOUSE.DOLLY,
  1602. RIGHT: MOUSE.PAN
  1603. }), T2(this, "touches", {
  1604. ONE: TOUCH.ROTATE,
  1605. TWO: TOUCH.DOLLY_PAN
  1606. }), T2(this, "target0", void 0), T2(this, "position0", void 0), T2(this, "zoom0", void 0), T2(this, "_domElementKeyEvents", null), T2(this, "getPolarAngle", void 0), T2(this, "getAzimuthalAngle", void 0), T2(this, "setPolarAngle", void 0), T2(this, "setAzimuthalAngle", void 0), T2(this, "getDistance", void 0), T2(this, "listenToKeyEvents", void 0), T2(this, "saveState", void 0), T2(this, "reset", void 0), T2(this, "update", void 0), T2(this, "connect", void 0), T2(this, "dispose", void 0), this.object = i, this.domElement = r, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object instanceof PerspectiveCamera ? this.object.zoom : 1, this.getPolarAngle = () => w.phi, this.getAzimuthalAngle = () => w.theta, this.setPolarAngle = (A2) => {
  1607. let U = oa(A2, 2 * Math.PI), W = w.phi;
  1608. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  1609. let ie = Math.abs(U - W);
  1610. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.phi = U - W, s.update();
  1611. }, this.setAzimuthalAngle = (A2) => {
  1612. let U = oa(A2, 2 * Math.PI), W = w.theta;
  1613. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  1614. let ie = Math.abs(U - W);
  1615. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.theta = U - W, s.update();
  1616. }, this.getDistance = () => s.object.position.distanceTo(s.target), this.listenToKeyEvents = (A2) => {
  1617. A2.addEventListener("keydown", yt), this._domElementKeyEvents = A2;
  1618. }, this.saveState = () => {
  1619. s.target0.copy(s.target), s.position0.copy(s.object.position), s.zoom0 = s.object instanceof PerspectiveCamera ? s.object.zoom : 1;
  1620. }, this.reset = () => {
  1621. s.target.copy(s.target0), s.object.position.copy(s.position0), s.object instanceof PerspectiveCamera && (s.object.zoom = s.zoom0, s.object.updateProjectionMatrix()), s.dispatchEvent(a), s.update(), d = h2.NONE;
  1622. }, this.update = (() => {
  1623. const A2 = new Vector3(), U = new Quaternion().setFromUnitVectors(i.up, new Vector3(0, 1, 0)), W = U.clone().invert(), ie = new Vector3(), ye = new Quaternion(), De = 2 * Math.PI;
  1624. return function() {
  1625. const pn = s.object.position;
  1626. A2.copy(pn).sub(s.target), A2.applyQuaternion(U), w.setFromVector3(A2), s.autoRotate && d === h2.NONE && ue2(K()), s.enableDamping ? (w.theta += _.theta * s.dampingFactor, w.phi += _.phi * s.dampingFactor) : (w.theta += _.theta, w.phi += _.phi);
  1627. let Ue = s.minAzimuthAngle, Ge = s.maxAzimuthAngle;
  1628. return isFinite(Ue) && isFinite(Ge) && (Ue < -Math.PI ? Ue += De : Ue > Math.PI && (Ue -= De), Ge < -Math.PI ? Ge += De : Ge > Math.PI && (Ge -= De), Ue <= Ge ? w.theta = Math.max(Ue, Math.min(Ge, w.theta)) : w.theta = w.theta > (Ue + Ge) / 2 ? Math.max(Ue, w.theta) : Math.min(Ge, w.theta)), w.phi = Math.max(s.minPolarAngle, Math.min(s.maxPolarAngle, w.phi)), w.makeSafe(), w.radius *= y2, w.radius = Math.max(s.minDistance, Math.min(s.maxDistance, w.radius)), s.enableDamping === true ? s.target.addScaledVector(C, s.dampingFactor) : s.target.add(C), A2.setFromSpherical(w), A2.applyQuaternion(W), pn.copy(s.target).add(A2), s.object.lookAt(s.target), s.enableDamping === true ? (_.theta *= 1 - s.dampingFactor, _.phi *= 1 - s.dampingFactor, C.multiplyScalar(1 - s.dampingFactor)) : (_.set(0, 0, 0), C.set(0, 0, 0)), y2 = 1, I2 || ie.distanceToSquared(s.object.position) > g || 8 * (1 - ye.dot(s.object.quaternion)) > g ? (s.dispatchEvent(a), ie.copy(s.object.position), ye.copy(s.object.quaternion), I2 = false, true) : false;
  1629. };
  1630. })(), this.connect = (A2) => {
  1631. A2 === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), s.domElement = A2, s.domElement.style.touchAction = "none", s.domElement.addEventListener("contextmenu", cn), s.domElement.addEventListener("pointerdown", st2), s.domElement.addEventListener("pointercancel", zn), s.domElement.addEventListener("wheel", Gn);
  1632. }, this.dispose = () => {
  1633. var A2, U, W, ie, ye, De;
  1634. (A2 = s.domElement) === null || A2 === void 0 || A2.removeEventListener("contextmenu", cn), (U = s.domElement) === null || U === void 0 || U.removeEventListener("pointerdown", st2), (W = s.domElement) === null || W === void 0 || W.removeEventListener("pointercancel", zn), (ie = s.domElement) === null || ie === void 0 || ie.removeEventListener("wheel", Gn), (ye = s.domElement) === null || ye === void 0 || ye.ownerDocument.removeEventListener("pointermove", ln), (De = s.domElement) === null || De === void 0 || De.ownerDocument.removeEventListener("pointerup", mt), s._domElementKeyEvents !== null && s._domElementKeyEvents.removeEventListener("keydown", yt);
  1635. };
  1636. const s = this, a = {
  1637. type: "change"
  1638. }, c = {
  1639. type: "start"
  1640. }, u = {
  1641. type: "end"
  1642. }, h2 = {
  1643. NONE: -1,
  1644. ROTATE: 0,
  1645. DOLLY: 1,
  1646. PAN: 2,
  1647. TOUCH_ROTATE: 3,
  1648. TOUCH_PAN: 4,
  1649. TOUCH_DOLLY_PAN: 5,
  1650. TOUCH_DOLLY_ROTATE: 6
  1651. };
  1652. let d = h2.NONE;
  1653. const g = 1e-6, w = new Spherical(), _ = new Spherical();
  1654. let y2 = 1;
  1655. const C = new Vector3();
  1656. let I2 = false;
  1657. const S2 = new Vector2(), R2 = new Vector2(), j2 = new Vector2(), F = new Vector2(), V2 = new Vector2(), D = new Vector2(), Y = new Vector2(), G2 = new Vector2(), N = new Vector2(), O = [], H2 = {};
  1658. function K() {
  1659. return 2 * Math.PI / 60 / 60 * s.autoRotateSpeed;
  1660. }
  1661. function q() {
  1662. return Math.pow(0.95, s.zoomSpeed);
  1663. }
  1664. function ue2(A2) {
  1665. s.reverseOrbit ? _.theta += A2 : _.theta -= A2;
  1666. }
  1667. function ge(A2) {
  1668. s.reverseOrbit ? _.phi += A2 : _.phi -= A2;
  1669. }
  1670. const ce2 = (() => {
  1671. const A2 = new Vector3();
  1672. return function(W, ie) {
  1673. A2.setFromMatrixColumn(ie, 0), A2.multiplyScalar(-W), C.add(A2);
  1674. };
  1675. })(), me2 = (() => {
  1676. const A2 = new Vector3();
  1677. return function(W, ie) {
  1678. s.screenSpacePanning === true ? A2.setFromMatrixColumn(ie, 1) : (A2.setFromMatrixColumn(ie, 0), A2.crossVectors(s.object.up, A2)), A2.multiplyScalar(W), C.add(A2);
  1679. };
  1680. })(), he = (() => {
  1681. const A2 = new Vector3();
  1682. return function(W, ie) {
  1683. const ye = s.domElement;
  1684. if (ye && s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera) {
  1685. const De = s.object.position;
  1686. A2.copy(De).sub(s.target);
  1687. let Ut = A2.length();
  1688. Ut *= Math.tan(s.object.fov / 2 * Math.PI / 180), ce2(2 * W * Ut / ye.clientHeight, s.object.matrix), me2(2 * ie * Ut / ye.clientHeight, s.object.matrix);
  1689. } else
  1690. ye && s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (ce2(W * (s.object.right - s.object.left) / s.object.zoom / ye.clientWidth, s.object.matrix), me2(ie * (s.object.top - s.object.bottom) / s.object.zoom / ye.clientHeight, s.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), s.enablePan = false);
  1691. };
  1692. })();
  1693. function ee2(A2) {
  1694. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y2 /= A2 : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom * A2)), s.object.updateProjectionMatrix(), I2 = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  1695. }
  1696. function X(A2) {
  1697. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y2 *= A2 : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom / A2)), s.object.updateProjectionMatrix(), I2 = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  1698. }
  1699. function Pe(A2) {
  1700. S2.set(A2.clientX, A2.clientY);
  1701. }
  1702. function fe2(A2) {
  1703. Y.set(A2.clientX, A2.clientY);
  1704. }
  1705. function ae(A2) {
  1706. F.set(A2.clientX, A2.clientY);
  1707. }
  1708. function ne(A2) {
  1709. R2.set(A2.clientX, A2.clientY), j2.subVectors(R2, S2).multiplyScalar(s.rotateSpeed);
  1710. const U = s.domElement;
  1711. U && (ue2(2 * Math.PI * j2.x / U.clientHeight), ge(2 * Math.PI * j2.y / U.clientHeight)), S2.copy(R2), s.update();
  1712. }
  1713. function be(A2) {
  1714. G2.set(A2.clientX, A2.clientY), N.subVectors(G2, Y), N.y > 0 ? ee2(q()) : N.y < 0 && X(q()), Y.copy(G2), s.update();
  1715. }
  1716. function M(A2) {
  1717. V2.set(A2.clientX, A2.clientY), D.subVectors(V2, F).multiplyScalar(s.panSpeed), he(D.x, D.y), F.copy(V2), s.update();
  1718. }
  1719. function le2(A2) {
  1720. A2.deltaY < 0 ? X(q()) : A2.deltaY > 0 && ee2(q()), s.update();
  1721. }
  1722. function Ve(A2) {
  1723. let U = false;
  1724. switch (A2.code) {
  1725. case s.keys.UP:
  1726. he(0, s.keyPanSpeed), U = true;
  1727. break;
  1728. case s.keys.BOTTOM:
  1729. he(0, -s.keyPanSpeed), U = true;
  1730. break;
  1731. case s.keys.LEFT:
  1732. he(s.keyPanSpeed, 0), U = true;
  1733. break;
  1734. case s.keys.RIGHT:
  1735. he(-s.keyPanSpeed, 0), U = true;
  1736. break;
  1737. }
  1738. U && (A2.preventDefault(), s.update());
  1739. }
  1740. function Ne2() {
  1741. if (O.length == 1)
  1742. S2.set(O[0].pageX, O[0].pageY);
  1743. else {
  1744. const A2 = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1745. S2.set(A2, U);
  1746. }
  1747. }
  1748. function we() {
  1749. if (O.length == 1)
  1750. F.set(O[0].pageX, O[0].pageY);
  1751. else {
  1752. const A2 = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1753. F.set(A2, U);
  1754. }
  1755. }
  1756. function it2() {
  1757. const A2 = O[0].pageX - O[1].pageX, U = O[0].pageY - O[1].pageY, W = Math.sqrt(A2 * A2 + U * U);
  1758. Y.set(0, W);
  1759. }
  1760. function Bn() {
  1761. s.enableZoom && it2(), s.enablePan && we();
  1762. }
  1763. function Xe2() {
  1764. s.enableZoom && it2(), s.enableRotate && Ne2();
  1765. }
  1766. function jn(A2) {
  1767. if (O.length == 1)
  1768. R2.set(A2.pageX, A2.pageY);
  1769. else {
  1770. const W = At(A2), ie = 0.5 * (A2.pageX + W.x), ye = 0.5 * (A2.pageY + W.y);
  1771. R2.set(ie, ye);
  1772. }
  1773. j2.subVectors(R2, S2).multiplyScalar(s.rotateSpeed);
  1774. const U = s.domElement;
  1775. U && (ue2(2 * Math.PI * j2.x / U.clientHeight), ge(2 * Math.PI * j2.y / U.clientHeight)), S2.copy(R2);
  1776. }
  1777. function an(A2) {
  1778. if (O.length == 1)
  1779. V2.set(A2.pageX, A2.pageY);
  1780. else {
  1781. const U = At(A2), W = 0.5 * (A2.pageX + U.x), ie = 0.5 * (A2.pageY + U.y);
  1782. V2.set(W, ie);
  1783. }
  1784. D.subVectors(V2, F).multiplyScalar(s.panSpeed), he(D.x, D.y), F.copy(V2);
  1785. }
  1786. function dt2(A2) {
  1787. const U = At(A2), W = A2.pageX - U.x, ie = A2.pageY - U.y, ye = Math.sqrt(W * W + ie * ie);
  1788. G2.set(0, ye), N.set(0, Math.pow(G2.y / Y.y, s.zoomSpeed)), ee2(N.y), Y.copy(G2);
  1789. }
  1790. function Mt(A2) {
  1791. s.enableZoom && dt2(A2), s.enablePan && an(A2);
  1792. }
  1793. function ze(A2) {
  1794. s.enableZoom && dt2(A2), s.enableRotate && jn(A2);
  1795. }
  1796. function st2(A2) {
  1797. if (s.enabled !== false) {
  1798. if (O.length === 0) {
  1799. var U, W;
  1800. (U = s.domElement) === null || U === void 0 || U.ownerDocument.addEventListener("pointermove", ln), (W = s.domElement) === null || W === void 0 || W.ownerDocument.addEventListener("pointerup", mt);
  1801. }
  1802. Kn(A2), A2.pointerType === "touch" ? St(A2) : hi(A2);
  1803. }
  1804. }
  1805. function ln(A2) {
  1806. s.enabled !== false && (A2.pointerType === "touch" ? Hn(A2) : Un(A2));
  1807. }
  1808. function mt(A2) {
  1809. if (xt(A2), O.length === 0) {
  1810. var U, W, ie;
  1811. (U = s.domElement) === null || U === void 0 || U.releasePointerCapture(A2.pointerId), (W = s.domElement) === null || W === void 0 || W.ownerDocument.removeEventListener("pointermove", ln), (ie = s.domElement) === null || ie === void 0 || ie.ownerDocument.removeEventListener("pointerup", mt);
  1812. }
  1813. s.dispatchEvent(u), d = h2.NONE;
  1814. }
  1815. function zn(A2) {
  1816. xt(A2);
  1817. }
  1818. function hi(A2) {
  1819. let U;
  1820. switch (A2.button) {
  1821. case 0:
  1822. U = s.mouseButtons.LEFT;
  1823. break;
  1824. case 1:
  1825. U = s.mouseButtons.MIDDLE;
  1826. break;
  1827. case 2:
  1828. U = s.mouseButtons.RIGHT;
  1829. break;
  1830. default:
  1831. U = -1;
  1832. }
  1833. switch (U) {
  1834. case MOUSE.DOLLY:
  1835. if (s.enableZoom === false)
  1836. return;
  1837. fe2(A2), d = h2.DOLLY;
  1838. break;
  1839. case MOUSE.ROTATE:
  1840. if (A2.ctrlKey || A2.metaKey || A2.shiftKey) {
  1841. if (s.enablePan === false)
  1842. return;
  1843. ae(A2), d = h2.PAN;
  1844. } else {
  1845. if (s.enableRotate === false)
  1846. return;
  1847. Pe(A2), d = h2.ROTATE;
  1848. }
  1849. break;
  1850. case MOUSE.PAN:
  1851. if (A2.ctrlKey || A2.metaKey || A2.shiftKey) {
  1852. if (s.enableRotate === false)
  1853. return;
  1854. Pe(A2), d = h2.ROTATE;
  1855. } else {
  1856. if (s.enablePan === false)
  1857. return;
  1858. ae(A2), d = h2.PAN;
  1859. }
  1860. break;
  1861. default:
  1862. d = h2.NONE;
  1863. }
  1864. d !== h2.NONE && s.dispatchEvent(c);
  1865. }
  1866. function Un(A2) {
  1867. if (s.enabled !== false)
  1868. switch (d) {
  1869. case h2.ROTATE:
  1870. if (s.enableRotate === false)
  1871. return;
  1872. ne(A2);
  1873. break;
  1874. case h2.DOLLY:
  1875. if (s.enableZoom === false)
  1876. return;
  1877. be(A2);
  1878. break;
  1879. case h2.PAN:
  1880. if (s.enablePan === false)
  1881. return;
  1882. M(A2);
  1883. break;
  1884. }
  1885. }
  1886. function Gn(A2) {
  1887. s.enabled === false || s.enableZoom === false || d !== h2.NONE && d !== h2.ROTATE || (A2.preventDefault(), s.dispatchEvent(c), le2(A2), s.dispatchEvent(u));
  1888. }
  1889. function yt(A2) {
  1890. s.enabled === false || s.enablePan === false || Ve(A2);
  1891. }
  1892. function St(A2) {
  1893. switch (ft(A2), O.length) {
  1894. case 1:
  1895. switch (s.touches.ONE) {
  1896. case TOUCH.ROTATE:
  1897. if (s.enableRotate === false)
  1898. return;
  1899. Ne2(), d = h2.TOUCH_ROTATE;
  1900. break;
  1901. case TOUCH.PAN:
  1902. if (s.enablePan === false)
  1903. return;
  1904. we(), d = h2.TOUCH_PAN;
  1905. break;
  1906. default:
  1907. d = h2.NONE;
  1908. }
  1909. break;
  1910. case 2:
  1911. switch (s.touches.TWO) {
  1912. case TOUCH.DOLLY_PAN:
  1913. if (s.enableZoom === false && s.enablePan === false)
  1914. return;
  1915. Bn(), d = h2.TOUCH_DOLLY_PAN;
  1916. break;
  1917. case TOUCH.DOLLY_ROTATE:
  1918. if (s.enableZoom === false && s.enableRotate === false)
  1919. return;
  1920. Xe2(), d = h2.TOUCH_DOLLY_ROTATE;
  1921. break;
  1922. default:
  1923. d = h2.NONE;
  1924. }
  1925. break;
  1926. default:
  1927. d = h2.NONE;
  1928. }
  1929. d !== h2.NONE && s.dispatchEvent(c);
  1930. }
  1931. function Hn(A2) {
  1932. switch (ft(A2), d) {
  1933. case h2.TOUCH_ROTATE:
  1934. if (s.enableRotate === false)
  1935. return;
  1936. jn(A2), s.update();
  1937. break;
  1938. case h2.TOUCH_PAN:
  1939. if (s.enablePan === false)
  1940. return;
  1941. an(A2), s.update();
  1942. break;
  1943. case h2.TOUCH_DOLLY_PAN:
  1944. if (s.enableZoom === false && s.enablePan === false)
  1945. return;
  1946. Mt(A2), s.update();
  1947. break;
  1948. case h2.TOUCH_DOLLY_ROTATE:
  1949. if (s.enableZoom === false && s.enableRotate === false)
  1950. return;
  1951. ze(A2), s.update();
  1952. break;
  1953. default:
  1954. d = h2.NONE;
  1955. }
  1956. }
  1957. function cn(A2) {
  1958. s.enabled !== false && A2.preventDefault();
  1959. }
  1960. function Kn(A2) {
  1961. O.push(A2);
  1962. }
  1963. function xt(A2) {
  1964. delete H2[A2.pointerId];
  1965. for (let U = 0; U < O.length; U++)
  1966. if (O[U].pointerId == A2.pointerId) {
  1967. O.splice(U, 1);
  1968. return;
  1969. }
  1970. }
  1971. function ft(A2) {
  1972. let U = H2[A2.pointerId];
  1973. U === void 0 && (U = new Vector2(), H2[A2.pointerId] = U), U.set(A2.pageX, A2.pageY);
  1974. }
  1975. function At(A2) {
  1976. const U = A2.pointerId === O[0].pointerId ? O[1] : O[0];
  1977. return H2[U.pointerId];
  1978. }
  1979. r !== void 0 && this.connect(r), this.update();
  1980. }
  1981. };
  1982. var su = class extends Loader {
  1983. constructor(i) {
  1984. super(i), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(r) {
  1985. return new cu(r);
  1986. }), this.register(function(r) {
  1987. return new vu(r);
  1988. }), this.register(function(r) {
  1989. return new bu(r);
  1990. }), this.register(function(r) {
  1991. return new uu(r);
  1992. }), this.register(function(r) {
  1993. return new hu(r);
  1994. }), this.register(function(r) {
  1995. return new du(r);
  1996. }), this.register(function(r) {
  1997. return new mu(r);
  1998. }), this.register(function(r) {
  1999. return new lu(r);
  2000. }), this.register(function(r) {
  2001. return new fu(r);
  2002. }), this.register(function(r) {
  2003. return new pu(r);
  2004. }), this.register(function(r) {
  2005. return new ou(r);
  2006. }), this.register(function(r) {
  2007. return new gu(r);
  2008. });
  2009. }
  2010. load(i, r, s, a) {
  2011. const c = this;
  2012. let u;
  2013. this.resourcePath !== "" ? u = this.resourcePath : this.path !== "" ? u = this.path : u = LoaderUtils.extractUrlBase(i), this.manager.itemStart(i);
  2014. const h2 = function(g) {
  2015. a ? a(g) : console.error(g), c.manager.itemError(i), c.manager.itemEnd(i);
  2016. }, d = new FileLoader(this.manager);
  2017. d.setPath(this.path), d.setResponseType("arraybuffer"), d.setRequestHeader(this.requestHeader), d.setWithCredentials(this.withCredentials), d.load(i, function(g) {
  2018. try {
  2019. c.parse(g, u, function(w) {
  2020. r(w), c.manager.itemEnd(i);
  2021. }, h2);
  2022. } catch (w) {
  2023. h2(w);
  2024. }
  2025. }, s, h2);
  2026. }
  2027. setDRACOLoader(i) {
  2028. return this.dracoLoader = i, this;
  2029. }
  2030. setDDSLoader() {
  2031. throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
  2032. }
  2033. setKTX2Loader(i) {
  2034. return this.ktx2Loader = i, this;
  2035. }
  2036. setMeshoptDecoder(i) {
  2037. return this.meshoptDecoder = i, this;
  2038. }
  2039. register(i) {
  2040. return this.pluginCallbacks.indexOf(i) === -1 && this.pluginCallbacks.push(i), this;
  2041. }
  2042. unregister(i) {
  2043. return this.pluginCallbacks.indexOf(i) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(i), 1), this;
  2044. }
  2045. parse(i, r, s, a) {
  2046. let c;
  2047. const u = {}, h2 = {};
  2048. if (typeof i == "string")
  2049. c = i;
  2050. else if (LoaderUtils.decodeText(new Uint8Array(i, 0, 4)) === $a) {
  2051. try {
  2052. u[re.KHR_BINARY_GLTF] = new _u(i);
  2053. } catch (_) {
  2054. a && a(_);
  2055. return;
  2056. }
  2057. c = u[re.KHR_BINARY_GLTF].content;
  2058. } else
  2059. c = LoaderUtils.decodeText(new Uint8Array(i));
  2060. const d = JSON.parse(c);
  2061. if (d.asset === void 0 || d.asset.version[0] < 2) {
  2062. a && a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
  2063. return;
  2064. }
  2065. const g = new Ru(d, {
  2066. path: r || this.resourcePath || "",
  2067. crossOrigin: this.crossOrigin,
  2068. requestHeader: this.requestHeader,
  2069. manager: this.manager,
  2070. ktx2Loader: this.ktx2Loader,
  2071. meshoptDecoder: this.meshoptDecoder
  2072. });
  2073. g.fileLoader.setRequestHeader(this.requestHeader);
  2074. for (let w = 0; w < this.pluginCallbacks.length; w++) {
  2075. const _ = this.pluginCallbacks[w](g);
  2076. h2[_.name] = _, u[_.name] = true;
  2077. }
  2078. if (d.extensionsUsed)
  2079. for (let w = 0; w < d.extensionsUsed.length; ++w) {
  2080. const _ = d.extensionsUsed[w], y2 = d.extensionsRequired || [];
  2081. switch (_) {
  2082. case re.KHR_MATERIALS_UNLIT:
  2083. u[_] = new au();
  2084. break;
  2085. case re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
  2086. u[_] = new xu();
  2087. break;
  2088. case re.KHR_DRACO_MESH_COMPRESSION:
  2089. u[_] = new wu(d, this.dracoLoader);
  2090. break;
  2091. case re.KHR_TEXTURE_TRANSFORM:
  2092. u[_] = new yu();
  2093. break;
  2094. case re.KHR_MESH_QUANTIZATION:
  2095. u[_] = new Eu();
  2096. break;
  2097. default:
  2098. y2.indexOf(_) >= 0 && h2[_] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + _ + '".');
  2099. }
  2100. }
  2101. g.setExtensions(u), g.setPlugins(h2), g.parse(s, a);
  2102. }
  2103. parseAsync(i, r) {
  2104. const s = this;
  2105. return new Promise(function(a, c) {
  2106. s.parse(i, r, a, c);
  2107. });
  2108. }
  2109. };
  2110. function ru() {
  2111. let b2 = {};
  2112. return {
  2113. get: function(i) {
  2114. return b2[i];
  2115. },
  2116. add: function(i, r) {
  2117. b2[i] = r;
  2118. },
  2119. remove: function(i) {
  2120. delete b2[i];
  2121. },
  2122. removeAll: function() {
  2123. b2 = {};
  2124. }
  2125. };
  2126. }
  2127. var re = {
  2128. KHR_BINARY_GLTF: "KHR_binary_glTF",
  2129. KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  2130. KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  2131. KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  2132. KHR_MATERIALS_IOR: "KHR_materials_ior",
  2133. KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  2134. KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
  2135. KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
  2136. KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  2137. KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
  2138. KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  2139. KHR_MATERIALS_VOLUME: "KHR_materials_volume",
  2140. KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  2141. KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  2142. KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  2143. KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
  2144. EXT_TEXTURE_WEBP: "EXT_texture_webp",
  2145. EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
  2146. };
  2147. var ou = class {
  2148. constructor(i) {
  2149. this.parser = i, this.name = re.KHR_LIGHTS_PUNCTUAL, this.cache = {
  2150. refs: {},
  2151. uses: {}
  2152. };
  2153. }
  2154. _markDefs() {
  2155. const i = this.parser, r = this.parser.json.nodes || [];
  2156. for (let s = 0, a = r.length; s < a; s++) {
  2157. const c = r[s];
  2158. c.extensions && c.extensions[this.name] && c.extensions[this.name].light !== void 0 && i._addNodeRef(this.cache, c.extensions[this.name].light);
  2159. }
  2160. }
  2161. _loadLight(i) {
  2162. const r = this.parser, s = "light:" + i;
  2163. let a = r.cache.get(s);
  2164. if (a)
  2165. return a;
  2166. const c = r.json, d = ((c.extensions && c.extensions[this.name] || {}).lights || [])[i];
  2167. let g;
  2168. const w = new Color(16777215);
  2169. d.color !== void 0 && w.fromArray(d.color);
  2170. const _ = d.range !== void 0 ? d.range : 0;
  2171. switch (d.type) {
  2172. case "directional":
  2173. g = new DirectionalLight(w), g.target.position.set(0, 0, -1), g.add(g.target);
  2174. break;
  2175. case "point":
  2176. g = new PointLight(w), g.distance = _;
  2177. break;
  2178. case "spot":
  2179. g = new SpotLight(w), g.distance = _, d.spot = d.spot || {}, d.spot.innerConeAngle = d.spot.innerConeAngle !== void 0 ? d.spot.innerConeAngle : 0, d.spot.outerConeAngle = d.spot.outerConeAngle !== void 0 ? d.spot.outerConeAngle : Math.PI / 4, g.angle = d.spot.outerConeAngle, g.penumbra = 1 - d.spot.innerConeAngle / d.spot.outerConeAngle, g.target.position.set(0, 0, -1), g.add(g.target);
  2180. break;
  2181. default:
  2182. throw new Error("THREE.GLTFLoader: Unexpected light type: " + d.type);
  2183. }
  2184. return g.position.set(0, 0, 0), g.decay = 2, d.intensity !== void 0 && (g.intensity = d.intensity), g.name = r.createUniqueName(d.name || "light_" + i), a = Promise.resolve(g), r.cache.add(s, a), a;
  2185. }
  2186. createNodeAttachment(i) {
  2187. const r = this, s = this.parser, c = s.json.nodes[i], h2 = (c.extensions && c.extensions[this.name] || {}).light;
  2188. return h2 === void 0 ? null : this._loadLight(h2).then(function(d) {
  2189. return s._getNodeRef(r.cache, h2, d);
  2190. });
  2191. }
  2192. };
  2193. var au = class {
  2194. constructor() {
  2195. this.name = re.KHR_MATERIALS_UNLIT;
  2196. }
  2197. getMaterialType() {
  2198. return MeshBasicMaterial;
  2199. }
  2200. extendParams(i, r, s) {
  2201. const a = [];
  2202. i.color = new Color(1, 1, 1), i.opacity = 1;
  2203. const c = r.pbrMetallicRoughness;
  2204. if (c) {
  2205. if (Array.isArray(c.baseColorFactor)) {
  2206. const u = c.baseColorFactor;
  2207. i.color.fromArray(u), i.opacity = u[3];
  2208. }
  2209. c.baseColorTexture !== void 0 && a.push(s.assignTexture(i, "map", c.baseColorTexture, sRGBEncoding));
  2210. }
  2211. return Promise.all(a);
  2212. }
  2213. };
  2214. var lu = class {
  2215. constructor(i) {
  2216. this.parser = i, this.name = re.KHR_MATERIALS_EMISSIVE_STRENGTH;
  2217. }
  2218. extendMaterialParams(i, r) {
  2219. const a = this.parser.json.materials[i];
  2220. if (!a.extensions || !a.extensions[this.name])
  2221. return Promise.resolve();
  2222. const c = a.extensions[this.name].emissiveStrength;
  2223. return c !== void 0 && (r.emissiveIntensity = c), Promise.resolve();
  2224. }
  2225. };
  2226. var cu = class {
  2227. constructor(i) {
  2228. this.parser = i, this.name = re.KHR_MATERIALS_CLEARCOAT;
  2229. }
  2230. getMaterialType(i) {
  2231. const s = this.parser.json.materials[i];
  2232. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2233. }
  2234. extendMaterialParams(i, r) {
  2235. const s = this.parser, a = s.json.materials[i];
  2236. if (!a.extensions || !a.extensions[this.name])
  2237. return Promise.resolve();
  2238. const c = [], u = a.extensions[this.name];
  2239. if (u.clearcoatFactor !== void 0 && (r.clearcoat = u.clearcoatFactor), u.clearcoatTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatMap", u.clearcoatTexture)), u.clearcoatRoughnessFactor !== void 0 && (r.clearcoatRoughness = u.clearcoatRoughnessFactor), u.clearcoatRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatRoughnessMap", u.clearcoatRoughnessTexture)), u.clearcoatNormalTexture !== void 0 && (c.push(s.assignTexture(r, "clearcoatNormalMap", u.clearcoatNormalTexture)), u.clearcoatNormalTexture.scale !== void 0)) {
  2240. const h2 = u.clearcoatNormalTexture.scale;
  2241. r.clearcoatNormalScale = new Vector2(h2, h2);
  2242. }
  2243. return Promise.all(c);
  2244. }
  2245. };
  2246. var pu = class {
  2247. constructor(i) {
  2248. this.parser = i, this.name = re.KHR_MATERIALS_IRIDESCENCE;
  2249. }
  2250. getMaterialType(i) {
  2251. const s = this.parser.json.materials[i];
  2252. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2253. }
  2254. extendMaterialParams(i, r) {
  2255. const s = this.parser, a = s.json.materials[i];
  2256. if (!a.extensions || !a.extensions[this.name])
  2257. return Promise.resolve();
  2258. const c = [], u = a.extensions[this.name];
  2259. return u.iridescenceFactor !== void 0 && (r.iridescence = u.iridescenceFactor), u.iridescenceTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceMap", u.iridescenceTexture)), u.iridescenceIor !== void 0 && (r.iridescenceIOR = u.iridescenceIor), r.iridescenceThicknessRange === void 0 && (r.iridescenceThicknessRange = [100, 400]), u.iridescenceThicknessMinimum !== void 0 && (r.iridescenceThicknessRange[0] = u.iridescenceThicknessMinimum), u.iridescenceThicknessMaximum !== void 0 && (r.iridescenceThicknessRange[1] = u.iridescenceThicknessMaximum), u.iridescenceThicknessTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceThicknessMap", u.iridescenceThicknessTexture)), Promise.all(c);
  2260. }
  2261. };
  2262. var uu = class {
  2263. constructor(i) {
  2264. this.parser = i, this.name = re.KHR_MATERIALS_SHEEN;
  2265. }
  2266. getMaterialType(i) {
  2267. const s = this.parser.json.materials[i];
  2268. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2269. }
  2270. extendMaterialParams(i, r) {
  2271. const s = this.parser, a = s.json.materials[i];
  2272. if (!a.extensions || !a.extensions[this.name])
  2273. return Promise.resolve();
  2274. const c = [];
  2275. r.sheenColor = new Color(0, 0, 0), r.sheenRoughness = 0, r.sheen = 1;
  2276. const u = a.extensions[this.name];
  2277. return u.sheenColorFactor !== void 0 && r.sheenColor.fromArray(u.sheenColorFactor), u.sheenRoughnessFactor !== void 0 && (r.sheenRoughness = u.sheenRoughnessFactor), u.sheenColorTexture !== void 0 && c.push(s.assignTexture(r, "sheenColorMap", u.sheenColorTexture, sRGBEncoding)), u.sheenRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "sheenRoughnessMap", u.sheenRoughnessTexture)), Promise.all(c);
  2278. }
  2279. };
  2280. var hu = class {
  2281. constructor(i) {
  2282. this.parser = i, this.name = re.KHR_MATERIALS_TRANSMISSION;
  2283. }
  2284. getMaterialType(i) {
  2285. const s = this.parser.json.materials[i];
  2286. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2287. }
  2288. extendMaterialParams(i, r) {
  2289. const s = this.parser, a = s.json.materials[i];
  2290. if (!a.extensions || !a.extensions[this.name])
  2291. return Promise.resolve();
  2292. const c = [], u = a.extensions[this.name];
  2293. return u.transmissionFactor !== void 0 && (r.transmission = u.transmissionFactor), u.transmissionTexture !== void 0 && c.push(s.assignTexture(r, "transmissionMap", u.transmissionTexture)), Promise.all(c);
  2294. }
  2295. };
  2296. var du = class {
  2297. constructor(i) {
  2298. this.parser = i, this.name = re.KHR_MATERIALS_VOLUME;
  2299. }
  2300. getMaterialType(i) {
  2301. const s = this.parser.json.materials[i];
  2302. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2303. }
  2304. extendMaterialParams(i, r) {
  2305. const s = this.parser, a = s.json.materials[i];
  2306. if (!a.extensions || !a.extensions[this.name])
  2307. return Promise.resolve();
  2308. const c = [], u = a.extensions[this.name];
  2309. r.thickness = u.thicknessFactor !== void 0 ? u.thicknessFactor : 0, u.thicknessTexture !== void 0 && c.push(s.assignTexture(r, "thicknessMap", u.thicknessTexture)), r.attenuationDistance = u.attenuationDistance || 1 / 0;
  2310. const h2 = u.attenuationColor || [1, 1, 1];
  2311. return r.attenuationColor = new Color(h2[0], h2[1], h2[2]), Promise.all(c);
  2312. }
  2313. };
  2314. var mu = class {
  2315. constructor(i) {
  2316. this.parser = i, this.name = re.KHR_MATERIALS_IOR;
  2317. }
  2318. getMaterialType(i) {
  2319. const s = this.parser.json.materials[i];
  2320. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2321. }
  2322. extendMaterialParams(i, r) {
  2323. const a = this.parser.json.materials[i];
  2324. if (!a.extensions || !a.extensions[this.name])
  2325. return Promise.resolve();
  2326. const c = a.extensions[this.name];
  2327. return r.ior = c.ior !== void 0 ? c.ior : 1.5, Promise.resolve();
  2328. }
  2329. };
  2330. var fu = class {
  2331. constructor(i) {
  2332. this.parser = i, this.name = re.KHR_MATERIALS_SPECULAR;
  2333. }
  2334. getMaterialType(i) {
  2335. const s = this.parser.json.materials[i];
  2336. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  2337. }
  2338. extendMaterialParams(i, r) {
  2339. const s = this.parser, a = s.json.materials[i];
  2340. if (!a.extensions || !a.extensions[this.name])
  2341. return Promise.resolve();
  2342. const c = [], u = a.extensions[this.name];
  2343. r.specularIntensity = u.specularFactor !== void 0 ? u.specularFactor : 1, u.specularTexture !== void 0 && c.push(s.assignTexture(r, "specularIntensityMap", u.specularTexture));
  2344. const h2 = u.specularColorFactor || [1, 1, 1];
  2345. return r.specularColor = new Color(h2[0], h2[1], h2[2]), u.specularColorTexture !== void 0 && c.push(s.assignTexture(r, "specularColorMap", u.specularColorTexture, sRGBEncoding)), Promise.all(c);
  2346. }
  2347. };
  2348. var vu = class {
  2349. constructor(i) {
  2350. this.parser = i, this.name = re.KHR_TEXTURE_BASISU;
  2351. }
  2352. loadTexture(i) {
  2353. const r = this.parser, s = r.json, a = s.textures[i];
  2354. if (!a.extensions || !a.extensions[this.name])
  2355. return null;
  2356. const c = a.extensions[this.name], u = r.options.ktx2Loader;
  2357. if (!u) {
  2358. if (s.extensionsRequired && s.extensionsRequired.indexOf(this.name) >= 0)
  2359. throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
  2360. return null;
  2361. }
  2362. return r.loadTextureImage(i, c.source, u);
  2363. }
  2364. };
  2365. var bu = class {
  2366. constructor(i) {
  2367. this.parser = i, this.name = re.EXT_TEXTURE_WEBP, this.isSupported = null;
  2368. }
  2369. loadTexture(i) {
  2370. const r = this.name, s = this.parser, a = s.json, c = a.textures[i];
  2371. if (!c.extensions || !c.extensions[r])
  2372. return null;
  2373. const u = c.extensions[r], h2 = a.images[u.source];
  2374. let d = s.textureLoader;
  2375. if (h2.uri) {
  2376. const g = s.options.manager.getHandler(h2.uri);
  2377. g !== null && (d = g);
  2378. }
  2379. return this.detectSupport().then(function(g) {
  2380. if (g)
  2381. return s.loadTextureImage(i, u.source, d);
  2382. if (a.extensionsRequired && a.extensionsRequired.indexOf(r) >= 0)
  2383. throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
  2384. return s.loadTexture(i);
  2385. });
  2386. }
  2387. detectSupport() {
  2388. return this.isSupported || (this.isSupported = new Promise(function(i) {
  2389. const r = new Image();
  2390. r.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", r.onload = r.onerror = function() {
  2391. i(r.height === 1);
  2392. };
  2393. })), this.isSupported;
  2394. }
  2395. };
  2396. var gu = class {
  2397. constructor(i) {
  2398. this.name = re.EXT_MESHOPT_COMPRESSION, this.parser = i;
  2399. }
  2400. loadBufferView(i) {
  2401. const r = this.parser.json, s = r.bufferViews[i];
  2402. if (s.extensions && s.extensions[this.name]) {
  2403. const a = s.extensions[this.name], c = this.parser.getDependency("buffer", a.buffer), u = this.parser.options.meshoptDecoder;
  2404. if (!u || !u.supported) {
  2405. if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
  2406. throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
  2407. return null;
  2408. }
  2409. return c.then(function(h2) {
  2410. const d = a.byteOffset || 0, g = a.byteLength || 0, w = a.count, _ = a.byteStride, y2 = new Uint8Array(h2, d, g);
  2411. return u.decodeGltfBufferAsync ? u.decodeGltfBufferAsync(w, _, y2, a.mode, a.filter).then(function(C) {
  2412. return C.buffer;
  2413. }) : u.ready.then(function() {
  2414. const C = new ArrayBuffer(w * _);
  2415. return u.decodeGltfBuffer(new Uint8Array(C), w, _, y2, a.mode, a.filter), C;
  2416. });
  2417. });
  2418. } else
  2419. return null;
  2420. }
  2421. };
  2422. var $a = "glTF";
  2423. var Gi = 12;
  2424. var aa = {
  2425. JSON: 1313821514,
  2426. BIN: 5130562
  2427. };
  2428. var _u = class {
  2429. constructor(i) {
  2430. this.name = re.KHR_BINARY_GLTF, this.content = null, this.body = null;
  2431. const r = new DataView(i, 0, Gi);
  2432. if (this.header = {
  2433. magic: LoaderUtils.decodeText(new Uint8Array(i.slice(0, 4))),
  2434. version: r.getUint32(4, true),
  2435. length: r.getUint32(8, true)
  2436. }, this.header.magic !== $a)
  2437. throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
  2438. if (this.header.version < 2)
  2439. throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
  2440. const s = this.header.length - Gi, a = new DataView(i, Gi);
  2441. let c = 0;
  2442. for (; c < s; ) {
  2443. const u = a.getUint32(c, true);
  2444. c += 4;
  2445. const h2 = a.getUint32(c, true);
  2446. if (c += 4, h2 === aa.JSON) {
  2447. const d = new Uint8Array(i, Gi + c, u);
  2448. this.content = LoaderUtils.decodeText(d);
  2449. } else if (h2 === aa.BIN) {
  2450. const d = Gi + c;
  2451. this.body = i.slice(d, d + u);
  2452. }
  2453. c += u;
  2454. }
  2455. if (this.content === null)
  2456. throw new Error("THREE.GLTFLoader: JSON content not found.");
  2457. }
  2458. };
  2459. var wu = class {
  2460. constructor(i, r) {
  2461. if (!r)
  2462. throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
  2463. this.name = re.KHR_DRACO_MESH_COMPRESSION, this.json = i, this.dracoLoader = r, this.dracoLoader.preload();
  2464. }
  2465. decodePrimitive(i, r) {
  2466. const s = this.json, a = this.dracoLoader, c = i.extensions[this.name].bufferView, u = i.extensions[this.name].attributes, h2 = {}, d = {}, g = {};
  2467. for (const w in u) {
  2468. const _ = co[w] || w.toLowerCase();
  2469. h2[_] = u[w];
  2470. }
  2471. for (const w in i.attributes) {
  2472. const _ = co[w] || w.toLowerCase();
  2473. if (u[w] !== void 0) {
  2474. const y2 = s.accessors[i.attributes[w]], C = Wi[y2.componentType];
  2475. g[_] = C.name, d[_] = y2.normalized === true;
  2476. }
  2477. }
  2478. return r.getDependency("bufferView", c).then(function(w) {
  2479. return new Promise(function(_) {
  2480. a.decodeDracoFile(w, function(y2) {
  2481. for (const C in y2.attributes) {
  2482. const I2 = y2.attributes[C], S2 = d[C];
  2483. S2 !== void 0 && (I2.normalized = S2);
  2484. }
  2485. _(y2);
  2486. }, h2, g);
  2487. });
  2488. });
  2489. }
  2490. };
  2491. var yu = class {
  2492. constructor() {
  2493. this.name = re.KHR_TEXTURE_TRANSFORM;
  2494. }
  2495. extendTexture(i, r) {
  2496. return r.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), r.offset === void 0 && r.rotation === void 0 && r.scale === void 0 || (i = i.clone(), r.offset !== void 0 && i.offset.fromArray(r.offset), r.rotation !== void 0 && (i.rotation = r.rotation), r.scale !== void 0 && i.repeat.fromArray(r.scale), i.needsUpdate = true), i;
  2497. }
  2498. };
  2499. var lo = class extends MeshStandardMaterial {
  2500. constructor(i) {
  2501. super(), this.isGLTFSpecularGlossinessMaterial = true;
  2502. const r = ["#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif"].join(`
  2503. `), s = ["#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif"].join(`
  2504. `), a = ["vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", " vec4 texelSpecular = texture2D( specularMap, vUv );", " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", " specularFactor *= texelSpecular.rgb;", "#endif"].join(`
  2505. `), 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(`
  2506. `), u = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.roughness += geometryRoughness;", "material.roughness = min( material.roughness, 1.0 );", "material.specularColor = specularFactor;"].join(`
  2507. `), h2 = {
  2508. specular: {
  2509. value: new Color().setHex(16777215)
  2510. },
  2511. glossiness: {
  2512. value: 1
  2513. },
  2514. specularMap: {
  2515. value: null
  2516. },
  2517. glossinessMap: {
  2518. value: null
  2519. }
  2520. };
  2521. this._extraUniforms = h2, this.onBeforeCompile = function(d) {
  2522. for (const g in h2)
  2523. d.uniforms[g] = h2[g];
  2524. d.fragmentShader = d.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", r).replace("#include <metalnessmap_pars_fragment>", s).replace("#include <roughnessmap_fragment>", a).replace("#include <metalnessmap_fragment>", c).replace("#include <lights_physical_fragment>", u);
  2525. }, Object.defineProperties(this, {
  2526. specular: {
  2527. get: function() {
  2528. return h2.specular.value;
  2529. },
  2530. set: function(d) {
  2531. h2.specular.value = d;
  2532. }
  2533. },
  2534. specularMap: {
  2535. get: function() {
  2536. return h2.specularMap.value;
  2537. },
  2538. set: function(d) {
  2539. h2.specularMap.value = d, d ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP;
  2540. }
  2541. },
  2542. glossiness: {
  2543. get: function() {
  2544. return h2.glossiness.value;
  2545. },
  2546. set: function(d) {
  2547. h2.glossiness.value = d;
  2548. }
  2549. },
  2550. glossinessMap: {
  2551. get: function() {
  2552. return h2.glossinessMap.value;
  2553. },
  2554. set: function(d) {
  2555. h2.glossinessMap.value = d, d ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV);
  2556. }
  2557. }
  2558. }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(i);
  2559. }
  2560. copy(i) {
  2561. return super.copy(i), this.specularMap = i.specularMap, this.specular.copy(i.specular), this.glossinessMap = i.glossinessMap, this.glossiness = i.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this;
  2562. }
  2563. };
  2564. var xu = class {
  2565. constructor() {
  2566. 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"];
  2567. }
  2568. getMaterialType() {
  2569. return lo;
  2570. }
  2571. extendParams(i, r, s) {
  2572. const a = r.extensions[this.name];
  2573. i.color = new Color(1, 1, 1), i.opacity = 1;
  2574. const c = [];
  2575. if (Array.isArray(a.diffuseFactor)) {
  2576. const u = a.diffuseFactor;
  2577. i.color.fromArray(u), i.opacity = u[3];
  2578. }
  2579. if (a.diffuseTexture !== void 0 && c.push(s.assignTexture(i, "map", a.diffuseTexture, sRGBEncoding)), i.emissive = new Color(0, 0, 0), i.glossiness = a.glossinessFactor !== void 0 ? a.glossinessFactor : 1, i.specular = new Color(1, 1, 1), Array.isArray(a.specularFactor) && i.specular.fromArray(a.specularFactor), a.specularGlossinessTexture !== void 0) {
  2580. const u = a.specularGlossinessTexture;
  2581. c.push(s.assignTexture(i, "glossinessMap", u)), c.push(s.assignTexture(i, "specularMap", u, sRGBEncoding));
  2582. }
  2583. return Promise.all(c);
  2584. }
  2585. createMaterial(i) {
  2586. const r = new lo(i);
  2587. return r.fog = true, r.color = i.color, r.map = i.map === void 0 ? null : i.map, r.lightMap = null, r.lightMapIntensity = 1, r.aoMap = i.aoMap === void 0 ? null : i.aoMap, r.aoMapIntensity = 1, r.emissive = i.emissive, r.emissiveIntensity = i.emissiveIntensity === void 0 ? 1 : i.emissiveIntensity, r.emissiveMap = i.emissiveMap === void 0 ? null : i.emissiveMap, r.bumpMap = i.bumpMap === void 0 ? null : i.bumpMap, r.bumpScale = 1, r.normalMap = i.normalMap === void 0 ? null : i.normalMap, r.normalMapType = TangentSpaceNormalMap, i.normalScale && (r.normalScale = i.normalScale), r.displacementMap = null, r.displacementScale = 1, r.displacementBias = 0, r.specularMap = i.specularMap === void 0 ? null : i.specularMap, r.specular = i.specular, r.glossinessMap = i.glossinessMap === void 0 ? null : i.glossinessMap, r.glossiness = i.glossiness, r.alphaMap = null, r.envMap = i.envMap === void 0 ? null : i.envMap, r.envMapIntensity = 1, r.refractionRatio = 0.98, r;
  2588. }
  2589. };
  2590. var Eu = class {
  2591. constructor() {
  2592. this.name = re.KHR_MESH_QUANTIZATION;
  2593. }
  2594. };
  2595. var Xa = class extends Interpolant {
  2596. constructor(i, r, s, a) {
  2597. super(i, r, s, a);
  2598. }
  2599. copySampleValue_(i) {
  2600. const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, c = i * a * 3 + a;
  2601. for (let u = 0; u !== a; u++)
  2602. r[u] = s[c + u];
  2603. return r;
  2604. }
  2605. interpolate_(i, r, s, a) {
  2606. const c = this.resultBuffer, u = this.sampleValues, h2 = this.valueSize, d = h2 * 2, g = h2 * 3, w = a - r, _ = (s - r) / w, y2 = _ * _, C = y2 * _, I2 = i * g, S2 = I2 - g, R2 = -2 * C + 3 * y2, j2 = C - y2, F = 1 - R2, V2 = j2 - y2 + _;
  2607. for (let D = 0; D !== h2; D++) {
  2608. const Y = u[S2 + D + h2], G2 = u[S2 + D + d] * w, N = u[I2 + D + h2], O = u[I2 + D] * w;
  2609. c[D] = F * Y + V2 * G2 + R2 * N + j2 * O;
  2610. }
  2611. return c;
  2612. }
  2613. };
  2614. var Cu = new Quaternion();
  2615. var Pu = class extends Xa {
  2616. interpolate_(i, r, s, a) {
  2617. const c = super.interpolate_(i, r, s, a);
  2618. return Cu.fromArray(c).normalize().toArray(c), c;
  2619. }
  2620. };
  2621. var Bt = {
  2622. FLOAT: 5126,
  2623. //FLOAT_MAT2: 35674,
  2624. FLOAT_MAT3: 35675,
  2625. FLOAT_MAT4: 35676,
  2626. FLOAT_VEC2: 35664,
  2627. FLOAT_VEC3: 35665,
  2628. FLOAT_VEC4: 35666,
  2629. LINEAR: 9729,
  2630. REPEAT: 10497,
  2631. SAMPLER_2D: 35678,
  2632. POINTS: 0,
  2633. LINES: 1,
  2634. LINE_LOOP: 2,
  2635. LINE_STRIP: 3,
  2636. TRIANGLES: 4,
  2637. TRIANGLE_STRIP: 5,
  2638. TRIANGLE_FAN: 6,
  2639. UNSIGNED_BYTE: 5121,
  2640. UNSIGNED_SHORT: 5123
  2641. };
  2642. var Wi = {
  2643. 5120: Int8Array,
  2644. 5121: Uint8Array,
  2645. 5122: Int16Array,
  2646. 5123: Uint16Array,
  2647. 5125: Uint32Array,
  2648. 5126: Float32Array
  2649. };
  2650. var la = {
  2651. 9728: NearestFilter,
  2652. 9729: LinearFilter,
  2653. 9984: NearestMipmapNearestFilter,
  2654. 9985: LinearMipmapNearestFilter,
  2655. 9986: NearestMipmapLinearFilter,
  2656. 9987: LinearMipmapLinearFilter
  2657. };
  2658. var ca = {
  2659. 33071: ClampToEdgeWrapping,
  2660. 33648: MirroredRepeatWrapping,
  2661. 10497: RepeatWrapping
  2662. };
  2663. var pa = {
  2664. SCALAR: 1,
  2665. VEC2: 2,
  2666. VEC3: 3,
  2667. VEC4: 4,
  2668. MAT2: 4,
  2669. MAT3: 9,
  2670. MAT4: 16
  2671. };
  2672. var co = {
  2673. POSITION: "position",
  2674. NORMAL: "normal",
  2675. TANGENT: "tangent",
  2676. TEXCOORD_0: "uv",
  2677. TEXCOORD_1: "uv2",
  2678. COLOR_0: "color",
  2679. WEIGHTS_0: "skinWeight",
  2680. JOINTS_0: "skinIndex"
  2681. };
  2682. var nn = {
  2683. scale: "scale",
  2684. translation: "position",
  2685. rotation: "quaternion",
  2686. weights: "morphTargetInfluences"
  2687. };
  2688. var Tu = {
  2689. CUBICSPLINE: void 0,
  2690. // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  2691. // keyframe track will be initialized with a default interpolation type, then modified.
  2692. LINEAR: InterpolateLinear,
  2693. STEP: InterpolateDiscrete
  2694. };
  2695. var Qr = {
  2696. OPAQUE: "OPAQUE",
  2697. MASK: "MASK",
  2698. BLEND: "BLEND"
  2699. };
  2700. function ku(b2) {
  2701. return b2.DefaultMaterial === void 0 && (b2.DefaultMaterial = new MeshStandardMaterial({
  2702. color: 16777215,
  2703. emissive: 0,
  2704. metalness: 1,
  2705. roughness: 1,
  2706. transparent: false,
  2707. depthTest: true,
  2708. side: FrontSide
  2709. })), b2.DefaultMaterial;
  2710. }
  2711. function Hi(b2, i, r) {
  2712. for (const s in r.extensions)
  2713. b2[s] === void 0 && (i.userData.gltfExtensions = i.userData.gltfExtensions || {}, i.userData.gltfExtensions[s] = r.extensions[s]);
  2714. }
  2715. function In(b2, i) {
  2716. i.extras !== void 0 && (typeof i.extras == "object" ? Object.assign(b2.userData, i.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + i.extras));
  2717. }
  2718. function Mu(b2, i, r) {
  2719. let s = false, a = false, c = false;
  2720. for (let g = 0, w = i.length; g < w; g++) {
  2721. const _ = i[g];
  2722. if (_.POSITION !== void 0 && (s = true), _.NORMAL !== void 0 && (a = true), _.COLOR_0 !== void 0 && (c = true), s && a && c)
  2723. break;
  2724. }
  2725. if (!s && !a && !c)
  2726. return Promise.resolve(b2);
  2727. const u = [], h2 = [], d = [];
  2728. for (let g = 0, w = i.length; g < w; g++) {
  2729. const _ = i[g];
  2730. if (s) {
  2731. const y2 = _.POSITION !== void 0 ? r.getDependency("accessor", _.POSITION) : b2.attributes.position;
  2732. u.push(y2);
  2733. }
  2734. if (a) {
  2735. const y2 = _.NORMAL !== void 0 ? r.getDependency("accessor", _.NORMAL) : b2.attributes.normal;
  2736. h2.push(y2);
  2737. }
  2738. if (c) {
  2739. const y2 = _.COLOR_0 !== void 0 ? r.getDependency("accessor", _.COLOR_0) : b2.attributes.color;
  2740. d.push(y2);
  2741. }
  2742. }
  2743. return Promise.all([Promise.all(u), Promise.all(h2), Promise.all(d)]).then(function(g) {
  2744. const w = g[0], _ = g[1], y2 = g[2];
  2745. return s && (b2.morphAttributes.position = w), a && (b2.morphAttributes.normal = _), c && (b2.morphAttributes.color = y2), b2.morphTargetsRelative = true, b2;
  2746. });
  2747. }
  2748. function Su(b2, i) {
  2749. if (b2.updateMorphTargets(), i.weights !== void 0)
  2750. for (let r = 0, s = i.weights.length; r < s; r++)
  2751. b2.morphTargetInfluences[r] = i.weights[r];
  2752. if (i.extras && Array.isArray(i.extras.targetNames)) {
  2753. const r = i.extras.targetNames;
  2754. if (b2.morphTargetInfluences.length === r.length) {
  2755. b2.morphTargetDictionary = {};
  2756. for (let s = 0, a = r.length; s < a; s++)
  2757. b2.morphTargetDictionary[r[s]] = s;
  2758. } else
  2759. console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
  2760. }
  2761. }
  2762. function Au(b2) {
  2763. const i = b2.extensions && b2.extensions[re.KHR_DRACO_MESH_COMPRESSION];
  2764. let r;
  2765. return i ? r = "draco:" + i.bufferView + ":" + i.indices + ":" + ua(i.attributes) : r = b2.indices + ":" + ua(b2.attributes) + ":" + b2.mode, r;
  2766. }
  2767. function ua(b2) {
  2768. let i = "";
  2769. const r = Object.keys(b2).sort();
  2770. for (let s = 0, a = r.length; s < a; s++)
  2771. i += r[s] + ":" + b2[r[s]] + ";";
  2772. return i;
  2773. }
  2774. function po(b2) {
  2775. switch (b2) {
  2776. case Int8Array:
  2777. return 1 / 127;
  2778. case Uint8Array:
  2779. return 1 / 255;
  2780. case Int16Array:
  2781. return 1 / 32767;
  2782. case Uint16Array:
  2783. return 1 / 65535;
  2784. default:
  2785. throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
  2786. }
  2787. }
  2788. function Lu(b2) {
  2789. return b2.search(/\.jpe?g($|\?)/i) > 0 || b2.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : b2.search(/\.webp($|\?)/i) > 0 || b2.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
  2790. }
  2791. var Ru = class {
  2792. constructor(i = {}, r = {}) {
  2793. var s, a;
  2794. this.json = i, this.extensions = {}, this.plugins = {}, this.options = r, this.cache = new ru(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = {
  2795. refs: {},
  2796. uses: {}
  2797. }, this.cameraCache = {
  2798. refs: {},
  2799. uses: {}
  2800. }, this.lightCache = {
  2801. refs: {},
  2802. uses: {}
  2803. }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
  2804. const c = typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true, u = typeof navigator < "u" && ((s = navigator.userAgent) === null || s === void 0 ? void 0 : s.indexOf("Firefox")) > -1, h2 = typeof navigator < "u" && u ? (a = navigator.userAgent) === null || a === void 0 ? void 0 : a.match(/Firefox\/([0-9]+)\./)[1] : -1;
  2805. typeof createImageBitmap > "u" || c || u && h2 < 98 ? this.textureLoader = new TextureLoader(this.options.manager) : this.textureLoader = new ImageBitmapLoader(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new FileLoader(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(true);
  2806. }
  2807. setExtensions(i) {
  2808. this.extensions = i;
  2809. }
  2810. setPlugins(i) {
  2811. this.plugins = i;
  2812. }
  2813. parse(i, r) {
  2814. const s = this, a = this.json, c = this.extensions;
  2815. this.cache.removeAll(), this._invokeAll(function(u) {
  2816. return u._markDefs && u._markDefs();
  2817. }), Promise.all(this._invokeAll(function(u) {
  2818. return u.beforeRoot && u.beforeRoot();
  2819. })).then(function() {
  2820. return Promise.all([s.getDependencies("scene"), s.getDependencies("animation"), s.getDependencies("camera")]);
  2821. }).then(function(u) {
  2822. const h2 = {
  2823. scene: u[0][a.scene || 0],
  2824. scenes: u[0],
  2825. animations: u[1],
  2826. cameras: u[2],
  2827. asset: a.asset,
  2828. parser: s,
  2829. userData: {}
  2830. };
  2831. Hi(c, h2, a), In(h2, a), Promise.all(s._invokeAll(function(d) {
  2832. return d.afterRoot && d.afterRoot(h2);
  2833. })).then(function() {
  2834. i(h2);
  2835. });
  2836. }).catch(r);
  2837. }
  2838. /**
  2839. * Marks the special nodes/meshes in json for efficient parse.
  2840. */
  2841. _markDefs() {
  2842. const i = this.json.nodes || [], r = this.json.skins || [], s = this.json.meshes || [];
  2843. for (let a = 0, c = r.length; a < c; a++) {
  2844. const u = r[a].joints;
  2845. for (let h2 = 0, d = u.length; h2 < d; h2++)
  2846. i[u[h2]].isBone = true;
  2847. }
  2848. for (let a = 0, c = i.length; a < c; a++) {
  2849. const u = i[a];
  2850. u.mesh !== void 0 && (this._addNodeRef(this.meshCache, u.mesh), u.skin !== void 0 && (s[u.mesh].isSkinnedMesh = true)), u.camera !== void 0 && this._addNodeRef(this.cameraCache, u.camera);
  2851. }
  2852. }
  2853. /**
  2854. * Counts references to shared node / Object3D resources. These resources
  2855. * can be reused, or "instantiated", at multiple nodes in the scene
  2856. * hierarchy. Mesh, Camera, and Light instances are instantiated and must
  2857. * be marked. Non-scenegraph resources (like Materials, Geometries, and
  2858. * Textures) can be reused directly and are not marked here.
  2859. *
  2860. * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
  2861. */
  2862. _addNodeRef(i, r) {
  2863. r !== void 0 && (i.refs[r] === void 0 && (i.refs[r] = i.uses[r] = 0), i.refs[r]++);
  2864. }
  2865. /** Returns a reference to a shared resource, cloning it if necessary. */
  2866. _getNodeRef(i, r, s) {
  2867. if (i.refs[r] <= 1)
  2868. return s;
  2869. const a = s.clone(), c = (u, h2) => {
  2870. const d = this.associations.get(u);
  2871. d != null && this.associations.set(h2, d);
  2872. for (const [g, w] of u.children.entries())
  2873. c(w, h2.children[g]);
  2874. };
  2875. return c(s, a), a.name += "_instance_" + i.uses[r]++, a;
  2876. }
  2877. _invokeOne(i) {
  2878. const r = Object.values(this.plugins);
  2879. r.push(this);
  2880. for (let s = 0; s < r.length; s++) {
  2881. const a = i(r[s]);
  2882. if (a)
  2883. return a;
  2884. }
  2885. return null;
  2886. }
  2887. _invokeAll(i) {
  2888. const r = Object.values(this.plugins);
  2889. r.unshift(this);
  2890. const s = [];
  2891. for (let a = 0; a < r.length; a++) {
  2892. const c = i(r[a]);
  2893. c && s.push(c);
  2894. }
  2895. return s;
  2896. }
  2897. /**
  2898. * Requests the specified dependency asynchronously, with caching.
  2899. * @param {string} type
  2900. * @param {number} index
  2901. * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
  2902. */
  2903. getDependency(i, r) {
  2904. const s = i + ":" + r;
  2905. let a = this.cache.get(s);
  2906. if (!a) {
  2907. switch (i) {
  2908. case "scene":
  2909. a = this.loadScene(r);
  2910. break;
  2911. case "node":
  2912. a = this.loadNode(r);
  2913. break;
  2914. case "mesh":
  2915. a = this._invokeOne(function(c) {
  2916. return c.loadMesh && c.loadMesh(r);
  2917. });
  2918. break;
  2919. case "accessor":
  2920. a = this.loadAccessor(r);
  2921. break;
  2922. case "bufferView":
  2923. a = this._invokeOne(function(c) {
  2924. return c.loadBufferView && c.loadBufferView(r);
  2925. });
  2926. break;
  2927. case "buffer":
  2928. a = this.loadBuffer(r);
  2929. break;
  2930. case "material":
  2931. a = this._invokeOne(function(c) {
  2932. return c.loadMaterial && c.loadMaterial(r);
  2933. });
  2934. break;
  2935. case "texture":
  2936. a = this._invokeOne(function(c) {
  2937. return c.loadTexture && c.loadTexture(r);
  2938. });
  2939. break;
  2940. case "skin":
  2941. a = this.loadSkin(r);
  2942. break;
  2943. case "animation":
  2944. a = this._invokeOne(function(c) {
  2945. return c.loadAnimation && c.loadAnimation(r);
  2946. });
  2947. break;
  2948. case "camera":
  2949. a = this.loadCamera(r);
  2950. break;
  2951. default:
  2952. throw new Error("Unknown type: " + i);
  2953. }
  2954. this.cache.add(s, a);
  2955. }
  2956. return a;
  2957. }
  2958. /**
  2959. * Requests all dependencies of the specified type asynchronously, with caching.
  2960. * @param {string} type
  2961. * @return {Promise<Array<Object>>}
  2962. */
  2963. getDependencies(i) {
  2964. let r = this.cache.get(i);
  2965. if (!r) {
  2966. const s = this, a = this.json[i + (i === "mesh" ? "es" : "s")] || [];
  2967. r = Promise.all(a.map(function(c, u) {
  2968. return s.getDependency(i, u);
  2969. })), this.cache.add(i, r);
  2970. }
  2971. return r;
  2972. }
  2973. /**
  2974. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2975. * @param {number} bufferIndex
  2976. * @return {Promise<ArrayBuffer>}
  2977. */
  2978. loadBuffer(i) {
  2979. const r = this.json.buffers[i], s = this.fileLoader;
  2980. if (r.type && r.type !== "arraybuffer")
  2981. throw new Error("THREE.GLTFLoader: " + r.type + " buffer type is not supported.");
  2982. if (r.uri === void 0 && i === 0)
  2983. return Promise.resolve(this.extensions[re.KHR_BINARY_GLTF].body);
  2984. const a = this.options;
  2985. return new Promise(function(c, u) {
  2986. s.load(LoaderUtils.resolveURL(r.uri, a.path), c, void 0, function() {
  2987. u(new Error('THREE.GLTFLoader: Failed to load buffer "' + r.uri + '".'));
  2988. });
  2989. });
  2990. }
  2991. /**
  2992. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2993. * @param {number} bufferViewIndex
  2994. * @return {Promise<ArrayBuffer>}
  2995. */
  2996. loadBufferView(i) {
  2997. const r = this.json.bufferViews[i];
  2998. return this.getDependency("buffer", r.buffer).then(function(s) {
  2999. const a = r.byteLength || 0, c = r.byteOffset || 0;
  3000. return s.slice(c, c + a);
  3001. });
  3002. }
  3003. /**
  3004. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
  3005. * @param {number} accessorIndex
  3006. * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
  3007. */
  3008. loadAccessor(i) {
  3009. const r = this, s = this.json, a = this.json.accessors[i];
  3010. if (a.bufferView === void 0 && a.sparse === void 0)
  3011. return Promise.resolve(null);
  3012. const c = [];
  3013. return a.bufferView !== void 0 ? c.push(this.getDependency("bufferView", a.bufferView)) : c.push(null), a.sparse !== void 0 && (c.push(this.getDependency("bufferView", a.sparse.indices.bufferView)), c.push(this.getDependency("bufferView", a.sparse.values.bufferView))), Promise.all(c).then(function(u) {
  3014. const h2 = u[0], d = pa[a.type], g = Wi[a.componentType], w = g.BYTES_PER_ELEMENT, _ = w * d, y2 = a.byteOffset || 0, C = a.bufferView !== void 0 ? s.bufferViews[a.bufferView].byteStride : void 0, I2 = a.normalized === true;
  3015. let S2, R2;
  3016. if (C && C !== _) {
  3017. const j2 = Math.floor(y2 / C), F = "InterleavedBuffer:" + a.bufferView + ":" + a.componentType + ":" + j2 + ":" + a.count;
  3018. let V2 = r.cache.get(F);
  3019. V2 || (S2 = new g(h2, j2 * C, a.count * C / w), V2 = new InterleavedBuffer(S2, C / w), r.cache.add(F, V2)), R2 = new InterleavedBufferAttribute(V2, d, y2 % C / w, I2);
  3020. } else
  3021. h2 === null ? S2 = new g(a.count * d) : S2 = new g(h2, y2, a.count * d), R2 = new BufferAttribute(S2, d, I2);
  3022. if (a.sparse !== void 0) {
  3023. const j2 = pa.SCALAR, F = Wi[a.sparse.indices.componentType], V2 = a.sparse.indices.byteOffset || 0, D = a.sparse.values.byteOffset || 0, Y = new F(u[1], V2, a.sparse.count * j2), G2 = new g(u[2], D, a.sparse.count * d);
  3024. h2 !== null && (R2 = new BufferAttribute(R2.array.slice(), R2.itemSize, R2.normalized));
  3025. for (let N = 0, O = Y.length; N < O; N++) {
  3026. const H2 = Y[N];
  3027. if (R2.setX(H2, G2[N * d]), d >= 2 && R2.setY(H2, G2[N * d + 1]), d >= 3 && R2.setZ(H2, G2[N * d + 2]), d >= 4 && R2.setW(H2, G2[N * d + 3]), d >= 5)
  3028. throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
  3029. }
  3030. }
  3031. return R2;
  3032. });
  3033. }
  3034. /**
  3035. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
  3036. * @param {number} textureIndex
  3037. * @return {Promise<THREE.Texture>}
  3038. */
  3039. loadTexture(i) {
  3040. const r = this.json, s = this.options, c = r.textures[i].source, u = r.images[c];
  3041. let h2 = this.textureLoader;
  3042. if (u.uri) {
  3043. const d = s.manager.getHandler(u.uri);
  3044. d !== null && (h2 = d);
  3045. }
  3046. return this.loadTextureImage(i, c, h2);
  3047. }
  3048. loadTextureImage(i, r, s) {
  3049. const a = this, c = this.json, u = c.textures[i], h2 = c.images[r], d = (h2.uri || h2.bufferView) + ":" + u.sampler;
  3050. if (this.textureCache[d])
  3051. return this.textureCache[d];
  3052. const g = this.loadImageSource(r, s).then(function(w) {
  3053. w.flipY = false, u.name && (w.name = u.name);
  3054. const y2 = (c.samplers || {})[u.sampler] || {};
  3055. return w.magFilter = la[y2.magFilter] || LinearFilter, w.minFilter = la[y2.minFilter] || LinearMipmapLinearFilter, w.wrapS = ca[y2.wrapS] || RepeatWrapping, w.wrapT = ca[y2.wrapT] || RepeatWrapping, a.associations.set(w, {
  3056. textures: i
  3057. }), w;
  3058. }).catch(function() {
  3059. return null;
  3060. });
  3061. return this.textureCache[d] = g, g;
  3062. }
  3063. loadImageSource(i, r) {
  3064. const s = this, a = this.json, c = this.options;
  3065. if (this.sourceCache[i] !== void 0)
  3066. return this.sourceCache[i].then((_) => _.clone());
  3067. const u = a.images[i], h2 = self.URL || self.webkitURL;
  3068. let d = u.uri || "", g = false;
  3069. if (u.bufferView !== void 0)
  3070. d = s.getDependency("bufferView", u.bufferView).then(function(_) {
  3071. g = true;
  3072. const y2 = new Blob([_], {
  3073. type: u.mimeType
  3074. });
  3075. return d = h2.createObjectURL(y2), d;
  3076. });
  3077. else if (u.uri === void 0)
  3078. throw new Error("THREE.GLTFLoader: Image " + i + " is missing URI and bufferView");
  3079. const w = Promise.resolve(d).then(function(_) {
  3080. return new Promise(function(y2, C) {
  3081. let I2 = y2;
  3082. r.isImageBitmapLoader === true && (I2 = function(S2) {
  3083. const R2 = new Texture(S2);
  3084. R2.needsUpdate = true, y2(R2);
  3085. }), r.load(LoaderUtils.resolveURL(_, c.path), I2, void 0, C);
  3086. });
  3087. }).then(function(_) {
  3088. return g === true && h2.revokeObjectURL(d), _.userData.mimeType = u.mimeType || Lu(u.uri), _;
  3089. }).catch(function(_) {
  3090. throw console.error("THREE.GLTFLoader: Couldn't load texture", d), _;
  3091. });
  3092. return this.sourceCache[i] = w, w;
  3093. }
  3094. /**
  3095. * Asynchronously assigns a texture to the given material parameters.
  3096. * @param {Object} materialParams
  3097. * @param {string} mapName
  3098. * @param {Object} mapDef
  3099. * @return {Promise<Texture>}
  3100. */
  3101. assignTexture(i, r, s, a) {
  3102. const c = this;
  3103. return this.getDependency("texture", s.index).then(function(u) {
  3104. if (s.texCoord !== void 0 && s.texCoord != 0 && !(r === "aoMap" && s.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + s.texCoord + " for texture " + r + " not yet supported."), c.extensions[re.KHR_TEXTURE_TRANSFORM]) {
  3105. const h2 = s.extensions !== void 0 ? s.extensions[re.KHR_TEXTURE_TRANSFORM] : void 0;
  3106. if (h2) {
  3107. const d = c.associations.get(u);
  3108. u = c.extensions[re.KHR_TEXTURE_TRANSFORM].extendTexture(u, h2), c.associations.set(u, d);
  3109. }
  3110. }
  3111. return a !== void 0 && (u.encoding = a), i[r] = u, u;
  3112. });
  3113. }
  3114. /**
  3115. * Assigns final material to a Mesh, Line, or Points instance. The instance
  3116. * already has a material (generated from the glTF material options alone)
  3117. * but reuse of the same glTF material may require multiple threejs materials
  3118. * to accommodate different primitive types, defines, etc. New materials will
  3119. * be created if necessary, and reused from a cache.
  3120. * @param {Object3D} mesh Mesh, Line, or Points instance.
  3121. */
  3122. assignFinalMaterial(i) {
  3123. const r = i.geometry;
  3124. let s = i.material;
  3125. const a = r.attributes.tangent === void 0, c = r.attributes.color !== void 0, u = r.attributes.normal === void 0;
  3126. if (i.isPoints) {
  3127. const h2 = "PointsMaterial:" + s.uuid;
  3128. let d = this.cache.get(h2);
  3129. d || (d = new PointsMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), d.map = s.map, d.sizeAttenuation = false, this.cache.add(h2, d)), s = d;
  3130. } else if (i.isLine) {
  3131. const h2 = "LineBasicMaterial:" + s.uuid;
  3132. let d = this.cache.get(h2);
  3133. d || (d = new LineBasicMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), this.cache.add(h2, d)), s = d;
  3134. }
  3135. if (a || c || u) {
  3136. let h2 = "ClonedMaterial:" + s.uuid + ":";
  3137. s.isGLTFSpecularGlossinessMaterial && (h2 += "specular-glossiness:"), a && (h2 += "derivative-tangents:"), c && (h2 += "vertex-colors:"), u && (h2 += "flat-shading:");
  3138. let d = this.cache.get(h2);
  3139. d || (d = s.clone(), c && (d.vertexColors = true), u && (d.flatShading = true), a && (d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(h2, d), this.associations.set(d, this.associations.get(s))), s = d;
  3140. }
  3141. s.aoMap && r.attributes.uv2 === void 0 && r.attributes.uv !== void 0 && r.setAttribute("uv2", r.attributes.uv), i.material = s;
  3142. }
  3143. getMaterialType() {
  3144. return MeshStandardMaterial;
  3145. }
  3146. /**
  3147. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
  3148. * @param {number} materialIndex
  3149. * @return {Promise<Material>}
  3150. */
  3151. loadMaterial(i) {
  3152. const r = this, s = this.json, a = this.extensions, c = s.materials[i];
  3153. let u;
  3154. const h2 = {}, d = c.extensions || {}, g = [];
  3155. if (d[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
  3156. const _ = a[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
  3157. u = _.getMaterialType(), g.push(_.extendParams(h2, c, r));
  3158. } else if (d[re.KHR_MATERIALS_UNLIT]) {
  3159. const _ = a[re.KHR_MATERIALS_UNLIT];
  3160. u = _.getMaterialType(), g.push(_.extendParams(h2, c, r));
  3161. } else {
  3162. const _ = c.pbrMetallicRoughness || {};
  3163. if (h2.color = new Color(1, 1, 1), h2.opacity = 1, Array.isArray(_.baseColorFactor)) {
  3164. const y2 = _.baseColorFactor;
  3165. h2.color.fromArray(y2), h2.opacity = y2[3];
  3166. }
  3167. _.baseColorTexture !== void 0 && g.push(r.assignTexture(h2, "map", _.baseColorTexture, sRGBEncoding)), h2.metalness = _.metallicFactor !== void 0 ? _.metallicFactor : 1, h2.roughness = _.roughnessFactor !== void 0 ? _.roughnessFactor : 1, _.metallicRoughnessTexture !== void 0 && (g.push(r.assignTexture(h2, "metalnessMap", _.metallicRoughnessTexture)), g.push(r.assignTexture(h2, "roughnessMap", _.metallicRoughnessTexture))), u = this._invokeOne(function(y2) {
  3168. return y2.getMaterialType && y2.getMaterialType(i);
  3169. }), g.push(Promise.all(this._invokeAll(function(y2) {
  3170. return y2.extendMaterialParams && y2.extendMaterialParams(i, h2);
  3171. })));
  3172. }
  3173. c.doubleSided === true && (h2.side = DoubleSide);
  3174. const w = c.alphaMode || Qr.OPAQUE;
  3175. if (w === Qr.BLEND ? (h2.transparent = true, h2.depthWrite = false) : (h2.transparent = false, w === Qr.MASK && (h2.alphaTest = c.alphaCutoff !== void 0 ? c.alphaCutoff : 0.5)), c.normalTexture !== void 0 && u !== MeshBasicMaterial && (g.push(r.assignTexture(h2, "normalMap", c.normalTexture)), h2.normalScale = new Vector2(1, 1), c.normalTexture.scale !== void 0)) {
  3176. const _ = c.normalTexture.scale;
  3177. h2.normalScale.set(_, _);
  3178. }
  3179. return c.occlusionTexture !== void 0 && u !== MeshBasicMaterial && (g.push(r.assignTexture(h2, "aoMap", c.occlusionTexture)), c.occlusionTexture.strength !== void 0 && (h2.aoMapIntensity = c.occlusionTexture.strength)), c.emissiveFactor !== void 0 && u !== MeshBasicMaterial && (h2.emissive = new Color().fromArray(c.emissiveFactor)), c.emissiveTexture !== void 0 && u !== MeshBasicMaterial && g.push(r.assignTexture(h2, "emissiveMap", c.emissiveTexture, sRGBEncoding)), Promise.all(g).then(function() {
  3180. let _;
  3181. return u === lo ? _ = a[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(h2) : _ = new u(h2), c.name && (_.name = c.name), In(_, c), r.associations.set(_, {
  3182. materials: i
  3183. }), c.extensions && Hi(a, _, c), _;
  3184. });
  3185. }
  3186. /** When Object3D instances are targeted by animation, they need unique names. */
  3187. createUniqueName(i) {
  3188. const r = PropertyBinding.sanitizeNodeName(i || "");
  3189. let s = r;
  3190. for (let a = 1; this.nodeNamesUsed[s]; ++a)
  3191. s = r + "_" + a;
  3192. return this.nodeNamesUsed[s] = true, s;
  3193. }
  3194. /**
  3195. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
  3196. *
  3197. * Creates BufferGeometries from primitives.
  3198. *
  3199. * @param {Array<GLTF.Primitive>} primitives
  3200. * @return {Promise<Array<BufferGeometry>>}
  3201. */
  3202. loadGeometries(i) {
  3203. const r = this, s = this.extensions, a = this.primitiveCache;
  3204. function c(h2) {
  3205. return s[re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h2, r).then(function(d) {
  3206. return ha(d, h2, r);
  3207. });
  3208. }
  3209. const u = [];
  3210. for (let h2 = 0, d = i.length; h2 < d; h2++) {
  3211. const g = i[h2], w = Au(g), _ = a[w];
  3212. if (_)
  3213. u.push(_.promise);
  3214. else {
  3215. let y2;
  3216. g.extensions && g.extensions[re.KHR_DRACO_MESH_COMPRESSION] ? y2 = c(g) : y2 = ha(new BufferGeometry(), g, r), a[w] = {
  3217. primitive: g,
  3218. promise: y2
  3219. }, u.push(y2);
  3220. }
  3221. }
  3222. return Promise.all(u);
  3223. }
  3224. /**
  3225. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
  3226. * @param {number} meshIndex
  3227. * @return {Promise<Group|Mesh|SkinnedMesh>}
  3228. */
  3229. loadMesh(i) {
  3230. const r = this, s = this.json, a = this.extensions, c = s.meshes[i], u = c.primitives, h2 = [];
  3231. for (let d = 0, g = u.length; d < g; d++) {
  3232. const w = u[d].material === void 0 ? ku(this.cache) : this.getDependency("material", u[d].material);
  3233. h2.push(w);
  3234. }
  3235. return h2.push(r.loadGeometries(u)), Promise.all(h2).then(function(d) {
  3236. const g = d.slice(0, d.length - 1), w = d[d.length - 1], _ = [];
  3237. for (let C = 0, I2 = w.length; C < I2; C++) {
  3238. const S2 = w[C], R2 = u[C];
  3239. let j2;
  3240. const F = g[C];
  3241. if (R2.mode === Bt.TRIANGLES || R2.mode === Bt.TRIANGLE_STRIP || R2.mode === Bt.TRIANGLE_FAN || R2.mode === void 0)
  3242. j2 = c.isSkinnedMesh === true ? new SkinnedMesh(S2, F) : new Mesh(S2, F), j2.isSkinnedMesh === true && !j2.geometry.attributes.skinWeight.normalized && j2.normalizeSkinWeights(), R2.mode === Bt.TRIANGLE_STRIP ? j2.geometry = da(j2.geometry, TriangleStripDrawMode) : R2.mode === Bt.TRIANGLE_FAN && (j2.geometry = da(j2.geometry, TriangleFanDrawMode));
  3243. else if (R2.mode === Bt.LINES)
  3244. j2 = new LineSegments(S2, F);
  3245. else if (R2.mode === Bt.LINE_STRIP)
  3246. j2 = new Line(S2, F);
  3247. else if (R2.mode === Bt.LINE_LOOP)
  3248. j2 = new LineLoop(S2, F);
  3249. else if (R2.mode === Bt.POINTS)
  3250. j2 = new Points(S2, F);
  3251. else
  3252. throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + R2.mode);
  3253. Object.keys(j2.geometry.morphAttributes).length > 0 && Su(j2, c), j2.name = r.createUniqueName(c.name || "mesh_" + i), In(j2, c), R2.extensions && Hi(a, j2, R2), r.assignFinalMaterial(j2), _.push(j2);
  3254. }
  3255. for (let C = 0, I2 = _.length; C < I2; C++)
  3256. r.associations.set(_[C], {
  3257. meshes: i,
  3258. primitives: C
  3259. });
  3260. if (_.length === 1)
  3261. return _[0];
  3262. const y2 = new Group();
  3263. r.associations.set(y2, {
  3264. meshes: i
  3265. });
  3266. for (let C = 0, I2 = _.length; C < I2; C++)
  3267. y2.add(_[C]);
  3268. return y2;
  3269. });
  3270. }
  3271. /**
  3272. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
  3273. * @param {number} cameraIndex
  3274. * @return {Promise<THREE.Camera>}
  3275. */
  3276. loadCamera(i) {
  3277. let r;
  3278. const s = this.json.cameras[i], a = s[s.type];
  3279. if (!a) {
  3280. console.warn("THREE.GLTFLoader: Missing camera parameters.");
  3281. return;
  3282. }
  3283. return s.type === "perspective" ? r = new PerspectiveCamera(MathUtils.radToDeg(a.yfov), a.aspectRatio || 1, a.znear || 1, a.zfar || 2e6) : s.type === "orthographic" && (r = new OrthographicCamera(-a.xmag, a.xmag, a.ymag, -a.ymag, a.znear, a.zfar)), s.name && (r.name = this.createUniqueName(s.name)), In(r, s), Promise.resolve(r);
  3284. }
  3285. /**
  3286. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
  3287. * @param {number} skinIndex
  3288. * @return {Promise<Object>}
  3289. */
  3290. loadSkin(i) {
  3291. const r = this.json.skins[i], s = {
  3292. joints: r.joints
  3293. };
  3294. return r.inverseBindMatrices === void 0 ? Promise.resolve(s) : this.getDependency("accessor", r.inverseBindMatrices).then(function(a) {
  3295. return s.inverseBindMatrices = a, s;
  3296. });
  3297. }
  3298. /**
  3299. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
  3300. * @param {number} animationIndex
  3301. * @return {Promise<AnimationClip>}
  3302. */
  3303. loadAnimation(i) {
  3304. const s = this.json.animations[i], a = [], c = [], u = [], h2 = [], d = [];
  3305. for (let g = 0, w = s.channels.length; g < w; g++) {
  3306. const _ = s.channels[g], y2 = s.samplers[_.sampler], C = _.target, I2 = C.node, S2 = s.parameters !== void 0 ? s.parameters[y2.input] : y2.input, R2 = s.parameters !== void 0 ? s.parameters[y2.output] : y2.output;
  3307. a.push(this.getDependency("node", I2)), c.push(this.getDependency("accessor", S2)), u.push(this.getDependency("accessor", R2)), h2.push(y2), d.push(C);
  3308. }
  3309. return Promise.all([Promise.all(a), Promise.all(c), Promise.all(u), Promise.all(h2), Promise.all(d)]).then(function(g) {
  3310. const w = g[0], _ = g[1], y2 = g[2], C = g[3], I2 = g[4], S2 = [];
  3311. for (let j2 = 0, F = w.length; j2 < F; j2++) {
  3312. const V2 = w[j2], D = _[j2], Y = y2[j2], G2 = C[j2], N = I2[j2];
  3313. if (V2 === void 0)
  3314. continue;
  3315. V2.updateMatrix();
  3316. let O;
  3317. switch (nn[N.path]) {
  3318. case nn.weights:
  3319. O = NumberKeyframeTrack;
  3320. break;
  3321. case nn.rotation:
  3322. O = QuaternionKeyframeTrack;
  3323. break;
  3324. case nn.position:
  3325. case nn.scale:
  3326. default:
  3327. O = VectorKeyframeTrack;
  3328. break;
  3329. }
  3330. const H2 = V2.name ? V2.name : V2.uuid, K = G2.interpolation !== void 0 ? Tu[G2.interpolation] : InterpolateLinear, q = [];
  3331. nn[N.path] === nn.weights ? V2.traverse(function(ge) {
  3332. ge.morphTargetInfluences && q.push(ge.name ? ge.name : ge.uuid);
  3333. }) : q.push(H2);
  3334. let ue2 = Y.array;
  3335. if (Y.normalized) {
  3336. const ge = po(ue2.constructor), ce2 = new Float32Array(ue2.length);
  3337. for (let me2 = 0, he = ue2.length; me2 < he; me2++)
  3338. ce2[me2] = ue2[me2] * ge;
  3339. ue2 = ce2;
  3340. }
  3341. for (let ge = 0, ce2 = q.length; ge < ce2; ge++) {
  3342. const me2 = new O(q[ge] + "." + nn[N.path], D.array, ue2, K);
  3343. G2.interpolation === "CUBICSPLINE" && (me2.createInterpolant = function(ee2) {
  3344. const X = this instanceof QuaternionKeyframeTrack ? Pu : Xa;
  3345. return new X(this.times, this.values, this.getValueSize() / 3, ee2);
  3346. }, me2.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true), S2.push(me2);
  3347. }
  3348. }
  3349. const R2 = s.name ? s.name : "animation_" + i;
  3350. return new AnimationClip(R2, void 0, S2);
  3351. });
  3352. }
  3353. createNodeMesh(i) {
  3354. const r = this.json, s = this, a = r.nodes[i];
  3355. return a.mesh === void 0 ? null : s.getDependency("mesh", a.mesh).then(function(c) {
  3356. const u = s._getNodeRef(s.meshCache, a.mesh, c);
  3357. return a.weights !== void 0 && u.traverse(function(h2) {
  3358. if (h2.isMesh)
  3359. for (let d = 0, g = a.weights.length; d < g; d++)
  3360. h2.morphTargetInfluences[d] = a.weights[d];
  3361. }), u;
  3362. });
  3363. }
  3364. /**
  3365. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
  3366. * @param {number} nodeIndex
  3367. * @return {Promise<Object3D>}
  3368. */
  3369. loadNode(i) {
  3370. const r = this.json, s = this.extensions, a = this, c = r.nodes[i], u = c.name ? a.createUniqueName(c.name) : "";
  3371. return function() {
  3372. const h2 = [], d = a._invokeOne(function(g) {
  3373. return g.createNodeMesh && g.createNodeMesh(i);
  3374. });
  3375. return d && h2.push(d), c.camera !== void 0 && h2.push(a.getDependency("camera", c.camera).then(function(g) {
  3376. return a._getNodeRef(a.cameraCache, c.camera, g);
  3377. })), a._invokeAll(function(g) {
  3378. return g.createNodeAttachment && g.createNodeAttachment(i);
  3379. }).forEach(function(g) {
  3380. h2.push(g);
  3381. }), Promise.all(h2);
  3382. }().then(function(h2) {
  3383. let d;
  3384. if (c.isBone === true ? d = new Bone() : h2.length > 1 ? d = new Group() : h2.length === 1 ? d = h2[0] : d = new Object3D(), d !== h2[0])
  3385. for (let g = 0, w = h2.length; g < w; g++)
  3386. d.add(h2[g]);
  3387. if (c.name && (d.userData.name = c.name, d.name = u), In(d, c), c.extensions && Hi(s, d, c), c.matrix !== void 0) {
  3388. const g = new Matrix4();
  3389. g.fromArray(c.matrix), d.applyMatrix4(g);
  3390. } else
  3391. 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);
  3392. return a.associations.has(d) || a.associations.set(d, {}), a.associations.get(d).nodes = i, d;
  3393. });
  3394. }
  3395. /**
  3396. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
  3397. * @param {number} sceneIndex
  3398. * @return {Promise<Group>}
  3399. */
  3400. loadScene(i) {
  3401. const r = this.json, s = this.extensions, a = this.json.scenes[i], c = this, u = new Group();
  3402. a.name && (u.name = c.createUniqueName(a.name)), In(u, a), a.extensions && Hi(s, u, a);
  3403. const h2 = a.nodes || [], d = [];
  3404. for (let g = 0, w = h2.length; g < w; g++)
  3405. d.push(Ya(h2[g], u, r, c));
  3406. return Promise.all(d).then(function() {
  3407. const g = (w) => {
  3408. const _ = /* @__PURE__ */ new Map();
  3409. for (const [y2, C] of c.associations)
  3410. (y2 instanceof Material || y2 instanceof Texture) && _.set(y2, C);
  3411. return w.traverse((y2) => {
  3412. const C = c.associations.get(y2);
  3413. C != null && _.set(y2, C);
  3414. }), _;
  3415. };
  3416. return c.associations = g(u), u;
  3417. });
  3418. }
  3419. };
  3420. function Ya(b2, i, r, s) {
  3421. const a = r.nodes[b2];
  3422. return s.getDependency("node", b2).then(function(c) {
  3423. if (a.skin === void 0)
  3424. return c;
  3425. let u;
  3426. return s.getDependency("skin", a.skin).then(function(h2) {
  3427. u = h2;
  3428. const d = [];
  3429. for (let g = 0, w = u.joints.length; g < w; g++)
  3430. d.push(s.getDependency("node", u.joints[g]));
  3431. return Promise.all(d);
  3432. }).then(function(h2) {
  3433. return c.traverse(function(d) {
  3434. if (!d.isMesh)
  3435. return;
  3436. const g = [], w = [];
  3437. for (let _ = 0, y2 = h2.length; _ < y2; _++) {
  3438. const C = h2[_];
  3439. if (C) {
  3440. g.push(C);
  3441. const I2 = new Matrix4();
  3442. u.inverseBindMatrices !== void 0 && I2.fromArray(u.inverseBindMatrices.array, _ * 16), w.push(I2);
  3443. } else
  3444. console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', u.joints[_]);
  3445. }
  3446. d.bind(new Skeleton(g, w), d.matrixWorld);
  3447. }), c;
  3448. });
  3449. }).then(function(c) {
  3450. i.add(c);
  3451. const u = [];
  3452. if (a.children) {
  3453. const h2 = a.children;
  3454. for (let d = 0, g = h2.length; d < g; d++) {
  3455. const w = h2[d];
  3456. u.push(Ya(w, c, r, s));
  3457. }
  3458. }
  3459. return Promise.all(u);
  3460. });
  3461. }
  3462. function Iu(b2, i, r) {
  3463. const s = i.attributes, a = new Box3();
  3464. if (s.POSITION !== void 0) {
  3465. const h2 = r.json.accessors[s.POSITION], d = h2.min, g = h2.max;
  3466. if (d !== void 0 && g !== void 0) {
  3467. if (a.set(new Vector3(d[0], d[1], d[2]), new Vector3(g[0], g[1], g[2])), h2.normalized) {
  3468. const w = po(Wi[h2.componentType]);
  3469. a.min.multiplyScalar(w), a.max.multiplyScalar(w);
  3470. }
  3471. } else {
  3472. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  3473. return;
  3474. }
  3475. } else
  3476. return;
  3477. const c = i.targets;
  3478. if (c !== void 0) {
  3479. const h2 = new Vector3(), d = new Vector3();
  3480. for (let g = 0, w = c.length; g < w; g++) {
  3481. const _ = c[g];
  3482. if (_.POSITION !== void 0) {
  3483. const y2 = r.json.accessors[_.POSITION], C = y2.min, I2 = y2.max;
  3484. if (C !== void 0 && I2 !== void 0) {
  3485. if (d.setX(Math.max(Math.abs(C[0]), Math.abs(I2[0]))), d.setY(Math.max(Math.abs(C[1]), Math.abs(I2[1]))), d.setZ(Math.max(Math.abs(C[2]), Math.abs(I2[2]))), y2.normalized) {
  3486. const S2 = po(Wi[y2.componentType]);
  3487. d.multiplyScalar(S2);
  3488. }
  3489. h2.max(d);
  3490. } else
  3491. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  3492. }
  3493. }
  3494. a.expandByVector(h2);
  3495. }
  3496. b2.boundingBox = a;
  3497. const u = new Sphere();
  3498. a.getCenter(u.center), u.radius = a.min.distanceTo(a.max) / 2, b2.boundingSphere = u;
  3499. }
  3500. function ha(b2, i, r) {
  3501. const s = i.attributes, a = [];
  3502. function c(u, h2) {
  3503. return r.getDependency("accessor", u).then(function(d) {
  3504. b2.setAttribute(h2, d);
  3505. });
  3506. }
  3507. for (const u in s) {
  3508. const h2 = co[u] || u.toLowerCase();
  3509. h2 in b2.attributes || a.push(c(s[u], h2));
  3510. }
  3511. if (i.indices !== void 0 && !b2.index) {
  3512. const u = r.getDependency("accessor", i.indices).then(function(h2) {
  3513. b2.setIndex(h2);
  3514. });
  3515. a.push(u);
  3516. }
  3517. return In(b2, i), Iu(b2, i, r), Promise.all(a).then(function() {
  3518. return i.targets !== void 0 ? Mu(b2, i.targets, r) : b2;
  3519. });
  3520. }
  3521. function da(b2, i) {
  3522. let r = b2.getIndex();
  3523. if (r === null) {
  3524. const u = [], h2 = b2.getAttribute("position");
  3525. if (h2 !== void 0) {
  3526. for (let d = 0; d < h2.count; d++)
  3527. u.push(d);
  3528. b2.setIndex(u), r = b2.getIndex();
  3529. } else
  3530. return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), b2;
  3531. }
  3532. const s = r.count - 2, a = [];
  3533. if (i === TriangleFanDrawMode)
  3534. for (let u = 1; u <= s; u++)
  3535. a.push(r.getX(0)), a.push(r.getX(u)), a.push(r.getX(u + 1));
  3536. else
  3537. for (let u = 0; u < s; u++)
  3538. u % 2 === 0 ? (a.push(r.getX(u)), a.push(r.getX(u + 1)), a.push(r.getX(u + 2))) : (a.push(r.getX(u + 2)), a.push(r.getX(u + 1)), a.push(r.getX(u)));
  3539. a.length / 3 !== s && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  3540. const c = b2.clone();
  3541. return c.setIndex(a), c;
  3542. }
  3543. var Vu = class extends ExtrudeGeometry {
  3544. constructor(i, r = {}) {
  3545. const {
  3546. bevelEnabled: s = false,
  3547. bevelSize: a = 8,
  3548. bevelThickness: c = 10,
  3549. font: u,
  3550. height: h2 = 50,
  3551. size: d = 100,
  3552. lineHeight: g = 1,
  3553. letterSpacing: w = 0,
  3554. ..._
  3555. } = r;
  3556. if (u === void 0)
  3557. super();
  3558. else {
  3559. const y2 = u.generateShapes(i, d, {
  3560. lineHeight: g,
  3561. letterSpacing: w
  3562. });
  3563. super(y2, {
  3564. ..._,
  3565. bevelEnabled: s,
  3566. bevelSize: a,
  3567. bevelThickness: c,
  3568. depth: h2
  3569. });
  3570. }
  3571. this.type = "TextGeometry";
  3572. }
  3573. };
  3574. function qa(b2, i, r) {
  3575. const s = r.length - b2 - 1;
  3576. if (i >= r[s])
  3577. return s - 1;
  3578. if (i <= r[b2])
  3579. return b2;
  3580. let a = b2, c = s, u = Math.floor((a + c) / 2);
  3581. for (; i < r[u] || i >= r[u + 1]; )
  3582. i < r[u] ? c = u : a = u, u = Math.floor((a + c) / 2);
  3583. return u;
  3584. }
  3585. function Du(b2, i, r, s) {
  3586. const a = [], c = [], u = [];
  3587. a[0] = 1;
  3588. for (let h2 = 1; h2 <= r; ++h2) {
  3589. c[h2] = i - s[b2 + 1 - h2], u[h2] = s[b2 + h2] - i;
  3590. let d = 0;
  3591. for (let g = 0; g < h2; ++g) {
  3592. const w = u[g + 1], _ = c[h2 - g], y2 = a[g] / (w + _);
  3593. a[g] = d + w * y2, d = _ * y2;
  3594. }
  3595. a[h2] = d;
  3596. }
  3597. return a;
  3598. }
  3599. function Ou(b2, i, r, s) {
  3600. const a = qa(b2, s, i), c = Du(a, s, b2, i), u = new Vector4(0, 0, 0, 0);
  3601. for (let h2 = 0; h2 <= b2; ++h2) {
  3602. const d = r[a - b2 + h2], g = c[h2], w = d.w * g;
  3603. u.x += d.x * w, u.y += d.y * w, u.z += d.z * w, u.w += d.w * g;
  3604. }
  3605. return u;
  3606. }
  3607. function Nu(b2, i, r, s, a) {
  3608. const c = [];
  3609. for (let y2 = 0; y2 <= r; ++y2)
  3610. c[y2] = 0;
  3611. const u = [];
  3612. for (let y2 = 0; y2 <= s; ++y2)
  3613. u[y2] = c.slice(0);
  3614. const h2 = [];
  3615. for (let y2 = 0; y2 <= r; ++y2)
  3616. h2[y2] = c.slice(0);
  3617. h2[0][0] = 1;
  3618. const d = c.slice(0), g = c.slice(0);
  3619. for (let y2 = 1; y2 <= r; ++y2) {
  3620. d[y2] = i - a[b2 + 1 - y2], g[y2] = a[b2 + y2] - i;
  3621. let C = 0;
  3622. for (let I2 = 0; I2 < y2; ++I2) {
  3623. const S2 = g[I2 + 1], R2 = d[y2 - I2];
  3624. h2[y2][I2] = S2 + R2;
  3625. const j2 = h2[I2][y2 - 1] / h2[y2][I2];
  3626. h2[I2][y2] = C + S2 * j2, C = R2 * j2;
  3627. }
  3628. h2[y2][y2] = C;
  3629. }
  3630. for (let y2 = 0; y2 <= r; ++y2)
  3631. u[0][y2] = h2[y2][r];
  3632. for (let y2 = 0; y2 <= r; ++y2) {
  3633. let C = 0, I2 = 1;
  3634. const S2 = [];
  3635. for (let R2 = 0; R2 <= r; ++R2)
  3636. S2[R2] = c.slice(0);
  3637. S2[0][0] = 1;
  3638. for (let R2 = 1; R2 <= s; ++R2) {
  3639. let j2 = 0;
  3640. const F = y2 - R2, V2 = r - R2;
  3641. y2 >= R2 && (S2[I2][0] = S2[C][0] / h2[V2 + 1][F], j2 = S2[I2][0] * h2[F][V2]);
  3642. const D = F >= -1 ? 1 : -F, Y = y2 - 1 <= V2 ? R2 - 1 : r - y2;
  3643. for (let G2 = D; G2 <= Y; ++G2)
  3644. S2[I2][G2] = (S2[C][G2] - S2[C][G2 - 1]) / h2[V2 + 1][F + G2], j2 += S2[I2][G2] * h2[F + G2][V2];
  3645. y2 <= V2 && (S2[I2][R2] = -S2[C][R2 - 1] / h2[V2 + 1][y2], j2 += S2[I2][R2] * h2[y2][V2]), u[R2][y2] = j2;
  3646. var w = C;
  3647. C = I2, I2 = w;
  3648. }
  3649. }
  3650. var _ = r;
  3651. for (let y2 = 1; y2 <= s; ++y2) {
  3652. for (let C = 0; C <= r; ++C)
  3653. u[y2][C] *= _;
  3654. _ *= r - y2;
  3655. }
  3656. return u;
  3657. }
  3658. function Fu(b2, i, r, s, a) {
  3659. const c = a < b2 ? a : b2, u = [], h2 = qa(b2, s, i), d = Nu(h2, s, b2, c, i), g = [];
  3660. for (let _ = 0; _ < r.length; ++_) {
  3661. var w = r[_].clone();
  3662. const y2 = w.w;
  3663. w.x *= y2, w.y *= y2, w.z *= y2, g[_] = w;
  3664. }
  3665. for (let _ = 0; _ <= c; ++_) {
  3666. var w = g[h2 - b2].clone().multiplyScalar(d[_][0]);
  3667. for (let C = 1; C <= b2; ++C)
  3668. w.add(g[h2 - b2 + C].clone().multiplyScalar(d[_][C]));
  3669. u[_] = w;
  3670. }
  3671. for (let _ = c + 1; _ <= a + 1; ++_)
  3672. u[_] = new Vector4(0, 0, 0);
  3673. return u;
  3674. }
  3675. function Bu(b2, i) {
  3676. let r = 1;
  3677. for (let a = 2; a <= b2; ++a)
  3678. r *= a;
  3679. let s = 1;
  3680. for (let a = 2; a <= i; ++a)
  3681. s *= a;
  3682. for (let a = 2; a <= b2 - i; ++a)
  3683. s *= a;
  3684. return r / s;
  3685. }
  3686. function ju(b2) {
  3687. const i = b2.length, r = [], s = [];
  3688. for (let c = 0; c < i; ++c) {
  3689. const u = b2[c];
  3690. r[c] = new Vector3(u.x, u.y, u.z), s[c] = u.w;
  3691. }
  3692. const a = [];
  3693. for (let c = 0; c < i; ++c) {
  3694. const u = r[c].clone();
  3695. for (let h2 = 1; h2 <= c; ++h2)
  3696. u.sub(a[c - h2].clone().multiplyScalar(Bu(c, h2) * s[h2]));
  3697. a[c] = u.divideScalar(s[0]);
  3698. }
  3699. return a;
  3700. }
  3701. function zu(b2, i, r, s, a) {
  3702. const c = Fu(b2, i, r, s, a);
  3703. return ju(c);
  3704. }
  3705. var ma = class extends Curve {
  3706. constructor(i, r, s, a, c) {
  3707. super(), this.degree = i, this.knots = r, this.controlPoints = [], this.startKnot = a || 0, this.endKnot = c || this.knots.length - 1;
  3708. for (let u = 0; u < s.length; ++u) {
  3709. const h2 = s[u];
  3710. this.controlPoints[u] = new Vector4(h2.x, h2.y, h2.z, h2.w);
  3711. }
  3712. }
  3713. getPoint(i, r) {
  3714. const s = r || new Vector3(), a = this.knots[this.startKnot] + i * (this.knots[this.endKnot] - this.knots[this.startKnot]), c = Ou(this.degree, this.knots, this.controlPoints, a);
  3715. return c.w != 1 && c.divideScalar(c.w), s.set(c.x, c.y, c.z);
  3716. }
  3717. getTangent(i, r) {
  3718. const s = r || new Vector3(), a = this.knots[0] + i * (this.knots[this.knots.length - 1] - this.knots[0]), c = zu(this.degree, this.knots, this.controlPoints, a, 1);
  3719. return s.copy(c[1]).normalize(), s;
  3720. }
  3721. };
  3722. var se2;
  3723. var Ae;
  3724. var We;
  3725. var Uu = class extends Loader {
  3726. constructor(i) {
  3727. super(i);
  3728. }
  3729. load(i, r, s, a) {
  3730. const c = this, u = c.path === "" ? LoaderUtils.extractUrlBase(i) : c.path, h2 = new FileLoader(this.manager);
  3731. h2.setPath(c.path), h2.setResponseType("arraybuffer"), h2.setRequestHeader(c.requestHeader), h2.setWithCredentials(c.withCredentials), h2.load(i, function(d) {
  3732. try {
  3733. r(c.parse(d, u));
  3734. } catch (g) {
  3735. a ? a(g) : console.error(g), c.manager.itemError(i);
  3736. }
  3737. }, s, a);
  3738. }
  3739. parse(i, r) {
  3740. if (Yu(i))
  3741. se2 = new Xu().parse(i);
  3742. else {
  3743. const a = Ja(i);
  3744. if (!qu(a))
  3745. throw new Error("THREE.FBXLoader: Unknown format.");
  3746. if (va(a) < 7e3)
  3747. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + va(a));
  3748. se2 = new $u().parse(a);
  3749. }
  3750. const s = new TextureLoader(this.manager).setPath(this.resourcePath || r).setCrossOrigin(this.crossOrigin);
  3751. return new Gu(s, this.manager).parse(se2);
  3752. }
  3753. };
  3754. var Gu = class {
  3755. constructor(i, r) {
  3756. this.textureLoader = i, this.manager = r;
  3757. }
  3758. parse() {
  3759. Ae = this.parseConnections();
  3760. const i = this.parseImages(), r = this.parseTextures(i), s = this.parseMaterials(r), a = this.parseDeformers(), c = new Hu().parse(a);
  3761. return this.parseScene(a, c, s), We;
  3762. }
  3763. // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
  3764. // and details the connection type
  3765. parseConnections() {
  3766. const i = /* @__PURE__ */ new Map();
  3767. return "Connections" in se2 && se2.Connections.connections.forEach(function(s) {
  3768. const a = s[0], c = s[1], u = s[2];
  3769. i.has(a) || i.set(a, {
  3770. parents: [],
  3771. children: []
  3772. });
  3773. const h2 = {
  3774. ID: c,
  3775. relationship: u
  3776. };
  3777. i.get(a).parents.push(h2), i.has(c) || i.set(c, {
  3778. parents: [],
  3779. children: []
  3780. });
  3781. const d = {
  3782. ID: a,
  3783. relationship: u
  3784. };
  3785. i.get(c).children.push(d);
  3786. }), i;
  3787. }
  3788. // Parse FBXTree.Objects.Video for embedded image data
  3789. // These images are connected to textures in FBXTree.Objects.Textures
  3790. // via FBXTree.Connections.
  3791. parseImages() {
  3792. const i = {}, r = {};
  3793. if ("Video" in se2.Objects) {
  3794. const s = se2.Objects.Video;
  3795. for (const a in s) {
  3796. const c = s[a], u = parseInt(a);
  3797. if (i[u] = c.RelativeFilename || c.Filename, "Content" in c) {
  3798. const h2 = c.Content instanceof ArrayBuffer && c.Content.byteLength > 0, d = typeof c.Content == "string" && c.Content !== "";
  3799. if (h2 || d) {
  3800. const g = this.parseImage(s[a]);
  3801. r[c.RelativeFilename || c.Filename] = g;
  3802. }
  3803. }
  3804. }
  3805. }
  3806. for (const s in i) {
  3807. const a = i[s];
  3808. r[a] !== void 0 ? i[s] = r[a] : i[s] = i[s].split("\\").pop();
  3809. }
  3810. return i;
  3811. }
  3812. // Parse embedded image data in FBXTree.Video.Content
  3813. parseImage(i) {
  3814. const r = i.Content, s = i.RelativeFilename || i.Filename, a = s.slice(s.lastIndexOf(".") + 1).toLowerCase();
  3815. let c;
  3816. switch (a) {
  3817. case "bmp":
  3818. c = "image/bmp";
  3819. break;
  3820. case "jpg":
  3821. case "jpeg":
  3822. c = "image/jpeg";
  3823. break;
  3824. case "png":
  3825. c = "image/png";
  3826. break;
  3827. case "tif":
  3828. c = "image/tiff";
  3829. break;
  3830. case "tga":
  3831. this.manager.getHandler(".tga") === null && console.warn("FBXLoader: TGA loader not found, skipping ", s), c = "image/tga";
  3832. break;
  3833. default:
  3834. console.warn('FBXLoader: Image type "' + a + '" is not supported.');
  3835. return;
  3836. }
  3837. if (typeof r == "string")
  3838. return "data:" + c + ";base64," + r;
  3839. {
  3840. const u = new Uint8Array(r);
  3841. return window.URL.createObjectURL(new Blob([u], {
  3842. type: c
  3843. }));
  3844. }
  3845. }
  3846. // Parse nodes in FBXTree.Objects.Texture
  3847. // These contain details such as UV scaling, cropping, rotation etc and are connected
  3848. // to images in FBXTree.Objects.Video
  3849. parseTextures(i) {
  3850. const r = /* @__PURE__ */ new Map();
  3851. if ("Texture" in se2.Objects) {
  3852. const s = se2.Objects.Texture;
  3853. for (const a in s) {
  3854. const c = this.parseTexture(s[a], i);
  3855. r.set(parseInt(a), c);
  3856. }
  3857. }
  3858. return r;
  3859. }
  3860. // Parse individual node in FBXTree.Objects.Texture
  3861. parseTexture(i, r) {
  3862. const s = this.loadTexture(i, r);
  3863. s.ID = i.id, s.name = i.attrName;
  3864. const a = i.WrapModeU, c = i.WrapModeV, u = a !== void 0 ? a.value : 0, h2 = c !== void 0 ? c.value : 0;
  3865. if (s.wrapS = u === 0 ? RepeatWrapping : ClampToEdgeWrapping, s.wrapT = h2 === 0 ? RepeatWrapping : ClampToEdgeWrapping, "Scaling" in i) {
  3866. const d = i.Scaling.value;
  3867. s.repeat.x = d[0], s.repeat.y = d[1];
  3868. }
  3869. return s;
  3870. }
  3871. // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
  3872. loadTexture(i, r) {
  3873. let s;
  3874. const a = this.textureLoader.path, c = Ae.get(i.id).children;
  3875. c !== void 0 && c.length > 0 && r[c[0].ID] !== void 0 && (s = r[c[0].ID], (s.indexOf("blob:") === 0 || s.indexOf("data:") === 0) && this.textureLoader.setPath(void 0));
  3876. let u;
  3877. const h2 = i.FileName.slice(-3).toLowerCase();
  3878. if (h2 === "tga") {
  3879. const d = this.manager.getHandler(".tga");
  3880. d === null ? (console.warn("FBXLoader: TGA loader not found, creating placeholder texture for", i.RelativeFilename), u = new Texture()) : (d.setPath(this.textureLoader.path), u = d.load(s));
  3881. } else
  3882. h2 === "psd" ? (console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for", i.RelativeFilename), u = new Texture()) : u = this.textureLoader.load(s);
  3883. return this.textureLoader.setPath(a), u;
  3884. }
  3885. // Parse nodes in FBXTree.Objects.Material
  3886. parseMaterials(i) {
  3887. const r = /* @__PURE__ */ new Map();
  3888. if ("Material" in se2.Objects) {
  3889. const s = se2.Objects.Material;
  3890. for (const a in s) {
  3891. const c = this.parseMaterial(s[a], i);
  3892. c !== null && r.set(parseInt(a), c);
  3893. }
  3894. }
  3895. return r;
  3896. }
  3897. // Parse single node in FBXTree.Objects.Material
  3898. // Materials are connected to texture maps in FBXTree.Objects.Textures
  3899. // FBX format currently only supports Lambert and Phong shading models
  3900. parseMaterial(i, r) {
  3901. const s = i.id, a = i.attrName;
  3902. let c = i.ShadingModel;
  3903. if (typeof c == "object" && (c = c.value), !Ae.has(s))
  3904. return null;
  3905. const u = this.parseParameters(i, r, s);
  3906. let h2;
  3907. switch (c.toLowerCase()) {
  3908. case "phong":
  3909. h2 = new MeshPhongMaterial();
  3910. break;
  3911. case "lambert":
  3912. h2 = new MeshLambertMaterial();
  3913. break;
  3914. default:
  3915. console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', c), h2 = new MeshPhongMaterial();
  3916. break;
  3917. }
  3918. return h2.setValues(u), h2.name = a, h2;
  3919. }
  3920. // Parse FBX material and return parameters suitable for a three.js material
  3921. // Also parse the texture map and return any textures associated with the material
  3922. parseParameters(i, r, s) {
  3923. const a = {};
  3924. i.BumpFactor && (a.bumpScale = i.BumpFactor.value), i.Diffuse ? a.color = new Color().fromArray(i.Diffuse.value) : i.DiffuseColor && (i.DiffuseColor.type === "Color" || i.DiffuseColor.type === "ColorRGB") && (a.color = new Color().fromArray(i.DiffuseColor.value)), i.DisplacementFactor && (a.displacementScale = i.DisplacementFactor.value), i.Emissive ? a.emissive = new Color().fromArray(i.Emissive.value) : i.EmissiveColor && (i.EmissiveColor.type === "Color" || i.EmissiveColor.type === "ColorRGB") && (a.emissive = new Color().fromArray(i.EmissiveColor.value)), i.EmissiveFactor && (a.emissiveIntensity = parseFloat(i.EmissiveFactor.value)), i.Opacity && (a.opacity = parseFloat(i.Opacity.value)), a.opacity < 1 && (a.transparent = true), i.ReflectionFactor && (a.reflectivity = i.ReflectionFactor.value), i.Shininess && (a.shininess = i.Shininess.value), i.Specular ? a.specular = new Color().fromArray(i.Specular.value) : i.SpecularColor && i.SpecularColor.type === "Color" && (a.specular = new Color().fromArray(i.SpecularColor.value));
  3925. const c = this;
  3926. return Ae.get(s).children.forEach(function(u) {
  3927. const h2 = u.relationship;
  3928. switch (h2) {
  3929. case "Bump":
  3930. a.bumpMap = c.getTexture(r, u.ID);
  3931. break;
  3932. case "Maya|TEX_ao_map":
  3933. a.aoMap = c.getTexture(r, u.ID);
  3934. break;
  3935. case "DiffuseColor":
  3936. case "Maya|TEX_color_map":
  3937. a.map = c.getTexture(r, u.ID), a.map !== void 0 && (a.map.encoding = sRGBEncoding);
  3938. break;
  3939. case "DisplacementColor":
  3940. a.displacementMap = c.getTexture(r, u.ID);
  3941. break;
  3942. case "EmissiveColor":
  3943. a.emissiveMap = c.getTexture(r, u.ID), a.emissiveMap !== void 0 && (a.emissiveMap.encoding = sRGBEncoding);
  3944. break;
  3945. case "NormalMap":
  3946. case "Maya|TEX_normal_map":
  3947. a.normalMap = c.getTexture(r, u.ID);
  3948. break;
  3949. case "ReflectionColor":
  3950. a.envMap = c.getTexture(r, u.ID), a.envMap !== void 0 && (a.envMap.mapping = EquirectangularReflectionMapping, a.envMap.encoding = sRGBEncoding);
  3951. break;
  3952. case "SpecularColor":
  3953. a.specularMap = c.getTexture(r, u.ID), a.specularMap !== void 0 && (a.specularMap.encoding = sRGBEncoding);
  3954. break;
  3955. case "TransparentColor":
  3956. case "TransparencyFactor":
  3957. a.alphaMap = c.getTexture(r, u.ID), a.transparent = true;
  3958. break;
  3959. case "AmbientColor":
  3960. case "ShininessExponent":
  3961. case "SpecularFactor":
  3962. case "VectorDisplacementColor":
  3963. default:
  3964. console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", h2);
  3965. break;
  3966. }
  3967. }), a;
  3968. }
  3969. // get a texture from the textureMap for use by a material.
  3970. getTexture(i, r) {
  3971. return "LayeredTexture" in se2.Objects && r in se2.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), r = Ae.get(r).children[0].ID), i.get(r);
  3972. }
  3973. // Parse nodes in FBXTree.Objects.Deformer
  3974. // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
  3975. // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
  3976. parseDeformers() {
  3977. const i = {}, r = {};
  3978. if ("Deformer" in se2.Objects) {
  3979. const s = se2.Objects.Deformer;
  3980. for (const a in s) {
  3981. const c = s[a], u = Ae.get(parseInt(a));
  3982. if (c.attrType === "Skin") {
  3983. const h2 = this.parseSkeleton(u, s);
  3984. h2.ID = a, u.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), h2.geometryID = u.parents[0].ID, i[a] = h2;
  3985. } else if (c.attrType === "BlendShape") {
  3986. const h2 = {
  3987. id: a
  3988. };
  3989. h2.rawTargets = this.parseMorphTargets(u, s), h2.id = a, u.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), r[a] = h2;
  3990. }
  3991. }
  3992. }
  3993. return {
  3994. skeletons: i,
  3995. morphTargets: r
  3996. };
  3997. }
  3998. // Parse single nodes in FBXTree.Objects.Deformer
  3999. // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
  4000. // Each skin node represents a skeleton and each cluster node represents a bone
  4001. parseSkeleton(i, r) {
  4002. const s = [];
  4003. return i.children.forEach(function(a) {
  4004. const c = r[a.ID];
  4005. if (c.attrType !== "Cluster")
  4006. return;
  4007. const u = {
  4008. ID: a.ID,
  4009. indices: [],
  4010. weights: [],
  4011. transformLink: new Matrix4().fromArray(c.TransformLink.a)
  4012. // transform: new Matrix4().fromArray( boneNode.Transform.a ),
  4013. // linkMode: boneNode.Mode,
  4014. };
  4015. "Indexes" in c && (u.indices = c.Indexes.a, u.weights = c.Weights.a), s.push(u);
  4016. }), {
  4017. rawBones: s,
  4018. bones: []
  4019. };
  4020. }
  4021. // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
  4022. parseMorphTargets(i, r) {
  4023. const s = [];
  4024. for (let a = 0; a < i.children.length; a++) {
  4025. const c = i.children[a], u = r[c.ID], h2 = {
  4026. name: u.attrName,
  4027. initialWeight: u.DeformPercent,
  4028. id: u.id,
  4029. fullWeights: u.FullWeights.a
  4030. };
  4031. if (u.attrType !== "BlendShapeChannel")
  4032. return;
  4033. h2.geoID = Ae.get(parseInt(c.ID)).children.filter(function(d) {
  4034. return d.relationship === void 0;
  4035. })[0].ID, s.push(h2);
  4036. }
  4037. return s;
  4038. }
  4039. // create the main Group() to be returned by the loader
  4040. parseScene(i, r, s) {
  4041. We = new Group();
  4042. const a = this.parseModels(i.skeletons, r, s), c = se2.Objects.Model, u = this;
  4043. a.forEach(function(d) {
  4044. const g = c[d.ID];
  4045. u.setLookAtProperties(d, g), Ae.get(d.ID).parents.forEach(function(_) {
  4046. const y2 = a.get(_.ID);
  4047. y2 !== void 0 && y2.add(d);
  4048. }), d.parent === null && We.add(d);
  4049. }), this.bindSkeleton(i.skeletons, r, a), this.createAmbientLight(), We.traverse(function(d) {
  4050. if (d.userData.transformData) {
  4051. d.parent && (d.userData.transformData.parentMatrix = d.parent.matrix, d.userData.transformData.parentMatrixWorld = d.parent.matrixWorld);
  4052. const g = Za(d.userData.transformData);
  4053. d.applyMatrix4(g), d.updateWorldMatrix();
  4054. }
  4055. });
  4056. const h2 = new Ku().parse();
  4057. We.children.length === 1 && We.children[0].isGroup && (We.children[0].animations = h2, We = We.children[0]), We.animations = h2;
  4058. }
  4059. // parse nodes in FBXTree.Objects.Model
  4060. parseModels(i, r, s) {
  4061. const a = /* @__PURE__ */ new Map(), c = se2.Objects.Model;
  4062. for (const u in c) {
  4063. const h2 = parseInt(u), d = c[u], g = Ae.get(h2);
  4064. let w = this.buildSkeleton(g, i, h2, d.attrName);
  4065. if (!w) {
  4066. switch (d.attrType) {
  4067. case "Camera":
  4068. w = this.createCamera(g);
  4069. break;
  4070. case "Light":
  4071. w = this.createLight(g);
  4072. break;
  4073. case "Mesh":
  4074. w = this.createMesh(g, r, s);
  4075. break;
  4076. case "NurbsCurve":
  4077. w = this.createCurve(g, r);
  4078. break;
  4079. case "LimbNode":
  4080. case "Root":
  4081. w = new Bone();
  4082. break;
  4083. case "Null":
  4084. default:
  4085. w = new Group();
  4086. break;
  4087. }
  4088. w.name = d.attrName ? PropertyBinding.sanitizeNodeName(d.attrName) : "", w.ID = h2;
  4089. }
  4090. this.getTransformData(w, d), a.set(h2, w);
  4091. }
  4092. return a;
  4093. }
  4094. buildSkeleton(i, r, s, a) {
  4095. let c = null;
  4096. return i.parents.forEach(function(u) {
  4097. for (const h2 in r) {
  4098. const d = r[h2];
  4099. d.rawBones.forEach(function(g, w) {
  4100. if (g.ID === u.ID) {
  4101. const _ = c;
  4102. c = new Bone(), c.matrixWorld.copy(g.transformLink), c.name = a ? PropertyBinding.sanitizeNodeName(a) : "", c.ID = s, d.bones[w] = c, _ !== null && c.add(_);
  4103. }
  4104. });
  4105. }
  4106. }), c;
  4107. }
  4108. // create a PerspectiveCamera or OrthographicCamera
  4109. createCamera(i) {
  4110. let r, s;
  4111. if (i.children.forEach(function(a) {
  4112. const c = se2.Objects.NodeAttribute[a.ID];
  4113. c !== void 0 && (s = c);
  4114. }), s === void 0)
  4115. r = new Object3D();
  4116. else {
  4117. let a = 0;
  4118. s.CameraProjectionType !== void 0 && s.CameraProjectionType.value === 1 && (a = 1);
  4119. let c = 1;
  4120. s.NearPlane !== void 0 && (c = s.NearPlane.value / 1e3);
  4121. let u = 1e3;
  4122. s.FarPlane !== void 0 && (u = s.FarPlane.value / 1e3);
  4123. let h2 = window.innerWidth, d = window.innerHeight;
  4124. s.AspectWidth !== void 0 && s.AspectHeight !== void 0 && (h2 = s.AspectWidth.value, d = s.AspectHeight.value);
  4125. const g = h2 / d;
  4126. let w = 45;
  4127. s.FieldOfView !== void 0 && (w = s.FieldOfView.value);
  4128. const _ = s.FocalLength ? s.FocalLength.value : null;
  4129. switch (a) {
  4130. case 0:
  4131. r = new PerspectiveCamera(w, g, c, u), _ !== null && r.setFocalLength(_);
  4132. break;
  4133. case 1:
  4134. r = new OrthographicCamera(-h2 / 2, h2 / 2, d / 2, -d / 2, c, u);
  4135. break;
  4136. default:
  4137. console.warn("THREE.FBXLoader: Unknown camera type " + a + "."), r = new Object3D();
  4138. break;
  4139. }
  4140. }
  4141. return r;
  4142. }
  4143. // Create a DirectionalLight, PointLight or SpotLight
  4144. createLight(i) {
  4145. let r, s;
  4146. if (i.children.forEach(function(a) {
  4147. const c = se2.Objects.NodeAttribute[a.ID];
  4148. c !== void 0 && (s = c);
  4149. }), s === void 0)
  4150. r = new Object3D();
  4151. else {
  4152. let a;
  4153. s.LightType === void 0 ? a = 0 : a = s.LightType.value;
  4154. let c = 16777215;
  4155. s.Color !== void 0 && (c = new Color().fromArray(s.Color.value));
  4156. let u = s.Intensity === void 0 ? 1 : s.Intensity.value / 100;
  4157. s.CastLightOnObject !== void 0 && s.CastLightOnObject.value === 0 && (u = 0);
  4158. let h2 = 0;
  4159. s.FarAttenuationEnd !== void 0 && (s.EnableFarAttenuation !== void 0 && s.EnableFarAttenuation.value === 0 ? h2 = 0 : h2 = s.FarAttenuationEnd.value);
  4160. const d = 1;
  4161. switch (a) {
  4162. case 0:
  4163. r = new PointLight(c, u, h2, d);
  4164. break;
  4165. case 1:
  4166. r = new DirectionalLight(c, u);
  4167. break;
  4168. case 2:
  4169. let g = Math.PI / 3;
  4170. s.InnerAngle !== void 0 && (g = MathUtils.degToRad(s.InnerAngle.value));
  4171. let w = 0;
  4172. s.OuterAngle !== void 0 && (w = MathUtils.degToRad(s.OuterAngle.value), w = Math.max(w, 1)), r = new SpotLight(c, u, h2, g, w, d);
  4173. break;
  4174. default:
  4175. console.warn("THREE.FBXLoader: Unknown light type " + s.LightType.value + ", defaulting to a PointLight."), r = new PointLight(c, u);
  4176. break;
  4177. }
  4178. s.CastShadows !== void 0 && s.CastShadows.value === 1 && (r.castShadow = true);
  4179. }
  4180. return r;
  4181. }
  4182. createMesh(i, r, s) {
  4183. let a, c = null, u = null;
  4184. const h2 = [];
  4185. return i.children.forEach(function(d) {
  4186. r.has(d.ID) && (c = r.get(d.ID)), s.has(d.ID) && h2.push(s.get(d.ID));
  4187. }), h2.length > 1 ? u = h2 : h2.length > 0 ? u = h2[0] : (u = new MeshPhongMaterial({
  4188. color: 13421772
  4189. }), h2.push(u)), "color" in c.attributes && h2.forEach(function(d) {
  4190. d.vertexColors = true;
  4191. }), c.FBX_Deformer ? (a = new SkinnedMesh(c, u), a.normalizeSkinWeights()) : a = new Mesh(c, u), a;
  4192. }
  4193. createCurve(i, r) {
  4194. const s = i.children.reduce(function(c, u) {
  4195. return r.has(u.ID) && (c = r.get(u.ID)), c;
  4196. }, null), a = new LineBasicMaterial({
  4197. color: 3342591,
  4198. linewidth: 1
  4199. });
  4200. return new Line(s, a);
  4201. }
  4202. // parse the model node for transform data
  4203. getTransformData(i, r) {
  4204. const s = {};
  4205. "InheritType" in r && (s.inheritType = parseInt(r.InheritType.value)), "RotationOrder" in r ? s.eulerOrder = Wa(r.RotationOrder.value) : s.eulerOrder = "ZYX", "Lcl_Translation" in r && (s.translation = r.Lcl_Translation.value), "PreRotation" in r && (s.preRotation = r.PreRotation.value), "Lcl_Rotation" in r && (s.rotation = r.Lcl_Rotation.value), "PostRotation" in r && (s.postRotation = r.PostRotation.value), "Lcl_Scaling" in r && (s.scale = r.Lcl_Scaling.value), "ScalingOffset" in r && (s.scalingOffset = r.ScalingOffset.value), "ScalingPivot" in r && (s.scalingPivot = r.ScalingPivot.value), "RotationOffset" in r && (s.rotationOffset = r.RotationOffset.value), "RotationPivot" in r && (s.rotationPivot = r.RotationPivot.value), i.userData.transformData = s;
  4206. }
  4207. setLookAtProperties(i, r) {
  4208. "LookAtProperty" in r && Ae.get(i.ID).children.forEach(function(a) {
  4209. if (a.relationship === "LookAtProperty") {
  4210. const c = se2.Objects.Model[a.ID];
  4211. if ("Lcl_Translation" in c) {
  4212. const u = c.Lcl_Translation.value;
  4213. i.target !== void 0 ? (i.target.position.fromArray(u), We.add(i.target)) : i.lookAt(new Vector3().fromArray(u));
  4214. }
  4215. }
  4216. });
  4217. }
  4218. bindSkeleton(i, r, s) {
  4219. const a = this.parsePoseNodes();
  4220. for (const c in i) {
  4221. const u = i[c];
  4222. Ae.get(parseInt(u.ID)).parents.forEach(function(d) {
  4223. if (r.has(d.ID)) {
  4224. const g = d.ID;
  4225. Ae.get(g).parents.forEach(function(_) {
  4226. s.has(_.ID) && s.get(_.ID).bind(new Skeleton(u.bones), a[_.ID]);
  4227. });
  4228. }
  4229. });
  4230. }
  4231. }
  4232. parsePoseNodes() {
  4233. const i = {};
  4234. if ("Pose" in se2.Objects) {
  4235. const r = se2.Objects.Pose;
  4236. for (const s in r)
  4237. if (r[s].attrType === "BindPose" && r[s].NbPoseNodes > 0) {
  4238. const a = r[s].PoseNode;
  4239. Array.isArray(a) ? a.forEach(function(c) {
  4240. i[c.Node] = new Matrix4().fromArray(c.Matrix.a);
  4241. }) : i[a.Node] = new Matrix4().fromArray(a.Matrix.a);
  4242. }
  4243. }
  4244. return i;
  4245. }
  4246. // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
  4247. createAmbientLight() {
  4248. if ("GlobalSettings" in se2 && "AmbientColor" in se2.GlobalSettings) {
  4249. const i = se2.GlobalSettings.AmbientColor.value, r = i[0], s = i[1], a = i[2];
  4250. if (r !== 0 || s !== 0 || a !== 0) {
  4251. const c = new Color(r, s, a);
  4252. We.add(new AmbientLight(c, 1));
  4253. }
  4254. }
  4255. }
  4256. };
  4257. var Hu = class {
  4258. // Parse nodes in FBXTree.Objects.Geometry
  4259. parse(i) {
  4260. const r = /* @__PURE__ */ new Map();
  4261. if ("Geometry" in se2.Objects) {
  4262. const s = se2.Objects.Geometry;
  4263. for (const a in s) {
  4264. const c = Ae.get(parseInt(a)), u = this.parseGeometry(c, s[a], i);
  4265. r.set(parseInt(a), u);
  4266. }
  4267. }
  4268. return r;
  4269. }
  4270. // Parse single node in FBXTree.Objects.Geometry
  4271. parseGeometry(i, r, s) {
  4272. switch (r.attrType) {
  4273. case "Mesh":
  4274. return this.parseMeshGeometry(i, r, s);
  4275. case "NurbsCurve":
  4276. return this.parseNurbsGeometry(r);
  4277. }
  4278. }
  4279. // Parse single node mesh geometry in FBXTree.Objects.Geometry
  4280. parseMeshGeometry(i, r, s) {
  4281. const a = s.skeletons, c = [], u = i.parents.map(function(_) {
  4282. return se2.Objects.Model[_.ID];
  4283. });
  4284. if (u.length === 0)
  4285. return;
  4286. const h2 = i.children.reduce(function(_, y2) {
  4287. return a[y2.ID] !== void 0 && (_ = a[y2.ID]), _;
  4288. }, null);
  4289. i.children.forEach(function(_) {
  4290. s.morphTargets[_.ID] !== void 0 && c.push(s.morphTargets[_.ID]);
  4291. });
  4292. const d = u[0], g = {};
  4293. "RotationOrder" in d && (g.eulerOrder = Wa(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);
  4294. const w = Za(g);
  4295. return this.genGeometry(r, h2, c, w);
  4296. }
  4297. // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
  4298. genGeometry(i, r, s, a) {
  4299. const c = new BufferGeometry();
  4300. i.attrName && (c.name = i.attrName);
  4301. const u = this.parseGeoNode(i, r), h2 = this.genBuffers(u), d = new Float32BufferAttribute(h2.vertex, 3);
  4302. if (d.applyMatrix4(a), c.setAttribute("position", d), h2.colors.length > 0 && c.setAttribute("color", new Float32BufferAttribute(h2.colors, 3)), r && (c.setAttribute("skinIndex", new Uint16BufferAttribute(h2.weightsIndices, 4)), c.setAttribute("skinWeight", new Float32BufferAttribute(h2.vertexWeights, 4)), c.FBX_Deformer = r), h2.normal.length > 0) {
  4303. const g = new Matrix3().getNormalMatrix(a), w = new Float32BufferAttribute(h2.normal, 3);
  4304. w.applyNormalMatrix(g), c.setAttribute("normal", w);
  4305. }
  4306. if (h2.uvs.forEach(function(g, w) {
  4307. let _ = "uv" + (w + 1).toString();
  4308. w === 0 && (_ = "uv"), c.setAttribute(_, new Float32BufferAttribute(h2.uvs[w], 2));
  4309. }), u.material && u.material.mappingType !== "AllSame") {
  4310. let g = h2.materialIndex[0], w = 0;
  4311. if (h2.materialIndex.forEach(function(_, y2) {
  4312. _ !== g && (c.addGroup(w, y2 - w, g), g = _, w = y2);
  4313. }), c.groups.length > 0) {
  4314. const _ = c.groups[c.groups.length - 1], y2 = _.start + _.count;
  4315. y2 !== h2.materialIndex.length && c.addGroup(y2, h2.materialIndex.length - y2, g);
  4316. }
  4317. c.groups.length === 0 && c.addGroup(0, h2.materialIndex.length, h2.materialIndex[0]);
  4318. }
  4319. return this.addMorphTargets(c, i, s, a), c;
  4320. }
  4321. parseGeoNode(i, r) {
  4322. const s = {};
  4323. if (s.vertexPositions = i.Vertices !== void 0 ? i.Vertices.a : [], s.vertexIndices = i.PolygonVertexIndex !== void 0 ? i.PolygonVertexIndex.a : [], i.LayerElementColor && (s.color = this.parseVertexColors(i.LayerElementColor[0])), i.LayerElementMaterial && (s.material = this.parseMaterialIndices(i.LayerElementMaterial[0])), i.LayerElementNormal && (s.normal = this.parseNormals(i.LayerElementNormal[0])), i.LayerElementUV) {
  4324. s.uv = [];
  4325. let a = 0;
  4326. for (; i.LayerElementUV[a]; )
  4327. i.LayerElementUV[a].UV && s.uv.push(this.parseUVs(i.LayerElementUV[a])), a++;
  4328. }
  4329. return s.weightTable = {}, r !== null && (s.skeleton = r, r.rawBones.forEach(function(a, c) {
  4330. a.indices.forEach(function(u, h2) {
  4331. s.weightTable[u] === void 0 && (s.weightTable[u] = []), s.weightTable[u].push({
  4332. id: c,
  4333. weight: a.weights[h2]
  4334. });
  4335. });
  4336. })), s;
  4337. }
  4338. genBuffers(i) {
  4339. const r = {
  4340. vertex: [],
  4341. normal: [],
  4342. colors: [],
  4343. uvs: [],
  4344. materialIndex: [],
  4345. vertexWeights: [],
  4346. weightsIndices: []
  4347. };
  4348. let s = 0, a = 0, c = false, u = [], h2 = [], d = [], g = [], w = [], _ = [];
  4349. const y2 = this;
  4350. return i.vertexIndices.forEach(function(C, I2) {
  4351. let S2, R2 = false;
  4352. C < 0 && (C = C ^ -1, R2 = true);
  4353. let j2 = [], F = [];
  4354. if (u.push(C * 3, C * 3 + 1, C * 3 + 2), i.color) {
  4355. const V2 = Vs(I2, s, C, i.color);
  4356. d.push(V2[0], V2[1], V2[2]);
  4357. }
  4358. if (i.skeleton) {
  4359. if (i.weightTable[C] !== void 0 && i.weightTable[C].forEach(function(V2) {
  4360. F.push(V2.weight), j2.push(V2.id);
  4361. }), F.length > 4) {
  4362. c || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), c = true);
  4363. const V2 = [0, 0, 0, 0], D = [0, 0, 0, 0];
  4364. F.forEach(function(Y, G2) {
  4365. let N = Y, O = j2[G2];
  4366. D.forEach(function(H2, K, q) {
  4367. if (N > H2) {
  4368. q[K] = N, N = H2;
  4369. const ue2 = V2[K];
  4370. V2[K] = O, O = ue2;
  4371. }
  4372. });
  4373. }), j2 = V2, F = D;
  4374. }
  4375. for (; F.length < 4; )
  4376. F.push(0), j2.push(0);
  4377. for (let V2 = 0; V2 < 4; ++V2)
  4378. w.push(F[V2]), _.push(j2[V2]);
  4379. }
  4380. if (i.normal) {
  4381. const V2 = Vs(I2, s, C, i.normal);
  4382. h2.push(V2[0], V2[1], V2[2]);
  4383. }
  4384. i.material && i.material.mappingType !== "AllSame" && (S2 = Vs(I2, s, C, i.material)[0]), i.uv && i.uv.forEach(function(V2, D) {
  4385. const Y = Vs(I2, s, C, V2);
  4386. g[D] === void 0 && (g[D] = []), g[D].push(Y[0]), g[D].push(Y[1]);
  4387. }), a++, R2 && (y2.genFace(r, i, u, S2, h2, d, g, w, _, a), s++, a = 0, u = [], h2 = [], d = [], g = [], w = [], _ = []);
  4388. }), r;
  4389. }
  4390. // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
  4391. genFace(i, r, s, a, c, u, h2, d, g, w) {
  4392. for (let _ = 2; _ < w; _++)
  4393. i.vertex.push(r.vertexPositions[s[0]]), i.vertex.push(r.vertexPositions[s[1]]), i.vertex.push(r.vertexPositions[s[2]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 1]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 2]]), i.vertex.push(r.vertexPositions[s[_ * 3]]), i.vertex.push(r.vertexPositions[s[_ * 3 + 1]]), i.vertex.push(r.vertexPositions[s[_ * 3 + 2]]), r.skeleton && (i.vertexWeights.push(d[0]), i.vertexWeights.push(d[1]), i.vertexWeights.push(d[2]), i.vertexWeights.push(d[3]), i.vertexWeights.push(d[(_ - 1) * 4]), i.vertexWeights.push(d[(_ - 1) * 4 + 1]), i.vertexWeights.push(d[(_ - 1) * 4 + 2]), i.vertexWeights.push(d[(_ - 1) * 4 + 3]), i.vertexWeights.push(d[_ * 4]), i.vertexWeights.push(d[_ * 4 + 1]), i.vertexWeights.push(d[_ * 4 + 2]), i.vertexWeights.push(d[_ * 4 + 3]), i.weightsIndices.push(g[0]), i.weightsIndices.push(g[1]), i.weightsIndices.push(g[2]), i.weightsIndices.push(g[3]), i.weightsIndices.push(g[(_ - 1) * 4]), i.weightsIndices.push(g[(_ - 1) * 4 + 1]), i.weightsIndices.push(g[(_ - 1) * 4 + 2]), i.weightsIndices.push(g[(_ - 1) * 4 + 3]), i.weightsIndices.push(g[_ * 4]), i.weightsIndices.push(g[_ * 4 + 1]), i.weightsIndices.push(g[_ * 4 + 2]), i.weightsIndices.push(g[_ * 4 + 3])), r.color && (i.colors.push(u[0]), i.colors.push(u[1]), i.colors.push(u[2]), i.colors.push(u[(_ - 1) * 3]), i.colors.push(u[(_ - 1) * 3 + 1]), i.colors.push(u[(_ - 1) * 3 + 2]), i.colors.push(u[_ * 3]), i.colors.push(u[_ * 3 + 1]), i.colors.push(u[_ * 3 + 2])), r.material && r.material.mappingType !== "AllSame" && (i.materialIndex.push(a), i.materialIndex.push(a), i.materialIndex.push(a)), r.normal && (i.normal.push(c[0]), i.normal.push(c[1]), i.normal.push(c[2]), i.normal.push(c[(_ - 1) * 3]), i.normal.push(c[(_ - 1) * 3 + 1]), i.normal.push(c[(_ - 1) * 3 + 2]), i.normal.push(c[_ * 3]), i.normal.push(c[_ * 3 + 1]), i.normal.push(c[_ * 3 + 2])), r.uv && r.uv.forEach(function(y2, C) {
  4394. i.uvs[C] === void 0 && (i.uvs[C] = []), i.uvs[C].push(h2[C][0]), i.uvs[C].push(h2[C][1]), i.uvs[C].push(h2[C][(_ - 1) * 2]), i.uvs[C].push(h2[C][(_ - 1) * 2 + 1]), i.uvs[C].push(h2[C][_ * 2]), i.uvs[C].push(h2[C][_ * 2 + 1]);
  4395. });
  4396. }
  4397. addMorphTargets(i, r, s, a) {
  4398. if (s.length === 0)
  4399. return;
  4400. i.morphTargetsRelative = true, i.morphAttributes.position = [];
  4401. const c = this;
  4402. s.forEach(function(u) {
  4403. u.rawTargets.forEach(function(h2) {
  4404. const d = se2.Objects.Geometry[h2.geoID];
  4405. d !== void 0 && c.genMorphGeometry(i, r, d, a, h2.name);
  4406. });
  4407. });
  4408. }
  4409. // a morph geometry node is similar to a standard node, and the node is also contained
  4410. // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
  4411. // and a special attribute Index defining which vertices of the original geometry are affected
  4412. // Normal and position attributes only have data for the vertices that are affected by the morph
  4413. genMorphGeometry(i, r, s, a, c) {
  4414. const u = r.PolygonVertexIndex !== void 0 ? r.PolygonVertexIndex.a : [], h2 = s.Vertices !== void 0 ? s.Vertices.a : [], d = s.Indexes !== void 0 ? s.Indexes.a : [], g = i.attributes.position.count * 3, w = new Float32Array(g);
  4415. for (let I2 = 0; I2 < d.length; I2++) {
  4416. const S2 = d[I2] * 3;
  4417. w[S2] = h2[I2 * 3], w[S2 + 1] = h2[I2 * 3 + 1], w[S2 + 2] = h2[I2 * 3 + 2];
  4418. }
  4419. const _ = {
  4420. vertexIndices: u,
  4421. vertexPositions: w
  4422. }, y2 = this.genBuffers(_), C = new Float32BufferAttribute(y2.vertex, 3);
  4423. C.name = c || s.attrName, C.applyMatrix4(a), i.morphAttributes.position.push(C);
  4424. }
  4425. // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
  4426. parseNormals(i) {
  4427. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.Normals.a;
  4428. let c = [];
  4429. return s === "IndexToDirect" && ("NormalIndex" in i ? c = i.NormalIndex.a : "NormalsIndex" in i && (c = i.NormalsIndex.a)), {
  4430. dataSize: 3,
  4431. buffer: a,
  4432. indices: c,
  4433. mappingType: r,
  4434. referenceType: s
  4435. };
  4436. }
  4437. // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
  4438. parseUVs(i) {
  4439. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.UV.a;
  4440. let c = [];
  4441. return s === "IndexToDirect" && (c = i.UVIndex.a), {
  4442. dataSize: 2,
  4443. buffer: a,
  4444. indices: c,
  4445. mappingType: r,
  4446. referenceType: s
  4447. };
  4448. }
  4449. // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
  4450. parseVertexColors(i) {
  4451. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.Colors.a;
  4452. let c = [];
  4453. return s === "IndexToDirect" && (c = i.ColorIndex.a), {
  4454. dataSize: 4,
  4455. buffer: a,
  4456. indices: c,
  4457. mappingType: r,
  4458. referenceType: s
  4459. };
  4460. }
  4461. // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
  4462. parseMaterialIndices(i) {
  4463. const r = i.MappingInformationType, s = i.ReferenceInformationType;
  4464. if (r === "NoMappingInformation")
  4465. return {
  4466. dataSize: 1,
  4467. buffer: [0],
  4468. indices: [0],
  4469. mappingType: "AllSame",
  4470. referenceType: s
  4471. };
  4472. const a = i.Materials.a, c = [];
  4473. for (let u = 0; u < a.length; ++u)
  4474. c.push(u);
  4475. return {
  4476. dataSize: 1,
  4477. buffer: a,
  4478. indices: c,
  4479. mappingType: r,
  4480. referenceType: s
  4481. };
  4482. }
  4483. // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
  4484. parseNurbsGeometry(i) {
  4485. if (ma === void 0)
  4486. 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();
  4487. const r = parseInt(i.Order);
  4488. if (isNaN(r))
  4489. return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", i.Order, i.id), new BufferGeometry();
  4490. const s = r - 1, a = i.KnotVector.a, c = [], u = i.Points.a;
  4491. for (let _ = 0, y2 = u.length; _ < y2; _ += 4)
  4492. c.push(new Vector4().fromArray(u, _));
  4493. let h2, d;
  4494. if (i.Form === "Closed")
  4495. c.push(c[0]);
  4496. else if (i.Form === "Periodic") {
  4497. h2 = s, d = a.length - 1 - h2;
  4498. for (let _ = 0; _ < s; ++_)
  4499. c.push(c[_]);
  4500. }
  4501. const w = new ma(s, a, c, h2, d).getPoints(c.length * 12);
  4502. return new BufferGeometry().setFromPoints(w);
  4503. }
  4504. };
  4505. var Ku = class {
  4506. // take raw animation clips and turn them into three.js animation clips
  4507. parse() {
  4508. const i = [], r = this.parseClips();
  4509. if (r !== void 0)
  4510. for (const s in r) {
  4511. const a = r[s], c = this.addClip(a);
  4512. i.push(c);
  4513. }
  4514. return i;
  4515. }
  4516. parseClips() {
  4517. if (se2.Objects.AnimationCurve === void 0)
  4518. return;
  4519. const i = this.parseAnimationCurveNodes();
  4520. this.parseAnimationCurves(i);
  4521. const r = this.parseAnimationLayers(i);
  4522. return this.parseAnimStacks(r);
  4523. }
  4524. // parse nodes in FBXTree.Objects.AnimationCurveNode
  4525. // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
  4526. // and is referenced by an AnimationLayer
  4527. parseAnimationCurveNodes() {
  4528. const i = se2.Objects.AnimationCurveNode, r = /* @__PURE__ */ new Map();
  4529. for (const s in i) {
  4530. const a = i[s];
  4531. if (a.attrName.match(/S|R|T|DeformPercent/) !== null) {
  4532. const c = {
  4533. id: a.id,
  4534. attr: a.attrName,
  4535. curves: {}
  4536. };
  4537. r.set(c.id, c);
  4538. }
  4539. }
  4540. return r;
  4541. }
  4542. // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
  4543. // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
  4544. // axis ( e.g. times and values of x rotation)
  4545. parseAnimationCurves(i) {
  4546. const r = se2.Objects.AnimationCurve;
  4547. for (const s in r) {
  4548. const a = {
  4549. id: r[s].id,
  4550. times: r[s].KeyTime.a.map(Qu),
  4551. values: r[s].KeyValueFloat.a
  4552. }, c = Ae.get(a.id);
  4553. if (c !== void 0) {
  4554. const u = c.parents[0].ID, h2 = c.parents[0].relationship;
  4555. h2.match(/X/) ? i.get(u).curves.x = a : h2.match(/Y/) ? i.get(u).curves.y = a : h2.match(/Z/) ? i.get(u).curves.z = a : h2.match(/d|DeformPercent/) && i.has(u) && (i.get(u).curves.morph = a);
  4556. }
  4557. }
  4558. }
  4559. // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
  4560. // to various AnimationCurveNodes and is referenced by an AnimationStack node
  4561. // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
  4562. parseAnimationLayers(i) {
  4563. const r = se2.Objects.AnimationLayer, s = /* @__PURE__ */ new Map();
  4564. for (const a in r) {
  4565. const c = [], u = Ae.get(parseInt(a));
  4566. u !== void 0 && (u.children.forEach(function(d, g) {
  4567. if (i.has(d.ID)) {
  4568. const w = i.get(d.ID);
  4569. if (w.curves.x !== void 0 || w.curves.y !== void 0 || w.curves.z !== void 0) {
  4570. if (c[g] === void 0) {
  4571. const _ = Ae.get(d.ID).parents.filter(function(y2) {
  4572. return y2.relationship !== void 0;
  4573. })[0].ID;
  4574. if (_ !== void 0) {
  4575. const y2 = se2.Objects.Model[_.toString()];
  4576. if (y2 === void 0) {
  4577. console.warn("THREE.FBXLoader: Encountered a unused curve.", d);
  4578. return;
  4579. }
  4580. const C = {
  4581. modelName: y2.attrName ? PropertyBinding.sanitizeNodeName(y2.attrName) : "",
  4582. ID: y2.id,
  4583. initialPosition: [0, 0, 0],
  4584. initialRotation: [0, 0, 0],
  4585. initialScale: [1, 1, 1]
  4586. };
  4587. We.traverse(function(I2) {
  4588. I2.ID === y2.id && (C.transform = I2.matrix, I2.userData.transformData && (C.eulerOrder = I2.userData.transformData.eulerOrder));
  4589. }), C.transform || (C.transform = new Matrix4()), "PreRotation" in y2 && (C.preRotation = y2.PreRotation.value), "PostRotation" in y2 && (C.postRotation = y2.PostRotation.value), c[g] = C;
  4590. }
  4591. }
  4592. c[g] && (c[g][w.attr] = w);
  4593. } else if (w.curves.morph !== void 0) {
  4594. if (c[g] === void 0) {
  4595. const _ = Ae.get(d.ID).parents.filter(function(j2) {
  4596. return j2.relationship !== void 0;
  4597. })[0].ID, y2 = Ae.get(_).parents[0].ID, C = Ae.get(y2).parents[0].ID, I2 = Ae.get(C).parents[0].ID, S2 = se2.Objects.Model[I2], R2 = {
  4598. modelName: S2.attrName ? PropertyBinding.sanitizeNodeName(S2.attrName) : "",
  4599. morphName: se2.Objects.Deformer[_].attrName
  4600. };
  4601. c[g] = R2;
  4602. }
  4603. c[g][w.attr] = w;
  4604. }
  4605. }
  4606. }), s.set(parseInt(a), c));
  4607. }
  4608. return s;
  4609. }
  4610. // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
  4611. // hierarchy. Each Stack node will be used to create a AnimationClip
  4612. parseAnimStacks(i) {
  4613. const r = se2.Objects.AnimationStack, s = {};
  4614. for (const a in r) {
  4615. const c = Ae.get(parseInt(a)).children;
  4616. c.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
  4617. const u = i.get(c[0].ID);
  4618. s[a] = {
  4619. name: r[a].attrName,
  4620. layer: u
  4621. };
  4622. }
  4623. return s;
  4624. }
  4625. addClip(i) {
  4626. let r = [];
  4627. const s = this;
  4628. return i.layer.forEach(function(a) {
  4629. r = r.concat(s.generateTracks(a));
  4630. }), new AnimationClip(i.name, -1, r);
  4631. }
  4632. generateTracks(i) {
  4633. const r = [];
  4634. let s = new Vector3(), a = new Quaternion(), c = new Vector3();
  4635. if (i.transform && i.transform.decompose(s, a, c), s = s.toArray(), a = new Euler().setFromQuaternion(a, i.eulerOrder).toArray(), c = c.toArray(), i.T !== void 0 && Object.keys(i.T.curves).length > 0) {
  4636. const u = this.generateVectorTrack(i.modelName, i.T.curves, s, "position");
  4637. u !== void 0 && r.push(u);
  4638. }
  4639. if (i.R !== void 0 && Object.keys(i.R.curves).length > 0) {
  4640. const u = this.generateRotationTrack(i.modelName, i.R.curves, a, i.preRotation, i.postRotation, i.eulerOrder);
  4641. u !== void 0 && r.push(u);
  4642. }
  4643. if (i.S !== void 0 && Object.keys(i.S.curves).length > 0) {
  4644. const u = this.generateVectorTrack(i.modelName, i.S.curves, c, "scale");
  4645. u !== void 0 && r.push(u);
  4646. }
  4647. if (i.DeformPercent !== void 0) {
  4648. const u = this.generateMorphTrack(i);
  4649. u !== void 0 && r.push(u);
  4650. }
  4651. return r;
  4652. }
  4653. generateVectorTrack(i, r, s, a) {
  4654. const c = this.getTimesForAllAxes(r), u = this.getKeyframeTrackValues(c, r, s);
  4655. return new VectorKeyframeTrack(i + "." + a, c, u);
  4656. }
  4657. generateRotationTrack(i, r, s, a, c, u) {
  4658. r.x !== void 0 && (this.interpolateRotations(r.x), r.x.values = r.x.values.map(MathUtils.degToRad)), r.y !== void 0 && (this.interpolateRotations(r.y), r.y.values = r.y.values.map(MathUtils.degToRad)), r.z !== void 0 && (this.interpolateRotations(r.z), r.z.values = r.z.values.map(MathUtils.degToRad));
  4659. const h2 = this.getTimesForAllAxes(r), d = this.getKeyframeTrackValues(h2, r, s);
  4660. a !== void 0 && (a = a.map(MathUtils.degToRad), a.push(u), a = new Euler().fromArray(a), a = new Quaternion().setFromEuler(a)), c !== void 0 && (c = c.map(MathUtils.degToRad), c.push(u), c = new Euler().fromArray(c), c = new Quaternion().setFromEuler(c).invert());
  4661. const g = new Quaternion(), w = new Euler(), _ = [];
  4662. for (let y2 = 0; y2 < d.length; y2 += 3)
  4663. w.set(d[y2], d[y2 + 1], d[y2 + 2], u), g.setFromEuler(w), a !== void 0 && g.premultiply(a), c !== void 0 && g.multiply(c), g.toArray(_, y2 / 3 * 4);
  4664. return new QuaternionKeyframeTrack(i + ".quaternion", h2, _);
  4665. }
  4666. generateMorphTrack(i) {
  4667. const r = i.DeformPercent.curves.morph, s = r.values.map(function(c) {
  4668. return c / 100;
  4669. }), a = We.getObjectByName(i.modelName).morphTargetDictionary[i.morphName];
  4670. return new NumberKeyframeTrack(i.modelName + ".morphTargetInfluences[" + a + "]", r.times, s);
  4671. }
  4672. // For all animated objects, times are defined separately for each axis
  4673. // Here we'll combine the times into one sorted array without duplicates
  4674. getTimesForAllAxes(i) {
  4675. let r = [];
  4676. if (i.x !== void 0 && (r = r.concat(i.x.times)), i.y !== void 0 && (r = r.concat(i.y.times)), i.z !== void 0 && (r = r.concat(i.z.times)), r = r.sort(function(s, a) {
  4677. return s - a;
  4678. }), r.length > 1) {
  4679. let s = 1, a = r[0];
  4680. for (let c = 1; c < r.length; c++) {
  4681. const u = r[c];
  4682. u !== a && (r[s] = u, a = u, s++);
  4683. }
  4684. r = r.slice(0, s);
  4685. }
  4686. return r;
  4687. }
  4688. getKeyframeTrackValues(i, r, s) {
  4689. const a = s, c = [];
  4690. let u = -1, h2 = -1, d = -1;
  4691. return i.forEach(function(g) {
  4692. if (r.x && (u = r.x.times.indexOf(g)), r.y && (h2 = r.y.times.indexOf(g)), r.z && (d = r.z.times.indexOf(g)), u !== -1) {
  4693. const w = r.x.values[u];
  4694. c.push(w), a[0] = w;
  4695. } else
  4696. c.push(a[0]);
  4697. if (h2 !== -1) {
  4698. const w = r.y.values[h2];
  4699. c.push(w), a[1] = w;
  4700. } else
  4701. c.push(a[1]);
  4702. if (d !== -1) {
  4703. const w = r.z.values[d];
  4704. c.push(w), a[2] = w;
  4705. } else
  4706. c.push(a[2]);
  4707. }), c;
  4708. }
  4709. // Rotations are defined as Euler angles which can have values of any size
  4710. // These will be converted to quaternions which don't support values greater than
  4711. // PI, so we'll interpolate large rotations
  4712. interpolateRotations(i) {
  4713. for (let r = 1; r < i.values.length; r++) {
  4714. const s = i.values[r - 1], a = i.values[r] - s, c = Math.abs(a);
  4715. if (c >= 180) {
  4716. const u = c / 180, h2 = a / u;
  4717. let d = s + h2;
  4718. const g = i.times[r - 1], _ = (i.times[r] - g) / u;
  4719. let y2 = g + _;
  4720. const C = [], I2 = [];
  4721. for (; y2 < i.times[r]; )
  4722. C.push(y2), y2 += _, I2.push(d), d += h2;
  4723. i.times = ba(i.times, r, C), i.values = ba(i.values, r, I2);
  4724. }
  4725. }
  4726. }
  4727. };
  4728. var $u = class {
  4729. getPrevNode() {
  4730. return this.nodeStack[this.currentIndent - 2];
  4731. }
  4732. getCurrentNode() {
  4733. return this.nodeStack[this.currentIndent - 1];
  4734. }
  4735. getCurrentProp() {
  4736. return this.currentProp;
  4737. }
  4738. pushStack(i) {
  4739. this.nodeStack.push(i), this.currentIndent += 1;
  4740. }
  4741. popStack() {
  4742. this.nodeStack.pop(), this.currentIndent -= 1;
  4743. }
  4744. setCurrentProp(i, r) {
  4745. this.currentProp = i, this.currentPropName = r;
  4746. }
  4747. parse(i) {
  4748. this.currentIndent = 0, this.allNodes = new Qa(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
  4749. const r = this, s = i.split(/[\r\n]+/);
  4750. return s.forEach(function(a, c) {
  4751. const u = a.match(/^[\s\t]*;/), h2 = a.match(/^[\s\t]*$/);
  4752. if (u || h2)
  4753. return;
  4754. const d = a.match("^\\t{" + r.currentIndent + "}(\\w+):(.*){", ""), g = a.match("^\\t{" + r.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"), w = a.match("^\\t{" + (r.currentIndent - 1) + "}}");
  4755. d ? r.parseNodeBegin(a, d) : g ? r.parseNodeProperty(a, g, s[++c]) : w ? r.popStack() : a.match(/^[^\s\t}]/) && r.parseNodePropertyContinued(a);
  4756. }), this.allNodes;
  4757. }
  4758. parseNodeBegin(i, r) {
  4759. const s = r[1].trim().replace(/^"/, "").replace(/"$/, ""), a = r[2].split(",").map(function(d) {
  4760. return d.trim().replace(/^"/, "").replace(/"$/, "");
  4761. }), c = {
  4762. name: s
  4763. }, u = this.parseNodeAttr(a), h2 = this.getCurrentNode();
  4764. this.currentIndent === 0 ? this.allNodes.add(s, c) : s in h2 ? (s === "PoseNode" ? h2.PoseNode.push(c) : h2[s].id !== void 0 && (h2[s] = {}, h2[s][h2[s].id] = h2[s]), u.id !== "" && (h2[s][u.id] = c)) : typeof u.id == "number" ? (h2[s] = {}, h2[s][u.id] = c) : s !== "Properties70" && (s === "PoseNode" ? h2[s] = [c] : h2[s] = c), typeof u.id == "number" && (c.id = u.id), u.name !== "" && (c.attrName = u.name), u.type !== "" && (c.attrType = u.type), this.pushStack(c);
  4765. }
  4766. parseNodeAttr(i) {
  4767. let r = i[0];
  4768. i[0] !== "" && (r = parseInt(i[0]), isNaN(r) && (r = i[0]));
  4769. let s = "", a = "";
  4770. return i.length > 1 && (s = i[1].replace(/^(\w+)::/, ""), a = i[2]), {
  4771. id: r,
  4772. name: s,
  4773. type: a
  4774. };
  4775. }
  4776. parseNodeProperty(i, r, s) {
  4777. let a = r[1].replace(/^"/, "").replace(/"$/, "").trim(), c = r[2].replace(/^"/, "").replace(/"$/, "").trim();
  4778. a === "Content" && c === "," && (c = s.replace(/"/g, "").replace(/,$/, "").trim());
  4779. const u = this.getCurrentNode();
  4780. if (u.name === "Properties70") {
  4781. this.parseNodeSpecialProperty(i, a, c);
  4782. return;
  4783. }
  4784. if (a === "C") {
  4785. const d = c.split(",").slice(1), g = parseInt(d[0]), w = parseInt(d[1]);
  4786. let _ = c.split(",").slice(3);
  4787. _ = _.map(function(y2) {
  4788. return y2.trim().replace(/^"/, "");
  4789. }), a = "connections", c = [g, w], Wu(c, _), u[a] === void 0 && (u[a] = []);
  4790. }
  4791. a === "Node" && (u.id = c), a in u && Array.isArray(u[a]) ? u[a].push(c) : a !== "a" ? u[a] = c : u.a = c, this.setCurrentProp(u, a), a === "a" && c.slice(-1) !== "," && (u.a = Wr(c));
  4792. }
  4793. parseNodePropertyContinued(i) {
  4794. const r = this.getCurrentNode();
  4795. r.a += i, i.slice(-1) !== "," && (r.a = Wr(r.a));
  4796. }
  4797. // parse "Property70"
  4798. parseNodeSpecialProperty(i, r, s) {
  4799. const a = s.split('",').map(function(w) {
  4800. return w.trim().replace(/^\"/, "").replace(/\s/, "_");
  4801. }), c = a[0], u = a[1], h2 = a[2], d = a[3];
  4802. let g = a[4];
  4803. switch (u) {
  4804. case "int":
  4805. case "enum":
  4806. case "bool":
  4807. case "ULongLong":
  4808. case "double":
  4809. case "Number":
  4810. case "FieldOfView":
  4811. g = parseFloat(g);
  4812. break;
  4813. case "Color":
  4814. case "ColorRGB":
  4815. case "Vector3D":
  4816. case "Lcl_Translation":
  4817. case "Lcl_Rotation":
  4818. case "Lcl_Scaling":
  4819. g = Wr(g);
  4820. break;
  4821. }
  4822. this.getPrevNode()[c] = {
  4823. type: u,
  4824. type2: h2,
  4825. flag: d,
  4826. value: g
  4827. }, this.setCurrentProp(this.getPrevNode(), c);
  4828. }
  4829. };
  4830. var Xu = class {
  4831. parse(i) {
  4832. const r = new fa(i);
  4833. r.skip(23);
  4834. const s = r.getUint32();
  4835. if (s < 6400)
  4836. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + s);
  4837. const a = new Qa();
  4838. for (; !this.endOfContent(r); ) {
  4839. const c = this.parseNode(r, s);
  4840. c !== null && a.add(c.name, c);
  4841. }
  4842. return a;
  4843. }
  4844. // Check if reader has reached the end of content.
  4845. endOfContent(i) {
  4846. return i.size() % 16 === 0 ? (i.getOffset() + 160 + 16 & -16) >= i.size() : i.getOffset() + 160 + 16 >= i.size();
  4847. }
  4848. // recursively parse nodes until the end of the file is reached
  4849. parseNode(i, r) {
  4850. const s = {}, a = r >= 7500 ? i.getUint64() : i.getUint32(), c = r >= 7500 ? i.getUint64() : i.getUint32();
  4851. r >= 7500 ? i.getUint64() : i.getUint32();
  4852. const u = i.getUint8(), h2 = i.getString(u);
  4853. if (a === 0)
  4854. return null;
  4855. const d = [];
  4856. for (let y2 = 0; y2 < c; y2++)
  4857. d.push(this.parseProperty(i));
  4858. const g = d.length > 0 ? d[0] : "", w = d.length > 1 ? d[1] : "", _ = d.length > 2 ? d[2] : "";
  4859. for (s.singleProperty = c === 1 && i.getOffset() === a; a > i.getOffset(); ) {
  4860. const y2 = this.parseNode(i, r);
  4861. y2 !== null && this.parseSubNode(h2, s, y2);
  4862. }
  4863. return s.propertyList = d, typeof g == "number" && (s.id = g), w !== "" && (s.attrName = w), _ !== "" && (s.attrType = _), h2 !== "" && (s.name = h2), s;
  4864. }
  4865. parseSubNode(i, r, s) {
  4866. if (s.singleProperty === true) {
  4867. const a = s.propertyList[0];
  4868. Array.isArray(a) ? (r[s.name] = s, s.a = a) : r[s.name] = a;
  4869. } else if (i === "Connections" && s.name === "C") {
  4870. const a = [];
  4871. s.propertyList.forEach(function(c, u) {
  4872. u !== 0 && a.push(c);
  4873. }), r.connections === void 0 && (r.connections = []), r.connections.push(a);
  4874. } else if (s.name === "Properties70")
  4875. Object.keys(s).forEach(function(c) {
  4876. r[c] = s[c];
  4877. });
  4878. else if (i === "Properties70" && s.name === "P") {
  4879. let a = s.propertyList[0], c = s.propertyList[1];
  4880. const u = s.propertyList[2], h2 = s.propertyList[3];
  4881. let d;
  4882. a.indexOf("Lcl ") === 0 && (a = a.replace("Lcl ", "Lcl_")), c.indexOf("Lcl ") === 0 && (c = c.replace("Lcl ", "Lcl_")), c === "Color" || c === "ColorRGB" || c === "Vector" || c === "Vector3D" || c.indexOf("Lcl_") === 0 ? d = [s.propertyList[4], s.propertyList[5], s.propertyList[6]] : d = s.propertyList[4], r[a] = {
  4883. type: c,
  4884. type2: u,
  4885. flag: h2,
  4886. value: d
  4887. };
  4888. } else
  4889. r[s.name] === void 0 ? typeof s.id == "number" ? (r[s.name] = {}, r[s.name][s.id] = s) : r[s.name] = s : s.name === "PoseNode" ? (Array.isArray(r[s.name]) || (r[s.name] = [r[s.name]]), r[s.name].push(s)) : r[s.name][s.id] === void 0 && (r[s.name][s.id] = s);
  4890. }
  4891. parseProperty(i) {
  4892. const r = i.getString(1);
  4893. let s;
  4894. switch (r) {
  4895. case "C":
  4896. return i.getBoolean();
  4897. case "D":
  4898. return i.getFloat64();
  4899. case "F":
  4900. return i.getFloat32();
  4901. case "I":
  4902. return i.getInt32();
  4903. case "L":
  4904. return i.getInt64();
  4905. case "R":
  4906. return s = i.getUint32(), i.getArrayBuffer(s);
  4907. case "S":
  4908. return s = i.getUint32(), i.getString(s);
  4909. case "Y":
  4910. return i.getInt16();
  4911. case "b":
  4912. case "c":
  4913. case "d":
  4914. case "f":
  4915. case "i":
  4916. case "l":
  4917. const a = i.getUint32(), c = i.getUint32(), u = i.getUint32();
  4918. if (c === 0)
  4919. switch (r) {
  4920. case "b":
  4921. case "c":
  4922. return i.getBooleanArray(a);
  4923. case "d":
  4924. return i.getFloat64Array(a);
  4925. case "f":
  4926. return i.getFloat32Array(a);
  4927. case "i":
  4928. return i.getInt32Array(a);
  4929. case "l":
  4930. return i.getInt64Array(a);
  4931. }
  4932. const h2 = Zp(new Uint8Array(i.getArrayBuffer(u))), d = new fa(h2.buffer);
  4933. switch (r) {
  4934. case "b":
  4935. case "c":
  4936. return d.getBooleanArray(a);
  4937. case "d":
  4938. return d.getFloat64Array(a);
  4939. case "f":
  4940. return d.getFloat32Array(a);
  4941. case "i":
  4942. return d.getInt32Array(a);
  4943. case "l":
  4944. return d.getInt64Array(a);
  4945. }
  4946. default:
  4947. throw new Error("THREE.FBXLoader: Unknown property type " + r);
  4948. }
  4949. }
  4950. };
  4951. var fa = class {
  4952. constructor(i, r) {
  4953. this.dv = new DataView(i), this.offset = 0, this.littleEndian = r !== void 0 ? r : true;
  4954. }
  4955. getOffset() {
  4956. return this.offset;
  4957. }
  4958. size() {
  4959. return this.dv.buffer.byteLength;
  4960. }
  4961. skip(i) {
  4962. this.offset += i;
  4963. }
  4964. // seems like true/false representation depends on exporter.
  4965. // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
  4966. // then sees LSB.
  4967. getBoolean() {
  4968. return (this.getUint8() & 1) === 1;
  4969. }
  4970. getBooleanArray(i) {
  4971. const r = [];
  4972. for (let s = 0; s < i; s++)
  4973. r.push(this.getBoolean());
  4974. return r;
  4975. }
  4976. getUint8() {
  4977. const i = this.dv.getUint8(this.offset);
  4978. return this.offset += 1, i;
  4979. }
  4980. getInt16() {
  4981. const i = this.dv.getInt16(this.offset, this.littleEndian);
  4982. return this.offset += 2, i;
  4983. }
  4984. getInt32() {
  4985. const i = this.dv.getInt32(this.offset, this.littleEndian);
  4986. return this.offset += 4, i;
  4987. }
  4988. getInt32Array(i) {
  4989. const r = [];
  4990. for (let s = 0; s < i; s++)
  4991. r.push(this.getInt32());
  4992. return r;
  4993. }
  4994. getUint32() {
  4995. const i = this.dv.getUint32(this.offset, this.littleEndian);
  4996. return this.offset += 4, i;
  4997. }
  4998. // JavaScript doesn't support 64-bit integer so calculate this here
  4999. // 1 << 32 will return 1 so using multiply operation instead here.
  5000. // There's a possibility that this method returns wrong value if the value
  5001. // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
  5002. // TODO: safely handle 64-bit integer
  5003. getInt64() {
  5004. let i, r;
  5005. return this.littleEndian ? (i = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), i = this.getUint32()), r & 2147483648 ? (r = ~r & 4294967295, i = ~i & 4294967295, i === 4294967295 && (r = r + 1 & 4294967295), i = i + 1 & 4294967295, -(r * 4294967296 + i)) : r * 4294967296 + i;
  5006. }
  5007. getInt64Array(i) {
  5008. const r = [];
  5009. for (let s = 0; s < i; s++)
  5010. r.push(this.getInt64());
  5011. return r;
  5012. }
  5013. // Note: see getInt64() comment
  5014. getUint64() {
  5015. let i, r;
  5016. return this.littleEndian ? (i = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), i = this.getUint32()), r * 4294967296 + i;
  5017. }
  5018. getFloat32() {
  5019. const i = this.dv.getFloat32(this.offset, this.littleEndian);
  5020. return this.offset += 4, i;
  5021. }
  5022. getFloat32Array(i) {
  5023. const r = [];
  5024. for (let s = 0; s < i; s++)
  5025. r.push(this.getFloat32());
  5026. return r;
  5027. }
  5028. getFloat64() {
  5029. const i = this.dv.getFloat64(this.offset, this.littleEndian);
  5030. return this.offset += 8, i;
  5031. }
  5032. getFloat64Array(i) {
  5033. const r = [];
  5034. for (let s = 0; s < i; s++)
  5035. r.push(this.getFloat64());
  5036. return r;
  5037. }
  5038. getArrayBuffer(i) {
  5039. const r = this.dv.buffer.slice(this.offset, this.offset + i);
  5040. return this.offset += i, r;
  5041. }
  5042. getString(i) {
  5043. let r = [];
  5044. for (let a = 0; a < i; a++)
  5045. r[a] = this.getUint8();
  5046. const s = r.indexOf(0);
  5047. return s >= 0 && (r = r.slice(0, s)), LoaderUtils.decodeText(new Uint8Array(r));
  5048. }
  5049. };
  5050. var Qa = class {
  5051. add(i, r) {
  5052. this[i] = r;
  5053. }
  5054. };
  5055. function Yu(b2) {
  5056. const i = "Kaydara FBX Binary \0";
  5057. return b2.byteLength >= i.length && i === Ja(b2, 0, i.length);
  5058. }
  5059. function qu(b2) {
  5060. const i = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
  5061. let r = 0;
  5062. function s(a) {
  5063. const c = b2[a - 1];
  5064. return b2 = b2.slice(r + a), r++, c;
  5065. }
  5066. for (let a = 0; a < i.length; ++a)
  5067. if (s(1) === i[a])
  5068. return false;
  5069. return true;
  5070. }
  5071. function va(b2) {
  5072. const i = /FBXVersion: (\d+)/, r = b2.match(i);
  5073. if (r)
  5074. return parseInt(r[1]);
  5075. throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
  5076. }
  5077. function Qu(b2) {
  5078. return b2 / 46186158e3;
  5079. }
  5080. var Zu = [];
  5081. function Vs(b2, i, r, s) {
  5082. let a;
  5083. switch (s.mappingType) {
  5084. case "ByPolygonVertex":
  5085. a = b2;
  5086. break;
  5087. case "ByPolygon":
  5088. a = i;
  5089. break;
  5090. case "ByVertice":
  5091. a = r;
  5092. break;
  5093. case "AllSame":
  5094. a = s.indices[0];
  5095. break;
  5096. default:
  5097. console.warn("THREE.FBXLoader: unknown attribute mapping type " + s.mappingType);
  5098. }
  5099. s.referenceType === "IndexToDirect" && (a = s.indices[a]);
  5100. const c = a * s.dataSize, u = c + s.dataSize;
  5101. return Ju(Zu, s.buffer, c, u);
  5102. }
  5103. var Zr = new Euler();
  5104. var ci = new Vector3();
  5105. function Za(b2) {
  5106. const i = new Matrix4(), r = new Matrix4(), s = new Matrix4(), a = new Matrix4(), c = new Matrix4(), u = new Matrix4(), h2 = new Matrix4(), d = new Matrix4(), g = new Matrix4(), w = new Matrix4(), _ = new Matrix4(), y2 = new Matrix4(), C = b2.inheritType ? b2.inheritType : 0;
  5107. if (b2.translation && i.setPosition(ci.fromArray(b2.translation)), b2.preRotation) {
  5108. const K = b2.preRotation.map(MathUtils.degToRad);
  5109. K.push(b2.eulerOrder), r.makeRotationFromEuler(Zr.fromArray(K));
  5110. }
  5111. if (b2.rotation) {
  5112. const K = b2.rotation.map(MathUtils.degToRad);
  5113. K.push(b2.eulerOrder), s.makeRotationFromEuler(Zr.fromArray(K));
  5114. }
  5115. if (b2.postRotation) {
  5116. const K = b2.postRotation.map(MathUtils.degToRad);
  5117. K.push(b2.eulerOrder), a.makeRotationFromEuler(Zr.fromArray(K)), a.invert();
  5118. }
  5119. b2.scale && c.scale(ci.fromArray(b2.scale)), b2.scalingOffset && h2.setPosition(ci.fromArray(b2.scalingOffset)), b2.scalingPivot && u.setPosition(ci.fromArray(b2.scalingPivot)), b2.rotationOffset && d.setPosition(ci.fromArray(b2.rotationOffset)), b2.rotationPivot && g.setPosition(ci.fromArray(b2.rotationPivot)), b2.parentMatrixWorld && (_.copy(b2.parentMatrix), w.copy(b2.parentMatrixWorld));
  5120. const I2 = r.clone().multiply(s).multiply(a), S2 = new Matrix4();
  5121. S2.extractRotation(w);
  5122. const R2 = new Matrix4();
  5123. R2.copyPosition(w);
  5124. const j2 = R2.clone().invert().multiply(w), F = S2.clone().invert().multiply(j2), V2 = c, D = new Matrix4();
  5125. if (C === 0)
  5126. D.copy(S2).multiply(I2).multiply(F).multiply(V2);
  5127. else if (C === 1)
  5128. D.copy(S2).multiply(F).multiply(I2).multiply(V2);
  5129. else {
  5130. const q = new Matrix4().scale(new Vector3().setFromMatrixScale(_)).clone().invert(), ue2 = F.clone().multiply(q);
  5131. D.copy(S2).multiply(I2).multiply(ue2).multiply(V2);
  5132. }
  5133. const Y = g.clone().invert(), G2 = u.clone().invert();
  5134. let N = i.clone().multiply(d).multiply(g).multiply(r).multiply(s).multiply(a).multiply(Y).multiply(h2).multiply(u).multiply(c).multiply(G2);
  5135. const O = new Matrix4().copyPosition(N), H2 = w.clone().multiply(O);
  5136. return y2.copyPosition(H2), N = y2.clone().multiply(D), N.premultiply(w.invert()), N;
  5137. }
  5138. function Wa(b2) {
  5139. b2 = b2 || 0;
  5140. const i = [
  5141. "ZYX",
  5142. // -> XYZ extrinsic
  5143. "YZX",
  5144. // -> XZY extrinsic
  5145. "XZY",
  5146. // -> YZX extrinsic
  5147. "ZXY",
  5148. // -> YXZ extrinsic
  5149. "YXZ",
  5150. // -> ZXY extrinsic
  5151. "XYZ"
  5152. // -> ZYX extrinsic
  5153. //'SphericXYZ', // not possible to support
  5154. ];
  5155. return b2 === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), i[0]) : i[b2];
  5156. }
  5157. function Wr(b2) {
  5158. return b2.split(",").map(function(r) {
  5159. return parseFloat(r);
  5160. });
  5161. }
  5162. function Ja(b2, i, r) {
  5163. return i === void 0 && (i = 0), r === void 0 && (r = b2.byteLength), LoaderUtils.decodeText(new Uint8Array(b2, i, r));
  5164. }
  5165. function Wu(b2, i) {
  5166. for (let r = 0, s = b2.length, a = i.length; r < a; r++, s++)
  5167. b2[s] = i[r];
  5168. }
  5169. function Ju(b2, i, r, s) {
  5170. for (let a = r, c = 0; a < s; a++, c++)
  5171. b2[c] = i[a];
  5172. return b2;
  5173. }
  5174. function ba(b2, i, r) {
  5175. return b2.slice(0, i).concat(r).concat(b2.slice(i));
  5176. }
  5177. var eh = class extends Loader {
  5178. constructor(i) {
  5179. super(i);
  5180. }
  5181. load(i, r, s, a) {
  5182. const c = new FileLoader(this.manager);
  5183. c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(i, (u) => {
  5184. if (typeof u != "string")
  5185. throw new Error("unsupported data type");
  5186. const h2 = JSON.parse(u), d = this.parse(h2);
  5187. r && r(d);
  5188. }, s, a);
  5189. }
  5190. parse(i) {
  5191. return new go(i);
  5192. }
  5193. };
  5194. var go = class {
  5195. constructor(i) {
  5196. T2(this, "data", void 0), this.data = i;
  5197. }
  5198. generateShapes(i, r = 100, s) {
  5199. const a = [], c = {
  5200. letterSpacing: 0,
  5201. lineHeight: 1,
  5202. ...s
  5203. }, u = th(i, r, this.data, c);
  5204. for (let h2 = 0, d = u.length; h2 < d; h2++)
  5205. Array.prototype.push.apply(a, u[h2].toShapes(false));
  5206. return a;
  5207. }
  5208. };
  5209. T2(go, "isFont", void 0);
  5210. T2(go, "type", void 0);
  5211. function th(b2, i, r, s) {
  5212. const a = Array.from(b2), c = i / r.resolution, u = (r.boundingBox.yMax - r.boundingBox.yMin + r.underlineThickness) * c, h2 = [];
  5213. let d = 0, g = 0;
  5214. for (let w = 0; w < a.length; w++) {
  5215. const _ = a[w];
  5216. if (_ === `
  5217. `)
  5218. d = 0, g -= u * s.lineHeight;
  5219. else {
  5220. const y2 = nh(_, c, d, g, r);
  5221. y2 && (d += y2.offsetX + s.letterSpacing, h2.push(y2.path));
  5222. }
  5223. }
  5224. return h2;
  5225. }
  5226. function nh(b2, i, r, s, a) {
  5227. const c = a.glyphs[b2] || a.glyphs["?"];
  5228. if (!c) {
  5229. console.error('THREE.Font: character "' + b2 + '" does not exists in font family ' + a.familyName + ".");
  5230. return;
  5231. }
  5232. const u = new ShapePath();
  5233. let h2, d, g, w, _, y2, C, I2;
  5234. if (c.o) {
  5235. const S2 = c._cachedOutline || (c._cachedOutline = c.o.split(" "));
  5236. for (let R2 = 0, j2 = S2.length; R2 < j2; )
  5237. switch (S2[R2++]) {
  5238. case "m":
  5239. h2 = parseInt(S2[R2++]) * i + r, d = parseInt(S2[R2++]) * i + s, u.moveTo(h2, d);
  5240. break;
  5241. case "l":
  5242. h2 = parseInt(S2[R2++]) * i + r, d = parseInt(S2[R2++]) * i + s, u.lineTo(h2, d);
  5243. break;
  5244. case "q":
  5245. g = parseInt(S2[R2++]) * i + r, w = parseInt(S2[R2++]) * i + s, _ = parseInt(S2[R2++]) * i + r, y2 = parseInt(S2[R2++]) * i + s, u.quadraticCurveTo(_, y2, g, w);
  5246. break;
  5247. case "b":
  5248. g = parseInt(S2[R2++]) * i + r, w = parseInt(S2[R2++]) * i + s, _ = parseInt(S2[R2++]) * i + r, y2 = parseInt(S2[R2++]) * i + s, C = parseInt(S2[R2++]) * i + r, I2 = parseInt(S2[R2++]) * i + s, u.bezierCurveTo(_, y2, C, I2, g, w);
  5249. break;
  5250. }
  5251. }
  5252. return {
  5253. offsetX: c.ha * i,
  5254. path: u
  5255. };
  5256. }
  5257. var el = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  5258. function ih(b2) {
  5259. return b2 && b2.__esModule && Object.prototype.hasOwnProperty.call(b2, "default") ? b2.default : b2;
  5260. }
  5261. var sh = class extends DataTextureLoader {
  5262. constructor(i) {
  5263. super(i), this.type = HalfFloatType;
  5264. }
  5265. // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
  5266. parse(i) {
  5267. const h2 = function(V2, D) {
  5268. switch (V2) {
  5269. case 1:
  5270. console.error("THREE.RGBELoader Read Error: " + (D || ""));
  5271. break;
  5272. case 2:
  5273. console.error("THREE.RGBELoader Write Error: " + (D || ""));
  5274. break;
  5275. case 3:
  5276. console.error("THREE.RGBELoader Bad File Format: " + (D || ""));
  5277. break;
  5278. default:
  5279. case 4:
  5280. console.error("THREE.RGBELoader: Error: " + (D || ""));
  5281. }
  5282. return -1;
  5283. }, _ = `
  5284. `, y2 = function(V2, D, Y) {
  5285. D = D || 1024;
  5286. let N = V2.pos, O = -1, H2 = 0, K = "", q = String.fromCharCode.apply(null, new Uint16Array(V2.subarray(N, N + 128)));
  5287. for (; 0 > (O = q.indexOf(_)) && H2 < D && N < V2.byteLength; )
  5288. K += q, H2 += q.length, N += 128, q += String.fromCharCode.apply(null, new Uint16Array(V2.subarray(N, N + 128)));
  5289. return -1 < O ? (Y !== false && (V2.pos += H2 + O + 1), K + q.slice(0, O)) : false;
  5290. }, C = function(V2) {
  5291. const D = /^#\?(\S+)/, Y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, G2 = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, O = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, H2 = {
  5292. valid: 0,
  5293. string: "",
  5294. comments: "",
  5295. programtype: "RGBE",
  5296. format: "",
  5297. gamma: 1,
  5298. exposure: 1,
  5299. width: 0,
  5300. height: 0
  5301. /* image dimensions, width/height */
  5302. };
  5303. let K, q;
  5304. if (V2.pos >= V2.byteLength || !(K = y2(V2)))
  5305. return h2(1, "no header found");
  5306. if (!(q = K.match(D)))
  5307. return h2(3, "bad initial token");
  5308. for (H2.valid |= 1, H2.programtype = q[1], H2.string += K + `
  5309. `; K = y2(V2), K !== false; ) {
  5310. if (H2.string += K + `
  5311. `, K.charAt(0) === "#") {
  5312. H2.comments += K + `
  5313. `;
  5314. continue;
  5315. }
  5316. if ((q = K.match(Y)) && (H2.gamma = parseFloat(q[1])), (q = K.match(G2)) && (H2.exposure = parseFloat(q[1])), (q = K.match(N)) && (H2.valid |= 2, H2.format = q[1]), (q = K.match(O)) && (H2.valid |= 4, H2.height = parseInt(q[1], 10), H2.width = parseInt(q[2], 10)), H2.valid & 2 && H2.valid & 4)
  5317. break;
  5318. }
  5319. return H2.valid & 2 ? H2.valid & 4 ? H2 : h2(3, "missing image size specifier") : h2(3, "missing format specifier");
  5320. }, I2 = function(V2, D, Y) {
  5321. const G2 = D;
  5322. if (
  5323. // run length encoding is not allowed so read flat
  5324. G2 < 8 || G2 > 32767 || // this file is not run length encoded
  5325. V2[0] !== 2 || V2[1] !== 2 || V2[2] & 128
  5326. )
  5327. return new Uint8Array(V2);
  5328. if (G2 !== (V2[2] << 8 | V2[3]))
  5329. return h2(3, "wrong scanline width");
  5330. const N = new Uint8Array(4 * D * Y);
  5331. if (!N.length)
  5332. return h2(4, "unable to allocate buffer space");
  5333. let O = 0, H2 = 0;
  5334. const K = 4 * G2, q = new Uint8Array(4), ue2 = new Uint8Array(K);
  5335. let ge = Y;
  5336. for (; ge > 0 && H2 < V2.byteLength; ) {
  5337. if (H2 + 4 > V2.byteLength)
  5338. return h2(1);
  5339. if (q[0] = V2[H2++], q[1] = V2[H2++], q[2] = V2[H2++], q[3] = V2[H2++], q[0] != 2 || q[1] != 2 || (q[2] << 8 | q[3]) != G2)
  5340. return h2(3, "bad rgbe scanline format");
  5341. let ce2 = 0, me2;
  5342. for (; ce2 < K && H2 < V2.byteLength; ) {
  5343. me2 = V2[H2++];
  5344. const ee2 = me2 > 128;
  5345. if (ee2 && (me2 -= 128), me2 === 0 || ce2 + me2 > K)
  5346. return h2(3, "bad scanline data");
  5347. if (ee2) {
  5348. const X = V2[H2++];
  5349. for (let Pe = 0; Pe < me2; Pe++)
  5350. ue2[ce2++] = X;
  5351. } else
  5352. ue2.set(V2.subarray(H2, H2 + me2), ce2), ce2 += me2, H2 += me2;
  5353. }
  5354. const he = G2;
  5355. for (let ee2 = 0; ee2 < he; ee2++) {
  5356. let X = 0;
  5357. N[O] = ue2[ee2 + X], X += G2, N[O + 1] = ue2[ee2 + X], X += G2, N[O + 2] = ue2[ee2 + X], X += G2, N[O + 3] = ue2[ee2 + X], O += 4;
  5358. }
  5359. ge--;
  5360. }
  5361. return N;
  5362. }, S2 = function(V2, D, Y, G2) {
  5363. const N = V2[D + 3], O = Math.pow(2, N - 128) / 255;
  5364. Y[G2 + 0] = V2[D + 0] * O, Y[G2 + 1] = V2[D + 1] * O, Y[G2 + 2] = V2[D + 2] * O, Y[G2 + 3] = 1;
  5365. }, R2 = function(V2, D, Y, G2) {
  5366. const N = V2[D + 3], O = Math.pow(2, N - 128) / 255;
  5367. Y[G2 + 0] = DataUtils.toHalfFloat(Math.min(V2[D + 0] * O, 65504)), Y[G2 + 1] = DataUtils.toHalfFloat(Math.min(V2[D + 1] * O, 65504)), Y[G2 + 2] = DataUtils.toHalfFloat(Math.min(V2[D + 2] * O, 65504)), Y[G2 + 3] = DataUtils.toHalfFloat(1);
  5368. }, j2 = new Uint8Array(i);
  5369. j2.pos = 0;
  5370. const F = C(j2);
  5371. if (F !== -1) {
  5372. const V2 = F.width, D = F.height, Y = I2(j2.subarray(j2.pos), V2, D);
  5373. if (Y !== -1) {
  5374. let G2, N, O;
  5375. switch (this.type) {
  5376. case FloatType:
  5377. O = Y.length / 4;
  5378. const H2 = new Float32Array(O * 4);
  5379. for (let q = 0; q < O; q++)
  5380. S2(Y, q * 4, H2, q * 4);
  5381. G2 = H2, N = FloatType;
  5382. break;
  5383. case HalfFloatType:
  5384. O = Y.length / 4;
  5385. const K = new Uint16Array(O * 4);
  5386. for (let q = 0; q < O; q++)
  5387. R2(Y, q * 4, K, q * 4);
  5388. G2 = K, N = HalfFloatType;
  5389. break;
  5390. default:
  5391. console.error("THREE.RGBELoader: unsupported type: ", this.type);
  5392. break;
  5393. }
  5394. return {
  5395. width: V2,
  5396. height: D,
  5397. data: G2,
  5398. header: F.string,
  5399. gamma: F.gamma,
  5400. exposure: F.exposure,
  5401. type: N
  5402. };
  5403. }
  5404. }
  5405. return null;
  5406. }
  5407. setDataType(i) {
  5408. return this.type = i, this;
  5409. }
  5410. load(i, r, s, a) {
  5411. function c(u, h2) {
  5412. switch (u.type) {
  5413. case FloatType:
  5414. case HalfFloatType:
  5415. u.encoding = LinearEncoding, u.minFilter = LinearFilter, u.magFilter = LinearFilter, u.generateMipmaps = false, u.flipY = true;
  5416. break;
  5417. }
  5418. r && r(u, h2);
  5419. }
  5420. return super.load(i, c, s, a);
  5421. }
  5422. };
  5423. var Jr = /* @__PURE__ */ new WeakMap();
  5424. var rh = class extends Loader {
  5425. constructor(i) {
  5426. super(i), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
  5427. position: "POSITION",
  5428. normal: "NORMAL",
  5429. color: "COLOR",
  5430. uv: "TEX_COORD"
  5431. }, this.defaultAttributeTypes = {
  5432. position: "Float32Array",
  5433. normal: "Float32Array",
  5434. color: "Float32Array",
  5435. uv: "Float32Array"
  5436. };
  5437. }
  5438. setDecoderPath(i) {
  5439. return this.decoderPath = i, this;
  5440. }
  5441. setDecoderConfig(i) {
  5442. return this.decoderConfig = i, this;
  5443. }
  5444. setWorkerLimit(i) {
  5445. return this.workerLimit = i, this;
  5446. }
  5447. load(i, r, s, a) {
  5448. const c = new FileLoader(this.manager);
  5449. c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(i, (u) => {
  5450. const h2 = {
  5451. attributeIDs: this.defaultAttributeIDs,
  5452. attributeTypes: this.defaultAttributeTypes,
  5453. useUniqueIDs: false
  5454. };
  5455. this.decodeGeometry(u, h2).then(r).catch(a);
  5456. }, s, a);
  5457. }
  5458. /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
  5459. decodeDracoFile(i, r, s, a) {
  5460. const c = {
  5461. attributeIDs: s || this.defaultAttributeIDs,
  5462. attributeTypes: a || this.defaultAttributeTypes,
  5463. useUniqueIDs: !!s
  5464. };
  5465. this.decodeGeometry(i, c).then(r);
  5466. }
  5467. decodeGeometry(i, r) {
  5468. for (const d in r.attributeTypes) {
  5469. const g = r.attributeTypes[d];
  5470. g.BYTES_PER_ELEMENT !== void 0 && (r.attributeTypes[d] = g.name);
  5471. }
  5472. const s = JSON.stringify(r);
  5473. if (Jr.has(i)) {
  5474. const d = Jr.get(i);
  5475. if (d.key === s)
  5476. return d.promise;
  5477. if (i.byteLength === 0)
  5478. throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
  5479. }
  5480. let a;
  5481. const c = this.workerNextTaskID++, u = i.byteLength, h2 = this._getWorker(c, u).then((d) => (a = d, new Promise((g, w) => {
  5482. a._callbacks[c] = {
  5483. resolve: g,
  5484. reject: w
  5485. }, a.postMessage({
  5486. type: "decode",
  5487. id: c,
  5488. taskConfig: r,
  5489. buffer: i
  5490. }, [i]);
  5491. }))).then((d) => this._createGeometry(d.geometry));
  5492. return h2.catch(() => true).then(() => {
  5493. a && c && this._releaseTask(a, c);
  5494. }), Jr.set(i, {
  5495. key: s,
  5496. promise: h2
  5497. }), h2;
  5498. }
  5499. _createGeometry(i) {
  5500. const r = new BufferGeometry();
  5501. i.index && r.setIndex(new BufferAttribute(i.index.array, 1));
  5502. for (let s = 0; s < i.attributes.length; s++) {
  5503. const a = i.attributes[s], c = a.name, u = a.array, h2 = a.itemSize;
  5504. r.setAttribute(c, new BufferAttribute(u, h2));
  5505. }
  5506. return r;
  5507. }
  5508. _loadLibrary(i, r) {
  5509. const s = new FileLoader(this.manager);
  5510. return s.setPath(this.decoderPath), s.setResponseType(r), s.setWithCredentials(this.withCredentials), new Promise((a, c) => {
  5511. s.load(i, a, void 0, c);
  5512. });
  5513. }
  5514. preload() {
  5515. return this._initDecoder(), this;
  5516. }
  5517. _initDecoder() {
  5518. if (this.decoderPending)
  5519. return this.decoderPending;
  5520. const i = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
  5521. return i ? r.push(this._loadLibrary("draco_decoder.js", "text")) : (r.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), r.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(r).then((s) => {
  5522. const a = s[0];
  5523. i || (this.decoderConfig.wasmBinary = s[1]);
  5524. const c = oh.toString(), u = ["/* draco decoder */", a, "", "/* worker */", c.substring(c.indexOf("{") + 1, c.lastIndexOf("}"))].join(`
  5525. `);
  5526. this.workerSourceURL = URL.createObjectURL(new Blob([u]));
  5527. }), this.decoderPending;
  5528. }
  5529. _getWorker(i, r) {
  5530. return this._initDecoder().then(() => {
  5531. if (this.workerPool.length < this.workerLimit) {
  5532. const a = new Worker(this.workerSourceURL);
  5533. a._callbacks = {}, a._taskCosts = {}, a._taskLoad = 0, a.postMessage({
  5534. type: "init",
  5535. decoderConfig: this.decoderConfig
  5536. }), a.onmessage = function(c) {
  5537. const u = c.data;
  5538. switch (u.type) {
  5539. case "decode":
  5540. a._callbacks[u.id].resolve(u);
  5541. break;
  5542. case "error":
  5543. a._callbacks[u.id].reject(u);
  5544. break;
  5545. default:
  5546. console.error('THREE.DRACOLoader: Unexpected message, "' + u.type + '"');
  5547. }
  5548. }, this.workerPool.push(a);
  5549. } else
  5550. this.workerPool.sort(function(a, c) {
  5551. return a._taskLoad > c._taskLoad ? -1 : 1;
  5552. });
  5553. const s = this.workerPool[this.workerPool.length - 1];
  5554. return s._taskCosts[i] = r, s._taskLoad += r, s;
  5555. });
  5556. }
  5557. _releaseTask(i, r) {
  5558. i._taskLoad -= i._taskCosts[r], delete i._callbacks[r], delete i._taskCosts[r];
  5559. }
  5560. debug() {
  5561. console.log("Task load: ", this.workerPool.map((i) => i._taskLoad));
  5562. }
  5563. dispose() {
  5564. for (let i = 0; i < this.workerPool.length; ++i)
  5565. this.workerPool[i].terminate();
  5566. return this.workerPool.length = 0, this;
  5567. }
  5568. };
  5569. function oh() {
  5570. let b2, i;
  5571. onmessage = function(u) {
  5572. const h2 = u.data;
  5573. switch (h2.type) {
  5574. case "init":
  5575. b2 = h2.decoderConfig, i = new Promise(function(w) {
  5576. b2.onModuleLoaded = function(_) {
  5577. w({
  5578. draco: _
  5579. });
  5580. }, DracoDecoderModule(b2);
  5581. });
  5582. break;
  5583. case "decode":
  5584. const d = h2.buffer, g = h2.taskConfig;
  5585. i.then((w) => {
  5586. const _ = w.draco, y2 = new _.Decoder(), C = new _.DecoderBuffer();
  5587. C.Init(new Int8Array(d), d.byteLength);
  5588. try {
  5589. const I2 = r(_, y2, C, g), S2 = I2.attributes.map((R2) => R2.array.buffer);
  5590. I2.index && S2.push(I2.index.array.buffer), self.postMessage({
  5591. type: "decode",
  5592. id: h2.id,
  5593. geometry: I2
  5594. }, S2);
  5595. } catch (I2) {
  5596. console.error(I2), self.postMessage({
  5597. type: "error",
  5598. id: h2.id,
  5599. error: I2.message
  5600. });
  5601. } finally {
  5602. _.destroy(C), _.destroy(y2);
  5603. }
  5604. });
  5605. break;
  5606. }
  5607. };
  5608. function r(u, h2, d, g) {
  5609. const w = g.attributeIDs, _ = g.attributeTypes;
  5610. let y2, C;
  5611. const I2 = h2.GetEncodedGeometryType(d);
  5612. if (I2 === u.TRIANGULAR_MESH)
  5613. y2 = new u.Mesh(), C = h2.DecodeBufferToMesh(d, y2);
  5614. else if (I2 === u.POINT_CLOUD)
  5615. y2 = new u.PointCloud(), C = h2.DecodeBufferToPointCloud(d, y2);
  5616. else
  5617. throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
  5618. if (!C.ok() || y2.ptr === 0)
  5619. throw new Error("THREE.DRACOLoader: Decoding failed: " + C.error_msg());
  5620. const S2 = {
  5621. index: null,
  5622. attributes: []
  5623. };
  5624. for (const R2 in w) {
  5625. const j2 = self[_[R2]];
  5626. let F, V2;
  5627. if (g.useUniqueIDs)
  5628. V2 = w[R2], F = h2.GetAttributeByUniqueId(y2, V2);
  5629. else {
  5630. if (V2 = h2.GetAttributeId(y2, u[w[R2]]), V2 === -1)
  5631. continue;
  5632. F = h2.GetAttribute(y2, V2);
  5633. }
  5634. S2.attributes.push(a(u, h2, y2, R2, j2, F));
  5635. }
  5636. return I2 === u.TRIANGULAR_MESH && (S2.index = s(u, h2, y2)), u.destroy(y2), S2;
  5637. }
  5638. function s(u, h2, d) {
  5639. const w = d.num_faces() * 3, _ = w * 4, y2 = u._malloc(_);
  5640. h2.GetTrianglesUInt32Array(d, _, y2);
  5641. const C = new Uint32Array(u.HEAPF32.buffer, y2, w).slice();
  5642. return u._free(y2), {
  5643. array: C,
  5644. itemSize: 1
  5645. };
  5646. }
  5647. function a(u, h2, d, g, w, _) {
  5648. const y2 = _.num_components(), I2 = d.num_points() * y2, S2 = I2 * w.BYTES_PER_ELEMENT, R2 = c(u, w), j2 = u._malloc(S2);
  5649. h2.GetAttributeDataArrayForAllPoints(d, _, R2, S2, j2);
  5650. const F = new w(u.HEAPF32.buffer, j2, I2).slice();
  5651. return u._free(j2), {
  5652. name: g,
  5653. array: F,
  5654. itemSize: y2
  5655. };
  5656. }
  5657. function c(u, h2) {
  5658. switch (h2) {
  5659. case Float32Array:
  5660. return u.DT_FLOAT32;
  5661. case Int8Array:
  5662. return u.DT_INT8;
  5663. case Int16Array:
  5664. return u.DT_INT16;
  5665. case Int32Array:
  5666. return u.DT_INT32;
  5667. case Uint8Array:
  5668. return u.DT_UINT8;
  5669. case Uint16Array:
  5670. return u.DT_UINT16;
  5671. case Uint32Array:
  5672. return u.DT_UINT32;
  5673. }
  5674. }
  5675. }
  5676. function Fn() {
  5677. const { state: b2, setState: i } = inject("useTres", L()), r = inject("extend") || (() => {
  5678. });
  5679. return {
  5680. state: b2,
  5681. setState: i,
  5682. extend: r
  5683. };
  5684. }
  5685. var ah = ["args"];
  5686. var ud = defineComponent({
  5687. __name: "OrbitControls",
  5688. props: {
  5689. makeDefault: { type: Boolean, default: false },
  5690. camera: null,
  5691. domElement: null,
  5692. target: null,
  5693. enableDamping: { type: Boolean }
  5694. },
  5695. setup(b2) {
  5696. const i = b2, { state: r, setState: s, extend: a } = Fn(), c = ref(null);
  5697. return a({ OrbitControls: iu }), watch(c, (u) => {
  5698. u && i.makeDefault ? s("controls", u) : s("controls", null);
  5699. }), (u, h2) => {
  5700. var d;
  5701. return unref(r).camera && unref(r).renderer ? (openBlock(), createElementBlock("TresOrbitControls", {
  5702. key: 0,
  5703. ref_key: "controls",
  5704. ref: c,
  5705. args: [unref(unref(r).camera) || b2.camera, ((d = unref(r).renderer) == null ? void 0 : d.domElement) || b2.domElement]
  5706. }, null, 8, ah)) : createCommentVNode("", true);
  5707. };
  5708. }
  5709. });
  5710. function lh(b2, i) {
  5711. const r = {};
  5712. for (const s of i)
  5713. Object.prototype.hasOwnProperty.call(b2, s) && (r[s] = b2[s]);
  5714. return r;
  5715. }
  5716. function ch(b2, i) {
  5717. const r = `set${i[0].toUpperCase()}${i.slice(1)}`;
  5718. return b2[r] !== void 0;
  5719. }
  5720. var hd = defineComponent({
  5721. __name: "TransformControls",
  5722. props: {
  5723. object: null,
  5724. mode: null,
  5725. enabled: { type: Boolean, default: true },
  5726. axis: null,
  5727. translationSnap: null,
  5728. rotationSnap: null,
  5729. scaleSnap: null,
  5730. space: null,
  5731. size: null,
  5732. showX: { type: Boolean },
  5733. showY: { type: Boolean },
  5734. showZ: { type: Boolean }
  5735. },
  5736. emits: ["dragging", "change", "mouseDown", "mouseUp", "objectChange"],
  5737. setup(b2, { emit: i }) {
  5738. const r = b2;
  5739. let s = shallowRef();
  5740. const { state: a } = Fn(), c = computed(
  5741. () => lh(r, [
  5742. "enabled",
  5743. "axis",
  5744. "mode",
  5745. "translationSnap",
  5746. "rotationSnap",
  5747. "scaleSnap",
  5748. "space",
  5749. "size",
  5750. "showX",
  5751. "showY",
  5752. "showZ"
  5753. ])
  5754. ), u = () => i("change", s.value), h2 = () => i("mouseDown", s.value), d = () => i("mouseUp", s.value), g = () => i("objectChange", s.value), w = (y2) => {
  5755. a.controls && (a.controls.enabled = !y2.value), i("dragging", y2.value);
  5756. };
  5757. function _(y2) {
  5758. y2.addEventListener("dragging-changed", w), y2.addEventListener("change", u), y2.addEventListener("mouseDown", h2), y2.addEventListener("mouseUp", d), y2.addEventListener("objectChange", g);
  5759. }
  5760. return watchEffect(() => {
  5761. a.camera && a.renderer && a.scene && r.object && (s.value = new eu(a.camera, a.renderer.domElement), s.value.attach(r.object), a.scene.add(s.value), _(s.value));
  5762. }), watch(
  5763. [c, s],
  5764. // TODO: properly type this
  5765. ([y2, C]) => {
  5766. if (y2 && C)
  5767. for (const I2 in y2)
  5768. if (!ch(C, I2))
  5769. C[I2] = y2[I2];
  5770. else {
  5771. const S2 = `set${I2[0].toUpperCase()}${I2.slice(1)}`;
  5772. typeof C[S2] == "function" && y2[I2] !== void 0 && C[S2](y2[I2]);
  5773. }
  5774. },
  5775. {
  5776. immediate: true
  5777. }
  5778. ), onUnmounted(() => {
  5779. s.value && (s.value.removeEventListener("dragging-changed", w), s.value.removeEventListener("change", u), s.value.removeEventListener("mouseDown", h2), s.value.removeEventListener("mouseUp", d), s.value.removeEventListener("objectChange", g));
  5780. }), (y2, C) => renderSlot(y2.$slots, "default");
  5781. }
  5782. });
  5783. var ga;
  5784. var tl = typeof window < "u";
  5785. var ph = (b2) => typeof b2 == "string";
  5786. var uh = () => {
  5787. };
  5788. tl && ((ga = window == null ? void 0 : window.navigator) != null && ga.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  5789. function nl(b2) {
  5790. return typeof b2 == "function" ? b2() : unref(b2);
  5791. }
  5792. function hh(b2) {
  5793. return b2;
  5794. }
  5795. function dh(b2) {
  5796. return getCurrentScope() ? (onScopeDispose(b2), true) : false;
  5797. }
  5798. function mh(b2, i = true) {
  5799. getCurrentInstance() ? onMounted(b2) : i ? b2() : nextTick(b2);
  5800. }
  5801. function fh(b2) {
  5802. var i;
  5803. const r = nl(b2);
  5804. return (i = r == null ? void 0 : r.$el) != null ? i : r;
  5805. }
  5806. var _o = tl ? window : void 0;
  5807. function Vn(...b2) {
  5808. let i, r, s, a;
  5809. if (ph(b2[0]) || Array.isArray(b2[0]) ? ([r, s, a] = b2, i = _o) : [i, r, s, a] = b2, !i)
  5810. return uh;
  5811. Array.isArray(r) || (r = [r]), Array.isArray(s) || (s = [s]);
  5812. const c = [], u = () => {
  5813. c.forEach((w) => w()), c.length = 0;
  5814. }, h2 = (w, _, y2, C) => (w.addEventListener(_, y2, C), () => w.removeEventListener(_, y2, C)), d = watch(() => [fh(i), nl(a)], ([w, _]) => {
  5815. u(), w && c.push(...r.flatMap((y2) => s.map((C) => h2(w, y2, C, _))));
  5816. }, { immediate: true, flush: "post" }), g = () => {
  5817. d(), u();
  5818. };
  5819. return dh(g), g;
  5820. }
  5821. var _a2 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  5822. var wa = "__vueuse_ssr_handlers__";
  5823. _a2[wa] = _a2[wa] || {};
  5824. function vh(b2 = {}) {
  5825. const {
  5826. type: i = "page",
  5827. touch: r = true,
  5828. resetOnTouchEnds: s = false,
  5829. initialValue: a = { x: 0, y: 0 },
  5830. window: c = _o,
  5831. eventFilter: u
  5832. } = b2, h2 = ref(a.x), d = ref(a.y), g = ref(null), w = (S2) => {
  5833. i === "page" ? (h2.value = S2.pageX, d.value = S2.pageY) : i === "client" ? (h2.value = S2.clientX, d.value = S2.clientY) : i === "movement" && (h2.value = S2.movementX, d.value = S2.movementY), g.value = "mouse";
  5834. }, _ = () => {
  5835. h2.value = a.x, d.value = a.y;
  5836. }, y2 = (S2) => {
  5837. if (S2.touches.length > 0) {
  5838. const R2 = S2.touches[0];
  5839. i === "page" ? (h2.value = R2.pageX, d.value = R2.pageY) : i === "client" && (h2.value = R2.clientX, d.value = R2.clientY), g.value = "touch";
  5840. }
  5841. }, C = (S2) => u === void 0 ? w(S2) : u(() => w(S2), {}), I2 = (S2) => u === void 0 ? y2(S2) : u(() => y2(S2), {});
  5842. return c && (Vn(c, "mousemove", C, { passive: true }), Vn(c, "dragover", C, { passive: true }), r && i !== "movement" && (Vn(c, "touchstart", I2, { passive: true }), Vn(c, "touchmove", I2, { passive: true }), s && Vn(c, "touchend", _, { passive: true }))), {
  5843. x: h2,
  5844. y: d,
  5845. sourceType: g
  5846. };
  5847. }
  5848. var ya;
  5849. (function(b2) {
  5850. b2.UP = "UP", b2.RIGHT = "RIGHT", b2.DOWN = "DOWN", b2.LEFT = "LEFT", b2.NONE = "NONE";
  5851. })(ya || (ya = {}));
  5852. var bh = Object.defineProperty;
  5853. var xa = Object.getOwnPropertySymbols;
  5854. var gh = Object.prototype.hasOwnProperty;
  5855. var _h = Object.prototype.propertyIsEnumerable;
  5856. var Ea = (b2, i, r) => i in b2 ? bh(b2, i, { enumerable: true, configurable: true, writable: true, value: r }) : b2[i] = r;
  5857. var wh = (b2, i) => {
  5858. for (var r in i || (i = {}))
  5859. gh.call(i, r) && Ea(b2, r, i[r]);
  5860. if (xa)
  5861. for (var r of xa(i))
  5862. _h.call(i, r) && Ea(b2, r, i[r]);
  5863. return b2;
  5864. };
  5865. var yh = {
  5866. easeInSine: [0.12, 0, 0.39, 0],
  5867. easeOutSine: [0.61, 1, 0.88, 1],
  5868. easeInOutSine: [0.37, 0, 0.63, 1],
  5869. easeInQuad: [0.11, 0, 0.5, 0],
  5870. easeOutQuad: [0.5, 1, 0.89, 1],
  5871. easeInOutQuad: [0.45, 0, 0.55, 1],
  5872. easeInCubic: [0.32, 0, 0.67, 0],
  5873. easeOutCubic: [0.33, 1, 0.68, 1],
  5874. easeInOutCubic: [0.65, 0, 0.35, 1],
  5875. easeInQuart: [0.5, 0, 0.75, 0],
  5876. easeOutQuart: [0.25, 1, 0.5, 1],
  5877. easeInOutQuart: [0.76, 0, 0.24, 1],
  5878. easeInQuint: [0.64, 0, 0.78, 0],
  5879. easeOutQuint: [0.22, 1, 0.36, 1],
  5880. easeInOutQuint: [0.83, 0, 0.17, 1],
  5881. easeInExpo: [0.7, 0, 0.84, 0],
  5882. easeOutExpo: [0.16, 1, 0.3, 1],
  5883. easeInOutExpo: [0.87, 0, 0.13, 1],
  5884. easeInCirc: [0.55, 0, 1, 0.45],
  5885. easeOutCirc: [0, 0.55, 0.45, 1],
  5886. easeInOutCirc: [0.85, 0, 0.15, 1],
  5887. easeInBack: [0.36, 0, 0.66, -0.56],
  5888. easeOutBack: [0.34, 1.56, 0.64, 1],
  5889. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  5890. };
  5891. wh({
  5892. linear: hh
  5893. }, yh);
  5894. function xh(b2 = {}) {
  5895. const {
  5896. window: i = _o,
  5897. initialWidth: r = 1 / 0,
  5898. initialHeight: s = 1 / 0,
  5899. listenOrientation: a = true,
  5900. includeScrollbar: c = true
  5901. } = b2, u = ref(r), h2 = ref(s), d = () => {
  5902. i && (c ? (u.value = i.innerWidth, h2.value = i.innerHeight) : (u.value = i.document.documentElement.clientWidth, h2.value = i.document.documentElement.clientHeight));
  5903. };
  5904. return d(), mh(d), Vn("resize", d, { passive: true }), a && Vn("orientationchange", d, { passive: true }), { width: u, height: h2 };
  5905. }
  5906. function Eh(b2 = false, i = 5, r) {
  5907. const { x: s, y: a } = vh(), { logWarning: c } = j(), { width: u, height: h2 } = xh(), d = computed(() => (s.value / u.value - 0.5) * i), g = computed(() => -(a.value / h2.value - 0.5) * i);
  5908. if (r) {
  5909. const { x: w, y: _ } = r.position;
  5910. watchEffect(() => {
  5911. b2 || r && (r.position.x = w + d.value, r.position.y = _ + g.value);
  5912. });
  5913. } else
  5914. c("Scene must contain a Camera component to use this composable");
  5915. }
  5916. var dd = defineComponent({
  5917. name: "PamCameraMouse",
  5918. props: ["disabled", "factor"],
  5919. setup(b2) {
  5920. const { state: i } = Fn();
  5921. return watchEffect(() => {
  5922. if (i != null && i.camera) {
  5923. const r = i == null ? void 0 : i.camera;
  5924. Eh(b2.disabled, b2.factor, r);
  5925. }
  5926. }), () => {
  5927. };
  5928. }
  5929. });
  5930. var js = {};
  5931. var Ch = {
  5932. get exports() {
  5933. return js;
  5934. },
  5935. set exports(b2) {
  5936. js = b2;
  5937. }
  5938. };
  5939. (function(b2, i) {
  5940. (function(r, s) {
  5941. s(i);
  5942. })(el, function(r) {
  5943. class s {
  5944. /**
  5945. * @hidden
  5946. */
  5947. constructor(e) {
  5948. const [t, l] = e.split("-"), v = t.split(".");
  5949. this.major = parseInt(v[0], 10), this.minor = parseInt(v[1], 10), this.patch = parseInt(v[2], 10), this.prerelease = l ?? null;
  5950. }
  5951. toString() {
  5952. const e = [this.major, this.minor, this.patch].join(".");
  5953. return this.prerelease !== null ? [e, this.prerelease].join("-") : e;
  5954. }
  5955. }
  5956. class a {
  5957. constructor(e) {
  5958. this.controller_ = e;
  5959. }
  5960. get element() {
  5961. return this.controller_.view.element;
  5962. }
  5963. get disabled() {
  5964. return this.controller_.viewProps.get("disabled");
  5965. }
  5966. set disabled(e) {
  5967. this.controller_.viewProps.set("disabled", e);
  5968. }
  5969. get hidden() {
  5970. return this.controller_.viewProps.get("hidden");
  5971. }
  5972. set hidden(e) {
  5973. this.controller_.viewProps.set("hidden", e);
  5974. }
  5975. dispose() {
  5976. this.controller_.viewProps.set("disposed", true);
  5977. }
  5978. }
  5979. class c {
  5980. constructor(e) {
  5981. this.target = e;
  5982. }
  5983. }
  5984. class u extends c {
  5985. constructor(e, t, l, v) {
  5986. super(e), this.value = t, this.presetKey = l, this.last = v ?? true;
  5987. }
  5988. }
  5989. class h2 extends c {
  5990. constructor(e, t, l) {
  5991. super(e), this.value = t, this.presetKey = l;
  5992. }
  5993. }
  5994. class d extends c {
  5995. constructor(e, t) {
  5996. super(e), this.expanded = t;
  5997. }
  5998. }
  5999. class g extends c {
  6000. constructor(e, t) {
  6001. super(e), this.index = t;
  6002. }
  6003. }
  6004. function w(n) {
  6005. return n;
  6006. }
  6007. function _(n) {
  6008. return n == null;
  6009. }
  6010. function y2(n, e) {
  6011. if (n.length !== e.length)
  6012. return false;
  6013. for (let t = 0; t < n.length; t++)
  6014. if (n[t] !== e[t])
  6015. return false;
  6016. return true;
  6017. }
  6018. function C(n, e) {
  6019. let t = n;
  6020. do {
  6021. const l = Object.getOwnPropertyDescriptor(t, e);
  6022. if (l && (l.set !== void 0 || l.writable === true))
  6023. return true;
  6024. t = Object.getPrototypeOf(t);
  6025. } while (t !== null);
  6026. return false;
  6027. }
  6028. const I2 = {
  6029. alreadydisposed: () => "View has been already disposed",
  6030. invalidparams: (n) => `Invalid parameters for '${n.name}'`,
  6031. nomatchingcontroller: (n) => `No matching controller for '${n.key}'`,
  6032. nomatchingview: (n) => `No matching view for '${JSON.stringify(n.params)}'`,
  6033. notbindable: () => "Value is not bindable",
  6034. propertynotfound: (n) => `Property '${n.name}' not found`,
  6035. shouldneverhappen: () => "This error should never happen"
  6036. };
  6037. class S2 {
  6038. static alreadyDisposed() {
  6039. return new S2({ type: "alreadydisposed" });
  6040. }
  6041. static notBindable() {
  6042. return new S2({
  6043. type: "notbindable"
  6044. });
  6045. }
  6046. static propertyNotFound(e) {
  6047. return new S2({
  6048. type: "propertynotfound",
  6049. context: {
  6050. name: e
  6051. }
  6052. });
  6053. }
  6054. static shouldNeverHappen() {
  6055. return new S2({ type: "shouldneverhappen" });
  6056. }
  6057. constructor(e) {
  6058. var t;
  6059. this.message = (t = I2[e.type](e.context)) !== null && t !== void 0 ? t : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = e.type;
  6060. }
  6061. }
  6062. class R2 {
  6063. constructor(e, t, l) {
  6064. this.obj_ = e, this.key_ = t, this.presetKey_ = l ?? t;
  6065. }
  6066. static isBindable(e) {
  6067. return !(e === null || typeof e != "object");
  6068. }
  6069. get key() {
  6070. return this.key_;
  6071. }
  6072. get presetKey() {
  6073. return this.presetKey_;
  6074. }
  6075. read() {
  6076. return this.obj_[this.key_];
  6077. }
  6078. write(e) {
  6079. this.obj_[this.key_] = e;
  6080. }
  6081. writeProperty(e, t) {
  6082. const l = this.read();
  6083. if (!R2.isBindable(l))
  6084. throw S2.notBindable();
  6085. if (!(e in l))
  6086. throw S2.propertyNotFound(e);
  6087. l[e] = t;
  6088. }
  6089. }
  6090. class j2 extends a {
  6091. get label() {
  6092. return this.controller_.props.get("label");
  6093. }
  6094. set label(e) {
  6095. this.controller_.props.set("label", e);
  6096. }
  6097. get title() {
  6098. var e;
  6099. return (e = this.controller_.valueController.props.get("title")) !== null && e !== void 0 ? e : "";
  6100. }
  6101. set title(e) {
  6102. this.controller_.valueController.props.set("title", e);
  6103. }
  6104. on(e, t) {
  6105. const l = t.bind(this);
  6106. return this.controller_.valueController.emitter.on(e, () => {
  6107. l(new c(this));
  6108. }), this;
  6109. }
  6110. }
  6111. class F {
  6112. constructor() {
  6113. this.observers_ = {};
  6114. }
  6115. on(e, t) {
  6116. let l = this.observers_[e];
  6117. return l || (l = this.observers_[e] = []), l.push({
  6118. handler: t
  6119. }), this;
  6120. }
  6121. off(e, t) {
  6122. const l = this.observers_[e];
  6123. return l && (this.observers_[e] = l.filter((v) => v.handler !== t)), this;
  6124. }
  6125. emit(e, t) {
  6126. const l = this.observers_[e];
  6127. l && l.forEach((v) => {
  6128. v.handler(t);
  6129. });
  6130. }
  6131. }
  6132. const V2 = "tp";
  6133. function D(n) {
  6134. return (t, l) => [
  6135. V2,
  6136. "-",
  6137. n,
  6138. "v",
  6139. t ? `_${t}` : "",
  6140. l ? `-${l}` : ""
  6141. ].join("");
  6142. }
  6143. function Y(n, e) {
  6144. return (t) => e(n(t));
  6145. }
  6146. function G2(n) {
  6147. return n.rawValue;
  6148. }
  6149. function N(n, e) {
  6150. n.emitter.on("change", Y(G2, e)), e(n.rawValue);
  6151. }
  6152. function O(n, e, t) {
  6153. N(n.value(e), t);
  6154. }
  6155. function H2(n, e, t) {
  6156. t ? n.classList.add(e) : n.classList.remove(e);
  6157. }
  6158. function K(n, e) {
  6159. return (t) => {
  6160. H2(n, e, t);
  6161. };
  6162. }
  6163. function q(n, e) {
  6164. N(n, (t) => {
  6165. e.textContent = t ?? "";
  6166. });
  6167. }
  6168. const ue2 = D("btn");
  6169. class ge {
  6170. constructor(e, t) {
  6171. this.element = e.createElement("div"), this.element.classList.add(ue2()), t.viewProps.bindClassModifiers(this.element);
  6172. const l = e.createElement("button");
  6173. l.classList.add(ue2("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  6174. const v = e.createElement("div");
  6175. v.classList.add(ue2("t")), q(t.props.value("title"), v), this.buttonElement.appendChild(v);
  6176. }
  6177. }
  6178. class ce2 {
  6179. constructor(e, t) {
  6180. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new ge(e, {
  6181. props: this.props,
  6182. viewProps: this.viewProps
  6183. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  6184. }
  6185. onClick_() {
  6186. this.emitter.emit("click", {
  6187. sender: this
  6188. });
  6189. }
  6190. }
  6191. class me2 {
  6192. constructor(e, t) {
  6193. var l;
  6194. this.constraint_ = t == null ? void 0 : t.constraint, this.equals_ = (l = t == null ? void 0 : t.equals) !== null && l !== void 0 ? l : (v, E) => v === E, this.emitter = new F(), this.rawValue_ = e;
  6195. }
  6196. get constraint() {
  6197. return this.constraint_;
  6198. }
  6199. get rawValue() {
  6200. return this.rawValue_;
  6201. }
  6202. set rawValue(e) {
  6203. this.setRawValue(e, {
  6204. forceEmit: false,
  6205. last: true
  6206. });
  6207. }
  6208. setRawValue(e, t) {
  6209. const l = t ?? {
  6210. forceEmit: false,
  6211. last: true
  6212. }, v = this.constraint_ ? this.constraint_.constrain(e) : e, E = this.rawValue_;
  6213. this.equals_(E, v) && !l.forceEmit || (this.emitter.emit("beforechange", {
  6214. sender: this
  6215. }), this.rawValue_ = v, this.emitter.emit("change", {
  6216. options: l,
  6217. previousRawValue: E,
  6218. rawValue: v,
  6219. sender: this
  6220. }));
  6221. }
  6222. }
  6223. class he {
  6224. constructor(e) {
  6225. this.emitter = new F(), this.value_ = e;
  6226. }
  6227. get rawValue() {
  6228. return this.value_;
  6229. }
  6230. set rawValue(e) {
  6231. this.setRawValue(e, {
  6232. forceEmit: false,
  6233. last: true
  6234. });
  6235. }
  6236. setRawValue(e, t) {
  6237. const l = t ?? {
  6238. forceEmit: false,
  6239. last: true
  6240. }, v = this.value_;
  6241. v === e && !l.forceEmit || (this.emitter.emit("beforechange", {
  6242. sender: this
  6243. }), this.value_ = e, this.emitter.emit("change", {
  6244. options: l,
  6245. previousRawValue: v,
  6246. rawValue: this.value_,
  6247. sender: this
  6248. }));
  6249. }
  6250. }
  6251. function ee2(n, e) {
  6252. const t = e == null ? void 0 : e.constraint, l = e == null ? void 0 : e.equals;
  6253. return !t && !l ? new he(n) : new me2(n, e);
  6254. }
  6255. class X {
  6256. constructor(e) {
  6257. this.emitter = new F(), this.valMap_ = e;
  6258. for (const t in this.valMap_)
  6259. this.valMap_[t].emitter.on("change", () => {
  6260. this.emitter.emit("change", {
  6261. key: t,
  6262. sender: this
  6263. });
  6264. });
  6265. }
  6266. static createCore(e) {
  6267. return Object.keys(e).reduce((l, v) => Object.assign(l, {
  6268. [v]: ee2(e[v])
  6269. }), {});
  6270. }
  6271. static fromObject(e) {
  6272. const t = this.createCore(e);
  6273. return new X(t);
  6274. }
  6275. get(e) {
  6276. return this.valMap_[e].rawValue;
  6277. }
  6278. set(e, t) {
  6279. this.valMap_[e].rawValue = t;
  6280. }
  6281. value(e) {
  6282. return this.valMap_[e];
  6283. }
  6284. }
  6285. function Pe(n, e) {
  6286. const l = Object.keys(e).reduce((v, E) => {
  6287. if (v === void 0)
  6288. return;
  6289. const k2 = e[E], B2 = k2(n[E]);
  6290. return B2.succeeded ? Object.assign(Object.assign({}, v), { [E]: B2.value }) : void 0;
  6291. }, {});
  6292. return l;
  6293. }
  6294. function fe2(n, e) {
  6295. return n.reduce((t, l) => {
  6296. if (t === void 0)
  6297. return;
  6298. const v = e(l);
  6299. if (!(!v.succeeded || v.value === void 0))
  6300. return [...t, v.value];
  6301. }, []);
  6302. }
  6303. function ae(n) {
  6304. return n === null ? false : typeof n == "object";
  6305. }
  6306. function ne(n) {
  6307. return (e) => (t) => {
  6308. if (!e && t === void 0)
  6309. return {
  6310. succeeded: false,
  6311. value: void 0
  6312. };
  6313. if (e && t === void 0)
  6314. return {
  6315. succeeded: true,
  6316. value: void 0
  6317. };
  6318. const l = n(t);
  6319. return l !== void 0 ? {
  6320. succeeded: true,
  6321. value: l
  6322. } : {
  6323. succeeded: false,
  6324. value: void 0
  6325. };
  6326. };
  6327. }
  6328. function be(n) {
  6329. return {
  6330. custom: (e) => ne(e)(n),
  6331. boolean: ne((e) => typeof e == "boolean" ? e : void 0)(n),
  6332. number: ne((e) => typeof e == "number" ? e : void 0)(n),
  6333. string: ne((e) => typeof e == "string" ? e : void 0)(n),
  6334. function: ne((e) => typeof e == "function" ? e : void 0)(n),
  6335. constant: (e) => ne((t) => t === e ? e : void 0)(n),
  6336. raw: ne((e) => e)(n),
  6337. object: (e) => ne((t) => {
  6338. if (ae(t))
  6339. return Pe(t, e);
  6340. })(n),
  6341. array: (e) => ne((t) => {
  6342. if (Array.isArray(t))
  6343. return fe2(t, e);
  6344. })(n)
  6345. };
  6346. }
  6347. const M = {
  6348. optional: be(true),
  6349. required: be(false)
  6350. };
  6351. function le2(n, e) {
  6352. const t = M.required.object(e)(n);
  6353. return t.succeeded ? t.value : void 0;
  6354. }
  6355. function Ve(n) {
  6356. console.warn([
  6357. `Missing '${n.key}' of ${n.target} in ${n.place}.`,
  6358. "Please rebuild plugins with the latest core package."
  6359. ].join(" "));
  6360. }
  6361. function Ne2(n) {
  6362. return n && n.parentElement && n.parentElement.removeChild(n), null;
  6363. }
  6364. class we {
  6365. constructor(e) {
  6366. this.value_ = e;
  6367. }
  6368. static create(e) {
  6369. return [
  6370. new we(e),
  6371. (t, l) => {
  6372. e.setRawValue(t, l);
  6373. }
  6374. ];
  6375. }
  6376. get emitter() {
  6377. return this.value_.emitter;
  6378. }
  6379. get rawValue() {
  6380. return this.value_.rawValue;
  6381. }
  6382. }
  6383. const it2 = D("");
  6384. function Bn(n, e) {
  6385. return K(n, it2(void 0, e));
  6386. }
  6387. class Xe2 extends X {
  6388. constructor(e) {
  6389. var t;
  6390. super(e), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = we.create(ee2(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (t = this.get("parent")) === null || t === void 0 || t.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  6391. }
  6392. static create(e) {
  6393. var t, l, v;
  6394. const E = e ?? {};
  6395. return new Xe2(X.createCore({
  6396. disabled: (t = E.disabled) !== null && t !== void 0 ? t : false,
  6397. disposed: false,
  6398. hidden: (l = E.hidden) !== null && l !== void 0 ? l : false,
  6399. parent: (v = E.parent) !== null && v !== void 0 ? v : null
  6400. }));
  6401. }
  6402. get globalDisabled() {
  6403. return this.globalDisabled_;
  6404. }
  6405. bindClassModifiers(e) {
  6406. N(this.globalDisabled_, Bn(e, "disabled")), O(this, "hidden", Bn(e, "hidden"));
  6407. }
  6408. bindDisabled(e) {
  6409. N(this.globalDisabled_, (t) => {
  6410. e.disabled = t;
  6411. });
  6412. }
  6413. bindTabIndex(e) {
  6414. N(this.globalDisabled_, (t) => {
  6415. e.tabIndex = t ? -1 : 0;
  6416. });
  6417. }
  6418. handleDispose(e) {
  6419. this.value("disposed").emitter.on("change", (t) => {
  6420. t && e();
  6421. });
  6422. }
  6423. getGlobalDisabled_() {
  6424. const e = this.get("parent");
  6425. return (e ? e.globalDisabled.rawValue : false) || this.get("disabled");
  6426. }
  6427. updateGlobalDisabled_() {
  6428. this.setGlobalDisabled_(this.getGlobalDisabled_());
  6429. }
  6430. onDisabledChange_() {
  6431. this.updateGlobalDisabled_();
  6432. }
  6433. onParentGlobalDisabledChange_() {
  6434. this.updateGlobalDisabled_();
  6435. }
  6436. onParentChange_(e) {
  6437. var t;
  6438. const l = e.previousRawValue;
  6439. 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_();
  6440. }
  6441. }
  6442. function jn() {
  6443. return ["veryfirst", "first", "last", "verylast"];
  6444. }
  6445. const an = D(""), dt2 = {
  6446. veryfirst: "vfst",
  6447. first: "fst",
  6448. last: "lst",
  6449. verylast: "vlst"
  6450. };
  6451. class Mt {
  6452. constructor(e) {
  6453. this.parent_ = null, this.blade = e.blade, this.view = e.view, this.viewProps = e.viewProps;
  6454. const t = this.view.element;
  6455. this.blade.value("positions").emitter.on("change", () => {
  6456. jn().forEach((l) => {
  6457. t.classList.remove(an(void 0, dt2[l]));
  6458. }), this.blade.get("positions").forEach((l) => {
  6459. t.classList.add(an(void 0, dt2[l]));
  6460. });
  6461. }), this.viewProps.handleDispose(() => {
  6462. Ne2(t);
  6463. });
  6464. }
  6465. get parent() {
  6466. return this.parent_;
  6467. }
  6468. set parent(e) {
  6469. if (this.parent_ = e, !("parent" in this.viewProps.valMap_)) {
  6470. Ve({
  6471. key: "parent",
  6472. target: Xe2.name,
  6473. place: "BladeController.parent"
  6474. });
  6475. return;
  6476. }
  6477. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  6478. }
  6479. }
  6480. const ze = "http://www.w3.org/2000/svg";
  6481. function st2(n) {
  6482. n.offsetHeight;
  6483. }
  6484. function ln(n, e) {
  6485. const t = n.style.transition;
  6486. n.style.transition = "none", e(), n.style.transition = t;
  6487. }
  6488. function mt(n) {
  6489. return n.ontouchstart !== void 0;
  6490. }
  6491. function zn() {
  6492. return globalThis;
  6493. }
  6494. function hi() {
  6495. return zn().document;
  6496. }
  6497. function Un(n) {
  6498. const e = n.ownerDocument.defaultView;
  6499. return e && "document" in e ? n.getContext("2d", {
  6500. willReadFrequently: true
  6501. }) : null;
  6502. }
  6503. const Gn = {
  6504. check: '<path d="M2 8l4 4l8 -8"/>',
  6505. dropdown: '<path d="M5 7h6l-3 3 z"/>',
  6506. p2dpad: '<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'
  6507. };
  6508. function yt(n, e) {
  6509. const t = n.createElementNS(ze, "svg");
  6510. return t.innerHTML = Gn[e], t;
  6511. }
  6512. function St(n, e, t) {
  6513. n.insertBefore(e, n.children[t]);
  6514. }
  6515. function Hn(n) {
  6516. n.parentElement && n.parentElement.removeChild(n);
  6517. }
  6518. function cn(n) {
  6519. for (; n.children.length > 0; )
  6520. n.removeChild(n.children[0]);
  6521. }
  6522. function Kn(n) {
  6523. for (; n.childNodes.length > 0; )
  6524. n.removeChild(n.childNodes[0]);
  6525. }
  6526. function xt(n) {
  6527. return n.relatedTarget ? n.relatedTarget : "explicitOriginalTarget" in n ? n.explicitOriginalTarget : null;
  6528. }
  6529. const ft = D("lbl");
  6530. function At(n, e) {
  6531. const t = n.createDocumentFragment();
  6532. return e.split(`
  6533. `).map((v) => n.createTextNode(v)).forEach((v, E) => {
  6534. E > 0 && t.appendChild(n.createElement("br")), t.appendChild(v);
  6535. }), t;
  6536. }
  6537. class A2 {
  6538. constructor(e, t) {
  6539. this.element = e.createElement("div"), this.element.classList.add(ft()), t.viewProps.bindClassModifiers(this.element);
  6540. const l = e.createElement("div");
  6541. l.classList.add(ft("l")), O(t.props, "label", (E) => {
  6542. _(E) ? this.element.classList.add(ft(void 0, "nol")) : (this.element.classList.remove(ft(void 0, "nol")), Kn(l), l.appendChild(At(e, E)));
  6543. }), this.element.appendChild(l), this.labelElement = l;
  6544. const v = e.createElement("div");
  6545. v.classList.add(ft("v")), this.element.appendChild(v), this.valueElement = v;
  6546. }
  6547. }
  6548. class U extends Mt {
  6549. constructor(e, t) {
  6550. const l = t.valueController.viewProps;
  6551. super(Object.assign(Object.assign({}, t), { view: new A2(e, {
  6552. props: t.props,
  6553. viewProps: l
  6554. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  6555. }
  6556. }
  6557. const W = {
  6558. id: "button",
  6559. type: "blade",
  6560. accept(n) {
  6561. const e = M, t = le2(n, {
  6562. title: e.required.string,
  6563. view: e.required.constant("button"),
  6564. label: e.optional.string
  6565. });
  6566. return t ? { params: t } : null;
  6567. },
  6568. controller(n) {
  6569. return new U(n.document, {
  6570. blade: n.blade,
  6571. props: X.fromObject({
  6572. label: n.params.label
  6573. }),
  6574. valueController: new ce2(n.document, {
  6575. props: X.fromObject({
  6576. title: n.params.title
  6577. }),
  6578. viewProps: n.viewProps
  6579. })
  6580. });
  6581. },
  6582. api(n) {
  6583. return !(n.controller instanceof U) || !(n.controller.valueController instanceof ce2) ? null : new j2(n.controller);
  6584. }
  6585. };
  6586. class ie extends Mt {
  6587. constructor(e) {
  6588. super(e), this.value = e.value;
  6589. }
  6590. }
  6591. function ye() {
  6592. return new X({
  6593. positions: ee2([], {
  6594. equals: y2
  6595. })
  6596. });
  6597. }
  6598. class De extends X {
  6599. constructor(e) {
  6600. super(e);
  6601. }
  6602. static create(e) {
  6603. const t = {
  6604. completed: true,
  6605. expanded: e,
  6606. expandedHeight: null,
  6607. shouldFixHeight: false,
  6608. temporaryExpanded: null
  6609. }, l = X.createCore(t);
  6610. return new De(l);
  6611. }
  6612. get styleExpanded() {
  6613. var e;
  6614. return (e = this.get("temporaryExpanded")) !== null && e !== void 0 ? e : this.get("expanded");
  6615. }
  6616. get styleHeight() {
  6617. if (!this.styleExpanded)
  6618. return "0";
  6619. const e = this.get("expandedHeight");
  6620. return this.get("shouldFixHeight") && !_(e) ? `${e}px` : "auto";
  6621. }
  6622. bindExpandedClass(e, t) {
  6623. const l = () => {
  6624. this.styleExpanded ? e.classList.add(t) : e.classList.remove(t);
  6625. };
  6626. O(this, "expanded", l), O(this, "temporaryExpanded", l);
  6627. }
  6628. cleanUpTransition() {
  6629. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  6630. }
  6631. }
  6632. function Ut(n, e) {
  6633. let t = 0;
  6634. return ln(e, () => {
  6635. n.set("expandedHeight", null), n.set("temporaryExpanded", true), st2(e), t = e.clientHeight, n.set("temporaryExpanded", null), st2(e);
  6636. }), t;
  6637. }
  6638. function pn(n, e) {
  6639. e.style.height = n.styleHeight;
  6640. }
  6641. function Ue(n, e) {
  6642. n.value("expanded").emitter.on("beforechange", () => {
  6643. if (n.set("completed", false), _(n.get("expandedHeight"))) {
  6644. const t = Ut(n, e);
  6645. t > 0 && n.set("expandedHeight", t);
  6646. }
  6647. n.set("shouldFixHeight", true), st2(e);
  6648. }), n.emitter.on("change", () => {
  6649. pn(n, e);
  6650. }), pn(n, e), e.addEventListener("transitionend", (t) => {
  6651. t.propertyName === "height" && n.cleanUpTransition();
  6652. });
  6653. }
  6654. class Ge extends a {
  6655. constructor(e, t) {
  6656. super(e), this.rackApi_ = t;
  6657. }
  6658. }
  6659. function Gs(n, e) {
  6660. return n.addBlade(Object.assign(Object.assign({}, e), { view: "button" }));
  6661. }
  6662. function Hs(n, e) {
  6663. return n.addBlade(Object.assign(Object.assign({}, e), { view: "folder" }));
  6664. }
  6665. function Ks(n, e) {
  6666. const t = e ?? {};
  6667. return n.addBlade(Object.assign(Object.assign({}, t), { view: "separator" }));
  6668. }
  6669. function di(n, e) {
  6670. return n.addBlade(Object.assign(Object.assign({}, e), { view: "tab" }));
  6671. }
  6672. class Lt {
  6673. constructor(e) {
  6674. 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;
  6675. }
  6676. get items() {
  6677. return this.items_;
  6678. }
  6679. allItems() {
  6680. return Array.from(this.cache_);
  6681. }
  6682. find(e) {
  6683. for (const t of this.allItems())
  6684. if (e(t))
  6685. return t;
  6686. return null;
  6687. }
  6688. includes(e) {
  6689. return this.cache_.has(e);
  6690. }
  6691. add(e, t) {
  6692. if (this.includes(e))
  6693. throw S2.shouldNeverHappen();
  6694. const l = t !== void 0 ? t : this.items_.length;
  6695. this.items_.splice(l, 0, e), this.cache_.add(e);
  6696. const v = this.extract_(e);
  6697. v && (v.emitter.on("add", this.onSubListAdd_), v.emitter.on("remove", this.onSubListRemove_), v.allItems().forEach((E) => {
  6698. this.cache_.add(E);
  6699. })), this.emitter.emit("add", {
  6700. index: l,
  6701. item: e,
  6702. root: this,
  6703. target: this
  6704. });
  6705. }
  6706. remove(e) {
  6707. const t = this.items_.indexOf(e);
  6708. if (t < 0)
  6709. return;
  6710. this.items_.splice(t, 1), this.cache_.delete(e);
  6711. const l = this.extract_(e);
  6712. l && (l.emitter.off("add", this.onSubListAdd_), l.emitter.off("remove", this.onSubListRemove_)), this.emitter.emit("remove", {
  6713. index: t,
  6714. item: e,
  6715. root: this,
  6716. target: this
  6717. });
  6718. }
  6719. onSubListAdd_(e) {
  6720. this.cache_.add(e.item), this.emitter.emit("add", {
  6721. index: e.index,
  6722. item: e.item,
  6723. root: this,
  6724. target: e.target
  6725. });
  6726. }
  6727. onSubListRemove_(e) {
  6728. this.cache_.delete(e.item), this.emitter.emit("remove", {
  6729. index: e.index,
  6730. item: e.item,
  6731. root: this,
  6732. target: e.target
  6733. });
  6734. }
  6735. }
  6736. class mi extends a {
  6737. constructor(e) {
  6738. super(e), this.onBindingChange_ = this.onBindingChange_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("change", this.onBindingChange_);
  6739. }
  6740. get label() {
  6741. return this.controller_.props.get("label");
  6742. }
  6743. set label(e) {
  6744. this.controller_.props.set("label", e);
  6745. }
  6746. on(e, t) {
  6747. const l = t.bind(this);
  6748. return this.emitter_.on(e, (v) => {
  6749. l(v.event);
  6750. }), this;
  6751. }
  6752. refresh() {
  6753. this.controller_.binding.read();
  6754. }
  6755. onBindingChange_(e) {
  6756. const t = e.sender.target.read();
  6757. this.emitter_.emit("change", {
  6758. event: new u(this, t, this.controller_.binding.target.presetKey, e.options.last)
  6759. });
  6760. }
  6761. }
  6762. class Fe extends U {
  6763. constructor(e, t) {
  6764. super(e, t), this.binding = t.binding;
  6765. }
  6766. }
  6767. class fi extends a {
  6768. constructor(e) {
  6769. super(e), this.onBindingUpdate_ = this.onBindingUpdate_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("update", this.onBindingUpdate_);
  6770. }
  6771. get label() {
  6772. return this.controller_.props.get("label");
  6773. }
  6774. set label(e) {
  6775. this.controller_.props.set("label", e);
  6776. }
  6777. on(e, t) {
  6778. const l = t.bind(this);
  6779. return this.emitter_.on(e, (v) => {
  6780. l(v.event);
  6781. }), this;
  6782. }
  6783. refresh() {
  6784. this.controller_.binding.read();
  6785. }
  6786. onBindingUpdate_(e) {
  6787. const t = e.sender.target.read();
  6788. this.emitter_.emit("update", {
  6789. event: new h2(this, t, this.controller_.binding.target.presetKey)
  6790. });
  6791. }
  6792. }
  6793. class rt2 extends U {
  6794. constructor(e, t) {
  6795. super(e, t), this.binding = t.binding, this.viewProps.bindDisabled(this.binding.ticker), this.viewProps.handleDispose(() => {
  6796. this.binding.dispose();
  6797. });
  6798. }
  6799. }
  6800. function ts(n) {
  6801. return n instanceof $n ? n.apiSet_ : n instanceof Ge ? n.rackApi_.apiSet_ : null;
  6802. }
  6803. function un(n, e) {
  6804. const t = n.find((l) => l.controller_ === e);
  6805. if (!t)
  6806. throw S2.shouldNeverHappen();
  6807. return t;
  6808. }
  6809. function ns(n, e, t) {
  6810. if (!R2.isBindable(n))
  6811. throw S2.notBindable();
  6812. return new R2(n, e, t);
  6813. }
  6814. class $n extends a {
  6815. constructor(e, t) {
  6816. 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 Lt(ts), this.pool_ = t;
  6817. const l = this.controller_.rack;
  6818. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), l.emitter.on("inputchange", this.onRackInputChange_), l.emitter.on("monitorupdate", this.onRackMonitorUpdate_), l.children.forEach((v) => {
  6819. this.setUpApi_(v);
  6820. });
  6821. }
  6822. get children() {
  6823. return this.controller_.rack.children.map((e) => un(this.apiSet_, e));
  6824. }
  6825. addInput(e, t, l) {
  6826. const v = l ?? {}, E = this.controller_.view.element.ownerDocument, k2 = this.pool_.createInput(E, ns(e, t, v.presetKey), v), B2 = new mi(k2);
  6827. return this.add(B2, v.index);
  6828. }
  6829. addMonitor(e, t, l) {
  6830. const v = l ?? {}, E = this.controller_.view.element.ownerDocument, k2 = this.pool_.createMonitor(E, ns(e, t), v), B2 = new fi(k2);
  6831. return this.add(B2, v.index);
  6832. }
  6833. addFolder(e) {
  6834. return Hs(this, e);
  6835. }
  6836. addButton(e) {
  6837. return Gs(this, e);
  6838. }
  6839. addSeparator(e) {
  6840. return Ks(this, e);
  6841. }
  6842. addTab(e) {
  6843. return di(this, e);
  6844. }
  6845. add(e, t) {
  6846. this.controller_.rack.add(e.controller_, t);
  6847. const l = this.apiSet_.find((v) => v.controller_ === e.controller_);
  6848. return l && this.apiSet_.remove(l), this.apiSet_.add(e), e;
  6849. }
  6850. remove(e) {
  6851. this.controller_.rack.remove(e.controller_);
  6852. }
  6853. addBlade(e) {
  6854. const t = this.controller_.view.element.ownerDocument, l = this.pool_.createBlade(t, e), v = this.pool_.createBladeApi(l);
  6855. return this.add(v, e.index);
  6856. }
  6857. on(e, t) {
  6858. const l = t.bind(this);
  6859. return this.emitter_.on(e, (v) => {
  6860. l(v.event);
  6861. }), this;
  6862. }
  6863. setUpApi_(e) {
  6864. this.apiSet_.find((l) => l.controller_ === e) || this.apiSet_.add(this.pool_.createBladeApi(e));
  6865. }
  6866. onRackAdd_(e) {
  6867. this.setUpApi_(e.bladeController);
  6868. }
  6869. onRackRemove_(e) {
  6870. if (e.isRoot) {
  6871. const t = un(this.apiSet_, e.bladeController);
  6872. this.apiSet_.remove(t);
  6873. }
  6874. }
  6875. onRackInputChange_(e) {
  6876. const t = e.bladeController;
  6877. if (t instanceof Fe) {
  6878. const l = un(this.apiSet_, t), v = t.binding;
  6879. this.emitter_.emit("change", {
  6880. event: new u(l, v.target.read(), v.target.presetKey, e.options.last)
  6881. });
  6882. } else if (t instanceof ie) {
  6883. const l = un(this.apiSet_, t);
  6884. this.emitter_.emit("change", {
  6885. event: new u(l, t.value.rawValue, void 0, e.options.last)
  6886. });
  6887. }
  6888. }
  6889. onRackMonitorUpdate_(e) {
  6890. if (!(e.bladeController instanceof rt2))
  6891. throw S2.shouldNeverHappen();
  6892. const t = un(this.apiSet_, e.bladeController), l = e.bladeController.binding;
  6893. this.emitter_.emit("update", {
  6894. event: new h2(t, l.target.read(), l.target.presetKey)
  6895. });
  6896. }
  6897. }
  6898. class vi extends Ge {
  6899. constructor(e, t) {
  6900. super(e, new $n(e.rackController, t)), this.emitter_ = new F(), this.controller_.foldable.value("expanded").emitter.on("change", (l) => {
  6901. this.emitter_.emit("fold", {
  6902. event: new d(this, l.sender.rawValue)
  6903. });
  6904. }), this.rackApi_.on("change", (l) => {
  6905. this.emitter_.emit("change", {
  6906. event: l
  6907. });
  6908. }), this.rackApi_.on("update", (l) => {
  6909. this.emitter_.emit("update", {
  6910. event: l
  6911. });
  6912. });
  6913. }
  6914. get expanded() {
  6915. return this.controller_.foldable.get("expanded");
  6916. }
  6917. set expanded(e) {
  6918. this.controller_.foldable.set("expanded", e);
  6919. }
  6920. get title() {
  6921. return this.controller_.props.get("title");
  6922. }
  6923. set title(e) {
  6924. this.controller_.props.set("title", e);
  6925. }
  6926. get children() {
  6927. return this.rackApi_.children;
  6928. }
  6929. addInput(e, t, l) {
  6930. return this.rackApi_.addInput(e, t, l);
  6931. }
  6932. addMonitor(e, t, l) {
  6933. return this.rackApi_.addMonitor(e, t, l);
  6934. }
  6935. addFolder(e) {
  6936. return this.rackApi_.addFolder(e);
  6937. }
  6938. addButton(e) {
  6939. return this.rackApi_.addButton(e);
  6940. }
  6941. addSeparator(e) {
  6942. return this.rackApi_.addSeparator(e);
  6943. }
  6944. addTab(e) {
  6945. return this.rackApi_.addTab(e);
  6946. }
  6947. add(e, t) {
  6948. return this.rackApi_.add(e, t);
  6949. }
  6950. remove(e) {
  6951. this.rackApi_.remove(e);
  6952. }
  6953. addBlade(e) {
  6954. return this.rackApi_.addBlade(e);
  6955. }
  6956. on(e, t) {
  6957. const l = t.bind(this);
  6958. return this.emitter_.on(e, (v) => {
  6959. l(v.event);
  6960. }), this;
  6961. }
  6962. }
  6963. class bi extends Mt {
  6964. constructor(e) {
  6965. super({
  6966. blade: e.blade,
  6967. view: e.view,
  6968. viewProps: e.rackController.viewProps
  6969. }), this.rackController = e.rackController;
  6970. }
  6971. }
  6972. class $s {
  6973. constructor(e, t) {
  6974. const l = D(t.viewName);
  6975. this.element = e.createElement("div"), this.element.classList.add(l()), t.viewProps.bindClassModifiers(this.element);
  6976. }
  6977. }
  6978. function Xs(n, e) {
  6979. for (let t = 0; t < n.length; t++) {
  6980. const l = n[t];
  6981. if (l instanceof Fe && l.binding === e)
  6982. return l;
  6983. }
  6984. return null;
  6985. }
  6986. function Ys(n, e) {
  6987. for (let t = 0; t < n.length; t++) {
  6988. const l = n[t];
  6989. if (l instanceof rt2 && l.binding === e)
  6990. return l;
  6991. }
  6992. return null;
  6993. }
  6994. function qs(n, e) {
  6995. for (let t = 0; t < n.length; t++) {
  6996. const l = n[t];
  6997. if (l instanceof ie && l.value === e)
  6998. return l;
  6999. }
  7000. return null;
  7001. }
  7002. function gi(n) {
  7003. return n instanceof hn ? n.rack : n instanceof bi ? n.rackController.rack : null;
  7004. }
  7005. function Qs(n) {
  7006. const e = gi(n);
  7007. return e ? e.bcSet_ : null;
  7008. }
  7009. class Zs {
  7010. constructor(e) {
  7011. var t, l;
  7012. 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 Lt(Qs), this.bcSet_.emitter.on("add", this.onSetAdd_), this.bcSet_.emitter.on("remove", this.onSetRemove_);
  7013. }
  7014. get children() {
  7015. return this.bcSet_.items;
  7016. }
  7017. add(e, t) {
  7018. var l;
  7019. (l = e.parent) === null || l === void 0 || l.remove(e), C(e, "parent") ? e.parent = this : (e.parent_ = this, Ve({
  7020. key: "parent",
  7021. target: "BladeController",
  7022. place: "BladeRack.add"
  7023. })), this.bcSet_.add(e, t);
  7024. }
  7025. remove(e) {
  7026. C(e, "parent") ? e.parent = null : (e.parent_ = null, Ve({
  7027. key: "parent",
  7028. target: "BladeController",
  7029. place: "BladeRack.remove"
  7030. })), this.bcSet_.remove(e);
  7031. }
  7032. find(e) {
  7033. return this.bcSet_.allItems().filter((t) => t instanceof e);
  7034. }
  7035. onSetAdd_(e) {
  7036. this.updatePositions_();
  7037. const t = e.target === e.root;
  7038. if (this.emitter.emit("add", {
  7039. bladeController: e.item,
  7040. index: e.index,
  7041. isRoot: t,
  7042. sender: this
  7043. }), !t)
  7044. return;
  7045. const l = e.item;
  7046. if (l.viewProps.emitter.on("change", this.onChildViewPropsChange_), l.blade.value("positions").emitter.on("change", this.onChildPositionsChange_), l.viewProps.handleDispose(this.onChildDispose_), l instanceof Fe)
  7047. l.binding.emitter.on("change", this.onChildInputChange_);
  7048. else if (l instanceof rt2)
  7049. l.binding.emitter.on("update", this.onChildMonitorUpdate_);
  7050. else if (l instanceof ie)
  7051. l.value.emitter.on("change", this.onChildValueChange_);
  7052. else {
  7053. const v = gi(l);
  7054. if (v) {
  7055. const E = v.emitter;
  7056. E.on("layout", this.onDescendantLayout_), E.on("inputchange", this.onDescendantInputChange_), E.on("monitorupdate", this.onDescendantMonitorUpdate_);
  7057. }
  7058. }
  7059. }
  7060. onSetRemove_(e) {
  7061. this.updatePositions_();
  7062. const t = e.target === e.root;
  7063. if (this.emitter.emit("remove", {
  7064. bladeController: e.item,
  7065. isRoot: t,
  7066. sender: this
  7067. }), !t)
  7068. return;
  7069. const l = e.item;
  7070. if (l instanceof Fe)
  7071. l.binding.emitter.off("change", this.onChildInputChange_);
  7072. else if (l instanceof rt2)
  7073. l.binding.emitter.off("update", this.onChildMonitorUpdate_);
  7074. else if (l instanceof ie)
  7075. l.value.emitter.off("change", this.onChildValueChange_);
  7076. else {
  7077. const v = gi(l);
  7078. if (v) {
  7079. const E = v.emitter;
  7080. E.off("layout", this.onDescendantLayout_), E.off("inputchange", this.onDescendantInputChange_), E.off("monitorupdate", this.onDescendantMonitorUpdate_);
  7081. }
  7082. }
  7083. }
  7084. updatePositions_() {
  7085. const e = this.bcSet_.items.filter((v) => !v.viewProps.get("hidden")), t = e[0], l = e[e.length - 1];
  7086. this.bcSet_.items.forEach((v) => {
  7087. const E = [];
  7088. v === t && (E.push("first"), (!this.blade_ || this.blade_.get("positions").includes("veryfirst")) && E.push("veryfirst")), v === l && (E.push("last"), (!this.blade_ || this.blade_.get("positions").includes("verylast")) && E.push("verylast")), v.blade.set("positions", E);
  7089. });
  7090. }
  7091. onChildPositionsChange_() {
  7092. this.updatePositions_(), this.emitter.emit("layout", {
  7093. sender: this
  7094. });
  7095. }
  7096. onChildViewPropsChange_(e) {
  7097. this.updatePositions_(), this.emitter.emit("layout", {
  7098. sender: this
  7099. });
  7100. }
  7101. onChildDispose_() {
  7102. this.bcSet_.items.filter((t) => t.viewProps.get("disposed")).forEach((t) => {
  7103. this.bcSet_.remove(t);
  7104. });
  7105. }
  7106. onChildInputChange_(e) {
  7107. const t = Xs(this.find(Fe), e.sender);
  7108. if (!t)
  7109. throw S2.alreadyDisposed();
  7110. this.emitter.emit("inputchange", {
  7111. bladeController: t,
  7112. options: e.options,
  7113. sender: this
  7114. });
  7115. }
  7116. onChildMonitorUpdate_(e) {
  7117. const t = Ys(this.find(rt2), e.sender);
  7118. if (!t)
  7119. throw S2.alreadyDisposed();
  7120. this.emitter.emit("monitorupdate", {
  7121. bladeController: t,
  7122. sender: this
  7123. });
  7124. }
  7125. onChildValueChange_(e) {
  7126. const t = qs(this.find(ie), e.sender);
  7127. if (!t)
  7128. throw S2.alreadyDisposed();
  7129. this.emitter.emit("inputchange", {
  7130. bladeController: t,
  7131. options: e.options,
  7132. sender: this
  7133. });
  7134. }
  7135. onDescendantLayout_(e) {
  7136. this.updatePositions_(), this.emitter.emit("layout", {
  7137. sender: this
  7138. });
  7139. }
  7140. onDescendantInputChange_(e) {
  7141. this.emitter.emit("inputchange", {
  7142. bladeController: e.bladeController,
  7143. options: e.options,
  7144. sender: this
  7145. });
  7146. }
  7147. onDescendantMonitorUpdate_(e) {
  7148. this.emitter.emit("monitorupdate", {
  7149. bladeController: e.bladeController,
  7150. sender: this
  7151. });
  7152. }
  7153. onBladePositionsChange_() {
  7154. this.updatePositions_();
  7155. }
  7156. }
  7157. class hn extends Mt {
  7158. constructor(e, t) {
  7159. super(Object.assign(Object.assign({}, t), { view: new $s(e, {
  7160. viewName: "brk",
  7161. viewProps: t.viewProps
  7162. }) })), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this);
  7163. const l = new Zs({
  7164. blade: t.root ? void 0 : t.blade,
  7165. viewProps: t.viewProps
  7166. });
  7167. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), this.rack = l, this.viewProps.handleDispose(() => {
  7168. for (let v = this.rack.children.length - 1; v >= 0; v--)
  7169. this.rack.children[v].viewProps.set("disposed", true);
  7170. });
  7171. }
  7172. onRackAdd_(e) {
  7173. e.isRoot && St(this.view.element, e.bladeController.view.element, e.index);
  7174. }
  7175. onRackRemove_(e) {
  7176. e.isRoot && Hn(e.bladeController.view.element);
  7177. }
  7178. }
  7179. const is = D("cnt");
  7180. class Ws {
  7181. constructor(e, t) {
  7182. var l;
  7183. this.className_ = D((l = t.viewName) !== null && l !== void 0 ? l : "fld"), this.element = e.createElement("div"), this.element.classList.add(this.className_(), is()), 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")));
  7184. const v = e.createElement("button");
  7185. v.classList.add(this.className_("b")), O(t.props, "title", (J) => {
  7186. _(J) ? this.element.classList.add(this.className_(void 0, "not")) : this.element.classList.remove(this.className_(void 0, "not"));
  7187. }), t.viewProps.bindDisabled(v), this.element.appendChild(v), this.buttonElement = v;
  7188. const E = e.createElement("div");
  7189. E.classList.add(this.className_("i")), this.element.appendChild(E);
  7190. const k2 = e.createElement("div");
  7191. k2.classList.add(this.className_("t")), q(t.props.value("title"), k2), this.buttonElement.appendChild(k2), this.titleElement = k2;
  7192. const B2 = e.createElement("div");
  7193. B2.classList.add(this.className_("m")), this.buttonElement.appendChild(B2);
  7194. const Q = t.containerElement;
  7195. Q.classList.add(this.className_("c")), this.element.appendChild(Q), this.containerElement = Q;
  7196. }
  7197. }
  7198. class Xn extends bi {
  7199. constructor(e, t) {
  7200. var l;
  7201. const v = De.create((l = t.expanded) !== null && l !== void 0 ? l : true), E = new hn(e, {
  7202. blade: t.blade,
  7203. root: t.root,
  7204. viewProps: t.viewProps
  7205. });
  7206. super(Object.assign(Object.assign({}, t), { rackController: E, view: new Ws(e, {
  7207. containerElement: E.view.element,
  7208. foldable: v,
  7209. props: t.props,
  7210. viewName: t.root ? "rot" : void 0,
  7211. viewProps: t.viewProps
  7212. }) })), this.onTitleClick_ = this.onTitleClick_.bind(this), this.props = t.props, this.foldable = v, Ue(this.foldable, this.view.containerElement), this.rackController.rack.emitter.on("add", () => {
  7213. this.foldable.cleanUpTransition();
  7214. }), this.rackController.rack.emitter.on("remove", () => {
  7215. this.foldable.cleanUpTransition();
  7216. }), this.view.buttonElement.addEventListener("click", this.onTitleClick_);
  7217. }
  7218. get document() {
  7219. return this.view.element.ownerDocument;
  7220. }
  7221. onTitleClick_() {
  7222. this.foldable.set("expanded", !this.foldable.get("expanded"));
  7223. }
  7224. }
  7225. const Js = {
  7226. id: "folder",
  7227. type: "blade",
  7228. accept(n) {
  7229. const e = M, t = le2(n, {
  7230. title: e.required.string,
  7231. view: e.required.constant("folder"),
  7232. expanded: e.optional.boolean
  7233. });
  7234. return t ? { params: t } : null;
  7235. },
  7236. controller(n) {
  7237. return new Xn(n.document, {
  7238. blade: n.blade,
  7239. expanded: n.params.expanded,
  7240. props: X.fromObject({
  7241. title: n.params.title
  7242. }),
  7243. viewProps: n.viewProps
  7244. });
  7245. },
  7246. api(n) {
  7247. return n.controller instanceof Xn ? new vi(n.controller, n.pool) : null;
  7248. }
  7249. };
  7250. class Gt extends ie {
  7251. constructor(e, t) {
  7252. const l = t.valueController.viewProps;
  7253. super(Object.assign(Object.assign({}, t), { value: t.valueController.value, view: new A2(e, {
  7254. props: t.props,
  7255. viewProps: l
  7256. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  7257. }
  7258. }
  7259. class ss extends a {
  7260. }
  7261. const _i = D("spr");
  7262. class er {
  7263. constructor(e, t) {
  7264. this.element = e.createElement("div"), this.element.classList.add(_i()), t.viewProps.bindClassModifiers(this.element);
  7265. const l = e.createElement("hr");
  7266. l.classList.add(_i("r")), this.element.appendChild(l);
  7267. }
  7268. }
  7269. class dn extends Mt {
  7270. constructor(e, t) {
  7271. super(Object.assign(Object.assign({}, t), { view: new er(e, {
  7272. viewProps: t.viewProps
  7273. }) }));
  7274. }
  7275. }
  7276. const tr = {
  7277. id: "separator",
  7278. type: "blade",
  7279. accept(n) {
  7280. const t = le2(n, {
  7281. view: M.required.constant("separator")
  7282. });
  7283. return t ? { params: t } : null;
  7284. },
  7285. controller(n) {
  7286. return new dn(n.document, {
  7287. blade: n.blade,
  7288. viewProps: n.viewProps
  7289. });
  7290. },
  7291. api(n) {
  7292. return n.controller instanceof dn ? new ss(n.controller) : null;
  7293. }
  7294. }, Le = D("tbi");
  7295. class nr {
  7296. constructor(e, t) {
  7297. this.element = e.createElement("div"), this.element.classList.add(Le()), t.viewProps.bindClassModifiers(this.element), O(t.props, "selected", (E) => {
  7298. E ? this.element.classList.add(Le(void 0, "sel")) : this.element.classList.remove(Le(void 0, "sel"));
  7299. });
  7300. const l = e.createElement("button");
  7301. l.classList.add(Le("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  7302. const v = e.createElement("div");
  7303. v.classList.add(Le("t")), q(t.props.value("title"), v), this.buttonElement.appendChild(v), this.titleElement = v;
  7304. }
  7305. }
  7306. class Yn {
  7307. constructor(e, t) {
  7308. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new nr(e, {
  7309. props: t.props,
  7310. viewProps: t.viewProps
  7311. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  7312. }
  7313. onClick_() {
  7314. this.emitter.emit("click", {
  7315. sender: this
  7316. });
  7317. }
  7318. }
  7319. class rs {
  7320. constructor(e, t) {
  7321. this.onItemClick_ = this.onItemClick_.bind(this), this.ic_ = new Yn(e, {
  7322. props: t.itemProps,
  7323. viewProps: Xe2.create()
  7324. }), this.ic_.emitter.on("click", this.onItemClick_), this.cc_ = new hn(e, {
  7325. blade: ye(),
  7326. viewProps: Xe2.create()
  7327. }), this.props = t.props, O(this.props, "selected", (l) => {
  7328. this.itemController.props.set("selected", l), this.contentController.viewProps.set("hidden", !l);
  7329. });
  7330. }
  7331. get itemController() {
  7332. return this.ic_;
  7333. }
  7334. get contentController() {
  7335. return this.cc_;
  7336. }
  7337. onItemClick_() {
  7338. this.props.set("selected", true);
  7339. }
  7340. }
  7341. class wi {
  7342. constructor(e, t) {
  7343. this.controller_ = e, this.rackApi_ = t;
  7344. }
  7345. get title() {
  7346. var e;
  7347. return (e = this.controller_.itemController.props.get("title")) !== null && e !== void 0 ? e : "";
  7348. }
  7349. set title(e) {
  7350. this.controller_.itemController.props.set("title", e);
  7351. }
  7352. get selected() {
  7353. return this.controller_.props.get("selected");
  7354. }
  7355. set selected(e) {
  7356. this.controller_.props.set("selected", e);
  7357. }
  7358. get children() {
  7359. return this.rackApi_.children;
  7360. }
  7361. addButton(e) {
  7362. return this.rackApi_.addButton(e);
  7363. }
  7364. addFolder(e) {
  7365. return this.rackApi_.addFolder(e);
  7366. }
  7367. addSeparator(e) {
  7368. return this.rackApi_.addSeparator(e);
  7369. }
  7370. addTab(e) {
  7371. return this.rackApi_.addTab(e);
  7372. }
  7373. add(e, t) {
  7374. this.rackApi_.add(e, t);
  7375. }
  7376. remove(e) {
  7377. this.rackApi_.remove(e);
  7378. }
  7379. addInput(e, t, l) {
  7380. return this.rackApi_.addInput(e, t, l);
  7381. }
  7382. addMonitor(e, t, l) {
  7383. return this.rackApi_.addMonitor(e, t, l);
  7384. }
  7385. addBlade(e) {
  7386. return this.rackApi_.addBlade(e);
  7387. }
  7388. }
  7389. class os extends Ge {
  7390. constructor(e, t) {
  7391. super(e, new $n(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) => {
  7392. this.emitter_.emit("change", {
  7393. event: l
  7394. });
  7395. }), this.rackApi_.on("update", (l) => {
  7396. this.emitter_.emit("update", {
  7397. event: l
  7398. });
  7399. }), 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) => {
  7400. this.setUpPageApi_(l);
  7401. });
  7402. }
  7403. get pages() {
  7404. return this.controller_.pageSet.items.map((e) => {
  7405. const t = this.pageApiMap_.get(e);
  7406. if (!t)
  7407. throw S2.shouldNeverHappen();
  7408. return t;
  7409. });
  7410. }
  7411. addPage(e) {
  7412. const t = this.controller_.view.element.ownerDocument, l = new rs(t, {
  7413. itemProps: X.fromObject({
  7414. selected: false,
  7415. title: e.title
  7416. }),
  7417. props: X.fromObject({
  7418. selected: false
  7419. })
  7420. });
  7421. this.controller_.add(l, e.index);
  7422. const v = this.pageApiMap_.get(l);
  7423. if (!v)
  7424. throw S2.shouldNeverHappen();
  7425. return v;
  7426. }
  7427. removePage(e) {
  7428. this.controller_.remove(e);
  7429. }
  7430. on(e, t) {
  7431. const l = t.bind(this);
  7432. return this.emitter_.on(e, (v) => {
  7433. l(v.event);
  7434. }), this;
  7435. }
  7436. setUpPageApi_(e) {
  7437. const t = this.rackApi_.apiSet_.find((v) => v.controller_ === e.contentController);
  7438. if (!t)
  7439. throw S2.shouldNeverHappen();
  7440. const l = new wi(e, t);
  7441. this.pageApiMap_.set(e, l);
  7442. }
  7443. onPageAdd_(e) {
  7444. this.setUpPageApi_(e.item);
  7445. }
  7446. onPageRemove_(e) {
  7447. if (!this.pageApiMap_.get(e.item))
  7448. throw S2.shouldNeverHappen();
  7449. this.pageApiMap_.delete(e.item);
  7450. }
  7451. onSelect_(e) {
  7452. this.emitter_.emit("select", {
  7453. event: new g(this, e.rawValue)
  7454. });
  7455. }
  7456. }
  7457. const as = -1;
  7458. class ir {
  7459. constructor() {
  7460. this.onItemSelectedChange_ = this.onItemSelectedChange_.bind(this), this.empty = ee2(true), this.selectedIndex = ee2(as), this.items_ = [];
  7461. }
  7462. add(e, t) {
  7463. const l = t ?? this.items_.length;
  7464. this.items_.splice(l, 0, e), e.emitter.on("change", this.onItemSelectedChange_), this.keepSelection_();
  7465. }
  7466. remove(e) {
  7467. const t = this.items_.indexOf(e);
  7468. t < 0 || (this.items_.splice(t, 1), e.emitter.off("change", this.onItemSelectedChange_), this.keepSelection_());
  7469. }
  7470. keepSelection_() {
  7471. if (this.items_.length === 0) {
  7472. this.selectedIndex.rawValue = as, this.empty.rawValue = true;
  7473. return;
  7474. }
  7475. const e = this.items_.findIndex((t) => t.rawValue);
  7476. e < 0 ? (this.items_.forEach((t, l) => {
  7477. t.rawValue = l === 0;
  7478. }), this.selectedIndex.rawValue = 0) : (this.items_.forEach((t, l) => {
  7479. t.rawValue = l === e;
  7480. }), this.selectedIndex.rawValue = e), this.empty.rawValue = false;
  7481. }
  7482. onItemSelectedChange_(e) {
  7483. if (e.rawValue) {
  7484. const t = this.items_.findIndex((l) => l === e.sender);
  7485. this.items_.forEach((l, v) => {
  7486. l.rawValue = v === t;
  7487. }), this.selectedIndex.rawValue = t;
  7488. } else
  7489. this.keepSelection_();
  7490. }
  7491. }
  7492. const Ht = D("tab");
  7493. class Kt {
  7494. constructor(e, t) {
  7495. this.element = e.createElement("div"), this.element.classList.add(Ht(), is()), t.viewProps.bindClassModifiers(this.element), N(t.empty, K(this.element, Ht(void 0, "nop")));
  7496. const l = e.createElement("div");
  7497. l.classList.add(Ht("t")), this.element.appendChild(l), this.itemsElement = l;
  7498. const v = e.createElement("div");
  7499. v.classList.add(Ht("i")), this.element.appendChild(v);
  7500. const E = t.contentsElement;
  7501. E.classList.add(Ht("c")), this.element.appendChild(E), this.contentsElement = E;
  7502. }
  7503. }
  7504. class mn extends bi {
  7505. constructor(e, t) {
  7506. const l = new hn(e, {
  7507. blade: t.blade,
  7508. viewProps: t.viewProps
  7509. }), v = new ir();
  7510. super({
  7511. blade: t.blade,
  7512. rackController: l,
  7513. view: new Kt(e, {
  7514. contentsElement: l.view.element,
  7515. empty: v.empty,
  7516. viewProps: t.viewProps
  7517. })
  7518. }), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.pageSet_ = new Lt(() => null), this.pageSet_.emitter.on("add", this.onPageAdd_), this.pageSet_.emitter.on("remove", this.onPageRemove_), this.tab = v;
  7519. }
  7520. get pageSet() {
  7521. return this.pageSet_;
  7522. }
  7523. add(e, t) {
  7524. this.pageSet_.add(e, t);
  7525. }
  7526. remove(e) {
  7527. this.pageSet_.remove(this.pageSet_.items[e]);
  7528. }
  7529. onPageAdd_(e) {
  7530. const t = e.item;
  7531. St(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"));
  7532. }
  7533. onPageRemove_(e) {
  7534. const t = e.item;
  7535. Hn(t.itemController.view.element), t.itemController.viewProps.set("parent", null), this.rackController.rack.remove(t.contentController), this.tab.remove(t.props.value("selected"));
  7536. }
  7537. }
  7538. const yi = {
  7539. id: "tab",
  7540. type: "blade",
  7541. accept(n) {
  7542. const e = M, t = le2(n, {
  7543. pages: e.required.array(e.required.object({ title: e.required.string })),
  7544. view: e.required.constant("tab")
  7545. });
  7546. return !t || t.pages.length === 0 ? null : { params: t };
  7547. },
  7548. controller(n) {
  7549. const e = new mn(n.document, {
  7550. blade: n.blade,
  7551. viewProps: n.viewProps
  7552. });
  7553. return n.params.pages.forEach((t) => {
  7554. const l = new rs(n.document, {
  7555. itemProps: X.fromObject({
  7556. selected: false,
  7557. title: t.title
  7558. }),
  7559. props: X.fromObject({
  7560. selected: false
  7561. })
  7562. });
  7563. e.add(l);
  7564. }), e;
  7565. },
  7566. api(n) {
  7567. return n.controller instanceof mn ? new os(n.controller, n.pool) : null;
  7568. }
  7569. };
  7570. function sr(n, e) {
  7571. const t = n.accept(e.params);
  7572. if (!t)
  7573. return null;
  7574. const l = M.optional.boolean(e.params.disabled).value, v = M.optional.boolean(e.params.hidden).value;
  7575. return n.controller({
  7576. blade: ye(),
  7577. document: e.document,
  7578. params: Object.assign(Object.assign({}, t.params), { disabled: l, hidden: v }),
  7579. viewProps: Xe2.create({
  7580. disabled: l,
  7581. hidden: v
  7582. })
  7583. });
  7584. }
  7585. class ls {
  7586. constructor() {
  7587. this.disabled = false, this.emitter = new F();
  7588. }
  7589. dispose() {
  7590. }
  7591. tick() {
  7592. this.disabled || this.emitter.emit("tick", {
  7593. sender: this
  7594. });
  7595. }
  7596. }
  7597. class xi {
  7598. constructor(e, t) {
  7599. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = e, this.emitter = new F(), this.interval_ = t, this.setTimer_();
  7600. }
  7601. get disabled() {
  7602. return this.disabled_;
  7603. }
  7604. set disabled(e) {
  7605. this.disabled_ = e, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  7606. }
  7607. dispose() {
  7608. this.clearTimer_();
  7609. }
  7610. clearTimer_() {
  7611. if (this.timerId_ === null)
  7612. return;
  7613. const e = this.doc_.defaultView;
  7614. e && e.clearInterval(this.timerId_), this.timerId_ = null;
  7615. }
  7616. setTimer_() {
  7617. if (this.clearTimer_(), this.interval_ <= 0)
  7618. return;
  7619. const e = this.doc_.defaultView;
  7620. e && (this.timerId_ = e.setInterval(this.onTick_, this.interval_));
  7621. }
  7622. onTick_() {
  7623. this.disabled_ || this.emitter.emit("tick", {
  7624. sender: this
  7625. });
  7626. }
  7627. }
  7628. class qn {
  7629. constructor(e) {
  7630. 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();
  7631. }
  7632. read() {
  7633. const e = this.target.read();
  7634. e !== void 0 && (this.value.rawValue = this.reader(e));
  7635. }
  7636. write_(e) {
  7637. this.writer(this.target, e);
  7638. }
  7639. onValueChange_(e) {
  7640. this.write_(e.rawValue), this.emitter.emit("change", {
  7641. options: e.options,
  7642. rawValue: e.rawValue,
  7643. sender: this
  7644. });
  7645. }
  7646. }
  7647. function Me(n, e) {
  7648. for (; n.length < e; )
  7649. n.push(void 0);
  7650. }
  7651. function cs(n) {
  7652. const e = [];
  7653. return Me(e, n), ee2(e);
  7654. }
  7655. function $t(n) {
  7656. const e = n.indexOf(void 0);
  7657. return e < 0 ? n : n.slice(0, e);
  7658. }
  7659. function Ye2(n, e) {
  7660. const t = [...$t(n), e];
  7661. return t.length > n.length ? t.splice(0, t.length - n.length) : Me(t, n.length), t;
  7662. }
  7663. class rr {
  7664. constructor(e) {
  7665. 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();
  7666. }
  7667. dispose() {
  7668. this.ticker.dispose();
  7669. }
  7670. read() {
  7671. const e = this.target.read();
  7672. if (e === void 0)
  7673. return;
  7674. const t = this.value.rawValue, l = this.reader_(e);
  7675. this.value.rawValue = Ye2(t, l), this.emitter.emit("update", {
  7676. rawValue: l,
  7677. sender: this
  7678. });
  7679. }
  7680. onTick_(e) {
  7681. this.read();
  7682. }
  7683. }
  7684. class fn {
  7685. constructor(e) {
  7686. this.constraints = e;
  7687. }
  7688. constrain(e) {
  7689. return this.constraints.reduce((t, l) => l.constrain(t), e);
  7690. }
  7691. }
  7692. function et2(n, e) {
  7693. if (n instanceof e)
  7694. return n;
  7695. if (n instanceof fn) {
  7696. const t = n.constraints.reduce((l, v) => l || (v instanceof e ? v : null), null);
  7697. if (t)
  7698. return t;
  7699. }
  7700. return null;
  7701. }
  7702. class Xt {
  7703. constructor(e) {
  7704. this.values = X.fromObject({
  7705. max: e.max,
  7706. min: e.min
  7707. });
  7708. }
  7709. constrain(e) {
  7710. const t = this.values.get("max"), l = this.values.get("min");
  7711. return Math.min(Math.max(e, l), t);
  7712. }
  7713. }
  7714. class vn {
  7715. constructor(e) {
  7716. this.values = X.fromObject({
  7717. options: e
  7718. });
  7719. }
  7720. get options() {
  7721. return this.values.get("options");
  7722. }
  7723. constrain(e) {
  7724. const t = this.values.get("options");
  7725. return t.length === 0 || t.filter((v) => v.value === e).length > 0 ? e : t[0].value;
  7726. }
  7727. }
  7728. class Ei {
  7729. constructor(e) {
  7730. this.values = X.fromObject({
  7731. max: e.max,
  7732. min: e.min
  7733. });
  7734. }
  7735. get maxValue() {
  7736. return this.values.get("max");
  7737. }
  7738. get minValue() {
  7739. return this.values.get("min");
  7740. }
  7741. constrain(e) {
  7742. const t = this.values.get("max"), l = this.values.get("min");
  7743. let v = e;
  7744. return _(l) || (v = Math.max(v, l)), _(t) || (v = Math.min(v, t)), v;
  7745. }
  7746. }
  7747. class Qn {
  7748. constructor(e, t = 0) {
  7749. this.step = e, this.origin = t;
  7750. }
  7751. constrain(e) {
  7752. const t = this.origin % this.step, l = Math.round((e - t) / this.step);
  7753. return t + l * this.step;
  7754. }
  7755. }
  7756. const Yt = D("lst");
  7757. class ps {
  7758. constructor(e, t) {
  7759. this.onValueChange_ = this.onValueChange_.bind(this), this.props_ = t.props, this.element = e.createElement("div"), this.element.classList.add(Yt()), t.viewProps.bindClassModifiers(this.element);
  7760. const l = e.createElement("select");
  7761. l.classList.add(Yt("s")), O(this.props_, "options", (E) => {
  7762. cn(l), E.forEach((k2, B2) => {
  7763. const Q = e.createElement("option");
  7764. Q.dataset.index = String(B2), Q.textContent = k2.text, Q.value = String(k2.value), l.appendChild(Q);
  7765. });
  7766. }), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.selectElement = l;
  7767. const v = e.createElement("div");
  7768. v.classList.add(Yt("m")), v.appendChild(yt(e, "dropdown")), this.element.appendChild(v), t.value.emitter.on("change", this.onValueChange_), this.value_ = t.value, this.update_();
  7769. }
  7770. update_() {
  7771. this.selectElement.value = String(this.value_.rawValue);
  7772. }
  7773. onValueChange_() {
  7774. this.update_();
  7775. }
  7776. }
  7777. class bn {
  7778. constructor(e, t) {
  7779. this.onSelectChange_ = this.onSelectChange_.bind(this), this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new ps(e, {
  7780. props: this.props,
  7781. value: this.value,
  7782. viewProps: this.viewProps
  7783. }), this.view.selectElement.addEventListener("change", this.onSelectChange_);
  7784. }
  7785. onSelectChange_(e) {
  7786. const l = e.currentTarget.selectedOptions.item(0);
  7787. if (!l)
  7788. return;
  7789. const v = Number(l.dataset.index);
  7790. this.value.rawValue = this.props.get("options")[v].value;
  7791. }
  7792. }
  7793. const us = D("pop");
  7794. class or {
  7795. constructor(e, t) {
  7796. this.element = e.createElement("div"), this.element.classList.add(us()), t.viewProps.bindClassModifiers(this.element), N(t.shows, K(this.element, us(void 0, "v")));
  7797. }
  7798. }
  7799. class hs {
  7800. constructor(e, t) {
  7801. this.shows = ee2(false), this.viewProps = t.viewProps, this.view = new or(e, {
  7802. shows: this.shows,
  7803. viewProps: this.viewProps
  7804. });
  7805. }
  7806. }
  7807. const ds = D("txt");
  7808. class ar {
  7809. constructor(e, t) {
  7810. this.onChange_ = this.onChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(ds()), t.viewProps.bindClassModifiers(this.element), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_);
  7811. const l = e.createElement("input");
  7812. l.classList.add(ds("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();
  7813. }
  7814. refresh() {
  7815. const e = this.props_.get("formatter");
  7816. this.inputElement.value = e(this.value_.rawValue);
  7817. }
  7818. onChange_() {
  7819. this.refresh();
  7820. }
  7821. }
  7822. class Zn {
  7823. constructor(e, t) {
  7824. 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 ar(e, {
  7825. props: t.props,
  7826. value: this.value,
  7827. viewProps: this.viewProps
  7828. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7829. }
  7830. onInputChange_(e) {
  7831. const l = e.currentTarget.value, v = this.parser_(l);
  7832. _(v) || (this.value.rawValue = v), this.view.refresh();
  7833. }
  7834. }
  7835. function lr(n) {
  7836. return String(n);
  7837. }
  7838. function ms(n) {
  7839. return n === "false" ? false : !!n;
  7840. }
  7841. function fs(n) {
  7842. return lr(n);
  7843. }
  7844. class cr {
  7845. constructor(e) {
  7846. this.text = e;
  7847. }
  7848. evaluate() {
  7849. return Number(this.text);
  7850. }
  7851. toString() {
  7852. return this.text;
  7853. }
  7854. }
  7855. const pr = {
  7856. "**": (n, e) => Math.pow(n, e),
  7857. "*": (n, e) => n * e,
  7858. "/": (n, e) => n / e,
  7859. "%": (n, e) => n % e,
  7860. "+": (n, e) => n + e,
  7861. "-": (n, e) => n - e,
  7862. "<<": (n, e) => n << e,
  7863. ">>": (n, e) => n >> e,
  7864. ">>>": (n, e) => n >>> e,
  7865. "&": (n, e) => n & e,
  7866. "^": (n, e) => n ^ e,
  7867. "|": (n, e) => n | e
  7868. };
  7869. class ur {
  7870. constructor(e, t, l) {
  7871. this.left = t, this.operator = e, this.right = l;
  7872. }
  7873. evaluate() {
  7874. const e = pr[this.operator];
  7875. if (!e)
  7876. throw new Error(`unexpected binary operator: '${this.operator}`);
  7877. return e(this.left.evaluate(), this.right.evaluate());
  7878. }
  7879. toString() {
  7880. return [
  7881. "b(",
  7882. this.left.toString(),
  7883. this.operator,
  7884. this.right.toString(),
  7885. ")"
  7886. ].join(" ");
  7887. }
  7888. }
  7889. const vs = {
  7890. "+": (n) => n,
  7891. "-": (n) => -n,
  7892. "~": (n) => ~n
  7893. };
  7894. class hr {
  7895. constructor(e, t) {
  7896. this.operator = e, this.expression = t;
  7897. }
  7898. evaluate() {
  7899. const e = vs[this.operator];
  7900. if (!e)
  7901. throw new Error(`unexpected unary operator: '${this.operator}`);
  7902. return e(this.expression.evaluate());
  7903. }
  7904. toString() {
  7905. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  7906. }
  7907. }
  7908. function Ci(n) {
  7909. return (e, t) => {
  7910. for (let l = 0; l < n.length; l++) {
  7911. const v = n[l](e, t);
  7912. if (v !== "")
  7913. return v;
  7914. }
  7915. return "";
  7916. };
  7917. }
  7918. function Rt(n, e) {
  7919. var t;
  7920. const l = n.substr(e).match(/^\s+/);
  7921. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7922. }
  7923. function dr(n, e) {
  7924. const t = n.substr(e, 1);
  7925. return t.match(/^[1-9]$/) ? t : "";
  7926. }
  7927. function gn(n, e) {
  7928. var t;
  7929. const l = n.substr(e).match(/^[0-9]+/);
  7930. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7931. }
  7932. function mr(n, e) {
  7933. const t = gn(n, e);
  7934. if (t !== "")
  7935. return t;
  7936. const l = n.substr(e, 1);
  7937. if (e += 1, l !== "-" && l !== "+")
  7938. return "";
  7939. const v = gn(n, e);
  7940. return v === "" ? "" : l + v;
  7941. }
  7942. function ot2(n, e) {
  7943. const t = n.substr(e, 1);
  7944. if (e += 1, t.toLowerCase() !== "e")
  7945. return "";
  7946. const l = mr(n, e);
  7947. return l === "" ? "" : t + l;
  7948. }
  7949. function bs(n, e) {
  7950. const t = n.substr(e, 1);
  7951. if (t === "0")
  7952. return t;
  7953. const l = dr(n, e);
  7954. return e += l.length, l === "" ? "" : l + gn(n, e);
  7955. }
  7956. function fr(n, e) {
  7957. const t = bs(n, e);
  7958. if (e += t.length, t === "")
  7959. return "";
  7960. const l = n.substr(e, 1);
  7961. if (e += l.length, l !== ".")
  7962. return "";
  7963. const v = gn(n, e);
  7964. return e += v.length, t + l + v + ot2(n, e);
  7965. }
  7966. function gs(n, e) {
  7967. const t = n.substr(e, 1);
  7968. if (e += t.length, t !== ".")
  7969. return "";
  7970. const l = gn(n, e);
  7971. return e += l.length, l === "" ? "" : t + l + ot2(n, e);
  7972. }
  7973. function vr(n, e) {
  7974. const t = bs(n, e);
  7975. return e += t.length, t === "" ? "" : t + ot2(n, e);
  7976. }
  7977. const _s = Ci([
  7978. fr,
  7979. gs,
  7980. vr
  7981. ]);
  7982. function Pi(n, e) {
  7983. var t;
  7984. const l = n.substr(e).match(/^[01]+/);
  7985. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7986. }
  7987. function br(n, e) {
  7988. const t = n.substr(e, 2);
  7989. if (e += t.length, t.toLowerCase() !== "0b")
  7990. return "";
  7991. const l = Pi(n, e);
  7992. return l === "" ? "" : t + l;
  7993. }
  7994. function ws(n, e) {
  7995. var t;
  7996. const l = n.substr(e).match(/^[0-7]+/);
  7997. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7998. }
  7999. function qe2(n, e) {
  8000. const t = n.substr(e, 2);
  8001. if (e += t.length, t.toLowerCase() !== "0o")
  8002. return "";
  8003. const l = ws(n, e);
  8004. return l === "" ? "" : t + l;
  8005. }
  8006. function gr(n, e) {
  8007. var t;
  8008. const l = n.substr(e).match(/^[0-9a-f]+/i);
  8009. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  8010. }
  8011. function _r(n, e) {
  8012. const t = n.substr(e, 2);
  8013. if (e += t.length, t.toLowerCase() !== "0x")
  8014. return "";
  8015. const l = gr(n, e);
  8016. return l === "" ? "" : t + l;
  8017. }
  8018. const Ti = Ci([
  8019. br,
  8020. qe2,
  8021. _r
  8022. ]), wr = Ci([
  8023. Ti,
  8024. _s
  8025. ]);
  8026. function Et(n, e) {
  8027. const t = wr(n, e);
  8028. return e += t.length, t === "" ? null : {
  8029. evaluable: new cr(t),
  8030. cursor: e
  8031. };
  8032. }
  8033. function ki(n, e) {
  8034. const t = n.substr(e, 1);
  8035. if (e += t.length, t !== "(")
  8036. return null;
  8037. const l = Wn(n, e);
  8038. if (!l)
  8039. return null;
  8040. e = l.cursor, e += Rt(n, e).length;
  8041. const v = n.substr(e, 1);
  8042. return e += v.length, v !== ")" ? null : {
  8043. evaluable: l.evaluable,
  8044. cursor: e
  8045. };
  8046. }
  8047. function yr(n, e) {
  8048. var t;
  8049. return (t = Et(n, e)) !== null && t !== void 0 ? t : ki(n, e);
  8050. }
  8051. function Mi(n, e) {
  8052. const t = yr(n, e);
  8053. if (t)
  8054. return t;
  8055. const l = n.substr(e, 1);
  8056. if (e += l.length, l !== "+" && l !== "-" && l !== "~")
  8057. return null;
  8058. const v = Mi(n, e);
  8059. return v ? (e = v.cursor, {
  8060. cursor: e,
  8061. evaluable: new hr(l, v.evaluable)
  8062. }) : null;
  8063. }
  8064. function xr(n, e, t) {
  8065. t += Rt(e, t).length;
  8066. const l = n.filter((v) => e.startsWith(v, t))[0];
  8067. return l ? (t += l.length, t += Rt(e, t).length, {
  8068. cursor: t,
  8069. operator: l
  8070. }) : null;
  8071. }
  8072. function It(n, e) {
  8073. return (t, l) => {
  8074. const v = n(t, l);
  8075. if (!v)
  8076. return null;
  8077. l = v.cursor;
  8078. let E = v.evaluable;
  8079. for (; ; ) {
  8080. const k2 = xr(e, t, l);
  8081. if (!k2)
  8082. break;
  8083. l = k2.cursor;
  8084. const B2 = n(t, l);
  8085. if (!B2)
  8086. return null;
  8087. l = B2.cursor, E = new ur(k2.operator, E, B2.evaluable);
  8088. }
  8089. return E ? {
  8090. cursor: l,
  8091. evaluable: E
  8092. } : null;
  8093. };
  8094. }
  8095. const ys = [
  8096. ["**"],
  8097. ["*", "/", "%"],
  8098. ["+", "-"],
  8099. ["<<", ">>>", ">>"],
  8100. ["&"],
  8101. ["^"],
  8102. ["|"]
  8103. ].reduce((n, e) => It(n, e), Mi);
  8104. function Wn(n, e) {
  8105. return e += Rt(n, e).length, ys(n, e);
  8106. }
  8107. function xs(n) {
  8108. const e = Wn(n, 0);
  8109. return !e || e.cursor + Rt(n, e.cursor).length !== n.length ? null : e.evaluable;
  8110. }
  8111. function at2(n) {
  8112. var e;
  8113. const t = xs(n);
  8114. return (e = t == null ? void 0 : t.evaluate()) !== null && e !== void 0 ? e : null;
  8115. }
  8116. function vt(n) {
  8117. if (typeof n == "number")
  8118. return n;
  8119. if (typeof n == "string") {
  8120. const e = at2(n);
  8121. if (!_(e))
  8122. return e;
  8123. }
  8124. return 0;
  8125. }
  8126. function Er(n) {
  8127. return String(n);
  8128. }
  8129. function Re(n) {
  8130. return (e) => e.toFixed(Math.max(Math.min(n, 20), 0));
  8131. }
  8132. const Es = Re(0);
  8133. function _n(n) {
  8134. return Es(n) + "%";
  8135. }
  8136. function Si(n) {
  8137. return String(n);
  8138. }
  8139. function Ct(n) {
  8140. return n;
  8141. }
  8142. function qt({ primary: n, secondary: e, forward: t, backward: l }) {
  8143. let v = false;
  8144. function E(k2) {
  8145. v || (v = true, k2(), v = false);
  8146. }
  8147. n.emitter.on("change", (k2) => {
  8148. E(() => {
  8149. e.setRawValue(t(n, e), k2.options);
  8150. });
  8151. }), e.emitter.on("change", (k2) => {
  8152. E(() => {
  8153. n.setRawValue(l(n, e), k2.options);
  8154. }), E(() => {
  8155. e.setRawValue(t(n, e), k2.options);
  8156. });
  8157. }), E(() => {
  8158. e.setRawValue(t(n, e), {
  8159. forceEmit: false,
  8160. last: true
  8161. });
  8162. });
  8163. }
  8164. function Oe(n, e) {
  8165. const t = n * (e.altKey ? 0.1 : 1) * (e.shiftKey ? 10 : 1);
  8166. return e.upKey ? +t : e.downKey ? -t : 0;
  8167. }
  8168. function wn(n) {
  8169. return {
  8170. altKey: n.altKey,
  8171. downKey: n.key === "ArrowDown",
  8172. shiftKey: n.shiftKey,
  8173. upKey: n.key === "ArrowUp"
  8174. };
  8175. }
  8176. function lt2(n) {
  8177. return {
  8178. altKey: n.altKey,
  8179. downKey: n.key === "ArrowLeft",
  8180. shiftKey: n.shiftKey,
  8181. upKey: n.key === "ArrowRight"
  8182. };
  8183. }
  8184. function Cs(n) {
  8185. return n === "ArrowUp" || n === "ArrowDown";
  8186. }
  8187. function Jn(n) {
  8188. return Cs(n) || n === "ArrowLeft" || n === "ArrowRight";
  8189. }
  8190. function Ai(n, e) {
  8191. var t, l;
  8192. const v = e.ownerDocument.defaultView, E = e.getBoundingClientRect();
  8193. return {
  8194. x: n.pageX - (((t = v && v.scrollX) !== null && t !== void 0 ? t : 0) + E.left),
  8195. y: n.pageY - (((l = v && v.scrollY) !== null && l !== void 0 ? l : 0) + E.top)
  8196. };
  8197. }
  8198. class Vt {
  8199. constructor(e) {
  8200. 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_, {
  8201. passive: false
  8202. }), e.addEventListener("touchmove", this.onTouchMove_, {
  8203. passive: true
  8204. }), e.addEventListener("touchend", this.onTouchEnd_), e.addEventListener("mousedown", this.onMouseDown_);
  8205. }
  8206. computePosition_(e) {
  8207. const t = this.elem_.getBoundingClientRect();
  8208. return {
  8209. bounds: {
  8210. width: t.width,
  8211. height: t.height
  8212. },
  8213. point: e ? {
  8214. x: e.x,
  8215. y: e.y
  8216. } : null
  8217. };
  8218. }
  8219. onMouseDown_(e) {
  8220. var t;
  8221. e.preventDefault(), (t = e.currentTarget) === null || t === void 0 || t.focus();
  8222. const l = this.elem_.ownerDocument;
  8223. l.addEventListener("mousemove", this.onDocumentMouseMove_), l.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  8224. altKey: e.altKey,
  8225. data: this.computePosition_(Ai(e, this.elem_)),
  8226. sender: this,
  8227. shiftKey: e.shiftKey
  8228. });
  8229. }
  8230. onDocumentMouseMove_(e) {
  8231. this.emitter.emit("move", {
  8232. altKey: e.altKey,
  8233. data: this.computePosition_(Ai(e, this.elem_)),
  8234. sender: this,
  8235. shiftKey: e.shiftKey
  8236. });
  8237. }
  8238. onDocumentMouseUp_(e) {
  8239. const t = this.elem_.ownerDocument;
  8240. t.removeEventListener("mousemove", this.onDocumentMouseMove_), t.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  8241. altKey: e.altKey,
  8242. data: this.computePosition_(Ai(e, this.elem_)),
  8243. sender: this,
  8244. shiftKey: e.shiftKey
  8245. });
  8246. }
  8247. onTouchStart_(e) {
  8248. e.preventDefault();
  8249. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  8250. this.emitter.emit("down", {
  8251. altKey: e.altKey,
  8252. data: this.computePosition_(t ? {
  8253. x: t.clientX - l.left,
  8254. y: t.clientY - l.top
  8255. } : void 0),
  8256. sender: this,
  8257. shiftKey: e.shiftKey
  8258. }), this.lastTouch_ = t;
  8259. }
  8260. onTouchMove_(e) {
  8261. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  8262. this.emitter.emit("move", {
  8263. altKey: e.altKey,
  8264. data: this.computePosition_(t ? {
  8265. x: t.clientX - l.left,
  8266. y: t.clientY - l.top
  8267. } : void 0),
  8268. sender: this,
  8269. shiftKey: e.shiftKey
  8270. }), this.lastTouch_ = t;
  8271. }
  8272. onTouchEnd_(e) {
  8273. var t;
  8274. const l = (t = e.targetTouches.item(0)) !== null && t !== void 0 ? t : this.lastTouch_, v = this.elem_.getBoundingClientRect();
  8275. this.emitter.emit("up", {
  8276. altKey: e.altKey,
  8277. data: this.computePosition_(l ? {
  8278. x: l.clientX - v.left,
  8279. y: l.clientY - v.top
  8280. } : void 0),
  8281. sender: this,
  8282. shiftKey: e.shiftKey
  8283. });
  8284. }
  8285. }
  8286. function _e(n, e, t, l, v) {
  8287. const E = (n - e) / (t - e);
  8288. return l + E * (v - l);
  8289. }
  8290. function Li(n) {
  8291. return String(n.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  8292. }
  8293. function Se(n, e, t) {
  8294. return Math.min(Math.max(n, e), t);
  8295. }
  8296. function Qt(n, e) {
  8297. return (n % e + e) % e;
  8298. }
  8299. const He = D("txt");
  8300. class Ri {
  8301. constructor(e, t) {
  8302. 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(He(), He(void 0, "num")), t.arrayPosition && this.element.classList.add(He(void 0, t.arrayPosition)), t.viewProps.bindClassModifiers(this.element);
  8303. const l = e.createElement("input");
  8304. l.classList.add(He("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(He()), this.inputElement.classList.add(He("i"));
  8305. const v = e.createElement("div");
  8306. v.classList.add(He("k")), this.element.appendChild(v), this.knobElement = v;
  8307. const E = e.createElementNS(ze, "svg");
  8308. E.classList.add(He("g")), this.knobElement.appendChild(E);
  8309. const k2 = e.createElementNS(ze, "path");
  8310. k2.classList.add(He("gb")), E.appendChild(k2), this.guideBodyElem_ = k2;
  8311. const B2 = e.createElementNS(ze, "path");
  8312. B2.classList.add(He("gh")), E.appendChild(B2), this.guideHeadElem_ = B2;
  8313. const Q = e.createElement("div");
  8314. Q.classList.add(D("tt")()), this.knobElement.appendChild(Q), this.tooltipElem_ = Q, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.refresh();
  8315. }
  8316. onDraggingChange_(e) {
  8317. if (e.rawValue === null) {
  8318. this.element.classList.remove(He(void 0, "drg"));
  8319. return;
  8320. }
  8321. this.element.classList.add(He(void 0, "drg"));
  8322. const t = e.rawValue / this.props_.get("draggingScale"), l = t + (t > 0 ? -1 : t < 0 ? 1 : 0), v = Se(-l, -4, 4);
  8323. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${l + v},0 L${l},4 L${l + v},8`, `M ${t},-1 L${t},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${t},4`);
  8324. const E = this.props_.get("formatter");
  8325. this.tooltipElem_.textContent = E(this.value.rawValue), this.tooltipElem_.style.left = `${t}px`;
  8326. }
  8327. refresh() {
  8328. const e = this.props_.get("formatter");
  8329. this.inputElement.value = e(this.value.rawValue);
  8330. }
  8331. onChange_() {
  8332. this.refresh();
  8333. }
  8334. }
  8335. class yn {
  8336. constructor(e, t) {
  8337. var l;
  8338. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = t.baseStep, this.parser_ = t.parser, this.props = t.props, this.sliderProps_ = (l = t.sliderProps) !== null && l !== void 0 ? l : null, this.value = t.value, this.viewProps = t.viewProps, this.dragging_ = ee2(null), this.view = new Ri(e, {
  8339. arrayPosition: t.arrayPosition,
  8340. dragging: this.dragging_,
  8341. props: this.props,
  8342. value: this.value,
  8343. viewProps: this.viewProps
  8344. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  8345. const v = new Vt(this.view.knobElement);
  8346. v.emitter.on("down", this.onPointerDown_), v.emitter.on("move", this.onPointerMove_), v.emitter.on("up", this.onPointerUp_);
  8347. }
  8348. constrainValue_(e) {
  8349. var t, l;
  8350. const v = (t = this.sliderProps_) === null || t === void 0 ? void 0 : t.get("minValue"), E = (l = this.sliderProps_) === null || l === void 0 ? void 0 : l.get("maxValue");
  8351. let k2 = e;
  8352. return v !== void 0 && (k2 = Math.max(k2, v)), E !== void 0 && (k2 = Math.min(k2, E)), k2;
  8353. }
  8354. onInputChange_(e) {
  8355. const l = e.currentTarget.value, v = this.parser_(l);
  8356. _(v) || (this.value.rawValue = this.constrainValue_(v)), this.view.refresh();
  8357. }
  8358. onInputKeyDown_(e) {
  8359. const t = Oe(this.baseStep_, wn(e));
  8360. t !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + t), {
  8361. forceEmit: false,
  8362. last: false
  8363. });
  8364. }
  8365. onInputKeyUp_(e) {
  8366. Oe(this.baseStep_, wn(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8367. forceEmit: true,
  8368. last: true
  8369. });
  8370. }
  8371. onPointerDown_() {
  8372. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  8373. }
  8374. computeDraggingValue_(e) {
  8375. if (!e.point)
  8376. return null;
  8377. const t = e.point.x - e.bounds.width / 2;
  8378. return this.constrainValue_(this.originRawValue_ + t * this.props.get("draggingScale"));
  8379. }
  8380. onPointerMove_(e) {
  8381. const t = this.computeDraggingValue_(e.data);
  8382. t !== null && (this.value.setRawValue(t, {
  8383. forceEmit: false,
  8384. last: false
  8385. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  8386. }
  8387. onPointerUp_(e) {
  8388. const t = this.computeDraggingValue_(e.data);
  8389. t !== null && (this.value.setRawValue(t, {
  8390. forceEmit: true,
  8391. last: true
  8392. }), this.dragging_.rawValue = null);
  8393. }
  8394. }
  8395. const Ii = D("sld");
  8396. class Ke2 {
  8397. constructor(e, t) {
  8398. 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(Ii()), t.viewProps.bindClassModifiers(this.element);
  8399. const l = e.createElement("div");
  8400. l.classList.add(Ii("t")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.trackElement = l;
  8401. const v = e.createElement("div");
  8402. v.classList.add(Ii("k")), this.trackElement.appendChild(v), this.knobElement = v, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.update_();
  8403. }
  8404. update_() {
  8405. const e = Se(_e(this.value.rawValue, this.props_.get("minValue"), this.props_.get("maxValue"), 0, 100), 0, 100);
  8406. this.knobElement.style.width = `${e}%`;
  8407. }
  8408. onChange_() {
  8409. this.update_();
  8410. }
  8411. }
  8412. class Vi {
  8413. constructor(e, t) {
  8414. 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 Ke2(e, {
  8415. props: this.props,
  8416. value: this.value,
  8417. viewProps: this.viewProps
  8418. }), this.ptHandler_ = new Vt(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_);
  8419. }
  8420. handlePointerEvent_(e, t) {
  8421. e.point && this.value.setRawValue(_e(Se(e.point.x, 0, e.bounds.width), 0, e.bounds.width, this.props.get("minValue"), this.props.get("maxValue")), t);
  8422. }
  8423. onPointerDownOrMove_(e) {
  8424. this.handlePointerEvent_(e.data, {
  8425. forceEmit: false,
  8426. last: false
  8427. });
  8428. }
  8429. onPointerUp_(e) {
  8430. this.handlePointerEvent_(e.data, {
  8431. forceEmit: true,
  8432. last: true
  8433. });
  8434. }
  8435. onKeyDown_(e) {
  8436. const t = Oe(this.baseStep_, lt2(e));
  8437. t !== 0 && this.value.setRawValue(this.value.rawValue + t, {
  8438. forceEmit: false,
  8439. last: false
  8440. });
  8441. }
  8442. onKeyUp_(e) {
  8443. Oe(this.baseStep_, lt2(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8444. forceEmit: true,
  8445. last: true
  8446. });
  8447. }
  8448. }
  8449. const xn = D("sldtxt");
  8450. class Di {
  8451. constructor(e, t) {
  8452. this.element = e.createElement("div"), this.element.classList.add(xn());
  8453. const l = e.createElement("div");
  8454. l.classList.add(xn("s")), this.sliderView_ = t.sliderView, l.appendChild(this.sliderView_.element), this.element.appendChild(l);
  8455. const v = e.createElement("div");
  8456. v.classList.add(xn("t")), this.textView_ = t.textView, v.appendChild(this.textView_.element), this.element.appendChild(v);
  8457. }
  8458. }
  8459. class ei {
  8460. constructor(e, t) {
  8461. this.value = t.value, this.viewProps = t.viewProps, this.sliderC_ = new Vi(e, {
  8462. baseStep: t.baseStep,
  8463. props: t.sliderProps,
  8464. value: t.value,
  8465. viewProps: this.viewProps
  8466. }), this.textC_ = new yn(e, {
  8467. baseStep: t.baseStep,
  8468. parser: t.parser,
  8469. props: t.textProps,
  8470. sliderProps: t.sliderProps,
  8471. value: t.value,
  8472. viewProps: t.viewProps
  8473. }), this.view = new Di(e, {
  8474. sliderView: this.sliderC_.view,
  8475. textView: this.textC_.view
  8476. });
  8477. }
  8478. get sliderController() {
  8479. return this.sliderC_;
  8480. }
  8481. get textController() {
  8482. return this.textC_;
  8483. }
  8484. }
  8485. function tt2(n, e) {
  8486. n.write(e);
  8487. }
  8488. function En(n) {
  8489. const e = M;
  8490. if (Array.isArray(n))
  8491. return e.required.array(e.required.object({
  8492. text: e.required.string,
  8493. value: e.required.raw
  8494. }))(n).value;
  8495. if (typeof n == "object")
  8496. return e.required.raw(n).value;
  8497. }
  8498. function Oi(n) {
  8499. if (n === "inline" || n === "popup")
  8500. return n;
  8501. }
  8502. function bt(n) {
  8503. const e = M;
  8504. return e.required.object({
  8505. max: e.optional.number,
  8506. min: e.optional.number,
  8507. step: e.optional.number
  8508. })(n).value;
  8509. }
  8510. function Ps(n) {
  8511. if (Array.isArray(n))
  8512. return n;
  8513. const e = [];
  8514. return Object.keys(n).forEach((t) => {
  8515. e.push({ text: t, value: n[t] });
  8516. }), e;
  8517. }
  8518. function Ni(n) {
  8519. return _(n) ? null : new vn(Ps(n));
  8520. }
  8521. function Cr(n) {
  8522. const e = n ? et2(n, Qn) : null;
  8523. return e ? e.step : null;
  8524. }
  8525. function ti(n, e) {
  8526. const t = n && et2(n, Qn);
  8527. return t ? Li(t.step) : Math.max(Li(e), 2);
  8528. }
  8529. function Dt(n) {
  8530. const e = Cr(n);
  8531. return e ?? 1;
  8532. }
  8533. function Ot(n, e) {
  8534. var t;
  8535. const l = n && et2(n, Qn), v = Math.abs((t = l == null ? void 0 : l.step) !== null && t !== void 0 ? t : e);
  8536. return v === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(v)) - 1);
  8537. }
  8538. const Cn = D("ckb");
  8539. class Pn {
  8540. constructor(e, t) {
  8541. this.onValueChange_ = this.onValueChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(Cn()), t.viewProps.bindClassModifiers(this.element);
  8542. const l = e.createElement("label");
  8543. l.classList.add(Cn("l")), this.element.appendChild(l);
  8544. const v = e.createElement("input");
  8545. v.classList.add(Cn("i")), v.type = "checkbox", l.appendChild(v), this.inputElement = v, t.viewProps.bindDisabled(this.inputElement);
  8546. const E = e.createElement("div");
  8547. E.classList.add(Cn("w")), l.appendChild(E);
  8548. const k2 = yt(e, "check");
  8549. E.appendChild(k2), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  8550. }
  8551. update_() {
  8552. this.inputElement.checked = this.value.rawValue;
  8553. }
  8554. onValueChange_() {
  8555. this.update_();
  8556. }
  8557. }
  8558. class Ts {
  8559. constructor(e, t) {
  8560. this.onInputChange_ = this.onInputChange_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new Pn(e, {
  8561. value: this.value,
  8562. viewProps: this.viewProps
  8563. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  8564. }
  8565. onInputChange_(e) {
  8566. const t = e.currentTarget;
  8567. this.value.rawValue = t.checked;
  8568. }
  8569. }
  8570. function ks(n) {
  8571. const e = [], t = Ni(n.options);
  8572. return t && e.push(t), new fn(e);
  8573. }
  8574. const ni = {
  8575. id: "input-bool",
  8576. type: "input",
  8577. accept: (n, e) => {
  8578. if (typeof n != "boolean")
  8579. return null;
  8580. const l = le2(e, {
  8581. options: M.optional.custom(En)
  8582. });
  8583. return l ? {
  8584. initialValue: n,
  8585. params: l
  8586. } : null;
  8587. },
  8588. binding: {
  8589. reader: (n) => ms,
  8590. constraint: (n) => ks(n.params),
  8591. writer: (n) => tt2
  8592. },
  8593. controller: (n) => {
  8594. const e = n.document, t = n.value, l = n.constraint, v = l && et2(l, vn);
  8595. return v ? new bn(e, {
  8596. props: new X({
  8597. options: v.values.value("options")
  8598. }),
  8599. value: t,
  8600. viewProps: n.viewProps
  8601. }) : new Ts(e, {
  8602. value: t,
  8603. viewProps: n.viewProps
  8604. });
  8605. }
  8606. }, Nt = D("col");
  8607. class Fi {
  8608. constructor(e, t) {
  8609. this.element = e.createElement("div"), this.element.classList.add(Nt()), t.foldable.bindExpandedClass(this.element, Nt(void 0, "expanded")), O(t.foldable, "completed", K(this.element, Nt(void 0, "cpl")));
  8610. const l = e.createElement("div");
  8611. l.classList.add(Nt("h")), this.element.appendChild(l);
  8612. const v = e.createElement("div");
  8613. v.classList.add(Nt("s")), l.appendChild(v), this.swatchElement = v;
  8614. const E = e.createElement("div");
  8615. if (E.classList.add(Nt("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  8616. const k2 = e.createElement("div");
  8617. k2.classList.add(Nt("p")), this.element.appendChild(k2), this.pickerElement = k2;
  8618. } else
  8619. this.pickerElement = null;
  8620. }
  8621. }
  8622. function Pr(n, e, t) {
  8623. const l = Se(n / 255, 0, 1), v = Se(e / 255, 0, 1), E = Se(t / 255, 0, 1), k2 = Math.max(l, v, E), B2 = Math.min(l, v, E), Q = k2 - B2;
  8624. let J = 0, de = 0;
  8625. const ve = (B2 + k2) / 2;
  8626. return Q !== 0 && (de = Q / (1 - Math.abs(k2 + B2 - 1)), l === k2 ? J = (v - E) / Q : v === k2 ? J = 2 + (E - l) / Q : J = 4 + (l - v) / Q, J = J / 6 + (J < 0 ? 1 : 0)), [J * 360, de * 100, ve * 100];
  8627. }
  8628. function Tr(n, e, t) {
  8629. const l = (n % 360 + 360) % 360, v = Se(e / 100, 0, 1), E = Se(t / 100, 0, 1), k2 = (1 - Math.abs(2 * E - 1)) * v, B2 = k2 * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k2 / 2;
  8630. let J, de, ve;
  8631. return l >= 0 && l < 60 ? [J, de, ve] = [k2, B2, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B2, k2, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, k2, B2] : l >= 180 && l < 240 ? [J, de, ve] = [0, B2, k2] : l >= 240 && l < 300 ? [J, de, ve] = [B2, 0, k2] : [J, de, ve] = [k2, 0, B2], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  8632. }
  8633. function kr(n, e, t) {
  8634. const l = Se(n / 255, 0, 1), v = Se(e / 255, 0, 1), E = Se(t / 255, 0, 1), k2 = Math.max(l, v, E), B2 = Math.min(l, v, E), Q = k2 - B2;
  8635. let J;
  8636. Q === 0 ? J = 0 : k2 === l ? J = 60 * (((v - E) / Q % 6 + 6) % 6) : k2 === v ? J = 60 * ((E - l) / Q + 2) : J = 60 * ((l - v) / Q + 4);
  8637. const de = k2 === 0 ? 0 : Q / k2, ve = k2;
  8638. return [J, de * 100, ve * 100];
  8639. }
  8640. function Ms(n, e, t) {
  8641. const l = Qt(n, 360), v = Se(e / 100, 0, 1), E = Se(t / 100, 0, 1), k2 = E * v, B2 = k2 * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k2;
  8642. let J, de, ve;
  8643. return l >= 0 && l < 60 ? [J, de, ve] = [k2, B2, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B2, k2, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, k2, B2] : l >= 180 && l < 240 ? [J, de, ve] = [0, B2, k2] : l >= 240 && l < 300 ? [J, de, ve] = [B2, 0, k2] : [J, de, ve] = [k2, 0, B2], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  8644. }
  8645. function m(n, e, t) {
  8646. const l = t + e * (100 - Math.abs(2 * t - 100)) / 200;
  8647. return [
  8648. n,
  8649. l !== 0 ? e * (100 - Math.abs(2 * t - 100)) / l : 0,
  8650. t + e * (100 - Math.abs(2 * t - 100)) / (2 * 100)
  8651. ];
  8652. }
  8653. function o(n, e, t) {
  8654. const l = 100 - Math.abs(t * (200 - e) / 100 - 100);
  8655. return [n, l !== 0 ? e * t / l : 0, t * (200 - e) / (2 * 100)];
  8656. }
  8657. function p(n) {
  8658. return [n[0], n[1], n[2]];
  8659. }
  8660. function f2(n, e) {
  8661. return [n[0], n[1], n[2], e];
  8662. }
  8663. const x = {
  8664. hsl: {
  8665. hsl: (n, e, t) => [n, e, t],
  8666. hsv: m,
  8667. rgb: Tr
  8668. },
  8669. hsv: {
  8670. hsl: o,
  8671. hsv: (n, e, t) => [n, e, t],
  8672. rgb: Ms
  8673. },
  8674. rgb: {
  8675. hsl: Pr,
  8676. hsv: kr,
  8677. rgb: (n, e, t) => [n, e, t]
  8678. }
  8679. };
  8680. function P(n, e) {
  8681. return [
  8682. e === "float" ? 1 : n === "rgb" ? 255 : 360,
  8683. e === "float" ? 1 : n === "rgb" ? 255 : 100,
  8684. e === "float" ? 1 : n === "rgb" ? 255 : 100
  8685. ];
  8686. }
  8687. function L2(n, e) {
  8688. return n === e ? e : Qt(n, e);
  8689. }
  8690. function z(n, e, t) {
  8691. var l;
  8692. const v = P(e, t);
  8693. return [
  8694. e === "rgb" ? Se(n[0], 0, v[0]) : L2(n[0], v[0]),
  8695. Se(n[1], 0, v[1]),
  8696. Se(n[2], 0, v[2]),
  8697. Se((l = n[3]) !== null && l !== void 0 ? l : 1, 0, 1)
  8698. ];
  8699. }
  8700. function oe(n, e, t, l) {
  8701. const v = P(e, t), E = P(e, l);
  8702. return n.map((k2, B2) => k2 / v[B2] * E[B2]);
  8703. }
  8704. function Qe2(n, e, t) {
  8705. const l = oe(n, e.mode, e.type, "int"), v = x[e.mode][t.mode](...l);
  8706. return oe(v, t.mode, "int", t.type);
  8707. }
  8708. function Ze2(n, e) {
  8709. return typeof n != "object" || _(n) ? false : e in n && typeof n[e] == "number";
  8710. }
  8711. class te2 {
  8712. static black(e = "int") {
  8713. return new te2([0, 0, 0], "rgb", e);
  8714. }
  8715. static fromObject(e, t = "int") {
  8716. const l = "a" in e ? [e.r, e.g, e.b, e.a] : [e.r, e.g, e.b];
  8717. return new te2(l, "rgb", t);
  8718. }
  8719. static toRgbaObject(e, t = "int") {
  8720. return e.toRgbaObject(t);
  8721. }
  8722. static isRgbColorObject(e) {
  8723. return Ze2(e, "r") && Ze2(e, "g") && Ze2(e, "b");
  8724. }
  8725. static isRgbaColorObject(e) {
  8726. return this.isRgbColorObject(e) && Ze2(e, "a");
  8727. }
  8728. static isColorObject(e) {
  8729. return this.isRgbColorObject(e);
  8730. }
  8731. static equals(e, t) {
  8732. if (e.mode !== t.mode)
  8733. return false;
  8734. const l = e.comps_, v = t.comps_;
  8735. for (let E = 0; E < l.length; E++)
  8736. if (l[E] !== v[E])
  8737. return false;
  8738. return true;
  8739. }
  8740. constructor(e, t, l = "int") {
  8741. this.mode = t, this.type = l, this.comps_ = z(e, t, l);
  8742. }
  8743. getComponents(e, t = "int") {
  8744. return f2(Qe2(p(this.comps_), { mode: this.mode, type: this.type }, { mode: e ?? this.mode, type: t }), this.comps_[3]);
  8745. }
  8746. toRgbaObject(e = "int") {
  8747. const t = this.getComponents("rgb", e);
  8748. return {
  8749. r: t[0],
  8750. g: t[1],
  8751. b: t[2],
  8752. a: t[3]
  8753. };
  8754. }
  8755. }
  8756. const Pt = D("colp");
  8757. class Mr {
  8758. constructor(e, t) {
  8759. this.alphaViews_ = null, this.element = e.createElement("div"), this.element.classList.add(Pt()), t.viewProps.bindClassModifiers(this.element);
  8760. const l = e.createElement("div");
  8761. l.classList.add(Pt("hsv"));
  8762. const v = e.createElement("div");
  8763. v.classList.add(Pt("sv")), this.svPaletteView_ = t.svPaletteView, v.appendChild(this.svPaletteView_.element), l.appendChild(v);
  8764. const E = e.createElement("div");
  8765. E.classList.add(Pt("h")), this.hPaletteView_ = t.hPaletteView, E.appendChild(this.hPaletteView_.element), l.appendChild(E), this.element.appendChild(l);
  8766. const k2 = e.createElement("div");
  8767. if (k2.classList.add(Pt("rgb")), this.textView_ = t.textView, k2.appendChild(this.textView_.element), this.element.appendChild(k2), t.alphaViews) {
  8768. this.alphaViews_ = {
  8769. palette: t.alphaViews.palette,
  8770. text: t.alphaViews.text
  8771. };
  8772. const B2 = e.createElement("div");
  8773. B2.classList.add(Pt("a"));
  8774. const Q = e.createElement("div");
  8775. Q.classList.add(Pt("ap")), Q.appendChild(this.alphaViews_.palette.element), B2.appendChild(Q);
  8776. const J = e.createElement("div");
  8777. J.classList.add(Pt("at")), J.appendChild(this.alphaViews_.text.element), B2.appendChild(J), this.element.appendChild(B2);
  8778. }
  8779. }
  8780. get allFocusableElements() {
  8781. const e = [
  8782. this.svPaletteView_.element,
  8783. this.hPaletteView_.element,
  8784. this.textView_.modeSelectElement,
  8785. ...this.textView_.textViews.map((t) => t.inputElement)
  8786. ];
  8787. return this.alphaViews_ && e.push(this.alphaViews_.palette.element, this.alphaViews_.text.inputElement), e;
  8788. }
  8789. }
  8790. function il(n) {
  8791. return n === "int" ? "int" : n === "float" ? "float" : void 0;
  8792. }
  8793. function Sr(n) {
  8794. const e = M;
  8795. return le2(n, {
  8796. alpha: e.optional.boolean,
  8797. color: e.optional.object({
  8798. alpha: e.optional.boolean,
  8799. type: e.optional.custom(il)
  8800. }),
  8801. expanded: e.optional.boolean,
  8802. picker: e.optional.custom(Oi)
  8803. });
  8804. }
  8805. function Tn(n) {
  8806. return n ? 0.1 : 1;
  8807. }
  8808. function kn(n) {
  8809. var e;
  8810. return (e = n.color) === null || e === void 0 ? void 0 : e.type;
  8811. }
  8812. function sl(n, e) {
  8813. return n.alpha === e.alpha && n.mode === e.mode && n.notation === e.notation && n.type === e.type;
  8814. }
  8815. function ct2(n, e) {
  8816. const t = n.match(/^(.+)%$/);
  8817. return Math.min(t ? parseFloat(t[1]) * 0.01 * e : parseFloat(n), e);
  8818. }
  8819. const rl = {
  8820. deg: (n) => n,
  8821. grad: (n) => n * 360 / 400,
  8822. rad: (n) => n * 360 / (2 * Math.PI),
  8823. turn: (n) => n * 360
  8824. };
  8825. function wo(n) {
  8826. const e = n.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);
  8827. if (!e)
  8828. return parseFloat(n);
  8829. const t = parseFloat(e[1]), l = e[2];
  8830. return rl[l](t);
  8831. }
  8832. function yo(n) {
  8833. const e = n.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8834. if (!e)
  8835. return null;
  8836. const t = [
  8837. ct2(e[1], 255),
  8838. ct2(e[2], 255),
  8839. ct2(e[3], 255)
  8840. ];
  8841. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8842. }
  8843. function xo(n) {
  8844. return (e) => {
  8845. const t = yo(e);
  8846. return t ? new te2(t, "rgb", n) : null;
  8847. };
  8848. }
  8849. function Eo(n) {
  8850. const e = n.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8851. if (!e)
  8852. return null;
  8853. const t = [
  8854. ct2(e[1], 255),
  8855. ct2(e[2], 255),
  8856. ct2(e[3], 255),
  8857. ct2(e[4], 1)
  8858. ];
  8859. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8860. }
  8861. function Co(n) {
  8862. return (e) => {
  8863. const t = Eo(e);
  8864. return t ? new te2(t, "rgb", n) : null;
  8865. };
  8866. }
  8867. function Po(n) {
  8868. const e = n.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8869. if (!e)
  8870. return null;
  8871. const t = [
  8872. wo(e[1]),
  8873. ct2(e[2], 100),
  8874. ct2(e[3], 100)
  8875. ];
  8876. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8877. }
  8878. function To(n) {
  8879. return (e) => {
  8880. const t = Po(e);
  8881. return t ? new te2(t, "hsl", n) : null;
  8882. };
  8883. }
  8884. function ko(n) {
  8885. const e = n.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8886. if (!e)
  8887. return null;
  8888. const t = [
  8889. wo(e[1]),
  8890. ct2(e[2], 100),
  8891. ct2(e[3], 100),
  8892. ct2(e[4], 1)
  8893. ];
  8894. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8895. }
  8896. function Mo(n) {
  8897. return (e) => {
  8898. const t = ko(e);
  8899. return t ? new te2(t, "hsl", n) : null;
  8900. };
  8901. }
  8902. function So(n) {
  8903. const e = n.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8904. if (e)
  8905. return [
  8906. parseInt(e[1] + e[1], 16),
  8907. parseInt(e[2] + e[2], 16),
  8908. parseInt(e[3] + e[3], 16)
  8909. ];
  8910. const t = n.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8911. return t ? [
  8912. parseInt(t[1], 16),
  8913. parseInt(t[2], 16),
  8914. parseInt(t[3], 16)
  8915. ] : null;
  8916. }
  8917. function ol(n) {
  8918. const e = So(n);
  8919. return e ? new te2(e, "rgb", "int") : null;
  8920. }
  8921. function Ao(n) {
  8922. const e = n.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8923. if (e)
  8924. return [
  8925. parseInt(e[1] + e[1], 16),
  8926. parseInt(e[2] + e[2], 16),
  8927. parseInt(e[3] + e[3], 16),
  8928. _e(parseInt(e[4] + e[4], 16), 0, 255, 0, 1)
  8929. ];
  8930. const t = n.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8931. return t ? [
  8932. parseInt(t[1], 16),
  8933. parseInt(t[2], 16),
  8934. parseInt(t[3], 16),
  8935. _e(parseInt(t[4], 16), 0, 255, 0, 1)
  8936. ] : null;
  8937. }
  8938. function al(n) {
  8939. const e = Ao(n);
  8940. return e ? new te2(e, "rgb", "int") : null;
  8941. }
  8942. function Lo(n) {
  8943. const e = n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8944. if (!e)
  8945. return null;
  8946. const t = [
  8947. parseFloat(e[1]),
  8948. parseFloat(e[2]),
  8949. parseFloat(e[3])
  8950. ];
  8951. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8952. }
  8953. function Ro(n) {
  8954. return (e) => {
  8955. const t = Lo(e);
  8956. return t ? new te2(t, "rgb", n) : null;
  8957. };
  8958. }
  8959. function Io(n) {
  8960. const e = n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8961. if (!e)
  8962. return null;
  8963. const t = [
  8964. parseFloat(e[1]),
  8965. parseFloat(e[2]),
  8966. parseFloat(e[3]),
  8967. parseFloat(e[4])
  8968. ];
  8969. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8970. }
  8971. function Vo(n) {
  8972. return (e) => {
  8973. const t = Io(e);
  8974. return t ? new te2(t, "rgb", n) : null;
  8975. };
  8976. }
  8977. const ll = [
  8978. {
  8979. parser: So,
  8980. result: {
  8981. alpha: false,
  8982. mode: "rgb",
  8983. notation: "hex"
  8984. }
  8985. },
  8986. {
  8987. parser: Ao,
  8988. result: {
  8989. alpha: true,
  8990. mode: "rgb",
  8991. notation: "hex"
  8992. }
  8993. },
  8994. {
  8995. parser: yo,
  8996. result: {
  8997. alpha: false,
  8998. mode: "rgb",
  8999. notation: "func"
  9000. }
  9001. },
  9002. {
  9003. parser: Eo,
  9004. result: {
  9005. alpha: true,
  9006. mode: "rgb",
  9007. notation: "func"
  9008. }
  9009. },
  9010. {
  9011. parser: Po,
  9012. result: {
  9013. alpha: false,
  9014. mode: "hsl",
  9015. notation: "func"
  9016. }
  9017. },
  9018. {
  9019. parser: ko,
  9020. result: {
  9021. alpha: true,
  9022. mode: "hsl",
  9023. notation: "func"
  9024. }
  9025. },
  9026. {
  9027. parser: Lo,
  9028. result: {
  9029. alpha: false,
  9030. mode: "rgb",
  9031. notation: "object"
  9032. }
  9033. },
  9034. {
  9035. parser: Io,
  9036. result: {
  9037. alpha: true,
  9038. mode: "rgb",
  9039. notation: "object"
  9040. }
  9041. }
  9042. ];
  9043. function cl(n) {
  9044. return ll.reduce((e, { parser: t, result: l }) => e || (t(n) ? l : null), null);
  9045. }
  9046. function Ar(n, e = "int") {
  9047. const t = cl(n);
  9048. 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;
  9049. }
  9050. const Do = {
  9051. int: [
  9052. ol,
  9053. al,
  9054. xo("int"),
  9055. Co("int"),
  9056. To("int"),
  9057. Mo("int"),
  9058. Ro("int"),
  9059. Vo("int")
  9060. ],
  9061. float: [
  9062. xo("float"),
  9063. Co("float"),
  9064. To("float"),
  9065. Mo("float"),
  9066. Ro("float"),
  9067. Vo("float")
  9068. ]
  9069. };
  9070. function pl(n) {
  9071. const e = Do[n];
  9072. return (t) => {
  9073. if (typeof t != "string")
  9074. return te2.black(n);
  9075. const l = e.reduce((v, E) => v || E(t), null);
  9076. return l ?? te2.black(n);
  9077. };
  9078. }
  9079. function Lr(n) {
  9080. const e = Do[n];
  9081. return (t) => e.reduce((l, v) => l || v(t), null);
  9082. }
  9083. function Oo(n) {
  9084. const e = Se(Math.floor(n), 0, 255).toString(16);
  9085. return e.length === 1 ? `0${e}` : e;
  9086. }
  9087. function No(n, e = "#") {
  9088. const t = p(n.getComponents("rgb")).map(Oo).join("");
  9089. return `${e}${t}`;
  9090. }
  9091. function Rr(n, e = "#") {
  9092. const t = n.getComponents("rgb"), l = [t[0], t[1], t[2], t[3] * 255].map(Oo).join("");
  9093. return `${e}${l}`;
  9094. }
  9095. function Fo(n, e) {
  9096. const t = Re(e === "float" ? 2 : 0);
  9097. return `rgb(${p(n.getComponents("rgb", e)).map((v) => t(v)).join(", ")})`;
  9098. }
  9099. function ul(n) {
  9100. return (e) => Fo(e, n);
  9101. }
  9102. function Ss(n, e) {
  9103. const t = Re(2), l = Re(e === "float" ? 2 : 0);
  9104. return `rgba(${n.getComponents("rgb", e).map((E, k2) => (k2 === 3 ? t : l)(E)).join(", ")})`;
  9105. }
  9106. function hl(n) {
  9107. return (e) => Ss(e, n);
  9108. }
  9109. function dl(n) {
  9110. const e = [
  9111. Re(0),
  9112. _n,
  9113. _n
  9114. ];
  9115. return `hsl(${p(n.getComponents("hsl")).map((l, v) => e[v](l)).join(", ")})`;
  9116. }
  9117. function ml(n) {
  9118. const e = [
  9119. Re(0),
  9120. _n,
  9121. _n,
  9122. Re(2)
  9123. ];
  9124. return `hsla(${n.getComponents("hsl").map((l, v) => e[v](l)).join(", ")})`;
  9125. }
  9126. function Bo(n, e) {
  9127. const t = Re(e === "float" ? 2 : 0), l = ["r", "g", "b"];
  9128. return `{${p(n.getComponents("rgb", e)).map((E, k2) => `${l[k2]}: ${t(E)}`).join(", ")}}`;
  9129. }
  9130. function fl(n) {
  9131. return (e) => Bo(e, n);
  9132. }
  9133. function jo(n, e) {
  9134. const t = Re(2), l = Re(e === "float" ? 2 : 0), v = ["r", "g", "b", "a"];
  9135. return `{${n.getComponents("rgb", e).map((k2, B2) => {
  9136. const Q = B2 === 3 ? t : l;
  9137. return `${v[B2]}: ${Q(k2)}`;
  9138. }).join(", ")}}`;
  9139. }
  9140. function vl(n) {
  9141. return (e) => jo(e, n);
  9142. }
  9143. const bl = [
  9144. {
  9145. format: {
  9146. alpha: false,
  9147. mode: "rgb",
  9148. notation: "hex",
  9149. type: "int"
  9150. },
  9151. stringifier: No
  9152. },
  9153. {
  9154. format: {
  9155. alpha: true,
  9156. mode: "rgb",
  9157. notation: "hex",
  9158. type: "int"
  9159. },
  9160. stringifier: Rr
  9161. },
  9162. {
  9163. format: {
  9164. alpha: false,
  9165. mode: "hsl",
  9166. notation: "func",
  9167. type: "int"
  9168. },
  9169. stringifier: dl
  9170. },
  9171. {
  9172. format: {
  9173. alpha: true,
  9174. mode: "hsl",
  9175. notation: "func",
  9176. type: "int"
  9177. },
  9178. stringifier: ml
  9179. },
  9180. ...["int", "float"].reduce((n, e) => [
  9181. ...n,
  9182. {
  9183. format: {
  9184. alpha: false,
  9185. mode: "rgb",
  9186. notation: "func",
  9187. type: e
  9188. },
  9189. stringifier: ul(e)
  9190. },
  9191. {
  9192. format: {
  9193. alpha: true,
  9194. mode: "rgb",
  9195. notation: "func",
  9196. type: e
  9197. },
  9198. stringifier: hl(e)
  9199. },
  9200. {
  9201. format: {
  9202. alpha: false,
  9203. mode: "rgb",
  9204. notation: "object",
  9205. type: e
  9206. },
  9207. stringifier: fl(e)
  9208. },
  9209. {
  9210. format: {
  9211. alpha: true,
  9212. mode: "rgb",
  9213. notation: "object",
  9214. type: e
  9215. },
  9216. stringifier: vl(e)
  9217. }
  9218. ], [])
  9219. ];
  9220. function Ir(n) {
  9221. return bl.reduce((e, t) => e || (sl(t.format, n) ? t.stringifier : null), null);
  9222. }
  9223. const Bi = D("apl");
  9224. class gl {
  9225. constructor(e, t) {
  9226. 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(Bi()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  9227. const l = e.createElement("div");
  9228. l.classList.add(Bi("b")), this.element.appendChild(l);
  9229. const v = e.createElement("div");
  9230. v.classList.add(Bi("c")), l.appendChild(v), this.colorElem_ = v;
  9231. const E = e.createElement("div");
  9232. E.classList.add(Bi("m")), this.element.appendChild(E), this.markerElem_ = E;
  9233. const k2 = e.createElement("div");
  9234. k2.classList.add(Bi("p")), this.markerElem_.appendChild(k2), this.previewElem_ = k2, this.update_();
  9235. }
  9236. update_() {
  9237. const e = this.value.rawValue, t = e.getComponents("rgb"), l = new te2([t[0], t[1], t[2], 0], "rgb"), v = new te2([t[0], t[1], t[2], 255], "rgb"), E = [
  9238. "to right",
  9239. Ss(l),
  9240. Ss(v)
  9241. ];
  9242. this.colorElem_.style.background = `linear-gradient(${E.join(",")})`, this.previewElem_.style.backgroundColor = Ss(e);
  9243. const k2 = _e(t[3], 0, 1, 0, 100);
  9244. this.markerElem_.style.left = `${k2}%`;
  9245. }
  9246. onValueChange_() {
  9247. this.update_();
  9248. }
  9249. }
  9250. class _l {
  9251. constructor(e, t) {
  9252. 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 gl(e, {
  9253. value: this.value,
  9254. viewProps: this.viewProps
  9255. }), this.ptHandler_ = new Vt(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_);
  9256. }
  9257. handlePointerEvent_(e, t) {
  9258. if (!e.point)
  9259. return;
  9260. const l = e.point.x / e.bounds.width, v = this.value.rawValue, [E, k2, B2] = v.getComponents("hsv");
  9261. this.value.setRawValue(new te2([E, k2, B2, l], "hsv"), t);
  9262. }
  9263. onPointerDown_(e) {
  9264. this.handlePointerEvent_(e.data, {
  9265. forceEmit: false,
  9266. last: false
  9267. });
  9268. }
  9269. onPointerMove_(e) {
  9270. this.handlePointerEvent_(e.data, {
  9271. forceEmit: false,
  9272. last: false
  9273. });
  9274. }
  9275. onPointerUp_(e) {
  9276. this.handlePointerEvent_(e.data, {
  9277. forceEmit: true,
  9278. last: true
  9279. });
  9280. }
  9281. onKeyDown_(e) {
  9282. const t = Oe(Tn(true), lt2(e));
  9283. if (t === 0)
  9284. return;
  9285. const l = this.value.rawValue, [v, E, k2, B2] = l.getComponents("hsv");
  9286. this.value.setRawValue(new te2([v, E, k2, B2 + t], "hsv"), {
  9287. forceEmit: false,
  9288. last: false
  9289. });
  9290. }
  9291. onKeyUp_(e) {
  9292. Oe(Tn(true), lt2(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  9293. forceEmit: true,
  9294. last: true
  9295. });
  9296. }
  9297. }
  9298. const ii = D("coltxt");
  9299. function wl(n) {
  9300. const e = n.createElement("select"), t = [
  9301. { text: "RGB", value: "rgb" },
  9302. { text: "HSL", value: "hsl" },
  9303. { text: "HSV", value: "hsv" }
  9304. ];
  9305. return e.appendChild(t.reduce((l, v) => {
  9306. const E = n.createElement("option");
  9307. return E.textContent = v.text, E.value = v.value, l.appendChild(E), l;
  9308. }, n.createDocumentFragment())), e;
  9309. }
  9310. class yl {
  9311. constructor(e, t) {
  9312. this.element = e.createElement("div"), this.element.classList.add(ii()), t.viewProps.bindClassModifiers(this.element);
  9313. const l = e.createElement("div");
  9314. l.classList.add(ii("m")), this.modeElem_ = wl(e), this.modeElem_.classList.add(ii("ms")), l.appendChild(this.modeSelectElement), t.viewProps.bindDisabled(this.modeElem_);
  9315. const v = e.createElement("div");
  9316. v.classList.add(ii("mm")), v.appendChild(yt(e, "dropdown")), l.appendChild(v), this.element.appendChild(l);
  9317. const E = e.createElement("div");
  9318. E.classList.add(ii("w")), this.element.appendChild(E), this.textsElem_ = E, this.textViews_ = t.textViews, this.applyTextViews_(), N(t.colorMode, (k2) => {
  9319. this.modeElem_.value = k2;
  9320. });
  9321. }
  9322. get modeSelectElement() {
  9323. return this.modeElem_;
  9324. }
  9325. get textViews() {
  9326. return this.textViews_;
  9327. }
  9328. set textViews(e) {
  9329. this.textViews_ = e, this.applyTextViews_();
  9330. }
  9331. applyTextViews_() {
  9332. cn(this.textsElem_);
  9333. const e = this.element.ownerDocument;
  9334. this.textViews_.forEach((t) => {
  9335. const l = e.createElement("div");
  9336. l.classList.add(ii("c")), l.appendChild(t.element), this.textsElem_.appendChild(l);
  9337. });
  9338. }
  9339. }
  9340. function xl(n) {
  9341. return Re(n === "float" ? 2 : 0);
  9342. }
  9343. function El(n, e, t) {
  9344. const l = P(n, e)[t];
  9345. return new Xt({
  9346. min: 0,
  9347. max: l
  9348. });
  9349. }
  9350. function Vr(n, e, t) {
  9351. return new yn(n, {
  9352. arrayPosition: t === 0 ? "fst" : t === 3 - 1 ? "lst" : "mid",
  9353. baseStep: Tn(false),
  9354. parser: e.parser,
  9355. props: X.fromObject({
  9356. draggingScale: e.colorType === "float" ? 0.01 : 1,
  9357. formatter: xl(e.colorType)
  9358. }),
  9359. value: ee2(0, {
  9360. constraint: El(e.colorMode, e.colorType, t)
  9361. }),
  9362. viewProps: e.viewProps
  9363. });
  9364. }
  9365. class Cl {
  9366. constructor(e, t) {
  9367. this.onModeSelectChange_ = this.onModeSelectChange_.bind(this), this.colorType_ = t.colorType, this.parser_ = t.parser, this.value = t.value, this.viewProps = t.viewProps, this.colorMode = ee2(this.value.rawValue.mode), this.ccs_ = this.createComponentControllers_(e), this.view = new yl(e, {
  9368. colorMode: this.colorMode,
  9369. textViews: [this.ccs_[0].view, this.ccs_[1].view, this.ccs_[2].view],
  9370. viewProps: this.viewProps
  9371. }), this.view.modeSelectElement.addEventListener("change", this.onModeSelectChange_);
  9372. }
  9373. createComponentControllers_(e) {
  9374. const t = {
  9375. colorMode: this.colorMode.rawValue,
  9376. colorType: this.colorType_,
  9377. parser: this.parser_,
  9378. viewProps: this.viewProps
  9379. }, l = [
  9380. Vr(e, t, 0),
  9381. Vr(e, t, 1),
  9382. Vr(e, t, 2)
  9383. ];
  9384. return l.forEach((v, E) => {
  9385. qt({
  9386. primary: this.value,
  9387. secondary: v.value,
  9388. forward: (k2) => k2.rawValue.getComponents(this.colorMode.rawValue, this.colorType_)[E],
  9389. backward: (k2, B2) => {
  9390. const Q = this.colorMode.rawValue, J = k2.rawValue.getComponents(Q, this.colorType_);
  9391. return J[E] = B2.rawValue, new te2(f2(p(J), J[3]), Q, this.colorType_);
  9392. }
  9393. });
  9394. }), l;
  9395. }
  9396. onModeSelectChange_(e) {
  9397. const t = e.currentTarget;
  9398. this.colorMode.rawValue = t.value, this.ccs_ = this.createComponentControllers_(this.view.element.ownerDocument), this.view.textViews = [
  9399. this.ccs_[0].view,
  9400. this.ccs_[1].view,
  9401. this.ccs_[2].view
  9402. ];
  9403. }
  9404. }
  9405. const Dr = D("hpl");
  9406. class Pl {
  9407. constructor(e, t) {
  9408. 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(Dr()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  9409. const l = e.createElement("div");
  9410. l.classList.add(Dr("c")), this.element.appendChild(l);
  9411. const v = e.createElement("div");
  9412. v.classList.add(Dr("m")), this.element.appendChild(v), this.markerElem_ = v, this.update_();
  9413. }
  9414. update_() {
  9415. const e = this.value.rawValue, [t] = e.getComponents("hsv");
  9416. this.markerElem_.style.backgroundColor = Fo(new te2([t, 100, 100], "hsv"));
  9417. const l = _e(t, 0, 360, 0, 100);
  9418. this.markerElem_.style.left = `${l}%`;
  9419. }
  9420. onValueChange_() {
  9421. this.update_();
  9422. }
  9423. }
  9424. class Tl {
  9425. constructor(e, t) {
  9426. 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 Pl(e, {
  9427. value: this.value,
  9428. viewProps: this.viewProps
  9429. }), this.ptHandler_ = new Vt(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_);
  9430. }
  9431. handlePointerEvent_(e, t) {
  9432. if (!e.point)
  9433. return;
  9434. const l = _e(Se(e.point.x, 0, e.bounds.width), 0, e.bounds.width, 0, 360), v = this.value.rawValue, [, E, k2, B2] = v.getComponents("hsv");
  9435. this.value.setRawValue(new te2([l, E, k2, B2], "hsv"), t);
  9436. }
  9437. onPointerDown_(e) {
  9438. this.handlePointerEvent_(e.data, {
  9439. forceEmit: false,
  9440. last: false
  9441. });
  9442. }
  9443. onPointerMove_(e) {
  9444. this.handlePointerEvent_(e.data, {
  9445. forceEmit: false,
  9446. last: false
  9447. });
  9448. }
  9449. onPointerUp_(e) {
  9450. this.handlePointerEvent_(e.data, {
  9451. forceEmit: true,
  9452. last: true
  9453. });
  9454. }
  9455. onKeyDown_(e) {
  9456. const t = Oe(Tn(false), lt2(e));
  9457. if (t === 0)
  9458. return;
  9459. const l = this.value.rawValue, [v, E, k2, B2] = l.getComponents("hsv");
  9460. this.value.setRawValue(new te2([v + t, E, k2, B2], "hsv"), {
  9461. forceEmit: false,
  9462. last: false
  9463. });
  9464. }
  9465. onKeyUp_(e) {
  9466. Oe(Tn(false), lt2(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  9467. forceEmit: true,
  9468. last: true
  9469. });
  9470. }
  9471. }
  9472. const Or = D("svp"), zo = 64;
  9473. class kl {
  9474. constructor(e, t) {
  9475. 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(Or()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  9476. const l = e.createElement("canvas");
  9477. l.height = zo, l.width = zo, l.classList.add(Or("c")), this.element.appendChild(l), this.canvasElement = l;
  9478. const v = e.createElement("div");
  9479. v.classList.add(Or("m")), this.element.appendChild(v), this.markerElem_ = v, this.update_();
  9480. }
  9481. update_() {
  9482. const e = Un(this.canvasElement);
  9483. if (!e)
  9484. return;
  9485. const l = this.value.rawValue.getComponents("hsv"), v = this.canvasElement.width, E = this.canvasElement.height, k2 = e.getImageData(0, 0, v, E), B2 = k2.data;
  9486. for (let de = 0; de < E; de++)
  9487. for (let ve = 0; ve < v; ve++) {
  9488. const Mn = _e(ve, 0, v, 0, 100), zi = _e(de, 0, E, 100, 0), Ui = Ms(l[0], Mn, zi), As = (de * v + ve) * 4;
  9489. B2[As] = Ui[0], B2[As + 1] = Ui[1], B2[As + 2] = Ui[2], B2[As + 3] = 255;
  9490. }
  9491. e.putImageData(k2, 0, 0);
  9492. const Q = _e(l[1], 0, 100, 0, 100);
  9493. this.markerElem_.style.left = `${Q}%`;
  9494. const J = _e(l[2], 0, 100, 100, 0);
  9495. this.markerElem_.style.top = `${J}%`;
  9496. }
  9497. onValueChange_() {
  9498. this.update_();
  9499. }
  9500. }
  9501. class Ml {
  9502. constructor(e, t) {
  9503. 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, {
  9504. value: this.value,
  9505. viewProps: this.viewProps
  9506. }), this.ptHandler_ = new Vt(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_);
  9507. }
  9508. handlePointerEvent_(e, t) {
  9509. if (!e.point)
  9510. return;
  9511. const l = _e(e.point.x, 0, e.bounds.width, 0, 100), v = _e(e.point.y, 0, e.bounds.height, 100, 0), [E, , , k2] = this.value.rawValue.getComponents("hsv");
  9512. this.value.setRawValue(new te2([E, l, v, k2], "hsv"), t);
  9513. }
  9514. onPointerDown_(e) {
  9515. this.handlePointerEvent_(e.data, {
  9516. forceEmit: false,
  9517. last: false
  9518. });
  9519. }
  9520. onPointerMove_(e) {
  9521. this.handlePointerEvent_(e.data, {
  9522. forceEmit: false,
  9523. last: false
  9524. });
  9525. }
  9526. onPointerUp_(e) {
  9527. this.handlePointerEvent_(e.data, {
  9528. forceEmit: true,
  9529. last: true
  9530. });
  9531. }
  9532. onKeyDown_(e) {
  9533. Jn(e.key) && e.preventDefault();
  9534. const [t, l, v, E] = this.value.rawValue.getComponents("hsv"), k2 = Tn(false), B2 = Oe(k2, lt2(e)), Q = Oe(k2, wn(e));
  9535. B2 === 0 && Q === 0 || this.value.setRawValue(new te2([t, l + B2, v + Q, E], "hsv"), {
  9536. forceEmit: false,
  9537. last: false
  9538. });
  9539. }
  9540. onKeyUp_(e) {
  9541. const t = Tn(false), l = Oe(t, lt2(e)), v = Oe(t, wn(e));
  9542. l === 0 && v === 0 || this.value.setRawValue(this.value.rawValue, {
  9543. forceEmit: true,
  9544. last: true
  9545. });
  9546. }
  9547. }
  9548. class Sl {
  9549. constructor(e, t) {
  9550. this.value = t.value, this.viewProps = t.viewProps, this.hPaletteC_ = new Tl(e, {
  9551. value: this.value,
  9552. viewProps: this.viewProps
  9553. }), this.svPaletteC_ = new Ml(e, {
  9554. value: this.value,
  9555. viewProps: this.viewProps
  9556. }), this.alphaIcs_ = t.supportsAlpha ? {
  9557. palette: new _l(e, {
  9558. value: this.value,
  9559. viewProps: this.viewProps
  9560. }),
  9561. text: new yn(e, {
  9562. parser: at2,
  9563. baseStep: 0.1,
  9564. props: X.fromObject({
  9565. draggingScale: 0.01,
  9566. formatter: Re(2)
  9567. }),
  9568. value: ee2(0, {
  9569. constraint: new Xt({ min: 0, max: 1 })
  9570. }),
  9571. viewProps: this.viewProps
  9572. })
  9573. } : null, this.alphaIcs_ && qt({
  9574. primary: this.value,
  9575. secondary: this.alphaIcs_.text.value,
  9576. forward: (l) => l.rawValue.getComponents()[3],
  9577. backward: (l, v) => {
  9578. const E = l.rawValue.getComponents();
  9579. return E[3] = v.rawValue, new te2(E, l.rawValue.mode);
  9580. }
  9581. }), this.textC_ = new Cl(e, {
  9582. colorType: t.colorType,
  9583. parser: at2,
  9584. value: this.value,
  9585. viewProps: this.viewProps
  9586. }), this.view = new Mr(e, {
  9587. alphaViews: this.alphaIcs_ ? {
  9588. palette: this.alphaIcs_.palette.view,
  9589. text: this.alphaIcs_.text.view
  9590. } : null,
  9591. hPaletteView: this.hPaletteC_.view,
  9592. supportsAlpha: t.supportsAlpha,
  9593. svPaletteView: this.svPaletteC_.view,
  9594. textView: this.textC_.view,
  9595. viewProps: this.viewProps
  9596. });
  9597. }
  9598. get textController() {
  9599. return this.textC_;
  9600. }
  9601. }
  9602. const Nr = D("colsw");
  9603. class Al {
  9604. constructor(e, t) {
  9605. 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(Nr()), t.viewProps.bindClassModifiers(this.element);
  9606. const l = e.createElement("div");
  9607. l.classList.add(Nr("sw")), this.element.appendChild(l), this.swatchElem_ = l;
  9608. const v = e.createElement("button");
  9609. v.classList.add(Nr("b")), t.viewProps.bindDisabled(v), this.element.appendChild(v), this.buttonElement = v, this.update_();
  9610. }
  9611. update_() {
  9612. const e = this.value.rawValue;
  9613. this.swatchElem_.style.backgroundColor = Rr(e);
  9614. }
  9615. onValueChange_() {
  9616. this.update_();
  9617. }
  9618. }
  9619. class Ll {
  9620. constructor(e, t) {
  9621. this.value = t.value, this.viewProps = t.viewProps, this.view = new Al(e, {
  9622. value: this.value,
  9623. viewProps: this.viewProps
  9624. });
  9625. }
  9626. }
  9627. class Fr {
  9628. constructor(e, t) {
  9629. 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_ = De.create(t.expanded), this.swatchC_ = new Ll(e, {
  9630. value: this.value,
  9631. viewProps: this.viewProps
  9632. });
  9633. const l = this.swatchC_.view.buttonElement;
  9634. l.addEventListener("blur", this.onButtonBlur_), l.addEventListener("click", this.onButtonClick_), this.textC_ = new Zn(e, {
  9635. parser: t.parser,
  9636. props: X.fromObject({
  9637. formatter: t.formatter
  9638. }),
  9639. value: this.value,
  9640. viewProps: this.viewProps
  9641. }), this.view = new Fi(e, {
  9642. foldable: this.foldable_,
  9643. pickerLayout: t.pickerLayout
  9644. }), this.view.swatchElement.appendChild(this.swatchC_.view.element), this.view.textElement.appendChild(this.textC_.view.element), this.popC_ = t.pickerLayout === "popup" ? new hs(e, {
  9645. viewProps: this.viewProps
  9646. }) : null;
  9647. const v = new Sl(e, {
  9648. colorType: t.colorType,
  9649. supportsAlpha: t.supportsAlpha,
  9650. value: this.value,
  9651. viewProps: this.viewProps
  9652. });
  9653. v.view.allFocusableElements.forEach((E) => {
  9654. E.addEventListener("blur", this.onPopupChildBlur_), E.addEventListener("keydown", this.onPopupChildKeydown_);
  9655. }), this.pickerC_ = v, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(v.view.element), qt({
  9656. primary: this.foldable_.value("expanded"),
  9657. secondary: this.popC_.shows,
  9658. forward: (E) => E.rawValue,
  9659. backward: (E, k2) => k2.rawValue
  9660. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ue(this.foldable_, this.view.pickerElement));
  9661. }
  9662. get textController() {
  9663. return this.textC_;
  9664. }
  9665. onButtonBlur_(e) {
  9666. if (!this.popC_)
  9667. return;
  9668. const t = this.view.element, l = e.relatedTarget;
  9669. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  9670. }
  9671. onButtonClick_() {
  9672. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  9673. }
  9674. onPopupChildBlur_(e) {
  9675. if (!this.popC_)
  9676. return;
  9677. const t = this.popC_.view.element, l = xt(e);
  9678. l && t.contains(l) || l && l === this.swatchC_.view.buttonElement && !mt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  9679. }
  9680. onPopupChildKeydown_(e) {
  9681. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.swatchC_.view.buttonElement.focus();
  9682. }
  9683. }
  9684. function Rl(n, e) {
  9685. return te2.isColorObject(n) ? te2.fromObject(n, e) : te2.black(e);
  9686. }
  9687. function Il(n) {
  9688. return p(n.getComponents("rgb")).reduce((e, t) => e << 8 | Math.floor(t) & 255, 0);
  9689. }
  9690. function Vl(n) {
  9691. return n.getComponents("rgb").reduce((e, t, l) => {
  9692. const v = Math.floor(l === 3 ? t * 255 : t) & 255;
  9693. return e << 8 | v;
  9694. }, 0) >>> 0;
  9695. }
  9696. function Dl(n) {
  9697. return new te2([n >> 16 & 255, n >> 8 & 255, n & 255], "rgb");
  9698. }
  9699. function Ol(n) {
  9700. return new te2([
  9701. n >> 24 & 255,
  9702. n >> 16 & 255,
  9703. n >> 8 & 255,
  9704. _e(n & 255, 0, 255, 0, 1)
  9705. ], "rgb");
  9706. }
  9707. function Nl(n) {
  9708. return typeof n != "number" ? te2.black() : Dl(n);
  9709. }
  9710. function Fl(n) {
  9711. return typeof n != "number" ? te2.black() : Ol(n);
  9712. }
  9713. function Bl(n) {
  9714. const e = Ir(n);
  9715. return e ? (t, l) => {
  9716. tt2(t, e(l));
  9717. } : null;
  9718. }
  9719. function jl(n) {
  9720. const e = n ? Vl : Il;
  9721. return (t, l) => {
  9722. tt2(t, e(l));
  9723. };
  9724. }
  9725. function zl(n, e, t) {
  9726. const l = e.toRgbaObject(t);
  9727. n.writeProperty("r", l.r), n.writeProperty("g", l.g), n.writeProperty("b", l.b), n.writeProperty("a", l.a);
  9728. }
  9729. function Ul(n, e, t) {
  9730. const l = e.toRgbaObject(t);
  9731. n.writeProperty("r", l.r), n.writeProperty("g", l.g), n.writeProperty("b", l.b);
  9732. }
  9733. function Gl(n, e) {
  9734. return (t, l) => {
  9735. n ? zl(t, l, e) : Ul(t, l, e);
  9736. };
  9737. }
  9738. function Br(n) {
  9739. var e;
  9740. return !!(n != null && n.alpha || !((e = n == null ? void 0 : n.color) === null || e === void 0) && e.alpha);
  9741. }
  9742. function Hl(n) {
  9743. return n ? (e) => Rr(e, "0x") : (e) => No(e, "0x");
  9744. }
  9745. function Kl(n) {
  9746. return "color" in n || "view" in n && n.view === "color";
  9747. }
  9748. const $l = {
  9749. id: "input-color-number",
  9750. type: "input",
  9751. accept: (n, e) => {
  9752. if (typeof n != "number" || !Kl(e))
  9753. return null;
  9754. const t = Sr(e);
  9755. return t ? {
  9756. initialValue: n,
  9757. params: t
  9758. } : null;
  9759. },
  9760. binding: {
  9761. reader: (n) => Br(n.params) ? Fl : Nl,
  9762. equals: te2.equals,
  9763. writer: (n) => jl(Br(n.params))
  9764. },
  9765. controller: (n) => {
  9766. const e = Br(n.params), t = "expanded" in n.params ? n.params.expanded : void 0, l = "picker" in n.params ? n.params.picker : void 0;
  9767. return new Fr(n.document, {
  9768. colorType: "int",
  9769. expanded: t ?? false,
  9770. formatter: Hl(e),
  9771. parser: Lr("int"),
  9772. pickerLayout: l ?? "popup",
  9773. supportsAlpha: e,
  9774. value: n.value,
  9775. viewProps: n.viewProps
  9776. });
  9777. }
  9778. };
  9779. function Xl(n) {
  9780. return te2.isRgbaColorObject(n);
  9781. }
  9782. function Yl(n) {
  9783. return (e) => Rl(e, n);
  9784. }
  9785. function ql(n, e) {
  9786. return (t) => n ? jo(t, e) : Bo(t, e);
  9787. }
  9788. const Ql = {
  9789. id: "input-color-object",
  9790. type: "input",
  9791. accept: (n, e) => {
  9792. if (!te2.isColorObject(n))
  9793. return null;
  9794. const t = Sr(e);
  9795. return t ? {
  9796. initialValue: n,
  9797. params: t
  9798. } : null;
  9799. },
  9800. binding: {
  9801. reader: (n) => Yl(kn(n.params)),
  9802. equals: te2.equals,
  9803. writer: (n) => Gl(Xl(n.initialValue), kn(n.params))
  9804. },
  9805. controller: (n) => {
  9806. var e;
  9807. const t = te2.isRgbaColorObject(n.initialValue), l = "expanded" in n.params ? n.params.expanded : void 0, v = "picker" in n.params ? n.params.picker : void 0, E = (e = kn(n.params)) !== null && e !== void 0 ? e : "int";
  9808. return new Fr(n.document, {
  9809. colorType: E,
  9810. expanded: l ?? false,
  9811. formatter: ql(t, E),
  9812. parser: Lr(E),
  9813. pickerLayout: v ?? "popup",
  9814. supportsAlpha: t,
  9815. value: n.value,
  9816. viewProps: n.viewProps
  9817. });
  9818. }
  9819. }, Zl = {
  9820. id: "input-color-string",
  9821. type: "input",
  9822. accept: (n, e) => {
  9823. if (typeof n != "string" || "view" in e && e.view === "text")
  9824. return null;
  9825. const t = Ar(n, kn(e));
  9826. if (!t || !Ir(t))
  9827. return null;
  9828. const v = Sr(e);
  9829. return v ? {
  9830. initialValue: n,
  9831. params: v
  9832. } : null;
  9833. },
  9834. binding: {
  9835. reader: (n) => {
  9836. var e;
  9837. return pl((e = kn(n.params)) !== null && e !== void 0 ? e : "int");
  9838. },
  9839. equals: te2.equals,
  9840. writer: (n) => {
  9841. const e = Ar(n.initialValue, kn(n.params));
  9842. if (!e)
  9843. throw S2.shouldNeverHappen();
  9844. const t = Bl(e);
  9845. if (!t)
  9846. throw S2.notBindable();
  9847. return t;
  9848. }
  9849. },
  9850. controller: (n) => {
  9851. const e = Ar(n.initialValue, kn(n.params));
  9852. if (!e)
  9853. throw S2.shouldNeverHappen();
  9854. const t = Ir(e);
  9855. if (!t)
  9856. throw S2.shouldNeverHappen();
  9857. const l = "expanded" in n.params ? n.params.expanded : void 0, v = "picker" in n.params ? n.params.picker : void 0;
  9858. return new Fr(n.document, {
  9859. colorType: e.type,
  9860. expanded: l ?? false,
  9861. formatter: t,
  9862. parser: Lr(e.type),
  9863. pickerLayout: v ?? "popup",
  9864. supportsAlpha: e.alpha,
  9865. value: n.value,
  9866. viewProps: n.viewProps
  9867. });
  9868. }
  9869. };
  9870. class Zt {
  9871. constructor(e) {
  9872. this.components = e.components, this.asm_ = e.assembly;
  9873. }
  9874. constrain(e) {
  9875. const t = this.asm_.toComponents(e).map((l, v) => {
  9876. var E, k2;
  9877. return (k2 = (E = this.components[v]) === null || E === void 0 ? void 0 : E.constrain(l)) !== null && k2 !== void 0 ? k2 : l;
  9878. });
  9879. return this.asm_.fromComponents(t);
  9880. }
  9881. }
  9882. const Uo = D("pndtxt");
  9883. class Wl {
  9884. constructor(e, t) {
  9885. this.textViews = t.textViews, this.element = e.createElement("div"), this.element.classList.add(Uo()), this.textViews.forEach((l) => {
  9886. const v = e.createElement("div");
  9887. v.classList.add(Uo("a")), v.appendChild(l.element), this.element.appendChild(v);
  9888. });
  9889. }
  9890. }
  9891. function Jl(n, e, t) {
  9892. return new yn(n, {
  9893. arrayPosition: t === 0 ? "fst" : t === e.axes.length - 1 ? "lst" : "mid",
  9894. baseStep: e.axes[t].baseStep,
  9895. parser: e.parser,
  9896. props: e.axes[t].textProps,
  9897. value: ee2(0, {
  9898. constraint: e.axes[t].constraint
  9899. }),
  9900. viewProps: e.viewProps
  9901. });
  9902. }
  9903. class jr {
  9904. constructor(e, t) {
  9905. this.value = t.value, this.viewProps = t.viewProps, this.acs_ = t.axes.map((l, v) => Jl(e, t, v)), this.acs_.forEach((l, v) => {
  9906. qt({
  9907. primary: this.value,
  9908. secondary: l.value,
  9909. forward: (E) => t.assembly.toComponents(E.rawValue)[v],
  9910. backward: (E, k2) => {
  9911. const B2 = t.assembly.toComponents(E.rawValue);
  9912. return B2[v] = k2.rawValue, t.assembly.fromComponents(B2);
  9913. }
  9914. });
  9915. }), this.view = new Wl(e, {
  9916. textViews: this.acs_.map((l) => l.view)
  9917. });
  9918. }
  9919. }
  9920. function Go(n, e) {
  9921. return "step" in n && !_(n.step) ? new Qn(n.step, e) : null;
  9922. }
  9923. function Ho(n) {
  9924. return !_(n.max) && !_(n.min) ? new Xt({
  9925. max: n.max,
  9926. min: n.min
  9927. }) : !_(n.max) || !_(n.min) ? new Ei({
  9928. max: n.max,
  9929. min: n.min
  9930. }) : null;
  9931. }
  9932. function ec(n) {
  9933. const e = et2(n, Xt);
  9934. if (e)
  9935. return [e.values.get("min"), e.values.get("max")];
  9936. const t = et2(n, Ei);
  9937. return t ? [t.minValue, t.maxValue] : [void 0, void 0];
  9938. }
  9939. function tc(n, e) {
  9940. const t = [], l = Go(n, e);
  9941. l && t.push(l);
  9942. const v = Ho(n);
  9943. v && t.push(v);
  9944. const E = Ni(n.options);
  9945. return E && t.push(E), new fn(t);
  9946. }
  9947. const nc = {
  9948. id: "input-number",
  9949. type: "input",
  9950. accept: (n, e) => {
  9951. if (typeof n != "number")
  9952. return null;
  9953. const t = M, l = le2(e, {
  9954. format: t.optional.function,
  9955. max: t.optional.number,
  9956. min: t.optional.number,
  9957. options: t.optional.custom(En),
  9958. step: t.optional.number
  9959. });
  9960. return l ? {
  9961. initialValue: n,
  9962. params: l
  9963. } : null;
  9964. },
  9965. binding: {
  9966. reader: (n) => vt,
  9967. constraint: (n) => tc(n.params, n.initialValue),
  9968. writer: (n) => tt2
  9969. },
  9970. controller: (n) => {
  9971. var e;
  9972. const t = n.value, l = n.constraint, v = l && et2(l, vn);
  9973. if (v)
  9974. return new bn(n.document, {
  9975. props: new X({
  9976. options: v.values.value("options")
  9977. }),
  9978. value: t,
  9979. viewProps: n.viewProps
  9980. });
  9981. const E = (e = "format" in n.params ? n.params.format : void 0) !== null && e !== void 0 ? e : Re(ti(l, t.rawValue)), k2 = l && et2(l, Xt);
  9982. return k2 ? new ei(n.document, {
  9983. baseStep: Dt(l),
  9984. parser: at2,
  9985. sliderProps: new X({
  9986. maxValue: k2.values.value("max"),
  9987. minValue: k2.values.value("min")
  9988. }),
  9989. textProps: X.fromObject({
  9990. draggingScale: Ot(l, t.rawValue),
  9991. formatter: E
  9992. }),
  9993. value: t,
  9994. viewProps: n.viewProps
  9995. }) : new yn(n.document, {
  9996. baseStep: Dt(l),
  9997. parser: at2,
  9998. props: X.fromObject({
  9999. draggingScale: Ot(l, t.rawValue),
  10000. formatter: E
  10001. }),
  10002. value: t,
  10003. viewProps: n.viewProps
  10004. });
  10005. }
  10006. };
  10007. class Wt {
  10008. constructor(e = 0, t = 0) {
  10009. this.x = e, this.y = t;
  10010. }
  10011. getComponents() {
  10012. return [this.x, this.y];
  10013. }
  10014. static isObject(e) {
  10015. if (_(e))
  10016. return false;
  10017. const t = e.x, l = e.y;
  10018. return !(typeof t != "number" || typeof l != "number");
  10019. }
  10020. static equals(e, t) {
  10021. return e.x === t.x && e.y === t.y;
  10022. }
  10023. toObject() {
  10024. return {
  10025. x: this.x,
  10026. y: this.y
  10027. };
  10028. }
  10029. }
  10030. const Ko = {
  10031. toComponents: (n) => n.getComponents(),
  10032. fromComponents: (n) => new Wt(...n)
  10033. }, si = D("p2d");
  10034. class ic {
  10035. constructor(e, t) {
  10036. this.element = e.createElement("div"), this.element.classList.add(si()), t.viewProps.bindClassModifiers(this.element), N(t.expanded, K(this.element, si(void 0, "expanded")));
  10037. const l = e.createElement("div");
  10038. l.classList.add(si("h")), this.element.appendChild(l);
  10039. const v = e.createElement("button");
  10040. v.classList.add(si("b")), v.appendChild(yt(e, "p2dpad")), t.viewProps.bindDisabled(v), l.appendChild(v), this.buttonElement = v;
  10041. const E = e.createElement("div");
  10042. if (E.classList.add(si("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  10043. const k2 = e.createElement("div");
  10044. k2.classList.add(si("p")), this.element.appendChild(k2), this.pickerElement = k2;
  10045. } else
  10046. this.pickerElement = null;
  10047. }
  10048. }
  10049. const Jt = D("p2dp");
  10050. class sc {
  10051. constructor(e, t) {
  10052. 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(Jt()), t.layout === "popup" && this.element.classList.add(Jt(void 0, "p")), t.viewProps.bindClassModifiers(this.element);
  10053. const l = e.createElement("div");
  10054. l.classList.add(Jt("p")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.padElement = l;
  10055. const v = e.createElementNS(ze, "svg");
  10056. v.classList.add(Jt("g")), this.padElement.appendChild(v), this.svgElem_ = v;
  10057. const E = e.createElementNS(ze, "line");
  10058. E.classList.add(Jt("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);
  10059. const k2 = e.createElementNS(ze, "line");
  10060. k2.classList.add(Jt("ax")), k2.setAttributeNS(null, "x1", "50%"), k2.setAttributeNS(null, "y1", "0"), k2.setAttributeNS(null, "x2", "50%"), k2.setAttributeNS(null, "y2", "100%"), this.svgElem_.appendChild(k2);
  10061. const B2 = e.createElementNS(ze, "line");
  10062. B2.classList.add(Jt("l")), B2.setAttributeNS(null, "x1", "50%"), B2.setAttributeNS(null, "y1", "50%"), this.svgElem_.appendChild(B2), this.lineElem_ = B2;
  10063. const Q = e.createElement("div");
  10064. Q.classList.add(Jt("m")), this.padElement.appendChild(Q), this.markerElem_ = Q, t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  10065. }
  10066. get allFocusableElements() {
  10067. return [this.padElement];
  10068. }
  10069. update_() {
  10070. const [e, t] = this.value.rawValue.getComponents(), l = this.maxValue_, v = _e(e, -l, +l, 0, 100), E = _e(t, -l, +l, 0, 100), k2 = this.invertsY_ ? 100 - E : E;
  10071. this.lineElem_.setAttributeNS(null, "x2", `${v}%`), this.lineElem_.setAttributeNS(null, "y2", `${k2}%`), this.markerElem_.style.left = `${v}%`, this.markerElem_.style.top = `${k2}%`;
  10072. }
  10073. onValueChange_() {
  10074. this.update_();
  10075. }
  10076. onFoldableChange_() {
  10077. this.update_();
  10078. }
  10079. }
  10080. function $o(n, e, t) {
  10081. return [
  10082. Oe(e[0], lt2(n)),
  10083. Oe(e[1], wn(n)) * (t ? 1 : -1)
  10084. ];
  10085. }
  10086. class rc {
  10087. constructor(e, t) {
  10088. 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 sc(e, {
  10089. invertsY: this.invertsY_,
  10090. layout: t.layout,
  10091. maxValue: this.maxValue_,
  10092. value: this.value,
  10093. viewProps: this.viewProps
  10094. }), this.ptHandler_ = new Vt(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_);
  10095. }
  10096. handlePointerEvent_(e, t) {
  10097. if (!e.point)
  10098. return;
  10099. const l = this.maxValue_, v = _e(e.point.x, 0, e.bounds.width, -l, +l), E = _e(this.invertsY_ ? e.bounds.height - e.point.y : e.point.y, 0, e.bounds.height, -l, +l);
  10100. this.value.setRawValue(new Wt(v, E), t);
  10101. }
  10102. onPointerDown_(e) {
  10103. this.handlePointerEvent_(e.data, {
  10104. forceEmit: false,
  10105. last: false
  10106. });
  10107. }
  10108. onPointerMove_(e) {
  10109. this.handlePointerEvent_(e.data, {
  10110. forceEmit: false,
  10111. last: false
  10112. });
  10113. }
  10114. onPointerUp_(e) {
  10115. this.handlePointerEvent_(e.data, {
  10116. forceEmit: true,
  10117. last: true
  10118. });
  10119. }
  10120. onPadKeyDown_(e) {
  10121. Jn(e.key) && e.preventDefault();
  10122. const [t, l] = $o(e, this.baseSteps_, this.invertsY_);
  10123. t === 0 && l === 0 || this.value.setRawValue(new Wt(this.value.rawValue.x + t, this.value.rawValue.y + l), {
  10124. forceEmit: false,
  10125. last: false
  10126. });
  10127. }
  10128. onPadKeyUp_(e) {
  10129. const [t, l] = $o(e, this.baseSteps_, this.invertsY_);
  10130. t === 0 && l === 0 || this.value.setRawValue(this.value.rawValue, {
  10131. forceEmit: true,
  10132. last: true
  10133. });
  10134. }
  10135. }
  10136. class oc {
  10137. constructor(e, t) {
  10138. var l, v;
  10139. 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_ = De.create(t.expanded), this.popC_ = t.pickerLayout === "popup" ? new hs(e, {
  10140. viewProps: this.viewProps
  10141. }) : null;
  10142. const E = new rc(e, {
  10143. baseSteps: [t.axes[0].baseStep, t.axes[1].baseStep],
  10144. invertsY: t.invertsY,
  10145. layout: t.pickerLayout,
  10146. maxValue: t.maxValue,
  10147. value: this.value,
  10148. viewProps: this.viewProps
  10149. });
  10150. E.view.allFocusableElements.forEach((k2) => {
  10151. k2.addEventListener("blur", this.onPopupChildBlur_), k2.addEventListener("keydown", this.onPopupChildKeydown_);
  10152. }), this.pickerC_ = E, this.textC_ = new jr(e, {
  10153. assembly: Ko,
  10154. axes: t.axes,
  10155. parser: t.parser,
  10156. value: this.value,
  10157. viewProps: this.viewProps
  10158. }), this.view = new ic(e, {
  10159. expanded: this.foldable_.value("expanded"),
  10160. pickerLayout: t.pickerLayout,
  10161. viewProps: this.viewProps
  10162. }), this.view.textElement.appendChild(this.textC_.view.element), (l = this.view.buttonElement) === null || l === void 0 || l.addEventListener("blur", this.onPadButtonBlur_), (v = this.view.buttonElement) === null || v === void 0 || v.addEventListener("click", this.onPadButtonClick_), this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), qt({
  10163. primary: this.foldable_.value("expanded"),
  10164. secondary: this.popC_.shows,
  10165. forward: (k2) => k2.rawValue,
  10166. backward: (k2, B2) => B2.rawValue
  10167. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ue(this.foldable_, this.view.pickerElement));
  10168. }
  10169. onPadButtonBlur_(e) {
  10170. if (!this.popC_)
  10171. return;
  10172. const t = this.view.element, l = e.relatedTarget;
  10173. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  10174. }
  10175. onPadButtonClick_() {
  10176. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  10177. }
  10178. onPopupChildBlur_(e) {
  10179. if (!this.popC_)
  10180. return;
  10181. const t = this.popC_.view.element, l = xt(e);
  10182. l && t.contains(l) || l && l === this.view.buttonElement && !mt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  10183. }
  10184. onPopupChildKeydown_(e) {
  10185. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.view.buttonElement.focus();
  10186. }
  10187. }
  10188. class ri {
  10189. constructor(e = 0, t = 0, l = 0) {
  10190. this.x = e, this.y = t, this.z = l;
  10191. }
  10192. getComponents() {
  10193. return [this.x, this.y, this.z];
  10194. }
  10195. static isObject(e) {
  10196. if (_(e))
  10197. return false;
  10198. const t = e.x, l = e.y, v = e.z;
  10199. return !(typeof t != "number" || typeof l != "number" || typeof v != "number");
  10200. }
  10201. static equals(e, t) {
  10202. return e.x === t.x && e.y === t.y && e.z === t.z;
  10203. }
  10204. toObject() {
  10205. return {
  10206. x: this.x,
  10207. y: this.y,
  10208. z: this.z
  10209. };
  10210. }
  10211. }
  10212. const Xo = {
  10213. toComponents: (n) => n.getComponents(),
  10214. fromComponents: (n) => new ri(...n)
  10215. };
  10216. function ac(n) {
  10217. return ri.isObject(n) ? new ri(n.x, n.y, n.z) : new ri();
  10218. }
  10219. function lc(n, e) {
  10220. n.writeProperty("x", e.x), n.writeProperty("y", e.y), n.writeProperty("z", e.z);
  10221. }
  10222. function cc(n, e) {
  10223. return new Zt({
  10224. assembly: Xo,
  10225. components: [
  10226. Ft("x" in n ? n.x : void 0, e.x),
  10227. Ft("y" in n ? n.y : void 0, e.y),
  10228. Ft("z" in n ? n.z : void 0, e.z)
  10229. ]
  10230. });
  10231. }
  10232. function zr(n, e) {
  10233. return {
  10234. baseStep: Dt(e),
  10235. constraint: e,
  10236. textProps: X.fromObject({
  10237. draggingScale: Ot(e, n),
  10238. formatter: Re(ti(e, n))
  10239. })
  10240. };
  10241. }
  10242. const pc = {
  10243. id: "input-point3d",
  10244. type: "input",
  10245. accept: (n, e) => {
  10246. if (!ri.isObject(n))
  10247. return null;
  10248. const t = M, l = le2(e, {
  10249. x: t.optional.custom(bt),
  10250. y: t.optional.custom(bt),
  10251. z: t.optional.custom(bt)
  10252. });
  10253. return l ? {
  10254. initialValue: n,
  10255. params: l
  10256. } : null;
  10257. },
  10258. binding: {
  10259. reader: (n) => ac,
  10260. constraint: (n) => cc(n.params, n.initialValue),
  10261. equals: ri.equals,
  10262. writer: (n) => lc
  10263. },
  10264. controller: (n) => {
  10265. const e = n.value, t = n.constraint;
  10266. if (!(t instanceof Zt))
  10267. throw S2.shouldNeverHappen();
  10268. return new jr(n.document, {
  10269. assembly: Xo,
  10270. axes: [
  10271. zr(e.rawValue.x, t.components[0]),
  10272. zr(e.rawValue.y, t.components[1]),
  10273. zr(e.rawValue.z, t.components[2])
  10274. ],
  10275. parser: at2,
  10276. value: e,
  10277. viewProps: n.viewProps
  10278. });
  10279. }
  10280. };
  10281. class oi {
  10282. constructor(e = 0, t = 0, l = 0, v = 0) {
  10283. this.x = e, this.y = t, this.z = l, this.w = v;
  10284. }
  10285. getComponents() {
  10286. return [this.x, this.y, this.z, this.w];
  10287. }
  10288. static isObject(e) {
  10289. if (_(e))
  10290. return false;
  10291. const t = e.x, l = e.y, v = e.z, E = e.w;
  10292. return !(typeof t != "number" || typeof l != "number" || typeof v != "number" || typeof E != "number");
  10293. }
  10294. static equals(e, t) {
  10295. return e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w;
  10296. }
  10297. toObject() {
  10298. return {
  10299. x: this.x,
  10300. y: this.y,
  10301. z: this.z,
  10302. w: this.w
  10303. };
  10304. }
  10305. }
  10306. const Yo = {
  10307. toComponents: (n) => n.getComponents(),
  10308. fromComponents: (n) => new oi(...n)
  10309. };
  10310. function uc(n) {
  10311. return oi.isObject(n) ? new oi(n.x, n.y, n.z, n.w) : new oi();
  10312. }
  10313. function hc(n, e) {
  10314. n.writeProperty("x", e.x), n.writeProperty("y", e.y), n.writeProperty("z", e.z), n.writeProperty("w", e.w);
  10315. }
  10316. function dc(n, e) {
  10317. return new Zt({
  10318. assembly: Yo,
  10319. components: [
  10320. Ft("x" in n ? n.x : void 0, e.x),
  10321. Ft("y" in n ? n.y : void 0, e.y),
  10322. Ft("z" in n ? n.z : void 0, e.z),
  10323. Ft("w" in n ? n.w : void 0, e.w)
  10324. ]
  10325. });
  10326. }
  10327. function mc(n, e) {
  10328. return {
  10329. baseStep: Dt(e),
  10330. constraint: e,
  10331. textProps: X.fromObject({
  10332. draggingScale: Ot(e, n),
  10333. formatter: Re(ti(e, n))
  10334. })
  10335. };
  10336. }
  10337. const fc = {
  10338. id: "input-point4d",
  10339. type: "input",
  10340. accept: (n, e) => {
  10341. if (!oi.isObject(n))
  10342. return null;
  10343. const t = M, l = le2(e, {
  10344. x: t.optional.custom(bt),
  10345. y: t.optional.custom(bt),
  10346. z: t.optional.custom(bt),
  10347. w: t.optional.custom(bt)
  10348. });
  10349. return l ? {
  10350. initialValue: n,
  10351. params: l
  10352. } : null;
  10353. },
  10354. binding: {
  10355. reader: (n) => uc,
  10356. constraint: (n) => dc(n.params, n.initialValue),
  10357. equals: oi.equals,
  10358. writer: (n) => hc
  10359. },
  10360. controller: (n) => {
  10361. const e = n.value, t = n.constraint;
  10362. if (!(t instanceof Zt))
  10363. throw S2.shouldNeverHappen();
  10364. return new jr(n.document, {
  10365. assembly: Yo,
  10366. axes: e.rawValue.getComponents().map((l, v) => mc(l, t.components[v])),
  10367. parser: at2,
  10368. value: e,
  10369. viewProps: n.viewProps
  10370. });
  10371. }
  10372. };
  10373. function vc(n) {
  10374. const e = [], t = Ni(n.options);
  10375. return t && e.push(t), new fn(e);
  10376. }
  10377. const bc = {
  10378. id: "input-string",
  10379. type: "input",
  10380. accept: (n, e) => {
  10381. if (typeof n != "string")
  10382. return null;
  10383. const l = le2(e, {
  10384. options: M.optional.custom(En)
  10385. });
  10386. return l ? {
  10387. initialValue: n,
  10388. params: l
  10389. } : null;
  10390. },
  10391. binding: {
  10392. reader: (n) => Si,
  10393. constraint: (n) => vc(n.params),
  10394. writer: (n) => tt2
  10395. },
  10396. controller: (n) => {
  10397. const e = n.document, t = n.value, l = n.constraint, v = l && et2(l, vn);
  10398. return v ? new bn(e, {
  10399. props: new X({
  10400. options: v.values.value("options")
  10401. }),
  10402. value: t,
  10403. viewProps: n.viewProps
  10404. }) : new Zn(e, {
  10405. parser: (E) => E,
  10406. props: X.fromObject({
  10407. formatter: Ct
  10408. }),
  10409. value: t,
  10410. viewProps: n.viewProps
  10411. });
  10412. }
  10413. }, ji = {
  10414. monitor: {
  10415. defaultInterval: 200,
  10416. defaultLineCount: 3
  10417. }
  10418. }, qo = D("mll");
  10419. class gc {
  10420. constructor(e, t) {
  10421. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(qo()), t.viewProps.bindClassModifiers(this.element);
  10422. const l = e.createElement("textarea");
  10423. l.classList.add(qo("i")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, l.readOnly = true, t.viewProps.bindDisabled(l), this.element.appendChild(l), this.textareaElem_ = l, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  10424. }
  10425. update_() {
  10426. const e = this.textareaElem_, t = e.scrollTop === e.scrollHeight - e.clientHeight, l = [];
  10427. this.value.rawValue.forEach((v) => {
  10428. v !== void 0 && l.push(this.formatter_(v));
  10429. }), e.textContent = l.join(`
  10430. `), t && (e.scrollTop = e.scrollHeight);
  10431. }
  10432. onValueUpdate_() {
  10433. this.update_();
  10434. }
  10435. }
  10436. class Ur {
  10437. constructor(e, t) {
  10438. this.value = t.value, this.viewProps = t.viewProps, this.view = new gc(e, {
  10439. formatter: t.formatter,
  10440. lineCount: t.lineCount,
  10441. value: this.value,
  10442. viewProps: this.viewProps
  10443. });
  10444. }
  10445. }
  10446. const Qo = D("sgl");
  10447. class _c {
  10448. constructor(e, t) {
  10449. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(Qo()), t.viewProps.bindClassModifiers(this.element);
  10450. const l = e.createElement("input");
  10451. l.classList.add(Qo("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_();
  10452. }
  10453. update_() {
  10454. const e = this.value.rawValue, t = e[e.length - 1];
  10455. this.inputElement.value = t !== void 0 ? this.formatter_(t) : "";
  10456. }
  10457. onValueUpdate_() {
  10458. this.update_();
  10459. }
  10460. }
  10461. class Gr {
  10462. constructor(e, t) {
  10463. this.value = t.value, this.viewProps = t.viewProps, this.view = new _c(e, {
  10464. formatter: t.formatter,
  10465. value: this.value,
  10466. viewProps: this.viewProps
  10467. });
  10468. }
  10469. }
  10470. const wc = {
  10471. id: "monitor-bool",
  10472. type: "monitor",
  10473. accept: (n, e) => {
  10474. if (typeof n != "boolean")
  10475. return null;
  10476. const l = le2(e, {
  10477. lineCount: M.optional.number
  10478. });
  10479. return l ? {
  10480. initialValue: n,
  10481. params: l
  10482. } : null;
  10483. },
  10484. binding: {
  10485. reader: (n) => ms
  10486. },
  10487. controller: (n) => {
  10488. var e;
  10489. return n.value.rawValue.length === 1 ? new Gr(n.document, {
  10490. formatter: fs,
  10491. value: n.value,
  10492. viewProps: n.viewProps
  10493. }) : new Ur(n.document, {
  10494. formatter: fs,
  10495. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  10496. value: n.value,
  10497. viewProps: n.viewProps
  10498. });
  10499. }
  10500. }, en = D("grl");
  10501. class yc {
  10502. constructor(e, t) {
  10503. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = e.createElement("div"), this.element.classList.add(en()), t.viewProps.bindClassModifiers(this.element), this.formatter_ = t.formatter, this.props_ = t.props, this.cursor_ = t.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  10504. const l = e.createElementNS(ze, "svg");
  10505. l.classList.add(en("g")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, this.element.appendChild(l), this.svgElem_ = l;
  10506. const v = e.createElementNS(ze, "polyline");
  10507. this.svgElem_.appendChild(v), this.lineElem_ = v;
  10508. const E = e.createElement("div");
  10509. E.classList.add(en("t"), D("tt")()), this.element.appendChild(E), this.tooltipElem_ = E, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  10510. }
  10511. get graphElement() {
  10512. return this.svgElem_;
  10513. }
  10514. update_() {
  10515. const e = this.svgElem_.getBoundingClientRect(), t = this.value.rawValue.length - 1, l = this.props_.get("minValue"), v = this.props_.get("maxValue"), E = [];
  10516. this.value.rawValue.forEach((de, ve) => {
  10517. if (de === void 0)
  10518. return;
  10519. const Mn = _e(ve, 0, t, 0, e.width), zi = _e(de, l, v, e.height, 0);
  10520. E.push([Mn, zi].join(","));
  10521. }), this.lineElem_.setAttributeNS(null, "points", E.join(" "));
  10522. const k2 = this.tooltipElem_, B2 = this.value.rawValue[this.cursor_.rawValue];
  10523. if (B2 === void 0) {
  10524. k2.classList.remove(en("t", "a"));
  10525. return;
  10526. }
  10527. const Q = _e(this.cursor_.rawValue, 0, t, 0, e.width), J = _e(B2, l, v, e.height, 0);
  10528. k2.style.left = `${Q}px`, k2.style.top = `${J}px`, k2.textContent = `${this.formatter_(B2)}`, k2.classList.contains(en("t", "a")) || (k2.classList.add(en("t", "a"), en("t", "in")), st2(k2), k2.classList.remove(en("t", "in")));
  10529. }
  10530. onValueUpdate_() {
  10531. this.update_();
  10532. }
  10533. onCursorChange_() {
  10534. this.update_();
  10535. }
  10536. }
  10537. class xc {
  10538. constructor(e, t) {
  10539. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = t.props, this.value = t.value, this.viewProps = t.viewProps, this.cursor_ = ee2(-1), this.view = new yc(e, {
  10540. cursor: this.cursor_,
  10541. formatter: t.formatter,
  10542. lineCount: t.lineCount,
  10543. props: this.props_,
  10544. value: this.value,
  10545. viewProps: this.viewProps
  10546. }), !mt(e))
  10547. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  10548. else {
  10549. const l = new Vt(this.view.element);
  10550. l.emitter.on("down", this.onGraphPointerDown_), l.emitter.on("move", this.onGraphPointerMove_), l.emitter.on("up", this.onGraphPointerUp_);
  10551. }
  10552. }
  10553. onGraphMouseLeave_() {
  10554. this.cursor_.rawValue = -1;
  10555. }
  10556. onGraphMouseMove_(e) {
  10557. const t = this.view.element.getBoundingClientRect();
  10558. this.cursor_.rawValue = Math.floor(_e(e.offsetX, 0, t.width, 0, this.value.rawValue.length));
  10559. }
  10560. onGraphPointerDown_(e) {
  10561. this.onGraphPointerMove_(e);
  10562. }
  10563. onGraphPointerMove_(e) {
  10564. if (!e.data.point) {
  10565. this.cursor_.rawValue = -1;
  10566. return;
  10567. }
  10568. this.cursor_.rawValue = Math.floor(_e(e.data.point.x, 0, e.data.bounds.width, 0, this.value.rawValue.length));
  10569. }
  10570. onGraphPointerUp_() {
  10571. this.cursor_.rawValue = -1;
  10572. }
  10573. }
  10574. function Hr(n) {
  10575. return "format" in n && !_(n.format) ? n.format : Re(2);
  10576. }
  10577. function Ec(n) {
  10578. var e;
  10579. return n.value.rawValue.length === 1 ? new Gr(n.document, {
  10580. formatter: Hr(n.params),
  10581. value: n.value,
  10582. viewProps: n.viewProps
  10583. }) : new Ur(n.document, {
  10584. formatter: Hr(n.params),
  10585. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  10586. value: n.value,
  10587. viewProps: n.viewProps
  10588. });
  10589. }
  10590. function Cc(n) {
  10591. var e, t, l;
  10592. return new xc(n.document, {
  10593. formatter: Hr(n.params),
  10594. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  10595. props: X.fromObject({
  10596. maxValue: (t = "max" in n.params ? n.params.max : null) !== null && t !== void 0 ? t : 100,
  10597. minValue: (l = "min" in n.params ? n.params.min : null) !== null && l !== void 0 ? l : 0
  10598. }),
  10599. value: n.value,
  10600. viewProps: n.viewProps
  10601. });
  10602. }
  10603. function Zo(n) {
  10604. return "view" in n && n.view === "graph";
  10605. }
  10606. const Pc = {
  10607. id: "monitor-number",
  10608. type: "monitor",
  10609. accept: (n, e) => {
  10610. if (typeof n != "number")
  10611. return null;
  10612. const t = M, l = le2(e, {
  10613. format: t.optional.function,
  10614. lineCount: t.optional.number,
  10615. max: t.optional.number,
  10616. min: t.optional.number,
  10617. view: t.optional.string
  10618. });
  10619. return l ? {
  10620. initialValue: n,
  10621. params: l
  10622. } : null;
  10623. },
  10624. binding: {
  10625. defaultBufferSize: (n) => Zo(n) ? 64 : 1,
  10626. reader: (n) => vt
  10627. },
  10628. controller: (n) => Zo(n.params) ? Cc(n) : Ec(n)
  10629. }, Tc = {
  10630. id: "monitor-string",
  10631. type: "monitor",
  10632. accept: (n, e) => {
  10633. if (typeof n != "string")
  10634. return null;
  10635. const t = M, l = le2(e, {
  10636. lineCount: t.optional.number,
  10637. multiline: t.optional.boolean
  10638. });
  10639. return l ? {
  10640. initialValue: n,
  10641. params: l
  10642. } : null;
  10643. },
  10644. binding: {
  10645. reader: (n) => Si
  10646. },
  10647. controller: (n) => {
  10648. var e;
  10649. const t = n.value;
  10650. return t.rawValue.length > 1 || "multiline" in n.params && n.params.multiline ? new Ur(n.document, {
  10651. formatter: Ct,
  10652. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  10653. value: t,
  10654. viewProps: n.viewProps
  10655. }) : new Gr(n.document, {
  10656. formatter: Ct,
  10657. value: t,
  10658. viewProps: n.viewProps
  10659. });
  10660. }
  10661. };
  10662. function kc(n, e) {
  10663. var t;
  10664. const l = n.accept(e.target.read(), e.params);
  10665. if (_(l))
  10666. return null;
  10667. const v = M, E = {
  10668. target: e.target,
  10669. initialValue: l.initialValue,
  10670. params: l.params
  10671. }, k2 = n.binding.reader(E), B2 = n.binding.constraint ? n.binding.constraint(E) : void 0, Q = ee2(k2(l.initialValue), {
  10672. constraint: B2,
  10673. equals: n.binding.equals
  10674. }), J = new qn({
  10675. reader: k2,
  10676. target: e.target,
  10677. value: Q,
  10678. writer: n.binding.writer(E)
  10679. }), de = v.optional.boolean(e.params.disabled).value, ve = v.optional.boolean(e.params.hidden).value, Mn = n.controller({
  10680. constraint: B2,
  10681. document: e.document,
  10682. initialValue: l.initialValue,
  10683. params: l.params,
  10684. value: J.value,
  10685. viewProps: Xe2.create({
  10686. disabled: de,
  10687. hidden: ve
  10688. })
  10689. });
  10690. return new Fe(e.document, {
  10691. binding: J,
  10692. blade: ye(),
  10693. props: X.fromObject({
  10694. label: "label" in e.params ? (t = v.optional.string(e.params.label).value) !== null && t !== void 0 ? t : null : e.target.key
  10695. }),
  10696. valueController: Mn
  10697. });
  10698. }
  10699. function Mc(n, e) {
  10700. return e === 0 ? new ls() : new xi(n, e ?? ji.monitor.defaultInterval);
  10701. }
  10702. function Sc(n, e) {
  10703. var t, l, v;
  10704. const E = M, k2 = n.accept(e.target.read(), e.params);
  10705. if (_(k2))
  10706. return null;
  10707. const B2 = {
  10708. target: e.target,
  10709. initialValue: k2.initialValue,
  10710. params: k2.params
  10711. }, Q = n.binding.reader(B2), J = (l = (t = E.optional.number(e.params.bufferSize).value) !== null && t !== void 0 ? t : n.binding.defaultBufferSize && n.binding.defaultBufferSize(k2.params)) !== null && l !== void 0 ? l : 1, de = E.optional.number(e.params.interval).value, ve = new rr({
  10712. reader: Q,
  10713. target: e.target,
  10714. ticker: Mc(e.document, de),
  10715. value: cs(J)
  10716. }), Mn = E.optional.boolean(e.params.disabled).value, zi = E.optional.boolean(e.params.hidden).value, Ui = n.controller({
  10717. document: e.document,
  10718. params: k2.params,
  10719. value: ve.value,
  10720. viewProps: Xe2.create({
  10721. disabled: Mn,
  10722. hidden: zi
  10723. })
  10724. });
  10725. return new rt2(e.document, {
  10726. binding: ve,
  10727. blade: ye(),
  10728. props: X.fromObject({
  10729. label: "label" in e.params ? (v = E.optional.string(e.params.label).value) !== null && v !== void 0 ? v : null : e.target.key
  10730. }),
  10731. valueController: Ui
  10732. });
  10733. }
  10734. class Ac {
  10735. constructor() {
  10736. this.pluginsMap_ = {
  10737. blades: [],
  10738. inputs: [],
  10739. monitors: []
  10740. };
  10741. }
  10742. getAll() {
  10743. return [
  10744. ...this.pluginsMap_.blades,
  10745. ...this.pluginsMap_.inputs,
  10746. ...this.pluginsMap_.monitors
  10747. ];
  10748. }
  10749. register(e) {
  10750. e.type === "blade" ? this.pluginsMap_.blades.unshift(e) : e.type === "input" ? this.pluginsMap_.inputs.unshift(e) : e.type === "monitor" && this.pluginsMap_.monitors.unshift(e);
  10751. }
  10752. createInput(e, t, l) {
  10753. const v = t.read();
  10754. if (_(v))
  10755. throw new S2({
  10756. context: {
  10757. key: t.key
  10758. },
  10759. type: "nomatchingcontroller"
  10760. });
  10761. const E = this.pluginsMap_.inputs.reduce((k2, B2) => k2 ?? kc(B2, {
  10762. document: e,
  10763. target: t,
  10764. params: l
  10765. }), null);
  10766. if (E)
  10767. return E;
  10768. throw new S2({
  10769. context: {
  10770. key: t.key
  10771. },
  10772. type: "nomatchingcontroller"
  10773. });
  10774. }
  10775. createMonitor(e, t, l) {
  10776. const v = this.pluginsMap_.monitors.reduce((E, k2) => E ?? Sc(k2, {
  10777. document: e,
  10778. params: l,
  10779. target: t
  10780. }), null);
  10781. if (v)
  10782. return v;
  10783. throw new S2({
  10784. context: {
  10785. key: t.key
  10786. },
  10787. type: "nomatchingcontroller"
  10788. });
  10789. }
  10790. createBlade(e, t) {
  10791. const l = this.pluginsMap_.blades.reduce((v, E) => v ?? sr(E, {
  10792. document: e,
  10793. params: t
  10794. }), null);
  10795. if (!l)
  10796. throw new S2({
  10797. type: "nomatchingview",
  10798. context: {
  10799. params: t
  10800. }
  10801. });
  10802. return l;
  10803. }
  10804. createBladeApi(e) {
  10805. if (e instanceof Fe)
  10806. return new mi(e);
  10807. if (e instanceof rt2)
  10808. return new fi(e);
  10809. if (e instanceof hn)
  10810. return new $n(e, this);
  10811. const t = this.pluginsMap_.blades.reduce((l, v) => l ?? v.api({
  10812. controller: e,
  10813. pool: this
  10814. }), null);
  10815. if (!t)
  10816. throw S2.shouldNeverHappen();
  10817. return t;
  10818. }
  10819. }
  10820. function Lc() {
  10821. const n = new Ac();
  10822. return [
  10823. Nc,
  10824. pc,
  10825. fc,
  10826. bc,
  10827. nc,
  10828. Zl,
  10829. Ql,
  10830. $l,
  10831. ni,
  10832. wc,
  10833. Tc,
  10834. Pc,
  10835. W,
  10836. Js,
  10837. tr,
  10838. yi
  10839. ].forEach((e) => {
  10840. n.register(e);
  10841. }), n;
  10842. }
  10843. function Rc(n) {
  10844. return Wt.isObject(n) ? new Wt(n.x, n.y) : new Wt();
  10845. }
  10846. function Ic(n, e) {
  10847. n.writeProperty("x", e.x), n.writeProperty("y", e.y);
  10848. }
  10849. function Ft(n, e) {
  10850. if (!n)
  10851. return;
  10852. const t = [], l = Go(n, e);
  10853. l && t.push(l);
  10854. const v = Ho(n);
  10855. return v && t.push(v), new fn(t);
  10856. }
  10857. function Vc(n, e) {
  10858. return new Zt({
  10859. assembly: Ko,
  10860. components: [
  10861. Ft("x" in n ? n.x : void 0, e.x),
  10862. Ft("y" in n ? n.y : void 0, e.y)
  10863. ]
  10864. });
  10865. }
  10866. function Wo(n, e) {
  10867. const [t, l] = n ? ec(n) : [];
  10868. if (!_(t) || !_(l))
  10869. return Math.max(Math.abs(t ?? 0), Math.abs(l ?? 0));
  10870. const v = Dt(n);
  10871. return Math.max(Math.abs(v) * 10, Math.abs(e) * 10);
  10872. }
  10873. function Dc(n, e) {
  10874. const t = e instanceof Zt ? e.components[0] : void 0, l = e instanceof Zt ? e.components[1] : void 0, v = Wo(t, n.x), E = Wo(l, n.y);
  10875. return Math.max(v, E);
  10876. }
  10877. function Jo(n, e) {
  10878. return {
  10879. baseStep: Dt(e),
  10880. constraint: e,
  10881. textProps: X.fromObject({
  10882. draggingScale: Ot(e, n),
  10883. formatter: Re(ti(e, n))
  10884. })
  10885. };
  10886. }
  10887. function Oc(n) {
  10888. if (!("y" in n))
  10889. return false;
  10890. const e = n.y;
  10891. return e && "inverted" in e ? !!e.inverted : false;
  10892. }
  10893. const Nc = {
  10894. id: "input-point2d",
  10895. type: "input",
  10896. accept: (n, e) => {
  10897. if (!Wt.isObject(n))
  10898. return null;
  10899. const t = M, l = le2(e, {
  10900. expanded: t.optional.boolean,
  10901. picker: t.optional.custom(Oi),
  10902. x: t.optional.custom(bt),
  10903. y: t.optional.object({
  10904. inverted: t.optional.boolean,
  10905. max: t.optional.number,
  10906. min: t.optional.number,
  10907. step: t.optional.number
  10908. })
  10909. });
  10910. return l ? {
  10911. initialValue: n,
  10912. params: l
  10913. } : null;
  10914. },
  10915. binding: {
  10916. reader: (n) => Rc,
  10917. constraint: (n) => Vc(n.params, n.initialValue),
  10918. equals: Wt.equals,
  10919. writer: (n) => Ic
  10920. },
  10921. controller: (n) => {
  10922. const e = n.document, t = n.value, l = n.constraint;
  10923. if (!(l instanceof Zt))
  10924. throw S2.shouldNeverHappen();
  10925. const v = "expanded" in n.params ? n.params.expanded : void 0, E = "picker" in n.params ? n.params.picker : void 0;
  10926. return new oc(e, {
  10927. axes: [
  10928. Jo(t.rawValue.x, l.components[0]),
  10929. Jo(t.rawValue.y, l.components[1])
  10930. ],
  10931. expanded: v ?? false,
  10932. invertsY: Oc(n.params),
  10933. maxValue: Dc(t.rawValue, l),
  10934. parser: at2,
  10935. pickerLayout: E ?? "popup",
  10936. value: t,
  10937. viewProps: n.viewProps
  10938. });
  10939. }
  10940. };
  10941. class ea extends a {
  10942. constructor(e) {
  10943. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10944. this.emitter_.emit("change", {
  10945. event: new u(this, t.rawValue)
  10946. });
  10947. });
  10948. }
  10949. get label() {
  10950. return this.controller_.props.get("label");
  10951. }
  10952. set label(e) {
  10953. this.controller_.props.set("label", e);
  10954. }
  10955. get options() {
  10956. return this.controller_.valueController.props.get("options");
  10957. }
  10958. set options(e) {
  10959. this.controller_.valueController.props.set("options", e);
  10960. }
  10961. get value() {
  10962. return this.controller_.valueController.value.rawValue;
  10963. }
  10964. set value(e) {
  10965. this.controller_.valueController.value.rawValue = e;
  10966. }
  10967. on(e, t) {
  10968. const l = t.bind(this);
  10969. return this.emitter_.on(e, (v) => {
  10970. l(v.event);
  10971. }), this;
  10972. }
  10973. }
  10974. class ta extends a {
  10975. constructor(e) {
  10976. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10977. this.emitter_.emit("change", {
  10978. event: new u(this, t.rawValue)
  10979. });
  10980. });
  10981. }
  10982. get label() {
  10983. return this.controller_.props.get("label");
  10984. }
  10985. set label(e) {
  10986. this.controller_.props.set("label", e);
  10987. }
  10988. get maxValue() {
  10989. return this.controller_.valueController.sliderController.props.get("maxValue");
  10990. }
  10991. set maxValue(e) {
  10992. this.controller_.valueController.sliderController.props.set("maxValue", e);
  10993. }
  10994. get minValue() {
  10995. return this.controller_.valueController.sliderController.props.get("minValue");
  10996. }
  10997. set minValue(e) {
  10998. this.controller_.valueController.sliderController.props.set("minValue", e);
  10999. }
  11000. get value() {
  11001. return this.controller_.valueController.value.rawValue;
  11002. }
  11003. set value(e) {
  11004. this.controller_.valueController.value.rawValue = e;
  11005. }
  11006. on(e, t) {
  11007. const l = t.bind(this);
  11008. return this.emitter_.on(e, (v) => {
  11009. l(v.event);
  11010. }), this;
  11011. }
  11012. }
  11013. class na extends a {
  11014. constructor(e) {
  11015. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  11016. this.emitter_.emit("change", {
  11017. event: new u(this, t.rawValue)
  11018. });
  11019. });
  11020. }
  11021. get label() {
  11022. return this.controller_.props.get("label");
  11023. }
  11024. set label(e) {
  11025. this.controller_.props.set("label", e);
  11026. }
  11027. get formatter() {
  11028. return this.controller_.valueController.props.get("formatter");
  11029. }
  11030. set formatter(e) {
  11031. this.controller_.valueController.props.set("formatter", e);
  11032. }
  11033. get value() {
  11034. return this.controller_.valueController.value.rawValue;
  11035. }
  11036. set value(e) {
  11037. this.controller_.valueController.value.rawValue = e;
  11038. }
  11039. on(e, t) {
  11040. const l = t.bind(this);
  11041. return this.emitter_.on(e, (v) => {
  11042. l(v.event);
  11043. }), this;
  11044. }
  11045. }
  11046. const Fc = function() {
  11047. return {
  11048. id: "list",
  11049. type: "blade",
  11050. accept(n) {
  11051. const e = M, t = le2(n, {
  11052. options: e.required.custom(En),
  11053. value: e.required.raw,
  11054. view: e.required.constant("list"),
  11055. label: e.optional.string
  11056. });
  11057. return t ? { params: t } : null;
  11058. },
  11059. controller(n) {
  11060. const e = new vn(Ps(n.params.options)), t = ee2(n.params.value, {
  11061. constraint: e
  11062. }), l = new bn(n.document, {
  11063. props: new X({
  11064. options: e.values.value("options")
  11065. }),
  11066. value: t,
  11067. viewProps: n.viewProps
  11068. });
  11069. return new Gt(n.document, {
  11070. blade: n.blade,
  11071. props: X.fromObject({
  11072. label: n.params.label
  11073. }),
  11074. valueController: l
  11075. });
  11076. },
  11077. api(n) {
  11078. return !(n.controller instanceof Gt) || !(n.controller.valueController instanceof bn) ? null : new ea(n.controller);
  11079. }
  11080. };
  11081. }();
  11082. function Bc(n) {
  11083. return n.reduce((e, t) => Object.assign(e, {
  11084. [t.presetKey]: t.read()
  11085. }), {});
  11086. }
  11087. function jc(n, e) {
  11088. n.forEach((t) => {
  11089. const l = e[t.target.presetKey];
  11090. l !== void 0 && t.writer(t.target, t.reader(l));
  11091. });
  11092. }
  11093. class zc extends vi {
  11094. /**
  11095. * @hidden
  11096. */
  11097. constructor(e, t) {
  11098. super(e, t);
  11099. }
  11100. get element() {
  11101. return this.controller_.view.element;
  11102. }
  11103. /**
  11104. * Imports a preset of all inputs.
  11105. * @param preset The preset object to import.
  11106. */
  11107. importPreset(e) {
  11108. const t = this.controller_.rackController.rack.find(Fe).map((l) => l.binding);
  11109. jc(t, e), this.refresh();
  11110. }
  11111. /**
  11112. * Exports a preset of all inputs.
  11113. * @return An exported preset object.
  11114. */
  11115. exportPreset() {
  11116. const e = this.controller_.rackController.rack.find(Fe).map((t) => t.binding.target);
  11117. return Bc(e);
  11118. }
  11119. /**
  11120. * Refreshes all bindings of the pane.
  11121. */
  11122. refresh() {
  11123. this.controller_.rackController.rack.find(Fe).forEach((e) => {
  11124. e.binding.read();
  11125. }), this.controller_.rackController.rack.find(rt2).forEach((e) => {
  11126. e.binding.read();
  11127. });
  11128. }
  11129. }
  11130. class Uc extends Xn {
  11131. constructor(e, t) {
  11132. super(e, {
  11133. expanded: t.expanded,
  11134. blade: t.blade,
  11135. props: t.props,
  11136. root: true,
  11137. viewProps: t.viewProps
  11138. });
  11139. }
  11140. }
  11141. const Gc = {
  11142. id: "slider",
  11143. type: "blade",
  11144. accept(n) {
  11145. const e = M, t = le2(n, {
  11146. max: e.required.number,
  11147. min: e.required.number,
  11148. view: e.required.constant("slider"),
  11149. format: e.optional.function,
  11150. label: e.optional.string,
  11151. value: e.optional.number
  11152. });
  11153. return t ? { params: t } : null;
  11154. },
  11155. controller(n) {
  11156. var e, t;
  11157. const l = (e = n.params.value) !== null && e !== void 0 ? e : 0, v = new Xt({
  11158. max: n.params.max,
  11159. min: n.params.min
  11160. }), E = new ei(n.document, {
  11161. baseStep: 1,
  11162. parser: at2,
  11163. sliderProps: new X({
  11164. maxValue: v.values.value("max"),
  11165. minValue: v.values.value("min")
  11166. }),
  11167. textProps: X.fromObject({
  11168. draggingScale: Ot(void 0, l),
  11169. formatter: (t = n.params.format) !== null && t !== void 0 ? t : Er
  11170. }),
  11171. value: ee2(l, {
  11172. constraint: v
  11173. }),
  11174. viewProps: n.viewProps
  11175. });
  11176. return new Gt(n.document, {
  11177. blade: n.blade,
  11178. props: X.fromObject({
  11179. label: n.params.label
  11180. }),
  11181. valueController: E
  11182. });
  11183. },
  11184. api(n) {
  11185. return !(n.controller instanceof Gt) || !(n.controller.valueController instanceof ei) ? null : new ta(n.controller);
  11186. }
  11187. }, Hc = function() {
  11188. return {
  11189. id: "text",
  11190. type: "blade",
  11191. accept(n) {
  11192. const e = M, t = le2(n, {
  11193. parse: e.required.function,
  11194. value: e.required.raw,
  11195. view: e.required.constant("text"),
  11196. format: e.optional.function,
  11197. label: e.optional.string
  11198. });
  11199. return t ? { params: t } : null;
  11200. },
  11201. controller(n) {
  11202. var e;
  11203. const t = new Zn(n.document, {
  11204. parser: n.params.parse,
  11205. props: X.fromObject({
  11206. formatter: (e = n.params.format) !== null && e !== void 0 ? e : (l) => String(l)
  11207. }),
  11208. value: ee2(n.params.value),
  11209. viewProps: n.viewProps
  11210. });
  11211. return new Gt(n.document, {
  11212. blade: n.blade,
  11213. props: X.fromObject({
  11214. label: n.params.label
  11215. }),
  11216. valueController: t
  11217. });
  11218. },
  11219. api(n) {
  11220. return !(n.controller instanceof Gt) || !(n.controller.valueController instanceof Zn) ? null : new na(n.controller);
  11221. }
  11222. };
  11223. }();
  11224. function Kc(n) {
  11225. const e = n.createElement("div");
  11226. return e.classList.add(D("dfw")()), n.body && n.body.appendChild(e), e;
  11227. }
  11228. function ia(n, e, t) {
  11229. if (n.querySelector(`style[data-tp-style=${e}]`))
  11230. return;
  11231. const l = n.createElement("style");
  11232. l.dataset.tpStyle = e, l.textContent = t, n.head.appendChild(l);
  11233. }
  11234. class $c extends zc {
  11235. constructor(e) {
  11236. var t, l;
  11237. const v = e ?? {}, E = (t = v.document) !== null && t !== void 0 ? t : hi(), k2 = Lc(), B2 = new Uc(E, {
  11238. expanded: v.expanded,
  11239. blade: ye(),
  11240. props: X.fromObject({
  11241. title: v.title
  11242. }),
  11243. viewProps: Xe2.create()
  11244. });
  11245. super(B2, k2), this.pool_ = k2, this.containerElem_ = (l = v.container) !== null && l !== void 0 ? l : Kc(E), this.containerElem_.appendChild(this.element), this.doc_ = E, this.usesDefaultWrapper_ = !v.container, this.setUpDefaultPlugins_();
  11246. }
  11247. get document() {
  11248. if (!this.doc_)
  11249. throw S2.alreadyDisposed();
  11250. return this.doc_;
  11251. }
  11252. dispose() {
  11253. const e = this.containerElem_;
  11254. if (!e)
  11255. throw S2.alreadyDisposed();
  11256. if (this.usesDefaultWrapper_) {
  11257. const t = e.parentElement;
  11258. t && t.removeChild(e);
  11259. }
  11260. this.containerElem_ = null, this.doc_ = null, super.dispose();
  11261. }
  11262. registerPlugin(e) {
  11263. ("plugin" in e ? [e.plugin] : "plugins" in e ? e.plugins : []).forEach((l) => {
  11264. this.pool_.register(l), this.embedPluginStyle_(l);
  11265. });
  11266. }
  11267. embedPluginStyle_(e) {
  11268. e.css && ia(this.document, `plugin-${e.id}`, e.css);
  11269. }
  11270. setUpDefaultPlugins_() {
  11271. ia(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) => {
  11272. this.embedPluginStyle_(e);
  11273. }), this.registerPlugin({
  11274. plugins: [
  11275. Gc,
  11276. Fc,
  11277. yi,
  11278. Hc
  11279. ]
  11280. });
  11281. }
  11282. }
  11283. const Xc = new s("3.1.7");
  11284. r.BladeApi = a, r.ButtonApi = j2, r.FolderApi = vi, r.InputBindingApi = mi, r.ListApi = ea, r.MonitorBindingApi = fi, r.Pane = $c, r.SeparatorApi = ss, r.SliderApi = ta, r.TabApi = os, r.TabPageApi = wi, r.TextApi = na, r.TpChangeEvent = u, r.VERSION = Xc, Object.defineProperty(r, "__esModule", { value: true });
  11285. });
  11286. })(Ch, js);
  11287. var Ji = {};
  11288. var Ph = {
  11289. get exports() {
  11290. return Ji;
  11291. },
  11292. set exports(b2) {
  11293. Ji = b2;
  11294. }
  11295. };
  11296. (function(b2, i) {
  11297. (function(r, s) {
  11298. s(i);
  11299. })(el, function(r) {
  11300. class s {
  11301. constructor(o) {
  11302. this.controller_ = o;
  11303. }
  11304. get element() {
  11305. return this.controller_.view.element;
  11306. }
  11307. get disabled() {
  11308. return this.controller_.viewProps.get("disabled");
  11309. }
  11310. set disabled(o) {
  11311. this.controller_.viewProps.set("disabled", o);
  11312. }
  11313. get hidden() {
  11314. return this.controller_.viewProps.get("hidden");
  11315. }
  11316. set hidden(o) {
  11317. this.controller_.viewProps.set("hidden", o);
  11318. }
  11319. dispose() {
  11320. this.controller_.viewProps.set("disposed", true);
  11321. }
  11322. }
  11323. class a {
  11324. constructor(o) {
  11325. this.target = o;
  11326. }
  11327. }
  11328. class c extends a {
  11329. constructor(o, p, f2, x) {
  11330. super(o), this.value = p, this.presetKey = f2, this.last = x ?? true;
  11331. }
  11332. }
  11333. function u(m) {
  11334. return m;
  11335. }
  11336. function h2(m) {
  11337. return m == null;
  11338. }
  11339. const d = {
  11340. alreadydisposed: () => "View has been already disposed",
  11341. invalidparams: (m) => `Invalid parameters for '${m.name}'`,
  11342. nomatchingcontroller: (m) => `No matching controller for '${m.key}'`,
  11343. nomatchingview: (m) => `No matching view for '${JSON.stringify(m.params)}'`,
  11344. notbindable: () => "Value is not bindable",
  11345. propertynotfound: (m) => `Property '${m.name}' not found`,
  11346. shouldneverhappen: () => "This error should never happen"
  11347. };
  11348. class g {
  11349. constructor(o) {
  11350. var p;
  11351. this.message = (p = d[o.type](o.context)) !== null && p !== void 0 ? p : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = o.type;
  11352. }
  11353. static alreadyDisposed() {
  11354. return new g({ type: "alreadydisposed" });
  11355. }
  11356. static notBindable() {
  11357. return new g({
  11358. type: "notbindable"
  11359. });
  11360. }
  11361. static propertyNotFound(o) {
  11362. return new g({
  11363. type: "propertynotfound",
  11364. context: {
  11365. name: o
  11366. }
  11367. });
  11368. }
  11369. static shouldNeverHappen() {
  11370. return new g({ type: "shouldneverhappen" });
  11371. }
  11372. }
  11373. class w {
  11374. constructor() {
  11375. this.observers_ = {};
  11376. }
  11377. on(o, p) {
  11378. let f2 = this.observers_[o];
  11379. return f2 || (f2 = this.observers_[o] = []), f2.push({
  11380. handler: p
  11381. }), this;
  11382. }
  11383. off(o, p) {
  11384. const f2 = this.observers_[o];
  11385. return f2 && (this.observers_[o] = f2.filter((x) => x.handler !== p)), this;
  11386. }
  11387. emit(o, p) {
  11388. const f2 = this.observers_[o];
  11389. f2 && f2.forEach((x) => {
  11390. x.handler(p);
  11391. });
  11392. }
  11393. }
  11394. const _ = "tp";
  11395. function y2(m) {
  11396. return (p, f2) => [
  11397. _,
  11398. "-",
  11399. m,
  11400. "v",
  11401. p ? `_${p}` : "",
  11402. f2 ? `-${f2}` : ""
  11403. ].join("");
  11404. }
  11405. function C(m, o) {
  11406. return (p) => o(m(p));
  11407. }
  11408. function I2(m) {
  11409. return m.rawValue;
  11410. }
  11411. function S2(m, o) {
  11412. m.emitter.on("change", C(I2, o)), o(m.rawValue);
  11413. }
  11414. function R2(m, o, p) {
  11415. S2(m.value(o), p);
  11416. }
  11417. function j2(m, o, p) {
  11418. p ? m.classList.add(o) : m.classList.remove(o);
  11419. }
  11420. function F(m, o) {
  11421. return (p) => {
  11422. j2(m, o, p);
  11423. };
  11424. }
  11425. function V2(m, o) {
  11426. S2(m, (p) => {
  11427. o.textContent = p ?? "";
  11428. });
  11429. }
  11430. const D = y2("btn");
  11431. class Y {
  11432. constructor(o, p) {
  11433. this.element = o.createElement("div"), this.element.classList.add(D()), p.viewProps.bindClassModifiers(this.element);
  11434. const f2 = o.createElement("button");
  11435. f2.classList.add(D("b")), p.viewProps.bindDisabled(f2), this.element.appendChild(f2), this.buttonElement = f2;
  11436. const x = o.createElement("div");
  11437. x.classList.add(D("t")), V2(p.props.value("title"), x), this.buttonElement.appendChild(x);
  11438. }
  11439. }
  11440. class G2 {
  11441. constructor(o, p) {
  11442. this.emitter = new w(), this.onClick_ = this.onClick_.bind(this), this.props = p.props, this.viewProps = p.viewProps, this.view = new Y(o, {
  11443. props: this.props,
  11444. viewProps: this.viewProps
  11445. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  11446. }
  11447. onClick_() {
  11448. this.emitter.emit("click", {
  11449. sender: this
  11450. });
  11451. }
  11452. }
  11453. class N {
  11454. constructor(o, p) {
  11455. var f2;
  11456. this.constraint_ = p == null ? void 0 : p.constraint, this.equals_ = (f2 = p == null ? void 0 : p.equals) !== null && f2 !== void 0 ? f2 : (x, P) => x === P, this.emitter = new w(), this.rawValue_ = o;
  11457. }
  11458. get constraint() {
  11459. return this.constraint_;
  11460. }
  11461. get rawValue() {
  11462. return this.rawValue_;
  11463. }
  11464. set rawValue(o) {
  11465. this.setRawValue(o, {
  11466. forceEmit: false,
  11467. last: true
  11468. });
  11469. }
  11470. setRawValue(o, p) {
  11471. const f2 = p ?? {
  11472. forceEmit: false,
  11473. last: true
  11474. }, x = this.constraint_ ? this.constraint_.constrain(o) : o, P = this.rawValue_;
  11475. this.equals_(P, x) && !f2.forceEmit || (this.emitter.emit("beforechange", {
  11476. sender: this
  11477. }), this.rawValue_ = x, this.emitter.emit("change", {
  11478. options: f2,
  11479. previousRawValue: P,
  11480. rawValue: x,
  11481. sender: this
  11482. }));
  11483. }
  11484. }
  11485. class O {
  11486. constructor(o) {
  11487. this.emitter = new w(), this.value_ = o;
  11488. }
  11489. get rawValue() {
  11490. return this.value_;
  11491. }
  11492. set rawValue(o) {
  11493. this.setRawValue(o, {
  11494. forceEmit: false,
  11495. last: true
  11496. });
  11497. }
  11498. setRawValue(o, p) {
  11499. const f2 = p ?? {
  11500. forceEmit: false,
  11501. last: true
  11502. }, x = this.value_;
  11503. x === o && !f2.forceEmit || (this.emitter.emit("beforechange", {
  11504. sender: this
  11505. }), this.value_ = o, this.emitter.emit("change", {
  11506. options: f2,
  11507. previousRawValue: x,
  11508. rawValue: this.value_,
  11509. sender: this
  11510. }));
  11511. }
  11512. }
  11513. function H2(m, o) {
  11514. const p = o == null ? void 0 : o.constraint, f2 = o == null ? void 0 : o.equals;
  11515. return !p && !f2 ? new O(m) : new N(m, o);
  11516. }
  11517. class K {
  11518. constructor(o) {
  11519. this.emitter = new w(), this.valMap_ = o;
  11520. for (const p in this.valMap_)
  11521. this.valMap_[p].emitter.on("change", () => {
  11522. this.emitter.emit("change", {
  11523. key: p,
  11524. sender: this
  11525. });
  11526. });
  11527. }
  11528. static createCore(o) {
  11529. return Object.keys(o).reduce((f2, x) => Object.assign(f2, {
  11530. [x]: H2(o[x])
  11531. }), {});
  11532. }
  11533. static fromObject(o) {
  11534. const p = this.createCore(o);
  11535. return new K(p);
  11536. }
  11537. get(o) {
  11538. return this.valMap_[o].rawValue;
  11539. }
  11540. set(o, p) {
  11541. this.valMap_[o].rawValue = p;
  11542. }
  11543. value(o) {
  11544. return this.valMap_[o];
  11545. }
  11546. }
  11547. function q(m, o) {
  11548. const f2 = Object.keys(o).reduce((x, P) => {
  11549. if (x === void 0)
  11550. return;
  11551. const L2 = o[P], z = L2(m[P]);
  11552. return z.succeeded ? Object.assign(Object.assign({}, x), { [P]: z.value }) : void 0;
  11553. }, {});
  11554. return f2;
  11555. }
  11556. function ue2(m, o) {
  11557. return m.reduce((p, f2) => {
  11558. if (p === void 0)
  11559. return;
  11560. const x = o(f2);
  11561. if (!(!x.succeeded || x.value === void 0))
  11562. return [...p, x.value];
  11563. }, []);
  11564. }
  11565. function ge(m) {
  11566. return m === null ? false : typeof m == "object";
  11567. }
  11568. function ce2(m) {
  11569. return (o) => (p) => {
  11570. if (!o && p === void 0)
  11571. return {
  11572. succeeded: false,
  11573. value: void 0
  11574. };
  11575. if (o && p === void 0)
  11576. return {
  11577. succeeded: true,
  11578. value: void 0
  11579. };
  11580. const f2 = m(p);
  11581. return f2 !== void 0 ? {
  11582. succeeded: true,
  11583. value: f2
  11584. } : {
  11585. succeeded: false,
  11586. value: void 0
  11587. };
  11588. };
  11589. }
  11590. function me2(m) {
  11591. return {
  11592. custom: (o) => ce2(o)(m),
  11593. boolean: ce2((o) => typeof o == "boolean" ? o : void 0)(m),
  11594. number: ce2((o) => typeof o == "number" ? o : void 0)(m),
  11595. string: ce2((o) => typeof o == "string" ? o : void 0)(m),
  11596. function: ce2((o) => typeof o == "function" ? o : void 0)(m),
  11597. constant: (o) => ce2((p) => p === o ? o : void 0)(m),
  11598. raw: ce2((o) => o)(m),
  11599. object: (o) => ce2((p) => {
  11600. if (ge(p))
  11601. return q(p, o);
  11602. })(m),
  11603. array: (o) => ce2((p) => {
  11604. if (Array.isArray(p))
  11605. return ue2(p, o);
  11606. })(m)
  11607. };
  11608. }
  11609. const he = {
  11610. optional: me2(true),
  11611. required: me2(false)
  11612. };
  11613. function ee2(m, o) {
  11614. const p = he.required.object(o)(m);
  11615. return p.succeeded ? p.value : void 0;
  11616. }
  11617. function X(m) {
  11618. console.warn([
  11619. `Missing '${m.key}' of ${m.target} in ${m.place}.`,
  11620. "Please rebuild plugins with the latest core package."
  11621. ].join(" "));
  11622. }
  11623. function Pe(m) {
  11624. return m && m.parentElement && m.parentElement.removeChild(m), null;
  11625. }
  11626. class fe2 {
  11627. constructor(o) {
  11628. this.value_ = o;
  11629. }
  11630. static create(o) {
  11631. return [
  11632. new fe2(o),
  11633. (p, f2) => {
  11634. o.setRawValue(p, f2);
  11635. }
  11636. ];
  11637. }
  11638. get emitter() {
  11639. return this.value_.emitter;
  11640. }
  11641. get rawValue() {
  11642. return this.value_.rawValue;
  11643. }
  11644. }
  11645. const ae = y2("");
  11646. function ne(m, o) {
  11647. return F(m, ae(void 0, o));
  11648. }
  11649. class be extends K {
  11650. constructor(o) {
  11651. var p;
  11652. super(o), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = fe2.create(H2(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (p = this.get("parent")) === null || p === void 0 || p.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  11653. }
  11654. static create(o) {
  11655. var p, f2, x;
  11656. const P = o ?? {};
  11657. return new be(K.createCore({
  11658. disabled: (p = P.disabled) !== null && p !== void 0 ? p : false,
  11659. disposed: false,
  11660. hidden: (f2 = P.hidden) !== null && f2 !== void 0 ? f2 : false,
  11661. parent: (x = P.parent) !== null && x !== void 0 ? x : null
  11662. }));
  11663. }
  11664. get globalDisabled() {
  11665. return this.globalDisabled_;
  11666. }
  11667. bindClassModifiers(o) {
  11668. S2(this.globalDisabled_, ne(o, "disabled")), R2(this, "hidden", ne(o, "hidden"));
  11669. }
  11670. bindDisabled(o) {
  11671. S2(this.globalDisabled_, (p) => {
  11672. o.disabled = p;
  11673. });
  11674. }
  11675. bindTabIndex(o) {
  11676. S2(this.globalDisabled_, (p) => {
  11677. o.tabIndex = p ? -1 : 0;
  11678. });
  11679. }
  11680. handleDispose(o) {
  11681. this.value("disposed").emitter.on("change", (p) => {
  11682. p && o();
  11683. });
  11684. }
  11685. getGlobalDisabled_() {
  11686. const o = this.get("parent");
  11687. return (o ? o.globalDisabled.rawValue : false) || this.get("disabled");
  11688. }
  11689. updateGlobalDisabled_() {
  11690. this.setGlobalDisabled_(this.getGlobalDisabled_());
  11691. }
  11692. onDisabledChange_() {
  11693. this.updateGlobalDisabled_();
  11694. }
  11695. onParentGlobalDisabledChange_() {
  11696. this.updateGlobalDisabled_();
  11697. }
  11698. onParentChange_(o) {
  11699. var p;
  11700. const f2 = o.previousRawValue;
  11701. f2 == null || f2.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (p = this.get("parent")) === null || p === void 0 || p.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  11702. }
  11703. }
  11704. function M() {
  11705. return ["veryfirst", "first", "last", "verylast"];
  11706. }
  11707. const le2 = y2(""), Ve = {
  11708. veryfirst: "vfst",
  11709. first: "fst",
  11710. last: "lst",
  11711. verylast: "vlst"
  11712. };
  11713. class Ne2 {
  11714. constructor(o) {
  11715. this.parent_ = null, this.blade = o.blade, this.view = o.view, this.viewProps = o.viewProps;
  11716. const p = this.view.element;
  11717. this.blade.value("positions").emitter.on("change", () => {
  11718. M().forEach((f2) => {
  11719. p.classList.remove(le2(void 0, Ve[f2]));
  11720. }), this.blade.get("positions").forEach((f2) => {
  11721. p.classList.add(le2(void 0, Ve[f2]));
  11722. });
  11723. }), this.viewProps.handleDispose(() => {
  11724. Pe(p);
  11725. });
  11726. }
  11727. get parent() {
  11728. return this.parent_;
  11729. }
  11730. set parent(o) {
  11731. if (this.parent_ = o, !("parent" in this.viewProps.valMap_)) {
  11732. X({
  11733. key: "parent",
  11734. target: be.name,
  11735. place: "BladeController.parent"
  11736. });
  11737. return;
  11738. }
  11739. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  11740. }
  11741. }
  11742. const we = "http://www.w3.org/2000/svg";
  11743. function it2(m) {
  11744. m.offsetHeight;
  11745. }
  11746. function Bn(m, o) {
  11747. const p = m.style.transition;
  11748. m.style.transition = "none", o(), m.style.transition = p;
  11749. }
  11750. function Xe2(m) {
  11751. return m.ontouchstart !== void 0;
  11752. }
  11753. function jn(m) {
  11754. for (; m.childNodes.length > 0; )
  11755. m.removeChild(m.childNodes[0]);
  11756. }
  11757. function an(m) {
  11758. return m.relatedTarget ? m.relatedTarget : "explicitOriginalTarget" in m ? m.explicitOriginalTarget : null;
  11759. }
  11760. const dt2 = y2("lbl");
  11761. function Mt(m, o) {
  11762. const p = m.createDocumentFragment();
  11763. return o.split(`
  11764. `).map((x) => m.createTextNode(x)).forEach((x, P) => {
  11765. P > 0 && p.appendChild(m.createElement("br")), p.appendChild(x);
  11766. }), p;
  11767. }
  11768. class ze {
  11769. constructor(o, p) {
  11770. this.element = o.createElement("div"), this.element.classList.add(dt2()), p.viewProps.bindClassModifiers(this.element);
  11771. const f2 = o.createElement("div");
  11772. f2.classList.add(dt2("l")), R2(p.props, "label", (P) => {
  11773. h2(P) ? this.element.classList.add(dt2(void 0, "nol")) : (this.element.classList.remove(dt2(void 0, "nol")), jn(f2), f2.appendChild(Mt(o, P)));
  11774. }), this.element.appendChild(f2), this.labelElement = f2;
  11775. const x = o.createElement("div");
  11776. x.classList.add(dt2("v")), this.element.appendChild(x), this.valueElement = x;
  11777. }
  11778. }
  11779. class st2 extends Ne2 {
  11780. constructor(o, p) {
  11781. const f2 = p.valueController.viewProps;
  11782. super(Object.assign(Object.assign({}, p), { view: new ze(o, {
  11783. props: p.props,
  11784. viewProps: f2
  11785. }), viewProps: f2 })), this.props = p.props, this.valueController = p.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11786. }
  11787. }
  11788. class ln extends Ne2 {
  11789. constructor(o) {
  11790. super(o), this.value = o.value;
  11791. }
  11792. }
  11793. class mt extends K {
  11794. constructor(o) {
  11795. super(o);
  11796. }
  11797. static create(o) {
  11798. const p = {
  11799. completed: true,
  11800. expanded: o,
  11801. expandedHeight: null,
  11802. shouldFixHeight: false,
  11803. temporaryExpanded: null
  11804. }, f2 = K.createCore(p);
  11805. return new mt(f2);
  11806. }
  11807. get styleExpanded() {
  11808. var o;
  11809. return (o = this.get("temporaryExpanded")) !== null && o !== void 0 ? o : this.get("expanded");
  11810. }
  11811. get styleHeight() {
  11812. if (!this.styleExpanded)
  11813. return "0";
  11814. const o = this.get("expandedHeight");
  11815. return this.get("shouldFixHeight") && !h2(o) ? `${o}px` : "auto";
  11816. }
  11817. bindExpandedClass(o, p) {
  11818. const f2 = () => {
  11819. this.styleExpanded ? o.classList.add(p) : o.classList.remove(p);
  11820. };
  11821. R2(this, "expanded", f2), R2(this, "temporaryExpanded", f2);
  11822. }
  11823. cleanUpTransition() {
  11824. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  11825. }
  11826. }
  11827. function zn(m) {
  11828. return mt.create(m);
  11829. }
  11830. function hi(m, o) {
  11831. let p = 0;
  11832. return Bn(o, () => {
  11833. m.set("expandedHeight", null), m.set("temporaryExpanded", true), it2(o), p = o.clientHeight, m.set("temporaryExpanded", null), it2(o);
  11834. }), p;
  11835. }
  11836. function Un(m, o) {
  11837. o.style.height = m.styleHeight;
  11838. }
  11839. function Gn(m, o) {
  11840. m.value("expanded").emitter.on("beforechange", () => {
  11841. m.set("completed", false), h2(m.get("expandedHeight")) && m.set("expandedHeight", hi(m, o)), m.set("shouldFixHeight", true), it2(o);
  11842. }), m.emitter.on("change", () => {
  11843. Un(m, o);
  11844. }), Un(m, o), o.addEventListener("transitionend", (p) => {
  11845. p.propertyName === "height" && m.cleanUpTransition();
  11846. });
  11847. }
  11848. class yt {
  11849. constructor(o, p) {
  11850. const f2 = y2(p.viewName);
  11851. this.element = o.createElement("div"), this.element.classList.add(f2()), p.viewProps.bindClassModifiers(this.element);
  11852. }
  11853. }
  11854. class St extends ln {
  11855. constructor(o, p) {
  11856. const f2 = p.valueController.viewProps;
  11857. super(Object.assign(Object.assign({}, p), { value: p.valueController.value, view: new ze(o, {
  11858. props: p.props,
  11859. viewProps: f2
  11860. }), viewProps: f2 })), this.props = p.props, this.valueController = p.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11861. }
  11862. }
  11863. class Hn {
  11864. constructor() {
  11865. this.disabled = false, this.emitter = new w();
  11866. }
  11867. dispose() {
  11868. }
  11869. tick() {
  11870. this.disabled || this.emitter.emit("tick", {
  11871. sender: this
  11872. });
  11873. }
  11874. }
  11875. class cn {
  11876. constructor(o, p) {
  11877. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = o, this.emitter = new w(), this.interval_ = p, this.setTimer_();
  11878. }
  11879. get disabled() {
  11880. return this.disabled_;
  11881. }
  11882. set disabled(o) {
  11883. this.disabled_ = o, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  11884. }
  11885. dispose() {
  11886. this.clearTimer_();
  11887. }
  11888. clearTimer_() {
  11889. if (this.timerId_ === null)
  11890. return;
  11891. const o = this.doc_.defaultView;
  11892. o && o.clearInterval(this.timerId_), this.timerId_ = null;
  11893. }
  11894. setTimer_() {
  11895. if (this.clearTimer_(), this.interval_ <= 0)
  11896. return;
  11897. const o = this.doc_.defaultView;
  11898. o && (this.timerId_ = o.setInterval(this.onTick_, this.interval_));
  11899. }
  11900. onTick_() {
  11901. this.disabled_ || this.emitter.emit("tick", {
  11902. sender: this
  11903. });
  11904. }
  11905. }
  11906. class Kn {
  11907. constructor(o) {
  11908. this.constraints = o;
  11909. }
  11910. constrain(o) {
  11911. return this.constraints.reduce((p, f2) => f2.constrain(p), o);
  11912. }
  11913. }
  11914. function xt(m, o) {
  11915. if (m instanceof o)
  11916. return m;
  11917. if (m instanceof Kn) {
  11918. const p = m.constraints.reduce((f2, x) => f2 || (x instanceof o ? x : null), null);
  11919. if (p)
  11920. return p;
  11921. }
  11922. return null;
  11923. }
  11924. class ft {
  11925. constructor(o) {
  11926. this.values = K.fromObject({
  11927. max: o.max,
  11928. min: o.min
  11929. });
  11930. }
  11931. constrain(o) {
  11932. const p = this.values.get("max"), f2 = this.values.get("min");
  11933. return Math.min(Math.max(o, f2), p);
  11934. }
  11935. }
  11936. class At {
  11937. constructor(o) {
  11938. this.values = K.fromObject({
  11939. max: o.max,
  11940. min: o.min
  11941. });
  11942. }
  11943. get maxValue() {
  11944. return this.values.get("max");
  11945. }
  11946. get minValue() {
  11947. return this.values.get("min");
  11948. }
  11949. constrain(o) {
  11950. const p = this.values.get("max"), f2 = this.values.get("min");
  11951. let x = o;
  11952. return h2(f2) || (x = Math.max(x, f2)), h2(p) || (x = Math.min(x, p)), x;
  11953. }
  11954. }
  11955. class A2 {
  11956. constructor(o, p = 0) {
  11957. this.step = o, this.origin = p;
  11958. }
  11959. constrain(o) {
  11960. const p = this.origin % this.step, f2 = Math.round((o - p) / this.step);
  11961. return p + f2 * this.step;
  11962. }
  11963. }
  11964. const U = y2("pop");
  11965. class W {
  11966. constructor(o, p) {
  11967. this.element = o.createElement("div"), this.element.classList.add(U()), p.viewProps.bindClassModifiers(this.element), S2(p.shows, F(this.element, U(void 0, "v")));
  11968. }
  11969. }
  11970. class ie {
  11971. constructor(o, p) {
  11972. this.shows = H2(false), this.viewProps = p.viewProps, this.view = new W(o, {
  11973. shows: this.shows,
  11974. viewProps: this.viewProps
  11975. });
  11976. }
  11977. }
  11978. const ye = y2("txt");
  11979. class De {
  11980. constructor(o, p) {
  11981. this.onChange_ = this.onChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(ye()), p.viewProps.bindClassModifiers(this.element), this.props_ = p.props, this.props_.emitter.on("change", this.onChange_);
  11982. const f2 = o.createElement("input");
  11983. f2.classList.add(ye("i")), f2.type = "text", p.viewProps.bindDisabled(f2), this.element.appendChild(f2), this.inputElement = f2, p.value.emitter.on("change", this.onChange_), this.value_ = p.value, this.refresh();
  11984. }
  11985. refresh() {
  11986. const o = this.props_.get("formatter");
  11987. this.inputElement.value = o(this.value_.rawValue);
  11988. }
  11989. onChange_() {
  11990. this.refresh();
  11991. }
  11992. }
  11993. class Ut {
  11994. constructor(o, p) {
  11995. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = p.parser, this.props = p.props, this.value = p.value, this.viewProps = p.viewProps, this.view = new De(o, {
  11996. props: p.props,
  11997. value: this.value,
  11998. viewProps: this.viewProps
  11999. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  12000. }
  12001. onInputChange_(o) {
  12002. const f2 = o.currentTarget.value, x = this.parser_(f2);
  12003. h2(x) || (this.value.rawValue = x), this.view.refresh();
  12004. }
  12005. }
  12006. function pn(m) {
  12007. return m === "false" ? false : !!m;
  12008. }
  12009. class Ue {
  12010. constructor(o) {
  12011. this.text = o;
  12012. }
  12013. evaluate() {
  12014. return Number(this.text);
  12015. }
  12016. toString() {
  12017. return this.text;
  12018. }
  12019. }
  12020. const Ge = {
  12021. "**": (m, o) => Math.pow(m, o),
  12022. "*": (m, o) => m * o,
  12023. "/": (m, o) => m / o,
  12024. "%": (m, o) => m % o,
  12025. "+": (m, o) => m + o,
  12026. "-": (m, o) => m - o,
  12027. "<<": (m, o) => m << o,
  12028. ">>": (m, o) => m >> o,
  12029. ">>>": (m, o) => m >>> o,
  12030. "&": (m, o) => m & o,
  12031. "^": (m, o) => m ^ o,
  12032. "|": (m, o) => m | o
  12033. };
  12034. class Gs {
  12035. constructor(o, p, f2) {
  12036. this.left = p, this.operator = o, this.right = f2;
  12037. }
  12038. evaluate() {
  12039. const o = Ge[this.operator];
  12040. if (!o)
  12041. throw new Error(`unexpected binary operator: '${this.operator}`);
  12042. return o(this.left.evaluate(), this.right.evaluate());
  12043. }
  12044. toString() {
  12045. return [
  12046. "b(",
  12047. this.left.toString(),
  12048. this.operator,
  12049. this.right.toString(),
  12050. ")"
  12051. ].join(" ");
  12052. }
  12053. }
  12054. const Hs = {
  12055. "+": (m) => m,
  12056. "-": (m) => -m,
  12057. "~": (m) => ~m
  12058. };
  12059. class Ks {
  12060. constructor(o, p) {
  12061. this.operator = o, this.expression = p;
  12062. }
  12063. evaluate() {
  12064. const o = Hs[this.operator];
  12065. if (!o)
  12066. throw new Error(`unexpected unary operator: '${this.operator}`);
  12067. return o(this.expression.evaluate());
  12068. }
  12069. toString() {
  12070. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  12071. }
  12072. }
  12073. function di(m) {
  12074. return (o, p) => {
  12075. for (let f2 = 0; f2 < m.length; f2++) {
  12076. const x = m[f2](o, p);
  12077. if (x !== "")
  12078. return x;
  12079. }
  12080. return "";
  12081. };
  12082. }
  12083. function Lt(m, o) {
  12084. var p;
  12085. const f2 = m.substr(o).match(/^\s+/);
  12086. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12087. }
  12088. function mi(m, o) {
  12089. const p = m.substr(o, 1);
  12090. return p.match(/^[1-9]$/) ? p : "";
  12091. }
  12092. function Fe(m, o) {
  12093. var p;
  12094. const f2 = m.substr(o).match(/^[0-9]+/);
  12095. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12096. }
  12097. function fi(m, o) {
  12098. const p = Fe(m, o);
  12099. if (p !== "")
  12100. return p;
  12101. const f2 = m.substr(o, 1);
  12102. if (o += 1, f2 !== "-" && f2 !== "+")
  12103. return "";
  12104. const x = Fe(m, o);
  12105. return x === "" ? "" : f2 + x;
  12106. }
  12107. function rt2(m, o) {
  12108. const p = m.substr(o, 1);
  12109. if (o += 1, p.toLowerCase() !== "e")
  12110. return "";
  12111. const f2 = fi(m, o);
  12112. return f2 === "" ? "" : p + f2;
  12113. }
  12114. function ts(m, o) {
  12115. const p = m.substr(o, 1);
  12116. if (p === "0")
  12117. return p;
  12118. const f2 = mi(m, o);
  12119. return o += f2.length, f2 === "" ? "" : f2 + Fe(m, o);
  12120. }
  12121. function un(m, o) {
  12122. const p = ts(m, o);
  12123. if (o += p.length, p === "")
  12124. return "";
  12125. const f2 = m.substr(o, 1);
  12126. if (o += f2.length, f2 !== ".")
  12127. return "";
  12128. const x = Fe(m, o);
  12129. return o += x.length, p + f2 + x + rt2(m, o);
  12130. }
  12131. function ns(m, o) {
  12132. const p = m.substr(o, 1);
  12133. if (o += p.length, p !== ".")
  12134. return "";
  12135. const f2 = Fe(m, o);
  12136. return o += f2.length, f2 === "" ? "" : p + f2 + rt2(m, o);
  12137. }
  12138. function $n(m, o) {
  12139. const p = ts(m, o);
  12140. return o += p.length, p === "" ? "" : p + rt2(m, o);
  12141. }
  12142. const vi = di([
  12143. un,
  12144. ns,
  12145. $n
  12146. ]);
  12147. function bi(m, o) {
  12148. var p;
  12149. const f2 = m.substr(o).match(/^[01]+/);
  12150. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12151. }
  12152. function $s(m, o) {
  12153. const p = m.substr(o, 2);
  12154. if (o += p.length, p.toLowerCase() !== "0b")
  12155. return "";
  12156. const f2 = bi(m, o);
  12157. return f2 === "" ? "" : p + f2;
  12158. }
  12159. function Xs(m, o) {
  12160. var p;
  12161. const f2 = m.substr(o).match(/^[0-7]+/);
  12162. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12163. }
  12164. function Ys(m, o) {
  12165. const p = m.substr(o, 2);
  12166. if (o += p.length, p.toLowerCase() !== "0o")
  12167. return "";
  12168. const f2 = Xs(m, o);
  12169. return f2 === "" ? "" : p + f2;
  12170. }
  12171. function qs(m, o) {
  12172. var p;
  12173. const f2 = m.substr(o).match(/^[0-9a-f]+/i);
  12174. return (p = f2 && f2[0]) !== null && p !== void 0 ? p : "";
  12175. }
  12176. function gi(m, o) {
  12177. const p = m.substr(o, 2);
  12178. if (o += p.length, p.toLowerCase() !== "0x")
  12179. return "";
  12180. const f2 = qs(m, o);
  12181. return f2 === "" ? "" : p + f2;
  12182. }
  12183. const Qs = di([
  12184. $s,
  12185. Ys,
  12186. gi
  12187. ]), Zs = di([
  12188. Qs,
  12189. vi
  12190. ]);
  12191. function hn(m, o) {
  12192. const p = Zs(m, o);
  12193. return o += p.length, p === "" ? null : {
  12194. evaluable: new Ue(p),
  12195. cursor: o
  12196. };
  12197. }
  12198. function is(m, o) {
  12199. const p = m.substr(o, 1);
  12200. if (o += p.length, p !== "(")
  12201. return null;
  12202. const f2 = _i(m, o);
  12203. if (!f2)
  12204. return null;
  12205. o = f2.cursor, o += Lt(m, o).length;
  12206. const x = m.substr(o, 1);
  12207. return o += x.length, x !== ")" ? null : {
  12208. evaluable: f2.evaluable,
  12209. cursor: o
  12210. };
  12211. }
  12212. function Ws(m, o) {
  12213. var p;
  12214. return (p = hn(m, o)) !== null && p !== void 0 ? p : is(m, o);
  12215. }
  12216. function Xn(m, o) {
  12217. const p = Ws(m, o);
  12218. if (p)
  12219. return p;
  12220. const f2 = m.substr(o, 1);
  12221. if (o += f2.length, f2 !== "+" && f2 !== "-" && f2 !== "~")
  12222. return null;
  12223. const x = Xn(m, o);
  12224. return x ? (o = x.cursor, {
  12225. cursor: o,
  12226. evaluable: new Ks(f2, x.evaluable)
  12227. }) : null;
  12228. }
  12229. function Js(m, o, p) {
  12230. p += Lt(o, p).length;
  12231. const f2 = m.filter((x) => o.startsWith(x, p))[0];
  12232. return f2 ? (p += f2.length, p += Lt(o, p).length, {
  12233. cursor: p,
  12234. operator: f2
  12235. }) : null;
  12236. }
  12237. function Gt(m, o) {
  12238. return (p, f2) => {
  12239. const x = m(p, f2);
  12240. if (!x)
  12241. return null;
  12242. f2 = x.cursor;
  12243. let P = x.evaluable;
  12244. for (; ; ) {
  12245. const L2 = Js(o, p, f2);
  12246. if (!L2)
  12247. break;
  12248. f2 = L2.cursor;
  12249. const z = m(p, f2);
  12250. if (!z)
  12251. return null;
  12252. f2 = z.cursor, P = new Gs(L2.operator, P, z.evaluable);
  12253. }
  12254. return P ? {
  12255. cursor: f2,
  12256. evaluable: P
  12257. } : null;
  12258. };
  12259. }
  12260. const ss = [
  12261. ["**"],
  12262. ["*", "/", "%"],
  12263. ["+", "-"],
  12264. ["<<", ">>>", ">>"],
  12265. ["&"],
  12266. ["^"],
  12267. ["|"]
  12268. ].reduce((m, o) => Gt(m, o), Xn);
  12269. function _i(m, o) {
  12270. return o += Lt(m, o).length, ss(m, o);
  12271. }
  12272. function er(m) {
  12273. const o = _i(m, 0);
  12274. return !o || o.cursor + Lt(m, o.cursor).length !== m.length ? null : o.evaluable;
  12275. }
  12276. function dn(m) {
  12277. var o;
  12278. const p = er(m);
  12279. return (o = p == null ? void 0 : p.evaluate()) !== null && o !== void 0 ? o : null;
  12280. }
  12281. function tr(m) {
  12282. if (typeof m == "number")
  12283. return m;
  12284. if (typeof m == "string") {
  12285. const o = dn(m);
  12286. if (!h2(o))
  12287. return o;
  12288. }
  12289. return 0;
  12290. }
  12291. function Le(m) {
  12292. return (o) => o.toFixed(Math.max(Math.min(m, 20), 0));
  12293. }
  12294. const nr = Le(0);
  12295. function Yn(m) {
  12296. return nr(m) + "%";
  12297. }
  12298. function rs(m) {
  12299. return String(m);
  12300. }
  12301. function wi(m, o) {
  12302. for (; m.length < o; )
  12303. m.push(void 0);
  12304. }
  12305. function os(m) {
  12306. const o = [];
  12307. return wi(o, m), H2(o);
  12308. }
  12309. function as(m) {
  12310. const o = m.indexOf(void 0);
  12311. return o < 0 ? m : m.slice(0, o);
  12312. }
  12313. function ir(m, o) {
  12314. const p = [...as(m), o];
  12315. return p.length > m.length ? p.splice(0, p.length - m.length) : wi(p, m.length), p;
  12316. }
  12317. function Ht({ primary: m, secondary: o, forward: p, backward: f2 }) {
  12318. let x = false;
  12319. function P(L2) {
  12320. x || (x = true, L2(), x = false);
  12321. }
  12322. m.emitter.on("change", (L2) => {
  12323. P(() => {
  12324. o.setRawValue(p(m, o), L2.options);
  12325. });
  12326. }), o.emitter.on("change", (L2) => {
  12327. P(() => {
  12328. m.setRawValue(f2(m, o), L2.options);
  12329. }), P(() => {
  12330. o.setRawValue(p(m, o), L2.options);
  12331. });
  12332. }), P(() => {
  12333. o.setRawValue(p(m, o), {
  12334. forceEmit: false,
  12335. last: true
  12336. });
  12337. });
  12338. }
  12339. function Kt(m, o) {
  12340. const p = m * (o.altKey ? 0.1 : 1) * (o.shiftKey ? 10 : 1);
  12341. return o.upKey ? +p : o.downKey ? -p : 0;
  12342. }
  12343. function mn(m) {
  12344. return {
  12345. altKey: m.altKey,
  12346. downKey: m.key === "ArrowDown",
  12347. shiftKey: m.shiftKey,
  12348. upKey: m.key === "ArrowUp"
  12349. };
  12350. }
  12351. function yi(m) {
  12352. return {
  12353. altKey: m.altKey,
  12354. downKey: m.key === "ArrowLeft",
  12355. shiftKey: m.shiftKey,
  12356. upKey: m.key === "ArrowRight"
  12357. };
  12358. }
  12359. function sr(m) {
  12360. return m === "ArrowUp" || m === "ArrowDown";
  12361. }
  12362. function ls(m) {
  12363. return sr(m) || m === "ArrowLeft" || m === "ArrowRight";
  12364. }
  12365. function xi(m, o) {
  12366. var p, f2;
  12367. const x = o.ownerDocument.defaultView, P = o.getBoundingClientRect();
  12368. return {
  12369. x: m.pageX - (((p = x && x.scrollX) !== null && p !== void 0 ? p : 0) + P.left),
  12370. y: m.pageY - (((f2 = x && x.scrollY) !== null && f2 !== void 0 ? f2 : 0) + P.top)
  12371. };
  12372. }
  12373. class qn {
  12374. constructor(o) {
  12375. this.lastTouch_ = null, this.onDocumentMouseMove_ = this.onDocumentMouseMove_.bind(this), this.onDocumentMouseUp_ = this.onDocumentMouseUp_.bind(this), this.onMouseDown_ = this.onMouseDown_.bind(this), this.onTouchEnd_ = this.onTouchEnd_.bind(this), this.onTouchMove_ = this.onTouchMove_.bind(this), this.onTouchStart_ = this.onTouchStart_.bind(this), this.elem_ = o, this.emitter = new w(), o.addEventListener("touchstart", this.onTouchStart_, {
  12376. passive: false
  12377. }), o.addEventListener("touchmove", this.onTouchMove_, {
  12378. passive: true
  12379. }), o.addEventListener("touchend", this.onTouchEnd_), o.addEventListener("mousedown", this.onMouseDown_);
  12380. }
  12381. computePosition_(o) {
  12382. const p = this.elem_.getBoundingClientRect();
  12383. return {
  12384. bounds: {
  12385. width: p.width,
  12386. height: p.height
  12387. },
  12388. point: o ? {
  12389. x: o.x,
  12390. y: o.y
  12391. } : null
  12392. };
  12393. }
  12394. onMouseDown_(o) {
  12395. var p;
  12396. o.preventDefault(), (p = o.currentTarget) === null || p === void 0 || p.focus();
  12397. const f2 = this.elem_.ownerDocument;
  12398. f2.addEventListener("mousemove", this.onDocumentMouseMove_), f2.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  12399. altKey: o.altKey,
  12400. data: this.computePosition_(xi(o, this.elem_)),
  12401. sender: this,
  12402. shiftKey: o.shiftKey
  12403. });
  12404. }
  12405. onDocumentMouseMove_(o) {
  12406. this.emitter.emit("move", {
  12407. altKey: o.altKey,
  12408. data: this.computePosition_(xi(o, this.elem_)),
  12409. sender: this,
  12410. shiftKey: o.shiftKey
  12411. });
  12412. }
  12413. onDocumentMouseUp_(o) {
  12414. const p = this.elem_.ownerDocument;
  12415. p.removeEventListener("mousemove", this.onDocumentMouseMove_), p.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  12416. altKey: o.altKey,
  12417. data: this.computePosition_(xi(o, this.elem_)),
  12418. sender: this,
  12419. shiftKey: o.shiftKey
  12420. });
  12421. }
  12422. onTouchStart_(o) {
  12423. o.preventDefault();
  12424. const p = o.targetTouches.item(0), f2 = this.elem_.getBoundingClientRect();
  12425. this.emitter.emit("down", {
  12426. altKey: o.altKey,
  12427. data: this.computePosition_(p ? {
  12428. x: p.clientX - f2.left,
  12429. y: p.clientY - f2.top
  12430. } : void 0),
  12431. sender: this,
  12432. shiftKey: o.shiftKey
  12433. }), this.lastTouch_ = p;
  12434. }
  12435. onTouchMove_(o) {
  12436. const p = o.targetTouches.item(0), f2 = this.elem_.getBoundingClientRect();
  12437. this.emitter.emit("move", {
  12438. altKey: o.altKey,
  12439. data: this.computePosition_(p ? {
  12440. x: p.clientX - f2.left,
  12441. y: p.clientY - f2.top
  12442. } : void 0),
  12443. sender: this,
  12444. shiftKey: o.shiftKey
  12445. }), this.lastTouch_ = p;
  12446. }
  12447. onTouchEnd_(o) {
  12448. var p;
  12449. const f2 = (p = o.targetTouches.item(0)) !== null && p !== void 0 ? p : this.lastTouch_, x = this.elem_.getBoundingClientRect();
  12450. this.emitter.emit("up", {
  12451. altKey: o.altKey,
  12452. data: this.computePosition_(f2 ? {
  12453. x: f2.clientX - x.left,
  12454. y: f2.clientY - x.top
  12455. } : void 0),
  12456. sender: this,
  12457. shiftKey: o.shiftKey
  12458. });
  12459. }
  12460. }
  12461. function Me(m, o, p, f2, x) {
  12462. const P = (m - o) / (p - o);
  12463. return f2 + P * (x - f2);
  12464. }
  12465. function cs(m) {
  12466. return String(m.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  12467. }
  12468. function $t(m, o, p) {
  12469. return Math.min(Math.max(m, o), p);
  12470. }
  12471. const Ye2 = y2("txt");
  12472. class rr {
  12473. constructor(o, p) {
  12474. this.onChange_ = this.onChange_.bind(this), this.props_ = p.props, this.props_.emitter.on("change", this.onChange_), this.element = o.createElement("div"), this.element.classList.add(Ye2(), Ye2(void 0, "num")), p.arrayPosition && this.element.classList.add(Ye2(void 0, p.arrayPosition)), p.viewProps.bindClassModifiers(this.element);
  12475. const f2 = o.createElement("input");
  12476. f2.classList.add(Ye2("i")), f2.type = "text", p.viewProps.bindDisabled(f2), this.element.appendChild(f2), this.inputElement = f2, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = p.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(Ye2()), this.inputElement.classList.add(Ye2("i"));
  12477. const x = o.createElement("div");
  12478. x.classList.add(Ye2("k")), this.element.appendChild(x), this.knobElement = x;
  12479. const P = o.createElementNS(we, "svg");
  12480. P.classList.add(Ye2("g")), this.knobElement.appendChild(P);
  12481. const L2 = o.createElementNS(we, "path");
  12482. L2.classList.add(Ye2("gb")), P.appendChild(L2), this.guideBodyElem_ = L2;
  12483. const z = o.createElementNS(we, "path");
  12484. z.classList.add(Ye2("gh")), P.appendChild(z), this.guideHeadElem_ = z;
  12485. const oe = o.createElement("div");
  12486. oe.classList.add(y2("tt")()), this.knobElement.appendChild(oe), this.tooltipElem_ = oe, p.value.emitter.on("change", this.onChange_), this.value = p.value, this.refresh();
  12487. }
  12488. onDraggingChange_(o) {
  12489. if (o.rawValue === null) {
  12490. this.element.classList.remove(Ye2(void 0, "drg"));
  12491. return;
  12492. }
  12493. this.element.classList.add(Ye2(void 0, "drg"));
  12494. const p = o.rawValue / this.props_.get("draggingScale"), f2 = p + (p > 0 ? -1 : p < 0 ? 1 : 0), x = $t(-f2, -4, 4);
  12495. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${f2 + x},0 L${f2},4 L${f2 + x},8`, `M ${p},-1 L${p},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${p},4`);
  12496. const P = this.props_.get("formatter");
  12497. this.tooltipElem_.textContent = P(this.value.rawValue), this.tooltipElem_.style.left = `${p}px`;
  12498. }
  12499. refresh() {
  12500. const o = this.props_.get("formatter");
  12501. this.inputElement.value = o(this.value.rawValue);
  12502. }
  12503. onChange_() {
  12504. this.refresh();
  12505. }
  12506. }
  12507. class fn {
  12508. constructor(o, p) {
  12509. var f2;
  12510. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = p.baseStep, this.parser_ = p.parser, this.props = p.props, this.sliderProps_ = (f2 = p.sliderProps) !== null && f2 !== void 0 ? f2 : null, this.value = p.value, this.viewProps = p.viewProps, this.dragging_ = H2(null), this.view = new rr(o, {
  12511. arrayPosition: p.arrayPosition,
  12512. dragging: this.dragging_,
  12513. props: this.props,
  12514. value: this.value,
  12515. viewProps: this.viewProps
  12516. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  12517. const x = new qn(this.view.knobElement);
  12518. x.emitter.on("down", this.onPointerDown_), x.emitter.on("move", this.onPointerMove_), x.emitter.on("up", this.onPointerUp_);
  12519. }
  12520. constrainValue_(o) {
  12521. var p, f2;
  12522. const x = (p = this.sliderProps_) === null || p === void 0 ? void 0 : p.get("minValue"), P = (f2 = this.sliderProps_) === null || f2 === void 0 ? void 0 : f2.get("maxValue");
  12523. let L2 = o;
  12524. return x !== void 0 && (L2 = Math.max(L2, x)), P !== void 0 && (L2 = Math.min(L2, P)), L2;
  12525. }
  12526. onInputChange_(o) {
  12527. const f2 = o.currentTarget.value, x = this.parser_(f2);
  12528. h2(x) || (this.value.rawValue = this.constrainValue_(x)), this.view.refresh();
  12529. }
  12530. onInputKeyDown_(o) {
  12531. const p = Kt(this.baseStep_, mn(o));
  12532. p !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + p), {
  12533. forceEmit: false,
  12534. last: false
  12535. });
  12536. }
  12537. onInputKeyUp_(o) {
  12538. Kt(this.baseStep_, mn(o)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  12539. forceEmit: true,
  12540. last: true
  12541. });
  12542. }
  12543. onPointerDown_() {
  12544. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  12545. }
  12546. computeDraggingValue_(o) {
  12547. if (!o.point)
  12548. return null;
  12549. const p = o.point.x - o.bounds.width / 2;
  12550. return this.constrainValue_(this.originRawValue_ + p * this.props.get("draggingScale"));
  12551. }
  12552. onPointerMove_(o) {
  12553. const p = this.computeDraggingValue_(o.data);
  12554. p !== null && (this.value.setRawValue(p, {
  12555. forceEmit: false,
  12556. last: false
  12557. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  12558. }
  12559. onPointerUp_(o) {
  12560. const p = this.computeDraggingValue_(o.data);
  12561. p !== null && (this.value.setRawValue(p, {
  12562. forceEmit: true,
  12563. last: true
  12564. }), this.dragging_.rawValue = null);
  12565. }
  12566. }
  12567. function et2(m, o) {
  12568. m.write(o);
  12569. }
  12570. function Xt(m) {
  12571. const o = m ? xt(m, A2) : null;
  12572. return o ? o.step : null;
  12573. }
  12574. function vn(m, o) {
  12575. const p = m && xt(m, A2);
  12576. return p ? cs(p.step) : Math.max(cs(o), 2);
  12577. }
  12578. function Ei(m) {
  12579. const o = Xt(m);
  12580. return o ?? 1;
  12581. }
  12582. function Qn(m, o) {
  12583. var p;
  12584. const f2 = m && xt(m, A2), x = Math.abs((p = f2 == null ? void 0 : f2.step) !== null && p !== void 0 ? p : o);
  12585. return x === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(x)) - 1);
  12586. }
  12587. function Yt(m) {
  12588. return [m[0], m[1], m[2]];
  12589. }
  12590. function ps(m) {
  12591. const o = $t(Math.floor(m), 0, 255).toString(16);
  12592. return o.length === 1 ? `0${o}` : o;
  12593. }
  12594. function bn(m, o = "#") {
  12595. const p = Yt(m.getComponents("rgb")).map(ps).join("");
  12596. return `${o}${p}`;
  12597. }
  12598. function us(m, o = "#") {
  12599. const p = m.getComponents("rgb"), f2 = [p[0], p[1], p[2], p[3] * 255].map(ps).join("");
  12600. return `${o}${f2}`;
  12601. }
  12602. function or(m, o) {
  12603. const p = Le(o === "float" ? 2 : 0);
  12604. return `rgb(${Yt(m.getComponents("rgb", o)).map((x) => p(x)).join(", ")})`;
  12605. }
  12606. function hs(m) {
  12607. return (o) => or(o, m);
  12608. }
  12609. function ds(m, o) {
  12610. const p = Le(2), f2 = Le(o === "float" ? 2 : 0);
  12611. return `rgba(${m.getComponents("rgb", o).map((P, L2) => (L2 === 3 ? p : f2)(P)).join(", ")})`;
  12612. }
  12613. function ar(m) {
  12614. return (o) => ds(o, m);
  12615. }
  12616. function Zn(m) {
  12617. const o = [
  12618. Le(0),
  12619. Yn,
  12620. Yn
  12621. ];
  12622. return `hsl(${Yt(m.getComponents("hsl")).map((f2, x) => o[x](f2)).join(", ")})`;
  12623. }
  12624. function lr(m) {
  12625. const o = [
  12626. Le(0),
  12627. Yn,
  12628. Yn,
  12629. Le(2)
  12630. ];
  12631. return `hsla(${m.getComponents("hsl").map((f2, x) => o[x](f2)).join(", ")})`;
  12632. }
  12633. function ms(m, o) {
  12634. const p = Le(o === "float" ? 2 : 0), f2 = ["r", "g", "b"];
  12635. return `{${Yt(m.getComponents("rgb", o)).map((P, L2) => `${f2[L2]}: ${p(P)}`).join(", ")}}`;
  12636. }
  12637. function fs(m) {
  12638. return (o) => ms(o, m);
  12639. }
  12640. function cr(m, o) {
  12641. const p = Le(2), f2 = Le(o === "float" ? 2 : 0), x = ["r", "g", "b", "a"];
  12642. return `{${m.getComponents("rgb", o).map((L2, z) => {
  12643. const oe = z === 3 ? p : f2;
  12644. return `${x[z]}: ${oe(L2)}`;
  12645. }).join(", ")}}`;
  12646. }
  12647. function pr(m) {
  12648. return (o) => cr(o, m);
  12649. }
  12650. [
  12651. ...["int", "float"].reduce((m, o) => [
  12652. ...m,
  12653. {
  12654. format: {
  12655. alpha: false,
  12656. mode: "rgb",
  12657. notation: "func",
  12658. type: o
  12659. },
  12660. stringifier: hs(o)
  12661. },
  12662. {
  12663. format: {
  12664. alpha: true,
  12665. mode: "rgb",
  12666. notation: "func",
  12667. type: o
  12668. },
  12669. stringifier: ar(o)
  12670. },
  12671. {
  12672. format: {
  12673. alpha: false,
  12674. mode: "rgb",
  12675. notation: "object",
  12676. type: o
  12677. },
  12678. stringifier: fs(o)
  12679. },
  12680. {
  12681. format: {
  12682. alpha: true,
  12683. mode: "rgb",
  12684. notation: "object",
  12685. type: o
  12686. },
  12687. stringifier: pr(o)
  12688. }
  12689. ], [])
  12690. ];
  12691. class ur {
  12692. constructor(o) {
  12693. this.components = o.components, this.asm_ = o.assembly;
  12694. }
  12695. constrain(o) {
  12696. const p = this.asm_.toComponents(o).map((f2, x) => {
  12697. var P, L2;
  12698. return (L2 = (P = this.components[x]) === null || P === void 0 ? void 0 : P.constrain(f2)) !== null && L2 !== void 0 ? L2 : f2;
  12699. });
  12700. return this.asm_.fromComponents(p);
  12701. }
  12702. }
  12703. const vs = y2("pndtxt");
  12704. class hr {
  12705. constructor(o, p) {
  12706. this.textViews = p.textViews, this.element = o.createElement("div"), this.element.classList.add(vs()), this.textViews.forEach((f2) => {
  12707. const x = o.createElement("div");
  12708. x.classList.add(vs("a")), x.appendChild(f2.element), this.element.appendChild(x);
  12709. });
  12710. }
  12711. }
  12712. function Ci(m, o, p) {
  12713. return new fn(m, {
  12714. arrayPosition: p === 0 ? "fst" : p === o.axes.length - 1 ? "lst" : "mid",
  12715. baseStep: o.axes[p].baseStep,
  12716. parser: o.parser,
  12717. props: o.axes[p].textProps,
  12718. value: H2(0, {
  12719. constraint: o.axes[p].constraint
  12720. }),
  12721. viewProps: o.viewProps
  12722. });
  12723. }
  12724. class Rt {
  12725. constructor(o, p) {
  12726. this.value = p.value, this.viewProps = p.viewProps, this.acs_ = p.axes.map((f2, x) => Ci(o, p, x)), this.acs_.forEach((f2, x) => {
  12727. Ht({
  12728. primary: this.value,
  12729. secondary: f2.value,
  12730. forward: (P) => p.assembly.toComponents(P.rawValue)[x],
  12731. backward: (P, L2) => {
  12732. const z = p.assembly.toComponents(P.rawValue);
  12733. return z[x] = L2.rawValue, p.assembly.fromComponents(z);
  12734. }
  12735. });
  12736. }), this.view = new hr(o, {
  12737. textViews: this.acs_.map((f2) => f2.view)
  12738. });
  12739. }
  12740. }
  12741. function dr(m, o) {
  12742. return "step" in m && !h2(m.step) ? new A2(m.step, o) : null;
  12743. }
  12744. function gn(m) {
  12745. return !h2(m.max) && !h2(m.min) ? new ft({
  12746. max: m.max,
  12747. min: m.min
  12748. }) : !h2(m.max) || !h2(m.min) ? new At({
  12749. max: m.max,
  12750. min: m.min
  12751. }) : null;
  12752. }
  12753. const mr = {
  12754. monitor: {
  12755. defaultInterval: 200,
  12756. defaultLineCount: 3
  12757. }
  12758. }, ot2 = y2("grl");
  12759. class bs {
  12760. constructor(o, p) {
  12761. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = o.createElement("div"), this.element.classList.add(ot2()), p.viewProps.bindClassModifiers(this.element), this.formatter_ = p.formatter, this.props_ = p.props, this.cursor_ = p.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  12762. const f2 = o.createElementNS(we, "svg");
  12763. f2.classList.add(ot2("g")), f2.style.height = `calc(var(--bld-us) * ${p.lineCount})`, this.element.appendChild(f2), this.svgElem_ = f2;
  12764. const x = o.createElementNS(we, "polyline");
  12765. this.svgElem_.appendChild(x), this.lineElem_ = x;
  12766. const P = o.createElement("div");
  12767. P.classList.add(ot2("t"), y2("tt")()), this.element.appendChild(P), this.tooltipElem_ = P, p.value.emitter.on("change", this.onValueUpdate_), this.value = p.value, this.update_();
  12768. }
  12769. get graphElement() {
  12770. return this.svgElem_;
  12771. }
  12772. update_() {
  12773. const o = this.svgElem_.getBoundingClientRect(), p = this.value.rawValue.length - 1, f2 = this.props_.get("minValue"), x = this.props_.get("maxValue"), P = [];
  12774. this.value.rawValue.forEach((Ze2, te2) => {
  12775. if (Ze2 === void 0)
  12776. return;
  12777. const Pt = Me(te2, 0, p, 0, o.width), Mr = Me(Ze2, f2, x, o.height, 0);
  12778. P.push([Pt, Mr].join(","));
  12779. }), this.lineElem_.setAttributeNS(null, "points", P.join(" "));
  12780. const L2 = this.tooltipElem_, z = this.value.rawValue[this.cursor_.rawValue];
  12781. if (z === void 0) {
  12782. L2.classList.remove(ot2("t", "a"));
  12783. return;
  12784. }
  12785. const oe = Me(this.cursor_.rawValue, 0, p, 0, o.width), Qe2 = Me(z, f2, x, o.height, 0);
  12786. L2.style.left = `${oe}px`, L2.style.top = `${Qe2}px`, L2.textContent = `${this.formatter_(z)}`, L2.classList.contains(ot2("t", "a")) || (L2.classList.add(ot2("t", "a"), ot2("t", "in")), it2(L2), L2.classList.remove(ot2("t", "in")));
  12787. }
  12788. onValueUpdate_() {
  12789. this.update_();
  12790. }
  12791. onCursorChange_() {
  12792. this.update_();
  12793. }
  12794. }
  12795. class fr {
  12796. constructor(o, p) {
  12797. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = p.props, this.value = p.value, this.viewProps = p.viewProps, this.cursor_ = H2(-1), this.view = new bs(o, {
  12798. cursor: this.cursor_,
  12799. formatter: p.formatter,
  12800. lineCount: p.lineCount,
  12801. props: this.props_,
  12802. value: this.value,
  12803. viewProps: this.viewProps
  12804. }), !Xe2(o))
  12805. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  12806. else {
  12807. const f2 = new qn(this.view.element);
  12808. f2.emitter.on("down", this.onGraphPointerDown_), f2.emitter.on("move", this.onGraphPointerMove_), f2.emitter.on("up", this.onGraphPointerUp_);
  12809. }
  12810. }
  12811. onGraphMouseLeave_() {
  12812. this.cursor_.rawValue = -1;
  12813. }
  12814. onGraphMouseMove_(o) {
  12815. const p = this.view.element.getBoundingClientRect();
  12816. this.cursor_.rawValue = Math.floor(Me(o.offsetX, 0, p.width, 0, this.value.rawValue.length));
  12817. }
  12818. onGraphPointerDown_(o) {
  12819. this.onGraphPointerMove_(o);
  12820. }
  12821. onGraphPointerMove_(o) {
  12822. if (!o.data.point) {
  12823. this.cursor_.rawValue = -1;
  12824. return;
  12825. }
  12826. this.cursor_.rawValue = Math.floor(Me(o.data.point.x, 0, o.data.bounds.width, 0, this.value.rawValue.length));
  12827. }
  12828. onGraphPointerUp_() {
  12829. this.cursor_.rawValue = -1;
  12830. }
  12831. }
  12832. class gs {
  12833. constructor(o) {
  12834. this.controller_ = o;
  12835. }
  12836. get disabled() {
  12837. return this.controller_.viewProps.get("disabled");
  12838. }
  12839. set disabled(o) {
  12840. this.controller_.viewProps.set("disabled", o);
  12841. }
  12842. get title() {
  12843. var o;
  12844. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  12845. }
  12846. set title(o) {
  12847. this.controller_.props.set("title", o);
  12848. }
  12849. on(o, p) {
  12850. const f2 = p.bind(this);
  12851. return this.controller_.emitter.on(o, () => {
  12852. f2(new a(this));
  12853. }), this;
  12854. }
  12855. }
  12856. class vr extends a {
  12857. constructor(o, p, f2) {
  12858. super(o), this.cell = p, this.index = f2;
  12859. }
  12860. }
  12861. class _s extends s {
  12862. constructor(o) {
  12863. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.emitter_ = new w();
  12864. const p = this.controller_.valueController;
  12865. p.cellControllers.forEach((f2, x) => {
  12866. const P = new gs(f2);
  12867. this.cellToApiMap_.set(f2, P), f2.emitter.on("click", () => {
  12868. const L2 = x % p.size[0], z = Math.floor(x / p.size[0]);
  12869. this.emitter_.emit("click", {
  12870. event: new vr(this, P, [L2, z])
  12871. });
  12872. });
  12873. });
  12874. }
  12875. cell(o, p) {
  12876. const f2 = this.controller_.valueController, x = f2.cellControllers[p * f2.size[0] + o];
  12877. return this.cellToApiMap_.get(x);
  12878. }
  12879. on(o, p) {
  12880. const f2 = p.bind(this);
  12881. return this.emitter_.on(o, (x) => {
  12882. f2(x.event);
  12883. }), this;
  12884. }
  12885. }
  12886. class Pi {
  12887. constructor(o, p) {
  12888. this.size = p.size;
  12889. const [f2, x] = this.size, P = [];
  12890. for (let L2 = 0; L2 < x; L2++)
  12891. for (let z = 0; z < f2; z++) {
  12892. const oe = new G2(o, {
  12893. props: K.fromObject(Object.assign({}, p.cellConfig(z, L2))),
  12894. viewProps: be.create()
  12895. });
  12896. P.push(oe);
  12897. }
  12898. this.cellCs_ = P, this.viewProps = be.create(), this.viewProps.handleDispose(() => {
  12899. this.cellCs_.forEach((L2) => {
  12900. L2.viewProps.set("disposed", true);
  12901. });
  12902. }), this.view = new yt(o, {
  12903. viewProps: this.viewProps,
  12904. viewName: "btngrid"
  12905. }), this.view.element.style.gridTemplateColumns = `repeat(${f2}, 1fr)`, this.cellCs_.forEach((L2) => {
  12906. this.view.element.appendChild(L2.view.element);
  12907. });
  12908. }
  12909. get cellControllers() {
  12910. return this.cellCs_;
  12911. }
  12912. }
  12913. const br = {
  12914. id: "buttongrid",
  12915. type: "blade",
  12916. // TODO:
  12917. 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}',
  12918. accept(m) {
  12919. const o = he, p = ee2(m, {
  12920. cells: o.required.function,
  12921. size: o.required.array(o.required.number),
  12922. view: o.required.constant("buttongrid"),
  12923. label: o.optional.string
  12924. });
  12925. return p ? { params: p } : null;
  12926. },
  12927. controller(m) {
  12928. return new st2(m.document, {
  12929. blade: m.blade,
  12930. props: K.fromObject({
  12931. label: m.params.label
  12932. }),
  12933. valueController: new Pi(m.document, {
  12934. cellConfig: m.params.cells,
  12935. size: m.params.size
  12936. })
  12937. });
  12938. },
  12939. api(m) {
  12940. return !(m.controller instanceof st2) || !(m.controller.valueController instanceof Pi) ? null : new _s(m.controller);
  12941. }
  12942. };
  12943. class ws extends s {
  12944. get label() {
  12945. return this.controller_.props.get("label");
  12946. }
  12947. set label(o) {
  12948. this.controller_.props.set("label", o);
  12949. }
  12950. get value() {
  12951. return this.controller_.valueController.value.rawValue;
  12952. }
  12953. set value(o) {
  12954. this.controller_.valueController.value.rawValue = o;
  12955. }
  12956. on(o, p) {
  12957. const f2 = p.bind(this);
  12958. return this.controller_.valueController.value.emitter.on(o, (x) => {
  12959. f2(new c(this, x.rawValue, void 0, x.options.last));
  12960. }), this;
  12961. }
  12962. }
  12963. function qe2(m, o, p) {
  12964. return m * (1 - p) + o * p;
  12965. }
  12966. const gr = 20, _r = 1e-3, Ti = 100;
  12967. function wr(m, o) {
  12968. let p = 0.25, f2 = 0.5, x = -1;
  12969. for (let P = 0; P < gr; P++) {
  12970. const [L2, z] = m.curve(f2);
  12971. if (f2 += p * (L2 < o ? 1 : -1), x = z, p *= 0.5, Math.abs(o - L2) < _r)
  12972. break;
  12973. }
  12974. return x;
  12975. }
  12976. class Et {
  12977. constructor(o = 0, p = 0, f2 = 1, x = 1) {
  12978. this.cache_ = [], this.comps_ = [o, p, f2, x];
  12979. }
  12980. get x1() {
  12981. return this.comps_[0];
  12982. }
  12983. get y1() {
  12984. return this.comps_[1];
  12985. }
  12986. get x2() {
  12987. return this.comps_[2];
  12988. }
  12989. get y2() {
  12990. return this.comps_[3];
  12991. }
  12992. static isObject(o) {
  12993. return h2(o) || !Array.isArray(o) ? false : typeof o[0] == "number" && typeof o[1] == "number" && typeof o[2] == "number" && typeof o[3] == "number";
  12994. }
  12995. static equals(o, p) {
  12996. return o.x1 === p.x1 && o.y1 === p.y1 && o.x2 === p.x2 && o.y2 === p.y2;
  12997. }
  12998. curve(o) {
  12999. const p = qe2(0, this.x1, o), f2 = qe2(0, this.y1, o), x = qe2(this.x1, this.x2, o), P = qe2(this.y1, this.y2, o), L2 = qe2(this.x2, 1, o), z = qe2(this.y2, 1, o), oe = qe2(p, x, o), Qe2 = qe2(f2, P, o), Ze2 = qe2(x, L2, o), te2 = qe2(P, z, o);
  13000. return [qe2(oe, Ze2, o), qe2(Qe2, te2, o)];
  13001. }
  13002. y(o) {
  13003. if (this.cache_.length === 0) {
  13004. const p = [];
  13005. for (let f2 = 0; f2 < Ti; f2++)
  13006. p.push(wr(this, Me(f2, 0, Ti - 1, 0, 1)));
  13007. this.cache_ = p;
  13008. }
  13009. return this.cache_[Math.round(Me($t(o, 0, 1), 0, 1, 0, Ti - 1))];
  13010. }
  13011. toObject() {
  13012. return [this.comps_[0], this.comps_[1], this.comps_[2], this.comps_[3]];
  13013. }
  13014. }
  13015. const ki = {
  13016. toComponents: (m) => m.toObject(),
  13017. fromComponents: (m) => new Et(...m)
  13018. };
  13019. function yr(m) {
  13020. const o = Le(2);
  13021. return `cubic-bezier(${m.toObject().map((f2) => o(f2)).join(", ")})`;
  13022. }
  13023. const Mi = [0, 0.5, 0.5, 1];
  13024. function xr(m) {
  13025. const o = m.match(/^cubic-bezier\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*\)$/);
  13026. if (!o)
  13027. return new Et(...Mi);
  13028. const p = [o[1], o[2], o[3], o[4]].reduce((f2, x) => {
  13029. if (!f2)
  13030. return null;
  13031. const P = Number(x);
  13032. return isNaN(P) ? null : [...f2, P];
  13033. }, []);
  13034. return new Et(...p ?? Mi);
  13035. }
  13036. const It = y2("cbz");
  13037. class ys {
  13038. constructor(o, p) {
  13039. this.element = o.createElement("div"), this.element.classList.add(It()), p.viewProps.bindClassModifiers(this.element), p.foldable.bindExpandedClass(this.element, It(void 0, "expanded")), R2(p.foldable, "completed", F(this.element, It(void 0, "cpl")));
  13040. const f2 = o.createElement("div");
  13041. f2.classList.add(It("h")), this.element.appendChild(f2);
  13042. const x = o.createElement("button");
  13043. x.classList.add(It("b")), p.viewProps.bindDisabled(x);
  13044. const P = o.createElementNS(we, "svg");
  13045. P.innerHTML = '<path d="M2 13C8 13 8 3 14 3"/>', x.appendChild(P), f2.appendChild(x), this.buttonElement = x;
  13046. const L2 = o.createElement("div");
  13047. if (L2.classList.add(It("t")), f2.appendChild(L2), this.textElement = L2, p.pickerLayout === "inline") {
  13048. const z = o.createElement("div");
  13049. z.classList.add(It("p")), this.element.appendChild(z), this.pickerElement = z;
  13050. } else
  13051. this.pickerElement = null;
  13052. }
  13053. }
  13054. const Wn = y2("cbzp");
  13055. class xs {
  13056. constructor(o, p) {
  13057. this.element = o.createElement("div"), this.element.classList.add(Wn()), p.viewProps.bindClassModifiers(this.element);
  13058. const f2 = o.createElement("div");
  13059. f2.classList.add(Wn("g")), this.element.appendChild(f2), this.graphElement = f2;
  13060. const x = o.createElement("div");
  13061. x.classList.add(Wn("t")), this.element.appendChild(x), this.textElement = x;
  13062. }
  13063. }
  13064. function at2(m, o) {
  13065. const p = new MutationObserver((x) => {
  13066. for (const P of x)
  13067. P.type === "childList" && P.addedNodes.forEach((L2) => {
  13068. L2.contains(L2) && (o(), p.disconnect());
  13069. });
  13070. }), f2 = m.ownerDocument;
  13071. p.observe(f2.body, {
  13072. attributes: true,
  13073. childList: true,
  13074. subtree: true
  13075. });
  13076. }
  13077. const vt = y2("cbzg");
  13078. function Er(m, o) {
  13079. return (p) => o(m(p));
  13080. }
  13081. class Re {
  13082. constructor(o, p) {
  13083. this.element = o.createElement("div"), this.element.classList.add(vt()), p.viewProps.bindClassModifiers(this.element), p.viewProps.bindTabIndex(this.element);
  13084. const f2 = o.createElement("div");
  13085. f2.classList.add(vt("p")), this.element.appendChild(f2), this.previewElement = f2;
  13086. const x = o.createElementNS(we, "svg");
  13087. x.classList.add(vt("g")), this.element.appendChild(x), this.svgElem_ = x;
  13088. const P = o.createElementNS(we, "path");
  13089. P.classList.add(vt("u")), this.svgElem_.appendChild(P), this.guideElem_ = P;
  13090. const L2 = o.createElementNS(we, "polyline");
  13091. L2.classList.add(vt("l")), this.svgElem_.appendChild(L2), this.lineElem_ = L2, this.handleElems_ = [o.createElement("div"), o.createElement("div")], this.handleElems_.forEach((z) => {
  13092. z.classList.add(vt("h")), this.element.appendChild(z);
  13093. }), this.vectorElems_ = [
  13094. o.createElementNS(we, "line"),
  13095. o.createElementNS(we, "line")
  13096. ], this.vectorElems_.forEach((z) => {
  13097. z.classList.add(vt("v")), this.svgElem_.appendChild(z);
  13098. }), this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_.bind(this)), this.sel_ = p.selection, this.handleElems_.forEach((z, oe) => {
  13099. S2(this.sel_, Er((Qe2) => Qe2 === oe, F(z, vt("h", "sel"))));
  13100. }), at2(this.element, () => {
  13101. this.refresh();
  13102. });
  13103. }
  13104. getVertMargin_(o) {
  13105. return o * 0.25;
  13106. }
  13107. valueToPosition(o, p) {
  13108. const f2 = this.element.getBoundingClientRect(), x = f2.width, P = f2.height, L2 = this.getVertMargin_(P);
  13109. return {
  13110. x: Me(o, 0, 1, 0, x),
  13111. y: Me(p, 0, 1, P - L2, L2)
  13112. };
  13113. }
  13114. positionToValue(o, p) {
  13115. const f2 = this.element.getBoundingClientRect(), x = f2.width, P = f2.height, L2 = this.getVertMargin_(P);
  13116. return {
  13117. x: $t(Me(o, 0, x, 0, 1), 0, 1),
  13118. y: Me(p, P - L2, L2, 0, 1)
  13119. };
  13120. }
  13121. refresh() {
  13122. this.guideElem_.setAttributeNS(null, "d", [0, 1].map((P) => {
  13123. const L2 = this.valueToPosition(0, P), z = this.valueToPosition(1, P);
  13124. return [`M ${L2.x},${L2.y}`, `L ${z.x},${z.y}`].join(" ");
  13125. }).join(" "));
  13126. const o = this.value_.rawValue, p = [];
  13127. let f2 = 0;
  13128. for (; ; ) {
  13129. const P = this.valueToPosition(...o.curve(f2));
  13130. if (p.push([P.x, P.y].join(",")), f2 >= 1)
  13131. break;
  13132. f2 = Math.min(f2 + 0.05, 1);
  13133. }
  13134. this.lineElem_.setAttributeNS(null, "points", p.join(" "));
  13135. const x = o.toObject();
  13136. [0, 1].forEach((P) => {
  13137. const L2 = this.valueToPosition(P, P), z = this.valueToPosition(x[P * 2], x[P * 2 + 1]), oe = this.vectorElems_[P];
  13138. oe.setAttributeNS(null, "x1", String(L2.x)), oe.setAttributeNS(null, "y1", String(L2.y)), oe.setAttributeNS(null, "x2", String(z.x)), oe.setAttributeNS(null, "y2", String(z.y));
  13139. const Qe2 = this.handleElems_[P];
  13140. Qe2.style.left = `${z.x}px`, Qe2.style.top = `${z.y}px`;
  13141. });
  13142. }
  13143. onValueChange_() {
  13144. this.refresh();
  13145. }
  13146. }
  13147. const Es = 24, _n = 400, Si = 1e3, Ct = y2("cbzprv");
  13148. class qt {
  13149. constructor(o, p) {
  13150. this.stopped_ = true, this.startTime_ = -1, this.onDispose_ = this.onDispose_.bind(this), this.onTimer_ = this.onTimer_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(Ct()), p.viewProps.bindClassModifiers(this.element);
  13151. const f2 = o.createElementNS(we, "svg");
  13152. f2.classList.add(Ct("g")), this.element.appendChild(f2), this.svgElem_ = f2;
  13153. const x = o.createElementNS(we, "path");
  13154. x.classList.add(Ct("t")), this.svgElem_.appendChild(x), this.ticksElem_ = x;
  13155. const P = o.createElement("div");
  13156. P.classList.add(Ct("m")), this.element.appendChild(P), this.markerElem_ = P, this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_), p.viewProps.handleDispose(this.onDispose_), at2(this.element, () => {
  13157. this.refresh();
  13158. });
  13159. }
  13160. play() {
  13161. this.stop(), this.updateMarker_(0), this.markerElem_.classList.add(Ct("m", "a")), this.startTime_ = new Date().getTime() + _n, this.stopped_ = false, requestAnimationFrame(this.onTimer_);
  13162. }
  13163. stop() {
  13164. this.stopped_ = true, this.markerElem_.classList.remove(Ct("m", "a"));
  13165. }
  13166. onDispose_() {
  13167. this.stop();
  13168. }
  13169. updateMarker_(o) {
  13170. const p = this.value_.rawValue.y($t(o, 0, 1));
  13171. this.markerElem_.style.left = `${p * 100}%`;
  13172. }
  13173. refresh() {
  13174. const o = this.svgElem_.getBoundingClientRect(), p = o.width, f2 = o.height, x = [], P = this.value_.rawValue;
  13175. for (let L2 = 0; L2 < Es; L2++) {
  13176. const z = Me(L2, 0, Es - 1, 0, 1), oe = Me(P.y(z), 0, 1, 0, p);
  13177. x.push(`M ${oe},0 v${f2}`);
  13178. }
  13179. this.ticksElem_.setAttributeNS(null, "d", x.join(" "));
  13180. }
  13181. onTimer_() {
  13182. if (this.startTime_ === null)
  13183. return;
  13184. const o = new Date().getTime() - this.startTime_, p = o / Si;
  13185. this.updateMarker_(p), o > Si + _n && this.stop(), this.stopped_ || requestAnimationFrame(this.onTimer_);
  13186. }
  13187. onValueChange_() {
  13188. this.refresh(), this.play();
  13189. }
  13190. }
  13191. function Oe(m, o, p, f2) {
  13192. const x = p - m, P = f2 - o;
  13193. return Math.sqrt(x * x + P * P);
  13194. }
  13195. function wn(m, o, p, f2) {
  13196. const x = Oe(m, o, p, f2), P = Math.atan2(f2 - o, p - m), L2 = Math.round(P / (Math.PI / 4)) * Math.PI / 4;
  13197. return {
  13198. x: m + Math.cos(L2) * x,
  13199. y: o + Math.sin(L2) * x
  13200. };
  13201. }
  13202. class lt2 {
  13203. constructor(o, p) {
  13204. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = p.baseStep, this.value = p.value, this.sel_ = H2(0), this.viewProps = p.viewProps, this.view = new Re(o, {
  13205. selection: this.sel_,
  13206. value: this.value,
  13207. viewProps: this.viewProps
  13208. }), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_), this.prevView_ = new qt(o, {
  13209. value: this.value,
  13210. viewProps: this.viewProps
  13211. }), this.prevView_.element.addEventListener("mousedown", (x) => {
  13212. x.stopImmediatePropagation(), x.preventDefault(), this.prevView_.play();
  13213. }), this.view.previewElement.appendChild(this.prevView_.element);
  13214. const f2 = new qn(this.view.element);
  13215. f2.emitter.on("down", this.onPointerDown_), f2.emitter.on("move", this.onPointerMove_), f2.emitter.on("up", this.onPointerUp_);
  13216. }
  13217. refresh() {
  13218. this.view.refresh(), this.prevView_.refresh(), this.prevView_.play();
  13219. }
  13220. updateValue_(o, p, f2) {
  13221. const x = this.sel_.rawValue, P = this.value.rawValue.toObject(), L2 = this.view.positionToValue(o.x, o.y), z = p ? wn(x, x, L2.x, L2.y) : L2;
  13222. P[x * 2] = z.x, P[x * 2 + 1] = z.y, this.value.setRawValue(new Et(...P), f2);
  13223. }
  13224. onPointerDown_(o) {
  13225. const p = o.data;
  13226. if (!p.point)
  13227. return;
  13228. const f2 = this.value.rawValue, x = this.view.valueToPosition(f2.x1, f2.y1), P = Oe(p.point.x, p.point.y, x.x, x.y), L2 = this.view.valueToPosition(f2.x2, f2.y2), z = Oe(p.point.x, p.point.y, L2.x, L2.y);
  13229. this.sel_.rawValue = P <= z ? 0 : 1, this.updateValue_(p.point, o.shiftKey, {
  13230. forceEmit: false,
  13231. last: false
  13232. });
  13233. }
  13234. onPointerMove_(o) {
  13235. const p = o.data;
  13236. p.point && this.updateValue_(p.point, o.shiftKey, {
  13237. forceEmit: false,
  13238. last: false
  13239. });
  13240. }
  13241. onPointerUp_(o) {
  13242. const p = o.data;
  13243. p.point && this.updateValue_(p.point, o.shiftKey, {
  13244. forceEmit: true,
  13245. last: true
  13246. });
  13247. }
  13248. onKeyDown_(o) {
  13249. ls(o.key) && o.preventDefault();
  13250. const p = this.sel_.rawValue, f2 = this.value.rawValue.toObject();
  13251. f2[p * 2] += Kt(this.baseStep_, yi(o)), f2[p * 2 + 1] += Kt(this.baseStep_, mn(o)), this.value.setRawValue(new Et(...f2), {
  13252. forceEmit: false,
  13253. last: false
  13254. });
  13255. }
  13256. onKeyUp_(o) {
  13257. ls(o.key) && o.preventDefault();
  13258. const p = Kt(this.baseStep_, yi(o)), f2 = Kt(this.baseStep_, mn(o));
  13259. p === 0 && f2 === 0 || this.value.setRawValue(this.value.rawValue, {
  13260. forceEmit: true,
  13261. last: true
  13262. });
  13263. }
  13264. }
  13265. class Cs {
  13266. constructor(o, p) {
  13267. this.value = p.value, this.viewProps = p.viewProps, this.view = new xs(o, {
  13268. viewProps: this.viewProps
  13269. }), this.gc_ = new lt2(o, {
  13270. baseStep: p.axis.baseStep,
  13271. value: this.value,
  13272. viewProps: this.viewProps
  13273. }), this.view.graphElement.appendChild(this.gc_.view.element);
  13274. const f2 = Object.assign(Object.assign({}, p.axis), { constraint: new At({ max: 1, min: 0 }) }), x = Object.assign(Object.assign({}, p.axis), { constraint: void 0 });
  13275. this.tc_ = new Rt(o, {
  13276. assembly: ki,
  13277. axes: [f2, x, f2, x],
  13278. parser: dn,
  13279. value: this.value,
  13280. viewProps: this.viewProps
  13281. }), this.view.textElement.appendChild(this.tc_.view.element);
  13282. }
  13283. get allFocusableElements() {
  13284. return [
  13285. this.gc_.view.element,
  13286. ...this.tc_.view.textViews.map((o) => o.inputElement)
  13287. ];
  13288. }
  13289. refresh() {
  13290. this.gc_.refresh();
  13291. }
  13292. }
  13293. class Jn {
  13294. constructor(o, p) {
  13295. this.onButtonBlur_ = this.onButtonBlur_.bind(this), this.onButtonClick_ = this.onButtonClick_.bind(this), this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.value = p.value, this.viewProps = p.viewProps, this.foldable_ = zn(p.expanded), this.view = new ys(o, {
  13296. foldable: this.foldable_,
  13297. pickerLayout: p.pickerLayout,
  13298. viewProps: this.viewProps
  13299. }), this.view.buttonElement.addEventListener("blur", this.onButtonBlur_), this.view.buttonElement.addEventListener("click", this.onButtonClick_), this.tc_ = new Ut(o, {
  13300. parser: xr,
  13301. props: K.fromObject({
  13302. formatter: yr
  13303. }),
  13304. value: this.value,
  13305. viewProps: this.viewProps
  13306. }), this.view.textElement.appendChild(this.tc_.view.element), this.popC_ = p.pickerLayout === "popup" ? new ie(o, {
  13307. viewProps: this.viewProps
  13308. }) : null;
  13309. const f2 = new Cs(o, {
  13310. axis: p.axis,
  13311. value: this.value,
  13312. viewProps: this.viewProps
  13313. });
  13314. f2.allFocusableElements.forEach((x) => {
  13315. x.addEventListener("blur", this.onPopupChildBlur_), x.addEventListener("keydown", this.onPopupChildKeydown_);
  13316. }), this.pickerC_ = f2, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), S2(this.popC_.shows, (x) => {
  13317. x && f2.refresh();
  13318. }), Ht({
  13319. primary: this.foldable_.value("expanded"),
  13320. secondary: this.popC_.shows,
  13321. forward: (x) => x.rawValue,
  13322. backward: (x, P) => P.rawValue
  13323. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Gn(this.foldable_, this.view.pickerElement));
  13324. }
  13325. onButtonBlur_(o) {
  13326. if (!this.popC_)
  13327. return;
  13328. const p = o.relatedTarget;
  13329. (!p || !this.popC_.view.element.contains(p)) && (this.popC_.shows.rawValue = false);
  13330. }
  13331. onButtonClick_() {
  13332. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.allFocusableElements[0].focus();
  13333. }
  13334. onPopupChildBlur_(o) {
  13335. if (!this.popC_)
  13336. return;
  13337. const p = this.popC_.view.element, f2 = an(o);
  13338. f2 && p.contains(f2) || f2 && f2 === this.view.buttonElement && !Xe2(p.ownerDocument) || (this.popC_.shows.rawValue = false);
  13339. }
  13340. onPopupChildKeydown_(o) {
  13341. this.popC_ && o.key === "Escape" && (this.popC_.shows.rawValue = false);
  13342. }
  13343. }
  13344. function Ai() {
  13345. return new ur({
  13346. assembly: ki,
  13347. components: [0, 1, 2, 3].map((m) => m % 2 === 0 ? new At({
  13348. min: 0,
  13349. max: 1
  13350. }) : void 0)
  13351. });
  13352. }
  13353. const Vt = {
  13354. id: "cubic-bezier",
  13355. type: "blade",
  13356. 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}',
  13357. accept(m) {
  13358. const o = he, p = ee2(m, {
  13359. value: o.required.array(o.required.number),
  13360. view: o.required.constant("cubicbezier"),
  13361. expanded: o.optional.boolean,
  13362. label: o.optional.string,
  13363. picker: o.optional.custom((f2) => f2 === "inline" || f2 === "popup" ? f2 : void 0)
  13364. });
  13365. return p ? { params: p } : null;
  13366. },
  13367. controller(m) {
  13368. var o, p;
  13369. const f2 = new Et(...m.params.value), x = H2(f2, {
  13370. constraint: Ai(),
  13371. equals: Et.equals
  13372. }), P = new Jn(m.document, {
  13373. axis: {
  13374. baseStep: 0.1,
  13375. textProps: K.fromObject({
  13376. draggingScale: 0.01,
  13377. formatter: Le(2)
  13378. })
  13379. },
  13380. expanded: (o = m.params.expanded) !== null && o !== void 0 ? o : false,
  13381. pickerLayout: (p = m.params.picker) !== null && p !== void 0 ? p : "popup",
  13382. value: x,
  13383. viewProps: m.viewProps
  13384. });
  13385. return new St(m.document, {
  13386. blade: m.blade,
  13387. props: K.fromObject({
  13388. label: m.params.label
  13389. }),
  13390. valueController: P
  13391. });
  13392. },
  13393. api(m) {
  13394. return !(m.controller instanceof St) || !(m.controller.valueController instanceof Jn) ? null : new ws(m.controller);
  13395. }
  13396. };
  13397. class _e extends s {
  13398. begin() {
  13399. this.controller_.valueController.begin();
  13400. }
  13401. end() {
  13402. this.controller_.valueController.end();
  13403. }
  13404. }
  13405. const Li = 20;
  13406. class Se {
  13407. constructor() {
  13408. this.start_ = null, this.duration_ = 0, this.fps_ = null, this.frameCount_ = 0, this.timestamps_ = [];
  13409. }
  13410. get duration() {
  13411. return this.duration_;
  13412. }
  13413. get fps() {
  13414. return this.fps_;
  13415. }
  13416. begin(o) {
  13417. this.start_ = o.getTime();
  13418. }
  13419. calculateFps_(o) {
  13420. if (this.timestamps_.length === 0)
  13421. return null;
  13422. const p = this.timestamps_[0];
  13423. return 1e3 * (this.frameCount_ - p.frameCount) / (o - p.time);
  13424. }
  13425. compactTimestamps_() {
  13426. if (this.timestamps_.length <= Li)
  13427. return;
  13428. const o = this.timestamps_.length - Li;
  13429. this.timestamps_.splice(0, o);
  13430. const p = this.timestamps_[0].frameCount;
  13431. this.timestamps_.forEach((f2) => {
  13432. f2.frameCount -= p;
  13433. }), this.frameCount_ -= p;
  13434. }
  13435. end(o) {
  13436. if (this.start_ === null)
  13437. return;
  13438. const p = o.getTime();
  13439. this.duration_ = p - this.start_, this.start_ = null, this.fps_ = this.calculateFps_(p), this.timestamps_.push({
  13440. frameCount: this.frameCount_,
  13441. time: p
  13442. }), ++this.frameCount_, this.compactTimestamps_();
  13443. }
  13444. }
  13445. const Qt = y2("fps");
  13446. class He {
  13447. constructor(o, p) {
  13448. this.element = o.createElement("div"), this.element.classList.add(Qt()), p.viewProps.bindClassModifiers(this.element), this.graphElement = o.createElement("div"), this.graphElement.classList.add(Qt("g")), this.element.appendChild(this.graphElement);
  13449. const f2 = o.createElement("div");
  13450. f2.classList.add(Qt("l")), this.element.appendChild(f2);
  13451. const x = o.createElement("span");
  13452. x.classList.add(Qt("v")), x.textContent = "--", f2.appendChild(x), this.valueElement = x;
  13453. const P = o.createElement("span");
  13454. P.classList.add(Qt("u")), P.textContent = "FPS", f2.appendChild(P);
  13455. }
  13456. }
  13457. class Ri {
  13458. constructor(o, p) {
  13459. this.stopwatch_ = new Se(), this.onTick_ = this.onTick_.bind(this), this.ticker_ = p.ticker, this.ticker_.emitter.on("tick", this.onTick_), this.value_ = p.value, this.viewProps = p.viewProps, this.view = new He(o, {
  13460. viewProps: this.viewProps
  13461. }), this.graphC_ = new fr(o, {
  13462. formatter: Le(0),
  13463. lineCount: p.lineCount,
  13464. props: K.fromObject({
  13465. maxValue: p.maxValue,
  13466. minValue: p.minValue
  13467. }),
  13468. value: this.value_,
  13469. viewProps: this.viewProps
  13470. }), this.view.graphElement.appendChild(this.graphC_.view.element), this.viewProps.handleDispose(() => {
  13471. this.graphC_.viewProps.set("disposed", true), this.ticker_.dispose();
  13472. });
  13473. }
  13474. begin() {
  13475. this.stopwatch_.begin(new Date());
  13476. }
  13477. end() {
  13478. this.stopwatch_.end(new Date());
  13479. }
  13480. onTick_() {
  13481. const o = this.stopwatch_.fps;
  13482. if (o !== null) {
  13483. const p = this.value_.rawValue;
  13484. this.value_.rawValue = ir(p, o), this.view.valueElement.textContent = o.toFixed(0);
  13485. }
  13486. }
  13487. }
  13488. function yn(m, o) {
  13489. return o === 0 ? new Hn() : new cn(m, o ?? mr.monitor.defaultInterval);
  13490. }
  13491. const Ii = {
  13492. id: "fpsgraph",
  13493. type: "blade",
  13494. accept(m) {
  13495. const o = he, p = ee2(m, {
  13496. view: o.required.constant("fpsgraph"),
  13497. interval: o.optional.number,
  13498. label: o.optional.string,
  13499. lineCount: o.optional.number,
  13500. max: o.optional.number,
  13501. min: o.optional.number
  13502. });
  13503. return p ? { params: p } : null;
  13504. },
  13505. controller(m) {
  13506. var o, p, f2, x;
  13507. const P = (o = m.params.interval) !== null && o !== void 0 ? o : 500;
  13508. return new st2(m.document, {
  13509. blade: m.blade,
  13510. props: K.fromObject({
  13511. label: m.params.label
  13512. }),
  13513. valueController: new Ri(m.document, {
  13514. lineCount: (p = m.params.lineCount) !== null && p !== void 0 ? p : 2,
  13515. maxValue: (f2 = m.params.max) !== null && f2 !== void 0 ? f2 : 90,
  13516. minValue: (x = m.params.min) !== null && x !== void 0 ? x : 0,
  13517. ticker: yn(m.document, P),
  13518. value: os(80),
  13519. viewProps: m.viewProps
  13520. })
  13521. });
  13522. },
  13523. api(m) {
  13524. return !(m.controller instanceof st2) || !(m.controller.valueController instanceof Ri) ? null : new _e(m.controller);
  13525. }
  13526. };
  13527. class Ke2 {
  13528. constructor(o, p) {
  13529. this.min = o, this.max = p;
  13530. }
  13531. static isObject(o) {
  13532. if (typeof o != "object" || o === null)
  13533. return false;
  13534. const p = o.min, f2 = o.max;
  13535. return !(typeof p != "number" || typeof f2 != "number");
  13536. }
  13537. static equals(o, p) {
  13538. return o.min === p.min && o.max === p.max;
  13539. }
  13540. get length() {
  13541. return this.max - this.min;
  13542. }
  13543. toObject() {
  13544. return {
  13545. min: this.min,
  13546. max: this.max
  13547. };
  13548. }
  13549. }
  13550. const Vi = {
  13551. fromComponents: (m) => new Ke2(m[0], m[1]),
  13552. toComponents: (m) => [m.min, m.max]
  13553. };
  13554. class xn {
  13555. constructor(o) {
  13556. this.edge = o;
  13557. }
  13558. constrain(o) {
  13559. var p, f2, x, P, L2, z, oe, Qe2;
  13560. if (o.min <= o.max)
  13561. return new Ke2((f2 = (p = this.edge) === null || p === void 0 ? void 0 : p.constrain(o.min)) !== null && f2 !== void 0 ? f2 : o.min, (P = (x = this.edge) === null || x === void 0 ? void 0 : x.constrain(o.max)) !== null && P !== void 0 ? P : o.max);
  13562. const Ze2 = (o.min + o.max) / 2;
  13563. return new Ke2((z = (L2 = this.edge) === null || L2 === void 0 ? void 0 : L2.constrain(Ze2)) !== null && z !== void 0 ? z : Ze2, (Qe2 = (oe = this.edge) === null || oe === void 0 ? void 0 : oe.constrain(Ze2)) !== null && Qe2 !== void 0 ? Qe2 : Ze2);
  13564. }
  13565. }
  13566. const Di = y2("rsltxt");
  13567. class ei {
  13568. constructor(o, p) {
  13569. this.sliderView_ = p.sliderView, this.textView_ = p.textView, this.element = o.createElement("div"), this.element.classList.add(Di());
  13570. const f2 = o.createElement("div");
  13571. f2.classList.add(Di("s")), f2.appendChild(this.sliderView_.element), this.element.appendChild(f2);
  13572. const x = o.createElement("div");
  13573. x.classList.add(Di("t")), x.appendChild(this.textView_.element), this.element.appendChild(x);
  13574. }
  13575. }
  13576. const tt2 = y2("rsl");
  13577. class En {
  13578. constructor(o, p) {
  13579. this.onSliderPropsChange_ = this.onSliderPropsChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.sliderProps_ = p.sliderProps, this.sliderProps_.emitter.on("change", this.onSliderPropsChange_), this.element = o.createElement("div"), this.element.classList.add(tt2()), p.viewProps.bindClassModifiers(this.element), this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_);
  13580. const f2 = o.createElement("div");
  13581. f2.classList.add(tt2("t")), this.element.appendChild(f2), this.trackElement = f2;
  13582. const x = o.createElement("div");
  13583. x.classList.add(tt2("b")), f2.appendChild(x), this.barElement = x;
  13584. const P = ["min", "max"].map((L2) => {
  13585. const z = o.createElement("div");
  13586. return z.classList.add(tt2("k"), tt2("k", L2)), f2.appendChild(z), z;
  13587. });
  13588. this.knobElements = [P[0], P[1]], this.update_();
  13589. }
  13590. valueToX_(o) {
  13591. const p = this.sliderProps_.get("minValue"), f2 = this.sliderProps_.get("maxValue");
  13592. return $t(Me(o, p, f2, 0, 1), 0, 1) * 100;
  13593. }
  13594. update_() {
  13595. const o = this.value_.rawValue;
  13596. o.length === 0 ? this.element.classList.add(tt2(void 0, "zero")) : this.element.classList.remove(tt2(void 0, "zero"));
  13597. const p = [this.valueToX_(o.min), this.valueToX_(o.max)];
  13598. this.barElement.style.left = `${p[0]}%`, this.barElement.style.right = `${100 - p[1]}%`, this.knobElements.forEach((f2, x) => {
  13599. f2.style.left = `${p[x]}%`;
  13600. });
  13601. }
  13602. onSliderPropsChange_() {
  13603. this.update_();
  13604. }
  13605. onValueChange_() {
  13606. this.update_();
  13607. }
  13608. }
  13609. class Oi {
  13610. constructor(o, p) {
  13611. this.grabbing_ = null, this.grabOffset_ = 0, this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.sliderProps = p.sliderProps, this.viewProps = p.viewProps, this.value = p.value, this.view = new En(o, {
  13612. sliderProps: this.sliderProps,
  13613. value: this.value,
  13614. viewProps: p.viewProps
  13615. });
  13616. const f2 = new qn(this.view.trackElement);
  13617. f2.emitter.on("down", this.onPointerDown_), f2.emitter.on("move", this.onPointerMove_), f2.emitter.on("up", this.onPointerUp_);
  13618. }
  13619. ofs_() {
  13620. return this.grabbing_ === "min" ? this.view.knobElements[0].getBoundingClientRect().width / 2 : this.grabbing_ === "max" ? -this.view.knobElements[1].getBoundingClientRect().width / 2 : 0;
  13621. }
  13622. valueFromData_(o) {
  13623. if (!o.point)
  13624. return null;
  13625. const p = (o.point.x + this.ofs_()) / o.bounds.width, f2 = this.sliderProps.get("minValue"), x = this.sliderProps.get("maxValue");
  13626. return Me(p, 0, 1, f2, x);
  13627. }
  13628. onPointerDown_(o) {
  13629. if (!o.data.point)
  13630. return;
  13631. const p = o.data.point.x / o.data.bounds.width, f2 = this.value.rawValue, x = this.sliderProps.get("minValue"), P = this.sliderProps.get("maxValue"), L2 = Me(f2.min, x, P, 0, 1), z = Me(f2.max, x, P, 0, 1);
  13632. Math.abs(z - p) <= 0.025 ? this.grabbing_ = "max" : Math.abs(L2 - p) <= 0.025 ? this.grabbing_ = "min" : p >= L2 && p <= z ? (this.grabbing_ = "length", this.grabOffset_ = Me(p - L2, 0, 1, 0, P - x)) : p < L2 ? (this.grabbing_ = "min", this.onPointerMove_(o)) : p > z && (this.grabbing_ = "max", this.onPointerMove_(o));
  13633. }
  13634. applyPointToValue_(o, p) {
  13635. const f2 = this.valueFromData_(o);
  13636. if (f2 === null)
  13637. return;
  13638. const x = this.sliderProps.get("minValue"), P = this.sliderProps.get("maxValue");
  13639. if (this.grabbing_ === "min")
  13640. this.value.setRawValue(new Ke2(f2, this.value.rawValue.max), p);
  13641. else if (this.grabbing_ === "max")
  13642. this.value.setRawValue(new Ke2(this.value.rawValue.min, f2), p);
  13643. else if (this.grabbing_ === "length") {
  13644. const L2 = this.value.rawValue.length;
  13645. let z = f2 - this.grabOffset_, oe = z + L2;
  13646. z < x ? (z = x, oe = x + L2) : oe > P && (z = P - L2, oe = P), this.value.setRawValue(new Ke2(z, oe), p);
  13647. }
  13648. }
  13649. onPointerMove_(o) {
  13650. this.applyPointToValue_(o.data, {
  13651. forceEmit: false,
  13652. last: false
  13653. });
  13654. }
  13655. onPointerUp_(o) {
  13656. this.applyPointToValue_(o.data, {
  13657. forceEmit: true,
  13658. last: true
  13659. }), this.grabbing_ = null;
  13660. }
  13661. }
  13662. class bt {
  13663. constructor(o, p) {
  13664. this.value = p.value, this.viewProps = p.viewProps, this.sc_ = new Oi(o, p);
  13665. const f2 = {
  13666. baseStep: p.baseStep,
  13667. constraint: p.constraint,
  13668. textProps: K.fromObject({
  13669. draggingScale: p.draggingScale,
  13670. formatter: p.formatter
  13671. })
  13672. };
  13673. this.tc_ = new Rt(o, {
  13674. assembly: Vi,
  13675. axes: [f2, f2],
  13676. parser: p.parser,
  13677. value: this.value,
  13678. viewProps: p.viewProps
  13679. }), this.view = new ei(o, {
  13680. sliderView: this.sc_.view,
  13681. textView: this.tc_.view
  13682. });
  13683. }
  13684. get textController() {
  13685. return this.tc_;
  13686. }
  13687. }
  13688. function Ps(m) {
  13689. return Ke2.isObject(m) ? new Ke2(m.min, m.max) : new Ke2(0, 0);
  13690. }
  13691. function Ni(m, o) {
  13692. m.writeProperty("max", o.max), m.writeProperty("min", o.min);
  13693. }
  13694. function Cr(m) {
  13695. const o = [], p = gn(m);
  13696. p && o.push(p);
  13697. const f2 = dr(m);
  13698. return f2 && o.push(f2), new xn(new Kn(o));
  13699. }
  13700. const ti = {
  13701. id: "input-interval",
  13702. type: "input",
  13703. 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}',
  13704. accept: (m, o) => {
  13705. if (!Ke2.isObject(m))
  13706. return null;
  13707. const p = he, f2 = ee2(o, {
  13708. format: p.optional.function,
  13709. max: p.optional.number,
  13710. min: p.optional.number,
  13711. step: p.optional.number
  13712. });
  13713. return f2 ? {
  13714. initialValue: new Ke2(m.min, m.max),
  13715. params: f2
  13716. } : null;
  13717. },
  13718. binding: {
  13719. reader: (m) => Ps,
  13720. constraint: (m) => Cr(m.params),
  13721. equals: Ke2.equals,
  13722. writer: (m) => Ni
  13723. },
  13724. controller(m) {
  13725. var o;
  13726. const p = m.value, f2 = m.constraint;
  13727. if (!(f2 instanceof xn))
  13728. throw g.shouldNeverHappen();
  13729. const x = (p.rawValue.min + p.rawValue.max) / 2, P = (o = m.params.format) !== null && o !== void 0 ? o : Le(vn(f2.edge, x)), L2 = f2.edge && xt(f2.edge, ft);
  13730. if (L2)
  13731. return new bt(m.document, {
  13732. baseStep: Ei(f2.edge),
  13733. constraint: f2.edge,
  13734. draggingScale: Qn(f2.edge, x),
  13735. formatter: P,
  13736. parser: dn,
  13737. sliderProps: new K({
  13738. maxValue: L2.values.value("max"),
  13739. minValue: L2.values.value("min")
  13740. }),
  13741. value: p,
  13742. viewProps: m.viewProps
  13743. });
  13744. const z = {
  13745. baseStep: Ei(f2.edge),
  13746. constraint: f2.edge,
  13747. textProps: K.fromObject({
  13748. draggingScale: x,
  13749. formatter: P
  13750. })
  13751. };
  13752. return new Rt(m.document, {
  13753. assembly: Vi,
  13754. axes: [z, z],
  13755. parser: dn,
  13756. value: p,
  13757. viewProps: m.viewProps
  13758. });
  13759. }
  13760. };
  13761. class Dt {
  13762. constructor(o) {
  13763. this.controller_ = o;
  13764. }
  13765. get disabled() {
  13766. return this.controller_.viewProps.get("disabled");
  13767. }
  13768. set disabled(o) {
  13769. this.controller_.viewProps.set("disabled", o);
  13770. }
  13771. get title() {
  13772. var o;
  13773. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  13774. }
  13775. set title(o) {
  13776. this.controller_.props.set("title", o);
  13777. }
  13778. }
  13779. class Ot extends c {
  13780. constructor(o, p, f2, x, P) {
  13781. super(o, x, P), this.cell = p, this.index = f2;
  13782. }
  13783. }
  13784. class Cn extends s {
  13785. constructor(o) {
  13786. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.controller_.valueController.cellControllers.forEach((f2) => {
  13787. const x = new Dt(f2);
  13788. this.cellToApiMap_.set(f2, x);
  13789. });
  13790. }
  13791. get value() {
  13792. return this.controller_.value;
  13793. }
  13794. cell(o, p) {
  13795. const f2 = this.controller_.valueController, x = f2.cellControllers[p * f2.size[0] + o];
  13796. return this.cellToApiMap_.get(x);
  13797. }
  13798. on(o, p) {
  13799. const f2 = p.bind(this);
  13800. this.controller_.value.emitter.on(o, (x) => {
  13801. const P = this.controller_.valueController, L2 = P.findCellByValue(x.rawValue);
  13802. if (!L2)
  13803. return;
  13804. const z = this.cellToApiMap_.get(L2);
  13805. if (!z)
  13806. return;
  13807. const oe = P.cellControllers.indexOf(L2);
  13808. f2(new Ot(this, z, [oe % P.size[0], Math.floor(oe / P.size[0])], x.rawValue, void 0));
  13809. });
  13810. }
  13811. }
  13812. const Pn = y2("rad");
  13813. class Ts {
  13814. constructor(o, p) {
  13815. this.element = o.createElement("div"), this.element.classList.add(Pn()), p.viewProps.bindClassModifiers(this.element);
  13816. const f2 = o.createElement("label");
  13817. f2.classList.add(Pn("l")), this.element.appendChild(f2);
  13818. const x = o.createElement("input");
  13819. x.classList.add(Pn("i")), x.name = p.name, x.type = "radio", p.viewProps.bindDisabled(x), f2.appendChild(x), this.inputElement = x;
  13820. const P = o.createElement("div");
  13821. P.classList.add(Pn("b")), f2.appendChild(P);
  13822. const L2 = o.createElement("div");
  13823. L2.classList.add(Pn("t")), P.appendChild(L2), R2(p.props, "title", (z) => {
  13824. L2.textContent = z;
  13825. });
  13826. }
  13827. }
  13828. class ks {
  13829. constructor(o, p) {
  13830. this.props = p.props, this.viewProps = p.viewProps, this.view = new Ts(o, {
  13831. name: p.name,
  13832. props: this.props,
  13833. viewProps: this.viewProps
  13834. });
  13835. }
  13836. }
  13837. class ni {
  13838. constructor(o, p) {
  13839. this.cellCs_ = [], this.cellValues_ = [], this.onCellInputChange_ = this.onCellInputChange_.bind(this), this.size = p.size;
  13840. const [f2, x] = this.size;
  13841. for (let P = 0; P < x; P++)
  13842. for (let L2 = 0; L2 < f2; L2++) {
  13843. const z = new ks(o, {
  13844. name: p.groupName,
  13845. props: K.fromObject(Object.assign({}, p.cellConfig(L2, P))),
  13846. viewProps: be.create()
  13847. });
  13848. this.cellCs_.push(z), this.cellValues_.push(p.cellConfig(L2, P).value);
  13849. }
  13850. this.value = p.value, S2(this.value, (P) => {
  13851. const L2 = this.findCellByValue(P);
  13852. L2 && (L2.view.inputElement.checked = true);
  13853. }), this.viewProps = be.create(), this.view = new yt(o, {
  13854. viewProps: this.viewProps,
  13855. viewName: "radgrid"
  13856. }), this.view.element.style.gridTemplateColumns = `repeat(${f2}, 1fr)`, this.cellCs_.forEach((P) => {
  13857. P.view.inputElement.addEventListener("change", this.onCellInputChange_), this.view.element.appendChild(P.view.element);
  13858. });
  13859. }
  13860. get cellControllers() {
  13861. return this.cellCs_;
  13862. }
  13863. findCellByValue(o) {
  13864. const p = this.cellValues_.findIndex((f2) => f2 === o);
  13865. return p < 0 ? null : this.cellCs_[p];
  13866. }
  13867. onCellInputChange_(o) {
  13868. const p = o.currentTarget, f2 = this.cellCs_.findIndex((x) => x.view.inputElement === p);
  13869. f2 < 0 || (this.value.rawValue = this.cellValues_[f2]);
  13870. }
  13871. }
  13872. const Nt = function() {
  13873. return {
  13874. id: "radiogrid",
  13875. type: "blade",
  13876. accept(m) {
  13877. const o = he, p = ee2(m, {
  13878. cells: o.required.function,
  13879. groupName: o.required.string,
  13880. size: o.required.array(o.required.number),
  13881. value: o.required.raw,
  13882. view: o.required.constant("radiogrid"),
  13883. label: o.optional.string
  13884. });
  13885. return p ? { params: p } : null;
  13886. },
  13887. controller(m) {
  13888. return new St(m.document, {
  13889. blade: m.blade,
  13890. props: K.fromObject({
  13891. label: m.params.label
  13892. }),
  13893. valueController: new ni(m.document, {
  13894. groupName: m.params.groupName,
  13895. cellConfig: m.params.cells,
  13896. size: m.params.size,
  13897. value: H2(m.params.value)
  13898. })
  13899. });
  13900. },
  13901. api(m) {
  13902. return !(m.controller instanceof St) || !(m.controller.valueController instanceof ni) ? null : new Cn(m.controller);
  13903. }
  13904. };
  13905. }();
  13906. function Fi(m) {
  13907. return {
  13908. id: "input-radiogrid",
  13909. type: "input",
  13910. accept(o, p) {
  13911. if (!m.isType(o))
  13912. return null;
  13913. const f2 = he, x = ee2(p, {
  13914. cells: f2.required.function,
  13915. groupName: f2.required.string,
  13916. size: f2.required.array(f2.required.number),
  13917. view: f2.required.constant("radiogrid")
  13918. });
  13919. return x ? {
  13920. initialValue: o,
  13921. params: x
  13922. } : null;
  13923. },
  13924. binding: m.binding,
  13925. controller: (o) => new ni(o.document, {
  13926. cellConfig: o.params.cells,
  13927. groupName: o.params.groupName,
  13928. size: o.params.size,
  13929. value: o.value
  13930. })
  13931. };
  13932. }
  13933. const Pr = Fi({
  13934. isType: (m) => typeof m == "number",
  13935. binding: {
  13936. reader: (m) => tr,
  13937. writer: (m) => et2
  13938. }
  13939. }), Tr = Fi({
  13940. isType: (m) => typeof m == "string",
  13941. binding: {
  13942. reader: (m) => rs,
  13943. writer: (m) => et2
  13944. }
  13945. }), kr = Fi({
  13946. isType: (m) => typeof m == "boolean",
  13947. binding: {
  13948. reader: (m) => pn,
  13949. writer: (m) => et2
  13950. }
  13951. }), Ms = [
  13952. br,
  13953. Vt,
  13954. Ii,
  13955. ti,
  13956. Nt,
  13957. kr,
  13958. Pr,
  13959. Tr
  13960. ];
  13961. r.ButtonCellApi = gs, r.ButtonGridApi = _s, r.ButtonGridController = Pi, r.CubicBezier = Et, r.CubicBezierApi = ws, r.CubicBezierAssembly = ki, r.CubicBezierController = Jn, r.CubicBezierGraphController = lt2, r.CubicBezierGraphView = Re, r.CubicBezierPickerController = Cs, r.CubicBezierPickerView = xs, r.CubicBezierPreviewView = qt, r.CubicBezierView = ys, r.FpsGraphBladeApi = _e, r.FpsGraphController = Ri, r.FpsView = He, r.Fpswatch = Se, r.Interval = Ke2, r.IntervalAssembly = Vi, r.IntervalConstraint = xn, r.RadioCellApi = Dt, r.RadioController = ks, r.RadioGridApi = Cn, r.RadioGridController = ni, r.RadioView = Ts, r.RangeSliderController = Oi, r.RangeSliderTextController = bt, r.RangeSliderTextView = ei, r.RangeSliderView = En, r.TpRadioGridChangeEvent = Ot, r.plugins = Ms, Object.defineProperty(r, "__esModule", { value: true });
  13962. });
  13963. })(Ph, Ji);
  13964. var Th = ih(Ji);
  13965. var kh = Np({
  13966. __proto__: null,
  13967. default: Th
  13968. }, [Ji]);
  13969. var Ln;
  13970. var Ds;
  13971. var md = (b2 = "tres-container") => {
  13972. Ln || (Ln = new js.Pane({
  13973. container: document.querySelector(b2) || void 0
  13974. }), Ln.registerPlugin(kh), Ds = Ln.addBlade({
  13975. view: "fpsgraph",
  13976. label: "fpsgraph"
  13977. }));
  13978. function i() {
  13979. Ln && Ln.dispose();
  13980. }
  13981. return onMounted(() => {
  13982. const { onBeforeLoop: r, onAfterLoop: s, resume: a } = $();
  13983. a(), r(() => Ds.begin()), s(() => Ds.end());
  13984. }), onUnmounted(() => {
  13985. i();
  13986. }), { pane: Ln, fpsGraph: Ds, disposeTweakPane: i };
  13987. };
  13988. function fd(b2, i) {
  13989. const r = ref(i), s = new AnimationMixer(r.value), a = shallowReactive({});
  13990. b2.forEach((u) => {
  13991. const h2 = s.clipAction(u, r.value);
  13992. a[u.name] = h2;
  13993. });
  13994. const { onLoop: c } = $();
  13995. return c(({ delta: u }) => {
  13996. s.update(u);
  13997. }), {
  13998. actions: a,
  13999. mixer: s
  14000. };
  14001. }
  14002. var Os = null;
  14003. function Mh(b2, i) {
  14004. return (r) => {
  14005. i && i(r), b2.draco && (Os || (Os = new rh()), Os.setDecoderPath(b2.decoderPath || "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"), r.setDRACOLoader(Os));
  14006. };
  14007. }
  14008. async function Sh(b2, i = {
  14009. draco: false
  14010. }, r) {
  14011. return await dt(su, b2, Mh(i, r));
  14012. }
  14013. var vd = defineComponent({
  14014. name: "GLTFModel",
  14015. props: ["path", "draco", "decoderPath"],
  14016. async setup(b2, { expose: i }) {
  14017. const { state: r } = Fn(), s = ref();
  14018. i({ model: s });
  14019. const { scene: a } = await Sh(b2.path, { draco: b2.draco, decoderPath: b2.decoderPath });
  14020. return s.value = a, r.scene && r.scene.add(a), () => {
  14021. };
  14022. }
  14023. });
  14024. async function Ah(b2) {
  14025. return await dt(Uu, b2);
  14026. }
  14027. var bd = defineComponent({
  14028. name: "FBXModel",
  14029. props: ["path"],
  14030. async setup(b2, { expose: i }) {
  14031. const { state: r } = Fn();
  14032. let s = null;
  14033. function a() {
  14034. return s;
  14035. }
  14036. return i({ getModel: a }), s = await Ah(b2.path), r.scene && s.isObject3D && r.scene.add(s), () => {
  14037. };
  14038. }
  14039. });
  14040. var Lh = { key: 0 };
  14041. var Rh = ["args", "center"];
  14042. var gd = defineComponent({
  14043. __name: "Text3D",
  14044. props: {
  14045. font: null,
  14046. text: null,
  14047. size: { default: 0.5 },
  14048. height: { default: 0.2 },
  14049. curveSegments: { default: 5 },
  14050. bevelEnabled: { type: Boolean, default: true },
  14051. bevelThickness: { default: 0.05 },
  14052. bevelSize: { default: 0.02 },
  14053. bevelOffset: { default: 0 },
  14054. bevelSegments: { default: 4 },
  14055. center: { type: Boolean, default: false }
  14056. },
  14057. async setup(b2) {
  14058. let i, r;
  14059. const s = b2, { extend: a } = Fn();
  14060. a({ TextGeometry: Vu });
  14061. const c = new eh(), u = useSlots(), h2 = computed(() => {
  14062. var w;
  14063. return s.text ? s.text : u.default ? (w = u.default()[0].children) == null ? void 0 : w.trim() : "TresJS";
  14064. }), d = ([i, r] = withAsyncContext(() => new Promise((w, _) => {
  14065. try {
  14066. typeof s.font == "string" ? c.load(s.font, (y2) => {
  14067. w(y2);
  14068. }) : w(s.font);
  14069. } catch (y2) {
  14070. _(console.error("cientos", y2));
  14071. }
  14072. })), i = await i, r(), i), g = computed(() => ({
  14073. font: d,
  14074. size: s.size,
  14075. height: s.height,
  14076. curveSegments: s.curveSegments,
  14077. bevelEnabled: s.bevelEnabled,
  14078. bevelThickness: s.bevelThickness,
  14079. bevelSize: s.bevelSize,
  14080. bevelOffset: s.bevelOffset,
  14081. bevelSegments: s.bevelSegments
  14082. }));
  14083. return (w, _) => unref(d) ? (openBlock(), createElementBlock("TresMesh", Lh, [
  14084. unref(h2) ? (openBlock(), createElementBlock("TresTextGeometry", {
  14085. key: 0,
  14086. args: [unref(h2), unref(g)],
  14087. center: b2.center
  14088. }, null, 8, Rh)) : createCommentVNode("", true),
  14089. renderSlot(w.$slots, "default")
  14090. ])) : createCommentVNode("", true);
  14091. }
  14092. });
  14093. var Ih = ["rotation"];
  14094. var Vh = ["args"];
  14095. var Dh = ["color"];
  14096. var _d = defineComponent({
  14097. __name: "Plane",
  14098. props: {
  14099. args: { default: () => [1, 1] },
  14100. color: { default: "0xffffff" }
  14101. },
  14102. setup(b2, { expose: i }) {
  14103. const r = shallowRef();
  14104. return i({
  14105. value: r
  14106. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14107. ref_key: "planeRef",
  14108. ref: r,
  14109. rotation: [-Math.PI / 2, 0, 0]
  14110. }, s.$attrs), [
  14111. createBaseVNode("TresPlaneGeometry", { args: b2.args }, null, 8, Vh),
  14112. renderSlot(s.$slots, "default", {}, () => [
  14113. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Dh)
  14114. ])
  14115. ], 16, Ih));
  14116. }
  14117. });
  14118. var Oh = ["args"];
  14119. var Nh = ["color"];
  14120. var wd = defineComponent({
  14121. __name: "Box",
  14122. props: {
  14123. args: { default: () => [1, 1, 1] },
  14124. color: { default: "0xffffff" }
  14125. },
  14126. setup(b2, { expose: i }) {
  14127. const r = shallowRef();
  14128. return i({
  14129. value: r
  14130. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14131. ref_key: "boxRef",
  14132. ref: r
  14133. }, s.$attrs), [
  14134. createBaseVNode("TresBoxGeometry", { args: b2.args }, null, 8, Oh),
  14135. renderSlot(s.$slots, "default", {}, () => [
  14136. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Nh)
  14137. ])
  14138. ], 16));
  14139. }
  14140. });
  14141. var Fh = ["args"];
  14142. var Bh = ["color"];
  14143. var yd = defineComponent({
  14144. __name: "Sphere",
  14145. props: {
  14146. args: { default: () => [2, 32, 16] },
  14147. color: { default: "0xffffff" }
  14148. },
  14149. setup(b2, { expose: i }) {
  14150. const r = shallowRef();
  14151. return i({
  14152. value: r
  14153. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14154. ref_key: "sphereRef",
  14155. ref: r
  14156. }, s.$attrs), [
  14157. createBaseVNode("TresSphereGeometry", { args: b2.args }, null, 8, Fh),
  14158. renderSlot(s.$slots, "default", {}, () => [
  14159. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Bh)
  14160. ])
  14161. ], 16));
  14162. }
  14163. });
  14164. var jh = ["args"];
  14165. var zh = ["color"];
  14166. var xd = defineComponent({
  14167. __name: "Torus",
  14168. props: {
  14169. args: { default: () => [1, 1, 16, 80] },
  14170. color: { default: "0xffffff" }
  14171. },
  14172. setup(b2, { expose: i }) {
  14173. const r = shallowRef();
  14174. return i({
  14175. value: r
  14176. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14177. ref_key: "torusRef",
  14178. ref: r
  14179. }, s.$attrs), [
  14180. createBaseVNode("TresTorusGeometry", { args: b2.args }, null, 8, jh),
  14181. renderSlot(s.$slots, "default", {}, () => [
  14182. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, zh)
  14183. ])
  14184. ], 16));
  14185. }
  14186. });
  14187. var Uh = ["args"];
  14188. var Gh = ["color"];
  14189. var Ed = defineComponent({
  14190. __name: "TorusKnot",
  14191. props: {
  14192. args: { default: () => [1, 0.4, 64, 8] },
  14193. color: { default: "0xffffff" }
  14194. },
  14195. setup(b2, { expose: i }) {
  14196. const r = shallowRef();
  14197. return i({
  14198. value: r
  14199. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14200. ref_key: "torusKnotRef",
  14201. ref: r
  14202. }, s.$attrs), [
  14203. createBaseVNode("TresTorusKnotGeometry", { args: b2.args }, null, 8, Uh),
  14204. renderSlot(s.$slots, "default", {}, () => [
  14205. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Gh)
  14206. ])
  14207. ], 16));
  14208. }
  14209. });
  14210. var Hh = ["args"];
  14211. var Kh = ["color"];
  14212. var Cd = defineComponent({
  14213. __name: "Circle",
  14214. props: {
  14215. args: { default: () => [1, 32, 0, Math.PI * 2] },
  14216. color: { default: "0xffffff" }
  14217. },
  14218. setup(b2, { expose: i }) {
  14219. const r = shallowRef();
  14220. return i({
  14221. value: r
  14222. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14223. ref_key: "circleRef",
  14224. ref: r
  14225. }, s.$attrs), [
  14226. createBaseVNode("TresCircleGeometry", { args: b2.args }, null, 8, Hh),
  14227. renderSlot(s.$slots, "default", {}, () => [
  14228. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Kh)
  14229. ])
  14230. ], 16));
  14231. }
  14232. });
  14233. var $h = ["args"];
  14234. var Xh = ["color"];
  14235. var Pd = defineComponent({
  14236. __name: "Cone",
  14237. props: {
  14238. args: { default: () => [1, 1, 12, false, 0, Math.PI * 2] },
  14239. color: { default: "0xffffff" }
  14240. },
  14241. setup(b2, { expose: i }) {
  14242. const r = shallowRef();
  14243. return i({
  14244. value: r
  14245. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14246. ref_key: "coneRef",
  14247. ref: r
  14248. }, s.$attrs), [
  14249. createBaseVNode("TresConeGeometry", { args: b2.args }, null, 8, $h),
  14250. renderSlot(s.$slots, "default", {}, () => [
  14251. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Xh)
  14252. ])
  14253. ], 16));
  14254. }
  14255. });
  14256. var Yh = ["args"];
  14257. var qh = ["color"];
  14258. var Td = defineComponent({
  14259. __name: "Tube",
  14260. props: {
  14261. args: { default: () => [
  14262. new QuadraticBezierCurve3(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),
  14263. 20,
  14264. 0.2,
  14265. 8,
  14266. false
  14267. ] },
  14268. color: { default: "0xffffff" }
  14269. },
  14270. setup(b2, { expose: i }) {
  14271. const r = shallowRef();
  14272. return i({
  14273. value: r
  14274. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14275. ref_key: "tubeRef",
  14276. ref: r
  14277. }, s.$attrs), [
  14278. createBaseVNode("TresTubeGeometry", { args: b2.args }, null, 8, Yh),
  14279. renderSlot(s.$slots, "default", {}, () => [
  14280. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, qh)
  14281. ])
  14282. ], 16));
  14283. }
  14284. });
  14285. var Qh = ["args"];
  14286. var Zh = ["color"];
  14287. var kd = defineComponent({
  14288. __name: "Ring",
  14289. props: {
  14290. args: { default: () => [0.5, 1, 32] },
  14291. color: { default: "0xffffff" }
  14292. },
  14293. setup(b2, { expose: i }) {
  14294. const r = shallowRef();
  14295. return i({
  14296. value: r
  14297. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14298. ref_key: "ringRef",
  14299. ref: r
  14300. }, s.$attrs), [
  14301. createBaseVNode("TresRingGeometry", { args: b2.args }, null, 8, Qh),
  14302. renderSlot(s.$slots, "default", {}, () => [
  14303. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, Zh)
  14304. ])
  14305. ], 16));
  14306. }
  14307. });
  14308. var Wh = ["rotation"];
  14309. var Jh = ["args"];
  14310. var ed = ["color"];
  14311. var Md = defineComponent({
  14312. __name: "Tetrahedron",
  14313. props: {
  14314. args: { default: () => [1, 0] },
  14315. color: { default: "0xffffff" }
  14316. },
  14317. setup(b2, { expose: i }) {
  14318. const r = shallowRef();
  14319. return i({
  14320. value: r
  14321. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14322. ref_key: "tetrahedronRef",
  14323. ref: r,
  14324. rotation: [-Math.PI / 2, 0, 0]
  14325. }, s.$attrs), [
  14326. createBaseVNode("TresTetrahedronGeometry", { args: b2.args }, null, 8, Jh),
  14327. renderSlot(s.$slots, "default", {}, () => [
  14328. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, ed)
  14329. ])
  14330. ], 16, Wh));
  14331. }
  14332. });
  14333. var td = ["args"];
  14334. var nd = ["color"];
  14335. var Sd = defineComponent({
  14336. __name: "Icosahedron",
  14337. props: {
  14338. args: { default: () => [1, 0] },
  14339. color: { default: "0xffffff" }
  14340. },
  14341. setup(b2, { expose: i }) {
  14342. const r = shallowRef();
  14343. return i({
  14344. value: r
  14345. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14346. ref_key: "icosahedronRef",
  14347. ref: r
  14348. }, s.$attrs), [
  14349. createBaseVNode("TresIcosahedronGeometry", { args: b2.args }, null, 8, td),
  14350. renderSlot(s.$slots, "default", {}, () => [
  14351. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, nd)
  14352. ])
  14353. ], 16));
  14354. }
  14355. });
  14356. var id = ["args"];
  14357. var sd = ["color"];
  14358. var Ad = defineComponent({
  14359. __name: "Octahedron",
  14360. props: {
  14361. args: { default: () => [1, 0] },
  14362. color: { default: "0xffffff" }
  14363. },
  14364. setup(b2, { expose: i }) {
  14365. const r = shallowRef();
  14366. return i({
  14367. value: r
  14368. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14369. ref_key: "octahedronRef",
  14370. ref: r
  14371. }, s.$attrs), [
  14372. createBaseVNode("TresOctahedronGeometry", { args: b2.args }, null, 8, id),
  14373. renderSlot(s.$slots, "default", {}, () => [
  14374. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, sd)
  14375. ])
  14376. ], 16));
  14377. }
  14378. });
  14379. var rd = ["args"];
  14380. var od = ["color"];
  14381. var Ld = defineComponent({
  14382. __name: "Dodecahedron",
  14383. props: {
  14384. args: { default: () => [1, 0] },
  14385. color: { default: "0xffffff" }
  14386. },
  14387. setup(b2, { expose: i }) {
  14388. const r = shallowRef();
  14389. return i({
  14390. value: r
  14391. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  14392. ref_key: "dodecahedronRef",
  14393. ref: r
  14394. }, s.$attrs), [
  14395. createBaseVNode("TresDodecahedronGeometry", { args: b2.args }, null, 8, rd),
  14396. renderSlot(s.$slots, "default", {}, () => [
  14397. createBaseVNode("TresMeshBasicMaterial", { color: b2.color }, null, 8, od)
  14398. ])
  14399. ], 16));
  14400. }
  14401. });
  14402. var eo = {
  14403. sunset: "venice/venice_sunset_4k.hdr"
  14404. };
  14405. async function ad({
  14406. files: b2 = ["/px.png", "/nx.png", "/py.png", "/ny.png", "/pz.png", "/nz.png"],
  14407. blur: i = 0,
  14408. background: r = false,
  14409. path: s = "/",
  14410. preset: a = void 0,
  14411. encoding: c = void 0
  14412. }) {
  14413. const { state: u } = Fn();
  14414. if (a) {
  14415. if (!(a in eo))
  14416. throw new Error("Preset must be one of: " + Object.keys(eo).join(", "));
  14417. b2 = eo[a], s = "https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";
  14418. }
  14419. const h2 = Array.isArray(b2), g = await dt(
  14420. h2 ? CubeTextureLoader : sh,
  14421. h2 ? [b2] : b2,
  14422. (_) => {
  14423. s && _.setPath(s), c && (_.encoding = c);
  14424. }
  14425. ), w = h2 ? g[0] : g;
  14426. return w && (w.mapping = h2 ? CubeReflectionMapping : EquirectangularReflectionMapping, w.encoding = c ?? h2 ? sRGBEncoding : LinearEncoding), u.scene && (u.scene.environment = w, r !== void 0 && (u.scene.background = w), i && (u.scene.backgroundBlurriness = i | 0)), w;
  14427. }
  14428. var Rd = defineComponent({
  14429. name: "Environment",
  14430. props: ["background", "blur", "files", "encoding", "path", "preset"],
  14431. async setup(b2, { expose: i }) {
  14432. let r = null;
  14433. return i({ getTexture: () => r }), r = await ad(b2), () => {
  14434. };
  14435. }
  14436. });
  14437. export {
  14438. wd as Box,
  14439. Cd as Circle,
  14440. Pd as Cone,
  14441. Ld as Dodecahedron,
  14442. Rd as Environment,
  14443. bd as FBXModel,
  14444. vd as GLTFModel,
  14445. Sd as Icosahedron,
  14446. Ad as Octahedron,
  14447. ud as OrbitControls,
  14448. dd as PamCameraMouse,
  14449. _d as Plane,
  14450. kd as Ring,
  14451. yd as Sphere,
  14452. Md as Tetrahedron,
  14453. gd as Text3D,
  14454. xd as Torus,
  14455. Ed as TorusKnot,
  14456. hd as TransformControls,
  14457. Td as Tube,
  14458. fd as useAnimations,
  14459. ad as useEnvironment,
  14460. Ah as useFBX,
  14461. Sh as useGLTF,
  14462. Eh as usePamCameraMouse,
  14463. md as useTweakPane
  14464. };
  14465. /*! Bundled license information:
  14466. @tresjs/cientos/dist/trescientos.js:
  14467. (*! Tweakpane 3.1.7 (c) 2016 cocopon, licensed under the MIT license. *)
  14468. */
  14469. //# sourceMappingURL=@tresjs_cientos.js.map