@tresjs_cientos.js 540 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841
  1. import {
  2. D,
  3. Et,
  4. I,
  5. Me
  6. } from "./chunk-DESKY23Y.js";
  7. import {
  8. computed,
  9. createBaseVNode,
  10. createCommentVNode,
  11. createElementBlock,
  12. defineComponent,
  13. getCurrentInstance,
  14. getCurrentScope,
  15. inject,
  16. mergeProps,
  17. nextTick,
  18. onMounted,
  19. onScopeDispose,
  20. onUnmounted,
  21. openBlock,
  22. ref,
  23. renderSlot,
  24. shallowReactive,
  25. shallowRef,
  26. unref,
  27. useSlots,
  28. watch,
  29. watchEffect,
  30. withAsyncContext
  31. } from "./chunk-LZPJ5JBW.js";
  32. import {
  33. AmbientLight,
  34. AnimationClip,
  35. AnimationMixer,
  36. Bone,
  37. Box3,
  38. BoxGeometry,
  39. BufferAttribute,
  40. BufferGeometry,
  41. ClampToEdgeWrapping,
  42. Color,
  43. CubeReflectionMapping,
  44. CubeTextureLoader,
  45. Curve,
  46. CylinderGeometry,
  47. DataTextureLoader,
  48. DataUtils,
  49. DirectionalLight,
  50. DoubleSide,
  51. EquirectangularReflectionMapping,
  52. Euler,
  53. EventDispatcher,
  54. ExtrudeGeometry,
  55. FileLoader,
  56. Float32BufferAttribute,
  57. FloatType,
  58. FrontSide,
  59. Group,
  60. HalfFloatType,
  61. ImageBitmapLoader,
  62. InterleavedBuffer,
  63. InterleavedBufferAttribute,
  64. Interpolant,
  65. InterpolateDiscrete,
  66. InterpolateLinear,
  67. Line,
  68. LineBasicMaterial,
  69. LineLoop,
  70. LineSegments,
  71. LinearEncoding,
  72. LinearFilter,
  73. LinearMipmapLinearFilter,
  74. LinearMipmapNearestFilter,
  75. Loader,
  76. LoaderUtils,
  77. MOUSE,
  78. Material,
  79. MathUtils,
  80. Matrix3,
  81. Matrix4,
  82. Mesh,
  83. MeshBasicMaterial,
  84. MeshLambertMaterial,
  85. MeshPhongMaterial,
  86. MeshPhysicalMaterial,
  87. MeshStandardMaterial,
  88. MirroredRepeatWrapping,
  89. NearestFilter,
  90. NearestMipmapLinearFilter,
  91. NearestMipmapNearestFilter,
  92. NumberKeyframeTrack,
  93. Object3D,
  94. OctahedronGeometry,
  95. OrthographicCamera,
  96. PerspectiveCamera,
  97. PlaneGeometry,
  98. PointLight,
  99. Points,
  100. PointsMaterial,
  101. PropertyBinding,
  102. QuadraticBezierCurve3,
  103. Quaternion,
  104. QuaternionKeyframeTrack,
  105. Raycaster,
  106. RepeatWrapping,
  107. ShapePath,
  108. Skeleton,
  109. SkinnedMesh,
  110. Sphere,
  111. SphereGeometry,
  112. Spherical,
  113. SpotLight,
  114. TOUCH,
  115. TangentSpaceNormalMap,
  116. Texture,
  117. TextureLoader,
  118. TorusGeometry,
  119. TriangleFanDrawMode,
  120. TriangleStripDrawMode,
  121. Uint16BufferAttribute,
  122. Vector2,
  123. Vector3,
  124. Vector4,
  125. VectorKeyframeTrack,
  126. sRGBEncoding
  127. } from "./chunk-4QXXOI63.js";
  128. import "./chunk-JC4IRQUL.js";
  129. // node_modules/.pnpm/@tresjs+cientos@2.0.0-beta.1_@tresjs+core@2.0.0-beta.5_three@0.150.1_vue@3.2.47/node_modules/@tresjs/cientos/dist/trescientos.js
  130. var Jc = Object.defineProperty;
  131. var eu = (v, n, r) => n in v ? Jc(v, n, { enumerable: true, configurable: true, writable: true, value: r }) : v[n] = r;
  132. var Zr = (v, n, r) => (eu(v, typeof n != "symbol" ? n + "" : n, r), r);
  133. function Gu(v, n) {
  134. for (var r = 0; r < n.length; r++) {
  135. const s = n[r];
  136. if (typeof s != "string" && !Array.isArray(s)) {
  137. for (const a in s)
  138. if (a !== "default" && !(a in v)) {
  139. const c = Object.getOwnPropertyDescriptor(s, a);
  140. c && Object.defineProperty(v, a, c.get ? c : {
  141. enumerable: true,
  142. get: () => s[a]
  143. });
  144. }
  145. }
  146. }
  147. return Object.freeze(Object.defineProperty(v, Symbol.toStringTag, { value: "Module" }));
  148. }
  149. function Ji(v) {
  150. return Ji = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
  151. return typeof n;
  152. } : function(n) {
  153. return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
  154. }, Ji(v);
  155. }
  156. function Hu(v, n) {
  157. if (Ji(v) !== "object" || v === null)
  158. return v;
  159. var r = v[Symbol.toPrimitive];
  160. if (r !== void 0) {
  161. var s = r.call(v, n || "default");
  162. if (Ji(s) !== "object")
  163. return s;
  164. throw new TypeError("@@toPrimitive must return a primitive value.");
  165. }
  166. return (n === "string" ? String : Number)(v);
  167. }
  168. function Ku(v) {
  169. var n = Hu(v, "string");
  170. return Ji(n) === "symbol" ? n : String(n);
  171. }
  172. function C(v, n, r) {
  173. return n = Ku(n), n in v ? Object.defineProperty(v, n, {
  174. value: r,
  175. enumerable: true,
  176. configurable: true,
  177. writable: true
  178. }) : v[n] = r, v;
  179. }
  180. var ht = Uint8Array;
  181. var ln = Uint16Array;
  182. var ho = Uint32Array;
  183. var Ka = new ht([
  184. 0,
  185. 0,
  186. 0,
  187. 0,
  188. 0,
  189. 0,
  190. 0,
  191. 0,
  192. 1,
  193. 1,
  194. 1,
  195. 1,
  196. 2,
  197. 2,
  198. 2,
  199. 2,
  200. 3,
  201. 3,
  202. 3,
  203. 3,
  204. 4,
  205. 4,
  206. 4,
  207. 4,
  208. 5,
  209. 5,
  210. 5,
  211. 5,
  212. 0,
  213. /* unused */
  214. 0,
  215. 0,
  216. /* impossible */
  217. 0
  218. ]);
  219. var $a = new ht([
  220. 0,
  221. 0,
  222. 0,
  223. 0,
  224. 1,
  225. 1,
  226. 2,
  227. 2,
  228. 3,
  229. 3,
  230. 4,
  231. 4,
  232. 5,
  233. 5,
  234. 6,
  235. 6,
  236. 7,
  237. 7,
  238. 8,
  239. 8,
  240. 9,
  241. 9,
  242. 10,
  243. 10,
  244. 11,
  245. 11,
  246. 12,
  247. 12,
  248. 13,
  249. 13,
  250. /* unused */
  251. 0,
  252. 0
  253. ]);
  254. var $u = new ht([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  255. var Xa = function(v, n) {
  256. for (var r = new ln(31), s = 0; s < 31; ++s)
  257. r[s] = n += 1 << v[s - 1];
  258. for (var a = new ho(r[30]), s = 1; s < 30; ++s)
  259. for (var c = r[s]; c < r[s + 1]; ++c)
  260. a[c] = c - r[s] << 5 | s;
  261. return [r, a];
  262. };
  263. var Ya = Xa(Ka, 2);
  264. var qa = Ya[0];
  265. var Xu = Ya[1];
  266. qa[28] = 258, Xu[258] = 28;
  267. var Yu = Xa($a, 0);
  268. var qu = Yu[0];
  269. var mo = new ln(32768);
  270. for (Ce = 0; Ce < 32768; ++Ce) {
  271. sn = (Ce & 43690) >>> 1 | (Ce & 21845) << 1;
  272. sn = (sn & 52428) >>> 2 | (sn & 13107) << 2, sn = (sn & 61680) >>> 4 | (sn & 3855) << 4, mo[Ce] = ((sn & 65280) >>> 8 | (sn & 255) << 8) >>> 1;
  273. }
  274. var sn;
  275. var Ce;
  276. var qi = function(v, n, r) {
  277. for (var s = v.length, a = 0, c = new ln(n); a < s; ++a)
  278. ++c[v[a] - 1];
  279. var p = new ln(n);
  280. for (a = 0; a < n; ++a)
  281. p[a] = p[a - 1] + c[a - 1] << 1;
  282. var h;
  283. if (r) {
  284. h = new ln(1 << n);
  285. var d = 15 - n;
  286. for (a = 0; a < s; ++a)
  287. if (v[a])
  288. for (var g = a << 4 | v[a], w = n - v[a], _ = p[v[a] - 1]++ << w, y = _ | (1 << w) - 1; _ <= y; ++_)
  289. h[mo[_] >>> d] = g;
  290. } else
  291. for (h = new ln(s), a = 0; a < s; ++a)
  292. v[a] && (h[a] = mo[p[v[a] - 1]++] >>> 15 - v[a]);
  293. return h;
  294. };
  295. var ns = new ht(288);
  296. for (Ce = 0; Ce < 144; ++Ce)
  297. ns[Ce] = 8;
  298. var Ce;
  299. for (Ce = 144; Ce < 256; ++Ce)
  300. ns[Ce] = 9;
  301. var Ce;
  302. for (Ce = 256; Ce < 280; ++Ce)
  303. ns[Ce] = 7;
  304. var Ce;
  305. for (Ce = 280; Ce < 288; ++Ce)
  306. ns[Ce] = 8;
  307. var Ce;
  308. var Qa = new ht(32);
  309. for (Ce = 0; Ce < 32; ++Ce)
  310. Qa[Ce] = 5;
  311. var Ce;
  312. var Qu = qi(ns, 9, 1);
  313. var Zu = qi(Qa, 5, 1);
  314. var to = function(v) {
  315. for (var n = v[0], r = 1; r < v.length; ++r)
  316. v[r] > n && (n = v[r]);
  317. return n;
  318. };
  319. var wt = function(v, n, r) {
  320. var s = n / 8 | 0;
  321. return (v[s] | v[s + 1] << 8) >> (n & 7) & r;
  322. };
  323. var no = function(v, n) {
  324. var r = n / 8 | 0;
  325. return (v[r] | v[r + 1] << 8 | v[r + 2] << 16) >> (n & 7);
  326. };
  327. var Wu = function(v) {
  328. return (v / 8 | 0) + (v & 7 && 1);
  329. };
  330. var Ju = function(v, n, r) {
  331. (n == null || n < 0) && (n = 0), (r == null || r > v.length) && (r = v.length);
  332. var s = new (v instanceof ln ? ln : v instanceof ho ? ho : ht)(r - n);
  333. return s.set(v.subarray(n, r)), s;
  334. };
  335. var ep = function(v, n, r) {
  336. var s = v.length;
  337. if (!s || r && !r.l && s < 5)
  338. return n || new ht(0);
  339. var a = !n || r, c = !r || r.i;
  340. r || (r = {}), n || (n = new ht(s * 3));
  341. var p = function(Ve) {
  342. var Be = n.length;
  343. if (Ve > Be) {
  344. var we = new ht(Math.max(Be * 2, Ve));
  345. we.set(n), n = we;
  346. }
  347. }, h = r.f || 0, d = r.p || 0, g = r.b || 0, w = r.l, _ = r.d, y = r.m, P = r.n, I2 = s * 8;
  348. do {
  349. if (!w) {
  350. r.f = h = wt(v, d, 1);
  351. var S = wt(v, d + 1, 3);
  352. if (d += 3, S)
  353. if (S == 1)
  354. w = Qu, _ = Zu, y = 9, P = 5;
  355. else if (S == 2) {
  356. var V = wt(v, d, 31) + 257, D2 = wt(v, d + 10, 15) + 4, Y = V + wt(v, d + 5, 31) + 1;
  357. d += 14;
  358. for (var G = new ht(Y), N = new ht(19), O = 0; O < D2; ++O)
  359. N[$u[O]] = wt(v, d + O * 3, 7);
  360. d += D2 * 3;
  361. for (var H = to(N), K = (1 << H) - 1, q = qi(N, H, 1), O = 0; O < Y; ) {
  362. var pe = q[wt(v, d, K)];
  363. d += pe & 15;
  364. var R = pe >>> 4;
  365. if (R < 16)
  366. G[O++] = R;
  367. else {
  368. var ge = 0, ce = 0;
  369. for (R == 16 ? (ce = 3 + wt(v, d, 3), d += 2, ge = G[O - 1]) : R == 17 ? (ce = 3 + wt(v, d, 7), d += 3) : R == 18 && (ce = 11 + wt(v, d, 127), d += 7); ce--; )
  370. G[O++] = ge;
  371. }
  372. }
  373. var me = G.subarray(0, V), he = G.subarray(V);
  374. y = to(me), P = to(he), w = qi(me, y, 1), _ = qi(he, P, 1);
  375. } else
  376. throw "invalid block type";
  377. else {
  378. var R = Wu(d) + 4, j = v[R - 4] | v[R - 3] << 8, F = R + j;
  379. if (F > s) {
  380. if (c)
  381. throw "unexpected EOF";
  382. break;
  383. }
  384. a && p(g + j), n.set(v.subarray(R, F), g), r.b = g += j, r.p = d = F * 8;
  385. continue;
  386. }
  387. if (d > I2) {
  388. if (c)
  389. throw "unexpected EOF";
  390. break;
  391. }
  392. }
  393. a && p(g + 131072);
  394. for (var ee = (1 << y) - 1, X = (1 << P) - 1, Pe = d; ; Pe = d) {
  395. var ge = w[no(v, d) & ee], fe = ge >>> 4;
  396. if (d += ge & 15, d > I2) {
  397. if (c)
  398. throw "unexpected EOF";
  399. break;
  400. }
  401. if (!ge)
  402. throw "invalid length/literal";
  403. if (fe < 256)
  404. n[g++] = fe;
  405. else if (fe == 256) {
  406. Pe = d, w = null;
  407. break;
  408. } else {
  409. var ae = fe - 254;
  410. if (fe > 264) {
  411. var O = fe - 257, ne = Ka[O];
  412. ae = wt(v, d, (1 << ne) - 1) + qa[O], d += ne;
  413. }
  414. var be = _[no(v, d) & X], M = be >>> 4;
  415. if (!be)
  416. throw "invalid distance";
  417. d += be & 15;
  418. var he = qu[M];
  419. if (M > 3) {
  420. var ne = $a[M];
  421. he += no(v, d) & (1 << ne) - 1, d += ne;
  422. }
  423. if (d > I2) {
  424. if (c)
  425. throw "unexpected EOF";
  426. break;
  427. }
  428. a && p(g + 131072);
  429. for (var le = g + ae; g < le; g += 4)
  430. n[g] = n[g - he], n[g + 1] = n[g + 1 - he], n[g + 2] = n[g + 2 - he], n[g + 3] = n[g + 3 - he];
  431. g = le;
  432. }
  433. }
  434. r.l = w, r.p = Pe, r.b = g, w && (h = 1, r.m = y, r.d = _, r.n = P);
  435. } while (!h);
  436. return g == n.length ? n : Ju(n, 0, g);
  437. };
  438. var tp = new ht(0);
  439. var np = function(v) {
  440. if ((v[0] & 15) != 8 || v[0] >>> 4 > 7 || (v[0] << 8 | v[1]) % 31)
  441. throw "invalid zlib data";
  442. if (v[1] & 32)
  443. throw "invalid zlib data: preset dictionaries not supported";
  444. };
  445. function ip(v, n) {
  446. return ep((np(v), v.subarray(2, -4)), n);
  447. }
  448. var sp = typeof TextDecoder < "u" && new TextDecoder();
  449. var rp = 0;
  450. try {
  451. sp.decode(tp, { stream: true }), rp = 1;
  452. } catch {
  453. }
  454. var op = class extends Object3D {
  455. // events
  456. constructor(n, r) {
  457. super(), C(this, "isTransformControls", true), C(this, "visible", false), C(this, "domElement", void 0), C(this, "raycaster", new Raycaster()), C(this, "gizmo", void 0), C(this, "plane", void 0), C(this, "tempVector", new Vector3()), C(this, "tempVector2", new Vector3()), C(this, "tempQuaternion", new Quaternion()), C(this, "unit", {
  458. X: new Vector3(1, 0, 0),
  459. Y: new Vector3(0, 1, 0),
  460. Z: new Vector3(0, 0, 1)
  461. }), C(this, "pointStart", new Vector3()), C(this, "pointEnd", new Vector3()), C(this, "offset", new Vector3()), C(this, "rotationAxis", new Vector3()), C(this, "startNorm", new Vector3()), C(this, "endNorm", new Vector3()), C(this, "rotationAngle", 0), C(this, "cameraPosition", new Vector3()), C(this, "cameraQuaternion", new Quaternion()), C(this, "cameraScale", new Vector3()), C(this, "parentPosition", new Vector3()), C(this, "parentQuaternion", new Quaternion()), C(this, "parentQuaternionInv", new Quaternion()), C(this, "parentScale", new Vector3()), C(this, "worldPositionStart", new Vector3()), C(this, "worldQuaternionStart", new Quaternion()), C(this, "worldScaleStart", new Vector3()), C(this, "worldPosition", new Vector3()), C(this, "worldQuaternion", new Quaternion()), C(this, "worldQuaternionInv", new Quaternion()), C(this, "worldScale", new Vector3()), C(this, "eye", new Vector3()), C(this, "positionStart", new Vector3()), C(this, "quaternionStart", new Quaternion()), C(this, "scaleStart", new Vector3()), C(this, "camera", void 0), C(this, "object", void 0), C(this, "enabled", true), C(this, "axis", null), C(this, "mode", "translate"), C(this, "translationSnap", null), C(this, "rotationSnap", null), C(this, "scaleSnap", null), C(this, "space", "world"), C(this, "size", 1), C(this, "dragging", false), C(this, "showX", true), C(this, "showY", true), C(this, "showZ", true), C(this, "changeEvent", {
  462. type: "change"
  463. }), C(this, "mouseDownEvent", {
  464. type: "mouseDown",
  465. mode: this.mode
  466. }), C(this, "mouseUpEvent", {
  467. type: "mouseUp",
  468. mode: this.mode
  469. }), C(this, "objectChangeEvent", {
  470. type: "objectChange"
  471. }), C(this, "intersectObjectWithRay", (a, c, p) => {
  472. const h = c.intersectObject(a, true);
  473. for (let d = 0; d < h.length; d++)
  474. if (h[d].object.visible || p)
  475. return h[d];
  476. return false;
  477. }), C(this, "attach", (a) => (this.object = a, this.visible = true, this)), C(this, "detach", () => (this.object = void 0, this.visible = false, this.axis = null, this)), C(this, "reset", () => this.enabled ? (this.dragging && this.object !== void 0 && (this.object.position.copy(this.positionStart), this.object.quaternion.copy(this.quaternionStart), this.object.scale.copy(this.scaleStart), this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent), this.pointStart.copy(this.pointEnd)), this) : this), C(this, "updateMatrixWorld", () => {
  478. 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();
  479. }), C(this, "pointerHover", (a) => {
  480. if (this.object === void 0 || this.dragging === true)
  481. return;
  482. this.raycaster.setFromCamera(a, this.camera);
  483. const c = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);
  484. c ? this.axis = c.object.name : this.axis = null;
  485. }), C(this, "pointerDown", (a) => {
  486. if (!(this.object === void 0 || this.dragging === true || a.button !== 0) && this.axis !== null) {
  487. this.raycaster.setFromCamera(a, this.camera);
  488. const c = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  489. if (c) {
  490. let p = this.space;
  491. if (this.mode === "scale" ? p = "local" : (this.axis === "E" || this.axis === "XYZE" || this.axis === "XYZ") && (p = "world"), p === "local" && this.mode === "rotate") {
  492. const h = this.rotationSnap;
  493. this.axis === "X" && h && (this.object.rotation.x = Math.round(this.object.rotation.x / h) * h), this.axis === "Y" && h && (this.object.rotation.y = Math.round(this.object.rotation.y / h) * h), this.axis === "Z" && h && (this.object.rotation.z = Math.round(this.object.rotation.z / h) * h);
  494. }
  495. 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);
  496. }
  497. this.dragging = true, this.mouseDownEvent.mode = this.mode, this.dispatchEvent(this.mouseDownEvent);
  498. }
  499. }), C(this, "pointerMove", (a) => {
  500. const c = this.axis, p = this.mode, h = this.object;
  501. let d = this.space;
  502. if (p === "scale" ? d = "local" : (c === "E" || c === "XYZE" || c === "XYZ") && (d = "world"), h === void 0 || c === null || this.dragging === false || a.button !== -1)
  503. return;
  504. this.raycaster.setFromCamera(a, this.camera);
  505. const g = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  506. if (g) {
  507. if (this.pointEnd.copy(g.point).sub(this.worldPositionStart), p === "translate")
  508. this.offset.copy(this.pointEnd).sub(this.pointStart), d === "local" && c !== "XYZ" && this.offset.applyQuaternion(this.worldQuaternionInv), c.indexOf("X") === -1 && (this.offset.x = 0), c.indexOf("Y") === -1 && (this.offset.y = 0), c.indexOf("Z") === -1 && (this.offset.z = 0), d === "local" && c !== "XYZ" ? this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale) : this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale), h.position.copy(this.offset).add(this.positionStart), this.translationSnap && (d === "local" && (h.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()), c.search("X") !== -1 && (h.position.x = Math.round(h.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h.position.y = Math.round(h.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h.position.z = Math.round(h.position.z / this.translationSnap) * this.translationSnap), h.position.applyQuaternion(this.quaternionStart)), d === "world" && (h.parent && h.position.add(this.tempVector.setFromMatrixPosition(h.parent.matrixWorld)), c.search("X") !== -1 && (h.position.x = Math.round(h.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h.position.y = Math.round(h.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h.position.z = Math.round(h.position.z / this.translationSnap) * this.translationSnap), h.parent && h.position.sub(this.tempVector.setFromMatrixPosition(h.parent.matrixWorld))));
  509. else if (p === "scale") {
  510. if (c.search("XYZ") !== -1) {
  511. let w = this.pointEnd.length() / this.pointStart.length();
  512. this.pointEnd.dot(this.pointStart) < 0 && (w *= -1), this.tempVector2.set(w, w, w);
  513. } else
  514. 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);
  515. h.scale.copy(this.scaleStart).multiply(this.tempVector2), this.scaleSnap && this.object && (c.search("X") !== -1 && (this.object.scale.x = Math.round(h.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Y") !== -1 && (h.scale.y = Math.round(h.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Z") !== -1 && (h.scale.z = Math.round(h.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
  516. } else if (p === "rotate") {
  517. this.offset.copy(this.pointEnd).sub(this.pointStart);
  518. const w = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));
  519. c === "E" ? (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this.startNorm.copy(this.pointStart).normalize(), this.endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this.endNorm.cross(this.startNorm).dot(this.eye) < 0 ? 1 : -1) : c === "XYZE" ? (this.rotationAxis.copy(this.offset).cross(this.eye).normalize(), this.rotationAngle = this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye)) * w) : (c === "X" || c === "Y" || c === "Z") && (this.rotationAxis.copy(this.unit[c]), this.tempVector.copy(this.unit[c]), d === "local" && this.tempVector.applyQuaternion(this.worldQuaternion), this.rotationAngle = this.offset.dot(this.tempVector.cross(this.eye).normalize()) * w), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), d === "local" && c !== "E" && c !== "XYZE" ? (h.quaternion.copy(this.quaternionStart), h.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this.parentQuaternionInv), h.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), h.quaternion.multiply(this.quaternionStart).normalize());
  520. }
  521. this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent);
  522. }
  523. }), C(this, "pointerUp", (a) => {
  524. a.button === 0 && (this.dragging && this.axis !== null && (this.mouseUpEvent.mode = this.mode, this.dispatchEvent(this.mouseUpEvent)), this.dragging = false, this.axis = null);
  525. }), C(this, "getPointer", (a) => {
  526. var c;
  527. if (this.domElement && (c = this.domElement.ownerDocument) !== null && c !== void 0 && c.pointerLockElement)
  528. return {
  529. x: 0,
  530. y: 0,
  531. button: a.button
  532. };
  533. {
  534. var p;
  535. const h = a.changedTouches ? a.changedTouches[0] : a, d = (p = this.domElement) === null || p === void 0 ? void 0 : p.getBoundingClientRect();
  536. return {
  537. x: (h.clientX - d.left) / d.width * 2 - 1,
  538. y: -(h.clientY - d.top) / d.height * 2 + 1,
  539. button: a.button
  540. };
  541. }
  542. }), C(this, "onPointerHover", (a) => {
  543. if (this.enabled)
  544. switch (a.pointerType) {
  545. case "mouse":
  546. case "pen":
  547. this.pointerHover(this.getPointer(a));
  548. break;
  549. }
  550. }), C(this, "onPointerDown", (a) => {
  551. !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)));
  552. }), C(this, "onPointerMove", (a) => {
  553. this.enabled && this.pointerMove(this.getPointer(a));
  554. }), C(this, "onPointerUp", (a) => {
  555. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "", this.domElement.ownerDocument.removeEventListener("pointermove", this.onPointerMove), this.pointerUp(this.getPointer(a)));
  556. }), C(this, "getMode", () => this.mode), C(this, "setMode", (a) => {
  557. this.mode = a;
  558. }), C(this, "setTranslationSnap", (a) => {
  559. this.translationSnap = a;
  560. }), C(this, "setRotationSnap", (a) => {
  561. this.rotationSnap = a;
  562. }), C(this, "setScaleSnap", (a) => {
  563. this.scaleSnap = a;
  564. }), C(this, "setSize", (a) => {
  565. this.size = a;
  566. }), C(this, "setSpace", (a) => {
  567. this.space = a;
  568. }), C(this, "update", () => {
  569. console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.");
  570. }), C(this, "connect", (a) => {
  571. 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);
  572. }), C(this, "dispose", () => {
  573. var a, c, p, h, d, g;
  574. (a = this.domElement) === null || a === void 0 || a.removeEventListener("pointerdown", this.onPointerDown), (c = this.domElement) === null || c === void 0 || c.removeEventListener("pointermove", this.onPointerHover), (p = this.domElement) === null || p === void 0 || (h = p.ownerDocument) === null || h === void 0 || h.removeEventListener("pointermove", this.onPointerMove), (d = this.domElement) === null || d === void 0 || (g = d.ownerDocument) === null || g === void 0 || g.removeEventListener("pointerup", this.onPointerUp), this.traverse((w) => {
  575. const _ = w;
  576. _.geometry && _.geometry.dispose(), _.material && _.material.dispose();
  577. });
  578. }), this.domElement = r, this.camera = n, this.gizmo = new ap(), this.add(this.gizmo), this.plane = new lp(), this.add(this.plane);
  579. const s = (a, c) => {
  580. let p = c;
  581. Object.defineProperty(this, a, {
  582. get: function() {
  583. return p !== void 0 ? p : c;
  584. },
  585. set: function(h) {
  586. p !== h && (p = h, this.plane[a] = h, this.gizmo[a] = h, this.dispatchEvent({
  587. type: a + "-changed",
  588. value: h
  589. }), this.dispatchEvent(this.changeEvent));
  590. }
  591. }), this[a] = c, this.plane[a] = c, this.gizmo[a] = c;
  592. };
  593. 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);
  594. }
  595. };
  596. var ap = class extends Object3D {
  597. // these are set from parent class TransformControls
  598. constructor() {
  599. super(), C(this, "isTransformControlsGizmo", true), C(this, "type", "TransformControlsGizmo"), C(this, "tempVector", new Vector3(0, 0, 0)), C(this, "tempEuler", new Euler()), C(this, "alignVector", new Vector3(0, 1, 0)), C(this, "zeroVector", new Vector3(0, 0, 0)), C(this, "lookAtMatrix", new Matrix4()), C(this, "tempQuaternion", new Quaternion()), C(this, "tempQuaternion2", new Quaternion()), C(this, "identityQuaternion", new Quaternion()), C(this, "unitX", new Vector3(1, 0, 0)), C(this, "unitY", new Vector3(0, 1, 0)), C(this, "unitZ", new Vector3(0, 0, 1)), C(this, "gizmo", void 0), C(this, "picker", void 0), C(this, "helper", void 0), C(this, "rotationAxis", new Vector3()), C(this, "cameraPosition", new Vector3()), C(this, "worldPositionStart", new Vector3()), C(this, "worldQuaternionStart", new Quaternion()), C(this, "worldPosition", new Vector3()), C(this, "worldQuaternion", new Quaternion()), C(this, "eye", new Vector3()), C(this, "camera", null), C(this, "enabled", true), C(this, "axis", null), C(this, "mode", "translate"), C(this, "space", "world"), C(this, "size", 1), C(this, "dragging", false), C(this, "showX", true), C(this, "showY", true), C(this, "showZ", true), C(this, "updateMatrixWorld", () => {
  600. let fe = this.space;
  601. this.mode === "scale" && (fe = "local");
  602. const ae = fe === "local" ? this.worldQuaternion : this.identityQuaternion;
  603. 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";
  604. let ne = [];
  605. ne = ne.concat(this.picker[this.mode].children), ne = ne.concat(this.gizmo[this.mode].children), ne = ne.concat(this.helper[this.mode].children);
  606. for (let be = 0; be < ne.length; be++) {
  607. const M = ne[be];
  608. M.visible = true, M.rotation.set(0, 0, 0), M.position.copy(this.worldPosition);
  609. let le;
  610. if (this.camera.isOrthographicCamera ? le = (this.camera.top - this.camera.bottom) / this.camera.zoom : le = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), M.scale.set(1, 1, 1).multiplyScalar(le * this.size / 7), M.tag === "helper") {
  611. 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));
  612. continue;
  613. }
  614. 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) {
  615. return M.name === Ve;
  616. }) ? (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));
  617. }
  618. super.updateMatrixWorld();
  619. });
  620. const n = new MeshBasicMaterial({
  621. depthTest: false,
  622. depthWrite: false,
  623. transparent: true,
  624. side: DoubleSide,
  625. fog: false,
  626. toneMapped: false
  627. }), r = new LineBasicMaterial({
  628. depthTest: false,
  629. depthWrite: false,
  630. transparent: true,
  631. linewidth: 1,
  632. fog: false,
  633. toneMapped: false
  634. }), s = n.clone();
  635. s.opacity = 0.15;
  636. const a = n.clone();
  637. a.opacity = 0.33;
  638. const c = n.clone();
  639. c.color.set(16711680);
  640. const p = n.clone();
  641. p.color.set(65280);
  642. const h = n.clone();
  643. h.color.set(255);
  644. const d = n.clone();
  645. d.opacity = 0.25;
  646. const g = d.clone();
  647. g.color.set(16776960);
  648. const w = d.clone();
  649. w.color.set(65535);
  650. const _ = d.clone();
  651. _.color.set(16711935), n.clone().color.set(16776960);
  652. const P = r.clone();
  653. P.color.set(16711680);
  654. const I2 = r.clone();
  655. I2.color.set(65280);
  656. const S = r.clone();
  657. S.color.set(255);
  658. const R = r.clone();
  659. R.color.set(65535);
  660. const j = r.clone();
  661. j.color.set(16711935);
  662. const F = r.clone();
  663. F.color.set(16776960);
  664. const V = r.clone();
  665. V.color.set(7895160);
  666. const D2 = F.clone();
  667. D2.opacity = 0.25;
  668. const Y = new CylinderGeometry(0, 0.05, 0.2, 12, 1, false), G = new BoxGeometry(0.125, 0.125, 0.125), N = new BufferGeometry();
  669. N.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
  670. const O = (fe, ae) => {
  671. const ne = new BufferGeometry(), be = [];
  672. for (let M = 0; M <= 64 * ae; ++M)
  673. be.push(0, Math.cos(M / 32 * Math.PI) * fe, Math.sin(M / 32 * Math.PI) * fe);
  674. return ne.setAttribute("position", new Float32BufferAttribute(be, 3)), ne;
  675. }, H = () => {
  676. const fe = new BufferGeometry();
  677. return fe.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3)), fe;
  678. }, K = {
  679. X: [[new Mesh(Y, c), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new Mesh(Y, c), [1, 0, 0], [0, 0, Math.PI / 2], null, "bwd"], [new Line(N, P)]],
  680. Y: [[new Mesh(Y, p), [0, 1, 0], null, null, "fwd"], [new Mesh(Y, p), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"], [new Line(N, I2), null, [0, 0, Math.PI / 2]]],
  681. Z: [[new Mesh(Y, h), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new Mesh(Y, h), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"], [new Line(N, S), null, [0, -Math.PI / 2, 0]]],
  682. XYZ: [[new Mesh(new OctahedronGeometry(0.1, 0), d.clone()), [0, 0, 0], [0, 0, 0]]],
  683. 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]]],
  684. YZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), w.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]], [new Line(N, R), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  685. XZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), _.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]], [new Line(N, j), [0.18, 0, 0.3], null, [0.125, 1, 1]], [new Line(N, j), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]]
  686. }, q = {
  687. X: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],
  688. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0.6, 0]]],
  689. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],
  690. XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), s)]],
  691. XY: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0.2, 0]]],
  692. YZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],
  693. XZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]
  694. }, pe = {
  695. START: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  696. END: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  697. DELTA: [[new Line(H(), a), null, null, null, "helper"]],
  698. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  699. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  700. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  701. }, ge = {
  702. X: [[new Line(O(1, 0.5), P)], [new Mesh(new OctahedronGeometry(0.04, 0), c), [0, 0, 0.99], null, [1, 3, 1]]],
  703. Y: [[new Line(O(1, 0.5), I2), null, [0, 0, -Math.PI / 2]], [new Mesh(new OctahedronGeometry(0.04, 0), p), [0, 0, 0.99], null, [3, 1, 1]]],
  704. Z: [[new Line(O(1, 0.5), S), null, [0, Math.PI / 2, 0]], [new Mesh(new OctahedronGeometry(0.04, 0), h), [0.99, 0, 0], null, [1, 3, 1]]],
  705. E: [[new Line(O(1.25, 1), D2), null, [0, Math.PI / 2, 0]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D2), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D2), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D2), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D2), [0, 1.17, 0], [0, 0, 0], [1, 1, 1e-3]]],
  706. XYZE: [[new Line(O(1, 1), V), null, [0, Math.PI / 2, 0]]]
  707. }, ce = {
  708. AXIS: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
  709. }, me = {
  710. X: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
  711. Y: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [Math.PI / 2, 0, 0]]],
  712. Z: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, 0, -Math.PI / 2]]],
  713. E: [[new Mesh(new TorusGeometry(1.25, 0.1, 2, 24), s)]],
  714. XYZE: [[new Mesh(new SphereGeometry(0.7, 10, 8), s)]]
  715. }, he = {
  716. X: [[new Mesh(G, c), [0.8, 0, 0], [0, 0, -Math.PI / 2]], [new Line(N, P), null, null, [0.8, 1, 1]]],
  717. Y: [[new Mesh(G, p), [0, 0.8, 0]], [new Line(N, I2), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]],
  718. Z: [[new Mesh(G, h), [0, 0, 0.8], [Math.PI / 2, 0, 0]], [new Line(N, S), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]],
  719. XY: [[new Mesh(G, g), [0.85, 0.85, 0], null, [2, 2, 0.2]], [new Line(N, F), [0.855, 0.98, 0], null, [0.125, 1, 1]], [new Line(N, F), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]],
  720. YZ: [[new Mesh(G, w), [0, 0.85, 0.85], null, [0.2, 2, 2]], [new Line(N, R), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  721. XZ: [[new Mesh(G, _), [0.85, 0, 0.85], null, [2, 0.2, 2]], [new Line(N, j), [0.855, 0, 0.98], null, [0.125, 1, 1]], [new Line(N, j), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  722. XYZX: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [1.1, 0, 0]]],
  723. XYZY: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 1.1, 0]]],
  724. XYZZ: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 0, 1.1]]]
  725. }, ee = {
  726. X: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],
  727. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0.5, 0]]],
  728. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],
  729. XY: [[new Mesh(G, s), [0.85, 0.85, 0], null, [3, 3, 0.2]]],
  730. YZ: [[new Mesh(G, s), [0, 0.85, 0.85], null, [0.2, 3, 3]]],
  731. XZ: [[new Mesh(G, s), [0.85, 0, 0.85], null, [3, 0.2, 3]]],
  732. XYZX: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [1.1, 0, 0]]],
  733. XYZY: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 1.1, 0]]],
  734. XYZZ: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 0, 1.1]]]
  735. }, X = {
  736. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  737. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  738. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  739. }, Pe = (fe) => {
  740. const ae = new Object3D();
  741. for (let ne in fe)
  742. for (let be = fe[ne].length; be--; ) {
  743. const M = fe[ne][be][0].clone(), le = fe[ne][be][1], Ve = fe[ne][be][2], Be = fe[ne][be][3], we = fe[ne][be][4];
  744. M.name = ne, M.tag = we, le && M.position.set(le[0], le[1], le[2]), Ve && M.rotation.set(Ve[0], Ve[1], Ve[2]), Be && M.scale.set(Be[0], Be[1], Be[2]), M.updateMatrix();
  745. const st = M.geometry.clone();
  746. st.applyMatrix4(M.matrix), M.geometry = st, 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);
  747. }
  748. return ae;
  749. };
  750. 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(me)), this.add(this.picker.scale = Pe(ee)), this.add(this.helper.translate = Pe(pe)), this.add(this.helper.rotate = Pe(ce)), this.add(this.helper.scale = Pe(X)), this.picker.translate.visible = false, this.picker.rotate.visible = false, this.picker.scale.visible = false;
  751. }
  752. // updateMatrixWorld will update transformations and appearance of individual handles
  753. };
  754. var lp = class extends Mesh {
  755. constructor() {
  756. super(new PlaneGeometry(1e5, 1e5, 2, 2), new MeshBasicMaterial({
  757. visible: false,
  758. wireframe: true,
  759. side: DoubleSide,
  760. transparent: true,
  761. opacity: 0.1,
  762. toneMapped: false
  763. })), C(this, "isTransformControlsPlane", true), C(this, "type", "TransformControlsPlane"), C(this, "unitX", new Vector3(1, 0, 0)), C(this, "unitY", new Vector3(0, 1, 0)), C(this, "unitZ", new Vector3(0, 0, 1)), C(this, "tempVector", new Vector3()), C(this, "dirVector", new Vector3()), C(this, "alignVector", new Vector3()), C(this, "tempMatrix", new Matrix4()), C(this, "identityQuaternion", new Quaternion()), C(this, "cameraQuaternion", new Quaternion()), C(this, "worldPosition", new Vector3()), C(this, "worldQuaternion", new Quaternion()), C(this, "eye", new Vector3()), C(this, "axis", null), C(this, "mode", "translate"), C(this, "space", "world"), C(this, "updateMatrixWorld", () => {
  764. let n = this.space;
  765. switch (this.position.copy(this.worldPosition), this.mode === "scale" && (n = "local"), this.unitX.set(1, 0, 0).applyQuaternion(n === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitY.set(0, 1, 0).applyQuaternion(n === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitZ.set(0, 0, 1).applyQuaternion(n === "local" ? this.worldQuaternion : this.identityQuaternion), this.alignVector.copy(this.unitY), this.mode) {
  766. case "translate":
  767. case "scale":
  768. switch (this.axis) {
  769. case "X":
  770. this.alignVector.copy(this.eye).cross(this.unitX), this.dirVector.copy(this.unitX).cross(this.alignVector);
  771. break;
  772. case "Y":
  773. this.alignVector.copy(this.eye).cross(this.unitY), this.dirVector.copy(this.unitY).cross(this.alignVector);
  774. break;
  775. case "Z":
  776. this.alignVector.copy(this.eye).cross(this.unitZ), this.dirVector.copy(this.unitZ).cross(this.alignVector);
  777. break;
  778. case "XY":
  779. this.dirVector.copy(this.unitZ);
  780. break;
  781. case "YZ":
  782. this.dirVector.copy(this.unitX);
  783. break;
  784. case "XZ":
  785. this.alignVector.copy(this.unitZ), this.dirVector.copy(this.unitY);
  786. break;
  787. case "XYZ":
  788. case "E":
  789. this.dirVector.set(0, 0, 0);
  790. break;
  791. }
  792. break;
  793. case "rotate":
  794. default:
  795. this.dirVector.set(0, 0, 0);
  796. }
  797. 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();
  798. });
  799. }
  800. };
  801. var ui = new Euler(0, 0, 0, "YXZ");
  802. var pi = new Vector3();
  803. var cp = {
  804. type: "change"
  805. };
  806. var up = {
  807. type: "lock"
  808. };
  809. var pp = {
  810. type: "unlock"
  811. };
  812. var ua = Math.PI / 2;
  813. var hp = class extends EventDispatcher {
  814. constructor(n, r) {
  815. super(), C(this, "camera", void 0), C(this, "domElement", void 0), C(this, "isLocked", void 0), C(this, "minPolarAngle", void 0), C(this, "maxPolarAngle", void 0), C(this, "pointerSpeed", void 0), C(this, "onMouseMove", (s) => {
  816. if (!this.domElement || this.isLocked === false)
  817. return;
  818. const a = s.movementX || s.mozMovementX || s.webkitMovementX || 0, c = s.movementY || s.mozMovementY || s.webkitMovementY || 0;
  819. ui.setFromQuaternion(this.camera.quaternion), ui.y -= a * 2e-3 * this.pointerSpeed, ui.x -= c * 2e-3 * this.pointerSpeed, ui.x = Math.max(ua - this.maxPolarAngle, Math.min(ua - this.minPolarAngle, ui.x)), this.camera.quaternion.setFromEuler(ui), this.dispatchEvent(cp);
  820. }), C(this, "onPointerlockChange", () => {
  821. this.domElement && (this.domElement.ownerDocument.pointerLockElement === this.domElement ? (this.dispatchEvent(up), this.isLocked = true) : (this.dispatchEvent(pp), this.isLocked = false));
  822. }), C(this, "onPointerlockError", () => {
  823. console.error("THREE.PointerLockControls: Unable to use Pointer Lock API");
  824. }), C(this, "connect", (s) => {
  825. this.domElement = s || this.domElement, this.domElement && (this.domElement.ownerDocument.addEventListener("mousemove", this.onMouseMove), this.domElement.ownerDocument.addEventListener("pointerlockchange", this.onPointerlockChange), this.domElement.ownerDocument.addEventListener("pointerlockerror", this.onPointerlockError));
  826. }), C(this, "disconnect", () => {
  827. this.domElement && (this.domElement.ownerDocument.removeEventListener("mousemove", this.onMouseMove), this.domElement.ownerDocument.removeEventListener("pointerlockchange", this.onPointerlockChange), this.domElement.ownerDocument.removeEventListener("pointerlockerror", this.onPointerlockError));
  828. }), C(this, "dispose", () => {
  829. this.disconnect();
  830. }), C(this, "getObject", () => this.camera), C(this, "direction", new Vector3(0, 0, -1)), C(this, "getDirection", (s) => s.copy(this.direction).applyQuaternion(this.camera.quaternion)), C(this, "moveForward", (s) => {
  831. pi.setFromMatrixColumn(this.camera.matrix, 0), pi.crossVectors(this.camera.up, pi), this.camera.position.addScaledVector(pi, s);
  832. }), C(this, "moveRight", (s) => {
  833. pi.setFromMatrixColumn(this.camera.matrix, 0), this.camera.position.addScaledVector(pi, s);
  834. }), C(this, "lock", () => {
  835. this.domElement && this.domElement.requestPointerLock();
  836. }), C(this, "unlock", () => {
  837. this.domElement && this.domElement.ownerDocument.exitPointerLock();
  838. }), this.camera = n, this.domElement = r, this.isLocked = false, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.pointerSpeed = 1, r && this.connect(r);
  839. }
  840. };
  841. var pa = (v, n) => (v % n + n) % n;
  842. var dp = class extends EventDispatcher {
  843. // Set to false to disable this control
  844. // "target" sets the location of focus, where the object orbits around
  845. // How far you can dolly in and out ( PerspectiveCamera only )
  846. // How far you can zoom in and out ( OrthographicCamera only )
  847. // How far you can orbit vertically, upper and lower limits.
  848. // Range is 0 to Math.PI radians.
  849. // radians
  850. // radians
  851. // How far you can orbit horizontally, upper and lower limits.
  852. // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
  853. // radians
  854. // radians
  855. // Set to true to enable damping (inertia)
  856. // If damping is enabled, you must call controls.update() in your animation loop
  857. // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
  858. // Set to false to disable zooming
  859. // Set to false to disable rotating
  860. // Set to false to disable panning
  861. // if false, pan orthogonal to world-space direction camera.up
  862. // pixels moved per arrow key push
  863. // Set to true to automatically rotate around the target
  864. // If auto-rotate is enabled, you must call controls.update() in your animation loop
  865. // 30 seconds per orbit when fps is 60
  866. // true if you want to reverse the orbit to mouse drag from left to right = orbits left
  867. // The four arrow keys
  868. // Mouse buttons
  869. // Touch fingers
  870. // the target DOM element for key events
  871. constructor(n, r) {
  872. super(), C(this, "object", void 0), C(this, "domElement", void 0), C(this, "enabled", true), C(this, "target", new Vector3()), C(this, "minDistance", 0), C(this, "maxDistance", 1 / 0), C(this, "minZoom", 0), C(this, "maxZoom", 1 / 0), C(this, "minPolarAngle", 0), C(this, "maxPolarAngle", Math.PI), C(this, "minAzimuthAngle", -1 / 0), C(this, "maxAzimuthAngle", 1 / 0), C(this, "enableDamping", false), C(this, "dampingFactor", 0.05), C(this, "enableZoom", true), C(this, "zoomSpeed", 1), C(this, "enableRotate", true), C(this, "rotateSpeed", 1), C(this, "enablePan", true), C(this, "panSpeed", 1), C(this, "screenSpacePanning", true), C(this, "keyPanSpeed", 7), C(this, "autoRotate", false), C(this, "autoRotateSpeed", 2), C(this, "reverseOrbit", false), C(this, "keys", {
  873. LEFT: "ArrowLeft",
  874. UP: "ArrowUp",
  875. RIGHT: "ArrowRight",
  876. BOTTOM: "ArrowDown"
  877. }), C(this, "mouseButtons", {
  878. LEFT: MOUSE.ROTATE,
  879. MIDDLE: MOUSE.DOLLY,
  880. RIGHT: MOUSE.PAN
  881. }), C(this, "touches", {
  882. ONE: TOUCH.ROTATE,
  883. TWO: TOUCH.DOLLY_PAN
  884. }), C(this, "target0", void 0), C(this, "position0", void 0), C(this, "zoom0", void 0), C(this, "_domElementKeyEvents", null), C(this, "getPolarAngle", void 0), C(this, "getAzimuthalAngle", void 0), C(this, "setPolarAngle", void 0), C(this, "setAzimuthalAngle", void 0), C(this, "getDistance", void 0), C(this, "listenToKeyEvents", void 0), C(this, "saveState", void 0), C(this, "reset", void 0), C(this, "update", void 0), C(this, "connect", void 0), C(this, "dispose", void 0), this.object = n, this.domElement = 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 = (L) => {
  885. let U = pa(L, 2 * Math.PI), W = w.phi;
  886. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  887. let ie = Math.abs(U - W);
  888. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.phi = U - W, s.update();
  889. }, this.setAzimuthalAngle = (L) => {
  890. let U = pa(L, 2 * Math.PI), W = w.theta;
  891. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  892. let ie = Math.abs(U - W);
  893. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.theta = U - W, s.update();
  894. }, this.getDistance = () => s.object.position.distanceTo(s.target), this.listenToKeyEvents = (L) => {
  895. L.addEventListener("keydown", xt), this._domElementKeyEvents = L;
  896. }, this.saveState = () => {
  897. s.target0.copy(s.target), s.position0.copy(s.object.position), s.zoom0 = s.object instanceof PerspectiveCamera ? s.object.zoom : 1;
  898. }, this.reset = () => {
  899. 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 = h.NONE;
  900. }, this.update = (() => {
  901. const L = new Vector3(), U = new Quaternion().setFromUnitVectors(n.up, new Vector3(0, 1, 0)), W = U.clone().invert(), ie = new Vector3(), ye = new Quaternion(), De = 2 * Math.PI;
  902. return function() {
  903. const hn = s.object.position;
  904. L.copy(hn).sub(s.target), L.applyQuaternion(U), w.setFromVector3(L), s.autoRotate && d === h.NONE && pe(K()), s.enableDamping ? (w.theta += _.theta * s.dampingFactor, w.phi += _.phi * s.dampingFactor) : (w.theta += _.theta, w.phi += _.phi);
  905. let Ue = s.minAzimuthAngle, Ge = s.maxAzimuthAngle;
  906. 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 *= y, w.radius = Math.max(s.minDistance, Math.min(s.maxDistance, w.radius)), s.enableDamping === true ? s.target.addScaledVector(P, s.dampingFactor) : s.target.add(P), L.setFromSpherical(w), L.applyQuaternion(W), hn.copy(s.target).add(L), s.object.lookAt(s.target), s.enableDamping === true ? (_.theta *= 1 - s.dampingFactor, _.phi *= 1 - s.dampingFactor, P.multiplyScalar(1 - s.dampingFactor)) : (_.set(0, 0, 0), P.set(0, 0, 0)), y = 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;
  907. };
  908. })(), this.connect = (L) => {
  909. L === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), s.domElement = L, s.domElement.style.touchAction = "none", s.domElement.addEventListener("contextmenu", pn), s.domElement.addEventListener("pointerdown", rt), s.domElement.addEventListener("pointercancel", Un), s.domElement.addEventListener("wheel", Hn);
  910. }, this.dispose = () => {
  911. var L, U, W, ie, ye, De;
  912. (L = s.domElement) === null || L === void 0 || L.removeEventListener("contextmenu", pn), (U = s.domElement) === null || U === void 0 || U.removeEventListener("pointerdown", rt), (W = s.domElement) === null || W === void 0 || W.removeEventListener("pointercancel", Un), (ie = s.domElement) === null || ie === void 0 || ie.removeEventListener("wheel", Hn), (ye = s.domElement) === null || ye === void 0 || ye.ownerDocument.removeEventListener("pointermove", un), (De = s.domElement) === null || De === void 0 || De.ownerDocument.removeEventListener("pointerup", ft), s._domElementKeyEvents !== null && s._domElementKeyEvents.removeEventListener("keydown", xt);
  913. };
  914. const s = this, a = {
  915. type: "change"
  916. }, c = {
  917. type: "start"
  918. }, p = {
  919. type: "end"
  920. }, h = {
  921. NONE: -1,
  922. ROTATE: 0,
  923. DOLLY: 1,
  924. PAN: 2,
  925. TOUCH_ROTATE: 3,
  926. TOUCH_PAN: 4,
  927. TOUCH_DOLLY_PAN: 5,
  928. TOUCH_DOLLY_ROTATE: 6
  929. };
  930. let d = h.NONE;
  931. const g = 1e-6, w = new Spherical(), _ = new Spherical();
  932. let y = 1;
  933. const P = new Vector3();
  934. let I2 = false;
  935. const S = new Vector2(), R = new Vector2(), j = new Vector2(), F = new Vector2(), V = new Vector2(), D2 = new Vector2(), Y = new Vector2(), G = new Vector2(), N = new Vector2(), O = [], H = {};
  936. function K() {
  937. return 2 * Math.PI / 60 / 60 * s.autoRotateSpeed;
  938. }
  939. function q() {
  940. return Math.pow(0.95, s.zoomSpeed);
  941. }
  942. function pe(L) {
  943. s.reverseOrbit ? _.theta += L : _.theta -= L;
  944. }
  945. function ge(L) {
  946. s.reverseOrbit ? _.phi += L : _.phi -= L;
  947. }
  948. const ce = (() => {
  949. const L = new Vector3();
  950. return function(W, ie) {
  951. L.setFromMatrixColumn(ie, 0), L.multiplyScalar(-W), P.add(L);
  952. };
  953. })(), me = (() => {
  954. const L = new Vector3();
  955. return function(W, ie) {
  956. s.screenSpacePanning === true ? L.setFromMatrixColumn(ie, 1) : (L.setFromMatrixColumn(ie, 0), L.crossVectors(s.object.up, L)), L.multiplyScalar(W), P.add(L);
  957. };
  958. })(), he = (() => {
  959. const L = new Vector3();
  960. return function(W, ie) {
  961. const ye = s.domElement;
  962. if (ye && s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera) {
  963. const De = s.object.position;
  964. L.copy(De).sub(s.target);
  965. let Ht = L.length();
  966. Ht *= Math.tan(s.object.fov / 2 * Math.PI / 180), ce(2 * W * Ht / ye.clientHeight, s.object.matrix), me(2 * ie * Ht / ye.clientHeight, s.object.matrix);
  967. } else
  968. ye && s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (ce(W * (s.object.right - s.object.left) / s.object.zoom / ye.clientWidth, s.object.matrix), me(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);
  969. };
  970. })();
  971. function ee(L) {
  972. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y /= L : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom * L)), s.object.updateProjectionMatrix(), I2 = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  973. }
  974. function X(L) {
  975. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y *= L : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom / L)), s.object.updateProjectionMatrix(), I2 = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  976. }
  977. function Pe(L) {
  978. S.set(L.clientX, L.clientY);
  979. }
  980. function fe(L) {
  981. Y.set(L.clientX, L.clientY);
  982. }
  983. function ae(L) {
  984. F.set(L.clientX, L.clientY);
  985. }
  986. function ne(L) {
  987. R.set(L.clientX, L.clientY), j.subVectors(R, S).multiplyScalar(s.rotateSpeed);
  988. const U = s.domElement;
  989. U && (pe(2 * Math.PI * j.x / U.clientHeight), ge(2 * Math.PI * j.y / U.clientHeight)), S.copy(R), s.update();
  990. }
  991. function be(L) {
  992. G.set(L.clientX, L.clientY), N.subVectors(G, Y), N.y > 0 ? ee(q()) : N.y < 0 && X(q()), Y.copy(G), s.update();
  993. }
  994. function M(L) {
  995. V.set(L.clientX, L.clientY), D2.subVectors(V, F).multiplyScalar(s.panSpeed), he(D2.x, D2.y), F.copy(V), s.update();
  996. }
  997. function le(L) {
  998. L.deltaY < 0 ? X(q()) : L.deltaY > 0 && ee(q()), s.update();
  999. }
  1000. function Ve(L) {
  1001. let U = false;
  1002. switch (L.code) {
  1003. case s.keys.UP:
  1004. he(0, s.keyPanSpeed), U = true;
  1005. break;
  1006. case s.keys.BOTTOM:
  1007. he(0, -s.keyPanSpeed), U = true;
  1008. break;
  1009. case s.keys.LEFT:
  1010. he(s.keyPanSpeed, 0), U = true;
  1011. break;
  1012. case s.keys.RIGHT:
  1013. he(-s.keyPanSpeed, 0), U = true;
  1014. break;
  1015. }
  1016. U && (L.preventDefault(), s.update());
  1017. }
  1018. function Be() {
  1019. if (O.length == 1)
  1020. S.set(O[0].pageX, O[0].pageY);
  1021. else {
  1022. const L = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1023. S.set(L, U);
  1024. }
  1025. }
  1026. function we() {
  1027. if (O.length == 1)
  1028. F.set(O[0].pageX, O[0].pageY);
  1029. else {
  1030. const L = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  1031. F.set(L, U);
  1032. }
  1033. }
  1034. function st() {
  1035. const L = O[0].pageX - O[1].pageX, U = O[0].pageY - O[1].pageY, W = Math.sqrt(L * L + U * U);
  1036. Y.set(0, W);
  1037. }
  1038. function jn() {
  1039. s.enableZoom && st(), s.enablePan && we();
  1040. }
  1041. function Ye() {
  1042. s.enableZoom && st(), s.enableRotate && Be();
  1043. }
  1044. function zn(L) {
  1045. if (O.length == 1)
  1046. R.set(L.pageX, L.pageY);
  1047. else {
  1048. const W = Lt(L), ie = 0.5 * (L.pageX + W.x), ye = 0.5 * (L.pageY + W.y);
  1049. R.set(ie, ye);
  1050. }
  1051. j.subVectors(R, S).multiplyScalar(s.rotateSpeed);
  1052. const U = s.domElement;
  1053. U && (pe(2 * Math.PI * j.x / U.clientHeight), ge(2 * Math.PI * j.y / U.clientHeight)), S.copy(R);
  1054. }
  1055. function cn(L) {
  1056. if (O.length == 1)
  1057. V.set(L.pageX, L.pageY);
  1058. else {
  1059. const U = Lt(L), W = 0.5 * (L.pageX + U.x), ie = 0.5 * (L.pageY + U.y);
  1060. V.set(W, ie);
  1061. }
  1062. D2.subVectors(V, F).multiplyScalar(s.panSpeed), he(D2.x, D2.y), F.copy(V);
  1063. }
  1064. function mt(L) {
  1065. const U = Lt(L), W = L.pageX - U.x, ie = L.pageY - U.y, ye = Math.sqrt(W * W + ie * ie);
  1066. G.set(0, ye), N.set(0, Math.pow(G.y / Y.y, s.zoomSpeed)), ee(N.y), Y.copy(G);
  1067. }
  1068. function Mt(L) {
  1069. s.enableZoom && mt(L), s.enablePan && cn(L);
  1070. }
  1071. function ze(L) {
  1072. s.enableZoom && mt(L), s.enableRotate && zn(L);
  1073. }
  1074. function rt(L) {
  1075. if (s.enabled !== false) {
  1076. if (O.length === 0) {
  1077. var U, W;
  1078. (U = s.domElement) === null || U === void 0 || U.ownerDocument.addEventListener("pointermove", un), (W = s.domElement) === null || W === void 0 || W.ownerDocument.addEventListener("pointerup", ft);
  1079. }
  1080. $n(L), L.pointerType === "touch" ? St(L) : mi(L);
  1081. }
  1082. }
  1083. function un(L) {
  1084. s.enabled !== false && (L.pointerType === "touch" ? Kn(L) : Gn(L));
  1085. }
  1086. function ft(L) {
  1087. if (Et2(L), O.length === 0) {
  1088. var U, W, ie;
  1089. (U = s.domElement) === null || U === void 0 || U.releasePointerCapture(L.pointerId), (W = s.domElement) === null || W === void 0 || W.ownerDocument.removeEventListener("pointermove", un), (ie = s.domElement) === null || ie === void 0 || ie.ownerDocument.removeEventListener("pointerup", ft);
  1090. }
  1091. s.dispatchEvent(p), d = h.NONE;
  1092. }
  1093. function Un(L) {
  1094. Et2(L);
  1095. }
  1096. function mi(L) {
  1097. let U;
  1098. switch (L.button) {
  1099. case 0:
  1100. U = s.mouseButtons.LEFT;
  1101. break;
  1102. case 1:
  1103. U = s.mouseButtons.MIDDLE;
  1104. break;
  1105. case 2:
  1106. U = s.mouseButtons.RIGHT;
  1107. break;
  1108. default:
  1109. U = -1;
  1110. }
  1111. switch (U) {
  1112. case MOUSE.DOLLY:
  1113. if (s.enableZoom === false)
  1114. return;
  1115. fe(L), d = h.DOLLY;
  1116. break;
  1117. case MOUSE.ROTATE:
  1118. if (L.ctrlKey || L.metaKey || L.shiftKey) {
  1119. if (s.enablePan === false)
  1120. return;
  1121. ae(L), d = h.PAN;
  1122. } else {
  1123. if (s.enableRotate === false)
  1124. return;
  1125. Pe(L), d = h.ROTATE;
  1126. }
  1127. break;
  1128. case MOUSE.PAN:
  1129. if (L.ctrlKey || L.metaKey || L.shiftKey) {
  1130. if (s.enableRotate === false)
  1131. return;
  1132. Pe(L), d = h.ROTATE;
  1133. } else {
  1134. if (s.enablePan === false)
  1135. return;
  1136. ae(L), d = h.PAN;
  1137. }
  1138. break;
  1139. default:
  1140. d = h.NONE;
  1141. }
  1142. d !== h.NONE && s.dispatchEvent(c);
  1143. }
  1144. function Gn(L) {
  1145. if (s.enabled !== false)
  1146. switch (d) {
  1147. case h.ROTATE:
  1148. if (s.enableRotate === false)
  1149. return;
  1150. ne(L);
  1151. break;
  1152. case h.DOLLY:
  1153. if (s.enableZoom === false)
  1154. return;
  1155. be(L);
  1156. break;
  1157. case h.PAN:
  1158. if (s.enablePan === false)
  1159. return;
  1160. M(L);
  1161. break;
  1162. }
  1163. }
  1164. function Hn(L) {
  1165. s.enabled === false || s.enableZoom === false || d !== h.NONE && d !== h.ROTATE || (L.preventDefault(), s.dispatchEvent(c), le(L), s.dispatchEvent(p));
  1166. }
  1167. function xt(L) {
  1168. s.enabled === false || s.enablePan === false || Ve(L);
  1169. }
  1170. function St(L) {
  1171. switch (vt(L), O.length) {
  1172. case 1:
  1173. switch (s.touches.ONE) {
  1174. case TOUCH.ROTATE:
  1175. if (s.enableRotate === false)
  1176. return;
  1177. Be(), d = h.TOUCH_ROTATE;
  1178. break;
  1179. case TOUCH.PAN:
  1180. if (s.enablePan === false)
  1181. return;
  1182. we(), d = h.TOUCH_PAN;
  1183. break;
  1184. default:
  1185. d = h.NONE;
  1186. }
  1187. break;
  1188. case 2:
  1189. switch (s.touches.TWO) {
  1190. case TOUCH.DOLLY_PAN:
  1191. if (s.enableZoom === false && s.enablePan === false)
  1192. return;
  1193. jn(), d = h.TOUCH_DOLLY_PAN;
  1194. break;
  1195. case TOUCH.DOLLY_ROTATE:
  1196. if (s.enableZoom === false && s.enableRotate === false)
  1197. return;
  1198. Ye(), d = h.TOUCH_DOLLY_ROTATE;
  1199. break;
  1200. default:
  1201. d = h.NONE;
  1202. }
  1203. break;
  1204. default:
  1205. d = h.NONE;
  1206. }
  1207. d !== h.NONE && s.dispatchEvent(c);
  1208. }
  1209. function Kn(L) {
  1210. switch (vt(L), d) {
  1211. case h.TOUCH_ROTATE:
  1212. if (s.enableRotate === false)
  1213. return;
  1214. zn(L), s.update();
  1215. break;
  1216. case h.TOUCH_PAN:
  1217. if (s.enablePan === false)
  1218. return;
  1219. cn(L), s.update();
  1220. break;
  1221. case h.TOUCH_DOLLY_PAN:
  1222. if (s.enableZoom === false && s.enablePan === false)
  1223. return;
  1224. Mt(L), s.update();
  1225. break;
  1226. case h.TOUCH_DOLLY_ROTATE:
  1227. if (s.enableZoom === false && s.enableRotate === false)
  1228. return;
  1229. ze(L), s.update();
  1230. break;
  1231. default:
  1232. d = h.NONE;
  1233. }
  1234. }
  1235. function pn(L) {
  1236. s.enabled !== false && L.preventDefault();
  1237. }
  1238. function $n(L) {
  1239. O.push(L);
  1240. }
  1241. function Et2(L) {
  1242. delete H[L.pointerId];
  1243. for (let U = 0; U < O.length; U++)
  1244. if (O[U].pointerId == L.pointerId) {
  1245. O.splice(U, 1);
  1246. return;
  1247. }
  1248. }
  1249. function vt(L) {
  1250. let U = H[L.pointerId];
  1251. U === void 0 && (U = new Vector2(), H[L.pointerId] = U), U.set(L.pageX, L.pageY);
  1252. }
  1253. function Lt(L) {
  1254. const U = L.pointerId === O[0].pointerId ? O[1] : O[0];
  1255. return H[U.pointerId];
  1256. }
  1257. r !== void 0 && this.connect(r), this.update();
  1258. }
  1259. };
  1260. var mp = class extends Loader {
  1261. constructor(n) {
  1262. super(n), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(r) {
  1263. return new _p(r);
  1264. }), this.register(function(r) {
  1265. return new Tp(r);
  1266. }), this.register(function(r) {
  1267. return new kp(r);
  1268. }), this.register(function(r) {
  1269. return new yp(r);
  1270. }), this.register(function(r) {
  1271. return new xp(r);
  1272. }), this.register(function(r) {
  1273. return new Ep(r);
  1274. }), this.register(function(r) {
  1275. return new Cp(r);
  1276. }), this.register(function(r) {
  1277. return new gp(r);
  1278. }), this.register(function(r) {
  1279. return new Pp(r);
  1280. }), this.register(function(r) {
  1281. return new wp(r);
  1282. }), this.register(function(r) {
  1283. return new vp(r);
  1284. }), this.register(function(r) {
  1285. return new Mp(r);
  1286. });
  1287. }
  1288. load(n, r, s, a) {
  1289. const c = this;
  1290. let p;
  1291. this.resourcePath !== "" ? p = this.resourcePath : this.path !== "" ? p = this.path : p = LoaderUtils.extractUrlBase(n), this.manager.itemStart(n);
  1292. const h = function(g) {
  1293. a ? a(g) : console.error(g), c.manager.itemError(n), c.manager.itemEnd(n);
  1294. }, d = new FileLoader(this.manager);
  1295. d.setPath(this.path), d.setResponseType("arraybuffer"), d.setRequestHeader(this.requestHeader), d.setWithCredentials(this.withCredentials), d.load(n, function(g) {
  1296. try {
  1297. c.parse(g, p, function(w) {
  1298. r(w), c.manager.itemEnd(n);
  1299. }, h);
  1300. } catch (w) {
  1301. h(w);
  1302. }
  1303. }, s, h);
  1304. }
  1305. setDRACOLoader(n) {
  1306. return this.dracoLoader = n, this;
  1307. }
  1308. setDDSLoader() {
  1309. throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
  1310. }
  1311. setKTX2Loader(n) {
  1312. return this.ktx2Loader = n, this;
  1313. }
  1314. setMeshoptDecoder(n) {
  1315. return this.meshoptDecoder = n, this;
  1316. }
  1317. register(n) {
  1318. return this.pluginCallbacks.indexOf(n) === -1 && this.pluginCallbacks.push(n), this;
  1319. }
  1320. unregister(n) {
  1321. return this.pluginCallbacks.indexOf(n) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n), 1), this;
  1322. }
  1323. parse(n, r, s, a) {
  1324. let c;
  1325. const p = {}, h = {};
  1326. if (typeof n == "string")
  1327. c = n;
  1328. else if (LoaderUtils.decodeText(new Uint8Array(n, 0, 4)) === Za) {
  1329. try {
  1330. p[re.KHR_BINARY_GLTF] = new Sp(n);
  1331. } catch (_) {
  1332. a && a(_);
  1333. return;
  1334. }
  1335. c = p[re.KHR_BINARY_GLTF].content;
  1336. } else
  1337. c = LoaderUtils.decodeText(new Uint8Array(n));
  1338. const d = JSON.parse(c);
  1339. if (d.asset === void 0 || d.asset.version[0] < 2) {
  1340. a && a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
  1341. return;
  1342. }
  1343. const g = new Up(d, {
  1344. path: r || this.resourcePath || "",
  1345. crossOrigin: this.crossOrigin,
  1346. requestHeader: this.requestHeader,
  1347. manager: this.manager,
  1348. ktx2Loader: this.ktx2Loader,
  1349. meshoptDecoder: this.meshoptDecoder
  1350. });
  1351. g.fileLoader.setRequestHeader(this.requestHeader);
  1352. for (let w = 0; w < this.pluginCallbacks.length; w++) {
  1353. const _ = this.pluginCallbacks[w](g);
  1354. h[_.name] = _, p[_.name] = true;
  1355. }
  1356. if (d.extensionsUsed)
  1357. for (let w = 0; w < d.extensionsUsed.length; ++w) {
  1358. const _ = d.extensionsUsed[w], y = d.extensionsRequired || [];
  1359. switch (_) {
  1360. case re.KHR_MATERIALS_UNLIT:
  1361. p[_] = new bp();
  1362. break;
  1363. case re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
  1364. p[_] = new Rp();
  1365. break;
  1366. case re.KHR_DRACO_MESH_COMPRESSION:
  1367. p[_] = new Lp(d, this.dracoLoader);
  1368. break;
  1369. case re.KHR_TEXTURE_TRANSFORM:
  1370. p[_] = new Ap();
  1371. break;
  1372. case re.KHR_MESH_QUANTIZATION:
  1373. p[_] = new Ip();
  1374. break;
  1375. default:
  1376. y.indexOf(_) >= 0 && h[_] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + _ + '".');
  1377. }
  1378. }
  1379. g.setExtensions(p), g.setPlugins(h), g.parse(s, a);
  1380. }
  1381. parseAsync(n, r) {
  1382. const s = this;
  1383. return new Promise(function(a, c) {
  1384. s.parse(n, r, a, c);
  1385. });
  1386. }
  1387. };
  1388. function fp() {
  1389. let v = {};
  1390. return {
  1391. get: function(n) {
  1392. return v[n];
  1393. },
  1394. add: function(n, r) {
  1395. v[n] = r;
  1396. },
  1397. remove: function(n) {
  1398. delete v[n];
  1399. },
  1400. removeAll: function() {
  1401. v = {};
  1402. }
  1403. };
  1404. }
  1405. var re = {
  1406. KHR_BINARY_GLTF: "KHR_binary_glTF",
  1407. KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  1408. KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  1409. KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  1410. KHR_MATERIALS_IOR: "KHR_materials_ior",
  1411. KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  1412. KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
  1413. KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
  1414. KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  1415. KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
  1416. KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  1417. KHR_MATERIALS_VOLUME: "KHR_materials_volume",
  1418. KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  1419. KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  1420. KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  1421. KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
  1422. EXT_TEXTURE_WEBP: "EXT_texture_webp",
  1423. EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
  1424. };
  1425. var vp = class {
  1426. constructor(n) {
  1427. this.parser = n, this.name = re.KHR_LIGHTS_PUNCTUAL, this.cache = {
  1428. refs: {},
  1429. uses: {}
  1430. };
  1431. }
  1432. _markDefs() {
  1433. const n = this.parser, r = this.parser.json.nodes || [];
  1434. for (let s = 0, a = r.length; s < a; s++) {
  1435. const c = r[s];
  1436. c.extensions && c.extensions[this.name] && c.extensions[this.name].light !== void 0 && n._addNodeRef(this.cache, c.extensions[this.name].light);
  1437. }
  1438. }
  1439. _loadLight(n) {
  1440. const r = this.parser, s = "light:" + n;
  1441. let a = r.cache.get(s);
  1442. if (a)
  1443. return a;
  1444. const c = r.json, d = ((c.extensions && c.extensions[this.name] || {}).lights || [])[n];
  1445. let g;
  1446. const w = new Color(16777215);
  1447. d.color !== void 0 && w.fromArray(d.color);
  1448. const _ = d.range !== void 0 ? d.range : 0;
  1449. switch (d.type) {
  1450. case "directional":
  1451. g = new DirectionalLight(w), g.target.position.set(0, 0, -1), g.add(g.target);
  1452. break;
  1453. case "point":
  1454. g = new PointLight(w), g.distance = _;
  1455. break;
  1456. case "spot":
  1457. 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);
  1458. break;
  1459. default:
  1460. throw new Error("THREE.GLTFLoader: Unexpected light type: " + d.type);
  1461. }
  1462. 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_" + n), a = Promise.resolve(g), r.cache.add(s, a), a;
  1463. }
  1464. createNodeAttachment(n) {
  1465. const r = this, s = this.parser, c = s.json.nodes[n], h = (c.extensions && c.extensions[this.name] || {}).light;
  1466. return h === void 0 ? null : this._loadLight(h).then(function(d) {
  1467. return s._getNodeRef(r.cache, h, d);
  1468. });
  1469. }
  1470. };
  1471. var bp = class {
  1472. constructor() {
  1473. this.name = re.KHR_MATERIALS_UNLIT;
  1474. }
  1475. getMaterialType() {
  1476. return MeshBasicMaterial;
  1477. }
  1478. extendParams(n, r, s) {
  1479. const a = [];
  1480. n.color = new Color(1, 1, 1), n.opacity = 1;
  1481. const c = r.pbrMetallicRoughness;
  1482. if (c) {
  1483. if (Array.isArray(c.baseColorFactor)) {
  1484. const p = c.baseColorFactor;
  1485. n.color.fromArray(p), n.opacity = p[3];
  1486. }
  1487. c.baseColorTexture !== void 0 && a.push(s.assignTexture(n, "map", c.baseColorTexture, sRGBEncoding));
  1488. }
  1489. return Promise.all(a);
  1490. }
  1491. };
  1492. var gp = class {
  1493. constructor(n) {
  1494. this.parser = n, this.name = re.KHR_MATERIALS_EMISSIVE_STRENGTH;
  1495. }
  1496. extendMaterialParams(n, r) {
  1497. const a = this.parser.json.materials[n];
  1498. if (!a.extensions || !a.extensions[this.name])
  1499. return Promise.resolve();
  1500. const c = a.extensions[this.name].emissiveStrength;
  1501. return c !== void 0 && (r.emissiveIntensity = c), Promise.resolve();
  1502. }
  1503. };
  1504. var _p = class {
  1505. constructor(n) {
  1506. this.parser = n, this.name = re.KHR_MATERIALS_CLEARCOAT;
  1507. }
  1508. getMaterialType(n) {
  1509. const s = this.parser.json.materials[n];
  1510. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1511. }
  1512. extendMaterialParams(n, r) {
  1513. const s = this.parser, a = s.json.materials[n];
  1514. if (!a.extensions || !a.extensions[this.name])
  1515. return Promise.resolve();
  1516. const c = [], p = a.extensions[this.name];
  1517. if (p.clearcoatFactor !== void 0 && (r.clearcoat = p.clearcoatFactor), p.clearcoatTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatMap", p.clearcoatTexture)), p.clearcoatRoughnessFactor !== void 0 && (r.clearcoatRoughness = p.clearcoatRoughnessFactor), p.clearcoatRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatRoughnessMap", p.clearcoatRoughnessTexture)), p.clearcoatNormalTexture !== void 0 && (c.push(s.assignTexture(r, "clearcoatNormalMap", p.clearcoatNormalTexture)), p.clearcoatNormalTexture.scale !== void 0)) {
  1518. const h = p.clearcoatNormalTexture.scale;
  1519. r.clearcoatNormalScale = new Vector2(h, h);
  1520. }
  1521. return Promise.all(c);
  1522. }
  1523. };
  1524. var wp = class {
  1525. constructor(n) {
  1526. this.parser = n, this.name = re.KHR_MATERIALS_IRIDESCENCE;
  1527. }
  1528. getMaterialType(n) {
  1529. const s = this.parser.json.materials[n];
  1530. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1531. }
  1532. extendMaterialParams(n, r) {
  1533. const s = this.parser, a = s.json.materials[n];
  1534. if (!a.extensions || !a.extensions[this.name])
  1535. return Promise.resolve();
  1536. const c = [], p = a.extensions[this.name];
  1537. return p.iridescenceFactor !== void 0 && (r.iridescence = p.iridescenceFactor), p.iridescenceTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceMap", p.iridescenceTexture)), p.iridescenceIor !== void 0 && (r.iridescenceIOR = p.iridescenceIor), r.iridescenceThicknessRange === void 0 && (r.iridescenceThicknessRange = [100, 400]), p.iridescenceThicknessMinimum !== void 0 && (r.iridescenceThicknessRange[0] = p.iridescenceThicknessMinimum), p.iridescenceThicknessMaximum !== void 0 && (r.iridescenceThicknessRange[1] = p.iridescenceThicknessMaximum), p.iridescenceThicknessTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceThicknessMap", p.iridescenceThicknessTexture)), Promise.all(c);
  1538. }
  1539. };
  1540. var yp = class {
  1541. constructor(n) {
  1542. this.parser = n, this.name = re.KHR_MATERIALS_SHEEN;
  1543. }
  1544. getMaterialType(n) {
  1545. const s = this.parser.json.materials[n];
  1546. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1547. }
  1548. extendMaterialParams(n, r) {
  1549. const s = this.parser, a = s.json.materials[n];
  1550. if (!a.extensions || !a.extensions[this.name])
  1551. return Promise.resolve();
  1552. const c = [];
  1553. r.sheenColor = new Color(0, 0, 0), r.sheenRoughness = 0, r.sheen = 1;
  1554. const p = a.extensions[this.name];
  1555. return p.sheenColorFactor !== void 0 && r.sheenColor.fromArray(p.sheenColorFactor), p.sheenRoughnessFactor !== void 0 && (r.sheenRoughness = p.sheenRoughnessFactor), p.sheenColorTexture !== void 0 && c.push(s.assignTexture(r, "sheenColorMap", p.sheenColorTexture, sRGBEncoding)), p.sheenRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "sheenRoughnessMap", p.sheenRoughnessTexture)), Promise.all(c);
  1556. }
  1557. };
  1558. var xp = class {
  1559. constructor(n) {
  1560. this.parser = n, this.name = re.KHR_MATERIALS_TRANSMISSION;
  1561. }
  1562. getMaterialType(n) {
  1563. const s = this.parser.json.materials[n];
  1564. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1565. }
  1566. extendMaterialParams(n, r) {
  1567. const s = this.parser, a = s.json.materials[n];
  1568. if (!a.extensions || !a.extensions[this.name])
  1569. return Promise.resolve();
  1570. const c = [], p = a.extensions[this.name];
  1571. return p.transmissionFactor !== void 0 && (r.transmission = p.transmissionFactor), p.transmissionTexture !== void 0 && c.push(s.assignTexture(r, "transmissionMap", p.transmissionTexture)), Promise.all(c);
  1572. }
  1573. };
  1574. var Ep = class {
  1575. constructor(n) {
  1576. this.parser = n, this.name = re.KHR_MATERIALS_VOLUME;
  1577. }
  1578. getMaterialType(n) {
  1579. const s = this.parser.json.materials[n];
  1580. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1581. }
  1582. extendMaterialParams(n, r) {
  1583. const s = this.parser, a = s.json.materials[n];
  1584. if (!a.extensions || !a.extensions[this.name])
  1585. return Promise.resolve();
  1586. const c = [], p = a.extensions[this.name];
  1587. r.thickness = p.thicknessFactor !== void 0 ? p.thicknessFactor : 0, p.thicknessTexture !== void 0 && c.push(s.assignTexture(r, "thicknessMap", p.thicknessTexture)), r.attenuationDistance = p.attenuationDistance || 1 / 0;
  1588. const h = p.attenuationColor || [1, 1, 1];
  1589. return r.attenuationColor = new Color(h[0], h[1], h[2]), Promise.all(c);
  1590. }
  1591. };
  1592. var Cp = class {
  1593. constructor(n) {
  1594. this.parser = n, this.name = re.KHR_MATERIALS_IOR;
  1595. }
  1596. getMaterialType(n) {
  1597. const s = this.parser.json.materials[n];
  1598. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1599. }
  1600. extendMaterialParams(n, r) {
  1601. const a = this.parser.json.materials[n];
  1602. if (!a.extensions || !a.extensions[this.name])
  1603. return Promise.resolve();
  1604. const c = a.extensions[this.name];
  1605. return r.ior = c.ior !== void 0 ? c.ior : 1.5, Promise.resolve();
  1606. }
  1607. };
  1608. var Pp = class {
  1609. constructor(n) {
  1610. this.parser = n, this.name = re.KHR_MATERIALS_SPECULAR;
  1611. }
  1612. getMaterialType(n) {
  1613. const s = this.parser.json.materials[n];
  1614. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1615. }
  1616. extendMaterialParams(n, r) {
  1617. const s = this.parser, a = s.json.materials[n];
  1618. if (!a.extensions || !a.extensions[this.name])
  1619. return Promise.resolve();
  1620. const c = [], p = a.extensions[this.name];
  1621. r.specularIntensity = p.specularFactor !== void 0 ? p.specularFactor : 1, p.specularTexture !== void 0 && c.push(s.assignTexture(r, "specularIntensityMap", p.specularTexture));
  1622. const h = p.specularColorFactor || [1, 1, 1];
  1623. return r.specularColor = new Color(h[0], h[1], h[2]), p.specularColorTexture !== void 0 && c.push(s.assignTexture(r, "specularColorMap", p.specularColorTexture, sRGBEncoding)), Promise.all(c);
  1624. }
  1625. };
  1626. var Tp = class {
  1627. constructor(n) {
  1628. this.parser = n, this.name = re.KHR_TEXTURE_BASISU;
  1629. }
  1630. loadTexture(n) {
  1631. const r = this.parser, s = r.json, a = s.textures[n];
  1632. if (!a.extensions || !a.extensions[this.name])
  1633. return null;
  1634. const c = a.extensions[this.name], p = r.options.ktx2Loader;
  1635. if (!p) {
  1636. if (s.extensionsRequired && s.extensionsRequired.indexOf(this.name) >= 0)
  1637. throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
  1638. return null;
  1639. }
  1640. return r.loadTextureImage(n, c.source, p);
  1641. }
  1642. };
  1643. var kp = class {
  1644. constructor(n) {
  1645. this.parser = n, this.name = re.EXT_TEXTURE_WEBP, this.isSupported = null;
  1646. }
  1647. loadTexture(n) {
  1648. const r = this.name, s = this.parser, a = s.json, c = a.textures[n];
  1649. if (!c.extensions || !c.extensions[r])
  1650. return null;
  1651. const p = c.extensions[r], h = a.images[p.source];
  1652. let d = s.textureLoader;
  1653. if (h.uri) {
  1654. const g = s.options.manager.getHandler(h.uri);
  1655. g !== null && (d = g);
  1656. }
  1657. return this.detectSupport().then(function(g) {
  1658. if (g)
  1659. return s.loadTextureImage(n, p.source, d);
  1660. if (a.extensionsRequired && a.extensionsRequired.indexOf(r) >= 0)
  1661. throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
  1662. return s.loadTexture(n);
  1663. });
  1664. }
  1665. detectSupport() {
  1666. return this.isSupported || (this.isSupported = new Promise(function(n) {
  1667. const r = new Image();
  1668. r.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", r.onload = r.onerror = function() {
  1669. n(r.height === 1);
  1670. };
  1671. })), this.isSupported;
  1672. }
  1673. };
  1674. var Mp = class {
  1675. constructor(n) {
  1676. this.name = re.EXT_MESHOPT_COMPRESSION, this.parser = n;
  1677. }
  1678. loadBufferView(n) {
  1679. const r = this.parser.json, s = r.bufferViews[n];
  1680. if (s.extensions && s.extensions[this.name]) {
  1681. const a = s.extensions[this.name], c = this.parser.getDependency("buffer", a.buffer), p = this.parser.options.meshoptDecoder;
  1682. if (!p || !p.supported) {
  1683. if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
  1684. throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
  1685. return null;
  1686. }
  1687. return c.then(function(h) {
  1688. const d = a.byteOffset || 0, g = a.byteLength || 0, w = a.count, _ = a.byteStride, y = new Uint8Array(h, d, g);
  1689. return p.decodeGltfBufferAsync ? p.decodeGltfBufferAsync(w, _, y, a.mode, a.filter).then(function(P) {
  1690. return P.buffer;
  1691. }) : p.ready.then(function() {
  1692. const P = new ArrayBuffer(w * _);
  1693. return p.decodeGltfBuffer(new Uint8Array(P), w, _, y, a.mode, a.filter), P;
  1694. });
  1695. });
  1696. } else
  1697. return null;
  1698. }
  1699. };
  1700. var Za = "glTF";
  1701. var Ki = 12;
  1702. var ha = {
  1703. JSON: 1313821514,
  1704. BIN: 5130562
  1705. };
  1706. var Sp = class {
  1707. constructor(n) {
  1708. this.name = re.KHR_BINARY_GLTF, this.content = null, this.body = null;
  1709. const r = new DataView(n, 0, Ki);
  1710. if (this.header = {
  1711. magic: LoaderUtils.decodeText(new Uint8Array(n.slice(0, 4))),
  1712. version: r.getUint32(4, true),
  1713. length: r.getUint32(8, true)
  1714. }, this.header.magic !== Za)
  1715. throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
  1716. if (this.header.version < 2)
  1717. throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
  1718. const s = this.header.length - Ki, a = new DataView(n, Ki);
  1719. let c = 0;
  1720. for (; c < s; ) {
  1721. const p = a.getUint32(c, true);
  1722. c += 4;
  1723. const h = a.getUint32(c, true);
  1724. if (c += 4, h === ha.JSON) {
  1725. const d = new Uint8Array(n, Ki + c, p);
  1726. this.content = LoaderUtils.decodeText(d);
  1727. } else if (h === ha.BIN) {
  1728. const d = Ki + c;
  1729. this.body = n.slice(d, d + p);
  1730. }
  1731. c += p;
  1732. }
  1733. if (this.content === null)
  1734. throw new Error("THREE.GLTFLoader: JSON content not found.");
  1735. }
  1736. };
  1737. var Lp = class {
  1738. constructor(n, r) {
  1739. if (!r)
  1740. throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
  1741. this.name = re.KHR_DRACO_MESH_COMPRESSION, this.json = n, this.dracoLoader = r, this.dracoLoader.preload();
  1742. }
  1743. decodePrimitive(n, r) {
  1744. const s = this.json, a = this.dracoLoader, c = n.extensions[this.name].bufferView, p = n.extensions[this.name].attributes, h = {}, d = {}, g = {};
  1745. for (const w in p) {
  1746. const _ = vo[w] || w.toLowerCase();
  1747. h[_] = p[w];
  1748. }
  1749. for (const w in n.attributes) {
  1750. const _ = vo[w] || w.toLowerCase();
  1751. if (p[w] !== void 0) {
  1752. const y = s.accessors[n.attributes[w]], P = es[y.componentType];
  1753. g[_] = P.name, d[_] = y.normalized === true;
  1754. }
  1755. }
  1756. return r.getDependency("bufferView", c).then(function(w) {
  1757. return new Promise(function(_) {
  1758. a.decodeDracoFile(w, function(y) {
  1759. for (const P in y.attributes) {
  1760. const I2 = y.attributes[P], S = d[P];
  1761. S !== void 0 && (I2.normalized = S);
  1762. }
  1763. _(y);
  1764. }, h, g);
  1765. });
  1766. });
  1767. }
  1768. };
  1769. var Ap = class {
  1770. constructor() {
  1771. this.name = re.KHR_TEXTURE_TRANSFORM;
  1772. }
  1773. extendTexture(n, r) {
  1774. 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 || (n = n.clone(), r.offset !== void 0 && n.offset.fromArray(r.offset), r.rotation !== void 0 && (n.rotation = r.rotation), r.scale !== void 0 && n.repeat.fromArray(r.scale), n.needsUpdate = true), n;
  1775. }
  1776. };
  1777. var fo = class extends MeshStandardMaterial {
  1778. constructor(n) {
  1779. super(), this.isGLTFSpecularGlossinessMaterial = true;
  1780. const r = ["#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif"].join(`
  1781. `), s = ["#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif"].join(`
  1782. `), 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(`
  1783. `), 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(`
  1784. `), p = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.roughness += geometryRoughness;", "material.roughness = min( material.roughness, 1.0 );", "material.specularColor = specularFactor;"].join(`
  1785. `), h = {
  1786. specular: {
  1787. value: new Color().setHex(16777215)
  1788. },
  1789. glossiness: {
  1790. value: 1
  1791. },
  1792. specularMap: {
  1793. value: null
  1794. },
  1795. glossinessMap: {
  1796. value: null
  1797. }
  1798. };
  1799. this._extraUniforms = h, this.onBeforeCompile = function(d) {
  1800. for (const g in h)
  1801. d.uniforms[g] = h[g];
  1802. 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>", p);
  1803. }, Object.defineProperties(this, {
  1804. specular: {
  1805. get: function() {
  1806. return h.specular.value;
  1807. },
  1808. set: function(d) {
  1809. h.specular.value = d;
  1810. }
  1811. },
  1812. specularMap: {
  1813. get: function() {
  1814. return h.specularMap.value;
  1815. },
  1816. set: function(d) {
  1817. h.specularMap.value = d, d ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP;
  1818. }
  1819. },
  1820. glossiness: {
  1821. get: function() {
  1822. return h.glossiness.value;
  1823. },
  1824. set: function(d) {
  1825. h.glossiness.value = d;
  1826. }
  1827. },
  1828. glossinessMap: {
  1829. get: function() {
  1830. return h.glossinessMap.value;
  1831. },
  1832. set: function(d) {
  1833. h.glossinessMap.value = d, d ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV);
  1834. }
  1835. }
  1836. }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(n);
  1837. }
  1838. copy(n) {
  1839. return super.copy(n), this.specularMap = n.specularMap, this.specular.copy(n.specular), this.glossinessMap = n.glossinessMap, this.glossiness = n.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this;
  1840. }
  1841. };
  1842. var Rp = class {
  1843. constructor() {
  1844. 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"];
  1845. }
  1846. getMaterialType() {
  1847. return fo;
  1848. }
  1849. extendParams(n, r, s) {
  1850. const a = r.extensions[this.name];
  1851. n.color = new Color(1, 1, 1), n.opacity = 1;
  1852. const c = [];
  1853. if (Array.isArray(a.diffuseFactor)) {
  1854. const p = a.diffuseFactor;
  1855. n.color.fromArray(p), n.opacity = p[3];
  1856. }
  1857. if (a.diffuseTexture !== void 0 && c.push(s.assignTexture(n, "map", a.diffuseTexture, sRGBEncoding)), n.emissive = new Color(0, 0, 0), n.glossiness = a.glossinessFactor !== void 0 ? a.glossinessFactor : 1, n.specular = new Color(1, 1, 1), Array.isArray(a.specularFactor) && n.specular.fromArray(a.specularFactor), a.specularGlossinessTexture !== void 0) {
  1858. const p = a.specularGlossinessTexture;
  1859. c.push(s.assignTexture(n, "glossinessMap", p)), c.push(s.assignTexture(n, "specularMap", p, sRGBEncoding));
  1860. }
  1861. return Promise.all(c);
  1862. }
  1863. createMaterial(n) {
  1864. const r = new fo(n);
  1865. return r.fog = true, r.color = n.color, r.map = n.map === void 0 ? null : n.map, r.lightMap = null, r.lightMapIntensity = 1, r.aoMap = n.aoMap === void 0 ? null : n.aoMap, r.aoMapIntensity = 1, r.emissive = n.emissive, r.emissiveIntensity = n.emissiveIntensity === void 0 ? 1 : n.emissiveIntensity, r.emissiveMap = n.emissiveMap === void 0 ? null : n.emissiveMap, r.bumpMap = n.bumpMap === void 0 ? null : n.bumpMap, r.bumpScale = 1, r.normalMap = n.normalMap === void 0 ? null : n.normalMap, r.normalMapType = TangentSpaceNormalMap, n.normalScale && (r.normalScale = n.normalScale), r.displacementMap = null, r.displacementScale = 1, r.displacementBias = 0, r.specularMap = n.specularMap === void 0 ? null : n.specularMap, r.specular = n.specular, r.glossinessMap = n.glossinessMap === void 0 ? null : n.glossinessMap, r.glossiness = n.glossiness, r.alphaMap = null, r.envMap = n.envMap === void 0 ? null : n.envMap, r.envMapIntensity = 1, r.refractionRatio = 0.98, r;
  1866. }
  1867. };
  1868. var Ip = class {
  1869. constructor() {
  1870. this.name = re.KHR_MESH_QUANTIZATION;
  1871. }
  1872. };
  1873. var Wa = class extends Interpolant {
  1874. constructor(n, r, s, a) {
  1875. super(n, r, s, a);
  1876. }
  1877. copySampleValue_(n) {
  1878. const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, c = n * a * 3 + a;
  1879. for (let p = 0; p !== a; p++)
  1880. r[p] = s[c + p];
  1881. return r;
  1882. }
  1883. interpolate_(n, r, s, a) {
  1884. const c = this.resultBuffer, p = this.sampleValues, h = this.valueSize, d = h * 2, g = h * 3, w = a - r, _ = (s - r) / w, y = _ * _, P = y * _, I2 = n * g, S = I2 - g, R = -2 * P + 3 * y, j = P - y, F = 1 - R, V = j - y + _;
  1885. for (let D2 = 0; D2 !== h; D2++) {
  1886. const Y = p[S + D2 + h], G = p[S + D2 + d] * w, N = p[I2 + D2 + h], O = p[I2 + D2] * w;
  1887. c[D2] = F * Y + V * G + R * N + j * O;
  1888. }
  1889. return c;
  1890. }
  1891. };
  1892. var Vp = new Quaternion();
  1893. var Dp = class extends Wa {
  1894. interpolate_(n, r, s, a) {
  1895. const c = super.interpolate_(n, r, s, a);
  1896. return Vp.fromArray(c).normalize().toArray(c), c;
  1897. }
  1898. };
  1899. var Bt = {
  1900. FLOAT: 5126,
  1901. //FLOAT_MAT2: 35674,
  1902. FLOAT_MAT3: 35675,
  1903. FLOAT_MAT4: 35676,
  1904. FLOAT_VEC2: 35664,
  1905. FLOAT_VEC3: 35665,
  1906. FLOAT_VEC4: 35666,
  1907. LINEAR: 9729,
  1908. REPEAT: 10497,
  1909. SAMPLER_2D: 35678,
  1910. POINTS: 0,
  1911. LINES: 1,
  1912. LINE_LOOP: 2,
  1913. LINE_STRIP: 3,
  1914. TRIANGLES: 4,
  1915. TRIANGLE_STRIP: 5,
  1916. TRIANGLE_FAN: 6,
  1917. UNSIGNED_BYTE: 5121,
  1918. UNSIGNED_SHORT: 5123
  1919. };
  1920. var es = {
  1921. 5120: Int8Array,
  1922. 5121: Uint8Array,
  1923. 5122: Int16Array,
  1924. 5123: Uint16Array,
  1925. 5125: Uint32Array,
  1926. 5126: Float32Array
  1927. };
  1928. var da = {
  1929. 9728: NearestFilter,
  1930. 9729: LinearFilter,
  1931. 9984: NearestMipmapNearestFilter,
  1932. 9985: LinearMipmapNearestFilter,
  1933. 9986: NearestMipmapLinearFilter,
  1934. 9987: LinearMipmapLinearFilter
  1935. };
  1936. var ma = {
  1937. 33071: ClampToEdgeWrapping,
  1938. 33648: MirroredRepeatWrapping,
  1939. 10497: RepeatWrapping
  1940. };
  1941. var fa = {
  1942. SCALAR: 1,
  1943. VEC2: 2,
  1944. VEC3: 3,
  1945. VEC4: 4,
  1946. MAT2: 4,
  1947. MAT3: 9,
  1948. MAT4: 16
  1949. };
  1950. var vo = {
  1951. POSITION: "position",
  1952. NORMAL: "normal",
  1953. TANGENT: "tangent",
  1954. TEXCOORD_0: "uv",
  1955. TEXCOORD_1: "uv2",
  1956. COLOR_0: "color",
  1957. WEIGHTS_0: "skinWeight",
  1958. JOINTS_0: "skinIndex"
  1959. };
  1960. var rn = {
  1961. scale: "scale",
  1962. translation: "position",
  1963. rotation: "quaternion",
  1964. weights: "morphTargetInfluences"
  1965. };
  1966. var Op = {
  1967. CUBICSPLINE: void 0,
  1968. // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  1969. // keyframe track will be initialized with a default interpolation type, then modified.
  1970. LINEAR: InterpolateLinear,
  1971. STEP: InterpolateDiscrete
  1972. };
  1973. var io = {
  1974. OPAQUE: "OPAQUE",
  1975. MASK: "MASK",
  1976. BLEND: "BLEND"
  1977. };
  1978. function Np(v) {
  1979. return v.DefaultMaterial === void 0 && (v.DefaultMaterial = new MeshStandardMaterial({
  1980. color: 16777215,
  1981. emissive: 0,
  1982. metalness: 1,
  1983. roughness: 1,
  1984. transparent: false,
  1985. depthTest: true,
  1986. side: FrontSide
  1987. })), v.DefaultMaterial;
  1988. }
  1989. function $i(v, n, r) {
  1990. for (const s in r.extensions)
  1991. v[s] === void 0 && (n.userData.gltfExtensions = n.userData.gltfExtensions || {}, n.userData.gltfExtensions[s] = r.extensions[s]);
  1992. }
  1993. function Dn(v, n) {
  1994. n.extras !== void 0 && (typeof n.extras == "object" ? Object.assign(v.userData, n.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + n.extras));
  1995. }
  1996. function Fp(v, n, r) {
  1997. let s = false, a = false, c = false;
  1998. for (let g = 0, w = n.length; g < w; g++) {
  1999. const _ = n[g];
  2000. if (_.POSITION !== void 0 && (s = true), _.NORMAL !== void 0 && (a = true), _.COLOR_0 !== void 0 && (c = true), s && a && c)
  2001. break;
  2002. }
  2003. if (!s && !a && !c)
  2004. return Promise.resolve(v);
  2005. const p = [], h = [], d = [];
  2006. for (let g = 0, w = n.length; g < w; g++) {
  2007. const _ = n[g];
  2008. if (s) {
  2009. const y = _.POSITION !== void 0 ? r.getDependency("accessor", _.POSITION) : v.attributes.position;
  2010. p.push(y);
  2011. }
  2012. if (a) {
  2013. const y = _.NORMAL !== void 0 ? r.getDependency("accessor", _.NORMAL) : v.attributes.normal;
  2014. h.push(y);
  2015. }
  2016. if (c) {
  2017. const y = _.COLOR_0 !== void 0 ? r.getDependency("accessor", _.COLOR_0) : v.attributes.color;
  2018. d.push(y);
  2019. }
  2020. }
  2021. return Promise.all([Promise.all(p), Promise.all(h), Promise.all(d)]).then(function(g) {
  2022. const w = g[0], _ = g[1], y = g[2];
  2023. return s && (v.morphAttributes.position = w), a && (v.morphAttributes.normal = _), c && (v.morphAttributes.color = y), v.morphTargetsRelative = true, v;
  2024. });
  2025. }
  2026. function Bp(v, n) {
  2027. if (v.updateMorphTargets(), n.weights !== void 0)
  2028. for (let r = 0, s = n.weights.length; r < s; r++)
  2029. v.morphTargetInfluences[r] = n.weights[r];
  2030. if (n.extras && Array.isArray(n.extras.targetNames)) {
  2031. const r = n.extras.targetNames;
  2032. if (v.morphTargetInfluences.length === r.length) {
  2033. v.morphTargetDictionary = {};
  2034. for (let s = 0, a = r.length; s < a; s++)
  2035. v.morphTargetDictionary[r[s]] = s;
  2036. } else
  2037. console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
  2038. }
  2039. }
  2040. function jp(v) {
  2041. const n = v.extensions && v.extensions[re.KHR_DRACO_MESH_COMPRESSION];
  2042. let r;
  2043. return n ? r = "draco:" + n.bufferView + ":" + n.indices + ":" + va(n.attributes) : r = v.indices + ":" + va(v.attributes) + ":" + v.mode, r;
  2044. }
  2045. function va(v) {
  2046. let n = "";
  2047. const r = Object.keys(v).sort();
  2048. for (let s = 0, a = r.length; s < a; s++)
  2049. n += r[s] + ":" + v[r[s]] + ";";
  2050. return n;
  2051. }
  2052. function bo(v) {
  2053. switch (v) {
  2054. case Int8Array:
  2055. return 1 / 127;
  2056. case Uint8Array:
  2057. return 1 / 255;
  2058. case Int16Array:
  2059. return 1 / 32767;
  2060. case Uint16Array:
  2061. return 1 / 65535;
  2062. default:
  2063. throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
  2064. }
  2065. }
  2066. function zp(v) {
  2067. return v.search(/\.jpe?g($|\?)/i) > 0 || v.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : v.search(/\.webp($|\?)/i) > 0 || v.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
  2068. }
  2069. var Up = class {
  2070. constructor(n = {}, r = {}) {
  2071. var s, a;
  2072. this.json = n, this.extensions = {}, this.plugins = {}, this.options = r, this.cache = new fp(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = {
  2073. refs: {},
  2074. uses: {}
  2075. }, this.cameraCache = {
  2076. refs: {},
  2077. uses: {}
  2078. }, this.lightCache = {
  2079. refs: {},
  2080. uses: {}
  2081. }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
  2082. const c = typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true, p = typeof navigator < "u" && ((s = navigator.userAgent) === null || s === void 0 ? void 0 : s.indexOf("Firefox")) > -1, h = typeof navigator < "u" && p ? (a = navigator.userAgent) === null || a === void 0 ? void 0 : a.match(/Firefox\/([0-9]+)\./)[1] : -1;
  2083. typeof createImageBitmap > "u" || c || p && h < 98 ? this.textureLoader = new TextureLoader(this.options.manager) : this.textureLoader = new ImageBitmapLoader(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new FileLoader(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(true);
  2084. }
  2085. setExtensions(n) {
  2086. this.extensions = n;
  2087. }
  2088. setPlugins(n) {
  2089. this.plugins = n;
  2090. }
  2091. parse(n, r) {
  2092. const s = this, a = this.json, c = this.extensions;
  2093. this.cache.removeAll(), this._invokeAll(function(p) {
  2094. return p._markDefs && p._markDefs();
  2095. }), Promise.all(this._invokeAll(function(p) {
  2096. return p.beforeRoot && p.beforeRoot();
  2097. })).then(function() {
  2098. return Promise.all([s.getDependencies("scene"), s.getDependencies("animation"), s.getDependencies("camera")]);
  2099. }).then(function(p) {
  2100. const h = {
  2101. scene: p[0][a.scene || 0],
  2102. scenes: p[0],
  2103. animations: p[1],
  2104. cameras: p[2],
  2105. asset: a.asset,
  2106. parser: s,
  2107. userData: {}
  2108. };
  2109. $i(c, h, a), Dn(h, a), Promise.all(s._invokeAll(function(d) {
  2110. return d.afterRoot && d.afterRoot(h);
  2111. })).then(function() {
  2112. n(h);
  2113. });
  2114. }).catch(r);
  2115. }
  2116. /**
  2117. * Marks the special nodes/meshes in json for efficient parse.
  2118. */
  2119. _markDefs() {
  2120. const n = this.json.nodes || [], r = this.json.skins || [], s = this.json.meshes || [];
  2121. for (let a = 0, c = r.length; a < c; a++) {
  2122. const p = r[a].joints;
  2123. for (let h = 0, d = p.length; h < d; h++)
  2124. n[p[h]].isBone = true;
  2125. }
  2126. for (let a = 0, c = n.length; a < c; a++) {
  2127. const p = n[a];
  2128. p.mesh !== void 0 && (this._addNodeRef(this.meshCache, p.mesh), p.skin !== void 0 && (s[p.mesh].isSkinnedMesh = true)), p.camera !== void 0 && this._addNodeRef(this.cameraCache, p.camera);
  2129. }
  2130. }
  2131. /**
  2132. * Counts references to shared node / Object3D resources. These resources
  2133. * can be reused, or "instantiated", at multiple nodes in the scene
  2134. * hierarchy. Mesh, Camera, and Light instances are instantiated and must
  2135. * be marked. Non-scenegraph resources (like Materials, Geometries, and
  2136. * Textures) can be reused directly and are not marked here.
  2137. *
  2138. * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
  2139. */
  2140. _addNodeRef(n, r) {
  2141. r !== void 0 && (n.refs[r] === void 0 && (n.refs[r] = n.uses[r] = 0), n.refs[r]++);
  2142. }
  2143. /** Returns a reference to a shared resource, cloning it if necessary. */
  2144. _getNodeRef(n, r, s) {
  2145. if (n.refs[r] <= 1)
  2146. return s;
  2147. const a = s.clone(), c = (p, h) => {
  2148. const d = this.associations.get(p);
  2149. d != null && this.associations.set(h, d);
  2150. for (const [g, w] of p.children.entries())
  2151. c(w, h.children[g]);
  2152. };
  2153. return c(s, a), a.name += "_instance_" + n.uses[r]++, a;
  2154. }
  2155. _invokeOne(n) {
  2156. const r = Object.values(this.plugins);
  2157. r.push(this);
  2158. for (let s = 0; s < r.length; s++) {
  2159. const a = n(r[s]);
  2160. if (a)
  2161. return a;
  2162. }
  2163. return null;
  2164. }
  2165. _invokeAll(n) {
  2166. const r = Object.values(this.plugins);
  2167. r.unshift(this);
  2168. const s = [];
  2169. for (let a = 0; a < r.length; a++) {
  2170. const c = n(r[a]);
  2171. c && s.push(c);
  2172. }
  2173. return s;
  2174. }
  2175. /**
  2176. * Requests the specified dependency asynchronously, with caching.
  2177. * @param {string} type
  2178. * @param {number} index
  2179. * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
  2180. */
  2181. getDependency(n, r) {
  2182. const s = n + ":" + r;
  2183. let a = this.cache.get(s);
  2184. if (!a) {
  2185. switch (n) {
  2186. case "scene":
  2187. a = this.loadScene(r);
  2188. break;
  2189. case "node":
  2190. a = this.loadNode(r);
  2191. break;
  2192. case "mesh":
  2193. a = this._invokeOne(function(c) {
  2194. return c.loadMesh && c.loadMesh(r);
  2195. });
  2196. break;
  2197. case "accessor":
  2198. a = this.loadAccessor(r);
  2199. break;
  2200. case "bufferView":
  2201. a = this._invokeOne(function(c) {
  2202. return c.loadBufferView && c.loadBufferView(r);
  2203. });
  2204. break;
  2205. case "buffer":
  2206. a = this.loadBuffer(r);
  2207. break;
  2208. case "material":
  2209. a = this._invokeOne(function(c) {
  2210. return c.loadMaterial && c.loadMaterial(r);
  2211. });
  2212. break;
  2213. case "texture":
  2214. a = this._invokeOne(function(c) {
  2215. return c.loadTexture && c.loadTexture(r);
  2216. });
  2217. break;
  2218. case "skin":
  2219. a = this.loadSkin(r);
  2220. break;
  2221. case "animation":
  2222. a = this._invokeOne(function(c) {
  2223. return c.loadAnimation && c.loadAnimation(r);
  2224. });
  2225. break;
  2226. case "camera":
  2227. a = this.loadCamera(r);
  2228. break;
  2229. default:
  2230. throw new Error("Unknown type: " + n);
  2231. }
  2232. this.cache.add(s, a);
  2233. }
  2234. return a;
  2235. }
  2236. /**
  2237. * Requests all dependencies of the specified type asynchronously, with caching.
  2238. * @param {string} type
  2239. * @return {Promise<Array<Object>>}
  2240. */
  2241. getDependencies(n) {
  2242. let r = this.cache.get(n);
  2243. if (!r) {
  2244. const s = this, a = this.json[n + (n === "mesh" ? "es" : "s")] || [];
  2245. r = Promise.all(a.map(function(c, p) {
  2246. return s.getDependency(n, p);
  2247. })), this.cache.add(n, r);
  2248. }
  2249. return r;
  2250. }
  2251. /**
  2252. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2253. * @param {number} bufferIndex
  2254. * @return {Promise<ArrayBuffer>}
  2255. */
  2256. loadBuffer(n) {
  2257. const r = this.json.buffers[n], s = this.fileLoader;
  2258. if (r.type && r.type !== "arraybuffer")
  2259. throw new Error("THREE.GLTFLoader: " + r.type + " buffer type is not supported.");
  2260. if (r.uri === void 0 && n === 0)
  2261. return Promise.resolve(this.extensions[re.KHR_BINARY_GLTF].body);
  2262. const a = this.options;
  2263. return new Promise(function(c, p) {
  2264. s.load(LoaderUtils.resolveURL(r.uri, a.path), c, void 0, function() {
  2265. p(new Error('THREE.GLTFLoader: Failed to load buffer "' + r.uri + '".'));
  2266. });
  2267. });
  2268. }
  2269. /**
  2270. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2271. * @param {number} bufferViewIndex
  2272. * @return {Promise<ArrayBuffer>}
  2273. */
  2274. loadBufferView(n) {
  2275. const r = this.json.bufferViews[n];
  2276. return this.getDependency("buffer", r.buffer).then(function(s) {
  2277. const a = r.byteLength || 0, c = r.byteOffset || 0;
  2278. return s.slice(c, c + a);
  2279. });
  2280. }
  2281. /**
  2282. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
  2283. * @param {number} accessorIndex
  2284. * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
  2285. */
  2286. loadAccessor(n) {
  2287. const r = this, s = this.json, a = this.json.accessors[n];
  2288. if (a.bufferView === void 0 && a.sparse === void 0)
  2289. return Promise.resolve(null);
  2290. const c = [];
  2291. 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(p) {
  2292. const h = p[0], d = fa[a.type], g = es[a.componentType], w = g.BYTES_PER_ELEMENT, _ = w * d, y = a.byteOffset || 0, P = a.bufferView !== void 0 ? s.bufferViews[a.bufferView].byteStride : void 0, I2 = a.normalized === true;
  2293. let S, R;
  2294. if (P && P !== _) {
  2295. const j = Math.floor(y / P), F = "InterleavedBuffer:" + a.bufferView + ":" + a.componentType + ":" + j + ":" + a.count;
  2296. let V = r.cache.get(F);
  2297. V || (S = new g(h, j * P, a.count * P / w), V = new InterleavedBuffer(S, P / w), r.cache.add(F, V)), R = new InterleavedBufferAttribute(V, d, y % P / w, I2);
  2298. } else
  2299. h === null ? S = new g(a.count * d) : S = new g(h, y, a.count * d), R = new BufferAttribute(S, d, I2);
  2300. if (a.sparse !== void 0) {
  2301. const j = fa.SCALAR, F = es[a.sparse.indices.componentType], V = a.sparse.indices.byteOffset || 0, D2 = a.sparse.values.byteOffset || 0, Y = new F(p[1], V, a.sparse.count * j), G = new g(p[2], D2, a.sparse.count * d);
  2302. h !== null && (R = new BufferAttribute(R.array.slice(), R.itemSize, R.normalized));
  2303. for (let N = 0, O = Y.length; N < O; N++) {
  2304. const H = Y[N];
  2305. if (R.setX(H, G[N * d]), d >= 2 && R.setY(H, G[N * d + 1]), d >= 3 && R.setZ(H, G[N * d + 2]), d >= 4 && R.setW(H, G[N * d + 3]), d >= 5)
  2306. throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
  2307. }
  2308. }
  2309. return R;
  2310. });
  2311. }
  2312. /**
  2313. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
  2314. * @param {number} textureIndex
  2315. * @return {Promise<THREE.Texture>}
  2316. */
  2317. loadTexture(n) {
  2318. const r = this.json, s = this.options, c = r.textures[n].source, p = r.images[c];
  2319. let h = this.textureLoader;
  2320. if (p.uri) {
  2321. const d = s.manager.getHandler(p.uri);
  2322. d !== null && (h = d);
  2323. }
  2324. return this.loadTextureImage(n, c, h);
  2325. }
  2326. loadTextureImage(n, r, s) {
  2327. const a = this, c = this.json, p = c.textures[n], h = c.images[r], d = (h.uri || h.bufferView) + ":" + p.sampler;
  2328. if (this.textureCache[d])
  2329. return this.textureCache[d];
  2330. const g = this.loadImageSource(r, s).then(function(w) {
  2331. w.flipY = false, p.name && (w.name = p.name);
  2332. const y = (c.samplers || {})[p.sampler] || {};
  2333. return w.magFilter = da[y.magFilter] || LinearFilter, w.minFilter = da[y.minFilter] || LinearMipmapLinearFilter, w.wrapS = ma[y.wrapS] || RepeatWrapping, w.wrapT = ma[y.wrapT] || RepeatWrapping, a.associations.set(w, {
  2334. textures: n
  2335. }), w;
  2336. }).catch(function() {
  2337. return null;
  2338. });
  2339. return this.textureCache[d] = g, g;
  2340. }
  2341. loadImageSource(n, r) {
  2342. const s = this, a = this.json, c = this.options;
  2343. if (this.sourceCache[n] !== void 0)
  2344. return this.sourceCache[n].then((_) => _.clone());
  2345. const p = a.images[n], h = self.URL || self.webkitURL;
  2346. let d = p.uri || "", g = false;
  2347. if (p.bufferView !== void 0)
  2348. d = s.getDependency("bufferView", p.bufferView).then(function(_) {
  2349. g = true;
  2350. const y = new Blob([_], {
  2351. type: p.mimeType
  2352. });
  2353. return d = h.createObjectURL(y), d;
  2354. });
  2355. else if (p.uri === void 0)
  2356. throw new Error("THREE.GLTFLoader: Image " + n + " is missing URI and bufferView");
  2357. const w = Promise.resolve(d).then(function(_) {
  2358. return new Promise(function(y, P) {
  2359. let I2 = y;
  2360. r.isImageBitmapLoader === true && (I2 = function(S) {
  2361. const R = new Texture(S);
  2362. R.needsUpdate = true, y(R);
  2363. }), r.load(LoaderUtils.resolveURL(_, c.path), I2, void 0, P);
  2364. });
  2365. }).then(function(_) {
  2366. return g === true && h.revokeObjectURL(d), _.userData.mimeType = p.mimeType || zp(p.uri), _;
  2367. }).catch(function(_) {
  2368. throw console.error("THREE.GLTFLoader: Couldn't load texture", d), _;
  2369. });
  2370. return this.sourceCache[n] = w, w;
  2371. }
  2372. /**
  2373. * Asynchronously assigns a texture to the given material parameters.
  2374. * @param {Object} materialParams
  2375. * @param {string} mapName
  2376. * @param {Object} mapDef
  2377. * @return {Promise<Texture>}
  2378. */
  2379. assignTexture(n, r, s, a) {
  2380. const c = this;
  2381. return this.getDependency("texture", s.index).then(function(p) {
  2382. 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]) {
  2383. const h = s.extensions !== void 0 ? s.extensions[re.KHR_TEXTURE_TRANSFORM] : void 0;
  2384. if (h) {
  2385. const d = c.associations.get(p);
  2386. p = c.extensions[re.KHR_TEXTURE_TRANSFORM].extendTexture(p, h), c.associations.set(p, d);
  2387. }
  2388. }
  2389. return a !== void 0 && (p.encoding = a), n[r] = p, p;
  2390. });
  2391. }
  2392. /**
  2393. * Assigns final material to a Mesh, Line, or Points instance. The instance
  2394. * already has a material (generated from the glTF material options alone)
  2395. * but reuse of the same glTF material may require multiple threejs materials
  2396. * to accommodate different primitive types, defines, etc. New materials will
  2397. * be created if necessary, and reused from a cache.
  2398. * @param {Object3D} mesh Mesh, Line, or Points instance.
  2399. */
  2400. assignFinalMaterial(n) {
  2401. const r = n.geometry;
  2402. let s = n.material;
  2403. const a = r.attributes.tangent === void 0, c = r.attributes.color !== void 0, p = r.attributes.normal === void 0;
  2404. if (n.isPoints) {
  2405. const h = "PointsMaterial:" + s.uuid;
  2406. let d = this.cache.get(h);
  2407. 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(h, d)), s = d;
  2408. } else if (n.isLine) {
  2409. const h = "LineBasicMaterial:" + s.uuid;
  2410. let d = this.cache.get(h);
  2411. d || (d = new LineBasicMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), this.cache.add(h, d)), s = d;
  2412. }
  2413. if (a || c || p) {
  2414. let h = "ClonedMaterial:" + s.uuid + ":";
  2415. s.isGLTFSpecularGlossinessMaterial && (h += "specular-glossiness:"), a && (h += "derivative-tangents:"), c && (h += "vertex-colors:"), p && (h += "flat-shading:");
  2416. let d = this.cache.get(h);
  2417. d || (d = s.clone(), c && (d.vertexColors = true), p && (d.flatShading = true), a && (d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(h, d), this.associations.set(d, this.associations.get(s))), s = d;
  2418. }
  2419. s.aoMap && r.attributes.uv2 === void 0 && r.attributes.uv !== void 0 && r.setAttribute("uv2", r.attributes.uv), n.material = s;
  2420. }
  2421. getMaterialType() {
  2422. return MeshStandardMaterial;
  2423. }
  2424. /**
  2425. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
  2426. * @param {number} materialIndex
  2427. * @return {Promise<Material>}
  2428. */
  2429. loadMaterial(n) {
  2430. const r = this, s = this.json, a = this.extensions, c = s.materials[n];
  2431. let p;
  2432. const h = {}, d = c.extensions || {}, g = [];
  2433. if (d[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
  2434. const _ = a[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
  2435. p = _.getMaterialType(), g.push(_.extendParams(h, c, r));
  2436. } else if (d[re.KHR_MATERIALS_UNLIT]) {
  2437. const _ = a[re.KHR_MATERIALS_UNLIT];
  2438. p = _.getMaterialType(), g.push(_.extendParams(h, c, r));
  2439. } else {
  2440. const _ = c.pbrMetallicRoughness || {};
  2441. if (h.color = new Color(1, 1, 1), h.opacity = 1, Array.isArray(_.baseColorFactor)) {
  2442. const y = _.baseColorFactor;
  2443. h.color.fromArray(y), h.opacity = y[3];
  2444. }
  2445. _.baseColorTexture !== void 0 && g.push(r.assignTexture(h, "map", _.baseColorTexture, sRGBEncoding)), h.metalness = _.metallicFactor !== void 0 ? _.metallicFactor : 1, h.roughness = _.roughnessFactor !== void 0 ? _.roughnessFactor : 1, _.metallicRoughnessTexture !== void 0 && (g.push(r.assignTexture(h, "metalnessMap", _.metallicRoughnessTexture)), g.push(r.assignTexture(h, "roughnessMap", _.metallicRoughnessTexture))), p = this._invokeOne(function(y) {
  2446. return y.getMaterialType && y.getMaterialType(n);
  2447. }), g.push(Promise.all(this._invokeAll(function(y) {
  2448. return y.extendMaterialParams && y.extendMaterialParams(n, h);
  2449. })));
  2450. }
  2451. c.doubleSided === true && (h.side = DoubleSide);
  2452. const w = c.alphaMode || io.OPAQUE;
  2453. if (w === io.BLEND ? (h.transparent = true, h.depthWrite = false) : (h.transparent = false, w === io.MASK && (h.alphaTest = c.alphaCutoff !== void 0 ? c.alphaCutoff : 0.5)), c.normalTexture !== void 0 && p !== MeshBasicMaterial && (g.push(r.assignTexture(h, "normalMap", c.normalTexture)), h.normalScale = new Vector2(1, 1), c.normalTexture.scale !== void 0)) {
  2454. const _ = c.normalTexture.scale;
  2455. h.normalScale.set(_, _);
  2456. }
  2457. return c.occlusionTexture !== void 0 && p !== MeshBasicMaterial && (g.push(r.assignTexture(h, "aoMap", c.occlusionTexture)), c.occlusionTexture.strength !== void 0 && (h.aoMapIntensity = c.occlusionTexture.strength)), c.emissiveFactor !== void 0 && p !== MeshBasicMaterial && (h.emissive = new Color().fromArray(c.emissiveFactor)), c.emissiveTexture !== void 0 && p !== MeshBasicMaterial && g.push(r.assignTexture(h, "emissiveMap", c.emissiveTexture, sRGBEncoding)), Promise.all(g).then(function() {
  2458. let _;
  2459. return p === fo ? _ = a[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(h) : _ = new p(h), c.name && (_.name = c.name), Dn(_, c), r.associations.set(_, {
  2460. materials: n
  2461. }), c.extensions && $i(a, _, c), _;
  2462. });
  2463. }
  2464. /** When Object3D instances are targeted by animation, they need unique names. */
  2465. createUniqueName(n) {
  2466. const r = PropertyBinding.sanitizeNodeName(n || "");
  2467. let s = r;
  2468. for (let a = 1; this.nodeNamesUsed[s]; ++a)
  2469. s = r + "_" + a;
  2470. return this.nodeNamesUsed[s] = true, s;
  2471. }
  2472. /**
  2473. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
  2474. *
  2475. * Creates BufferGeometries from primitives.
  2476. *
  2477. * @param {Array<GLTF.Primitive>} primitives
  2478. * @return {Promise<Array<BufferGeometry>>}
  2479. */
  2480. loadGeometries(n) {
  2481. const r = this, s = this.extensions, a = this.primitiveCache;
  2482. function c(h) {
  2483. return s[re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h, r).then(function(d) {
  2484. return ba(d, h, r);
  2485. });
  2486. }
  2487. const p = [];
  2488. for (let h = 0, d = n.length; h < d; h++) {
  2489. const g = n[h], w = jp(g), _ = a[w];
  2490. if (_)
  2491. p.push(_.promise);
  2492. else {
  2493. let y;
  2494. g.extensions && g.extensions[re.KHR_DRACO_MESH_COMPRESSION] ? y = c(g) : y = ba(new BufferGeometry(), g, r), a[w] = {
  2495. primitive: g,
  2496. promise: y
  2497. }, p.push(y);
  2498. }
  2499. }
  2500. return Promise.all(p);
  2501. }
  2502. /**
  2503. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
  2504. * @param {number} meshIndex
  2505. * @return {Promise<Group|Mesh|SkinnedMesh>}
  2506. */
  2507. loadMesh(n) {
  2508. const r = this, s = this.json, a = this.extensions, c = s.meshes[n], p = c.primitives, h = [];
  2509. for (let d = 0, g = p.length; d < g; d++) {
  2510. const w = p[d].material === void 0 ? Np(this.cache) : this.getDependency("material", p[d].material);
  2511. h.push(w);
  2512. }
  2513. return h.push(r.loadGeometries(p)), Promise.all(h).then(function(d) {
  2514. const g = d.slice(0, d.length - 1), w = d[d.length - 1], _ = [];
  2515. for (let P = 0, I2 = w.length; P < I2; P++) {
  2516. const S = w[P], R = p[P];
  2517. let j;
  2518. const F = g[P];
  2519. if (R.mode === Bt.TRIANGLES || R.mode === Bt.TRIANGLE_STRIP || R.mode === Bt.TRIANGLE_FAN || R.mode === void 0)
  2520. j = c.isSkinnedMesh === true ? new SkinnedMesh(S, F) : new Mesh(S, F), j.isSkinnedMesh === true && !j.geometry.attributes.skinWeight.normalized && j.normalizeSkinWeights(), R.mode === Bt.TRIANGLE_STRIP ? j.geometry = ga(j.geometry, TriangleStripDrawMode) : R.mode === Bt.TRIANGLE_FAN && (j.geometry = ga(j.geometry, TriangleFanDrawMode));
  2521. else if (R.mode === Bt.LINES)
  2522. j = new LineSegments(S, F);
  2523. else if (R.mode === Bt.LINE_STRIP)
  2524. j = new Line(S, F);
  2525. else if (R.mode === Bt.LINE_LOOP)
  2526. j = new LineLoop(S, F);
  2527. else if (R.mode === Bt.POINTS)
  2528. j = new Points(S, F);
  2529. else
  2530. throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + R.mode);
  2531. Object.keys(j.geometry.morphAttributes).length > 0 && Bp(j, c), j.name = r.createUniqueName(c.name || "mesh_" + n), Dn(j, c), R.extensions && $i(a, j, R), r.assignFinalMaterial(j), _.push(j);
  2532. }
  2533. for (let P = 0, I2 = _.length; P < I2; P++)
  2534. r.associations.set(_[P], {
  2535. meshes: n,
  2536. primitives: P
  2537. });
  2538. if (_.length === 1)
  2539. return _[0];
  2540. const y = new Group();
  2541. r.associations.set(y, {
  2542. meshes: n
  2543. });
  2544. for (let P = 0, I2 = _.length; P < I2; P++)
  2545. y.add(_[P]);
  2546. return y;
  2547. });
  2548. }
  2549. /**
  2550. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
  2551. * @param {number} cameraIndex
  2552. * @return {Promise<THREE.Camera>}
  2553. */
  2554. loadCamera(n) {
  2555. let r;
  2556. const s = this.json.cameras[n], a = s[s.type];
  2557. if (!a) {
  2558. console.warn("THREE.GLTFLoader: Missing camera parameters.");
  2559. return;
  2560. }
  2561. 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)), Dn(r, s), Promise.resolve(r);
  2562. }
  2563. /**
  2564. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
  2565. * @param {number} skinIndex
  2566. * @return {Promise<Object>}
  2567. */
  2568. loadSkin(n) {
  2569. const r = this.json.skins[n], s = {
  2570. joints: r.joints
  2571. };
  2572. return r.inverseBindMatrices === void 0 ? Promise.resolve(s) : this.getDependency("accessor", r.inverseBindMatrices).then(function(a) {
  2573. return s.inverseBindMatrices = a, s;
  2574. });
  2575. }
  2576. /**
  2577. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
  2578. * @param {number} animationIndex
  2579. * @return {Promise<AnimationClip>}
  2580. */
  2581. loadAnimation(n) {
  2582. const s = this.json.animations[n], a = [], c = [], p = [], h = [], d = [];
  2583. for (let g = 0, w = s.channels.length; g < w; g++) {
  2584. const _ = s.channels[g], y = s.samplers[_.sampler], P = _.target, I2 = P.node, S = s.parameters !== void 0 ? s.parameters[y.input] : y.input, R = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
  2585. a.push(this.getDependency("node", I2)), c.push(this.getDependency("accessor", S)), p.push(this.getDependency("accessor", R)), h.push(y), d.push(P);
  2586. }
  2587. return Promise.all([Promise.all(a), Promise.all(c), Promise.all(p), Promise.all(h), Promise.all(d)]).then(function(g) {
  2588. const w = g[0], _ = g[1], y = g[2], P = g[3], I2 = g[4], S = [];
  2589. for (let j = 0, F = w.length; j < F; j++) {
  2590. const V = w[j], D2 = _[j], Y = y[j], G = P[j], N = I2[j];
  2591. if (V === void 0)
  2592. continue;
  2593. V.updateMatrix();
  2594. let O;
  2595. switch (rn[N.path]) {
  2596. case rn.weights:
  2597. O = NumberKeyframeTrack;
  2598. break;
  2599. case rn.rotation:
  2600. O = QuaternionKeyframeTrack;
  2601. break;
  2602. case rn.position:
  2603. case rn.scale:
  2604. default:
  2605. O = VectorKeyframeTrack;
  2606. break;
  2607. }
  2608. const H = V.name ? V.name : V.uuid, K = G.interpolation !== void 0 ? Op[G.interpolation] : InterpolateLinear, q = [];
  2609. rn[N.path] === rn.weights ? V.traverse(function(ge) {
  2610. ge.morphTargetInfluences && q.push(ge.name ? ge.name : ge.uuid);
  2611. }) : q.push(H);
  2612. let pe = Y.array;
  2613. if (Y.normalized) {
  2614. const ge = bo(pe.constructor), ce = new Float32Array(pe.length);
  2615. for (let me = 0, he = pe.length; me < he; me++)
  2616. ce[me] = pe[me] * ge;
  2617. pe = ce;
  2618. }
  2619. for (let ge = 0, ce = q.length; ge < ce; ge++) {
  2620. const me = new O(q[ge] + "." + rn[N.path], D2.array, pe, K);
  2621. G.interpolation === "CUBICSPLINE" && (me.createInterpolant = function(ee) {
  2622. const X = this instanceof QuaternionKeyframeTrack ? Dp : Wa;
  2623. return new X(this.times, this.values, this.getValueSize() / 3, ee);
  2624. }, me.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true), S.push(me);
  2625. }
  2626. }
  2627. const R = s.name ? s.name : "animation_" + n;
  2628. return new AnimationClip(R, void 0, S);
  2629. });
  2630. }
  2631. createNodeMesh(n) {
  2632. const r = this.json, s = this, a = r.nodes[n];
  2633. return a.mesh === void 0 ? null : s.getDependency("mesh", a.mesh).then(function(c) {
  2634. const p = s._getNodeRef(s.meshCache, a.mesh, c);
  2635. return a.weights !== void 0 && p.traverse(function(h) {
  2636. if (h.isMesh)
  2637. for (let d = 0, g = a.weights.length; d < g; d++)
  2638. h.morphTargetInfluences[d] = a.weights[d];
  2639. }), p;
  2640. });
  2641. }
  2642. /**
  2643. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
  2644. * @param {number} nodeIndex
  2645. * @return {Promise<Object3D>}
  2646. */
  2647. loadNode(n) {
  2648. const r = this.json, s = this.extensions, a = this, c = r.nodes[n], p = c.name ? a.createUniqueName(c.name) : "";
  2649. return function() {
  2650. const h = [], d = a._invokeOne(function(g) {
  2651. return g.createNodeMesh && g.createNodeMesh(n);
  2652. });
  2653. return d && h.push(d), c.camera !== void 0 && h.push(a.getDependency("camera", c.camera).then(function(g) {
  2654. return a._getNodeRef(a.cameraCache, c.camera, g);
  2655. })), a._invokeAll(function(g) {
  2656. return g.createNodeAttachment && g.createNodeAttachment(n);
  2657. }).forEach(function(g) {
  2658. h.push(g);
  2659. }), Promise.all(h);
  2660. }().then(function(h) {
  2661. let d;
  2662. if (c.isBone === true ? d = new Bone() : h.length > 1 ? d = new Group() : h.length === 1 ? d = h[0] : d = new Object3D(), d !== h[0])
  2663. for (let g = 0, w = h.length; g < w; g++)
  2664. d.add(h[g]);
  2665. if (c.name && (d.userData.name = c.name, d.name = p), Dn(d, c), c.extensions && $i(s, d, c), c.matrix !== void 0) {
  2666. const g = new Matrix4();
  2667. g.fromArray(c.matrix), d.applyMatrix4(g);
  2668. } else
  2669. 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);
  2670. return a.associations.has(d) || a.associations.set(d, {}), a.associations.get(d).nodes = n, d;
  2671. });
  2672. }
  2673. /**
  2674. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
  2675. * @param {number} sceneIndex
  2676. * @return {Promise<Group>}
  2677. */
  2678. loadScene(n) {
  2679. const r = this.json, s = this.extensions, a = this.json.scenes[n], c = this, p = new Group();
  2680. a.name && (p.name = c.createUniqueName(a.name)), Dn(p, a), a.extensions && $i(s, p, a);
  2681. const h = a.nodes || [], d = [];
  2682. for (let g = 0, w = h.length; g < w; g++)
  2683. d.push(Ja(h[g], p, r, c));
  2684. return Promise.all(d).then(function() {
  2685. const g = (w) => {
  2686. const _ = /* @__PURE__ */ new Map();
  2687. for (const [y, P] of c.associations)
  2688. (y instanceof Material || y instanceof Texture) && _.set(y, P);
  2689. return w.traverse((y) => {
  2690. const P = c.associations.get(y);
  2691. P != null && _.set(y, P);
  2692. }), _;
  2693. };
  2694. return c.associations = g(p), p;
  2695. });
  2696. }
  2697. };
  2698. function Ja(v, n, r, s) {
  2699. const a = r.nodes[v];
  2700. return s.getDependency("node", v).then(function(c) {
  2701. if (a.skin === void 0)
  2702. return c;
  2703. let p;
  2704. return s.getDependency("skin", a.skin).then(function(h) {
  2705. p = h;
  2706. const d = [];
  2707. for (let g = 0, w = p.joints.length; g < w; g++)
  2708. d.push(s.getDependency("node", p.joints[g]));
  2709. return Promise.all(d);
  2710. }).then(function(h) {
  2711. return c.traverse(function(d) {
  2712. if (!d.isMesh)
  2713. return;
  2714. const g = [], w = [];
  2715. for (let _ = 0, y = h.length; _ < y; _++) {
  2716. const P = h[_];
  2717. if (P) {
  2718. g.push(P);
  2719. const I2 = new Matrix4();
  2720. p.inverseBindMatrices !== void 0 && I2.fromArray(p.inverseBindMatrices.array, _ * 16), w.push(I2);
  2721. } else
  2722. console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', p.joints[_]);
  2723. }
  2724. d.bind(new Skeleton(g, w), d.matrixWorld);
  2725. }), c;
  2726. });
  2727. }).then(function(c) {
  2728. n.add(c);
  2729. const p = [];
  2730. if (a.children) {
  2731. const h = a.children;
  2732. for (let d = 0, g = h.length; d < g; d++) {
  2733. const w = h[d];
  2734. p.push(Ja(w, c, r, s));
  2735. }
  2736. }
  2737. return Promise.all(p);
  2738. });
  2739. }
  2740. function Gp(v, n, r) {
  2741. const s = n.attributes, a = new Box3();
  2742. if (s.POSITION !== void 0) {
  2743. const h = r.json.accessors[s.POSITION], d = h.min, g = h.max;
  2744. if (d !== void 0 && g !== void 0) {
  2745. if (a.set(new Vector3(d[0], d[1], d[2]), new Vector3(g[0], g[1], g[2])), h.normalized) {
  2746. const w = bo(es[h.componentType]);
  2747. a.min.multiplyScalar(w), a.max.multiplyScalar(w);
  2748. }
  2749. } else {
  2750. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  2751. return;
  2752. }
  2753. } else
  2754. return;
  2755. const c = n.targets;
  2756. if (c !== void 0) {
  2757. const h = new Vector3(), d = new Vector3();
  2758. for (let g = 0, w = c.length; g < w; g++) {
  2759. const _ = c[g];
  2760. if (_.POSITION !== void 0) {
  2761. const y = r.json.accessors[_.POSITION], P = y.min, I2 = y.max;
  2762. if (P !== void 0 && I2 !== void 0) {
  2763. if (d.setX(Math.max(Math.abs(P[0]), Math.abs(I2[0]))), d.setY(Math.max(Math.abs(P[1]), Math.abs(I2[1]))), d.setZ(Math.max(Math.abs(P[2]), Math.abs(I2[2]))), y.normalized) {
  2764. const S = bo(es[y.componentType]);
  2765. d.multiplyScalar(S);
  2766. }
  2767. h.max(d);
  2768. } else
  2769. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  2770. }
  2771. }
  2772. a.expandByVector(h);
  2773. }
  2774. v.boundingBox = a;
  2775. const p = new Sphere();
  2776. a.getCenter(p.center), p.radius = a.min.distanceTo(a.max) / 2, v.boundingSphere = p;
  2777. }
  2778. function ba(v, n, r) {
  2779. const s = n.attributes, a = [];
  2780. function c(p, h) {
  2781. return r.getDependency("accessor", p).then(function(d) {
  2782. v.setAttribute(h, d);
  2783. });
  2784. }
  2785. for (const p in s) {
  2786. const h = vo[p] || p.toLowerCase();
  2787. h in v.attributes || a.push(c(s[p], h));
  2788. }
  2789. if (n.indices !== void 0 && !v.index) {
  2790. const p = r.getDependency("accessor", n.indices).then(function(h) {
  2791. v.setIndex(h);
  2792. });
  2793. a.push(p);
  2794. }
  2795. return Dn(v, n), Gp(v, n, r), Promise.all(a).then(function() {
  2796. return n.targets !== void 0 ? Fp(v, n.targets, r) : v;
  2797. });
  2798. }
  2799. function ga(v, n) {
  2800. let r = v.getIndex();
  2801. if (r === null) {
  2802. const p = [], h = v.getAttribute("position");
  2803. if (h !== void 0) {
  2804. for (let d = 0; d < h.count; d++)
  2805. p.push(d);
  2806. v.setIndex(p), r = v.getIndex();
  2807. } else
  2808. return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), v;
  2809. }
  2810. const s = r.count - 2, a = [];
  2811. if (n === TriangleFanDrawMode)
  2812. for (let p = 1; p <= s; p++)
  2813. a.push(r.getX(0)), a.push(r.getX(p)), a.push(r.getX(p + 1));
  2814. else
  2815. for (let p = 0; p < s; p++)
  2816. p % 2 === 0 ? (a.push(r.getX(p)), a.push(r.getX(p + 1)), a.push(r.getX(p + 2))) : (a.push(r.getX(p + 2)), a.push(r.getX(p + 1)), a.push(r.getX(p)));
  2817. a.length / 3 !== s && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  2818. const c = v.clone();
  2819. return c.setIndex(a), c;
  2820. }
  2821. var Hp = class extends ExtrudeGeometry {
  2822. constructor(n, r = {}) {
  2823. const {
  2824. bevelEnabled: s = false,
  2825. bevelSize: a = 8,
  2826. bevelThickness: c = 10,
  2827. font: p,
  2828. height: h = 50,
  2829. size: d = 100,
  2830. lineHeight: g = 1,
  2831. letterSpacing: w = 0,
  2832. ..._
  2833. } = r;
  2834. if (p === void 0)
  2835. super();
  2836. else {
  2837. const y = p.generateShapes(n, d, {
  2838. lineHeight: g,
  2839. letterSpacing: w
  2840. });
  2841. super(y, {
  2842. ..._,
  2843. bevelEnabled: s,
  2844. bevelSize: a,
  2845. bevelThickness: c,
  2846. depth: h
  2847. });
  2848. }
  2849. this.type = "TextGeometry";
  2850. }
  2851. };
  2852. function el(v, n, r) {
  2853. const s = r.length - v - 1;
  2854. if (n >= r[s])
  2855. return s - 1;
  2856. if (n <= r[v])
  2857. return v;
  2858. let a = v, c = s, p = Math.floor((a + c) / 2);
  2859. for (; n < r[p] || n >= r[p + 1]; )
  2860. n < r[p] ? c = p : a = p, p = Math.floor((a + c) / 2);
  2861. return p;
  2862. }
  2863. function Kp(v, n, r, s) {
  2864. const a = [], c = [], p = [];
  2865. a[0] = 1;
  2866. for (let h = 1; h <= r; ++h) {
  2867. c[h] = n - s[v + 1 - h], p[h] = s[v + h] - n;
  2868. let d = 0;
  2869. for (let g = 0; g < h; ++g) {
  2870. const w = p[g + 1], _ = c[h - g], y = a[g] / (w + _);
  2871. a[g] = d + w * y, d = _ * y;
  2872. }
  2873. a[h] = d;
  2874. }
  2875. return a;
  2876. }
  2877. function $p(v, n, r, s) {
  2878. const a = el(v, s, n), c = Kp(a, s, v, n), p = new Vector4(0, 0, 0, 0);
  2879. for (let h = 0; h <= v; ++h) {
  2880. const d = r[a - v + h], g = c[h], w = d.w * g;
  2881. p.x += d.x * w, p.y += d.y * w, p.z += d.z * w, p.w += d.w * g;
  2882. }
  2883. return p;
  2884. }
  2885. function Xp(v, n, r, s, a) {
  2886. const c = [];
  2887. for (let y = 0; y <= r; ++y)
  2888. c[y] = 0;
  2889. const p = [];
  2890. for (let y = 0; y <= s; ++y)
  2891. p[y] = c.slice(0);
  2892. const h = [];
  2893. for (let y = 0; y <= r; ++y)
  2894. h[y] = c.slice(0);
  2895. h[0][0] = 1;
  2896. const d = c.slice(0), g = c.slice(0);
  2897. for (let y = 1; y <= r; ++y) {
  2898. d[y] = n - a[v + 1 - y], g[y] = a[v + y] - n;
  2899. let P = 0;
  2900. for (let I2 = 0; I2 < y; ++I2) {
  2901. const S = g[I2 + 1], R = d[y - I2];
  2902. h[y][I2] = S + R;
  2903. const j = h[I2][y - 1] / h[y][I2];
  2904. h[I2][y] = P + S * j, P = R * j;
  2905. }
  2906. h[y][y] = P;
  2907. }
  2908. for (let y = 0; y <= r; ++y)
  2909. p[0][y] = h[y][r];
  2910. for (let y = 0; y <= r; ++y) {
  2911. let P = 0, I2 = 1;
  2912. const S = [];
  2913. for (let R = 0; R <= r; ++R)
  2914. S[R] = c.slice(0);
  2915. S[0][0] = 1;
  2916. for (let R = 1; R <= s; ++R) {
  2917. let j = 0;
  2918. const F = y - R, V = r - R;
  2919. y >= R && (S[I2][0] = S[P][0] / h[V + 1][F], j = S[I2][0] * h[F][V]);
  2920. const D2 = F >= -1 ? 1 : -F, Y = y - 1 <= V ? R - 1 : r - y;
  2921. for (let G = D2; G <= Y; ++G)
  2922. S[I2][G] = (S[P][G] - S[P][G - 1]) / h[V + 1][F + G], j += S[I2][G] * h[F + G][V];
  2923. y <= V && (S[I2][R] = -S[P][R - 1] / h[V + 1][y], j += S[I2][R] * h[y][V]), p[R][y] = j;
  2924. var w = P;
  2925. P = I2, I2 = w;
  2926. }
  2927. }
  2928. var _ = r;
  2929. for (let y = 1; y <= s; ++y) {
  2930. for (let P = 0; P <= r; ++P)
  2931. p[y][P] *= _;
  2932. _ *= r - y;
  2933. }
  2934. return p;
  2935. }
  2936. function Yp(v, n, r, s, a) {
  2937. const c = a < v ? a : v, p = [], h = el(v, s, n), d = Xp(h, s, v, c, n), g = [];
  2938. for (let _ = 0; _ < r.length; ++_) {
  2939. var w = r[_].clone();
  2940. const y = w.w;
  2941. w.x *= y, w.y *= y, w.z *= y, g[_] = w;
  2942. }
  2943. for (let _ = 0; _ <= c; ++_) {
  2944. var w = g[h - v].clone().multiplyScalar(d[_][0]);
  2945. for (let P = 1; P <= v; ++P)
  2946. w.add(g[h - v + P].clone().multiplyScalar(d[_][P]));
  2947. p[_] = w;
  2948. }
  2949. for (let _ = c + 1; _ <= a + 1; ++_)
  2950. p[_] = new Vector4(0, 0, 0);
  2951. return p;
  2952. }
  2953. function qp(v, n) {
  2954. let r = 1;
  2955. for (let a = 2; a <= v; ++a)
  2956. r *= a;
  2957. let s = 1;
  2958. for (let a = 2; a <= n; ++a)
  2959. s *= a;
  2960. for (let a = 2; a <= v - n; ++a)
  2961. s *= a;
  2962. return r / s;
  2963. }
  2964. function Qp(v) {
  2965. const n = v.length, r = [], s = [];
  2966. for (let c = 0; c < n; ++c) {
  2967. const p = v[c];
  2968. r[c] = new Vector3(p.x, p.y, p.z), s[c] = p.w;
  2969. }
  2970. const a = [];
  2971. for (let c = 0; c < n; ++c) {
  2972. const p = r[c].clone();
  2973. for (let h = 1; h <= c; ++h)
  2974. p.sub(a[c - h].clone().multiplyScalar(qp(c, h) * s[h]));
  2975. a[c] = p.divideScalar(s[0]);
  2976. }
  2977. return a;
  2978. }
  2979. function Zp(v, n, r, s, a) {
  2980. const c = Yp(v, n, r, s, a);
  2981. return Qp(c);
  2982. }
  2983. var _a = class extends Curve {
  2984. constructor(n, r, s, a, c) {
  2985. super(), this.degree = n, this.knots = r, this.controlPoints = [], this.startKnot = a || 0, this.endKnot = c || this.knots.length - 1;
  2986. for (let p = 0; p < s.length; ++p) {
  2987. const h = s[p];
  2988. this.controlPoints[p] = new Vector4(h.x, h.y, h.z, h.w);
  2989. }
  2990. }
  2991. getPoint(n, r) {
  2992. const s = r || new Vector3(), a = this.knots[this.startKnot] + n * (this.knots[this.endKnot] - this.knots[this.startKnot]), c = $p(this.degree, this.knots, this.controlPoints, a);
  2993. return c.w != 1 && c.divideScalar(c.w), s.set(c.x, c.y, c.z);
  2994. }
  2995. getTangent(n, r) {
  2996. const s = r || new Vector3(), a = this.knots[0] + n * (this.knots[this.knots.length - 1] - this.knots[0]), c = Zp(this.degree, this.knots, this.controlPoints, a, 1);
  2997. return s.copy(c[1]).normalize(), s;
  2998. }
  2999. };
  3000. var se;
  3001. var Ae;
  3002. var Je;
  3003. var Wp = class extends Loader {
  3004. constructor(n) {
  3005. super(n);
  3006. }
  3007. load(n, r, s, a) {
  3008. const c = this, p = c.path === "" ? LoaderUtils.extractUrlBase(n) : c.path, h = new FileLoader(this.manager);
  3009. h.setPath(c.path), h.setResponseType("arraybuffer"), h.setRequestHeader(c.requestHeader), h.setWithCredentials(c.withCredentials), h.load(n, function(d) {
  3010. try {
  3011. r(c.parse(d, p));
  3012. } catch (g) {
  3013. a ? a(g) : console.error(g), c.manager.itemError(n);
  3014. }
  3015. }, s, a);
  3016. }
  3017. parse(n, r) {
  3018. if (sh(n))
  3019. se = new ih().parse(n);
  3020. else {
  3021. const a = sl(n);
  3022. if (!rh(a))
  3023. throw new Error("THREE.FBXLoader: Unknown format.");
  3024. if (ya(a) < 7e3)
  3025. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + ya(a));
  3026. se = new nh().parse(a);
  3027. }
  3028. const s = new TextureLoader(this.manager).setPath(this.resourcePath || r).setCrossOrigin(this.crossOrigin);
  3029. return new Jp(s, this.manager).parse(se);
  3030. }
  3031. };
  3032. var Jp = class {
  3033. constructor(n, r) {
  3034. this.textureLoader = n, this.manager = r;
  3035. }
  3036. parse() {
  3037. Ae = this.parseConnections();
  3038. const n = this.parseImages(), r = this.parseTextures(n), s = this.parseMaterials(r), a = this.parseDeformers(), c = new eh().parse(a);
  3039. return this.parseScene(a, c, s), Je;
  3040. }
  3041. // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
  3042. // and details the connection type
  3043. parseConnections() {
  3044. const n = /* @__PURE__ */ new Map();
  3045. return "Connections" in se && se.Connections.connections.forEach(function(s) {
  3046. const a = s[0], c = s[1], p = s[2];
  3047. n.has(a) || n.set(a, {
  3048. parents: [],
  3049. children: []
  3050. });
  3051. const h = {
  3052. ID: c,
  3053. relationship: p
  3054. };
  3055. n.get(a).parents.push(h), n.has(c) || n.set(c, {
  3056. parents: [],
  3057. children: []
  3058. });
  3059. const d = {
  3060. ID: a,
  3061. relationship: p
  3062. };
  3063. n.get(c).children.push(d);
  3064. }), n;
  3065. }
  3066. // Parse FBXTree.Objects.Video for embedded image data
  3067. // These images are connected to textures in FBXTree.Objects.Textures
  3068. // via FBXTree.Connections.
  3069. parseImages() {
  3070. const n = {}, r = {};
  3071. if ("Video" in se.Objects) {
  3072. const s = se.Objects.Video;
  3073. for (const a in s) {
  3074. const c = s[a], p = parseInt(a);
  3075. if (n[p] = c.RelativeFilename || c.Filename, "Content" in c) {
  3076. const h = c.Content instanceof ArrayBuffer && c.Content.byteLength > 0, d = typeof c.Content == "string" && c.Content !== "";
  3077. if (h || d) {
  3078. const g = this.parseImage(s[a]);
  3079. r[c.RelativeFilename || c.Filename] = g;
  3080. }
  3081. }
  3082. }
  3083. }
  3084. for (const s in n) {
  3085. const a = n[s];
  3086. r[a] !== void 0 ? n[s] = r[a] : n[s] = n[s].split("\\").pop();
  3087. }
  3088. return n;
  3089. }
  3090. // Parse embedded image data in FBXTree.Video.Content
  3091. parseImage(n) {
  3092. const r = n.Content, s = n.RelativeFilename || n.Filename, a = s.slice(s.lastIndexOf(".") + 1).toLowerCase();
  3093. let c;
  3094. switch (a) {
  3095. case "bmp":
  3096. c = "image/bmp";
  3097. break;
  3098. case "jpg":
  3099. case "jpeg":
  3100. c = "image/jpeg";
  3101. break;
  3102. case "png":
  3103. c = "image/png";
  3104. break;
  3105. case "tif":
  3106. c = "image/tiff";
  3107. break;
  3108. case "tga":
  3109. this.manager.getHandler(".tga") === null && console.warn("FBXLoader: TGA loader not found, skipping ", s), c = "image/tga";
  3110. break;
  3111. default:
  3112. console.warn('FBXLoader: Image type "' + a + '" is not supported.');
  3113. return;
  3114. }
  3115. if (typeof r == "string")
  3116. return "data:" + c + ";base64," + r;
  3117. {
  3118. const p = new Uint8Array(r);
  3119. return window.URL.createObjectURL(new Blob([p], {
  3120. type: c
  3121. }));
  3122. }
  3123. }
  3124. // Parse nodes in FBXTree.Objects.Texture
  3125. // These contain details such as UV scaling, cropping, rotation etc and are connected
  3126. // to images in FBXTree.Objects.Video
  3127. parseTextures(n) {
  3128. const r = /* @__PURE__ */ new Map();
  3129. if ("Texture" in se.Objects) {
  3130. const s = se.Objects.Texture;
  3131. for (const a in s) {
  3132. const c = this.parseTexture(s[a], n);
  3133. r.set(parseInt(a), c);
  3134. }
  3135. }
  3136. return r;
  3137. }
  3138. // Parse individual node in FBXTree.Objects.Texture
  3139. parseTexture(n, r) {
  3140. const s = this.loadTexture(n, r);
  3141. s.ID = n.id, s.name = n.attrName;
  3142. const a = n.WrapModeU, c = n.WrapModeV, p = a !== void 0 ? a.value : 0, h = c !== void 0 ? c.value : 0;
  3143. if (s.wrapS = p === 0 ? RepeatWrapping : ClampToEdgeWrapping, s.wrapT = h === 0 ? RepeatWrapping : ClampToEdgeWrapping, "Scaling" in n) {
  3144. const d = n.Scaling.value;
  3145. s.repeat.x = d[0], s.repeat.y = d[1];
  3146. }
  3147. return s;
  3148. }
  3149. // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
  3150. loadTexture(n, r) {
  3151. let s;
  3152. const a = this.textureLoader.path, c = Ae.get(n.id).children;
  3153. 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));
  3154. let p;
  3155. const h = n.FileName.slice(-3).toLowerCase();
  3156. if (h === "tga") {
  3157. const d = this.manager.getHandler(".tga");
  3158. d === null ? (console.warn("FBXLoader: TGA loader not found, creating placeholder texture for", n.RelativeFilename), p = new Texture()) : (d.setPath(this.textureLoader.path), p = d.load(s));
  3159. } else
  3160. h === "psd" ? (console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for", n.RelativeFilename), p = new Texture()) : p = this.textureLoader.load(s);
  3161. return this.textureLoader.setPath(a), p;
  3162. }
  3163. // Parse nodes in FBXTree.Objects.Material
  3164. parseMaterials(n) {
  3165. const r = /* @__PURE__ */ new Map();
  3166. if ("Material" in se.Objects) {
  3167. const s = se.Objects.Material;
  3168. for (const a in s) {
  3169. const c = this.parseMaterial(s[a], n);
  3170. c !== null && r.set(parseInt(a), c);
  3171. }
  3172. }
  3173. return r;
  3174. }
  3175. // Parse single node in FBXTree.Objects.Material
  3176. // Materials are connected to texture maps in FBXTree.Objects.Textures
  3177. // FBX format currently only supports Lambert and Phong shading models
  3178. parseMaterial(n, r) {
  3179. const s = n.id, a = n.attrName;
  3180. let c = n.ShadingModel;
  3181. if (typeof c == "object" && (c = c.value), !Ae.has(s))
  3182. return null;
  3183. const p = this.parseParameters(n, r, s);
  3184. let h;
  3185. switch (c.toLowerCase()) {
  3186. case "phong":
  3187. h = new MeshPhongMaterial();
  3188. break;
  3189. case "lambert":
  3190. h = new MeshLambertMaterial();
  3191. break;
  3192. default:
  3193. console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', c), h = new MeshPhongMaterial();
  3194. break;
  3195. }
  3196. return h.setValues(p), h.name = a, h;
  3197. }
  3198. // Parse FBX material and return parameters suitable for a three.js material
  3199. // Also parse the texture map and return any textures associated with the material
  3200. parseParameters(n, r, s) {
  3201. const a = {};
  3202. n.BumpFactor && (a.bumpScale = n.BumpFactor.value), n.Diffuse ? a.color = new Color().fromArray(n.Diffuse.value) : n.DiffuseColor && (n.DiffuseColor.type === "Color" || n.DiffuseColor.type === "ColorRGB") && (a.color = new Color().fromArray(n.DiffuseColor.value)), n.DisplacementFactor && (a.displacementScale = n.DisplacementFactor.value), n.Emissive ? a.emissive = new Color().fromArray(n.Emissive.value) : n.EmissiveColor && (n.EmissiveColor.type === "Color" || n.EmissiveColor.type === "ColorRGB") && (a.emissive = new Color().fromArray(n.EmissiveColor.value)), n.EmissiveFactor && (a.emissiveIntensity = parseFloat(n.EmissiveFactor.value)), n.Opacity && (a.opacity = parseFloat(n.Opacity.value)), a.opacity < 1 && (a.transparent = true), n.ReflectionFactor && (a.reflectivity = n.ReflectionFactor.value), n.Shininess && (a.shininess = n.Shininess.value), n.Specular ? a.specular = new Color().fromArray(n.Specular.value) : n.SpecularColor && n.SpecularColor.type === "Color" && (a.specular = new Color().fromArray(n.SpecularColor.value));
  3203. const c = this;
  3204. return Ae.get(s).children.forEach(function(p) {
  3205. const h = p.relationship;
  3206. switch (h) {
  3207. case "Bump":
  3208. a.bumpMap = c.getTexture(r, p.ID);
  3209. break;
  3210. case "Maya|TEX_ao_map":
  3211. a.aoMap = c.getTexture(r, p.ID);
  3212. break;
  3213. case "DiffuseColor":
  3214. case "Maya|TEX_color_map":
  3215. a.map = c.getTexture(r, p.ID), a.map !== void 0 && (a.map.encoding = sRGBEncoding);
  3216. break;
  3217. case "DisplacementColor":
  3218. a.displacementMap = c.getTexture(r, p.ID);
  3219. break;
  3220. case "EmissiveColor":
  3221. a.emissiveMap = c.getTexture(r, p.ID), a.emissiveMap !== void 0 && (a.emissiveMap.encoding = sRGBEncoding);
  3222. break;
  3223. case "NormalMap":
  3224. case "Maya|TEX_normal_map":
  3225. a.normalMap = c.getTexture(r, p.ID);
  3226. break;
  3227. case "ReflectionColor":
  3228. a.envMap = c.getTexture(r, p.ID), a.envMap !== void 0 && (a.envMap.mapping = EquirectangularReflectionMapping, a.envMap.encoding = sRGBEncoding);
  3229. break;
  3230. case "SpecularColor":
  3231. a.specularMap = c.getTexture(r, p.ID), a.specularMap !== void 0 && (a.specularMap.encoding = sRGBEncoding);
  3232. break;
  3233. case "TransparentColor":
  3234. case "TransparencyFactor":
  3235. a.alphaMap = c.getTexture(r, p.ID), a.transparent = true;
  3236. break;
  3237. case "AmbientColor":
  3238. case "ShininessExponent":
  3239. case "SpecularFactor":
  3240. case "VectorDisplacementColor":
  3241. default:
  3242. console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", h);
  3243. break;
  3244. }
  3245. }), a;
  3246. }
  3247. // get a texture from the textureMap for use by a material.
  3248. getTexture(n, r) {
  3249. return "LayeredTexture" in se.Objects && r in se.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), n.get(r);
  3250. }
  3251. // Parse nodes in FBXTree.Objects.Deformer
  3252. // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
  3253. // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
  3254. parseDeformers() {
  3255. const n = {}, r = {};
  3256. if ("Deformer" in se.Objects) {
  3257. const s = se.Objects.Deformer;
  3258. for (const a in s) {
  3259. const c = s[a], p = Ae.get(parseInt(a));
  3260. if (c.attrType === "Skin") {
  3261. const h = this.parseSkeleton(p, s);
  3262. h.ID = a, p.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), h.geometryID = p.parents[0].ID, n[a] = h;
  3263. } else if (c.attrType === "BlendShape") {
  3264. const h = {
  3265. id: a
  3266. };
  3267. h.rawTargets = this.parseMorphTargets(p, s), h.id = a, p.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), r[a] = h;
  3268. }
  3269. }
  3270. }
  3271. return {
  3272. skeletons: n,
  3273. morphTargets: r
  3274. };
  3275. }
  3276. // Parse single nodes in FBXTree.Objects.Deformer
  3277. // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
  3278. // Each skin node represents a skeleton and each cluster node represents a bone
  3279. parseSkeleton(n, r) {
  3280. const s = [];
  3281. return n.children.forEach(function(a) {
  3282. const c = r[a.ID];
  3283. if (c.attrType !== "Cluster")
  3284. return;
  3285. const p = {
  3286. ID: a.ID,
  3287. indices: [],
  3288. weights: [],
  3289. transformLink: new Matrix4().fromArray(c.TransformLink.a)
  3290. // transform: new Matrix4().fromArray( boneNode.Transform.a ),
  3291. // linkMode: boneNode.Mode,
  3292. };
  3293. "Indexes" in c && (p.indices = c.Indexes.a, p.weights = c.Weights.a), s.push(p);
  3294. }), {
  3295. rawBones: s,
  3296. bones: []
  3297. };
  3298. }
  3299. // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
  3300. parseMorphTargets(n, r) {
  3301. const s = [];
  3302. for (let a = 0; a < n.children.length; a++) {
  3303. const c = n.children[a], p = r[c.ID], h = {
  3304. name: p.attrName,
  3305. initialWeight: p.DeformPercent,
  3306. id: p.id,
  3307. fullWeights: p.FullWeights.a
  3308. };
  3309. if (p.attrType !== "BlendShapeChannel")
  3310. return;
  3311. h.geoID = Ae.get(parseInt(c.ID)).children.filter(function(d) {
  3312. return d.relationship === void 0;
  3313. })[0].ID, s.push(h);
  3314. }
  3315. return s;
  3316. }
  3317. // create the main Group() to be returned by the loader
  3318. parseScene(n, r, s) {
  3319. Je = new Group();
  3320. const a = this.parseModels(n.skeletons, r, s), c = se.Objects.Model, p = this;
  3321. a.forEach(function(d) {
  3322. const g = c[d.ID];
  3323. p.setLookAtProperties(d, g), Ae.get(d.ID).parents.forEach(function(_) {
  3324. const y = a.get(_.ID);
  3325. y !== void 0 && y.add(d);
  3326. }), d.parent === null && Je.add(d);
  3327. }), this.bindSkeleton(n.skeletons, r, a), this.createAmbientLight(), Je.traverse(function(d) {
  3328. if (d.userData.transformData) {
  3329. d.parent && (d.userData.transformData.parentMatrix = d.parent.matrix, d.userData.transformData.parentMatrixWorld = d.parent.matrixWorld);
  3330. const g = nl(d.userData.transformData);
  3331. d.applyMatrix4(g), d.updateWorldMatrix();
  3332. }
  3333. });
  3334. const h = new th().parse();
  3335. Je.children.length === 1 && Je.children[0].isGroup && (Je.children[0].animations = h, Je = Je.children[0]), Je.animations = h;
  3336. }
  3337. // parse nodes in FBXTree.Objects.Model
  3338. parseModels(n, r, s) {
  3339. const a = /* @__PURE__ */ new Map(), c = se.Objects.Model;
  3340. for (const p in c) {
  3341. const h = parseInt(p), d = c[p], g = Ae.get(h);
  3342. let w = this.buildSkeleton(g, n, h, d.attrName);
  3343. if (!w) {
  3344. switch (d.attrType) {
  3345. case "Camera":
  3346. w = this.createCamera(g);
  3347. break;
  3348. case "Light":
  3349. w = this.createLight(g);
  3350. break;
  3351. case "Mesh":
  3352. w = this.createMesh(g, r, s);
  3353. break;
  3354. case "NurbsCurve":
  3355. w = this.createCurve(g, r);
  3356. break;
  3357. case "LimbNode":
  3358. case "Root":
  3359. w = new Bone();
  3360. break;
  3361. case "Null":
  3362. default:
  3363. w = new Group();
  3364. break;
  3365. }
  3366. w.name = d.attrName ? PropertyBinding.sanitizeNodeName(d.attrName) : "", w.ID = h;
  3367. }
  3368. this.getTransformData(w, d), a.set(h, w);
  3369. }
  3370. return a;
  3371. }
  3372. buildSkeleton(n, r, s, a) {
  3373. let c = null;
  3374. return n.parents.forEach(function(p) {
  3375. for (const h in r) {
  3376. const d = r[h];
  3377. d.rawBones.forEach(function(g, w) {
  3378. if (g.ID === p.ID) {
  3379. const _ = c;
  3380. c = new Bone(), c.matrixWorld.copy(g.transformLink), c.name = a ? PropertyBinding.sanitizeNodeName(a) : "", c.ID = s, d.bones[w] = c, _ !== null && c.add(_);
  3381. }
  3382. });
  3383. }
  3384. }), c;
  3385. }
  3386. // create a PerspectiveCamera or OrthographicCamera
  3387. createCamera(n) {
  3388. let r, s;
  3389. if (n.children.forEach(function(a) {
  3390. const c = se.Objects.NodeAttribute[a.ID];
  3391. c !== void 0 && (s = c);
  3392. }), s === void 0)
  3393. r = new Object3D();
  3394. else {
  3395. let a = 0;
  3396. s.CameraProjectionType !== void 0 && s.CameraProjectionType.value === 1 && (a = 1);
  3397. let c = 1;
  3398. s.NearPlane !== void 0 && (c = s.NearPlane.value / 1e3);
  3399. let p = 1e3;
  3400. s.FarPlane !== void 0 && (p = s.FarPlane.value / 1e3);
  3401. let h = window.innerWidth, d = window.innerHeight;
  3402. s.AspectWidth !== void 0 && s.AspectHeight !== void 0 && (h = s.AspectWidth.value, d = s.AspectHeight.value);
  3403. const g = h / d;
  3404. let w = 45;
  3405. s.FieldOfView !== void 0 && (w = s.FieldOfView.value);
  3406. const _ = s.FocalLength ? s.FocalLength.value : null;
  3407. switch (a) {
  3408. case 0:
  3409. r = new PerspectiveCamera(w, g, c, p), _ !== null && r.setFocalLength(_);
  3410. break;
  3411. case 1:
  3412. r = new OrthographicCamera(-h / 2, h / 2, d / 2, -d / 2, c, p);
  3413. break;
  3414. default:
  3415. console.warn("THREE.FBXLoader: Unknown camera type " + a + "."), r = new Object3D();
  3416. break;
  3417. }
  3418. }
  3419. return r;
  3420. }
  3421. // Create a DirectionalLight, PointLight or SpotLight
  3422. createLight(n) {
  3423. let r, s;
  3424. if (n.children.forEach(function(a) {
  3425. const c = se.Objects.NodeAttribute[a.ID];
  3426. c !== void 0 && (s = c);
  3427. }), s === void 0)
  3428. r = new Object3D();
  3429. else {
  3430. let a;
  3431. s.LightType === void 0 ? a = 0 : a = s.LightType.value;
  3432. let c = 16777215;
  3433. s.Color !== void 0 && (c = new Color().fromArray(s.Color.value));
  3434. let p = s.Intensity === void 0 ? 1 : s.Intensity.value / 100;
  3435. s.CastLightOnObject !== void 0 && s.CastLightOnObject.value === 0 && (p = 0);
  3436. let h = 0;
  3437. s.FarAttenuationEnd !== void 0 && (s.EnableFarAttenuation !== void 0 && s.EnableFarAttenuation.value === 0 ? h = 0 : h = s.FarAttenuationEnd.value);
  3438. const d = 1;
  3439. switch (a) {
  3440. case 0:
  3441. r = new PointLight(c, p, h, d);
  3442. break;
  3443. case 1:
  3444. r = new DirectionalLight(c, p);
  3445. break;
  3446. case 2:
  3447. let g = Math.PI / 3;
  3448. s.InnerAngle !== void 0 && (g = MathUtils.degToRad(s.InnerAngle.value));
  3449. let w = 0;
  3450. s.OuterAngle !== void 0 && (w = MathUtils.degToRad(s.OuterAngle.value), w = Math.max(w, 1)), r = new SpotLight(c, p, h, g, w, d);
  3451. break;
  3452. default:
  3453. console.warn("THREE.FBXLoader: Unknown light type " + s.LightType.value + ", defaulting to a PointLight."), r = new PointLight(c, p);
  3454. break;
  3455. }
  3456. s.CastShadows !== void 0 && s.CastShadows.value === 1 && (r.castShadow = true);
  3457. }
  3458. return r;
  3459. }
  3460. createMesh(n, r, s) {
  3461. let a, c = null, p = null;
  3462. const h = [];
  3463. return n.children.forEach(function(d) {
  3464. r.has(d.ID) && (c = r.get(d.ID)), s.has(d.ID) && h.push(s.get(d.ID));
  3465. }), h.length > 1 ? p = h : h.length > 0 ? p = h[0] : (p = new MeshPhongMaterial({
  3466. color: 13421772
  3467. }), h.push(p)), "color" in c.attributes && h.forEach(function(d) {
  3468. d.vertexColors = true;
  3469. }), c.FBX_Deformer ? (a = new SkinnedMesh(c, p), a.normalizeSkinWeights()) : a = new Mesh(c, p), a;
  3470. }
  3471. createCurve(n, r) {
  3472. const s = n.children.reduce(function(c, p) {
  3473. return r.has(p.ID) && (c = r.get(p.ID)), c;
  3474. }, null), a = new LineBasicMaterial({
  3475. color: 3342591,
  3476. linewidth: 1
  3477. });
  3478. return new Line(s, a);
  3479. }
  3480. // parse the model node for transform data
  3481. getTransformData(n, r) {
  3482. const s = {};
  3483. "InheritType" in r && (s.inheritType = parseInt(r.InheritType.value)), "RotationOrder" in r ? s.eulerOrder = il(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), n.userData.transformData = s;
  3484. }
  3485. setLookAtProperties(n, r) {
  3486. "LookAtProperty" in r && Ae.get(n.ID).children.forEach(function(a) {
  3487. if (a.relationship === "LookAtProperty") {
  3488. const c = se.Objects.Model[a.ID];
  3489. if ("Lcl_Translation" in c) {
  3490. const p = c.Lcl_Translation.value;
  3491. n.target !== void 0 ? (n.target.position.fromArray(p), Je.add(n.target)) : n.lookAt(new Vector3().fromArray(p));
  3492. }
  3493. }
  3494. });
  3495. }
  3496. bindSkeleton(n, r, s) {
  3497. const a = this.parsePoseNodes();
  3498. for (const c in n) {
  3499. const p = n[c];
  3500. Ae.get(parseInt(p.ID)).parents.forEach(function(d) {
  3501. if (r.has(d.ID)) {
  3502. const g = d.ID;
  3503. Ae.get(g).parents.forEach(function(_) {
  3504. s.has(_.ID) && s.get(_.ID).bind(new Skeleton(p.bones), a[_.ID]);
  3505. });
  3506. }
  3507. });
  3508. }
  3509. }
  3510. parsePoseNodes() {
  3511. const n = {};
  3512. if ("Pose" in se.Objects) {
  3513. const r = se.Objects.Pose;
  3514. for (const s in r)
  3515. if (r[s].attrType === "BindPose" && r[s].NbPoseNodes > 0) {
  3516. const a = r[s].PoseNode;
  3517. Array.isArray(a) ? a.forEach(function(c) {
  3518. n[c.Node] = new Matrix4().fromArray(c.Matrix.a);
  3519. }) : n[a.Node] = new Matrix4().fromArray(a.Matrix.a);
  3520. }
  3521. }
  3522. return n;
  3523. }
  3524. // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
  3525. createAmbientLight() {
  3526. if ("GlobalSettings" in se && "AmbientColor" in se.GlobalSettings) {
  3527. const n = se.GlobalSettings.AmbientColor.value, r = n[0], s = n[1], a = n[2];
  3528. if (r !== 0 || s !== 0 || a !== 0) {
  3529. const c = new Color(r, s, a);
  3530. Je.add(new AmbientLight(c, 1));
  3531. }
  3532. }
  3533. }
  3534. };
  3535. var eh = class {
  3536. // Parse nodes in FBXTree.Objects.Geometry
  3537. parse(n) {
  3538. const r = /* @__PURE__ */ new Map();
  3539. if ("Geometry" in se.Objects) {
  3540. const s = se.Objects.Geometry;
  3541. for (const a in s) {
  3542. const c = Ae.get(parseInt(a)), p = this.parseGeometry(c, s[a], n);
  3543. r.set(parseInt(a), p);
  3544. }
  3545. }
  3546. return r;
  3547. }
  3548. // Parse single node in FBXTree.Objects.Geometry
  3549. parseGeometry(n, r, s) {
  3550. switch (r.attrType) {
  3551. case "Mesh":
  3552. return this.parseMeshGeometry(n, r, s);
  3553. case "NurbsCurve":
  3554. return this.parseNurbsGeometry(r);
  3555. }
  3556. }
  3557. // Parse single node mesh geometry in FBXTree.Objects.Geometry
  3558. parseMeshGeometry(n, r, s) {
  3559. const a = s.skeletons, c = [], p = n.parents.map(function(_) {
  3560. return se.Objects.Model[_.ID];
  3561. });
  3562. if (p.length === 0)
  3563. return;
  3564. const h = n.children.reduce(function(_, y) {
  3565. return a[y.ID] !== void 0 && (_ = a[y.ID]), _;
  3566. }, null);
  3567. n.children.forEach(function(_) {
  3568. s.morphTargets[_.ID] !== void 0 && c.push(s.morphTargets[_.ID]);
  3569. });
  3570. const d = p[0], g = {};
  3571. "RotationOrder" in d && (g.eulerOrder = il(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);
  3572. const w = nl(g);
  3573. return this.genGeometry(r, h, c, w);
  3574. }
  3575. // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
  3576. genGeometry(n, r, s, a) {
  3577. const c = new BufferGeometry();
  3578. n.attrName && (c.name = n.attrName);
  3579. const p = this.parseGeoNode(n, r), h = this.genBuffers(p), d = new Float32BufferAttribute(h.vertex, 3);
  3580. if (d.applyMatrix4(a), c.setAttribute("position", d), h.colors.length > 0 && c.setAttribute("color", new Float32BufferAttribute(h.colors, 3)), r && (c.setAttribute("skinIndex", new Uint16BufferAttribute(h.weightsIndices, 4)), c.setAttribute("skinWeight", new Float32BufferAttribute(h.vertexWeights, 4)), c.FBX_Deformer = r), h.normal.length > 0) {
  3581. const g = new Matrix3().getNormalMatrix(a), w = new Float32BufferAttribute(h.normal, 3);
  3582. w.applyNormalMatrix(g), c.setAttribute("normal", w);
  3583. }
  3584. if (h.uvs.forEach(function(g, w) {
  3585. let _ = "uv" + (w + 1).toString();
  3586. w === 0 && (_ = "uv"), c.setAttribute(_, new Float32BufferAttribute(h.uvs[w], 2));
  3587. }), p.material && p.material.mappingType !== "AllSame") {
  3588. let g = h.materialIndex[0], w = 0;
  3589. if (h.materialIndex.forEach(function(_, y) {
  3590. _ !== g && (c.addGroup(w, y - w, g), g = _, w = y);
  3591. }), c.groups.length > 0) {
  3592. const _ = c.groups[c.groups.length - 1], y = _.start + _.count;
  3593. y !== h.materialIndex.length && c.addGroup(y, h.materialIndex.length - y, g);
  3594. }
  3595. c.groups.length === 0 && c.addGroup(0, h.materialIndex.length, h.materialIndex[0]);
  3596. }
  3597. return this.addMorphTargets(c, n, s, a), c;
  3598. }
  3599. parseGeoNode(n, r) {
  3600. const s = {};
  3601. if (s.vertexPositions = n.Vertices !== void 0 ? n.Vertices.a : [], s.vertexIndices = n.PolygonVertexIndex !== void 0 ? n.PolygonVertexIndex.a : [], n.LayerElementColor && (s.color = this.parseVertexColors(n.LayerElementColor[0])), n.LayerElementMaterial && (s.material = this.parseMaterialIndices(n.LayerElementMaterial[0])), n.LayerElementNormal && (s.normal = this.parseNormals(n.LayerElementNormal[0])), n.LayerElementUV) {
  3602. s.uv = [];
  3603. let a = 0;
  3604. for (; n.LayerElementUV[a]; )
  3605. n.LayerElementUV[a].UV && s.uv.push(this.parseUVs(n.LayerElementUV[a])), a++;
  3606. }
  3607. return s.weightTable = {}, r !== null && (s.skeleton = r, r.rawBones.forEach(function(a, c) {
  3608. a.indices.forEach(function(p, h) {
  3609. s.weightTable[p] === void 0 && (s.weightTable[p] = []), s.weightTable[p].push({
  3610. id: c,
  3611. weight: a.weights[h]
  3612. });
  3613. });
  3614. })), s;
  3615. }
  3616. genBuffers(n) {
  3617. const r = {
  3618. vertex: [],
  3619. normal: [],
  3620. colors: [],
  3621. uvs: [],
  3622. materialIndex: [],
  3623. vertexWeights: [],
  3624. weightsIndices: []
  3625. };
  3626. let s = 0, a = 0, c = false, p = [], h = [], d = [], g = [], w = [], _ = [];
  3627. const y = this;
  3628. return n.vertexIndices.forEach(function(P, I2) {
  3629. let S, R = false;
  3630. P < 0 && (P = P ^ -1, R = true);
  3631. let j = [], F = [];
  3632. if (p.push(P * 3, P * 3 + 1, P * 3 + 2), n.color) {
  3633. const V = Os(I2, s, P, n.color);
  3634. d.push(V[0], V[1], V[2]);
  3635. }
  3636. if (n.skeleton) {
  3637. if (n.weightTable[P] !== void 0 && n.weightTable[P].forEach(function(V) {
  3638. F.push(V.weight), j.push(V.id);
  3639. }), F.length > 4) {
  3640. c || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), c = true);
  3641. const V = [0, 0, 0, 0], D2 = [0, 0, 0, 0];
  3642. F.forEach(function(Y, G) {
  3643. let N = Y, O = j[G];
  3644. D2.forEach(function(H, K, q) {
  3645. if (N > H) {
  3646. q[K] = N, N = H;
  3647. const pe = V[K];
  3648. V[K] = O, O = pe;
  3649. }
  3650. });
  3651. }), j = V, F = D2;
  3652. }
  3653. for (; F.length < 4; )
  3654. F.push(0), j.push(0);
  3655. for (let V = 0; V < 4; ++V)
  3656. w.push(F[V]), _.push(j[V]);
  3657. }
  3658. if (n.normal) {
  3659. const V = Os(I2, s, P, n.normal);
  3660. h.push(V[0], V[1], V[2]);
  3661. }
  3662. n.material && n.material.mappingType !== "AllSame" && (S = Os(I2, s, P, n.material)[0]), n.uv && n.uv.forEach(function(V, D2) {
  3663. const Y = Os(I2, s, P, V);
  3664. g[D2] === void 0 && (g[D2] = []), g[D2].push(Y[0]), g[D2].push(Y[1]);
  3665. }), a++, R && (y.genFace(r, n, p, S, h, d, g, w, _, a), s++, a = 0, p = [], h = [], d = [], g = [], w = [], _ = []);
  3666. }), r;
  3667. }
  3668. // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
  3669. genFace(n, r, s, a, c, p, h, d, g, w) {
  3670. for (let _ = 2; _ < w; _++)
  3671. n.vertex.push(r.vertexPositions[s[0]]), n.vertex.push(r.vertexPositions[s[1]]), n.vertex.push(r.vertexPositions[s[2]]), n.vertex.push(r.vertexPositions[s[(_ - 1) * 3]]), n.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 1]]), n.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 2]]), n.vertex.push(r.vertexPositions[s[_ * 3]]), n.vertex.push(r.vertexPositions[s[_ * 3 + 1]]), n.vertex.push(r.vertexPositions[s[_ * 3 + 2]]), r.skeleton && (n.vertexWeights.push(d[0]), n.vertexWeights.push(d[1]), n.vertexWeights.push(d[2]), n.vertexWeights.push(d[3]), n.vertexWeights.push(d[(_ - 1) * 4]), n.vertexWeights.push(d[(_ - 1) * 4 + 1]), n.vertexWeights.push(d[(_ - 1) * 4 + 2]), n.vertexWeights.push(d[(_ - 1) * 4 + 3]), n.vertexWeights.push(d[_ * 4]), n.vertexWeights.push(d[_ * 4 + 1]), n.vertexWeights.push(d[_ * 4 + 2]), n.vertexWeights.push(d[_ * 4 + 3]), n.weightsIndices.push(g[0]), n.weightsIndices.push(g[1]), n.weightsIndices.push(g[2]), n.weightsIndices.push(g[3]), n.weightsIndices.push(g[(_ - 1) * 4]), n.weightsIndices.push(g[(_ - 1) * 4 + 1]), n.weightsIndices.push(g[(_ - 1) * 4 + 2]), n.weightsIndices.push(g[(_ - 1) * 4 + 3]), n.weightsIndices.push(g[_ * 4]), n.weightsIndices.push(g[_ * 4 + 1]), n.weightsIndices.push(g[_ * 4 + 2]), n.weightsIndices.push(g[_ * 4 + 3])), r.color && (n.colors.push(p[0]), n.colors.push(p[1]), n.colors.push(p[2]), n.colors.push(p[(_ - 1) * 3]), n.colors.push(p[(_ - 1) * 3 + 1]), n.colors.push(p[(_ - 1) * 3 + 2]), n.colors.push(p[_ * 3]), n.colors.push(p[_ * 3 + 1]), n.colors.push(p[_ * 3 + 2])), r.material && r.material.mappingType !== "AllSame" && (n.materialIndex.push(a), n.materialIndex.push(a), n.materialIndex.push(a)), r.normal && (n.normal.push(c[0]), n.normal.push(c[1]), n.normal.push(c[2]), n.normal.push(c[(_ - 1) * 3]), n.normal.push(c[(_ - 1) * 3 + 1]), n.normal.push(c[(_ - 1) * 3 + 2]), n.normal.push(c[_ * 3]), n.normal.push(c[_ * 3 + 1]), n.normal.push(c[_ * 3 + 2])), r.uv && r.uv.forEach(function(y, P) {
  3672. n.uvs[P] === void 0 && (n.uvs[P] = []), n.uvs[P].push(h[P][0]), n.uvs[P].push(h[P][1]), n.uvs[P].push(h[P][(_ - 1) * 2]), n.uvs[P].push(h[P][(_ - 1) * 2 + 1]), n.uvs[P].push(h[P][_ * 2]), n.uvs[P].push(h[P][_ * 2 + 1]);
  3673. });
  3674. }
  3675. addMorphTargets(n, r, s, a) {
  3676. if (s.length === 0)
  3677. return;
  3678. n.morphTargetsRelative = true, n.morphAttributes.position = [];
  3679. const c = this;
  3680. s.forEach(function(p) {
  3681. p.rawTargets.forEach(function(h) {
  3682. const d = se.Objects.Geometry[h.geoID];
  3683. d !== void 0 && c.genMorphGeometry(n, r, d, a, h.name);
  3684. });
  3685. });
  3686. }
  3687. // a morph geometry node is similar to a standard node, and the node is also contained
  3688. // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
  3689. // and a special attribute Index defining which vertices of the original geometry are affected
  3690. // Normal and position attributes only have data for the vertices that are affected by the morph
  3691. genMorphGeometry(n, r, s, a, c) {
  3692. const p = r.PolygonVertexIndex !== void 0 ? r.PolygonVertexIndex.a : [], h = s.Vertices !== void 0 ? s.Vertices.a : [], d = s.Indexes !== void 0 ? s.Indexes.a : [], g = n.attributes.position.count * 3, w = new Float32Array(g);
  3693. for (let I2 = 0; I2 < d.length; I2++) {
  3694. const S = d[I2] * 3;
  3695. w[S] = h[I2 * 3], w[S + 1] = h[I2 * 3 + 1], w[S + 2] = h[I2 * 3 + 2];
  3696. }
  3697. const _ = {
  3698. vertexIndices: p,
  3699. vertexPositions: w
  3700. }, y = this.genBuffers(_), P = new Float32BufferAttribute(y.vertex, 3);
  3701. P.name = c || s.attrName, P.applyMatrix4(a), n.morphAttributes.position.push(P);
  3702. }
  3703. // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
  3704. parseNormals(n) {
  3705. const r = n.MappingInformationType, s = n.ReferenceInformationType, a = n.Normals.a;
  3706. let c = [];
  3707. return s === "IndexToDirect" && ("NormalIndex" in n ? c = n.NormalIndex.a : "NormalsIndex" in n && (c = n.NormalsIndex.a)), {
  3708. dataSize: 3,
  3709. buffer: a,
  3710. indices: c,
  3711. mappingType: r,
  3712. referenceType: s
  3713. };
  3714. }
  3715. // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
  3716. parseUVs(n) {
  3717. const r = n.MappingInformationType, s = n.ReferenceInformationType, a = n.UV.a;
  3718. let c = [];
  3719. return s === "IndexToDirect" && (c = n.UVIndex.a), {
  3720. dataSize: 2,
  3721. buffer: a,
  3722. indices: c,
  3723. mappingType: r,
  3724. referenceType: s
  3725. };
  3726. }
  3727. // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
  3728. parseVertexColors(n) {
  3729. const r = n.MappingInformationType, s = n.ReferenceInformationType, a = n.Colors.a;
  3730. let c = [];
  3731. return s === "IndexToDirect" && (c = n.ColorIndex.a), {
  3732. dataSize: 4,
  3733. buffer: a,
  3734. indices: c,
  3735. mappingType: r,
  3736. referenceType: s
  3737. };
  3738. }
  3739. // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
  3740. parseMaterialIndices(n) {
  3741. const r = n.MappingInformationType, s = n.ReferenceInformationType;
  3742. if (r === "NoMappingInformation")
  3743. return {
  3744. dataSize: 1,
  3745. buffer: [0],
  3746. indices: [0],
  3747. mappingType: "AllSame",
  3748. referenceType: s
  3749. };
  3750. const a = n.Materials.a, c = [];
  3751. for (let p = 0; p < a.length; ++p)
  3752. c.push(p);
  3753. return {
  3754. dataSize: 1,
  3755. buffer: a,
  3756. indices: c,
  3757. mappingType: r,
  3758. referenceType: s
  3759. };
  3760. }
  3761. // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
  3762. parseNurbsGeometry(n) {
  3763. if (_a === void 0)
  3764. 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();
  3765. const r = parseInt(n.Order);
  3766. if (isNaN(r))
  3767. return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", n.Order, n.id), new BufferGeometry();
  3768. const s = r - 1, a = n.KnotVector.a, c = [], p = n.Points.a;
  3769. for (let _ = 0, y = p.length; _ < y; _ += 4)
  3770. c.push(new Vector4().fromArray(p, _));
  3771. let h, d;
  3772. if (n.Form === "Closed")
  3773. c.push(c[0]);
  3774. else if (n.Form === "Periodic") {
  3775. h = s, d = a.length - 1 - h;
  3776. for (let _ = 0; _ < s; ++_)
  3777. c.push(c[_]);
  3778. }
  3779. const w = new _a(s, a, c, h, d).getPoints(c.length * 12);
  3780. return new BufferGeometry().setFromPoints(w);
  3781. }
  3782. };
  3783. var th = class {
  3784. // take raw animation clips and turn them into three.js animation clips
  3785. parse() {
  3786. const n = [], r = this.parseClips();
  3787. if (r !== void 0)
  3788. for (const s in r) {
  3789. const a = r[s], c = this.addClip(a);
  3790. n.push(c);
  3791. }
  3792. return n;
  3793. }
  3794. parseClips() {
  3795. if (se.Objects.AnimationCurve === void 0)
  3796. return;
  3797. const n = this.parseAnimationCurveNodes();
  3798. this.parseAnimationCurves(n);
  3799. const r = this.parseAnimationLayers(n);
  3800. return this.parseAnimStacks(r);
  3801. }
  3802. // parse nodes in FBXTree.Objects.AnimationCurveNode
  3803. // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
  3804. // and is referenced by an AnimationLayer
  3805. parseAnimationCurveNodes() {
  3806. const n = se.Objects.AnimationCurveNode, r = /* @__PURE__ */ new Map();
  3807. for (const s in n) {
  3808. const a = n[s];
  3809. if (a.attrName.match(/S|R|T|DeformPercent/) !== null) {
  3810. const c = {
  3811. id: a.id,
  3812. attr: a.attrName,
  3813. curves: {}
  3814. };
  3815. r.set(c.id, c);
  3816. }
  3817. }
  3818. return r;
  3819. }
  3820. // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
  3821. // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
  3822. // axis ( e.g. times and values of x rotation)
  3823. parseAnimationCurves(n) {
  3824. const r = se.Objects.AnimationCurve;
  3825. for (const s in r) {
  3826. const a = {
  3827. id: r[s].id,
  3828. times: r[s].KeyTime.a.map(oh),
  3829. values: r[s].KeyValueFloat.a
  3830. }, c = Ae.get(a.id);
  3831. if (c !== void 0) {
  3832. const p = c.parents[0].ID, h = c.parents[0].relationship;
  3833. h.match(/X/) ? n.get(p).curves.x = a : h.match(/Y/) ? n.get(p).curves.y = a : h.match(/Z/) ? n.get(p).curves.z = a : h.match(/d|DeformPercent/) && n.has(p) && (n.get(p).curves.morph = a);
  3834. }
  3835. }
  3836. }
  3837. // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
  3838. // to various AnimationCurveNodes and is referenced by an AnimationStack node
  3839. // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
  3840. parseAnimationLayers(n) {
  3841. const r = se.Objects.AnimationLayer, s = /* @__PURE__ */ new Map();
  3842. for (const a in r) {
  3843. const c = [], p = Ae.get(parseInt(a));
  3844. p !== void 0 && (p.children.forEach(function(d, g) {
  3845. if (n.has(d.ID)) {
  3846. const w = n.get(d.ID);
  3847. if (w.curves.x !== void 0 || w.curves.y !== void 0 || w.curves.z !== void 0) {
  3848. if (c[g] === void 0) {
  3849. const _ = Ae.get(d.ID).parents.filter(function(y) {
  3850. return y.relationship !== void 0;
  3851. })[0].ID;
  3852. if (_ !== void 0) {
  3853. const y = se.Objects.Model[_.toString()];
  3854. if (y === void 0) {
  3855. console.warn("THREE.FBXLoader: Encountered a unused curve.", d);
  3856. return;
  3857. }
  3858. const P = {
  3859. modelName: y.attrName ? PropertyBinding.sanitizeNodeName(y.attrName) : "",
  3860. ID: y.id,
  3861. initialPosition: [0, 0, 0],
  3862. initialRotation: [0, 0, 0],
  3863. initialScale: [1, 1, 1]
  3864. };
  3865. Je.traverse(function(I2) {
  3866. I2.ID === y.id && (P.transform = I2.matrix, I2.userData.transformData && (P.eulerOrder = I2.userData.transformData.eulerOrder));
  3867. }), P.transform || (P.transform = new Matrix4()), "PreRotation" in y && (P.preRotation = y.PreRotation.value), "PostRotation" in y && (P.postRotation = y.PostRotation.value), c[g] = P;
  3868. }
  3869. }
  3870. c[g] && (c[g][w.attr] = w);
  3871. } else if (w.curves.morph !== void 0) {
  3872. if (c[g] === void 0) {
  3873. const _ = Ae.get(d.ID).parents.filter(function(j) {
  3874. return j.relationship !== void 0;
  3875. })[0].ID, y = Ae.get(_).parents[0].ID, P = Ae.get(y).parents[0].ID, I2 = Ae.get(P).parents[0].ID, S = se.Objects.Model[I2], R = {
  3876. modelName: S.attrName ? PropertyBinding.sanitizeNodeName(S.attrName) : "",
  3877. morphName: se.Objects.Deformer[_].attrName
  3878. };
  3879. c[g] = R;
  3880. }
  3881. c[g][w.attr] = w;
  3882. }
  3883. }
  3884. }), s.set(parseInt(a), c));
  3885. }
  3886. return s;
  3887. }
  3888. // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
  3889. // hierarchy. Each Stack node will be used to create a AnimationClip
  3890. parseAnimStacks(n) {
  3891. const r = se.Objects.AnimationStack, s = {};
  3892. for (const a in r) {
  3893. const c = Ae.get(parseInt(a)).children;
  3894. c.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
  3895. const p = n.get(c[0].ID);
  3896. s[a] = {
  3897. name: r[a].attrName,
  3898. layer: p
  3899. };
  3900. }
  3901. return s;
  3902. }
  3903. addClip(n) {
  3904. let r = [];
  3905. const s = this;
  3906. return n.layer.forEach(function(a) {
  3907. r = r.concat(s.generateTracks(a));
  3908. }), new AnimationClip(n.name, -1, r);
  3909. }
  3910. generateTracks(n) {
  3911. const r = [];
  3912. let s = new Vector3(), a = new Quaternion(), c = new Vector3();
  3913. if (n.transform && n.transform.decompose(s, a, c), s = s.toArray(), a = new Euler().setFromQuaternion(a, n.eulerOrder).toArray(), c = c.toArray(), n.T !== void 0 && Object.keys(n.T.curves).length > 0) {
  3914. const p = this.generateVectorTrack(n.modelName, n.T.curves, s, "position");
  3915. p !== void 0 && r.push(p);
  3916. }
  3917. if (n.R !== void 0 && Object.keys(n.R.curves).length > 0) {
  3918. const p = this.generateRotationTrack(n.modelName, n.R.curves, a, n.preRotation, n.postRotation, n.eulerOrder);
  3919. p !== void 0 && r.push(p);
  3920. }
  3921. if (n.S !== void 0 && Object.keys(n.S.curves).length > 0) {
  3922. const p = this.generateVectorTrack(n.modelName, n.S.curves, c, "scale");
  3923. p !== void 0 && r.push(p);
  3924. }
  3925. if (n.DeformPercent !== void 0) {
  3926. const p = this.generateMorphTrack(n);
  3927. p !== void 0 && r.push(p);
  3928. }
  3929. return r;
  3930. }
  3931. generateVectorTrack(n, r, s, a) {
  3932. const c = this.getTimesForAllAxes(r), p = this.getKeyframeTrackValues(c, r, s);
  3933. return new VectorKeyframeTrack(n + "." + a, c, p);
  3934. }
  3935. generateRotationTrack(n, r, s, a, c, p) {
  3936. 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));
  3937. const h = this.getTimesForAllAxes(r), d = this.getKeyframeTrackValues(h, r, s);
  3938. a !== void 0 && (a = a.map(MathUtils.degToRad), a.push(p), a = new Euler().fromArray(a), a = new Quaternion().setFromEuler(a)), c !== void 0 && (c = c.map(MathUtils.degToRad), c.push(p), c = new Euler().fromArray(c), c = new Quaternion().setFromEuler(c).invert());
  3939. const g = new Quaternion(), w = new Euler(), _ = [];
  3940. for (let y = 0; y < d.length; y += 3)
  3941. w.set(d[y], d[y + 1], d[y + 2], p), g.setFromEuler(w), a !== void 0 && g.premultiply(a), c !== void 0 && g.multiply(c), g.toArray(_, y / 3 * 4);
  3942. return new QuaternionKeyframeTrack(n + ".quaternion", h, _);
  3943. }
  3944. generateMorphTrack(n) {
  3945. const r = n.DeformPercent.curves.morph, s = r.values.map(function(c) {
  3946. return c / 100;
  3947. }), a = Je.getObjectByName(n.modelName).morphTargetDictionary[n.morphName];
  3948. return new NumberKeyframeTrack(n.modelName + ".morphTargetInfluences[" + a + "]", r.times, s);
  3949. }
  3950. // For all animated objects, times are defined separately for each axis
  3951. // Here we'll combine the times into one sorted array without duplicates
  3952. getTimesForAllAxes(n) {
  3953. let r = [];
  3954. if (n.x !== void 0 && (r = r.concat(n.x.times)), n.y !== void 0 && (r = r.concat(n.y.times)), n.z !== void 0 && (r = r.concat(n.z.times)), r = r.sort(function(s, a) {
  3955. return s - a;
  3956. }), r.length > 1) {
  3957. let s = 1, a = r[0];
  3958. for (let c = 1; c < r.length; c++) {
  3959. const p = r[c];
  3960. p !== a && (r[s] = p, a = p, s++);
  3961. }
  3962. r = r.slice(0, s);
  3963. }
  3964. return r;
  3965. }
  3966. getKeyframeTrackValues(n, r, s) {
  3967. const a = s, c = [];
  3968. let p = -1, h = -1, d = -1;
  3969. return n.forEach(function(g) {
  3970. if (r.x && (p = r.x.times.indexOf(g)), r.y && (h = r.y.times.indexOf(g)), r.z && (d = r.z.times.indexOf(g)), p !== -1) {
  3971. const w = r.x.values[p];
  3972. c.push(w), a[0] = w;
  3973. } else
  3974. c.push(a[0]);
  3975. if (h !== -1) {
  3976. const w = r.y.values[h];
  3977. c.push(w), a[1] = w;
  3978. } else
  3979. c.push(a[1]);
  3980. if (d !== -1) {
  3981. const w = r.z.values[d];
  3982. c.push(w), a[2] = w;
  3983. } else
  3984. c.push(a[2]);
  3985. }), c;
  3986. }
  3987. // Rotations are defined as Euler angles which can have values of any size
  3988. // These will be converted to quaternions which don't support values greater than
  3989. // PI, so we'll interpolate large rotations
  3990. interpolateRotations(n) {
  3991. for (let r = 1; r < n.values.length; r++) {
  3992. const s = n.values[r - 1], a = n.values[r] - s, c = Math.abs(a);
  3993. if (c >= 180) {
  3994. const p = c / 180, h = a / p;
  3995. let d = s + h;
  3996. const g = n.times[r - 1], _ = (n.times[r] - g) / p;
  3997. let y = g + _;
  3998. const P = [], I2 = [];
  3999. for (; y < n.times[r]; )
  4000. P.push(y), y += _, I2.push(d), d += h;
  4001. n.times = xa(n.times, r, P), n.values = xa(n.values, r, I2);
  4002. }
  4003. }
  4004. }
  4005. };
  4006. var nh = class {
  4007. getPrevNode() {
  4008. return this.nodeStack[this.currentIndent - 2];
  4009. }
  4010. getCurrentNode() {
  4011. return this.nodeStack[this.currentIndent - 1];
  4012. }
  4013. getCurrentProp() {
  4014. return this.currentProp;
  4015. }
  4016. pushStack(n) {
  4017. this.nodeStack.push(n), this.currentIndent += 1;
  4018. }
  4019. popStack() {
  4020. this.nodeStack.pop(), this.currentIndent -= 1;
  4021. }
  4022. setCurrentProp(n, r) {
  4023. this.currentProp = n, this.currentPropName = r;
  4024. }
  4025. parse(n) {
  4026. this.currentIndent = 0, this.allNodes = new tl(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
  4027. const r = this, s = n.split(/[\r\n]+/);
  4028. return s.forEach(function(a, c) {
  4029. const p = a.match(/^[\s\t]*;/), h = a.match(/^[\s\t]*$/);
  4030. if (p || h)
  4031. return;
  4032. 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) + "}}");
  4033. d ? r.parseNodeBegin(a, d) : g ? r.parseNodeProperty(a, g, s[++c]) : w ? r.popStack() : a.match(/^[^\s\t}]/) && r.parseNodePropertyContinued(a);
  4034. }), this.allNodes;
  4035. }
  4036. parseNodeBegin(n, r) {
  4037. const s = r[1].trim().replace(/^"/, "").replace(/"$/, ""), a = r[2].split(",").map(function(d) {
  4038. return d.trim().replace(/^"/, "").replace(/"$/, "");
  4039. }), c = {
  4040. name: s
  4041. }, p = this.parseNodeAttr(a), h = this.getCurrentNode();
  4042. this.currentIndent === 0 ? this.allNodes.add(s, c) : s in h ? (s === "PoseNode" ? h.PoseNode.push(c) : h[s].id !== void 0 && (h[s] = {}, h[s][h[s].id] = h[s]), p.id !== "" && (h[s][p.id] = c)) : typeof p.id == "number" ? (h[s] = {}, h[s][p.id] = c) : s !== "Properties70" && (s === "PoseNode" ? h[s] = [c] : h[s] = c), typeof p.id == "number" && (c.id = p.id), p.name !== "" && (c.attrName = p.name), p.type !== "" && (c.attrType = p.type), this.pushStack(c);
  4043. }
  4044. parseNodeAttr(n) {
  4045. let r = n[0];
  4046. n[0] !== "" && (r = parseInt(n[0]), isNaN(r) && (r = n[0]));
  4047. let s = "", a = "";
  4048. return n.length > 1 && (s = n[1].replace(/^(\w+)::/, ""), a = n[2]), {
  4049. id: r,
  4050. name: s,
  4051. type: a
  4052. };
  4053. }
  4054. parseNodeProperty(n, r, s) {
  4055. let a = r[1].replace(/^"/, "").replace(/"$/, "").trim(), c = r[2].replace(/^"/, "").replace(/"$/, "").trim();
  4056. a === "Content" && c === "," && (c = s.replace(/"/g, "").replace(/,$/, "").trim());
  4057. const p = this.getCurrentNode();
  4058. if (p.name === "Properties70") {
  4059. this.parseNodeSpecialProperty(n, a, c);
  4060. return;
  4061. }
  4062. if (a === "C") {
  4063. const d = c.split(",").slice(1), g = parseInt(d[0]), w = parseInt(d[1]);
  4064. let _ = c.split(",").slice(3);
  4065. _ = _.map(function(y) {
  4066. return y.trim().replace(/^"/, "");
  4067. }), a = "connections", c = [g, w], lh(c, _), p[a] === void 0 && (p[a] = []);
  4068. }
  4069. a === "Node" && (p.id = c), a in p && Array.isArray(p[a]) ? p[a].push(c) : a !== "a" ? p[a] = c : p.a = c, this.setCurrentProp(p, a), a === "a" && c.slice(-1) !== "," && (p.a = ro(c));
  4070. }
  4071. parseNodePropertyContinued(n) {
  4072. const r = this.getCurrentNode();
  4073. r.a += n, n.slice(-1) !== "," && (r.a = ro(r.a));
  4074. }
  4075. // parse "Property70"
  4076. parseNodeSpecialProperty(n, r, s) {
  4077. const a = s.split('",').map(function(w) {
  4078. return w.trim().replace(/^\"/, "").replace(/\s/, "_");
  4079. }), c = a[0], p = a[1], h = a[2], d = a[3];
  4080. let g = a[4];
  4081. switch (p) {
  4082. case "int":
  4083. case "enum":
  4084. case "bool":
  4085. case "ULongLong":
  4086. case "double":
  4087. case "Number":
  4088. case "FieldOfView":
  4089. g = parseFloat(g);
  4090. break;
  4091. case "Color":
  4092. case "ColorRGB":
  4093. case "Vector3D":
  4094. case "Lcl_Translation":
  4095. case "Lcl_Rotation":
  4096. case "Lcl_Scaling":
  4097. g = ro(g);
  4098. break;
  4099. }
  4100. this.getPrevNode()[c] = {
  4101. type: p,
  4102. type2: h,
  4103. flag: d,
  4104. value: g
  4105. }, this.setCurrentProp(this.getPrevNode(), c);
  4106. }
  4107. };
  4108. var ih = class {
  4109. parse(n) {
  4110. const r = new wa(n);
  4111. r.skip(23);
  4112. const s = r.getUint32();
  4113. if (s < 6400)
  4114. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + s);
  4115. const a = new tl();
  4116. for (; !this.endOfContent(r); ) {
  4117. const c = this.parseNode(r, s);
  4118. c !== null && a.add(c.name, c);
  4119. }
  4120. return a;
  4121. }
  4122. // Check if reader has reached the end of content.
  4123. endOfContent(n) {
  4124. return n.size() % 16 === 0 ? (n.getOffset() + 160 + 16 & -16) >= n.size() : n.getOffset() + 160 + 16 >= n.size();
  4125. }
  4126. // recursively parse nodes until the end of the file is reached
  4127. parseNode(n, r) {
  4128. const s = {}, a = r >= 7500 ? n.getUint64() : n.getUint32(), c = r >= 7500 ? n.getUint64() : n.getUint32();
  4129. r >= 7500 ? n.getUint64() : n.getUint32();
  4130. const p = n.getUint8(), h = n.getString(p);
  4131. if (a === 0)
  4132. return null;
  4133. const d = [];
  4134. for (let y = 0; y < c; y++)
  4135. d.push(this.parseProperty(n));
  4136. const g = d.length > 0 ? d[0] : "", w = d.length > 1 ? d[1] : "", _ = d.length > 2 ? d[2] : "";
  4137. for (s.singleProperty = c === 1 && n.getOffset() === a; a > n.getOffset(); ) {
  4138. const y = this.parseNode(n, r);
  4139. y !== null && this.parseSubNode(h, s, y);
  4140. }
  4141. return s.propertyList = d, typeof g == "number" && (s.id = g), w !== "" && (s.attrName = w), _ !== "" && (s.attrType = _), h !== "" && (s.name = h), s;
  4142. }
  4143. parseSubNode(n, r, s) {
  4144. if (s.singleProperty === true) {
  4145. const a = s.propertyList[0];
  4146. Array.isArray(a) ? (r[s.name] = s, s.a = a) : r[s.name] = a;
  4147. } else if (n === "Connections" && s.name === "C") {
  4148. const a = [];
  4149. s.propertyList.forEach(function(c, p) {
  4150. p !== 0 && a.push(c);
  4151. }), r.connections === void 0 && (r.connections = []), r.connections.push(a);
  4152. } else if (s.name === "Properties70")
  4153. Object.keys(s).forEach(function(c) {
  4154. r[c] = s[c];
  4155. });
  4156. else if (n === "Properties70" && s.name === "P") {
  4157. let a = s.propertyList[0], c = s.propertyList[1];
  4158. const p = s.propertyList[2], h = s.propertyList[3];
  4159. let d;
  4160. 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] = {
  4161. type: c,
  4162. type2: p,
  4163. flag: h,
  4164. value: d
  4165. };
  4166. } else
  4167. 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);
  4168. }
  4169. parseProperty(n) {
  4170. const r = n.getString(1);
  4171. let s;
  4172. switch (r) {
  4173. case "C":
  4174. return n.getBoolean();
  4175. case "D":
  4176. return n.getFloat64();
  4177. case "F":
  4178. return n.getFloat32();
  4179. case "I":
  4180. return n.getInt32();
  4181. case "L":
  4182. return n.getInt64();
  4183. case "R":
  4184. return s = n.getUint32(), n.getArrayBuffer(s);
  4185. case "S":
  4186. return s = n.getUint32(), n.getString(s);
  4187. case "Y":
  4188. return n.getInt16();
  4189. case "b":
  4190. case "c":
  4191. case "d":
  4192. case "f":
  4193. case "i":
  4194. case "l":
  4195. const a = n.getUint32(), c = n.getUint32(), p = n.getUint32();
  4196. if (c === 0)
  4197. switch (r) {
  4198. case "b":
  4199. case "c":
  4200. return n.getBooleanArray(a);
  4201. case "d":
  4202. return n.getFloat64Array(a);
  4203. case "f":
  4204. return n.getFloat32Array(a);
  4205. case "i":
  4206. return n.getInt32Array(a);
  4207. case "l":
  4208. return n.getInt64Array(a);
  4209. }
  4210. const h = ip(new Uint8Array(n.getArrayBuffer(p))), d = new wa(h.buffer);
  4211. switch (r) {
  4212. case "b":
  4213. case "c":
  4214. return d.getBooleanArray(a);
  4215. case "d":
  4216. return d.getFloat64Array(a);
  4217. case "f":
  4218. return d.getFloat32Array(a);
  4219. case "i":
  4220. return d.getInt32Array(a);
  4221. case "l":
  4222. return d.getInt64Array(a);
  4223. }
  4224. default:
  4225. throw new Error("THREE.FBXLoader: Unknown property type " + r);
  4226. }
  4227. }
  4228. };
  4229. var wa = class {
  4230. constructor(n, r) {
  4231. this.dv = new DataView(n), this.offset = 0, this.littleEndian = r !== void 0 ? r : true;
  4232. }
  4233. getOffset() {
  4234. return this.offset;
  4235. }
  4236. size() {
  4237. return this.dv.buffer.byteLength;
  4238. }
  4239. skip(n) {
  4240. this.offset += n;
  4241. }
  4242. // seems like true/false representation depends on exporter.
  4243. // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
  4244. // then sees LSB.
  4245. getBoolean() {
  4246. return (this.getUint8() & 1) === 1;
  4247. }
  4248. getBooleanArray(n) {
  4249. const r = [];
  4250. for (let s = 0; s < n; s++)
  4251. r.push(this.getBoolean());
  4252. return r;
  4253. }
  4254. getUint8() {
  4255. const n = this.dv.getUint8(this.offset);
  4256. return this.offset += 1, n;
  4257. }
  4258. getInt16() {
  4259. const n = this.dv.getInt16(this.offset, this.littleEndian);
  4260. return this.offset += 2, n;
  4261. }
  4262. getInt32() {
  4263. const n = this.dv.getInt32(this.offset, this.littleEndian);
  4264. return this.offset += 4, n;
  4265. }
  4266. getInt32Array(n) {
  4267. const r = [];
  4268. for (let s = 0; s < n; s++)
  4269. r.push(this.getInt32());
  4270. return r;
  4271. }
  4272. getUint32() {
  4273. const n = this.dv.getUint32(this.offset, this.littleEndian);
  4274. return this.offset += 4, n;
  4275. }
  4276. // JavaScript doesn't support 64-bit integer so calculate this here
  4277. // 1 << 32 will return 1 so using multiply operation instead here.
  4278. // There's a possibility that this method returns wrong value if the value
  4279. // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
  4280. // TODO: safely handle 64-bit integer
  4281. getInt64() {
  4282. let n, r;
  4283. return this.littleEndian ? (n = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), n = this.getUint32()), r & 2147483648 ? (r = ~r & 4294967295, n = ~n & 4294967295, n === 4294967295 && (r = r + 1 & 4294967295), n = n + 1 & 4294967295, -(r * 4294967296 + n)) : r * 4294967296 + n;
  4284. }
  4285. getInt64Array(n) {
  4286. const r = [];
  4287. for (let s = 0; s < n; s++)
  4288. r.push(this.getInt64());
  4289. return r;
  4290. }
  4291. // Note: see getInt64() comment
  4292. getUint64() {
  4293. let n, r;
  4294. return this.littleEndian ? (n = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), n = this.getUint32()), r * 4294967296 + n;
  4295. }
  4296. getFloat32() {
  4297. const n = this.dv.getFloat32(this.offset, this.littleEndian);
  4298. return this.offset += 4, n;
  4299. }
  4300. getFloat32Array(n) {
  4301. const r = [];
  4302. for (let s = 0; s < n; s++)
  4303. r.push(this.getFloat32());
  4304. return r;
  4305. }
  4306. getFloat64() {
  4307. const n = this.dv.getFloat64(this.offset, this.littleEndian);
  4308. return this.offset += 8, n;
  4309. }
  4310. getFloat64Array(n) {
  4311. const r = [];
  4312. for (let s = 0; s < n; s++)
  4313. r.push(this.getFloat64());
  4314. return r;
  4315. }
  4316. getArrayBuffer(n) {
  4317. const r = this.dv.buffer.slice(this.offset, this.offset + n);
  4318. return this.offset += n, r;
  4319. }
  4320. getString(n) {
  4321. let r = [];
  4322. for (let a = 0; a < n; a++)
  4323. r[a] = this.getUint8();
  4324. const s = r.indexOf(0);
  4325. return s >= 0 && (r = r.slice(0, s)), LoaderUtils.decodeText(new Uint8Array(r));
  4326. }
  4327. };
  4328. var tl = class {
  4329. add(n, r) {
  4330. this[n] = r;
  4331. }
  4332. };
  4333. function sh(v) {
  4334. const n = "Kaydara FBX Binary \0";
  4335. return v.byteLength >= n.length && n === sl(v, 0, n.length);
  4336. }
  4337. function rh(v) {
  4338. const n = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
  4339. let r = 0;
  4340. function s(a) {
  4341. const c = v[a - 1];
  4342. return v = v.slice(r + a), r++, c;
  4343. }
  4344. for (let a = 0; a < n.length; ++a)
  4345. if (s(1) === n[a])
  4346. return false;
  4347. return true;
  4348. }
  4349. function ya(v) {
  4350. const n = /FBXVersion: (\d+)/, r = v.match(n);
  4351. if (r)
  4352. return parseInt(r[1]);
  4353. throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
  4354. }
  4355. function oh(v) {
  4356. return v / 46186158e3;
  4357. }
  4358. var ah = [];
  4359. function Os(v, n, r, s) {
  4360. let a;
  4361. switch (s.mappingType) {
  4362. case "ByPolygonVertex":
  4363. a = v;
  4364. break;
  4365. case "ByPolygon":
  4366. a = n;
  4367. break;
  4368. case "ByVertice":
  4369. a = r;
  4370. break;
  4371. case "AllSame":
  4372. a = s.indices[0];
  4373. break;
  4374. default:
  4375. console.warn("THREE.FBXLoader: unknown attribute mapping type " + s.mappingType);
  4376. }
  4377. s.referenceType === "IndexToDirect" && (a = s.indices[a]);
  4378. const c = a * s.dataSize, p = c + s.dataSize;
  4379. return ch(ah, s.buffer, c, p);
  4380. }
  4381. var so = new Euler();
  4382. var hi = new Vector3();
  4383. function nl(v) {
  4384. const n = new Matrix4(), r = new Matrix4(), s = new Matrix4(), a = new Matrix4(), c = new Matrix4(), p = new Matrix4(), h = new Matrix4(), d = new Matrix4(), g = new Matrix4(), w = new Matrix4(), _ = new Matrix4(), y = new Matrix4(), P = v.inheritType ? v.inheritType : 0;
  4385. if (v.translation && n.setPosition(hi.fromArray(v.translation)), v.preRotation) {
  4386. const K = v.preRotation.map(MathUtils.degToRad);
  4387. K.push(v.eulerOrder), r.makeRotationFromEuler(so.fromArray(K));
  4388. }
  4389. if (v.rotation) {
  4390. const K = v.rotation.map(MathUtils.degToRad);
  4391. K.push(v.eulerOrder), s.makeRotationFromEuler(so.fromArray(K));
  4392. }
  4393. if (v.postRotation) {
  4394. const K = v.postRotation.map(MathUtils.degToRad);
  4395. K.push(v.eulerOrder), a.makeRotationFromEuler(so.fromArray(K)), a.invert();
  4396. }
  4397. v.scale && c.scale(hi.fromArray(v.scale)), v.scalingOffset && h.setPosition(hi.fromArray(v.scalingOffset)), v.scalingPivot && p.setPosition(hi.fromArray(v.scalingPivot)), v.rotationOffset && d.setPosition(hi.fromArray(v.rotationOffset)), v.rotationPivot && g.setPosition(hi.fromArray(v.rotationPivot)), v.parentMatrixWorld && (_.copy(v.parentMatrix), w.copy(v.parentMatrixWorld));
  4398. const I2 = r.clone().multiply(s).multiply(a), S = new Matrix4();
  4399. S.extractRotation(w);
  4400. const R = new Matrix4();
  4401. R.copyPosition(w);
  4402. const j = R.clone().invert().multiply(w), F = S.clone().invert().multiply(j), V = c, D2 = new Matrix4();
  4403. if (P === 0)
  4404. D2.copy(S).multiply(I2).multiply(F).multiply(V);
  4405. else if (P === 1)
  4406. D2.copy(S).multiply(F).multiply(I2).multiply(V);
  4407. else {
  4408. const q = new Matrix4().scale(new Vector3().setFromMatrixScale(_)).clone().invert(), pe = F.clone().multiply(q);
  4409. D2.copy(S).multiply(I2).multiply(pe).multiply(V);
  4410. }
  4411. const Y = g.clone().invert(), G = p.clone().invert();
  4412. let N = n.clone().multiply(d).multiply(g).multiply(r).multiply(s).multiply(a).multiply(Y).multiply(h).multiply(p).multiply(c).multiply(G);
  4413. const O = new Matrix4().copyPosition(N), H = w.clone().multiply(O);
  4414. return y.copyPosition(H), N = y.clone().multiply(D2), N.premultiply(w.invert()), N;
  4415. }
  4416. function il(v) {
  4417. v = v || 0;
  4418. const n = [
  4419. "ZYX",
  4420. // -> XYZ extrinsic
  4421. "YZX",
  4422. // -> XZY extrinsic
  4423. "XZY",
  4424. // -> YZX extrinsic
  4425. "ZXY",
  4426. // -> YXZ extrinsic
  4427. "YXZ",
  4428. // -> ZXY extrinsic
  4429. "XYZ"
  4430. // -> ZYX extrinsic
  4431. //'SphericXYZ', // not possible to support
  4432. ];
  4433. return v === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), n[0]) : n[v];
  4434. }
  4435. function ro(v) {
  4436. return v.split(",").map(function(r) {
  4437. return parseFloat(r);
  4438. });
  4439. }
  4440. function sl(v, n, r) {
  4441. return n === void 0 && (n = 0), r === void 0 && (r = v.byteLength), LoaderUtils.decodeText(new Uint8Array(v, n, r));
  4442. }
  4443. function lh(v, n) {
  4444. for (let r = 0, s = v.length, a = n.length; r < a; r++, s++)
  4445. v[s] = n[r];
  4446. }
  4447. function ch(v, n, r, s) {
  4448. for (let a = r, c = 0; a < s; a++, c++)
  4449. v[c] = n[a];
  4450. return v;
  4451. }
  4452. function xa(v, n, r) {
  4453. return v.slice(0, n).concat(r).concat(v.slice(n));
  4454. }
  4455. var uh = class extends Loader {
  4456. constructor(n) {
  4457. super(n);
  4458. }
  4459. load(n, r, s, a) {
  4460. const c = new FileLoader(this.manager);
  4461. c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(n, (p) => {
  4462. if (typeof p != "string")
  4463. throw new Error("unsupported data type");
  4464. const h = JSON.parse(p), d = this.parse(h);
  4465. r && r(d);
  4466. }, s, a);
  4467. }
  4468. parse(n) {
  4469. return new xo(n);
  4470. }
  4471. };
  4472. var xo = class {
  4473. constructor(n) {
  4474. C(this, "data", void 0), this.data = n;
  4475. }
  4476. generateShapes(n, r = 100, s) {
  4477. const a = [], c = {
  4478. letterSpacing: 0,
  4479. lineHeight: 1,
  4480. ...s
  4481. }, p = ph(n, r, this.data, c);
  4482. for (let h = 0, d = p.length; h < d; h++)
  4483. Array.prototype.push.apply(a, p[h].toShapes(false));
  4484. return a;
  4485. }
  4486. };
  4487. C(xo, "isFont", void 0);
  4488. C(xo, "type", void 0);
  4489. function ph(v, n, r, s) {
  4490. const a = Array.from(v), c = n / r.resolution, p = (r.boundingBox.yMax - r.boundingBox.yMin + r.underlineThickness) * c, h = [];
  4491. let d = 0, g = 0;
  4492. for (let w = 0; w < a.length; w++) {
  4493. const _ = a[w];
  4494. if (_ === `
  4495. `)
  4496. d = 0, g -= p * s.lineHeight;
  4497. else {
  4498. const y = hh(_, c, d, g, r);
  4499. y && (d += y.offsetX + s.letterSpacing, h.push(y.path));
  4500. }
  4501. }
  4502. return h;
  4503. }
  4504. function hh(v, n, r, s, a) {
  4505. const c = a.glyphs[v] || a.glyphs["?"];
  4506. if (!c) {
  4507. console.error('THREE.Font: character "' + v + '" does not exists in font family ' + a.familyName + ".");
  4508. return;
  4509. }
  4510. const p = new ShapePath();
  4511. let h, d, g, w, _, y, P, I2;
  4512. if (c.o) {
  4513. const S = c._cachedOutline || (c._cachedOutline = c.o.split(" "));
  4514. for (let R = 0, j = S.length; R < j; )
  4515. switch (S[R++]) {
  4516. case "m":
  4517. h = parseInt(S[R++]) * n + r, d = parseInt(S[R++]) * n + s, p.moveTo(h, d);
  4518. break;
  4519. case "l":
  4520. h = parseInt(S[R++]) * n + r, d = parseInt(S[R++]) * n + s, p.lineTo(h, d);
  4521. break;
  4522. case "q":
  4523. g = parseInt(S[R++]) * n + r, w = parseInt(S[R++]) * n + s, _ = parseInt(S[R++]) * n + r, y = parseInt(S[R++]) * n + s, p.quadraticCurveTo(_, y, g, w);
  4524. break;
  4525. case "b":
  4526. g = parseInt(S[R++]) * n + r, w = parseInt(S[R++]) * n + s, _ = parseInt(S[R++]) * n + r, y = parseInt(S[R++]) * n + s, P = parseInt(S[R++]) * n + r, I2 = parseInt(S[R++]) * n + s, p.bezierCurveTo(_, y, P, I2, g, w);
  4527. break;
  4528. }
  4529. }
  4530. return {
  4531. offsetX: c.ha * n,
  4532. path: p
  4533. };
  4534. }
  4535. var rl = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  4536. function dh(v) {
  4537. return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
  4538. }
  4539. var mh = class extends DataTextureLoader {
  4540. constructor(n) {
  4541. super(n), this.type = HalfFloatType;
  4542. }
  4543. // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
  4544. parse(n) {
  4545. const h = function(V, D2) {
  4546. switch (V) {
  4547. case 1:
  4548. console.error("THREE.RGBELoader Read Error: " + (D2 || ""));
  4549. break;
  4550. case 2:
  4551. console.error("THREE.RGBELoader Write Error: " + (D2 || ""));
  4552. break;
  4553. case 3:
  4554. console.error("THREE.RGBELoader Bad File Format: " + (D2 || ""));
  4555. break;
  4556. default:
  4557. case 4:
  4558. console.error("THREE.RGBELoader: Error: " + (D2 || ""));
  4559. }
  4560. return -1;
  4561. }, _ = `
  4562. `, y = function(V, D2, Y) {
  4563. D2 = D2 || 1024;
  4564. let N = V.pos, O = -1, H = 0, K = "", q = String.fromCharCode.apply(null, new Uint16Array(V.subarray(N, N + 128)));
  4565. for (; 0 > (O = q.indexOf(_)) && H < D2 && N < V.byteLength; )
  4566. K += q, H += q.length, N += 128, q += String.fromCharCode.apply(null, new Uint16Array(V.subarray(N, N + 128)));
  4567. return -1 < O ? (Y !== false && (V.pos += H + O + 1), K + q.slice(0, O)) : false;
  4568. }, P = function(V) {
  4569. const D2 = /^#\?(\S+)/, Y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, G = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, O = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, H = {
  4570. valid: 0,
  4571. string: "",
  4572. comments: "",
  4573. programtype: "RGBE",
  4574. format: "",
  4575. gamma: 1,
  4576. exposure: 1,
  4577. width: 0,
  4578. height: 0
  4579. /* image dimensions, width/height */
  4580. };
  4581. let K, q;
  4582. if (V.pos >= V.byteLength || !(K = y(V)))
  4583. return h(1, "no header found");
  4584. if (!(q = K.match(D2)))
  4585. return h(3, "bad initial token");
  4586. for (H.valid |= 1, H.programtype = q[1], H.string += K + `
  4587. `; K = y(V), K !== false; ) {
  4588. if (H.string += K + `
  4589. `, K.charAt(0) === "#") {
  4590. H.comments += K + `
  4591. `;
  4592. continue;
  4593. }
  4594. if ((q = K.match(Y)) && (H.gamma = parseFloat(q[1])), (q = K.match(G)) && (H.exposure = parseFloat(q[1])), (q = K.match(N)) && (H.valid |= 2, H.format = q[1]), (q = K.match(O)) && (H.valid |= 4, H.height = parseInt(q[1], 10), H.width = parseInt(q[2], 10)), H.valid & 2 && H.valid & 4)
  4595. break;
  4596. }
  4597. return H.valid & 2 ? H.valid & 4 ? H : h(3, "missing image size specifier") : h(3, "missing format specifier");
  4598. }, I2 = function(V, D2, Y) {
  4599. const G = D2;
  4600. if (
  4601. // run length encoding is not allowed so read flat
  4602. G < 8 || G > 32767 || // this file is not run length encoded
  4603. V[0] !== 2 || V[1] !== 2 || V[2] & 128
  4604. )
  4605. return new Uint8Array(V);
  4606. if (G !== (V[2] << 8 | V[3]))
  4607. return h(3, "wrong scanline width");
  4608. const N = new Uint8Array(4 * D2 * Y);
  4609. if (!N.length)
  4610. return h(4, "unable to allocate buffer space");
  4611. let O = 0, H = 0;
  4612. const K = 4 * G, q = new Uint8Array(4), pe = new Uint8Array(K);
  4613. let ge = Y;
  4614. for (; ge > 0 && H < V.byteLength; ) {
  4615. if (H + 4 > V.byteLength)
  4616. return h(1);
  4617. if (q[0] = V[H++], q[1] = V[H++], q[2] = V[H++], q[3] = V[H++], q[0] != 2 || q[1] != 2 || (q[2] << 8 | q[3]) != G)
  4618. return h(3, "bad rgbe scanline format");
  4619. let ce = 0, me;
  4620. for (; ce < K && H < V.byteLength; ) {
  4621. me = V[H++];
  4622. const ee = me > 128;
  4623. if (ee && (me -= 128), me === 0 || ce + me > K)
  4624. return h(3, "bad scanline data");
  4625. if (ee) {
  4626. const X = V[H++];
  4627. for (let Pe = 0; Pe < me; Pe++)
  4628. pe[ce++] = X;
  4629. } else
  4630. pe.set(V.subarray(H, H + me), ce), ce += me, H += me;
  4631. }
  4632. const he = G;
  4633. for (let ee = 0; ee < he; ee++) {
  4634. let X = 0;
  4635. N[O] = pe[ee + X], X += G, N[O + 1] = pe[ee + X], X += G, N[O + 2] = pe[ee + X], X += G, N[O + 3] = pe[ee + X], O += 4;
  4636. }
  4637. ge--;
  4638. }
  4639. return N;
  4640. }, S = function(V, D2, Y, G) {
  4641. const N = V[D2 + 3], O = Math.pow(2, N - 128) / 255;
  4642. Y[G + 0] = V[D2 + 0] * O, Y[G + 1] = V[D2 + 1] * O, Y[G + 2] = V[D2 + 2] * O, Y[G + 3] = 1;
  4643. }, R = function(V, D2, Y, G) {
  4644. const N = V[D2 + 3], O = Math.pow(2, N - 128) / 255;
  4645. Y[G + 0] = DataUtils.toHalfFloat(Math.min(V[D2 + 0] * O, 65504)), Y[G + 1] = DataUtils.toHalfFloat(Math.min(V[D2 + 1] * O, 65504)), Y[G + 2] = DataUtils.toHalfFloat(Math.min(V[D2 + 2] * O, 65504)), Y[G + 3] = DataUtils.toHalfFloat(1);
  4646. }, j = new Uint8Array(n);
  4647. j.pos = 0;
  4648. const F = P(j);
  4649. if (F !== -1) {
  4650. const V = F.width, D2 = F.height, Y = I2(j.subarray(j.pos), V, D2);
  4651. if (Y !== -1) {
  4652. let G, N, O;
  4653. switch (this.type) {
  4654. case FloatType:
  4655. O = Y.length / 4;
  4656. const H = new Float32Array(O * 4);
  4657. for (let q = 0; q < O; q++)
  4658. S(Y, q * 4, H, q * 4);
  4659. G = H, N = FloatType;
  4660. break;
  4661. case HalfFloatType:
  4662. O = Y.length / 4;
  4663. const K = new Uint16Array(O * 4);
  4664. for (let q = 0; q < O; q++)
  4665. R(Y, q * 4, K, q * 4);
  4666. G = K, N = HalfFloatType;
  4667. break;
  4668. default:
  4669. console.error("THREE.RGBELoader: unsupported type: ", this.type);
  4670. break;
  4671. }
  4672. return {
  4673. width: V,
  4674. height: D2,
  4675. data: G,
  4676. header: F.string,
  4677. gamma: F.gamma,
  4678. exposure: F.exposure,
  4679. type: N
  4680. };
  4681. }
  4682. }
  4683. return null;
  4684. }
  4685. setDataType(n) {
  4686. return this.type = n, this;
  4687. }
  4688. load(n, r, s, a) {
  4689. function c(p, h) {
  4690. switch (p.type) {
  4691. case FloatType:
  4692. case HalfFloatType:
  4693. p.encoding = LinearEncoding, p.minFilter = LinearFilter, p.magFilter = LinearFilter, p.generateMipmaps = false, p.flipY = true;
  4694. break;
  4695. }
  4696. r && r(p, h);
  4697. }
  4698. return super.load(n, c, s, a);
  4699. }
  4700. };
  4701. var oo = /* @__PURE__ */ new WeakMap();
  4702. var fh = class extends Loader {
  4703. constructor(n) {
  4704. super(n), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
  4705. position: "POSITION",
  4706. normal: "NORMAL",
  4707. color: "COLOR",
  4708. uv: "TEX_COORD"
  4709. }, this.defaultAttributeTypes = {
  4710. position: "Float32Array",
  4711. normal: "Float32Array",
  4712. color: "Float32Array",
  4713. uv: "Float32Array"
  4714. };
  4715. }
  4716. setDecoderPath(n) {
  4717. return this.decoderPath = n, this;
  4718. }
  4719. setDecoderConfig(n) {
  4720. return this.decoderConfig = n, this;
  4721. }
  4722. setWorkerLimit(n) {
  4723. return this.workerLimit = n, this;
  4724. }
  4725. load(n, r, s, a) {
  4726. const c = new FileLoader(this.manager);
  4727. c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(n, (p) => {
  4728. const h = {
  4729. attributeIDs: this.defaultAttributeIDs,
  4730. attributeTypes: this.defaultAttributeTypes,
  4731. useUniqueIDs: false
  4732. };
  4733. this.decodeGeometry(p, h).then(r).catch(a);
  4734. }, s, a);
  4735. }
  4736. /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
  4737. decodeDracoFile(n, r, s, a) {
  4738. const c = {
  4739. attributeIDs: s || this.defaultAttributeIDs,
  4740. attributeTypes: a || this.defaultAttributeTypes,
  4741. useUniqueIDs: !!s
  4742. };
  4743. this.decodeGeometry(n, c).then(r);
  4744. }
  4745. decodeGeometry(n, r) {
  4746. for (const d in r.attributeTypes) {
  4747. const g = r.attributeTypes[d];
  4748. g.BYTES_PER_ELEMENT !== void 0 && (r.attributeTypes[d] = g.name);
  4749. }
  4750. const s = JSON.stringify(r);
  4751. if (oo.has(n)) {
  4752. const d = oo.get(n);
  4753. if (d.key === s)
  4754. return d.promise;
  4755. if (n.byteLength === 0)
  4756. throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
  4757. }
  4758. let a;
  4759. const c = this.workerNextTaskID++, p = n.byteLength, h = this._getWorker(c, p).then((d) => (a = d, new Promise((g, w) => {
  4760. a._callbacks[c] = {
  4761. resolve: g,
  4762. reject: w
  4763. }, a.postMessage({
  4764. type: "decode",
  4765. id: c,
  4766. taskConfig: r,
  4767. buffer: n
  4768. }, [n]);
  4769. }))).then((d) => this._createGeometry(d.geometry));
  4770. return h.catch(() => true).then(() => {
  4771. a && c && this._releaseTask(a, c);
  4772. }), oo.set(n, {
  4773. key: s,
  4774. promise: h
  4775. }), h;
  4776. }
  4777. _createGeometry(n) {
  4778. const r = new BufferGeometry();
  4779. n.index && r.setIndex(new BufferAttribute(n.index.array, 1));
  4780. for (let s = 0; s < n.attributes.length; s++) {
  4781. const a = n.attributes[s], c = a.name, p = a.array, h = a.itemSize;
  4782. r.setAttribute(c, new BufferAttribute(p, h));
  4783. }
  4784. return r;
  4785. }
  4786. _loadLibrary(n, r) {
  4787. const s = new FileLoader(this.manager);
  4788. return s.setPath(this.decoderPath), s.setResponseType(r), s.setWithCredentials(this.withCredentials), new Promise((a, c) => {
  4789. s.load(n, a, void 0, c);
  4790. });
  4791. }
  4792. preload() {
  4793. return this._initDecoder(), this;
  4794. }
  4795. _initDecoder() {
  4796. if (this.decoderPending)
  4797. return this.decoderPending;
  4798. const n = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
  4799. return n ? 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) => {
  4800. const a = s[0];
  4801. n || (this.decoderConfig.wasmBinary = s[1]);
  4802. const c = vh.toString(), p = ["/* draco decoder */", a, "", "/* worker */", c.substring(c.indexOf("{") + 1, c.lastIndexOf("}"))].join(`
  4803. `);
  4804. this.workerSourceURL = URL.createObjectURL(new Blob([p]));
  4805. }), this.decoderPending;
  4806. }
  4807. _getWorker(n, r) {
  4808. return this._initDecoder().then(() => {
  4809. if (this.workerPool.length < this.workerLimit) {
  4810. const a = new Worker(this.workerSourceURL);
  4811. a._callbacks = {}, a._taskCosts = {}, a._taskLoad = 0, a.postMessage({
  4812. type: "init",
  4813. decoderConfig: this.decoderConfig
  4814. }), a.onmessage = function(c) {
  4815. const p = c.data;
  4816. switch (p.type) {
  4817. case "decode":
  4818. a._callbacks[p.id].resolve(p);
  4819. break;
  4820. case "error":
  4821. a._callbacks[p.id].reject(p);
  4822. break;
  4823. default:
  4824. console.error('THREE.DRACOLoader: Unexpected message, "' + p.type + '"');
  4825. }
  4826. }, this.workerPool.push(a);
  4827. } else
  4828. this.workerPool.sort(function(a, c) {
  4829. return a._taskLoad > c._taskLoad ? -1 : 1;
  4830. });
  4831. const s = this.workerPool[this.workerPool.length - 1];
  4832. return s._taskCosts[n] = r, s._taskLoad += r, s;
  4833. });
  4834. }
  4835. _releaseTask(n, r) {
  4836. n._taskLoad -= n._taskCosts[r], delete n._callbacks[r], delete n._taskCosts[r];
  4837. }
  4838. debug() {
  4839. console.log("Task load: ", this.workerPool.map((n) => n._taskLoad));
  4840. }
  4841. dispose() {
  4842. for (let n = 0; n < this.workerPool.length; ++n)
  4843. this.workerPool[n].terminate();
  4844. return this.workerPool.length = 0, this;
  4845. }
  4846. };
  4847. function vh() {
  4848. let v, n;
  4849. onmessage = function(p) {
  4850. const h = p.data;
  4851. switch (h.type) {
  4852. case "init":
  4853. v = h.decoderConfig, n = new Promise(function(w) {
  4854. v.onModuleLoaded = function(_) {
  4855. w({
  4856. draco: _
  4857. });
  4858. }, DracoDecoderModule(v);
  4859. });
  4860. break;
  4861. case "decode":
  4862. const d = h.buffer, g = h.taskConfig;
  4863. n.then((w) => {
  4864. const _ = w.draco, y = new _.Decoder(), P = new _.DecoderBuffer();
  4865. P.Init(new Int8Array(d), d.byteLength);
  4866. try {
  4867. const I2 = r(_, y, P, g), S = I2.attributes.map((R) => R.array.buffer);
  4868. I2.index && S.push(I2.index.array.buffer), self.postMessage({
  4869. type: "decode",
  4870. id: h.id,
  4871. geometry: I2
  4872. }, S);
  4873. } catch (I2) {
  4874. console.error(I2), self.postMessage({
  4875. type: "error",
  4876. id: h.id,
  4877. error: I2.message
  4878. });
  4879. } finally {
  4880. _.destroy(P), _.destroy(y);
  4881. }
  4882. });
  4883. break;
  4884. }
  4885. };
  4886. function r(p, h, d, g) {
  4887. const w = g.attributeIDs, _ = g.attributeTypes;
  4888. let y, P;
  4889. const I2 = h.GetEncodedGeometryType(d);
  4890. if (I2 === p.TRIANGULAR_MESH)
  4891. y = new p.Mesh(), P = h.DecodeBufferToMesh(d, y);
  4892. else if (I2 === p.POINT_CLOUD)
  4893. y = new p.PointCloud(), P = h.DecodeBufferToPointCloud(d, y);
  4894. else
  4895. throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
  4896. if (!P.ok() || y.ptr === 0)
  4897. throw new Error("THREE.DRACOLoader: Decoding failed: " + P.error_msg());
  4898. const S = {
  4899. index: null,
  4900. attributes: []
  4901. };
  4902. for (const R in w) {
  4903. const j = self[_[R]];
  4904. let F, V;
  4905. if (g.useUniqueIDs)
  4906. V = w[R], F = h.GetAttributeByUniqueId(y, V);
  4907. else {
  4908. if (V = h.GetAttributeId(y, p[w[R]]), V === -1)
  4909. continue;
  4910. F = h.GetAttribute(y, V);
  4911. }
  4912. S.attributes.push(a(p, h, y, R, j, F));
  4913. }
  4914. return I2 === p.TRIANGULAR_MESH && (S.index = s(p, h, y)), p.destroy(y), S;
  4915. }
  4916. function s(p, h, d) {
  4917. const w = d.num_faces() * 3, _ = w * 4, y = p._malloc(_);
  4918. h.GetTrianglesUInt32Array(d, _, y);
  4919. const P = new Uint32Array(p.HEAPF32.buffer, y, w).slice();
  4920. return p._free(y), {
  4921. array: P,
  4922. itemSize: 1
  4923. };
  4924. }
  4925. function a(p, h, d, g, w, _) {
  4926. const y = _.num_components(), I2 = d.num_points() * y, S = I2 * w.BYTES_PER_ELEMENT, R = c(p, w), j = p._malloc(S);
  4927. h.GetAttributeDataArrayForAllPoints(d, _, R, S, j);
  4928. const F = new w(p.HEAPF32.buffer, j, I2).slice();
  4929. return p._free(j), {
  4930. name: g,
  4931. array: F,
  4932. itemSize: y
  4933. };
  4934. }
  4935. function c(p, h) {
  4936. switch (h) {
  4937. case Float32Array:
  4938. return p.DT_FLOAT32;
  4939. case Int8Array:
  4940. return p.DT_INT8;
  4941. case Int16Array:
  4942. return p.DT_INT16;
  4943. case Int32Array:
  4944. return p.DT_INT32;
  4945. case Uint8Array:
  4946. return p.DT_UINT8;
  4947. case Uint16Array:
  4948. return p.DT_UINT16;
  4949. case Uint32Array:
  4950. return p.DT_UINT32;
  4951. }
  4952. }
  4953. }
  4954. function Gt() {
  4955. const { state: v, setState: n } = inject("useTres", D()), r = inject("extend") || (() => {
  4956. });
  4957. return {
  4958. state: v,
  4959. setState: n,
  4960. extend: r
  4961. };
  4962. }
  4963. var bh = ["args"];
  4964. var Pd = defineComponent({
  4965. __name: "OrbitControls",
  4966. props: {
  4967. makeDefault: { type: Boolean, default: false },
  4968. camera: null,
  4969. domElement: null,
  4970. target: null,
  4971. enableDamping: { type: Boolean }
  4972. },
  4973. setup(v) {
  4974. const n = v, { state: r, setState: s, extend: a } = Gt(), c = ref(null);
  4975. return a({ OrbitControls: dp }), watch(c, (p) => {
  4976. p && n.makeDefault ? s("controls", p) : s("controls", null);
  4977. }), (p, h) => {
  4978. var d;
  4979. return unref(r).camera && unref(r).renderer ? (openBlock(), createElementBlock("TresOrbitControls", {
  4980. key: 0,
  4981. ref_key: "controls",
  4982. ref: c,
  4983. args: [unref(r).camera || v.camera, ((d = unref(r).renderer) == null ? void 0 : d.domElement) || v.domElement]
  4984. }, null, 8, bh)) : createCommentVNode("", true);
  4985. };
  4986. }
  4987. });
  4988. var Ea;
  4989. var ol = typeof window < "u";
  4990. var gh = (v) => typeof v == "string";
  4991. var _h = () => {
  4992. };
  4993. ol && ((Ea = window == null ? void 0 : window.navigator) != null && Ea.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  4994. function al(v) {
  4995. return typeof v == "function" ? v() : unref(v);
  4996. }
  4997. function wh(v) {
  4998. return v;
  4999. }
  5000. function yh(v) {
  5001. return getCurrentScope() ? (onScopeDispose(v), true) : false;
  5002. }
  5003. function xh(v, n = true) {
  5004. getCurrentInstance() ? onMounted(v) : n ? v() : nextTick(v);
  5005. }
  5006. function Eh(v) {
  5007. var n;
  5008. const r = al(v);
  5009. return (n = r == null ? void 0 : r.$el) != null ? n : r;
  5010. }
  5011. var Eo = ol ? window : void 0;
  5012. function an(...v) {
  5013. let n, r, s, a;
  5014. if (gh(v[0]) || Array.isArray(v[0]) ? ([r, s, a] = v, n = Eo) : [n, r, s, a] = v, !n)
  5015. return _h;
  5016. Array.isArray(r) || (r = [r]), Array.isArray(s) || (s = [s]);
  5017. const c = [], p = () => {
  5018. c.forEach((w) => w()), c.length = 0;
  5019. }, h = (w, _, y, P) => (w.addEventListener(_, y, P), () => w.removeEventListener(_, y, P)), d = watch(() => [Eh(n), al(a)], ([w, _]) => {
  5020. p(), w && c.push(...r.flatMap((y) => s.map((P) => h(w, y, P, _))));
  5021. }, { immediate: true, flush: "post" }), g = () => {
  5022. d(), p();
  5023. };
  5024. return yh(g), g;
  5025. }
  5026. var Ca = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  5027. var Pa = "__vueuse_ssr_handlers__";
  5028. Ca[Pa] = Ca[Pa] || {};
  5029. function Ch(v = {}) {
  5030. const {
  5031. type: n = "page",
  5032. touch: r = true,
  5033. resetOnTouchEnds: s = false,
  5034. initialValue: a = { x: 0, y: 0 },
  5035. window: c = Eo,
  5036. eventFilter: p
  5037. } = v, h = ref(a.x), d = ref(a.y), g = ref(null), w = (S) => {
  5038. n === "page" ? (h.value = S.pageX, d.value = S.pageY) : n === "client" ? (h.value = S.clientX, d.value = S.clientY) : n === "movement" && (h.value = S.movementX, d.value = S.movementY), g.value = "mouse";
  5039. }, _ = () => {
  5040. h.value = a.x, d.value = a.y;
  5041. }, y = (S) => {
  5042. if (S.touches.length > 0) {
  5043. const R = S.touches[0];
  5044. n === "page" ? (h.value = R.pageX, d.value = R.pageY) : n === "client" && (h.value = R.clientX, d.value = R.clientY), g.value = "touch";
  5045. }
  5046. }, P = (S) => p === void 0 ? w(S) : p(() => w(S), {}), I2 = (S) => p === void 0 ? y(S) : p(() => y(S), {});
  5047. return c && (an(c, "mousemove", P, { passive: true }), an(c, "dragover", P, { passive: true }), r && n !== "movement" && (an(c, "touchstart", I2, { passive: true }), an(c, "touchmove", I2, { passive: true }), s && an(c, "touchend", _, { passive: true }))), {
  5048. x: h,
  5049. y: d,
  5050. sourceType: g
  5051. };
  5052. }
  5053. var Ta;
  5054. (function(v) {
  5055. v.UP = "UP", v.RIGHT = "RIGHT", v.DOWN = "DOWN", v.LEFT = "LEFT", v.NONE = "NONE";
  5056. })(Ta || (Ta = {}));
  5057. var Ph = Object.defineProperty;
  5058. var ka = Object.getOwnPropertySymbols;
  5059. var Th = Object.prototype.hasOwnProperty;
  5060. var kh = Object.prototype.propertyIsEnumerable;
  5061. var Ma = (v, n, r) => n in v ? Ph(v, n, { enumerable: true, configurable: true, writable: true, value: r }) : v[n] = r;
  5062. var Mh = (v, n) => {
  5063. for (var r in n || (n = {}))
  5064. Th.call(n, r) && Ma(v, r, n[r]);
  5065. if (ka)
  5066. for (var r of ka(n))
  5067. kh.call(n, r) && Ma(v, r, n[r]);
  5068. return v;
  5069. };
  5070. var Sh = {
  5071. easeInSine: [0.12, 0, 0.39, 0],
  5072. easeOutSine: [0.61, 1, 0.88, 1],
  5073. easeInOutSine: [0.37, 0, 0.63, 1],
  5074. easeInQuad: [0.11, 0, 0.5, 0],
  5075. easeOutQuad: [0.5, 1, 0.89, 1],
  5076. easeInOutQuad: [0.45, 0, 0.55, 1],
  5077. easeInCubic: [0.32, 0, 0.67, 0],
  5078. easeOutCubic: [0.33, 1, 0.68, 1],
  5079. easeInOutCubic: [0.65, 0, 0.35, 1],
  5080. easeInQuart: [0.5, 0, 0.75, 0],
  5081. easeOutQuart: [0.25, 1, 0.5, 1],
  5082. easeInOutQuart: [0.76, 0, 0.24, 1],
  5083. easeInQuint: [0.64, 0, 0.78, 0],
  5084. easeOutQuint: [0.22, 1, 0.36, 1],
  5085. easeInOutQuint: [0.83, 0, 0.17, 1],
  5086. easeInExpo: [0.7, 0, 0.84, 0],
  5087. easeOutExpo: [0.16, 1, 0.3, 1],
  5088. easeInOutExpo: [0.87, 0, 0.13, 1],
  5089. easeInCirc: [0.55, 0, 1, 0.45],
  5090. easeOutCirc: [0, 0.55, 0.45, 1],
  5091. easeInOutCirc: [0.85, 0, 0.15, 1],
  5092. easeInBack: [0.36, 0, 0.66, -0.56],
  5093. easeOutBack: [0.34, 1.56, 0.64, 1],
  5094. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  5095. };
  5096. Mh({
  5097. linear: wh
  5098. }, Sh);
  5099. function Lh(v = {}) {
  5100. const {
  5101. window: n = Eo,
  5102. initialWidth: r = 1 / 0,
  5103. initialHeight: s = 1 / 0,
  5104. listenOrientation: a = true,
  5105. includeScrollbar: c = true
  5106. } = v, p = ref(r), h = ref(s), d = () => {
  5107. n && (c ? (p.value = n.innerWidth, h.value = n.innerHeight) : (p.value = n.document.documentElement.clientWidth, h.value = n.document.documentElement.clientHeight));
  5108. };
  5109. return d(), xh(d), an("resize", d, { passive: true }), a && an("orientationchange", d, { passive: true }), { width: p, height: h };
  5110. }
  5111. var Ah = ["args"];
  5112. var Td = defineComponent({
  5113. __name: "PointerLockControls",
  5114. props: {
  5115. makeDefault: { type: Boolean, default: false },
  5116. camera: null,
  5117. domElement: null,
  5118. selector: null
  5119. },
  5120. setup(v, { expose: n }) {
  5121. const r = v, { state: s, setState: a, extend: c } = Gt(), p = ref(null);
  5122. let h;
  5123. return c({ PointerLockControls: hp }), watch(p, (d) => {
  5124. var w;
  5125. d && r.makeDefault ? a("controls", d) : a("controls", null);
  5126. const g = document.getElementById(r.selector || "");
  5127. h = g || ((w = s.renderer) == null ? void 0 : w.domElement), an(h, "click", () => {
  5128. var _;
  5129. (_ = p.value) == null || _.lock();
  5130. });
  5131. }), n({
  5132. value: p
  5133. }), (d, g) => {
  5134. var w;
  5135. return unref(s).camera && unref(s).renderer ? (openBlock(), createElementBlock("TresPointerLockControls", {
  5136. key: 0,
  5137. ref_key: "controls",
  5138. ref: p,
  5139. args: [unref(s).camera || v.camera, ((w = unref(s).renderer) == null ? void 0 : w.domElement) || v.domElement]
  5140. }, null, 8, Ah)) : createCommentVNode("", true);
  5141. };
  5142. }
  5143. });
  5144. function Rh(v, n) {
  5145. const r = {};
  5146. for (const s of n)
  5147. Object.prototype.hasOwnProperty.call(v, s) && (r[s] = v[s]);
  5148. return r;
  5149. }
  5150. function Ih(v, n) {
  5151. const r = `set${n[0].toUpperCase()}${n.slice(1)}`;
  5152. return v[r] !== void 0;
  5153. }
  5154. var kd = defineComponent({
  5155. __name: "TransformControls",
  5156. props: {
  5157. object: null,
  5158. mode: null,
  5159. enabled: { type: Boolean, default: true },
  5160. axis: null,
  5161. translationSnap: null,
  5162. rotationSnap: null,
  5163. scaleSnap: null,
  5164. space: null,
  5165. size: null,
  5166. showX: { type: Boolean },
  5167. showY: { type: Boolean },
  5168. showZ: { type: Boolean }
  5169. },
  5170. emits: ["dragging", "change", "mouseDown", "mouseUp", "objectChange"],
  5171. setup(v, { emit: n }) {
  5172. const r = v;
  5173. let s = shallowRef();
  5174. const { state: a } = Gt(), c = computed(
  5175. () => Rh(r, [
  5176. "enabled",
  5177. "axis",
  5178. "mode",
  5179. "translationSnap",
  5180. "rotationSnap",
  5181. "scaleSnap",
  5182. "space",
  5183. "size",
  5184. "showX",
  5185. "showY",
  5186. "showZ"
  5187. ])
  5188. ), p = () => n("change", s.value), h = () => n("mouseDown", s.value), d = () => n("mouseUp", s.value), g = () => n("objectChange", s.value), w = (y) => {
  5189. a.controls && (a.controls.enabled = !y.value), n("dragging", y.value);
  5190. };
  5191. function _(y) {
  5192. y.addEventListener("dragging-changed", w), y.addEventListener("change", p), y.addEventListener("mouseDown", h), y.addEventListener("mouseUp", d), y.addEventListener("objectChange", g);
  5193. }
  5194. return watchEffect(() => {
  5195. a.camera && a.renderer && a.scene && r.object && (s.value = new op(a.camera, a.renderer.domElement), s.value.attach(r.object), a.scene.add(s.value), _(s.value));
  5196. }), watch(
  5197. [c, s],
  5198. // TODO: properly type this
  5199. ([y, P]) => {
  5200. if (y && P)
  5201. for (const I2 in y)
  5202. if (!Ih(P, I2))
  5203. P[I2] = y[I2];
  5204. else {
  5205. const S = `set${I2[0].toUpperCase()}${I2.slice(1)}`;
  5206. typeof P[S] == "function" && y[I2] !== void 0 && P[S](y[I2]);
  5207. }
  5208. },
  5209. {
  5210. immediate: true
  5211. }
  5212. ), onUnmounted(() => {
  5213. s.value && (s.value.removeEventListener("dragging-changed", w), s.value.removeEventListener("change", p), s.value.removeEventListener("mouseDown", h), s.value.removeEventListener("mouseUp", d), s.value.removeEventListener("objectChange", g));
  5214. }), (y, P) => renderSlot(y.$slots, "default");
  5215. }
  5216. });
  5217. function Vh(v = false, n = 5, r) {
  5218. const { x: s, y: a } = Ch(), { logWarning: c } = I(), { width: p, height: h } = Lh(), d = computed(() => (s.value / p.value - 0.5) * n), g = computed(() => -(a.value / h.value - 0.5) * n);
  5219. if (r) {
  5220. const { x: w, y: _ } = r.position;
  5221. watchEffect(() => {
  5222. v || r && (r.position.x = w + d.value, r.position.y = _ + g.value);
  5223. });
  5224. } else
  5225. c("Scene must contain a Camera component to use this composable");
  5226. }
  5227. var Md = defineComponent({
  5228. name: "PamCameraMouse",
  5229. props: ["disabled", "factor"],
  5230. setup(v) {
  5231. const { state: n } = Gt();
  5232. return watchEffect(() => {
  5233. if (n != null && n.camera) {
  5234. const r = n == null ? void 0 : n.camera;
  5235. Vh(v.disabled, v.factor, r);
  5236. }
  5237. }), () => {
  5238. };
  5239. }
  5240. });
  5241. var Gs = {};
  5242. var Dh = {
  5243. get exports() {
  5244. return Gs;
  5245. },
  5246. set exports(v) {
  5247. Gs = v;
  5248. }
  5249. };
  5250. (function(v, n) {
  5251. (function(r, s) {
  5252. s(n);
  5253. })(rl, function(r) {
  5254. class s {
  5255. /**
  5256. * @hidden
  5257. */
  5258. constructor(e) {
  5259. const [t, l] = e.split("-"), b = t.split(".");
  5260. this.major = parseInt(b[0], 10), this.minor = parseInt(b[1], 10), this.patch = parseInt(b[2], 10), this.prerelease = l ?? null;
  5261. }
  5262. toString() {
  5263. const e = [this.major, this.minor, this.patch].join(".");
  5264. return this.prerelease !== null ? [e, this.prerelease].join("-") : e;
  5265. }
  5266. }
  5267. class a {
  5268. constructor(e) {
  5269. this.controller_ = e;
  5270. }
  5271. get element() {
  5272. return this.controller_.view.element;
  5273. }
  5274. get disabled() {
  5275. return this.controller_.viewProps.get("disabled");
  5276. }
  5277. set disabled(e) {
  5278. this.controller_.viewProps.set("disabled", e);
  5279. }
  5280. get hidden() {
  5281. return this.controller_.viewProps.get("hidden");
  5282. }
  5283. set hidden(e) {
  5284. this.controller_.viewProps.set("hidden", e);
  5285. }
  5286. dispose() {
  5287. this.controller_.viewProps.set("disposed", true);
  5288. }
  5289. }
  5290. class c {
  5291. constructor(e) {
  5292. this.target = e;
  5293. }
  5294. }
  5295. class p extends c {
  5296. constructor(e, t, l, b) {
  5297. super(e), this.value = t, this.presetKey = l, this.last = b ?? true;
  5298. }
  5299. }
  5300. class h extends c {
  5301. constructor(e, t, l) {
  5302. super(e), this.value = t, this.presetKey = l;
  5303. }
  5304. }
  5305. class d extends c {
  5306. constructor(e, t) {
  5307. super(e), this.expanded = t;
  5308. }
  5309. }
  5310. class g extends c {
  5311. constructor(e, t) {
  5312. super(e), this.index = t;
  5313. }
  5314. }
  5315. function w(i) {
  5316. return i;
  5317. }
  5318. function _(i) {
  5319. return i == null;
  5320. }
  5321. function y(i, e) {
  5322. if (i.length !== e.length)
  5323. return false;
  5324. for (let t = 0; t < i.length; t++)
  5325. if (i[t] !== e[t])
  5326. return false;
  5327. return true;
  5328. }
  5329. function P(i, e) {
  5330. let t = i;
  5331. do {
  5332. const l = Object.getOwnPropertyDescriptor(t, e);
  5333. if (l && (l.set !== void 0 || l.writable === true))
  5334. return true;
  5335. t = Object.getPrototypeOf(t);
  5336. } while (t !== null);
  5337. return false;
  5338. }
  5339. const I2 = {
  5340. alreadydisposed: () => "View has been already disposed",
  5341. invalidparams: (i) => `Invalid parameters for '${i.name}'`,
  5342. nomatchingcontroller: (i) => `No matching controller for '${i.key}'`,
  5343. nomatchingview: (i) => `No matching view for '${JSON.stringify(i.params)}'`,
  5344. notbindable: () => "Value is not bindable",
  5345. propertynotfound: (i) => `Property '${i.name}' not found`,
  5346. shouldneverhappen: () => "This error should never happen"
  5347. };
  5348. class S {
  5349. static alreadyDisposed() {
  5350. return new S({ type: "alreadydisposed" });
  5351. }
  5352. static notBindable() {
  5353. return new S({
  5354. type: "notbindable"
  5355. });
  5356. }
  5357. static propertyNotFound(e) {
  5358. return new S({
  5359. type: "propertynotfound",
  5360. context: {
  5361. name: e
  5362. }
  5363. });
  5364. }
  5365. static shouldNeverHappen() {
  5366. return new S({ type: "shouldneverhappen" });
  5367. }
  5368. constructor(e) {
  5369. var t;
  5370. 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;
  5371. }
  5372. }
  5373. class R {
  5374. constructor(e, t, l) {
  5375. this.obj_ = e, this.key_ = t, this.presetKey_ = l ?? t;
  5376. }
  5377. static isBindable(e) {
  5378. return !(e === null || typeof e != "object");
  5379. }
  5380. get key() {
  5381. return this.key_;
  5382. }
  5383. get presetKey() {
  5384. return this.presetKey_;
  5385. }
  5386. read() {
  5387. return this.obj_[this.key_];
  5388. }
  5389. write(e) {
  5390. this.obj_[this.key_] = e;
  5391. }
  5392. writeProperty(e, t) {
  5393. const l = this.read();
  5394. if (!R.isBindable(l))
  5395. throw S.notBindable();
  5396. if (!(e in l))
  5397. throw S.propertyNotFound(e);
  5398. l[e] = t;
  5399. }
  5400. }
  5401. class j extends a {
  5402. get label() {
  5403. return this.controller_.props.get("label");
  5404. }
  5405. set label(e) {
  5406. this.controller_.props.set("label", e);
  5407. }
  5408. get title() {
  5409. var e;
  5410. return (e = this.controller_.valueController.props.get("title")) !== null && e !== void 0 ? e : "";
  5411. }
  5412. set title(e) {
  5413. this.controller_.valueController.props.set("title", e);
  5414. }
  5415. on(e, t) {
  5416. const l = t.bind(this);
  5417. return this.controller_.valueController.emitter.on(e, () => {
  5418. l(new c(this));
  5419. }), this;
  5420. }
  5421. }
  5422. class F {
  5423. constructor() {
  5424. this.observers_ = {};
  5425. }
  5426. on(e, t) {
  5427. let l = this.observers_[e];
  5428. return l || (l = this.observers_[e] = []), l.push({
  5429. handler: t
  5430. }), this;
  5431. }
  5432. off(e, t) {
  5433. const l = this.observers_[e];
  5434. return l && (this.observers_[e] = l.filter((b) => b.handler !== t)), this;
  5435. }
  5436. emit(e, t) {
  5437. const l = this.observers_[e];
  5438. l && l.forEach((b) => {
  5439. b.handler(t);
  5440. });
  5441. }
  5442. }
  5443. const V = "tp";
  5444. function D2(i) {
  5445. return (t, l) => [
  5446. V,
  5447. "-",
  5448. i,
  5449. "v",
  5450. t ? `_${t}` : "",
  5451. l ? `-${l}` : ""
  5452. ].join("");
  5453. }
  5454. function Y(i, e) {
  5455. return (t) => e(i(t));
  5456. }
  5457. function G(i) {
  5458. return i.rawValue;
  5459. }
  5460. function N(i, e) {
  5461. i.emitter.on("change", Y(G, e)), e(i.rawValue);
  5462. }
  5463. function O(i, e, t) {
  5464. N(i.value(e), t);
  5465. }
  5466. function H(i, e, t) {
  5467. t ? i.classList.add(e) : i.classList.remove(e);
  5468. }
  5469. function K(i, e) {
  5470. return (t) => {
  5471. H(i, e, t);
  5472. };
  5473. }
  5474. function q(i, e) {
  5475. N(i, (t) => {
  5476. e.textContent = t ?? "";
  5477. });
  5478. }
  5479. const pe = D2("btn");
  5480. class ge {
  5481. constructor(e, t) {
  5482. this.element = e.createElement("div"), this.element.classList.add(pe()), t.viewProps.bindClassModifiers(this.element);
  5483. const l = e.createElement("button");
  5484. l.classList.add(pe("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  5485. const b = e.createElement("div");
  5486. b.classList.add(pe("t")), q(t.props.value("title"), b), this.buttonElement.appendChild(b);
  5487. }
  5488. }
  5489. class ce {
  5490. constructor(e, t) {
  5491. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new ge(e, {
  5492. props: this.props,
  5493. viewProps: this.viewProps
  5494. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  5495. }
  5496. onClick_() {
  5497. this.emitter.emit("click", {
  5498. sender: this
  5499. });
  5500. }
  5501. }
  5502. class me {
  5503. constructor(e, t) {
  5504. var l;
  5505. this.constraint_ = t == null ? void 0 : t.constraint, this.equals_ = (l = t == null ? void 0 : t.equals) !== null && l !== void 0 ? l : (b, E) => b === E, this.emitter = new F(), this.rawValue_ = e;
  5506. }
  5507. get constraint() {
  5508. return this.constraint_;
  5509. }
  5510. get rawValue() {
  5511. return this.rawValue_;
  5512. }
  5513. set rawValue(e) {
  5514. this.setRawValue(e, {
  5515. forceEmit: false,
  5516. last: true
  5517. });
  5518. }
  5519. setRawValue(e, t) {
  5520. const l = t ?? {
  5521. forceEmit: false,
  5522. last: true
  5523. }, b = this.constraint_ ? this.constraint_.constrain(e) : e, E = this.rawValue_;
  5524. this.equals_(E, b) && !l.forceEmit || (this.emitter.emit("beforechange", {
  5525. sender: this
  5526. }), this.rawValue_ = b, this.emitter.emit("change", {
  5527. options: l,
  5528. previousRawValue: E,
  5529. rawValue: b,
  5530. sender: this
  5531. }));
  5532. }
  5533. }
  5534. class he {
  5535. constructor(e) {
  5536. this.emitter = new F(), this.value_ = e;
  5537. }
  5538. get rawValue() {
  5539. return this.value_;
  5540. }
  5541. set rawValue(e) {
  5542. this.setRawValue(e, {
  5543. forceEmit: false,
  5544. last: true
  5545. });
  5546. }
  5547. setRawValue(e, t) {
  5548. const l = t ?? {
  5549. forceEmit: false,
  5550. last: true
  5551. }, b = this.value_;
  5552. b === e && !l.forceEmit || (this.emitter.emit("beforechange", {
  5553. sender: this
  5554. }), this.value_ = e, this.emitter.emit("change", {
  5555. options: l,
  5556. previousRawValue: b,
  5557. rawValue: this.value_,
  5558. sender: this
  5559. }));
  5560. }
  5561. }
  5562. function ee(i, e) {
  5563. const t = e == null ? void 0 : e.constraint, l = e == null ? void 0 : e.equals;
  5564. return !t && !l ? new he(i) : new me(i, e);
  5565. }
  5566. class X {
  5567. constructor(e) {
  5568. this.emitter = new F(), this.valMap_ = e;
  5569. for (const t in this.valMap_)
  5570. this.valMap_[t].emitter.on("change", () => {
  5571. this.emitter.emit("change", {
  5572. key: t,
  5573. sender: this
  5574. });
  5575. });
  5576. }
  5577. static createCore(e) {
  5578. return Object.keys(e).reduce((l, b) => Object.assign(l, {
  5579. [b]: ee(e[b])
  5580. }), {});
  5581. }
  5582. static fromObject(e) {
  5583. const t = this.createCore(e);
  5584. return new X(t);
  5585. }
  5586. get(e) {
  5587. return this.valMap_[e].rawValue;
  5588. }
  5589. set(e, t) {
  5590. this.valMap_[e].rawValue = t;
  5591. }
  5592. value(e) {
  5593. return this.valMap_[e];
  5594. }
  5595. }
  5596. function Pe(i, e) {
  5597. const l = Object.keys(e).reduce((b, E) => {
  5598. if (b === void 0)
  5599. return;
  5600. const k = e[E], B = k(i[E]);
  5601. return B.succeeded ? Object.assign(Object.assign({}, b), { [E]: B.value }) : void 0;
  5602. }, {});
  5603. return l;
  5604. }
  5605. function fe(i, e) {
  5606. return i.reduce((t, l) => {
  5607. if (t === void 0)
  5608. return;
  5609. const b = e(l);
  5610. if (!(!b.succeeded || b.value === void 0))
  5611. return [...t, b.value];
  5612. }, []);
  5613. }
  5614. function ae(i) {
  5615. return i === null ? false : typeof i == "object";
  5616. }
  5617. function ne(i) {
  5618. return (e) => (t) => {
  5619. if (!e && t === void 0)
  5620. return {
  5621. succeeded: false,
  5622. value: void 0
  5623. };
  5624. if (e && t === void 0)
  5625. return {
  5626. succeeded: true,
  5627. value: void 0
  5628. };
  5629. const l = i(t);
  5630. return l !== void 0 ? {
  5631. succeeded: true,
  5632. value: l
  5633. } : {
  5634. succeeded: false,
  5635. value: void 0
  5636. };
  5637. };
  5638. }
  5639. function be(i) {
  5640. return {
  5641. custom: (e) => ne(e)(i),
  5642. boolean: ne((e) => typeof e == "boolean" ? e : void 0)(i),
  5643. number: ne((e) => typeof e == "number" ? e : void 0)(i),
  5644. string: ne((e) => typeof e == "string" ? e : void 0)(i),
  5645. function: ne((e) => typeof e == "function" ? e : void 0)(i),
  5646. constant: (e) => ne((t) => t === e ? e : void 0)(i),
  5647. raw: ne((e) => e)(i),
  5648. object: (e) => ne((t) => {
  5649. if (ae(t))
  5650. return Pe(t, e);
  5651. })(i),
  5652. array: (e) => ne((t) => {
  5653. if (Array.isArray(t))
  5654. return fe(t, e);
  5655. })(i)
  5656. };
  5657. }
  5658. const M = {
  5659. optional: be(true),
  5660. required: be(false)
  5661. };
  5662. function le(i, e) {
  5663. const t = M.required.object(e)(i);
  5664. return t.succeeded ? t.value : void 0;
  5665. }
  5666. function Ve(i) {
  5667. console.warn([
  5668. `Missing '${i.key}' of ${i.target} in ${i.place}.`,
  5669. "Please rebuild plugins with the latest core package."
  5670. ].join(" "));
  5671. }
  5672. function Be(i) {
  5673. return i && i.parentElement && i.parentElement.removeChild(i), null;
  5674. }
  5675. class we {
  5676. constructor(e) {
  5677. this.value_ = e;
  5678. }
  5679. static create(e) {
  5680. return [
  5681. new we(e),
  5682. (t, l) => {
  5683. e.setRawValue(t, l);
  5684. }
  5685. ];
  5686. }
  5687. get emitter() {
  5688. return this.value_.emitter;
  5689. }
  5690. get rawValue() {
  5691. return this.value_.rawValue;
  5692. }
  5693. }
  5694. const st = D2("");
  5695. function jn(i, e) {
  5696. return K(i, st(void 0, e));
  5697. }
  5698. class Ye extends X {
  5699. constructor(e) {
  5700. var t;
  5701. 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(ee(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (t = this.get("parent")) === null || t === void 0 || t.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  5702. }
  5703. static create(e) {
  5704. var t, l, b;
  5705. const E = e ?? {};
  5706. return new Ye(X.createCore({
  5707. disabled: (t = E.disabled) !== null && t !== void 0 ? t : false,
  5708. disposed: false,
  5709. hidden: (l = E.hidden) !== null && l !== void 0 ? l : false,
  5710. parent: (b = E.parent) !== null && b !== void 0 ? b : null
  5711. }));
  5712. }
  5713. get globalDisabled() {
  5714. return this.globalDisabled_;
  5715. }
  5716. bindClassModifiers(e) {
  5717. N(this.globalDisabled_, jn(e, "disabled")), O(this, "hidden", jn(e, "hidden"));
  5718. }
  5719. bindDisabled(e) {
  5720. N(this.globalDisabled_, (t) => {
  5721. e.disabled = t;
  5722. });
  5723. }
  5724. bindTabIndex(e) {
  5725. N(this.globalDisabled_, (t) => {
  5726. e.tabIndex = t ? -1 : 0;
  5727. });
  5728. }
  5729. handleDispose(e) {
  5730. this.value("disposed").emitter.on("change", (t) => {
  5731. t && e();
  5732. });
  5733. }
  5734. getGlobalDisabled_() {
  5735. const e = this.get("parent");
  5736. return (e ? e.globalDisabled.rawValue : false) || this.get("disabled");
  5737. }
  5738. updateGlobalDisabled_() {
  5739. this.setGlobalDisabled_(this.getGlobalDisabled_());
  5740. }
  5741. onDisabledChange_() {
  5742. this.updateGlobalDisabled_();
  5743. }
  5744. onParentGlobalDisabledChange_() {
  5745. this.updateGlobalDisabled_();
  5746. }
  5747. onParentChange_(e) {
  5748. var t;
  5749. const l = e.previousRawValue;
  5750. 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_();
  5751. }
  5752. }
  5753. function zn() {
  5754. return ["veryfirst", "first", "last", "verylast"];
  5755. }
  5756. const cn = D2(""), mt = {
  5757. veryfirst: "vfst",
  5758. first: "fst",
  5759. last: "lst",
  5760. verylast: "vlst"
  5761. };
  5762. class Mt {
  5763. constructor(e) {
  5764. this.parent_ = null, this.blade = e.blade, this.view = e.view, this.viewProps = e.viewProps;
  5765. const t = this.view.element;
  5766. this.blade.value("positions").emitter.on("change", () => {
  5767. zn().forEach((l) => {
  5768. t.classList.remove(cn(void 0, mt[l]));
  5769. }), this.blade.get("positions").forEach((l) => {
  5770. t.classList.add(cn(void 0, mt[l]));
  5771. });
  5772. }), this.viewProps.handleDispose(() => {
  5773. Be(t);
  5774. });
  5775. }
  5776. get parent() {
  5777. return this.parent_;
  5778. }
  5779. set parent(e) {
  5780. if (this.parent_ = e, !("parent" in this.viewProps.valMap_)) {
  5781. Ve({
  5782. key: "parent",
  5783. target: Ye.name,
  5784. place: "BladeController.parent"
  5785. });
  5786. return;
  5787. }
  5788. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  5789. }
  5790. }
  5791. const ze = "http://www.w3.org/2000/svg";
  5792. function rt(i) {
  5793. i.offsetHeight;
  5794. }
  5795. function un(i, e) {
  5796. const t = i.style.transition;
  5797. i.style.transition = "none", e(), i.style.transition = t;
  5798. }
  5799. function ft(i) {
  5800. return i.ontouchstart !== void 0;
  5801. }
  5802. function Un() {
  5803. return globalThis;
  5804. }
  5805. function mi() {
  5806. return Un().document;
  5807. }
  5808. function Gn(i) {
  5809. const e = i.ownerDocument.defaultView;
  5810. return e && "document" in e ? i.getContext("2d", {
  5811. willReadFrequently: true
  5812. }) : null;
  5813. }
  5814. const Hn = {
  5815. check: '<path d="M2 8l4 4l8 -8"/>',
  5816. dropdown: '<path d="M5 7h6l-3 3 z"/>',
  5817. p2dpad: '<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'
  5818. };
  5819. function xt(i, e) {
  5820. const t = i.createElementNS(ze, "svg");
  5821. return t.innerHTML = Hn[e], t;
  5822. }
  5823. function St(i, e, t) {
  5824. i.insertBefore(e, i.children[t]);
  5825. }
  5826. function Kn(i) {
  5827. i.parentElement && i.parentElement.removeChild(i);
  5828. }
  5829. function pn(i) {
  5830. for (; i.children.length > 0; )
  5831. i.removeChild(i.children[0]);
  5832. }
  5833. function $n(i) {
  5834. for (; i.childNodes.length > 0; )
  5835. i.removeChild(i.childNodes[0]);
  5836. }
  5837. function Et2(i) {
  5838. return i.relatedTarget ? i.relatedTarget : "explicitOriginalTarget" in i ? i.explicitOriginalTarget : null;
  5839. }
  5840. const vt = D2("lbl");
  5841. function Lt(i, e) {
  5842. const t = i.createDocumentFragment();
  5843. return e.split(`
  5844. `).map((b) => i.createTextNode(b)).forEach((b, E) => {
  5845. E > 0 && t.appendChild(i.createElement("br")), t.appendChild(b);
  5846. }), t;
  5847. }
  5848. class L {
  5849. constructor(e, t) {
  5850. this.element = e.createElement("div"), this.element.classList.add(vt()), t.viewProps.bindClassModifiers(this.element);
  5851. const l = e.createElement("div");
  5852. l.classList.add(vt("l")), O(t.props, "label", (E) => {
  5853. _(E) ? this.element.classList.add(vt(void 0, "nol")) : (this.element.classList.remove(vt(void 0, "nol")), $n(l), l.appendChild(Lt(e, E)));
  5854. }), this.element.appendChild(l), this.labelElement = l;
  5855. const b = e.createElement("div");
  5856. b.classList.add(vt("v")), this.element.appendChild(b), this.valueElement = b;
  5857. }
  5858. }
  5859. class U extends Mt {
  5860. constructor(e, t) {
  5861. const l = t.valueController.viewProps;
  5862. super(Object.assign(Object.assign({}, t), { view: new L(e, {
  5863. props: t.props,
  5864. viewProps: l
  5865. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  5866. }
  5867. }
  5868. const W = {
  5869. id: "button",
  5870. type: "blade",
  5871. accept(i) {
  5872. const e = M, t = le(i, {
  5873. title: e.required.string,
  5874. view: e.required.constant("button"),
  5875. label: e.optional.string
  5876. });
  5877. return t ? { params: t } : null;
  5878. },
  5879. controller(i) {
  5880. return new U(i.document, {
  5881. blade: i.blade,
  5882. props: X.fromObject({
  5883. label: i.params.label
  5884. }),
  5885. valueController: new ce(i.document, {
  5886. props: X.fromObject({
  5887. title: i.params.title
  5888. }),
  5889. viewProps: i.viewProps
  5890. })
  5891. });
  5892. },
  5893. api(i) {
  5894. return !(i.controller instanceof U) || !(i.controller.valueController instanceof ce) ? null : new j(i.controller);
  5895. }
  5896. };
  5897. class ie extends Mt {
  5898. constructor(e) {
  5899. super(e), this.value = e.value;
  5900. }
  5901. }
  5902. function ye() {
  5903. return new X({
  5904. positions: ee([], {
  5905. equals: y
  5906. })
  5907. });
  5908. }
  5909. class De extends X {
  5910. constructor(e) {
  5911. super(e);
  5912. }
  5913. static create(e) {
  5914. const t = {
  5915. completed: true,
  5916. expanded: e,
  5917. expandedHeight: null,
  5918. shouldFixHeight: false,
  5919. temporaryExpanded: null
  5920. }, l = X.createCore(t);
  5921. return new De(l);
  5922. }
  5923. get styleExpanded() {
  5924. var e;
  5925. return (e = this.get("temporaryExpanded")) !== null && e !== void 0 ? e : this.get("expanded");
  5926. }
  5927. get styleHeight() {
  5928. if (!this.styleExpanded)
  5929. return "0";
  5930. const e = this.get("expandedHeight");
  5931. return this.get("shouldFixHeight") && !_(e) ? `${e}px` : "auto";
  5932. }
  5933. bindExpandedClass(e, t) {
  5934. const l = () => {
  5935. this.styleExpanded ? e.classList.add(t) : e.classList.remove(t);
  5936. };
  5937. O(this, "expanded", l), O(this, "temporaryExpanded", l);
  5938. }
  5939. cleanUpTransition() {
  5940. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  5941. }
  5942. }
  5943. function Ht(i, e) {
  5944. let t = 0;
  5945. return un(e, () => {
  5946. i.set("expandedHeight", null), i.set("temporaryExpanded", true), rt(e), t = e.clientHeight, i.set("temporaryExpanded", null), rt(e);
  5947. }), t;
  5948. }
  5949. function hn(i, e) {
  5950. e.style.height = i.styleHeight;
  5951. }
  5952. function Ue(i, e) {
  5953. i.value("expanded").emitter.on("beforechange", () => {
  5954. if (i.set("completed", false), _(i.get("expandedHeight"))) {
  5955. const t = Ht(i, e);
  5956. t > 0 && i.set("expandedHeight", t);
  5957. }
  5958. i.set("shouldFixHeight", true), rt(e);
  5959. }), i.emitter.on("change", () => {
  5960. hn(i, e);
  5961. }), hn(i, e), e.addEventListener("transitionend", (t) => {
  5962. t.propertyName === "height" && i.cleanUpTransition();
  5963. });
  5964. }
  5965. class Ge extends a {
  5966. constructor(e, t) {
  5967. super(e), this.rackApi_ = t;
  5968. }
  5969. }
  5970. function qs(i, e) {
  5971. return i.addBlade(Object.assign(Object.assign({}, e), { view: "button" }));
  5972. }
  5973. function Qs(i, e) {
  5974. return i.addBlade(Object.assign(Object.assign({}, e), { view: "folder" }));
  5975. }
  5976. function Zs(i, e) {
  5977. const t = e ?? {};
  5978. return i.addBlade(Object.assign(Object.assign({}, t), { view: "separator" }));
  5979. }
  5980. function fi(i, e) {
  5981. return i.addBlade(Object.assign(Object.assign({}, e), { view: "tab" }));
  5982. }
  5983. class At {
  5984. constructor(e) {
  5985. 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;
  5986. }
  5987. get items() {
  5988. return this.items_;
  5989. }
  5990. allItems() {
  5991. return Array.from(this.cache_);
  5992. }
  5993. find(e) {
  5994. for (const t of this.allItems())
  5995. if (e(t))
  5996. return t;
  5997. return null;
  5998. }
  5999. includes(e) {
  6000. return this.cache_.has(e);
  6001. }
  6002. add(e, t) {
  6003. if (this.includes(e))
  6004. throw S.shouldNeverHappen();
  6005. const l = t !== void 0 ? t : this.items_.length;
  6006. this.items_.splice(l, 0, e), this.cache_.add(e);
  6007. const b = this.extract_(e);
  6008. b && (b.emitter.on("add", this.onSubListAdd_), b.emitter.on("remove", this.onSubListRemove_), b.allItems().forEach((E) => {
  6009. this.cache_.add(E);
  6010. })), this.emitter.emit("add", {
  6011. index: l,
  6012. item: e,
  6013. root: this,
  6014. target: this
  6015. });
  6016. }
  6017. remove(e) {
  6018. const t = this.items_.indexOf(e);
  6019. if (t < 0)
  6020. return;
  6021. this.items_.splice(t, 1), this.cache_.delete(e);
  6022. const l = this.extract_(e);
  6023. l && (l.emitter.off("add", this.onSubListAdd_), l.emitter.off("remove", this.onSubListRemove_)), this.emitter.emit("remove", {
  6024. index: t,
  6025. item: e,
  6026. root: this,
  6027. target: this
  6028. });
  6029. }
  6030. onSubListAdd_(e) {
  6031. this.cache_.add(e.item), this.emitter.emit("add", {
  6032. index: e.index,
  6033. item: e.item,
  6034. root: this,
  6035. target: e.target
  6036. });
  6037. }
  6038. onSubListRemove_(e) {
  6039. this.cache_.delete(e.item), this.emitter.emit("remove", {
  6040. index: e.index,
  6041. item: e.item,
  6042. root: this,
  6043. target: e.target
  6044. });
  6045. }
  6046. }
  6047. class vi extends a {
  6048. constructor(e) {
  6049. super(e), this.onBindingChange_ = this.onBindingChange_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("change", this.onBindingChange_);
  6050. }
  6051. get label() {
  6052. return this.controller_.props.get("label");
  6053. }
  6054. set label(e) {
  6055. this.controller_.props.set("label", e);
  6056. }
  6057. on(e, t) {
  6058. const l = t.bind(this);
  6059. return this.emitter_.on(e, (b) => {
  6060. l(b.event);
  6061. }), this;
  6062. }
  6063. refresh() {
  6064. this.controller_.binding.read();
  6065. }
  6066. onBindingChange_(e) {
  6067. const t = e.sender.target.read();
  6068. this.emitter_.emit("change", {
  6069. event: new p(this, t, this.controller_.binding.target.presetKey, e.options.last)
  6070. });
  6071. }
  6072. }
  6073. class je extends U {
  6074. constructor(e, t) {
  6075. super(e, t), this.binding = t.binding;
  6076. }
  6077. }
  6078. class bi extends a {
  6079. constructor(e) {
  6080. super(e), this.onBindingUpdate_ = this.onBindingUpdate_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("update", this.onBindingUpdate_);
  6081. }
  6082. get label() {
  6083. return this.controller_.props.get("label");
  6084. }
  6085. set label(e) {
  6086. this.controller_.props.set("label", e);
  6087. }
  6088. on(e, t) {
  6089. const l = t.bind(this);
  6090. return this.emitter_.on(e, (b) => {
  6091. l(b.event);
  6092. }), this;
  6093. }
  6094. refresh() {
  6095. this.controller_.binding.read();
  6096. }
  6097. onBindingUpdate_(e) {
  6098. const t = e.sender.target.read();
  6099. this.emitter_.emit("update", {
  6100. event: new h(this, t, this.controller_.binding.target.presetKey)
  6101. });
  6102. }
  6103. }
  6104. class ot extends U {
  6105. constructor(e, t) {
  6106. super(e, t), this.binding = t.binding, this.viewProps.bindDisabled(this.binding.ticker), this.viewProps.handleDispose(() => {
  6107. this.binding.dispose();
  6108. });
  6109. }
  6110. }
  6111. function is(i) {
  6112. return i instanceof Xn ? i.apiSet_ : i instanceof Ge ? i.rackApi_.apiSet_ : null;
  6113. }
  6114. function dn(i, e) {
  6115. const t = i.find((l) => l.controller_ === e);
  6116. if (!t)
  6117. throw S.shouldNeverHappen();
  6118. return t;
  6119. }
  6120. function ss(i, e, t) {
  6121. if (!R.isBindable(i))
  6122. throw S.notBindable();
  6123. return new R(i, e, t);
  6124. }
  6125. class Xn extends a {
  6126. constructor(e, t) {
  6127. 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 At(is), this.pool_ = t;
  6128. const l = this.controller_.rack;
  6129. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), l.emitter.on("inputchange", this.onRackInputChange_), l.emitter.on("monitorupdate", this.onRackMonitorUpdate_), l.children.forEach((b) => {
  6130. this.setUpApi_(b);
  6131. });
  6132. }
  6133. get children() {
  6134. return this.controller_.rack.children.map((e) => dn(this.apiSet_, e));
  6135. }
  6136. addInput(e, t, l) {
  6137. const b = l ?? {}, E = this.controller_.view.element.ownerDocument, k = this.pool_.createInput(E, ss(e, t, b.presetKey), b), B = new vi(k);
  6138. return this.add(B, b.index);
  6139. }
  6140. addMonitor(e, t, l) {
  6141. const b = l ?? {}, E = this.controller_.view.element.ownerDocument, k = this.pool_.createMonitor(E, ss(e, t), b), B = new bi(k);
  6142. return this.add(B, b.index);
  6143. }
  6144. addFolder(e) {
  6145. return Qs(this, e);
  6146. }
  6147. addButton(e) {
  6148. return qs(this, e);
  6149. }
  6150. addSeparator(e) {
  6151. return Zs(this, e);
  6152. }
  6153. addTab(e) {
  6154. return fi(this, e);
  6155. }
  6156. add(e, t) {
  6157. this.controller_.rack.add(e.controller_, t);
  6158. const l = this.apiSet_.find((b) => b.controller_ === e.controller_);
  6159. return l && this.apiSet_.remove(l), this.apiSet_.add(e), e;
  6160. }
  6161. remove(e) {
  6162. this.controller_.rack.remove(e.controller_);
  6163. }
  6164. addBlade(e) {
  6165. const t = this.controller_.view.element.ownerDocument, l = this.pool_.createBlade(t, e), b = this.pool_.createBladeApi(l);
  6166. return this.add(b, e.index);
  6167. }
  6168. on(e, t) {
  6169. const l = t.bind(this);
  6170. return this.emitter_.on(e, (b) => {
  6171. l(b.event);
  6172. }), this;
  6173. }
  6174. setUpApi_(e) {
  6175. this.apiSet_.find((l) => l.controller_ === e) || this.apiSet_.add(this.pool_.createBladeApi(e));
  6176. }
  6177. onRackAdd_(e) {
  6178. this.setUpApi_(e.bladeController);
  6179. }
  6180. onRackRemove_(e) {
  6181. if (e.isRoot) {
  6182. const t = dn(this.apiSet_, e.bladeController);
  6183. this.apiSet_.remove(t);
  6184. }
  6185. }
  6186. onRackInputChange_(e) {
  6187. const t = e.bladeController;
  6188. if (t instanceof je) {
  6189. const l = dn(this.apiSet_, t), b = t.binding;
  6190. this.emitter_.emit("change", {
  6191. event: new p(l, b.target.read(), b.target.presetKey, e.options.last)
  6192. });
  6193. } else if (t instanceof ie) {
  6194. const l = dn(this.apiSet_, t);
  6195. this.emitter_.emit("change", {
  6196. event: new p(l, t.value.rawValue, void 0, e.options.last)
  6197. });
  6198. }
  6199. }
  6200. onRackMonitorUpdate_(e) {
  6201. if (!(e.bladeController instanceof ot))
  6202. throw S.shouldNeverHappen();
  6203. const t = dn(this.apiSet_, e.bladeController), l = e.bladeController.binding;
  6204. this.emitter_.emit("update", {
  6205. event: new h(t, l.target.read(), l.target.presetKey)
  6206. });
  6207. }
  6208. }
  6209. class gi extends Ge {
  6210. constructor(e, t) {
  6211. super(e, new Xn(e.rackController, t)), this.emitter_ = new F(), this.controller_.foldable.value("expanded").emitter.on("change", (l) => {
  6212. this.emitter_.emit("fold", {
  6213. event: new d(this, l.sender.rawValue)
  6214. });
  6215. }), this.rackApi_.on("change", (l) => {
  6216. this.emitter_.emit("change", {
  6217. event: l
  6218. });
  6219. }), this.rackApi_.on("update", (l) => {
  6220. this.emitter_.emit("update", {
  6221. event: l
  6222. });
  6223. });
  6224. }
  6225. get expanded() {
  6226. return this.controller_.foldable.get("expanded");
  6227. }
  6228. set expanded(e) {
  6229. this.controller_.foldable.set("expanded", e);
  6230. }
  6231. get title() {
  6232. return this.controller_.props.get("title");
  6233. }
  6234. set title(e) {
  6235. this.controller_.props.set("title", e);
  6236. }
  6237. get children() {
  6238. return this.rackApi_.children;
  6239. }
  6240. addInput(e, t, l) {
  6241. return this.rackApi_.addInput(e, t, l);
  6242. }
  6243. addMonitor(e, t, l) {
  6244. return this.rackApi_.addMonitor(e, t, l);
  6245. }
  6246. addFolder(e) {
  6247. return this.rackApi_.addFolder(e);
  6248. }
  6249. addButton(e) {
  6250. return this.rackApi_.addButton(e);
  6251. }
  6252. addSeparator(e) {
  6253. return this.rackApi_.addSeparator(e);
  6254. }
  6255. addTab(e) {
  6256. return this.rackApi_.addTab(e);
  6257. }
  6258. add(e, t) {
  6259. return this.rackApi_.add(e, t);
  6260. }
  6261. remove(e) {
  6262. this.rackApi_.remove(e);
  6263. }
  6264. addBlade(e) {
  6265. return this.rackApi_.addBlade(e);
  6266. }
  6267. on(e, t) {
  6268. const l = t.bind(this);
  6269. return this.emitter_.on(e, (b) => {
  6270. l(b.event);
  6271. }), this;
  6272. }
  6273. }
  6274. class _i extends Mt {
  6275. constructor(e) {
  6276. super({
  6277. blade: e.blade,
  6278. view: e.view,
  6279. viewProps: e.rackController.viewProps
  6280. }), this.rackController = e.rackController;
  6281. }
  6282. }
  6283. class Ws {
  6284. constructor(e, t) {
  6285. const l = D2(t.viewName);
  6286. this.element = e.createElement("div"), this.element.classList.add(l()), t.viewProps.bindClassModifiers(this.element);
  6287. }
  6288. }
  6289. function Js(i, e) {
  6290. for (let t = 0; t < i.length; t++) {
  6291. const l = i[t];
  6292. if (l instanceof je && l.binding === e)
  6293. return l;
  6294. }
  6295. return null;
  6296. }
  6297. function er(i, e) {
  6298. for (let t = 0; t < i.length; t++) {
  6299. const l = i[t];
  6300. if (l instanceof ot && l.binding === e)
  6301. return l;
  6302. }
  6303. return null;
  6304. }
  6305. function tr(i, e) {
  6306. for (let t = 0; t < i.length; t++) {
  6307. const l = i[t];
  6308. if (l instanceof ie && l.value === e)
  6309. return l;
  6310. }
  6311. return null;
  6312. }
  6313. function wi(i) {
  6314. return i instanceof mn ? i.rack : i instanceof _i ? i.rackController.rack : null;
  6315. }
  6316. function nr(i) {
  6317. const e = wi(i);
  6318. return e ? e.bcSet_ : null;
  6319. }
  6320. class ir {
  6321. constructor(e) {
  6322. var t, l;
  6323. 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 At(nr), this.bcSet_.emitter.on("add", this.onSetAdd_), this.bcSet_.emitter.on("remove", this.onSetRemove_);
  6324. }
  6325. get children() {
  6326. return this.bcSet_.items;
  6327. }
  6328. add(e, t) {
  6329. var l;
  6330. (l = e.parent) === null || l === void 0 || l.remove(e), P(e, "parent") ? e.parent = this : (e.parent_ = this, Ve({
  6331. key: "parent",
  6332. target: "BladeController",
  6333. place: "BladeRack.add"
  6334. })), this.bcSet_.add(e, t);
  6335. }
  6336. remove(e) {
  6337. P(e, "parent") ? e.parent = null : (e.parent_ = null, Ve({
  6338. key: "parent",
  6339. target: "BladeController",
  6340. place: "BladeRack.remove"
  6341. })), this.bcSet_.remove(e);
  6342. }
  6343. find(e) {
  6344. return this.bcSet_.allItems().filter((t) => t instanceof e);
  6345. }
  6346. onSetAdd_(e) {
  6347. this.updatePositions_();
  6348. const t = e.target === e.root;
  6349. if (this.emitter.emit("add", {
  6350. bladeController: e.item,
  6351. index: e.index,
  6352. isRoot: t,
  6353. sender: this
  6354. }), !t)
  6355. return;
  6356. const l = e.item;
  6357. if (l.viewProps.emitter.on("change", this.onChildViewPropsChange_), l.blade.value("positions").emitter.on("change", this.onChildPositionsChange_), l.viewProps.handleDispose(this.onChildDispose_), l instanceof je)
  6358. l.binding.emitter.on("change", this.onChildInputChange_);
  6359. else if (l instanceof ot)
  6360. l.binding.emitter.on("update", this.onChildMonitorUpdate_);
  6361. else if (l instanceof ie)
  6362. l.value.emitter.on("change", this.onChildValueChange_);
  6363. else {
  6364. const b = wi(l);
  6365. if (b) {
  6366. const E = b.emitter;
  6367. E.on("layout", this.onDescendantLayout_), E.on("inputchange", this.onDescendantInputChange_), E.on("monitorupdate", this.onDescendantMonitorUpdate_);
  6368. }
  6369. }
  6370. }
  6371. onSetRemove_(e) {
  6372. this.updatePositions_();
  6373. const t = e.target === e.root;
  6374. if (this.emitter.emit("remove", {
  6375. bladeController: e.item,
  6376. isRoot: t,
  6377. sender: this
  6378. }), !t)
  6379. return;
  6380. const l = e.item;
  6381. if (l instanceof je)
  6382. l.binding.emitter.off("change", this.onChildInputChange_);
  6383. else if (l instanceof ot)
  6384. l.binding.emitter.off("update", this.onChildMonitorUpdate_);
  6385. else if (l instanceof ie)
  6386. l.value.emitter.off("change", this.onChildValueChange_);
  6387. else {
  6388. const b = wi(l);
  6389. if (b) {
  6390. const E = b.emitter;
  6391. E.off("layout", this.onDescendantLayout_), E.off("inputchange", this.onDescendantInputChange_), E.off("monitorupdate", this.onDescendantMonitorUpdate_);
  6392. }
  6393. }
  6394. }
  6395. updatePositions_() {
  6396. const e = this.bcSet_.items.filter((b) => !b.viewProps.get("hidden")), t = e[0], l = e[e.length - 1];
  6397. this.bcSet_.items.forEach((b) => {
  6398. const E = [];
  6399. b === t && (E.push("first"), (!this.blade_ || this.blade_.get("positions").includes("veryfirst")) && E.push("veryfirst")), b === l && (E.push("last"), (!this.blade_ || this.blade_.get("positions").includes("verylast")) && E.push("verylast")), b.blade.set("positions", E);
  6400. });
  6401. }
  6402. onChildPositionsChange_() {
  6403. this.updatePositions_(), this.emitter.emit("layout", {
  6404. sender: this
  6405. });
  6406. }
  6407. onChildViewPropsChange_(e) {
  6408. this.updatePositions_(), this.emitter.emit("layout", {
  6409. sender: this
  6410. });
  6411. }
  6412. onChildDispose_() {
  6413. this.bcSet_.items.filter((t) => t.viewProps.get("disposed")).forEach((t) => {
  6414. this.bcSet_.remove(t);
  6415. });
  6416. }
  6417. onChildInputChange_(e) {
  6418. const t = Js(this.find(je), e.sender);
  6419. if (!t)
  6420. throw S.alreadyDisposed();
  6421. this.emitter.emit("inputchange", {
  6422. bladeController: t,
  6423. options: e.options,
  6424. sender: this
  6425. });
  6426. }
  6427. onChildMonitorUpdate_(e) {
  6428. const t = er(this.find(ot), e.sender);
  6429. if (!t)
  6430. throw S.alreadyDisposed();
  6431. this.emitter.emit("monitorupdate", {
  6432. bladeController: t,
  6433. sender: this
  6434. });
  6435. }
  6436. onChildValueChange_(e) {
  6437. const t = tr(this.find(ie), e.sender);
  6438. if (!t)
  6439. throw S.alreadyDisposed();
  6440. this.emitter.emit("inputchange", {
  6441. bladeController: t,
  6442. options: e.options,
  6443. sender: this
  6444. });
  6445. }
  6446. onDescendantLayout_(e) {
  6447. this.updatePositions_(), this.emitter.emit("layout", {
  6448. sender: this
  6449. });
  6450. }
  6451. onDescendantInputChange_(e) {
  6452. this.emitter.emit("inputchange", {
  6453. bladeController: e.bladeController,
  6454. options: e.options,
  6455. sender: this
  6456. });
  6457. }
  6458. onDescendantMonitorUpdate_(e) {
  6459. this.emitter.emit("monitorupdate", {
  6460. bladeController: e.bladeController,
  6461. sender: this
  6462. });
  6463. }
  6464. onBladePositionsChange_() {
  6465. this.updatePositions_();
  6466. }
  6467. }
  6468. class mn extends Mt {
  6469. constructor(e, t) {
  6470. super(Object.assign(Object.assign({}, t), { view: new Ws(e, {
  6471. viewName: "brk",
  6472. viewProps: t.viewProps
  6473. }) })), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this);
  6474. const l = new ir({
  6475. blade: t.root ? void 0 : t.blade,
  6476. viewProps: t.viewProps
  6477. });
  6478. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), this.rack = l, this.viewProps.handleDispose(() => {
  6479. for (let b = this.rack.children.length - 1; b >= 0; b--)
  6480. this.rack.children[b].viewProps.set("disposed", true);
  6481. });
  6482. }
  6483. onRackAdd_(e) {
  6484. e.isRoot && St(this.view.element, e.bladeController.view.element, e.index);
  6485. }
  6486. onRackRemove_(e) {
  6487. e.isRoot && Kn(e.bladeController.view.element);
  6488. }
  6489. }
  6490. const rs = D2("cnt");
  6491. class sr {
  6492. constructor(e, t) {
  6493. var l;
  6494. this.className_ = D2((l = t.viewName) !== null && l !== void 0 ? l : "fld"), this.element = e.createElement("div"), this.element.classList.add(this.className_(), rs()), t.viewProps.bindClassModifiers(this.element), this.foldable_ = t.foldable, this.foldable_.bindExpandedClass(this.element, this.className_(void 0, "expanded")), O(this.foldable_, "completed", K(this.element, this.className_(void 0, "cpl")));
  6495. const b = e.createElement("button");
  6496. b.classList.add(this.className_("b")), O(t.props, "title", (J) => {
  6497. _(J) ? this.element.classList.add(this.className_(void 0, "not")) : this.element.classList.remove(this.className_(void 0, "not"));
  6498. }), t.viewProps.bindDisabled(b), this.element.appendChild(b), this.buttonElement = b;
  6499. const E = e.createElement("div");
  6500. E.classList.add(this.className_("i")), this.element.appendChild(E);
  6501. const k = e.createElement("div");
  6502. k.classList.add(this.className_("t")), q(t.props.value("title"), k), this.buttonElement.appendChild(k), this.titleElement = k;
  6503. const B = e.createElement("div");
  6504. B.classList.add(this.className_("m")), this.buttonElement.appendChild(B);
  6505. const Q = t.containerElement;
  6506. Q.classList.add(this.className_("c")), this.element.appendChild(Q), this.containerElement = Q;
  6507. }
  6508. }
  6509. class Yn extends _i {
  6510. constructor(e, t) {
  6511. var l;
  6512. const b = De.create((l = t.expanded) !== null && l !== void 0 ? l : true), E = new mn(e, {
  6513. blade: t.blade,
  6514. root: t.root,
  6515. viewProps: t.viewProps
  6516. });
  6517. super(Object.assign(Object.assign({}, t), { rackController: E, view: new sr(e, {
  6518. containerElement: E.view.element,
  6519. foldable: b,
  6520. props: t.props,
  6521. viewName: t.root ? "rot" : void 0,
  6522. viewProps: t.viewProps
  6523. }) })), this.onTitleClick_ = this.onTitleClick_.bind(this), this.props = t.props, this.foldable = b, Ue(this.foldable, this.view.containerElement), this.rackController.rack.emitter.on("add", () => {
  6524. this.foldable.cleanUpTransition();
  6525. }), this.rackController.rack.emitter.on("remove", () => {
  6526. this.foldable.cleanUpTransition();
  6527. }), this.view.buttonElement.addEventListener("click", this.onTitleClick_);
  6528. }
  6529. get document() {
  6530. return this.view.element.ownerDocument;
  6531. }
  6532. onTitleClick_() {
  6533. this.foldable.set("expanded", !this.foldable.get("expanded"));
  6534. }
  6535. }
  6536. const rr = {
  6537. id: "folder",
  6538. type: "blade",
  6539. accept(i) {
  6540. const e = M, t = le(i, {
  6541. title: e.required.string,
  6542. view: e.required.constant("folder"),
  6543. expanded: e.optional.boolean
  6544. });
  6545. return t ? { params: t } : null;
  6546. },
  6547. controller(i) {
  6548. return new Yn(i.document, {
  6549. blade: i.blade,
  6550. expanded: i.params.expanded,
  6551. props: X.fromObject({
  6552. title: i.params.title
  6553. }),
  6554. viewProps: i.viewProps
  6555. });
  6556. },
  6557. api(i) {
  6558. return i.controller instanceof Yn ? new gi(i.controller, i.pool) : null;
  6559. }
  6560. };
  6561. class Kt extends ie {
  6562. constructor(e, t) {
  6563. const l = t.valueController.viewProps;
  6564. super(Object.assign(Object.assign({}, t), { value: t.valueController.value, view: new L(e, {
  6565. props: t.props,
  6566. viewProps: l
  6567. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  6568. }
  6569. }
  6570. class os extends a {
  6571. }
  6572. const yi = D2("spr");
  6573. class or {
  6574. constructor(e, t) {
  6575. this.element = e.createElement("div"), this.element.classList.add(yi()), t.viewProps.bindClassModifiers(this.element);
  6576. const l = e.createElement("hr");
  6577. l.classList.add(yi("r")), this.element.appendChild(l);
  6578. }
  6579. }
  6580. class fn extends Mt {
  6581. constructor(e, t) {
  6582. super(Object.assign(Object.assign({}, t), { view: new or(e, {
  6583. viewProps: t.viewProps
  6584. }) }));
  6585. }
  6586. }
  6587. const ar = {
  6588. id: "separator",
  6589. type: "blade",
  6590. accept(i) {
  6591. const t = le(i, {
  6592. view: M.required.constant("separator")
  6593. });
  6594. return t ? { params: t } : null;
  6595. },
  6596. controller(i) {
  6597. return new fn(i.document, {
  6598. blade: i.blade,
  6599. viewProps: i.viewProps
  6600. });
  6601. },
  6602. api(i) {
  6603. return i.controller instanceof fn ? new os(i.controller) : null;
  6604. }
  6605. }, Re = D2("tbi");
  6606. class lr {
  6607. constructor(e, t) {
  6608. this.element = e.createElement("div"), this.element.classList.add(Re()), t.viewProps.bindClassModifiers(this.element), O(t.props, "selected", (E) => {
  6609. E ? this.element.classList.add(Re(void 0, "sel")) : this.element.classList.remove(Re(void 0, "sel"));
  6610. });
  6611. const l = e.createElement("button");
  6612. l.classList.add(Re("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  6613. const b = e.createElement("div");
  6614. b.classList.add(Re("t")), q(t.props.value("title"), b), this.buttonElement.appendChild(b), this.titleElement = b;
  6615. }
  6616. }
  6617. class qn {
  6618. constructor(e, t) {
  6619. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new lr(e, {
  6620. props: t.props,
  6621. viewProps: t.viewProps
  6622. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  6623. }
  6624. onClick_() {
  6625. this.emitter.emit("click", {
  6626. sender: this
  6627. });
  6628. }
  6629. }
  6630. class as {
  6631. constructor(e, t) {
  6632. this.onItemClick_ = this.onItemClick_.bind(this), this.ic_ = new qn(e, {
  6633. props: t.itemProps,
  6634. viewProps: Ye.create()
  6635. }), this.ic_.emitter.on("click", this.onItemClick_), this.cc_ = new mn(e, {
  6636. blade: ye(),
  6637. viewProps: Ye.create()
  6638. }), this.props = t.props, O(this.props, "selected", (l) => {
  6639. this.itemController.props.set("selected", l), this.contentController.viewProps.set("hidden", !l);
  6640. });
  6641. }
  6642. get itemController() {
  6643. return this.ic_;
  6644. }
  6645. get contentController() {
  6646. return this.cc_;
  6647. }
  6648. onItemClick_() {
  6649. this.props.set("selected", true);
  6650. }
  6651. }
  6652. class xi {
  6653. constructor(e, t) {
  6654. this.controller_ = e, this.rackApi_ = t;
  6655. }
  6656. get title() {
  6657. var e;
  6658. return (e = this.controller_.itemController.props.get("title")) !== null && e !== void 0 ? e : "";
  6659. }
  6660. set title(e) {
  6661. this.controller_.itemController.props.set("title", e);
  6662. }
  6663. get selected() {
  6664. return this.controller_.props.get("selected");
  6665. }
  6666. set selected(e) {
  6667. this.controller_.props.set("selected", e);
  6668. }
  6669. get children() {
  6670. return this.rackApi_.children;
  6671. }
  6672. addButton(e) {
  6673. return this.rackApi_.addButton(e);
  6674. }
  6675. addFolder(e) {
  6676. return this.rackApi_.addFolder(e);
  6677. }
  6678. addSeparator(e) {
  6679. return this.rackApi_.addSeparator(e);
  6680. }
  6681. addTab(e) {
  6682. return this.rackApi_.addTab(e);
  6683. }
  6684. add(e, t) {
  6685. this.rackApi_.add(e, t);
  6686. }
  6687. remove(e) {
  6688. this.rackApi_.remove(e);
  6689. }
  6690. addInput(e, t, l) {
  6691. return this.rackApi_.addInput(e, t, l);
  6692. }
  6693. addMonitor(e, t, l) {
  6694. return this.rackApi_.addMonitor(e, t, l);
  6695. }
  6696. addBlade(e) {
  6697. return this.rackApi_.addBlade(e);
  6698. }
  6699. }
  6700. class ls extends Ge {
  6701. constructor(e, t) {
  6702. super(e, new Xn(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) => {
  6703. this.emitter_.emit("change", {
  6704. event: l
  6705. });
  6706. }), this.rackApi_.on("update", (l) => {
  6707. this.emitter_.emit("update", {
  6708. event: l
  6709. });
  6710. }), 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) => {
  6711. this.setUpPageApi_(l);
  6712. });
  6713. }
  6714. get pages() {
  6715. return this.controller_.pageSet.items.map((e) => {
  6716. const t = this.pageApiMap_.get(e);
  6717. if (!t)
  6718. throw S.shouldNeverHappen();
  6719. return t;
  6720. });
  6721. }
  6722. addPage(e) {
  6723. const t = this.controller_.view.element.ownerDocument, l = new as(t, {
  6724. itemProps: X.fromObject({
  6725. selected: false,
  6726. title: e.title
  6727. }),
  6728. props: X.fromObject({
  6729. selected: false
  6730. })
  6731. });
  6732. this.controller_.add(l, e.index);
  6733. const b = this.pageApiMap_.get(l);
  6734. if (!b)
  6735. throw S.shouldNeverHappen();
  6736. return b;
  6737. }
  6738. removePage(e) {
  6739. this.controller_.remove(e);
  6740. }
  6741. on(e, t) {
  6742. const l = t.bind(this);
  6743. return this.emitter_.on(e, (b) => {
  6744. l(b.event);
  6745. }), this;
  6746. }
  6747. setUpPageApi_(e) {
  6748. const t = this.rackApi_.apiSet_.find((b) => b.controller_ === e.contentController);
  6749. if (!t)
  6750. throw S.shouldNeverHappen();
  6751. const l = new xi(e, t);
  6752. this.pageApiMap_.set(e, l);
  6753. }
  6754. onPageAdd_(e) {
  6755. this.setUpPageApi_(e.item);
  6756. }
  6757. onPageRemove_(e) {
  6758. if (!this.pageApiMap_.get(e.item))
  6759. throw S.shouldNeverHappen();
  6760. this.pageApiMap_.delete(e.item);
  6761. }
  6762. onSelect_(e) {
  6763. this.emitter_.emit("select", {
  6764. event: new g(this, e.rawValue)
  6765. });
  6766. }
  6767. }
  6768. const cs = -1;
  6769. class cr {
  6770. constructor() {
  6771. this.onItemSelectedChange_ = this.onItemSelectedChange_.bind(this), this.empty = ee(true), this.selectedIndex = ee(cs), this.items_ = [];
  6772. }
  6773. add(e, t) {
  6774. const l = t ?? this.items_.length;
  6775. this.items_.splice(l, 0, e), e.emitter.on("change", this.onItemSelectedChange_), this.keepSelection_();
  6776. }
  6777. remove(e) {
  6778. const t = this.items_.indexOf(e);
  6779. t < 0 || (this.items_.splice(t, 1), e.emitter.off("change", this.onItemSelectedChange_), this.keepSelection_());
  6780. }
  6781. keepSelection_() {
  6782. if (this.items_.length === 0) {
  6783. this.selectedIndex.rawValue = cs, this.empty.rawValue = true;
  6784. return;
  6785. }
  6786. const e = this.items_.findIndex((t) => t.rawValue);
  6787. e < 0 ? (this.items_.forEach((t, l) => {
  6788. t.rawValue = l === 0;
  6789. }), this.selectedIndex.rawValue = 0) : (this.items_.forEach((t, l) => {
  6790. t.rawValue = l === e;
  6791. }), this.selectedIndex.rawValue = e), this.empty.rawValue = false;
  6792. }
  6793. onItemSelectedChange_(e) {
  6794. if (e.rawValue) {
  6795. const t = this.items_.findIndex((l) => l === e.sender);
  6796. this.items_.forEach((l, b) => {
  6797. l.rawValue = b === t;
  6798. }), this.selectedIndex.rawValue = t;
  6799. } else
  6800. this.keepSelection_();
  6801. }
  6802. }
  6803. const $t = D2("tab");
  6804. class Xt {
  6805. constructor(e, t) {
  6806. this.element = e.createElement("div"), this.element.classList.add($t(), rs()), t.viewProps.bindClassModifiers(this.element), N(t.empty, K(this.element, $t(void 0, "nop")));
  6807. const l = e.createElement("div");
  6808. l.classList.add($t("t")), this.element.appendChild(l), this.itemsElement = l;
  6809. const b = e.createElement("div");
  6810. b.classList.add($t("i")), this.element.appendChild(b);
  6811. const E = t.contentsElement;
  6812. E.classList.add($t("c")), this.element.appendChild(E), this.contentsElement = E;
  6813. }
  6814. }
  6815. class vn extends _i {
  6816. constructor(e, t) {
  6817. const l = new mn(e, {
  6818. blade: t.blade,
  6819. viewProps: t.viewProps
  6820. }), b = new cr();
  6821. super({
  6822. blade: t.blade,
  6823. rackController: l,
  6824. view: new Xt(e, {
  6825. contentsElement: l.view.element,
  6826. empty: b.empty,
  6827. viewProps: t.viewProps
  6828. })
  6829. }), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.pageSet_ = new At(() => null), this.pageSet_.emitter.on("add", this.onPageAdd_), this.pageSet_.emitter.on("remove", this.onPageRemove_), this.tab = b;
  6830. }
  6831. get pageSet() {
  6832. return this.pageSet_;
  6833. }
  6834. add(e, t) {
  6835. this.pageSet_.add(e, t);
  6836. }
  6837. remove(e) {
  6838. this.pageSet_.remove(this.pageSet_.items[e]);
  6839. }
  6840. onPageAdd_(e) {
  6841. const t = e.item;
  6842. 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"));
  6843. }
  6844. onPageRemove_(e) {
  6845. const t = e.item;
  6846. Kn(t.itemController.view.element), t.itemController.viewProps.set("parent", null), this.rackController.rack.remove(t.contentController), this.tab.remove(t.props.value("selected"));
  6847. }
  6848. }
  6849. const Ei = {
  6850. id: "tab",
  6851. type: "blade",
  6852. accept(i) {
  6853. const e = M, t = le(i, {
  6854. pages: e.required.array(e.required.object({ title: e.required.string })),
  6855. view: e.required.constant("tab")
  6856. });
  6857. return !t || t.pages.length === 0 ? null : { params: t };
  6858. },
  6859. controller(i) {
  6860. const e = new vn(i.document, {
  6861. blade: i.blade,
  6862. viewProps: i.viewProps
  6863. });
  6864. return i.params.pages.forEach((t) => {
  6865. const l = new as(i.document, {
  6866. itemProps: X.fromObject({
  6867. selected: false,
  6868. title: t.title
  6869. }),
  6870. props: X.fromObject({
  6871. selected: false
  6872. })
  6873. });
  6874. e.add(l);
  6875. }), e;
  6876. },
  6877. api(i) {
  6878. return i.controller instanceof vn ? new ls(i.controller, i.pool) : null;
  6879. }
  6880. };
  6881. function ur(i, e) {
  6882. const t = i.accept(e.params);
  6883. if (!t)
  6884. return null;
  6885. const l = M.optional.boolean(e.params.disabled).value, b = M.optional.boolean(e.params.hidden).value;
  6886. return i.controller({
  6887. blade: ye(),
  6888. document: e.document,
  6889. params: Object.assign(Object.assign({}, t.params), { disabled: l, hidden: b }),
  6890. viewProps: Ye.create({
  6891. disabled: l,
  6892. hidden: b
  6893. })
  6894. });
  6895. }
  6896. class us {
  6897. constructor() {
  6898. this.disabled = false, this.emitter = new F();
  6899. }
  6900. dispose() {
  6901. }
  6902. tick() {
  6903. this.disabled || this.emitter.emit("tick", {
  6904. sender: this
  6905. });
  6906. }
  6907. }
  6908. class Ci {
  6909. constructor(e, t) {
  6910. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = e, this.emitter = new F(), this.interval_ = t, this.setTimer_();
  6911. }
  6912. get disabled() {
  6913. return this.disabled_;
  6914. }
  6915. set disabled(e) {
  6916. this.disabled_ = e, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  6917. }
  6918. dispose() {
  6919. this.clearTimer_();
  6920. }
  6921. clearTimer_() {
  6922. if (this.timerId_ === null)
  6923. return;
  6924. const e = this.doc_.defaultView;
  6925. e && e.clearInterval(this.timerId_), this.timerId_ = null;
  6926. }
  6927. setTimer_() {
  6928. if (this.clearTimer_(), this.interval_ <= 0)
  6929. return;
  6930. const e = this.doc_.defaultView;
  6931. e && (this.timerId_ = e.setInterval(this.onTick_, this.interval_));
  6932. }
  6933. onTick_() {
  6934. this.disabled_ || this.emitter.emit("tick", {
  6935. sender: this
  6936. });
  6937. }
  6938. }
  6939. class Qn {
  6940. constructor(e) {
  6941. 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();
  6942. }
  6943. read() {
  6944. const e = this.target.read();
  6945. e !== void 0 && (this.value.rawValue = this.reader(e));
  6946. }
  6947. write_(e) {
  6948. this.writer(this.target, e);
  6949. }
  6950. onValueChange_(e) {
  6951. this.write_(e.rawValue), this.emitter.emit("change", {
  6952. options: e.options,
  6953. rawValue: e.rawValue,
  6954. sender: this
  6955. });
  6956. }
  6957. }
  6958. function Me2(i, e) {
  6959. for (; i.length < e; )
  6960. i.push(void 0);
  6961. }
  6962. function ps(i) {
  6963. const e = [];
  6964. return Me2(e, i), ee(e);
  6965. }
  6966. function Yt(i) {
  6967. const e = i.indexOf(void 0);
  6968. return e < 0 ? i : i.slice(0, e);
  6969. }
  6970. function qe(i, e) {
  6971. const t = [...Yt(i), e];
  6972. return t.length > i.length ? t.splice(0, t.length - i.length) : Me2(t, i.length), t;
  6973. }
  6974. class pr {
  6975. constructor(e) {
  6976. 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();
  6977. }
  6978. dispose() {
  6979. this.ticker.dispose();
  6980. }
  6981. read() {
  6982. const e = this.target.read();
  6983. if (e === void 0)
  6984. return;
  6985. const t = this.value.rawValue, l = this.reader_(e);
  6986. this.value.rawValue = qe(t, l), this.emitter.emit("update", {
  6987. rawValue: l,
  6988. sender: this
  6989. });
  6990. }
  6991. onTick_(e) {
  6992. this.read();
  6993. }
  6994. }
  6995. class bn {
  6996. constructor(e) {
  6997. this.constraints = e;
  6998. }
  6999. constrain(e) {
  7000. return this.constraints.reduce((t, l) => l.constrain(t), e);
  7001. }
  7002. }
  7003. function tt(i, e) {
  7004. if (i instanceof e)
  7005. return i;
  7006. if (i instanceof bn) {
  7007. const t = i.constraints.reduce((l, b) => l || (b instanceof e ? b : null), null);
  7008. if (t)
  7009. return t;
  7010. }
  7011. return null;
  7012. }
  7013. class qt {
  7014. constructor(e) {
  7015. this.values = X.fromObject({
  7016. max: e.max,
  7017. min: e.min
  7018. });
  7019. }
  7020. constrain(e) {
  7021. const t = this.values.get("max"), l = this.values.get("min");
  7022. return Math.min(Math.max(e, l), t);
  7023. }
  7024. }
  7025. class gn {
  7026. constructor(e) {
  7027. this.values = X.fromObject({
  7028. options: e
  7029. });
  7030. }
  7031. get options() {
  7032. return this.values.get("options");
  7033. }
  7034. constrain(e) {
  7035. const t = this.values.get("options");
  7036. return t.length === 0 || t.filter((b) => b.value === e).length > 0 ? e : t[0].value;
  7037. }
  7038. }
  7039. class Pi {
  7040. constructor(e) {
  7041. this.values = X.fromObject({
  7042. max: e.max,
  7043. min: e.min
  7044. });
  7045. }
  7046. get maxValue() {
  7047. return this.values.get("max");
  7048. }
  7049. get minValue() {
  7050. return this.values.get("min");
  7051. }
  7052. constrain(e) {
  7053. const t = this.values.get("max"), l = this.values.get("min");
  7054. let b = e;
  7055. return _(l) || (b = Math.max(b, l)), _(t) || (b = Math.min(b, t)), b;
  7056. }
  7057. }
  7058. class Zn {
  7059. constructor(e, t = 0) {
  7060. this.step = e, this.origin = t;
  7061. }
  7062. constrain(e) {
  7063. const t = this.origin % this.step, l = Math.round((e - t) / this.step);
  7064. return t + l * this.step;
  7065. }
  7066. }
  7067. const Qt = D2("lst");
  7068. class hs {
  7069. constructor(e, t) {
  7070. this.onValueChange_ = this.onValueChange_.bind(this), this.props_ = t.props, this.element = e.createElement("div"), this.element.classList.add(Qt()), t.viewProps.bindClassModifiers(this.element);
  7071. const l = e.createElement("select");
  7072. l.classList.add(Qt("s")), O(this.props_, "options", (E) => {
  7073. pn(l), E.forEach((k, B) => {
  7074. const Q = e.createElement("option");
  7075. Q.dataset.index = String(B), Q.textContent = k.text, Q.value = String(k.value), l.appendChild(Q);
  7076. });
  7077. }), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.selectElement = l;
  7078. const b = e.createElement("div");
  7079. b.classList.add(Qt("m")), b.appendChild(xt(e, "dropdown")), this.element.appendChild(b), t.value.emitter.on("change", this.onValueChange_), this.value_ = t.value, this.update_();
  7080. }
  7081. update_() {
  7082. this.selectElement.value = String(this.value_.rawValue);
  7083. }
  7084. onValueChange_() {
  7085. this.update_();
  7086. }
  7087. }
  7088. class _n {
  7089. constructor(e, t) {
  7090. this.onSelectChange_ = this.onSelectChange_.bind(this), this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new hs(e, {
  7091. props: this.props,
  7092. value: this.value,
  7093. viewProps: this.viewProps
  7094. }), this.view.selectElement.addEventListener("change", this.onSelectChange_);
  7095. }
  7096. onSelectChange_(e) {
  7097. const l = e.currentTarget.selectedOptions.item(0);
  7098. if (!l)
  7099. return;
  7100. const b = Number(l.dataset.index);
  7101. this.value.rawValue = this.props.get("options")[b].value;
  7102. }
  7103. }
  7104. const ds = D2("pop");
  7105. class hr {
  7106. constructor(e, t) {
  7107. this.element = e.createElement("div"), this.element.classList.add(ds()), t.viewProps.bindClassModifiers(this.element), N(t.shows, K(this.element, ds(void 0, "v")));
  7108. }
  7109. }
  7110. class ms {
  7111. constructor(e, t) {
  7112. this.shows = ee(false), this.viewProps = t.viewProps, this.view = new hr(e, {
  7113. shows: this.shows,
  7114. viewProps: this.viewProps
  7115. });
  7116. }
  7117. }
  7118. const fs = D2("txt");
  7119. class dr {
  7120. constructor(e, t) {
  7121. this.onChange_ = this.onChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(fs()), t.viewProps.bindClassModifiers(this.element), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_);
  7122. const l = e.createElement("input");
  7123. l.classList.add(fs("i")), l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, t.value.emitter.on("change", this.onChange_), this.value_ = t.value, this.refresh();
  7124. }
  7125. refresh() {
  7126. const e = this.props_.get("formatter");
  7127. this.inputElement.value = e(this.value_.rawValue);
  7128. }
  7129. onChange_() {
  7130. this.refresh();
  7131. }
  7132. }
  7133. class Wn {
  7134. constructor(e, t) {
  7135. 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 dr(e, {
  7136. props: t.props,
  7137. value: this.value,
  7138. viewProps: this.viewProps
  7139. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7140. }
  7141. onInputChange_(e) {
  7142. const l = e.currentTarget.value, b = this.parser_(l);
  7143. _(b) || (this.value.rawValue = b), this.view.refresh();
  7144. }
  7145. }
  7146. function mr(i) {
  7147. return String(i);
  7148. }
  7149. function vs(i) {
  7150. return i === "false" ? false : !!i;
  7151. }
  7152. function bs(i) {
  7153. return mr(i);
  7154. }
  7155. class fr {
  7156. constructor(e) {
  7157. this.text = e;
  7158. }
  7159. evaluate() {
  7160. return Number(this.text);
  7161. }
  7162. toString() {
  7163. return this.text;
  7164. }
  7165. }
  7166. const vr = {
  7167. "**": (i, e) => Math.pow(i, e),
  7168. "*": (i, e) => i * e,
  7169. "/": (i, e) => i / e,
  7170. "%": (i, e) => i % e,
  7171. "+": (i, e) => i + e,
  7172. "-": (i, e) => i - e,
  7173. "<<": (i, e) => i << e,
  7174. ">>": (i, e) => i >> e,
  7175. ">>>": (i, e) => i >>> e,
  7176. "&": (i, e) => i & e,
  7177. "^": (i, e) => i ^ e,
  7178. "|": (i, e) => i | e
  7179. };
  7180. class br {
  7181. constructor(e, t, l) {
  7182. this.left = t, this.operator = e, this.right = l;
  7183. }
  7184. evaluate() {
  7185. const e = vr[this.operator];
  7186. if (!e)
  7187. throw new Error(`unexpected binary operator: '${this.operator}`);
  7188. return e(this.left.evaluate(), this.right.evaluate());
  7189. }
  7190. toString() {
  7191. return [
  7192. "b(",
  7193. this.left.toString(),
  7194. this.operator,
  7195. this.right.toString(),
  7196. ")"
  7197. ].join(" ");
  7198. }
  7199. }
  7200. const gs = {
  7201. "+": (i) => i,
  7202. "-": (i) => -i,
  7203. "~": (i) => ~i
  7204. };
  7205. class gr {
  7206. constructor(e, t) {
  7207. this.operator = e, this.expression = t;
  7208. }
  7209. evaluate() {
  7210. const e = gs[this.operator];
  7211. if (!e)
  7212. throw new Error(`unexpected unary operator: '${this.operator}`);
  7213. return e(this.expression.evaluate());
  7214. }
  7215. toString() {
  7216. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  7217. }
  7218. }
  7219. function Ti(i) {
  7220. return (e, t) => {
  7221. for (let l = 0; l < i.length; l++) {
  7222. const b = i[l](e, t);
  7223. if (b !== "")
  7224. return b;
  7225. }
  7226. return "";
  7227. };
  7228. }
  7229. function Rt(i, e) {
  7230. var t;
  7231. const l = i.substr(e).match(/^\s+/);
  7232. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7233. }
  7234. function _r(i, e) {
  7235. const t = i.substr(e, 1);
  7236. return t.match(/^[1-9]$/) ? t : "";
  7237. }
  7238. function wn(i, e) {
  7239. var t;
  7240. const l = i.substr(e).match(/^[0-9]+/);
  7241. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7242. }
  7243. function wr(i, e) {
  7244. const t = wn(i, e);
  7245. if (t !== "")
  7246. return t;
  7247. const l = i.substr(e, 1);
  7248. if (e += 1, l !== "-" && l !== "+")
  7249. return "";
  7250. const b = wn(i, e);
  7251. return b === "" ? "" : l + b;
  7252. }
  7253. function at(i, e) {
  7254. const t = i.substr(e, 1);
  7255. if (e += 1, t.toLowerCase() !== "e")
  7256. return "";
  7257. const l = wr(i, e);
  7258. return l === "" ? "" : t + l;
  7259. }
  7260. function _s(i, e) {
  7261. const t = i.substr(e, 1);
  7262. if (t === "0")
  7263. return t;
  7264. const l = _r(i, e);
  7265. return e += l.length, l === "" ? "" : l + wn(i, e);
  7266. }
  7267. function yr(i, e) {
  7268. const t = _s(i, e);
  7269. if (e += t.length, t === "")
  7270. return "";
  7271. const l = i.substr(e, 1);
  7272. if (e += l.length, l !== ".")
  7273. return "";
  7274. const b = wn(i, e);
  7275. return e += b.length, t + l + b + at(i, e);
  7276. }
  7277. function ws(i, e) {
  7278. const t = i.substr(e, 1);
  7279. if (e += t.length, t !== ".")
  7280. return "";
  7281. const l = wn(i, e);
  7282. return e += l.length, l === "" ? "" : t + l + at(i, e);
  7283. }
  7284. function xr(i, e) {
  7285. const t = _s(i, e);
  7286. return e += t.length, t === "" ? "" : t + at(i, e);
  7287. }
  7288. const ys = Ti([
  7289. yr,
  7290. ws,
  7291. xr
  7292. ]);
  7293. function ki(i, e) {
  7294. var t;
  7295. const l = i.substr(e).match(/^[01]+/);
  7296. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7297. }
  7298. function Er(i, e) {
  7299. const t = i.substr(e, 2);
  7300. if (e += t.length, t.toLowerCase() !== "0b")
  7301. return "";
  7302. const l = ki(i, e);
  7303. return l === "" ? "" : t + l;
  7304. }
  7305. function xs(i, e) {
  7306. var t;
  7307. const l = i.substr(e).match(/^[0-7]+/);
  7308. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7309. }
  7310. function Qe(i, e) {
  7311. const t = i.substr(e, 2);
  7312. if (e += t.length, t.toLowerCase() !== "0o")
  7313. return "";
  7314. const l = xs(i, e);
  7315. return l === "" ? "" : t + l;
  7316. }
  7317. function Cr(i, e) {
  7318. var t;
  7319. const l = i.substr(e).match(/^[0-9a-f]+/i);
  7320. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7321. }
  7322. function Pr(i, e) {
  7323. const t = i.substr(e, 2);
  7324. if (e += t.length, t.toLowerCase() !== "0x")
  7325. return "";
  7326. const l = Cr(i, e);
  7327. return l === "" ? "" : t + l;
  7328. }
  7329. const Mi = Ti([
  7330. Er,
  7331. Qe,
  7332. Pr
  7333. ]), Tr = Ti([
  7334. Mi,
  7335. ys
  7336. ]);
  7337. function Ct(i, e) {
  7338. const t = Tr(i, e);
  7339. return e += t.length, t === "" ? null : {
  7340. evaluable: new fr(t),
  7341. cursor: e
  7342. };
  7343. }
  7344. function Si(i, e) {
  7345. const t = i.substr(e, 1);
  7346. if (e += t.length, t !== "(")
  7347. return null;
  7348. const l = Jn(i, e);
  7349. if (!l)
  7350. return null;
  7351. e = l.cursor, e += Rt(i, e).length;
  7352. const b = i.substr(e, 1);
  7353. return e += b.length, b !== ")" ? null : {
  7354. evaluable: l.evaluable,
  7355. cursor: e
  7356. };
  7357. }
  7358. function kr(i, e) {
  7359. var t;
  7360. return (t = Ct(i, e)) !== null && t !== void 0 ? t : Si(i, e);
  7361. }
  7362. function Li(i, e) {
  7363. const t = kr(i, e);
  7364. if (t)
  7365. return t;
  7366. const l = i.substr(e, 1);
  7367. if (e += l.length, l !== "+" && l !== "-" && l !== "~")
  7368. return null;
  7369. const b = Li(i, e);
  7370. return b ? (e = b.cursor, {
  7371. cursor: e,
  7372. evaluable: new gr(l, b.evaluable)
  7373. }) : null;
  7374. }
  7375. function Mr(i, e, t) {
  7376. t += Rt(e, t).length;
  7377. const l = i.filter((b) => e.startsWith(b, t))[0];
  7378. return l ? (t += l.length, t += Rt(e, t).length, {
  7379. cursor: t,
  7380. operator: l
  7381. }) : null;
  7382. }
  7383. function It(i, e) {
  7384. return (t, l) => {
  7385. const b = i(t, l);
  7386. if (!b)
  7387. return null;
  7388. l = b.cursor;
  7389. let E = b.evaluable;
  7390. for (; ; ) {
  7391. const k = Mr(e, t, l);
  7392. if (!k)
  7393. break;
  7394. l = k.cursor;
  7395. const B = i(t, l);
  7396. if (!B)
  7397. return null;
  7398. l = B.cursor, E = new br(k.operator, E, B.evaluable);
  7399. }
  7400. return E ? {
  7401. cursor: l,
  7402. evaluable: E
  7403. } : null;
  7404. };
  7405. }
  7406. const Es = [
  7407. ["**"],
  7408. ["*", "/", "%"],
  7409. ["+", "-"],
  7410. ["<<", ">>>", ">>"],
  7411. ["&"],
  7412. ["^"],
  7413. ["|"]
  7414. ].reduce((i, e) => It(i, e), Li);
  7415. function Jn(i, e) {
  7416. return e += Rt(i, e).length, Es(i, e);
  7417. }
  7418. function Cs(i) {
  7419. const e = Jn(i, 0);
  7420. return !e || e.cursor + Rt(i, e.cursor).length !== i.length ? null : e.evaluable;
  7421. }
  7422. function lt(i) {
  7423. var e;
  7424. const t = Cs(i);
  7425. return (e = t == null ? void 0 : t.evaluate()) !== null && e !== void 0 ? e : null;
  7426. }
  7427. function bt(i) {
  7428. if (typeof i == "number")
  7429. return i;
  7430. if (typeof i == "string") {
  7431. const e = lt(i);
  7432. if (!_(e))
  7433. return e;
  7434. }
  7435. return 0;
  7436. }
  7437. function Sr(i) {
  7438. return String(i);
  7439. }
  7440. function Ie(i) {
  7441. return (e) => e.toFixed(Math.max(Math.min(i, 20), 0));
  7442. }
  7443. const Ps = Ie(0);
  7444. function yn(i) {
  7445. return Ps(i) + "%";
  7446. }
  7447. function Ai(i) {
  7448. return String(i);
  7449. }
  7450. function Pt(i) {
  7451. return i;
  7452. }
  7453. function Zt({ primary: i, secondary: e, forward: t, backward: l }) {
  7454. let b = false;
  7455. function E(k) {
  7456. b || (b = true, k(), b = false);
  7457. }
  7458. i.emitter.on("change", (k) => {
  7459. E(() => {
  7460. e.setRawValue(t(i, e), k.options);
  7461. });
  7462. }), e.emitter.on("change", (k) => {
  7463. E(() => {
  7464. i.setRawValue(l(i, e), k.options);
  7465. }), E(() => {
  7466. e.setRawValue(t(i, e), k.options);
  7467. });
  7468. }), E(() => {
  7469. e.setRawValue(t(i, e), {
  7470. forceEmit: false,
  7471. last: true
  7472. });
  7473. });
  7474. }
  7475. function Oe(i, e) {
  7476. const t = i * (e.altKey ? 0.1 : 1) * (e.shiftKey ? 10 : 1);
  7477. return e.upKey ? +t : e.downKey ? -t : 0;
  7478. }
  7479. function xn(i) {
  7480. return {
  7481. altKey: i.altKey,
  7482. downKey: i.key === "ArrowDown",
  7483. shiftKey: i.shiftKey,
  7484. upKey: i.key === "ArrowUp"
  7485. };
  7486. }
  7487. function ct(i) {
  7488. return {
  7489. altKey: i.altKey,
  7490. downKey: i.key === "ArrowLeft",
  7491. shiftKey: i.shiftKey,
  7492. upKey: i.key === "ArrowRight"
  7493. };
  7494. }
  7495. function Ts(i) {
  7496. return i === "ArrowUp" || i === "ArrowDown";
  7497. }
  7498. function ei(i) {
  7499. return Ts(i) || i === "ArrowLeft" || i === "ArrowRight";
  7500. }
  7501. function Ri(i, e) {
  7502. var t, l;
  7503. const b = e.ownerDocument.defaultView, E = e.getBoundingClientRect();
  7504. return {
  7505. x: i.pageX - (((t = b && b.scrollX) !== null && t !== void 0 ? t : 0) + E.left),
  7506. y: i.pageY - (((l = b && b.scrollY) !== null && l !== void 0 ? l : 0) + E.top)
  7507. };
  7508. }
  7509. class Vt {
  7510. constructor(e) {
  7511. 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_, {
  7512. passive: false
  7513. }), e.addEventListener("touchmove", this.onTouchMove_, {
  7514. passive: true
  7515. }), e.addEventListener("touchend", this.onTouchEnd_), e.addEventListener("mousedown", this.onMouseDown_);
  7516. }
  7517. computePosition_(e) {
  7518. const t = this.elem_.getBoundingClientRect();
  7519. return {
  7520. bounds: {
  7521. width: t.width,
  7522. height: t.height
  7523. },
  7524. point: e ? {
  7525. x: e.x,
  7526. y: e.y
  7527. } : null
  7528. };
  7529. }
  7530. onMouseDown_(e) {
  7531. var t;
  7532. e.preventDefault(), (t = e.currentTarget) === null || t === void 0 || t.focus();
  7533. const l = this.elem_.ownerDocument;
  7534. l.addEventListener("mousemove", this.onDocumentMouseMove_), l.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  7535. altKey: e.altKey,
  7536. data: this.computePosition_(Ri(e, this.elem_)),
  7537. sender: this,
  7538. shiftKey: e.shiftKey
  7539. });
  7540. }
  7541. onDocumentMouseMove_(e) {
  7542. this.emitter.emit("move", {
  7543. altKey: e.altKey,
  7544. data: this.computePosition_(Ri(e, this.elem_)),
  7545. sender: this,
  7546. shiftKey: e.shiftKey
  7547. });
  7548. }
  7549. onDocumentMouseUp_(e) {
  7550. const t = this.elem_.ownerDocument;
  7551. t.removeEventListener("mousemove", this.onDocumentMouseMove_), t.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  7552. altKey: e.altKey,
  7553. data: this.computePosition_(Ri(e, this.elem_)),
  7554. sender: this,
  7555. shiftKey: e.shiftKey
  7556. });
  7557. }
  7558. onTouchStart_(e) {
  7559. e.preventDefault();
  7560. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  7561. this.emitter.emit("down", {
  7562. altKey: e.altKey,
  7563. data: this.computePosition_(t ? {
  7564. x: t.clientX - l.left,
  7565. y: t.clientY - l.top
  7566. } : void 0),
  7567. sender: this,
  7568. shiftKey: e.shiftKey
  7569. }), this.lastTouch_ = t;
  7570. }
  7571. onTouchMove_(e) {
  7572. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  7573. this.emitter.emit("move", {
  7574. altKey: e.altKey,
  7575. data: this.computePosition_(t ? {
  7576. x: t.clientX - l.left,
  7577. y: t.clientY - l.top
  7578. } : void 0),
  7579. sender: this,
  7580. shiftKey: e.shiftKey
  7581. }), this.lastTouch_ = t;
  7582. }
  7583. onTouchEnd_(e) {
  7584. var t;
  7585. const l = (t = e.targetTouches.item(0)) !== null && t !== void 0 ? t : this.lastTouch_, b = this.elem_.getBoundingClientRect();
  7586. this.emitter.emit("up", {
  7587. altKey: e.altKey,
  7588. data: this.computePosition_(l ? {
  7589. x: l.clientX - b.left,
  7590. y: l.clientY - b.top
  7591. } : void 0),
  7592. sender: this,
  7593. shiftKey: e.shiftKey
  7594. });
  7595. }
  7596. }
  7597. function _e(i, e, t, l, b) {
  7598. const E = (i - e) / (t - e);
  7599. return l + E * (b - l);
  7600. }
  7601. function Ii(i) {
  7602. return String(i.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  7603. }
  7604. function Se(i, e, t) {
  7605. return Math.min(Math.max(i, e), t);
  7606. }
  7607. function Wt(i, e) {
  7608. return (i % e + e) % e;
  7609. }
  7610. const He = D2("txt");
  7611. class Vi {
  7612. constructor(e, t) {
  7613. 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);
  7614. const l = e.createElement("input");
  7615. 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"));
  7616. const b = e.createElement("div");
  7617. b.classList.add(He("k")), this.element.appendChild(b), this.knobElement = b;
  7618. const E = e.createElementNS(ze, "svg");
  7619. E.classList.add(He("g")), this.knobElement.appendChild(E);
  7620. const k = e.createElementNS(ze, "path");
  7621. k.classList.add(He("gb")), E.appendChild(k), this.guideBodyElem_ = k;
  7622. const B = e.createElementNS(ze, "path");
  7623. B.classList.add(He("gh")), E.appendChild(B), this.guideHeadElem_ = B;
  7624. const Q = e.createElement("div");
  7625. Q.classList.add(D2("tt")()), this.knobElement.appendChild(Q), this.tooltipElem_ = Q, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.refresh();
  7626. }
  7627. onDraggingChange_(e) {
  7628. if (e.rawValue === null) {
  7629. this.element.classList.remove(He(void 0, "drg"));
  7630. return;
  7631. }
  7632. this.element.classList.add(He(void 0, "drg"));
  7633. const t = e.rawValue / this.props_.get("draggingScale"), l = t + (t > 0 ? -1 : t < 0 ? 1 : 0), b = Se(-l, -4, 4);
  7634. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${l + b},0 L${l},4 L${l + b},8`, `M ${t},-1 L${t},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${t},4`);
  7635. const E = this.props_.get("formatter");
  7636. this.tooltipElem_.textContent = E(this.value.rawValue), this.tooltipElem_.style.left = `${t}px`;
  7637. }
  7638. refresh() {
  7639. const e = this.props_.get("formatter");
  7640. this.inputElement.value = e(this.value.rawValue);
  7641. }
  7642. onChange_() {
  7643. this.refresh();
  7644. }
  7645. }
  7646. class En {
  7647. constructor(e, t) {
  7648. var l;
  7649. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = t.baseStep, this.parser_ = t.parser, this.props = t.props, this.sliderProps_ = (l = t.sliderProps) !== null && l !== void 0 ? l : null, this.value = t.value, this.viewProps = t.viewProps, this.dragging_ = ee(null), this.view = new Vi(e, {
  7650. arrayPosition: t.arrayPosition,
  7651. dragging: this.dragging_,
  7652. props: this.props,
  7653. value: this.value,
  7654. viewProps: this.viewProps
  7655. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  7656. const b = new Vt(this.view.knobElement);
  7657. b.emitter.on("down", this.onPointerDown_), b.emitter.on("move", this.onPointerMove_), b.emitter.on("up", this.onPointerUp_);
  7658. }
  7659. constrainValue_(e) {
  7660. var t, l;
  7661. const b = (t = this.sliderProps_) === null || t === void 0 ? void 0 : t.get("minValue"), E = (l = this.sliderProps_) === null || l === void 0 ? void 0 : l.get("maxValue");
  7662. let k = e;
  7663. return b !== void 0 && (k = Math.max(k, b)), E !== void 0 && (k = Math.min(k, E)), k;
  7664. }
  7665. onInputChange_(e) {
  7666. const l = e.currentTarget.value, b = this.parser_(l);
  7667. _(b) || (this.value.rawValue = this.constrainValue_(b)), this.view.refresh();
  7668. }
  7669. onInputKeyDown_(e) {
  7670. const t = Oe(this.baseStep_, xn(e));
  7671. t !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + t), {
  7672. forceEmit: false,
  7673. last: false
  7674. });
  7675. }
  7676. onInputKeyUp_(e) {
  7677. Oe(this.baseStep_, xn(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  7678. forceEmit: true,
  7679. last: true
  7680. });
  7681. }
  7682. onPointerDown_() {
  7683. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  7684. }
  7685. computeDraggingValue_(e) {
  7686. if (!e.point)
  7687. return null;
  7688. const t = e.point.x - e.bounds.width / 2;
  7689. return this.constrainValue_(this.originRawValue_ + t * this.props.get("draggingScale"));
  7690. }
  7691. onPointerMove_(e) {
  7692. const t = this.computeDraggingValue_(e.data);
  7693. t !== null && (this.value.setRawValue(t, {
  7694. forceEmit: false,
  7695. last: false
  7696. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  7697. }
  7698. onPointerUp_(e) {
  7699. const t = this.computeDraggingValue_(e.data);
  7700. t !== null && (this.value.setRawValue(t, {
  7701. forceEmit: true,
  7702. last: true
  7703. }), this.dragging_.rawValue = null);
  7704. }
  7705. }
  7706. const Di = D2("sld");
  7707. class Ke {
  7708. constructor(e, t) {
  7709. this.onChange_ = this.onChange_.bind(this), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_), this.element = e.createElement("div"), this.element.classList.add(Di()), t.viewProps.bindClassModifiers(this.element);
  7710. const l = e.createElement("div");
  7711. l.classList.add(Di("t")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.trackElement = l;
  7712. const b = e.createElement("div");
  7713. b.classList.add(Di("k")), this.trackElement.appendChild(b), this.knobElement = b, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.update_();
  7714. }
  7715. update_() {
  7716. const e = Se(_e(this.value.rawValue, this.props_.get("minValue"), this.props_.get("maxValue"), 0, 100), 0, 100);
  7717. this.knobElement.style.width = `${e}%`;
  7718. }
  7719. onChange_() {
  7720. this.update_();
  7721. }
  7722. }
  7723. class Oi {
  7724. constructor(e, t) {
  7725. 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 Ke(e, {
  7726. props: this.props,
  7727. value: this.value,
  7728. viewProps: this.viewProps
  7729. }), 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_);
  7730. }
  7731. handlePointerEvent_(e, t) {
  7732. 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);
  7733. }
  7734. onPointerDownOrMove_(e) {
  7735. this.handlePointerEvent_(e.data, {
  7736. forceEmit: false,
  7737. last: false
  7738. });
  7739. }
  7740. onPointerUp_(e) {
  7741. this.handlePointerEvent_(e.data, {
  7742. forceEmit: true,
  7743. last: true
  7744. });
  7745. }
  7746. onKeyDown_(e) {
  7747. const t = Oe(this.baseStep_, ct(e));
  7748. t !== 0 && this.value.setRawValue(this.value.rawValue + t, {
  7749. forceEmit: false,
  7750. last: false
  7751. });
  7752. }
  7753. onKeyUp_(e) {
  7754. Oe(this.baseStep_, ct(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  7755. forceEmit: true,
  7756. last: true
  7757. });
  7758. }
  7759. }
  7760. const Cn = D2("sldtxt");
  7761. class Ni {
  7762. constructor(e, t) {
  7763. this.element = e.createElement("div"), this.element.classList.add(Cn());
  7764. const l = e.createElement("div");
  7765. l.classList.add(Cn("s")), this.sliderView_ = t.sliderView, l.appendChild(this.sliderView_.element), this.element.appendChild(l);
  7766. const b = e.createElement("div");
  7767. b.classList.add(Cn("t")), this.textView_ = t.textView, b.appendChild(this.textView_.element), this.element.appendChild(b);
  7768. }
  7769. }
  7770. class ti {
  7771. constructor(e, t) {
  7772. this.value = t.value, this.viewProps = t.viewProps, this.sliderC_ = new Oi(e, {
  7773. baseStep: t.baseStep,
  7774. props: t.sliderProps,
  7775. value: t.value,
  7776. viewProps: this.viewProps
  7777. }), this.textC_ = new En(e, {
  7778. baseStep: t.baseStep,
  7779. parser: t.parser,
  7780. props: t.textProps,
  7781. sliderProps: t.sliderProps,
  7782. value: t.value,
  7783. viewProps: t.viewProps
  7784. }), this.view = new Ni(e, {
  7785. sliderView: this.sliderC_.view,
  7786. textView: this.textC_.view
  7787. });
  7788. }
  7789. get sliderController() {
  7790. return this.sliderC_;
  7791. }
  7792. get textController() {
  7793. return this.textC_;
  7794. }
  7795. }
  7796. function nt(i, e) {
  7797. i.write(e);
  7798. }
  7799. function Pn(i) {
  7800. const e = M;
  7801. if (Array.isArray(i))
  7802. return e.required.array(e.required.object({
  7803. text: e.required.string,
  7804. value: e.required.raw
  7805. }))(i).value;
  7806. if (typeof i == "object")
  7807. return e.required.raw(i).value;
  7808. }
  7809. function Fi(i) {
  7810. if (i === "inline" || i === "popup")
  7811. return i;
  7812. }
  7813. function gt(i) {
  7814. const e = M;
  7815. return e.required.object({
  7816. max: e.optional.number,
  7817. min: e.optional.number,
  7818. step: e.optional.number
  7819. })(i).value;
  7820. }
  7821. function ks(i) {
  7822. if (Array.isArray(i))
  7823. return i;
  7824. const e = [];
  7825. return Object.keys(i).forEach((t) => {
  7826. e.push({ text: t, value: i[t] });
  7827. }), e;
  7828. }
  7829. function Bi(i) {
  7830. return _(i) ? null : new gn(ks(i));
  7831. }
  7832. function Lr(i) {
  7833. const e = i ? tt(i, Zn) : null;
  7834. return e ? e.step : null;
  7835. }
  7836. function ni(i, e) {
  7837. const t = i && tt(i, Zn);
  7838. return t ? Ii(t.step) : Math.max(Ii(e), 2);
  7839. }
  7840. function Dt(i) {
  7841. const e = Lr(i);
  7842. return e ?? 1;
  7843. }
  7844. function Ot(i, e) {
  7845. var t;
  7846. const l = i && tt(i, Zn), b = Math.abs((t = l == null ? void 0 : l.step) !== null && t !== void 0 ? t : e);
  7847. return b === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(b)) - 1);
  7848. }
  7849. const Tn = D2("ckb");
  7850. class kn {
  7851. constructor(e, t) {
  7852. this.onValueChange_ = this.onValueChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(Tn()), t.viewProps.bindClassModifiers(this.element);
  7853. const l = e.createElement("label");
  7854. l.classList.add(Tn("l")), this.element.appendChild(l);
  7855. const b = e.createElement("input");
  7856. b.classList.add(Tn("i")), b.type = "checkbox", l.appendChild(b), this.inputElement = b, t.viewProps.bindDisabled(this.inputElement);
  7857. const E = e.createElement("div");
  7858. E.classList.add(Tn("w")), l.appendChild(E);
  7859. const k = xt(e, "check");
  7860. E.appendChild(k), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  7861. }
  7862. update_() {
  7863. this.inputElement.checked = this.value.rawValue;
  7864. }
  7865. onValueChange_() {
  7866. this.update_();
  7867. }
  7868. }
  7869. class Ms {
  7870. constructor(e, t) {
  7871. this.onInputChange_ = this.onInputChange_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new kn(e, {
  7872. value: this.value,
  7873. viewProps: this.viewProps
  7874. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7875. }
  7876. onInputChange_(e) {
  7877. const t = e.currentTarget;
  7878. this.value.rawValue = t.checked;
  7879. }
  7880. }
  7881. function Ss(i) {
  7882. const e = [], t = Bi(i.options);
  7883. return t && e.push(t), new bn(e);
  7884. }
  7885. const ii = {
  7886. id: "input-bool",
  7887. type: "input",
  7888. accept: (i, e) => {
  7889. if (typeof i != "boolean")
  7890. return null;
  7891. const l = le(e, {
  7892. options: M.optional.custom(Pn)
  7893. });
  7894. return l ? {
  7895. initialValue: i,
  7896. params: l
  7897. } : null;
  7898. },
  7899. binding: {
  7900. reader: (i) => vs,
  7901. constraint: (i) => Ss(i.params),
  7902. writer: (i) => nt
  7903. },
  7904. controller: (i) => {
  7905. const e = i.document, t = i.value, l = i.constraint, b = l && tt(l, gn);
  7906. return b ? new _n(e, {
  7907. props: new X({
  7908. options: b.values.value("options")
  7909. }),
  7910. value: t,
  7911. viewProps: i.viewProps
  7912. }) : new Ms(e, {
  7913. value: t,
  7914. viewProps: i.viewProps
  7915. });
  7916. }
  7917. }, Nt = D2("col");
  7918. class ji {
  7919. constructor(e, t) {
  7920. 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")));
  7921. const l = e.createElement("div");
  7922. l.classList.add(Nt("h")), this.element.appendChild(l);
  7923. const b = e.createElement("div");
  7924. b.classList.add(Nt("s")), l.appendChild(b), this.swatchElement = b;
  7925. const E = e.createElement("div");
  7926. if (E.classList.add(Nt("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  7927. const k = e.createElement("div");
  7928. k.classList.add(Nt("p")), this.element.appendChild(k), this.pickerElement = k;
  7929. } else
  7930. this.pickerElement = null;
  7931. }
  7932. }
  7933. function Ar(i, e, t) {
  7934. const l = Se(i / 255, 0, 1), b = Se(e / 255, 0, 1), E = Se(t / 255, 0, 1), k = Math.max(l, b, E), B = Math.min(l, b, E), Q = k - B;
  7935. let J = 0, de = 0;
  7936. const ve = (B + k) / 2;
  7937. return Q !== 0 && (de = Q / (1 - Math.abs(k + B - 1)), l === k ? J = (b - E) / Q : b === k ? J = 2 + (E - l) / Q : J = 4 + (l - b) / Q, J = J / 6 + (J < 0 ? 1 : 0)), [J * 360, de * 100, ve * 100];
  7938. }
  7939. function Rr(i, e, t) {
  7940. const l = (i % 360 + 360) % 360, b = Se(e / 100, 0, 1), E = Se(t / 100, 0, 1), k = (1 - Math.abs(2 * E - 1)) * b, B = k * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k / 2;
  7941. let J, de, ve;
  7942. return l >= 0 && l < 60 ? [J, de, ve] = [k, B, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B, k, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, k, B] : l >= 180 && l < 240 ? [J, de, ve] = [0, B, k] : l >= 240 && l < 300 ? [J, de, ve] = [B, 0, k] : [J, de, ve] = [k, 0, B], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  7943. }
  7944. function Ir(i, e, t) {
  7945. const l = Se(i / 255, 0, 1), b = Se(e / 255, 0, 1), E = Se(t / 255, 0, 1), k = Math.max(l, b, E), B = Math.min(l, b, E), Q = k - B;
  7946. let J;
  7947. Q === 0 ? J = 0 : k === l ? J = 60 * (((b - E) / Q % 6 + 6) % 6) : k === b ? J = 60 * ((E - l) / Q + 2) : J = 60 * ((l - b) / Q + 4);
  7948. const de = k === 0 ? 0 : Q / k, ve = k;
  7949. return [J, de * 100, ve * 100];
  7950. }
  7951. function Ls(i, e, t) {
  7952. const l = Wt(i, 360), b = Se(e / 100, 0, 1), E = Se(t / 100, 0, 1), k = E * b, B = k * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k;
  7953. let J, de, ve;
  7954. return l >= 0 && l < 60 ? [J, de, ve] = [k, B, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B, k, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, k, B] : l >= 180 && l < 240 ? [J, de, ve] = [0, B, k] : l >= 240 && l < 300 ? [J, de, ve] = [B, 0, k] : [J, de, ve] = [k, 0, B], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  7955. }
  7956. function m(i, e, t) {
  7957. const l = t + e * (100 - Math.abs(2 * t - 100)) / 200;
  7958. return [
  7959. i,
  7960. l !== 0 ? e * (100 - Math.abs(2 * t - 100)) / l : 0,
  7961. t + e * (100 - Math.abs(2 * t - 100)) / (2 * 100)
  7962. ];
  7963. }
  7964. function o(i, e, t) {
  7965. const l = 100 - Math.abs(t * (200 - e) / 100 - 100);
  7966. return [i, l !== 0 ? e * t / l : 0, t * (200 - e) / (2 * 100)];
  7967. }
  7968. function u(i) {
  7969. return [i[0], i[1], i[2]];
  7970. }
  7971. function f(i, e) {
  7972. return [i[0], i[1], i[2], e];
  7973. }
  7974. const x = {
  7975. hsl: {
  7976. hsl: (i, e, t) => [i, e, t],
  7977. hsv: m,
  7978. rgb: Rr
  7979. },
  7980. hsv: {
  7981. hsl: o,
  7982. hsv: (i, e, t) => [i, e, t],
  7983. rgb: Ls
  7984. },
  7985. rgb: {
  7986. hsl: Ar,
  7987. hsv: Ir,
  7988. rgb: (i, e, t) => [i, e, t]
  7989. }
  7990. };
  7991. function T(i, e) {
  7992. return [
  7993. e === "float" ? 1 : i === "rgb" ? 255 : 360,
  7994. e === "float" ? 1 : i === "rgb" ? 255 : 100,
  7995. e === "float" ? 1 : i === "rgb" ? 255 : 100
  7996. ];
  7997. }
  7998. function A(i, e) {
  7999. return i === e ? e : Wt(i, e);
  8000. }
  8001. function z(i, e, t) {
  8002. var l;
  8003. const b = T(e, t);
  8004. return [
  8005. e === "rgb" ? Se(i[0], 0, b[0]) : A(i[0], b[0]),
  8006. Se(i[1], 0, b[1]),
  8007. Se(i[2], 0, b[2]),
  8008. Se((l = i[3]) !== null && l !== void 0 ? l : 1, 0, 1)
  8009. ];
  8010. }
  8011. function oe(i, e, t, l) {
  8012. const b = T(e, t), E = T(e, l);
  8013. return i.map((k, B) => k / b[B] * E[B]);
  8014. }
  8015. function Ze(i, e, t) {
  8016. const l = oe(i, e.mode, e.type, "int"), b = x[e.mode][t.mode](...l);
  8017. return oe(b, t.mode, "int", t.type);
  8018. }
  8019. function We(i, e) {
  8020. return typeof i != "object" || _(i) ? false : e in i && typeof i[e] == "number";
  8021. }
  8022. class te {
  8023. static black(e = "int") {
  8024. return new te([0, 0, 0], "rgb", e);
  8025. }
  8026. static fromObject(e, t = "int") {
  8027. const l = "a" in e ? [e.r, e.g, e.b, e.a] : [e.r, e.g, e.b];
  8028. return new te(l, "rgb", t);
  8029. }
  8030. static toRgbaObject(e, t = "int") {
  8031. return e.toRgbaObject(t);
  8032. }
  8033. static isRgbColorObject(e) {
  8034. return We(e, "r") && We(e, "g") && We(e, "b");
  8035. }
  8036. static isRgbaColorObject(e) {
  8037. return this.isRgbColorObject(e) && We(e, "a");
  8038. }
  8039. static isColorObject(e) {
  8040. return this.isRgbColorObject(e);
  8041. }
  8042. static equals(e, t) {
  8043. if (e.mode !== t.mode)
  8044. return false;
  8045. const l = e.comps_, b = t.comps_;
  8046. for (let E = 0; E < l.length; E++)
  8047. if (l[E] !== b[E])
  8048. return false;
  8049. return true;
  8050. }
  8051. constructor(e, t, l = "int") {
  8052. this.mode = t, this.type = l, this.comps_ = z(e, t, l);
  8053. }
  8054. getComponents(e, t = "int") {
  8055. return f(Ze(u(this.comps_), { mode: this.mode, type: this.type }, { mode: e ?? this.mode, type: t }), this.comps_[3]);
  8056. }
  8057. toRgbaObject(e = "int") {
  8058. const t = this.getComponents("rgb", e);
  8059. return {
  8060. r: t[0],
  8061. g: t[1],
  8062. b: t[2],
  8063. a: t[3]
  8064. };
  8065. }
  8066. }
  8067. const Tt = D2("colp");
  8068. class Vr {
  8069. constructor(e, t) {
  8070. this.alphaViews_ = null, this.element = e.createElement("div"), this.element.classList.add(Tt()), t.viewProps.bindClassModifiers(this.element);
  8071. const l = e.createElement("div");
  8072. l.classList.add(Tt("hsv"));
  8073. const b = e.createElement("div");
  8074. b.classList.add(Tt("sv")), this.svPaletteView_ = t.svPaletteView, b.appendChild(this.svPaletteView_.element), l.appendChild(b);
  8075. const E = e.createElement("div");
  8076. E.classList.add(Tt("h")), this.hPaletteView_ = t.hPaletteView, E.appendChild(this.hPaletteView_.element), l.appendChild(E), this.element.appendChild(l);
  8077. const k = e.createElement("div");
  8078. if (k.classList.add(Tt("rgb")), this.textView_ = t.textView, k.appendChild(this.textView_.element), this.element.appendChild(k), t.alphaViews) {
  8079. this.alphaViews_ = {
  8080. palette: t.alphaViews.palette,
  8081. text: t.alphaViews.text
  8082. };
  8083. const B = e.createElement("div");
  8084. B.classList.add(Tt("a"));
  8085. const Q = e.createElement("div");
  8086. Q.classList.add(Tt("ap")), Q.appendChild(this.alphaViews_.palette.element), B.appendChild(Q);
  8087. const J = e.createElement("div");
  8088. J.classList.add(Tt("at")), J.appendChild(this.alphaViews_.text.element), B.appendChild(J), this.element.appendChild(B);
  8089. }
  8090. }
  8091. get allFocusableElements() {
  8092. const e = [
  8093. this.svPaletteView_.element,
  8094. this.hPaletteView_.element,
  8095. this.textView_.modeSelectElement,
  8096. ...this.textView_.textViews.map((t) => t.inputElement)
  8097. ];
  8098. return this.alphaViews_ && e.push(this.alphaViews_.palette.element, this.alphaViews_.text.inputElement), e;
  8099. }
  8100. }
  8101. function ll(i) {
  8102. return i === "int" ? "int" : i === "float" ? "float" : void 0;
  8103. }
  8104. function Dr(i) {
  8105. const e = M;
  8106. return le(i, {
  8107. alpha: e.optional.boolean,
  8108. color: e.optional.object({
  8109. alpha: e.optional.boolean,
  8110. type: e.optional.custom(ll)
  8111. }),
  8112. expanded: e.optional.boolean,
  8113. picker: e.optional.custom(Fi)
  8114. });
  8115. }
  8116. function Mn(i) {
  8117. return i ? 0.1 : 1;
  8118. }
  8119. function Sn(i) {
  8120. var e;
  8121. return (e = i.color) === null || e === void 0 ? void 0 : e.type;
  8122. }
  8123. function cl(i, e) {
  8124. return i.alpha === e.alpha && i.mode === e.mode && i.notation === e.notation && i.type === e.type;
  8125. }
  8126. function ut(i, e) {
  8127. const t = i.match(/^(.+)%$/);
  8128. return Math.min(t ? parseFloat(t[1]) * 0.01 * e : parseFloat(i), e);
  8129. }
  8130. const ul = {
  8131. deg: (i) => i,
  8132. grad: (i) => i * 360 / 400,
  8133. rad: (i) => i * 360 / (2 * Math.PI),
  8134. turn: (i) => i * 360
  8135. };
  8136. function Co(i) {
  8137. const e = i.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);
  8138. if (!e)
  8139. return parseFloat(i);
  8140. const t = parseFloat(e[1]), l = e[2];
  8141. return ul[l](t);
  8142. }
  8143. function Po(i) {
  8144. const e = i.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8145. if (!e)
  8146. return null;
  8147. const t = [
  8148. ut(e[1], 255),
  8149. ut(e[2], 255),
  8150. ut(e[3], 255)
  8151. ];
  8152. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8153. }
  8154. function To(i) {
  8155. return (e) => {
  8156. const t = Po(e);
  8157. return t ? new te(t, "rgb", i) : null;
  8158. };
  8159. }
  8160. function ko(i) {
  8161. const e = i.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8162. if (!e)
  8163. return null;
  8164. const t = [
  8165. ut(e[1], 255),
  8166. ut(e[2], 255),
  8167. ut(e[3], 255),
  8168. ut(e[4], 1)
  8169. ];
  8170. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8171. }
  8172. function Mo(i) {
  8173. return (e) => {
  8174. const t = ko(e);
  8175. return t ? new te(t, "rgb", i) : null;
  8176. };
  8177. }
  8178. function So(i) {
  8179. const e = i.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8180. if (!e)
  8181. return null;
  8182. const t = [
  8183. Co(e[1]),
  8184. ut(e[2], 100),
  8185. ut(e[3], 100)
  8186. ];
  8187. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8188. }
  8189. function Lo(i) {
  8190. return (e) => {
  8191. const t = So(e);
  8192. return t ? new te(t, "hsl", i) : null;
  8193. };
  8194. }
  8195. function Ao(i) {
  8196. const e = i.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8197. if (!e)
  8198. return null;
  8199. const t = [
  8200. Co(e[1]),
  8201. ut(e[2], 100),
  8202. ut(e[3], 100),
  8203. ut(e[4], 1)
  8204. ];
  8205. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8206. }
  8207. function Ro(i) {
  8208. return (e) => {
  8209. const t = Ao(e);
  8210. return t ? new te(t, "hsl", i) : null;
  8211. };
  8212. }
  8213. function Io(i) {
  8214. const e = i.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8215. if (e)
  8216. return [
  8217. parseInt(e[1] + e[1], 16),
  8218. parseInt(e[2] + e[2], 16),
  8219. parseInt(e[3] + e[3], 16)
  8220. ];
  8221. const t = i.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8222. return t ? [
  8223. parseInt(t[1], 16),
  8224. parseInt(t[2], 16),
  8225. parseInt(t[3], 16)
  8226. ] : null;
  8227. }
  8228. function pl(i) {
  8229. const e = Io(i);
  8230. return e ? new te(e, "rgb", "int") : null;
  8231. }
  8232. function Vo(i) {
  8233. const e = i.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8234. if (e)
  8235. return [
  8236. parseInt(e[1] + e[1], 16),
  8237. parseInt(e[2] + e[2], 16),
  8238. parseInt(e[3] + e[3], 16),
  8239. _e(parseInt(e[4] + e[4], 16), 0, 255, 0, 1)
  8240. ];
  8241. const t = i.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8242. return t ? [
  8243. parseInt(t[1], 16),
  8244. parseInt(t[2], 16),
  8245. parseInt(t[3], 16),
  8246. _e(parseInt(t[4], 16), 0, 255, 0, 1)
  8247. ] : null;
  8248. }
  8249. function hl(i) {
  8250. const e = Vo(i);
  8251. return e ? new te(e, "rgb", "int") : null;
  8252. }
  8253. function Do(i) {
  8254. const e = i.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8255. if (!e)
  8256. return null;
  8257. const t = [
  8258. parseFloat(e[1]),
  8259. parseFloat(e[2]),
  8260. parseFloat(e[3])
  8261. ];
  8262. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8263. }
  8264. function Oo(i) {
  8265. return (e) => {
  8266. const t = Do(e);
  8267. return t ? new te(t, "rgb", i) : null;
  8268. };
  8269. }
  8270. function No(i) {
  8271. const e = i.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8272. if (!e)
  8273. return null;
  8274. const t = [
  8275. parseFloat(e[1]),
  8276. parseFloat(e[2]),
  8277. parseFloat(e[3]),
  8278. parseFloat(e[4])
  8279. ];
  8280. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8281. }
  8282. function Fo(i) {
  8283. return (e) => {
  8284. const t = No(e);
  8285. return t ? new te(t, "rgb", i) : null;
  8286. };
  8287. }
  8288. const dl = [
  8289. {
  8290. parser: Io,
  8291. result: {
  8292. alpha: false,
  8293. mode: "rgb",
  8294. notation: "hex"
  8295. }
  8296. },
  8297. {
  8298. parser: Vo,
  8299. result: {
  8300. alpha: true,
  8301. mode: "rgb",
  8302. notation: "hex"
  8303. }
  8304. },
  8305. {
  8306. parser: Po,
  8307. result: {
  8308. alpha: false,
  8309. mode: "rgb",
  8310. notation: "func"
  8311. }
  8312. },
  8313. {
  8314. parser: ko,
  8315. result: {
  8316. alpha: true,
  8317. mode: "rgb",
  8318. notation: "func"
  8319. }
  8320. },
  8321. {
  8322. parser: So,
  8323. result: {
  8324. alpha: false,
  8325. mode: "hsl",
  8326. notation: "func"
  8327. }
  8328. },
  8329. {
  8330. parser: Ao,
  8331. result: {
  8332. alpha: true,
  8333. mode: "hsl",
  8334. notation: "func"
  8335. }
  8336. },
  8337. {
  8338. parser: Do,
  8339. result: {
  8340. alpha: false,
  8341. mode: "rgb",
  8342. notation: "object"
  8343. }
  8344. },
  8345. {
  8346. parser: No,
  8347. result: {
  8348. alpha: true,
  8349. mode: "rgb",
  8350. notation: "object"
  8351. }
  8352. }
  8353. ];
  8354. function ml(i) {
  8355. return dl.reduce((e, { parser: t, result: l }) => e || (t(i) ? l : null), null);
  8356. }
  8357. function Or(i, e = "int") {
  8358. const t = ml(i);
  8359. 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;
  8360. }
  8361. const Bo = {
  8362. int: [
  8363. pl,
  8364. hl,
  8365. To("int"),
  8366. Mo("int"),
  8367. Lo("int"),
  8368. Ro("int"),
  8369. Oo("int"),
  8370. Fo("int")
  8371. ],
  8372. float: [
  8373. To("float"),
  8374. Mo("float"),
  8375. Lo("float"),
  8376. Ro("float"),
  8377. Oo("float"),
  8378. Fo("float")
  8379. ]
  8380. };
  8381. function fl(i) {
  8382. const e = Bo[i];
  8383. return (t) => {
  8384. if (typeof t != "string")
  8385. return te.black(i);
  8386. const l = e.reduce((b, E) => b || E(t), null);
  8387. return l ?? te.black(i);
  8388. };
  8389. }
  8390. function Nr(i) {
  8391. const e = Bo[i];
  8392. return (t) => e.reduce((l, b) => l || b(t), null);
  8393. }
  8394. function jo(i) {
  8395. const e = Se(Math.floor(i), 0, 255).toString(16);
  8396. return e.length === 1 ? `0${e}` : e;
  8397. }
  8398. function zo(i, e = "#") {
  8399. const t = u(i.getComponents("rgb")).map(jo).join("");
  8400. return `${e}${t}`;
  8401. }
  8402. function Fr(i, e = "#") {
  8403. const t = i.getComponents("rgb"), l = [t[0], t[1], t[2], t[3] * 255].map(jo).join("");
  8404. return `${e}${l}`;
  8405. }
  8406. function Uo(i, e) {
  8407. const t = Ie(e === "float" ? 2 : 0);
  8408. return `rgb(${u(i.getComponents("rgb", e)).map((b) => t(b)).join(", ")})`;
  8409. }
  8410. function vl(i) {
  8411. return (e) => Uo(e, i);
  8412. }
  8413. function As(i, e) {
  8414. const t = Ie(2), l = Ie(e === "float" ? 2 : 0);
  8415. return `rgba(${i.getComponents("rgb", e).map((E, k) => (k === 3 ? t : l)(E)).join(", ")})`;
  8416. }
  8417. function bl(i) {
  8418. return (e) => As(e, i);
  8419. }
  8420. function gl(i) {
  8421. const e = [
  8422. Ie(0),
  8423. yn,
  8424. yn
  8425. ];
  8426. return `hsl(${u(i.getComponents("hsl")).map((l, b) => e[b](l)).join(", ")})`;
  8427. }
  8428. function _l(i) {
  8429. const e = [
  8430. Ie(0),
  8431. yn,
  8432. yn,
  8433. Ie(2)
  8434. ];
  8435. return `hsla(${i.getComponents("hsl").map((l, b) => e[b](l)).join(", ")})`;
  8436. }
  8437. function Go(i, e) {
  8438. const t = Ie(e === "float" ? 2 : 0), l = ["r", "g", "b"];
  8439. return `{${u(i.getComponents("rgb", e)).map((E, k) => `${l[k]}: ${t(E)}`).join(", ")}}`;
  8440. }
  8441. function wl(i) {
  8442. return (e) => Go(e, i);
  8443. }
  8444. function Ho(i, e) {
  8445. const t = Ie(2), l = Ie(e === "float" ? 2 : 0), b = ["r", "g", "b", "a"];
  8446. return `{${i.getComponents("rgb", e).map((k, B) => {
  8447. const Q = B === 3 ? t : l;
  8448. return `${b[B]}: ${Q(k)}`;
  8449. }).join(", ")}}`;
  8450. }
  8451. function yl(i) {
  8452. return (e) => Ho(e, i);
  8453. }
  8454. const xl = [
  8455. {
  8456. format: {
  8457. alpha: false,
  8458. mode: "rgb",
  8459. notation: "hex",
  8460. type: "int"
  8461. },
  8462. stringifier: zo
  8463. },
  8464. {
  8465. format: {
  8466. alpha: true,
  8467. mode: "rgb",
  8468. notation: "hex",
  8469. type: "int"
  8470. },
  8471. stringifier: Fr
  8472. },
  8473. {
  8474. format: {
  8475. alpha: false,
  8476. mode: "hsl",
  8477. notation: "func",
  8478. type: "int"
  8479. },
  8480. stringifier: gl
  8481. },
  8482. {
  8483. format: {
  8484. alpha: true,
  8485. mode: "hsl",
  8486. notation: "func",
  8487. type: "int"
  8488. },
  8489. stringifier: _l
  8490. },
  8491. ...["int", "float"].reduce((i, e) => [
  8492. ...i,
  8493. {
  8494. format: {
  8495. alpha: false,
  8496. mode: "rgb",
  8497. notation: "func",
  8498. type: e
  8499. },
  8500. stringifier: vl(e)
  8501. },
  8502. {
  8503. format: {
  8504. alpha: true,
  8505. mode: "rgb",
  8506. notation: "func",
  8507. type: e
  8508. },
  8509. stringifier: bl(e)
  8510. },
  8511. {
  8512. format: {
  8513. alpha: false,
  8514. mode: "rgb",
  8515. notation: "object",
  8516. type: e
  8517. },
  8518. stringifier: wl(e)
  8519. },
  8520. {
  8521. format: {
  8522. alpha: true,
  8523. mode: "rgb",
  8524. notation: "object",
  8525. type: e
  8526. },
  8527. stringifier: yl(e)
  8528. }
  8529. ], [])
  8530. ];
  8531. function Br(i) {
  8532. return xl.reduce((e, t) => e || (cl(t.format, i) ? t.stringifier : null), null);
  8533. }
  8534. const zi = D2("apl");
  8535. class El {
  8536. constructor(e, t) {
  8537. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(zi()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8538. const l = e.createElement("div");
  8539. l.classList.add(zi("b")), this.element.appendChild(l);
  8540. const b = e.createElement("div");
  8541. b.classList.add(zi("c")), l.appendChild(b), this.colorElem_ = b;
  8542. const E = e.createElement("div");
  8543. E.classList.add(zi("m")), this.element.appendChild(E), this.markerElem_ = E;
  8544. const k = e.createElement("div");
  8545. k.classList.add(zi("p")), this.markerElem_.appendChild(k), this.previewElem_ = k, this.update_();
  8546. }
  8547. update_() {
  8548. const e = this.value.rawValue, t = e.getComponents("rgb"), l = new te([t[0], t[1], t[2], 0], "rgb"), b = new te([t[0], t[1], t[2], 255], "rgb"), E = [
  8549. "to right",
  8550. As(l),
  8551. As(b)
  8552. ];
  8553. this.colorElem_.style.background = `linear-gradient(${E.join(",")})`, this.previewElem_.style.backgroundColor = As(e);
  8554. const k = _e(t[3], 0, 1, 0, 100);
  8555. this.markerElem_.style.left = `${k}%`;
  8556. }
  8557. onValueChange_() {
  8558. this.update_();
  8559. }
  8560. }
  8561. class Cl {
  8562. constructor(e, t) {
  8563. 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 El(e, {
  8564. value: this.value,
  8565. viewProps: this.viewProps
  8566. }), 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_);
  8567. }
  8568. handlePointerEvent_(e, t) {
  8569. if (!e.point)
  8570. return;
  8571. const l = e.point.x / e.bounds.width, b = this.value.rawValue, [E, k, B] = b.getComponents("hsv");
  8572. this.value.setRawValue(new te([E, k, B, l], "hsv"), t);
  8573. }
  8574. onPointerDown_(e) {
  8575. this.handlePointerEvent_(e.data, {
  8576. forceEmit: false,
  8577. last: false
  8578. });
  8579. }
  8580. onPointerMove_(e) {
  8581. this.handlePointerEvent_(e.data, {
  8582. forceEmit: false,
  8583. last: false
  8584. });
  8585. }
  8586. onPointerUp_(e) {
  8587. this.handlePointerEvent_(e.data, {
  8588. forceEmit: true,
  8589. last: true
  8590. });
  8591. }
  8592. onKeyDown_(e) {
  8593. const t = Oe(Mn(true), ct(e));
  8594. if (t === 0)
  8595. return;
  8596. const l = this.value.rawValue, [b, E, k, B] = l.getComponents("hsv");
  8597. this.value.setRawValue(new te([b, E, k, B + t], "hsv"), {
  8598. forceEmit: false,
  8599. last: false
  8600. });
  8601. }
  8602. onKeyUp_(e) {
  8603. Oe(Mn(true), ct(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8604. forceEmit: true,
  8605. last: true
  8606. });
  8607. }
  8608. }
  8609. const si = D2("coltxt");
  8610. function Pl(i) {
  8611. const e = i.createElement("select"), t = [
  8612. { text: "RGB", value: "rgb" },
  8613. { text: "HSL", value: "hsl" },
  8614. { text: "HSV", value: "hsv" }
  8615. ];
  8616. return e.appendChild(t.reduce((l, b) => {
  8617. const E = i.createElement("option");
  8618. return E.textContent = b.text, E.value = b.value, l.appendChild(E), l;
  8619. }, i.createDocumentFragment())), e;
  8620. }
  8621. class Tl {
  8622. constructor(e, t) {
  8623. this.element = e.createElement("div"), this.element.classList.add(si()), t.viewProps.bindClassModifiers(this.element);
  8624. const l = e.createElement("div");
  8625. l.classList.add(si("m")), this.modeElem_ = Pl(e), this.modeElem_.classList.add(si("ms")), l.appendChild(this.modeSelectElement), t.viewProps.bindDisabled(this.modeElem_);
  8626. const b = e.createElement("div");
  8627. b.classList.add(si("mm")), b.appendChild(xt(e, "dropdown")), l.appendChild(b), this.element.appendChild(l);
  8628. const E = e.createElement("div");
  8629. E.classList.add(si("w")), this.element.appendChild(E), this.textsElem_ = E, this.textViews_ = t.textViews, this.applyTextViews_(), N(t.colorMode, (k) => {
  8630. this.modeElem_.value = k;
  8631. });
  8632. }
  8633. get modeSelectElement() {
  8634. return this.modeElem_;
  8635. }
  8636. get textViews() {
  8637. return this.textViews_;
  8638. }
  8639. set textViews(e) {
  8640. this.textViews_ = e, this.applyTextViews_();
  8641. }
  8642. applyTextViews_() {
  8643. pn(this.textsElem_);
  8644. const e = this.element.ownerDocument;
  8645. this.textViews_.forEach((t) => {
  8646. const l = e.createElement("div");
  8647. l.classList.add(si("c")), l.appendChild(t.element), this.textsElem_.appendChild(l);
  8648. });
  8649. }
  8650. }
  8651. function kl(i) {
  8652. return Ie(i === "float" ? 2 : 0);
  8653. }
  8654. function Ml(i, e, t) {
  8655. const l = T(i, e)[t];
  8656. return new qt({
  8657. min: 0,
  8658. max: l
  8659. });
  8660. }
  8661. function jr(i, e, t) {
  8662. return new En(i, {
  8663. arrayPosition: t === 0 ? "fst" : t === 3 - 1 ? "lst" : "mid",
  8664. baseStep: Mn(false),
  8665. parser: e.parser,
  8666. props: X.fromObject({
  8667. draggingScale: e.colorType === "float" ? 0.01 : 1,
  8668. formatter: kl(e.colorType)
  8669. }),
  8670. value: ee(0, {
  8671. constraint: Ml(e.colorMode, e.colorType, t)
  8672. }),
  8673. viewProps: e.viewProps
  8674. });
  8675. }
  8676. class Sl {
  8677. constructor(e, t) {
  8678. this.onModeSelectChange_ = this.onModeSelectChange_.bind(this), this.colorType_ = t.colorType, this.parser_ = t.parser, this.value = t.value, this.viewProps = t.viewProps, this.colorMode = ee(this.value.rawValue.mode), this.ccs_ = this.createComponentControllers_(e), this.view = new Tl(e, {
  8679. colorMode: this.colorMode,
  8680. textViews: [this.ccs_[0].view, this.ccs_[1].view, this.ccs_[2].view],
  8681. viewProps: this.viewProps
  8682. }), this.view.modeSelectElement.addEventListener("change", this.onModeSelectChange_);
  8683. }
  8684. createComponentControllers_(e) {
  8685. const t = {
  8686. colorMode: this.colorMode.rawValue,
  8687. colorType: this.colorType_,
  8688. parser: this.parser_,
  8689. viewProps: this.viewProps
  8690. }, l = [
  8691. jr(e, t, 0),
  8692. jr(e, t, 1),
  8693. jr(e, t, 2)
  8694. ];
  8695. return l.forEach((b, E) => {
  8696. Zt({
  8697. primary: this.value,
  8698. secondary: b.value,
  8699. forward: (k) => k.rawValue.getComponents(this.colorMode.rawValue, this.colorType_)[E],
  8700. backward: (k, B) => {
  8701. const Q = this.colorMode.rawValue, J = k.rawValue.getComponents(Q, this.colorType_);
  8702. return J[E] = B.rawValue, new te(f(u(J), J[3]), Q, this.colorType_);
  8703. }
  8704. });
  8705. }), l;
  8706. }
  8707. onModeSelectChange_(e) {
  8708. const t = e.currentTarget;
  8709. this.colorMode.rawValue = t.value, this.ccs_ = this.createComponentControllers_(this.view.element.ownerDocument), this.view.textViews = [
  8710. this.ccs_[0].view,
  8711. this.ccs_[1].view,
  8712. this.ccs_[2].view
  8713. ];
  8714. }
  8715. }
  8716. const zr = D2("hpl");
  8717. class Ll {
  8718. constructor(e, t) {
  8719. 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(zr()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8720. const l = e.createElement("div");
  8721. l.classList.add(zr("c")), this.element.appendChild(l);
  8722. const b = e.createElement("div");
  8723. b.classList.add(zr("m")), this.element.appendChild(b), this.markerElem_ = b, this.update_();
  8724. }
  8725. update_() {
  8726. const e = this.value.rawValue, [t] = e.getComponents("hsv");
  8727. this.markerElem_.style.backgroundColor = Uo(new te([t, 100, 100], "hsv"));
  8728. const l = _e(t, 0, 360, 0, 100);
  8729. this.markerElem_.style.left = `${l}%`;
  8730. }
  8731. onValueChange_() {
  8732. this.update_();
  8733. }
  8734. }
  8735. class Al {
  8736. constructor(e, t) {
  8737. 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 Ll(e, {
  8738. value: this.value,
  8739. viewProps: this.viewProps
  8740. }), 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_);
  8741. }
  8742. handlePointerEvent_(e, t) {
  8743. if (!e.point)
  8744. return;
  8745. const l = _e(Se(e.point.x, 0, e.bounds.width), 0, e.bounds.width, 0, 360), b = this.value.rawValue, [, E, k, B] = b.getComponents("hsv");
  8746. this.value.setRawValue(new te([l, E, k, B], "hsv"), t);
  8747. }
  8748. onPointerDown_(e) {
  8749. this.handlePointerEvent_(e.data, {
  8750. forceEmit: false,
  8751. last: false
  8752. });
  8753. }
  8754. onPointerMove_(e) {
  8755. this.handlePointerEvent_(e.data, {
  8756. forceEmit: false,
  8757. last: false
  8758. });
  8759. }
  8760. onPointerUp_(e) {
  8761. this.handlePointerEvent_(e.data, {
  8762. forceEmit: true,
  8763. last: true
  8764. });
  8765. }
  8766. onKeyDown_(e) {
  8767. const t = Oe(Mn(false), ct(e));
  8768. if (t === 0)
  8769. return;
  8770. const l = this.value.rawValue, [b, E, k, B] = l.getComponents("hsv");
  8771. this.value.setRawValue(new te([b + t, E, k, B], "hsv"), {
  8772. forceEmit: false,
  8773. last: false
  8774. });
  8775. }
  8776. onKeyUp_(e) {
  8777. Oe(Mn(false), ct(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8778. forceEmit: true,
  8779. last: true
  8780. });
  8781. }
  8782. }
  8783. const Ur = D2("svp"), Ko = 64;
  8784. class Rl {
  8785. constructor(e, t) {
  8786. 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(Ur()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8787. const l = e.createElement("canvas");
  8788. l.height = Ko, l.width = Ko, l.classList.add(Ur("c")), this.element.appendChild(l), this.canvasElement = l;
  8789. const b = e.createElement("div");
  8790. b.classList.add(Ur("m")), this.element.appendChild(b), this.markerElem_ = b, this.update_();
  8791. }
  8792. update_() {
  8793. const e = Gn(this.canvasElement);
  8794. if (!e)
  8795. return;
  8796. const l = this.value.rawValue.getComponents("hsv"), b = this.canvasElement.width, E = this.canvasElement.height, k = e.getImageData(0, 0, b, E), B = k.data;
  8797. for (let de = 0; de < E; de++)
  8798. for (let ve = 0; ve < b; ve++) {
  8799. const Ln = _e(ve, 0, b, 0, 100), Gi = _e(de, 0, E, 100, 0), Hi = Ls(l[0], Ln, Gi), Rs = (de * b + ve) * 4;
  8800. B[Rs] = Hi[0], B[Rs + 1] = Hi[1], B[Rs + 2] = Hi[2], B[Rs + 3] = 255;
  8801. }
  8802. e.putImageData(k, 0, 0);
  8803. const Q = _e(l[1], 0, 100, 0, 100);
  8804. this.markerElem_.style.left = `${Q}%`;
  8805. const J = _e(l[2], 0, 100, 100, 0);
  8806. this.markerElem_.style.top = `${J}%`;
  8807. }
  8808. onValueChange_() {
  8809. this.update_();
  8810. }
  8811. }
  8812. class Il {
  8813. constructor(e, t) {
  8814. 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 Rl(e, {
  8815. value: this.value,
  8816. viewProps: this.viewProps
  8817. }), 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_);
  8818. }
  8819. handlePointerEvent_(e, t) {
  8820. if (!e.point)
  8821. return;
  8822. const l = _e(e.point.x, 0, e.bounds.width, 0, 100), b = _e(e.point.y, 0, e.bounds.height, 100, 0), [E, , , k] = this.value.rawValue.getComponents("hsv");
  8823. this.value.setRawValue(new te([E, l, b, k], "hsv"), t);
  8824. }
  8825. onPointerDown_(e) {
  8826. this.handlePointerEvent_(e.data, {
  8827. forceEmit: false,
  8828. last: false
  8829. });
  8830. }
  8831. onPointerMove_(e) {
  8832. this.handlePointerEvent_(e.data, {
  8833. forceEmit: false,
  8834. last: false
  8835. });
  8836. }
  8837. onPointerUp_(e) {
  8838. this.handlePointerEvent_(e.data, {
  8839. forceEmit: true,
  8840. last: true
  8841. });
  8842. }
  8843. onKeyDown_(e) {
  8844. ei(e.key) && e.preventDefault();
  8845. const [t, l, b, E] = this.value.rawValue.getComponents("hsv"), k = Mn(false), B = Oe(k, ct(e)), Q = Oe(k, xn(e));
  8846. B === 0 && Q === 0 || this.value.setRawValue(new te([t, l + B, b + Q, E], "hsv"), {
  8847. forceEmit: false,
  8848. last: false
  8849. });
  8850. }
  8851. onKeyUp_(e) {
  8852. const t = Mn(false), l = Oe(t, ct(e)), b = Oe(t, xn(e));
  8853. l === 0 && b === 0 || this.value.setRawValue(this.value.rawValue, {
  8854. forceEmit: true,
  8855. last: true
  8856. });
  8857. }
  8858. }
  8859. class Vl {
  8860. constructor(e, t) {
  8861. this.value = t.value, this.viewProps = t.viewProps, this.hPaletteC_ = new Al(e, {
  8862. value: this.value,
  8863. viewProps: this.viewProps
  8864. }), this.svPaletteC_ = new Il(e, {
  8865. value: this.value,
  8866. viewProps: this.viewProps
  8867. }), this.alphaIcs_ = t.supportsAlpha ? {
  8868. palette: new Cl(e, {
  8869. value: this.value,
  8870. viewProps: this.viewProps
  8871. }),
  8872. text: new En(e, {
  8873. parser: lt,
  8874. baseStep: 0.1,
  8875. props: X.fromObject({
  8876. draggingScale: 0.01,
  8877. formatter: Ie(2)
  8878. }),
  8879. value: ee(0, {
  8880. constraint: new qt({ min: 0, max: 1 })
  8881. }),
  8882. viewProps: this.viewProps
  8883. })
  8884. } : null, this.alphaIcs_ && Zt({
  8885. primary: this.value,
  8886. secondary: this.alphaIcs_.text.value,
  8887. forward: (l) => l.rawValue.getComponents()[3],
  8888. backward: (l, b) => {
  8889. const E = l.rawValue.getComponents();
  8890. return E[3] = b.rawValue, new te(E, l.rawValue.mode);
  8891. }
  8892. }), this.textC_ = new Sl(e, {
  8893. colorType: t.colorType,
  8894. parser: lt,
  8895. value: this.value,
  8896. viewProps: this.viewProps
  8897. }), this.view = new Vr(e, {
  8898. alphaViews: this.alphaIcs_ ? {
  8899. palette: this.alphaIcs_.palette.view,
  8900. text: this.alphaIcs_.text.view
  8901. } : null,
  8902. hPaletteView: this.hPaletteC_.view,
  8903. supportsAlpha: t.supportsAlpha,
  8904. svPaletteView: this.svPaletteC_.view,
  8905. textView: this.textC_.view,
  8906. viewProps: this.viewProps
  8907. });
  8908. }
  8909. get textController() {
  8910. return this.textC_;
  8911. }
  8912. }
  8913. const Gr = D2("colsw");
  8914. class Dl {
  8915. constructor(e, t) {
  8916. 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(Gr()), t.viewProps.bindClassModifiers(this.element);
  8917. const l = e.createElement("div");
  8918. l.classList.add(Gr("sw")), this.element.appendChild(l), this.swatchElem_ = l;
  8919. const b = e.createElement("button");
  8920. b.classList.add(Gr("b")), t.viewProps.bindDisabled(b), this.element.appendChild(b), this.buttonElement = b, this.update_();
  8921. }
  8922. update_() {
  8923. const e = this.value.rawValue;
  8924. this.swatchElem_.style.backgroundColor = Fr(e);
  8925. }
  8926. onValueChange_() {
  8927. this.update_();
  8928. }
  8929. }
  8930. class Ol {
  8931. constructor(e, t) {
  8932. this.value = t.value, this.viewProps = t.viewProps, this.view = new Dl(e, {
  8933. value: this.value,
  8934. viewProps: this.viewProps
  8935. });
  8936. }
  8937. }
  8938. class Hr {
  8939. constructor(e, t) {
  8940. 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 Ol(e, {
  8941. value: this.value,
  8942. viewProps: this.viewProps
  8943. });
  8944. const l = this.swatchC_.view.buttonElement;
  8945. l.addEventListener("blur", this.onButtonBlur_), l.addEventListener("click", this.onButtonClick_), this.textC_ = new Wn(e, {
  8946. parser: t.parser,
  8947. props: X.fromObject({
  8948. formatter: t.formatter
  8949. }),
  8950. value: this.value,
  8951. viewProps: this.viewProps
  8952. }), this.view = new ji(e, {
  8953. foldable: this.foldable_,
  8954. pickerLayout: t.pickerLayout
  8955. }), this.view.swatchElement.appendChild(this.swatchC_.view.element), this.view.textElement.appendChild(this.textC_.view.element), this.popC_ = t.pickerLayout === "popup" ? new ms(e, {
  8956. viewProps: this.viewProps
  8957. }) : null;
  8958. const b = new Vl(e, {
  8959. colorType: t.colorType,
  8960. supportsAlpha: t.supportsAlpha,
  8961. value: this.value,
  8962. viewProps: this.viewProps
  8963. });
  8964. b.view.allFocusableElements.forEach((E) => {
  8965. E.addEventListener("blur", this.onPopupChildBlur_), E.addEventListener("keydown", this.onPopupChildKeydown_);
  8966. }), this.pickerC_ = b, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(b.view.element), Zt({
  8967. primary: this.foldable_.value("expanded"),
  8968. secondary: this.popC_.shows,
  8969. forward: (E) => E.rawValue,
  8970. backward: (E, k) => k.rawValue
  8971. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ue(this.foldable_, this.view.pickerElement));
  8972. }
  8973. get textController() {
  8974. return this.textC_;
  8975. }
  8976. onButtonBlur_(e) {
  8977. if (!this.popC_)
  8978. return;
  8979. const t = this.view.element, l = e.relatedTarget;
  8980. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  8981. }
  8982. onButtonClick_() {
  8983. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  8984. }
  8985. onPopupChildBlur_(e) {
  8986. if (!this.popC_)
  8987. return;
  8988. const t = this.popC_.view.element, l = Et2(e);
  8989. l && t.contains(l) || l && l === this.swatchC_.view.buttonElement && !ft(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  8990. }
  8991. onPopupChildKeydown_(e) {
  8992. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.swatchC_.view.buttonElement.focus();
  8993. }
  8994. }
  8995. function Nl(i, e) {
  8996. return te.isColorObject(i) ? te.fromObject(i, e) : te.black(e);
  8997. }
  8998. function Fl(i) {
  8999. return u(i.getComponents("rgb")).reduce((e, t) => e << 8 | Math.floor(t) & 255, 0);
  9000. }
  9001. function Bl(i) {
  9002. return i.getComponents("rgb").reduce((e, t, l) => {
  9003. const b = Math.floor(l === 3 ? t * 255 : t) & 255;
  9004. return e << 8 | b;
  9005. }, 0) >>> 0;
  9006. }
  9007. function jl(i) {
  9008. return new te([i >> 16 & 255, i >> 8 & 255, i & 255], "rgb");
  9009. }
  9010. function zl(i) {
  9011. return new te([
  9012. i >> 24 & 255,
  9013. i >> 16 & 255,
  9014. i >> 8 & 255,
  9015. _e(i & 255, 0, 255, 0, 1)
  9016. ], "rgb");
  9017. }
  9018. function Ul(i) {
  9019. return typeof i != "number" ? te.black() : jl(i);
  9020. }
  9021. function Gl(i) {
  9022. return typeof i != "number" ? te.black() : zl(i);
  9023. }
  9024. function Hl(i) {
  9025. const e = Br(i);
  9026. return e ? (t, l) => {
  9027. nt(t, e(l));
  9028. } : null;
  9029. }
  9030. function Kl(i) {
  9031. const e = i ? Bl : Fl;
  9032. return (t, l) => {
  9033. nt(t, e(l));
  9034. };
  9035. }
  9036. function $l(i, e, t) {
  9037. const l = e.toRgbaObject(t);
  9038. i.writeProperty("r", l.r), i.writeProperty("g", l.g), i.writeProperty("b", l.b), i.writeProperty("a", l.a);
  9039. }
  9040. function Xl(i, e, t) {
  9041. const l = e.toRgbaObject(t);
  9042. i.writeProperty("r", l.r), i.writeProperty("g", l.g), i.writeProperty("b", l.b);
  9043. }
  9044. function Yl(i, e) {
  9045. return (t, l) => {
  9046. i ? $l(t, l, e) : Xl(t, l, e);
  9047. };
  9048. }
  9049. function Kr(i) {
  9050. var e;
  9051. return !!(i != null && i.alpha || !((e = i == null ? void 0 : i.color) === null || e === void 0) && e.alpha);
  9052. }
  9053. function ql(i) {
  9054. return i ? (e) => Fr(e, "0x") : (e) => zo(e, "0x");
  9055. }
  9056. function Ql(i) {
  9057. return "color" in i || "view" in i && i.view === "color";
  9058. }
  9059. const Zl = {
  9060. id: "input-color-number",
  9061. type: "input",
  9062. accept: (i, e) => {
  9063. if (typeof i != "number" || !Ql(e))
  9064. return null;
  9065. const t = Dr(e);
  9066. return t ? {
  9067. initialValue: i,
  9068. params: t
  9069. } : null;
  9070. },
  9071. binding: {
  9072. reader: (i) => Kr(i.params) ? Gl : Ul,
  9073. equals: te.equals,
  9074. writer: (i) => Kl(Kr(i.params))
  9075. },
  9076. controller: (i) => {
  9077. const e = Kr(i.params), t = "expanded" in i.params ? i.params.expanded : void 0, l = "picker" in i.params ? i.params.picker : void 0;
  9078. return new Hr(i.document, {
  9079. colorType: "int",
  9080. expanded: t ?? false,
  9081. formatter: ql(e),
  9082. parser: Nr("int"),
  9083. pickerLayout: l ?? "popup",
  9084. supportsAlpha: e,
  9085. value: i.value,
  9086. viewProps: i.viewProps
  9087. });
  9088. }
  9089. };
  9090. function Wl(i) {
  9091. return te.isRgbaColorObject(i);
  9092. }
  9093. function Jl(i) {
  9094. return (e) => Nl(e, i);
  9095. }
  9096. function ec(i, e) {
  9097. return (t) => i ? Ho(t, e) : Go(t, e);
  9098. }
  9099. const tc = {
  9100. id: "input-color-object",
  9101. type: "input",
  9102. accept: (i, e) => {
  9103. if (!te.isColorObject(i))
  9104. return null;
  9105. const t = Dr(e);
  9106. return t ? {
  9107. initialValue: i,
  9108. params: t
  9109. } : null;
  9110. },
  9111. binding: {
  9112. reader: (i) => Jl(Sn(i.params)),
  9113. equals: te.equals,
  9114. writer: (i) => Yl(Wl(i.initialValue), Sn(i.params))
  9115. },
  9116. controller: (i) => {
  9117. var e;
  9118. const t = te.isRgbaColorObject(i.initialValue), l = "expanded" in i.params ? i.params.expanded : void 0, b = "picker" in i.params ? i.params.picker : void 0, E = (e = Sn(i.params)) !== null && e !== void 0 ? e : "int";
  9119. return new Hr(i.document, {
  9120. colorType: E,
  9121. expanded: l ?? false,
  9122. formatter: ec(t, E),
  9123. parser: Nr(E),
  9124. pickerLayout: b ?? "popup",
  9125. supportsAlpha: t,
  9126. value: i.value,
  9127. viewProps: i.viewProps
  9128. });
  9129. }
  9130. }, nc = {
  9131. id: "input-color-string",
  9132. type: "input",
  9133. accept: (i, e) => {
  9134. if (typeof i != "string" || "view" in e && e.view === "text")
  9135. return null;
  9136. const t = Or(i, Sn(e));
  9137. if (!t || !Br(t))
  9138. return null;
  9139. const b = Dr(e);
  9140. return b ? {
  9141. initialValue: i,
  9142. params: b
  9143. } : null;
  9144. },
  9145. binding: {
  9146. reader: (i) => {
  9147. var e;
  9148. return fl((e = Sn(i.params)) !== null && e !== void 0 ? e : "int");
  9149. },
  9150. equals: te.equals,
  9151. writer: (i) => {
  9152. const e = Or(i.initialValue, Sn(i.params));
  9153. if (!e)
  9154. throw S.shouldNeverHappen();
  9155. const t = Hl(e);
  9156. if (!t)
  9157. throw S.notBindable();
  9158. return t;
  9159. }
  9160. },
  9161. controller: (i) => {
  9162. const e = Or(i.initialValue, Sn(i.params));
  9163. if (!e)
  9164. throw S.shouldNeverHappen();
  9165. const t = Br(e);
  9166. if (!t)
  9167. throw S.shouldNeverHappen();
  9168. const l = "expanded" in i.params ? i.params.expanded : void 0, b = "picker" in i.params ? i.params.picker : void 0;
  9169. return new Hr(i.document, {
  9170. colorType: e.type,
  9171. expanded: l ?? false,
  9172. formatter: t,
  9173. parser: Nr(e.type),
  9174. pickerLayout: b ?? "popup",
  9175. supportsAlpha: e.alpha,
  9176. value: i.value,
  9177. viewProps: i.viewProps
  9178. });
  9179. }
  9180. };
  9181. class Jt {
  9182. constructor(e) {
  9183. this.components = e.components, this.asm_ = e.assembly;
  9184. }
  9185. constrain(e) {
  9186. const t = this.asm_.toComponents(e).map((l, b) => {
  9187. var E, k;
  9188. return (k = (E = this.components[b]) === null || E === void 0 ? void 0 : E.constrain(l)) !== null && k !== void 0 ? k : l;
  9189. });
  9190. return this.asm_.fromComponents(t);
  9191. }
  9192. }
  9193. const $o = D2("pndtxt");
  9194. class ic {
  9195. constructor(e, t) {
  9196. this.textViews = t.textViews, this.element = e.createElement("div"), this.element.classList.add($o()), this.textViews.forEach((l) => {
  9197. const b = e.createElement("div");
  9198. b.classList.add($o("a")), b.appendChild(l.element), this.element.appendChild(b);
  9199. });
  9200. }
  9201. }
  9202. function sc(i, e, t) {
  9203. return new En(i, {
  9204. arrayPosition: t === 0 ? "fst" : t === e.axes.length - 1 ? "lst" : "mid",
  9205. baseStep: e.axes[t].baseStep,
  9206. parser: e.parser,
  9207. props: e.axes[t].textProps,
  9208. value: ee(0, {
  9209. constraint: e.axes[t].constraint
  9210. }),
  9211. viewProps: e.viewProps
  9212. });
  9213. }
  9214. class $r {
  9215. constructor(e, t) {
  9216. this.value = t.value, this.viewProps = t.viewProps, this.acs_ = t.axes.map((l, b) => sc(e, t, b)), this.acs_.forEach((l, b) => {
  9217. Zt({
  9218. primary: this.value,
  9219. secondary: l.value,
  9220. forward: (E) => t.assembly.toComponents(E.rawValue)[b],
  9221. backward: (E, k) => {
  9222. const B = t.assembly.toComponents(E.rawValue);
  9223. return B[b] = k.rawValue, t.assembly.fromComponents(B);
  9224. }
  9225. });
  9226. }), this.view = new ic(e, {
  9227. textViews: this.acs_.map((l) => l.view)
  9228. });
  9229. }
  9230. }
  9231. function Xo(i, e) {
  9232. return "step" in i && !_(i.step) ? new Zn(i.step, e) : null;
  9233. }
  9234. function Yo(i) {
  9235. return !_(i.max) && !_(i.min) ? new qt({
  9236. max: i.max,
  9237. min: i.min
  9238. }) : !_(i.max) || !_(i.min) ? new Pi({
  9239. max: i.max,
  9240. min: i.min
  9241. }) : null;
  9242. }
  9243. function rc(i) {
  9244. const e = tt(i, qt);
  9245. if (e)
  9246. return [e.values.get("min"), e.values.get("max")];
  9247. const t = tt(i, Pi);
  9248. return t ? [t.minValue, t.maxValue] : [void 0, void 0];
  9249. }
  9250. function oc(i, e) {
  9251. const t = [], l = Xo(i, e);
  9252. l && t.push(l);
  9253. const b = Yo(i);
  9254. b && t.push(b);
  9255. const E = Bi(i.options);
  9256. return E && t.push(E), new bn(t);
  9257. }
  9258. const ac = {
  9259. id: "input-number",
  9260. type: "input",
  9261. accept: (i, e) => {
  9262. if (typeof i != "number")
  9263. return null;
  9264. const t = M, l = le(e, {
  9265. format: t.optional.function,
  9266. max: t.optional.number,
  9267. min: t.optional.number,
  9268. options: t.optional.custom(Pn),
  9269. step: t.optional.number
  9270. });
  9271. return l ? {
  9272. initialValue: i,
  9273. params: l
  9274. } : null;
  9275. },
  9276. binding: {
  9277. reader: (i) => bt,
  9278. constraint: (i) => oc(i.params, i.initialValue),
  9279. writer: (i) => nt
  9280. },
  9281. controller: (i) => {
  9282. var e;
  9283. const t = i.value, l = i.constraint, b = l && tt(l, gn);
  9284. if (b)
  9285. return new _n(i.document, {
  9286. props: new X({
  9287. options: b.values.value("options")
  9288. }),
  9289. value: t,
  9290. viewProps: i.viewProps
  9291. });
  9292. const E = (e = "format" in i.params ? i.params.format : void 0) !== null && e !== void 0 ? e : Ie(ni(l, t.rawValue)), k = l && tt(l, qt);
  9293. return k ? new ti(i.document, {
  9294. baseStep: Dt(l),
  9295. parser: lt,
  9296. sliderProps: new X({
  9297. maxValue: k.values.value("max"),
  9298. minValue: k.values.value("min")
  9299. }),
  9300. textProps: X.fromObject({
  9301. draggingScale: Ot(l, t.rawValue),
  9302. formatter: E
  9303. }),
  9304. value: t,
  9305. viewProps: i.viewProps
  9306. }) : new En(i.document, {
  9307. baseStep: Dt(l),
  9308. parser: lt,
  9309. props: X.fromObject({
  9310. draggingScale: Ot(l, t.rawValue),
  9311. formatter: E
  9312. }),
  9313. value: t,
  9314. viewProps: i.viewProps
  9315. });
  9316. }
  9317. };
  9318. class en {
  9319. constructor(e = 0, t = 0) {
  9320. this.x = e, this.y = t;
  9321. }
  9322. getComponents() {
  9323. return [this.x, this.y];
  9324. }
  9325. static isObject(e) {
  9326. if (_(e))
  9327. return false;
  9328. const t = e.x, l = e.y;
  9329. return !(typeof t != "number" || typeof l != "number");
  9330. }
  9331. static equals(e, t) {
  9332. return e.x === t.x && e.y === t.y;
  9333. }
  9334. toObject() {
  9335. return {
  9336. x: this.x,
  9337. y: this.y
  9338. };
  9339. }
  9340. }
  9341. const qo = {
  9342. toComponents: (i) => i.getComponents(),
  9343. fromComponents: (i) => new en(...i)
  9344. }, ri = D2("p2d");
  9345. class lc {
  9346. constructor(e, t) {
  9347. this.element = e.createElement("div"), this.element.classList.add(ri()), t.viewProps.bindClassModifiers(this.element), N(t.expanded, K(this.element, ri(void 0, "expanded")));
  9348. const l = e.createElement("div");
  9349. l.classList.add(ri("h")), this.element.appendChild(l);
  9350. const b = e.createElement("button");
  9351. b.classList.add(ri("b")), b.appendChild(xt(e, "p2dpad")), t.viewProps.bindDisabled(b), l.appendChild(b), this.buttonElement = b;
  9352. const E = e.createElement("div");
  9353. if (E.classList.add(ri("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  9354. const k = e.createElement("div");
  9355. k.classList.add(ri("p")), this.element.appendChild(k), this.pickerElement = k;
  9356. } else
  9357. this.pickerElement = null;
  9358. }
  9359. }
  9360. const tn = D2("p2dp");
  9361. class cc {
  9362. constructor(e, t) {
  9363. this.onFoldableChange_ = this.onFoldableChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.invertsY_ = t.invertsY, this.maxValue_ = t.maxValue, this.element = e.createElement("div"), this.element.classList.add(tn()), t.layout === "popup" && this.element.classList.add(tn(void 0, "p")), t.viewProps.bindClassModifiers(this.element);
  9364. const l = e.createElement("div");
  9365. l.classList.add(tn("p")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.padElement = l;
  9366. const b = e.createElementNS(ze, "svg");
  9367. b.classList.add(tn("g")), this.padElement.appendChild(b), this.svgElem_ = b;
  9368. const E = e.createElementNS(ze, "line");
  9369. E.classList.add(tn("ax")), E.setAttributeNS(null, "x1", "0"), E.setAttributeNS(null, "y1", "50%"), E.setAttributeNS(null, "x2", "100%"), E.setAttributeNS(null, "y2", "50%"), this.svgElem_.appendChild(E);
  9370. const k = e.createElementNS(ze, "line");
  9371. k.classList.add(tn("ax")), k.setAttributeNS(null, "x1", "50%"), k.setAttributeNS(null, "y1", "0"), k.setAttributeNS(null, "x2", "50%"), k.setAttributeNS(null, "y2", "100%"), this.svgElem_.appendChild(k);
  9372. const B = e.createElementNS(ze, "line");
  9373. B.classList.add(tn("l")), B.setAttributeNS(null, "x1", "50%"), B.setAttributeNS(null, "y1", "50%"), this.svgElem_.appendChild(B), this.lineElem_ = B;
  9374. const Q = e.createElement("div");
  9375. Q.classList.add(tn("m")), this.padElement.appendChild(Q), this.markerElem_ = Q, t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  9376. }
  9377. get allFocusableElements() {
  9378. return [this.padElement];
  9379. }
  9380. update_() {
  9381. const [e, t] = this.value.rawValue.getComponents(), l = this.maxValue_, b = _e(e, -l, +l, 0, 100), E = _e(t, -l, +l, 0, 100), k = this.invertsY_ ? 100 - E : E;
  9382. this.lineElem_.setAttributeNS(null, "x2", `${b}%`), this.lineElem_.setAttributeNS(null, "y2", `${k}%`), this.markerElem_.style.left = `${b}%`, this.markerElem_.style.top = `${k}%`;
  9383. }
  9384. onValueChange_() {
  9385. this.update_();
  9386. }
  9387. onFoldableChange_() {
  9388. this.update_();
  9389. }
  9390. }
  9391. function Qo(i, e, t) {
  9392. return [
  9393. Oe(e[0], ct(i)),
  9394. Oe(e[1], xn(i)) * (t ? 1 : -1)
  9395. ];
  9396. }
  9397. class uc {
  9398. constructor(e, t) {
  9399. 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 cc(e, {
  9400. invertsY: this.invertsY_,
  9401. layout: t.layout,
  9402. maxValue: this.maxValue_,
  9403. value: this.value,
  9404. viewProps: this.viewProps
  9405. }), 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_);
  9406. }
  9407. handlePointerEvent_(e, t) {
  9408. if (!e.point)
  9409. return;
  9410. const l = this.maxValue_, b = _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);
  9411. this.value.setRawValue(new en(b, E), t);
  9412. }
  9413. onPointerDown_(e) {
  9414. this.handlePointerEvent_(e.data, {
  9415. forceEmit: false,
  9416. last: false
  9417. });
  9418. }
  9419. onPointerMove_(e) {
  9420. this.handlePointerEvent_(e.data, {
  9421. forceEmit: false,
  9422. last: false
  9423. });
  9424. }
  9425. onPointerUp_(e) {
  9426. this.handlePointerEvent_(e.data, {
  9427. forceEmit: true,
  9428. last: true
  9429. });
  9430. }
  9431. onPadKeyDown_(e) {
  9432. ei(e.key) && e.preventDefault();
  9433. const [t, l] = Qo(e, this.baseSteps_, this.invertsY_);
  9434. t === 0 && l === 0 || this.value.setRawValue(new en(this.value.rawValue.x + t, this.value.rawValue.y + l), {
  9435. forceEmit: false,
  9436. last: false
  9437. });
  9438. }
  9439. onPadKeyUp_(e) {
  9440. const [t, l] = Qo(e, this.baseSteps_, this.invertsY_);
  9441. t === 0 && l === 0 || this.value.setRawValue(this.value.rawValue, {
  9442. forceEmit: true,
  9443. last: true
  9444. });
  9445. }
  9446. }
  9447. class pc {
  9448. constructor(e, t) {
  9449. var l, b;
  9450. 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 ms(e, {
  9451. viewProps: this.viewProps
  9452. }) : null;
  9453. const E = new uc(e, {
  9454. baseSteps: [t.axes[0].baseStep, t.axes[1].baseStep],
  9455. invertsY: t.invertsY,
  9456. layout: t.pickerLayout,
  9457. maxValue: t.maxValue,
  9458. value: this.value,
  9459. viewProps: this.viewProps
  9460. });
  9461. E.view.allFocusableElements.forEach((k) => {
  9462. k.addEventListener("blur", this.onPopupChildBlur_), k.addEventListener("keydown", this.onPopupChildKeydown_);
  9463. }), this.pickerC_ = E, this.textC_ = new $r(e, {
  9464. assembly: qo,
  9465. axes: t.axes,
  9466. parser: t.parser,
  9467. value: this.value,
  9468. viewProps: this.viewProps
  9469. }), this.view = new lc(e, {
  9470. expanded: this.foldable_.value("expanded"),
  9471. pickerLayout: t.pickerLayout,
  9472. viewProps: this.viewProps
  9473. }), this.view.textElement.appendChild(this.textC_.view.element), (l = this.view.buttonElement) === null || l === void 0 || l.addEventListener("blur", this.onPadButtonBlur_), (b = this.view.buttonElement) === null || b === void 0 || b.addEventListener("click", this.onPadButtonClick_), this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), Zt({
  9474. primary: this.foldable_.value("expanded"),
  9475. secondary: this.popC_.shows,
  9476. forward: (k) => k.rawValue,
  9477. backward: (k, B) => B.rawValue
  9478. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ue(this.foldable_, this.view.pickerElement));
  9479. }
  9480. onPadButtonBlur_(e) {
  9481. if (!this.popC_)
  9482. return;
  9483. const t = this.view.element, l = e.relatedTarget;
  9484. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  9485. }
  9486. onPadButtonClick_() {
  9487. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  9488. }
  9489. onPopupChildBlur_(e) {
  9490. if (!this.popC_)
  9491. return;
  9492. const t = this.popC_.view.element, l = Et2(e);
  9493. l && t.contains(l) || l && l === this.view.buttonElement && !ft(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  9494. }
  9495. onPopupChildKeydown_(e) {
  9496. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.view.buttonElement.focus();
  9497. }
  9498. }
  9499. class oi {
  9500. constructor(e = 0, t = 0, l = 0) {
  9501. this.x = e, this.y = t, this.z = l;
  9502. }
  9503. getComponents() {
  9504. return [this.x, this.y, this.z];
  9505. }
  9506. static isObject(e) {
  9507. if (_(e))
  9508. return false;
  9509. const t = e.x, l = e.y, b = e.z;
  9510. return !(typeof t != "number" || typeof l != "number" || typeof b != "number");
  9511. }
  9512. static equals(e, t) {
  9513. return e.x === t.x && e.y === t.y && e.z === t.z;
  9514. }
  9515. toObject() {
  9516. return {
  9517. x: this.x,
  9518. y: this.y,
  9519. z: this.z
  9520. };
  9521. }
  9522. }
  9523. const Zo = {
  9524. toComponents: (i) => i.getComponents(),
  9525. fromComponents: (i) => new oi(...i)
  9526. };
  9527. function hc(i) {
  9528. return oi.isObject(i) ? new oi(i.x, i.y, i.z) : new oi();
  9529. }
  9530. function dc(i, e) {
  9531. i.writeProperty("x", e.x), i.writeProperty("y", e.y), i.writeProperty("z", e.z);
  9532. }
  9533. function mc(i, e) {
  9534. return new Jt({
  9535. assembly: Zo,
  9536. components: [
  9537. Ft("x" in i ? i.x : void 0, e.x),
  9538. Ft("y" in i ? i.y : void 0, e.y),
  9539. Ft("z" in i ? i.z : void 0, e.z)
  9540. ]
  9541. });
  9542. }
  9543. function Xr(i, e) {
  9544. return {
  9545. baseStep: Dt(e),
  9546. constraint: e,
  9547. textProps: X.fromObject({
  9548. draggingScale: Ot(e, i),
  9549. formatter: Ie(ni(e, i))
  9550. })
  9551. };
  9552. }
  9553. const fc = {
  9554. id: "input-point3d",
  9555. type: "input",
  9556. accept: (i, e) => {
  9557. if (!oi.isObject(i))
  9558. return null;
  9559. const t = M, l = le(e, {
  9560. x: t.optional.custom(gt),
  9561. y: t.optional.custom(gt),
  9562. z: t.optional.custom(gt)
  9563. });
  9564. return l ? {
  9565. initialValue: i,
  9566. params: l
  9567. } : null;
  9568. },
  9569. binding: {
  9570. reader: (i) => hc,
  9571. constraint: (i) => mc(i.params, i.initialValue),
  9572. equals: oi.equals,
  9573. writer: (i) => dc
  9574. },
  9575. controller: (i) => {
  9576. const e = i.value, t = i.constraint;
  9577. if (!(t instanceof Jt))
  9578. throw S.shouldNeverHappen();
  9579. return new $r(i.document, {
  9580. assembly: Zo,
  9581. axes: [
  9582. Xr(e.rawValue.x, t.components[0]),
  9583. Xr(e.rawValue.y, t.components[1]),
  9584. Xr(e.rawValue.z, t.components[2])
  9585. ],
  9586. parser: lt,
  9587. value: e,
  9588. viewProps: i.viewProps
  9589. });
  9590. }
  9591. };
  9592. class ai {
  9593. constructor(e = 0, t = 0, l = 0, b = 0) {
  9594. this.x = e, this.y = t, this.z = l, this.w = b;
  9595. }
  9596. getComponents() {
  9597. return [this.x, this.y, this.z, this.w];
  9598. }
  9599. static isObject(e) {
  9600. if (_(e))
  9601. return false;
  9602. const t = e.x, l = e.y, b = e.z, E = e.w;
  9603. return !(typeof t != "number" || typeof l != "number" || typeof b != "number" || typeof E != "number");
  9604. }
  9605. static equals(e, t) {
  9606. return e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w;
  9607. }
  9608. toObject() {
  9609. return {
  9610. x: this.x,
  9611. y: this.y,
  9612. z: this.z,
  9613. w: this.w
  9614. };
  9615. }
  9616. }
  9617. const Wo = {
  9618. toComponents: (i) => i.getComponents(),
  9619. fromComponents: (i) => new ai(...i)
  9620. };
  9621. function vc(i) {
  9622. return ai.isObject(i) ? new ai(i.x, i.y, i.z, i.w) : new ai();
  9623. }
  9624. function bc(i, e) {
  9625. i.writeProperty("x", e.x), i.writeProperty("y", e.y), i.writeProperty("z", e.z), i.writeProperty("w", e.w);
  9626. }
  9627. function gc(i, e) {
  9628. return new Jt({
  9629. assembly: Wo,
  9630. components: [
  9631. Ft("x" in i ? i.x : void 0, e.x),
  9632. Ft("y" in i ? i.y : void 0, e.y),
  9633. Ft("z" in i ? i.z : void 0, e.z),
  9634. Ft("w" in i ? i.w : void 0, e.w)
  9635. ]
  9636. });
  9637. }
  9638. function _c(i, e) {
  9639. return {
  9640. baseStep: Dt(e),
  9641. constraint: e,
  9642. textProps: X.fromObject({
  9643. draggingScale: Ot(e, i),
  9644. formatter: Ie(ni(e, i))
  9645. })
  9646. };
  9647. }
  9648. const wc = {
  9649. id: "input-point4d",
  9650. type: "input",
  9651. accept: (i, e) => {
  9652. if (!ai.isObject(i))
  9653. return null;
  9654. const t = M, l = le(e, {
  9655. x: t.optional.custom(gt),
  9656. y: t.optional.custom(gt),
  9657. z: t.optional.custom(gt),
  9658. w: t.optional.custom(gt)
  9659. });
  9660. return l ? {
  9661. initialValue: i,
  9662. params: l
  9663. } : null;
  9664. },
  9665. binding: {
  9666. reader: (i) => vc,
  9667. constraint: (i) => gc(i.params, i.initialValue),
  9668. equals: ai.equals,
  9669. writer: (i) => bc
  9670. },
  9671. controller: (i) => {
  9672. const e = i.value, t = i.constraint;
  9673. if (!(t instanceof Jt))
  9674. throw S.shouldNeverHappen();
  9675. return new $r(i.document, {
  9676. assembly: Wo,
  9677. axes: e.rawValue.getComponents().map((l, b) => _c(l, t.components[b])),
  9678. parser: lt,
  9679. value: e,
  9680. viewProps: i.viewProps
  9681. });
  9682. }
  9683. };
  9684. function yc(i) {
  9685. const e = [], t = Bi(i.options);
  9686. return t && e.push(t), new bn(e);
  9687. }
  9688. const xc = {
  9689. id: "input-string",
  9690. type: "input",
  9691. accept: (i, e) => {
  9692. if (typeof i != "string")
  9693. return null;
  9694. const l = le(e, {
  9695. options: M.optional.custom(Pn)
  9696. });
  9697. return l ? {
  9698. initialValue: i,
  9699. params: l
  9700. } : null;
  9701. },
  9702. binding: {
  9703. reader: (i) => Ai,
  9704. constraint: (i) => yc(i.params),
  9705. writer: (i) => nt
  9706. },
  9707. controller: (i) => {
  9708. const e = i.document, t = i.value, l = i.constraint, b = l && tt(l, gn);
  9709. return b ? new _n(e, {
  9710. props: new X({
  9711. options: b.values.value("options")
  9712. }),
  9713. value: t,
  9714. viewProps: i.viewProps
  9715. }) : new Wn(e, {
  9716. parser: (E) => E,
  9717. props: X.fromObject({
  9718. formatter: Pt
  9719. }),
  9720. value: t,
  9721. viewProps: i.viewProps
  9722. });
  9723. }
  9724. }, Ui = {
  9725. monitor: {
  9726. defaultInterval: 200,
  9727. defaultLineCount: 3
  9728. }
  9729. }, Jo = D2("mll");
  9730. class Ec {
  9731. constructor(e, t) {
  9732. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(Jo()), t.viewProps.bindClassModifiers(this.element);
  9733. const l = e.createElement("textarea");
  9734. l.classList.add(Jo("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_();
  9735. }
  9736. update_() {
  9737. const e = this.textareaElem_, t = e.scrollTop === e.scrollHeight - e.clientHeight, l = [];
  9738. this.value.rawValue.forEach((b) => {
  9739. b !== void 0 && l.push(this.formatter_(b));
  9740. }), e.textContent = l.join(`
  9741. `), t && (e.scrollTop = e.scrollHeight);
  9742. }
  9743. onValueUpdate_() {
  9744. this.update_();
  9745. }
  9746. }
  9747. class Yr {
  9748. constructor(e, t) {
  9749. this.value = t.value, this.viewProps = t.viewProps, this.view = new Ec(e, {
  9750. formatter: t.formatter,
  9751. lineCount: t.lineCount,
  9752. value: this.value,
  9753. viewProps: this.viewProps
  9754. });
  9755. }
  9756. }
  9757. const ea = D2("sgl");
  9758. class Cc {
  9759. constructor(e, t) {
  9760. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(ea()), t.viewProps.bindClassModifiers(this.element);
  9761. const l = e.createElement("input");
  9762. l.classList.add(ea("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_();
  9763. }
  9764. update_() {
  9765. const e = this.value.rawValue, t = e[e.length - 1];
  9766. this.inputElement.value = t !== void 0 ? this.formatter_(t) : "";
  9767. }
  9768. onValueUpdate_() {
  9769. this.update_();
  9770. }
  9771. }
  9772. class qr {
  9773. constructor(e, t) {
  9774. this.value = t.value, this.viewProps = t.viewProps, this.view = new Cc(e, {
  9775. formatter: t.formatter,
  9776. value: this.value,
  9777. viewProps: this.viewProps
  9778. });
  9779. }
  9780. }
  9781. const Pc = {
  9782. id: "monitor-bool",
  9783. type: "monitor",
  9784. accept: (i, e) => {
  9785. if (typeof i != "boolean")
  9786. return null;
  9787. const l = le(e, {
  9788. lineCount: M.optional.number
  9789. });
  9790. return l ? {
  9791. initialValue: i,
  9792. params: l
  9793. } : null;
  9794. },
  9795. binding: {
  9796. reader: (i) => vs
  9797. },
  9798. controller: (i) => {
  9799. var e;
  9800. return i.value.rawValue.length === 1 ? new qr(i.document, {
  9801. formatter: bs,
  9802. value: i.value,
  9803. viewProps: i.viewProps
  9804. }) : new Yr(i.document, {
  9805. formatter: bs,
  9806. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  9807. value: i.value,
  9808. viewProps: i.viewProps
  9809. });
  9810. }
  9811. }, nn = D2("grl");
  9812. class Tc {
  9813. constructor(e, t) {
  9814. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = e.createElement("div"), this.element.classList.add(nn()), t.viewProps.bindClassModifiers(this.element), this.formatter_ = t.formatter, this.props_ = t.props, this.cursor_ = t.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  9815. const l = e.createElementNS(ze, "svg");
  9816. l.classList.add(nn("g")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, this.element.appendChild(l), this.svgElem_ = l;
  9817. const b = e.createElementNS(ze, "polyline");
  9818. this.svgElem_.appendChild(b), this.lineElem_ = b;
  9819. const E = e.createElement("div");
  9820. E.classList.add(nn("t"), D2("tt")()), this.element.appendChild(E), this.tooltipElem_ = E, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  9821. }
  9822. get graphElement() {
  9823. return this.svgElem_;
  9824. }
  9825. update_() {
  9826. const e = this.svgElem_.getBoundingClientRect(), t = this.value.rawValue.length - 1, l = this.props_.get("minValue"), b = this.props_.get("maxValue"), E = [];
  9827. this.value.rawValue.forEach((de, ve) => {
  9828. if (de === void 0)
  9829. return;
  9830. const Ln = _e(ve, 0, t, 0, e.width), Gi = _e(de, l, b, e.height, 0);
  9831. E.push([Ln, Gi].join(","));
  9832. }), this.lineElem_.setAttributeNS(null, "points", E.join(" "));
  9833. const k = this.tooltipElem_, B = this.value.rawValue[this.cursor_.rawValue];
  9834. if (B === void 0) {
  9835. k.classList.remove(nn("t", "a"));
  9836. return;
  9837. }
  9838. const Q = _e(this.cursor_.rawValue, 0, t, 0, e.width), J = _e(B, l, b, e.height, 0);
  9839. k.style.left = `${Q}px`, k.style.top = `${J}px`, k.textContent = `${this.formatter_(B)}`, k.classList.contains(nn("t", "a")) || (k.classList.add(nn("t", "a"), nn("t", "in")), rt(k), k.classList.remove(nn("t", "in")));
  9840. }
  9841. onValueUpdate_() {
  9842. this.update_();
  9843. }
  9844. onCursorChange_() {
  9845. this.update_();
  9846. }
  9847. }
  9848. class kc {
  9849. constructor(e, t) {
  9850. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = t.props, this.value = t.value, this.viewProps = t.viewProps, this.cursor_ = ee(-1), this.view = new Tc(e, {
  9851. cursor: this.cursor_,
  9852. formatter: t.formatter,
  9853. lineCount: t.lineCount,
  9854. props: this.props_,
  9855. value: this.value,
  9856. viewProps: this.viewProps
  9857. }), !ft(e))
  9858. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  9859. else {
  9860. const l = new Vt(this.view.element);
  9861. l.emitter.on("down", this.onGraphPointerDown_), l.emitter.on("move", this.onGraphPointerMove_), l.emitter.on("up", this.onGraphPointerUp_);
  9862. }
  9863. }
  9864. onGraphMouseLeave_() {
  9865. this.cursor_.rawValue = -1;
  9866. }
  9867. onGraphMouseMove_(e) {
  9868. const t = this.view.element.getBoundingClientRect();
  9869. this.cursor_.rawValue = Math.floor(_e(e.offsetX, 0, t.width, 0, this.value.rawValue.length));
  9870. }
  9871. onGraphPointerDown_(e) {
  9872. this.onGraphPointerMove_(e);
  9873. }
  9874. onGraphPointerMove_(e) {
  9875. if (!e.data.point) {
  9876. this.cursor_.rawValue = -1;
  9877. return;
  9878. }
  9879. this.cursor_.rawValue = Math.floor(_e(e.data.point.x, 0, e.data.bounds.width, 0, this.value.rawValue.length));
  9880. }
  9881. onGraphPointerUp_() {
  9882. this.cursor_.rawValue = -1;
  9883. }
  9884. }
  9885. function Qr(i) {
  9886. return "format" in i && !_(i.format) ? i.format : Ie(2);
  9887. }
  9888. function Mc(i) {
  9889. var e;
  9890. return i.value.rawValue.length === 1 ? new qr(i.document, {
  9891. formatter: Qr(i.params),
  9892. value: i.value,
  9893. viewProps: i.viewProps
  9894. }) : new Yr(i.document, {
  9895. formatter: Qr(i.params),
  9896. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  9897. value: i.value,
  9898. viewProps: i.viewProps
  9899. });
  9900. }
  9901. function Sc(i) {
  9902. var e, t, l;
  9903. return new kc(i.document, {
  9904. formatter: Qr(i.params),
  9905. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  9906. props: X.fromObject({
  9907. maxValue: (t = "max" in i.params ? i.params.max : null) !== null && t !== void 0 ? t : 100,
  9908. minValue: (l = "min" in i.params ? i.params.min : null) !== null && l !== void 0 ? l : 0
  9909. }),
  9910. value: i.value,
  9911. viewProps: i.viewProps
  9912. });
  9913. }
  9914. function ta(i) {
  9915. return "view" in i && i.view === "graph";
  9916. }
  9917. const Lc = {
  9918. id: "monitor-number",
  9919. type: "monitor",
  9920. accept: (i, e) => {
  9921. if (typeof i != "number")
  9922. return null;
  9923. const t = M, l = le(e, {
  9924. format: t.optional.function,
  9925. lineCount: t.optional.number,
  9926. max: t.optional.number,
  9927. min: t.optional.number,
  9928. view: t.optional.string
  9929. });
  9930. return l ? {
  9931. initialValue: i,
  9932. params: l
  9933. } : null;
  9934. },
  9935. binding: {
  9936. defaultBufferSize: (i) => ta(i) ? 64 : 1,
  9937. reader: (i) => bt
  9938. },
  9939. controller: (i) => ta(i.params) ? Sc(i) : Mc(i)
  9940. }, Ac = {
  9941. id: "monitor-string",
  9942. type: "monitor",
  9943. accept: (i, e) => {
  9944. if (typeof i != "string")
  9945. return null;
  9946. const t = M, l = le(e, {
  9947. lineCount: t.optional.number,
  9948. multiline: t.optional.boolean
  9949. });
  9950. return l ? {
  9951. initialValue: i,
  9952. params: l
  9953. } : null;
  9954. },
  9955. binding: {
  9956. reader: (i) => Ai
  9957. },
  9958. controller: (i) => {
  9959. var e;
  9960. const t = i.value;
  9961. return t.rawValue.length > 1 || "multiline" in i.params && i.params.multiline ? new Yr(i.document, {
  9962. formatter: Pt,
  9963. lineCount: (e = i.params.lineCount) !== null && e !== void 0 ? e : Ui.monitor.defaultLineCount,
  9964. value: t,
  9965. viewProps: i.viewProps
  9966. }) : new qr(i.document, {
  9967. formatter: Pt,
  9968. value: t,
  9969. viewProps: i.viewProps
  9970. });
  9971. }
  9972. };
  9973. function Rc(i, e) {
  9974. var t;
  9975. const l = i.accept(e.target.read(), e.params);
  9976. if (_(l))
  9977. return null;
  9978. const b = M, E = {
  9979. target: e.target,
  9980. initialValue: l.initialValue,
  9981. params: l.params
  9982. }, k = i.binding.reader(E), B = i.binding.constraint ? i.binding.constraint(E) : void 0, Q = ee(k(l.initialValue), {
  9983. constraint: B,
  9984. equals: i.binding.equals
  9985. }), J = new Qn({
  9986. reader: k,
  9987. target: e.target,
  9988. value: Q,
  9989. writer: i.binding.writer(E)
  9990. }), de = b.optional.boolean(e.params.disabled).value, ve = b.optional.boolean(e.params.hidden).value, Ln = i.controller({
  9991. constraint: B,
  9992. document: e.document,
  9993. initialValue: l.initialValue,
  9994. params: l.params,
  9995. value: J.value,
  9996. viewProps: Ye.create({
  9997. disabled: de,
  9998. hidden: ve
  9999. })
  10000. });
  10001. return new je(e.document, {
  10002. binding: J,
  10003. blade: ye(),
  10004. props: X.fromObject({
  10005. label: "label" in e.params ? (t = b.optional.string(e.params.label).value) !== null && t !== void 0 ? t : null : e.target.key
  10006. }),
  10007. valueController: Ln
  10008. });
  10009. }
  10010. function Ic(i, e) {
  10011. return e === 0 ? new us() : new Ci(i, e ?? Ui.monitor.defaultInterval);
  10012. }
  10013. function Vc(i, e) {
  10014. var t, l, b;
  10015. const E = M, k = i.accept(e.target.read(), e.params);
  10016. if (_(k))
  10017. return null;
  10018. const B = {
  10019. target: e.target,
  10020. initialValue: k.initialValue,
  10021. params: k.params
  10022. }, Q = i.binding.reader(B), J = (l = (t = E.optional.number(e.params.bufferSize).value) !== null && t !== void 0 ? t : i.binding.defaultBufferSize && i.binding.defaultBufferSize(k.params)) !== null && l !== void 0 ? l : 1, de = E.optional.number(e.params.interval).value, ve = new pr({
  10023. reader: Q,
  10024. target: e.target,
  10025. ticker: Ic(e.document, de),
  10026. value: ps(J)
  10027. }), Ln = E.optional.boolean(e.params.disabled).value, Gi = E.optional.boolean(e.params.hidden).value, Hi = i.controller({
  10028. document: e.document,
  10029. params: k.params,
  10030. value: ve.value,
  10031. viewProps: Ye.create({
  10032. disabled: Ln,
  10033. hidden: Gi
  10034. })
  10035. });
  10036. return new ot(e.document, {
  10037. binding: ve,
  10038. blade: ye(),
  10039. props: X.fromObject({
  10040. label: "label" in e.params ? (b = E.optional.string(e.params.label).value) !== null && b !== void 0 ? b : null : e.target.key
  10041. }),
  10042. valueController: Hi
  10043. });
  10044. }
  10045. class Dc {
  10046. constructor() {
  10047. this.pluginsMap_ = {
  10048. blades: [],
  10049. inputs: [],
  10050. monitors: []
  10051. };
  10052. }
  10053. getAll() {
  10054. return [
  10055. ...this.pluginsMap_.blades,
  10056. ...this.pluginsMap_.inputs,
  10057. ...this.pluginsMap_.monitors
  10058. ];
  10059. }
  10060. register(e) {
  10061. e.type === "blade" ? this.pluginsMap_.blades.unshift(e) : e.type === "input" ? this.pluginsMap_.inputs.unshift(e) : e.type === "monitor" && this.pluginsMap_.monitors.unshift(e);
  10062. }
  10063. createInput(e, t, l) {
  10064. const b = t.read();
  10065. if (_(b))
  10066. throw new S({
  10067. context: {
  10068. key: t.key
  10069. },
  10070. type: "nomatchingcontroller"
  10071. });
  10072. const E = this.pluginsMap_.inputs.reduce((k, B) => k ?? Rc(B, {
  10073. document: e,
  10074. target: t,
  10075. params: l
  10076. }), null);
  10077. if (E)
  10078. return E;
  10079. throw new S({
  10080. context: {
  10081. key: t.key
  10082. },
  10083. type: "nomatchingcontroller"
  10084. });
  10085. }
  10086. createMonitor(e, t, l) {
  10087. const b = this.pluginsMap_.monitors.reduce((E, k) => E ?? Vc(k, {
  10088. document: e,
  10089. params: l,
  10090. target: t
  10091. }), null);
  10092. if (b)
  10093. return b;
  10094. throw new S({
  10095. context: {
  10096. key: t.key
  10097. },
  10098. type: "nomatchingcontroller"
  10099. });
  10100. }
  10101. createBlade(e, t) {
  10102. const l = this.pluginsMap_.blades.reduce((b, E) => b ?? ur(E, {
  10103. document: e,
  10104. params: t
  10105. }), null);
  10106. if (!l)
  10107. throw new S({
  10108. type: "nomatchingview",
  10109. context: {
  10110. params: t
  10111. }
  10112. });
  10113. return l;
  10114. }
  10115. createBladeApi(e) {
  10116. if (e instanceof je)
  10117. return new vi(e);
  10118. if (e instanceof ot)
  10119. return new bi(e);
  10120. if (e instanceof mn)
  10121. return new Xn(e, this);
  10122. const t = this.pluginsMap_.blades.reduce((l, b) => l ?? b.api({
  10123. controller: e,
  10124. pool: this
  10125. }), null);
  10126. if (!t)
  10127. throw S.shouldNeverHappen();
  10128. return t;
  10129. }
  10130. }
  10131. function Oc() {
  10132. const i = new Dc();
  10133. return [
  10134. Uc,
  10135. fc,
  10136. wc,
  10137. xc,
  10138. ac,
  10139. nc,
  10140. tc,
  10141. Zl,
  10142. ii,
  10143. Pc,
  10144. Ac,
  10145. Lc,
  10146. W,
  10147. rr,
  10148. ar,
  10149. Ei
  10150. ].forEach((e) => {
  10151. i.register(e);
  10152. }), i;
  10153. }
  10154. function Nc(i) {
  10155. return en.isObject(i) ? new en(i.x, i.y) : new en();
  10156. }
  10157. function Fc(i, e) {
  10158. i.writeProperty("x", e.x), i.writeProperty("y", e.y);
  10159. }
  10160. function Ft(i, e) {
  10161. if (!i)
  10162. return;
  10163. const t = [], l = Xo(i, e);
  10164. l && t.push(l);
  10165. const b = Yo(i);
  10166. return b && t.push(b), new bn(t);
  10167. }
  10168. function Bc(i, e) {
  10169. return new Jt({
  10170. assembly: qo,
  10171. components: [
  10172. Ft("x" in i ? i.x : void 0, e.x),
  10173. Ft("y" in i ? i.y : void 0, e.y)
  10174. ]
  10175. });
  10176. }
  10177. function na(i, e) {
  10178. const [t, l] = i ? rc(i) : [];
  10179. if (!_(t) || !_(l))
  10180. return Math.max(Math.abs(t ?? 0), Math.abs(l ?? 0));
  10181. const b = Dt(i);
  10182. return Math.max(Math.abs(b) * 10, Math.abs(e) * 10);
  10183. }
  10184. function jc(i, e) {
  10185. const t = e instanceof Jt ? e.components[0] : void 0, l = e instanceof Jt ? e.components[1] : void 0, b = na(t, i.x), E = na(l, i.y);
  10186. return Math.max(b, E);
  10187. }
  10188. function ia(i, e) {
  10189. return {
  10190. baseStep: Dt(e),
  10191. constraint: e,
  10192. textProps: X.fromObject({
  10193. draggingScale: Ot(e, i),
  10194. formatter: Ie(ni(e, i))
  10195. })
  10196. };
  10197. }
  10198. function zc(i) {
  10199. if (!("y" in i))
  10200. return false;
  10201. const e = i.y;
  10202. return e && "inverted" in e ? !!e.inverted : false;
  10203. }
  10204. const Uc = {
  10205. id: "input-point2d",
  10206. type: "input",
  10207. accept: (i, e) => {
  10208. if (!en.isObject(i))
  10209. return null;
  10210. const t = M, l = le(e, {
  10211. expanded: t.optional.boolean,
  10212. picker: t.optional.custom(Fi),
  10213. x: t.optional.custom(gt),
  10214. y: t.optional.object({
  10215. inverted: t.optional.boolean,
  10216. max: t.optional.number,
  10217. min: t.optional.number,
  10218. step: t.optional.number
  10219. })
  10220. });
  10221. return l ? {
  10222. initialValue: i,
  10223. params: l
  10224. } : null;
  10225. },
  10226. binding: {
  10227. reader: (i) => Nc,
  10228. constraint: (i) => Bc(i.params, i.initialValue),
  10229. equals: en.equals,
  10230. writer: (i) => Fc
  10231. },
  10232. controller: (i) => {
  10233. const e = i.document, t = i.value, l = i.constraint;
  10234. if (!(l instanceof Jt))
  10235. throw S.shouldNeverHappen();
  10236. const b = "expanded" in i.params ? i.params.expanded : void 0, E = "picker" in i.params ? i.params.picker : void 0;
  10237. return new pc(e, {
  10238. axes: [
  10239. ia(t.rawValue.x, l.components[0]),
  10240. ia(t.rawValue.y, l.components[1])
  10241. ],
  10242. expanded: b ?? false,
  10243. invertsY: zc(i.params),
  10244. maxValue: jc(t.rawValue, l),
  10245. parser: lt,
  10246. pickerLayout: E ?? "popup",
  10247. value: t,
  10248. viewProps: i.viewProps
  10249. });
  10250. }
  10251. };
  10252. class sa extends a {
  10253. constructor(e) {
  10254. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10255. this.emitter_.emit("change", {
  10256. event: new p(this, t.rawValue)
  10257. });
  10258. });
  10259. }
  10260. get label() {
  10261. return this.controller_.props.get("label");
  10262. }
  10263. set label(e) {
  10264. this.controller_.props.set("label", e);
  10265. }
  10266. get options() {
  10267. return this.controller_.valueController.props.get("options");
  10268. }
  10269. set options(e) {
  10270. this.controller_.valueController.props.set("options", e);
  10271. }
  10272. get value() {
  10273. return this.controller_.valueController.value.rawValue;
  10274. }
  10275. set value(e) {
  10276. this.controller_.valueController.value.rawValue = e;
  10277. }
  10278. on(e, t) {
  10279. const l = t.bind(this);
  10280. return this.emitter_.on(e, (b) => {
  10281. l(b.event);
  10282. }), this;
  10283. }
  10284. }
  10285. class ra extends a {
  10286. constructor(e) {
  10287. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10288. this.emitter_.emit("change", {
  10289. event: new p(this, t.rawValue)
  10290. });
  10291. });
  10292. }
  10293. get label() {
  10294. return this.controller_.props.get("label");
  10295. }
  10296. set label(e) {
  10297. this.controller_.props.set("label", e);
  10298. }
  10299. get maxValue() {
  10300. return this.controller_.valueController.sliderController.props.get("maxValue");
  10301. }
  10302. set maxValue(e) {
  10303. this.controller_.valueController.sliderController.props.set("maxValue", e);
  10304. }
  10305. get minValue() {
  10306. return this.controller_.valueController.sliderController.props.get("minValue");
  10307. }
  10308. set minValue(e) {
  10309. this.controller_.valueController.sliderController.props.set("minValue", e);
  10310. }
  10311. get value() {
  10312. return this.controller_.valueController.value.rawValue;
  10313. }
  10314. set value(e) {
  10315. this.controller_.valueController.value.rawValue = e;
  10316. }
  10317. on(e, t) {
  10318. const l = t.bind(this);
  10319. return this.emitter_.on(e, (b) => {
  10320. l(b.event);
  10321. }), this;
  10322. }
  10323. }
  10324. class oa extends a {
  10325. constructor(e) {
  10326. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10327. this.emitter_.emit("change", {
  10328. event: new p(this, t.rawValue)
  10329. });
  10330. });
  10331. }
  10332. get label() {
  10333. return this.controller_.props.get("label");
  10334. }
  10335. set label(e) {
  10336. this.controller_.props.set("label", e);
  10337. }
  10338. get formatter() {
  10339. return this.controller_.valueController.props.get("formatter");
  10340. }
  10341. set formatter(e) {
  10342. this.controller_.valueController.props.set("formatter", e);
  10343. }
  10344. get value() {
  10345. return this.controller_.valueController.value.rawValue;
  10346. }
  10347. set value(e) {
  10348. this.controller_.valueController.value.rawValue = e;
  10349. }
  10350. on(e, t) {
  10351. const l = t.bind(this);
  10352. return this.emitter_.on(e, (b) => {
  10353. l(b.event);
  10354. }), this;
  10355. }
  10356. }
  10357. const Gc = function() {
  10358. return {
  10359. id: "list",
  10360. type: "blade",
  10361. accept(i) {
  10362. const e = M, t = le(i, {
  10363. options: e.required.custom(Pn),
  10364. value: e.required.raw,
  10365. view: e.required.constant("list"),
  10366. label: e.optional.string
  10367. });
  10368. return t ? { params: t } : null;
  10369. },
  10370. controller(i) {
  10371. const e = new gn(ks(i.params.options)), t = ee(i.params.value, {
  10372. constraint: e
  10373. }), l = new _n(i.document, {
  10374. props: new X({
  10375. options: e.values.value("options")
  10376. }),
  10377. value: t,
  10378. viewProps: i.viewProps
  10379. });
  10380. return new Kt(i.document, {
  10381. blade: i.blade,
  10382. props: X.fromObject({
  10383. label: i.params.label
  10384. }),
  10385. valueController: l
  10386. });
  10387. },
  10388. api(i) {
  10389. return !(i.controller instanceof Kt) || !(i.controller.valueController instanceof _n) ? null : new sa(i.controller);
  10390. }
  10391. };
  10392. }();
  10393. function Hc(i) {
  10394. return i.reduce((e, t) => Object.assign(e, {
  10395. [t.presetKey]: t.read()
  10396. }), {});
  10397. }
  10398. function Kc(i, e) {
  10399. i.forEach((t) => {
  10400. const l = e[t.target.presetKey];
  10401. l !== void 0 && t.writer(t.target, t.reader(l));
  10402. });
  10403. }
  10404. class $c extends gi {
  10405. /**
  10406. * @hidden
  10407. */
  10408. constructor(e, t) {
  10409. super(e, t);
  10410. }
  10411. get element() {
  10412. return this.controller_.view.element;
  10413. }
  10414. /**
  10415. * Imports a preset of all inputs.
  10416. * @param preset The preset object to import.
  10417. */
  10418. importPreset(e) {
  10419. const t = this.controller_.rackController.rack.find(je).map((l) => l.binding);
  10420. Kc(t, e), this.refresh();
  10421. }
  10422. /**
  10423. * Exports a preset of all inputs.
  10424. * @return An exported preset object.
  10425. */
  10426. exportPreset() {
  10427. const e = this.controller_.rackController.rack.find(je).map((t) => t.binding.target);
  10428. return Hc(e);
  10429. }
  10430. /**
  10431. * Refreshes all bindings of the pane.
  10432. */
  10433. refresh() {
  10434. this.controller_.rackController.rack.find(je).forEach((e) => {
  10435. e.binding.read();
  10436. }), this.controller_.rackController.rack.find(ot).forEach((e) => {
  10437. e.binding.read();
  10438. });
  10439. }
  10440. }
  10441. class Xc extends Yn {
  10442. constructor(e, t) {
  10443. super(e, {
  10444. expanded: t.expanded,
  10445. blade: t.blade,
  10446. props: t.props,
  10447. root: true,
  10448. viewProps: t.viewProps
  10449. });
  10450. }
  10451. }
  10452. const Yc = {
  10453. id: "slider",
  10454. type: "blade",
  10455. accept(i) {
  10456. const e = M, t = le(i, {
  10457. max: e.required.number,
  10458. min: e.required.number,
  10459. view: e.required.constant("slider"),
  10460. format: e.optional.function,
  10461. label: e.optional.string,
  10462. value: e.optional.number
  10463. });
  10464. return t ? { params: t } : null;
  10465. },
  10466. controller(i) {
  10467. var e, t;
  10468. const l = (e = i.params.value) !== null && e !== void 0 ? e : 0, b = new qt({
  10469. max: i.params.max,
  10470. min: i.params.min
  10471. }), E = new ti(i.document, {
  10472. baseStep: 1,
  10473. parser: lt,
  10474. sliderProps: new X({
  10475. maxValue: b.values.value("max"),
  10476. minValue: b.values.value("min")
  10477. }),
  10478. textProps: X.fromObject({
  10479. draggingScale: Ot(void 0, l),
  10480. formatter: (t = i.params.format) !== null && t !== void 0 ? t : Sr
  10481. }),
  10482. value: ee(l, {
  10483. constraint: b
  10484. }),
  10485. viewProps: i.viewProps
  10486. });
  10487. return new Kt(i.document, {
  10488. blade: i.blade,
  10489. props: X.fromObject({
  10490. label: i.params.label
  10491. }),
  10492. valueController: E
  10493. });
  10494. },
  10495. api(i) {
  10496. return !(i.controller instanceof Kt) || !(i.controller.valueController instanceof ti) ? null : new ra(i.controller);
  10497. }
  10498. }, qc = function() {
  10499. return {
  10500. id: "text",
  10501. type: "blade",
  10502. accept(i) {
  10503. const e = M, t = le(i, {
  10504. parse: e.required.function,
  10505. value: e.required.raw,
  10506. view: e.required.constant("text"),
  10507. format: e.optional.function,
  10508. label: e.optional.string
  10509. });
  10510. return t ? { params: t } : null;
  10511. },
  10512. controller(i) {
  10513. var e;
  10514. const t = new Wn(i.document, {
  10515. parser: i.params.parse,
  10516. props: X.fromObject({
  10517. formatter: (e = i.params.format) !== null && e !== void 0 ? e : (l) => String(l)
  10518. }),
  10519. value: ee(i.params.value),
  10520. viewProps: i.viewProps
  10521. });
  10522. return new Kt(i.document, {
  10523. blade: i.blade,
  10524. props: X.fromObject({
  10525. label: i.params.label
  10526. }),
  10527. valueController: t
  10528. });
  10529. },
  10530. api(i) {
  10531. return !(i.controller instanceof Kt) || !(i.controller.valueController instanceof Wn) ? null : new oa(i.controller);
  10532. }
  10533. };
  10534. }();
  10535. function Qc(i) {
  10536. const e = i.createElement("div");
  10537. return e.classList.add(D2("dfw")()), i.body && i.body.appendChild(e), e;
  10538. }
  10539. function aa(i, e, t) {
  10540. if (i.querySelector(`style[data-tp-style=${e}]`))
  10541. return;
  10542. const l = i.createElement("style");
  10543. l.dataset.tpStyle = e, l.textContent = t, i.head.appendChild(l);
  10544. }
  10545. class Zc extends $c {
  10546. constructor(e) {
  10547. var t, l;
  10548. const b = e ?? {}, E = (t = b.document) !== null && t !== void 0 ? t : mi(), k = Oc(), B = new Xc(E, {
  10549. expanded: b.expanded,
  10550. blade: ye(),
  10551. props: X.fromObject({
  10552. title: b.title
  10553. }),
  10554. viewProps: Ye.create()
  10555. });
  10556. super(B, k), this.pool_ = k, this.containerElem_ = (l = b.container) !== null && l !== void 0 ? l : Qc(E), this.containerElem_.appendChild(this.element), this.doc_ = E, this.usesDefaultWrapper_ = !b.container, this.setUpDefaultPlugins_();
  10557. }
  10558. get document() {
  10559. if (!this.doc_)
  10560. throw S.alreadyDisposed();
  10561. return this.doc_;
  10562. }
  10563. dispose() {
  10564. const e = this.containerElem_;
  10565. if (!e)
  10566. throw S.alreadyDisposed();
  10567. if (this.usesDefaultWrapper_) {
  10568. const t = e.parentElement;
  10569. t && t.removeChild(e);
  10570. }
  10571. this.containerElem_ = null, this.doc_ = null, super.dispose();
  10572. }
  10573. registerPlugin(e) {
  10574. ("plugin" in e ? [e.plugin] : "plugins" in e ? e.plugins : []).forEach((l) => {
  10575. this.pool_.register(l), this.embedPluginStyle_(l);
  10576. });
  10577. }
  10578. embedPluginStyle_(e) {
  10579. e.css && aa(this.document, `plugin-${e.id}`, e.css);
  10580. }
  10581. setUpDefaultPlugins_() {
  10582. aa(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) => {
  10583. this.embedPluginStyle_(e);
  10584. }), this.registerPlugin({
  10585. plugins: [
  10586. Yc,
  10587. Gc,
  10588. Ei,
  10589. qc
  10590. ]
  10591. });
  10592. }
  10593. }
  10594. const Wc = new s("3.1.7");
  10595. r.BladeApi = a, r.ButtonApi = j, r.FolderApi = gi, r.InputBindingApi = vi, r.ListApi = sa, r.MonitorBindingApi = bi, r.Pane = Zc, r.SeparatorApi = os, r.SliderApi = ra, r.TabApi = ls, r.TabPageApi = xi, r.TextApi = oa, r.TpChangeEvent = p, r.VERSION = Wc, Object.defineProperty(r, "__esModule", { value: true });
  10596. });
  10597. })(Dh, Gs);
  10598. var ts = {};
  10599. var Oh = {
  10600. get exports() {
  10601. return ts;
  10602. },
  10603. set exports(v) {
  10604. ts = v;
  10605. }
  10606. };
  10607. (function(v, n) {
  10608. (function(r, s) {
  10609. s(n);
  10610. })(rl, function(r) {
  10611. class s {
  10612. constructor(o) {
  10613. this.controller_ = o;
  10614. }
  10615. get element() {
  10616. return this.controller_.view.element;
  10617. }
  10618. get disabled() {
  10619. return this.controller_.viewProps.get("disabled");
  10620. }
  10621. set disabled(o) {
  10622. this.controller_.viewProps.set("disabled", o);
  10623. }
  10624. get hidden() {
  10625. return this.controller_.viewProps.get("hidden");
  10626. }
  10627. set hidden(o) {
  10628. this.controller_.viewProps.set("hidden", o);
  10629. }
  10630. dispose() {
  10631. this.controller_.viewProps.set("disposed", true);
  10632. }
  10633. }
  10634. class a {
  10635. constructor(o) {
  10636. this.target = o;
  10637. }
  10638. }
  10639. class c extends a {
  10640. constructor(o, u, f, x) {
  10641. super(o), this.value = u, this.presetKey = f, this.last = x ?? true;
  10642. }
  10643. }
  10644. function p(m) {
  10645. return m;
  10646. }
  10647. function h(m) {
  10648. return m == null;
  10649. }
  10650. const d = {
  10651. alreadydisposed: () => "View has been already disposed",
  10652. invalidparams: (m) => `Invalid parameters for '${m.name}'`,
  10653. nomatchingcontroller: (m) => `No matching controller for '${m.key}'`,
  10654. nomatchingview: (m) => `No matching view for '${JSON.stringify(m.params)}'`,
  10655. notbindable: () => "Value is not bindable",
  10656. propertynotfound: (m) => `Property '${m.name}' not found`,
  10657. shouldneverhappen: () => "This error should never happen"
  10658. };
  10659. class g {
  10660. constructor(o) {
  10661. var u;
  10662. this.message = (u = d[o.type](o.context)) !== null && u !== void 0 ? u : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = o.type;
  10663. }
  10664. static alreadyDisposed() {
  10665. return new g({ type: "alreadydisposed" });
  10666. }
  10667. static notBindable() {
  10668. return new g({
  10669. type: "notbindable"
  10670. });
  10671. }
  10672. static propertyNotFound(o) {
  10673. return new g({
  10674. type: "propertynotfound",
  10675. context: {
  10676. name: o
  10677. }
  10678. });
  10679. }
  10680. static shouldNeverHappen() {
  10681. return new g({ type: "shouldneverhappen" });
  10682. }
  10683. }
  10684. class w {
  10685. constructor() {
  10686. this.observers_ = {};
  10687. }
  10688. on(o, u) {
  10689. let f = this.observers_[o];
  10690. return f || (f = this.observers_[o] = []), f.push({
  10691. handler: u
  10692. }), this;
  10693. }
  10694. off(o, u) {
  10695. const f = this.observers_[o];
  10696. return f && (this.observers_[o] = f.filter((x) => x.handler !== u)), this;
  10697. }
  10698. emit(o, u) {
  10699. const f = this.observers_[o];
  10700. f && f.forEach((x) => {
  10701. x.handler(u);
  10702. });
  10703. }
  10704. }
  10705. const _ = "tp";
  10706. function y(m) {
  10707. return (u, f) => [
  10708. _,
  10709. "-",
  10710. m,
  10711. "v",
  10712. u ? `_${u}` : "",
  10713. f ? `-${f}` : ""
  10714. ].join("");
  10715. }
  10716. function P(m, o) {
  10717. return (u) => o(m(u));
  10718. }
  10719. function I2(m) {
  10720. return m.rawValue;
  10721. }
  10722. function S(m, o) {
  10723. m.emitter.on("change", P(I2, o)), o(m.rawValue);
  10724. }
  10725. function R(m, o, u) {
  10726. S(m.value(o), u);
  10727. }
  10728. function j(m, o, u) {
  10729. u ? m.classList.add(o) : m.classList.remove(o);
  10730. }
  10731. function F(m, o) {
  10732. return (u) => {
  10733. j(m, o, u);
  10734. };
  10735. }
  10736. function V(m, o) {
  10737. S(m, (u) => {
  10738. o.textContent = u ?? "";
  10739. });
  10740. }
  10741. const D2 = y("btn");
  10742. class Y {
  10743. constructor(o, u) {
  10744. this.element = o.createElement("div"), this.element.classList.add(D2()), u.viewProps.bindClassModifiers(this.element);
  10745. const f = o.createElement("button");
  10746. f.classList.add(D2("b")), u.viewProps.bindDisabled(f), this.element.appendChild(f), this.buttonElement = f;
  10747. const x = o.createElement("div");
  10748. x.classList.add(D2("t")), V(u.props.value("title"), x), this.buttonElement.appendChild(x);
  10749. }
  10750. }
  10751. class G {
  10752. constructor(o, u) {
  10753. this.emitter = new w(), this.onClick_ = this.onClick_.bind(this), this.props = u.props, this.viewProps = u.viewProps, this.view = new Y(o, {
  10754. props: this.props,
  10755. viewProps: this.viewProps
  10756. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  10757. }
  10758. onClick_() {
  10759. this.emitter.emit("click", {
  10760. sender: this
  10761. });
  10762. }
  10763. }
  10764. class N {
  10765. constructor(o, u) {
  10766. var f;
  10767. this.constraint_ = u == null ? void 0 : u.constraint, this.equals_ = (f = u == null ? void 0 : u.equals) !== null && f !== void 0 ? f : (x, T) => x === T, this.emitter = new w(), this.rawValue_ = o;
  10768. }
  10769. get constraint() {
  10770. return this.constraint_;
  10771. }
  10772. get rawValue() {
  10773. return this.rawValue_;
  10774. }
  10775. set rawValue(o) {
  10776. this.setRawValue(o, {
  10777. forceEmit: false,
  10778. last: true
  10779. });
  10780. }
  10781. setRawValue(o, u) {
  10782. const f = u ?? {
  10783. forceEmit: false,
  10784. last: true
  10785. }, x = this.constraint_ ? this.constraint_.constrain(o) : o, T = this.rawValue_;
  10786. this.equals_(T, x) && !f.forceEmit || (this.emitter.emit("beforechange", {
  10787. sender: this
  10788. }), this.rawValue_ = x, this.emitter.emit("change", {
  10789. options: f,
  10790. previousRawValue: T,
  10791. rawValue: x,
  10792. sender: this
  10793. }));
  10794. }
  10795. }
  10796. class O {
  10797. constructor(o) {
  10798. this.emitter = new w(), this.value_ = o;
  10799. }
  10800. get rawValue() {
  10801. return this.value_;
  10802. }
  10803. set rawValue(o) {
  10804. this.setRawValue(o, {
  10805. forceEmit: false,
  10806. last: true
  10807. });
  10808. }
  10809. setRawValue(o, u) {
  10810. const f = u ?? {
  10811. forceEmit: false,
  10812. last: true
  10813. }, x = this.value_;
  10814. x === o && !f.forceEmit || (this.emitter.emit("beforechange", {
  10815. sender: this
  10816. }), this.value_ = o, this.emitter.emit("change", {
  10817. options: f,
  10818. previousRawValue: x,
  10819. rawValue: this.value_,
  10820. sender: this
  10821. }));
  10822. }
  10823. }
  10824. function H(m, o) {
  10825. const u = o == null ? void 0 : o.constraint, f = o == null ? void 0 : o.equals;
  10826. return !u && !f ? new O(m) : new N(m, o);
  10827. }
  10828. class K {
  10829. constructor(o) {
  10830. this.emitter = new w(), this.valMap_ = o;
  10831. for (const u in this.valMap_)
  10832. this.valMap_[u].emitter.on("change", () => {
  10833. this.emitter.emit("change", {
  10834. key: u,
  10835. sender: this
  10836. });
  10837. });
  10838. }
  10839. static createCore(o) {
  10840. return Object.keys(o).reduce((f, x) => Object.assign(f, {
  10841. [x]: H(o[x])
  10842. }), {});
  10843. }
  10844. static fromObject(o) {
  10845. const u = this.createCore(o);
  10846. return new K(u);
  10847. }
  10848. get(o) {
  10849. return this.valMap_[o].rawValue;
  10850. }
  10851. set(o, u) {
  10852. this.valMap_[o].rawValue = u;
  10853. }
  10854. value(o) {
  10855. return this.valMap_[o];
  10856. }
  10857. }
  10858. function q(m, o) {
  10859. const f = Object.keys(o).reduce((x, T) => {
  10860. if (x === void 0)
  10861. return;
  10862. const A = o[T], z = A(m[T]);
  10863. return z.succeeded ? Object.assign(Object.assign({}, x), { [T]: z.value }) : void 0;
  10864. }, {});
  10865. return f;
  10866. }
  10867. function pe(m, o) {
  10868. return m.reduce((u, f) => {
  10869. if (u === void 0)
  10870. return;
  10871. const x = o(f);
  10872. if (!(!x.succeeded || x.value === void 0))
  10873. return [...u, x.value];
  10874. }, []);
  10875. }
  10876. function ge(m) {
  10877. return m === null ? false : typeof m == "object";
  10878. }
  10879. function ce(m) {
  10880. return (o) => (u) => {
  10881. if (!o && u === void 0)
  10882. return {
  10883. succeeded: false,
  10884. value: void 0
  10885. };
  10886. if (o && u === void 0)
  10887. return {
  10888. succeeded: true,
  10889. value: void 0
  10890. };
  10891. const f = m(u);
  10892. return f !== void 0 ? {
  10893. succeeded: true,
  10894. value: f
  10895. } : {
  10896. succeeded: false,
  10897. value: void 0
  10898. };
  10899. };
  10900. }
  10901. function me(m) {
  10902. return {
  10903. custom: (o) => ce(o)(m),
  10904. boolean: ce((o) => typeof o == "boolean" ? o : void 0)(m),
  10905. number: ce((o) => typeof o == "number" ? o : void 0)(m),
  10906. string: ce((o) => typeof o == "string" ? o : void 0)(m),
  10907. function: ce((o) => typeof o == "function" ? o : void 0)(m),
  10908. constant: (o) => ce((u) => u === o ? o : void 0)(m),
  10909. raw: ce((o) => o)(m),
  10910. object: (o) => ce((u) => {
  10911. if (ge(u))
  10912. return q(u, o);
  10913. })(m),
  10914. array: (o) => ce((u) => {
  10915. if (Array.isArray(u))
  10916. return pe(u, o);
  10917. })(m)
  10918. };
  10919. }
  10920. const he = {
  10921. optional: me(true),
  10922. required: me(false)
  10923. };
  10924. function ee(m, o) {
  10925. const u = he.required.object(o)(m);
  10926. return u.succeeded ? u.value : void 0;
  10927. }
  10928. function X(m) {
  10929. console.warn([
  10930. `Missing '${m.key}' of ${m.target} in ${m.place}.`,
  10931. "Please rebuild plugins with the latest core package."
  10932. ].join(" "));
  10933. }
  10934. function Pe(m) {
  10935. return m && m.parentElement && m.parentElement.removeChild(m), null;
  10936. }
  10937. class fe {
  10938. constructor(o) {
  10939. this.value_ = o;
  10940. }
  10941. static create(o) {
  10942. return [
  10943. new fe(o),
  10944. (u, f) => {
  10945. o.setRawValue(u, f);
  10946. }
  10947. ];
  10948. }
  10949. get emitter() {
  10950. return this.value_.emitter;
  10951. }
  10952. get rawValue() {
  10953. return this.value_.rawValue;
  10954. }
  10955. }
  10956. const ae = y("");
  10957. function ne(m, o) {
  10958. return F(m, ae(void 0, o));
  10959. }
  10960. class be extends K {
  10961. constructor(o) {
  10962. var u;
  10963. super(o), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = fe.create(H(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (u = this.get("parent")) === null || u === void 0 || u.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  10964. }
  10965. static create(o) {
  10966. var u, f, x;
  10967. const T = o ?? {};
  10968. return new be(K.createCore({
  10969. disabled: (u = T.disabled) !== null && u !== void 0 ? u : false,
  10970. disposed: false,
  10971. hidden: (f = T.hidden) !== null && f !== void 0 ? f : false,
  10972. parent: (x = T.parent) !== null && x !== void 0 ? x : null
  10973. }));
  10974. }
  10975. get globalDisabled() {
  10976. return this.globalDisabled_;
  10977. }
  10978. bindClassModifiers(o) {
  10979. S(this.globalDisabled_, ne(o, "disabled")), R(this, "hidden", ne(o, "hidden"));
  10980. }
  10981. bindDisabled(o) {
  10982. S(this.globalDisabled_, (u) => {
  10983. o.disabled = u;
  10984. });
  10985. }
  10986. bindTabIndex(o) {
  10987. S(this.globalDisabled_, (u) => {
  10988. o.tabIndex = u ? -1 : 0;
  10989. });
  10990. }
  10991. handleDispose(o) {
  10992. this.value("disposed").emitter.on("change", (u) => {
  10993. u && o();
  10994. });
  10995. }
  10996. getGlobalDisabled_() {
  10997. const o = this.get("parent");
  10998. return (o ? o.globalDisabled.rawValue : false) || this.get("disabled");
  10999. }
  11000. updateGlobalDisabled_() {
  11001. this.setGlobalDisabled_(this.getGlobalDisabled_());
  11002. }
  11003. onDisabledChange_() {
  11004. this.updateGlobalDisabled_();
  11005. }
  11006. onParentGlobalDisabledChange_() {
  11007. this.updateGlobalDisabled_();
  11008. }
  11009. onParentChange_(o) {
  11010. var u;
  11011. const f = o.previousRawValue;
  11012. f == null || f.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (u = this.get("parent")) === null || u === void 0 || u.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  11013. }
  11014. }
  11015. function M() {
  11016. return ["veryfirst", "first", "last", "verylast"];
  11017. }
  11018. const le = y(""), Ve = {
  11019. veryfirst: "vfst",
  11020. first: "fst",
  11021. last: "lst",
  11022. verylast: "vlst"
  11023. };
  11024. class Be {
  11025. constructor(o) {
  11026. this.parent_ = null, this.blade = o.blade, this.view = o.view, this.viewProps = o.viewProps;
  11027. const u = this.view.element;
  11028. this.blade.value("positions").emitter.on("change", () => {
  11029. M().forEach((f) => {
  11030. u.classList.remove(le(void 0, Ve[f]));
  11031. }), this.blade.get("positions").forEach((f) => {
  11032. u.classList.add(le(void 0, Ve[f]));
  11033. });
  11034. }), this.viewProps.handleDispose(() => {
  11035. Pe(u);
  11036. });
  11037. }
  11038. get parent() {
  11039. return this.parent_;
  11040. }
  11041. set parent(o) {
  11042. if (this.parent_ = o, !("parent" in this.viewProps.valMap_)) {
  11043. X({
  11044. key: "parent",
  11045. target: be.name,
  11046. place: "BladeController.parent"
  11047. });
  11048. return;
  11049. }
  11050. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  11051. }
  11052. }
  11053. const we = "http://www.w3.org/2000/svg";
  11054. function st(m) {
  11055. m.offsetHeight;
  11056. }
  11057. function jn(m, o) {
  11058. const u = m.style.transition;
  11059. m.style.transition = "none", o(), m.style.transition = u;
  11060. }
  11061. function Ye(m) {
  11062. return m.ontouchstart !== void 0;
  11063. }
  11064. function zn(m) {
  11065. for (; m.childNodes.length > 0; )
  11066. m.removeChild(m.childNodes[0]);
  11067. }
  11068. function cn(m) {
  11069. return m.relatedTarget ? m.relatedTarget : "explicitOriginalTarget" in m ? m.explicitOriginalTarget : null;
  11070. }
  11071. const mt = y("lbl");
  11072. function Mt(m, o) {
  11073. const u = m.createDocumentFragment();
  11074. return o.split(`
  11075. `).map((x) => m.createTextNode(x)).forEach((x, T) => {
  11076. T > 0 && u.appendChild(m.createElement("br")), u.appendChild(x);
  11077. }), u;
  11078. }
  11079. class ze {
  11080. constructor(o, u) {
  11081. this.element = o.createElement("div"), this.element.classList.add(mt()), u.viewProps.bindClassModifiers(this.element);
  11082. const f = o.createElement("div");
  11083. f.classList.add(mt("l")), R(u.props, "label", (T) => {
  11084. h(T) ? this.element.classList.add(mt(void 0, "nol")) : (this.element.classList.remove(mt(void 0, "nol")), zn(f), f.appendChild(Mt(o, T)));
  11085. }), this.element.appendChild(f), this.labelElement = f;
  11086. const x = o.createElement("div");
  11087. x.classList.add(mt("v")), this.element.appendChild(x), this.valueElement = x;
  11088. }
  11089. }
  11090. class rt extends Be {
  11091. constructor(o, u) {
  11092. const f = u.valueController.viewProps;
  11093. super(Object.assign(Object.assign({}, u), { view: new ze(o, {
  11094. props: u.props,
  11095. viewProps: f
  11096. }), viewProps: f })), this.props = u.props, this.valueController = u.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11097. }
  11098. }
  11099. class un extends Be {
  11100. constructor(o) {
  11101. super(o), this.value = o.value;
  11102. }
  11103. }
  11104. class ft extends K {
  11105. constructor(o) {
  11106. super(o);
  11107. }
  11108. static create(o) {
  11109. const u = {
  11110. completed: true,
  11111. expanded: o,
  11112. expandedHeight: null,
  11113. shouldFixHeight: false,
  11114. temporaryExpanded: null
  11115. }, f = K.createCore(u);
  11116. return new ft(f);
  11117. }
  11118. get styleExpanded() {
  11119. var o;
  11120. return (o = this.get("temporaryExpanded")) !== null && o !== void 0 ? o : this.get("expanded");
  11121. }
  11122. get styleHeight() {
  11123. if (!this.styleExpanded)
  11124. return "0";
  11125. const o = this.get("expandedHeight");
  11126. return this.get("shouldFixHeight") && !h(o) ? `${o}px` : "auto";
  11127. }
  11128. bindExpandedClass(o, u) {
  11129. const f = () => {
  11130. this.styleExpanded ? o.classList.add(u) : o.classList.remove(u);
  11131. };
  11132. R(this, "expanded", f), R(this, "temporaryExpanded", f);
  11133. }
  11134. cleanUpTransition() {
  11135. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  11136. }
  11137. }
  11138. function Un(m) {
  11139. return ft.create(m);
  11140. }
  11141. function mi(m, o) {
  11142. let u = 0;
  11143. return jn(o, () => {
  11144. m.set("expandedHeight", null), m.set("temporaryExpanded", true), st(o), u = o.clientHeight, m.set("temporaryExpanded", null), st(o);
  11145. }), u;
  11146. }
  11147. function Gn(m, o) {
  11148. o.style.height = m.styleHeight;
  11149. }
  11150. function Hn(m, o) {
  11151. m.value("expanded").emitter.on("beforechange", () => {
  11152. m.set("completed", false), h(m.get("expandedHeight")) && m.set("expandedHeight", mi(m, o)), m.set("shouldFixHeight", true), st(o);
  11153. }), m.emitter.on("change", () => {
  11154. Gn(m, o);
  11155. }), Gn(m, o), o.addEventListener("transitionend", (u) => {
  11156. u.propertyName === "height" && m.cleanUpTransition();
  11157. });
  11158. }
  11159. class xt {
  11160. constructor(o, u) {
  11161. const f = y(u.viewName);
  11162. this.element = o.createElement("div"), this.element.classList.add(f()), u.viewProps.bindClassModifiers(this.element);
  11163. }
  11164. }
  11165. class St extends un {
  11166. constructor(o, u) {
  11167. const f = u.valueController.viewProps;
  11168. super(Object.assign(Object.assign({}, u), { value: u.valueController.value, view: new ze(o, {
  11169. props: u.props,
  11170. viewProps: f
  11171. }), viewProps: f })), this.props = u.props, this.valueController = u.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11172. }
  11173. }
  11174. class Kn {
  11175. constructor() {
  11176. this.disabled = false, this.emitter = new w();
  11177. }
  11178. dispose() {
  11179. }
  11180. tick() {
  11181. this.disabled || this.emitter.emit("tick", {
  11182. sender: this
  11183. });
  11184. }
  11185. }
  11186. class pn {
  11187. constructor(o, u) {
  11188. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = o, this.emitter = new w(), this.interval_ = u, this.setTimer_();
  11189. }
  11190. get disabled() {
  11191. return this.disabled_;
  11192. }
  11193. set disabled(o) {
  11194. this.disabled_ = o, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  11195. }
  11196. dispose() {
  11197. this.clearTimer_();
  11198. }
  11199. clearTimer_() {
  11200. if (this.timerId_ === null)
  11201. return;
  11202. const o = this.doc_.defaultView;
  11203. o && o.clearInterval(this.timerId_), this.timerId_ = null;
  11204. }
  11205. setTimer_() {
  11206. if (this.clearTimer_(), this.interval_ <= 0)
  11207. return;
  11208. const o = this.doc_.defaultView;
  11209. o && (this.timerId_ = o.setInterval(this.onTick_, this.interval_));
  11210. }
  11211. onTick_() {
  11212. this.disabled_ || this.emitter.emit("tick", {
  11213. sender: this
  11214. });
  11215. }
  11216. }
  11217. class $n {
  11218. constructor(o) {
  11219. this.constraints = o;
  11220. }
  11221. constrain(o) {
  11222. return this.constraints.reduce((u, f) => f.constrain(u), o);
  11223. }
  11224. }
  11225. function Et2(m, o) {
  11226. if (m instanceof o)
  11227. return m;
  11228. if (m instanceof $n) {
  11229. const u = m.constraints.reduce((f, x) => f || (x instanceof o ? x : null), null);
  11230. if (u)
  11231. return u;
  11232. }
  11233. return null;
  11234. }
  11235. class vt {
  11236. constructor(o) {
  11237. this.values = K.fromObject({
  11238. max: o.max,
  11239. min: o.min
  11240. });
  11241. }
  11242. constrain(o) {
  11243. const u = this.values.get("max"), f = this.values.get("min");
  11244. return Math.min(Math.max(o, f), u);
  11245. }
  11246. }
  11247. class Lt {
  11248. constructor(o) {
  11249. this.values = K.fromObject({
  11250. max: o.max,
  11251. min: o.min
  11252. });
  11253. }
  11254. get maxValue() {
  11255. return this.values.get("max");
  11256. }
  11257. get minValue() {
  11258. return this.values.get("min");
  11259. }
  11260. constrain(o) {
  11261. const u = this.values.get("max"), f = this.values.get("min");
  11262. let x = o;
  11263. return h(f) || (x = Math.max(x, f)), h(u) || (x = Math.min(x, u)), x;
  11264. }
  11265. }
  11266. class L {
  11267. constructor(o, u = 0) {
  11268. this.step = o, this.origin = u;
  11269. }
  11270. constrain(o) {
  11271. const u = this.origin % this.step, f = Math.round((o - u) / this.step);
  11272. return u + f * this.step;
  11273. }
  11274. }
  11275. const U = y("pop");
  11276. class W {
  11277. constructor(o, u) {
  11278. this.element = o.createElement("div"), this.element.classList.add(U()), u.viewProps.bindClassModifiers(this.element), S(u.shows, F(this.element, U(void 0, "v")));
  11279. }
  11280. }
  11281. class ie {
  11282. constructor(o, u) {
  11283. this.shows = H(false), this.viewProps = u.viewProps, this.view = new W(o, {
  11284. shows: this.shows,
  11285. viewProps: this.viewProps
  11286. });
  11287. }
  11288. }
  11289. const ye = y("txt");
  11290. class De {
  11291. constructor(o, u) {
  11292. this.onChange_ = this.onChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(ye()), u.viewProps.bindClassModifiers(this.element), this.props_ = u.props, this.props_.emitter.on("change", this.onChange_);
  11293. const f = o.createElement("input");
  11294. f.classList.add(ye("i")), f.type = "text", u.viewProps.bindDisabled(f), this.element.appendChild(f), this.inputElement = f, u.value.emitter.on("change", this.onChange_), this.value_ = u.value, this.refresh();
  11295. }
  11296. refresh() {
  11297. const o = this.props_.get("formatter");
  11298. this.inputElement.value = o(this.value_.rawValue);
  11299. }
  11300. onChange_() {
  11301. this.refresh();
  11302. }
  11303. }
  11304. class Ht {
  11305. constructor(o, u) {
  11306. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = u.parser, this.props = u.props, this.value = u.value, this.viewProps = u.viewProps, this.view = new De(o, {
  11307. props: u.props,
  11308. value: this.value,
  11309. viewProps: this.viewProps
  11310. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  11311. }
  11312. onInputChange_(o) {
  11313. const f = o.currentTarget.value, x = this.parser_(f);
  11314. h(x) || (this.value.rawValue = x), this.view.refresh();
  11315. }
  11316. }
  11317. function hn(m) {
  11318. return m === "false" ? false : !!m;
  11319. }
  11320. class Ue {
  11321. constructor(o) {
  11322. this.text = o;
  11323. }
  11324. evaluate() {
  11325. return Number(this.text);
  11326. }
  11327. toString() {
  11328. return this.text;
  11329. }
  11330. }
  11331. const Ge = {
  11332. "**": (m, o) => Math.pow(m, o),
  11333. "*": (m, o) => m * o,
  11334. "/": (m, o) => m / o,
  11335. "%": (m, o) => m % o,
  11336. "+": (m, o) => m + o,
  11337. "-": (m, o) => m - o,
  11338. "<<": (m, o) => m << o,
  11339. ">>": (m, o) => m >> o,
  11340. ">>>": (m, o) => m >>> o,
  11341. "&": (m, o) => m & o,
  11342. "^": (m, o) => m ^ o,
  11343. "|": (m, o) => m | o
  11344. };
  11345. class qs {
  11346. constructor(o, u, f) {
  11347. this.left = u, this.operator = o, this.right = f;
  11348. }
  11349. evaluate() {
  11350. const o = Ge[this.operator];
  11351. if (!o)
  11352. throw new Error(`unexpected binary operator: '${this.operator}`);
  11353. return o(this.left.evaluate(), this.right.evaluate());
  11354. }
  11355. toString() {
  11356. return [
  11357. "b(",
  11358. this.left.toString(),
  11359. this.operator,
  11360. this.right.toString(),
  11361. ")"
  11362. ].join(" ");
  11363. }
  11364. }
  11365. const Qs = {
  11366. "+": (m) => m,
  11367. "-": (m) => -m,
  11368. "~": (m) => ~m
  11369. };
  11370. class Zs {
  11371. constructor(o, u) {
  11372. this.operator = o, this.expression = u;
  11373. }
  11374. evaluate() {
  11375. const o = Qs[this.operator];
  11376. if (!o)
  11377. throw new Error(`unexpected unary operator: '${this.operator}`);
  11378. return o(this.expression.evaluate());
  11379. }
  11380. toString() {
  11381. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  11382. }
  11383. }
  11384. function fi(m) {
  11385. return (o, u) => {
  11386. for (let f = 0; f < m.length; f++) {
  11387. const x = m[f](o, u);
  11388. if (x !== "")
  11389. return x;
  11390. }
  11391. return "";
  11392. };
  11393. }
  11394. function At(m, o) {
  11395. var u;
  11396. const f = m.substr(o).match(/^\s+/);
  11397. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11398. }
  11399. function vi(m, o) {
  11400. const u = m.substr(o, 1);
  11401. return u.match(/^[1-9]$/) ? u : "";
  11402. }
  11403. function je(m, o) {
  11404. var u;
  11405. const f = m.substr(o).match(/^[0-9]+/);
  11406. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11407. }
  11408. function bi(m, o) {
  11409. const u = je(m, o);
  11410. if (u !== "")
  11411. return u;
  11412. const f = m.substr(o, 1);
  11413. if (o += 1, f !== "-" && f !== "+")
  11414. return "";
  11415. const x = je(m, o);
  11416. return x === "" ? "" : f + x;
  11417. }
  11418. function ot(m, o) {
  11419. const u = m.substr(o, 1);
  11420. if (o += 1, u.toLowerCase() !== "e")
  11421. return "";
  11422. const f = bi(m, o);
  11423. return f === "" ? "" : u + f;
  11424. }
  11425. function is(m, o) {
  11426. const u = m.substr(o, 1);
  11427. if (u === "0")
  11428. return u;
  11429. const f = vi(m, o);
  11430. return o += f.length, f === "" ? "" : f + je(m, o);
  11431. }
  11432. function dn(m, o) {
  11433. const u = is(m, o);
  11434. if (o += u.length, u === "")
  11435. return "";
  11436. const f = m.substr(o, 1);
  11437. if (o += f.length, f !== ".")
  11438. return "";
  11439. const x = je(m, o);
  11440. return o += x.length, u + f + x + ot(m, o);
  11441. }
  11442. function ss(m, o) {
  11443. const u = m.substr(o, 1);
  11444. if (o += u.length, u !== ".")
  11445. return "";
  11446. const f = je(m, o);
  11447. return o += f.length, f === "" ? "" : u + f + ot(m, o);
  11448. }
  11449. function Xn(m, o) {
  11450. const u = is(m, o);
  11451. return o += u.length, u === "" ? "" : u + ot(m, o);
  11452. }
  11453. const gi = fi([
  11454. dn,
  11455. ss,
  11456. Xn
  11457. ]);
  11458. function _i(m, o) {
  11459. var u;
  11460. const f = m.substr(o).match(/^[01]+/);
  11461. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11462. }
  11463. function Ws(m, o) {
  11464. const u = m.substr(o, 2);
  11465. if (o += u.length, u.toLowerCase() !== "0b")
  11466. return "";
  11467. const f = _i(m, o);
  11468. return f === "" ? "" : u + f;
  11469. }
  11470. function Js(m, o) {
  11471. var u;
  11472. const f = m.substr(o).match(/^[0-7]+/);
  11473. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11474. }
  11475. function er(m, o) {
  11476. const u = m.substr(o, 2);
  11477. if (o += u.length, u.toLowerCase() !== "0o")
  11478. return "";
  11479. const f = Js(m, o);
  11480. return f === "" ? "" : u + f;
  11481. }
  11482. function tr(m, o) {
  11483. var u;
  11484. const f = m.substr(o).match(/^[0-9a-f]+/i);
  11485. return (u = f && f[0]) !== null && u !== void 0 ? u : "";
  11486. }
  11487. function wi(m, o) {
  11488. const u = m.substr(o, 2);
  11489. if (o += u.length, u.toLowerCase() !== "0x")
  11490. return "";
  11491. const f = tr(m, o);
  11492. return f === "" ? "" : u + f;
  11493. }
  11494. const nr = fi([
  11495. Ws,
  11496. er,
  11497. wi
  11498. ]), ir = fi([
  11499. nr,
  11500. gi
  11501. ]);
  11502. function mn(m, o) {
  11503. const u = ir(m, o);
  11504. return o += u.length, u === "" ? null : {
  11505. evaluable: new Ue(u),
  11506. cursor: o
  11507. };
  11508. }
  11509. function rs(m, o) {
  11510. const u = m.substr(o, 1);
  11511. if (o += u.length, u !== "(")
  11512. return null;
  11513. const f = yi(m, o);
  11514. if (!f)
  11515. return null;
  11516. o = f.cursor, o += At(m, o).length;
  11517. const x = m.substr(o, 1);
  11518. return o += x.length, x !== ")" ? null : {
  11519. evaluable: f.evaluable,
  11520. cursor: o
  11521. };
  11522. }
  11523. function sr(m, o) {
  11524. var u;
  11525. return (u = mn(m, o)) !== null && u !== void 0 ? u : rs(m, o);
  11526. }
  11527. function Yn(m, o) {
  11528. const u = sr(m, o);
  11529. if (u)
  11530. return u;
  11531. const f = m.substr(o, 1);
  11532. if (o += f.length, f !== "+" && f !== "-" && f !== "~")
  11533. return null;
  11534. const x = Yn(m, o);
  11535. return x ? (o = x.cursor, {
  11536. cursor: o,
  11537. evaluable: new Zs(f, x.evaluable)
  11538. }) : null;
  11539. }
  11540. function rr(m, o, u) {
  11541. u += At(o, u).length;
  11542. const f = m.filter((x) => o.startsWith(x, u))[0];
  11543. return f ? (u += f.length, u += At(o, u).length, {
  11544. cursor: u,
  11545. operator: f
  11546. }) : null;
  11547. }
  11548. function Kt(m, o) {
  11549. return (u, f) => {
  11550. const x = m(u, f);
  11551. if (!x)
  11552. return null;
  11553. f = x.cursor;
  11554. let T = x.evaluable;
  11555. for (; ; ) {
  11556. const A = rr(o, u, f);
  11557. if (!A)
  11558. break;
  11559. f = A.cursor;
  11560. const z = m(u, f);
  11561. if (!z)
  11562. return null;
  11563. f = z.cursor, T = new qs(A.operator, T, z.evaluable);
  11564. }
  11565. return T ? {
  11566. cursor: f,
  11567. evaluable: T
  11568. } : null;
  11569. };
  11570. }
  11571. const os = [
  11572. ["**"],
  11573. ["*", "/", "%"],
  11574. ["+", "-"],
  11575. ["<<", ">>>", ">>"],
  11576. ["&"],
  11577. ["^"],
  11578. ["|"]
  11579. ].reduce((m, o) => Kt(m, o), Yn);
  11580. function yi(m, o) {
  11581. return o += At(m, o).length, os(m, o);
  11582. }
  11583. function or(m) {
  11584. const o = yi(m, 0);
  11585. return !o || o.cursor + At(m, o.cursor).length !== m.length ? null : o.evaluable;
  11586. }
  11587. function fn(m) {
  11588. var o;
  11589. const u = or(m);
  11590. return (o = u == null ? void 0 : u.evaluate()) !== null && o !== void 0 ? o : null;
  11591. }
  11592. function ar(m) {
  11593. if (typeof m == "number")
  11594. return m;
  11595. if (typeof m == "string") {
  11596. const o = fn(m);
  11597. if (!h(o))
  11598. return o;
  11599. }
  11600. return 0;
  11601. }
  11602. function Re(m) {
  11603. return (o) => o.toFixed(Math.max(Math.min(m, 20), 0));
  11604. }
  11605. const lr = Re(0);
  11606. function qn(m) {
  11607. return lr(m) + "%";
  11608. }
  11609. function as(m) {
  11610. return String(m);
  11611. }
  11612. function xi(m, o) {
  11613. for (; m.length < o; )
  11614. m.push(void 0);
  11615. }
  11616. function ls(m) {
  11617. const o = [];
  11618. return xi(o, m), H(o);
  11619. }
  11620. function cs(m) {
  11621. const o = m.indexOf(void 0);
  11622. return o < 0 ? m : m.slice(0, o);
  11623. }
  11624. function cr(m, o) {
  11625. const u = [...cs(m), o];
  11626. return u.length > m.length ? u.splice(0, u.length - m.length) : xi(u, m.length), u;
  11627. }
  11628. function $t({ primary: m, secondary: o, forward: u, backward: f }) {
  11629. let x = false;
  11630. function T(A) {
  11631. x || (x = true, A(), x = false);
  11632. }
  11633. m.emitter.on("change", (A) => {
  11634. T(() => {
  11635. o.setRawValue(u(m, o), A.options);
  11636. });
  11637. }), o.emitter.on("change", (A) => {
  11638. T(() => {
  11639. m.setRawValue(f(m, o), A.options);
  11640. }), T(() => {
  11641. o.setRawValue(u(m, o), A.options);
  11642. });
  11643. }), T(() => {
  11644. o.setRawValue(u(m, o), {
  11645. forceEmit: false,
  11646. last: true
  11647. });
  11648. });
  11649. }
  11650. function Xt(m, o) {
  11651. const u = m * (o.altKey ? 0.1 : 1) * (o.shiftKey ? 10 : 1);
  11652. return o.upKey ? +u : o.downKey ? -u : 0;
  11653. }
  11654. function vn(m) {
  11655. return {
  11656. altKey: m.altKey,
  11657. downKey: m.key === "ArrowDown",
  11658. shiftKey: m.shiftKey,
  11659. upKey: m.key === "ArrowUp"
  11660. };
  11661. }
  11662. function Ei(m) {
  11663. return {
  11664. altKey: m.altKey,
  11665. downKey: m.key === "ArrowLeft",
  11666. shiftKey: m.shiftKey,
  11667. upKey: m.key === "ArrowRight"
  11668. };
  11669. }
  11670. function ur(m) {
  11671. return m === "ArrowUp" || m === "ArrowDown";
  11672. }
  11673. function us(m) {
  11674. return ur(m) || m === "ArrowLeft" || m === "ArrowRight";
  11675. }
  11676. function Ci(m, o) {
  11677. var u, f;
  11678. const x = o.ownerDocument.defaultView, T = o.getBoundingClientRect();
  11679. return {
  11680. x: m.pageX - (((u = x && x.scrollX) !== null && u !== void 0 ? u : 0) + T.left),
  11681. y: m.pageY - (((f = x && x.scrollY) !== null && f !== void 0 ? f : 0) + T.top)
  11682. };
  11683. }
  11684. class Qn {
  11685. constructor(o) {
  11686. 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_, {
  11687. passive: false
  11688. }), o.addEventListener("touchmove", this.onTouchMove_, {
  11689. passive: true
  11690. }), o.addEventListener("touchend", this.onTouchEnd_), o.addEventListener("mousedown", this.onMouseDown_);
  11691. }
  11692. computePosition_(o) {
  11693. const u = this.elem_.getBoundingClientRect();
  11694. return {
  11695. bounds: {
  11696. width: u.width,
  11697. height: u.height
  11698. },
  11699. point: o ? {
  11700. x: o.x,
  11701. y: o.y
  11702. } : null
  11703. };
  11704. }
  11705. onMouseDown_(o) {
  11706. var u;
  11707. o.preventDefault(), (u = o.currentTarget) === null || u === void 0 || u.focus();
  11708. const f = this.elem_.ownerDocument;
  11709. f.addEventListener("mousemove", this.onDocumentMouseMove_), f.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  11710. altKey: o.altKey,
  11711. data: this.computePosition_(Ci(o, this.elem_)),
  11712. sender: this,
  11713. shiftKey: o.shiftKey
  11714. });
  11715. }
  11716. onDocumentMouseMove_(o) {
  11717. this.emitter.emit("move", {
  11718. altKey: o.altKey,
  11719. data: this.computePosition_(Ci(o, this.elem_)),
  11720. sender: this,
  11721. shiftKey: o.shiftKey
  11722. });
  11723. }
  11724. onDocumentMouseUp_(o) {
  11725. const u = this.elem_.ownerDocument;
  11726. u.removeEventListener("mousemove", this.onDocumentMouseMove_), u.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  11727. altKey: o.altKey,
  11728. data: this.computePosition_(Ci(o, this.elem_)),
  11729. sender: this,
  11730. shiftKey: o.shiftKey
  11731. });
  11732. }
  11733. onTouchStart_(o) {
  11734. o.preventDefault();
  11735. const u = o.targetTouches.item(0), f = this.elem_.getBoundingClientRect();
  11736. this.emitter.emit("down", {
  11737. altKey: o.altKey,
  11738. data: this.computePosition_(u ? {
  11739. x: u.clientX - f.left,
  11740. y: u.clientY - f.top
  11741. } : void 0),
  11742. sender: this,
  11743. shiftKey: o.shiftKey
  11744. }), this.lastTouch_ = u;
  11745. }
  11746. onTouchMove_(o) {
  11747. const u = o.targetTouches.item(0), f = this.elem_.getBoundingClientRect();
  11748. this.emitter.emit("move", {
  11749. altKey: o.altKey,
  11750. data: this.computePosition_(u ? {
  11751. x: u.clientX - f.left,
  11752. y: u.clientY - f.top
  11753. } : void 0),
  11754. sender: this,
  11755. shiftKey: o.shiftKey
  11756. }), this.lastTouch_ = u;
  11757. }
  11758. onTouchEnd_(o) {
  11759. var u;
  11760. const f = (u = o.targetTouches.item(0)) !== null && u !== void 0 ? u : this.lastTouch_, x = this.elem_.getBoundingClientRect();
  11761. this.emitter.emit("up", {
  11762. altKey: o.altKey,
  11763. data: this.computePosition_(f ? {
  11764. x: f.clientX - x.left,
  11765. y: f.clientY - x.top
  11766. } : void 0),
  11767. sender: this,
  11768. shiftKey: o.shiftKey
  11769. });
  11770. }
  11771. }
  11772. function Me2(m, o, u, f, x) {
  11773. const T = (m - o) / (u - o);
  11774. return f + T * (x - f);
  11775. }
  11776. function ps(m) {
  11777. return String(m.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  11778. }
  11779. function Yt(m, o, u) {
  11780. return Math.min(Math.max(m, o), u);
  11781. }
  11782. const qe = y("txt");
  11783. class pr {
  11784. constructor(o, u) {
  11785. this.onChange_ = this.onChange_.bind(this), this.props_ = u.props, this.props_.emitter.on("change", this.onChange_), this.element = o.createElement("div"), this.element.classList.add(qe(), qe(void 0, "num")), u.arrayPosition && this.element.classList.add(qe(void 0, u.arrayPosition)), u.viewProps.bindClassModifiers(this.element);
  11786. const f = o.createElement("input");
  11787. f.classList.add(qe("i")), f.type = "text", u.viewProps.bindDisabled(f), this.element.appendChild(f), this.inputElement = f, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = u.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(qe()), this.inputElement.classList.add(qe("i"));
  11788. const x = o.createElement("div");
  11789. x.classList.add(qe("k")), this.element.appendChild(x), this.knobElement = x;
  11790. const T = o.createElementNS(we, "svg");
  11791. T.classList.add(qe("g")), this.knobElement.appendChild(T);
  11792. const A = o.createElementNS(we, "path");
  11793. A.classList.add(qe("gb")), T.appendChild(A), this.guideBodyElem_ = A;
  11794. const z = o.createElementNS(we, "path");
  11795. z.classList.add(qe("gh")), T.appendChild(z), this.guideHeadElem_ = z;
  11796. const oe = o.createElement("div");
  11797. oe.classList.add(y("tt")()), this.knobElement.appendChild(oe), this.tooltipElem_ = oe, u.value.emitter.on("change", this.onChange_), this.value = u.value, this.refresh();
  11798. }
  11799. onDraggingChange_(o) {
  11800. if (o.rawValue === null) {
  11801. this.element.classList.remove(qe(void 0, "drg"));
  11802. return;
  11803. }
  11804. this.element.classList.add(qe(void 0, "drg"));
  11805. const u = o.rawValue / this.props_.get("draggingScale"), f = u + (u > 0 ? -1 : u < 0 ? 1 : 0), x = Yt(-f, -4, 4);
  11806. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${f + x},0 L${f},4 L${f + x},8`, `M ${u},-1 L${u},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${u},4`);
  11807. const T = this.props_.get("formatter");
  11808. this.tooltipElem_.textContent = T(this.value.rawValue), this.tooltipElem_.style.left = `${u}px`;
  11809. }
  11810. refresh() {
  11811. const o = this.props_.get("formatter");
  11812. this.inputElement.value = o(this.value.rawValue);
  11813. }
  11814. onChange_() {
  11815. this.refresh();
  11816. }
  11817. }
  11818. class bn {
  11819. constructor(o, u) {
  11820. var f;
  11821. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = u.baseStep, this.parser_ = u.parser, this.props = u.props, this.sliderProps_ = (f = u.sliderProps) !== null && f !== void 0 ? f : null, this.value = u.value, this.viewProps = u.viewProps, this.dragging_ = H(null), this.view = new pr(o, {
  11822. arrayPosition: u.arrayPosition,
  11823. dragging: this.dragging_,
  11824. props: this.props,
  11825. value: this.value,
  11826. viewProps: this.viewProps
  11827. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  11828. const x = new Qn(this.view.knobElement);
  11829. x.emitter.on("down", this.onPointerDown_), x.emitter.on("move", this.onPointerMove_), x.emitter.on("up", this.onPointerUp_);
  11830. }
  11831. constrainValue_(o) {
  11832. var u, f;
  11833. const x = (u = this.sliderProps_) === null || u === void 0 ? void 0 : u.get("minValue"), T = (f = this.sliderProps_) === null || f === void 0 ? void 0 : f.get("maxValue");
  11834. let A = o;
  11835. return x !== void 0 && (A = Math.max(A, x)), T !== void 0 && (A = Math.min(A, T)), A;
  11836. }
  11837. onInputChange_(o) {
  11838. const f = o.currentTarget.value, x = this.parser_(f);
  11839. h(x) || (this.value.rawValue = this.constrainValue_(x)), this.view.refresh();
  11840. }
  11841. onInputKeyDown_(o) {
  11842. const u = Xt(this.baseStep_, vn(o));
  11843. u !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + u), {
  11844. forceEmit: false,
  11845. last: false
  11846. });
  11847. }
  11848. onInputKeyUp_(o) {
  11849. Xt(this.baseStep_, vn(o)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  11850. forceEmit: true,
  11851. last: true
  11852. });
  11853. }
  11854. onPointerDown_() {
  11855. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  11856. }
  11857. computeDraggingValue_(o) {
  11858. if (!o.point)
  11859. return null;
  11860. const u = o.point.x - o.bounds.width / 2;
  11861. return this.constrainValue_(this.originRawValue_ + u * this.props.get("draggingScale"));
  11862. }
  11863. onPointerMove_(o) {
  11864. const u = this.computeDraggingValue_(o.data);
  11865. u !== null && (this.value.setRawValue(u, {
  11866. forceEmit: false,
  11867. last: false
  11868. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  11869. }
  11870. onPointerUp_(o) {
  11871. const u = this.computeDraggingValue_(o.data);
  11872. u !== null && (this.value.setRawValue(u, {
  11873. forceEmit: true,
  11874. last: true
  11875. }), this.dragging_.rawValue = null);
  11876. }
  11877. }
  11878. function tt(m, o) {
  11879. m.write(o);
  11880. }
  11881. function qt(m) {
  11882. const o = m ? Et2(m, L) : null;
  11883. return o ? o.step : null;
  11884. }
  11885. function gn(m, o) {
  11886. const u = m && Et2(m, L);
  11887. return u ? ps(u.step) : Math.max(ps(o), 2);
  11888. }
  11889. function Pi(m) {
  11890. const o = qt(m);
  11891. return o ?? 1;
  11892. }
  11893. function Zn(m, o) {
  11894. var u;
  11895. const f = m && Et2(m, L), x = Math.abs((u = f == null ? void 0 : f.step) !== null && u !== void 0 ? u : o);
  11896. return x === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(x)) - 1);
  11897. }
  11898. function Qt(m) {
  11899. return [m[0], m[1], m[2]];
  11900. }
  11901. function hs(m) {
  11902. const o = Yt(Math.floor(m), 0, 255).toString(16);
  11903. return o.length === 1 ? `0${o}` : o;
  11904. }
  11905. function _n(m, o = "#") {
  11906. const u = Qt(m.getComponents("rgb")).map(hs).join("");
  11907. return `${o}${u}`;
  11908. }
  11909. function ds(m, o = "#") {
  11910. const u = m.getComponents("rgb"), f = [u[0], u[1], u[2], u[3] * 255].map(hs).join("");
  11911. return `${o}${f}`;
  11912. }
  11913. function hr(m, o) {
  11914. const u = Re(o === "float" ? 2 : 0);
  11915. return `rgb(${Qt(m.getComponents("rgb", o)).map((x) => u(x)).join(", ")})`;
  11916. }
  11917. function ms(m) {
  11918. return (o) => hr(o, m);
  11919. }
  11920. function fs(m, o) {
  11921. const u = Re(2), f = Re(o === "float" ? 2 : 0);
  11922. return `rgba(${m.getComponents("rgb", o).map((T, A) => (A === 3 ? u : f)(T)).join(", ")})`;
  11923. }
  11924. function dr(m) {
  11925. return (o) => fs(o, m);
  11926. }
  11927. function Wn(m) {
  11928. const o = [
  11929. Re(0),
  11930. qn,
  11931. qn
  11932. ];
  11933. return `hsl(${Qt(m.getComponents("hsl")).map((f, x) => o[x](f)).join(", ")})`;
  11934. }
  11935. function mr(m) {
  11936. const o = [
  11937. Re(0),
  11938. qn,
  11939. qn,
  11940. Re(2)
  11941. ];
  11942. return `hsla(${m.getComponents("hsl").map((f, x) => o[x](f)).join(", ")})`;
  11943. }
  11944. function vs(m, o) {
  11945. const u = Re(o === "float" ? 2 : 0), f = ["r", "g", "b"];
  11946. return `{${Qt(m.getComponents("rgb", o)).map((T, A) => `${f[A]}: ${u(T)}`).join(", ")}}`;
  11947. }
  11948. function bs(m) {
  11949. return (o) => vs(o, m);
  11950. }
  11951. function fr(m, o) {
  11952. const u = Re(2), f = Re(o === "float" ? 2 : 0), x = ["r", "g", "b", "a"];
  11953. return `{${m.getComponents("rgb", o).map((A, z) => {
  11954. const oe = z === 3 ? u : f;
  11955. return `${x[z]}: ${oe(A)}`;
  11956. }).join(", ")}}`;
  11957. }
  11958. function vr(m) {
  11959. return (o) => fr(o, m);
  11960. }
  11961. [
  11962. ...["int", "float"].reduce((m, o) => [
  11963. ...m,
  11964. {
  11965. format: {
  11966. alpha: false,
  11967. mode: "rgb",
  11968. notation: "func",
  11969. type: o
  11970. },
  11971. stringifier: ms(o)
  11972. },
  11973. {
  11974. format: {
  11975. alpha: true,
  11976. mode: "rgb",
  11977. notation: "func",
  11978. type: o
  11979. },
  11980. stringifier: dr(o)
  11981. },
  11982. {
  11983. format: {
  11984. alpha: false,
  11985. mode: "rgb",
  11986. notation: "object",
  11987. type: o
  11988. },
  11989. stringifier: bs(o)
  11990. },
  11991. {
  11992. format: {
  11993. alpha: true,
  11994. mode: "rgb",
  11995. notation: "object",
  11996. type: o
  11997. },
  11998. stringifier: vr(o)
  11999. }
  12000. ], [])
  12001. ];
  12002. class br {
  12003. constructor(o) {
  12004. this.components = o.components, this.asm_ = o.assembly;
  12005. }
  12006. constrain(o) {
  12007. const u = this.asm_.toComponents(o).map((f, x) => {
  12008. var T, A;
  12009. return (A = (T = this.components[x]) === null || T === void 0 ? void 0 : T.constrain(f)) !== null && A !== void 0 ? A : f;
  12010. });
  12011. return this.asm_.fromComponents(u);
  12012. }
  12013. }
  12014. const gs = y("pndtxt");
  12015. class gr {
  12016. constructor(o, u) {
  12017. this.textViews = u.textViews, this.element = o.createElement("div"), this.element.classList.add(gs()), this.textViews.forEach((f) => {
  12018. const x = o.createElement("div");
  12019. x.classList.add(gs("a")), x.appendChild(f.element), this.element.appendChild(x);
  12020. });
  12021. }
  12022. }
  12023. function Ti(m, o, u) {
  12024. return new bn(m, {
  12025. arrayPosition: u === 0 ? "fst" : u === o.axes.length - 1 ? "lst" : "mid",
  12026. baseStep: o.axes[u].baseStep,
  12027. parser: o.parser,
  12028. props: o.axes[u].textProps,
  12029. value: H(0, {
  12030. constraint: o.axes[u].constraint
  12031. }),
  12032. viewProps: o.viewProps
  12033. });
  12034. }
  12035. class Rt {
  12036. constructor(o, u) {
  12037. this.value = u.value, this.viewProps = u.viewProps, this.acs_ = u.axes.map((f, x) => Ti(o, u, x)), this.acs_.forEach((f, x) => {
  12038. $t({
  12039. primary: this.value,
  12040. secondary: f.value,
  12041. forward: (T) => u.assembly.toComponents(T.rawValue)[x],
  12042. backward: (T, A) => {
  12043. const z = u.assembly.toComponents(T.rawValue);
  12044. return z[x] = A.rawValue, u.assembly.fromComponents(z);
  12045. }
  12046. });
  12047. }), this.view = new gr(o, {
  12048. textViews: this.acs_.map((f) => f.view)
  12049. });
  12050. }
  12051. }
  12052. function _r(m, o) {
  12053. return "step" in m && !h(m.step) ? new L(m.step, o) : null;
  12054. }
  12055. function wn(m) {
  12056. return !h(m.max) && !h(m.min) ? new vt({
  12057. max: m.max,
  12058. min: m.min
  12059. }) : !h(m.max) || !h(m.min) ? new Lt({
  12060. max: m.max,
  12061. min: m.min
  12062. }) : null;
  12063. }
  12064. const wr = {
  12065. monitor: {
  12066. defaultInterval: 200,
  12067. defaultLineCount: 3
  12068. }
  12069. }, at = y("grl");
  12070. class _s {
  12071. constructor(o, u) {
  12072. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = o.createElement("div"), this.element.classList.add(at()), u.viewProps.bindClassModifiers(this.element), this.formatter_ = u.formatter, this.props_ = u.props, this.cursor_ = u.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  12073. const f = o.createElementNS(we, "svg");
  12074. f.classList.add(at("g")), f.style.height = `calc(var(--bld-us) * ${u.lineCount})`, this.element.appendChild(f), this.svgElem_ = f;
  12075. const x = o.createElementNS(we, "polyline");
  12076. this.svgElem_.appendChild(x), this.lineElem_ = x;
  12077. const T = o.createElement("div");
  12078. T.classList.add(at("t"), y("tt")()), this.element.appendChild(T), this.tooltipElem_ = T, u.value.emitter.on("change", this.onValueUpdate_), this.value = u.value, this.update_();
  12079. }
  12080. get graphElement() {
  12081. return this.svgElem_;
  12082. }
  12083. update_() {
  12084. const o = this.svgElem_.getBoundingClientRect(), u = this.value.rawValue.length - 1, f = this.props_.get("minValue"), x = this.props_.get("maxValue"), T = [];
  12085. this.value.rawValue.forEach((We, te) => {
  12086. if (We === void 0)
  12087. return;
  12088. const Tt = Me2(te, 0, u, 0, o.width), Vr = Me2(We, f, x, o.height, 0);
  12089. T.push([Tt, Vr].join(","));
  12090. }), this.lineElem_.setAttributeNS(null, "points", T.join(" "));
  12091. const A = this.tooltipElem_, z = this.value.rawValue[this.cursor_.rawValue];
  12092. if (z === void 0) {
  12093. A.classList.remove(at("t", "a"));
  12094. return;
  12095. }
  12096. const oe = Me2(this.cursor_.rawValue, 0, u, 0, o.width), Ze = Me2(z, f, x, o.height, 0);
  12097. A.style.left = `${oe}px`, A.style.top = `${Ze}px`, A.textContent = `${this.formatter_(z)}`, A.classList.contains(at("t", "a")) || (A.classList.add(at("t", "a"), at("t", "in")), st(A), A.classList.remove(at("t", "in")));
  12098. }
  12099. onValueUpdate_() {
  12100. this.update_();
  12101. }
  12102. onCursorChange_() {
  12103. this.update_();
  12104. }
  12105. }
  12106. class yr {
  12107. constructor(o, u) {
  12108. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = u.props, this.value = u.value, this.viewProps = u.viewProps, this.cursor_ = H(-1), this.view = new _s(o, {
  12109. cursor: this.cursor_,
  12110. formatter: u.formatter,
  12111. lineCount: u.lineCount,
  12112. props: this.props_,
  12113. value: this.value,
  12114. viewProps: this.viewProps
  12115. }), !Ye(o))
  12116. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  12117. else {
  12118. const f = new Qn(this.view.element);
  12119. f.emitter.on("down", this.onGraphPointerDown_), f.emitter.on("move", this.onGraphPointerMove_), f.emitter.on("up", this.onGraphPointerUp_);
  12120. }
  12121. }
  12122. onGraphMouseLeave_() {
  12123. this.cursor_.rawValue = -1;
  12124. }
  12125. onGraphMouseMove_(o) {
  12126. const u = this.view.element.getBoundingClientRect();
  12127. this.cursor_.rawValue = Math.floor(Me2(o.offsetX, 0, u.width, 0, this.value.rawValue.length));
  12128. }
  12129. onGraphPointerDown_(o) {
  12130. this.onGraphPointerMove_(o);
  12131. }
  12132. onGraphPointerMove_(o) {
  12133. if (!o.data.point) {
  12134. this.cursor_.rawValue = -1;
  12135. return;
  12136. }
  12137. this.cursor_.rawValue = Math.floor(Me2(o.data.point.x, 0, o.data.bounds.width, 0, this.value.rawValue.length));
  12138. }
  12139. onGraphPointerUp_() {
  12140. this.cursor_.rawValue = -1;
  12141. }
  12142. }
  12143. class ws {
  12144. constructor(o) {
  12145. this.controller_ = o;
  12146. }
  12147. get disabled() {
  12148. return this.controller_.viewProps.get("disabled");
  12149. }
  12150. set disabled(o) {
  12151. this.controller_.viewProps.set("disabled", o);
  12152. }
  12153. get title() {
  12154. var o;
  12155. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  12156. }
  12157. set title(o) {
  12158. this.controller_.props.set("title", o);
  12159. }
  12160. on(o, u) {
  12161. const f = u.bind(this);
  12162. return this.controller_.emitter.on(o, () => {
  12163. f(new a(this));
  12164. }), this;
  12165. }
  12166. }
  12167. class xr extends a {
  12168. constructor(o, u, f) {
  12169. super(o), this.cell = u, this.index = f;
  12170. }
  12171. }
  12172. class ys extends s {
  12173. constructor(o) {
  12174. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.emitter_ = new w();
  12175. const u = this.controller_.valueController;
  12176. u.cellControllers.forEach((f, x) => {
  12177. const T = new ws(f);
  12178. this.cellToApiMap_.set(f, T), f.emitter.on("click", () => {
  12179. const A = x % u.size[0], z = Math.floor(x / u.size[0]);
  12180. this.emitter_.emit("click", {
  12181. event: new xr(this, T, [A, z])
  12182. });
  12183. });
  12184. });
  12185. }
  12186. cell(o, u) {
  12187. const f = this.controller_.valueController, x = f.cellControllers[u * f.size[0] + o];
  12188. return this.cellToApiMap_.get(x);
  12189. }
  12190. on(o, u) {
  12191. const f = u.bind(this);
  12192. return this.emitter_.on(o, (x) => {
  12193. f(x.event);
  12194. }), this;
  12195. }
  12196. }
  12197. class ki {
  12198. constructor(o, u) {
  12199. this.size = u.size;
  12200. const [f, x] = this.size, T = [];
  12201. for (let A = 0; A < x; A++)
  12202. for (let z = 0; z < f; z++) {
  12203. const oe = new G(o, {
  12204. props: K.fromObject(Object.assign({}, u.cellConfig(z, A))),
  12205. viewProps: be.create()
  12206. });
  12207. T.push(oe);
  12208. }
  12209. this.cellCs_ = T, this.viewProps = be.create(), this.viewProps.handleDispose(() => {
  12210. this.cellCs_.forEach((A) => {
  12211. A.viewProps.set("disposed", true);
  12212. });
  12213. }), this.view = new xt(o, {
  12214. viewProps: this.viewProps,
  12215. viewName: "btngrid"
  12216. }), this.view.element.style.gridTemplateColumns = `repeat(${f}, 1fr)`, this.cellCs_.forEach((A) => {
  12217. this.view.element.appendChild(A.view.element);
  12218. });
  12219. }
  12220. get cellControllers() {
  12221. return this.cellCs_;
  12222. }
  12223. }
  12224. const Er = {
  12225. id: "buttongrid",
  12226. type: "blade",
  12227. // TODO:
  12228. 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}',
  12229. accept(m) {
  12230. const o = he, u = ee(m, {
  12231. cells: o.required.function,
  12232. size: o.required.array(o.required.number),
  12233. view: o.required.constant("buttongrid"),
  12234. label: o.optional.string
  12235. });
  12236. return u ? { params: u } : null;
  12237. },
  12238. controller(m) {
  12239. return new rt(m.document, {
  12240. blade: m.blade,
  12241. props: K.fromObject({
  12242. label: m.params.label
  12243. }),
  12244. valueController: new ki(m.document, {
  12245. cellConfig: m.params.cells,
  12246. size: m.params.size
  12247. })
  12248. });
  12249. },
  12250. api(m) {
  12251. return !(m.controller instanceof rt) || !(m.controller.valueController instanceof ki) ? null : new ys(m.controller);
  12252. }
  12253. };
  12254. class xs extends s {
  12255. get label() {
  12256. return this.controller_.props.get("label");
  12257. }
  12258. set label(o) {
  12259. this.controller_.props.set("label", o);
  12260. }
  12261. get value() {
  12262. return this.controller_.valueController.value.rawValue;
  12263. }
  12264. set value(o) {
  12265. this.controller_.valueController.value.rawValue = o;
  12266. }
  12267. on(o, u) {
  12268. const f = u.bind(this);
  12269. return this.controller_.valueController.value.emitter.on(o, (x) => {
  12270. f(new c(this, x.rawValue, void 0, x.options.last));
  12271. }), this;
  12272. }
  12273. }
  12274. function Qe(m, o, u) {
  12275. return m * (1 - u) + o * u;
  12276. }
  12277. const Cr = 20, Pr = 1e-3, Mi = 100;
  12278. function Tr(m, o) {
  12279. let u = 0.25, f = 0.5, x = -1;
  12280. for (let T = 0; T < Cr; T++) {
  12281. const [A, z] = m.curve(f);
  12282. if (f += u * (A < o ? 1 : -1), x = z, u *= 0.5, Math.abs(o - A) < Pr)
  12283. break;
  12284. }
  12285. return x;
  12286. }
  12287. class Ct {
  12288. constructor(o = 0, u = 0, f = 1, x = 1) {
  12289. this.cache_ = [], this.comps_ = [o, u, f, x];
  12290. }
  12291. get x1() {
  12292. return this.comps_[0];
  12293. }
  12294. get y1() {
  12295. return this.comps_[1];
  12296. }
  12297. get x2() {
  12298. return this.comps_[2];
  12299. }
  12300. get y2() {
  12301. return this.comps_[3];
  12302. }
  12303. static isObject(o) {
  12304. return h(o) || !Array.isArray(o) ? false : typeof o[0] == "number" && typeof o[1] == "number" && typeof o[2] == "number" && typeof o[3] == "number";
  12305. }
  12306. static equals(o, u) {
  12307. return o.x1 === u.x1 && o.y1 === u.y1 && o.x2 === u.x2 && o.y2 === u.y2;
  12308. }
  12309. curve(o) {
  12310. const u = Qe(0, this.x1, o), f = Qe(0, this.y1, o), x = Qe(this.x1, this.x2, o), T = Qe(this.y1, this.y2, o), A = Qe(this.x2, 1, o), z = Qe(this.y2, 1, o), oe = Qe(u, x, o), Ze = Qe(f, T, o), We = Qe(x, A, o), te = Qe(T, z, o);
  12311. return [Qe(oe, We, o), Qe(Ze, te, o)];
  12312. }
  12313. y(o) {
  12314. if (this.cache_.length === 0) {
  12315. const u = [];
  12316. for (let f = 0; f < Mi; f++)
  12317. u.push(Tr(this, Me2(f, 0, Mi - 1, 0, 1)));
  12318. this.cache_ = u;
  12319. }
  12320. return this.cache_[Math.round(Me2(Yt(o, 0, 1), 0, 1, 0, Mi - 1))];
  12321. }
  12322. toObject() {
  12323. return [this.comps_[0], this.comps_[1], this.comps_[2], this.comps_[3]];
  12324. }
  12325. }
  12326. const Si = {
  12327. toComponents: (m) => m.toObject(),
  12328. fromComponents: (m) => new Ct(...m)
  12329. };
  12330. function kr(m) {
  12331. const o = Re(2);
  12332. return `cubic-bezier(${m.toObject().map((f) => o(f)).join(", ")})`;
  12333. }
  12334. const Li = [0, 0.5, 0.5, 1];
  12335. function Mr(m) {
  12336. const o = m.match(/^cubic-bezier\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*\)$/);
  12337. if (!o)
  12338. return new Ct(...Li);
  12339. const u = [o[1], o[2], o[3], o[4]].reduce((f, x) => {
  12340. if (!f)
  12341. return null;
  12342. const T = Number(x);
  12343. return isNaN(T) ? null : [...f, T];
  12344. }, []);
  12345. return new Ct(...u ?? Li);
  12346. }
  12347. const It = y("cbz");
  12348. class Es {
  12349. constructor(o, u) {
  12350. this.element = o.createElement("div"), this.element.classList.add(It()), u.viewProps.bindClassModifiers(this.element), u.foldable.bindExpandedClass(this.element, It(void 0, "expanded")), R(u.foldable, "completed", F(this.element, It(void 0, "cpl")));
  12351. const f = o.createElement("div");
  12352. f.classList.add(It("h")), this.element.appendChild(f);
  12353. const x = o.createElement("button");
  12354. x.classList.add(It("b")), u.viewProps.bindDisabled(x);
  12355. const T = o.createElementNS(we, "svg");
  12356. T.innerHTML = '<path d="M2 13C8 13 8 3 14 3"/>', x.appendChild(T), f.appendChild(x), this.buttonElement = x;
  12357. const A = o.createElement("div");
  12358. if (A.classList.add(It("t")), f.appendChild(A), this.textElement = A, u.pickerLayout === "inline") {
  12359. const z = o.createElement("div");
  12360. z.classList.add(It("p")), this.element.appendChild(z), this.pickerElement = z;
  12361. } else
  12362. this.pickerElement = null;
  12363. }
  12364. }
  12365. const Jn = y("cbzp");
  12366. class Cs {
  12367. constructor(o, u) {
  12368. this.element = o.createElement("div"), this.element.classList.add(Jn()), u.viewProps.bindClassModifiers(this.element);
  12369. const f = o.createElement("div");
  12370. f.classList.add(Jn("g")), this.element.appendChild(f), this.graphElement = f;
  12371. const x = o.createElement("div");
  12372. x.classList.add(Jn("t")), this.element.appendChild(x), this.textElement = x;
  12373. }
  12374. }
  12375. function lt(m, o) {
  12376. const u = new MutationObserver((x) => {
  12377. for (const T of x)
  12378. T.type === "childList" && T.addedNodes.forEach((A) => {
  12379. A.contains(A) && (o(), u.disconnect());
  12380. });
  12381. }), f = m.ownerDocument;
  12382. u.observe(f.body, {
  12383. attributes: true,
  12384. childList: true,
  12385. subtree: true
  12386. });
  12387. }
  12388. const bt = y("cbzg");
  12389. function Sr(m, o) {
  12390. return (u) => o(m(u));
  12391. }
  12392. class Ie {
  12393. constructor(o, u) {
  12394. this.element = o.createElement("div"), this.element.classList.add(bt()), u.viewProps.bindClassModifiers(this.element), u.viewProps.bindTabIndex(this.element);
  12395. const f = o.createElement("div");
  12396. f.classList.add(bt("p")), this.element.appendChild(f), this.previewElement = f;
  12397. const x = o.createElementNS(we, "svg");
  12398. x.classList.add(bt("g")), this.element.appendChild(x), this.svgElem_ = x;
  12399. const T = o.createElementNS(we, "path");
  12400. T.classList.add(bt("u")), this.svgElem_.appendChild(T), this.guideElem_ = T;
  12401. const A = o.createElementNS(we, "polyline");
  12402. A.classList.add(bt("l")), this.svgElem_.appendChild(A), this.lineElem_ = A, this.handleElems_ = [o.createElement("div"), o.createElement("div")], this.handleElems_.forEach((z) => {
  12403. z.classList.add(bt("h")), this.element.appendChild(z);
  12404. }), this.vectorElems_ = [
  12405. o.createElementNS(we, "line"),
  12406. o.createElementNS(we, "line")
  12407. ], this.vectorElems_.forEach((z) => {
  12408. z.classList.add(bt("v")), this.svgElem_.appendChild(z);
  12409. }), this.value_ = u.value, this.value_.emitter.on("change", this.onValueChange_.bind(this)), this.sel_ = u.selection, this.handleElems_.forEach((z, oe) => {
  12410. S(this.sel_, Sr((Ze) => Ze === oe, F(z, bt("h", "sel"))));
  12411. }), lt(this.element, () => {
  12412. this.refresh();
  12413. });
  12414. }
  12415. getVertMargin_(o) {
  12416. return o * 0.25;
  12417. }
  12418. valueToPosition(o, u) {
  12419. const f = this.element.getBoundingClientRect(), x = f.width, T = f.height, A = this.getVertMargin_(T);
  12420. return {
  12421. x: Me2(o, 0, 1, 0, x),
  12422. y: Me2(u, 0, 1, T - A, A)
  12423. };
  12424. }
  12425. positionToValue(o, u) {
  12426. const f = this.element.getBoundingClientRect(), x = f.width, T = f.height, A = this.getVertMargin_(T);
  12427. return {
  12428. x: Yt(Me2(o, 0, x, 0, 1), 0, 1),
  12429. y: Me2(u, T - A, A, 0, 1)
  12430. };
  12431. }
  12432. refresh() {
  12433. this.guideElem_.setAttributeNS(null, "d", [0, 1].map((T) => {
  12434. const A = this.valueToPosition(0, T), z = this.valueToPosition(1, T);
  12435. return [`M ${A.x},${A.y}`, `L ${z.x},${z.y}`].join(" ");
  12436. }).join(" "));
  12437. const o = this.value_.rawValue, u = [];
  12438. let f = 0;
  12439. for (; ; ) {
  12440. const T = this.valueToPosition(...o.curve(f));
  12441. if (u.push([T.x, T.y].join(",")), f >= 1)
  12442. break;
  12443. f = Math.min(f + 0.05, 1);
  12444. }
  12445. this.lineElem_.setAttributeNS(null, "points", u.join(" "));
  12446. const x = o.toObject();
  12447. [0, 1].forEach((T) => {
  12448. const A = this.valueToPosition(T, T), z = this.valueToPosition(x[T * 2], x[T * 2 + 1]), oe = this.vectorElems_[T];
  12449. oe.setAttributeNS(null, "x1", String(A.x)), oe.setAttributeNS(null, "y1", String(A.y)), oe.setAttributeNS(null, "x2", String(z.x)), oe.setAttributeNS(null, "y2", String(z.y));
  12450. const Ze = this.handleElems_[T];
  12451. Ze.style.left = `${z.x}px`, Ze.style.top = `${z.y}px`;
  12452. });
  12453. }
  12454. onValueChange_() {
  12455. this.refresh();
  12456. }
  12457. }
  12458. const Ps = 24, yn = 400, Ai = 1e3, Pt = y("cbzprv");
  12459. class Zt {
  12460. constructor(o, u) {
  12461. 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(Pt()), u.viewProps.bindClassModifiers(this.element);
  12462. const f = o.createElementNS(we, "svg");
  12463. f.classList.add(Pt("g")), this.element.appendChild(f), this.svgElem_ = f;
  12464. const x = o.createElementNS(we, "path");
  12465. x.classList.add(Pt("t")), this.svgElem_.appendChild(x), this.ticksElem_ = x;
  12466. const T = o.createElement("div");
  12467. T.classList.add(Pt("m")), this.element.appendChild(T), this.markerElem_ = T, this.value_ = u.value, this.value_.emitter.on("change", this.onValueChange_), u.viewProps.handleDispose(this.onDispose_), lt(this.element, () => {
  12468. this.refresh();
  12469. });
  12470. }
  12471. play() {
  12472. this.stop(), this.updateMarker_(0), this.markerElem_.classList.add(Pt("m", "a")), this.startTime_ = (/* @__PURE__ */ new Date()).getTime() + yn, this.stopped_ = false, requestAnimationFrame(this.onTimer_);
  12473. }
  12474. stop() {
  12475. this.stopped_ = true, this.markerElem_.classList.remove(Pt("m", "a"));
  12476. }
  12477. onDispose_() {
  12478. this.stop();
  12479. }
  12480. updateMarker_(o) {
  12481. const u = this.value_.rawValue.y(Yt(o, 0, 1));
  12482. this.markerElem_.style.left = `${u * 100}%`;
  12483. }
  12484. refresh() {
  12485. const o = this.svgElem_.getBoundingClientRect(), u = o.width, f = o.height, x = [], T = this.value_.rawValue;
  12486. for (let A = 0; A < Ps; A++) {
  12487. const z = Me2(A, 0, Ps - 1, 0, 1), oe = Me2(T.y(z), 0, 1, 0, u);
  12488. x.push(`M ${oe},0 v${f}`);
  12489. }
  12490. this.ticksElem_.setAttributeNS(null, "d", x.join(" "));
  12491. }
  12492. onTimer_() {
  12493. if (this.startTime_ === null)
  12494. return;
  12495. const o = (/* @__PURE__ */ new Date()).getTime() - this.startTime_, u = o / Ai;
  12496. this.updateMarker_(u), o > Ai + yn && this.stop(), this.stopped_ || requestAnimationFrame(this.onTimer_);
  12497. }
  12498. onValueChange_() {
  12499. this.refresh(), this.play();
  12500. }
  12501. }
  12502. function Oe(m, o, u, f) {
  12503. const x = u - m, T = f - o;
  12504. return Math.sqrt(x * x + T * T);
  12505. }
  12506. function xn(m, o, u, f) {
  12507. const x = Oe(m, o, u, f), T = Math.atan2(f - o, u - m), A = Math.round(T / (Math.PI / 4)) * Math.PI / 4;
  12508. return {
  12509. x: m + Math.cos(A) * x,
  12510. y: o + Math.sin(A) * x
  12511. };
  12512. }
  12513. class ct {
  12514. constructor(o, u) {
  12515. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = u.baseStep, this.value = u.value, this.sel_ = H(0), this.viewProps = u.viewProps, this.view = new Ie(o, {
  12516. selection: this.sel_,
  12517. value: this.value,
  12518. viewProps: this.viewProps
  12519. }), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_), this.prevView_ = new Zt(o, {
  12520. value: this.value,
  12521. viewProps: this.viewProps
  12522. }), this.prevView_.element.addEventListener("mousedown", (x) => {
  12523. x.stopImmediatePropagation(), x.preventDefault(), this.prevView_.play();
  12524. }), this.view.previewElement.appendChild(this.prevView_.element);
  12525. const f = new Qn(this.view.element);
  12526. f.emitter.on("down", this.onPointerDown_), f.emitter.on("move", this.onPointerMove_), f.emitter.on("up", this.onPointerUp_);
  12527. }
  12528. refresh() {
  12529. this.view.refresh(), this.prevView_.refresh(), this.prevView_.play();
  12530. }
  12531. updateValue_(o, u, f) {
  12532. const x = this.sel_.rawValue, T = this.value.rawValue.toObject(), A = this.view.positionToValue(o.x, o.y), z = u ? xn(x, x, A.x, A.y) : A;
  12533. T[x * 2] = z.x, T[x * 2 + 1] = z.y, this.value.setRawValue(new Ct(...T), f);
  12534. }
  12535. onPointerDown_(o) {
  12536. const u = o.data;
  12537. if (!u.point)
  12538. return;
  12539. const f = this.value.rawValue, x = this.view.valueToPosition(f.x1, f.y1), T = Oe(u.point.x, u.point.y, x.x, x.y), A = this.view.valueToPosition(f.x2, f.y2), z = Oe(u.point.x, u.point.y, A.x, A.y);
  12540. this.sel_.rawValue = T <= z ? 0 : 1, this.updateValue_(u.point, o.shiftKey, {
  12541. forceEmit: false,
  12542. last: false
  12543. });
  12544. }
  12545. onPointerMove_(o) {
  12546. const u = o.data;
  12547. u.point && this.updateValue_(u.point, o.shiftKey, {
  12548. forceEmit: false,
  12549. last: false
  12550. });
  12551. }
  12552. onPointerUp_(o) {
  12553. const u = o.data;
  12554. u.point && this.updateValue_(u.point, o.shiftKey, {
  12555. forceEmit: true,
  12556. last: true
  12557. });
  12558. }
  12559. onKeyDown_(o) {
  12560. us(o.key) && o.preventDefault();
  12561. const u = this.sel_.rawValue, f = this.value.rawValue.toObject();
  12562. f[u * 2] += Xt(this.baseStep_, Ei(o)), f[u * 2 + 1] += Xt(this.baseStep_, vn(o)), this.value.setRawValue(new Ct(...f), {
  12563. forceEmit: false,
  12564. last: false
  12565. });
  12566. }
  12567. onKeyUp_(o) {
  12568. us(o.key) && o.preventDefault();
  12569. const u = Xt(this.baseStep_, Ei(o)), f = Xt(this.baseStep_, vn(o));
  12570. u === 0 && f === 0 || this.value.setRawValue(this.value.rawValue, {
  12571. forceEmit: true,
  12572. last: true
  12573. });
  12574. }
  12575. }
  12576. class Ts {
  12577. constructor(o, u) {
  12578. this.value = u.value, this.viewProps = u.viewProps, this.view = new Cs(o, {
  12579. viewProps: this.viewProps
  12580. }), this.gc_ = new ct(o, {
  12581. baseStep: u.axis.baseStep,
  12582. value: this.value,
  12583. viewProps: this.viewProps
  12584. }), this.view.graphElement.appendChild(this.gc_.view.element);
  12585. const f = Object.assign(Object.assign({}, u.axis), { constraint: new Lt({ max: 1, min: 0 }) }), x = Object.assign(Object.assign({}, u.axis), { constraint: void 0 });
  12586. this.tc_ = new Rt(o, {
  12587. assembly: Si,
  12588. axes: [f, x, f, x],
  12589. parser: fn,
  12590. value: this.value,
  12591. viewProps: this.viewProps
  12592. }), this.view.textElement.appendChild(this.tc_.view.element);
  12593. }
  12594. get allFocusableElements() {
  12595. return [
  12596. this.gc_.view.element,
  12597. ...this.tc_.view.textViews.map((o) => o.inputElement)
  12598. ];
  12599. }
  12600. refresh() {
  12601. this.gc_.refresh();
  12602. }
  12603. }
  12604. class ei {
  12605. constructor(o, u) {
  12606. this.onButtonBlur_ = this.onButtonBlur_.bind(this), this.onButtonClick_ = this.onButtonClick_.bind(this), this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.value = u.value, this.viewProps = u.viewProps, this.foldable_ = Un(u.expanded), this.view = new Es(o, {
  12607. foldable: this.foldable_,
  12608. pickerLayout: u.pickerLayout,
  12609. viewProps: this.viewProps
  12610. }), this.view.buttonElement.addEventListener("blur", this.onButtonBlur_), this.view.buttonElement.addEventListener("click", this.onButtonClick_), this.tc_ = new Ht(o, {
  12611. parser: Mr,
  12612. props: K.fromObject({
  12613. formatter: kr
  12614. }),
  12615. value: this.value,
  12616. viewProps: this.viewProps
  12617. }), this.view.textElement.appendChild(this.tc_.view.element), this.popC_ = u.pickerLayout === "popup" ? new ie(o, {
  12618. viewProps: this.viewProps
  12619. }) : null;
  12620. const f = new Ts(o, {
  12621. axis: u.axis,
  12622. value: this.value,
  12623. viewProps: this.viewProps
  12624. });
  12625. f.allFocusableElements.forEach((x) => {
  12626. x.addEventListener("blur", this.onPopupChildBlur_), x.addEventListener("keydown", this.onPopupChildKeydown_);
  12627. }), this.pickerC_ = f, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), S(this.popC_.shows, (x) => {
  12628. x && f.refresh();
  12629. }), $t({
  12630. primary: this.foldable_.value("expanded"),
  12631. secondary: this.popC_.shows,
  12632. forward: (x) => x.rawValue,
  12633. backward: (x, T) => T.rawValue
  12634. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Hn(this.foldable_, this.view.pickerElement));
  12635. }
  12636. onButtonBlur_(o) {
  12637. if (!this.popC_)
  12638. return;
  12639. const u = o.relatedTarget;
  12640. (!u || !this.popC_.view.element.contains(u)) && (this.popC_.shows.rawValue = false);
  12641. }
  12642. onButtonClick_() {
  12643. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.allFocusableElements[0].focus();
  12644. }
  12645. onPopupChildBlur_(o) {
  12646. if (!this.popC_)
  12647. return;
  12648. const u = this.popC_.view.element, f = cn(o);
  12649. f && u.contains(f) || f && f === this.view.buttonElement && !Ye(u.ownerDocument) || (this.popC_.shows.rawValue = false);
  12650. }
  12651. onPopupChildKeydown_(o) {
  12652. this.popC_ && o.key === "Escape" && (this.popC_.shows.rawValue = false);
  12653. }
  12654. }
  12655. function Ri() {
  12656. return new br({
  12657. assembly: Si,
  12658. components: [0, 1, 2, 3].map((m) => m % 2 === 0 ? new Lt({
  12659. min: 0,
  12660. max: 1
  12661. }) : void 0)
  12662. });
  12663. }
  12664. const Vt = {
  12665. id: "cubic-bezier",
  12666. type: "blade",
  12667. 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}',
  12668. accept(m) {
  12669. const o = he, u = ee(m, {
  12670. value: o.required.array(o.required.number),
  12671. view: o.required.constant("cubicbezier"),
  12672. expanded: o.optional.boolean,
  12673. label: o.optional.string,
  12674. picker: o.optional.custom((f) => f === "inline" || f === "popup" ? f : void 0)
  12675. });
  12676. return u ? { params: u } : null;
  12677. },
  12678. controller(m) {
  12679. var o, u;
  12680. const f = new Ct(...m.params.value), x = H(f, {
  12681. constraint: Ri(),
  12682. equals: Ct.equals
  12683. }), T = new ei(m.document, {
  12684. axis: {
  12685. baseStep: 0.1,
  12686. textProps: K.fromObject({
  12687. draggingScale: 0.01,
  12688. formatter: Re(2)
  12689. })
  12690. },
  12691. expanded: (o = m.params.expanded) !== null && o !== void 0 ? o : false,
  12692. pickerLayout: (u = m.params.picker) !== null && u !== void 0 ? u : "popup",
  12693. value: x,
  12694. viewProps: m.viewProps
  12695. });
  12696. return new St(m.document, {
  12697. blade: m.blade,
  12698. props: K.fromObject({
  12699. label: m.params.label
  12700. }),
  12701. valueController: T
  12702. });
  12703. },
  12704. api(m) {
  12705. return !(m.controller instanceof St) || !(m.controller.valueController instanceof ei) ? null : new xs(m.controller);
  12706. }
  12707. };
  12708. class _e extends s {
  12709. begin() {
  12710. this.controller_.valueController.begin();
  12711. }
  12712. end() {
  12713. this.controller_.valueController.end();
  12714. }
  12715. }
  12716. const Ii = 20;
  12717. class Se {
  12718. constructor() {
  12719. this.start_ = null, this.duration_ = 0, this.fps_ = null, this.frameCount_ = 0, this.timestamps_ = [];
  12720. }
  12721. get duration() {
  12722. return this.duration_;
  12723. }
  12724. get fps() {
  12725. return this.fps_;
  12726. }
  12727. begin(o) {
  12728. this.start_ = o.getTime();
  12729. }
  12730. calculateFps_(o) {
  12731. if (this.timestamps_.length === 0)
  12732. return null;
  12733. const u = this.timestamps_[0];
  12734. return 1e3 * (this.frameCount_ - u.frameCount) / (o - u.time);
  12735. }
  12736. compactTimestamps_() {
  12737. if (this.timestamps_.length <= Ii)
  12738. return;
  12739. const o = this.timestamps_.length - Ii;
  12740. this.timestamps_.splice(0, o);
  12741. const u = this.timestamps_[0].frameCount;
  12742. this.timestamps_.forEach((f) => {
  12743. f.frameCount -= u;
  12744. }), this.frameCount_ -= u;
  12745. }
  12746. end(o) {
  12747. if (this.start_ === null)
  12748. return;
  12749. const u = o.getTime();
  12750. this.duration_ = u - this.start_, this.start_ = null, this.fps_ = this.calculateFps_(u), this.timestamps_.push({
  12751. frameCount: this.frameCount_,
  12752. time: u
  12753. }), ++this.frameCount_, this.compactTimestamps_();
  12754. }
  12755. }
  12756. const Wt = y("fps");
  12757. class He {
  12758. constructor(o, u) {
  12759. this.element = o.createElement("div"), this.element.classList.add(Wt()), u.viewProps.bindClassModifiers(this.element), this.graphElement = o.createElement("div"), this.graphElement.classList.add(Wt("g")), this.element.appendChild(this.graphElement);
  12760. const f = o.createElement("div");
  12761. f.classList.add(Wt("l")), this.element.appendChild(f);
  12762. const x = o.createElement("span");
  12763. x.classList.add(Wt("v")), x.textContent = "--", f.appendChild(x), this.valueElement = x;
  12764. const T = o.createElement("span");
  12765. T.classList.add(Wt("u")), T.textContent = "FPS", f.appendChild(T);
  12766. }
  12767. }
  12768. class Vi {
  12769. constructor(o, u) {
  12770. this.stopwatch_ = new Se(), this.onTick_ = this.onTick_.bind(this), this.ticker_ = u.ticker, this.ticker_.emitter.on("tick", this.onTick_), this.value_ = u.value, this.viewProps = u.viewProps, this.view = new He(o, {
  12771. viewProps: this.viewProps
  12772. }), this.graphC_ = new yr(o, {
  12773. formatter: Re(0),
  12774. lineCount: u.lineCount,
  12775. props: K.fromObject({
  12776. maxValue: u.maxValue,
  12777. minValue: u.minValue
  12778. }),
  12779. value: this.value_,
  12780. viewProps: this.viewProps
  12781. }), this.view.graphElement.appendChild(this.graphC_.view.element), this.viewProps.handleDispose(() => {
  12782. this.graphC_.viewProps.set("disposed", true), this.ticker_.dispose();
  12783. });
  12784. }
  12785. begin() {
  12786. this.stopwatch_.begin(/* @__PURE__ */ new Date());
  12787. }
  12788. end() {
  12789. this.stopwatch_.end(/* @__PURE__ */ new Date());
  12790. }
  12791. onTick_() {
  12792. const o = this.stopwatch_.fps;
  12793. if (o !== null) {
  12794. const u = this.value_.rawValue;
  12795. this.value_.rawValue = cr(u, o), this.view.valueElement.textContent = o.toFixed(0);
  12796. }
  12797. }
  12798. }
  12799. function En(m, o) {
  12800. return o === 0 ? new Kn() : new pn(m, o ?? wr.monitor.defaultInterval);
  12801. }
  12802. const Di = {
  12803. id: "fpsgraph",
  12804. type: "blade",
  12805. accept(m) {
  12806. const o = he, u = ee(m, {
  12807. view: o.required.constant("fpsgraph"),
  12808. interval: o.optional.number,
  12809. label: o.optional.string,
  12810. lineCount: o.optional.number,
  12811. max: o.optional.number,
  12812. min: o.optional.number
  12813. });
  12814. return u ? { params: u } : null;
  12815. },
  12816. controller(m) {
  12817. var o, u, f, x;
  12818. const T = (o = m.params.interval) !== null && o !== void 0 ? o : 500;
  12819. return new rt(m.document, {
  12820. blade: m.blade,
  12821. props: K.fromObject({
  12822. label: m.params.label
  12823. }),
  12824. valueController: new Vi(m.document, {
  12825. lineCount: (u = m.params.lineCount) !== null && u !== void 0 ? u : 2,
  12826. maxValue: (f = m.params.max) !== null && f !== void 0 ? f : 90,
  12827. minValue: (x = m.params.min) !== null && x !== void 0 ? x : 0,
  12828. ticker: En(m.document, T),
  12829. value: ls(80),
  12830. viewProps: m.viewProps
  12831. })
  12832. });
  12833. },
  12834. api(m) {
  12835. return !(m.controller instanceof rt) || !(m.controller.valueController instanceof Vi) ? null : new _e(m.controller);
  12836. }
  12837. };
  12838. class Ke {
  12839. constructor(o, u) {
  12840. this.min = o, this.max = u;
  12841. }
  12842. static isObject(o) {
  12843. if (typeof o != "object" || o === null)
  12844. return false;
  12845. const u = o.min, f = o.max;
  12846. return !(typeof u != "number" || typeof f != "number");
  12847. }
  12848. static equals(o, u) {
  12849. return o.min === u.min && o.max === u.max;
  12850. }
  12851. get length() {
  12852. return this.max - this.min;
  12853. }
  12854. toObject() {
  12855. return {
  12856. min: this.min,
  12857. max: this.max
  12858. };
  12859. }
  12860. }
  12861. const Oi = {
  12862. fromComponents: (m) => new Ke(m[0], m[1]),
  12863. toComponents: (m) => [m.min, m.max]
  12864. };
  12865. class Cn {
  12866. constructor(o) {
  12867. this.edge = o;
  12868. }
  12869. constrain(o) {
  12870. var u, f, x, T, A, z, oe, Ze;
  12871. if (o.min <= o.max)
  12872. return new Ke((f = (u = this.edge) === null || u === void 0 ? void 0 : u.constrain(o.min)) !== null && f !== void 0 ? f : o.min, (T = (x = this.edge) === null || x === void 0 ? void 0 : x.constrain(o.max)) !== null && T !== void 0 ? T : o.max);
  12873. const We = (o.min + o.max) / 2;
  12874. return new Ke((z = (A = this.edge) === null || A === void 0 ? void 0 : A.constrain(We)) !== null && z !== void 0 ? z : We, (Ze = (oe = this.edge) === null || oe === void 0 ? void 0 : oe.constrain(We)) !== null && Ze !== void 0 ? Ze : We);
  12875. }
  12876. }
  12877. const Ni = y("rsltxt");
  12878. class ti {
  12879. constructor(o, u) {
  12880. this.sliderView_ = u.sliderView, this.textView_ = u.textView, this.element = o.createElement("div"), this.element.classList.add(Ni());
  12881. const f = o.createElement("div");
  12882. f.classList.add(Ni("s")), f.appendChild(this.sliderView_.element), this.element.appendChild(f);
  12883. const x = o.createElement("div");
  12884. x.classList.add(Ni("t")), x.appendChild(this.textView_.element), this.element.appendChild(x);
  12885. }
  12886. }
  12887. const nt = y("rsl");
  12888. class Pn {
  12889. constructor(o, u) {
  12890. this.onSliderPropsChange_ = this.onSliderPropsChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.sliderProps_ = u.sliderProps, this.sliderProps_.emitter.on("change", this.onSliderPropsChange_), this.element = o.createElement("div"), this.element.classList.add(nt()), u.viewProps.bindClassModifiers(this.element), this.value_ = u.value, this.value_.emitter.on("change", this.onValueChange_);
  12891. const f = o.createElement("div");
  12892. f.classList.add(nt("t")), this.element.appendChild(f), this.trackElement = f;
  12893. const x = o.createElement("div");
  12894. x.classList.add(nt("b")), f.appendChild(x), this.barElement = x;
  12895. const T = ["min", "max"].map((A) => {
  12896. const z = o.createElement("div");
  12897. return z.classList.add(nt("k"), nt("k", A)), f.appendChild(z), z;
  12898. });
  12899. this.knobElements = [T[0], T[1]], this.update_();
  12900. }
  12901. valueToX_(o) {
  12902. const u = this.sliderProps_.get("minValue"), f = this.sliderProps_.get("maxValue");
  12903. return Yt(Me2(o, u, f, 0, 1), 0, 1) * 100;
  12904. }
  12905. update_() {
  12906. const o = this.value_.rawValue;
  12907. o.length === 0 ? this.element.classList.add(nt(void 0, "zero")) : this.element.classList.remove(nt(void 0, "zero"));
  12908. const u = [this.valueToX_(o.min), this.valueToX_(o.max)];
  12909. this.barElement.style.left = `${u[0]}%`, this.barElement.style.right = `${100 - u[1]}%`, this.knobElements.forEach((f, x) => {
  12910. f.style.left = `${u[x]}%`;
  12911. });
  12912. }
  12913. onSliderPropsChange_() {
  12914. this.update_();
  12915. }
  12916. onValueChange_() {
  12917. this.update_();
  12918. }
  12919. }
  12920. class Fi {
  12921. constructor(o, u) {
  12922. this.grabbing_ = null, this.grabOffset_ = 0, this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.sliderProps = u.sliderProps, this.viewProps = u.viewProps, this.value = u.value, this.view = new Pn(o, {
  12923. sliderProps: this.sliderProps,
  12924. value: this.value,
  12925. viewProps: u.viewProps
  12926. });
  12927. const f = new Qn(this.view.trackElement);
  12928. f.emitter.on("down", this.onPointerDown_), f.emitter.on("move", this.onPointerMove_), f.emitter.on("up", this.onPointerUp_);
  12929. }
  12930. ofs_() {
  12931. return this.grabbing_ === "min" ? this.view.knobElements[0].getBoundingClientRect().width / 2 : this.grabbing_ === "max" ? -this.view.knobElements[1].getBoundingClientRect().width / 2 : 0;
  12932. }
  12933. valueFromData_(o) {
  12934. if (!o.point)
  12935. return null;
  12936. const u = (o.point.x + this.ofs_()) / o.bounds.width, f = this.sliderProps.get("minValue"), x = this.sliderProps.get("maxValue");
  12937. return Me2(u, 0, 1, f, x);
  12938. }
  12939. onPointerDown_(o) {
  12940. if (!o.data.point)
  12941. return;
  12942. const u = o.data.point.x / o.data.bounds.width, f = this.value.rawValue, x = this.sliderProps.get("minValue"), T = this.sliderProps.get("maxValue"), A = Me2(f.min, x, T, 0, 1), z = Me2(f.max, x, T, 0, 1);
  12943. Math.abs(z - u) <= 0.025 ? this.grabbing_ = "max" : Math.abs(A - u) <= 0.025 ? this.grabbing_ = "min" : u >= A && u <= z ? (this.grabbing_ = "length", this.grabOffset_ = Me2(u - A, 0, 1, 0, T - x)) : u < A ? (this.grabbing_ = "min", this.onPointerMove_(o)) : u > z && (this.grabbing_ = "max", this.onPointerMove_(o));
  12944. }
  12945. applyPointToValue_(o, u) {
  12946. const f = this.valueFromData_(o);
  12947. if (f === null)
  12948. return;
  12949. const x = this.sliderProps.get("minValue"), T = this.sliderProps.get("maxValue");
  12950. if (this.grabbing_ === "min")
  12951. this.value.setRawValue(new Ke(f, this.value.rawValue.max), u);
  12952. else if (this.grabbing_ === "max")
  12953. this.value.setRawValue(new Ke(this.value.rawValue.min, f), u);
  12954. else if (this.grabbing_ === "length") {
  12955. const A = this.value.rawValue.length;
  12956. let z = f - this.grabOffset_, oe = z + A;
  12957. z < x ? (z = x, oe = x + A) : oe > T && (z = T - A, oe = T), this.value.setRawValue(new Ke(z, oe), u);
  12958. }
  12959. }
  12960. onPointerMove_(o) {
  12961. this.applyPointToValue_(o.data, {
  12962. forceEmit: false,
  12963. last: false
  12964. });
  12965. }
  12966. onPointerUp_(o) {
  12967. this.applyPointToValue_(o.data, {
  12968. forceEmit: true,
  12969. last: true
  12970. }), this.grabbing_ = null;
  12971. }
  12972. }
  12973. class gt {
  12974. constructor(o, u) {
  12975. this.value = u.value, this.viewProps = u.viewProps, this.sc_ = new Fi(o, u);
  12976. const f = {
  12977. baseStep: u.baseStep,
  12978. constraint: u.constraint,
  12979. textProps: K.fromObject({
  12980. draggingScale: u.draggingScale,
  12981. formatter: u.formatter
  12982. })
  12983. };
  12984. this.tc_ = new Rt(o, {
  12985. assembly: Oi,
  12986. axes: [f, f],
  12987. parser: u.parser,
  12988. value: this.value,
  12989. viewProps: u.viewProps
  12990. }), this.view = new ti(o, {
  12991. sliderView: this.sc_.view,
  12992. textView: this.tc_.view
  12993. });
  12994. }
  12995. get textController() {
  12996. return this.tc_;
  12997. }
  12998. }
  12999. function ks(m) {
  13000. return Ke.isObject(m) ? new Ke(m.min, m.max) : new Ke(0, 0);
  13001. }
  13002. function Bi(m, o) {
  13003. m.writeProperty("max", o.max), m.writeProperty("min", o.min);
  13004. }
  13005. function Lr(m) {
  13006. const o = [], u = wn(m);
  13007. u && o.push(u);
  13008. const f = _r(m);
  13009. return f && o.push(f), new Cn(new $n(o));
  13010. }
  13011. const ni = {
  13012. id: "input-interval",
  13013. type: "input",
  13014. 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}',
  13015. accept: (m, o) => {
  13016. if (!Ke.isObject(m))
  13017. return null;
  13018. const u = he, f = ee(o, {
  13019. format: u.optional.function,
  13020. max: u.optional.number,
  13021. min: u.optional.number,
  13022. step: u.optional.number
  13023. });
  13024. return f ? {
  13025. initialValue: new Ke(m.min, m.max),
  13026. params: f
  13027. } : null;
  13028. },
  13029. binding: {
  13030. reader: (m) => ks,
  13031. constraint: (m) => Lr(m.params),
  13032. equals: Ke.equals,
  13033. writer: (m) => Bi
  13034. },
  13035. controller(m) {
  13036. var o;
  13037. const u = m.value, f = m.constraint;
  13038. if (!(f instanceof Cn))
  13039. throw g.shouldNeverHappen();
  13040. const x = (u.rawValue.min + u.rawValue.max) / 2, T = (o = m.params.format) !== null && o !== void 0 ? o : Re(gn(f.edge, x)), A = f.edge && Et2(f.edge, vt);
  13041. if (A)
  13042. return new gt(m.document, {
  13043. baseStep: Pi(f.edge),
  13044. constraint: f.edge,
  13045. draggingScale: Zn(f.edge, x),
  13046. formatter: T,
  13047. parser: fn,
  13048. sliderProps: new K({
  13049. maxValue: A.values.value("max"),
  13050. minValue: A.values.value("min")
  13051. }),
  13052. value: u,
  13053. viewProps: m.viewProps
  13054. });
  13055. const z = {
  13056. baseStep: Pi(f.edge),
  13057. constraint: f.edge,
  13058. textProps: K.fromObject({
  13059. draggingScale: x,
  13060. formatter: T
  13061. })
  13062. };
  13063. return new Rt(m.document, {
  13064. assembly: Oi,
  13065. axes: [z, z],
  13066. parser: fn,
  13067. value: u,
  13068. viewProps: m.viewProps
  13069. });
  13070. }
  13071. };
  13072. class Dt {
  13073. constructor(o) {
  13074. this.controller_ = o;
  13075. }
  13076. get disabled() {
  13077. return this.controller_.viewProps.get("disabled");
  13078. }
  13079. set disabled(o) {
  13080. this.controller_.viewProps.set("disabled", o);
  13081. }
  13082. get title() {
  13083. var o;
  13084. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  13085. }
  13086. set title(o) {
  13087. this.controller_.props.set("title", o);
  13088. }
  13089. }
  13090. class Ot extends c {
  13091. constructor(o, u, f, x, T) {
  13092. super(o, x, T), this.cell = u, this.index = f;
  13093. }
  13094. }
  13095. class Tn extends s {
  13096. constructor(o) {
  13097. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.controller_.valueController.cellControllers.forEach((f) => {
  13098. const x = new Dt(f);
  13099. this.cellToApiMap_.set(f, x);
  13100. });
  13101. }
  13102. get value() {
  13103. return this.controller_.value;
  13104. }
  13105. cell(o, u) {
  13106. const f = this.controller_.valueController, x = f.cellControllers[u * f.size[0] + o];
  13107. return this.cellToApiMap_.get(x);
  13108. }
  13109. on(o, u) {
  13110. const f = u.bind(this);
  13111. this.controller_.value.emitter.on(o, (x) => {
  13112. const T = this.controller_.valueController, A = T.findCellByValue(x.rawValue);
  13113. if (!A)
  13114. return;
  13115. const z = this.cellToApiMap_.get(A);
  13116. if (!z)
  13117. return;
  13118. const oe = T.cellControllers.indexOf(A);
  13119. f(new Ot(this, z, [oe % T.size[0], Math.floor(oe / T.size[0])], x.rawValue, void 0));
  13120. });
  13121. }
  13122. }
  13123. const kn = y("rad");
  13124. class Ms {
  13125. constructor(o, u) {
  13126. this.element = o.createElement("div"), this.element.classList.add(kn()), u.viewProps.bindClassModifiers(this.element);
  13127. const f = o.createElement("label");
  13128. f.classList.add(kn("l")), this.element.appendChild(f);
  13129. const x = o.createElement("input");
  13130. x.classList.add(kn("i")), x.name = u.name, x.type = "radio", u.viewProps.bindDisabled(x), f.appendChild(x), this.inputElement = x;
  13131. const T = o.createElement("div");
  13132. T.classList.add(kn("b")), f.appendChild(T);
  13133. const A = o.createElement("div");
  13134. A.classList.add(kn("t")), T.appendChild(A), R(u.props, "title", (z) => {
  13135. A.textContent = z;
  13136. });
  13137. }
  13138. }
  13139. class Ss {
  13140. constructor(o, u) {
  13141. this.props = u.props, this.viewProps = u.viewProps, this.view = new Ms(o, {
  13142. name: u.name,
  13143. props: this.props,
  13144. viewProps: this.viewProps
  13145. });
  13146. }
  13147. }
  13148. class ii {
  13149. constructor(o, u) {
  13150. this.cellCs_ = [], this.cellValues_ = [], this.onCellInputChange_ = this.onCellInputChange_.bind(this), this.size = u.size;
  13151. const [f, x] = this.size;
  13152. for (let T = 0; T < x; T++)
  13153. for (let A = 0; A < f; A++) {
  13154. const z = new Ss(o, {
  13155. name: u.groupName,
  13156. props: K.fromObject(Object.assign({}, u.cellConfig(A, T))),
  13157. viewProps: be.create()
  13158. });
  13159. this.cellCs_.push(z), this.cellValues_.push(u.cellConfig(A, T).value);
  13160. }
  13161. this.value = u.value, S(this.value, (T) => {
  13162. const A = this.findCellByValue(T);
  13163. A && (A.view.inputElement.checked = true);
  13164. }), this.viewProps = be.create(), this.view = new xt(o, {
  13165. viewProps: this.viewProps,
  13166. viewName: "radgrid"
  13167. }), this.view.element.style.gridTemplateColumns = `repeat(${f}, 1fr)`, this.cellCs_.forEach((T) => {
  13168. T.view.inputElement.addEventListener("change", this.onCellInputChange_), this.view.element.appendChild(T.view.element);
  13169. });
  13170. }
  13171. get cellControllers() {
  13172. return this.cellCs_;
  13173. }
  13174. findCellByValue(o) {
  13175. const u = this.cellValues_.findIndex((f) => f === o);
  13176. return u < 0 ? null : this.cellCs_[u];
  13177. }
  13178. onCellInputChange_(o) {
  13179. const u = o.currentTarget, f = this.cellCs_.findIndex((x) => x.view.inputElement === u);
  13180. f < 0 || (this.value.rawValue = this.cellValues_[f]);
  13181. }
  13182. }
  13183. const Nt = function() {
  13184. return {
  13185. id: "radiogrid",
  13186. type: "blade",
  13187. accept(m) {
  13188. const o = he, u = ee(m, {
  13189. cells: o.required.function,
  13190. groupName: o.required.string,
  13191. size: o.required.array(o.required.number),
  13192. value: o.required.raw,
  13193. view: o.required.constant("radiogrid"),
  13194. label: o.optional.string
  13195. });
  13196. return u ? { params: u } : null;
  13197. },
  13198. controller(m) {
  13199. return new St(m.document, {
  13200. blade: m.blade,
  13201. props: K.fromObject({
  13202. label: m.params.label
  13203. }),
  13204. valueController: new ii(m.document, {
  13205. groupName: m.params.groupName,
  13206. cellConfig: m.params.cells,
  13207. size: m.params.size,
  13208. value: H(m.params.value)
  13209. })
  13210. });
  13211. },
  13212. api(m) {
  13213. return !(m.controller instanceof St) || !(m.controller.valueController instanceof ii) ? null : new Tn(m.controller);
  13214. }
  13215. };
  13216. }();
  13217. function ji(m) {
  13218. return {
  13219. id: "input-radiogrid",
  13220. type: "input",
  13221. accept(o, u) {
  13222. if (!m.isType(o))
  13223. return null;
  13224. const f = he, x = ee(u, {
  13225. cells: f.required.function,
  13226. groupName: f.required.string,
  13227. size: f.required.array(f.required.number),
  13228. view: f.required.constant("radiogrid")
  13229. });
  13230. return x ? {
  13231. initialValue: o,
  13232. params: x
  13233. } : null;
  13234. },
  13235. binding: m.binding,
  13236. controller: (o) => new ii(o.document, {
  13237. cellConfig: o.params.cells,
  13238. groupName: o.params.groupName,
  13239. size: o.params.size,
  13240. value: o.value
  13241. })
  13242. };
  13243. }
  13244. const Ar = ji({
  13245. isType: (m) => typeof m == "number",
  13246. binding: {
  13247. reader: (m) => ar,
  13248. writer: (m) => tt
  13249. }
  13250. }), Rr = ji({
  13251. isType: (m) => typeof m == "string",
  13252. binding: {
  13253. reader: (m) => as,
  13254. writer: (m) => tt
  13255. }
  13256. }), Ir = ji({
  13257. isType: (m) => typeof m == "boolean",
  13258. binding: {
  13259. reader: (m) => hn,
  13260. writer: (m) => tt
  13261. }
  13262. }), Ls = [
  13263. Er,
  13264. Vt,
  13265. Di,
  13266. ni,
  13267. Nt,
  13268. Ir,
  13269. Ar,
  13270. Rr
  13271. ];
  13272. r.ButtonCellApi = ws, r.ButtonGridApi = ys, r.ButtonGridController = ki, r.CubicBezier = Ct, r.CubicBezierApi = xs, r.CubicBezierAssembly = Si, r.CubicBezierController = ei, r.CubicBezierGraphController = ct, r.CubicBezierGraphView = Ie, r.CubicBezierPickerController = Ts, r.CubicBezierPickerView = Cs, r.CubicBezierPreviewView = Zt, r.CubicBezierView = Es, r.FpsGraphBladeApi = _e, r.FpsGraphController = Vi, r.FpsView = He, r.Fpswatch = Se, r.Interval = Ke, r.IntervalAssembly = Oi, r.IntervalConstraint = Cn, r.RadioCellApi = Dt, r.RadioController = Ss, r.RadioGridApi = Tn, r.RadioGridController = ii, r.RadioView = Ms, r.RangeSliderController = Fi, r.RangeSliderTextController = gt, r.RangeSliderTextView = ti, r.RangeSliderView = Pn, r.TpRadioGridChangeEvent = Ot, r.plugins = Ls, Object.defineProperty(r, "__esModule", { value: true });
  13273. });
  13274. })(Oh, ts);
  13275. var Nh = dh(ts);
  13276. var Fh = Gu({
  13277. __proto__: null,
  13278. default: Nh
  13279. }, [ts]);
  13280. var In;
  13281. var Ns;
  13282. var Sd = (v = "tres-container") => {
  13283. In || (In = new Gs.Pane({
  13284. container: document.querySelector(v) || void 0
  13285. }), In.registerPlugin(Fh), Ns = In.addBlade({
  13286. view: "fpsgraph",
  13287. label: "fpsgraph"
  13288. }));
  13289. function n() {
  13290. In && In.dispose();
  13291. }
  13292. return onMounted(() => {
  13293. const { onBeforeLoop: r, onAfterLoop: s, resume: a } = Me();
  13294. a(), r(() => Ns.begin()), s(() => Ns.end());
  13295. }), onUnmounted(() => {
  13296. n();
  13297. }), { pane: In, fpsGraph: Ns, disposeTweakPane: n };
  13298. };
  13299. function Ld(v, n) {
  13300. const r = ref(n), s = new AnimationMixer(r.value), a = shallowReactive({});
  13301. v.forEach((p) => {
  13302. const h = s.clipAction(p, r.value);
  13303. a[p.name] = h;
  13304. });
  13305. const { onLoop: c } = Me();
  13306. return c(({ delta: p }) => {
  13307. s.update(p);
  13308. }), {
  13309. actions: a,
  13310. mixer: s
  13311. };
  13312. }
  13313. var Fs = null;
  13314. function Bh(v, n) {
  13315. return (r) => {
  13316. n && n(r), v.draco && (Fs || (Fs = new fh()), Fs.setDecoderPath(v.decoderPath || "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"), r.setDRACOLoader(Fs));
  13317. };
  13318. }
  13319. async function jh(v, n = {
  13320. draco: false
  13321. }, r) {
  13322. return await Et(mp, v, Bh(n, r));
  13323. }
  13324. var Ad = defineComponent({
  13325. name: "GLTFModel",
  13326. props: ["path", "draco", "decoderPath"],
  13327. async setup(v, { expose: n }) {
  13328. const { state: r } = Gt(), s = ref();
  13329. n({ model: s });
  13330. const { scene: a } = await jh(v.path, { draco: v.draco, decoderPath: v.decoderPath });
  13331. return s.value = a, r.scene && r.scene.add(a), () => {
  13332. };
  13333. }
  13334. });
  13335. async function zh(v) {
  13336. return await Et(Wp, v);
  13337. }
  13338. var Rd = defineComponent({
  13339. name: "FBXModel",
  13340. props: ["path"],
  13341. async setup(v, { expose: n }) {
  13342. const { state: r } = Gt();
  13343. let s = null;
  13344. function a() {
  13345. return s;
  13346. }
  13347. return n({ getModel: a }), s = await zh(v.path), r.scene && s.isObject3D && r.scene.add(s), () => {
  13348. };
  13349. }
  13350. });
  13351. var Uh = { key: 0 };
  13352. var Gh = ["args", "center"];
  13353. var Id = defineComponent({
  13354. __name: "Text3D",
  13355. props: {
  13356. font: null,
  13357. text: null,
  13358. size: { default: 0.5 },
  13359. height: { default: 0.2 },
  13360. curveSegments: { default: 5 },
  13361. bevelEnabled: { type: Boolean, default: true },
  13362. bevelThickness: { default: 0.05 },
  13363. bevelSize: { default: 0.02 },
  13364. bevelOffset: { default: 0 },
  13365. bevelSegments: { default: 4 },
  13366. center: { type: Boolean, default: false }
  13367. },
  13368. async setup(v) {
  13369. let n, r;
  13370. const s = v, { extend: a } = Gt();
  13371. a({ TextGeometry: Hp });
  13372. const c = new uh(), p = useSlots(), h = computed(() => {
  13373. var w;
  13374. return s.text ? s.text : p.default ? (w = p.default()[0].children) == null ? void 0 : w.trim() : "TresJS";
  13375. }), d = ([n, r] = withAsyncContext(() => new Promise((w, _) => {
  13376. try {
  13377. typeof s.font == "string" ? c.load(s.font, (y) => {
  13378. w(y);
  13379. }) : w(s.font);
  13380. } catch (y) {
  13381. _(console.error("cientos", y));
  13382. }
  13383. })), n = await n, r(), n), g = computed(() => ({
  13384. font: d,
  13385. size: s.size,
  13386. height: s.height,
  13387. curveSegments: s.curveSegments,
  13388. bevelEnabled: s.bevelEnabled,
  13389. bevelThickness: s.bevelThickness,
  13390. bevelSize: s.bevelSize,
  13391. bevelOffset: s.bevelOffset,
  13392. bevelSegments: s.bevelSegments
  13393. }));
  13394. return (w, _) => unref(d) ? (openBlock(), createElementBlock("TresMesh", Uh, [
  13395. unref(h) ? (openBlock(), createElementBlock("TresTextGeometry", {
  13396. key: 0,
  13397. args: [unref(h), unref(g)],
  13398. center: v.center
  13399. }, null, 8, Gh)) : createCommentVNode("", true),
  13400. renderSlot(w.$slots, "default")
  13401. ])) : createCommentVNode("", true);
  13402. }
  13403. });
  13404. var Hh = ["rotation"];
  13405. var Kh = ["args"];
  13406. var $h = ["color"];
  13407. var Vd = defineComponent({
  13408. __name: "Plane",
  13409. props: {
  13410. args: { default: () => [1, 1] },
  13411. color: { default: "0xffffff" }
  13412. },
  13413. setup(v, { expose: n }) {
  13414. const r = shallowRef();
  13415. return n({
  13416. value: r
  13417. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13418. ref_key: "planeRef",
  13419. ref: r,
  13420. rotation: [-Math.PI / 2, 0, 0]
  13421. }, s.$attrs), [
  13422. createBaseVNode("TresPlaneGeometry", { args: v.args }, null, 8, Kh),
  13423. renderSlot(s.$slots, "default", {}, () => [
  13424. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, $h)
  13425. ])
  13426. ], 16, Hh));
  13427. }
  13428. });
  13429. var Xh = ["args"];
  13430. var Yh = ["color"];
  13431. var Dd = defineComponent({
  13432. __name: "Box",
  13433. props: {
  13434. args: { default: () => [1, 1, 1] },
  13435. color: { default: "0xffffff" }
  13436. },
  13437. setup(v, { expose: n }) {
  13438. const r = shallowRef();
  13439. return n({
  13440. value: r
  13441. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13442. ref_key: "boxRef",
  13443. ref: r
  13444. }, s.$attrs), [
  13445. createBaseVNode("TresBoxGeometry", { args: v.args }, null, 8, Xh),
  13446. renderSlot(s.$slots, "default", {}, () => [
  13447. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Yh)
  13448. ])
  13449. ], 16));
  13450. }
  13451. });
  13452. var qh = ["args"];
  13453. var Qh = ["color"];
  13454. var Od = defineComponent({
  13455. __name: "Sphere",
  13456. props: {
  13457. args: { default: () => [2, 32, 16] },
  13458. color: { default: "0xffffff" }
  13459. },
  13460. setup(v, { expose: n }) {
  13461. const r = shallowRef();
  13462. return n({
  13463. value: r
  13464. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13465. ref_key: "sphereRef",
  13466. ref: r
  13467. }, s.$attrs), [
  13468. createBaseVNode("TresSphereGeometry", { args: v.args }, null, 8, qh),
  13469. renderSlot(s.$slots, "default", {}, () => [
  13470. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Qh)
  13471. ])
  13472. ], 16));
  13473. }
  13474. });
  13475. var Zh = ["args"];
  13476. var Wh = ["color"];
  13477. var Nd = defineComponent({
  13478. __name: "Torus",
  13479. props: {
  13480. args: { default: () => [1, 1, 16, 80] },
  13481. color: { default: "0xffffff" }
  13482. },
  13483. setup(v, { expose: n }) {
  13484. const r = shallowRef();
  13485. return n({
  13486. value: r
  13487. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13488. ref_key: "torusRef",
  13489. ref: r
  13490. }, s.$attrs), [
  13491. createBaseVNode("TresTorusGeometry", { args: v.args }, null, 8, Zh),
  13492. renderSlot(s.$slots, "default", {}, () => [
  13493. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, Wh)
  13494. ])
  13495. ], 16));
  13496. }
  13497. });
  13498. var Jh = ["args"];
  13499. var ed = ["color"];
  13500. var Fd = defineComponent({
  13501. __name: "TorusKnot",
  13502. props: {
  13503. args: { default: () => [1, 0.4, 64, 8] },
  13504. color: { default: "0xffffff" }
  13505. },
  13506. setup(v, { expose: n }) {
  13507. const r = shallowRef();
  13508. return n({
  13509. value: r
  13510. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13511. ref_key: "torusKnotRef",
  13512. ref: r
  13513. }, s.$attrs), [
  13514. createBaseVNode("TresTorusKnotGeometry", { args: v.args }, null, 8, Jh),
  13515. renderSlot(s.$slots, "default", {}, () => [
  13516. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, ed)
  13517. ])
  13518. ], 16));
  13519. }
  13520. });
  13521. var td = ["args"];
  13522. var nd = ["color"];
  13523. var Bd = defineComponent({
  13524. __name: "Circle",
  13525. props: {
  13526. args: { default: () => [1, 32, 0, Math.PI * 2] },
  13527. color: { default: "0xffffff" }
  13528. },
  13529. setup(v, { expose: n }) {
  13530. const r = shallowRef();
  13531. return n({
  13532. value: r
  13533. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13534. ref_key: "circleRef",
  13535. ref: r
  13536. }, s.$attrs), [
  13537. createBaseVNode("TresCircleGeometry", { args: v.args }, null, 8, td),
  13538. renderSlot(s.$slots, "default", {}, () => [
  13539. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, nd)
  13540. ])
  13541. ], 16));
  13542. }
  13543. });
  13544. var id = ["args"];
  13545. var sd = ["color"];
  13546. var jd = defineComponent({
  13547. __name: "Cone",
  13548. props: {
  13549. args: { default: () => [1, 1, 12, false, 0, Math.PI * 2] },
  13550. color: { default: "0xffffff" }
  13551. },
  13552. setup(v, { expose: n }) {
  13553. const r = shallowRef();
  13554. return n({
  13555. value: r
  13556. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13557. ref_key: "coneRef",
  13558. ref: r
  13559. }, s.$attrs), [
  13560. createBaseVNode("TresConeGeometry", { args: v.args }, null, 8, id),
  13561. renderSlot(s.$slots, "default", {}, () => [
  13562. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, sd)
  13563. ])
  13564. ], 16));
  13565. }
  13566. });
  13567. var rd = ["args"];
  13568. var od = ["color"];
  13569. var zd = defineComponent({
  13570. __name: "Tube",
  13571. props: {
  13572. args: { default: () => [
  13573. new QuadraticBezierCurve3(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),
  13574. 20,
  13575. 0.2,
  13576. 8,
  13577. false
  13578. ] },
  13579. color: { default: "0xffffff" }
  13580. },
  13581. setup(v, { expose: n }) {
  13582. const r = shallowRef();
  13583. return n({
  13584. value: r
  13585. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13586. ref_key: "tubeRef",
  13587. ref: r
  13588. }, s.$attrs), [
  13589. createBaseVNode("TresTubeGeometry", { args: v.args }, null, 8, rd),
  13590. renderSlot(s.$slots, "default", {}, () => [
  13591. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, od)
  13592. ])
  13593. ], 16));
  13594. }
  13595. });
  13596. var ad = ["args"];
  13597. var ld = ["color"];
  13598. var Ud = defineComponent({
  13599. __name: "Ring",
  13600. props: {
  13601. args: { default: () => [0.5, 1, 32] },
  13602. color: { default: "0xffffff" }
  13603. },
  13604. setup(v, { expose: n }) {
  13605. const r = shallowRef();
  13606. return n({
  13607. value: r
  13608. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13609. ref_key: "ringRef",
  13610. ref: r
  13611. }, s.$attrs), [
  13612. createBaseVNode("TresRingGeometry", { args: v.args }, null, 8, ad),
  13613. renderSlot(s.$slots, "default", {}, () => [
  13614. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, ld)
  13615. ])
  13616. ], 16));
  13617. }
  13618. });
  13619. var cd = ["rotation"];
  13620. var ud = ["args"];
  13621. var pd = ["color"];
  13622. var Gd = defineComponent({
  13623. __name: "Tetrahedron",
  13624. props: {
  13625. args: { default: () => [1, 0] },
  13626. color: { default: "0xffffff" }
  13627. },
  13628. setup(v, { expose: n }) {
  13629. const r = shallowRef();
  13630. return n({
  13631. value: r
  13632. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13633. ref_key: "tetrahedronRef",
  13634. ref: r,
  13635. rotation: [-Math.PI / 2, 0, 0]
  13636. }, s.$attrs), [
  13637. createBaseVNode("TresTetrahedronGeometry", { args: v.args }, null, 8, ud),
  13638. renderSlot(s.$slots, "default", {}, () => [
  13639. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, pd)
  13640. ])
  13641. ], 16, cd));
  13642. }
  13643. });
  13644. var hd = ["args"];
  13645. var dd = ["color"];
  13646. var Hd = defineComponent({
  13647. __name: "Icosahedron",
  13648. props: {
  13649. args: { default: () => [1, 0] },
  13650. color: { default: "0xffffff" }
  13651. },
  13652. setup(v, { expose: n }) {
  13653. const r = shallowRef();
  13654. return n({
  13655. value: r
  13656. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13657. ref_key: "icosahedronRef",
  13658. ref: r
  13659. }, s.$attrs), [
  13660. createBaseVNode("TresIcosahedronGeometry", { args: v.args }, null, 8, hd),
  13661. renderSlot(s.$slots, "default", {}, () => [
  13662. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, dd)
  13663. ])
  13664. ], 16));
  13665. }
  13666. });
  13667. var md = ["args"];
  13668. var fd = ["color"];
  13669. var Kd = defineComponent({
  13670. __name: "Octahedron",
  13671. props: {
  13672. args: { default: () => [1, 0] },
  13673. color: { default: "0xffffff" }
  13674. },
  13675. setup(v, { expose: n }) {
  13676. const r = shallowRef();
  13677. return n({
  13678. value: r
  13679. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13680. ref_key: "octahedronRef",
  13681. ref: r
  13682. }, s.$attrs), [
  13683. createBaseVNode("TresOctahedronGeometry", { args: v.args }, null, 8, md),
  13684. renderSlot(s.$slots, "default", {}, () => [
  13685. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, fd)
  13686. ])
  13687. ], 16));
  13688. }
  13689. });
  13690. var vd = ["args"];
  13691. var bd = ["color"];
  13692. var $d = defineComponent({
  13693. __name: "Dodecahedron",
  13694. props: {
  13695. args: { default: () => [1, 0] },
  13696. color: { default: "0xffffff" }
  13697. },
  13698. setup(v, { expose: n }) {
  13699. const r = shallowRef();
  13700. return n({
  13701. value: r
  13702. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13703. ref_key: "dodecahedronRef",
  13704. ref: r
  13705. }, s.$attrs), [
  13706. createBaseVNode("TresDodecahedronGeometry", { args: v.args }, null, 8, vd),
  13707. renderSlot(s.$slots, "default", {}, () => [
  13708. createBaseVNode("TresMeshBasicMaterial", { color: v.color }, null, 8, bd)
  13709. ])
  13710. ], 16));
  13711. }
  13712. });
  13713. var ao = {
  13714. sunset: "venice/venice_sunset_4k.hdr"
  13715. };
  13716. async function gd({
  13717. files: v = ["/px.png", "/nx.png", "/py.png", "/ny.png", "/pz.png", "/nz.png"],
  13718. blur: n = 0,
  13719. background: r = false,
  13720. path: s = "/",
  13721. preset: a = void 0,
  13722. encoding: c = void 0
  13723. }) {
  13724. const { state: p } = Gt();
  13725. if (a) {
  13726. if (!(a in ao))
  13727. throw new Error("Preset must be one of: " + Object.keys(ao).join(", "));
  13728. v = ao[a], s = "https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";
  13729. }
  13730. const h = Array.isArray(v), g = await Et(
  13731. h ? CubeTextureLoader : mh,
  13732. h ? [v] : v,
  13733. (_) => {
  13734. s && _.setPath(s), c && (_.encoding = c);
  13735. }
  13736. ), w = h ? g[0] : g;
  13737. return w && (w.mapping = h ? CubeReflectionMapping : EquirectangularReflectionMapping, w.encoding = c ?? h ? sRGBEncoding : LinearEncoding), p.scene && (p.scene.environment = w, r !== void 0 && (p.scene.background = w), n && (p.scene.backgroundBlurriness = n | 0)), w;
  13738. }
  13739. var Xd = defineComponent({
  13740. name: "Environment",
  13741. props: ["background", "blur", "files", "encoding", "path", "preset"],
  13742. async setup(v, { expose: n }) {
  13743. let r = null;
  13744. return n({ getTexture: () => r }), r = await gd(v), () => {
  13745. };
  13746. }
  13747. });
  13748. var _d = class extends MeshStandardMaterial {
  13749. constructor(r = {}) {
  13750. super(r);
  13751. Zr(this, "_time");
  13752. Zr(this, "_factor");
  13753. this.setValues(r), this._time = { value: 0 }, this._factor = { value: 1 };
  13754. }
  13755. onBeforeCompile(r) {
  13756. r.uniforms.time = this._time, r.uniforms.factor = this._factor, r.vertexShader = `
  13757. uniform float time;
  13758. uniform float factor;
  13759. ${r.vertexShader}
  13760. `, r.vertexShader = r.vertexShader.replace(
  13761. "#include <begin_vertex>",
  13762. `float theta = sin( time + position.y ) / 2.0 * factor;
  13763. float c = cos( theta );
  13764. float s = sin( theta );
  13765. mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
  13766. vec3 transformed = vec3( position ) * m;
  13767. vNormal = vNormal * m;`
  13768. );
  13769. }
  13770. get time() {
  13771. return this._time.value;
  13772. }
  13773. set time(r) {
  13774. this._time.value = r;
  13775. }
  13776. get factor() {
  13777. return this._factor.value;
  13778. }
  13779. set factor(r) {
  13780. this._factor.value = r;
  13781. }
  13782. };
  13783. var wd = ["factor"];
  13784. var Yd = defineComponent({
  13785. __name: "index",
  13786. props: {
  13787. speed: { default: 1 },
  13788. factor: { default: 1 }
  13789. },
  13790. setup(v) {
  13791. const n = v, r = shallowRef(), { extend: s } = Gt();
  13792. s({ MeshWobbleMaterial: _d });
  13793. const { onLoop: a } = Me();
  13794. return watchEffect(() => {
  13795. console.log(r.value);
  13796. }), a(({ elapsed: c }) => {
  13797. r.value && (r.value.time = c * (n == null ? void 0 : n.speed));
  13798. }), (c, p) => (openBlock(), createElementBlock("TresMeshWobbleMaterial", mergeProps({
  13799. ref_key: "materialRef",
  13800. ref: r,
  13801. factor: v.factor
  13802. }, c.$attrs), null, 16, wd));
  13803. }
  13804. });
  13805. export {
  13806. Dd as Box,
  13807. Bd as Circle,
  13808. jd as Cone,
  13809. $d as Dodecahedron,
  13810. Xd as Environment,
  13811. Rd as FBXModel,
  13812. Ad as GLTFModel,
  13813. Hd as Icosahedron,
  13814. Yd as MeshWobbleMaterial,
  13815. Kd as Octahedron,
  13816. Pd as OrbitControls,
  13817. Md as PamCameraMouse,
  13818. Vd as Plane,
  13819. Td as PointerLockControls,
  13820. Ud as Ring,
  13821. Od as Sphere,
  13822. Gd as Tetrahedron,
  13823. Id as Text3D,
  13824. Nd as Torus,
  13825. Fd as TorusKnot,
  13826. kd as TransformControls,
  13827. zd as Tube,
  13828. Ld as useAnimations,
  13829. gd as useEnvironment,
  13830. zh as useFBX,
  13831. jh as useGLTF,
  13832. Vh as usePamCameraMouse,
  13833. Sd as useTweakPane
  13834. };
  13835. /*! Bundled license information:
  13836. @tresjs/cientos/dist/trescientos.js:
  13837. (*! Tweakpane 3.1.7 (c) 2016 cocopon, licensed under the MIT license. *)
  13838. */
  13839. //# sourceMappingURL=@tresjs_cientos.js.map