pixi__js.js 499 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424
  1. import {
  2. ALPHA_MODES,
  3. AbstractBatchRenderer,
  4. AbstractMultiResource,
  5. AbstractRenderer,
  6. ArrayResource,
  7. Attribute,
  8. BLEND_MODES,
  9. BUFFER_BITS,
  10. BUFFER_TYPE,
  11. BaseImageResource,
  12. BaseRenderTexture,
  13. BaseTexture,
  14. BatchDrawCall,
  15. BatchGeometry,
  16. BatchPluginFactory,
  17. BatchRenderer,
  18. BatchShaderGenerator,
  19. BatchSystem,
  20. BatchTextureArray,
  21. Bounds,
  22. BrowserAdapter,
  23. Buffer,
  24. BufferResource,
  25. CLEAR_MODES,
  26. COLOR_MASK_BITS,
  27. CanvasRenderTarget,
  28. CanvasResource,
  29. Circle,
  30. Container,
  31. ContextSystem,
  32. CubeResource,
  33. DEG_TO_RAD,
  34. DRAW_MODES,
  35. DisplayObject,
  36. ENV,
  37. Ellipse,
  38. ExtensionType,
  39. FORMATS,
  40. Filter,
  41. FilterState,
  42. FilterSystem,
  43. Framebuffer,
  44. FramebufferSystem,
  45. GC_MODES,
  46. GLFramebuffer,
  47. GLProgram,
  48. GLTexture,
  49. Geometry,
  50. GeometrySystem,
  51. IGLUniformData,
  52. INSTALLED,
  53. ImageBitmapResource,
  54. ImageResource,
  55. MASK_TYPES,
  56. MIPMAP_MODES,
  57. MSAA_QUALITY,
  58. MaskData,
  59. MaskSystem,
  60. Matrix,
  61. ObjectRenderer,
  62. ObservablePoint,
  63. PI_2,
  64. PRECISION,
  65. Point,
  66. Polygon,
  67. Program,
  68. ProjectionSystem,
  69. Quad,
  70. QuadUv,
  71. RAD_TO_DEG,
  72. RENDERER_TYPE,
  73. Rectangle,
  74. RenderTexture,
  75. RenderTexturePool,
  76. RenderTextureSystem,
  77. Renderer,
  78. Resource,
  79. RoundedRectangle,
  80. Runner,
  81. SAMPLER_TYPES,
  82. SCALE_MODES,
  83. SHAPES,
  84. SVGResource,
  85. ScissorSystem,
  86. Shader,
  87. ShaderSystem,
  88. SpriteMaskFilter,
  89. State,
  90. StateSystem,
  91. StencilSystem,
  92. System,
  93. TARGETS,
  94. TYPES,
  95. TemporaryDisplayObject,
  96. Texture,
  97. TextureGCSystem,
  98. TextureMatrix,
  99. TextureSystem,
  100. TextureUvs,
  101. Ticker,
  102. TickerPlugin,
  103. Transform,
  104. UPDATE_PRIORITY,
  105. UniformGroup,
  106. VERSION,
  107. VideoResource,
  108. ViewableBuffer,
  109. WRAP_MODES,
  110. autoDetectRenderer,
  111. autoDetectResource,
  112. checkMaxIfStatementsInShader,
  113. correctBlendMode,
  114. createIndicesForQuads,
  115. createUBOElements,
  116. defaultFilterVertex,
  117. defaultVertex$1,
  118. deprecation,
  119. extensions,
  120. generateProgram,
  121. generateUniformBufferSync,
  122. getResolutionOfUrl,
  123. getTestContext,
  124. getUBOData,
  125. groupD8,
  126. hex2rgb,
  127. hex2string,
  128. import_earcut,
  129. import_eventemitter3,
  130. isMobile,
  131. premultiplyRgba,
  132. premultiplyTint,
  133. premultiplyTintToRgba,
  134. removeItems,
  135. resources,
  136. settings,
  137. sign,
  138. string2hex,
  139. systems,
  140. trimCanvas,
  141. uid,
  142. uniformParsers,
  143. url,
  144. utils_exports
  145. } from "./chunk-66BJ5UTJ.js";
  146. import {
  147. __commonJS,
  148. __toESM
  149. } from "./chunk-DC5AMYBS.js";
  150. // node_modules/object-assign/index.js
  151. var require_object_assign = __commonJS({
  152. "node_modules/object-assign/index.js"(exports, module) {
  153. "use strict";
  154. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  155. var hasOwnProperty = Object.prototype.hasOwnProperty;
  156. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  157. function toObject(val) {
  158. if (val === null || val === void 0) {
  159. throw new TypeError("Object.assign cannot be called with null or undefined");
  160. }
  161. return Object(val);
  162. }
  163. function shouldUseNative() {
  164. try {
  165. if (!Object.assign) {
  166. return false;
  167. }
  168. var test1 = new String("abc");
  169. test1[5] = "de";
  170. if (Object.getOwnPropertyNames(test1)[0] === "5") {
  171. return false;
  172. }
  173. var test2 = {};
  174. for (var i = 0; i < 10; i++) {
  175. test2["_" + String.fromCharCode(i)] = i;
  176. }
  177. var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
  178. return test2[n];
  179. });
  180. if (order2.join("") !== "0123456789") {
  181. return false;
  182. }
  183. var test3 = {};
  184. "abcdefghijklmnopqrst".split("").forEach(function(letter) {
  185. test3[letter] = letter;
  186. });
  187. if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
  188. return false;
  189. }
  190. return true;
  191. } catch (err) {
  192. return false;
  193. }
  194. }
  195. module.exports = shouldUseNative() ? Object.assign : function(target, source) {
  196. var from;
  197. var to = toObject(target);
  198. var symbols;
  199. for (var s = 1; s < arguments.length; s++) {
  200. from = Object(arguments[s]);
  201. for (var key in from) {
  202. if (hasOwnProperty.call(from, key)) {
  203. to[key] = from[key];
  204. }
  205. }
  206. if (getOwnPropertySymbols) {
  207. symbols = getOwnPropertySymbols(from);
  208. for (var i = 0; i < symbols.length; i++) {
  209. if (propIsEnumerable.call(from, symbols[i])) {
  210. to[symbols[i]] = from[symbols[i]];
  211. }
  212. }
  213. }
  214. }
  215. return to;
  216. };
  217. }
  218. });
  219. // node_modules/promise-polyfill/src/finally.js
  220. function finallyConstructor(callback) {
  221. var constructor = this.constructor;
  222. return this.then(
  223. function(value) {
  224. return constructor.resolve(callback()).then(function() {
  225. return value;
  226. });
  227. },
  228. function(reason) {
  229. return constructor.resolve(callback()).then(function() {
  230. return constructor.reject(reason);
  231. });
  232. }
  233. );
  234. }
  235. var finally_default = finallyConstructor;
  236. // node_modules/promise-polyfill/src/allSettled.js
  237. function allSettled(arr) {
  238. var P = this;
  239. return new P(function(resolve2, reject2) {
  240. if (!(arr && typeof arr.length !== "undefined")) {
  241. return reject2(
  242. new TypeError(
  243. typeof arr + " " + arr + " is not iterable(cannot read property Symbol(Symbol.iterator))"
  244. )
  245. );
  246. }
  247. var args = Array.prototype.slice.call(arr);
  248. if (args.length === 0) return resolve2([]);
  249. var remaining = args.length;
  250. function res(i2, val) {
  251. if (val && (typeof val === "object" || typeof val === "function")) {
  252. var then = val.then;
  253. if (typeof then === "function") {
  254. then.call(
  255. val,
  256. function(val2) {
  257. res(i2, val2);
  258. },
  259. function(e) {
  260. args[i2] = { status: "rejected", reason: e };
  261. if (--remaining === 0) {
  262. resolve2(args);
  263. }
  264. }
  265. );
  266. return;
  267. }
  268. }
  269. args[i2] = { status: "fulfilled", value: val };
  270. if (--remaining === 0) {
  271. resolve2(args);
  272. }
  273. }
  274. for (var i = 0; i < args.length; i++) {
  275. res(i, args[i]);
  276. }
  277. });
  278. }
  279. var allSettled_default = allSettled;
  280. // node_modules/promise-polyfill/src/any.js
  281. function AggregateError(errors, message) {
  282. this.name = "AggregateError", this.errors = errors;
  283. this.message = message || "";
  284. }
  285. AggregateError.prototype = Error.prototype;
  286. function any(arr) {
  287. var P = this;
  288. return new P(function(resolve2, reject2) {
  289. if (!(arr && typeof arr.length !== "undefined")) {
  290. return reject2(new TypeError("Promise.any accepts an array"));
  291. }
  292. var args = Array.prototype.slice.call(arr);
  293. if (args.length === 0) return reject2();
  294. var rejectionReasons = [];
  295. for (var i = 0; i < args.length; i++) {
  296. try {
  297. P.resolve(args[i]).then(resolve2).catch(function(error) {
  298. rejectionReasons.push(error);
  299. if (rejectionReasons.length === args.length) {
  300. reject2(
  301. new AggregateError(
  302. rejectionReasons,
  303. "All promises were rejected"
  304. )
  305. );
  306. }
  307. });
  308. } catch (ex) {
  309. reject2(ex);
  310. }
  311. }
  312. });
  313. }
  314. var any_default = any;
  315. // node_modules/promise-polyfill/src/index.js
  316. var setTimeoutFunc = setTimeout;
  317. function isArray(x) {
  318. return Boolean(x && typeof x.length !== "undefined");
  319. }
  320. function noop() {
  321. }
  322. function bind(fn, thisArg) {
  323. return function() {
  324. fn.apply(thisArg, arguments);
  325. };
  326. }
  327. function Promise2(fn) {
  328. if (!(this instanceof Promise2))
  329. throw new TypeError("Promises must be constructed via new");
  330. if (typeof fn !== "function") throw new TypeError("not a function");
  331. this._state = 0;
  332. this._handled = false;
  333. this._value = void 0;
  334. this._deferreds = [];
  335. doResolve(fn, this);
  336. }
  337. function handle(self2, deferred) {
  338. while (self2._state === 3) {
  339. self2 = self2._value;
  340. }
  341. if (self2._state === 0) {
  342. self2._deferreds.push(deferred);
  343. return;
  344. }
  345. self2._handled = true;
  346. Promise2._immediateFn(function() {
  347. var cb = self2._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  348. if (cb === null) {
  349. (self2._state === 1 ? resolve : reject)(deferred.promise, self2._value);
  350. return;
  351. }
  352. var ret;
  353. try {
  354. ret = cb(self2._value);
  355. } catch (e) {
  356. reject(deferred.promise, e);
  357. return;
  358. }
  359. resolve(deferred.promise, ret);
  360. });
  361. }
  362. function resolve(self2, newValue) {
  363. try {
  364. if (newValue === self2)
  365. throw new TypeError("A promise cannot be resolved with itself.");
  366. if (newValue && (typeof newValue === "object" || typeof newValue === "function")) {
  367. var then = newValue.then;
  368. if (newValue instanceof Promise2) {
  369. self2._state = 3;
  370. self2._value = newValue;
  371. finale(self2);
  372. return;
  373. } else if (typeof then === "function") {
  374. doResolve(bind(then, newValue), self2);
  375. return;
  376. }
  377. }
  378. self2._state = 1;
  379. self2._value = newValue;
  380. finale(self2);
  381. } catch (e) {
  382. reject(self2, e);
  383. }
  384. }
  385. function reject(self2, newValue) {
  386. self2._state = 2;
  387. self2._value = newValue;
  388. finale(self2);
  389. }
  390. function finale(self2) {
  391. if (self2._state === 2 && self2._deferreds.length === 0) {
  392. Promise2._immediateFn(function() {
  393. if (!self2._handled) {
  394. Promise2._unhandledRejectionFn(self2._value);
  395. }
  396. });
  397. }
  398. for (var i = 0, len = self2._deferreds.length; i < len; i++) {
  399. handle(self2, self2._deferreds[i]);
  400. }
  401. self2._deferreds = null;
  402. }
  403. function Handler(onFulfilled, onRejected, promise) {
  404. this.onFulfilled = typeof onFulfilled === "function" ? onFulfilled : null;
  405. this.onRejected = typeof onRejected === "function" ? onRejected : null;
  406. this.promise = promise;
  407. }
  408. function doResolve(fn, self2) {
  409. var done = false;
  410. try {
  411. fn(
  412. function(value) {
  413. if (done) return;
  414. done = true;
  415. resolve(self2, value);
  416. },
  417. function(reason) {
  418. if (done) return;
  419. done = true;
  420. reject(self2, reason);
  421. }
  422. );
  423. } catch (ex) {
  424. if (done) return;
  425. done = true;
  426. reject(self2, ex);
  427. }
  428. }
  429. Promise2.prototype["catch"] = function(onRejected) {
  430. return this.then(null, onRejected);
  431. };
  432. Promise2.prototype.then = function(onFulfilled, onRejected) {
  433. var prom = new this.constructor(noop);
  434. handle(this, new Handler(onFulfilled, onRejected, prom));
  435. return prom;
  436. };
  437. Promise2.prototype["finally"] = finally_default;
  438. Promise2.all = function(arr) {
  439. return new Promise2(function(resolve2, reject2) {
  440. if (!isArray(arr)) {
  441. return reject2(new TypeError("Promise.all accepts an array"));
  442. }
  443. var args = Array.prototype.slice.call(arr);
  444. if (args.length === 0) return resolve2([]);
  445. var remaining = args.length;
  446. function res(i2, val) {
  447. try {
  448. if (val && (typeof val === "object" || typeof val === "function")) {
  449. var then = val.then;
  450. if (typeof then === "function") {
  451. then.call(
  452. val,
  453. function(val2) {
  454. res(i2, val2);
  455. },
  456. reject2
  457. );
  458. return;
  459. }
  460. }
  461. args[i2] = val;
  462. if (--remaining === 0) {
  463. resolve2(args);
  464. }
  465. } catch (ex) {
  466. reject2(ex);
  467. }
  468. }
  469. for (var i = 0; i < args.length; i++) {
  470. res(i, args[i]);
  471. }
  472. });
  473. };
  474. Promise2.any = any_default;
  475. Promise2.allSettled = allSettled_default;
  476. Promise2.resolve = function(value) {
  477. if (value && typeof value === "object" && value.constructor === Promise2) {
  478. return value;
  479. }
  480. return new Promise2(function(resolve2) {
  481. resolve2(value);
  482. });
  483. };
  484. Promise2.reject = function(value) {
  485. return new Promise2(function(resolve2, reject2) {
  486. reject2(value);
  487. });
  488. };
  489. Promise2.race = function(arr) {
  490. return new Promise2(function(resolve2, reject2) {
  491. if (!isArray(arr)) {
  492. return reject2(new TypeError("Promise.race accepts an array"));
  493. }
  494. for (var i = 0, len = arr.length; i < len; i++) {
  495. Promise2.resolve(arr[i]).then(resolve2, reject2);
  496. }
  497. });
  498. };
  499. Promise2._immediateFn = // @ts-ignore
  500. typeof setImmediate === "function" && function(fn) {
  501. setImmediate(fn);
  502. } || function(fn) {
  503. setTimeoutFunc(fn, 0);
  504. };
  505. Promise2._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  506. if (typeof console !== "undefined" && console) {
  507. console.warn("Possible Unhandled Promise Rejection:", err);
  508. }
  509. };
  510. var src_default = Promise2;
  511. // node_modules/@pixi/polyfill/dist/esm/polyfill.mjs
  512. var import_object_assign = __toESM(require_object_assign(), 1);
  513. if (typeof globalThis === "undefined") {
  514. if (typeof self !== "undefined") {
  515. self.globalThis = self;
  516. } else if (typeof global !== "undefined") {
  517. global.globalThis = global;
  518. }
  519. }
  520. if (!globalThis.Promise) {
  521. globalThis.Promise = src_default;
  522. }
  523. if (!Object.assign) {
  524. Object.assign = import_object_assign.default;
  525. }
  526. var ONE_FRAME_TIME = 16;
  527. if (!(Date.now && Date.prototype.getTime)) {
  528. Date.now = function now() {
  529. return (/* @__PURE__ */ new Date()).getTime();
  530. };
  531. }
  532. if (!(globalThis.performance && globalThis.performance.now)) {
  533. startTime_1 = Date.now();
  534. if (!globalThis.performance) {
  535. globalThis.performance = {};
  536. }
  537. globalThis.performance.now = function() {
  538. return Date.now() - startTime_1;
  539. };
  540. }
  541. var startTime_1;
  542. var lastTime = Date.now();
  543. var vendors = ["ms", "moz", "webkit", "o"];
  544. for (x = 0; x < vendors.length && !globalThis.requestAnimationFrame; ++x) {
  545. p = vendors[x];
  546. globalThis.requestAnimationFrame = globalThis[p + "RequestAnimationFrame"];
  547. globalThis.cancelAnimationFrame = globalThis[p + "CancelAnimationFrame"] || globalThis[p + "CancelRequestAnimationFrame"];
  548. }
  549. var p;
  550. var x;
  551. if (!globalThis.requestAnimationFrame) {
  552. globalThis.requestAnimationFrame = function(callback) {
  553. if (typeof callback !== "function") {
  554. throw new TypeError(callback + "is not a function");
  555. }
  556. var currentTime = Date.now();
  557. var delay = ONE_FRAME_TIME + lastTime - currentTime;
  558. if (delay < 0) {
  559. delay = 0;
  560. }
  561. lastTime = currentTime;
  562. return globalThis.self.setTimeout(function() {
  563. lastTime = Date.now();
  564. callback(performance.now());
  565. }, delay);
  566. };
  567. }
  568. if (!globalThis.cancelAnimationFrame) {
  569. globalThis.cancelAnimationFrame = function(id) {
  570. return clearTimeout(id);
  571. };
  572. }
  573. if (!Math.sign) {
  574. Math.sign = function mathSign(x) {
  575. x = Number(x);
  576. if (x === 0 || isNaN(x)) {
  577. return x;
  578. }
  579. return x > 0 ? 1 : -1;
  580. };
  581. }
  582. if (!Number.isInteger) {
  583. Number.isInteger = function numberIsInteger(value) {
  584. return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
  585. };
  586. }
  587. if (!globalThis.ArrayBuffer) {
  588. globalThis.ArrayBuffer = Array;
  589. }
  590. if (!globalThis.Float32Array) {
  591. globalThis.Float32Array = Array;
  592. }
  593. if (!globalThis.Uint32Array) {
  594. globalThis.Uint32Array = Array;
  595. }
  596. if (!globalThis.Uint16Array) {
  597. globalThis.Uint16Array = Array;
  598. }
  599. if (!globalThis.Uint8Array) {
  600. globalThis.Uint8Array = Array;
  601. }
  602. if (!globalThis.Int32Array) {
  603. globalThis.Int32Array = Array;
  604. }
  605. // node_modules/@pixi/accessibility/dist/esm/accessibility.mjs
  606. var accessibleTarget = {
  607. /**
  608. * Flag for if the object is accessible. If true AccessibilityManager will overlay a
  609. * shadow div with attributes set
  610. * @member {boolean}
  611. * @memberof PIXI.DisplayObject#
  612. */
  613. accessible: false,
  614. /**
  615. * Sets the title attribute of the shadow div
  616. * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'
  617. * @member {?string}
  618. * @memberof PIXI.DisplayObject#
  619. */
  620. accessibleTitle: null,
  621. /**
  622. * Sets the aria-label attribute of the shadow div
  623. * @member {string}
  624. * @memberof PIXI.DisplayObject#
  625. */
  626. accessibleHint: null,
  627. /**
  628. * @member {number}
  629. * @memberof PIXI.DisplayObject#
  630. * @private
  631. * @todo Needs docs.
  632. */
  633. tabIndex: 0,
  634. /**
  635. * @member {boolean}
  636. * @memberof PIXI.DisplayObject#
  637. * @todo Needs docs.
  638. */
  639. _accessibleActive: false,
  640. /**
  641. * @member {boolean}
  642. * @memberof PIXI.DisplayObject#
  643. * @todo Needs docs.
  644. */
  645. _accessibleDiv: null,
  646. /**
  647. * Specify the type of div the accessible layer is. Screen readers treat the element differently
  648. * depending on this type. Defaults to button.
  649. * @member {string}
  650. * @memberof PIXI.DisplayObject#
  651. * @default 'button'
  652. */
  653. accessibleType: "button",
  654. /**
  655. * Specify the pointer-events the accessible div will use
  656. * Defaults to auto.
  657. * @member {string}
  658. * @memberof PIXI.DisplayObject#
  659. * @default 'auto'
  660. */
  661. accessiblePointerEvents: "auto",
  662. /**
  663. * Setting to false will prevent any children inside this container to
  664. * be accessible. Defaults to true.
  665. * @member {boolean}
  666. * @memberof PIXI.DisplayObject#
  667. * @default true
  668. */
  669. accessibleChildren: true,
  670. renderId: -1
  671. };
  672. DisplayObject.mixin(accessibleTarget);
  673. var KEY_CODE_TAB = 9;
  674. var DIV_TOUCH_SIZE = 100;
  675. var DIV_TOUCH_POS_X = 0;
  676. var DIV_TOUCH_POS_Y = 0;
  677. var DIV_TOUCH_ZINDEX = 2;
  678. var DIV_HOOK_SIZE = 1;
  679. var DIV_HOOK_POS_X = -1e3;
  680. var DIV_HOOK_POS_Y = -1e3;
  681. var DIV_HOOK_ZINDEX = 2;
  682. var AccessibilityManager = (
  683. /** @class */
  684. (function() {
  685. function AccessibilityManager2(renderer) {
  686. this.debug = false;
  687. this._isActive = false;
  688. this._isMobileAccessibility = false;
  689. this.pool = [];
  690. this.renderId = 0;
  691. this.children = [];
  692. this.androidUpdateCount = 0;
  693. this.androidUpdateFrequency = 500;
  694. this._hookDiv = null;
  695. if (isMobile.tablet || isMobile.phone) {
  696. this.createTouchHook();
  697. }
  698. var div = document.createElement("div");
  699. div.style.width = DIV_TOUCH_SIZE + "px";
  700. div.style.height = DIV_TOUCH_SIZE + "px";
  701. div.style.position = "absolute";
  702. div.style.top = DIV_TOUCH_POS_X + "px";
  703. div.style.left = DIV_TOUCH_POS_Y + "px";
  704. div.style.zIndex = DIV_TOUCH_ZINDEX.toString();
  705. this.div = div;
  706. this.renderer = renderer;
  707. this._onKeyDown = this._onKeyDown.bind(this);
  708. this._onMouseMove = this._onMouseMove.bind(this);
  709. globalThis.addEventListener("keydown", this._onKeyDown, false);
  710. }
  711. Object.defineProperty(AccessibilityManager2.prototype, "isActive", {
  712. /**
  713. * Value of `true` if accessibility is currently active and accessibility layers are showing.
  714. * @member {boolean}
  715. * @readonly
  716. */
  717. get: function() {
  718. return this._isActive;
  719. },
  720. enumerable: false,
  721. configurable: true
  722. });
  723. Object.defineProperty(AccessibilityManager2.prototype, "isMobileAccessibility", {
  724. /**
  725. * Value of `true` if accessibility is enabled for touch devices.
  726. * @member {boolean}
  727. * @readonly
  728. */
  729. get: function() {
  730. return this._isMobileAccessibility;
  731. },
  732. enumerable: false,
  733. configurable: true
  734. });
  735. AccessibilityManager2.prototype.createTouchHook = function() {
  736. var _this = this;
  737. var hookDiv = document.createElement("button");
  738. hookDiv.style.width = DIV_HOOK_SIZE + "px";
  739. hookDiv.style.height = DIV_HOOK_SIZE + "px";
  740. hookDiv.style.position = "absolute";
  741. hookDiv.style.top = DIV_HOOK_POS_X + "px";
  742. hookDiv.style.left = DIV_HOOK_POS_Y + "px";
  743. hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();
  744. hookDiv.style.backgroundColor = "#FF0000";
  745. hookDiv.title = "select to enable accessibility for this content";
  746. hookDiv.addEventListener("focus", function() {
  747. _this._isMobileAccessibility = true;
  748. _this.activate();
  749. _this.destroyTouchHook();
  750. });
  751. document.body.appendChild(hookDiv);
  752. this._hookDiv = hookDiv;
  753. };
  754. AccessibilityManager2.prototype.destroyTouchHook = function() {
  755. if (!this._hookDiv) {
  756. return;
  757. }
  758. document.body.removeChild(this._hookDiv);
  759. this._hookDiv = null;
  760. };
  761. AccessibilityManager2.prototype.activate = function() {
  762. var _a3;
  763. if (this._isActive) {
  764. return;
  765. }
  766. this._isActive = true;
  767. globalThis.document.addEventListener("mousemove", this._onMouseMove, true);
  768. globalThis.removeEventListener("keydown", this._onKeyDown, false);
  769. this.renderer.on("postrender", this.update, this);
  770. (_a3 = this.renderer.view.parentNode) === null || _a3 === void 0 ? void 0 : _a3.appendChild(this.div);
  771. };
  772. AccessibilityManager2.prototype.deactivate = function() {
  773. var _a3;
  774. if (!this._isActive || this._isMobileAccessibility) {
  775. return;
  776. }
  777. this._isActive = false;
  778. globalThis.document.removeEventListener("mousemove", this._onMouseMove, true);
  779. globalThis.addEventListener("keydown", this._onKeyDown, false);
  780. this.renderer.off("postrender", this.update);
  781. (_a3 = this.div.parentNode) === null || _a3 === void 0 ? void 0 : _a3.removeChild(this.div);
  782. };
  783. AccessibilityManager2.prototype.updateAccessibleObjects = function(displayObject) {
  784. if (!displayObject.visible || !displayObject.accessibleChildren) {
  785. return;
  786. }
  787. if (displayObject.accessible && displayObject.interactive) {
  788. if (!displayObject._accessibleActive) {
  789. this.addChild(displayObject);
  790. }
  791. displayObject.renderId = this.renderId;
  792. }
  793. var children = displayObject.children;
  794. if (children) {
  795. for (var i = 0; i < children.length; i++) {
  796. this.updateAccessibleObjects(children[i]);
  797. }
  798. }
  799. };
  800. AccessibilityManager2.prototype.update = function() {
  801. var now = performance.now();
  802. if (isMobile.android.device && now < this.androidUpdateCount) {
  803. return;
  804. }
  805. this.androidUpdateCount = now + this.androidUpdateFrequency;
  806. if (!this.renderer.renderingToScreen) {
  807. return;
  808. }
  809. if (this.renderer._lastObjectRendered) {
  810. this.updateAccessibleObjects(this.renderer._lastObjectRendered);
  811. }
  812. var _a3 = this.renderer.view.getBoundingClientRect(), left = _a3.left, top = _a3.top, width = _a3.width, height = _a3.height;
  813. var _b2 = this.renderer, viewWidth = _b2.width, viewHeight = _b2.height, resolution = _b2.resolution;
  814. var sx = width / viewWidth * resolution;
  815. var sy = height / viewHeight * resolution;
  816. var div = this.div;
  817. div.style.left = left + "px";
  818. div.style.top = top + "px";
  819. div.style.width = viewWidth + "px";
  820. div.style.height = viewHeight + "px";
  821. for (var i = 0; i < this.children.length; i++) {
  822. var child = this.children[i];
  823. if (child.renderId !== this.renderId) {
  824. child._accessibleActive = false;
  825. removeItems(this.children, i, 1);
  826. this.div.removeChild(child._accessibleDiv);
  827. this.pool.push(child._accessibleDiv);
  828. child._accessibleDiv = null;
  829. i--;
  830. } else {
  831. div = child._accessibleDiv;
  832. var hitArea = child.hitArea;
  833. var wt = child.worldTransform;
  834. if (child.hitArea) {
  835. div.style.left = (wt.tx + hitArea.x * wt.a) * sx + "px";
  836. div.style.top = (wt.ty + hitArea.y * wt.d) * sy + "px";
  837. div.style.width = hitArea.width * wt.a * sx + "px";
  838. div.style.height = hitArea.height * wt.d * sy + "px";
  839. } else {
  840. hitArea = child.getBounds();
  841. this.capHitArea(hitArea);
  842. div.style.left = hitArea.x * sx + "px";
  843. div.style.top = hitArea.y * sy + "px";
  844. div.style.width = hitArea.width * sx + "px";
  845. div.style.height = hitArea.height * sy + "px";
  846. if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) {
  847. div.title = child.accessibleTitle;
  848. }
  849. if (div.getAttribute("aria-label") !== child.accessibleHint && child.accessibleHint !== null) {
  850. div.setAttribute("aria-label", child.accessibleHint);
  851. }
  852. }
  853. if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) {
  854. div.title = child.accessibleTitle;
  855. div.tabIndex = child.tabIndex;
  856. if (this.debug) {
  857. this.updateDebugHTML(div);
  858. }
  859. }
  860. }
  861. }
  862. this.renderId++;
  863. };
  864. AccessibilityManager2.prototype.updateDebugHTML = function(div) {
  865. div.innerHTML = "type: " + div.type + "</br> title : " + div.title + "</br> tabIndex: " + div.tabIndex;
  866. };
  867. AccessibilityManager2.prototype.capHitArea = function(hitArea) {
  868. if (hitArea.x < 0) {
  869. hitArea.width += hitArea.x;
  870. hitArea.x = 0;
  871. }
  872. if (hitArea.y < 0) {
  873. hitArea.height += hitArea.y;
  874. hitArea.y = 0;
  875. }
  876. var _a3 = this.renderer, viewWidth = _a3.width, viewHeight = _a3.height;
  877. if (hitArea.x + hitArea.width > viewWidth) {
  878. hitArea.width = viewWidth - hitArea.x;
  879. }
  880. if (hitArea.y + hitArea.height > viewHeight) {
  881. hitArea.height = viewHeight - hitArea.y;
  882. }
  883. };
  884. AccessibilityManager2.prototype.addChild = function(displayObject) {
  885. var div = this.pool.pop();
  886. if (!div) {
  887. div = document.createElement("button");
  888. div.style.width = DIV_TOUCH_SIZE + "px";
  889. div.style.height = DIV_TOUCH_SIZE + "px";
  890. div.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent";
  891. div.style.position = "absolute";
  892. div.style.zIndex = DIV_TOUCH_ZINDEX.toString();
  893. div.style.borderStyle = "none";
  894. if (navigator.userAgent.toLowerCase().indexOf("chrome") > -1) {
  895. div.setAttribute("aria-live", "off");
  896. } else {
  897. div.setAttribute("aria-live", "polite");
  898. }
  899. if (navigator.userAgent.match(/rv:.*Gecko\//)) {
  900. div.setAttribute("aria-relevant", "additions");
  901. } else {
  902. div.setAttribute("aria-relevant", "text");
  903. }
  904. div.addEventListener("click", this._onClick.bind(this));
  905. div.addEventListener("focus", this._onFocus.bind(this));
  906. div.addEventListener("focusout", this._onFocusOut.bind(this));
  907. }
  908. div.style.pointerEvents = displayObject.accessiblePointerEvents;
  909. div.type = displayObject.accessibleType;
  910. if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) {
  911. div.title = displayObject.accessibleTitle;
  912. } else if (!displayObject.accessibleHint || displayObject.accessibleHint === null) {
  913. div.title = "displayObject " + displayObject.tabIndex;
  914. }
  915. if (displayObject.accessibleHint && displayObject.accessibleHint !== null) {
  916. div.setAttribute("aria-label", displayObject.accessibleHint);
  917. }
  918. if (this.debug) {
  919. this.updateDebugHTML(div);
  920. }
  921. displayObject._accessibleActive = true;
  922. displayObject._accessibleDiv = div;
  923. div.displayObject = displayObject;
  924. this.children.push(displayObject);
  925. this.div.appendChild(displayObject._accessibleDiv);
  926. displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;
  927. };
  928. AccessibilityManager2.prototype._onClick = function(e) {
  929. var interactionManager = this.renderer.plugins.interaction;
  930. var displayObject = e.target.displayObject;
  931. var eventData = interactionManager.eventData;
  932. interactionManager.dispatchEvent(displayObject, "click", eventData);
  933. interactionManager.dispatchEvent(displayObject, "pointertap", eventData);
  934. interactionManager.dispatchEvent(displayObject, "tap", eventData);
  935. };
  936. AccessibilityManager2.prototype._onFocus = function(e) {
  937. if (!e.target.getAttribute("aria-live")) {
  938. e.target.setAttribute("aria-live", "assertive");
  939. }
  940. var interactionManager = this.renderer.plugins.interaction;
  941. var displayObject = e.target.displayObject;
  942. var eventData = interactionManager.eventData;
  943. interactionManager.dispatchEvent(displayObject, "mouseover", eventData);
  944. };
  945. AccessibilityManager2.prototype._onFocusOut = function(e) {
  946. if (!e.target.getAttribute("aria-live")) {
  947. e.target.setAttribute("aria-live", "polite");
  948. }
  949. var interactionManager = this.renderer.plugins.interaction;
  950. var displayObject = e.target.displayObject;
  951. var eventData = interactionManager.eventData;
  952. interactionManager.dispatchEvent(displayObject, "mouseout", eventData);
  953. };
  954. AccessibilityManager2.prototype._onKeyDown = function(e) {
  955. if (e.keyCode !== KEY_CODE_TAB) {
  956. return;
  957. }
  958. this.activate();
  959. };
  960. AccessibilityManager2.prototype._onMouseMove = function(e) {
  961. if (e.movementX === 0 && e.movementY === 0) {
  962. return;
  963. }
  964. this.deactivate();
  965. };
  966. AccessibilityManager2.prototype.destroy = function() {
  967. this.destroyTouchHook();
  968. this.div = null;
  969. globalThis.document.removeEventListener("mousemove", this._onMouseMove, true);
  970. globalThis.removeEventListener("keydown", this._onKeyDown);
  971. this.pool = null;
  972. this.children = null;
  973. this.renderer = null;
  974. };
  975. AccessibilityManager2.extension = {
  976. name: "accessibility",
  977. type: [
  978. ExtensionType.RendererPlugin,
  979. ExtensionType.CanvasRendererPlugin
  980. ]
  981. };
  982. return AccessibilityManager2;
  983. })()
  984. );
  985. // node_modules/@pixi/interaction/dist/esm/interaction.mjs
  986. var InteractionData = (
  987. /** @class */
  988. (function() {
  989. function InteractionData2() {
  990. this.pressure = 0;
  991. this.rotationAngle = 0;
  992. this.twist = 0;
  993. this.tangentialPressure = 0;
  994. this.global = new Point();
  995. this.target = null;
  996. this.originalEvent = null;
  997. this.identifier = null;
  998. this.isPrimary = false;
  999. this.button = 0;
  1000. this.buttons = 0;
  1001. this.width = 0;
  1002. this.height = 0;
  1003. this.tiltX = 0;
  1004. this.tiltY = 0;
  1005. this.pointerType = null;
  1006. this.pressure = 0;
  1007. this.rotationAngle = 0;
  1008. this.twist = 0;
  1009. this.tangentialPressure = 0;
  1010. }
  1011. Object.defineProperty(InteractionData2.prototype, "pointerId", {
  1012. /**
  1013. * The unique identifier of the pointer. It will be the same as `identifier`.
  1014. * @readonly
  1015. * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
  1016. */
  1017. get: function() {
  1018. return this.identifier;
  1019. },
  1020. enumerable: false,
  1021. configurable: true
  1022. });
  1023. InteractionData2.prototype.getLocalPosition = function(displayObject, point, globalPos) {
  1024. return displayObject.worldTransform.applyInverse(globalPos || this.global, point);
  1025. };
  1026. InteractionData2.prototype.copyEvent = function(event) {
  1027. if ("isPrimary" in event && event.isPrimary) {
  1028. this.isPrimary = true;
  1029. }
  1030. this.button = "button" in event && event.button;
  1031. var buttons = "buttons" in event && event.buttons;
  1032. this.buttons = Number.isInteger(buttons) ? buttons : "which" in event && event.which;
  1033. this.width = "width" in event && event.width;
  1034. this.height = "height" in event && event.height;
  1035. this.tiltX = "tiltX" in event && event.tiltX;
  1036. this.tiltY = "tiltY" in event && event.tiltY;
  1037. this.pointerType = "pointerType" in event && event.pointerType;
  1038. this.pressure = "pressure" in event && event.pressure;
  1039. this.rotationAngle = "rotationAngle" in event && event.rotationAngle;
  1040. this.twist = "twist" in event && event.twist || 0;
  1041. this.tangentialPressure = "tangentialPressure" in event && event.tangentialPressure || 0;
  1042. };
  1043. InteractionData2.prototype.reset = function() {
  1044. this.isPrimary = false;
  1045. };
  1046. return InteractionData2;
  1047. })()
  1048. );
  1049. var extendStatics = function(d, b) {
  1050. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  1051. d2.__proto__ = b2;
  1052. } || function(d2, b2) {
  1053. for (var p in b2) {
  1054. if (b2.hasOwnProperty(p)) {
  1055. d2[p] = b2[p];
  1056. }
  1057. }
  1058. };
  1059. return extendStatics(d, b);
  1060. };
  1061. function __extends(d, b) {
  1062. extendStatics(d, b);
  1063. function __() {
  1064. this.constructor = d;
  1065. }
  1066. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1067. }
  1068. var InteractionEvent = (
  1069. /** @class */
  1070. (function() {
  1071. function InteractionEvent2() {
  1072. this.stopped = false;
  1073. this.stopsPropagatingAt = null;
  1074. this.stopPropagationHint = false;
  1075. this.target = null;
  1076. this.currentTarget = null;
  1077. this.type = null;
  1078. this.data = null;
  1079. }
  1080. InteractionEvent2.prototype.stopPropagation = function() {
  1081. this.stopped = true;
  1082. this.stopPropagationHint = true;
  1083. this.stopsPropagatingAt = this.currentTarget;
  1084. };
  1085. InteractionEvent2.prototype.reset = function() {
  1086. this.stopped = false;
  1087. this.stopsPropagatingAt = null;
  1088. this.stopPropagationHint = false;
  1089. this.currentTarget = null;
  1090. this.target = null;
  1091. };
  1092. return InteractionEvent2;
  1093. })()
  1094. );
  1095. var InteractionTrackingData = (
  1096. /** @class */
  1097. (function() {
  1098. function InteractionTrackingData2(pointerId) {
  1099. this._pointerId = pointerId;
  1100. this._flags = InteractionTrackingData2.FLAGS.NONE;
  1101. }
  1102. InteractionTrackingData2.prototype._doSet = function(flag, yn) {
  1103. if (yn) {
  1104. this._flags = this._flags | flag;
  1105. } else {
  1106. this._flags = this._flags & ~flag;
  1107. }
  1108. };
  1109. Object.defineProperty(InteractionTrackingData2.prototype, "pointerId", {
  1110. /**
  1111. * Unique pointer id of the event
  1112. * @readonly
  1113. * @private
  1114. * @member {number}
  1115. */
  1116. get: function() {
  1117. return this._pointerId;
  1118. },
  1119. enumerable: false,
  1120. configurable: true
  1121. });
  1122. Object.defineProperty(InteractionTrackingData2.prototype, "flags", {
  1123. /**
  1124. * State of the tracking data, expressed as bit flags
  1125. * @private
  1126. * @member {number}
  1127. */
  1128. get: function() {
  1129. return this._flags;
  1130. },
  1131. set: function(flags) {
  1132. this._flags = flags;
  1133. },
  1134. enumerable: false,
  1135. configurable: true
  1136. });
  1137. Object.defineProperty(InteractionTrackingData2.prototype, "none", {
  1138. /**
  1139. * Is the tracked event inactive (not over or down)?
  1140. * @private
  1141. * @member {number}
  1142. */
  1143. get: function() {
  1144. return this._flags === InteractionTrackingData2.FLAGS.NONE;
  1145. },
  1146. enumerable: false,
  1147. configurable: true
  1148. });
  1149. Object.defineProperty(InteractionTrackingData2.prototype, "over", {
  1150. /**
  1151. * Is the tracked event over the DisplayObject?
  1152. * @private
  1153. * @member {boolean}
  1154. */
  1155. get: function() {
  1156. return (this._flags & InteractionTrackingData2.FLAGS.OVER) !== 0;
  1157. },
  1158. set: function(yn) {
  1159. this._doSet(InteractionTrackingData2.FLAGS.OVER, yn);
  1160. },
  1161. enumerable: false,
  1162. configurable: true
  1163. });
  1164. Object.defineProperty(InteractionTrackingData2.prototype, "rightDown", {
  1165. /**
  1166. * Did the right mouse button come down in the DisplayObject?
  1167. * @private
  1168. * @member {boolean}
  1169. */
  1170. get: function() {
  1171. return (this._flags & InteractionTrackingData2.FLAGS.RIGHT_DOWN) !== 0;
  1172. },
  1173. set: function(yn) {
  1174. this._doSet(InteractionTrackingData2.FLAGS.RIGHT_DOWN, yn);
  1175. },
  1176. enumerable: false,
  1177. configurable: true
  1178. });
  1179. Object.defineProperty(InteractionTrackingData2.prototype, "leftDown", {
  1180. /**
  1181. * Did the left mouse button come down in the DisplayObject?
  1182. * @private
  1183. * @member {boolean}
  1184. */
  1185. get: function() {
  1186. return (this._flags & InteractionTrackingData2.FLAGS.LEFT_DOWN) !== 0;
  1187. },
  1188. set: function(yn) {
  1189. this._doSet(InteractionTrackingData2.FLAGS.LEFT_DOWN, yn);
  1190. },
  1191. enumerable: false,
  1192. configurable: true
  1193. });
  1194. InteractionTrackingData2.FLAGS = Object.freeze({
  1195. NONE: 0,
  1196. OVER: 1 << 0,
  1197. LEFT_DOWN: 1 << 1,
  1198. RIGHT_DOWN: 1 << 2
  1199. });
  1200. return InteractionTrackingData2;
  1201. })()
  1202. );
  1203. var TreeSearch = (
  1204. /** @class */
  1205. (function() {
  1206. function TreeSearch2() {
  1207. this._tempPoint = new Point();
  1208. }
  1209. TreeSearch2.prototype.recursiveFindHit = function(interactionEvent, displayObject, func, hitTest, interactive) {
  1210. var _a3;
  1211. if (!displayObject || !displayObject.visible) {
  1212. return false;
  1213. }
  1214. var point = interactionEvent.data.global;
  1215. interactive = displayObject.interactive || interactive;
  1216. var hit = false;
  1217. var interactiveParent = interactive;
  1218. var hitTestChildren = true;
  1219. if (displayObject.hitArea) {
  1220. if (hitTest) {
  1221. displayObject.worldTransform.applyInverse(point, this._tempPoint);
  1222. if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) {
  1223. hitTest = false;
  1224. hitTestChildren = false;
  1225. } else {
  1226. hit = true;
  1227. }
  1228. }
  1229. interactiveParent = false;
  1230. } else if (displayObject._mask) {
  1231. if (hitTest) {
  1232. var maskObject = displayObject._mask.isMaskData ? displayObject._mask.maskObject : displayObject._mask;
  1233. if (maskObject && !((_a3 = maskObject.containsPoint) === null || _a3 === void 0 ? void 0 : _a3.call(maskObject, point))) {
  1234. hitTest = false;
  1235. }
  1236. }
  1237. }
  1238. if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) {
  1239. var children = displayObject.children;
  1240. for (var i = children.length - 1; i >= 0; i--) {
  1241. var child = children[i];
  1242. var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);
  1243. if (childHit) {
  1244. if (!child.parent) {
  1245. continue;
  1246. }
  1247. interactiveParent = false;
  1248. if (childHit) {
  1249. if (interactionEvent.target) {
  1250. hitTest = false;
  1251. }
  1252. hit = true;
  1253. }
  1254. }
  1255. }
  1256. }
  1257. if (interactive) {
  1258. if (hitTest && !interactionEvent.target) {
  1259. if (!displayObject.hitArea && displayObject.containsPoint) {
  1260. if (displayObject.containsPoint(point)) {
  1261. hit = true;
  1262. }
  1263. }
  1264. }
  1265. if (displayObject.interactive) {
  1266. if (hit && !interactionEvent.target) {
  1267. interactionEvent.target = displayObject;
  1268. }
  1269. if (func) {
  1270. func(interactionEvent, displayObject, !!hit);
  1271. }
  1272. }
  1273. }
  1274. return hit;
  1275. };
  1276. TreeSearch2.prototype.findHit = function(interactionEvent, displayObject, func, hitTest) {
  1277. this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);
  1278. };
  1279. return TreeSearch2;
  1280. })()
  1281. );
  1282. var interactiveTarget = {
  1283. interactive: false,
  1284. interactiveChildren: true,
  1285. hitArea: null,
  1286. /**
  1287. * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive
  1288. * Setting this changes the 'cursor' property to `'pointer'`.
  1289. * @example
  1290. * const sprite = new PIXI.Sprite(texture);
  1291. * sprite.interactive = true;
  1292. * sprite.buttonMode = true;
  1293. * @member {boolean}
  1294. * @memberof PIXI.DisplayObject#
  1295. */
  1296. get buttonMode() {
  1297. return this.cursor === "pointer";
  1298. },
  1299. set buttonMode(value) {
  1300. if (value) {
  1301. this.cursor = "pointer";
  1302. } else if (this.cursor === "pointer") {
  1303. this.cursor = null;
  1304. }
  1305. },
  1306. /**
  1307. * This defines what cursor mode is used when the mouse cursor
  1308. * is hovered over the displayObject.
  1309. * @example
  1310. * const sprite = new PIXI.Sprite(texture);
  1311. * sprite.interactive = true;
  1312. * sprite.cursor = 'wait';
  1313. * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor
  1314. * @member {string}
  1315. * @memberof PIXI.DisplayObject#
  1316. */
  1317. cursor: null,
  1318. /**
  1319. * Internal set of all active pointers, by identifier
  1320. * @member {Map<number, InteractionTrackingData>}
  1321. * @memberof PIXI.DisplayObject#
  1322. * @private
  1323. */
  1324. get trackedPointers() {
  1325. if (this._trackedPointers === void 0) {
  1326. this._trackedPointers = {};
  1327. }
  1328. return this._trackedPointers;
  1329. },
  1330. /**
  1331. * Map of all tracked pointers, by identifier. Use trackedPointers to access.
  1332. * @private
  1333. * @type {Map<number, InteractionTrackingData>}
  1334. */
  1335. _trackedPointers: void 0
  1336. };
  1337. DisplayObject.mixin(interactiveTarget);
  1338. var MOUSE_POINTER_ID = 1;
  1339. var hitTestEvent = {
  1340. target: null,
  1341. data: {
  1342. global: null
  1343. }
  1344. };
  1345. var InteractionManager = (
  1346. /** @class */
  1347. (function(_super) {
  1348. __extends(InteractionManager2, _super);
  1349. function InteractionManager2(renderer, options) {
  1350. var _this = _super.call(this) || this;
  1351. options = options || {};
  1352. _this.renderer = renderer;
  1353. _this.autoPreventDefault = options.autoPreventDefault !== void 0 ? options.autoPreventDefault : true;
  1354. _this.interactionFrequency = options.interactionFrequency || 10;
  1355. _this.mouse = new InteractionData();
  1356. _this.mouse.identifier = MOUSE_POINTER_ID;
  1357. _this.mouse.global.set(-999999);
  1358. _this.activeInteractionData = {};
  1359. _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse;
  1360. _this.interactionDataPool = [];
  1361. _this.eventData = new InteractionEvent();
  1362. _this.interactionDOMElement = null;
  1363. _this.moveWhenInside = false;
  1364. _this.eventsAdded = false;
  1365. _this.tickerAdded = false;
  1366. _this.mouseOverRenderer = !("PointerEvent" in globalThis);
  1367. _this.supportsTouchEvents = "ontouchstart" in globalThis;
  1368. _this.supportsPointerEvents = !!globalThis.PointerEvent;
  1369. _this.onPointerUp = _this.onPointerUp.bind(_this);
  1370. _this.processPointerUp = _this.processPointerUp.bind(_this);
  1371. _this.onPointerCancel = _this.onPointerCancel.bind(_this);
  1372. _this.processPointerCancel = _this.processPointerCancel.bind(_this);
  1373. _this.onPointerDown = _this.onPointerDown.bind(_this);
  1374. _this.processPointerDown = _this.processPointerDown.bind(_this);
  1375. _this.onPointerMove = _this.onPointerMove.bind(_this);
  1376. _this.processPointerMove = _this.processPointerMove.bind(_this);
  1377. _this.onPointerOut = _this.onPointerOut.bind(_this);
  1378. _this.processPointerOverOut = _this.processPointerOverOut.bind(_this);
  1379. _this.onPointerOver = _this.onPointerOver.bind(_this);
  1380. _this.cursorStyles = {
  1381. default: "inherit",
  1382. pointer: "pointer"
  1383. };
  1384. _this.currentCursorMode = null;
  1385. _this.cursor = null;
  1386. _this.resolution = 1;
  1387. _this.delayedEvents = [];
  1388. _this.search = new TreeSearch();
  1389. _this._tempDisplayObject = new TemporaryDisplayObject();
  1390. _this._eventListenerOptions = { capture: true, passive: false };
  1391. _this._useSystemTicker = options.useSystemTicker !== void 0 ? options.useSystemTicker : true;
  1392. _this.setTargetElement(_this.renderer.view, _this.renderer.resolution);
  1393. return _this;
  1394. }
  1395. Object.defineProperty(InteractionManager2.prototype, "useSystemTicker", {
  1396. /**
  1397. * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.
  1398. * @default true
  1399. */
  1400. get: function() {
  1401. return this._useSystemTicker;
  1402. },
  1403. set: function(useSystemTicker) {
  1404. this._useSystemTicker = useSystemTicker;
  1405. if (useSystemTicker) {
  1406. this.addTickerListener();
  1407. } else {
  1408. this.removeTickerListener();
  1409. }
  1410. },
  1411. enumerable: false,
  1412. configurable: true
  1413. });
  1414. Object.defineProperty(InteractionManager2.prototype, "lastObjectRendered", {
  1415. /**
  1416. * Last rendered object or temp object.
  1417. * @readonly
  1418. * @protected
  1419. */
  1420. get: function() {
  1421. return this.renderer._lastObjectRendered || this._tempDisplayObject;
  1422. },
  1423. enumerable: false,
  1424. configurable: true
  1425. });
  1426. InteractionManager2.prototype.hitTest = function(globalPoint, root) {
  1427. hitTestEvent.target = null;
  1428. hitTestEvent.data.global = globalPoint;
  1429. if (!root) {
  1430. root = this.lastObjectRendered;
  1431. }
  1432. this.processInteractive(hitTestEvent, root, null, true);
  1433. return hitTestEvent.target;
  1434. };
  1435. InteractionManager2.prototype.setTargetElement = function(element, resolution) {
  1436. if (resolution === void 0) {
  1437. resolution = 1;
  1438. }
  1439. this.removeTickerListener();
  1440. this.removeEvents();
  1441. this.interactionDOMElement = element;
  1442. this.resolution = resolution;
  1443. this.addEvents();
  1444. this.addTickerListener();
  1445. };
  1446. InteractionManager2.prototype.addTickerListener = function() {
  1447. if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) {
  1448. return;
  1449. }
  1450. Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);
  1451. this.tickerAdded = true;
  1452. };
  1453. InteractionManager2.prototype.removeTickerListener = function() {
  1454. if (!this.tickerAdded) {
  1455. return;
  1456. }
  1457. Ticker.system.remove(this.tickerUpdate, this);
  1458. this.tickerAdded = false;
  1459. };
  1460. InteractionManager2.prototype.addEvents = function() {
  1461. if (this.eventsAdded || !this.interactionDOMElement) {
  1462. return;
  1463. }
  1464. var style = this.interactionDOMElement.style;
  1465. if (globalThis.navigator.msPointerEnabled) {
  1466. style.msContentZooming = "none";
  1467. style.msTouchAction = "none";
  1468. } else if (this.supportsPointerEvents) {
  1469. style.touchAction = "none";
  1470. }
  1471. if (this.supportsPointerEvents) {
  1472. globalThis.document.addEventListener("pointermove", this.onPointerMove, this._eventListenerOptions);
  1473. this.interactionDOMElement.addEventListener("pointerdown", this.onPointerDown, this._eventListenerOptions);
  1474. this.interactionDOMElement.addEventListener("pointerleave", this.onPointerOut, this._eventListenerOptions);
  1475. this.interactionDOMElement.addEventListener("pointerover", this.onPointerOver, this._eventListenerOptions);
  1476. globalThis.addEventListener("pointercancel", this.onPointerCancel, this._eventListenerOptions);
  1477. globalThis.addEventListener("pointerup", this.onPointerUp, this._eventListenerOptions);
  1478. } else {
  1479. globalThis.document.addEventListener("mousemove", this.onPointerMove, this._eventListenerOptions);
  1480. this.interactionDOMElement.addEventListener("mousedown", this.onPointerDown, this._eventListenerOptions);
  1481. this.interactionDOMElement.addEventListener("mouseout", this.onPointerOut, this._eventListenerOptions);
  1482. this.interactionDOMElement.addEventListener("mouseover", this.onPointerOver, this._eventListenerOptions);
  1483. globalThis.addEventListener("mouseup", this.onPointerUp, this._eventListenerOptions);
  1484. }
  1485. if (this.supportsTouchEvents) {
  1486. this.interactionDOMElement.addEventListener("touchstart", this.onPointerDown, this._eventListenerOptions);
  1487. this.interactionDOMElement.addEventListener("touchcancel", this.onPointerCancel, this._eventListenerOptions);
  1488. this.interactionDOMElement.addEventListener("touchend", this.onPointerUp, this._eventListenerOptions);
  1489. this.interactionDOMElement.addEventListener("touchmove", this.onPointerMove, this._eventListenerOptions);
  1490. }
  1491. this.eventsAdded = true;
  1492. };
  1493. InteractionManager2.prototype.removeEvents = function() {
  1494. if (!this.eventsAdded || !this.interactionDOMElement) {
  1495. return;
  1496. }
  1497. var style = this.interactionDOMElement.style;
  1498. if (globalThis.navigator.msPointerEnabled) {
  1499. style.msContentZooming = "";
  1500. style.msTouchAction = "";
  1501. } else if (this.supportsPointerEvents) {
  1502. style.touchAction = "";
  1503. }
  1504. if (this.supportsPointerEvents) {
  1505. globalThis.document.removeEventListener("pointermove", this.onPointerMove, this._eventListenerOptions);
  1506. this.interactionDOMElement.removeEventListener("pointerdown", this.onPointerDown, this._eventListenerOptions);
  1507. this.interactionDOMElement.removeEventListener("pointerleave", this.onPointerOut, this._eventListenerOptions);
  1508. this.interactionDOMElement.removeEventListener("pointerover", this.onPointerOver, this._eventListenerOptions);
  1509. globalThis.removeEventListener("pointercancel", this.onPointerCancel, this._eventListenerOptions);
  1510. globalThis.removeEventListener("pointerup", this.onPointerUp, this._eventListenerOptions);
  1511. } else {
  1512. globalThis.document.removeEventListener("mousemove", this.onPointerMove, this._eventListenerOptions);
  1513. this.interactionDOMElement.removeEventListener("mousedown", this.onPointerDown, this._eventListenerOptions);
  1514. this.interactionDOMElement.removeEventListener("mouseout", this.onPointerOut, this._eventListenerOptions);
  1515. this.interactionDOMElement.removeEventListener("mouseover", this.onPointerOver, this._eventListenerOptions);
  1516. globalThis.removeEventListener("mouseup", this.onPointerUp, this._eventListenerOptions);
  1517. }
  1518. if (this.supportsTouchEvents) {
  1519. this.interactionDOMElement.removeEventListener("touchstart", this.onPointerDown, this._eventListenerOptions);
  1520. this.interactionDOMElement.removeEventListener("touchcancel", this.onPointerCancel, this._eventListenerOptions);
  1521. this.interactionDOMElement.removeEventListener("touchend", this.onPointerUp, this._eventListenerOptions);
  1522. this.interactionDOMElement.removeEventListener("touchmove", this.onPointerMove, this._eventListenerOptions);
  1523. }
  1524. this.interactionDOMElement = null;
  1525. this.eventsAdded = false;
  1526. };
  1527. InteractionManager2.prototype.tickerUpdate = function(deltaTime) {
  1528. this._deltaTime += deltaTime;
  1529. if (this._deltaTime < this.interactionFrequency) {
  1530. return;
  1531. }
  1532. this._deltaTime = 0;
  1533. this.update();
  1534. };
  1535. InteractionManager2.prototype.update = function() {
  1536. if (!this.interactionDOMElement) {
  1537. return;
  1538. }
  1539. if (this._didMove) {
  1540. this._didMove = false;
  1541. return;
  1542. }
  1543. this.cursor = null;
  1544. for (var k in this.activeInteractionData) {
  1545. if (this.activeInteractionData.hasOwnProperty(k)) {
  1546. var interactionData = this.activeInteractionData[k];
  1547. if (interactionData.originalEvent && interactionData.pointerType !== "touch") {
  1548. var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData);
  1549. this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, true);
  1550. }
  1551. }
  1552. }
  1553. this.setCursorMode(this.cursor);
  1554. };
  1555. InteractionManager2.prototype.setCursorMode = function(mode) {
  1556. mode = mode || "default";
  1557. var applyStyles = true;
  1558. if (globalThis.OffscreenCanvas && this.interactionDOMElement instanceof OffscreenCanvas) {
  1559. applyStyles = false;
  1560. }
  1561. if (this.currentCursorMode === mode) {
  1562. return;
  1563. }
  1564. this.currentCursorMode = mode;
  1565. var style = this.cursorStyles[mode];
  1566. if (style) {
  1567. switch (typeof style) {
  1568. case "string":
  1569. if (applyStyles) {
  1570. this.interactionDOMElement.style.cursor = style;
  1571. }
  1572. break;
  1573. case "function":
  1574. style(mode);
  1575. break;
  1576. case "object":
  1577. if (applyStyles) {
  1578. Object.assign(this.interactionDOMElement.style, style);
  1579. }
  1580. break;
  1581. }
  1582. } else if (applyStyles && typeof mode === "string" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) {
  1583. this.interactionDOMElement.style.cursor = mode;
  1584. }
  1585. };
  1586. InteractionManager2.prototype.dispatchEvent = function(displayObject, eventString, eventData) {
  1587. if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) {
  1588. eventData.currentTarget = displayObject;
  1589. eventData.type = eventString;
  1590. displayObject.emit(eventString, eventData);
  1591. if (displayObject[eventString]) {
  1592. displayObject[eventString](eventData);
  1593. }
  1594. }
  1595. };
  1596. InteractionManager2.prototype.delayDispatchEvent = function(displayObject, eventString, eventData) {
  1597. this.delayedEvents.push({ displayObject, eventString, eventData });
  1598. };
  1599. InteractionManager2.prototype.mapPositionToPoint = function(point, x, y) {
  1600. var rect;
  1601. if (!this.interactionDOMElement.parentElement) {
  1602. rect = {
  1603. x: 0,
  1604. y: 0,
  1605. width: this.interactionDOMElement.width,
  1606. height: this.interactionDOMElement.height,
  1607. left: 0,
  1608. top: 0
  1609. };
  1610. } else {
  1611. rect = this.interactionDOMElement.getBoundingClientRect();
  1612. }
  1613. var resolutionMultiplier = 1 / this.resolution;
  1614. point.x = (x - rect.left) * (this.interactionDOMElement.width / rect.width) * resolutionMultiplier;
  1615. point.y = (y - rect.top) * (this.interactionDOMElement.height / rect.height) * resolutionMultiplier;
  1616. };
  1617. InteractionManager2.prototype.processInteractive = function(interactionEvent, displayObject, func, hitTest) {
  1618. var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);
  1619. var delayedEvents = this.delayedEvents;
  1620. if (!delayedEvents.length) {
  1621. return hit;
  1622. }
  1623. interactionEvent.stopPropagationHint = false;
  1624. var delayedLen = delayedEvents.length;
  1625. this.delayedEvents = [];
  1626. for (var i = 0; i < delayedLen; i++) {
  1627. var _a3 = delayedEvents[i], displayObject_1 = _a3.displayObject, eventString = _a3.eventString, eventData = _a3.eventData;
  1628. if (eventData.stopsPropagatingAt === displayObject_1) {
  1629. eventData.stopPropagationHint = true;
  1630. }
  1631. this.dispatchEvent(displayObject_1, eventString, eventData);
  1632. }
  1633. return hit;
  1634. };
  1635. InteractionManager2.prototype.onPointerDown = function(originalEvent) {
  1636. if (this.supportsTouchEvents && originalEvent.pointerType === "touch") {
  1637. return;
  1638. }
  1639. var events = this.normalizeToPointerData(originalEvent);
  1640. if (this.autoPreventDefault && events[0].isNormalized) {
  1641. var cancelable = originalEvent.cancelable || !("cancelable" in originalEvent);
  1642. if (cancelable) {
  1643. originalEvent.preventDefault();
  1644. }
  1645. }
  1646. var eventLen = events.length;
  1647. for (var i = 0; i < eventLen; i++) {
  1648. var event = events[i];
  1649. var interactionData = this.getInteractionDataForPointerId(event);
  1650. var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);
  1651. interactionEvent.data.originalEvent = originalEvent;
  1652. this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);
  1653. this.emit("pointerdown", interactionEvent);
  1654. if (event.pointerType === "touch") {
  1655. this.emit("touchstart", interactionEvent);
  1656. } else if (event.pointerType === "mouse" || event.pointerType === "pen") {
  1657. var isRightButton = event.button === 2;
  1658. this.emit(isRightButton ? "rightdown" : "mousedown", this.eventData);
  1659. }
  1660. }
  1661. };
  1662. InteractionManager2.prototype.processPointerDown = function(interactionEvent, displayObject, hit) {
  1663. var data = interactionEvent.data;
  1664. var id = interactionEvent.data.identifier;
  1665. if (hit) {
  1666. if (!displayObject.trackedPointers[id]) {
  1667. displayObject.trackedPointers[id] = new InteractionTrackingData(id);
  1668. }
  1669. this.dispatchEvent(displayObject, "pointerdown", interactionEvent);
  1670. if (data.pointerType === "touch") {
  1671. this.dispatchEvent(displayObject, "touchstart", interactionEvent);
  1672. } else if (data.pointerType === "mouse" || data.pointerType === "pen") {
  1673. var isRightButton = data.button === 2;
  1674. if (isRightButton) {
  1675. displayObject.trackedPointers[id].rightDown = true;
  1676. } else {
  1677. displayObject.trackedPointers[id].leftDown = true;
  1678. }
  1679. this.dispatchEvent(displayObject, isRightButton ? "rightdown" : "mousedown", interactionEvent);
  1680. }
  1681. }
  1682. };
  1683. InteractionManager2.prototype.onPointerComplete = function(originalEvent, cancelled, func) {
  1684. var events = this.normalizeToPointerData(originalEvent);
  1685. var eventLen = events.length;
  1686. var target = originalEvent.target;
  1687. if (originalEvent.composedPath && originalEvent.composedPath().length > 0) {
  1688. target = originalEvent.composedPath()[0];
  1689. }
  1690. var eventAppend = target !== this.interactionDOMElement ? "outside" : "";
  1691. for (var i = 0; i < eventLen; i++) {
  1692. var event = events[i];
  1693. var interactionData = this.getInteractionDataForPointerId(event);
  1694. var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);
  1695. interactionEvent.data.originalEvent = originalEvent;
  1696. this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);
  1697. this.emit(cancelled ? "pointercancel" : "pointerup" + eventAppend, interactionEvent);
  1698. if (event.pointerType === "mouse" || event.pointerType === "pen") {
  1699. var isRightButton = event.button === 2;
  1700. this.emit(isRightButton ? "rightup" + eventAppend : "mouseup" + eventAppend, interactionEvent);
  1701. } else if (event.pointerType === "touch") {
  1702. this.emit(cancelled ? "touchcancel" : "touchend" + eventAppend, interactionEvent);
  1703. this.releaseInteractionDataForPointerId(event.pointerId);
  1704. }
  1705. }
  1706. };
  1707. InteractionManager2.prototype.onPointerCancel = function(event) {
  1708. if (this.supportsTouchEvents && event.pointerType === "touch") {
  1709. return;
  1710. }
  1711. this.onPointerComplete(event, true, this.processPointerCancel);
  1712. };
  1713. InteractionManager2.prototype.processPointerCancel = function(interactionEvent, displayObject) {
  1714. var data = interactionEvent.data;
  1715. var id = interactionEvent.data.identifier;
  1716. if (displayObject.trackedPointers[id] !== void 0) {
  1717. delete displayObject.trackedPointers[id];
  1718. this.dispatchEvent(displayObject, "pointercancel", interactionEvent);
  1719. if (data.pointerType === "touch") {
  1720. this.dispatchEvent(displayObject, "touchcancel", interactionEvent);
  1721. }
  1722. }
  1723. };
  1724. InteractionManager2.prototype.onPointerUp = function(event) {
  1725. if (this.supportsTouchEvents && event.pointerType === "touch") {
  1726. return;
  1727. }
  1728. this.onPointerComplete(event, false, this.processPointerUp);
  1729. };
  1730. InteractionManager2.prototype.processPointerUp = function(interactionEvent, displayObject, hit) {
  1731. var data = interactionEvent.data;
  1732. var id = interactionEvent.data.identifier;
  1733. var trackingData = displayObject.trackedPointers[id];
  1734. var isTouch = data.pointerType === "touch";
  1735. var isMouse = data.pointerType === "mouse" || data.pointerType === "pen";
  1736. var isMouseTap = false;
  1737. if (isMouse) {
  1738. var isRightButton = data.button === 2;
  1739. var flags = InteractionTrackingData.FLAGS;
  1740. var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;
  1741. var isDown = trackingData !== void 0 && trackingData.flags & test;
  1742. if (hit) {
  1743. this.dispatchEvent(displayObject, isRightButton ? "rightup" : "mouseup", interactionEvent);
  1744. if (isDown) {
  1745. this.dispatchEvent(displayObject, isRightButton ? "rightclick" : "click", interactionEvent);
  1746. isMouseTap = true;
  1747. }
  1748. } else if (isDown) {
  1749. this.dispatchEvent(displayObject, isRightButton ? "rightupoutside" : "mouseupoutside", interactionEvent);
  1750. }
  1751. if (trackingData) {
  1752. if (isRightButton) {
  1753. trackingData.rightDown = false;
  1754. } else {
  1755. trackingData.leftDown = false;
  1756. }
  1757. }
  1758. }
  1759. if (hit) {
  1760. this.dispatchEvent(displayObject, "pointerup", interactionEvent);
  1761. if (isTouch) {
  1762. this.dispatchEvent(displayObject, "touchend", interactionEvent);
  1763. }
  1764. if (trackingData) {
  1765. if (!isMouse || isMouseTap) {
  1766. this.dispatchEvent(displayObject, "pointertap", interactionEvent);
  1767. }
  1768. if (isTouch) {
  1769. this.dispatchEvent(displayObject, "tap", interactionEvent);
  1770. trackingData.over = false;
  1771. }
  1772. }
  1773. } else if (trackingData) {
  1774. this.dispatchEvent(displayObject, "pointerupoutside", interactionEvent);
  1775. if (isTouch) {
  1776. this.dispatchEvent(displayObject, "touchendoutside", interactionEvent);
  1777. }
  1778. }
  1779. if (trackingData && trackingData.none) {
  1780. delete displayObject.trackedPointers[id];
  1781. }
  1782. };
  1783. InteractionManager2.prototype.onPointerMove = function(originalEvent) {
  1784. if (this.supportsTouchEvents && originalEvent.pointerType === "touch") {
  1785. return;
  1786. }
  1787. var events = this.normalizeToPointerData(originalEvent);
  1788. if (events[0].pointerType === "mouse" || events[0].pointerType === "pen") {
  1789. this._didMove = true;
  1790. this.cursor = null;
  1791. }
  1792. var eventLen = events.length;
  1793. for (var i = 0; i < eventLen; i++) {
  1794. var event = events[i];
  1795. var interactionData = this.getInteractionDataForPointerId(event);
  1796. var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);
  1797. interactionEvent.data.originalEvent = originalEvent;
  1798. this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);
  1799. this.emit("pointermove", interactionEvent);
  1800. if (event.pointerType === "touch") {
  1801. this.emit("touchmove", interactionEvent);
  1802. }
  1803. if (event.pointerType === "mouse" || event.pointerType === "pen") {
  1804. this.emit("mousemove", interactionEvent);
  1805. }
  1806. }
  1807. if (events[0].pointerType === "mouse") {
  1808. this.setCursorMode(this.cursor);
  1809. }
  1810. };
  1811. InteractionManager2.prototype.processPointerMove = function(interactionEvent, displayObject, hit) {
  1812. var data = interactionEvent.data;
  1813. var isTouch = data.pointerType === "touch";
  1814. var isMouse = data.pointerType === "mouse" || data.pointerType === "pen";
  1815. if (isMouse) {
  1816. this.processPointerOverOut(interactionEvent, displayObject, hit);
  1817. }
  1818. if (!this.moveWhenInside || hit) {
  1819. this.dispatchEvent(displayObject, "pointermove", interactionEvent);
  1820. if (isTouch) {
  1821. this.dispatchEvent(displayObject, "touchmove", interactionEvent);
  1822. }
  1823. if (isMouse) {
  1824. this.dispatchEvent(displayObject, "mousemove", interactionEvent);
  1825. }
  1826. }
  1827. };
  1828. InteractionManager2.prototype.onPointerOut = function(originalEvent) {
  1829. if (this.supportsTouchEvents && originalEvent.pointerType === "touch") {
  1830. return;
  1831. }
  1832. var events = this.normalizeToPointerData(originalEvent);
  1833. var event = events[0];
  1834. if (event.pointerType === "mouse") {
  1835. this.mouseOverRenderer = false;
  1836. this.setCursorMode(null);
  1837. }
  1838. var interactionData = this.getInteractionDataForPointerId(event);
  1839. var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);
  1840. interactionEvent.data.originalEvent = event;
  1841. this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);
  1842. this.emit("pointerout", interactionEvent);
  1843. if (event.pointerType === "mouse" || event.pointerType === "pen") {
  1844. this.emit("mouseout", interactionEvent);
  1845. } else {
  1846. this.releaseInteractionDataForPointerId(interactionData.identifier);
  1847. }
  1848. };
  1849. InteractionManager2.prototype.processPointerOverOut = function(interactionEvent, displayObject, hit) {
  1850. var data = interactionEvent.data;
  1851. var id = interactionEvent.data.identifier;
  1852. var isMouse = data.pointerType === "mouse" || data.pointerType === "pen";
  1853. var trackingData = displayObject.trackedPointers[id];
  1854. if (hit && !trackingData) {
  1855. trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);
  1856. }
  1857. if (trackingData === void 0) {
  1858. return;
  1859. }
  1860. if (hit && this.mouseOverRenderer) {
  1861. if (!trackingData.over) {
  1862. trackingData.over = true;
  1863. this.delayDispatchEvent(displayObject, "pointerover", interactionEvent);
  1864. if (isMouse) {
  1865. this.delayDispatchEvent(displayObject, "mouseover", interactionEvent);
  1866. }
  1867. }
  1868. if (isMouse && this.cursor === null) {
  1869. this.cursor = displayObject.cursor;
  1870. }
  1871. } else if (trackingData.over) {
  1872. trackingData.over = false;
  1873. this.dispatchEvent(displayObject, "pointerout", this.eventData);
  1874. if (isMouse) {
  1875. this.dispatchEvent(displayObject, "mouseout", interactionEvent);
  1876. }
  1877. if (trackingData.none) {
  1878. delete displayObject.trackedPointers[id];
  1879. }
  1880. }
  1881. };
  1882. InteractionManager2.prototype.onPointerOver = function(originalEvent) {
  1883. if (this.supportsTouchEvents && originalEvent.pointerType === "touch") {
  1884. return;
  1885. }
  1886. var events = this.normalizeToPointerData(originalEvent);
  1887. var event = events[0];
  1888. var interactionData = this.getInteractionDataForPointerId(event);
  1889. var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);
  1890. interactionEvent.data.originalEvent = event;
  1891. if (event.pointerType === "mouse") {
  1892. this.mouseOverRenderer = true;
  1893. }
  1894. this.emit("pointerover", interactionEvent);
  1895. if (event.pointerType === "mouse" || event.pointerType === "pen") {
  1896. this.emit("mouseover", interactionEvent);
  1897. }
  1898. };
  1899. InteractionManager2.prototype.getInteractionDataForPointerId = function(event) {
  1900. var pointerId = event.pointerId;
  1901. var interactionData;
  1902. if (pointerId === MOUSE_POINTER_ID || event.pointerType === "mouse") {
  1903. interactionData = this.mouse;
  1904. } else if (this.activeInteractionData[pointerId]) {
  1905. interactionData = this.activeInteractionData[pointerId];
  1906. } else {
  1907. interactionData = this.interactionDataPool.pop() || new InteractionData();
  1908. interactionData.identifier = pointerId;
  1909. this.activeInteractionData[pointerId] = interactionData;
  1910. }
  1911. interactionData.copyEvent(event);
  1912. return interactionData;
  1913. };
  1914. InteractionManager2.prototype.releaseInteractionDataForPointerId = function(pointerId) {
  1915. var interactionData = this.activeInteractionData[pointerId];
  1916. if (interactionData) {
  1917. delete this.activeInteractionData[pointerId];
  1918. interactionData.reset();
  1919. this.interactionDataPool.push(interactionData);
  1920. }
  1921. };
  1922. InteractionManager2.prototype.configureInteractionEventForDOMEvent = function(interactionEvent, pointerEvent, interactionData) {
  1923. interactionEvent.data = interactionData;
  1924. this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);
  1925. if (pointerEvent.pointerType === "touch") {
  1926. pointerEvent.globalX = interactionData.global.x;
  1927. pointerEvent.globalY = interactionData.global.y;
  1928. }
  1929. interactionData.originalEvent = pointerEvent;
  1930. interactionEvent.reset();
  1931. return interactionEvent;
  1932. };
  1933. InteractionManager2.prototype.normalizeToPointerData = function(event) {
  1934. var normalizedEvents = [];
  1935. if (this.supportsTouchEvents && event instanceof TouchEvent) {
  1936. for (var i = 0, li = event.changedTouches.length; i < li; i++) {
  1937. var touch = event.changedTouches[i];
  1938. if (typeof touch.button === "undefined") {
  1939. touch.button = event.touches.length ? 1 : 0;
  1940. }
  1941. if (typeof touch.buttons === "undefined") {
  1942. touch.buttons = event.touches.length ? 1 : 0;
  1943. }
  1944. if (typeof touch.isPrimary === "undefined") {
  1945. touch.isPrimary = event.touches.length === 1 && event.type === "touchstart";
  1946. }
  1947. if (typeof touch.width === "undefined") {
  1948. touch.width = touch.radiusX || 1;
  1949. }
  1950. if (typeof touch.height === "undefined") {
  1951. touch.height = touch.radiusY || 1;
  1952. }
  1953. if (typeof touch.tiltX === "undefined") {
  1954. touch.tiltX = 0;
  1955. }
  1956. if (typeof touch.tiltY === "undefined") {
  1957. touch.tiltY = 0;
  1958. }
  1959. if (typeof touch.pointerType === "undefined") {
  1960. touch.pointerType = "touch";
  1961. }
  1962. if (typeof touch.pointerId === "undefined") {
  1963. touch.pointerId = touch.identifier || 0;
  1964. }
  1965. if (typeof touch.pressure === "undefined") {
  1966. touch.pressure = touch.force || 0.5;
  1967. }
  1968. if (typeof touch.twist === "undefined") {
  1969. touch.twist = 0;
  1970. }
  1971. if (typeof touch.tangentialPressure === "undefined") {
  1972. touch.tangentialPressure = 0;
  1973. }
  1974. if (typeof touch.layerX === "undefined") {
  1975. touch.layerX = touch.offsetX = touch.clientX;
  1976. }
  1977. if (typeof touch.layerY === "undefined") {
  1978. touch.layerY = touch.offsetY = touch.clientY;
  1979. }
  1980. touch.isNormalized = true;
  1981. normalizedEvents.push(touch);
  1982. }
  1983. } else if (!globalThis.MouseEvent || event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof globalThis.PointerEvent))) {
  1984. var tempEvent = event;
  1985. if (typeof tempEvent.isPrimary === "undefined") {
  1986. tempEvent.isPrimary = true;
  1987. }
  1988. if (typeof tempEvent.width === "undefined") {
  1989. tempEvent.width = 1;
  1990. }
  1991. if (typeof tempEvent.height === "undefined") {
  1992. tempEvent.height = 1;
  1993. }
  1994. if (typeof tempEvent.tiltX === "undefined") {
  1995. tempEvent.tiltX = 0;
  1996. }
  1997. if (typeof tempEvent.tiltY === "undefined") {
  1998. tempEvent.tiltY = 0;
  1999. }
  2000. if (typeof tempEvent.pointerType === "undefined") {
  2001. tempEvent.pointerType = "mouse";
  2002. }
  2003. if (typeof tempEvent.pointerId === "undefined") {
  2004. tempEvent.pointerId = MOUSE_POINTER_ID;
  2005. }
  2006. if (typeof tempEvent.pressure === "undefined") {
  2007. tempEvent.pressure = 0.5;
  2008. }
  2009. if (typeof tempEvent.twist === "undefined") {
  2010. tempEvent.twist = 0;
  2011. }
  2012. if (typeof tempEvent.tangentialPressure === "undefined") {
  2013. tempEvent.tangentialPressure = 0;
  2014. }
  2015. tempEvent.isNormalized = true;
  2016. normalizedEvents.push(tempEvent);
  2017. } else {
  2018. normalizedEvents.push(event);
  2019. }
  2020. return normalizedEvents;
  2021. };
  2022. InteractionManager2.prototype.destroy = function() {
  2023. this.removeEvents();
  2024. this.removeTickerListener();
  2025. this.removeAllListeners();
  2026. this.renderer = null;
  2027. this.mouse = null;
  2028. this.eventData = null;
  2029. this.interactionDOMElement = null;
  2030. this.onPointerDown = null;
  2031. this.processPointerDown = null;
  2032. this.onPointerUp = null;
  2033. this.processPointerUp = null;
  2034. this.onPointerCancel = null;
  2035. this.processPointerCancel = null;
  2036. this.onPointerMove = null;
  2037. this.processPointerMove = null;
  2038. this.onPointerOut = null;
  2039. this.processPointerOverOut = null;
  2040. this.onPointerOver = null;
  2041. this.search = null;
  2042. };
  2043. InteractionManager2.extension = {
  2044. name: "interaction",
  2045. type: [
  2046. ExtensionType.RendererPlugin,
  2047. ExtensionType.CanvasRendererPlugin
  2048. ]
  2049. };
  2050. return InteractionManager2;
  2051. })(import_eventemitter3.default)
  2052. );
  2053. // node_modules/@pixi/extract/dist/esm/extract.mjs
  2054. var TEMP_RECT = new Rectangle();
  2055. var BYTES_PER_PIXEL = 4;
  2056. var Extract = (
  2057. /** @class */
  2058. (function() {
  2059. function Extract2(renderer) {
  2060. this.renderer = renderer;
  2061. }
  2062. Extract2.prototype.image = function(target, format, quality) {
  2063. var image = new Image();
  2064. image.src = this.base64(target, format, quality);
  2065. return image;
  2066. };
  2067. Extract2.prototype.base64 = function(target, format, quality) {
  2068. return this.canvas(target).toDataURL(format, quality);
  2069. };
  2070. Extract2.prototype.canvas = function(target, frame) {
  2071. var _a3 = this._rawPixels(target, frame), pixels = _a3.pixels, width = _a3.width, height = _a3.height, flipY = _a3.flipY;
  2072. var canvasBuffer = new CanvasRenderTarget(width, height, 1);
  2073. var canvasData = canvasBuffer.context.getImageData(0, 0, width, height);
  2074. Extract2.arrayPostDivide(pixels, canvasData.data);
  2075. canvasBuffer.context.putImageData(canvasData, 0, 0);
  2076. if (flipY) {
  2077. var target_1 = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);
  2078. target_1.context.scale(1, -1);
  2079. target_1.context.drawImage(canvasBuffer.canvas, 0, -height);
  2080. canvasBuffer.destroy();
  2081. canvasBuffer = target_1;
  2082. }
  2083. return canvasBuffer.canvas;
  2084. };
  2085. Extract2.prototype.pixels = function(target, frame) {
  2086. var pixels = this._rawPixels(target, frame).pixels;
  2087. Extract2.arrayPostDivide(pixels, pixels);
  2088. return pixels;
  2089. };
  2090. Extract2.prototype._rawPixels = function(target, frame) {
  2091. var renderer = this.renderer;
  2092. var resolution;
  2093. var flipY = false;
  2094. var renderTexture;
  2095. var generated = false;
  2096. if (target) {
  2097. if (target instanceof RenderTexture) {
  2098. renderTexture = target;
  2099. } else {
  2100. var multisample = renderer.context.webGLVersion >= 2 ? renderer.multisample : MSAA_QUALITY.NONE;
  2101. renderTexture = this.renderer.generateTexture(target, { multisample });
  2102. if (multisample !== MSAA_QUALITY.NONE) {
  2103. var resolvedTexture = RenderTexture.create({
  2104. width: renderTexture.width,
  2105. height: renderTexture.height
  2106. });
  2107. renderer.framebuffer.bind(renderTexture.framebuffer);
  2108. renderer.framebuffer.blit(resolvedTexture.framebuffer);
  2109. renderer.framebuffer.bind(null);
  2110. renderTexture.destroy(true);
  2111. renderTexture = resolvedTexture;
  2112. }
  2113. generated = true;
  2114. }
  2115. }
  2116. if (renderTexture) {
  2117. resolution = renderTexture.baseTexture.resolution;
  2118. frame = frame !== null && frame !== void 0 ? frame : renderTexture.frame;
  2119. flipY = false;
  2120. renderer.renderTexture.bind(renderTexture);
  2121. } else {
  2122. resolution = renderer.resolution;
  2123. if (!frame) {
  2124. frame = TEMP_RECT;
  2125. frame.width = renderer.width;
  2126. frame.height = renderer.height;
  2127. }
  2128. flipY = true;
  2129. renderer.renderTexture.bind(null);
  2130. }
  2131. var width = Math.round(frame.width * resolution);
  2132. var height = Math.round(frame.height * resolution);
  2133. var pixels = new Uint8Array(BYTES_PER_PIXEL * width * height);
  2134. var gl = renderer.gl;
  2135. gl.readPixels(Math.round(frame.x * resolution), Math.round(frame.y * resolution), width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
  2136. if (generated) {
  2137. renderTexture.destroy(true);
  2138. }
  2139. return { pixels, width, height, flipY };
  2140. };
  2141. Extract2.prototype.destroy = function() {
  2142. this.renderer = null;
  2143. };
  2144. Extract2.arrayPostDivide = function(pixels, out) {
  2145. for (var i = 0; i < pixels.length; i += 4) {
  2146. var alpha = out[i + 3] = pixels[i + 3];
  2147. if (alpha !== 0) {
  2148. out[i] = Math.round(Math.min(pixels[i] * 255 / alpha, 255));
  2149. out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255 / alpha, 255));
  2150. out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255 / alpha, 255));
  2151. } else {
  2152. out[i] = pixels[i];
  2153. out[i + 1] = pixels[i + 1];
  2154. out[i + 2] = pixels[i + 2];
  2155. }
  2156. }
  2157. };
  2158. Extract2.extension = {
  2159. name: "extract",
  2160. type: ExtensionType.RendererPlugin
  2161. };
  2162. return Extract2;
  2163. })()
  2164. );
  2165. // node_modules/@pixi/loaders/dist/esm/loaders.mjs
  2166. var SignalBinding = (
  2167. /** @class */
  2168. (function() {
  2169. function SignalBinding2(fn, once, thisArg) {
  2170. if (once === void 0) {
  2171. once = false;
  2172. }
  2173. this._fn = fn;
  2174. this._once = once;
  2175. this._thisArg = thisArg;
  2176. this._next = this._prev = this._owner = null;
  2177. }
  2178. SignalBinding2.prototype.detach = function() {
  2179. if (this._owner === null) {
  2180. return false;
  2181. }
  2182. this._owner.detach(this);
  2183. return true;
  2184. };
  2185. return SignalBinding2;
  2186. })()
  2187. );
  2188. function _addSignalBinding(self2, node) {
  2189. if (!self2._head) {
  2190. self2._head = node;
  2191. self2._tail = node;
  2192. } else {
  2193. self2._tail._next = node;
  2194. node._prev = self2._tail;
  2195. self2._tail = node;
  2196. }
  2197. node._owner = self2;
  2198. return node;
  2199. }
  2200. var Signal = (
  2201. /** @class */
  2202. (function() {
  2203. function Signal2() {
  2204. this._head = this._tail = void 0;
  2205. }
  2206. Signal2.prototype.handlers = function(exists) {
  2207. if (exists === void 0) {
  2208. exists = false;
  2209. }
  2210. var node = this._head;
  2211. if (exists) {
  2212. return !!node;
  2213. }
  2214. var ee = [];
  2215. while (node) {
  2216. ee.push(node);
  2217. node = node._next;
  2218. }
  2219. return ee;
  2220. };
  2221. Signal2.prototype.has = function(node) {
  2222. if (!(node instanceof SignalBinding)) {
  2223. throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");
  2224. }
  2225. return node._owner === this;
  2226. };
  2227. Signal2.prototype.dispatch = function() {
  2228. var arguments$1 = arguments;
  2229. var args = [];
  2230. for (var _i = 0; _i < arguments.length; _i++) {
  2231. args[_i] = arguments$1[_i];
  2232. }
  2233. var node = this._head;
  2234. if (!node) {
  2235. return false;
  2236. }
  2237. while (node) {
  2238. if (node._once) {
  2239. this.detach(node);
  2240. }
  2241. node._fn.apply(node._thisArg, args);
  2242. node = node._next;
  2243. }
  2244. return true;
  2245. };
  2246. Signal2.prototype.add = function(fn, thisArg) {
  2247. if (thisArg === void 0) {
  2248. thisArg = null;
  2249. }
  2250. if (typeof fn !== "function") {
  2251. throw new Error("MiniSignal#add(): First arg must be a Function.");
  2252. }
  2253. return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));
  2254. };
  2255. Signal2.prototype.once = function(fn, thisArg) {
  2256. if (thisArg === void 0) {
  2257. thisArg = null;
  2258. }
  2259. if (typeof fn !== "function") {
  2260. throw new Error("MiniSignal#once(): First arg must be a Function.");
  2261. }
  2262. return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));
  2263. };
  2264. Signal2.prototype.detach = function(node) {
  2265. if (!(node instanceof SignalBinding)) {
  2266. throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");
  2267. }
  2268. if (node._owner !== this) {
  2269. return this;
  2270. }
  2271. if (node._prev) {
  2272. node._prev._next = node._next;
  2273. }
  2274. if (node._next) {
  2275. node._next._prev = node._prev;
  2276. }
  2277. if (node === this._head) {
  2278. this._head = node._next;
  2279. if (node._next === null) {
  2280. this._tail = null;
  2281. }
  2282. } else if (node === this._tail) {
  2283. this._tail = node._prev;
  2284. this._tail._next = null;
  2285. }
  2286. node._owner = null;
  2287. return this;
  2288. };
  2289. Signal2.prototype.detachAll = function() {
  2290. var node = this._head;
  2291. if (!node) {
  2292. return this;
  2293. }
  2294. this._head = this._tail = null;
  2295. while (node) {
  2296. node._owner = null;
  2297. node = node._next;
  2298. }
  2299. return this;
  2300. };
  2301. return Signal2;
  2302. })()
  2303. );
  2304. function parseUri(str, opts) {
  2305. opts = opts || {};
  2306. var o = {
  2307. // eslint-disable-next-line max-len
  2308. key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"],
  2309. q: {
  2310. name: "queryKey",
  2311. parser: /(?:^|&)([^&=]*)=?([^&]*)/g
  2312. },
  2313. parser: {
  2314. // eslint-disable-next-line max-len
  2315. strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
  2316. // eslint-disable-next-line max-len
  2317. loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
  2318. }
  2319. };
  2320. var m = o.parser[opts.strictMode ? "strict" : "loose"].exec(str);
  2321. var uri = {};
  2322. var i = 14;
  2323. while (i--) {
  2324. uri[o.key[i]] = m[i] || "";
  2325. }
  2326. uri[o.q.name] = {};
  2327. uri[o.key[12]].replace(o.q.parser, function(_t0, t1, t2) {
  2328. if (t1) {
  2329. uri[o.q.name][t1] = t2;
  2330. }
  2331. });
  2332. return uri;
  2333. }
  2334. var useXdr;
  2335. var tempAnchor = null;
  2336. var STATUS_NONE = 0;
  2337. var STATUS_OK = 200;
  2338. var STATUS_EMPTY = 204;
  2339. var STATUS_IE_BUG_EMPTY = 1223;
  2340. var STATUS_TYPE_OK = 2;
  2341. function _noop$1() {
  2342. }
  2343. function setExtMap(map, extname, val) {
  2344. if (extname && extname.indexOf(".") === 0) {
  2345. extname = extname.substring(1);
  2346. }
  2347. if (!extname) {
  2348. return;
  2349. }
  2350. map[extname] = val;
  2351. }
  2352. function reqType(xhr) {
  2353. return xhr.toString().replace("object ", "");
  2354. }
  2355. var LoaderResource = (
  2356. /** @class */
  2357. (function() {
  2358. function LoaderResource2(name, url2, options) {
  2359. this._dequeue = _noop$1;
  2360. this._onLoadBinding = null;
  2361. this._elementTimer = 0;
  2362. this._boundComplete = null;
  2363. this._boundOnError = null;
  2364. this._boundOnProgress = null;
  2365. this._boundOnTimeout = null;
  2366. this._boundXhrOnError = null;
  2367. this._boundXhrOnTimeout = null;
  2368. this._boundXhrOnAbort = null;
  2369. this._boundXhrOnLoad = null;
  2370. if (typeof name !== "string" || typeof url2 !== "string") {
  2371. throw new Error("Both name and url are required for constructing a resource.");
  2372. }
  2373. options = options || {};
  2374. this._flags = 0;
  2375. this._setFlag(LoaderResource2.STATUS_FLAGS.DATA_URL, url2.indexOf("data:") === 0);
  2376. this.name = name;
  2377. this.url = url2;
  2378. this.extension = this._getExtension();
  2379. this.data = null;
  2380. this.crossOrigin = options.crossOrigin === true ? "anonymous" : options.crossOrigin;
  2381. this.timeout = options.timeout || 0;
  2382. this.loadType = options.loadType || this._determineLoadType();
  2383. this.xhrType = options.xhrType;
  2384. this.metadata = options.metadata || {};
  2385. this.error = null;
  2386. this.xhr = null;
  2387. this.children = [];
  2388. this.type = LoaderResource2.TYPE.UNKNOWN;
  2389. this.progressChunk = 0;
  2390. this._dequeue = _noop$1;
  2391. this._onLoadBinding = null;
  2392. this._elementTimer = 0;
  2393. this._boundComplete = this.complete.bind(this);
  2394. this._boundOnError = this._onError.bind(this);
  2395. this._boundOnProgress = this._onProgress.bind(this);
  2396. this._boundOnTimeout = this._onTimeout.bind(this);
  2397. this._boundXhrOnError = this._xhrOnError.bind(this);
  2398. this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);
  2399. this._boundXhrOnAbort = this._xhrOnAbort.bind(this);
  2400. this._boundXhrOnLoad = this._xhrOnLoad.bind(this);
  2401. this.onStart = new Signal();
  2402. this.onProgress = new Signal();
  2403. this.onComplete = new Signal();
  2404. this.onAfterMiddleware = new Signal();
  2405. }
  2406. LoaderResource2.setExtensionLoadType = function(extname, loadType) {
  2407. setExtMap(LoaderResource2._loadTypeMap, extname, loadType);
  2408. };
  2409. LoaderResource2.setExtensionXhrType = function(extname, xhrType) {
  2410. setExtMap(LoaderResource2._xhrTypeMap, extname, xhrType);
  2411. };
  2412. Object.defineProperty(LoaderResource2.prototype, "isDataUrl", {
  2413. /**
  2414. * When the resource starts to load.
  2415. * @memberof PIXI.LoaderResource
  2416. * @callback OnStartSignal
  2417. * @param {PIXI.Resource} resource - The resource that the event happened on.
  2418. */
  2419. /**
  2420. * When the resource reports loading progress.
  2421. * @memberof PIXI.LoaderResource
  2422. * @callback OnProgressSignal
  2423. * @param {PIXI.Resource} resource - The resource that the event happened on.
  2424. * @param {number} percentage - The progress of the load in the range [0, 1].
  2425. */
  2426. /**
  2427. * When the resource finishes loading.
  2428. * @memberof PIXI.LoaderResource
  2429. * @callback OnCompleteSignal
  2430. * @param {PIXI.Resource} resource - The resource that the event happened on.
  2431. */
  2432. /**
  2433. * @memberof PIXI.LoaderResource
  2434. * @typedef {object} IMetadata
  2435. * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The
  2436. * element to use for loading, instead of creating one.
  2437. * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This
  2438. * is useful if you want to pass in a `loadElement` that you already added load sources to.
  2439. * @property {string|string[]} [mimeType] - The mime type to use for the source element
  2440. * of a video/audio elment. If the urls are an array, you can pass this as an array as well
  2441. * where each index is the mime type to use for the corresponding url index.
  2442. */
  2443. /**
  2444. * Stores whether or not this url is a data url.
  2445. * @readonly
  2446. * @member {boolean}
  2447. */
  2448. get: function() {
  2449. return this._hasFlag(LoaderResource2.STATUS_FLAGS.DATA_URL);
  2450. },
  2451. enumerable: false,
  2452. configurable: true
  2453. });
  2454. Object.defineProperty(LoaderResource2.prototype, "isComplete", {
  2455. /**
  2456. * Describes if this resource has finished loading. Is true when the resource has completely
  2457. * loaded.
  2458. * @readonly
  2459. * @member {boolean}
  2460. */
  2461. get: function() {
  2462. return this._hasFlag(LoaderResource2.STATUS_FLAGS.COMPLETE);
  2463. },
  2464. enumerable: false,
  2465. configurable: true
  2466. });
  2467. Object.defineProperty(LoaderResource2.prototype, "isLoading", {
  2468. /**
  2469. * Describes if this resource is currently loading. Is true when the resource starts loading,
  2470. * and is false again when complete.
  2471. * @readonly
  2472. * @member {boolean}
  2473. */
  2474. get: function() {
  2475. return this._hasFlag(LoaderResource2.STATUS_FLAGS.LOADING);
  2476. },
  2477. enumerable: false,
  2478. configurable: true
  2479. });
  2480. LoaderResource2.prototype.complete = function() {
  2481. this._clearEvents();
  2482. this._finish();
  2483. };
  2484. LoaderResource2.prototype.abort = function(message) {
  2485. if (this.error) {
  2486. return;
  2487. }
  2488. this.error = new Error(message);
  2489. this._clearEvents();
  2490. if (this.xhr) {
  2491. this.xhr.abort();
  2492. } else if (this.xdr) {
  2493. this.xdr.abort();
  2494. } else if (this.data) {
  2495. if (this.data.src) {
  2496. this.data.src = LoaderResource2.EMPTY_GIF;
  2497. } else {
  2498. while (this.data.firstChild) {
  2499. this.data.removeChild(this.data.firstChild);
  2500. }
  2501. }
  2502. }
  2503. this._finish();
  2504. };
  2505. LoaderResource2.prototype.load = function(cb) {
  2506. var _this = this;
  2507. if (this.isLoading) {
  2508. return;
  2509. }
  2510. if (this.isComplete) {
  2511. if (cb) {
  2512. setTimeout(function() {
  2513. return cb(_this);
  2514. }, 1);
  2515. }
  2516. return;
  2517. } else if (cb) {
  2518. this.onComplete.once(cb);
  2519. }
  2520. this._setFlag(LoaderResource2.STATUS_FLAGS.LOADING, true);
  2521. this.onStart.dispatch(this);
  2522. if (this.crossOrigin === false || typeof this.crossOrigin !== "string") {
  2523. this.crossOrigin = this._determineCrossOrigin(this.url);
  2524. }
  2525. switch (this.loadType) {
  2526. case LoaderResource2.LOAD_TYPE.IMAGE:
  2527. this.type = LoaderResource2.TYPE.IMAGE;
  2528. this._loadElement("image");
  2529. break;
  2530. case LoaderResource2.LOAD_TYPE.AUDIO:
  2531. this.type = LoaderResource2.TYPE.AUDIO;
  2532. this._loadSourceElement("audio");
  2533. break;
  2534. case LoaderResource2.LOAD_TYPE.VIDEO:
  2535. this.type = LoaderResource2.TYPE.VIDEO;
  2536. this._loadSourceElement("video");
  2537. break;
  2538. case LoaderResource2.LOAD_TYPE.XHR:
  2539. /* falls through */
  2540. default:
  2541. if (typeof useXdr === "undefined") {
  2542. useXdr = !!(globalThis.XDomainRequest && !("withCredentials" in new XMLHttpRequest()));
  2543. }
  2544. if (useXdr && this.crossOrigin) {
  2545. this._loadXdr();
  2546. } else {
  2547. this._loadXhr();
  2548. }
  2549. break;
  2550. }
  2551. };
  2552. LoaderResource2.prototype._hasFlag = function(flag) {
  2553. return (this._flags & flag) !== 0;
  2554. };
  2555. LoaderResource2.prototype._setFlag = function(flag, value) {
  2556. this._flags = value ? this._flags | flag : this._flags & ~flag;
  2557. };
  2558. LoaderResource2.prototype._clearEvents = function() {
  2559. clearTimeout(this._elementTimer);
  2560. if (this.data && this.data.removeEventListener) {
  2561. this.data.removeEventListener("error", this._boundOnError, false);
  2562. this.data.removeEventListener("load", this._boundComplete, false);
  2563. this.data.removeEventListener("progress", this._boundOnProgress, false);
  2564. this.data.removeEventListener("canplaythrough", this._boundComplete, false);
  2565. }
  2566. if (this.xhr) {
  2567. if (this.xhr.removeEventListener) {
  2568. this.xhr.removeEventListener("error", this._boundXhrOnError, false);
  2569. this.xhr.removeEventListener("timeout", this._boundXhrOnTimeout, false);
  2570. this.xhr.removeEventListener("abort", this._boundXhrOnAbort, false);
  2571. this.xhr.removeEventListener("progress", this._boundOnProgress, false);
  2572. this.xhr.removeEventListener("load", this._boundXhrOnLoad, false);
  2573. } else {
  2574. this.xhr.onerror = null;
  2575. this.xhr.ontimeout = null;
  2576. this.xhr.onprogress = null;
  2577. this.xhr.onload = null;
  2578. }
  2579. }
  2580. };
  2581. LoaderResource2.prototype._finish = function() {
  2582. if (this.isComplete) {
  2583. throw new Error("Complete called again for an already completed resource.");
  2584. }
  2585. this._setFlag(LoaderResource2.STATUS_FLAGS.COMPLETE, true);
  2586. this._setFlag(LoaderResource2.STATUS_FLAGS.LOADING, false);
  2587. this.onComplete.dispatch(this);
  2588. };
  2589. LoaderResource2.prototype._loadElement = function(type) {
  2590. if (this.metadata.loadElement) {
  2591. this.data = this.metadata.loadElement;
  2592. } else if (type === "image" && typeof globalThis.Image !== "undefined") {
  2593. this.data = new Image();
  2594. } else {
  2595. this.data = document.createElement(type);
  2596. }
  2597. if (this.crossOrigin) {
  2598. this.data.crossOrigin = this.crossOrigin;
  2599. }
  2600. if (!this.metadata.skipSource) {
  2601. this.data.src = this.url;
  2602. }
  2603. this.data.addEventListener("error", this._boundOnError, false);
  2604. this.data.addEventListener("load", this._boundComplete, false);
  2605. this.data.addEventListener("progress", this._boundOnProgress, false);
  2606. if (this.timeout) {
  2607. this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);
  2608. }
  2609. };
  2610. LoaderResource2.prototype._loadSourceElement = function(type) {
  2611. if (this.metadata.loadElement) {
  2612. this.data = this.metadata.loadElement;
  2613. } else if (type === "audio" && typeof globalThis.Audio !== "undefined") {
  2614. this.data = new Audio();
  2615. } else {
  2616. this.data = document.createElement(type);
  2617. }
  2618. if (this.data === null) {
  2619. this.abort("Unsupported element: " + type);
  2620. return;
  2621. }
  2622. if (this.crossOrigin) {
  2623. this.data.crossOrigin = this.crossOrigin;
  2624. }
  2625. if (!this.metadata.skipSource) {
  2626. if (navigator.isCocoonJS) {
  2627. this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;
  2628. } else if (Array.isArray(this.url)) {
  2629. var mimeTypes = this.metadata.mimeType;
  2630. for (var i = 0; i < this.url.length; ++i) {
  2631. this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes));
  2632. }
  2633. } else {
  2634. var mimeTypes = this.metadata.mimeType;
  2635. this.data.appendChild(this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes));
  2636. }
  2637. }
  2638. this.data.addEventListener("error", this._boundOnError, false);
  2639. this.data.addEventListener("load", this._boundComplete, false);
  2640. this.data.addEventListener("progress", this._boundOnProgress, false);
  2641. this.data.addEventListener("canplaythrough", this._boundComplete, false);
  2642. this.data.load();
  2643. if (this.timeout) {
  2644. this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);
  2645. }
  2646. };
  2647. LoaderResource2.prototype._loadXhr = function() {
  2648. if (typeof this.xhrType !== "string") {
  2649. this.xhrType = this._determineXhrType();
  2650. }
  2651. var xhr = this.xhr = new XMLHttpRequest();
  2652. if (this.crossOrigin === "use-credentials") {
  2653. xhr.withCredentials = true;
  2654. }
  2655. xhr.open("GET", this.url, true);
  2656. xhr.timeout = this.timeout;
  2657. if (this.xhrType === LoaderResource2.XHR_RESPONSE_TYPE.JSON || this.xhrType === LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT) {
  2658. xhr.responseType = LoaderResource2.XHR_RESPONSE_TYPE.TEXT;
  2659. } else {
  2660. xhr.responseType = this.xhrType;
  2661. }
  2662. xhr.addEventListener("error", this._boundXhrOnError, false);
  2663. xhr.addEventListener("timeout", this._boundXhrOnTimeout, false);
  2664. xhr.addEventListener("abort", this._boundXhrOnAbort, false);
  2665. xhr.addEventListener("progress", this._boundOnProgress, false);
  2666. xhr.addEventListener("load", this._boundXhrOnLoad, false);
  2667. xhr.send();
  2668. };
  2669. LoaderResource2.prototype._loadXdr = function() {
  2670. if (typeof this.xhrType !== "string") {
  2671. this.xhrType = this._determineXhrType();
  2672. }
  2673. var xdr = this.xhr = new globalThis.XDomainRequest();
  2674. xdr.timeout = this.timeout || 5e3;
  2675. xdr.onerror = this._boundXhrOnError;
  2676. xdr.ontimeout = this._boundXhrOnTimeout;
  2677. xdr.onprogress = this._boundOnProgress;
  2678. xdr.onload = this._boundXhrOnLoad;
  2679. xdr.open("GET", this.url, true);
  2680. setTimeout(function() {
  2681. return xdr.send();
  2682. }, 1);
  2683. };
  2684. LoaderResource2.prototype._createSource = function(type, url2, mime) {
  2685. if (!mime) {
  2686. mime = type + "/" + this._getExtension(url2);
  2687. }
  2688. var source = document.createElement("source");
  2689. source.src = url2;
  2690. source.type = mime;
  2691. return source;
  2692. };
  2693. LoaderResource2.prototype._onError = function(event) {
  2694. this.abort("Failed to load element using: " + event.target.nodeName);
  2695. };
  2696. LoaderResource2.prototype._onProgress = function(event) {
  2697. if (event && event.lengthComputable) {
  2698. this.onProgress.dispatch(this, event.loaded / event.total);
  2699. }
  2700. };
  2701. LoaderResource2.prototype._onTimeout = function() {
  2702. this.abort("Load timed out.");
  2703. };
  2704. LoaderResource2.prototype._xhrOnError = function() {
  2705. var xhr = this.xhr;
  2706. this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ', text: "' + xhr.statusText + '"');
  2707. };
  2708. LoaderResource2.prototype._xhrOnTimeout = function() {
  2709. var xhr = this.xhr;
  2710. this.abort(reqType(xhr) + " Request timed out.");
  2711. };
  2712. LoaderResource2.prototype._xhrOnAbort = function() {
  2713. var xhr = this.xhr;
  2714. this.abort(reqType(xhr) + " Request was aborted by the user.");
  2715. };
  2716. LoaderResource2.prototype._xhrOnLoad = function() {
  2717. var xhr = this.xhr;
  2718. var text = "";
  2719. var status = typeof xhr.status === "undefined" ? STATUS_OK : xhr.status;
  2720. if (xhr.responseType === "" || xhr.responseType === "text" || typeof xhr.responseType === "undefined") {
  2721. text = xhr.responseText;
  2722. }
  2723. if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource2.XHR_RESPONSE_TYPE.BUFFER)) {
  2724. status = STATUS_OK;
  2725. } else if (status === STATUS_IE_BUG_EMPTY) {
  2726. status = STATUS_EMPTY;
  2727. }
  2728. var statusType = status / 100 | 0;
  2729. if (statusType === STATUS_TYPE_OK) {
  2730. if (this.xhrType === LoaderResource2.XHR_RESPONSE_TYPE.TEXT) {
  2731. this.data = text;
  2732. this.type = LoaderResource2.TYPE.TEXT;
  2733. } else if (this.xhrType === LoaderResource2.XHR_RESPONSE_TYPE.JSON) {
  2734. try {
  2735. this.data = JSON.parse(text);
  2736. this.type = LoaderResource2.TYPE.JSON;
  2737. } catch (e) {
  2738. this.abort("Error trying to parse loaded json: " + e);
  2739. return;
  2740. }
  2741. } else if (this.xhrType === LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT) {
  2742. try {
  2743. if (globalThis.DOMParser) {
  2744. var domparser = new DOMParser();
  2745. this.data = domparser.parseFromString(text, "text/xml");
  2746. } else {
  2747. var div = document.createElement("div");
  2748. div.innerHTML = text;
  2749. this.data = div;
  2750. }
  2751. this.type = LoaderResource2.TYPE.XML;
  2752. } catch (e$1) {
  2753. this.abort("Error trying to parse loaded xml: " + e$1);
  2754. return;
  2755. }
  2756. } else {
  2757. this.data = xhr.response || text;
  2758. }
  2759. } else {
  2760. this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL);
  2761. return;
  2762. }
  2763. this.complete();
  2764. };
  2765. LoaderResource2.prototype._determineCrossOrigin = function(url2, loc) {
  2766. if (url2.indexOf("data:") === 0) {
  2767. return "";
  2768. }
  2769. if (globalThis.origin !== globalThis.location.origin) {
  2770. return "anonymous";
  2771. }
  2772. loc = loc || globalThis.location;
  2773. if (!tempAnchor) {
  2774. tempAnchor = document.createElement("a");
  2775. }
  2776. tempAnchor.href = url2;
  2777. var parsedUrl = parseUri(tempAnchor.href, { strictMode: true });
  2778. var samePort = !parsedUrl.port && loc.port === "" || parsedUrl.port === loc.port;
  2779. var protocol = parsedUrl.protocol ? parsedUrl.protocol + ":" : "";
  2780. if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol) {
  2781. return "anonymous";
  2782. }
  2783. return "";
  2784. };
  2785. LoaderResource2.prototype._determineXhrType = function() {
  2786. return LoaderResource2._xhrTypeMap[this.extension] || LoaderResource2.XHR_RESPONSE_TYPE.TEXT;
  2787. };
  2788. LoaderResource2.prototype._determineLoadType = function() {
  2789. return LoaderResource2._loadTypeMap[this.extension] || LoaderResource2.LOAD_TYPE.XHR;
  2790. };
  2791. LoaderResource2.prototype._getExtension = function(url2) {
  2792. if (url2 === void 0) {
  2793. url2 = this.url;
  2794. }
  2795. var ext = "";
  2796. if (this.isDataUrl) {
  2797. var slashIndex = url2.indexOf("/");
  2798. ext = url2.substring(slashIndex + 1, url2.indexOf(";", slashIndex));
  2799. } else {
  2800. var queryStart = url2.indexOf("?");
  2801. var hashStart = url2.indexOf("#");
  2802. var index = Math.min(queryStart > -1 ? queryStart : url2.length, hashStart > -1 ? hashStart : url2.length);
  2803. url2 = url2.substring(0, index);
  2804. ext = url2.substring(url2.lastIndexOf(".") + 1);
  2805. }
  2806. return ext.toLowerCase();
  2807. };
  2808. LoaderResource2.prototype._getMimeFromXhrType = function(type) {
  2809. switch (type) {
  2810. case LoaderResource2.XHR_RESPONSE_TYPE.BUFFER:
  2811. return "application/octet-binary";
  2812. case LoaderResource2.XHR_RESPONSE_TYPE.BLOB:
  2813. return "application/blob";
  2814. case LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT:
  2815. return "application/xml";
  2816. case LoaderResource2.XHR_RESPONSE_TYPE.JSON:
  2817. return "application/json";
  2818. case LoaderResource2.XHR_RESPONSE_TYPE.DEFAULT:
  2819. case LoaderResource2.XHR_RESPONSE_TYPE.TEXT:
  2820. /* falls through */
  2821. default:
  2822. return "text/plain";
  2823. }
  2824. };
  2825. return LoaderResource2;
  2826. })()
  2827. );
  2828. (function(LoaderResource2) {
  2829. (function(STATUS_FLAGS) {
  2830. STATUS_FLAGS[STATUS_FLAGS["NONE"] = 0] = "NONE";
  2831. STATUS_FLAGS[STATUS_FLAGS["DATA_URL"] = 1] = "DATA_URL";
  2832. STATUS_FLAGS[STATUS_FLAGS["COMPLETE"] = 2] = "COMPLETE";
  2833. STATUS_FLAGS[STATUS_FLAGS["LOADING"] = 4] = "LOADING";
  2834. })(LoaderResource2.STATUS_FLAGS || (LoaderResource2.STATUS_FLAGS = {}));
  2835. (function(TYPE) {
  2836. TYPE[TYPE["UNKNOWN"] = 0] = "UNKNOWN";
  2837. TYPE[TYPE["JSON"] = 1] = "JSON";
  2838. TYPE[TYPE["XML"] = 2] = "XML";
  2839. TYPE[TYPE["IMAGE"] = 3] = "IMAGE";
  2840. TYPE[TYPE["AUDIO"] = 4] = "AUDIO";
  2841. TYPE[TYPE["VIDEO"] = 5] = "VIDEO";
  2842. TYPE[TYPE["TEXT"] = 6] = "TEXT";
  2843. })(LoaderResource2.TYPE || (LoaderResource2.TYPE = {}));
  2844. (function(LOAD_TYPE) {
  2845. LOAD_TYPE[LOAD_TYPE["XHR"] = 1] = "XHR";
  2846. LOAD_TYPE[LOAD_TYPE["IMAGE"] = 2] = "IMAGE";
  2847. LOAD_TYPE[LOAD_TYPE["AUDIO"] = 3] = "AUDIO";
  2848. LOAD_TYPE[LOAD_TYPE["VIDEO"] = 4] = "VIDEO";
  2849. })(LoaderResource2.LOAD_TYPE || (LoaderResource2.LOAD_TYPE = {}));
  2850. (function(XHR_RESPONSE_TYPE) {
  2851. XHR_RESPONSE_TYPE["DEFAULT"] = "text";
  2852. XHR_RESPONSE_TYPE["BUFFER"] = "arraybuffer";
  2853. XHR_RESPONSE_TYPE["BLOB"] = "blob";
  2854. XHR_RESPONSE_TYPE["DOCUMENT"] = "document";
  2855. XHR_RESPONSE_TYPE["JSON"] = "json";
  2856. XHR_RESPONSE_TYPE["TEXT"] = "text";
  2857. })(LoaderResource2.XHR_RESPONSE_TYPE || (LoaderResource2.XHR_RESPONSE_TYPE = {}));
  2858. LoaderResource2._loadTypeMap = {
  2859. // images
  2860. gif: LoaderResource2.LOAD_TYPE.IMAGE,
  2861. png: LoaderResource2.LOAD_TYPE.IMAGE,
  2862. bmp: LoaderResource2.LOAD_TYPE.IMAGE,
  2863. jpg: LoaderResource2.LOAD_TYPE.IMAGE,
  2864. jpeg: LoaderResource2.LOAD_TYPE.IMAGE,
  2865. tif: LoaderResource2.LOAD_TYPE.IMAGE,
  2866. tiff: LoaderResource2.LOAD_TYPE.IMAGE,
  2867. webp: LoaderResource2.LOAD_TYPE.IMAGE,
  2868. tga: LoaderResource2.LOAD_TYPE.IMAGE,
  2869. avif: LoaderResource2.LOAD_TYPE.IMAGE,
  2870. svg: LoaderResource2.LOAD_TYPE.IMAGE,
  2871. "svg+xml": LoaderResource2.LOAD_TYPE.IMAGE,
  2872. // audio
  2873. mp3: LoaderResource2.LOAD_TYPE.AUDIO,
  2874. ogg: LoaderResource2.LOAD_TYPE.AUDIO,
  2875. wav: LoaderResource2.LOAD_TYPE.AUDIO,
  2876. // videos
  2877. mp4: LoaderResource2.LOAD_TYPE.VIDEO,
  2878. webm: LoaderResource2.LOAD_TYPE.VIDEO
  2879. };
  2880. LoaderResource2._xhrTypeMap = {
  2881. // xml
  2882. xhtml: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2883. html: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2884. htm: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2885. xml: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2886. tmx: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2887. svg: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2888. // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.
  2889. // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,
  2890. // this should probably be fine.
  2891. tsx: LoaderResource2.XHR_RESPONSE_TYPE.DOCUMENT,
  2892. // images
  2893. gif: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2894. png: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2895. bmp: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2896. jpg: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2897. jpeg: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2898. tif: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2899. tiff: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2900. webp: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2901. tga: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2902. avif: LoaderResource2.XHR_RESPONSE_TYPE.BLOB,
  2903. // json
  2904. json: LoaderResource2.XHR_RESPONSE_TYPE.JSON,
  2905. // text
  2906. text: LoaderResource2.XHR_RESPONSE_TYPE.TEXT,
  2907. txt: LoaderResource2.XHR_RESPONSE_TYPE.TEXT,
  2908. // fonts
  2909. ttf: LoaderResource2.XHR_RESPONSE_TYPE.BUFFER,
  2910. otf: LoaderResource2.XHR_RESPONSE_TYPE.BUFFER
  2911. };
  2912. LoaderResource2.EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
  2913. })(LoaderResource || (LoaderResource = {}));
  2914. function _noop() {
  2915. }
  2916. function onlyOnce(fn) {
  2917. return function onceWrapper() {
  2918. var arguments$1 = arguments;
  2919. var args = [];
  2920. for (var _i = 0; _i < arguments.length; _i++) {
  2921. args[_i] = arguments$1[_i];
  2922. }
  2923. if (fn === null) {
  2924. throw new Error("Callback was already called.");
  2925. }
  2926. var callFn = fn;
  2927. fn = null;
  2928. callFn.apply(this, args);
  2929. };
  2930. }
  2931. var AsyncQueueItem = (
  2932. /** @class */
  2933. /* @__PURE__ */ (function() {
  2934. function AsyncQueueItem2(data, callback) {
  2935. this.data = data;
  2936. this.callback = callback;
  2937. }
  2938. return AsyncQueueItem2;
  2939. })()
  2940. );
  2941. var AsyncQueue = (
  2942. /** @class */
  2943. (function() {
  2944. function AsyncQueue2(worker, concurrency) {
  2945. var _this = this;
  2946. if (concurrency === void 0) {
  2947. concurrency = 1;
  2948. }
  2949. this.workers = 0;
  2950. this.saturated = _noop;
  2951. this.unsaturated = _noop;
  2952. this.empty = _noop;
  2953. this.drain = _noop;
  2954. this.error = _noop;
  2955. this.started = false;
  2956. this.paused = false;
  2957. this._tasks = [];
  2958. this._insert = function(data, insertAtFront, callback) {
  2959. if (callback && typeof callback !== "function") {
  2960. throw new Error("task callback must be a function");
  2961. }
  2962. _this.started = true;
  2963. if (data == null && _this.idle()) {
  2964. setTimeout(function() {
  2965. return _this.drain();
  2966. }, 1);
  2967. return;
  2968. }
  2969. var item = new AsyncQueueItem(data, typeof callback === "function" ? callback : _noop);
  2970. if (insertAtFront) {
  2971. _this._tasks.unshift(item);
  2972. } else {
  2973. _this._tasks.push(item);
  2974. }
  2975. setTimeout(_this.process, 1);
  2976. };
  2977. this.process = function() {
  2978. while (!_this.paused && _this.workers < _this.concurrency && _this._tasks.length) {
  2979. var task = _this._tasks.shift();
  2980. if (_this._tasks.length === 0) {
  2981. _this.empty();
  2982. }
  2983. _this.workers += 1;
  2984. if (_this.workers === _this.concurrency) {
  2985. _this.saturated();
  2986. }
  2987. _this._worker(task.data, onlyOnce(_this._next(task)));
  2988. }
  2989. };
  2990. this._worker = worker;
  2991. if (concurrency === 0) {
  2992. throw new Error("Concurrency must not be zero");
  2993. }
  2994. this.concurrency = concurrency;
  2995. this.buffer = concurrency / 4;
  2996. }
  2997. AsyncQueue2.prototype._next = function(task) {
  2998. var _this = this;
  2999. return function() {
  3000. var arguments$1 = arguments;
  3001. var args = [];
  3002. for (var _i = 0; _i < arguments.length; _i++) {
  3003. args[_i] = arguments$1[_i];
  3004. }
  3005. _this.workers -= 1;
  3006. task.callback.apply(task, args);
  3007. if (args[0] != null) {
  3008. _this.error(args[0], task.data);
  3009. }
  3010. if (_this.workers <= _this.concurrency - _this.buffer) {
  3011. _this.unsaturated();
  3012. }
  3013. if (_this.idle()) {
  3014. _this.drain();
  3015. }
  3016. _this.process();
  3017. };
  3018. };
  3019. AsyncQueue2.prototype.push = function(data, callback) {
  3020. this._insert(data, false, callback);
  3021. };
  3022. AsyncQueue2.prototype.kill = function() {
  3023. this.workers = 0;
  3024. this.drain = _noop;
  3025. this.started = false;
  3026. this._tasks = [];
  3027. };
  3028. AsyncQueue2.prototype.unshift = function(data, callback) {
  3029. this._insert(data, true, callback);
  3030. };
  3031. AsyncQueue2.prototype.length = function() {
  3032. return this._tasks.length;
  3033. };
  3034. AsyncQueue2.prototype.running = function() {
  3035. return this.workers;
  3036. };
  3037. AsyncQueue2.prototype.idle = function() {
  3038. return this._tasks.length + this.workers === 0;
  3039. };
  3040. AsyncQueue2.prototype.pause = function() {
  3041. if (this.paused === true) {
  3042. return;
  3043. }
  3044. this.paused = true;
  3045. };
  3046. AsyncQueue2.prototype.resume = function() {
  3047. if (this.paused === false) {
  3048. return;
  3049. }
  3050. this.paused = false;
  3051. for (var w = 1; w <= this.concurrency; w++) {
  3052. this.process();
  3053. }
  3054. };
  3055. AsyncQueue2.eachSeries = function(array, iterator, callback, deferNext) {
  3056. var i = 0;
  3057. var len = array.length;
  3058. function next(err) {
  3059. if (err || i === len) {
  3060. if (callback) {
  3061. callback(err);
  3062. }
  3063. return;
  3064. }
  3065. if (deferNext) {
  3066. setTimeout(function() {
  3067. iterator(array[i++], next);
  3068. }, 1);
  3069. } else {
  3070. iterator(array[i++], next);
  3071. }
  3072. }
  3073. next();
  3074. };
  3075. AsyncQueue2.queue = function(worker, concurrency) {
  3076. return new AsyncQueue2(worker, concurrency);
  3077. };
  3078. return AsyncQueue2;
  3079. })()
  3080. );
  3081. var MAX_PROGRESS = 100;
  3082. var rgxExtractUrlHash = /(#[\w-]+)?$/;
  3083. var Loader = (
  3084. /** @class */
  3085. (function() {
  3086. function Loader2(baseUrl, concurrency) {
  3087. var _this = this;
  3088. if (baseUrl === void 0) {
  3089. baseUrl = "";
  3090. }
  3091. if (concurrency === void 0) {
  3092. concurrency = 10;
  3093. }
  3094. this.progress = 0;
  3095. this.loading = false;
  3096. this.defaultQueryString = "";
  3097. this._beforeMiddleware = [];
  3098. this._afterMiddleware = [];
  3099. this._resourcesParsing = [];
  3100. this._boundLoadResource = function(r, d) {
  3101. return _this._loadResource(r, d);
  3102. };
  3103. this.resources = {};
  3104. this.baseUrl = baseUrl;
  3105. this._beforeMiddleware = [];
  3106. this._afterMiddleware = [];
  3107. this._resourcesParsing = [];
  3108. this._boundLoadResource = function(r, d) {
  3109. return _this._loadResource(r, d);
  3110. };
  3111. this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);
  3112. this._queue.pause();
  3113. this.resources = {};
  3114. this.onProgress = new Signal();
  3115. this.onError = new Signal();
  3116. this.onLoad = new Signal();
  3117. this.onStart = new Signal();
  3118. this.onComplete = new Signal();
  3119. for (var i = 0; i < Loader2._plugins.length; ++i) {
  3120. var plugin = Loader2._plugins[i];
  3121. var pre = plugin.pre, use = plugin.use;
  3122. if (pre) {
  3123. this.pre(pre);
  3124. }
  3125. if (use) {
  3126. this.use(use);
  3127. }
  3128. }
  3129. this._protected = false;
  3130. }
  3131. Loader2.prototype._add = function(name, url2, options, callback) {
  3132. if (this.loading && (!options || !options.parentResource)) {
  3133. throw new Error("Cannot add resources while the loader is running.");
  3134. }
  3135. if (this.resources[name]) {
  3136. throw new Error('Resource named "' + name + '" already exists.');
  3137. }
  3138. url2 = this._prepareUrl(url2);
  3139. this.resources[name] = new LoaderResource(name, url2, options);
  3140. if (typeof callback === "function") {
  3141. this.resources[name].onAfterMiddleware.once(callback);
  3142. }
  3143. if (this.loading) {
  3144. var parent = options.parentResource;
  3145. var incompleteChildren = [];
  3146. for (var i = 0; i < parent.children.length; ++i) {
  3147. if (!parent.children[i].isComplete) {
  3148. incompleteChildren.push(parent.children[i]);
  3149. }
  3150. }
  3151. var fullChunk = parent.progressChunk * (incompleteChildren.length + 1);
  3152. var eachChunk = fullChunk / (incompleteChildren.length + 2);
  3153. parent.children.push(this.resources[name]);
  3154. parent.progressChunk = eachChunk;
  3155. for (var i = 0; i < incompleteChildren.length; ++i) {
  3156. incompleteChildren[i].progressChunk = eachChunk;
  3157. }
  3158. this.resources[name].progressChunk = eachChunk;
  3159. }
  3160. this._queue.push(this.resources[name]);
  3161. return this;
  3162. };
  3163. Loader2.prototype.pre = function(fn) {
  3164. this._beforeMiddleware.push(fn);
  3165. return this;
  3166. };
  3167. Loader2.prototype.use = function(fn) {
  3168. this._afterMiddleware.push(fn);
  3169. return this;
  3170. };
  3171. Loader2.prototype.reset = function() {
  3172. this.progress = 0;
  3173. this.loading = false;
  3174. this._queue.kill();
  3175. this._queue.pause();
  3176. for (var k in this.resources) {
  3177. var res = this.resources[k];
  3178. if (res._onLoadBinding) {
  3179. res._onLoadBinding.detach();
  3180. }
  3181. if (res.isLoading) {
  3182. res.abort("loader reset");
  3183. }
  3184. }
  3185. this.resources = {};
  3186. return this;
  3187. };
  3188. Loader2.prototype.load = function(cb) {
  3189. deprecation("6.5.0", "@pixi/loaders is being replaced with @pixi/assets in the next major release.");
  3190. if (typeof cb === "function") {
  3191. this.onComplete.once(cb);
  3192. }
  3193. if (this.loading) {
  3194. return this;
  3195. }
  3196. if (this._queue.idle()) {
  3197. this._onStart();
  3198. this._onComplete();
  3199. } else {
  3200. var numTasks = this._queue._tasks.length;
  3201. var chunk = MAX_PROGRESS / numTasks;
  3202. for (var i = 0; i < this._queue._tasks.length; ++i) {
  3203. this._queue._tasks[i].data.progressChunk = chunk;
  3204. }
  3205. this._onStart();
  3206. this._queue.resume();
  3207. }
  3208. return this;
  3209. };
  3210. Object.defineProperty(Loader2.prototype, "concurrency", {
  3211. /**
  3212. * The number of resources to load concurrently.
  3213. * @default 10
  3214. */
  3215. get: function() {
  3216. return this._queue.concurrency;
  3217. },
  3218. set: function(concurrency) {
  3219. this._queue.concurrency = concurrency;
  3220. },
  3221. enumerable: false,
  3222. configurable: true
  3223. });
  3224. Loader2.prototype._prepareUrl = function(url2) {
  3225. var parsedUrl = parseUri(url2, { strictMode: true });
  3226. var result;
  3227. if (parsedUrl.protocol || !parsedUrl.path || url2.indexOf("//") === 0) {
  3228. result = url2;
  3229. } else if (this.baseUrl.length && this.baseUrl.lastIndexOf("/") !== this.baseUrl.length - 1 && url2.charAt(0) !== "/") {
  3230. result = this.baseUrl + "/" + url2;
  3231. } else {
  3232. result = this.baseUrl + url2;
  3233. }
  3234. if (this.defaultQueryString) {
  3235. var hash = rgxExtractUrlHash.exec(result)[0];
  3236. result = result.slice(0, result.length - hash.length);
  3237. if (result.indexOf("?") !== -1) {
  3238. result += "&" + this.defaultQueryString;
  3239. } else {
  3240. result += "?" + this.defaultQueryString;
  3241. }
  3242. result += hash;
  3243. }
  3244. return result;
  3245. };
  3246. Loader2.prototype._loadResource = function(resource, dequeue) {
  3247. var _this = this;
  3248. resource._dequeue = dequeue;
  3249. AsyncQueue.eachSeries(this._beforeMiddleware, function(fn, next) {
  3250. fn.call(_this, resource, function() {
  3251. next(resource.isComplete ? {} : null);
  3252. });
  3253. }, function() {
  3254. if (resource.isComplete) {
  3255. _this._onLoad(resource);
  3256. } else {
  3257. resource._onLoadBinding = resource.onComplete.once(_this._onLoad, _this);
  3258. resource.load();
  3259. }
  3260. }, true);
  3261. };
  3262. Loader2.prototype._onStart = function() {
  3263. this.progress = 0;
  3264. this.loading = true;
  3265. this.onStart.dispatch(this);
  3266. };
  3267. Loader2.prototype._onComplete = function() {
  3268. this.progress = MAX_PROGRESS;
  3269. this.loading = false;
  3270. this.onComplete.dispatch(this, this.resources);
  3271. };
  3272. Loader2.prototype._onLoad = function(resource) {
  3273. var _this = this;
  3274. resource._onLoadBinding = null;
  3275. this._resourcesParsing.push(resource);
  3276. resource._dequeue();
  3277. AsyncQueue.eachSeries(this._afterMiddleware, function(fn, next) {
  3278. fn.call(_this, resource, next);
  3279. }, function() {
  3280. resource.onAfterMiddleware.dispatch(resource);
  3281. _this.progress = Math.min(MAX_PROGRESS, _this.progress + resource.progressChunk);
  3282. _this.onProgress.dispatch(_this, resource);
  3283. if (resource.error) {
  3284. _this.onError.dispatch(resource.error, _this, resource);
  3285. } else {
  3286. _this.onLoad.dispatch(_this, resource);
  3287. }
  3288. _this._resourcesParsing.splice(_this._resourcesParsing.indexOf(resource), 1);
  3289. if (_this._queue.idle() && _this._resourcesParsing.length === 0) {
  3290. _this._onComplete();
  3291. }
  3292. }, true);
  3293. };
  3294. Loader2.prototype.destroy = function() {
  3295. if (!this._protected) {
  3296. this.reset();
  3297. }
  3298. };
  3299. Object.defineProperty(Loader2, "shared", {
  3300. /** A premade instance of the loader that can be used to load resources. */
  3301. get: function() {
  3302. var shared = Loader2._shared;
  3303. if (!shared) {
  3304. shared = new Loader2();
  3305. shared._protected = true;
  3306. Loader2._shared = shared;
  3307. }
  3308. return shared;
  3309. },
  3310. enumerable: false,
  3311. configurable: true
  3312. });
  3313. Loader2.registerPlugin = function(plugin) {
  3314. deprecation("6.5.0", "Loader.registerPlugin() is deprecated, use extensions.add() instead.");
  3315. extensions.add({
  3316. type: ExtensionType.Loader,
  3317. ref: plugin
  3318. });
  3319. return Loader2;
  3320. };
  3321. Loader2._plugins = [];
  3322. return Loader2;
  3323. })()
  3324. );
  3325. extensions.handleByList(ExtensionType.Loader, Loader._plugins);
  3326. Loader.prototype.add = function add(name, url2, options, callback) {
  3327. if (Array.isArray(name)) {
  3328. for (var i = 0; i < name.length; ++i) {
  3329. this.add(name[i]);
  3330. }
  3331. return this;
  3332. }
  3333. if (typeof name === "object") {
  3334. options = name;
  3335. callback = url2 || options.callback || options.onComplete;
  3336. url2 = options.url;
  3337. name = options.name || options.key || options.url;
  3338. }
  3339. if (typeof url2 !== "string") {
  3340. callback = options;
  3341. options = url2;
  3342. url2 = name;
  3343. }
  3344. if (typeof url2 !== "string") {
  3345. throw new Error("No url passed to add resource to loader.");
  3346. }
  3347. if (typeof options === "function") {
  3348. callback = options;
  3349. options = null;
  3350. }
  3351. return this._add(name, url2, options, callback);
  3352. };
  3353. var AppLoaderPlugin = (
  3354. /** @class */
  3355. (function() {
  3356. function AppLoaderPlugin2() {
  3357. }
  3358. AppLoaderPlugin2.init = function(options) {
  3359. options = Object.assign({
  3360. sharedLoader: false
  3361. }, options);
  3362. this.loader = options.sharedLoader ? Loader.shared : new Loader();
  3363. };
  3364. AppLoaderPlugin2.destroy = function() {
  3365. if (this.loader) {
  3366. this.loader.destroy();
  3367. this.loader = null;
  3368. }
  3369. };
  3370. AppLoaderPlugin2.extension = ExtensionType.Application;
  3371. return AppLoaderPlugin2;
  3372. })()
  3373. );
  3374. var TextureLoader = (
  3375. /** @class */
  3376. (function() {
  3377. function TextureLoader2() {
  3378. }
  3379. TextureLoader2.add = function() {
  3380. LoaderResource.setExtensionLoadType("svg", LoaderResource.LOAD_TYPE.XHR);
  3381. LoaderResource.setExtensionXhrType("svg", LoaderResource.XHR_RESPONSE_TYPE.TEXT);
  3382. };
  3383. TextureLoader2.use = function(resource, next) {
  3384. if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === "svg")) {
  3385. var data = resource.data, url2 = resource.url, name = resource.name, metadata = resource.metadata;
  3386. Texture.fromLoader(data, url2, name, metadata).then(function(texture) {
  3387. resource.texture = texture;
  3388. next();
  3389. }).catch(next);
  3390. } else {
  3391. next();
  3392. }
  3393. };
  3394. TextureLoader2.extension = ExtensionType.Loader;
  3395. return TextureLoader2;
  3396. })()
  3397. );
  3398. var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  3399. function encodeBinary(input) {
  3400. var output = "";
  3401. var inx = 0;
  3402. while (inx < input.length) {
  3403. var bytebuffer = [0, 0, 0];
  3404. var encodedCharIndexes = [0, 0, 0, 0];
  3405. for (var jnx = 0; jnx < bytebuffer.length; ++jnx) {
  3406. if (inx < input.length) {
  3407. bytebuffer[jnx] = input.charCodeAt(inx++) & 255;
  3408. } else {
  3409. bytebuffer[jnx] = 0;
  3410. }
  3411. }
  3412. encodedCharIndexes[0] = bytebuffer[0] >> 2;
  3413. encodedCharIndexes[1] = (bytebuffer[0] & 3) << 4 | bytebuffer[1] >> 4;
  3414. encodedCharIndexes[2] = (bytebuffer[1] & 15) << 2 | bytebuffer[2] >> 6;
  3415. encodedCharIndexes[3] = bytebuffer[2] & 63;
  3416. var paddingBytes = inx - (input.length - 1);
  3417. switch (paddingBytes) {
  3418. case 2:
  3419. encodedCharIndexes[3] = 64;
  3420. encodedCharIndexes[2] = 64;
  3421. break;
  3422. case 1:
  3423. encodedCharIndexes[3] = 64;
  3424. break;
  3425. }
  3426. for (var jnx = 0; jnx < encodedCharIndexes.length; ++jnx) {
  3427. output += _keyStr.charAt(encodedCharIndexes[jnx]);
  3428. }
  3429. }
  3430. return output;
  3431. }
  3432. function parsing(resource, next) {
  3433. if (!resource.data) {
  3434. next();
  3435. return;
  3436. }
  3437. if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB) {
  3438. if (!self.Blob || typeof resource.data === "string") {
  3439. var type = resource.xhr.getResponseHeader("content-type");
  3440. if (type && type.indexOf("image") === 0) {
  3441. resource.data = new Image();
  3442. resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText);
  3443. resource.type = LoaderResource.TYPE.IMAGE;
  3444. resource.data.onload = function() {
  3445. resource.data.onload = null;
  3446. next();
  3447. };
  3448. return;
  3449. }
  3450. } else if (resource.data.type.indexOf("image") === 0) {
  3451. var Url_1 = globalThis.URL || globalThis.webkitURL;
  3452. var src_1 = Url_1.createObjectURL(resource.data);
  3453. resource.blob = resource.data;
  3454. resource.data = new Image();
  3455. resource.data.src = src_1;
  3456. resource.type = LoaderResource.TYPE.IMAGE;
  3457. resource.data.onload = function() {
  3458. Url_1.revokeObjectURL(src_1);
  3459. resource.data.onload = null;
  3460. next();
  3461. };
  3462. return;
  3463. }
  3464. }
  3465. next();
  3466. }
  3467. var ParsingLoader = (
  3468. /** @class */
  3469. (function() {
  3470. function ParsingLoader2() {
  3471. }
  3472. ParsingLoader2.extension = ExtensionType.Loader;
  3473. ParsingLoader2.use = parsing;
  3474. return ParsingLoader2;
  3475. })()
  3476. );
  3477. extensions.add(TextureLoader, ParsingLoader);
  3478. // node_modules/@pixi/compressed-textures/dist/esm/compressed-textures.mjs
  3479. var _a$2;
  3480. var INTERNAL_FORMATS;
  3481. (function(INTERNAL_FORMATS2) {
  3482. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB_S3TC_DXT1_EXT"] = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT";
  3483. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_S3TC_DXT1_EXT"] = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT";
  3484. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_S3TC_DXT3_EXT"] = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT";
  3485. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_S3TC_DXT5_EXT"] = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT";
  3486. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"] = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
  3487. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"] = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
  3488. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"] = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
  3489. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB_S3TC_DXT1_EXT"] = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT";
  3490. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_R11_EAC"] = 37488] = "COMPRESSED_R11_EAC";
  3491. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SIGNED_R11_EAC"] = 37489] = "COMPRESSED_SIGNED_R11_EAC";
  3492. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RG11_EAC"] = 37490] = "COMPRESSED_RG11_EAC";
  3493. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SIGNED_RG11_EAC"] = 37491] = "COMPRESSED_SIGNED_RG11_EAC";
  3494. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB8_ETC2"] = 37492] = "COMPRESSED_RGB8_ETC2";
  3495. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA8_ETC2_EAC"] = 37496] = "COMPRESSED_RGBA8_ETC2_EAC";
  3496. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB8_ETC2"] = 37493] = "COMPRESSED_SRGB8_ETC2";
  3497. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"] = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
  3498. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
  3499. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
  3500. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB_PVRTC_4BPPV1_IMG"] = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
  3501. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"] = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
  3502. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB_PVRTC_2BPPV1_IMG"] = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
  3503. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"] = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
  3504. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB_ETC1_WEBGL"] = 36196] = "COMPRESSED_RGB_ETC1_WEBGL";
  3505. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGB_ATC_WEBGL"] = 35986] = "COMPRESSED_RGB_ATC_WEBGL";
  3506. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"] = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL";
  3507. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"] = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL";
  3508. INTERNAL_FORMATS2[INTERNAL_FORMATS2["COMPRESSED_RGBA_ASTC_4x4_KHR"] = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR";
  3509. })(INTERNAL_FORMATS || (INTERNAL_FORMATS = {}));
  3510. var INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = (_a$2 = {}, // WEBGL_compressed_texture_s3tc
  3511. _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT] = 1, // WEBGL_compressed_texture_s3tc
  3512. _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = 1, // WEBGL_compressed_texture_etc
  3513. _a$2[INTERNAL_FORMATS.COMPRESSED_R11_EAC] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RG11_EAC] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 0.5, // WEBGL_compressed_texture_pvrtc
  3514. _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = 0.25, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = 0.25, // WEBGL_compressed_texture_etc1
  3515. _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL] = 0.5, // @see https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_compressed_ATC_texture.txt
  3516. // WEBGL_compressed_texture_atc
  3517. _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL] = 0.5, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = 1, _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = 1, // @see https://registry.khronos.org/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
  3518. // WEBGL_compressed_texture_astc
  3519. /* eslint-disable-next-line camelcase */
  3520. _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR] = 1, _a$2);
  3521. var extendStatics2 = function(d, b) {
  3522. extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  3523. d2.__proto__ = b2;
  3524. } || function(d2, b2) {
  3525. for (var p in b2) {
  3526. if (b2.hasOwnProperty(p)) {
  3527. d2[p] = b2[p];
  3528. }
  3529. }
  3530. };
  3531. return extendStatics2(d, b);
  3532. };
  3533. function __extends2(d, b) {
  3534. extendStatics2(d, b);
  3535. function __() {
  3536. this.constructor = d;
  3537. }
  3538. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3539. }
  3540. function __awaiter(thisArg, _arguments, P, generator) {
  3541. function adopt(value) {
  3542. return value instanceof P ? value : new P(function(resolve2) {
  3543. resolve2(value);
  3544. });
  3545. }
  3546. return new (P || (P = Promise))(function(resolve2, reject2) {
  3547. function fulfilled(value) {
  3548. try {
  3549. step(generator.next(value));
  3550. } catch (e) {
  3551. reject2(e);
  3552. }
  3553. }
  3554. function rejected(value) {
  3555. try {
  3556. step(generator["throw"](value));
  3557. } catch (e) {
  3558. reject2(e);
  3559. }
  3560. }
  3561. function step(result) {
  3562. result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
  3563. }
  3564. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3565. });
  3566. }
  3567. function __generator(thisArg, body) {
  3568. var _ = { label: 0, sent: function() {
  3569. if (t[0] & 1) {
  3570. throw t[1];
  3571. }
  3572. return t[1];
  3573. }, trys: [], ops: [] }, f, y, t, g;
  3574. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  3575. return this;
  3576. }), g;
  3577. function verb(n) {
  3578. return function(v) {
  3579. return step([n, v]);
  3580. };
  3581. }
  3582. function step(op) {
  3583. if (f) {
  3584. throw new TypeError("Generator is already executing.");
  3585. }
  3586. while (_) {
  3587. try {
  3588. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) {
  3589. return t;
  3590. }
  3591. if (y = 0, t) {
  3592. op = [op[0] & 2, t.value];
  3593. }
  3594. switch (op[0]) {
  3595. case 0:
  3596. case 1:
  3597. t = op;
  3598. break;
  3599. case 4:
  3600. _.label++;
  3601. return { value: op[1], done: false };
  3602. case 5:
  3603. _.label++;
  3604. y = op[1];
  3605. op = [0];
  3606. continue;
  3607. case 7:
  3608. op = _.ops.pop();
  3609. _.trys.pop();
  3610. continue;
  3611. default:
  3612. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  3613. _ = 0;
  3614. continue;
  3615. }
  3616. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  3617. _.label = op[1];
  3618. break;
  3619. }
  3620. if (op[0] === 6 && _.label < t[1]) {
  3621. _.label = t[1];
  3622. t = op;
  3623. break;
  3624. }
  3625. if (t && _.label < t[2]) {
  3626. _.label = t[2];
  3627. _.ops.push(op);
  3628. break;
  3629. }
  3630. if (t[2]) {
  3631. _.ops.pop();
  3632. }
  3633. _.trys.pop();
  3634. continue;
  3635. }
  3636. op = body.call(thisArg, _);
  3637. } catch (e) {
  3638. op = [6, e];
  3639. y = 0;
  3640. } finally {
  3641. f = t = 0;
  3642. }
  3643. }
  3644. if (op[0] & 5) {
  3645. throw op[1];
  3646. }
  3647. return { value: op[0] ? op[1] : void 0, done: true };
  3648. }
  3649. }
  3650. var BlobResource = (
  3651. /** @class */
  3652. (function(_super) {
  3653. __extends2(BlobResource2, _super);
  3654. function BlobResource2(source, options) {
  3655. if (options === void 0) {
  3656. options = { width: 1, height: 1, autoLoad: true };
  3657. }
  3658. var _this = this;
  3659. var origin;
  3660. var data;
  3661. if (typeof source === "string") {
  3662. origin = source;
  3663. data = new Uint8Array();
  3664. } else {
  3665. origin = null;
  3666. data = source;
  3667. }
  3668. _this = _super.call(this, data, options) || this;
  3669. _this.origin = origin;
  3670. _this.buffer = data ? new ViewableBuffer(data) : null;
  3671. if (_this.origin && options.autoLoad !== false) {
  3672. _this.load();
  3673. }
  3674. if (data && data.length) {
  3675. _this.loaded = true;
  3676. _this.onBlobLoaded(_this.buffer.rawBinaryData);
  3677. }
  3678. return _this;
  3679. }
  3680. BlobResource2.prototype.onBlobLoaded = function(_data) {
  3681. };
  3682. BlobResource2.prototype.load = function() {
  3683. return __awaiter(this, void 0, Promise, function() {
  3684. var response, blob, arrayBuffer;
  3685. return __generator(this, function(_a3) {
  3686. switch (_a3.label) {
  3687. case 0:
  3688. return [4, fetch(this.origin)];
  3689. case 1:
  3690. response = _a3.sent();
  3691. return [4, response.blob()];
  3692. case 2:
  3693. blob = _a3.sent();
  3694. return [4, blob.arrayBuffer()];
  3695. case 3:
  3696. arrayBuffer = _a3.sent();
  3697. this.data = new Uint32Array(arrayBuffer);
  3698. this.buffer = new ViewableBuffer(arrayBuffer);
  3699. this.loaded = true;
  3700. this.onBlobLoaded(arrayBuffer);
  3701. this.update();
  3702. return [2, this];
  3703. }
  3704. });
  3705. });
  3706. };
  3707. return BlobResource2;
  3708. })(BufferResource)
  3709. );
  3710. var CompressedTextureResource = (
  3711. /** @class */
  3712. (function(_super) {
  3713. __extends2(CompressedTextureResource2, _super);
  3714. function CompressedTextureResource2(source, options) {
  3715. var _this = _super.call(this, source, options) || this;
  3716. _this.format = options.format;
  3717. _this.levels = options.levels || 1;
  3718. _this._width = options.width;
  3719. _this._height = options.height;
  3720. _this._extension = CompressedTextureResource2._formatToExtension(_this.format);
  3721. if (options.levelBuffers || _this.buffer) {
  3722. _this._levelBuffers = options.levelBuffers || CompressedTextureResource2._createLevelBuffers(
  3723. source instanceof Uint8Array ? source : _this.buffer.uint8View,
  3724. _this.format,
  3725. _this.levels,
  3726. 4,
  3727. 4,
  3728. // PVRTC has 8x4 blocks in 2bpp mode
  3729. _this.width,
  3730. _this.height
  3731. );
  3732. }
  3733. return _this;
  3734. }
  3735. CompressedTextureResource2.prototype.upload = function(renderer, _texture, _glTexture) {
  3736. var gl = renderer.gl;
  3737. var extension = renderer.context.extensions[this._extension];
  3738. if (!extension) {
  3739. throw new Error(this._extension + " textures are not supported on the current machine");
  3740. }
  3741. if (!this._levelBuffers) {
  3742. return false;
  3743. }
  3744. for (var i = 0, j = this.levels; i < j; i++) {
  3745. var _a3 = this._levelBuffers[i], levelID = _a3.levelID, levelWidth = _a3.levelWidth, levelHeight = _a3.levelHeight, levelBuffer = _a3.levelBuffer;
  3746. gl.compressedTexImage2D(gl.TEXTURE_2D, levelID, this.format, levelWidth, levelHeight, 0, levelBuffer);
  3747. }
  3748. return true;
  3749. };
  3750. CompressedTextureResource2.prototype.onBlobLoaded = function() {
  3751. this._levelBuffers = CompressedTextureResource2._createLevelBuffers(
  3752. this.buffer.uint8View,
  3753. this.format,
  3754. this.levels,
  3755. 4,
  3756. 4,
  3757. // PVRTC has 8x4 blocks in 2bpp mode
  3758. this.width,
  3759. this.height
  3760. );
  3761. };
  3762. CompressedTextureResource2._formatToExtension = function(format) {
  3763. if (format >= 33776 && format <= 33779) {
  3764. return "s3tc";
  3765. } else if (format >= 37488 && format <= 37497) {
  3766. return "etc";
  3767. } else if (format >= 35840 && format <= 35843) {
  3768. return "pvrtc";
  3769. } else if (format >= 36196) {
  3770. return "etc1";
  3771. } else if (format >= 35986 && format <= 34798) {
  3772. return "atc";
  3773. }
  3774. throw new Error("Invalid (compressed) texture format given!");
  3775. };
  3776. CompressedTextureResource2._createLevelBuffers = function(buffer, format, levels, blockWidth, blockHeight, imageWidth, imageHeight) {
  3777. var buffers = new Array(levels);
  3778. var offset = buffer.byteOffset;
  3779. var levelWidth = imageWidth;
  3780. var levelHeight = imageHeight;
  3781. var alignedLevelWidth = levelWidth + blockWidth - 1 & ~(blockWidth - 1);
  3782. var alignedLevelHeight = levelHeight + blockHeight - 1 & ~(blockHeight - 1);
  3783. var levelSize = alignedLevelWidth * alignedLevelHeight * INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[format];
  3784. for (var i = 0; i < levels; i++) {
  3785. buffers[i] = {
  3786. levelID: i,
  3787. levelWidth: levels > 1 ? levelWidth : alignedLevelWidth,
  3788. levelHeight: levels > 1 ? levelHeight : alignedLevelHeight,
  3789. levelBuffer: new Uint8Array(buffer.buffer, offset, levelSize)
  3790. };
  3791. offset += levelSize;
  3792. levelWidth = levelWidth >> 1 || 1;
  3793. levelHeight = levelHeight >> 1 || 1;
  3794. alignedLevelWidth = levelWidth + blockWidth - 1 & ~(blockWidth - 1);
  3795. alignedLevelHeight = levelHeight + blockHeight - 1 & ~(blockHeight - 1);
  3796. levelSize = alignedLevelWidth * alignedLevelHeight * INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[format];
  3797. }
  3798. return buffers;
  3799. };
  3800. return CompressedTextureResource2;
  3801. })(BlobResource)
  3802. );
  3803. var CompressedTextureLoader = (
  3804. /** @class */
  3805. (function() {
  3806. function CompressedTextureLoader2() {
  3807. }
  3808. CompressedTextureLoader2.use = function(resource, next) {
  3809. var data = resource.data;
  3810. var loader = this;
  3811. if (resource.type === LoaderResource.TYPE.JSON && data && data.cacheID && data.textures) {
  3812. var textures = data.textures;
  3813. var textureURL = void 0;
  3814. var fallbackURL = void 0;
  3815. for (var i = 0, j = textures.length; i < j; i++) {
  3816. var texture = textures[i];
  3817. var url_1 = texture.src;
  3818. var format = texture.format;
  3819. if (!format) {
  3820. fallbackURL = url_1;
  3821. }
  3822. if (CompressedTextureLoader2.textureFormats[format]) {
  3823. textureURL = url_1;
  3824. break;
  3825. }
  3826. }
  3827. textureURL = textureURL || fallbackURL;
  3828. if (!textureURL) {
  3829. next(new Error("Cannot load compressed-textures in " + resource.url + ", make sure you provide a fallback"));
  3830. return;
  3831. }
  3832. if (textureURL === resource.url) {
  3833. next(new Error("URL of compressed texture cannot be the same as the manifest's URL"));
  3834. return;
  3835. }
  3836. var loadOptions = {
  3837. crossOrigin: resource.crossOrigin,
  3838. metadata: resource.metadata.imageMetadata,
  3839. parentResource: resource
  3840. };
  3841. var resourcePath = url.resolve(resource.url.replace(loader.baseUrl, ""), textureURL);
  3842. var resourceName = data.cacheID;
  3843. loader.add(resourceName, resourcePath, loadOptions, function(res) {
  3844. if (res.error) {
  3845. next(res.error);
  3846. return;
  3847. }
  3848. var _a3 = res.texture, texture2 = _a3 === void 0 ? null : _a3, _b2 = res.textures, textures2 = _b2 === void 0 ? {} : _b2;
  3849. Object.assign(resource, { texture: texture2, textures: textures2 });
  3850. next();
  3851. });
  3852. } else {
  3853. next();
  3854. }
  3855. };
  3856. Object.defineProperty(CompressedTextureLoader2, "textureExtensions", {
  3857. /** Map of available texture extensions. */
  3858. get: function() {
  3859. if (!CompressedTextureLoader2._textureExtensions) {
  3860. var canvas = settings.ADAPTER.createCanvas();
  3861. var gl = canvas.getContext("webgl");
  3862. if (!gl) {
  3863. console.warn("WebGL not available for compressed textures. Silently failing.");
  3864. return {};
  3865. }
  3866. var extensions2 = {
  3867. s3tc: gl.getExtension("WEBGL_compressed_texture_s3tc"),
  3868. s3tc_sRGB: gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
  3869. etc: gl.getExtension("WEBGL_compressed_texture_etc"),
  3870. etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
  3871. pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
  3872. atc: gl.getExtension("WEBGL_compressed_texture_atc"),
  3873. astc: gl.getExtension("WEBGL_compressed_texture_astc")
  3874. };
  3875. CompressedTextureLoader2._textureExtensions = extensions2;
  3876. }
  3877. return CompressedTextureLoader2._textureExtensions;
  3878. },
  3879. enumerable: false,
  3880. configurable: true
  3881. });
  3882. Object.defineProperty(CompressedTextureLoader2, "textureFormats", {
  3883. /** Map of available texture formats. */
  3884. get: function() {
  3885. if (!CompressedTextureLoader2._textureFormats) {
  3886. var extensions2 = CompressedTextureLoader2.textureExtensions;
  3887. CompressedTextureLoader2._textureFormats = {};
  3888. for (var extensionName in extensions2) {
  3889. var extension = extensions2[extensionName];
  3890. if (!extension) {
  3891. continue;
  3892. }
  3893. Object.assign(CompressedTextureLoader2._textureFormats, Object.getPrototypeOf(extension));
  3894. }
  3895. }
  3896. return CompressedTextureLoader2._textureFormats;
  3897. },
  3898. enumerable: false,
  3899. configurable: true
  3900. });
  3901. CompressedTextureLoader2.extension = ExtensionType.Loader;
  3902. return CompressedTextureLoader2;
  3903. })()
  3904. );
  3905. function registerCompressedTextures(url2, resources2, metadata) {
  3906. var result = {
  3907. textures: {},
  3908. texture: null
  3909. };
  3910. if (!resources2) {
  3911. return result;
  3912. }
  3913. var textures = resources2.map(function(resource) {
  3914. return new Texture(new BaseTexture(resource, Object.assign({
  3915. mipmap: MIPMAP_MODES.OFF,
  3916. alphaMode: ALPHA_MODES.NO_PREMULTIPLIED_ALPHA
  3917. }, metadata)));
  3918. });
  3919. textures.forEach(function(texture, i) {
  3920. var baseTexture = texture.baseTexture;
  3921. var cacheID = url2 + "-" + (i + 1);
  3922. BaseTexture.addToCache(baseTexture, cacheID);
  3923. Texture.addToCache(texture, cacheID);
  3924. if (i === 0) {
  3925. BaseTexture.addToCache(baseTexture, url2);
  3926. Texture.addToCache(texture, url2);
  3927. result.texture = texture;
  3928. }
  3929. result.textures[cacheID] = texture;
  3930. });
  3931. return result;
  3932. }
  3933. var _a$1;
  3934. var _b$1;
  3935. var DDS_MAGIC_SIZE = 4;
  3936. var DDS_HEADER_SIZE = 124;
  3937. var DDS_HEADER_PF_SIZE = 32;
  3938. var DDS_HEADER_DX10_SIZE = 20;
  3939. var DDS_MAGIC = 542327876;
  3940. var DDS_FIELDS = {
  3941. SIZE: 1,
  3942. FLAGS: 2,
  3943. HEIGHT: 3,
  3944. WIDTH: 4,
  3945. MIPMAP_COUNT: 7,
  3946. PIXEL_FORMAT: 19
  3947. };
  3948. var DDS_PF_FIELDS = {
  3949. SIZE: 0,
  3950. FLAGS: 1,
  3951. FOURCC: 2,
  3952. RGB_BITCOUNT: 3,
  3953. R_BIT_MASK: 4,
  3954. G_BIT_MASK: 5,
  3955. B_BIT_MASK: 6,
  3956. A_BIT_MASK: 7
  3957. };
  3958. var DDS_DX10_FIELDS = {
  3959. DXGI_FORMAT: 0,
  3960. RESOURCE_DIMENSION: 1,
  3961. MISC_FLAG: 2,
  3962. ARRAY_SIZE: 3,
  3963. MISC_FLAGS2: 4
  3964. };
  3965. var DXGI_FORMAT;
  3966. (function(DXGI_FORMAT2) {
  3967. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_UNKNOWN"] = 0] = "DXGI_FORMAT_UNKNOWN";
  3968. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32A32_TYPELESS"] = 1] = "DXGI_FORMAT_R32G32B32A32_TYPELESS";
  3969. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32A32_FLOAT"] = 2] = "DXGI_FORMAT_R32G32B32A32_FLOAT";
  3970. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32A32_UINT"] = 3] = "DXGI_FORMAT_R32G32B32A32_UINT";
  3971. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32A32_SINT"] = 4] = "DXGI_FORMAT_R32G32B32A32_SINT";
  3972. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32_TYPELESS"] = 5] = "DXGI_FORMAT_R32G32B32_TYPELESS";
  3973. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32_FLOAT"] = 6] = "DXGI_FORMAT_R32G32B32_FLOAT";
  3974. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32_UINT"] = 7] = "DXGI_FORMAT_R32G32B32_UINT";
  3975. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32B32_SINT"] = 8] = "DXGI_FORMAT_R32G32B32_SINT";
  3976. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16B16A16_TYPELESS"] = 9] = "DXGI_FORMAT_R16G16B16A16_TYPELESS";
  3977. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16B16A16_FLOAT"] = 10] = "DXGI_FORMAT_R16G16B16A16_FLOAT";
  3978. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16B16A16_UNORM"] = 11] = "DXGI_FORMAT_R16G16B16A16_UNORM";
  3979. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16B16A16_UINT"] = 12] = "DXGI_FORMAT_R16G16B16A16_UINT";
  3980. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16B16A16_SNORM"] = 13] = "DXGI_FORMAT_R16G16B16A16_SNORM";
  3981. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16B16A16_SINT"] = 14] = "DXGI_FORMAT_R16G16B16A16_SINT";
  3982. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32_TYPELESS"] = 15] = "DXGI_FORMAT_R32G32_TYPELESS";
  3983. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32_FLOAT"] = 16] = "DXGI_FORMAT_R32G32_FLOAT";
  3984. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32_UINT"] = 17] = "DXGI_FORMAT_R32G32_UINT";
  3985. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G32_SINT"] = 18] = "DXGI_FORMAT_R32G32_SINT";
  3986. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32G8X24_TYPELESS"] = 19] = "DXGI_FORMAT_R32G8X24_TYPELESS";
  3987. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_D32_FLOAT_S8X24_UINT"] = 20] = "DXGI_FORMAT_D32_FLOAT_S8X24_UINT";
  3988. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS"] = 21] = "DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS";
  3989. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_X32_TYPELESS_G8X24_UINT"] = 22] = "DXGI_FORMAT_X32_TYPELESS_G8X24_UINT";
  3990. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R10G10B10A2_TYPELESS"] = 23] = "DXGI_FORMAT_R10G10B10A2_TYPELESS";
  3991. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R10G10B10A2_UNORM"] = 24] = "DXGI_FORMAT_R10G10B10A2_UNORM";
  3992. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R10G10B10A2_UINT"] = 25] = "DXGI_FORMAT_R10G10B10A2_UINT";
  3993. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R11G11B10_FLOAT"] = 26] = "DXGI_FORMAT_R11G11B10_FLOAT";
  3994. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8B8A8_TYPELESS"] = 27] = "DXGI_FORMAT_R8G8B8A8_TYPELESS";
  3995. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8B8A8_UNORM"] = 28] = "DXGI_FORMAT_R8G8B8A8_UNORM";
  3996. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8B8A8_UNORM_SRGB"] = 29] = "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB";
  3997. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8B8A8_UINT"] = 30] = "DXGI_FORMAT_R8G8B8A8_UINT";
  3998. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8B8A8_SNORM"] = 31] = "DXGI_FORMAT_R8G8B8A8_SNORM";
  3999. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8B8A8_SINT"] = 32] = "DXGI_FORMAT_R8G8B8A8_SINT";
  4000. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16_TYPELESS"] = 33] = "DXGI_FORMAT_R16G16_TYPELESS";
  4001. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16_FLOAT"] = 34] = "DXGI_FORMAT_R16G16_FLOAT";
  4002. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16_UNORM"] = 35] = "DXGI_FORMAT_R16G16_UNORM";
  4003. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16_UINT"] = 36] = "DXGI_FORMAT_R16G16_UINT";
  4004. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16_SNORM"] = 37] = "DXGI_FORMAT_R16G16_SNORM";
  4005. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16G16_SINT"] = 38] = "DXGI_FORMAT_R16G16_SINT";
  4006. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32_TYPELESS"] = 39] = "DXGI_FORMAT_R32_TYPELESS";
  4007. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_D32_FLOAT"] = 40] = "DXGI_FORMAT_D32_FLOAT";
  4008. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32_FLOAT"] = 41] = "DXGI_FORMAT_R32_FLOAT";
  4009. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32_UINT"] = 42] = "DXGI_FORMAT_R32_UINT";
  4010. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R32_SINT"] = 43] = "DXGI_FORMAT_R32_SINT";
  4011. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R24G8_TYPELESS"] = 44] = "DXGI_FORMAT_R24G8_TYPELESS";
  4012. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_D24_UNORM_S8_UINT"] = 45] = "DXGI_FORMAT_D24_UNORM_S8_UINT";
  4013. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R24_UNORM_X8_TYPELESS"] = 46] = "DXGI_FORMAT_R24_UNORM_X8_TYPELESS";
  4014. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_X24_TYPELESS_G8_UINT"] = 47] = "DXGI_FORMAT_X24_TYPELESS_G8_UINT";
  4015. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8_TYPELESS"] = 48] = "DXGI_FORMAT_R8G8_TYPELESS";
  4016. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8_UNORM"] = 49] = "DXGI_FORMAT_R8G8_UNORM";
  4017. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8_UINT"] = 50] = "DXGI_FORMAT_R8G8_UINT";
  4018. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8_SNORM"] = 51] = "DXGI_FORMAT_R8G8_SNORM";
  4019. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8_SINT"] = 52] = "DXGI_FORMAT_R8G8_SINT";
  4020. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16_TYPELESS"] = 53] = "DXGI_FORMAT_R16_TYPELESS";
  4021. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16_FLOAT"] = 54] = "DXGI_FORMAT_R16_FLOAT";
  4022. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_D16_UNORM"] = 55] = "DXGI_FORMAT_D16_UNORM";
  4023. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16_UNORM"] = 56] = "DXGI_FORMAT_R16_UNORM";
  4024. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16_UINT"] = 57] = "DXGI_FORMAT_R16_UINT";
  4025. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16_SNORM"] = 58] = "DXGI_FORMAT_R16_SNORM";
  4026. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R16_SINT"] = 59] = "DXGI_FORMAT_R16_SINT";
  4027. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8_TYPELESS"] = 60] = "DXGI_FORMAT_R8_TYPELESS";
  4028. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8_UNORM"] = 61] = "DXGI_FORMAT_R8_UNORM";
  4029. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8_UINT"] = 62] = "DXGI_FORMAT_R8_UINT";
  4030. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8_SNORM"] = 63] = "DXGI_FORMAT_R8_SNORM";
  4031. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8_SINT"] = 64] = "DXGI_FORMAT_R8_SINT";
  4032. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_A8_UNORM"] = 65] = "DXGI_FORMAT_A8_UNORM";
  4033. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R1_UNORM"] = 66] = "DXGI_FORMAT_R1_UNORM";
  4034. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R9G9B9E5_SHAREDEXP"] = 67] = "DXGI_FORMAT_R9G9B9E5_SHAREDEXP";
  4035. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R8G8_B8G8_UNORM"] = 68] = "DXGI_FORMAT_R8G8_B8G8_UNORM";
  4036. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_G8R8_G8B8_UNORM"] = 69] = "DXGI_FORMAT_G8R8_G8B8_UNORM";
  4037. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC1_TYPELESS"] = 70] = "DXGI_FORMAT_BC1_TYPELESS";
  4038. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC1_UNORM"] = 71] = "DXGI_FORMAT_BC1_UNORM";
  4039. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC1_UNORM_SRGB"] = 72] = "DXGI_FORMAT_BC1_UNORM_SRGB";
  4040. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC2_TYPELESS"] = 73] = "DXGI_FORMAT_BC2_TYPELESS";
  4041. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC2_UNORM"] = 74] = "DXGI_FORMAT_BC2_UNORM";
  4042. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC2_UNORM_SRGB"] = 75] = "DXGI_FORMAT_BC2_UNORM_SRGB";
  4043. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC3_TYPELESS"] = 76] = "DXGI_FORMAT_BC3_TYPELESS";
  4044. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC3_UNORM"] = 77] = "DXGI_FORMAT_BC3_UNORM";
  4045. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC3_UNORM_SRGB"] = 78] = "DXGI_FORMAT_BC3_UNORM_SRGB";
  4046. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC4_TYPELESS"] = 79] = "DXGI_FORMAT_BC4_TYPELESS";
  4047. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC4_UNORM"] = 80] = "DXGI_FORMAT_BC4_UNORM";
  4048. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC4_SNORM"] = 81] = "DXGI_FORMAT_BC4_SNORM";
  4049. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC5_TYPELESS"] = 82] = "DXGI_FORMAT_BC5_TYPELESS";
  4050. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC5_UNORM"] = 83] = "DXGI_FORMAT_BC5_UNORM";
  4051. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC5_SNORM"] = 84] = "DXGI_FORMAT_BC5_SNORM";
  4052. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B5G6R5_UNORM"] = 85] = "DXGI_FORMAT_B5G6R5_UNORM";
  4053. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B5G5R5A1_UNORM"] = 86] = "DXGI_FORMAT_B5G5R5A1_UNORM";
  4054. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B8G8R8A8_UNORM"] = 87] = "DXGI_FORMAT_B8G8R8A8_UNORM";
  4055. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B8G8R8X8_UNORM"] = 88] = "DXGI_FORMAT_B8G8R8X8_UNORM";
  4056. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM"] = 89] = "DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM";
  4057. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B8G8R8A8_TYPELESS"] = 90] = "DXGI_FORMAT_B8G8R8A8_TYPELESS";
  4058. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B8G8R8A8_UNORM_SRGB"] = 91] = "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB";
  4059. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B8G8R8X8_TYPELESS"] = 92] = "DXGI_FORMAT_B8G8R8X8_TYPELESS";
  4060. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B8G8R8X8_UNORM_SRGB"] = 93] = "DXGI_FORMAT_B8G8R8X8_UNORM_SRGB";
  4061. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC6H_TYPELESS"] = 94] = "DXGI_FORMAT_BC6H_TYPELESS";
  4062. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC6H_UF16"] = 95] = "DXGI_FORMAT_BC6H_UF16";
  4063. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC6H_SF16"] = 96] = "DXGI_FORMAT_BC6H_SF16";
  4064. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC7_TYPELESS"] = 97] = "DXGI_FORMAT_BC7_TYPELESS";
  4065. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC7_UNORM"] = 98] = "DXGI_FORMAT_BC7_UNORM";
  4066. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_BC7_UNORM_SRGB"] = 99] = "DXGI_FORMAT_BC7_UNORM_SRGB";
  4067. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_AYUV"] = 100] = "DXGI_FORMAT_AYUV";
  4068. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_Y410"] = 101] = "DXGI_FORMAT_Y410";
  4069. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_Y416"] = 102] = "DXGI_FORMAT_Y416";
  4070. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_NV12"] = 103] = "DXGI_FORMAT_NV12";
  4071. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_P010"] = 104] = "DXGI_FORMAT_P010";
  4072. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_P016"] = 105] = "DXGI_FORMAT_P016";
  4073. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_420_OPAQUE"] = 106] = "DXGI_FORMAT_420_OPAQUE";
  4074. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_YUY2"] = 107] = "DXGI_FORMAT_YUY2";
  4075. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_Y210"] = 108] = "DXGI_FORMAT_Y210";
  4076. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_Y216"] = 109] = "DXGI_FORMAT_Y216";
  4077. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_NV11"] = 110] = "DXGI_FORMAT_NV11";
  4078. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_AI44"] = 111] = "DXGI_FORMAT_AI44";
  4079. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_IA44"] = 112] = "DXGI_FORMAT_IA44";
  4080. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_P8"] = 113] = "DXGI_FORMAT_P8";
  4081. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_A8P8"] = 114] = "DXGI_FORMAT_A8P8";
  4082. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_B4G4R4A4_UNORM"] = 115] = "DXGI_FORMAT_B4G4R4A4_UNORM";
  4083. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_P208"] = 116] = "DXGI_FORMAT_P208";
  4084. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_V208"] = 117] = "DXGI_FORMAT_V208";
  4085. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_V408"] = 118] = "DXGI_FORMAT_V408";
  4086. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE"] = 119] = "DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE";
  4087. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE"] = 120] = "DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE";
  4088. DXGI_FORMAT2[DXGI_FORMAT2["DXGI_FORMAT_FORCE_UINT"] = 121] = "DXGI_FORMAT_FORCE_UINT";
  4089. })(DXGI_FORMAT || (DXGI_FORMAT = {}));
  4090. var D3D10_RESOURCE_DIMENSION;
  4091. (function(D3D10_RESOURCE_DIMENSION2) {
  4092. D3D10_RESOURCE_DIMENSION2[D3D10_RESOURCE_DIMENSION2["DDS_DIMENSION_TEXTURE1D"] = 2] = "DDS_DIMENSION_TEXTURE1D";
  4093. D3D10_RESOURCE_DIMENSION2[D3D10_RESOURCE_DIMENSION2["DDS_DIMENSION_TEXTURE2D"] = 3] = "DDS_DIMENSION_TEXTURE2D";
  4094. D3D10_RESOURCE_DIMENSION2[D3D10_RESOURCE_DIMENSION2["DDS_DIMENSION_TEXTURE3D"] = 6] = "DDS_DIMENSION_TEXTURE3D";
  4095. })(D3D10_RESOURCE_DIMENSION || (D3D10_RESOURCE_DIMENSION = {}));
  4096. var PF_FLAGS = 1;
  4097. var DDPF_ALPHA = 2;
  4098. var DDPF_FOURCC = 4;
  4099. var DDPF_RGB = 64;
  4100. var DDPF_YUV = 512;
  4101. var DDPF_LUMINANCE = 131072;
  4102. var FOURCC_DXT1 = 827611204;
  4103. var FOURCC_DXT3 = 861165636;
  4104. var FOURCC_DXT5 = 894720068;
  4105. var FOURCC_DX10 = 808540228;
  4106. var DDS_RESOURCE_MISC_TEXTURECUBE = 4;
  4107. var FOURCC_TO_FORMAT = (_a$1 = {}, _a$1[FOURCC_DXT1] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT, _a$1[FOURCC_DXT3] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT, _a$1[FOURCC_DXT5] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT, _a$1);
  4108. var DXGI_TO_FORMAT = (_b$1 = {}, // WEBGL_compressed_texture_s3tc
  4109. _b$1[DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM] = INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT, // WEBGL_compressed_texture_s3tc_srgb
  4110. _b$1[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB] = INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB] = INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, _b$1[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB] = INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, _b$1);
  4111. function parseDDS(arrayBuffer) {
  4112. var data = new Uint32Array(arrayBuffer);
  4113. var magicWord = data[0];
  4114. if (magicWord !== DDS_MAGIC) {
  4115. throw new Error("Invalid DDS file magic word");
  4116. }
  4117. var header = new Uint32Array(arrayBuffer, 0, DDS_HEADER_SIZE / Uint32Array.BYTES_PER_ELEMENT);
  4118. var height = header[DDS_FIELDS.HEIGHT];
  4119. var width = header[DDS_FIELDS.WIDTH];
  4120. var mipmapCount = header[DDS_FIELDS.MIPMAP_COUNT];
  4121. var pixelFormat = new Uint32Array(arrayBuffer, DDS_FIELDS.PIXEL_FORMAT * Uint32Array.BYTES_PER_ELEMENT, DDS_HEADER_PF_SIZE / Uint32Array.BYTES_PER_ELEMENT);
  4122. var formatFlags = pixelFormat[PF_FLAGS];
  4123. if (formatFlags & DDPF_FOURCC) {
  4124. var fourCC = pixelFormat[DDS_PF_FIELDS.FOURCC];
  4125. if (fourCC !== FOURCC_DX10) {
  4126. var internalFormat_1 = FOURCC_TO_FORMAT[fourCC];
  4127. var dataOffset_1 = DDS_MAGIC_SIZE + DDS_HEADER_SIZE;
  4128. var texData = new Uint8Array(arrayBuffer, dataOffset_1);
  4129. var resource = new CompressedTextureResource(texData, {
  4130. format: internalFormat_1,
  4131. width,
  4132. height,
  4133. levels: mipmapCount
  4134. // CompressedTextureResource will separate the levelBuffers for us!
  4135. });
  4136. return [resource];
  4137. }
  4138. var dx10Offset = DDS_MAGIC_SIZE + DDS_HEADER_SIZE;
  4139. var dx10Header = new Uint32Array(data.buffer, dx10Offset, DDS_HEADER_DX10_SIZE / Uint32Array.BYTES_PER_ELEMENT);
  4140. var dxgiFormat = dx10Header[DDS_DX10_FIELDS.DXGI_FORMAT];
  4141. var resourceDimension = dx10Header[DDS_DX10_FIELDS.RESOURCE_DIMENSION];
  4142. var miscFlag = dx10Header[DDS_DX10_FIELDS.MISC_FLAG];
  4143. var arraySize = dx10Header[DDS_DX10_FIELDS.ARRAY_SIZE];
  4144. var internalFormat_2 = DXGI_TO_FORMAT[dxgiFormat];
  4145. if (internalFormat_2 === void 0) {
  4146. throw new Error("DDSParser cannot parse texture data with DXGI format " + dxgiFormat);
  4147. }
  4148. if (miscFlag === DDS_RESOURCE_MISC_TEXTURECUBE) {
  4149. throw new Error("DDSParser does not support cubemap textures");
  4150. }
  4151. if (resourceDimension === D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D) {
  4152. throw new Error("DDSParser does not supported 3D texture data");
  4153. }
  4154. var imageBuffers = new Array();
  4155. var dataOffset = DDS_MAGIC_SIZE + DDS_HEADER_SIZE + DDS_HEADER_DX10_SIZE;
  4156. if (arraySize === 1) {
  4157. imageBuffers.push(new Uint8Array(arrayBuffer, dataOffset));
  4158. } else {
  4159. var pixelSize = INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[internalFormat_2];
  4160. var imageSize = 0;
  4161. var levelWidth = width;
  4162. var levelHeight = height;
  4163. for (var i = 0; i < mipmapCount; i++) {
  4164. var alignedLevelWidth = Math.max(1, levelWidth + 3 & ~3);
  4165. var alignedLevelHeight = Math.max(1, levelHeight + 3 & ~3);
  4166. var levelSize = alignedLevelWidth * alignedLevelHeight * pixelSize;
  4167. imageSize += levelSize;
  4168. levelWidth = levelWidth >>> 1;
  4169. levelHeight = levelHeight >>> 1;
  4170. }
  4171. var imageOffset = dataOffset;
  4172. for (var i = 0; i < arraySize; i++) {
  4173. imageBuffers.push(new Uint8Array(arrayBuffer, imageOffset, imageSize));
  4174. imageOffset += imageSize;
  4175. }
  4176. }
  4177. return imageBuffers.map(function(buffer) {
  4178. return new CompressedTextureResource(buffer, {
  4179. format: internalFormat_2,
  4180. width,
  4181. height,
  4182. levels: mipmapCount
  4183. });
  4184. });
  4185. }
  4186. if (formatFlags & DDPF_RGB) {
  4187. throw new Error("DDSParser does not support uncompressed texture data.");
  4188. }
  4189. if (formatFlags & DDPF_YUV) {
  4190. throw new Error("DDSParser does not supported YUV uncompressed texture data.");
  4191. }
  4192. if (formatFlags & DDPF_LUMINANCE) {
  4193. throw new Error("DDSParser does not support single-channel (lumninance) texture data!");
  4194. }
  4195. if (formatFlags & DDPF_ALPHA) {
  4196. throw new Error("DDSParser does not support single-channel (alpha) texture data!");
  4197. }
  4198. throw new Error("DDSParser failed to load a texture file due to an unknown reason!");
  4199. }
  4200. var _a;
  4201. var _b;
  4202. var _c;
  4203. var FILE_IDENTIFIER = [171, 75, 84, 88, 32, 49, 49, 187, 13, 10, 26, 10];
  4204. var ENDIANNESS = 67305985;
  4205. var KTX_FIELDS = {
  4206. FILE_IDENTIFIER: 0,
  4207. ENDIANNESS: 12,
  4208. GL_TYPE: 16,
  4209. GL_TYPE_SIZE: 20,
  4210. GL_FORMAT: 24,
  4211. GL_INTERNAL_FORMAT: 28,
  4212. GL_BASE_INTERNAL_FORMAT: 32,
  4213. PIXEL_WIDTH: 36,
  4214. PIXEL_HEIGHT: 40,
  4215. PIXEL_DEPTH: 44,
  4216. NUMBER_OF_ARRAY_ELEMENTS: 48,
  4217. NUMBER_OF_FACES: 52,
  4218. NUMBER_OF_MIPMAP_LEVELS: 56,
  4219. BYTES_OF_KEY_VALUE_DATA: 60
  4220. };
  4221. var FILE_HEADER_SIZE = 64;
  4222. var TYPES_TO_BYTES_PER_COMPONENT = (_a = {}, _a[TYPES.UNSIGNED_BYTE] = 1, _a[TYPES.UNSIGNED_SHORT] = 2, _a[TYPES.INT] = 4, _a[TYPES.UNSIGNED_INT] = 4, _a[TYPES.FLOAT] = 4, _a[TYPES.HALF_FLOAT] = 8, _a);
  4223. var FORMATS_TO_COMPONENTS = (_b = {}, _b[FORMATS.RGBA] = 4, _b[FORMATS.RGB] = 3, _b[FORMATS.RG] = 2, _b[FORMATS.RED] = 1, _b[FORMATS.LUMINANCE] = 1, _b[FORMATS.LUMINANCE_ALPHA] = 2, _b[FORMATS.ALPHA] = 1, _b);
  4224. var TYPES_TO_BYTES_PER_PIXEL = (_c = {}, _c[TYPES.UNSIGNED_SHORT_4_4_4_4] = 2, _c[TYPES.UNSIGNED_SHORT_5_5_5_1] = 2, _c[TYPES.UNSIGNED_SHORT_5_6_5] = 2, _c);
  4225. function parseKTX(url2, arrayBuffer, loadKeyValueData) {
  4226. if (loadKeyValueData === void 0) {
  4227. loadKeyValueData = false;
  4228. }
  4229. var dataView = new DataView(arrayBuffer);
  4230. if (!validate(url2, dataView)) {
  4231. return null;
  4232. }
  4233. var littleEndian = dataView.getUint32(KTX_FIELDS.ENDIANNESS, true) === ENDIANNESS;
  4234. var glType = dataView.getUint32(KTX_FIELDS.GL_TYPE, littleEndian);
  4235. var glFormat = dataView.getUint32(KTX_FIELDS.GL_FORMAT, littleEndian);
  4236. var glInternalFormat = dataView.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT, littleEndian);
  4237. var pixelWidth = dataView.getUint32(KTX_FIELDS.PIXEL_WIDTH, littleEndian);
  4238. var pixelHeight = dataView.getUint32(KTX_FIELDS.PIXEL_HEIGHT, littleEndian) || 1;
  4239. var pixelDepth = dataView.getUint32(KTX_FIELDS.PIXEL_DEPTH, littleEndian) || 1;
  4240. var numberOfArrayElements = dataView.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS, littleEndian) || 1;
  4241. var numberOfFaces = dataView.getUint32(KTX_FIELDS.NUMBER_OF_FACES, littleEndian);
  4242. var numberOfMipmapLevels = dataView.getUint32(KTX_FIELDS.NUMBER_OF_MIPMAP_LEVELS, littleEndian);
  4243. var bytesOfKeyValueData = dataView.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA, littleEndian);
  4244. if (pixelHeight === 0 || pixelDepth !== 1) {
  4245. throw new Error("Only 2D textures are supported");
  4246. }
  4247. if (numberOfFaces !== 1) {
  4248. throw new Error("CubeTextures are not supported by KTXLoader yet!");
  4249. }
  4250. if (numberOfArrayElements !== 1) {
  4251. throw new Error("WebGL does not support array textures");
  4252. }
  4253. var blockWidth = 4;
  4254. var blockHeight = 4;
  4255. var alignedWidth = pixelWidth + 3 & ~3;
  4256. var alignedHeight = pixelHeight + 3 & ~3;
  4257. var imageBuffers = new Array(numberOfArrayElements);
  4258. var imagePixels = pixelWidth * pixelHeight;
  4259. if (glType === 0) {
  4260. imagePixels = alignedWidth * alignedHeight;
  4261. }
  4262. var imagePixelByteSize;
  4263. if (glType !== 0) {
  4264. if (TYPES_TO_BYTES_PER_COMPONENT[glType]) {
  4265. imagePixelByteSize = TYPES_TO_BYTES_PER_COMPONENT[glType] * FORMATS_TO_COMPONENTS[glFormat];
  4266. } else {
  4267. imagePixelByteSize = TYPES_TO_BYTES_PER_PIXEL[glType];
  4268. }
  4269. } else {
  4270. imagePixelByteSize = INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[glInternalFormat];
  4271. }
  4272. if (imagePixelByteSize === void 0) {
  4273. throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");
  4274. }
  4275. var kvData = loadKeyValueData ? parseKvData(dataView, bytesOfKeyValueData, littleEndian) : null;
  4276. var imageByteSize = imagePixels * imagePixelByteSize;
  4277. var mipByteSize = imageByteSize;
  4278. var mipWidth = pixelWidth;
  4279. var mipHeight = pixelHeight;
  4280. var alignedMipWidth = alignedWidth;
  4281. var alignedMipHeight = alignedHeight;
  4282. var imageOffset = FILE_HEADER_SIZE + bytesOfKeyValueData;
  4283. for (var mipmapLevel = 0; mipmapLevel < numberOfMipmapLevels; mipmapLevel++) {
  4284. var imageSize = dataView.getUint32(imageOffset, littleEndian);
  4285. var elementOffset = imageOffset + 4;
  4286. for (var arrayElement = 0; arrayElement < numberOfArrayElements; arrayElement++) {
  4287. var mips = imageBuffers[arrayElement];
  4288. if (!mips) {
  4289. mips = imageBuffers[arrayElement] = new Array(numberOfMipmapLevels);
  4290. }
  4291. mips[mipmapLevel] = {
  4292. levelID: mipmapLevel,
  4293. // don't align mipWidth when texture not compressed! (glType not zero)
  4294. levelWidth: numberOfMipmapLevels > 1 || glType !== 0 ? mipWidth : alignedMipWidth,
  4295. levelHeight: numberOfMipmapLevels > 1 || glType !== 0 ? mipHeight : alignedMipHeight,
  4296. levelBuffer: new Uint8Array(arrayBuffer, elementOffset, mipByteSize)
  4297. };
  4298. elementOffset += mipByteSize;
  4299. }
  4300. imageOffset += imageSize + 4;
  4301. imageOffset = imageOffset % 4 !== 0 ? imageOffset + 4 - imageOffset % 4 : imageOffset;
  4302. mipWidth = mipWidth >> 1 || 1;
  4303. mipHeight = mipHeight >> 1 || 1;
  4304. alignedMipWidth = mipWidth + blockWidth - 1 & ~(blockWidth - 1);
  4305. alignedMipHeight = mipHeight + blockHeight - 1 & ~(blockHeight - 1);
  4306. mipByteSize = alignedMipWidth * alignedMipHeight * imagePixelByteSize;
  4307. }
  4308. if (glType !== 0) {
  4309. return {
  4310. uncompressed: imageBuffers.map(function(levelBuffers) {
  4311. var buffer = levelBuffers[0].levelBuffer;
  4312. var convertToInt = false;
  4313. if (glType === TYPES.FLOAT) {
  4314. buffer = new Float32Array(levelBuffers[0].levelBuffer.buffer, levelBuffers[0].levelBuffer.byteOffset, levelBuffers[0].levelBuffer.byteLength / 4);
  4315. } else if (glType === TYPES.UNSIGNED_INT) {
  4316. convertToInt = true;
  4317. buffer = new Uint32Array(levelBuffers[0].levelBuffer.buffer, levelBuffers[0].levelBuffer.byteOffset, levelBuffers[0].levelBuffer.byteLength / 4);
  4318. } else if (glType === TYPES.INT) {
  4319. convertToInt = true;
  4320. buffer = new Int32Array(levelBuffers[0].levelBuffer.buffer, levelBuffers[0].levelBuffer.byteOffset, levelBuffers[0].levelBuffer.byteLength / 4);
  4321. }
  4322. return {
  4323. resource: new BufferResource(buffer, {
  4324. width: levelBuffers[0].levelWidth,
  4325. height: levelBuffers[0].levelHeight
  4326. }),
  4327. type: glType,
  4328. format: convertToInt ? convertFormatToInteger(glFormat) : glFormat
  4329. };
  4330. }),
  4331. kvData
  4332. };
  4333. }
  4334. return {
  4335. compressed: imageBuffers.map(function(levelBuffers) {
  4336. return new CompressedTextureResource(null, {
  4337. format: glInternalFormat,
  4338. width: pixelWidth,
  4339. height: pixelHeight,
  4340. levels: numberOfMipmapLevels,
  4341. levelBuffers
  4342. });
  4343. }),
  4344. kvData
  4345. };
  4346. }
  4347. function validate(url2, dataView) {
  4348. for (var i = 0; i < FILE_IDENTIFIER.length; i++) {
  4349. if (dataView.getUint8(i) !== FILE_IDENTIFIER[i]) {
  4350. console.error(url2 + " is not a valid *.ktx file!");
  4351. return false;
  4352. }
  4353. }
  4354. return true;
  4355. }
  4356. function convertFormatToInteger(format) {
  4357. switch (format) {
  4358. case FORMATS.RGBA:
  4359. return FORMATS.RGBA_INTEGER;
  4360. case FORMATS.RGB:
  4361. return FORMATS.RGB_INTEGER;
  4362. case FORMATS.RG:
  4363. return FORMATS.RG_INTEGER;
  4364. case FORMATS.RED:
  4365. return FORMATS.RED_INTEGER;
  4366. default:
  4367. return format;
  4368. }
  4369. }
  4370. function parseKvData(dataView, bytesOfKeyValueData, littleEndian) {
  4371. var kvData = /* @__PURE__ */ new Map();
  4372. var bytesIntoKeyValueData = 0;
  4373. while (bytesIntoKeyValueData < bytesOfKeyValueData) {
  4374. var keyAndValueByteSize = dataView.getUint32(FILE_HEADER_SIZE + bytesIntoKeyValueData, littleEndian);
  4375. var keyAndValueByteOffset = FILE_HEADER_SIZE + bytesIntoKeyValueData + 4;
  4376. var valuePadding = 3 - (keyAndValueByteSize + 3) % 4;
  4377. if (keyAndValueByteSize === 0 || keyAndValueByteSize > bytesOfKeyValueData - bytesIntoKeyValueData) {
  4378. console.error("KTXLoader: keyAndValueByteSize out of bounds");
  4379. break;
  4380. }
  4381. var keyNulByte = 0;
  4382. for (; keyNulByte < keyAndValueByteSize; keyNulByte++) {
  4383. if (dataView.getUint8(keyAndValueByteOffset + keyNulByte) === 0) {
  4384. break;
  4385. }
  4386. }
  4387. if (keyNulByte === -1) {
  4388. console.error("KTXLoader: Failed to find null byte terminating kvData key");
  4389. break;
  4390. }
  4391. var key = new TextDecoder().decode(new Uint8Array(dataView.buffer, keyAndValueByteOffset, keyNulByte));
  4392. var value = new DataView(dataView.buffer, keyAndValueByteOffset + keyNulByte + 1, keyAndValueByteSize - keyNulByte - 1);
  4393. kvData.set(key, value);
  4394. bytesIntoKeyValueData += 4 + keyAndValueByteSize + valuePadding;
  4395. }
  4396. return kvData;
  4397. }
  4398. LoaderResource.setExtensionXhrType("dds", LoaderResource.XHR_RESPONSE_TYPE.BUFFER);
  4399. var DDSLoader = (
  4400. /** @class */
  4401. (function() {
  4402. function DDSLoader2() {
  4403. }
  4404. DDSLoader2.use = function(resource, next) {
  4405. if (resource.extension === "dds" && resource.data) {
  4406. try {
  4407. Object.assign(resource, registerCompressedTextures(resource.name || resource.url, parseDDS(resource.data), resource.metadata));
  4408. } catch (err) {
  4409. next(err);
  4410. return;
  4411. }
  4412. }
  4413. next();
  4414. };
  4415. DDSLoader2.extension = ExtensionType.Loader;
  4416. return DDSLoader2;
  4417. })()
  4418. );
  4419. LoaderResource.setExtensionXhrType("ktx", LoaderResource.XHR_RESPONSE_TYPE.BUFFER);
  4420. var KTXLoader = (
  4421. /** @class */
  4422. (function() {
  4423. function KTXLoader2() {
  4424. }
  4425. KTXLoader2.use = function(resource, next) {
  4426. if (resource.extension === "ktx" && resource.data) {
  4427. try {
  4428. var url_1 = resource.name || resource.url;
  4429. var _a3 = parseKTX(url_1, resource.data, this.loadKeyValueData), compressed = _a3.compressed, uncompressed = _a3.uncompressed, kvData_1 = _a3.kvData;
  4430. if (compressed) {
  4431. var result = registerCompressedTextures(url_1, compressed, resource.metadata);
  4432. if (kvData_1 && result.textures) {
  4433. for (var textureId in result.textures) {
  4434. result.textures[textureId].baseTexture.ktxKeyValueData = kvData_1;
  4435. }
  4436. }
  4437. Object.assign(resource, result);
  4438. } else if (uncompressed) {
  4439. var textures_1 = {};
  4440. uncompressed.forEach(function(image, i) {
  4441. var texture = new Texture(new BaseTexture(image.resource, {
  4442. mipmap: MIPMAP_MODES.OFF,
  4443. alphaMode: ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,
  4444. type: image.type,
  4445. format: image.format
  4446. }));
  4447. var cacheID = url_1 + "-" + (i + 1);
  4448. if (kvData_1) {
  4449. texture.baseTexture.ktxKeyValueData = kvData_1;
  4450. }
  4451. BaseTexture.addToCache(texture.baseTexture, cacheID);
  4452. Texture.addToCache(texture, cacheID);
  4453. if (i === 0) {
  4454. textures_1[url_1] = texture;
  4455. BaseTexture.addToCache(texture.baseTexture, url_1);
  4456. Texture.addToCache(texture, url_1);
  4457. }
  4458. textures_1[cacheID] = texture;
  4459. });
  4460. Object.assign(resource, { textures: textures_1 });
  4461. }
  4462. } catch (err) {
  4463. next(err);
  4464. return;
  4465. }
  4466. }
  4467. next();
  4468. };
  4469. KTXLoader2.extension = ExtensionType.Loader;
  4470. KTXLoader2.loadKeyValueData = false;
  4471. return KTXLoader2;
  4472. })()
  4473. );
  4474. // node_modules/@pixi/particle-container/dist/esm/particle-container.mjs
  4475. var extendStatics3 = function(d, b) {
  4476. extendStatics3 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  4477. d2.__proto__ = b2;
  4478. } || function(d2, b2) {
  4479. for (var p in b2) {
  4480. if (b2.hasOwnProperty(p)) {
  4481. d2[p] = b2[p];
  4482. }
  4483. }
  4484. };
  4485. return extendStatics3(d, b);
  4486. };
  4487. function __extends3(d, b) {
  4488. extendStatics3(d, b);
  4489. function __() {
  4490. this.constructor = d;
  4491. }
  4492. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4493. }
  4494. var ParticleContainer = (
  4495. /** @class */
  4496. (function(_super) {
  4497. __extends3(ParticleContainer2, _super);
  4498. function ParticleContainer2(maxSize, properties, batchSize, autoResize) {
  4499. if (maxSize === void 0) {
  4500. maxSize = 1500;
  4501. }
  4502. if (batchSize === void 0) {
  4503. batchSize = 16384;
  4504. }
  4505. if (autoResize === void 0) {
  4506. autoResize = false;
  4507. }
  4508. var _this = _super.call(this) || this;
  4509. var maxBatchSize = 16384;
  4510. if (batchSize > maxBatchSize) {
  4511. batchSize = maxBatchSize;
  4512. }
  4513. _this._properties = [false, true, false, false, false];
  4514. _this._maxSize = maxSize;
  4515. _this._batchSize = batchSize;
  4516. _this._buffers = null;
  4517. _this._bufferUpdateIDs = [];
  4518. _this._updateID = 0;
  4519. _this.interactiveChildren = false;
  4520. _this.blendMode = BLEND_MODES.NORMAL;
  4521. _this.autoResize = autoResize;
  4522. _this.roundPixels = true;
  4523. _this.baseTexture = null;
  4524. _this.setProperties(properties);
  4525. _this._tint = 0;
  4526. _this.tintRgb = new Float32Array(4);
  4527. _this.tint = 16777215;
  4528. return _this;
  4529. }
  4530. ParticleContainer2.prototype.setProperties = function(properties) {
  4531. if (properties) {
  4532. this._properties[0] = "vertices" in properties || "scale" in properties ? !!properties.vertices || !!properties.scale : this._properties[0];
  4533. this._properties[1] = "position" in properties ? !!properties.position : this._properties[1];
  4534. this._properties[2] = "rotation" in properties ? !!properties.rotation : this._properties[2];
  4535. this._properties[3] = "uvs" in properties ? !!properties.uvs : this._properties[3];
  4536. this._properties[4] = "tint" in properties || "alpha" in properties ? !!properties.tint || !!properties.alpha : this._properties[4];
  4537. }
  4538. };
  4539. ParticleContainer2.prototype.updateTransform = function() {
  4540. this.displayObjectUpdateTransform();
  4541. };
  4542. Object.defineProperty(ParticleContainer2.prototype, "tint", {
  4543. /**
  4544. * The tint applied to the container. This is a hex value.
  4545. * A value of 0xFFFFFF will remove any tint effect.
  4546. * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.
  4547. * @default 0xFFFFFF
  4548. */
  4549. get: function() {
  4550. return this._tint;
  4551. },
  4552. set: function(value) {
  4553. this._tint = value;
  4554. hex2rgb(value, this.tintRgb);
  4555. },
  4556. enumerable: false,
  4557. configurable: true
  4558. });
  4559. ParticleContainer2.prototype.render = function(renderer) {
  4560. var _this = this;
  4561. if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) {
  4562. return;
  4563. }
  4564. if (!this.baseTexture) {
  4565. this.baseTexture = this.children[0]._texture.baseTexture;
  4566. if (!this.baseTexture.valid) {
  4567. this.baseTexture.once("update", function() {
  4568. return _this.onChildrenChange(0);
  4569. });
  4570. }
  4571. }
  4572. renderer.batch.setObjectRenderer(renderer.plugins.particle);
  4573. renderer.plugins.particle.render(this);
  4574. };
  4575. ParticleContainer2.prototype.onChildrenChange = function(smallestChildIndex) {
  4576. var bufferIndex = Math.floor(smallestChildIndex / this._batchSize);
  4577. while (this._bufferUpdateIDs.length < bufferIndex) {
  4578. this._bufferUpdateIDs.push(0);
  4579. }
  4580. this._bufferUpdateIDs[bufferIndex] = ++this._updateID;
  4581. };
  4582. ParticleContainer2.prototype.dispose = function() {
  4583. if (this._buffers) {
  4584. for (var i = 0; i < this._buffers.length; ++i) {
  4585. this._buffers[i].destroy();
  4586. }
  4587. this._buffers = null;
  4588. }
  4589. };
  4590. ParticleContainer2.prototype.destroy = function(options) {
  4591. _super.prototype.destroy.call(this, options);
  4592. this.dispose();
  4593. this._properties = null;
  4594. this._buffers = null;
  4595. this._bufferUpdateIDs = null;
  4596. };
  4597. return ParticleContainer2;
  4598. })(Container)
  4599. );
  4600. var ParticleBuffer = (
  4601. /** @class */
  4602. (function() {
  4603. function ParticleBuffer2(properties, dynamicPropertyFlags, size) {
  4604. this.geometry = new Geometry();
  4605. this.indexBuffer = null;
  4606. this.size = size;
  4607. this.dynamicProperties = [];
  4608. this.staticProperties = [];
  4609. for (var i = 0; i < properties.length; ++i) {
  4610. var property = properties[i];
  4611. property = {
  4612. attributeName: property.attributeName,
  4613. size: property.size,
  4614. uploadFunction: property.uploadFunction,
  4615. type: property.type || TYPES.FLOAT,
  4616. offset: property.offset
  4617. };
  4618. if (dynamicPropertyFlags[i]) {
  4619. this.dynamicProperties.push(property);
  4620. } else {
  4621. this.staticProperties.push(property);
  4622. }
  4623. }
  4624. this.staticStride = 0;
  4625. this.staticBuffer = null;
  4626. this.staticData = null;
  4627. this.staticDataUint32 = null;
  4628. this.dynamicStride = 0;
  4629. this.dynamicBuffer = null;
  4630. this.dynamicData = null;
  4631. this.dynamicDataUint32 = null;
  4632. this._updateID = 0;
  4633. this.initBuffers();
  4634. }
  4635. ParticleBuffer2.prototype.initBuffers = function() {
  4636. var geometry = this.geometry;
  4637. var dynamicOffset = 0;
  4638. this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);
  4639. geometry.addIndex(this.indexBuffer);
  4640. this.dynamicStride = 0;
  4641. for (var i = 0; i < this.dynamicProperties.length; ++i) {
  4642. var property = this.dynamicProperties[i];
  4643. property.offset = dynamicOffset;
  4644. dynamicOffset += property.size;
  4645. this.dynamicStride += property.size;
  4646. }
  4647. var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);
  4648. this.dynamicData = new Float32Array(dynBuffer);
  4649. this.dynamicDataUint32 = new Uint32Array(dynBuffer);
  4650. this.dynamicBuffer = new Buffer(this.dynamicData, false, false);
  4651. var staticOffset = 0;
  4652. this.staticStride = 0;
  4653. for (var i = 0; i < this.staticProperties.length; ++i) {
  4654. var property = this.staticProperties[i];
  4655. property.offset = staticOffset;
  4656. staticOffset += property.size;
  4657. this.staticStride += property.size;
  4658. }
  4659. var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);
  4660. this.staticData = new Float32Array(statBuffer);
  4661. this.staticDataUint32 = new Uint32Array(statBuffer);
  4662. this.staticBuffer = new Buffer(this.staticData, true, false);
  4663. for (var i = 0; i < this.dynamicProperties.length; ++i) {
  4664. var property = this.dynamicProperties[i];
  4665. geometry.addAttribute(property.attributeName, this.dynamicBuffer, 0, property.type === TYPES.UNSIGNED_BYTE, property.type, this.dynamicStride * 4, property.offset * 4);
  4666. }
  4667. for (var i = 0; i < this.staticProperties.length; ++i) {
  4668. var property = this.staticProperties[i];
  4669. geometry.addAttribute(property.attributeName, this.staticBuffer, 0, property.type === TYPES.UNSIGNED_BYTE, property.type, this.staticStride * 4, property.offset * 4);
  4670. }
  4671. };
  4672. ParticleBuffer2.prototype.uploadDynamic = function(children, startIndex, amount) {
  4673. for (var i = 0; i < this.dynamicProperties.length; i++) {
  4674. var property = this.dynamicProperties[i];
  4675. property.uploadFunction(children, startIndex, amount, property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset);
  4676. }
  4677. this.dynamicBuffer._updateID++;
  4678. };
  4679. ParticleBuffer2.prototype.uploadStatic = function(children, startIndex, amount) {
  4680. for (var i = 0; i < this.staticProperties.length; i++) {
  4681. var property = this.staticProperties[i];
  4682. property.uploadFunction(children, startIndex, amount, property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset);
  4683. }
  4684. this.staticBuffer._updateID++;
  4685. };
  4686. ParticleBuffer2.prototype.destroy = function() {
  4687. this.indexBuffer = null;
  4688. this.dynamicProperties = null;
  4689. this.dynamicBuffer = null;
  4690. this.dynamicData = null;
  4691. this.dynamicDataUint32 = null;
  4692. this.staticProperties = null;
  4693. this.staticBuffer = null;
  4694. this.staticData = null;
  4695. this.staticDataUint32 = null;
  4696. this.geometry.destroy();
  4697. };
  4698. return ParticleBuffer2;
  4699. })()
  4700. );
  4701. var fragment = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}";
  4702. var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n";
  4703. var ParticleRenderer = (
  4704. /** @class */
  4705. (function(_super) {
  4706. __extends3(ParticleRenderer2, _super);
  4707. function ParticleRenderer2(renderer) {
  4708. var _this = _super.call(this, renderer) || this;
  4709. _this.shader = null;
  4710. _this.properties = null;
  4711. _this.tempMatrix = new Matrix();
  4712. _this.properties = [
  4713. // verticesData
  4714. {
  4715. attributeName: "aVertexPosition",
  4716. size: 2,
  4717. uploadFunction: _this.uploadVertices,
  4718. offset: 0
  4719. },
  4720. // positionData
  4721. {
  4722. attributeName: "aPositionCoord",
  4723. size: 2,
  4724. uploadFunction: _this.uploadPosition,
  4725. offset: 0
  4726. },
  4727. // rotationData
  4728. {
  4729. attributeName: "aRotation",
  4730. size: 1,
  4731. uploadFunction: _this.uploadRotation,
  4732. offset: 0
  4733. },
  4734. // uvsData
  4735. {
  4736. attributeName: "aTextureCoord",
  4737. size: 2,
  4738. uploadFunction: _this.uploadUvs,
  4739. offset: 0
  4740. },
  4741. // tintData
  4742. {
  4743. attributeName: "aColor",
  4744. size: 1,
  4745. type: TYPES.UNSIGNED_BYTE,
  4746. uploadFunction: _this.uploadTint,
  4747. offset: 0
  4748. }
  4749. ];
  4750. _this.shader = Shader.from(vertex, fragment, {});
  4751. _this.state = State.for2d();
  4752. return _this;
  4753. }
  4754. ParticleRenderer2.prototype.render = function(container) {
  4755. var children = container.children;
  4756. var maxSize = container._maxSize;
  4757. var batchSize = container._batchSize;
  4758. var renderer = this.renderer;
  4759. var totalChildren = children.length;
  4760. if (totalChildren === 0) {
  4761. return;
  4762. } else if (totalChildren > maxSize && !container.autoResize) {
  4763. totalChildren = maxSize;
  4764. }
  4765. var buffers = container._buffers;
  4766. if (!buffers) {
  4767. buffers = container._buffers = this.generateBuffers(container);
  4768. }
  4769. var baseTexture = children[0]._texture.baseTexture;
  4770. var premultiplied = baseTexture.alphaMode > 0;
  4771. this.state.blendMode = correctBlendMode(container.blendMode, premultiplied);
  4772. renderer.state.set(this.state);
  4773. var gl = renderer.gl;
  4774. var m = container.worldTransform.copyTo(this.tempMatrix);
  4775. m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);
  4776. this.shader.uniforms.translationMatrix = m.toArray(true);
  4777. this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, premultiplied);
  4778. this.shader.uniforms.uSampler = baseTexture;
  4779. this.renderer.shader.bind(this.shader);
  4780. var updateStatic = false;
  4781. for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) {
  4782. var amount = totalChildren - i;
  4783. if (amount > batchSize) {
  4784. amount = batchSize;
  4785. }
  4786. if (j >= buffers.length) {
  4787. buffers.push(this._generateOneMoreBuffer(container));
  4788. }
  4789. var buffer = buffers[j];
  4790. buffer.uploadDynamic(children, i, amount);
  4791. var bid = container._bufferUpdateIDs[j] || 0;
  4792. updateStatic = updateStatic || buffer._updateID < bid;
  4793. if (updateStatic) {
  4794. buffer._updateID = container._updateID;
  4795. buffer.uploadStatic(children, i, amount);
  4796. }
  4797. renderer.geometry.bind(buffer.geometry);
  4798. gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);
  4799. }
  4800. };
  4801. ParticleRenderer2.prototype.generateBuffers = function(container) {
  4802. var buffers = [];
  4803. var size = container._maxSize;
  4804. var batchSize = container._batchSize;
  4805. var dynamicPropertyFlags = container._properties;
  4806. for (var i = 0; i < size; i += batchSize) {
  4807. buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));
  4808. }
  4809. return buffers;
  4810. };
  4811. ParticleRenderer2.prototype._generateOneMoreBuffer = function(container) {
  4812. var batchSize = container._batchSize;
  4813. var dynamicPropertyFlags = container._properties;
  4814. return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);
  4815. };
  4816. ParticleRenderer2.prototype.uploadVertices = function(children, startIndex, amount, array, stride, offset) {
  4817. var w0 = 0;
  4818. var w1 = 0;
  4819. var h0 = 0;
  4820. var h1 = 0;
  4821. for (var i = 0; i < amount; ++i) {
  4822. var sprite = children[startIndex + i];
  4823. var texture = sprite._texture;
  4824. var sx = sprite.scale.x;
  4825. var sy = sprite.scale.y;
  4826. var trim = texture.trim;
  4827. var orig = texture.orig;
  4828. if (trim) {
  4829. w1 = trim.x - sprite.anchor.x * orig.width;
  4830. w0 = w1 + trim.width;
  4831. h1 = trim.y - sprite.anchor.y * orig.height;
  4832. h0 = h1 + trim.height;
  4833. } else {
  4834. w0 = orig.width * (1 - sprite.anchor.x);
  4835. w1 = orig.width * -sprite.anchor.x;
  4836. h0 = orig.height * (1 - sprite.anchor.y);
  4837. h1 = orig.height * -sprite.anchor.y;
  4838. }
  4839. array[offset] = w1 * sx;
  4840. array[offset + 1] = h1 * sy;
  4841. array[offset + stride] = w0 * sx;
  4842. array[offset + stride + 1] = h1 * sy;
  4843. array[offset + stride * 2] = w0 * sx;
  4844. array[offset + stride * 2 + 1] = h0 * sy;
  4845. array[offset + stride * 3] = w1 * sx;
  4846. array[offset + stride * 3 + 1] = h0 * sy;
  4847. offset += stride * 4;
  4848. }
  4849. };
  4850. ParticleRenderer2.prototype.uploadPosition = function(children, startIndex, amount, array, stride, offset) {
  4851. for (var i = 0; i < amount; i++) {
  4852. var spritePosition = children[startIndex + i].position;
  4853. array[offset] = spritePosition.x;
  4854. array[offset + 1] = spritePosition.y;
  4855. array[offset + stride] = spritePosition.x;
  4856. array[offset + stride + 1] = spritePosition.y;
  4857. array[offset + stride * 2] = spritePosition.x;
  4858. array[offset + stride * 2 + 1] = spritePosition.y;
  4859. array[offset + stride * 3] = spritePosition.x;
  4860. array[offset + stride * 3 + 1] = spritePosition.y;
  4861. offset += stride * 4;
  4862. }
  4863. };
  4864. ParticleRenderer2.prototype.uploadRotation = function(children, startIndex, amount, array, stride, offset) {
  4865. for (var i = 0; i < amount; i++) {
  4866. var spriteRotation = children[startIndex + i].rotation;
  4867. array[offset] = spriteRotation;
  4868. array[offset + stride] = spriteRotation;
  4869. array[offset + stride * 2] = spriteRotation;
  4870. array[offset + stride * 3] = spriteRotation;
  4871. offset += stride * 4;
  4872. }
  4873. };
  4874. ParticleRenderer2.prototype.uploadUvs = function(children, startIndex, amount, array, stride, offset) {
  4875. for (var i = 0; i < amount; ++i) {
  4876. var textureUvs = children[startIndex + i]._texture._uvs;
  4877. if (textureUvs) {
  4878. array[offset] = textureUvs.x0;
  4879. array[offset + 1] = textureUvs.y0;
  4880. array[offset + stride] = textureUvs.x1;
  4881. array[offset + stride + 1] = textureUvs.y1;
  4882. array[offset + stride * 2] = textureUvs.x2;
  4883. array[offset + stride * 2 + 1] = textureUvs.y2;
  4884. array[offset + stride * 3] = textureUvs.x3;
  4885. array[offset + stride * 3 + 1] = textureUvs.y3;
  4886. offset += stride * 4;
  4887. } else {
  4888. array[offset] = 0;
  4889. array[offset + 1] = 0;
  4890. array[offset + stride] = 0;
  4891. array[offset + stride + 1] = 0;
  4892. array[offset + stride * 2] = 0;
  4893. array[offset + stride * 2 + 1] = 0;
  4894. array[offset + stride * 3] = 0;
  4895. array[offset + stride * 3 + 1] = 0;
  4896. offset += stride * 4;
  4897. }
  4898. }
  4899. };
  4900. ParticleRenderer2.prototype.uploadTint = function(children, startIndex, amount, array, stride, offset) {
  4901. for (var i = 0; i < amount; ++i) {
  4902. var sprite = children[startIndex + i];
  4903. var premultiplied = sprite._texture.baseTexture.alphaMode > 0;
  4904. var alpha = sprite.alpha;
  4905. var argb = alpha < 1 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);
  4906. array[offset] = argb;
  4907. array[offset + stride] = argb;
  4908. array[offset + stride * 2] = argb;
  4909. array[offset + stride * 3] = argb;
  4910. offset += stride * 4;
  4911. }
  4912. };
  4913. ParticleRenderer2.prototype.destroy = function() {
  4914. _super.prototype.destroy.call(this);
  4915. if (this.shader) {
  4916. this.shader.destroy();
  4917. this.shader = null;
  4918. }
  4919. this.tempMatrix = null;
  4920. };
  4921. ParticleRenderer2.extension = {
  4922. name: "particle",
  4923. type: ExtensionType.RendererPlugin
  4924. };
  4925. return ParticleRenderer2;
  4926. })(ObjectRenderer)
  4927. );
  4928. // node_modules/@pixi/graphics/dist/esm/graphics.mjs
  4929. var LINE_JOIN;
  4930. (function(LINE_JOIN2) {
  4931. LINE_JOIN2["MITER"] = "miter";
  4932. LINE_JOIN2["BEVEL"] = "bevel";
  4933. LINE_JOIN2["ROUND"] = "round";
  4934. })(LINE_JOIN || (LINE_JOIN = {}));
  4935. var LINE_CAP;
  4936. (function(LINE_CAP2) {
  4937. LINE_CAP2["BUTT"] = "butt";
  4938. LINE_CAP2["ROUND"] = "round";
  4939. LINE_CAP2["SQUARE"] = "square";
  4940. })(LINE_CAP || (LINE_CAP = {}));
  4941. var GRAPHICS_CURVES = {
  4942. adaptive: true,
  4943. maxLength: 10,
  4944. minSegments: 8,
  4945. maxSegments: 2048,
  4946. epsilon: 1e-4,
  4947. _segmentsCount: function(length, defaultSegments) {
  4948. if (defaultSegments === void 0) {
  4949. defaultSegments = 20;
  4950. }
  4951. if (!this.adaptive || !length || isNaN(length)) {
  4952. return defaultSegments;
  4953. }
  4954. var result = Math.ceil(length / this.maxLength);
  4955. if (result < this.minSegments) {
  4956. result = this.minSegments;
  4957. } else if (result > this.maxSegments) {
  4958. result = this.maxSegments;
  4959. }
  4960. return result;
  4961. }
  4962. };
  4963. var FillStyle = (
  4964. /** @class */
  4965. (function() {
  4966. function FillStyle2() {
  4967. this.color = 16777215;
  4968. this.alpha = 1;
  4969. this.texture = Texture.WHITE;
  4970. this.matrix = null;
  4971. this.visible = false;
  4972. this.reset();
  4973. }
  4974. FillStyle2.prototype.clone = function() {
  4975. var obj = new FillStyle2();
  4976. obj.color = this.color;
  4977. obj.alpha = this.alpha;
  4978. obj.texture = this.texture;
  4979. obj.matrix = this.matrix;
  4980. obj.visible = this.visible;
  4981. return obj;
  4982. };
  4983. FillStyle2.prototype.reset = function() {
  4984. this.color = 16777215;
  4985. this.alpha = 1;
  4986. this.texture = Texture.WHITE;
  4987. this.matrix = null;
  4988. this.visible = false;
  4989. };
  4990. FillStyle2.prototype.destroy = function() {
  4991. this.texture = null;
  4992. this.matrix = null;
  4993. };
  4994. return FillStyle2;
  4995. })()
  4996. );
  4997. var extendStatics4 = function(d, b) {
  4998. extendStatics4 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  4999. d2.__proto__ = b2;
  5000. } || function(d2, b2) {
  5001. for (var p in b2) {
  5002. if (b2.hasOwnProperty(p)) {
  5003. d2[p] = b2[p];
  5004. }
  5005. }
  5006. };
  5007. return extendStatics4(d, b);
  5008. };
  5009. function __extends4(d, b) {
  5010. extendStatics4(d, b);
  5011. function __() {
  5012. this.constructor = d;
  5013. }
  5014. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5015. }
  5016. function fixOrientation(points, hole) {
  5017. var _a3, _b2;
  5018. if (hole === void 0) {
  5019. hole = false;
  5020. }
  5021. var m = points.length;
  5022. if (m < 6) {
  5023. return;
  5024. }
  5025. var area = 0;
  5026. for (var i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
  5027. var x2 = points[i];
  5028. var y2 = points[i + 1];
  5029. area += (x2 - x1) * (y2 + y1);
  5030. x1 = x2;
  5031. y1 = y2;
  5032. }
  5033. if (!hole && area > 0 || hole && area <= 0) {
  5034. var n = m / 2;
  5035. for (var i = n + n % 2; i < m; i += 2) {
  5036. var i1 = m - i - 2;
  5037. var i2 = m - i - 1;
  5038. var i3 = i;
  5039. var i4 = i + 1;
  5040. _a3 = [points[i3], points[i1]], points[i1] = _a3[0], points[i3] = _a3[1];
  5041. _b2 = [points[i4], points[i2]], points[i2] = _b2[0], points[i4] = _b2[1];
  5042. }
  5043. }
  5044. }
  5045. var buildPoly = {
  5046. build: function(graphicsData) {
  5047. graphicsData.points = graphicsData.shape.points.slice();
  5048. },
  5049. triangulate: function(graphicsData, graphicsGeometry) {
  5050. var points = graphicsData.points;
  5051. var holes = graphicsData.holes;
  5052. var verts = graphicsGeometry.points;
  5053. var indices2 = graphicsGeometry.indices;
  5054. if (points.length >= 6) {
  5055. fixOrientation(points, false);
  5056. var holeArray = [];
  5057. for (var i = 0; i < holes.length; i++) {
  5058. var hole = holes[i];
  5059. fixOrientation(hole.points, true);
  5060. holeArray.push(points.length / 2);
  5061. points = points.concat(hole.points);
  5062. }
  5063. var triangles = (0, import_earcut.default)(points, holeArray, 2);
  5064. if (!triangles) {
  5065. return;
  5066. }
  5067. var vertPos = verts.length / 2;
  5068. for (var i = 0; i < triangles.length; i += 3) {
  5069. indices2.push(triangles[i] + vertPos);
  5070. indices2.push(triangles[i + 1] + vertPos);
  5071. indices2.push(triangles[i + 2] + vertPos);
  5072. }
  5073. for (var i = 0; i < points.length; i++) {
  5074. verts.push(points[i]);
  5075. }
  5076. }
  5077. }
  5078. };
  5079. var buildCircle = {
  5080. build: function(graphicsData) {
  5081. var points = graphicsData.points;
  5082. var x;
  5083. var y;
  5084. var dx;
  5085. var dy;
  5086. var rx;
  5087. var ry;
  5088. if (graphicsData.type === SHAPES.CIRC) {
  5089. var circle = graphicsData.shape;
  5090. x = circle.x;
  5091. y = circle.y;
  5092. rx = ry = circle.radius;
  5093. dx = dy = 0;
  5094. } else if (graphicsData.type === SHAPES.ELIP) {
  5095. var ellipse = graphicsData.shape;
  5096. x = ellipse.x;
  5097. y = ellipse.y;
  5098. rx = ellipse.width;
  5099. ry = ellipse.height;
  5100. dx = dy = 0;
  5101. } else {
  5102. var roundedRect = graphicsData.shape;
  5103. var halfWidth = roundedRect.width / 2;
  5104. var halfHeight = roundedRect.height / 2;
  5105. x = roundedRect.x + halfWidth;
  5106. y = roundedRect.y + halfHeight;
  5107. rx = ry = Math.max(0, Math.min(roundedRect.radius, Math.min(halfWidth, halfHeight)));
  5108. dx = halfWidth - rx;
  5109. dy = halfHeight - ry;
  5110. }
  5111. if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
  5112. points.length = 0;
  5113. return;
  5114. }
  5115. var n = Math.ceil(2.3 * Math.sqrt(rx + ry));
  5116. var m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
  5117. points.length = m;
  5118. if (m === 0) {
  5119. return;
  5120. }
  5121. if (n === 0) {
  5122. points.length = 8;
  5123. points[0] = points[6] = x + dx;
  5124. points[1] = points[3] = y + dy;
  5125. points[2] = points[4] = x - dx;
  5126. points[5] = points[7] = y - dy;
  5127. return;
  5128. }
  5129. var j1 = 0;
  5130. var j2 = n * 4 + (dx ? 2 : 0) + 2;
  5131. var j3 = j2;
  5132. var j4 = m;
  5133. {
  5134. var x0 = dx + rx;
  5135. var y0 = dy;
  5136. var x1 = x + x0;
  5137. var x2 = x - x0;
  5138. var y1 = y + y0;
  5139. points[j1++] = x1;
  5140. points[j1++] = y1;
  5141. points[--j2] = y1;
  5142. points[--j2] = x2;
  5143. if (dy) {
  5144. var y2 = y - y0;
  5145. points[j3++] = x2;
  5146. points[j3++] = y2;
  5147. points[--j4] = y2;
  5148. points[--j4] = x1;
  5149. }
  5150. }
  5151. for (var i = 1; i < n; i++) {
  5152. var a = Math.PI / 2 * (i / n);
  5153. var x0 = dx + Math.cos(a) * rx;
  5154. var y0 = dy + Math.sin(a) * ry;
  5155. var x1 = x + x0;
  5156. var x2 = x - x0;
  5157. var y1 = y + y0;
  5158. var y2 = y - y0;
  5159. points[j1++] = x1;
  5160. points[j1++] = y1;
  5161. points[--j2] = y1;
  5162. points[--j2] = x2;
  5163. points[j3++] = x2;
  5164. points[j3++] = y2;
  5165. points[--j4] = y2;
  5166. points[--j4] = x1;
  5167. }
  5168. {
  5169. var x0 = dx;
  5170. var y0 = dy + ry;
  5171. var x1 = x + x0;
  5172. var x2 = x - x0;
  5173. var y1 = y + y0;
  5174. var y2 = y - y0;
  5175. points[j1++] = x1;
  5176. points[j1++] = y1;
  5177. points[--j4] = y2;
  5178. points[--j4] = x1;
  5179. if (dx) {
  5180. points[j1++] = x2;
  5181. points[j1++] = y1;
  5182. points[--j4] = y2;
  5183. points[--j4] = x2;
  5184. }
  5185. }
  5186. },
  5187. triangulate: function(graphicsData, graphicsGeometry) {
  5188. var points = graphicsData.points;
  5189. var verts = graphicsGeometry.points;
  5190. var indices2 = graphicsGeometry.indices;
  5191. if (points.length === 0) {
  5192. return;
  5193. }
  5194. var vertPos = verts.length / 2;
  5195. var center = vertPos;
  5196. var x;
  5197. var y;
  5198. if (graphicsData.type !== SHAPES.RREC) {
  5199. var circle = graphicsData.shape;
  5200. x = circle.x;
  5201. y = circle.y;
  5202. } else {
  5203. var roundedRect = graphicsData.shape;
  5204. x = roundedRect.x + roundedRect.width / 2;
  5205. y = roundedRect.y + roundedRect.height / 2;
  5206. }
  5207. var matrix = graphicsData.matrix;
  5208. verts.push(graphicsData.matrix ? matrix.a * x + matrix.c * y + matrix.tx : x, graphicsData.matrix ? matrix.b * x + matrix.d * y + matrix.ty : y);
  5209. vertPos++;
  5210. verts.push(points[0], points[1]);
  5211. for (var i = 2; i < points.length; i += 2) {
  5212. verts.push(points[i], points[i + 1]);
  5213. indices2.push(vertPos++, center, vertPos);
  5214. }
  5215. indices2.push(center + 1, center, vertPos);
  5216. }
  5217. };
  5218. var buildRectangle = {
  5219. build: function(graphicsData) {
  5220. var rectData = graphicsData.shape;
  5221. var x = rectData.x;
  5222. var y = rectData.y;
  5223. var width = rectData.width;
  5224. var height = rectData.height;
  5225. var points = graphicsData.points;
  5226. points.length = 0;
  5227. points.push(x, y, x + width, y, x + width, y + height, x, y + height);
  5228. },
  5229. triangulate: function(graphicsData, graphicsGeometry) {
  5230. var points = graphicsData.points;
  5231. var verts = graphicsGeometry.points;
  5232. var vertPos = verts.length / 2;
  5233. verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]);
  5234. graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3);
  5235. }
  5236. };
  5237. function getPt(n1, n2, perc) {
  5238. var diff = n2 - n1;
  5239. return n1 + diff * perc;
  5240. }
  5241. function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) {
  5242. if (out === void 0) {
  5243. out = [];
  5244. }
  5245. var n = 20;
  5246. var points = out;
  5247. var xa = 0;
  5248. var ya = 0;
  5249. var xb = 0;
  5250. var yb = 0;
  5251. var x = 0;
  5252. var y = 0;
  5253. for (var i = 0, j = 0; i <= n; ++i) {
  5254. j = i / n;
  5255. xa = getPt(fromX, cpX, j);
  5256. ya = getPt(fromY, cpY, j);
  5257. xb = getPt(cpX, toX, j);
  5258. yb = getPt(cpY, toY, j);
  5259. x = getPt(xa, xb, j);
  5260. y = getPt(ya, yb, j);
  5261. if (i === 0 && points[points.length - 2] === x && points[points.length - 1] === y) {
  5262. continue;
  5263. }
  5264. points.push(x, y);
  5265. }
  5266. return points;
  5267. }
  5268. var buildRoundedRectangle = {
  5269. build: function(graphicsData) {
  5270. if (Graphics.nextRoundedRectBehavior) {
  5271. buildCircle.build(graphicsData);
  5272. return;
  5273. }
  5274. var rrectData = graphicsData.shape;
  5275. var points = graphicsData.points;
  5276. var x = rrectData.x;
  5277. var y = rrectData.y;
  5278. var width = rrectData.width;
  5279. var height = rrectData.height;
  5280. var radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));
  5281. points.length = 0;
  5282. if (!radius) {
  5283. points.push(x, y, x + width, y, x + width, y + height, x, y + height);
  5284. } else {
  5285. quadraticBezierCurve(x, y + radius, x, y, x + radius, y, points);
  5286. quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, points);
  5287. quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, points);
  5288. quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, points);
  5289. }
  5290. },
  5291. triangulate: function(graphicsData, graphicsGeometry) {
  5292. if (Graphics.nextRoundedRectBehavior) {
  5293. buildCircle.triangulate(graphicsData, graphicsGeometry);
  5294. return;
  5295. }
  5296. var points = graphicsData.points;
  5297. var verts = graphicsGeometry.points;
  5298. var indices2 = graphicsGeometry.indices;
  5299. var vecPos = verts.length / 2;
  5300. var triangles = (0, import_earcut.default)(points, null, 2);
  5301. for (var i = 0, j = triangles.length; i < j; i += 3) {
  5302. indices2.push(triangles[i] + vecPos);
  5303. indices2.push(triangles[i + 1] + vecPos);
  5304. indices2.push(triangles[i + 2] + vecPos);
  5305. }
  5306. for (var i = 0, j = points.length; i < j; i++) {
  5307. verts.push(points[i], points[++i]);
  5308. }
  5309. }
  5310. };
  5311. function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {
  5312. var ix = x - nx * innerWeight;
  5313. var iy = y - ny * innerWeight;
  5314. var ox = x + nx * outerWeight;
  5315. var oy = y + ny * outerWeight;
  5316. var exx;
  5317. var eyy;
  5318. if (clockwise) {
  5319. exx = ny;
  5320. eyy = -nx;
  5321. } else {
  5322. exx = -ny;
  5323. eyy = nx;
  5324. }
  5325. var eix = ix + exx;
  5326. var eiy = iy + eyy;
  5327. var eox = ox + exx;
  5328. var eoy = oy + eyy;
  5329. verts.push(eix, eiy);
  5330. verts.push(eox, eoy);
  5331. return 2;
  5332. }
  5333. function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
  5334. var cx2p0x = sx - cx;
  5335. var cy2p0y = sy - cy;
  5336. var angle0 = Math.atan2(cx2p0x, cy2p0y);
  5337. var angle1 = Math.atan2(ex - cx, ey - cy);
  5338. if (clockwise && angle0 < angle1) {
  5339. angle0 += Math.PI * 2;
  5340. } else if (!clockwise && angle0 > angle1) {
  5341. angle1 += Math.PI * 2;
  5342. }
  5343. var startAngle = angle0;
  5344. var angleDiff = angle1 - angle0;
  5345. var absAngleDiff = Math.abs(angleDiff);
  5346. var radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y);
  5347. var segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1;
  5348. var angleInc = angleDiff / segCount;
  5349. startAngle += angleInc;
  5350. if (clockwise) {
  5351. verts.push(cx, cy);
  5352. verts.push(sx, sy);
  5353. for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
  5354. verts.push(cx, cy);
  5355. verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
  5356. }
  5357. verts.push(cx, cy);
  5358. verts.push(ex, ey);
  5359. } else {
  5360. verts.push(sx, sy);
  5361. verts.push(cx, cy);
  5362. for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
  5363. verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
  5364. verts.push(cx, cy);
  5365. }
  5366. verts.push(ex, ey);
  5367. verts.push(cx, cy);
  5368. }
  5369. return segCount * 2;
  5370. }
  5371. function buildNonNativeLine(graphicsData, graphicsGeometry) {
  5372. var shape = graphicsData.shape;
  5373. var points = graphicsData.points || shape.points.slice();
  5374. var eps = graphicsGeometry.closePointEps;
  5375. if (points.length === 0) {
  5376. return;
  5377. }
  5378. var style = graphicsData.lineStyle;
  5379. var firstPoint = new Point(points[0], points[1]);
  5380. var lastPoint = new Point(points[points.length - 2], points[points.length - 1]);
  5381. var closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;
  5382. var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
  5383. if (closedShape) {
  5384. points = points.slice();
  5385. if (closedPath) {
  5386. points.pop();
  5387. points.pop();
  5388. lastPoint.set(points[points.length - 2], points[points.length - 1]);
  5389. }
  5390. var midPointX = (firstPoint.x + lastPoint.x) * 0.5;
  5391. var midPointY = (lastPoint.y + firstPoint.y) * 0.5;
  5392. points.unshift(midPointX, midPointY);
  5393. points.push(midPointX, midPointY);
  5394. }
  5395. var verts = graphicsGeometry.points;
  5396. var length = points.length / 2;
  5397. var indexCount = points.length;
  5398. var indexStart = verts.length / 2;
  5399. var width = style.width / 2;
  5400. var widthSquared = width * width;
  5401. var miterLimitSquared = style.miterLimit * style.miterLimit;
  5402. var x0 = points[0];
  5403. var y0 = points[1];
  5404. var x1 = points[2];
  5405. var y1 = points[3];
  5406. var x2 = 0;
  5407. var y2 = 0;
  5408. var perpx = -(y0 - y1);
  5409. var perpy = x0 - x1;
  5410. var perp1x = 0;
  5411. var perp1y = 0;
  5412. var dist = Math.sqrt(perpx * perpx + perpy * perpy);
  5413. perpx /= dist;
  5414. perpy /= dist;
  5415. perpx *= width;
  5416. perpy *= width;
  5417. var ratio = style.alignment;
  5418. var innerWeight = (1 - ratio) * 2;
  5419. var outerWeight = ratio * 2;
  5420. if (!closedShape) {
  5421. if (style.cap === LINE_CAP.ROUND) {
  5422. indexCount += round(x0 - perpx * (innerWeight - outerWeight) * 0.5, y0 - perpy * (innerWeight - outerWeight) * 0.5, x0 - perpx * innerWeight, y0 - perpy * innerWeight, x0 + perpx * outerWeight, y0 + perpy * outerWeight, verts, true) + 2;
  5423. } else if (style.cap === LINE_CAP.SQUARE) {
  5424. indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);
  5425. }
  5426. }
  5427. verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight);
  5428. verts.push(x0 + perpx * outerWeight, y0 + perpy * outerWeight);
  5429. for (var i = 1; i < length - 1; ++i) {
  5430. x0 = points[(i - 1) * 2];
  5431. y0 = points[(i - 1) * 2 + 1];
  5432. x1 = points[i * 2];
  5433. y1 = points[i * 2 + 1];
  5434. x2 = points[(i + 1) * 2];
  5435. y2 = points[(i + 1) * 2 + 1];
  5436. perpx = -(y0 - y1);
  5437. perpy = x0 - x1;
  5438. dist = Math.sqrt(perpx * perpx + perpy * perpy);
  5439. perpx /= dist;
  5440. perpy /= dist;
  5441. perpx *= width;
  5442. perpy *= width;
  5443. perp1x = -(y1 - y2);
  5444. perp1y = x1 - x2;
  5445. dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);
  5446. perp1x /= dist;
  5447. perp1y /= dist;
  5448. perp1x *= width;
  5449. perp1y *= width;
  5450. var dx0 = x1 - x0;
  5451. var dy0 = y0 - y1;
  5452. var dx1 = x1 - x2;
  5453. var dy1 = y2 - y1;
  5454. var dot = dx0 * dx1 + dy0 * dy1;
  5455. var cross = dy0 * dx1 - dy1 * dx0;
  5456. var clockwise = cross < 0;
  5457. if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
  5458. verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
  5459. verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
  5460. if (dot >= 0) {
  5461. if (style.join === LINE_JOIN.ROUND) {
  5462. indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
  5463. } else {
  5464. indexCount += 2;
  5465. }
  5466. verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight);
  5467. verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
  5468. }
  5469. continue;
  5470. }
  5471. var c1 = (-perpx + x0) * (-perpy + y1) - (-perpx + x1) * (-perpy + y0);
  5472. var c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2);
  5473. var px = (dx0 * c2 - dx1 * c1) / cross;
  5474. var py = (dy1 * c1 - dy0 * c2) / cross;
  5475. var pdist = (px - x1) * (px - x1) + (py - y1) * (py - y1);
  5476. var imx = x1 + (px - x1) * innerWeight;
  5477. var imy = y1 + (py - y1) * innerWeight;
  5478. var omx = x1 - (px - x1) * outerWeight;
  5479. var omy = y1 - (py - y1) * outerWeight;
  5480. var smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1);
  5481. var insideWeight = clockwise ? innerWeight : outerWeight;
  5482. var smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
  5483. var insideMiterOk = pdist <= smallerInsideDiagonalSq;
  5484. if (insideMiterOk) {
  5485. if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) {
  5486. if (clockwise) {
  5487. verts.push(imx, imy);
  5488. verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
  5489. verts.push(imx, imy);
  5490. verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
  5491. } else {
  5492. verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
  5493. verts.push(omx, omy);
  5494. verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
  5495. verts.push(omx, omy);
  5496. }
  5497. indexCount += 2;
  5498. } else if (style.join === LINE_JOIN.ROUND) {
  5499. if (clockwise) {
  5500. verts.push(imx, imy);
  5501. verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
  5502. indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
  5503. verts.push(imx, imy);
  5504. verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
  5505. } else {
  5506. verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
  5507. verts.push(omx, omy);
  5508. indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
  5509. verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
  5510. verts.push(omx, omy);
  5511. }
  5512. } else {
  5513. verts.push(imx, imy);
  5514. verts.push(omx, omy);
  5515. }
  5516. } else {
  5517. verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
  5518. verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
  5519. if (style.join === LINE_JOIN.ROUND) {
  5520. if (clockwise) {
  5521. indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
  5522. } else {
  5523. indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
  5524. }
  5525. } else if (style.join === LINE_JOIN.MITER && pdist / widthSquared <= miterLimitSquared) {
  5526. if (clockwise) {
  5527. verts.push(omx, omy);
  5528. verts.push(omx, omy);
  5529. } else {
  5530. verts.push(imx, imy);
  5531. verts.push(imx, imy);
  5532. }
  5533. indexCount += 2;
  5534. }
  5535. verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
  5536. verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
  5537. indexCount += 2;
  5538. }
  5539. }
  5540. x0 = points[(length - 2) * 2];
  5541. y0 = points[(length - 2) * 2 + 1];
  5542. x1 = points[(length - 1) * 2];
  5543. y1 = points[(length - 1) * 2 + 1];
  5544. perpx = -(y0 - y1);
  5545. perpy = x0 - x1;
  5546. dist = Math.sqrt(perpx * perpx + perpy * perpy);
  5547. perpx /= dist;
  5548. perpy /= dist;
  5549. perpx *= width;
  5550. perpy *= width;
  5551. verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
  5552. verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
  5553. if (!closedShape) {
  5554. if (style.cap === LINE_CAP.ROUND) {
  5555. indexCount += round(x1 - perpx * (innerWeight - outerWeight) * 0.5, y1 - perpy * (innerWeight - outerWeight) * 0.5, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight, verts, false) + 2;
  5556. } else if (style.cap === LINE_CAP.SQUARE) {
  5557. indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);
  5558. }
  5559. }
  5560. var indices2 = graphicsGeometry.indices;
  5561. var eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;
  5562. for (var i = indexStart; i < indexCount + indexStart - 2; ++i) {
  5563. x0 = verts[i * 2];
  5564. y0 = verts[i * 2 + 1];
  5565. x1 = verts[(i + 1) * 2];
  5566. y1 = verts[(i + 1) * 2 + 1];
  5567. x2 = verts[(i + 2) * 2];
  5568. y2 = verts[(i + 2) * 2 + 1];
  5569. if (Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) {
  5570. continue;
  5571. }
  5572. indices2.push(i, i + 1, i + 2);
  5573. }
  5574. }
  5575. function buildNativeLine(graphicsData, graphicsGeometry) {
  5576. var i = 0;
  5577. var shape = graphicsData.shape;
  5578. var points = graphicsData.points || shape.points;
  5579. var closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;
  5580. if (points.length === 0) {
  5581. return;
  5582. }
  5583. var verts = graphicsGeometry.points;
  5584. var indices2 = graphicsGeometry.indices;
  5585. var length = points.length / 2;
  5586. var startIndex = verts.length / 2;
  5587. var currentIndex = startIndex;
  5588. verts.push(points[0], points[1]);
  5589. for (i = 1; i < length; i++) {
  5590. verts.push(points[i * 2], points[i * 2 + 1]);
  5591. indices2.push(currentIndex, currentIndex + 1);
  5592. currentIndex++;
  5593. }
  5594. if (closedShape) {
  5595. indices2.push(currentIndex, startIndex);
  5596. }
  5597. }
  5598. function buildLine(graphicsData, graphicsGeometry) {
  5599. if (graphicsData.lineStyle.native) {
  5600. buildNativeLine(graphicsData, graphicsGeometry);
  5601. } else {
  5602. buildNonNativeLine(graphicsData, graphicsGeometry);
  5603. }
  5604. }
  5605. var ArcUtils = (
  5606. /** @class */
  5607. (function() {
  5608. function ArcUtils2() {
  5609. }
  5610. ArcUtils2.curveTo = function(x1, y1, x2, y2, radius, points) {
  5611. var fromX = points[points.length - 2];
  5612. var fromY = points[points.length - 1];
  5613. var a1 = fromY - y1;
  5614. var b1 = fromX - x1;
  5615. var a2 = y2 - y1;
  5616. var b2 = x2 - x1;
  5617. var mm = Math.abs(a1 * b2 - b1 * a2);
  5618. if (mm < 1e-8 || radius === 0) {
  5619. if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) {
  5620. points.push(x1, y1);
  5621. }
  5622. return null;
  5623. }
  5624. var dd = a1 * a1 + b1 * b1;
  5625. var cc = a2 * a2 + b2 * b2;
  5626. var tt = a1 * a2 + b1 * b2;
  5627. var k1 = radius * Math.sqrt(dd) / mm;
  5628. var k2 = radius * Math.sqrt(cc) / mm;
  5629. var j1 = k1 * tt / dd;
  5630. var j2 = k2 * tt / cc;
  5631. var cx = k1 * b2 + k2 * b1;
  5632. var cy = k1 * a2 + k2 * a1;
  5633. var px = b1 * (k2 + j1);
  5634. var py = a1 * (k2 + j1);
  5635. var qx = b2 * (k1 + j2);
  5636. var qy = a2 * (k1 + j2);
  5637. var startAngle = Math.atan2(py - cy, px - cx);
  5638. var endAngle = Math.atan2(qy - cy, qx - cx);
  5639. return {
  5640. cx: cx + x1,
  5641. cy: cy + y1,
  5642. radius,
  5643. startAngle,
  5644. endAngle,
  5645. anticlockwise: b1 * a2 > b2 * a1
  5646. };
  5647. };
  5648. ArcUtils2.arc = function(_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) {
  5649. var sweep = endAngle - startAngle;
  5650. var n = GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / PI_2) * 40);
  5651. var theta = sweep / (n * 2);
  5652. var theta2 = theta * 2;
  5653. var cTheta = Math.cos(theta);
  5654. var sTheta = Math.sin(theta);
  5655. var segMinus = n - 1;
  5656. var remainder = segMinus % 1 / segMinus;
  5657. for (var i = 0; i <= segMinus; ++i) {
  5658. var real = i + remainder * i;
  5659. var angle = theta + startAngle + theta2 * real;
  5660. var c = Math.cos(angle);
  5661. var s = -Math.sin(angle);
  5662. points.push((cTheta * c + sTheta * s) * radius + cx, (cTheta * -s + sTheta * c) * radius + cy);
  5663. }
  5664. };
  5665. return ArcUtils2;
  5666. })()
  5667. );
  5668. var BezierUtils = (
  5669. /** @class */
  5670. (function() {
  5671. function BezierUtils2() {
  5672. }
  5673. BezierUtils2.curveLength = function(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {
  5674. var n = 10;
  5675. var result = 0;
  5676. var t = 0;
  5677. var t2 = 0;
  5678. var t3 = 0;
  5679. var nt = 0;
  5680. var nt2 = 0;
  5681. var nt3 = 0;
  5682. var x = 0;
  5683. var y = 0;
  5684. var dx = 0;
  5685. var dy = 0;
  5686. var prevX = fromX;
  5687. var prevY = fromY;
  5688. for (var i = 1; i <= n; ++i) {
  5689. t = i / n;
  5690. t2 = t * t;
  5691. t3 = t2 * t;
  5692. nt = 1 - t;
  5693. nt2 = nt * nt;
  5694. nt3 = nt2 * nt;
  5695. x = nt3 * fromX + 3 * nt2 * t * cpX + 3 * nt * t2 * cpX2 + t3 * toX;
  5696. y = nt3 * fromY + 3 * nt2 * t * cpY + 3 * nt * t2 * cpY2 + t3 * toY;
  5697. dx = prevX - x;
  5698. dy = prevY - y;
  5699. prevX = x;
  5700. prevY = y;
  5701. result += Math.sqrt(dx * dx + dy * dy);
  5702. }
  5703. return result;
  5704. };
  5705. BezierUtils2.curveTo = function(cpX, cpY, cpX2, cpY2, toX, toY, points) {
  5706. var fromX = points[points.length - 2];
  5707. var fromY = points[points.length - 1];
  5708. points.length -= 2;
  5709. var n = GRAPHICS_CURVES._segmentsCount(BezierUtils2.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY));
  5710. var dt = 0;
  5711. var dt2 = 0;
  5712. var dt3 = 0;
  5713. var t2 = 0;
  5714. var t3 = 0;
  5715. points.push(fromX, fromY);
  5716. for (var i = 1, j = 0; i <= n; ++i) {
  5717. j = i / n;
  5718. dt = 1 - j;
  5719. dt2 = dt * dt;
  5720. dt3 = dt2 * dt;
  5721. t2 = j * j;
  5722. t3 = t2 * j;
  5723. points.push(dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX, dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY);
  5724. }
  5725. };
  5726. return BezierUtils2;
  5727. })()
  5728. );
  5729. var QuadraticUtils = (
  5730. /** @class */
  5731. (function() {
  5732. function QuadraticUtils2() {
  5733. }
  5734. QuadraticUtils2.curveLength = function(fromX, fromY, cpX, cpY, toX, toY) {
  5735. var ax = fromX - 2 * cpX + toX;
  5736. var ay = fromY - 2 * cpY + toY;
  5737. var bx = 2 * cpX - 2 * fromX;
  5738. var by = 2 * cpY - 2 * fromY;
  5739. var a = 4 * (ax * ax + ay * ay);
  5740. var b = 4 * (ax * bx + ay * by);
  5741. var c = bx * bx + by * by;
  5742. var s = 2 * Math.sqrt(a + b + c);
  5743. var a2 = Math.sqrt(a);
  5744. var a32 = 2 * a * a2;
  5745. var c2 = 2 * Math.sqrt(c);
  5746. var ba = b / a2;
  5747. return (a32 * s + a2 * b * (s - c2) + (4 * c * a - b * b) * Math.log((2 * a2 + ba + s) / (ba + c2))) / (4 * a32);
  5748. };
  5749. QuadraticUtils2.curveTo = function(cpX, cpY, toX, toY, points) {
  5750. var fromX = points[points.length - 2];
  5751. var fromY = points[points.length - 1];
  5752. var n = GRAPHICS_CURVES._segmentsCount(QuadraticUtils2.curveLength(fromX, fromY, cpX, cpY, toX, toY));
  5753. var xa = 0;
  5754. var ya = 0;
  5755. for (var i = 1; i <= n; ++i) {
  5756. var j = i / n;
  5757. xa = fromX + (cpX - fromX) * j;
  5758. ya = fromY + (cpY - fromY) * j;
  5759. points.push(xa + (cpX + (toX - cpX) * j - xa) * j, ya + (cpY + (toY - cpY) * j - ya) * j);
  5760. }
  5761. };
  5762. return QuadraticUtils2;
  5763. })()
  5764. );
  5765. var BatchPart = (
  5766. /** @class */
  5767. (function() {
  5768. function BatchPart2() {
  5769. this.reset();
  5770. }
  5771. BatchPart2.prototype.begin = function(style, startIndex, attribStart) {
  5772. this.reset();
  5773. this.style = style;
  5774. this.start = startIndex;
  5775. this.attribStart = attribStart;
  5776. };
  5777. BatchPart2.prototype.end = function(endIndex, endAttrib) {
  5778. this.attribSize = endAttrib - this.attribStart;
  5779. this.size = endIndex - this.start;
  5780. };
  5781. BatchPart2.prototype.reset = function() {
  5782. this.style = null;
  5783. this.size = 0;
  5784. this.start = 0;
  5785. this.attribStart = 0;
  5786. this.attribSize = 0;
  5787. };
  5788. return BatchPart2;
  5789. })()
  5790. );
  5791. var _a2;
  5792. var FILL_COMMANDS = (_a2 = {}, _a2[SHAPES.POLY] = buildPoly, _a2[SHAPES.CIRC] = buildCircle, _a2[SHAPES.ELIP] = buildCircle, _a2[SHAPES.RECT] = buildRectangle, _a2[SHAPES.RREC] = buildRoundedRectangle, _a2);
  5793. var BATCH_POOL = [];
  5794. var DRAW_CALL_POOL = [];
  5795. var GraphicsData = (
  5796. /** @class */
  5797. (function() {
  5798. function GraphicsData2(shape, fillStyle, lineStyle, matrix) {
  5799. if (fillStyle === void 0) {
  5800. fillStyle = null;
  5801. }
  5802. if (lineStyle === void 0) {
  5803. lineStyle = null;
  5804. }
  5805. if (matrix === void 0) {
  5806. matrix = null;
  5807. }
  5808. this.points = [];
  5809. this.holes = [];
  5810. this.shape = shape;
  5811. this.lineStyle = lineStyle;
  5812. this.fillStyle = fillStyle;
  5813. this.matrix = matrix;
  5814. this.type = shape.type;
  5815. }
  5816. GraphicsData2.prototype.clone = function() {
  5817. return new GraphicsData2(this.shape, this.fillStyle, this.lineStyle, this.matrix);
  5818. };
  5819. GraphicsData2.prototype.destroy = function() {
  5820. this.shape = null;
  5821. this.holes.length = 0;
  5822. this.holes = null;
  5823. this.points.length = 0;
  5824. this.points = null;
  5825. this.lineStyle = null;
  5826. this.fillStyle = null;
  5827. };
  5828. return GraphicsData2;
  5829. })()
  5830. );
  5831. var tmpPoint = new Point();
  5832. var GraphicsGeometry = (
  5833. /** @class */
  5834. (function(_super) {
  5835. __extends4(GraphicsGeometry2, _super);
  5836. function GraphicsGeometry2() {
  5837. var _this = _super.call(this) || this;
  5838. _this.closePointEps = 1e-4;
  5839. _this.boundsPadding = 0;
  5840. _this.uvsFloat32 = null;
  5841. _this.indicesUint16 = null;
  5842. _this.batchable = false;
  5843. _this.points = [];
  5844. _this.colors = [];
  5845. _this.uvs = [];
  5846. _this.indices = [];
  5847. _this.textureIds = [];
  5848. _this.graphicsData = [];
  5849. _this.drawCalls = [];
  5850. _this.batchDirty = -1;
  5851. _this.batches = [];
  5852. _this.dirty = 0;
  5853. _this.cacheDirty = -1;
  5854. _this.clearDirty = 0;
  5855. _this.shapeIndex = 0;
  5856. _this._bounds = new Bounds();
  5857. _this.boundsDirty = -1;
  5858. return _this;
  5859. }
  5860. Object.defineProperty(GraphicsGeometry2.prototype, "bounds", {
  5861. /**
  5862. * Get the current bounds of the graphic geometry.
  5863. * @readonly
  5864. */
  5865. get: function() {
  5866. this.updateBatches();
  5867. if (this.boundsDirty !== this.dirty) {
  5868. this.boundsDirty = this.dirty;
  5869. this.calculateBounds();
  5870. }
  5871. return this._bounds;
  5872. },
  5873. enumerable: false,
  5874. configurable: true
  5875. });
  5876. GraphicsGeometry2.prototype.invalidate = function() {
  5877. this.boundsDirty = -1;
  5878. this.dirty++;
  5879. this.batchDirty++;
  5880. this.shapeIndex = 0;
  5881. this.points.length = 0;
  5882. this.colors.length = 0;
  5883. this.uvs.length = 0;
  5884. this.indices.length = 0;
  5885. this.textureIds.length = 0;
  5886. for (var i = 0; i < this.drawCalls.length; i++) {
  5887. this.drawCalls[i].texArray.clear();
  5888. DRAW_CALL_POOL.push(this.drawCalls[i]);
  5889. }
  5890. this.drawCalls.length = 0;
  5891. for (var i = 0; i < this.batches.length; i++) {
  5892. var batchPart = this.batches[i];
  5893. batchPart.reset();
  5894. BATCH_POOL.push(batchPart);
  5895. }
  5896. this.batches.length = 0;
  5897. };
  5898. GraphicsGeometry2.prototype.clear = function() {
  5899. if (this.graphicsData.length > 0) {
  5900. this.invalidate();
  5901. this.clearDirty++;
  5902. this.graphicsData.length = 0;
  5903. }
  5904. return this;
  5905. };
  5906. GraphicsGeometry2.prototype.drawShape = function(shape, fillStyle, lineStyle, matrix) {
  5907. if (fillStyle === void 0) {
  5908. fillStyle = null;
  5909. }
  5910. if (lineStyle === void 0) {
  5911. lineStyle = null;
  5912. }
  5913. if (matrix === void 0) {
  5914. matrix = null;
  5915. }
  5916. var data = new GraphicsData(shape, fillStyle, lineStyle, matrix);
  5917. this.graphicsData.push(data);
  5918. this.dirty++;
  5919. return this;
  5920. };
  5921. GraphicsGeometry2.prototype.drawHole = function(shape, matrix) {
  5922. if (matrix === void 0) {
  5923. matrix = null;
  5924. }
  5925. if (!this.graphicsData.length) {
  5926. return null;
  5927. }
  5928. var data = new GraphicsData(shape, null, null, matrix);
  5929. var lastShape = this.graphicsData[this.graphicsData.length - 1];
  5930. data.lineStyle = lastShape.lineStyle;
  5931. lastShape.holes.push(data);
  5932. this.dirty++;
  5933. return this;
  5934. };
  5935. GraphicsGeometry2.prototype.destroy = function() {
  5936. _super.prototype.destroy.call(this);
  5937. for (var i = 0; i < this.graphicsData.length; ++i) {
  5938. this.graphicsData[i].destroy();
  5939. }
  5940. this.points.length = 0;
  5941. this.points = null;
  5942. this.colors.length = 0;
  5943. this.colors = null;
  5944. this.uvs.length = 0;
  5945. this.uvs = null;
  5946. this.indices.length = 0;
  5947. this.indices = null;
  5948. this.indexBuffer.destroy();
  5949. this.indexBuffer = null;
  5950. this.graphicsData.length = 0;
  5951. this.graphicsData = null;
  5952. this.drawCalls.length = 0;
  5953. this.drawCalls = null;
  5954. this.batches.length = 0;
  5955. this.batches = null;
  5956. this._bounds = null;
  5957. };
  5958. GraphicsGeometry2.prototype.containsPoint = function(point) {
  5959. var graphicsData = this.graphicsData;
  5960. for (var i = 0; i < graphicsData.length; ++i) {
  5961. var data = graphicsData[i];
  5962. if (!data.fillStyle.visible) {
  5963. continue;
  5964. }
  5965. if (data.shape) {
  5966. if (data.matrix) {
  5967. data.matrix.applyInverse(point, tmpPoint);
  5968. } else {
  5969. tmpPoint.copyFrom(point);
  5970. }
  5971. if (data.shape.contains(tmpPoint.x, tmpPoint.y)) {
  5972. var hitHole = false;
  5973. if (data.holes) {
  5974. for (var i_1 = 0; i_1 < data.holes.length; i_1++) {
  5975. var hole = data.holes[i_1];
  5976. if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) {
  5977. hitHole = true;
  5978. break;
  5979. }
  5980. }
  5981. }
  5982. if (!hitHole) {
  5983. return true;
  5984. }
  5985. }
  5986. }
  5987. }
  5988. return false;
  5989. };
  5990. GraphicsGeometry2.prototype.updateBatches = function() {
  5991. if (!this.graphicsData.length) {
  5992. this.batchable = true;
  5993. return;
  5994. }
  5995. if (!this.validateBatching()) {
  5996. return;
  5997. }
  5998. this.cacheDirty = this.dirty;
  5999. var uvs = this.uvs;
  6000. var graphicsData = this.graphicsData;
  6001. var batchPart = null;
  6002. var currentStyle = null;
  6003. if (this.batches.length > 0) {
  6004. batchPart = this.batches[this.batches.length - 1];
  6005. currentStyle = batchPart.style;
  6006. }
  6007. for (var i = this.shapeIndex; i < graphicsData.length; i++) {
  6008. this.shapeIndex++;
  6009. var data = graphicsData[i];
  6010. var fillStyle = data.fillStyle;
  6011. var lineStyle = data.lineStyle;
  6012. var command = FILL_COMMANDS[data.type];
  6013. command.build(data);
  6014. if (data.matrix) {
  6015. this.transformPoints(data.points, data.matrix);
  6016. }
  6017. if (fillStyle.visible || lineStyle.visible) {
  6018. this.processHoles(data.holes);
  6019. }
  6020. for (var j = 0; j < 2; j++) {
  6021. var style = j === 0 ? fillStyle : lineStyle;
  6022. if (!style.visible) {
  6023. continue;
  6024. }
  6025. var nextTexture = style.texture.baseTexture;
  6026. var index_1 = this.indices.length;
  6027. var attribIndex = this.points.length / 2;
  6028. nextTexture.wrapMode = WRAP_MODES.REPEAT;
  6029. if (j === 0) {
  6030. this.processFill(data);
  6031. } else {
  6032. this.processLine(data);
  6033. }
  6034. var size = this.points.length / 2 - attribIndex;
  6035. if (size === 0) {
  6036. continue;
  6037. }
  6038. if (batchPart && !this._compareStyles(currentStyle, style)) {
  6039. batchPart.end(index_1, attribIndex);
  6040. batchPart = null;
  6041. }
  6042. if (!batchPart) {
  6043. batchPart = BATCH_POOL.pop() || new BatchPart();
  6044. batchPart.begin(style, index_1, attribIndex);
  6045. this.batches.push(batchPart);
  6046. currentStyle = style;
  6047. }
  6048. this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);
  6049. }
  6050. }
  6051. var index = this.indices.length;
  6052. var attrib = this.points.length / 2;
  6053. if (batchPart) {
  6054. batchPart.end(index, attrib);
  6055. }
  6056. if (this.batches.length === 0) {
  6057. this.batchable = true;
  6058. return;
  6059. }
  6060. var need32 = attrib > 65535;
  6061. if (this.indicesUint16 && this.indices.length === this.indicesUint16.length && need32 === this.indicesUint16.BYTES_PER_ELEMENT > 2) {
  6062. this.indicesUint16.set(this.indices);
  6063. } else {
  6064. this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);
  6065. }
  6066. this.batchable = this.isBatchable();
  6067. if (this.batchable) {
  6068. this.packBatches();
  6069. } else {
  6070. this.buildDrawCalls();
  6071. }
  6072. };
  6073. GraphicsGeometry2.prototype._compareStyles = function(styleA, styleB) {
  6074. if (!styleA || !styleB) {
  6075. return false;
  6076. }
  6077. if (styleA.texture.baseTexture !== styleB.texture.baseTexture) {
  6078. return false;
  6079. }
  6080. if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) {
  6081. return false;
  6082. }
  6083. if (!!styleA.native !== !!styleB.native) {
  6084. return false;
  6085. }
  6086. return true;
  6087. };
  6088. GraphicsGeometry2.prototype.validateBatching = function() {
  6089. if (this.dirty === this.cacheDirty || !this.graphicsData.length) {
  6090. return false;
  6091. }
  6092. for (var i = 0, l = this.graphicsData.length; i < l; i++) {
  6093. var data = this.graphicsData[i];
  6094. var fill = data.fillStyle;
  6095. var line = data.lineStyle;
  6096. if (fill && !fill.texture.baseTexture.valid) {
  6097. return false;
  6098. }
  6099. if (line && !line.texture.baseTexture.valid) {
  6100. return false;
  6101. }
  6102. }
  6103. return true;
  6104. };
  6105. GraphicsGeometry2.prototype.packBatches = function() {
  6106. this.batchDirty++;
  6107. this.uvsFloat32 = new Float32Array(this.uvs);
  6108. var batches = this.batches;
  6109. for (var i = 0, l = batches.length; i < l; i++) {
  6110. var batch = batches[i];
  6111. for (var j = 0; j < batch.size; j++) {
  6112. var index = batch.start + j;
  6113. this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;
  6114. }
  6115. }
  6116. };
  6117. GraphicsGeometry2.prototype.isBatchable = function() {
  6118. if (this.points.length > 65535 * 2) {
  6119. return false;
  6120. }
  6121. var batches = this.batches;
  6122. for (var i = 0; i < batches.length; i++) {
  6123. if (batches[i].style.native) {
  6124. return false;
  6125. }
  6126. }
  6127. return this.points.length < GraphicsGeometry2.BATCHABLE_SIZE * 2;
  6128. };
  6129. GraphicsGeometry2.prototype.buildDrawCalls = function() {
  6130. var TICK = ++BaseTexture._globalBatch;
  6131. for (var i = 0; i < this.drawCalls.length; i++) {
  6132. this.drawCalls[i].texArray.clear();
  6133. DRAW_CALL_POOL.push(this.drawCalls[i]);
  6134. }
  6135. this.drawCalls.length = 0;
  6136. var colors = this.colors;
  6137. var textureIds = this.textureIds;
  6138. var currentGroup = DRAW_CALL_POOL.pop();
  6139. if (!currentGroup) {
  6140. currentGroup = new BatchDrawCall();
  6141. currentGroup.texArray = new BatchTextureArray();
  6142. }
  6143. currentGroup.texArray.count = 0;
  6144. currentGroup.start = 0;
  6145. currentGroup.size = 0;
  6146. currentGroup.type = DRAW_MODES.TRIANGLES;
  6147. var textureCount = 0;
  6148. var currentTexture = null;
  6149. var textureId = 0;
  6150. var native = false;
  6151. var drawMode = DRAW_MODES.TRIANGLES;
  6152. var index = 0;
  6153. this.drawCalls.push(currentGroup);
  6154. for (var i = 0; i < this.batches.length; i++) {
  6155. var data = this.batches[i];
  6156. var MAX_TEXTURES = 8;
  6157. var style = data.style;
  6158. var nextTexture = style.texture.baseTexture;
  6159. if (native !== !!style.native) {
  6160. native = !!style.native;
  6161. drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;
  6162. currentTexture = null;
  6163. textureCount = MAX_TEXTURES;
  6164. TICK++;
  6165. }
  6166. if (currentTexture !== nextTexture) {
  6167. currentTexture = nextTexture;
  6168. if (nextTexture._batchEnabled !== TICK) {
  6169. if (textureCount === MAX_TEXTURES) {
  6170. TICK++;
  6171. textureCount = 0;
  6172. if (currentGroup.size > 0) {
  6173. currentGroup = DRAW_CALL_POOL.pop();
  6174. if (!currentGroup) {
  6175. currentGroup = new BatchDrawCall();
  6176. currentGroup.texArray = new BatchTextureArray();
  6177. }
  6178. this.drawCalls.push(currentGroup);
  6179. }
  6180. currentGroup.start = index;
  6181. currentGroup.size = 0;
  6182. currentGroup.texArray.count = 0;
  6183. currentGroup.type = drawMode;
  6184. }
  6185. nextTexture.touched = 1;
  6186. nextTexture._batchEnabled = TICK;
  6187. nextTexture._batchLocation = textureCount;
  6188. nextTexture.wrapMode = WRAP_MODES.REPEAT;
  6189. currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;
  6190. textureCount++;
  6191. }
  6192. }
  6193. currentGroup.size += data.size;
  6194. index += data.size;
  6195. textureId = nextTexture._batchLocation;
  6196. this.addColors(colors, style.color, style.alpha, data.attribSize, data.attribStart);
  6197. this.addTextureIds(textureIds, textureId, data.attribSize, data.attribStart);
  6198. }
  6199. BaseTexture._globalBatch = TICK;
  6200. this.packAttributes();
  6201. };
  6202. GraphicsGeometry2.prototype.packAttributes = function() {
  6203. var verts = this.points;
  6204. var uvs = this.uvs;
  6205. var colors = this.colors;
  6206. var textureIds = this.textureIds;
  6207. var glPoints = new ArrayBuffer(verts.length * 3 * 4);
  6208. var f32 = new Float32Array(glPoints);
  6209. var u32 = new Uint32Array(glPoints);
  6210. var p = 0;
  6211. for (var i = 0; i < verts.length / 2; i++) {
  6212. f32[p++] = verts[i * 2];
  6213. f32[p++] = verts[i * 2 + 1];
  6214. f32[p++] = uvs[i * 2];
  6215. f32[p++] = uvs[i * 2 + 1];
  6216. u32[p++] = colors[i];
  6217. f32[p++] = textureIds[i];
  6218. }
  6219. this._buffer.update(glPoints);
  6220. this._indexBuffer.update(this.indicesUint16);
  6221. };
  6222. GraphicsGeometry2.prototype.processFill = function(data) {
  6223. if (data.holes.length) {
  6224. buildPoly.triangulate(data, this);
  6225. } else {
  6226. var command = FILL_COMMANDS[data.type];
  6227. command.triangulate(data, this);
  6228. }
  6229. };
  6230. GraphicsGeometry2.prototype.processLine = function(data) {
  6231. buildLine(data, this);
  6232. for (var i = 0; i < data.holes.length; i++) {
  6233. buildLine(data.holes[i], this);
  6234. }
  6235. };
  6236. GraphicsGeometry2.prototype.processHoles = function(holes) {
  6237. for (var i = 0; i < holes.length; i++) {
  6238. var hole = holes[i];
  6239. var command = FILL_COMMANDS[hole.type];
  6240. command.build(hole);
  6241. if (hole.matrix) {
  6242. this.transformPoints(hole.points, hole.matrix);
  6243. }
  6244. }
  6245. };
  6246. GraphicsGeometry2.prototype.calculateBounds = function() {
  6247. var bounds = this._bounds;
  6248. bounds.clear();
  6249. bounds.addVertexData(this.points, 0, this.points.length);
  6250. bounds.pad(this.boundsPadding, this.boundsPadding);
  6251. };
  6252. GraphicsGeometry2.prototype.transformPoints = function(points, matrix) {
  6253. for (var i = 0; i < points.length / 2; i++) {
  6254. var x = points[i * 2];
  6255. var y = points[i * 2 + 1];
  6256. points[i * 2] = matrix.a * x + matrix.c * y + matrix.tx;
  6257. points[i * 2 + 1] = matrix.b * x + matrix.d * y + matrix.ty;
  6258. }
  6259. };
  6260. GraphicsGeometry2.prototype.addColors = function(colors, color, alpha, size, offset) {
  6261. if (offset === void 0) {
  6262. offset = 0;
  6263. }
  6264. var rgb = (color >> 16) + (color & 65280) + ((color & 255) << 16);
  6265. var rgba = premultiplyTint(rgb, alpha);
  6266. colors.length = Math.max(colors.length, offset + size);
  6267. for (var i = 0; i < size; i++) {
  6268. colors[offset + i] = rgba;
  6269. }
  6270. };
  6271. GraphicsGeometry2.prototype.addTextureIds = function(textureIds, id, size, offset) {
  6272. if (offset === void 0) {
  6273. offset = 0;
  6274. }
  6275. textureIds.length = Math.max(textureIds.length, offset + size);
  6276. for (var i = 0; i < size; i++) {
  6277. textureIds[offset + i] = id;
  6278. }
  6279. };
  6280. GraphicsGeometry2.prototype.addUvs = function(verts, uvs, texture, start, size, matrix) {
  6281. if (matrix === void 0) {
  6282. matrix = null;
  6283. }
  6284. var index = 0;
  6285. var uvsStart = uvs.length;
  6286. var frame = texture.frame;
  6287. while (index < size) {
  6288. var x = verts[(start + index) * 2];
  6289. var y = verts[(start + index) * 2 + 1];
  6290. if (matrix) {
  6291. var nx = matrix.a * x + matrix.c * y + matrix.tx;
  6292. y = matrix.b * x + matrix.d * y + matrix.ty;
  6293. x = nx;
  6294. }
  6295. index++;
  6296. uvs.push(x / frame.width, y / frame.height);
  6297. }
  6298. var baseTexture = texture.baseTexture;
  6299. if (frame.width < baseTexture.width || frame.height < baseTexture.height) {
  6300. this.adjustUvs(uvs, texture, uvsStart, size);
  6301. }
  6302. };
  6303. GraphicsGeometry2.prototype.adjustUvs = function(uvs, texture, start, size) {
  6304. var baseTexture = texture.baseTexture;
  6305. var eps = 1e-6;
  6306. var finish = start + size * 2;
  6307. var frame = texture.frame;
  6308. var scaleX = frame.width / baseTexture.width;
  6309. var scaleY = frame.height / baseTexture.height;
  6310. var offsetX = frame.x / frame.width;
  6311. var offsetY = frame.y / frame.height;
  6312. var minX = Math.floor(uvs[start] + eps);
  6313. var minY = Math.floor(uvs[start + 1] + eps);
  6314. for (var i = start + 2; i < finish; i += 2) {
  6315. minX = Math.min(minX, Math.floor(uvs[i] + eps));
  6316. minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));
  6317. }
  6318. offsetX -= minX;
  6319. offsetY -= minY;
  6320. for (var i = start; i < finish; i += 2) {
  6321. uvs[i] = (uvs[i] + offsetX) * scaleX;
  6322. uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;
  6323. }
  6324. };
  6325. GraphicsGeometry2.BATCHABLE_SIZE = 100;
  6326. return GraphicsGeometry2;
  6327. })(BatchGeometry)
  6328. );
  6329. var LineStyle = (
  6330. /** @class */
  6331. (function(_super) {
  6332. __extends4(LineStyle2, _super);
  6333. function LineStyle2() {
  6334. var _this = _super !== null && _super.apply(this, arguments) || this;
  6335. _this.width = 0;
  6336. _this.alignment = 0.5;
  6337. _this.native = false;
  6338. _this.cap = LINE_CAP.BUTT;
  6339. _this.join = LINE_JOIN.MITER;
  6340. _this.miterLimit = 10;
  6341. return _this;
  6342. }
  6343. LineStyle2.prototype.clone = function() {
  6344. var obj = new LineStyle2();
  6345. obj.color = this.color;
  6346. obj.alpha = this.alpha;
  6347. obj.texture = this.texture;
  6348. obj.matrix = this.matrix;
  6349. obj.visible = this.visible;
  6350. obj.width = this.width;
  6351. obj.alignment = this.alignment;
  6352. obj.native = this.native;
  6353. obj.cap = this.cap;
  6354. obj.join = this.join;
  6355. obj.miterLimit = this.miterLimit;
  6356. return obj;
  6357. };
  6358. LineStyle2.prototype.reset = function() {
  6359. _super.prototype.reset.call(this);
  6360. this.color = 0;
  6361. this.alignment = 0.5;
  6362. this.width = 0;
  6363. this.native = false;
  6364. };
  6365. return LineStyle2;
  6366. })(FillStyle)
  6367. );
  6368. var temp = new Float32Array(3);
  6369. var DEFAULT_SHADERS = {};
  6370. var Graphics = (
  6371. /** @class */
  6372. (function(_super) {
  6373. __extends4(Graphics2, _super);
  6374. function Graphics2(geometry) {
  6375. if (geometry === void 0) {
  6376. geometry = null;
  6377. }
  6378. var _this = _super.call(this) || this;
  6379. _this.shader = null;
  6380. _this.pluginName = "batch";
  6381. _this.currentPath = null;
  6382. _this.batches = [];
  6383. _this.batchTint = -1;
  6384. _this.batchDirty = -1;
  6385. _this.vertexData = null;
  6386. _this._fillStyle = new FillStyle();
  6387. _this._lineStyle = new LineStyle();
  6388. _this._matrix = null;
  6389. _this._holeMode = false;
  6390. _this.state = State.for2d();
  6391. _this._geometry = geometry || new GraphicsGeometry();
  6392. _this._geometry.refCount++;
  6393. _this._transformID = -1;
  6394. _this.tint = 16777215;
  6395. _this.blendMode = BLEND_MODES.NORMAL;
  6396. return _this;
  6397. }
  6398. Object.defineProperty(Graphics2.prototype, "geometry", {
  6399. /**
  6400. * Includes vertex positions, face indices, normals, colors, UVs, and
  6401. * custom attributes within buffers, reducing the cost of passing all
  6402. * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.
  6403. * @readonly
  6404. */
  6405. get: function() {
  6406. return this._geometry;
  6407. },
  6408. enumerable: false,
  6409. configurable: true
  6410. });
  6411. Graphics2.prototype.clone = function() {
  6412. this.finishPoly();
  6413. return new Graphics2(this._geometry);
  6414. };
  6415. Object.defineProperty(Graphics2.prototype, "blendMode", {
  6416. get: function() {
  6417. return this.state.blendMode;
  6418. },
  6419. /**
  6420. * The blend mode to be applied to the graphic shape. Apply a value of
  6421. * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. Note that, since each
  6422. * primitive in the GraphicsGeometry list is rendered sequentially, modes
  6423. * such as `PIXI.BLEND_MODES.ADD` and `PIXI.BLEND_MODES.MULTIPLY` will
  6424. * be applied per-primitive.
  6425. * @default PIXI.BLEND_MODES.NORMAL
  6426. */
  6427. set: function(value) {
  6428. this.state.blendMode = value;
  6429. },
  6430. enumerable: false,
  6431. configurable: true
  6432. });
  6433. Object.defineProperty(Graphics2.prototype, "tint", {
  6434. /**
  6435. * The tint applied to each graphic shape. This is a hex value. A value of
  6436. * 0xFFFFFF will remove any tint effect.
  6437. * @default 0xFFFFFF
  6438. */
  6439. get: function() {
  6440. return this._tint;
  6441. },
  6442. set: function(value) {
  6443. this._tint = value;
  6444. },
  6445. enumerable: false,
  6446. configurable: true
  6447. });
  6448. Object.defineProperty(Graphics2.prototype, "fill", {
  6449. /**
  6450. * The current fill style.
  6451. * @readonly
  6452. */
  6453. get: function() {
  6454. return this._fillStyle;
  6455. },
  6456. enumerable: false,
  6457. configurable: true
  6458. });
  6459. Object.defineProperty(Graphics2.prototype, "line", {
  6460. /**
  6461. * The current line style.
  6462. * @readonly
  6463. */
  6464. get: function() {
  6465. return this._lineStyle;
  6466. },
  6467. enumerable: false,
  6468. configurable: true
  6469. });
  6470. Graphics2.prototype.lineStyle = function(options, color, alpha, alignment, native) {
  6471. if (options === void 0) {
  6472. options = null;
  6473. }
  6474. if (color === void 0) {
  6475. color = 0;
  6476. }
  6477. if (alpha === void 0) {
  6478. alpha = 1;
  6479. }
  6480. if (alignment === void 0) {
  6481. alignment = 0.5;
  6482. }
  6483. if (native === void 0) {
  6484. native = false;
  6485. }
  6486. if (typeof options === "number") {
  6487. options = { width: options, color, alpha, alignment, native };
  6488. }
  6489. return this.lineTextureStyle(options);
  6490. };
  6491. Graphics2.prototype.lineTextureStyle = function(options) {
  6492. options = Object.assign({
  6493. width: 0,
  6494. texture: Texture.WHITE,
  6495. color: options && options.texture ? 16777215 : 0,
  6496. alpha: 1,
  6497. matrix: null,
  6498. alignment: 0.5,
  6499. native: false,
  6500. cap: LINE_CAP.BUTT,
  6501. join: LINE_JOIN.MITER,
  6502. miterLimit: 10
  6503. }, options);
  6504. if (this.currentPath) {
  6505. this.startPoly();
  6506. }
  6507. var visible = options.width > 0 && options.alpha > 0;
  6508. if (!visible) {
  6509. this._lineStyle.reset();
  6510. } else {
  6511. if (options.matrix) {
  6512. options.matrix = options.matrix.clone();
  6513. options.matrix.invert();
  6514. }
  6515. Object.assign(this._lineStyle, { visible }, options);
  6516. }
  6517. return this;
  6518. };
  6519. Graphics2.prototype.startPoly = function() {
  6520. if (this.currentPath) {
  6521. var points = this.currentPath.points;
  6522. var len = this.currentPath.points.length;
  6523. if (len > 2) {
  6524. this.drawShape(this.currentPath);
  6525. this.currentPath = new Polygon();
  6526. this.currentPath.closeStroke = false;
  6527. this.currentPath.points.push(points[len - 2], points[len - 1]);
  6528. }
  6529. } else {
  6530. this.currentPath = new Polygon();
  6531. this.currentPath.closeStroke = false;
  6532. }
  6533. };
  6534. Graphics2.prototype.finishPoly = function() {
  6535. if (this.currentPath) {
  6536. if (this.currentPath.points.length > 2) {
  6537. this.drawShape(this.currentPath);
  6538. this.currentPath = null;
  6539. } else {
  6540. this.currentPath.points.length = 0;
  6541. }
  6542. }
  6543. };
  6544. Graphics2.prototype.moveTo = function(x, y) {
  6545. this.startPoly();
  6546. this.currentPath.points[0] = x;
  6547. this.currentPath.points[1] = y;
  6548. return this;
  6549. };
  6550. Graphics2.prototype.lineTo = function(x, y) {
  6551. if (!this.currentPath) {
  6552. this.moveTo(0, 0);
  6553. }
  6554. var points = this.currentPath.points;
  6555. var fromX = points[points.length - 2];
  6556. var fromY = points[points.length - 1];
  6557. if (fromX !== x || fromY !== y) {
  6558. points.push(x, y);
  6559. }
  6560. return this;
  6561. };
  6562. Graphics2.prototype._initCurve = function(x, y) {
  6563. if (x === void 0) {
  6564. x = 0;
  6565. }
  6566. if (y === void 0) {
  6567. y = 0;
  6568. }
  6569. if (this.currentPath) {
  6570. if (this.currentPath.points.length === 0) {
  6571. this.currentPath.points = [x, y];
  6572. }
  6573. } else {
  6574. this.moveTo(x, y);
  6575. }
  6576. };
  6577. Graphics2.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY) {
  6578. this._initCurve();
  6579. var points = this.currentPath.points;
  6580. if (points.length === 0) {
  6581. this.moveTo(0, 0);
  6582. }
  6583. QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);
  6584. return this;
  6585. };
  6586. Graphics2.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY) {
  6587. this._initCurve();
  6588. BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);
  6589. return this;
  6590. };
  6591. Graphics2.prototype.arcTo = function(x1, y1, x2, y2, radius) {
  6592. this._initCurve(x1, y1);
  6593. var points = this.currentPath.points;
  6594. var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);
  6595. if (result) {
  6596. var cx = result.cx, cy = result.cy, radius_1 = result.radius, startAngle = result.startAngle, endAngle = result.endAngle, anticlockwise = result.anticlockwise;
  6597. this.arc(cx, cy, radius_1, startAngle, endAngle, anticlockwise);
  6598. }
  6599. return this;
  6600. };
  6601. Graphics2.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise) {
  6602. if (anticlockwise === void 0) {
  6603. anticlockwise = false;
  6604. }
  6605. if (startAngle === endAngle) {
  6606. return this;
  6607. }
  6608. if (!anticlockwise && endAngle <= startAngle) {
  6609. endAngle += PI_2;
  6610. } else if (anticlockwise && startAngle <= endAngle) {
  6611. startAngle += PI_2;
  6612. }
  6613. var sweep = endAngle - startAngle;
  6614. if (sweep === 0) {
  6615. return this;
  6616. }
  6617. var startX = cx + Math.cos(startAngle) * radius;
  6618. var startY = cy + Math.sin(startAngle) * radius;
  6619. var eps = this._geometry.closePointEps;
  6620. var points = this.currentPath ? this.currentPath.points : null;
  6621. if (points) {
  6622. var xDiff = Math.abs(points[points.length - 2] - startX);
  6623. var yDiff = Math.abs(points[points.length - 1] - startY);
  6624. if (xDiff < eps && yDiff < eps) ;
  6625. else {
  6626. points.push(startX, startY);
  6627. }
  6628. } else {
  6629. this.moveTo(startX, startY);
  6630. points = this.currentPath.points;
  6631. }
  6632. ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);
  6633. return this;
  6634. };
  6635. Graphics2.prototype.beginFill = function(color, alpha) {
  6636. if (color === void 0) {
  6637. color = 0;
  6638. }
  6639. if (alpha === void 0) {
  6640. alpha = 1;
  6641. }
  6642. return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });
  6643. };
  6644. Graphics2.prototype.beginTextureFill = function(options) {
  6645. options = Object.assign({
  6646. texture: Texture.WHITE,
  6647. color: 16777215,
  6648. alpha: 1,
  6649. matrix: null
  6650. }, options);
  6651. if (this.currentPath) {
  6652. this.startPoly();
  6653. }
  6654. var visible = options.alpha > 0;
  6655. if (!visible) {
  6656. this._fillStyle.reset();
  6657. } else {
  6658. if (options.matrix) {
  6659. options.matrix = options.matrix.clone();
  6660. options.matrix.invert();
  6661. }
  6662. Object.assign(this._fillStyle, { visible }, options);
  6663. }
  6664. return this;
  6665. };
  6666. Graphics2.prototype.endFill = function() {
  6667. this.finishPoly();
  6668. this._fillStyle.reset();
  6669. return this;
  6670. };
  6671. Graphics2.prototype.drawRect = function(x, y, width, height) {
  6672. return this.drawShape(new Rectangle(x, y, width, height));
  6673. };
  6674. Graphics2.prototype.drawRoundedRect = function(x, y, width, height, radius) {
  6675. return this.drawShape(new RoundedRectangle(x, y, width, height, radius));
  6676. };
  6677. Graphics2.prototype.drawCircle = function(x, y, radius) {
  6678. return this.drawShape(new Circle(x, y, radius));
  6679. };
  6680. Graphics2.prototype.drawEllipse = function(x, y, width, height) {
  6681. return this.drawShape(new Ellipse(x, y, width, height));
  6682. };
  6683. Graphics2.prototype.drawPolygon = function() {
  6684. var arguments$1 = arguments;
  6685. var path = [];
  6686. for (var _i = 0; _i < arguments.length; _i++) {
  6687. path[_i] = arguments$1[_i];
  6688. }
  6689. var points;
  6690. var closeStroke = true;
  6691. var poly = path[0];
  6692. if (poly.points) {
  6693. closeStroke = poly.closeStroke;
  6694. points = poly.points;
  6695. } else if (Array.isArray(path[0])) {
  6696. points = path[0];
  6697. } else {
  6698. points = path;
  6699. }
  6700. var shape = new Polygon(points);
  6701. shape.closeStroke = closeStroke;
  6702. this.drawShape(shape);
  6703. return this;
  6704. };
  6705. Graphics2.prototype.drawShape = function(shape) {
  6706. if (!this._holeMode) {
  6707. this._geometry.drawShape(shape, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix);
  6708. } else {
  6709. this._geometry.drawHole(shape, this._matrix);
  6710. }
  6711. return this;
  6712. };
  6713. Graphics2.prototype.clear = function() {
  6714. this._geometry.clear();
  6715. this._lineStyle.reset();
  6716. this._fillStyle.reset();
  6717. this._boundsID++;
  6718. this._matrix = null;
  6719. this._holeMode = false;
  6720. this.currentPath = null;
  6721. return this;
  6722. };
  6723. Graphics2.prototype.isFastRect = function() {
  6724. var data = this._geometry.graphicsData;
  6725. return data.length === 1 && data[0].shape.type === SHAPES.RECT && !data[0].matrix && !data[0].holes.length && !(data[0].lineStyle.visible && data[0].lineStyle.width);
  6726. };
  6727. Graphics2.prototype._render = function(renderer) {
  6728. this.finishPoly();
  6729. var geometry = this._geometry;
  6730. geometry.updateBatches();
  6731. if (geometry.batchable) {
  6732. if (this.batchDirty !== geometry.batchDirty) {
  6733. this._populateBatches();
  6734. }
  6735. this._renderBatched(renderer);
  6736. } else {
  6737. renderer.batch.flush();
  6738. this._renderDirect(renderer);
  6739. }
  6740. };
  6741. Graphics2.prototype._populateBatches = function() {
  6742. var geometry = this._geometry;
  6743. var blendMode = this.blendMode;
  6744. var len = geometry.batches.length;
  6745. this.batchTint = -1;
  6746. this._transformID = -1;
  6747. this.batchDirty = geometry.batchDirty;
  6748. this.batches.length = len;
  6749. this.vertexData = new Float32Array(geometry.points);
  6750. for (var i = 0; i < len; i++) {
  6751. var gI = geometry.batches[i];
  6752. var color = gI.style.color;
  6753. var vertexData = new Float32Array(this.vertexData.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2);
  6754. var uvs = new Float32Array(geometry.uvsFloat32.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2);
  6755. var indices2 = new Uint16Array(geometry.indicesUint16.buffer, gI.start * 2, gI.size);
  6756. var batch = {
  6757. vertexData,
  6758. blendMode,
  6759. indices: indices2,
  6760. uvs,
  6761. _batchRGB: hex2rgb(color),
  6762. _tintRGB: color,
  6763. _texture: gI.style.texture,
  6764. alpha: gI.style.alpha,
  6765. worldAlpha: 1
  6766. };
  6767. this.batches[i] = batch;
  6768. }
  6769. };
  6770. Graphics2.prototype._renderBatched = function(renderer) {
  6771. if (!this.batches.length) {
  6772. return;
  6773. }
  6774. renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
  6775. this.calculateVertices();
  6776. this.calculateTints();
  6777. for (var i = 0, l = this.batches.length; i < l; i++) {
  6778. var batch = this.batches[i];
  6779. batch.worldAlpha = this.worldAlpha * batch.alpha;
  6780. renderer.plugins[this.pluginName].render(batch);
  6781. }
  6782. };
  6783. Graphics2.prototype._renderDirect = function(renderer) {
  6784. var shader = this._resolveDirectShader(renderer);
  6785. var geometry = this._geometry;
  6786. var tint = this.tint;
  6787. var worldAlpha = this.worldAlpha;
  6788. var uniforms = shader.uniforms;
  6789. var drawCalls = geometry.drawCalls;
  6790. uniforms.translationMatrix = this.transform.worldTransform;
  6791. uniforms.tint[0] = (tint >> 16 & 255) / 255 * worldAlpha;
  6792. uniforms.tint[1] = (tint >> 8 & 255) / 255 * worldAlpha;
  6793. uniforms.tint[2] = (tint & 255) / 255 * worldAlpha;
  6794. uniforms.tint[3] = worldAlpha;
  6795. renderer.shader.bind(shader);
  6796. renderer.geometry.bind(geometry, shader);
  6797. renderer.state.set(this.state);
  6798. for (var i = 0, l = drawCalls.length; i < l; i++) {
  6799. this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);
  6800. }
  6801. };
  6802. Graphics2.prototype._renderDrawCallDirect = function(renderer, drawCall) {
  6803. var texArray = drawCall.texArray, type = drawCall.type, size = drawCall.size, start = drawCall.start;
  6804. var groupTextureCount = texArray.count;
  6805. for (var j = 0; j < groupTextureCount; j++) {
  6806. renderer.texture.bind(texArray.elements[j], j);
  6807. }
  6808. renderer.geometry.draw(type, size, start);
  6809. };
  6810. Graphics2.prototype._resolveDirectShader = function(renderer) {
  6811. var shader = this.shader;
  6812. var pluginName = this.pluginName;
  6813. if (!shader) {
  6814. if (!DEFAULT_SHADERS[pluginName]) {
  6815. var MAX_TEXTURES = renderer.plugins[pluginName].MAX_TEXTURES;
  6816. var sampleValues = new Int32Array(MAX_TEXTURES);
  6817. for (var i = 0; i < MAX_TEXTURES; i++) {
  6818. sampleValues[i] = i;
  6819. }
  6820. var uniforms = {
  6821. tint: new Float32Array([1, 1, 1, 1]),
  6822. translationMatrix: new Matrix(),
  6823. default: UniformGroup.from({ uSamplers: sampleValues }, true)
  6824. };
  6825. var program = renderer.plugins[pluginName]._shader.program;
  6826. DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);
  6827. }
  6828. shader = DEFAULT_SHADERS[pluginName];
  6829. }
  6830. return shader;
  6831. };
  6832. Graphics2.prototype._calculateBounds = function() {
  6833. this.finishPoly();
  6834. var geometry = this._geometry;
  6835. if (!geometry.graphicsData.length) {
  6836. return;
  6837. }
  6838. var _a3 = geometry.bounds, minX = _a3.minX, minY = _a3.minY, maxX = _a3.maxX, maxY = _a3.maxY;
  6839. this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
  6840. };
  6841. Graphics2.prototype.containsPoint = function(point) {
  6842. this.worldTransform.applyInverse(point, Graphics2._TEMP_POINT);
  6843. return this._geometry.containsPoint(Graphics2._TEMP_POINT);
  6844. };
  6845. Graphics2.prototype.calculateTints = function() {
  6846. if (this.batchTint !== this.tint) {
  6847. this.batchTint = this.tint;
  6848. var tintRGB = hex2rgb(this.tint, temp);
  6849. for (var i = 0; i < this.batches.length; i++) {
  6850. var batch = this.batches[i];
  6851. var batchTint = batch._batchRGB;
  6852. var r = tintRGB[0] * batchTint[0] * 255;
  6853. var g = tintRGB[1] * batchTint[1] * 255;
  6854. var b = tintRGB[2] * batchTint[2] * 255;
  6855. var color = (r << 16) + (g << 8) + (b | 0);
  6856. batch._tintRGB = (color >> 16) + (color & 65280) + ((color & 255) << 16);
  6857. }
  6858. }
  6859. };
  6860. Graphics2.prototype.calculateVertices = function() {
  6861. var wtID = this.transform._worldID;
  6862. if (this._transformID === wtID) {
  6863. return;
  6864. }
  6865. this._transformID = wtID;
  6866. var wt = this.transform.worldTransform;
  6867. var a = wt.a;
  6868. var b = wt.b;
  6869. var c = wt.c;
  6870. var d = wt.d;
  6871. var tx = wt.tx;
  6872. var ty = wt.ty;
  6873. var data = this._geometry.points;
  6874. var vertexData = this.vertexData;
  6875. var count = 0;
  6876. for (var i = 0; i < data.length; i += 2) {
  6877. var x = data[i];
  6878. var y = data[i + 1];
  6879. vertexData[count++] = a * x + c * y + tx;
  6880. vertexData[count++] = d * y + b * x + ty;
  6881. }
  6882. };
  6883. Graphics2.prototype.closePath = function() {
  6884. var currentPath = this.currentPath;
  6885. if (currentPath) {
  6886. currentPath.closeStroke = true;
  6887. this.finishPoly();
  6888. }
  6889. return this;
  6890. };
  6891. Graphics2.prototype.setMatrix = function(matrix) {
  6892. this._matrix = matrix;
  6893. return this;
  6894. };
  6895. Graphics2.prototype.beginHole = function() {
  6896. this.finishPoly();
  6897. this._holeMode = true;
  6898. return this;
  6899. };
  6900. Graphics2.prototype.endHole = function() {
  6901. this.finishPoly();
  6902. this._holeMode = false;
  6903. return this;
  6904. };
  6905. Graphics2.prototype.destroy = function(options) {
  6906. this._geometry.refCount--;
  6907. if (this._geometry.refCount === 0) {
  6908. this._geometry.dispose();
  6909. }
  6910. this._matrix = null;
  6911. this.currentPath = null;
  6912. this._lineStyle.destroy();
  6913. this._lineStyle = null;
  6914. this._fillStyle.destroy();
  6915. this._fillStyle = null;
  6916. this._geometry = null;
  6917. this.shader = null;
  6918. this.vertexData = null;
  6919. this.batches.length = 0;
  6920. this.batches = null;
  6921. _super.prototype.destroy.call(this, options);
  6922. };
  6923. Graphics2.nextRoundedRectBehavior = false;
  6924. Graphics2._TEMP_POINT = new Point();
  6925. return Graphics2;
  6926. })(Container)
  6927. );
  6928. var graphicsUtils = {
  6929. buildPoly,
  6930. buildCircle,
  6931. buildRectangle,
  6932. buildRoundedRectangle,
  6933. buildLine,
  6934. ArcUtils,
  6935. BezierUtils,
  6936. QuadraticUtils,
  6937. BatchPart,
  6938. FILL_COMMANDS,
  6939. BATCH_POOL,
  6940. DRAW_CALL_POOL
  6941. };
  6942. // node_modules/@pixi/sprite/dist/esm/sprite.mjs
  6943. var extendStatics5 = function(d, b) {
  6944. extendStatics5 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  6945. d2.__proto__ = b2;
  6946. } || function(d2, b2) {
  6947. for (var p in b2) {
  6948. if (b2.hasOwnProperty(p)) {
  6949. d2[p] = b2[p];
  6950. }
  6951. }
  6952. };
  6953. return extendStatics5(d, b);
  6954. };
  6955. function __extends5(d, b) {
  6956. extendStatics5(d, b);
  6957. function __() {
  6958. this.constructor = d;
  6959. }
  6960. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6961. }
  6962. var tempPoint = new Point();
  6963. var indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
  6964. var Sprite = (
  6965. /** @class */
  6966. (function(_super) {
  6967. __extends5(Sprite2, _super);
  6968. function Sprite2(texture) {
  6969. var _this = _super.call(this) || this;
  6970. _this._anchor = new ObservablePoint(_this._onAnchorUpdate, _this, texture ? texture.defaultAnchor.x : 0, texture ? texture.defaultAnchor.y : 0);
  6971. _this._texture = null;
  6972. _this._width = 0;
  6973. _this._height = 0;
  6974. _this._tint = null;
  6975. _this._tintRGB = null;
  6976. _this.tint = 16777215;
  6977. _this.blendMode = BLEND_MODES.NORMAL;
  6978. _this._cachedTint = 16777215;
  6979. _this.uvs = null;
  6980. _this.texture = texture || Texture.EMPTY;
  6981. _this.vertexData = new Float32Array(8);
  6982. _this.vertexTrimmedData = null;
  6983. _this._transformID = -1;
  6984. _this._textureID = -1;
  6985. _this._transformTrimmedID = -1;
  6986. _this._textureTrimmedID = -1;
  6987. _this.indices = indices;
  6988. _this.pluginName = "batch";
  6989. _this.isSprite = true;
  6990. _this._roundPixels = settings.ROUND_PIXELS;
  6991. return _this;
  6992. }
  6993. Sprite2.prototype._onTextureUpdate = function() {
  6994. this._textureID = -1;
  6995. this._textureTrimmedID = -1;
  6996. this._cachedTint = 16777215;
  6997. if (this._width) {
  6998. this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;
  6999. }
  7000. if (this._height) {
  7001. this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;
  7002. }
  7003. };
  7004. Sprite2.prototype._onAnchorUpdate = function() {
  7005. this._transformID = -1;
  7006. this._transformTrimmedID = -1;
  7007. };
  7008. Sprite2.prototype.calculateVertices = function() {
  7009. var texture = this._texture;
  7010. if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) {
  7011. return;
  7012. }
  7013. if (this._textureID !== texture._updateID) {
  7014. this.uvs = this._texture._uvs.uvsFloat32;
  7015. }
  7016. this._transformID = this.transform._worldID;
  7017. this._textureID = texture._updateID;
  7018. var wt = this.transform.worldTransform;
  7019. var a = wt.a;
  7020. var b = wt.b;
  7021. var c = wt.c;
  7022. var d = wt.d;
  7023. var tx = wt.tx;
  7024. var ty = wt.ty;
  7025. var vertexData = this.vertexData;
  7026. var trim = texture.trim;
  7027. var orig = texture.orig;
  7028. var anchor = this._anchor;
  7029. var w0 = 0;
  7030. var w1 = 0;
  7031. var h0 = 0;
  7032. var h1 = 0;
  7033. if (trim) {
  7034. w1 = trim.x - anchor._x * orig.width;
  7035. w0 = w1 + trim.width;
  7036. h1 = trim.y - anchor._y * orig.height;
  7037. h0 = h1 + trim.height;
  7038. } else {
  7039. w1 = -anchor._x * orig.width;
  7040. w0 = w1 + orig.width;
  7041. h1 = -anchor._y * orig.height;
  7042. h0 = h1 + orig.height;
  7043. }
  7044. vertexData[0] = a * w1 + c * h1 + tx;
  7045. vertexData[1] = d * h1 + b * w1 + ty;
  7046. vertexData[2] = a * w0 + c * h1 + tx;
  7047. vertexData[3] = d * h1 + b * w0 + ty;
  7048. vertexData[4] = a * w0 + c * h0 + tx;
  7049. vertexData[5] = d * h0 + b * w0 + ty;
  7050. vertexData[6] = a * w1 + c * h0 + tx;
  7051. vertexData[7] = d * h0 + b * w1 + ty;
  7052. if (this._roundPixels) {
  7053. var resolution = settings.RESOLUTION;
  7054. for (var i = 0; i < vertexData.length; ++i) {
  7055. vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);
  7056. }
  7057. }
  7058. };
  7059. Sprite2.prototype.calculateTrimmedVertices = function() {
  7060. if (!this.vertexTrimmedData) {
  7061. this.vertexTrimmedData = new Float32Array(8);
  7062. } else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) {
  7063. return;
  7064. }
  7065. this._transformTrimmedID = this.transform._worldID;
  7066. this._textureTrimmedID = this._texture._updateID;
  7067. var texture = this._texture;
  7068. var vertexData = this.vertexTrimmedData;
  7069. var orig = texture.orig;
  7070. var anchor = this._anchor;
  7071. var wt = this.transform.worldTransform;
  7072. var a = wt.a;
  7073. var b = wt.b;
  7074. var c = wt.c;
  7075. var d = wt.d;
  7076. var tx = wt.tx;
  7077. var ty = wt.ty;
  7078. var w1 = -anchor._x * orig.width;
  7079. var w0 = w1 + orig.width;
  7080. var h1 = -anchor._y * orig.height;
  7081. var h0 = h1 + orig.height;
  7082. vertexData[0] = a * w1 + c * h1 + tx;
  7083. vertexData[1] = d * h1 + b * w1 + ty;
  7084. vertexData[2] = a * w0 + c * h1 + tx;
  7085. vertexData[3] = d * h1 + b * w0 + ty;
  7086. vertexData[4] = a * w0 + c * h0 + tx;
  7087. vertexData[5] = d * h0 + b * w0 + ty;
  7088. vertexData[6] = a * w1 + c * h0 + tx;
  7089. vertexData[7] = d * h0 + b * w1 + ty;
  7090. };
  7091. Sprite2.prototype._render = function(renderer) {
  7092. this.calculateVertices();
  7093. renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
  7094. renderer.plugins[this.pluginName].render(this);
  7095. };
  7096. Sprite2.prototype._calculateBounds = function() {
  7097. var trim = this._texture.trim;
  7098. var orig = this._texture.orig;
  7099. if (!trim || trim.width === orig.width && trim.height === orig.height) {
  7100. this.calculateVertices();
  7101. this._bounds.addQuad(this.vertexData);
  7102. } else {
  7103. this.calculateTrimmedVertices();
  7104. this._bounds.addQuad(this.vertexTrimmedData);
  7105. }
  7106. };
  7107. Sprite2.prototype.getLocalBounds = function(rect) {
  7108. if (this.children.length === 0) {
  7109. if (!this._localBounds) {
  7110. this._localBounds = new Bounds();
  7111. }
  7112. this._localBounds.minX = this._texture.orig.width * -this._anchor._x;
  7113. this._localBounds.minY = this._texture.orig.height * -this._anchor._y;
  7114. this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);
  7115. this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);
  7116. if (!rect) {
  7117. if (!this._localBoundsRect) {
  7118. this._localBoundsRect = new Rectangle();
  7119. }
  7120. rect = this._localBoundsRect;
  7121. }
  7122. return this._localBounds.getRectangle(rect);
  7123. }
  7124. return _super.prototype.getLocalBounds.call(this, rect);
  7125. };
  7126. Sprite2.prototype.containsPoint = function(point) {
  7127. this.worldTransform.applyInverse(point, tempPoint);
  7128. var width = this._texture.orig.width;
  7129. var height = this._texture.orig.height;
  7130. var x1 = -width * this.anchor.x;
  7131. var y1 = 0;
  7132. if (tempPoint.x >= x1 && tempPoint.x < x1 + width) {
  7133. y1 = -height * this.anchor.y;
  7134. if (tempPoint.y >= y1 && tempPoint.y < y1 + height) {
  7135. return true;
  7136. }
  7137. }
  7138. return false;
  7139. };
  7140. Sprite2.prototype.destroy = function(options) {
  7141. _super.prototype.destroy.call(this, options);
  7142. this._texture.off("update", this._onTextureUpdate, this);
  7143. this._anchor = null;
  7144. var destroyTexture = typeof options === "boolean" ? options : options && options.texture;
  7145. if (destroyTexture) {
  7146. var destroyBaseTexture = typeof options === "boolean" ? options : options && options.baseTexture;
  7147. this._texture.destroy(!!destroyBaseTexture);
  7148. }
  7149. this._texture = null;
  7150. };
  7151. Sprite2.from = function(source, options) {
  7152. var texture = source instanceof Texture ? source : Texture.from(source, options);
  7153. return new Sprite2(texture);
  7154. };
  7155. Object.defineProperty(Sprite2.prototype, "roundPixels", {
  7156. get: function() {
  7157. return this._roundPixels;
  7158. },
  7159. /**
  7160. * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
  7161. *
  7162. * Advantages can include sharper image quality (like text) and faster rendering on canvas.
  7163. * The main disadvantage is movement of objects may appear less smooth.
  7164. *
  7165. * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.
  7166. * @default false
  7167. */
  7168. set: function(value) {
  7169. if (this._roundPixels !== value) {
  7170. this._transformID = -1;
  7171. }
  7172. this._roundPixels = value;
  7173. },
  7174. enumerable: false,
  7175. configurable: true
  7176. });
  7177. Object.defineProperty(Sprite2.prototype, "width", {
  7178. /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */
  7179. get: function() {
  7180. return Math.abs(this.scale.x) * this._texture.orig.width;
  7181. },
  7182. set: function(value) {
  7183. var s = sign(this.scale.x) || 1;
  7184. this.scale.x = s * value / this._texture.orig.width;
  7185. this._width = value;
  7186. },
  7187. enumerable: false,
  7188. configurable: true
  7189. });
  7190. Object.defineProperty(Sprite2.prototype, "height", {
  7191. /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */
  7192. get: function() {
  7193. return Math.abs(this.scale.y) * this._texture.orig.height;
  7194. },
  7195. set: function(value) {
  7196. var s = sign(this.scale.y) || 1;
  7197. this.scale.y = s * value / this._texture.orig.height;
  7198. this._height = value;
  7199. },
  7200. enumerable: false,
  7201. configurable: true
  7202. });
  7203. Object.defineProperty(Sprite2.prototype, "anchor", {
  7204. /**
  7205. * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}
  7206. * and passed to the constructor.
  7207. *
  7208. * The default is `(0,0)`, this means the sprite's origin is the top left.
  7209. *
  7210. * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.
  7211. *
  7212. * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.
  7213. *
  7214. * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
  7215. * @example
  7216. * const sprite = new PIXI.Sprite(texture);
  7217. * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).
  7218. */
  7219. get: function() {
  7220. return this._anchor;
  7221. },
  7222. set: function(value) {
  7223. this._anchor.copyFrom(value);
  7224. },
  7225. enumerable: false,
  7226. configurable: true
  7227. });
  7228. Object.defineProperty(Sprite2.prototype, "tint", {
  7229. /**
  7230. * The tint applied to the sprite. This is a hex value.
  7231. *
  7232. * A value of 0xFFFFFF will remove any tint effect.
  7233. * @default 0xFFFFFF
  7234. */
  7235. get: function() {
  7236. return this._tint;
  7237. },
  7238. set: function(value) {
  7239. this._tint = value;
  7240. this._tintRGB = (value >> 16) + (value & 65280) + ((value & 255) << 16);
  7241. },
  7242. enumerable: false,
  7243. configurable: true
  7244. });
  7245. Object.defineProperty(Sprite2.prototype, "texture", {
  7246. /** The texture that the sprite is using. */
  7247. get: function() {
  7248. return this._texture;
  7249. },
  7250. set: function(value) {
  7251. if (this._texture === value) {
  7252. return;
  7253. }
  7254. if (this._texture) {
  7255. this._texture.off("update", this._onTextureUpdate, this);
  7256. }
  7257. this._texture = value || Texture.EMPTY;
  7258. this._cachedTint = 16777215;
  7259. this._textureID = -1;
  7260. this._textureTrimmedID = -1;
  7261. if (value) {
  7262. if (value.baseTexture.valid) {
  7263. this._onTextureUpdate();
  7264. } else {
  7265. value.once("update", this._onTextureUpdate, this);
  7266. }
  7267. }
  7268. },
  7269. enumerable: false,
  7270. configurable: true
  7271. });
  7272. return Sprite2;
  7273. })(Container)
  7274. );
  7275. // node_modules/@pixi/text/dist/esm/text.mjs
  7276. var extendStatics6 = function(d, b) {
  7277. extendStatics6 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  7278. d2.__proto__ = b2;
  7279. } || function(d2, b2) {
  7280. for (var p in b2) {
  7281. if (b2.hasOwnProperty(p)) {
  7282. d2[p] = b2[p];
  7283. }
  7284. }
  7285. };
  7286. return extendStatics6(d, b);
  7287. };
  7288. function __extends6(d, b) {
  7289. extendStatics6(d, b);
  7290. function __() {
  7291. this.constructor = d;
  7292. }
  7293. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7294. }
  7295. var TEXT_GRADIENT;
  7296. (function(TEXT_GRADIENT2) {
  7297. TEXT_GRADIENT2[TEXT_GRADIENT2["LINEAR_VERTICAL"] = 0] = "LINEAR_VERTICAL";
  7298. TEXT_GRADIENT2[TEXT_GRADIENT2["LINEAR_HORIZONTAL"] = 1] = "LINEAR_HORIZONTAL";
  7299. })(TEXT_GRADIENT || (TEXT_GRADIENT = {}));
  7300. var defaultStyle = {
  7301. align: "left",
  7302. breakWords: false,
  7303. dropShadow: false,
  7304. dropShadowAlpha: 1,
  7305. dropShadowAngle: Math.PI / 6,
  7306. dropShadowBlur: 0,
  7307. dropShadowColor: "black",
  7308. dropShadowDistance: 5,
  7309. fill: "black",
  7310. fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,
  7311. fillGradientStops: [],
  7312. fontFamily: "Arial",
  7313. fontSize: 26,
  7314. fontStyle: "normal",
  7315. fontVariant: "normal",
  7316. fontWeight: "normal",
  7317. letterSpacing: 0,
  7318. lineHeight: 0,
  7319. lineJoin: "miter",
  7320. miterLimit: 10,
  7321. padding: 0,
  7322. stroke: "black",
  7323. strokeThickness: 0,
  7324. textBaseline: "alphabetic",
  7325. trim: false,
  7326. whiteSpace: "pre",
  7327. wordWrap: false,
  7328. wordWrapWidth: 100,
  7329. leading: 0
  7330. };
  7331. var genericFontFamilies = [
  7332. "serif",
  7333. "sans-serif",
  7334. "monospace",
  7335. "cursive",
  7336. "fantasy",
  7337. "system-ui"
  7338. ];
  7339. var TextStyle = (
  7340. /** @class */
  7341. (function() {
  7342. function TextStyle2(style) {
  7343. this.styleID = 0;
  7344. this.reset();
  7345. deepCopyProperties(this, style, style);
  7346. }
  7347. TextStyle2.prototype.clone = function() {
  7348. var clonedProperties = {};
  7349. deepCopyProperties(clonedProperties, this, defaultStyle);
  7350. return new TextStyle2(clonedProperties);
  7351. };
  7352. TextStyle2.prototype.reset = function() {
  7353. deepCopyProperties(this, defaultStyle, defaultStyle);
  7354. };
  7355. Object.defineProperty(TextStyle2.prototype, "align", {
  7356. /**
  7357. * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text
  7358. *
  7359. * @member {string}
  7360. */
  7361. get: function() {
  7362. return this._align;
  7363. },
  7364. set: function(align) {
  7365. if (this._align !== align) {
  7366. this._align = align;
  7367. this.styleID++;
  7368. }
  7369. },
  7370. enumerable: false,
  7371. configurable: true
  7372. });
  7373. Object.defineProperty(TextStyle2.prototype, "breakWords", {
  7374. /** Indicates if lines can be wrapped within words, it needs wordWrap to be set to true. */
  7375. get: function() {
  7376. return this._breakWords;
  7377. },
  7378. set: function(breakWords) {
  7379. if (this._breakWords !== breakWords) {
  7380. this._breakWords = breakWords;
  7381. this.styleID++;
  7382. }
  7383. },
  7384. enumerable: false,
  7385. configurable: true
  7386. });
  7387. Object.defineProperty(TextStyle2.prototype, "dropShadow", {
  7388. /** Set a drop shadow for the text. */
  7389. get: function() {
  7390. return this._dropShadow;
  7391. },
  7392. set: function(dropShadow) {
  7393. if (this._dropShadow !== dropShadow) {
  7394. this._dropShadow = dropShadow;
  7395. this.styleID++;
  7396. }
  7397. },
  7398. enumerable: false,
  7399. configurable: true
  7400. });
  7401. Object.defineProperty(TextStyle2.prototype, "dropShadowAlpha", {
  7402. /** Set alpha for the drop shadow. */
  7403. get: function() {
  7404. return this._dropShadowAlpha;
  7405. },
  7406. set: function(dropShadowAlpha) {
  7407. if (this._dropShadowAlpha !== dropShadowAlpha) {
  7408. this._dropShadowAlpha = dropShadowAlpha;
  7409. this.styleID++;
  7410. }
  7411. },
  7412. enumerable: false,
  7413. configurable: true
  7414. });
  7415. Object.defineProperty(TextStyle2.prototype, "dropShadowAngle", {
  7416. /** Set a angle of the drop shadow. */
  7417. get: function() {
  7418. return this._dropShadowAngle;
  7419. },
  7420. set: function(dropShadowAngle) {
  7421. if (this._dropShadowAngle !== dropShadowAngle) {
  7422. this._dropShadowAngle = dropShadowAngle;
  7423. this.styleID++;
  7424. }
  7425. },
  7426. enumerable: false,
  7427. configurable: true
  7428. });
  7429. Object.defineProperty(TextStyle2.prototype, "dropShadowBlur", {
  7430. /** Set a shadow blur radius. */
  7431. get: function() {
  7432. return this._dropShadowBlur;
  7433. },
  7434. set: function(dropShadowBlur) {
  7435. if (this._dropShadowBlur !== dropShadowBlur) {
  7436. this._dropShadowBlur = dropShadowBlur;
  7437. this.styleID++;
  7438. }
  7439. },
  7440. enumerable: false,
  7441. configurable: true
  7442. });
  7443. Object.defineProperty(TextStyle2.prototype, "dropShadowColor", {
  7444. /** A fill style to be used on the dropshadow e.g 'red', '#00FF00'. */
  7445. get: function() {
  7446. return this._dropShadowColor;
  7447. },
  7448. set: function(dropShadowColor) {
  7449. var outputColor = getColor(dropShadowColor);
  7450. if (this._dropShadowColor !== outputColor) {
  7451. this._dropShadowColor = outputColor;
  7452. this.styleID++;
  7453. }
  7454. },
  7455. enumerable: false,
  7456. configurable: true
  7457. });
  7458. Object.defineProperty(TextStyle2.prototype, "dropShadowDistance", {
  7459. /** Set a distance of the drop shadow. */
  7460. get: function() {
  7461. return this._dropShadowDistance;
  7462. },
  7463. set: function(dropShadowDistance) {
  7464. if (this._dropShadowDistance !== dropShadowDistance) {
  7465. this._dropShadowDistance = dropShadowDistance;
  7466. this.styleID++;
  7467. }
  7468. },
  7469. enumerable: false,
  7470. configurable: true
  7471. });
  7472. Object.defineProperty(TextStyle2.prototype, "fill", {
  7473. /**
  7474. * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.
  7475. *
  7476. * Can be an array to create a gradient eg ['#000000','#FFFFFF']
  7477. * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}
  7478. *
  7479. * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}
  7480. */
  7481. get: function() {
  7482. return this._fill;
  7483. },
  7484. set: function(fill) {
  7485. var outputColor = getColor(fill);
  7486. if (this._fill !== outputColor) {
  7487. this._fill = outputColor;
  7488. this.styleID++;
  7489. }
  7490. },
  7491. enumerable: false,
  7492. configurable: true
  7493. });
  7494. Object.defineProperty(TextStyle2.prototype, "fillGradientType", {
  7495. /**
  7496. * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.
  7497. *
  7498. * @see PIXI.TEXT_GRADIENT
  7499. */
  7500. get: function() {
  7501. return this._fillGradientType;
  7502. },
  7503. set: function(fillGradientType) {
  7504. if (this._fillGradientType !== fillGradientType) {
  7505. this._fillGradientType = fillGradientType;
  7506. this.styleID++;
  7507. }
  7508. },
  7509. enumerable: false,
  7510. configurable: true
  7511. });
  7512. Object.defineProperty(TextStyle2.prototype, "fillGradientStops", {
  7513. /**
  7514. * If fill is an array of colours to create a gradient, this array can set the stop points
  7515. * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.
  7516. */
  7517. get: function() {
  7518. return this._fillGradientStops;
  7519. },
  7520. set: function(fillGradientStops) {
  7521. if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) {
  7522. this._fillGradientStops = fillGradientStops;
  7523. this.styleID++;
  7524. }
  7525. },
  7526. enumerable: false,
  7527. configurable: true
  7528. });
  7529. Object.defineProperty(TextStyle2.prototype, "fontFamily", {
  7530. /** The font family. */
  7531. get: function() {
  7532. return this._fontFamily;
  7533. },
  7534. set: function(fontFamily) {
  7535. if (this.fontFamily !== fontFamily) {
  7536. this._fontFamily = fontFamily;
  7537. this.styleID++;
  7538. }
  7539. },
  7540. enumerable: false,
  7541. configurable: true
  7542. });
  7543. Object.defineProperty(TextStyle2.prototype, "fontSize", {
  7544. /**
  7545. * The font size
  7546. * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')
  7547. */
  7548. get: function() {
  7549. return this._fontSize;
  7550. },
  7551. set: function(fontSize) {
  7552. if (this._fontSize !== fontSize) {
  7553. this._fontSize = fontSize;
  7554. this.styleID++;
  7555. }
  7556. },
  7557. enumerable: false,
  7558. configurable: true
  7559. });
  7560. Object.defineProperty(TextStyle2.prototype, "fontStyle", {
  7561. /**
  7562. * The font style
  7563. * ('normal', 'italic' or 'oblique')
  7564. *
  7565. * @member {string}
  7566. */
  7567. get: function() {
  7568. return this._fontStyle;
  7569. },
  7570. set: function(fontStyle) {
  7571. if (this._fontStyle !== fontStyle) {
  7572. this._fontStyle = fontStyle;
  7573. this.styleID++;
  7574. }
  7575. },
  7576. enumerable: false,
  7577. configurable: true
  7578. });
  7579. Object.defineProperty(TextStyle2.prototype, "fontVariant", {
  7580. /**
  7581. * The font variant
  7582. * ('normal' or 'small-caps')
  7583. *
  7584. * @member {string}
  7585. */
  7586. get: function() {
  7587. return this._fontVariant;
  7588. },
  7589. set: function(fontVariant) {
  7590. if (this._fontVariant !== fontVariant) {
  7591. this._fontVariant = fontVariant;
  7592. this.styleID++;
  7593. }
  7594. },
  7595. enumerable: false,
  7596. configurable: true
  7597. });
  7598. Object.defineProperty(TextStyle2.prototype, "fontWeight", {
  7599. /**
  7600. * The font weight
  7601. * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')
  7602. *
  7603. * @member {string}
  7604. */
  7605. get: function() {
  7606. return this._fontWeight;
  7607. },
  7608. set: function(fontWeight) {
  7609. if (this._fontWeight !== fontWeight) {
  7610. this._fontWeight = fontWeight;
  7611. this.styleID++;
  7612. }
  7613. },
  7614. enumerable: false,
  7615. configurable: true
  7616. });
  7617. Object.defineProperty(TextStyle2.prototype, "letterSpacing", {
  7618. /** The amount of spacing between letters, default is 0. */
  7619. get: function() {
  7620. return this._letterSpacing;
  7621. },
  7622. set: function(letterSpacing) {
  7623. if (this._letterSpacing !== letterSpacing) {
  7624. this._letterSpacing = letterSpacing;
  7625. this.styleID++;
  7626. }
  7627. },
  7628. enumerable: false,
  7629. configurable: true
  7630. });
  7631. Object.defineProperty(TextStyle2.prototype, "lineHeight", {
  7632. /** The line height, a number that represents the vertical space that a letter uses. */
  7633. get: function() {
  7634. return this._lineHeight;
  7635. },
  7636. set: function(lineHeight) {
  7637. if (this._lineHeight !== lineHeight) {
  7638. this._lineHeight = lineHeight;
  7639. this.styleID++;
  7640. }
  7641. },
  7642. enumerable: false,
  7643. configurable: true
  7644. });
  7645. Object.defineProperty(TextStyle2.prototype, "leading", {
  7646. /** The space between lines. */
  7647. get: function() {
  7648. return this._leading;
  7649. },
  7650. set: function(leading) {
  7651. if (this._leading !== leading) {
  7652. this._leading = leading;
  7653. this.styleID++;
  7654. }
  7655. },
  7656. enumerable: false,
  7657. configurable: true
  7658. });
  7659. Object.defineProperty(TextStyle2.prototype, "lineJoin", {
  7660. /**
  7661. * The lineJoin property sets the type of corner created, it can resolve spiked text issues.
  7662. * Default is 'miter' (creates a sharp corner).
  7663. *
  7664. * @member {string}
  7665. */
  7666. get: function() {
  7667. return this._lineJoin;
  7668. },
  7669. set: function(lineJoin) {
  7670. if (this._lineJoin !== lineJoin) {
  7671. this._lineJoin = lineJoin;
  7672. this.styleID++;
  7673. }
  7674. },
  7675. enumerable: false,
  7676. configurable: true
  7677. });
  7678. Object.defineProperty(TextStyle2.prototype, "miterLimit", {
  7679. /**
  7680. * The miter limit to use when using the 'miter' lineJoin mode.
  7681. *
  7682. * This can reduce or increase the spikiness of rendered text.
  7683. */
  7684. get: function() {
  7685. return this._miterLimit;
  7686. },
  7687. set: function(miterLimit) {
  7688. if (this._miterLimit !== miterLimit) {
  7689. this._miterLimit = miterLimit;
  7690. this.styleID++;
  7691. }
  7692. },
  7693. enumerable: false,
  7694. configurable: true
  7695. });
  7696. Object.defineProperty(TextStyle2.prototype, "padding", {
  7697. /**
  7698. * Occasionally some fonts are cropped. Adding some padding will prevent this from happening
  7699. * by adding padding to all sides of the text.
  7700. */
  7701. get: function() {
  7702. return this._padding;
  7703. },
  7704. set: function(padding) {
  7705. if (this._padding !== padding) {
  7706. this._padding = padding;
  7707. this.styleID++;
  7708. }
  7709. },
  7710. enumerable: false,
  7711. configurable: true
  7712. });
  7713. Object.defineProperty(TextStyle2.prototype, "stroke", {
  7714. /**
  7715. * A canvas fillstyle that will be used on the text stroke
  7716. * e.g 'blue', '#FCFF00'
  7717. */
  7718. get: function() {
  7719. return this._stroke;
  7720. },
  7721. set: function(stroke) {
  7722. var outputColor = getColor(stroke);
  7723. if (this._stroke !== outputColor) {
  7724. this._stroke = outputColor;
  7725. this.styleID++;
  7726. }
  7727. },
  7728. enumerable: false,
  7729. configurable: true
  7730. });
  7731. Object.defineProperty(TextStyle2.prototype, "strokeThickness", {
  7732. /**
  7733. * A number that represents the thickness of the stroke.
  7734. *
  7735. * @default 0
  7736. */
  7737. get: function() {
  7738. return this._strokeThickness;
  7739. },
  7740. set: function(strokeThickness) {
  7741. if (this._strokeThickness !== strokeThickness) {
  7742. this._strokeThickness = strokeThickness;
  7743. this.styleID++;
  7744. }
  7745. },
  7746. enumerable: false,
  7747. configurable: true
  7748. });
  7749. Object.defineProperty(TextStyle2.prototype, "textBaseline", {
  7750. /**
  7751. * The baseline of the text that is rendered.
  7752. *
  7753. * @member {string}
  7754. */
  7755. get: function() {
  7756. return this._textBaseline;
  7757. },
  7758. set: function(textBaseline) {
  7759. if (this._textBaseline !== textBaseline) {
  7760. this._textBaseline = textBaseline;
  7761. this.styleID++;
  7762. }
  7763. },
  7764. enumerable: false,
  7765. configurable: true
  7766. });
  7767. Object.defineProperty(TextStyle2.prototype, "trim", {
  7768. /** Trim transparent borders. */
  7769. get: function() {
  7770. return this._trim;
  7771. },
  7772. set: function(trim) {
  7773. if (this._trim !== trim) {
  7774. this._trim = trim;
  7775. this.styleID++;
  7776. }
  7777. },
  7778. enumerable: false,
  7779. configurable: true
  7780. });
  7781. Object.defineProperty(TextStyle2.prototype, "whiteSpace", {
  7782. /**
  7783. * How newlines and spaces should be handled.
  7784. * Default is 'pre' (preserve, preserve).
  7785. *
  7786. * value | New lines | Spaces
  7787. * --- | --- | ---
  7788. * 'normal' | Collapse | Collapse
  7789. * 'pre' | Preserve | Preserve
  7790. * 'pre-line' | Preserve | Collapse
  7791. *
  7792. * @member {string}
  7793. */
  7794. get: function() {
  7795. return this._whiteSpace;
  7796. },
  7797. set: function(whiteSpace) {
  7798. if (this._whiteSpace !== whiteSpace) {
  7799. this._whiteSpace = whiteSpace;
  7800. this.styleID++;
  7801. }
  7802. },
  7803. enumerable: false,
  7804. configurable: true
  7805. });
  7806. Object.defineProperty(TextStyle2.prototype, "wordWrap", {
  7807. /** Indicates if word wrap should be used. */
  7808. get: function() {
  7809. return this._wordWrap;
  7810. },
  7811. set: function(wordWrap) {
  7812. if (this._wordWrap !== wordWrap) {
  7813. this._wordWrap = wordWrap;
  7814. this.styleID++;
  7815. }
  7816. },
  7817. enumerable: false,
  7818. configurable: true
  7819. });
  7820. Object.defineProperty(TextStyle2.prototype, "wordWrapWidth", {
  7821. /** The width at which text will wrap, it needs wordWrap to be set to true. */
  7822. get: function() {
  7823. return this._wordWrapWidth;
  7824. },
  7825. set: function(wordWrapWidth) {
  7826. if (this._wordWrapWidth !== wordWrapWidth) {
  7827. this._wordWrapWidth = wordWrapWidth;
  7828. this.styleID++;
  7829. }
  7830. },
  7831. enumerable: false,
  7832. configurable: true
  7833. });
  7834. TextStyle2.prototype.toFontString = function() {
  7835. var fontSizeString = typeof this.fontSize === "number" ? this.fontSize + "px" : this.fontSize;
  7836. var fontFamilies = this.fontFamily;
  7837. if (!Array.isArray(this.fontFamily)) {
  7838. fontFamilies = this.fontFamily.split(",");
  7839. }
  7840. for (var i = fontFamilies.length - 1; i >= 0; i--) {
  7841. var fontFamily = fontFamilies[i].trim();
  7842. if (!/([\"\'])[^\'\"]+\1/.test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) {
  7843. fontFamily = '"' + fontFamily + '"';
  7844. }
  7845. fontFamilies[i] = fontFamily;
  7846. }
  7847. return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + fontSizeString + " " + fontFamilies.join(",");
  7848. };
  7849. return TextStyle2;
  7850. })()
  7851. );
  7852. function getSingleColor(color) {
  7853. if (typeof color === "number") {
  7854. return hex2string(color);
  7855. } else if (typeof color === "string") {
  7856. if (color.indexOf("0x") === 0) {
  7857. color = color.replace("0x", "#");
  7858. }
  7859. }
  7860. return color;
  7861. }
  7862. function getColor(color) {
  7863. if (!Array.isArray(color)) {
  7864. return getSingleColor(color);
  7865. } else {
  7866. for (var i = 0; i < color.length; ++i) {
  7867. color[i] = getSingleColor(color[i]);
  7868. }
  7869. return color;
  7870. }
  7871. }
  7872. function areArraysEqual(array1, array2) {
  7873. if (!Array.isArray(array1) || !Array.isArray(array2)) {
  7874. return false;
  7875. }
  7876. if (array1.length !== array2.length) {
  7877. return false;
  7878. }
  7879. for (var i = 0; i < array1.length; ++i) {
  7880. if (array1[i] !== array2[i]) {
  7881. return false;
  7882. }
  7883. }
  7884. return true;
  7885. }
  7886. function deepCopyProperties(target, source, propertyObj) {
  7887. for (var prop in propertyObj) {
  7888. if (Array.isArray(source[prop])) {
  7889. target[prop] = source[prop].slice();
  7890. } else {
  7891. target[prop] = source[prop];
  7892. }
  7893. }
  7894. }
  7895. var contextSettings = {
  7896. // TextMetrics requires getImageData readback for measuring fonts.
  7897. willReadFrequently: true
  7898. };
  7899. var TextMetrics = (
  7900. /** @class */
  7901. (function() {
  7902. function TextMetrics2(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) {
  7903. this.text = text;
  7904. this.style = style;
  7905. this.width = width;
  7906. this.height = height;
  7907. this.lines = lines;
  7908. this.lineWidths = lineWidths;
  7909. this.lineHeight = lineHeight;
  7910. this.maxLineWidth = maxLineWidth;
  7911. this.fontProperties = fontProperties;
  7912. }
  7913. TextMetrics2.measureText = function(text, style, wordWrap, canvas) {
  7914. if (canvas === void 0) {
  7915. canvas = TextMetrics2._canvas;
  7916. }
  7917. wordWrap = wordWrap === void 0 || wordWrap === null ? style.wordWrap : wordWrap;
  7918. var font = style.toFontString();
  7919. var fontProperties = TextMetrics2.measureFont(font);
  7920. if (fontProperties.fontSize === 0) {
  7921. fontProperties.fontSize = style.fontSize;
  7922. fontProperties.ascent = style.fontSize;
  7923. }
  7924. var context = canvas.getContext("2d", contextSettings);
  7925. context.font = font;
  7926. var outputText = wordWrap ? TextMetrics2.wordWrap(text, style, canvas) : text;
  7927. var lines = outputText.split(/(?:\r\n|\r|\n)/);
  7928. var lineWidths = new Array(lines.length);
  7929. var maxLineWidth = 0;
  7930. for (var i = 0; i < lines.length; i++) {
  7931. var lineWidth = context.measureText(lines[i]).width + (lines[i].length - 1) * style.letterSpacing;
  7932. lineWidths[i] = lineWidth;
  7933. maxLineWidth = Math.max(maxLineWidth, lineWidth);
  7934. }
  7935. var width = maxLineWidth + style.strokeThickness;
  7936. if (style.dropShadow) {
  7937. width += style.dropShadowDistance;
  7938. }
  7939. var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;
  7940. var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) + (lines.length - 1) * (lineHeight + style.leading);
  7941. if (style.dropShadow) {
  7942. height += style.dropShadowDistance;
  7943. }
  7944. return new TextMetrics2(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties);
  7945. };
  7946. TextMetrics2.wordWrap = function(text, style, canvas) {
  7947. if (canvas === void 0) {
  7948. canvas = TextMetrics2._canvas;
  7949. }
  7950. var context = canvas.getContext("2d", contextSettings);
  7951. var width = 0;
  7952. var line = "";
  7953. var lines = "";
  7954. var cache = /* @__PURE__ */ Object.create(null);
  7955. var letterSpacing = style.letterSpacing, whiteSpace = style.whiteSpace;
  7956. var collapseSpaces = TextMetrics2.collapseSpaces(whiteSpace);
  7957. var collapseNewlines = TextMetrics2.collapseNewlines(whiteSpace);
  7958. var canPrependSpaces = !collapseSpaces;
  7959. var wordWrapWidth = style.wordWrapWidth + letterSpacing;
  7960. var tokens = TextMetrics2.tokenize(text);
  7961. for (var i = 0; i < tokens.length; i++) {
  7962. var token = tokens[i];
  7963. if (TextMetrics2.isNewline(token)) {
  7964. if (!collapseNewlines) {
  7965. lines += TextMetrics2.addLine(line);
  7966. canPrependSpaces = !collapseSpaces;
  7967. line = "";
  7968. width = 0;
  7969. continue;
  7970. }
  7971. token = " ";
  7972. }
  7973. if (collapseSpaces) {
  7974. var currIsBreakingSpace = TextMetrics2.isBreakingSpace(token);
  7975. var lastIsBreakingSpace = TextMetrics2.isBreakingSpace(line[line.length - 1]);
  7976. if (currIsBreakingSpace && lastIsBreakingSpace) {
  7977. continue;
  7978. }
  7979. }
  7980. var tokenWidth = TextMetrics2.getFromCache(token, letterSpacing, cache, context);
  7981. if (tokenWidth > wordWrapWidth) {
  7982. if (line !== "") {
  7983. lines += TextMetrics2.addLine(line);
  7984. line = "";
  7985. width = 0;
  7986. }
  7987. if (TextMetrics2.canBreakWords(token, style.breakWords)) {
  7988. var characters = TextMetrics2.wordWrapSplit(token);
  7989. for (var j = 0; j < characters.length; j++) {
  7990. var char = characters[j];
  7991. var k = 1;
  7992. while (characters[j + k]) {
  7993. var nextChar = characters[j + k];
  7994. var lastChar = char[char.length - 1];
  7995. if (!TextMetrics2.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) {
  7996. char += nextChar;
  7997. } else {
  7998. break;
  7999. }
  8000. k++;
  8001. }
  8002. j += char.length - 1;
  8003. var characterWidth = TextMetrics2.getFromCache(char, letterSpacing, cache, context);
  8004. if (characterWidth + width > wordWrapWidth) {
  8005. lines += TextMetrics2.addLine(line);
  8006. canPrependSpaces = false;
  8007. line = "";
  8008. width = 0;
  8009. }
  8010. line += char;
  8011. width += characterWidth;
  8012. }
  8013. } else {
  8014. if (line.length > 0) {
  8015. lines += TextMetrics2.addLine(line);
  8016. line = "";
  8017. width = 0;
  8018. }
  8019. var isLastToken = i === tokens.length - 1;
  8020. lines += TextMetrics2.addLine(token, !isLastToken);
  8021. canPrependSpaces = false;
  8022. line = "";
  8023. width = 0;
  8024. }
  8025. } else {
  8026. if (tokenWidth + width > wordWrapWidth) {
  8027. canPrependSpaces = false;
  8028. lines += TextMetrics2.addLine(line);
  8029. line = "";
  8030. width = 0;
  8031. }
  8032. if (line.length > 0 || !TextMetrics2.isBreakingSpace(token) || canPrependSpaces) {
  8033. line += token;
  8034. width += tokenWidth;
  8035. }
  8036. }
  8037. }
  8038. lines += TextMetrics2.addLine(line, false);
  8039. return lines;
  8040. };
  8041. TextMetrics2.addLine = function(line, newLine) {
  8042. if (newLine === void 0) {
  8043. newLine = true;
  8044. }
  8045. line = TextMetrics2.trimRight(line);
  8046. line = newLine ? line + "\n" : line;
  8047. return line;
  8048. };
  8049. TextMetrics2.getFromCache = function(key, letterSpacing, cache, context) {
  8050. var width = cache[key];
  8051. if (typeof width !== "number") {
  8052. var spacing = key.length * letterSpacing;
  8053. width = context.measureText(key).width + spacing;
  8054. cache[key] = width;
  8055. }
  8056. return width;
  8057. };
  8058. TextMetrics2.collapseSpaces = function(whiteSpace) {
  8059. return whiteSpace === "normal" || whiteSpace === "pre-line";
  8060. };
  8061. TextMetrics2.collapseNewlines = function(whiteSpace) {
  8062. return whiteSpace === "normal";
  8063. };
  8064. TextMetrics2.trimRight = function(text) {
  8065. if (typeof text !== "string") {
  8066. return "";
  8067. }
  8068. for (var i = text.length - 1; i >= 0; i--) {
  8069. var char = text[i];
  8070. if (!TextMetrics2.isBreakingSpace(char)) {
  8071. break;
  8072. }
  8073. text = text.slice(0, -1);
  8074. }
  8075. return text;
  8076. };
  8077. TextMetrics2.isNewline = function(char) {
  8078. if (typeof char !== "string") {
  8079. return false;
  8080. }
  8081. return TextMetrics2._newlines.indexOf(char.charCodeAt(0)) >= 0;
  8082. };
  8083. TextMetrics2.isBreakingSpace = function(char, _nextChar) {
  8084. if (typeof char !== "string") {
  8085. return false;
  8086. }
  8087. return TextMetrics2._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0;
  8088. };
  8089. TextMetrics2.tokenize = function(text) {
  8090. var tokens = [];
  8091. var token = "";
  8092. if (typeof text !== "string") {
  8093. return tokens;
  8094. }
  8095. for (var i = 0; i < text.length; i++) {
  8096. var char = text[i];
  8097. var nextChar = text[i + 1];
  8098. if (TextMetrics2.isBreakingSpace(char, nextChar) || TextMetrics2.isNewline(char)) {
  8099. if (token !== "") {
  8100. tokens.push(token);
  8101. token = "";
  8102. }
  8103. tokens.push(char);
  8104. continue;
  8105. }
  8106. token += char;
  8107. }
  8108. if (token !== "") {
  8109. tokens.push(token);
  8110. }
  8111. return tokens;
  8112. };
  8113. TextMetrics2.canBreakWords = function(_token, breakWords) {
  8114. return breakWords;
  8115. };
  8116. TextMetrics2.canBreakChars = function(_char, _nextChar, _token, _index, _breakWords) {
  8117. return true;
  8118. };
  8119. TextMetrics2.wordWrapSplit = function(token) {
  8120. return token.split("");
  8121. };
  8122. TextMetrics2.measureFont = function(font) {
  8123. if (TextMetrics2._fonts[font]) {
  8124. return TextMetrics2._fonts[font];
  8125. }
  8126. var properties = {
  8127. ascent: 0,
  8128. descent: 0,
  8129. fontSize: 0
  8130. };
  8131. var canvas = TextMetrics2._canvas;
  8132. var context = TextMetrics2._context;
  8133. context.font = font;
  8134. var metricsString = TextMetrics2.METRICS_STRING + TextMetrics2.BASELINE_SYMBOL;
  8135. var width = Math.ceil(context.measureText(metricsString).width);
  8136. var baseline = Math.ceil(context.measureText(TextMetrics2.BASELINE_SYMBOL).width);
  8137. var height = Math.ceil(TextMetrics2.HEIGHT_MULTIPLIER * baseline);
  8138. baseline = baseline * TextMetrics2.BASELINE_MULTIPLIER | 0;
  8139. canvas.width = width;
  8140. canvas.height = height;
  8141. context.fillStyle = "#f00";
  8142. context.fillRect(0, 0, width, height);
  8143. context.font = font;
  8144. context.textBaseline = "alphabetic";
  8145. context.fillStyle = "#000";
  8146. context.fillText(metricsString, 0, baseline);
  8147. var imagedata = context.getImageData(0, 0, width, height).data;
  8148. var pixels = imagedata.length;
  8149. var line = width * 4;
  8150. var i = 0;
  8151. var idx = 0;
  8152. var stop = false;
  8153. for (i = 0; i < baseline; ++i) {
  8154. for (var j = 0; j < line; j += 4) {
  8155. if (imagedata[idx + j] !== 255) {
  8156. stop = true;
  8157. break;
  8158. }
  8159. }
  8160. if (!stop) {
  8161. idx += line;
  8162. } else {
  8163. break;
  8164. }
  8165. }
  8166. properties.ascent = baseline - i;
  8167. idx = pixels - line;
  8168. stop = false;
  8169. for (i = height; i > baseline; --i) {
  8170. for (var j = 0; j < line; j += 4) {
  8171. if (imagedata[idx + j] !== 255) {
  8172. stop = true;
  8173. break;
  8174. }
  8175. }
  8176. if (!stop) {
  8177. idx -= line;
  8178. } else {
  8179. break;
  8180. }
  8181. }
  8182. properties.descent = i - baseline;
  8183. properties.fontSize = properties.ascent + properties.descent;
  8184. TextMetrics2._fonts[font] = properties;
  8185. return properties;
  8186. };
  8187. TextMetrics2.clearMetrics = function(font) {
  8188. if (font === void 0) {
  8189. font = "";
  8190. }
  8191. if (font) {
  8192. delete TextMetrics2._fonts[font];
  8193. } else {
  8194. TextMetrics2._fonts = {};
  8195. }
  8196. };
  8197. Object.defineProperty(TextMetrics2, "_canvas", {
  8198. /**
  8199. * Cached canvas element for measuring text
  8200. * TODO: this should be private, but isn't because of backward compat, will fix later.
  8201. * @ignore
  8202. */
  8203. get: function() {
  8204. if (!TextMetrics2.__canvas) {
  8205. var canvas = void 0;
  8206. try {
  8207. var c = new OffscreenCanvas(0, 0);
  8208. var context = c.getContext("2d", contextSettings);
  8209. if (context && context.measureText) {
  8210. TextMetrics2.__canvas = c;
  8211. return c;
  8212. }
  8213. canvas = settings.ADAPTER.createCanvas();
  8214. } catch (ex) {
  8215. canvas = settings.ADAPTER.createCanvas();
  8216. }
  8217. canvas.width = canvas.height = 10;
  8218. TextMetrics2.__canvas = canvas;
  8219. }
  8220. return TextMetrics2.__canvas;
  8221. },
  8222. enumerable: false,
  8223. configurable: true
  8224. });
  8225. Object.defineProperty(TextMetrics2, "_context", {
  8226. /**
  8227. * TODO: this should be private, but isn't because of backward compat, will fix later.
  8228. * @ignore
  8229. */
  8230. get: function() {
  8231. if (!TextMetrics2.__context) {
  8232. TextMetrics2.__context = TextMetrics2._canvas.getContext("2d", contextSettings);
  8233. }
  8234. return TextMetrics2.__context;
  8235. },
  8236. enumerable: false,
  8237. configurable: true
  8238. });
  8239. return TextMetrics2;
  8240. })()
  8241. );
  8242. TextMetrics._fonts = {};
  8243. TextMetrics.METRICS_STRING = "|ÉqÅ";
  8244. TextMetrics.BASELINE_SYMBOL = "M";
  8245. TextMetrics.BASELINE_MULTIPLIER = 1.4;
  8246. TextMetrics.HEIGHT_MULTIPLIER = 2;
  8247. TextMetrics._newlines = [
  8248. 10,
  8249. 13
  8250. ];
  8251. TextMetrics._breakingSpaces = [
  8252. 9,
  8253. 32,
  8254. 8192,
  8255. 8193,
  8256. 8194,
  8257. 8195,
  8258. 8196,
  8259. 8197,
  8260. 8198,
  8261. 8200,
  8262. 8201,
  8263. 8202,
  8264. 8287,
  8265. 12288
  8266. ];
  8267. var defaultDestroyOptions = {
  8268. texture: true,
  8269. children: false,
  8270. baseTexture: true
  8271. };
  8272. var Text = (
  8273. /** @class */
  8274. (function(_super) {
  8275. __extends6(Text2, _super);
  8276. function Text2(text, style, canvas) {
  8277. var _this = this;
  8278. var ownCanvas = false;
  8279. if (!canvas) {
  8280. canvas = settings.ADAPTER.createCanvas();
  8281. ownCanvas = true;
  8282. }
  8283. canvas.width = 3;
  8284. canvas.height = 3;
  8285. var texture = Texture.from(canvas);
  8286. texture.orig = new Rectangle();
  8287. texture.trim = new Rectangle();
  8288. _this = _super.call(this, texture) || this;
  8289. _this._ownCanvas = ownCanvas;
  8290. _this.canvas = canvas;
  8291. _this.context = canvas.getContext("2d", {
  8292. // required for trimming to work without warnings
  8293. willReadFrequently: true
  8294. });
  8295. _this._resolution = settings.RESOLUTION;
  8296. _this._autoResolution = true;
  8297. _this._text = null;
  8298. _this._style = null;
  8299. _this._styleListener = null;
  8300. _this._font = "";
  8301. _this.text = text;
  8302. _this.style = style;
  8303. _this.localStyleID = -1;
  8304. return _this;
  8305. }
  8306. Text2.prototype.updateText = function(respectDirty) {
  8307. var style = this._style;
  8308. if (this.localStyleID !== style.styleID) {
  8309. this.dirty = true;
  8310. this.localStyleID = style.styleID;
  8311. }
  8312. if (!this.dirty && respectDirty) {
  8313. return;
  8314. }
  8315. this._font = this._style.toFontString();
  8316. var context = this.context;
  8317. var measured = TextMetrics.measureText(this._text || " ", this._style, this._style.wordWrap, this.canvas);
  8318. var width = measured.width;
  8319. var height = measured.height;
  8320. var lines = measured.lines;
  8321. var lineHeight = measured.lineHeight;
  8322. var lineWidths = measured.lineWidths;
  8323. var maxLineWidth = measured.maxLineWidth;
  8324. var fontProperties = measured.fontProperties;
  8325. this.canvas.width = Math.ceil(Math.ceil(Math.max(1, width) + style.padding * 2) * this._resolution);
  8326. this.canvas.height = Math.ceil(Math.ceil(Math.max(1, height) + style.padding * 2) * this._resolution);
  8327. context.scale(this._resolution, this._resolution);
  8328. context.clearRect(0, 0, this.canvas.width, this.canvas.height);
  8329. context.font = this._font;
  8330. context.lineWidth = style.strokeThickness;
  8331. context.textBaseline = style.textBaseline;
  8332. context.lineJoin = style.lineJoin;
  8333. context.miterLimit = style.miterLimit;
  8334. var linePositionX;
  8335. var linePositionY;
  8336. var passesCount = style.dropShadow ? 2 : 1;
  8337. for (var i = 0; i < passesCount; ++i) {
  8338. var isShadowPass = style.dropShadow && i === 0;
  8339. var dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + style.padding * 2) : 0;
  8340. var dsOffsetShadow = dsOffsetText * this._resolution;
  8341. if (isShadowPass) {
  8342. context.fillStyle = "black";
  8343. context.strokeStyle = "black";
  8344. var dropShadowColor = style.dropShadowColor;
  8345. var rgb = hex2rgb(typeof dropShadowColor === "number" ? dropShadowColor : string2hex(dropShadowColor));
  8346. var dropShadowBlur = style.dropShadowBlur * this._resolution;
  8347. var dropShadowDistance = style.dropShadowDistance * this._resolution;
  8348. context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")";
  8349. context.shadowBlur = dropShadowBlur;
  8350. context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;
  8351. context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance + dsOffsetShadow;
  8352. } else {
  8353. context.fillStyle = this._generateFillStyle(style, lines, measured);
  8354. context.strokeStyle = style.stroke;
  8355. context.shadowColor = "black";
  8356. context.shadowBlur = 0;
  8357. context.shadowOffsetX = 0;
  8358. context.shadowOffsetY = 0;
  8359. }
  8360. var linePositionYShift = (lineHeight - fontProperties.fontSize) / 2;
  8361. if (!Text2.nextLineHeightBehavior || lineHeight - fontProperties.fontSize < 0) {
  8362. linePositionYShift = 0;
  8363. }
  8364. for (var i_1 = 0; i_1 < lines.length; i_1++) {
  8365. linePositionX = style.strokeThickness / 2;
  8366. linePositionY = style.strokeThickness / 2 + i_1 * lineHeight + fontProperties.ascent + linePositionYShift;
  8367. if (style.align === "right") {
  8368. linePositionX += maxLineWidth - lineWidths[i_1];
  8369. } else if (style.align === "center") {
  8370. linePositionX += (maxLineWidth - lineWidths[i_1]) / 2;
  8371. }
  8372. if (style.stroke && style.strokeThickness) {
  8373. this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText, true);
  8374. }
  8375. if (style.fill) {
  8376. this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText);
  8377. }
  8378. }
  8379. }
  8380. this.updateTexture();
  8381. };
  8382. Text2.prototype.drawLetterSpacing = function(text, x, y, isStroke) {
  8383. if (isStroke === void 0) {
  8384. isStroke = false;
  8385. }
  8386. var style = this._style;
  8387. var letterSpacing = style.letterSpacing;
  8388. var supportLetterSpacing = Text2.experimentalLetterSpacing && ("letterSpacing" in CanvasRenderingContext2D.prototype || "textLetterSpacing" in CanvasRenderingContext2D.prototype);
  8389. if (letterSpacing === 0 || supportLetterSpacing) {
  8390. if (supportLetterSpacing) {
  8391. this.context.letterSpacing = letterSpacing;
  8392. this.context.textLetterSpacing = letterSpacing;
  8393. }
  8394. if (isStroke) {
  8395. this.context.strokeText(text, x, y);
  8396. } else {
  8397. this.context.fillText(text, x, y);
  8398. }
  8399. return;
  8400. }
  8401. var currentPosition = x;
  8402. var stringArray = Array.from ? Array.from(text) : text.split("");
  8403. var previousWidth = this.context.measureText(text).width;
  8404. var currentWidth = 0;
  8405. for (var i = 0; i < stringArray.length; ++i) {
  8406. var currentChar = stringArray[i];
  8407. if (isStroke) {
  8408. this.context.strokeText(currentChar, currentPosition, y);
  8409. } else {
  8410. this.context.fillText(currentChar, currentPosition, y);
  8411. }
  8412. var textStr = "";
  8413. for (var j = i + 1; j < stringArray.length; ++j) {
  8414. textStr += stringArray[j];
  8415. }
  8416. currentWidth = this.context.measureText(textStr).width;
  8417. currentPosition += previousWidth - currentWidth + letterSpacing;
  8418. previousWidth = currentWidth;
  8419. }
  8420. };
  8421. Text2.prototype.updateTexture = function() {
  8422. var canvas = this.canvas;
  8423. if (this._style.trim) {
  8424. var trimmed = trimCanvas(canvas);
  8425. if (trimmed.data) {
  8426. canvas.width = trimmed.width;
  8427. canvas.height = trimmed.height;
  8428. this.context.putImageData(trimmed.data, 0, 0);
  8429. }
  8430. }
  8431. var texture = this._texture;
  8432. var style = this._style;
  8433. var padding = style.trim ? 0 : style.padding;
  8434. var baseTexture = texture.baseTexture;
  8435. texture.trim.width = texture._frame.width = canvas.width / this._resolution;
  8436. texture.trim.height = texture._frame.height = canvas.height / this._resolution;
  8437. texture.trim.x = -padding;
  8438. texture.trim.y = -padding;
  8439. texture.orig.width = texture._frame.width - padding * 2;
  8440. texture.orig.height = texture._frame.height - padding * 2;
  8441. this._onTextureUpdate();
  8442. baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);
  8443. texture.updateUvs();
  8444. this.dirty = false;
  8445. };
  8446. Text2.prototype._render = function(renderer) {
  8447. if (this._autoResolution && this._resolution !== renderer.resolution) {
  8448. this._resolution = renderer.resolution;
  8449. this.dirty = true;
  8450. }
  8451. this.updateText(true);
  8452. _super.prototype._render.call(this, renderer);
  8453. };
  8454. Text2.prototype.updateTransform = function() {
  8455. this.updateText(true);
  8456. _super.prototype.updateTransform.call(this);
  8457. };
  8458. Text2.prototype.getBounds = function(skipUpdate, rect) {
  8459. this.updateText(true);
  8460. if (this._textureID === -1) {
  8461. skipUpdate = false;
  8462. }
  8463. return _super.prototype.getBounds.call(this, skipUpdate, rect);
  8464. };
  8465. Text2.prototype.getLocalBounds = function(rect) {
  8466. this.updateText(true);
  8467. return _super.prototype.getLocalBounds.call(this, rect);
  8468. };
  8469. Text2.prototype._calculateBounds = function() {
  8470. this.calculateVertices();
  8471. this._bounds.addQuad(this.vertexData);
  8472. };
  8473. Text2.prototype._generateFillStyle = function(style, lines, metrics) {
  8474. var fillStyle = style.fill;
  8475. if (!Array.isArray(fillStyle)) {
  8476. return fillStyle;
  8477. } else if (fillStyle.length === 1) {
  8478. return fillStyle[0];
  8479. }
  8480. var gradient;
  8481. var dropShadowCorrection = style.dropShadow ? style.dropShadowDistance : 0;
  8482. var padding = style.padding || 0;
  8483. var width = this.canvas.width / this._resolution - dropShadowCorrection - padding * 2;
  8484. var height = this.canvas.height / this._resolution - dropShadowCorrection - padding * 2;
  8485. var fill = fillStyle.slice();
  8486. var fillGradientStops = style.fillGradientStops.slice();
  8487. if (!fillGradientStops.length) {
  8488. var lengthPlus1 = fill.length + 1;
  8489. for (var i = 1; i < lengthPlus1; ++i) {
  8490. fillGradientStops.push(i / lengthPlus1);
  8491. }
  8492. }
  8493. fill.unshift(fillStyle[0]);
  8494. fillGradientStops.unshift(0);
  8495. fill.push(fillStyle[fillStyle.length - 1]);
  8496. fillGradientStops.push(1);
  8497. if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL) {
  8498. gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding);
  8499. var textHeight = metrics.fontProperties.fontSize + style.strokeThickness;
  8500. for (var i = 0; i < lines.length; i++) {
  8501. var lastLineBottom = metrics.lineHeight * (i - 1) + textHeight;
  8502. var thisLineTop = metrics.lineHeight * i;
  8503. var thisLineGradientStart = thisLineTop;
  8504. if (i > 0 && lastLineBottom > thisLineTop) {
  8505. thisLineGradientStart = (thisLineTop + lastLineBottom) / 2;
  8506. }
  8507. var thisLineBottom = thisLineTop + textHeight;
  8508. var nextLineTop = metrics.lineHeight * (i + 1);
  8509. var thisLineGradientEnd = thisLineBottom;
  8510. if (i + 1 < lines.length && nextLineTop < thisLineBottom) {
  8511. thisLineGradientEnd = (thisLineBottom + nextLineTop) / 2;
  8512. }
  8513. var gradStopLineHeight = (thisLineGradientEnd - thisLineGradientStart) / height;
  8514. for (var j = 0; j < fill.length; j++) {
  8515. var lineStop = 0;
  8516. if (typeof fillGradientStops[j] === "number") {
  8517. lineStop = fillGradientStops[j];
  8518. } else {
  8519. lineStop = j / fill.length;
  8520. }
  8521. var globalStop = Math.min(1, Math.max(0, thisLineGradientStart / height + lineStop * gradStopLineHeight));
  8522. globalStop = Number(globalStop.toFixed(5));
  8523. gradient.addColorStop(globalStop, fill[j]);
  8524. }
  8525. }
  8526. } else {
  8527. gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2);
  8528. var totalIterations = fill.length + 1;
  8529. var currentIteration = 1;
  8530. for (var i = 0; i < fill.length; i++) {
  8531. var stop = void 0;
  8532. if (typeof fillGradientStops[i] === "number") {
  8533. stop = fillGradientStops[i];
  8534. } else {
  8535. stop = currentIteration / totalIterations;
  8536. }
  8537. gradient.addColorStop(stop, fill[i]);
  8538. currentIteration++;
  8539. }
  8540. }
  8541. return gradient;
  8542. };
  8543. Text2.prototype.destroy = function(options) {
  8544. if (typeof options === "boolean") {
  8545. options = { children: options };
  8546. }
  8547. options = Object.assign({}, defaultDestroyOptions, options);
  8548. _super.prototype.destroy.call(this, options);
  8549. if (this._ownCanvas) {
  8550. this.canvas.height = this.canvas.width = 0;
  8551. }
  8552. this.context = null;
  8553. this.canvas = null;
  8554. this._style = null;
  8555. };
  8556. Object.defineProperty(Text2.prototype, "width", {
  8557. /** The width of the Text, setting this will actually modify the scale to achieve the value set. */
  8558. get: function() {
  8559. this.updateText(true);
  8560. return Math.abs(this.scale.x) * this._texture.orig.width;
  8561. },
  8562. set: function(value) {
  8563. this.updateText(true);
  8564. var s = sign(this.scale.x) || 1;
  8565. this.scale.x = s * value / this._texture.orig.width;
  8566. this._width = value;
  8567. },
  8568. enumerable: false,
  8569. configurable: true
  8570. });
  8571. Object.defineProperty(Text2.prototype, "height", {
  8572. /** The height of the Text, setting this will actually modify the scale to achieve the value set. */
  8573. get: function() {
  8574. this.updateText(true);
  8575. return Math.abs(this.scale.y) * this._texture.orig.height;
  8576. },
  8577. set: function(value) {
  8578. this.updateText(true);
  8579. var s = sign(this.scale.y) || 1;
  8580. this.scale.y = s * value / this._texture.orig.height;
  8581. this._height = value;
  8582. },
  8583. enumerable: false,
  8584. configurable: true
  8585. });
  8586. Object.defineProperty(Text2.prototype, "style", {
  8587. /**
  8588. * Set the style of the text.
  8589. *
  8590. * Set up an event listener to listen for changes on the style object and mark the text as dirty.
  8591. */
  8592. get: function() {
  8593. return this._style;
  8594. },
  8595. set: function(style) {
  8596. style = style || {};
  8597. if (style instanceof TextStyle) {
  8598. this._style = style;
  8599. } else {
  8600. this._style = new TextStyle(style);
  8601. }
  8602. this.localStyleID = -1;
  8603. this.dirty = true;
  8604. },
  8605. enumerable: false,
  8606. configurable: true
  8607. });
  8608. Object.defineProperty(Text2.prototype, "text", {
  8609. /** Set the copy for the text object. To split a line you can use '\n'. */
  8610. get: function() {
  8611. return this._text;
  8612. },
  8613. set: function(text) {
  8614. text = String(text === null || text === void 0 ? "" : text);
  8615. if (this._text === text) {
  8616. return;
  8617. }
  8618. this._text = text;
  8619. this.dirty = true;
  8620. },
  8621. enumerable: false,
  8622. configurable: true
  8623. });
  8624. Object.defineProperty(Text2.prototype, "resolution", {
  8625. /**
  8626. * The resolution / device pixel ratio of the canvas.
  8627. *
  8628. * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
  8629. * @default 1
  8630. */
  8631. get: function() {
  8632. return this._resolution;
  8633. },
  8634. set: function(value) {
  8635. this._autoResolution = false;
  8636. if (this._resolution === value) {
  8637. return;
  8638. }
  8639. this._resolution = value;
  8640. this.dirty = true;
  8641. },
  8642. enumerable: false,
  8643. configurable: true
  8644. });
  8645. Text2.nextLineHeightBehavior = false;
  8646. Text2.experimentalLetterSpacing = false;
  8647. return Text2;
  8648. })(Sprite)
  8649. );
  8650. // node_modules/@pixi/prepare/dist/esm/prepare.mjs
  8651. settings.UPLOADS_PER_FRAME = 4;
  8652. var extendStatics7 = function(d, b) {
  8653. extendStatics7 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  8654. d2.__proto__ = b2;
  8655. } || function(d2, b2) {
  8656. for (var p in b2) {
  8657. if (b2.hasOwnProperty(p)) {
  8658. d2[p] = b2[p];
  8659. }
  8660. }
  8661. };
  8662. return extendStatics7(d, b);
  8663. };
  8664. function __extends7(d, b) {
  8665. extendStatics7(d, b);
  8666. function __() {
  8667. this.constructor = d;
  8668. }
  8669. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8670. }
  8671. var CountLimiter = (
  8672. /** @class */
  8673. (function() {
  8674. function CountLimiter2(maxItemsPerFrame) {
  8675. this.maxItemsPerFrame = maxItemsPerFrame;
  8676. this.itemsLeft = 0;
  8677. }
  8678. CountLimiter2.prototype.beginFrame = function() {
  8679. this.itemsLeft = this.maxItemsPerFrame;
  8680. };
  8681. CountLimiter2.prototype.allowedToUpload = function() {
  8682. return this.itemsLeft-- > 0;
  8683. };
  8684. return CountLimiter2;
  8685. })()
  8686. );
  8687. function findMultipleBaseTextures(item, queue) {
  8688. var result = false;
  8689. if (item && item._textures && item._textures.length) {
  8690. for (var i = 0; i < item._textures.length; i++) {
  8691. if (item._textures[i] instanceof Texture) {
  8692. var baseTexture = item._textures[i].baseTexture;
  8693. if (queue.indexOf(baseTexture) === -1) {
  8694. queue.push(baseTexture);
  8695. result = true;
  8696. }
  8697. }
  8698. }
  8699. }
  8700. return result;
  8701. }
  8702. function findBaseTexture(item, queue) {
  8703. if (item.baseTexture instanceof BaseTexture) {
  8704. var texture = item.baseTexture;
  8705. if (queue.indexOf(texture) === -1) {
  8706. queue.push(texture);
  8707. }
  8708. return true;
  8709. }
  8710. return false;
  8711. }
  8712. function findTexture(item, queue) {
  8713. if (item._texture && item._texture instanceof Texture) {
  8714. var texture = item._texture.baseTexture;
  8715. if (queue.indexOf(texture) === -1) {
  8716. queue.push(texture);
  8717. }
  8718. return true;
  8719. }
  8720. return false;
  8721. }
  8722. function drawText(_helper, item) {
  8723. if (item instanceof Text) {
  8724. item.updateText(true);
  8725. return true;
  8726. }
  8727. return false;
  8728. }
  8729. function calculateTextStyle(_helper, item) {
  8730. if (item instanceof TextStyle) {
  8731. var font = item.toFontString();
  8732. TextMetrics.measureFont(font);
  8733. return true;
  8734. }
  8735. return false;
  8736. }
  8737. function findText(item, queue) {
  8738. if (item instanceof Text) {
  8739. if (queue.indexOf(item.style) === -1) {
  8740. queue.push(item.style);
  8741. }
  8742. if (queue.indexOf(item) === -1) {
  8743. queue.push(item);
  8744. }
  8745. var texture = item._texture.baseTexture;
  8746. if (queue.indexOf(texture) === -1) {
  8747. queue.push(texture);
  8748. }
  8749. return true;
  8750. }
  8751. return false;
  8752. }
  8753. function findTextStyle(item, queue) {
  8754. if (item instanceof TextStyle) {
  8755. if (queue.indexOf(item) === -1) {
  8756. queue.push(item);
  8757. }
  8758. return true;
  8759. }
  8760. return false;
  8761. }
  8762. var BasePrepare = (
  8763. /** @class */
  8764. (function() {
  8765. function BasePrepare2(renderer) {
  8766. var _this = this;
  8767. this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);
  8768. this.renderer = renderer;
  8769. this.uploadHookHelper = null;
  8770. this.queue = [];
  8771. this.addHooks = [];
  8772. this.uploadHooks = [];
  8773. this.completes = [];
  8774. this.ticking = false;
  8775. this.delayedTick = function() {
  8776. if (!_this.queue) {
  8777. return;
  8778. }
  8779. _this.prepareItems();
  8780. };
  8781. this.registerFindHook(findText);
  8782. this.registerFindHook(findTextStyle);
  8783. this.registerFindHook(findMultipleBaseTextures);
  8784. this.registerFindHook(findBaseTexture);
  8785. this.registerFindHook(findTexture);
  8786. this.registerUploadHook(drawText);
  8787. this.registerUploadHook(calculateTextStyle);
  8788. }
  8789. BasePrepare2.prototype.upload = function(item, done) {
  8790. var _this = this;
  8791. if (typeof item === "function") {
  8792. done = item;
  8793. item = null;
  8794. }
  8795. if (done) {
  8796. deprecation("6.5.0", "BasePrepare.upload callback is deprecated, use the return Promise instead.");
  8797. }
  8798. return new Promise(function(resolve2) {
  8799. if (item) {
  8800. _this.add(item);
  8801. }
  8802. var complete = function() {
  8803. done === null || done === void 0 ? void 0 : done();
  8804. resolve2();
  8805. };
  8806. if (_this.queue.length) {
  8807. _this.completes.push(complete);
  8808. if (!_this.ticking) {
  8809. _this.ticking = true;
  8810. Ticker.system.addOnce(_this.tick, _this, UPDATE_PRIORITY.UTILITY);
  8811. }
  8812. } else {
  8813. complete();
  8814. }
  8815. });
  8816. };
  8817. BasePrepare2.prototype.tick = function() {
  8818. setTimeout(this.delayedTick, 0);
  8819. };
  8820. BasePrepare2.prototype.prepareItems = function() {
  8821. this.limiter.beginFrame();
  8822. while (this.queue.length && this.limiter.allowedToUpload()) {
  8823. var item = this.queue[0];
  8824. var uploaded = false;
  8825. if (item && !item._destroyed) {
  8826. for (var i = 0, len = this.uploadHooks.length; i < len; i++) {
  8827. if (this.uploadHooks[i](this.uploadHookHelper, item)) {
  8828. this.queue.shift();
  8829. uploaded = true;
  8830. break;
  8831. }
  8832. }
  8833. }
  8834. if (!uploaded) {
  8835. this.queue.shift();
  8836. }
  8837. }
  8838. if (!this.queue.length) {
  8839. this.ticking = false;
  8840. var completes = this.completes.slice(0);
  8841. this.completes.length = 0;
  8842. for (var i = 0, len = completes.length; i < len; i++) {
  8843. completes[i]();
  8844. }
  8845. } else {
  8846. Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);
  8847. }
  8848. };
  8849. BasePrepare2.prototype.registerFindHook = function(addHook) {
  8850. if (addHook) {
  8851. this.addHooks.push(addHook);
  8852. }
  8853. return this;
  8854. };
  8855. BasePrepare2.prototype.registerUploadHook = function(uploadHook) {
  8856. if (uploadHook) {
  8857. this.uploadHooks.push(uploadHook);
  8858. }
  8859. return this;
  8860. };
  8861. BasePrepare2.prototype.add = function(item) {
  8862. for (var i = 0, len = this.addHooks.length; i < len; i++) {
  8863. if (this.addHooks[i](item, this.queue)) {
  8864. break;
  8865. }
  8866. }
  8867. if (item instanceof Container) {
  8868. for (var i = item.children.length - 1; i >= 0; i--) {
  8869. this.add(item.children[i]);
  8870. }
  8871. }
  8872. return this;
  8873. };
  8874. BasePrepare2.prototype.destroy = function() {
  8875. if (this.ticking) {
  8876. Ticker.system.remove(this.tick, this);
  8877. }
  8878. this.ticking = false;
  8879. this.addHooks = null;
  8880. this.uploadHooks = null;
  8881. this.renderer = null;
  8882. this.completes = null;
  8883. this.queue = null;
  8884. this.limiter = null;
  8885. this.uploadHookHelper = null;
  8886. };
  8887. return BasePrepare2;
  8888. })()
  8889. );
  8890. function uploadBaseTextures(renderer, item) {
  8891. if (item instanceof BaseTexture) {
  8892. if (!item._glTextures[renderer.CONTEXT_UID]) {
  8893. renderer.texture.bind(item);
  8894. }
  8895. return true;
  8896. }
  8897. return false;
  8898. }
  8899. function uploadGraphics(renderer, item) {
  8900. if (!(item instanceof Graphics)) {
  8901. return false;
  8902. }
  8903. var geometry = item.geometry;
  8904. item.finishPoly();
  8905. geometry.updateBatches();
  8906. var batches = geometry.batches;
  8907. for (var i = 0; i < batches.length; i++) {
  8908. var texture = batches[i].style.texture;
  8909. if (texture) {
  8910. uploadBaseTextures(renderer, texture.baseTexture);
  8911. }
  8912. }
  8913. if (!geometry.batchable) {
  8914. renderer.geometry.bind(geometry, item._resolveDirectShader(renderer));
  8915. }
  8916. return true;
  8917. }
  8918. function findGraphics(item, queue) {
  8919. if (item instanceof Graphics) {
  8920. queue.push(item);
  8921. return true;
  8922. }
  8923. return false;
  8924. }
  8925. var Prepare = (
  8926. /** @class */
  8927. (function(_super) {
  8928. __extends7(Prepare2, _super);
  8929. function Prepare2(renderer) {
  8930. var _this = _super.call(this, renderer) || this;
  8931. _this.uploadHookHelper = _this.renderer;
  8932. _this.registerFindHook(findGraphics);
  8933. _this.registerUploadHook(uploadBaseTextures);
  8934. _this.registerUploadHook(uploadGraphics);
  8935. return _this;
  8936. }
  8937. Prepare2.extension = {
  8938. name: "prepare",
  8939. type: ExtensionType.RendererPlugin
  8940. };
  8941. return Prepare2;
  8942. })(BasePrepare)
  8943. );
  8944. var TimeLimiter = (
  8945. /** @class */
  8946. (function() {
  8947. function TimeLimiter2(maxMilliseconds) {
  8948. this.maxMilliseconds = maxMilliseconds;
  8949. this.frameStart = 0;
  8950. }
  8951. TimeLimiter2.prototype.beginFrame = function() {
  8952. this.frameStart = Date.now();
  8953. };
  8954. TimeLimiter2.prototype.allowedToUpload = function() {
  8955. return Date.now() - this.frameStart < this.maxMilliseconds;
  8956. };
  8957. return TimeLimiter2;
  8958. })()
  8959. );
  8960. // node_modules/@pixi/spritesheet/dist/esm/spritesheet.mjs
  8961. var Spritesheet = (
  8962. /** @class */
  8963. (function() {
  8964. function Spritesheet2(texture, data, resolutionFilename) {
  8965. if (resolutionFilename === void 0) {
  8966. resolutionFilename = null;
  8967. }
  8968. this.linkedSheets = [];
  8969. this._texture = texture instanceof Texture ? texture : null;
  8970. this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture;
  8971. this.textures = {};
  8972. this.animations = {};
  8973. this.data = data;
  8974. var resource = this.baseTexture.resource;
  8975. this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));
  8976. this._frames = this.data.frames;
  8977. this._frameKeys = Object.keys(this._frames);
  8978. this._batchIndex = 0;
  8979. this._callback = null;
  8980. }
  8981. Spritesheet2.prototype._updateResolution = function(resolutionFilename) {
  8982. if (resolutionFilename === void 0) {
  8983. resolutionFilename = null;
  8984. }
  8985. var scale = this.data.meta.scale;
  8986. var resolution = getResolutionOfUrl(resolutionFilename, null);
  8987. if (resolution === null) {
  8988. resolution = scale !== void 0 ? parseFloat(scale) : 1;
  8989. }
  8990. if (resolution !== 1) {
  8991. this.baseTexture.setResolution(resolution);
  8992. }
  8993. return resolution;
  8994. };
  8995. Spritesheet2.prototype.parse = function(callback) {
  8996. var _this = this;
  8997. if (callback) {
  8998. deprecation("6.5.0", "Spritesheet.parse callback is deprecated, use the return Promise instead.");
  8999. }
  9000. return new Promise(function(resolve2) {
  9001. _this._callback = function(textures) {
  9002. callback === null || callback === void 0 ? void 0 : callback(textures);
  9003. resolve2(textures);
  9004. };
  9005. _this._batchIndex = 0;
  9006. if (_this._frameKeys.length <= Spritesheet2.BATCH_SIZE) {
  9007. _this._processFrames(0);
  9008. _this._processAnimations();
  9009. _this._parseComplete();
  9010. } else {
  9011. _this._nextBatch();
  9012. }
  9013. });
  9014. };
  9015. Spritesheet2.prototype._processFrames = function(initialFrameIndex) {
  9016. var frameIndex = initialFrameIndex;
  9017. var maxFrames = Spritesheet2.BATCH_SIZE;
  9018. while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) {
  9019. var i = this._frameKeys[frameIndex];
  9020. var data = this._frames[i];
  9021. var rect = data.frame;
  9022. if (rect) {
  9023. var frame = null;
  9024. var trim = null;
  9025. var sourceSize = data.trimmed !== false && data.sourceSize ? data.sourceSize : data.frame;
  9026. var orig = new Rectangle(0, 0, Math.floor(sourceSize.w) / this.resolution, Math.floor(sourceSize.h) / this.resolution);
  9027. if (data.rotated) {
  9028. frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.h) / this.resolution, Math.floor(rect.w) / this.resolution);
  9029. } else {
  9030. frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution);
  9031. }
  9032. if (data.trimmed !== false && data.spriteSourceSize) {
  9033. trim = new Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution);
  9034. }
  9035. this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor);
  9036. Texture.addToCache(this.textures[i], i);
  9037. }
  9038. frameIndex++;
  9039. }
  9040. };
  9041. Spritesheet2.prototype._processAnimations = function() {
  9042. var animations = this.data.animations || {};
  9043. for (var animName in animations) {
  9044. this.animations[animName] = [];
  9045. for (var i = 0; i < animations[animName].length; i++) {
  9046. var frameName = animations[animName][i];
  9047. this.animations[animName].push(this.textures[frameName]);
  9048. }
  9049. }
  9050. };
  9051. Spritesheet2.prototype._parseComplete = function() {
  9052. var callback = this._callback;
  9053. this._callback = null;
  9054. this._batchIndex = 0;
  9055. callback.call(this, this.textures);
  9056. };
  9057. Spritesheet2.prototype._nextBatch = function() {
  9058. var _this = this;
  9059. this._processFrames(this._batchIndex * Spritesheet2.BATCH_SIZE);
  9060. this._batchIndex++;
  9061. setTimeout(function() {
  9062. if (_this._batchIndex * Spritesheet2.BATCH_SIZE < _this._frameKeys.length) {
  9063. _this._nextBatch();
  9064. } else {
  9065. _this._processAnimations();
  9066. _this._parseComplete();
  9067. }
  9068. }, 0);
  9069. };
  9070. Spritesheet2.prototype.destroy = function(destroyBase) {
  9071. var _a3;
  9072. if (destroyBase === void 0) {
  9073. destroyBase = false;
  9074. }
  9075. for (var i in this.textures) {
  9076. this.textures[i].destroy();
  9077. }
  9078. this._frames = null;
  9079. this._frameKeys = null;
  9080. this.data = null;
  9081. this.textures = null;
  9082. if (destroyBase) {
  9083. (_a3 = this._texture) === null || _a3 === void 0 ? void 0 : _a3.destroy();
  9084. this.baseTexture.destroy();
  9085. }
  9086. this._texture = null;
  9087. this.baseTexture = null;
  9088. this.linkedSheets = [];
  9089. };
  9090. Spritesheet2.BATCH_SIZE = 1e3;
  9091. return Spritesheet2;
  9092. })()
  9093. );
  9094. var SpritesheetLoader = (
  9095. /** @class */
  9096. (function() {
  9097. function SpritesheetLoader2() {
  9098. }
  9099. SpritesheetLoader2.use = function(resource, next) {
  9100. var _a3, _b2;
  9101. var loader = this;
  9102. var imageResourceName = resource.name + "_image";
  9103. if (!resource.data || resource.type !== LoaderResource.TYPE.JSON || !resource.data.frames || loader.resources[imageResourceName]) {
  9104. next();
  9105. return;
  9106. }
  9107. var multiPacks = (_b2 = (_a3 = resource.data) === null || _a3 === void 0 ? void 0 : _a3.meta) === null || _b2 === void 0 ? void 0 : _b2.related_multi_packs;
  9108. if (Array.isArray(multiPacks)) {
  9109. var _loop_1 = function(item2) {
  9110. if (typeof item2 !== "string") {
  9111. return "continue";
  9112. }
  9113. var itemName = item2.replace(".json", "");
  9114. var itemUrl = url.resolve(resource.url.replace(loader.baseUrl, ""), item2);
  9115. if (loader.resources[itemName] || Object.values(loader.resources).some(function(r) {
  9116. return url.format(url.parse(r.url)) === itemUrl;
  9117. })) {
  9118. return "continue";
  9119. }
  9120. var options = {
  9121. crossOrigin: resource.crossOrigin,
  9122. loadType: LoaderResource.LOAD_TYPE.XHR,
  9123. xhrType: LoaderResource.XHR_RESPONSE_TYPE.JSON,
  9124. parentResource: resource,
  9125. metadata: resource.metadata
  9126. };
  9127. loader.add(itemName, itemUrl, options);
  9128. };
  9129. for (var _i = 0, multiPacks_1 = multiPacks; _i < multiPacks_1.length; _i++) {
  9130. var item = multiPacks_1[_i];
  9131. _loop_1(item);
  9132. }
  9133. }
  9134. var loadOptions = {
  9135. crossOrigin: resource.crossOrigin,
  9136. metadata: resource.metadata.imageMetadata,
  9137. parentResource: resource
  9138. };
  9139. var resourcePath = SpritesheetLoader2.getResourcePath(resource, loader.baseUrl);
  9140. loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) {
  9141. if (res.error) {
  9142. next(res.error);
  9143. return;
  9144. }
  9145. var spritesheet = new Spritesheet(res.texture, resource.data, resource.url);
  9146. spritesheet.parse().then(function() {
  9147. resource.spritesheet = spritesheet;
  9148. resource.textures = spritesheet.textures;
  9149. next();
  9150. });
  9151. });
  9152. };
  9153. SpritesheetLoader2.getResourcePath = function(resource, baseUrl) {
  9154. if (resource.isDataUrl) {
  9155. return resource.data.meta.image;
  9156. }
  9157. return url.resolve(resource.url.replace(baseUrl, ""), resource.data.meta.image);
  9158. };
  9159. SpritesheetLoader2.extension = ExtensionType.Loader;
  9160. return SpritesheetLoader2;
  9161. })()
  9162. );
  9163. // node_modules/@pixi/sprite-tiling/dist/esm/sprite-tiling.mjs
  9164. var extendStatics8 = function(d, b) {
  9165. extendStatics8 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  9166. d2.__proto__ = b2;
  9167. } || function(d2, b2) {
  9168. for (var p in b2) {
  9169. if (b2.hasOwnProperty(p)) {
  9170. d2[p] = b2[p];
  9171. }
  9172. }
  9173. };
  9174. return extendStatics8(d, b);
  9175. };
  9176. function __extends8(d, b) {
  9177. extendStatics8(d, b);
  9178. function __() {
  9179. this.constructor = d;
  9180. }
  9181. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9182. }
  9183. var tempPoint2 = new Point();
  9184. var TilingSprite = (
  9185. /** @class */
  9186. (function(_super) {
  9187. __extends8(TilingSprite2, _super);
  9188. function TilingSprite2(texture, width, height) {
  9189. if (width === void 0) {
  9190. width = 100;
  9191. }
  9192. if (height === void 0) {
  9193. height = 100;
  9194. }
  9195. var _this = _super.call(this, texture) || this;
  9196. _this.tileTransform = new Transform();
  9197. _this._width = width;
  9198. _this._height = height;
  9199. _this.uvMatrix = _this.texture.uvMatrix || new TextureMatrix(texture);
  9200. _this.pluginName = "tilingSprite";
  9201. _this.uvRespectAnchor = false;
  9202. return _this;
  9203. }
  9204. Object.defineProperty(TilingSprite2.prototype, "clampMargin", {
  9205. /**
  9206. * Changes frame clamping in corresponding textureTransform, shortcut
  9207. * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
  9208. * @default 0.5
  9209. * @member {number}
  9210. */
  9211. get: function() {
  9212. return this.uvMatrix.clampMargin;
  9213. },
  9214. set: function(value) {
  9215. this.uvMatrix.clampMargin = value;
  9216. this.uvMatrix.update(true);
  9217. },
  9218. enumerable: false,
  9219. configurable: true
  9220. });
  9221. Object.defineProperty(TilingSprite2.prototype, "tileScale", {
  9222. /** The scaling of the image that is being tiled. */
  9223. get: function() {
  9224. return this.tileTransform.scale;
  9225. },
  9226. set: function(value) {
  9227. this.tileTransform.scale.copyFrom(value);
  9228. },
  9229. enumerable: false,
  9230. configurable: true
  9231. });
  9232. Object.defineProperty(TilingSprite2.prototype, "tilePosition", {
  9233. /** The offset of the image that is being tiled. */
  9234. get: function() {
  9235. return this.tileTransform.position;
  9236. },
  9237. set: function(value) {
  9238. this.tileTransform.position.copyFrom(value);
  9239. },
  9240. enumerable: false,
  9241. configurable: true
  9242. });
  9243. TilingSprite2.prototype._onTextureUpdate = function() {
  9244. if (this.uvMatrix) {
  9245. this.uvMatrix.texture = this._texture;
  9246. }
  9247. this._cachedTint = 16777215;
  9248. };
  9249. TilingSprite2.prototype._render = function(renderer) {
  9250. var texture = this._texture;
  9251. if (!texture || !texture.valid) {
  9252. return;
  9253. }
  9254. this.tileTransform.updateLocalTransform();
  9255. this.uvMatrix.update();
  9256. renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
  9257. renderer.plugins[this.pluginName].render(this);
  9258. };
  9259. TilingSprite2.prototype._calculateBounds = function() {
  9260. var minX = this._width * -this._anchor._x;
  9261. var minY = this._height * -this._anchor._y;
  9262. var maxX = this._width * (1 - this._anchor._x);
  9263. var maxY = this._height * (1 - this._anchor._y);
  9264. this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
  9265. };
  9266. TilingSprite2.prototype.getLocalBounds = function(rect) {
  9267. if (this.children.length === 0) {
  9268. this._bounds.minX = this._width * -this._anchor._x;
  9269. this._bounds.minY = this._height * -this._anchor._y;
  9270. this._bounds.maxX = this._width * (1 - this._anchor._x);
  9271. this._bounds.maxY = this._height * (1 - this._anchor._y);
  9272. if (!rect) {
  9273. if (!this._localBoundsRect) {
  9274. this._localBoundsRect = new Rectangle();
  9275. }
  9276. rect = this._localBoundsRect;
  9277. }
  9278. return this._bounds.getRectangle(rect);
  9279. }
  9280. return _super.prototype.getLocalBounds.call(this, rect);
  9281. };
  9282. TilingSprite2.prototype.containsPoint = function(point) {
  9283. this.worldTransform.applyInverse(point, tempPoint2);
  9284. var width = this._width;
  9285. var height = this._height;
  9286. var x1 = -width * this.anchor._x;
  9287. if (tempPoint2.x >= x1 && tempPoint2.x < x1 + width) {
  9288. var y1 = -height * this.anchor._y;
  9289. if (tempPoint2.y >= y1 && tempPoint2.y < y1 + height) {
  9290. return true;
  9291. }
  9292. }
  9293. return false;
  9294. };
  9295. TilingSprite2.prototype.destroy = function(options) {
  9296. _super.prototype.destroy.call(this, options);
  9297. this.tileTransform = null;
  9298. this.uvMatrix = null;
  9299. };
  9300. TilingSprite2.from = function(source, options) {
  9301. var texture = source instanceof Texture ? source : Texture.from(source, options);
  9302. return new TilingSprite2(texture, options.width, options.height);
  9303. };
  9304. Object.defineProperty(TilingSprite2.prototype, "width", {
  9305. /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */
  9306. get: function() {
  9307. return this._width;
  9308. },
  9309. set: function(value) {
  9310. this._width = value;
  9311. },
  9312. enumerable: false,
  9313. configurable: true
  9314. });
  9315. Object.defineProperty(TilingSprite2.prototype, "height", {
  9316. /** The height of the TilingSprite, setting this will actually modify the scale to achieve the value set. */
  9317. get: function() {
  9318. return this._height;
  9319. },
  9320. set: function(value) {
  9321. this._height = value;
  9322. },
  9323. enumerable: false,
  9324. configurable: true
  9325. });
  9326. return TilingSprite2;
  9327. })(Sprite)
  9328. );
  9329. var fragmentSimpleSrc = "#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n";
  9330. var gl1VertexSrc = "#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";
  9331. var gl1FragmentSrc = "#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n";
  9332. var gl2VertexSrc = "#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";
  9333. var gl2FragmentSrc = "#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n";
  9334. var tempMat = new Matrix();
  9335. var TilingSpriteRenderer = (
  9336. /** @class */
  9337. (function(_super) {
  9338. __extends8(TilingSpriteRenderer2, _super);
  9339. function TilingSpriteRenderer2(renderer) {
  9340. var _this = _super.call(this, renderer) || this;
  9341. renderer.runners.contextChange.add(_this);
  9342. _this.quad = new QuadUv();
  9343. _this.state = State.for2d();
  9344. return _this;
  9345. }
  9346. TilingSpriteRenderer2.prototype.contextChange = function() {
  9347. var renderer = this.renderer;
  9348. var uniforms = { globals: renderer.globalUniforms };
  9349. this.simpleShader = Shader.from(gl1VertexSrc, fragmentSimpleSrc, uniforms);
  9350. this.shader = renderer.context.webGLVersion > 1 ? Shader.from(gl2VertexSrc, gl2FragmentSrc, uniforms) : Shader.from(gl1VertexSrc, gl1FragmentSrc, uniforms);
  9351. };
  9352. TilingSpriteRenderer2.prototype.render = function(ts) {
  9353. var renderer = this.renderer;
  9354. var quad = this.quad;
  9355. var vertices = quad.vertices;
  9356. vertices[0] = vertices[6] = ts._width * -ts.anchor.x;
  9357. vertices[1] = vertices[3] = ts._height * -ts.anchor.y;
  9358. vertices[2] = vertices[4] = ts._width * (1 - ts.anchor.x);
  9359. vertices[5] = vertices[7] = ts._height * (1 - ts.anchor.y);
  9360. var anchorX = ts.uvRespectAnchor ? ts.anchor.x : 0;
  9361. var anchorY = ts.uvRespectAnchor ? ts.anchor.y : 0;
  9362. vertices = quad.uvs;
  9363. vertices[0] = vertices[6] = -anchorX;
  9364. vertices[1] = vertices[3] = -anchorY;
  9365. vertices[2] = vertices[4] = 1 - anchorX;
  9366. vertices[5] = vertices[7] = 1 - anchorY;
  9367. quad.invalidate();
  9368. var tex = ts._texture;
  9369. var baseTex = tex.baseTexture;
  9370. var premultiplied = baseTex.alphaMode > 0;
  9371. var lt = ts.tileTransform.localTransform;
  9372. var uv = ts.uvMatrix;
  9373. var isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
  9374. if (isSimple) {
  9375. if (!baseTex._glTextures[renderer.CONTEXT_UID]) {
  9376. if (baseTex.wrapMode === WRAP_MODES.CLAMP) {
  9377. baseTex.wrapMode = WRAP_MODES.REPEAT;
  9378. }
  9379. } else {
  9380. isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;
  9381. }
  9382. }
  9383. var shader = isSimple ? this.simpleShader : this.shader;
  9384. var w = tex.width;
  9385. var h = tex.height;
  9386. var W = ts._width;
  9387. var H = ts._height;
  9388. tempMat.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H);
  9389. tempMat.invert();
  9390. if (isSimple) {
  9391. tempMat.prepend(uv.mapCoord);
  9392. } else {
  9393. shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);
  9394. shader.uniforms.uClampFrame = uv.uClampFrame;
  9395. shader.uniforms.uClampOffset = uv.uClampOffset;
  9396. }
  9397. shader.uniforms.uTransform = tempMat.toArray(true);
  9398. shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, premultiplied);
  9399. shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);
  9400. shader.uniforms.uSampler = tex;
  9401. renderer.shader.bind(shader);
  9402. renderer.geometry.bind(quad);
  9403. this.state.blendMode = correctBlendMode(ts.blendMode, premultiplied);
  9404. renderer.state.set(this.state);
  9405. renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);
  9406. };
  9407. TilingSpriteRenderer2.extension = {
  9408. name: "tilingSprite",
  9409. type: ExtensionType.RendererPlugin
  9410. };
  9411. return TilingSpriteRenderer2;
  9412. })(ObjectRenderer)
  9413. );
  9414. // node_modules/@pixi/mesh/dist/esm/mesh.mjs
  9415. var extendStatics9 = function(d, b) {
  9416. extendStatics9 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  9417. d2.__proto__ = b2;
  9418. } || function(d2, b2) {
  9419. for (var p in b2) {
  9420. if (b2.hasOwnProperty(p)) {
  9421. d2[p] = b2[p];
  9422. }
  9423. }
  9424. };
  9425. return extendStatics9(d, b);
  9426. };
  9427. function __extends9(d, b) {
  9428. extendStatics9(d, b);
  9429. function __() {
  9430. this.constructor = d;
  9431. }
  9432. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9433. }
  9434. var MeshBatchUvs = (
  9435. /** @class */
  9436. (function() {
  9437. function MeshBatchUvs2(uvBuffer, uvMatrix) {
  9438. this.uvBuffer = uvBuffer;
  9439. this.uvMatrix = uvMatrix;
  9440. this.data = null;
  9441. this._bufferUpdateId = -1;
  9442. this._textureUpdateId = -1;
  9443. this._updateID = 0;
  9444. }
  9445. MeshBatchUvs2.prototype.update = function(forceUpdate) {
  9446. if (!forceUpdate && this._bufferUpdateId === this.uvBuffer._updateID && this._textureUpdateId === this.uvMatrix._updateID) {
  9447. return;
  9448. }
  9449. this._bufferUpdateId = this.uvBuffer._updateID;
  9450. this._textureUpdateId = this.uvMatrix._updateID;
  9451. var data = this.uvBuffer.data;
  9452. if (!this.data || this.data.length !== data.length) {
  9453. this.data = new Float32Array(data.length);
  9454. }
  9455. this.uvMatrix.multiplyUvs(data, this.data);
  9456. this._updateID++;
  9457. };
  9458. return MeshBatchUvs2;
  9459. })()
  9460. );
  9461. var tempPoint3 = new Point();
  9462. var tempPolygon = new Polygon();
  9463. var Mesh = (
  9464. /** @class */
  9465. (function(_super) {
  9466. __extends9(Mesh2, _super);
  9467. function Mesh2(geometry, shader, state, drawMode) {
  9468. if (drawMode === void 0) {
  9469. drawMode = DRAW_MODES.TRIANGLES;
  9470. }
  9471. var _this = _super.call(this) || this;
  9472. _this.geometry = geometry;
  9473. _this.shader = shader;
  9474. _this.state = state || State.for2d();
  9475. _this.drawMode = drawMode;
  9476. _this.start = 0;
  9477. _this.size = 0;
  9478. _this.uvs = null;
  9479. _this.indices = null;
  9480. _this.vertexData = new Float32Array(1);
  9481. _this.vertexDirty = -1;
  9482. _this._transformID = -1;
  9483. _this._roundPixels = settings.ROUND_PIXELS;
  9484. _this.batchUvs = null;
  9485. return _this;
  9486. }
  9487. Object.defineProperty(Mesh2.prototype, "geometry", {
  9488. /**
  9489. * Includes vertex positions, face indices, normals, colors, UVs, and
  9490. * custom attributes within buffers, reducing the cost of passing all
  9491. * this data to the GPU. Can be shared between multiple Mesh objects.
  9492. */
  9493. get: function() {
  9494. return this._geometry;
  9495. },
  9496. set: function(value) {
  9497. if (this._geometry === value) {
  9498. return;
  9499. }
  9500. if (this._geometry) {
  9501. this._geometry.refCount--;
  9502. if (this._geometry.refCount === 0) {
  9503. this._geometry.dispose();
  9504. }
  9505. }
  9506. this._geometry = value;
  9507. if (this._geometry) {
  9508. this._geometry.refCount++;
  9509. }
  9510. this.vertexDirty = -1;
  9511. },
  9512. enumerable: false,
  9513. configurable: true
  9514. });
  9515. Object.defineProperty(Mesh2.prototype, "uvBuffer", {
  9516. /**
  9517. * To change mesh uv's, change its uvBuffer data and increment its _updateID.
  9518. * @readonly
  9519. */
  9520. get: function() {
  9521. return this.geometry.buffers[1];
  9522. },
  9523. enumerable: false,
  9524. configurable: true
  9525. });
  9526. Object.defineProperty(Mesh2.prototype, "verticesBuffer", {
  9527. /**
  9528. * To change mesh vertices, change its uvBuffer data and increment its _updateID.
  9529. * Incrementing _updateID is optional because most of Mesh objects do it anyway.
  9530. * @readonly
  9531. */
  9532. get: function() {
  9533. return this.geometry.buffers[0];
  9534. },
  9535. enumerable: false,
  9536. configurable: true
  9537. });
  9538. Object.defineProperty(Mesh2.prototype, "material", {
  9539. get: function() {
  9540. return this.shader;
  9541. },
  9542. /** Alias for {@link PIXI.Mesh#shader}. */
  9543. set: function(value) {
  9544. this.shader = value;
  9545. },
  9546. enumerable: false,
  9547. configurable: true
  9548. });
  9549. Object.defineProperty(Mesh2.prototype, "blendMode", {
  9550. get: function() {
  9551. return this.state.blendMode;
  9552. },
  9553. /**
  9554. * The blend mode to be applied to the Mesh. Apply a value of
  9555. * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.
  9556. * @default PIXI.BLEND_MODES.NORMAL;
  9557. */
  9558. set: function(value) {
  9559. this.state.blendMode = value;
  9560. },
  9561. enumerable: false,
  9562. configurable: true
  9563. });
  9564. Object.defineProperty(Mesh2.prototype, "roundPixels", {
  9565. get: function() {
  9566. return this._roundPixels;
  9567. },
  9568. /**
  9569. * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
  9570. * Advantages can include sharper image quality (like text) and faster rendering on canvas.
  9571. * The main disadvantage is movement of objects may appear less smooth.
  9572. * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
  9573. * @default false
  9574. */
  9575. set: function(value) {
  9576. if (this._roundPixels !== value) {
  9577. this._transformID = -1;
  9578. }
  9579. this._roundPixels = value;
  9580. },
  9581. enumerable: false,
  9582. configurable: true
  9583. });
  9584. Object.defineProperty(Mesh2.prototype, "tint", {
  9585. /**
  9586. * The multiply tint applied to the Mesh. This is a hex value. A value of
  9587. * `0xFFFFFF` will remove any tint effect.
  9588. *
  9589. * Null for non-MeshMaterial shaders
  9590. * @default 0xFFFFFF
  9591. */
  9592. get: function() {
  9593. return "tint" in this.shader ? this.shader.tint : null;
  9594. },
  9595. set: function(value) {
  9596. this.shader.tint = value;
  9597. },
  9598. enumerable: false,
  9599. configurable: true
  9600. });
  9601. Object.defineProperty(Mesh2.prototype, "texture", {
  9602. /** The texture that the Mesh uses. Null for non-MeshMaterial shaders */
  9603. get: function() {
  9604. return "texture" in this.shader ? this.shader.texture : null;
  9605. },
  9606. set: function(value) {
  9607. this.shader.texture = value;
  9608. },
  9609. enumerable: false,
  9610. configurable: true
  9611. });
  9612. Mesh2.prototype._render = function(renderer) {
  9613. var vertices = this.geometry.buffers[0].data;
  9614. var shader = this.shader;
  9615. if (shader.batchable && this.drawMode === DRAW_MODES.TRIANGLES && vertices.length < Mesh2.BATCHABLE_SIZE * 2) {
  9616. this._renderToBatch(renderer);
  9617. } else {
  9618. this._renderDefault(renderer);
  9619. }
  9620. };
  9621. Mesh2.prototype._renderDefault = function(renderer) {
  9622. var shader = this.shader;
  9623. shader.alpha = this.worldAlpha;
  9624. if (shader.update) {
  9625. shader.update();
  9626. }
  9627. renderer.batch.flush();
  9628. shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);
  9629. renderer.shader.bind(shader);
  9630. renderer.state.set(this.state);
  9631. renderer.geometry.bind(this.geometry, shader);
  9632. renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);
  9633. };
  9634. Mesh2.prototype._renderToBatch = function(renderer) {
  9635. var geometry = this.geometry;
  9636. var shader = this.shader;
  9637. if (shader.uvMatrix) {
  9638. shader.uvMatrix.update();
  9639. this.calculateUvs();
  9640. }
  9641. this.calculateVertices();
  9642. this.indices = geometry.indexBuffer.data;
  9643. this._tintRGB = shader._tintRGB;
  9644. this._texture = shader.texture;
  9645. var pluginName = this.material.pluginName;
  9646. renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);
  9647. renderer.plugins[pluginName].render(this);
  9648. };
  9649. Mesh2.prototype.calculateVertices = function() {
  9650. var geometry = this.geometry;
  9651. var verticesBuffer = geometry.buffers[0];
  9652. var vertices = verticesBuffer.data;
  9653. var vertexDirtyId = verticesBuffer._updateID;
  9654. if (vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) {
  9655. return;
  9656. }
  9657. this._transformID = this.transform._worldID;
  9658. if (this.vertexData.length !== vertices.length) {
  9659. this.vertexData = new Float32Array(vertices.length);
  9660. }
  9661. var wt = this.transform.worldTransform;
  9662. var a = wt.a;
  9663. var b = wt.b;
  9664. var c = wt.c;
  9665. var d = wt.d;
  9666. var tx = wt.tx;
  9667. var ty = wt.ty;
  9668. var vertexData = this.vertexData;
  9669. for (var i = 0; i < vertexData.length / 2; i++) {
  9670. var x = vertices[i * 2];
  9671. var y = vertices[i * 2 + 1];
  9672. vertexData[i * 2] = a * x + c * y + tx;
  9673. vertexData[i * 2 + 1] = b * x + d * y + ty;
  9674. }
  9675. if (this._roundPixels) {
  9676. var resolution = settings.RESOLUTION;
  9677. for (var i = 0; i < vertexData.length; ++i) {
  9678. vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);
  9679. }
  9680. }
  9681. this.vertexDirty = vertexDirtyId;
  9682. };
  9683. Mesh2.prototype.calculateUvs = function() {
  9684. var geomUvs = this.geometry.buffers[1];
  9685. var shader = this.shader;
  9686. if (!shader.uvMatrix.isSimple) {
  9687. if (!this.batchUvs) {
  9688. this.batchUvs = new MeshBatchUvs(geomUvs, shader.uvMatrix);
  9689. }
  9690. this.batchUvs.update();
  9691. this.uvs = this.batchUvs.data;
  9692. } else {
  9693. this.uvs = geomUvs.data;
  9694. }
  9695. };
  9696. Mesh2.prototype._calculateBounds = function() {
  9697. this.calculateVertices();
  9698. this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);
  9699. };
  9700. Mesh2.prototype.containsPoint = function(point) {
  9701. if (!this.getBounds().contains(point.x, point.y)) {
  9702. return false;
  9703. }
  9704. this.worldTransform.applyInverse(point, tempPoint3);
  9705. var vertices = this.geometry.getBuffer("aVertexPosition").data;
  9706. var points = tempPolygon.points;
  9707. var indices2 = this.geometry.getIndex().data;
  9708. var len = indices2.length;
  9709. var step = this.drawMode === 4 ? 3 : 1;
  9710. for (var i = 0; i + 2 < len; i += step) {
  9711. var ind0 = indices2[i] * 2;
  9712. var ind1 = indices2[i + 1] * 2;
  9713. var ind2 = indices2[i + 2] * 2;
  9714. points[0] = vertices[ind0];
  9715. points[1] = vertices[ind0 + 1];
  9716. points[2] = vertices[ind1];
  9717. points[3] = vertices[ind1 + 1];
  9718. points[4] = vertices[ind2];
  9719. points[5] = vertices[ind2 + 1];
  9720. if (tempPolygon.contains(tempPoint3.x, tempPoint3.y)) {
  9721. return true;
  9722. }
  9723. }
  9724. return false;
  9725. };
  9726. Mesh2.prototype.destroy = function(options) {
  9727. _super.prototype.destroy.call(this, options);
  9728. if (this._cachedTexture) {
  9729. this._cachedTexture.destroy();
  9730. this._cachedTexture = null;
  9731. }
  9732. this.geometry = null;
  9733. this.shader = null;
  9734. this.state = null;
  9735. this.uvs = null;
  9736. this.indices = null;
  9737. this.vertexData = null;
  9738. };
  9739. Mesh2.BATCHABLE_SIZE = 100;
  9740. return Mesh2;
  9741. })(Container)
  9742. );
  9743. var fragment2 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n";
  9744. var vertex2 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n";
  9745. var MeshMaterial = (
  9746. /** @class */
  9747. (function(_super) {
  9748. __extends9(MeshMaterial2, _super);
  9749. function MeshMaterial2(uSampler, options) {
  9750. var _this = this;
  9751. var uniforms = {
  9752. uSampler,
  9753. alpha: 1,
  9754. uTextureMatrix: Matrix.IDENTITY,
  9755. uColor: new Float32Array([1, 1, 1, 1])
  9756. };
  9757. options = Object.assign({
  9758. tint: 16777215,
  9759. alpha: 1,
  9760. pluginName: "batch"
  9761. }, options);
  9762. if (options.uniforms) {
  9763. Object.assign(uniforms, options.uniforms);
  9764. }
  9765. _this = _super.call(this, options.program || Program.from(vertex2, fragment2), uniforms) || this;
  9766. _this._colorDirty = false;
  9767. _this.uvMatrix = new TextureMatrix(uSampler);
  9768. _this.batchable = options.program === void 0;
  9769. _this.pluginName = options.pluginName;
  9770. _this.tint = options.tint;
  9771. _this.alpha = options.alpha;
  9772. return _this;
  9773. }
  9774. Object.defineProperty(MeshMaterial2.prototype, "texture", {
  9775. /** Reference to the texture being rendered. */
  9776. get: function() {
  9777. return this.uniforms.uSampler;
  9778. },
  9779. set: function(value) {
  9780. if (this.uniforms.uSampler !== value) {
  9781. if (!this.uniforms.uSampler.baseTexture.alphaMode !== !value.baseTexture.alphaMode) {
  9782. this._colorDirty = true;
  9783. }
  9784. this.uniforms.uSampler = value;
  9785. this.uvMatrix.texture = value;
  9786. }
  9787. },
  9788. enumerable: false,
  9789. configurable: true
  9790. });
  9791. Object.defineProperty(MeshMaterial2.prototype, "alpha", {
  9792. get: function() {
  9793. return this._alpha;
  9794. },
  9795. /**
  9796. * This gets automatically set by the object using this.
  9797. * @default 1
  9798. */
  9799. set: function(value) {
  9800. if (value === this._alpha) {
  9801. return;
  9802. }
  9803. this._alpha = value;
  9804. this._colorDirty = true;
  9805. },
  9806. enumerable: false,
  9807. configurable: true
  9808. });
  9809. Object.defineProperty(MeshMaterial2.prototype, "tint", {
  9810. get: function() {
  9811. return this._tint;
  9812. },
  9813. /**
  9814. * Multiply tint for the material.
  9815. * @default 0xFFFFFF
  9816. */
  9817. set: function(value) {
  9818. if (value === this._tint) {
  9819. return;
  9820. }
  9821. this._tint = value;
  9822. this._tintRGB = (value >> 16) + (value & 65280) + ((value & 255) << 16);
  9823. this._colorDirty = true;
  9824. },
  9825. enumerable: false,
  9826. configurable: true
  9827. });
  9828. MeshMaterial2.prototype.update = function() {
  9829. if (this._colorDirty) {
  9830. this._colorDirty = false;
  9831. var baseTexture = this.texture.baseTexture;
  9832. premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode);
  9833. }
  9834. if (this.uvMatrix.update()) {
  9835. this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;
  9836. }
  9837. };
  9838. return MeshMaterial2;
  9839. })(Shader)
  9840. );
  9841. var MeshGeometry = (
  9842. /** @class */
  9843. (function(_super) {
  9844. __extends9(MeshGeometry2, _super);
  9845. function MeshGeometry2(vertices, uvs, index) {
  9846. var _this = _super.call(this) || this;
  9847. var verticesBuffer = new Buffer(vertices);
  9848. var uvsBuffer = new Buffer(uvs, true);
  9849. var indexBuffer = new Buffer(index, true, true);
  9850. _this.addAttribute("aVertexPosition", verticesBuffer, 2, false, TYPES.FLOAT).addAttribute("aTextureCoord", uvsBuffer, 2, false, TYPES.FLOAT).addIndex(indexBuffer);
  9851. _this._updateId = -1;
  9852. return _this;
  9853. }
  9854. Object.defineProperty(MeshGeometry2.prototype, "vertexDirtyId", {
  9855. /**
  9856. * If the vertex position is updated.
  9857. * @readonly
  9858. * @private
  9859. */
  9860. get: function() {
  9861. return this.buffers[0]._updateID;
  9862. },
  9863. enumerable: false,
  9864. configurable: true
  9865. });
  9866. return MeshGeometry2;
  9867. })(Geometry)
  9868. );
  9869. // node_modules/@pixi/text-bitmap/dist/esm/text-bitmap.mjs
  9870. var extendStatics10 = function(d, b) {
  9871. extendStatics10 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  9872. d2.__proto__ = b2;
  9873. } || function(d2, b2) {
  9874. for (var p in b2) {
  9875. if (b2.hasOwnProperty(p)) {
  9876. d2[p] = b2[p];
  9877. }
  9878. }
  9879. };
  9880. return extendStatics10(d, b);
  9881. };
  9882. function __extends10(d, b) {
  9883. extendStatics10(d, b);
  9884. function __() {
  9885. this.constructor = d;
  9886. }
  9887. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9888. }
  9889. var BitmapFontData = (
  9890. /** @class */
  9891. /* @__PURE__ */ (function() {
  9892. function BitmapFontData2() {
  9893. this.info = [];
  9894. this.common = [];
  9895. this.page = [];
  9896. this.char = [];
  9897. this.kerning = [];
  9898. this.distanceField = [];
  9899. }
  9900. return BitmapFontData2;
  9901. })()
  9902. );
  9903. var TextFormat = (
  9904. /** @class */
  9905. (function() {
  9906. function TextFormat2() {
  9907. }
  9908. TextFormat2.test = function(data) {
  9909. return typeof data === "string" && data.indexOf("info face=") === 0;
  9910. };
  9911. TextFormat2.parse = function(txt) {
  9912. var items = txt.match(/^[a-z]+\s+.+$/gm);
  9913. var rawData = {
  9914. info: [],
  9915. common: [],
  9916. page: [],
  9917. char: [],
  9918. chars: [],
  9919. kerning: [],
  9920. kernings: [],
  9921. distanceField: []
  9922. };
  9923. for (var i in items) {
  9924. var name = items[i].match(/^[a-z]+/gm)[0];
  9925. var attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm);
  9926. var itemData = {};
  9927. for (var i_1 in attributeList) {
  9928. var split = attributeList[i_1].split("=");
  9929. var key = split[0];
  9930. var strValue = split[1].replace(/"/gm, "");
  9931. var floatValue = parseFloat(strValue);
  9932. var value = isNaN(floatValue) ? strValue : floatValue;
  9933. itemData[key] = value;
  9934. }
  9935. rawData[name].push(itemData);
  9936. }
  9937. var font = new BitmapFontData();
  9938. rawData.info.forEach(function(info) {
  9939. return font.info.push({
  9940. face: info.face,
  9941. size: parseInt(info.size, 10)
  9942. });
  9943. });
  9944. rawData.common.forEach(function(common) {
  9945. return font.common.push({
  9946. lineHeight: parseInt(common.lineHeight, 10)
  9947. });
  9948. });
  9949. rawData.page.forEach(function(page) {
  9950. return font.page.push({
  9951. id: parseInt(page.id, 10),
  9952. file: page.file
  9953. });
  9954. });
  9955. rawData.char.forEach(function(char) {
  9956. return font.char.push({
  9957. id: parseInt(char.id, 10),
  9958. page: parseInt(char.page, 10),
  9959. x: parseInt(char.x, 10),
  9960. y: parseInt(char.y, 10),
  9961. width: parseInt(char.width, 10),
  9962. height: parseInt(char.height, 10),
  9963. xoffset: parseInt(char.xoffset, 10),
  9964. yoffset: parseInt(char.yoffset, 10),
  9965. xadvance: parseInt(char.xadvance, 10)
  9966. });
  9967. });
  9968. rawData.kerning.forEach(function(kerning) {
  9969. return font.kerning.push({
  9970. first: parseInt(kerning.first, 10),
  9971. second: parseInt(kerning.second, 10),
  9972. amount: parseInt(kerning.amount, 10)
  9973. });
  9974. });
  9975. rawData.distanceField.forEach(function(df) {
  9976. return font.distanceField.push({
  9977. distanceRange: parseInt(df.distanceRange, 10),
  9978. fieldType: df.fieldType
  9979. });
  9980. });
  9981. return font;
  9982. };
  9983. return TextFormat2;
  9984. })()
  9985. );
  9986. var XMLFormat = (
  9987. /** @class */
  9988. (function() {
  9989. function XMLFormat2() {
  9990. }
  9991. XMLFormat2.test = function(data) {
  9992. return data instanceof XMLDocument && data.getElementsByTagName("page").length && data.getElementsByTagName("info")[0].getAttribute("face") !== null;
  9993. };
  9994. XMLFormat2.parse = function(xml) {
  9995. var data = new BitmapFontData();
  9996. var info = xml.getElementsByTagName("info");
  9997. var common = xml.getElementsByTagName("common");
  9998. var page = xml.getElementsByTagName("page");
  9999. var char = xml.getElementsByTagName("char");
  10000. var kerning = xml.getElementsByTagName("kerning");
  10001. var distanceField = xml.getElementsByTagName("distanceField");
  10002. for (var i = 0; i < info.length; i++) {
  10003. data.info.push({
  10004. face: info[i].getAttribute("face"),
  10005. size: parseInt(info[i].getAttribute("size"), 10)
  10006. });
  10007. }
  10008. for (var i = 0; i < common.length; i++) {
  10009. data.common.push({
  10010. lineHeight: parseInt(common[i].getAttribute("lineHeight"), 10)
  10011. });
  10012. }
  10013. for (var i = 0; i < page.length; i++) {
  10014. data.page.push({
  10015. id: parseInt(page[i].getAttribute("id"), 10) || 0,
  10016. file: page[i].getAttribute("file")
  10017. });
  10018. }
  10019. for (var i = 0; i < char.length; i++) {
  10020. var letter = char[i];
  10021. data.char.push({
  10022. id: parseInt(letter.getAttribute("id"), 10),
  10023. page: parseInt(letter.getAttribute("page"), 10) || 0,
  10024. x: parseInt(letter.getAttribute("x"), 10),
  10025. y: parseInt(letter.getAttribute("y"), 10),
  10026. width: parseInt(letter.getAttribute("width"), 10),
  10027. height: parseInt(letter.getAttribute("height"), 10),
  10028. xoffset: parseInt(letter.getAttribute("xoffset"), 10),
  10029. yoffset: parseInt(letter.getAttribute("yoffset"), 10),
  10030. xadvance: parseInt(letter.getAttribute("xadvance"), 10)
  10031. });
  10032. }
  10033. for (var i = 0; i < kerning.length; i++) {
  10034. data.kerning.push({
  10035. first: parseInt(kerning[i].getAttribute("first"), 10),
  10036. second: parseInt(kerning[i].getAttribute("second"), 10),
  10037. amount: parseInt(kerning[i].getAttribute("amount"), 10)
  10038. });
  10039. }
  10040. for (var i = 0; i < distanceField.length; i++) {
  10041. data.distanceField.push({
  10042. fieldType: distanceField[i].getAttribute("fieldType"),
  10043. distanceRange: parseInt(distanceField[i].getAttribute("distanceRange"), 10)
  10044. });
  10045. }
  10046. return data;
  10047. };
  10048. return XMLFormat2;
  10049. })()
  10050. );
  10051. var XMLStringFormat = (
  10052. /** @class */
  10053. (function() {
  10054. function XMLStringFormat2() {
  10055. }
  10056. XMLStringFormat2.test = function(data) {
  10057. if (typeof data === "string" && data.indexOf("<font>") > -1) {
  10058. var xml = new globalThis.DOMParser().parseFromString(data, "text/xml");
  10059. return XMLFormat.test(xml);
  10060. }
  10061. return false;
  10062. };
  10063. XMLStringFormat2.parse = function(xmlTxt) {
  10064. var xml = new globalThis.DOMParser().parseFromString(xmlTxt, "text/xml");
  10065. return XMLFormat.parse(xml);
  10066. };
  10067. return XMLStringFormat2;
  10068. })()
  10069. );
  10070. var formats = [
  10071. TextFormat,
  10072. XMLFormat,
  10073. XMLStringFormat
  10074. ];
  10075. function autoDetectFormat(data) {
  10076. for (var i = 0; i < formats.length; i++) {
  10077. if (formats[i].test(data)) {
  10078. return formats[i];
  10079. }
  10080. }
  10081. return null;
  10082. }
  10083. function generateFillStyle(canvas, context, style, resolution, lines, metrics) {
  10084. var fillStyle = style.fill;
  10085. if (!Array.isArray(fillStyle)) {
  10086. return fillStyle;
  10087. } else if (fillStyle.length === 1) {
  10088. return fillStyle[0];
  10089. }
  10090. var gradient;
  10091. var dropShadowCorrection = style.dropShadow ? style.dropShadowDistance : 0;
  10092. var padding = style.padding || 0;
  10093. var width = canvas.width / resolution - dropShadowCorrection - padding * 2;
  10094. var height = canvas.height / resolution - dropShadowCorrection - padding * 2;
  10095. var fill = fillStyle.slice();
  10096. var fillGradientStops = style.fillGradientStops.slice();
  10097. if (!fillGradientStops.length) {
  10098. var lengthPlus1 = fill.length + 1;
  10099. for (var i = 1; i < lengthPlus1; ++i) {
  10100. fillGradientStops.push(i / lengthPlus1);
  10101. }
  10102. }
  10103. fill.unshift(fillStyle[0]);
  10104. fillGradientStops.unshift(0);
  10105. fill.push(fillStyle[fillStyle.length - 1]);
  10106. fillGradientStops.push(1);
  10107. if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL) {
  10108. gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);
  10109. var lastIterationStop = 0;
  10110. var textHeight = metrics.fontProperties.fontSize + style.strokeThickness;
  10111. var gradStopLineHeight = textHeight / height;
  10112. for (var i = 0; i < lines.length; i++) {
  10113. var thisLineTop = metrics.lineHeight * i;
  10114. for (var j = 0; j < fill.length; j++) {
  10115. var lineStop = 0;
  10116. if (typeof fillGradientStops[j] === "number") {
  10117. lineStop = fillGradientStops[j];
  10118. } else {
  10119. lineStop = j / fill.length;
  10120. }
  10121. var globalStop = thisLineTop / height + lineStop * gradStopLineHeight;
  10122. var clampedStop = Math.max(lastIterationStop, globalStop);
  10123. clampedStop = Math.min(clampedStop, 1);
  10124. gradient.addColorStop(clampedStop, fill[j]);
  10125. lastIterationStop = clampedStop;
  10126. }
  10127. }
  10128. } else {
  10129. gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);
  10130. var totalIterations = fill.length + 1;
  10131. var currentIteration = 1;
  10132. for (var i = 0; i < fill.length; i++) {
  10133. var stop = void 0;
  10134. if (typeof fillGradientStops[i] === "number") {
  10135. stop = fillGradientStops[i];
  10136. } else {
  10137. stop = currentIteration / totalIterations;
  10138. }
  10139. gradient.addColorStop(stop, fill[i]);
  10140. currentIteration++;
  10141. }
  10142. }
  10143. return gradient;
  10144. }
  10145. function drawGlyph(canvas, context, metrics, x, y, resolution, style) {
  10146. var char = metrics.text;
  10147. var fontProperties = metrics.fontProperties;
  10148. context.translate(x, y);
  10149. context.scale(resolution, resolution);
  10150. var tx = style.strokeThickness / 2;
  10151. var ty = -(style.strokeThickness / 2);
  10152. context.font = style.toFontString();
  10153. context.lineWidth = style.strokeThickness;
  10154. context.textBaseline = style.textBaseline;
  10155. context.lineJoin = style.lineJoin;
  10156. context.miterLimit = style.miterLimit;
  10157. context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);
  10158. context.strokeStyle = style.stroke;
  10159. if (style.dropShadow) {
  10160. var dropShadowColor = style.dropShadowColor;
  10161. var rgb = hex2rgb(typeof dropShadowColor === "number" ? dropShadowColor : string2hex(dropShadowColor));
  10162. var dropShadowBlur = style.dropShadowBlur * resolution;
  10163. var dropShadowDistance = style.dropShadowDistance * resolution;
  10164. context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")";
  10165. context.shadowBlur = dropShadowBlur;
  10166. context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;
  10167. context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;
  10168. } else {
  10169. context.shadowColor = "black";
  10170. context.shadowBlur = 0;
  10171. context.shadowOffsetX = 0;
  10172. context.shadowOffsetY = 0;
  10173. }
  10174. if (style.stroke && style.strokeThickness) {
  10175. context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);
  10176. }
  10177. if (style.fill) {
  10178. context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);
  10179. }
  10180. context.setTransform(1, 0, 0, 1, 0, 0);
  10181. context.fillStyle = "rgba(0, 0, 0, 0)";
  10182. }
  10183. function splitTextToCharacters(text) {
  10184. return Array.from ? Array.from(text) : text.split("");
  10185. }
  10186. function resolveCharacters(chars) {
  10187. if (typeof chars === "string") {
  10188. chars = [chars];
  10189. }
  10190. var result = [];
  10191. for (var i = 0, j = chars.length; i < j; i++) {
  10192. var item = chars[i];
  10193. if (Array.isArray(item)) {
  10194. if (item.length !== 2) {
  10195. throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got " + item.length + ".");
  10196. }
  10197. var startCode = item[0].charCodeAt(0);
  10198. var endCode = item[1].charCodeAt(0);
  10199. if (endCode < startCode) {
  10200. throw new Error("[BitmapFont]: Invalid character range.");
  10201. }
  10202. for (var i_1 = startCode, j_1 = endCode; i_1 <= j_1; i_1++) {
  10203. result.push(String.fromCharCode(i_1));
  10204. }
  10205. } else {
  10206. result.push.apply(result, splitTextToCharacters(item));
  10207. }
  10208. }
  10209. if (result.length === 0) {
  10210. throw new Error("[BitmapFont]: Empty set when resolving characters.");
  10211. }
  10212. return result;
  10213. }
  10214. function extractCharCode(str) {
  10215. return str.codePointAt ? str.codePointAt(0) : str.charCodeAt(0);
  10216. }
  10217. var BitmapFont = (
  10218. /** @class */
  10219. (function() {
  10220. function BitmapFont2(data, textures, ownsTextures) {
  10221. var _a3, _b2;
  10222. var info = data.info[0];
  10223. var common = data.common[0];
  10224. var page = data.page[0];
  10225. var distanceField = data.distanceField[0];
  10226. var res = getResolutionOfUrl(page.file);
  10227. var pageTextures = {};
  10228. this._ownsTextures = ownsTextures;
  10229. this.font = info.face;
  10230. this.size = info.size;
  10231. this.lineHeight = common.lineHeight / res;
  10232. this.chars = {};
  10233. this.pageTextures = pageTextures;
  10234. for (var i = 0; i < data.page.length; i++) {
  10235. var _c2 = data.page[i], id = _c2.id, file = _c2.file;
  10236. pageTextures[id] = textures instanceof Array ? textures[i] : textures[file];
  10237. if ((distanceField === null || distanceField === void 0 ? void 0 : distanceField.fieldType) && distanceField.fieldType !== "none") {
  10238. pageTextures[id].baseTexture.alphaMode = ALPHA_MODES.NO_PREMULTIPLIED_ALPHA;
  10239. pageTextures[id].baseTexture.mipmap = MIPMAP_MODES.OFF;
  10240. }
  10241. }
  10242. for (var i = 0; i < data.char.length; i++) {
  10243. var _d = data.char[i], id = _d.id, page_1 = _d.page;
  10244. var _e = data.char[i], x = _e.x, y = _e.y, width = _e.width, height = _e.height, xoffset = _e.xoffset, yoffset = _e.yoffset, xadvance = _e.xadvance;
  10245. x /= res;
  10246. y /= res;
  10247. width /= res;
  10248. height /= res;
  10249. xoffset /= res;
  10250. yoffset /= res;
  10251. xadvance /= res;
  10252. var rect = new Rectangle(x + pageTextures[page_1].frame.x / res, y + pageTextures[page_1].frame.y / res, width, height);
  10253. this.chars[id] = {
  10254. xOffset: xoffset,
  10255. yOffset: yoffset,
  10256. xAdvance: xadvance,
  10257. kerning: {},
  10258. texture: new Texture(pageTextures[page_1].baseTexture, rect),
  10259. page: page_1
  10260. };
  10261. }
  10262. for (var i = 0; i < data.kerning.length; i++) {
  10263. var _f = data.kerning[i], first = _f.first, second = _f.second, amount = _f.amount;
  10264. first /= res;
  10265. second /= res;
  10266. amount /= res;
  10267. if (this.chars[second]) {
  10268. this.chars[second].kerning[first] = amount;
  10269. }
  10270. }
  10271. this.distanceFieldRange = distanceField === null || distanceField === void 0 ? void 0 : distanceField.distanceRange;
  10272. this.distanceFieldType = (_b2 = (_a3 = distanceField === null || distanceField === void 0 ? void 0 : distanceField.fieldType) === null || _a3 === void 0 ? void 0 : _a3.toLowerCase()) !== null && _b2 !== void 0 ? _b2 : "none";
  10273. }
  10274. BitmapFont2.prototype.destroy = function() {
  10275. for (var id in this.chars) {
  10276. this.chars[id].texture.destroy();
  10277. this.chars[id].texture = null;
  10278. }
  10279. for (var id in this.pageTextures) {
  10280. if (this._ownsTextures) {
  10281. this.pageTextures[id].destroy(true);
  10282. }
  10283. this.pageTextures[id] = null;
  10284. }
  10285. this.chars = null;
  10286. this.pageTextures = null;
  10287. };
  10288. BitmapFont2.install = function(data, textures, ownsTextures) {
  10289. var fontData;
  10290. if (data instanceof BitmapFontData) {
  10291. fontData = data;
  10292. } else {
  10293. var format = autoDetectFormat(data);
  10294. if (!format) {
  10295. throw new Error("Unrecognized data format for font.");
  10296. }
  10297. fontData = format.parse(data);
  10298. }
  10299. if (textures instanceof Texture) {
  10300. textures = [textures];
  10301. }
  10302. var font = new BitmapFont2(fontData, textures, ownsTextures);
  10303. BitmapFont2.available[font.font] = font;
  10304. return font;
  10305. };
  10306. BitmapFont2.uninstall = function(name) {
  10307. var font = BitmapFont2.available[name];
  10308. if (!font) {
  10309. throw new Error("No font found named '" + name + "'");
  10310. }
  10311. font.destroy();
  10312. delete BitmapFont2.available[name];
  10313. };
  10314. BitmapFont2.from = function(name, textStyle, options) {
  10315. if (!name) {
  10316. throw new Error("[BitmapFont] Property `name` is required.");
  10317. }
  10318. var _a3 = Object.assign({}, BitmapFont2.defaultOptions, options), chars = _a3.chars, padding = _a3.padding, resolution = _a3.resolution, textureWidth = _a3.textureWidth, textureHeight = _a3.textureHeight;
  10319. var charsList = resolveCharacters(chars);
  10320. var style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);
  10321. var lineWidth = textureWidth;
  10322. var fontData = new BitmapFontData();
  10323. fontData.info[0] = {
  10324. face: style.fontFamily,
  10325. size: style.fontSize
  10326. };
  10327. fontData.common[0] = {
  10328. lineHeight: style.fontSize
  10329. };
  10330. var positionX = 0;
  10331. var positionY = 0;
  10332. var canvas;
  10333. var context;
  10334. var baseTexture;
  10335. var maxCharHeight = 0;
  10336. var textures = [];
  10337. for (var i = 0; i < charsList.length; i++) {
  10338. if (!canvas) {
  10339. canvas = settings.ADAPTER.createCanvas();
  10340. canvas.width = textureWidth;
  10341. canvas.height = textureHeight;
  10342. context = canvas.getContext("2d");
  10343. baseTexture = new BaseTexture(canvas, { resolution });
  10344. textures.push(new Texture(baseTexture));
  10345. fontData.page.push({
  10346. id: textures.length - 1,
  10347. file: ""
  10348. });
  10349. }
  10350. var character = charsList[i];
  10351. var metrics = TextMetrics.measureText(character, style, false, canvas);
  10352. var width = metrics.width;
  10353. var height = Math.ceil(metrics.height);
  10354. var textureGlyphWidth = Math.ceil((style.fontStyle === "italic" ? 2 : 1) * width);
  10355. if (positionY >= textureHeight - height * resolution) {
  10356. if (positionY === 0) {
  10357. throw new Error("[BitmapFont] textureHeight " + textureHeight + "px is too small " + ("(fontFamily: '" + style.fontFamily + "', fontSize: " + style.fontSize + "px, char: '" + character + "')"));
  10358. }
  10359. --i;
  10360. canvas = null;
  10361. context = null;
  10362. baseTexture = null;
  10363. positionY = 0;
  10364. positionX = 0;
  10365. maxCharHeight = 0;
  10366. continue;
  10367. }
  10368. maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);
  10369. if (textureGlyphWidth * resolution + positionX >= lineWidth) {
  10370. if (positionX === 0) {
  10371. throw new Error("[BitmapFont] textureWidth " + textureWidth + "px is too small " + ("(fontFamily: '" + style.fontFamily + "', fontSize: " + style.fontSize + "px, char: '" + character + "')"));
  10372. }
  10373. --i;
  10374. positionY += maxCharHeight * resolution;
  10375. positionY = Math.ceil(positionY);
  10376. positionX = 0;
  10377. maxCharHeight = 0;
  10378. continue;
  10379. }
  10380. drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);
  10381. var id = extractCharCode(metrics.text);
  10382. fontData.char.push({
  10383. id,
  10384. page: textures.length - 1,
  10385. x: positionX / resolution,
  10386. y: positionY / resolution,
  10387. width: textureGlyphWidth,
  10388. height,
  10389. xoffset: 0,
  10390. yoffset: 0,
  10391. xadvance: Math.ceil(width - (style.dropShadow ? style.dropShadowDistance : 0) - (style.stroke ? style.strokeThickness : 0))
  10392. });
  10393. positionX += (textureGlyphWidth + 2 * padding) * resolution;
  10394. positionX = Math.ceil(positionX);
  10395. }
  10396. if (!(options === null || options === void 0 ? void 0 : options.skipKerning)) {
  10397. for (var i = 0, len = charsList.length; i < len; i++) {
  10398. var first = charsList[i];
  10399. for (var j = 0; j < len; j++) {
  10400. var second = charsList[j];
  10401. var c1 = context.measureText(first).width;
  10402. var c2 = context.measureText(second).width;
  10403. var total = context.measureText(first + second).width;
  10404. var amount = total - (c1 + c2);
  10405. if (amount) {
  10406. fontData.kerning.push({
  10407. first: extractCharCode(first),
  10408. second: extractCharCode(second),
  10409. amount
  10410. });
  10411. }
  10412. }
  10413. }
  10414. }
  10415. var font = new BitmapFont2(fontData, textures, true);
  10416. if (BitmapFont2.available[name] !== void 0) {
  10417. BitmapFont2.uninstall(name);
  10418. }
  10419. BitmapFont2.available[name] = font;
  10420. return font;
  10421. };
  10422. BitmapFont2.ALPHA = [["a", "z"], ["A", "Z"], " "];
  10423. BitmapFont2.NUMERIC = [["0", "9"]];
  10424. BitmapFont2.ALPHANUMERIC = [["a", "z"], ["A", "Z"], ["0", "9"], " "];
  10425. BitmapFont2.ASCII = [[" ", "~"]];
  10426. BitmapFont2.defaultOptions = {
  10427. resolution: 1,
  10428. textureWidth: 512,
  10429. textureHeight: 512,
  10430. padding: 4,
  10431. chars: BitmapFont2.ALPHANUMERIC
  10432. };
  10433. BitmapFont2.available = {};
  10434. return BitmapFont2;
  10435. })()
  10436. );
  10437. var msdfFrag = "// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n if (median < 0.01) {\r\n alpha = 0.0;\r\n } else if (median > 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n";
  10438. var msdfVert = "// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n";
  10439. var pageMeshDataDefaultPageMeshData = [];
  10440. var pageMeshDataMSDFPageMeshData = [];
  10441. var charRenderDataPool = [];
  10442. var BitmapText = (
  10443. /** @class */
  10444. (function(_super) {
  10445. __extends10(BitmapText2, _super);
  10446. function BitmapText2(text, style) {
  10447. if (style === void 0) {
  10448. style = {};
  10449. }
  10450. var _this = _super.call(this) || this;
  10451. _this._tint = 16777215;
  10452. var _a3 = Object.assign({}, BitmapText2.styleDefaults, style), align = _a3.align, tint = _a3.tint, maxWidth = _a3.maxWidth, letterSpacing = _a3.letterSpacing, fontName = _a3.fontName, fontSize = _a3.fontSize;
  10453. if (!BitmapFont.available[fontName]) {
  10454. throw new Error('Missing BitmapFont "' + fontName + '"');
  10455. }
  10456. _this._activePagesMeshData = [];
  10457. _this._textWidth = 0;
  10458. _this._textHeight = 0;
  10459. _this._align = align;
  10460. _this._tint = tint;
  10461. _this._font = void 0;
  10462. _this._fontName = fontName;
  10463. _this._fontSize = fontSize;
  10464. _this.text = text;
  10465. _this._maxWidth = maxWidth;
  10466. _this._maxLineHeight = 0;
  10467. _this._letterSpacing = letterSpacing;
  10468. _this._anchor = new ObservablePoint(function() {
  10469. _this.dirty = true;
  10470. }, _this, 0, 0);
  10471. _this._roundPixels = settings.ROUND_PIXELS;
  10472. _this.dirty = true;
  10473. _this._resolution = settings.RESOLUTION;
  10474. _this._autoResolution = true;
  10475. _this._textureCache = {};
  10476. return _this;
  10477. }
  10478. BitmapText2.prototype.updateText = function() {
  10479. var _a3;
  10480. var data = BitmapFont.available[this._fontName];
  10481. var fontSize = this.fontSize;
  10482. var scale = fontSize / data.size;
  10483. var pos = new Point();
  10484. var chars = [];
  10485. var lineWidths = [];
  10486. var lineSpaces = [];
  10487. var text = this._text.replace(/(?:\r\n|\r)/g, "\n") || " ";
  10488. var charsInput = splitTextToCharacters(text);
  10489. var maxWidth = this._maxWidth * data.size / fontSize;
  10490. var pageMeshDataPool = data.distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
  10491. var prevCharCode = null;
  10492. var lastLineWidth = 0;
  10493. var maxLineWidth = 0;
  10494. var line = 0;
  10495. var lastBreakPos = -1;
  10496. var lastBreakWidth = 0;
  10497. var spacesRemoved = 0;
  10498. var maxLineHeight = 0;
  10499. var spaceCount = 0;
  10500. for (var i = 0; i < charsInput.length; i++) {
  10501. var char = charsInput[i];
  10502. var charCode = extractCharCode(char);
  10503. if (/(?:\s)/.test(char)) {
  10504. lastBreakPos = i;
  10505. lastBreakWidth = lastLineWidth;
  10506. spaceCount++;
  10507. }
  10508. if (char === "\r" || char === "\n") {
  10509. lineWidths.push(lastLineWidth);
  10510. lineSpaces.push(-1);
  10511. maxLineWidth = Math.max(maxLineWidth, lastLineWidth);
  10512. ++line;
  10513. ++spacesRemoved;
  10514. pos.x = 0;
  10515. pos.y += data.lineHeight;
  10516. prevCharCode = null;
  10517. spaceCount = 0;
  10518. continue;
  10519. }
  10520. var charData = data.chars[charCode];
  10521. if (!charData) {
  10522. continue;
  10523. }
  10524. if (prevCharCode && charData.kerning[prevCharCode]) {
  10525. pos.x += charData.kerning[prevCharCode];
  10526. }
  10527. var charRenderData = charRenderDataPool.pop() || {
  10528. texture: Texture.EMPTY,
  10529. line: 0,
  10530. charCode: 0,
  10531. prevSpaces: 0,
  10532. position: new Point()
  10533. };
  10534. charRenderData.texture = charData.texture;
  10535. charRenderData.line = line;
  10536. charRenderData.charCode = charCode;
  10537. charRenderData.position.x = pos.x + charData.xOffset + this._letterSpacing / 2;
  10538. charRenderData.position.y = pos.y + charData.yOffset;
  10539. charRenderData.prevSpaces = spaceCount;
  10540. chars.push(charRenderData);
  10541. lastLineWidth = charRenderData.position.x + Math.max(charData.xAdvance - charData.xOffset, charData.texture.orig.width);
  10542. pos.x += charData.xAdvance + this._letterSpacing;
  10543. maxLineHeight = Math.max(maxLineHeight, charData.yOffset + charData.texture.height);
  10544. prevCharCode = charCode;
  10545. if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) {
  10546. ++spacesRemoved;
  10547. removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);
  10548. i = lastBreakPos;
  10549. lastBreakPos = -1;
  10550. lineWidths.push(lastBreakWidth);
  10551. lineSpaces.push(chars.length > 0 ? chars[chars.length - 1].prevSpaces : 0);
  10552. maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);
  10553. line++;
  10554. pos.x = 0;
  10555. pos.y += data.lineHeight;
  10556. prevCharCode = null;
  10557. spaceCount = 0;
  10558. }
  10559. }
  10560. var lastChar = charsInput[charsInput.length - 1];
  10561. if (lastChar !== "\r" && lastChar !== "\n") {
  10562. if (/(?:\s)/.test(lastChar)) {
  10563. lastLineWidth = lastBreakWidth;
  10564. }
  10565. lineWidths.push(lastLineWidth);
  10566. maxLineWidth = Math.max(maxLineWidth, lastLineWidth);
  10567. lineSpaces.push(-1);
  10568. }
  10569. var lineAlignOffsets = [];
  10570. for (var i = 0; i <= line; i++) {
  10571. var alignOffset = 0;
  10572. if (this._align === "right") {
  10573. alignOffset = maxLineWidth - lineWidths[i];
  10574. } else if (this._align === "center") {
  10575. alignOffset = (maxLineWidth - lineWidths[i]) / 2;
  10576. } else if (this._align === "justify") {
  10577. alignOffset = lineSpaces[i] < 0 ? 0 : (maxLineWidth - lineWidths[i]) / lineSpaces[i];
  10578. }
  10579. lineAlignOffsets.push(alignOffset);
  10580. }
  10581. var lenChars = chars.length;
  10582. var pagesMeshData = {};
  10583. var newPagesMeshData = [];
  10584. var activePagesMeshData = this._activePagesMeshData;
  10585. pageMeshDataPool.push.apply(pageMeshDataPool, activePagesMeshData);
  10586. for (var i = 0; i < lenChars; i++) {
  10587. var texture = chars[i].texture;
  10588. var baseTextureUid = texture.baseTexture.uid;
  10589. if (!pagesMeshData[baseTextureUid]) {
  10590. var pageMeshData = pageMeshDataPool.pop();
  10591. if (!pageMeshData) {
  10592. var geometry = new MeshGeometry();
  10593. var material = void 0;
  10594. var meshBlendMode = void 0;
  10595. if (data.distanceFieldType === "none") {
  10596. material = new MeshMaterial(Texture.EMPTY);
  10597. meshBlendMode = BLEND_MODES.NORMAL;
  10598. } else {
  10599. material = new MeshMaterial(Texture.EMPTY, { program: Program.from(msdfVert, msdfFrag), uniforms: { uFWidth: 0 } });
  10600. meshBlendMode = BLEND_MODES.NORMAL_NPM;
  10601. }
  10602. var mesh = new Mesh(geometry, material);
  10603. mesh.blendMode = meshBlendMode;
  10604. pageMeshData = {
  10605. index: 0,
  10606. indexCount: 0,
  10607. vertexCount: 0,
  10608. uvsCount: 0,
  10609. total: 0,
  10610. mesh,
  10611. vertices: null,
  10612. uvs: null,
  10613. indices: null
  10614. };
  10615. }
  10616. pageMeshData.index = 0;
  10617. pageMeshData.indexCount = 0;
  10618. pageMeshData.vertexCount = 0;
  10619. pageMeshData.uvsCount = 0;
  10620. pageMeshData.total = 0;
  10621. var _textureCache = this._textureCache;
  10622. _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);
  10623. pageMeshData.mesh.texture = _textureCache[baseTextureUid];
  10624. pageMeshData.mesh.tint = this._tint;
  10625. newPagesMeshData.push(pageMeshData);
  10626. pagesMeshData[baseTextureUid] = pageMeshData;
  10627. }
  10628. pagesMeshData[baseTextureUid].total++;
  10629. }
  10630. for (var i = 0; i < activePagesMeshData.length; i++) {
  10631. if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1) {
  10632. this.removeChild(activePagesMeshData[i].mesh);
  10633. }
  10634. }
  10635. for (var i = 0; i < newPagesMeshData.length; i++) {
  10636. if (newPagesMeshData[i].mesh.parent !== this) {
  10637. this.addChild(newPagesMeshData[i].mesh);
  10638. }
  10639. }
  10640. this._activePagesMeshData = newPagesMeshData;
  10641. for (var i in pagesMeshData) {
  10642. var pageMeshData = pagesMeshData[i];
  10643. var total = pageMeshData.total;
  10644. if (!(((_a3 = pageMeshData.indices) === null || _a3 === void 0 ? void 0 : _a3.length) > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2) {
  10645. pageMeshData.vertices = new Float32Array(4 * 2 * total);
  10646. pageMeshData.uvs = new Float32Array(4 * 2 * total);
  10647. pageMeshData.indices = new Uint16Array(6 * total);
  10648. } else {
  10649. var total_1 = pageMeshData.total;
  10650. var vertices = pageMeshData.vertices;
  10651. for (var i_1 = total_1 * 4 * 2; i_1 < vertices.length; i_1++) {
  10652. vertices[i_1] = 0;
  10653. }
  10654. }
  10655. pageMeshData.mesh.size = 6 * total;
  10656. }
  10657. for (var i = 0; i < lenChars; i++) {
  10658. var char = chars[i];
  10659. var offset = char.position.x + lineAlignOffsets[char.line] * (this._align === "justify" ? char.prevSpaces : 1);
  10660. if (this._roundPixels) {
  10661. offset = Math.round(offset);
  10662. }
  10663. var xPos = offset * scale;
  10664. var yPos = char.position.y * scale;
  10665. var texture = char.texture;
  10666. var pageMesh = pagesMeshData[texture.baseTexture.uid];
  10667. var textureFrame = texture.frame;
  10668. var textureUvs = texture._uvs;
  10669. var index = pageMesh.index++;
  10670. pageMesh.indices[index * 6 + 0] = 0 + index * 4;
  10671. pageMesh.indices[index * 6 + 1] = 1 + index * 4;
  10672. pageMesh.indices[index * 6 + 2] = 2 + index * 4;
  10673. pageMesh.indices[index * 6 + 3] = 0 + index * 4;
  10674. pageMesh.indices[index * 6 + 4] = 2 + index * 4;
  10675. pageMesh.indices[index * 6 + 5] = 3 + index * 4;
  10676. pageMesh.vertices[index * 8 + 0] = xPos;
  10677. pageMesh.vertices[index * 8 + 1] = yPos;
  10678. pageMesh.vertices[index * 8 + 2] = xPos + textureFrame.width * scale;
  10679. pageMesh.vertices[index * 8 + 3] = yPos;
  10680. pageMesh.vertices[index * 8 + 4] = xPos + textureFrame.width * scale;
  10681. pageMesh.vertices[index * 8 + 5] = yPos + textureFrame.height * scale;
  10682. pageMesh.vertices[index * 8 + 6] = xPos;
  10683. pageMesh.vertices[index * 8 + 7] = yPos + textureFrame.height * scale;
  10684. pageMesh.uvs[index * 8 + 0] = textureUvs.x0;
  10685. pageMesh.uvs[index * 8 + 1] = textureUvs.y0;
  10686. pageMesh.uvs[index * 8 + 2] = textureUvs.x1;
  10687. pageMesh.uvs[index * 8 + 3] = textureUvs.y1;
  10688. pageMesh.uvs[index * 8 + 4] = textureUvs.x2;
  10689. pageMesh.uvs[index * 8 + 5] = textureUvs.y2;
  10690. pageMesh.uvs[index * 8 + 6] = textureUvs.x3;
  10691. pageMesh.uvs[index * 8 + 7] = textureUvs.y3;
  10692. }
  10693. this._textWidth = maxLineWidth * scale;
  10694. this._textHeight = (pos.y + data.lineHeight) * scale;
  10695. for (var i in pagesMeshData) {
  10696. var pageMeshData = pagesMeshData[i];
  10697. if (this.anchor.x !== 0 || this.anchor.y !== 0) {
  10698. var vertexCount = 0;
  10699. var anchorOffsetX = this._textWidth * this.anchor.x;
  10700. var anchorOffsetY = this._textHeight * this.anchor.y;
  10701. for (var i_2 = 0; i_2 < pageMeshData.total; i_2++) {
  10702. pageMeshData.vertices[vertexCount++] -= anchorOffsetX;
  10703. pageMeshData.vertices[vertexCount++] -= anchorOffsetY;
  10704. pageMeshData.vertices[vertexCount++] -= anchorOffsetX;
  10705. pageMeshData.vertices[vertexCount++] -= anchorOffsetY;
  10706. pageMeshData.vertices[vertexCount++] -= anchorOffsetX;
  10707. pageMeshData.vertices[vertexCount++] -= anchorOffsetY;
  10708. pageMeshData.vertices[vertexCount++] -= anchorOffsetX;
  10709. pageMeshData.vertices[vertexCount++] -= anchorOffsetY;
  10710. }
  10711. }
  10712. this._maxLineHeight = maxLineHeight * scale;
  10713. var vertexBuffer = pageMeshData.mesh.geometry.getBuffer("aVertexPosition");
  10714. var textureBuffer = pageMeshData.mesh.geometry.getBuffer("aTextureCoord");
  10715. var indexBuffer = pageMeshData.mesh.geometry.getIndex();
  10716. vertexBuffer.data = pageMeshData.vertices;
  10717. textureBuffer.data = pageMeshData.uvs;
  10718. indexBuffer.data = pageMeshData.indices;
  10719. vertexBuffer.update();
  10720. textureBuffer.update();
  10721. indexBuffer.update();
  10722. }
  10723. for (var i = 0; i < chars.length; i++) {
  10724. charRenderDataPool.push(chars[i]);
  10725. }
  10726. this._font = data;
  10727. this.dirty = false;
  10728. };
  10729. BitmapText2.prototype.updateTransform = function() {
  10730. this.validate();
  10731. this.containerUpdateTransform();
  10732. };
  10733. BitmapText2.prototype._render = function(renderer) {
  10734. if (this._autoResolution && this._resolution !== renderer.resolution) {
  10735. this._resolution = renderer.resolution;
  10736. this.dirty = true;
  10737. }
  10738. var _a3 = BitmapFont.available[this._fontName], distanceFieldRange = _a3.distanceFieldRange, distanceFieldType = _a3.distanceFieldType, size = _a3.size;
  10739. if (distanceFieldType !== "none") {
  10740. var _b2 = this.worldTransform, a = _b2.a, b = _b2.b, c = _b2.c, d = _b2.d;
  10741. var dx = Math.sqrt(a * a + b * b);
  10742. var dy = Math.sqrt(c * c + d * d);
  10743. var worldScale = (Math.abs(dx) + Math.abs(dy)) / 2;
  10744. var fontScale = this.fontSize / size;
  10745. for (var _i = 0, _c2 = this._activePagesMeshData; _i < _c2.length; _i++) {
  10746. var mesh = _c2[_i];
  10747. mesh.mesh.shader.uniforms.uFWidth = worldScale * distanceFieldRange * fontScale * this._resolution;
  10748. }
  10749. }
  10750. _super.prototype._render.call(this, renderer);
  10751. };
  10752. BitmapText2.prototype.getLocalBounds = function() {
  10753. this.validate();
  10754. return _super.prototype.getLocalBounds.call(this);
  10755. };
  10756. BitmapText2.prototype.validate = function() {
  10757. var font = BitmapFont.available[this._fontName];
  10758. if (!font) {
  10759. throw new Error('Missing BitmapFont "' + this._fontName + '"');
  10760. }
  10761. if (this._font !== font) {
  10762. this.dirty = true;
  10763. }
  10764. if (this.dirty) {
  10765. this.updateText();
  10766. }
  10767. };
  10768. Object.defineProperty(BitmapText2.prototype, "tint", {
  10769. /**
  10770. * The tint of the BitmapText object.
  10771. * @default 0xffffff
  10772. */
  10773. get: function() {
  10774. return this._tint;
  10775. },
  10776. set: function(value) {
  10777. if (this._tint === value) {
  10778. return;
  10779. }
  10780. this._tint = value;
  10781. for (var i = 0; i < this._activePagesMeshData.length; i++) {
  10782. this._activePagesMeshData[i].mesh.tint = value;
  10783. }
  10784. },
  10785. enumerable: false,
  10786. configurable: true
  10787. });
  10788. Object.defineProperty(BitmapText2.prototype, "align", {
  10789. /**
  10790. * The alignment of the BitmapText object.
  10791. * @member {string}
  10792. * @default 'left'
  10793. */
  10794. get: function() {
  10795. return this._align;
  10796. },
  10797. set: function(value) {
  10798. if (this._align !== value) {
  10799. this._align = value;
  10800. this.dirty = true;
  10801. }
  10802. },
  10803. enumerable: false,
  10804. configurable: true
  10805. });
  10806. Object.defineProperty(BitmapText2.prototype, "fontName", {
  10807. /** The name of the BitmapFont. */
  10808. get: function() {
  10809. return this._fontName;
  10810. },
  10811. set: function(value) {
  10812. if (!BitmapFont.available[value]) {
  10813. throw new Error('Missing BitmapFont "' + value + '"');
  10814. }
  10815. if (this._fontName !== value) {
  10816. this._fontName = value;
  10817. this.dirty = true;
  10818. }
  10819. },
  10820. enumerable: false,
  10821. configurable: true
  10822. });
  10823. Object.defineProperty(BitmapText2.prototype, "fontSize", {
  10824. /** The size of the font to display. */
  10825. get: function() {
  10826. var _a3;
  10827. return (_a3 = this._fontSize) !== null && _a3 !== void 0 ? _a3 : BitmapFont.available[this._fontName].size;
  10828. },
  10829. set: function(value) {
  10830. if (this._fontSize !== value) {
  10831. this._fontSize = value;
  10832. this.dirty = true;
  10833. }
  10834. },
  10835. enumerable: false,
  10836. configurable: true
  10837. });
  10838. Object.defineProperty(BitmapText2.prototype, "anchor", {
  10839. /**
  10840. * The anchor sets the origin point of the text.
  10841. *
  10842. * The default is `(0,0)`, this means the text's origin is the top left.
  10843. *
  10844. * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.
  10845. *
  10846. * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.
  10847. */
  10848. get: function() {
  10849. return this._anchor;
  10850. },
  10851. set: function(value) {
  10852. if (typeof value === "number") {
  10853. this._anchor.set(value);
  10854. } else {
  10855. this._anchor.copyFrom(value);
  10856. }
  10857. },
  10858. enumerable: false,
  10859. configurable: true
  10860. });
  10861. Object.defineProperty(BitmapText2.prototype, "text", {
  10862. /** The text of the BitmapText object. */
  10863. get: function() {
  10864. return this._text;
  10865. },
  10866. set: function(text) {
  10867. text = String(text === null || text === void 0 ? "" : text);
  10868. if (this._text === text) {
  10869. return;
  10870. }
  10871. this._text = text;
  10872. this.dirty = true;
  10873. },
  10874. enumerable: false,
  10875. configurable: true
  10876. });
  10877. Object.defineProperty(BitmapText2.prototype, "maxWidth", {
  10878. /**
  10879. * The max width of this bitmap text in pixels. If the text provided is longer than the
  10880. * value provided, line breaks will be automatically inserted in the last whitespace.
  10881. * Disable by setting the value to 0.
  10882. */
  10883. get: function() {
  10884. return this._maxWidth;
  10885. },
  10886. set: function(value) {
  10887. if (this._maxWidth === value) {
  10888. return;
  10889. }
  10890. this._maxWidth = value;
  10891. this.dirty = true;
  10892. },
  10893. enumerable: false,
  10894. configurable: true
  10895. });
  10896. Object.defineProperty(BitmapText2.prototype, "maxLineHeight", {
  10897. /**
  10898. * The max line height. This is useful when trying to use the total height of the Text,
  10899. * i.e. when trying to vertically align.
  10900. * @readonly
  10901. */
  10902. get: function() {
  10903. this.validate();
  10904. return this._maxLineHeight;
  10905. },
  10906. enumerable: false,
  10907. configurable: true
  10908. });
  10909. Object.defineProperty(BitmapText2.prototype, "textWidth", {
  10910. /**
  10911. * The width of the overall text, different from fontSize,
  10912. * which is defined in the style object.
  10913. * @readonly
  10914. */
  10915. get: function() {
  10916. this.validate();
  10917. return this._textWidth;
  10918. },
  10919. enumerable: false,
  10920. configurable: true
  10921. });
  10922. Object.defineProperty(BitmapText2.prototype, "letterSpacing", {
  10923. /** Additional space between characters. */
  10924. get: function() {
  10925. return this._letterSpacing;
  10926. },
  10927. set: function(value) {
  10928. if (this._letterSpacing !== value) {
  10929. this._letterSpacing = value;
  10930. this.dirty = true;
  10931. }
  10932. },
  10933. enumerable: false,
  10934. configurable: true
  10935. });
  10936. Object.defineProperty(BitmapText2.prototype, "roundPixels", {
  10937. /**
  10938. * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
  10939. * Advantages can include sharper image quality (like text) and faster rendering on canvas.
  10940. * The main disadvantage is movement of objects may appear less smooth.
  10941. * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
  10942. * @default PIXI.settings.ROUND_PIXELS
  10943. */
  10944. get: function() {
  10945. return this._roundPixels;
  10946. },
  10947. set: function(value) {
  10948. if (value !== this._roundPixels) {
  10949. this._roundPixels = value;
  10950. this.dirty = true;
  10951. }
  10952. },
  10953. enumerable: false,
  10954. configurable: true
  10955. });
  10956. Object.defineProperty(BitmapText2.prototype, "textHeight", {
  10957. /**
  10958. * The height of the overall text, different from fontSize,
  10959. * which is defined in the style object.
  10960. * @readonly
  10961. */
  10962. get: function() {
  10963. this.validate();
  10964. return this._textHeight;
  10965. },
  10966. enumerable: false,
  10967. configurable: true
  10968. });
  10969. Object.defineProperty(BitmapText2.prototype, "resolution", {
  10970. /**
  10971. * The resolution / device pixel ratio of the canvas.
  10972. *
  10973. * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
  10974. * @default 1
  10975. */
  10976. get: function() {
  10977. return this._resolution;
  10978. },
  10979. set: function(value) {
  10980. this._autoResolution = false;
  10981. if (this._resolution === value) {
  10982. return;
  10983. }
  10984. this._resolution = value;
  10985. this.dirty = true;
  10986. },
  10987. enumerable: false,
  10988. configurable: true
  10989. });
  10990. BitmapText2.prototype.destroy = function(options) {
  10991. var _textureCache = this._textureCache;
  10992. var data = BitmapFont.available[this._fontName];
  10993. var pageMeshDataPool = data.distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
  10994. pageMeshDataPool.push.apply(pageMeshDataPool, this._activePagesMeshData);
  10995. for (var _i = 0, _a3 = this._activePagesMeshData; _i < _a3.length; _i++) {
  10996. var pageMeshData = _a3[_i];
  10997. this.removeChild(pageMeshData.mesh);
  10998. }
  10999. this._activePagesMeshData = [];
  11000. pageMeshDataPool.filter(function(page) {
  11001. return _textureCache[page.mesh.texture.baseTexture.uid];
  11002. }).forEach(function(page) {
  11003. page.mesh.texture = Texture.EMPTY;
  11004. });
  11005. for (var id in _textureCache) {
  11006. var texture = _textureCache[id];
  11007. texture.destroy();
  11008. delete _textureCache[id];
  11009. }
  11010. this._font = null;
  11011. this._textureCache = null;
  11012. _super.prototype.destroy.call(this, options);
  11013. };
  11014. BitmapText2.styleDefaults = {
  11015. align: "left",
  11016. tint: 16777215,
  11017. maxWidth: 0,
  11018. letterSpacing: 0
  11019. };
  11020. return BitmapText2;
  11021. })(Container)
  11022. );
  11023. var BitmapFontLoader = (
  11024. /** @class */
  11025. (function() {
  11026. function BitmapFontLoader2() {
  11027. }
  11028. BitmapFontLoader2.add = function() {
  11029. LoaderResource.setExtensionXhrType("fnt", LoaderResource.XHR_RESPONSE_TYPE.TEXT);
  11030. };
  11031. BitmapFontLoader2.use = function(resource, next) {
  11032. var format = autoDetectFormat(resource.data);
  11033. if (!format) {
  11034. next();
  11035. return;
  11036. }
  11037. var baseUrl = BitmapFontLoader2.getBaseUrl(this, resource);
  11038. var data = format.parse(resource.data);
  11039. var textures = {};
  11040. var completed = function(page) {
  11041. textures[page.metadata.pageFile] = page.texture;
  11042. if (Object.keys(textures).length === data.page.length) {
  11043. resource.bitmapFont = BitmapFont.install(data, textures, true);
  11044. next();
  11045. }
  11046. };
  11047. for (var i = 0; i < data.page.length; ++i) {
  11048. var pageFile = data.page[i].file;
  11049. var url2 = baseUrl + pageFile;
  11050. var exists = false;
  11051. for (var name in this.resources) {
  11052. var bitmapResource = this.resources[name];
  11053. if (bitmapResource.url === url2) {
  11054. bitmapResource.metadata.pageFile = pageFile;
  11055. if (bitmapResource.texture) {
  11056. completed(bitmapResource);
  11057. } else {
  11058. bitmapResource.onAfterMiddleware.add(completed);
  11059. }
  11060. exists = true;
  11061. break;
  11062. }
  11063. }
  11064. if (!exists) {
  11065. var options = {
  11066. crossOrigin: resource.crossOrigin,
  11067. loadType: LoaderResource.LOAD_TYPE.IMAGE,
  11068. metadata: Object.assign({ pageFile }, resource.metadata.imageMetadata),
  11069. parentResource: resource
  11070. };
  11071. this.add(url2, options, completed);
  11072. }
  11073. }
  11074. };
  11075. BitmapFontLoader2.getBaseUrl = function(loader, resource) {
  11076. var resUrl = !resource.isDataUrl ? BitmapFontLoader2.dirname(resource.url) : "";
  11077. if (resource.isDataUrl) {
  11078. if (resUrl === ".") {
  11079. resUrl = "";
  11080. }
  11081. if (loader.baseUrl && resUrl) {
  11082. if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === "/") {
  11083. resUrl += "/";
  11084. }
  11085. }
  11086. }
  11087. resUrl = resUrl.replace(loader.baseUrl, "");
  11088. if (resUrl && resUrl.charAt(resUrl.length - 1) !== "/") {
  11089. resUrl += "/";
  11090. }
  11091. return resUrl;
  11092. };
  11093. BitmapFontLoader2.dirname = function(url2) {
  11094. var dir = url2.replace(/\\/g, "/").replace(/\/$/, "").replace(/\/[^\/]*$/, "");
  11095. if (dir === url2) {
  11096. return ".";
  11097. } else if (dir === "") {
  11098. return "/";
  11099. }
  11100. return dir;
  11101. };
  11102. BitmapFontLoader2.extension = ExtensionType.Loader;
  11103. return BitmapFontLoader2;
  11104. })()
  11105. );
  11106. // node_modules/@pixi/filter-alpha/dist/esm/filter-alpha.mjs
  11107. var extendStatics11 = function(d, b) {
  11108. extendStatics11 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  11109. d2.__proto__ = b2;
  11110. } || function(d2, b2) {
  11111. for (var p in b2) {
  11112. if (b2.hasOwnProperty(p)) {
  11113. d2[p] = b2[p];
  11114. }
  11115. }
  11116. };
  11117. return extendStatics11(d, b);
  11118. };
  11119. function __extends11(d, b) {
  11120. extendStatics11(d, b);
  11121. function __() {
  11122. this.constructor = d;
  11123. }
  11124. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11125. }
  11126. var fragment3 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n";
  11127. var AlphaFilter = (
  11128. /** @class */
  11129. (function(_super) {
  11130. __extends11(AlphaFilter2, _super);
  11131. function AlphaFilter2(alpha) {
  11132. if (alpha === void 0) {
  11133. alpha = 1;
  11134. }
  11135. var _this = _super.call(this, defaultVertex$1, fragment3, { uAlpha: 1 }) || this;
  11136. _this.alpha = alpha;
  11137. return _this;
  11138. }
  11139. Object.defineProperty(AlphaFilter2.prototype, "alpha", {
  11140. /**
  11141. * Coefficient for alpha multiplication
  11142. * @default 1
  11143. */
  11144. get: function() {
  11145. return this.uniforms.uAlpha;
  11146. },
  11147. set: function(value) {
  11148. this.uniforms.uAlpha = value;
  11149. },
  11150. enumerable: false,
  11151. configurable: true
  11152. });
  11153. return AlphaFilter2;
  11154. })(Filter)
  11155. );
  11156. // node_modules/@pixi/filter-blur/dist/esm/filter-blur.mjs
  11157. var extendStatics12 = function(d, b) {
  11158. extendStatics12 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  11159. d2.__proto__ = b2;
  11160. } || function(d2, b2) {
  11161. for (var p in b2) {
  11162. if (b2.hasOwnProperty(p)) {
  11163. d2[p] = b2[p];
  11164. }
  11165. }
  11166. };
  11167. return extendStatics12(d, b);
  11168. };
  11169. function __extends12(d, b) {
  11170. extendStatics12(d, b);
  11171. function __() {
  11172. this.constructor = d;
  11173. }
  11174. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11175. }
  11176. var vertTemplate = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }";
  11177. function generateBlurVertSource(kernelSize, x) {
  11178. var halfLength = Math.ceil(kernelSize / 2);
  11179. var vertSource = vertTemplate;
  11180. var blurLoop = "";
  11181. var template;
  11182. if (x) {
  11183. template = "vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);";
  11184. } else {
  11185. template = "vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";
  11186. }
  11187. for (var i = 0; i < kernelSize; i++) {
  11188. var blur = template.replace("%index%", i.toString());
  11189. blur = blur.replace("%sampleIndex%", i - (halfLength - 1) + ".0");
  11190. blurLoop += blur;
  11191. blurLoop += "\n";
  11192. }
  11193. vertSource = vertSource.replace("%blur%", blurLoop);
  11194. vertSource = vertSource.replace("%size%", kernelSize.toString());
  11195. return vertSource;
  11196. }
  11197. var GAUSSIAN_VALUES = {
  11198. 5: [0.153388, 0.221461, 0.250301],
  11199. 7: [0.071303, 0.131514, 0.189879, 0.214607],
  11200. 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],
  11201. 11: [93e-4, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],
  11202. 13: [2406e-6, 9255e-6, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],
  11203. 15: [489e-6, 2403e-6, 9246e-6, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448]
  11204. };
  11205. var fragTemplate = [
  11206. "varying vec2 vBlurTexCoords[%size%];",
  11207. "uniform sampler2D uSampler;",
  11208. "void main(void)",
  11209. "{",
  11210. " gl_FragColor = vec4(0.0);",
  11211. " %blur%",
  11212. "}"
  11213. ].join("\n");
  11214. function generateBlurFragSource(kernelSize) {
  11215. var kernel = GAUSSIAN_VALUES[kernelSize];
  11216. var halfLength = kernel.length;
  11217. var fragSource = fragTemplate;
  11218. var blurLoop = "";
  11219. var template = "gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";
  11220. var value;
  11221. for (var i = 0; i < kernelSize; i++) {
  11222. var blur = template.replace("%index%", i.toString());
  11223. value = i;
  11224. if (i >= halfLength) {
  11225. value = kernelSize - i - 1;
  11226. }
  11227. blur = blur.replace("%value%", kernel[value].toString());
  11228. blurLoop += blur;
  11229. blurLoop += "\n";
  11230. }
  11231. fragSource = fragSource.replace("%blur%", blurLoop);
  11232. fragSource = fragSource.replace("%size%", kernelSize.toString());
  11233. return fragSource;
  11234. }
  11235. var BlurFilterPass = (
  11236. /** @class */
  11237. (function(_super) {
  11238. __extends12(BlurFilterPass2, _super);
  11239. function BlurFilterPass2(horizontal, strength, quality, resolution, kernelSize) {
  11240. if (strength === void 0) {
  11241. strength = 8;
  11242. }
  11243. if (quality === void 0) {
  11244. quality = 4;
  11245. }
  11246. if (resolution === void 0) {
  11247. resolution = settings.FILTER_RESOLUTION;
  11248. }
  11249. if (kernelSize === void 0) {
  11250. kernelSize = 5;
  11251. }
  11252. var _this = this;
  11253. var vertSrc = generateBlurVertSource(kernelSize, horizontal);
  11254. var fragSrc = generateBlurFragSource(kernelSize);
  11255. _this = _super.call(
  11256. this,
  11257. // vertex shader
  11258. vertSrc,
  11259. // fragment shader
  11260. fragSrc
  11261. ) || this;
  11262. _this.horizontal = horizontal;
  11263. _this.resolution = resolution;
  11264. _this._quality = 0;
  11265. _this.quality = quality;
  11266. _this.blur = strength;
  11267. return _this;
  11268. }
  11269. BlurFilterPass2.prototype.apply = function(filterManager, input, output, clearMode) {
  11270. if (output) {
  11271. if (this.horizontal) {
  11272. this.uniforms.strength = 1 / output.width * (output.width / input.width);
  11273. } else {
  11274. this.uniforms.strength = 1 / output.height * (output.height / input.height);
  11275. }
  11276. } else {
  11277. if (this.horizontal) {
  11278. this.uniforms.strength = 1 / filterManager.renderer.width * (filterManager.renderer.width / input.width);
  11279. } else {
  11280. this.uniforms.strength = 1 / filterManager.renderer.height * (filterManager.renderer.height / input.height);
  11281. }
  11282. }
  11283. this.uniforms.strength *= this.strength;
  11284. this.uniforms.strength /= this.passes;
  11285. if (this.passes === 1) {
  11286. filterManager.applyFilter(this, input, output, clearMode);
  11287. } else {
  11288. var renderTarget = filterManager.getFilterTexture();
  11289. var renderer = filterManager.renderer;
  11290. var flip = input;
  11291. var flop = renderTarget;
  11292. this.state.blend = false;
  11293. filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);
  11294. for (var i = 1; i < this.passes - 1; i++) {
  11295. filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);
  11296. this.uniforms.uSampler = flop;
  11297. var temp2 = flop;
  11298. flop = flip;
  11299. flip = temp2;
  11300. renderer.shader.bind(this);
  11301. renderer.geometry.draw(5);
  11302. }
  11303. this.state.blend = true;
  11304. filterManager.applyFilter(this, flop, output, clearMode);
  11305. filterManager.returnFilterTexture(renderTarget);
  11306. }
  11307. };
  11308. Object.defineProperty(BlurFilterPass2.prototype, "blur", {
  11309. /**
  11310. * Sets the strength of both the blur.
  11311. * @default 16
  11312. */
  11313. get: function() {
  11314. return this.strength;
  11315. },
  11316. set: function(value) {
  11317. this.padding = 1 + Math.abs(value) * 2;
  11318. this.strength = value;
  11319. },
  11320. enumerable: false,
  11321. configurable: true
  11322. });
  11323. Object.defineProperty(BlurFilterPass2.prototype, "quality", {
  11324. /**
  11325. * Sets the quality of the blur by modifying the number of passes. More passes means higher
  11326. * quality bluring but the lower the performance.
  11327. * @default 4
  11328. */
  11329. get: function() {
  11330. return this._quality;
  11331. },
  11332. set: function(value) {
  11333. this._quality = value;
  11334. this.passes = value;
  11335. },
  11336. enumerable: false,
  11337. configurable: true
  11338. });
  11339. return BlurFilterPass2;
  11340. })(Filter)
  11341. );
  11342. var BlurFilter = (
  11343. /** @class */
  11344. (function(_super) {
  11345. __extends12(BlurFilter2, _super);
  11346. function BlurFilter2(strength, quality, resolution, kernelSize) {
  11347. if (strength === void 0) {
  11348. strength = 8;
  11349. }
  11350. if (quality === void 0) {
  11351. quality = 4;
  11352. }
  11353. if (resolution === void 0) {
  11354. resolution = settings.FILTER_RESOLUTION;
  11355. }
  11356. if (kernelSize === void 0) {
  11357. kernelSize = 5;
  11358. }
  11359. var _this = _super.call(this) || this;
  11360. _this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);
  11361. _this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);
  11362. _this.resolution = resolution;
  11363. _this.quality = quality;
  11364. _this.blur = strength;
  11365. _this.repeatEdgePixels = false;
  11366. return _this;
  11367. }
  11368. BlurFilter2.prototype.apply = function(filterManager, input, output, clearMode) {
  11369. var xStrength = Math.abs(this.blurXFilter.strength);
  11370. var yStrength = Math.abs(this.blurYFilter.strength);
  11371. if (xStrength && yStrength) {
  11372. var renderTarget = filterManager.getFilterTexture();
  11373. this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);
  11374. this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);
  11375. filterManager.returnFilterTexture(renderTarget);
  11376. } else if (yStrength) {
  11377. this.blurYFilter.apply(filterManager, input, output, clearMode);
  11378. } else {
  11379. this.blurXFilter.apply(filterManager, input, output, clearMode);
  11380. }
  11381. };
  11382. BlurFilter2.prototype.updatePadding = function() {
  11383. if (this._repeatEdgePixels) {
  11384. this.padding = 0;
  11385. } else {
  11386. this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;
  11387. }
  11388. };
  11389. Object.defineProperty(BlurFilter2.prototype, "blur", {
  11390. /**
  11391. * Sets the strength of both the blurX and blurY properties simultaneously
  11392. * @default 2
  11393. */
  11394. get: function() {
  11395. return this.blurXFilter.blur;
  11396. },
  11397. set: function(value) {
  11398. this.blurXFilter.blur = this.blurYFilter.blur = value;
  11399. this.updatePadding();
  11400. },
  11401. enumerable: false,
  11402. configurable: true
  11403. });
  11404. Object.defineProperty(BlurFilter2.prototype, "quality", {
  11405. /**
  11406. * Sets the number of passes for blur. More passes means higher quality bluring.
  11407. * @default 1
  11408. */
  11409. get: function() {
  11410. return this.blurXFilter.quality;
  11411. },
  11412. set: function(value) {
  11413. this.blurXFilter.quality = this.blurYFilter.quality = value;
  11414. },
  11415. enumerable: false,
  11416. configurable: true
  11417. });
  11418. Object.defineProperty(BlurFilter2.prototype, "blurX", {
  11419. /**
  11420. * Sets the strength of the blurX property
  11421. * @default 2
  11422. */
  11423. get: function() {
  11424. return this.blurXFilter.blur;
  11425. },
  11426. set: function(value) {
  11427. this.blurXFilter.blur = value;
  11428. this.updatePadding();
  11429. },
  11430. enumerable: false,
  11431. configurable: true
  11432. });
  11433. Object.defineProperty(BlurFilter2.prototype, "blurY", {
  11434. /**
  11435. * Sets the strength of the blurY property
  11436. * @default 2
  11437. */
  11438. get: function() {
  11439. return this.blurYFilter.blur;
  11440. },
  11441. set: function(value) {
  11442. this.blurYFilter.blur = value;
  11443. this.updatePadding();
  11444. },
  11445. enumerable: false,
  11446. configurable: true
  11447. });
  11448. Object.defineProperty(BlurFilter2.prototype, "blendMode", {
  11449. /**
  11450. * Sets the blendmode of the filter
  11451. * @default PIXI.BLEND_MODES.NORMAL
  11452. */
  11453. get: function() {
  11454. return this.blurYFilter.blendMode;
  11455. },
  11456. set: function(value) {
  11457. this.blurYFilter.blendMode = value;
  11458. },
  11459. enumerable: false,
  11460. configurable: true
  11461. });
  11462. Object.defineProperty(BlurFilter2.prototype, "repeatEdgePixels", {
  11463. /**
  11464. * If set to true the edge of the target will be clamped
  11465. * @default false
  11466. */
  11467. get: function() {
  11468. return this._repeatEdgePixels;
  11469. },
  11470. set: function(value) {
  11471. this._repeatEdgePixels = value;
  11472. this.updatePadding();
  11473. },
  11474. enumerable: false,
  11475. configurable: true
  11476. });
  11477. return BlurFilter2;
  11478. })(Filter)
  11479. );
  11480. // node_modules/@pixi/filter-color-matrix/dist/esm/filter-color-matrix.mjs
  11481. var extendStatics13 = function(d, b) {
  11482. extendStatics13 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  11483. d2.__proto__ = b2;
  11484. } || function(d2, b2) {
  11485. for (var p in b2) {
  11486. if (b2.hasOwnProperty(p)) {
  11487. d2[p] = b2[p];
  11488. }
  11489. }
  11490. };
  11491. return extendStatics13(d, b);
  11492. };
  11493. function __extends13(d, b) {
  11494. extendStatics13(d, b);
  11495. function __() {
  11496. this.constructor = d;
  11497. }
  11498. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11499. }
  11500. var fragment4 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n";
  11501. var ColorMatrixFilter = (
  11502. /** @class */
  11503. (function(_super) {
  11504. __extends13(ColorMatrixFilter2, _super);
  11505. function ColorMatrixFilter2() {
  11506. var _this = this;
  11507. var uniforms = {
  11508. m: new Float32Array([
  11509. 1,
  11510. 0,
  11511. 0,
  11512. 0,
  11513. 0,
  11514. 0,
  11515. 1,
  11516. 0,
  11517. 0,
  11518. 0,
  11519. 0,
  11520. 0,
  11521. 1,
  11522. 0,
  11523. 0,
  11524. 0,
  11525. 0,
  11526. 0,
  11527. 1,
  11528. 0
  11529. ]),
  11530. uAlpha: 1
  11531. };
  11532. _this = _super.call(this, defaultFilterVertex, fragment4, uniforms) || this;
  11533. _this.alpha = 1;
  11534. return _this;
  11535. }
  11536. ColorMatrixFilter2.prototype._loadMatrix = function(matrix, multiply) {
  11537. if (multiply === void 0) {
  11538. multiply = false;
  11539. }
  11540. var newMatrix = matrix;
  11541. if (multiply) {
  11542. this._multiply(newMatrix, this.uniforms.m, matrix);
  11543. newMatrix = this._colorMatrix(newMatrix);
  11544. }
  11545. this.uniforms.m = newMatrix;
  11546. };
  11547. ColorMatrixFilter2.prototype._multiply = function(out, a, b) {
  11548. out[0] = a[0] * b[0] + a[1] * b[5] + a[2] * b[10] + a[3] * b[15];
  11549. out[1] = a[0] * b[1] + a[1] * b[6] + a[2] * b[11] + a[3] * b[16];
  11550. out[2] = a[0] * b[2] + a[1] * b[7] + a[2] * b[12] + a[3] * b[17];
  11551. out[3] = a[0] * b[3] + a[1] * b[8] + a[2] * b[13] + a[3] * b[18];
  11552. out[4] = a[0] * b[4] + a[1] * b[9] + a[2] * b[14] + a[3] * b[19] + a[4];
  11553. out[5] = a[5] * b[0] + a[6] * b[5] + a[7] * b[10] + a[8] * b[15];
  11554. out[6] = a[5] * b[1] + a[6] * b[6] + a[7] * b[11] + a[8] * b[16];
  11555. out[7] = a[5] * b[2] + a[6] * b[7] + a[7] * b[12] + a[8] * b[17];
  11556. out[8] = a[5] * b[3] + a[6] * b[8] + a[7] * b[13] + a[8] * b[18];
  11557. out[9] = a[5] * b[4] + a[6] * b[9] + a[7] * b[14] + a[8] * b[19] + a[9];
  11558. out[10] = a[10] * b[0] + a[11] * b[5] + a[12] * b[10] + a[13] * b[15];
  11559. out[11] = a[10] * b[1] + a[11] * b[6] + a[12] * b[11] + a[13] * b[16];
  11560. out[12] = a[10] * b[2] + a[11] * b[7] + a[12] * b[12] + a[13] * b[17];
  11561. out[13] = a[10] * b[3] + a[11] * b[8] + a[12] * b[13] + a[13] * b[18];
  11562. out[14] = a[10] * b[4] + a[11] * b[9] + a[12] * b[14] + a[13] * b[19] + a[14];
  11563. out[15] = a[15] * b[0] + a[16] * b[5] + a[17] * b[10] + a[18] * b[15];
  11564. out[16] = a[15] * b[1] + a[16] * b[6] + a[17] * b[11] + a[18] * b[16];
  11565. out[17] = a[15] * b[2] + a[16] * b[7] + a[17] * b[12] + a[18] * b[17];
  11566. out[18] = a[15] * b[3] + a[16] * b[8] + a[17] * b[13] + a[18] * b[18];
  11567. out[19] = a[15] * b[4] + a[16] * b[9] + a[17] * b[14] + a[18] * b[19] + a[19];
  11568. return out;
  11569. };
  11570. ColorMatrixFilter2.prototype._colorMatrix = function(matrix) {
  11571. var m = new Float32Array(matrix);
  11572. m[4] /= 255;
  11573. m[9] /= 255;
  11574. m[14] /= 255;
  11575. m[19] /= 255;
  11576. return m;
  11577. };
  11578. ColorMatrixFilter2.prototype.brightness = function(b, multiply) {
  11579. var matrix = [
  11580. b,
  11581. 0,
  11582. 0,
  11583. 0,
  11584. 0,
  11585. 0,
  11586. b,
  11587. 0,
  11588. 0,
  11589. 0,
  11590. 0,
  11591. 0,
  11592. b,
  11593. 0,
  11594. 0,
  11595. 0,
  11596. 0,
  11597. 0,
  11598. 1,
  11599. 0
  11600. ];
  11601. this._loadMatrix(matrix, multiply);
  11602. };
  11603. ColorMatrixFilter2.prototype.tint = function(color, multiply) {
  11604. var r = color >> 16 & 255;
  11605. var g = color >> 8 & 255;
  11606. var b = color & 255;
  11607. var matrix = [
  11608. r / 255,
  11609. 0,
  11610. 0,
  11611. 0,
  11612. 0,
  11613. 0,
  11614. g / 255,
  11615. 0,
  11616. 0,
  11617. 0,
  11618. 0,
  11619. 0,
  11620. b / 255,
  11621. 0,
  11622. 0,
  11623. 0,
  11624. 0,
  11625. 0,
  11626. 1,
  11627. 0
  11628. ];
  11629. this._loadMatrix(matrix, multiply);
  11630. };
  11631. ColorMatrixFilter2.prototype.greyscale = function(scale, multiply) {
  11632. var matrix = [
  11633. scale,
  11634. scale,
  11635. scale,
  11636. 0,
  11637. 0,
  11638. scale,
  11639. scale,
  11640. scale,
  11641. 0,
  11642. 0,
  11643. scale,
  11644. scale,
  11645. scale,
  11646. 0,
  11647. 0,
  11648. 0,
  11649. 0,
  11650. 0,
  11651. 1,
  11652. 0
  11653. ];
  11654. this._loadMatrix(matrix, multiply);
  11655. };
  11656. ColorMatrixFilter2.prototype.blackAndWhite = function(multiply) {
  11657. var matrix = [
  11658. 0.3,
  11659. 0.6,
  11660. 0.1,
  11661. 0,
  11662. 0,
  11663. 0.3,
  11664. 0.6,
  11665. 0.1,
  11666. 0,
  11667. 0,
  11668. 0.3,
  11669. 0.6,
  11670. 0.1,
  11671. 0,
  11672. 0,
  11673. 0,
  11674. 0,
  11675. 0,
  11676. 1,
  11677. 0
  11678. ];
  11679. this._loadMatrix(matrix, multiply);
  11680. };
  11681. ColorMatrixFilter2.prototype.hue = function(rotation, multiply) {
  11682. rotation = (rotation || 0) / 180 * Math.PI;
  11683. var cosR = Math.cos(rotation);
  11684. var sinR = Math.sin(rotation);
  11685. var sqrt = Math.sqrt;
  11686. var w = 1 / 3;
  11687. var sqrW = sqrt(w);
  11688. var a00 = cosR + (1 - cosR) * w;
  11689. var a01 = w * (1 - cosR) - sqrW * sinR;
  11690. var a02 = w * (1 - cosR) + sqrW * sinR;
  11691. var a10 = w * (1 - cosR) + sqrW * sinR;
  11692. var a11 = cosR + w * (1 - cosR);
  11693. var a12 = w * (1 - cosR) - sqrW * sinR;
  11694. var a20 = w * (1 - cosR) - sqrW * sinR;
  11695. var a21 = w * (1 - cosR) + sqrW * sinR;
  11696. var a22 = cosR + w * (1 - cosR);
  11697. var matrix = [
  11698. a00,
  11699. a01,
  11700. a02,
  11701. 0,
  11702. 0,
  11703. a10,
  11704. a11,
  11705. a12,
  11706. 0,
  11707. 0,
  11708. a20,
  11709. a21,
  11710. a22,
  11711. 0,
  11712. 0,
  11713. 0,
  11714. 0,
  11715. 0,
  11716. 1,
  11717. 0
  11718. ];
  11719. this._loadMatrix(matrix, multiply);
  11720. };
  11721. ColorMatrixFilter2.prototype.contrast = function(amount, multiply) {
  11722. var v = (amount || 0) + 1;
  11723. var o = -0.5 * (v - 1);
  11724. var matrix = [
  11725. v,
  11726. 0,
  11727. 0,
  11728. 0,
  11729. o,
  11730. 0,
  11731. v,
  11732. 0,
  11733. 0,
  11734. o,
  11735. 0,
  11736. 0,
  11737. v,
  11738. 0,
  11739. o,
  11740. 0,
  11741. 0,
  11742. 0,
  11743. 1,
  11744. 0
  11745. ];
  11746. this._loadMatrix(matrix, multiply);
  11747. };
  11748. ColorMatrixFilter2.prototype.saturate = function(amount, multiply) {
  11749. if (amount === void 0) {
  11750. amount = 0;
  11751. }
  11752. var x = amount * 2 / 3 + 1;
  11753. var y = (x - 1) * -0.5;
  11754. var matrix = [
  11755. x,
  11756. y,
  11757. y,
  11758. 0,
  11759. 0,
  11760. y,
  11761. x,
  11762. y,
  11763. 0,
  11764. 0,
  11765. y,
  11766. y,
  11767. x,
  11768. 0,
  11769. 0,
  11770. 0,
  11771. 0,
  11772. 0,
  11773. 1,
  11774. 0
  11775. ];
  11776. this._loadMatrix(matrix, multiply);
  11777. };
  11778. ColorMatrixFilter2.prototype.desaturate = function() {
  11779. this.saturate(-1);
  11780. };
  11781. ColorMatrixFilter2.prototype.negative = function(multiply) {
  11782. var matrix = [
  11783. -1,
  11784. 0,
  11785. 0,
  11786. 1,
  11787. 0,
  11788. 0,
  11789. -1,
  11790. 0,
  11791. 1,
  11792. 0,
  11793. 0,
  11794. 0,
  11795. -1,
  11796. 1,
  11797. 0,
  11798. 0,
  11799. 0,
  11800. 0,
  11801. 1,
  11802. 0
  11803. ];
  11804. this._loadMatrix(matrix, multiply);
  11805. };
  11806. ColorMatrixFilter2.prototype.sepia = function(multiply) {
  11807. var matrix = [
  11808. 0.393,
  11809. 0.7689999,
  11810. 0.18899999,
  11811. 0,
  11812. 0,
  11813. 0.349,
  11814. 0.6859999,
  11815. 0.16799999,
  11816. 0,
  11817. 0,
  11818. 0.272,
  11819. 0.5339999,
  11820. 0.13099999,
  11821. 0,
  11822. 0,
  11823. 0,
  11824. 0,
  11825. 0,
  11826. 1,
  11827. 0
  11828. ];
  11829. this._loadMatrix(matrix, multiply);
  11830. };
  11831. ColorMatrixFilter2.prototype.technicolor = function(multiply) {
  11832. var matrix = [
  11833. 1.9125277891456083,
  11834. -0.8545344976951645,
  11835. -0.09155508482755585,
  11836. 0,
  11837. 11.793603434377337,
  11838. -0.3087833385928097,
  11839. 1.7658908555458428,
  11840. -0.10601743074722245,
  11841. 0,
  11842. -70.35205161461398,
  11843. -0.231103377548616,
  11844. -0.7501899197440212,
  11845. 1.847597816108189,
  11846. 0,
  11847. 30.950940869491138,
  11848. 0,
  11849. 0,
  11850. 0,
  11851. 1,
  11852. 0
  11853. ];
  11854. this._loadMatrix(matrix, multiply);
  11855. };
  11856. ColorMatrixFilter2.prototype.polaroid = function(multiply) {
  11857. var matrix = [
  11858. 1.438,
  11859. -0.062,
  11860. -0.062,
  11861. 0,
  11862. 0,
  11863. -0.122,
  11864. 1.378,
  11865. -0.122,
  11866. 0,
  11867. 0,
  11868. -0.016,
  11869. -0.016,
  11870. 1.483,
  11871. 0,
  11872. 0,
  11873. 0,
  11874. 0,
  11875. 0,
  11876. 1,
  11877. 0
  11878. ];
  11879. this._loadMatrix(matrix, multiply);
  11880. };
  11881. ColorMatrixFilter2.prototype.toBGR = function(multiply) {
  11882. var matrix = [
  11883. 0,
  11884. 0,
  11885. 1,
  11886. 0,
  11887. 0,
  11888. 0,
  11889. 1,
  11890. 0,
  11891. 0,
  11892. 0,
  11893. 1,
  11894. 0,
  11895. 0,
  11896. 0,
  11897. 0,
  11898. 0,
  11899. 0,
  11900. 0,
  11901. 1,
  11902. 0
  11903. ];
  11904. this._loadMatrix(matrix, multiply);
  11905. };
  11906. ColorMatrixFilter2.prototype.kodachrome = function(multiply) {
  11907. var matrix = [
  11908. 1.1285582396593525,
  11909. -0.3967382283601348,
  11910. -0.03992559172921793,
  11911. 0,
  11912. 63.72958762196502,
  11913. -0.16404339962244616,
  11914. 1.0835251566291304,
  11915. -0.05498805115633132,
  11916. 0,
  11917. 24.732407896706203,
  11918. -0.16786010706155763,
  11919. -0.5603416277695248,
  11920. 1.6014850761964943,
  11921. 0,
  11922. 35.62982807460946,
  11923. 0,
  11924. 0,
  11925. 0,
  11926. 1,
  11927. 0
  11928. ];
  11929. this._loadMatrix(matrix, multiply);
  11930. };
  11931. ColorMatrixFilter2.prototype.browni = function(multiply) {
  11932. var matrix = [
  11933. 0.5997023498159715,
  11934. 0.34553243048391263,
  11935. -0.2708298674538042,
  11936. 0,
  11937. 47.43192855600873,
  11938. -0.037703249837783157,
  11939. 0.8609577587992641,
  11940. 0.15059552388459913,
  11941. 0,
  11942. -36.96841498319127,
  11943. 0.24113635128153335,
  11944. -0.07441037908422492,
  11945. 0.44972182064877153,
  11946. 0,
  11947. -7.562075277591283,
  11948. 0,
  11949. 0,
  11950. 0,
  11951. 1,
  11952. 0
  11953. ];
  11954. this._loadMatrix(matrix, multiply);
  11955. };
  11956. ColorMatrixFilter2.prototype.vintage = function(multiply) {
  11957. var matrix = [
  11958. 0.6279345635605994,
  11959. 0.3202183420819367,
  11960. -0.03965408211312453,
  11961. 0,
  11962. 9.651285835294123,
  11963. 0.02578397704808868,
  11964. 0.6441188644374771,
  11965. 0.03259127616149294,
  11966. 0,
  11967. 7.462829176470591,
  11968. 0.0466055556782719,
  11969. -0.0851232987247891,
  11970. 0.5241648018700465,
  11971. 0,
  11972. 5.159190588235296,
  11973. 0,
  11974. 0,
  11975. 0,
  11976. 1,
  11977. 0
  11978. ];
  11979. this._loadMatrix(matrix, multiply);
  11980. };
  11981. ColorMatrixFilter2.prototype.colorTone = function(desaturation, toned, lightColor, darkColor, multiply) {
  11982. desaturation = desaturation || 0.2;
  11983. toned = toned || 0.15;
  11984. lightColor = lightColor || 16770432;
  11985. darkColor = darkColor || 3375104;
  11986. var lR = (lightColor >> 16 & 255) / 255;
  11987. var lG = (lightColor >> 8 & 255) / 255;
  11988. var lB = (lightColor & 255) / 255;
  11989. var dR = (darkColor >> 16 & 255) / 255;
  11990. var dG = (darkColor >> 8 & 255) / 255;
  11991. var dB = (darkColor & 255) / 255;
  11992. var matrix = [
  11993. 0.3,
  11994. 0.59,
  11995. 0.11,
  11996. 0,
  11997. 0,
  11998. lR,
  11999. lG,
  12000. lB,
  12001. desaturation,
  12002. 0,
  12003. dR,
  12004. dG,
  12005. dB,
  12006. toned,
  12007. 0,
  12008. lR - dR,
  12009. lG - dG,
  12010. lB - dB,
  12011. 0,
  12012. 0
  12013. ];
  12014. this._loadMatrix(matrix, multiply);
  12015. };
  12016. ColorMatrixFilter2.prototype.night = function(intensity, multiply) {
  12017. intensity = intensity || 0.1;
  12018. var matrix = [
  12019. intensity * -2,
  12020. -intensity,
  12021. 0,
  12022. 0,
  12023. 0,
  12024. -intensity,
  12025. 0,
  12026. intensity,
  12027. 0,
  12028. 0,
  12029. 0,
  12030. intensity,
  12031. intensity * 2,
  12032. 0,
  12033. 0,
  12034. 0,
  12035. 0,
  12036. 0,
  12037. 1,
  12038. 0
  12039. ];
  12040. this._loadMatrix(matrix, multiply);
  12041. };
  12042. ColorMatrixFilter2.prototype.predator = function(amount, multiply) {
  12043. var matrix = [
  12044. // row 1
  12045. 11.224130630493164 * amount,
  12046. -4.794486999511719 * amount,
  12047. -2.8746118545532227 * amount,
  12048. 0 * amount,
  12049. 0.40342438220977783 * amount,
  12050. // row 2
  12051. -3.6330697536468506 * amount,
  12052. 9.193157196044922 * amount,
  12053. -2.951810836791992 * amount,
  12054. 0 * amount,
  12055. -1.316135048866272 * amount,
  12056. // row 3
  12057. -3.2184197902679443 * amount,
  12058. -4.2375030517578125 * amount,
  12059. 7.476448059082031 * amount,
  12060. 0 * amount,
  12061. 0.8044459223747253 * amount,
  12062. // row 4
  12063. 0,
  12064. 0,
  12065. 0,
  12066. 1,
  12067. 0
  12068. ];
  12069. this._loadMatrix(matrix, multiply);
  12070. };
  12071. ColorMatrixFilter2.prototype.lsd = function(multiply) {
  12072. var matrix = [
  12073. 2,
  12074. -0.4,
  12075. 0.5,
  12076. 0,
  12077. 0,
  12078. -0.5,
  12079. 2,
  12080. -0.4,
  12081. 0,
  12082. 0,
  12083. -0.4,
  12084. -0.5,
  12085. 3,
  12086. 0,
  12087. 0,
  12088. 0,
  12089. 0,
  12090. 0,
  12091. 1,
  12092. 0
  12093. ];
  12094. this._loadMatrix(matrix, multiply);
  12095. };
  12096. ColorMatrixFilter2.prototype.reset = function() {
  12097. var matrix = [
  12098. 1,
  12099. 0,
  12100. 0,
  12101. 0,
  12102. 0,
  12103. 0,
  12104. 1,
  12105. 0,
  12106. 0,
  12107. 0,
  12108. 0,
  12109. 0,
  12110. 1,
  12111. 0,
  12112. 0,
  12113. 0,
  12114. 0,
  12115. 0,
  12116. 1,
  12117. 0
  12118. ];
  12119. this._loadMatrix(matrix, false);
  12120. };
  12121. Object.defineProperty(ColorMatrixFilter2.prototype, "matrix", {
  12122. /**
  12123. * The matrix of the color matrix filter
  12124. * @member {number[]}
  12125. * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]
  12126. */
  12127. get: function() {
  12128. return this.uniforms.m;
  12129. },
  12130. set: function(value) {
  12131. this.uniforms.m = value;
  12132. },
  12133. enumerable: false,
  12134. configurable: true
  12135. });
  12136. Object.defineProperty(ColorMatrixFilter2.prototype, "alpha", {
  12137. /**
  12138. * The opacity value to use when mixing the original and resultant colors.
  12139. *
  12140. * When the value is 0, the original color is used without modification.
  12141. * When the value is 1, the result color is used.
  12142. * When in the range (0, 1) the color is interpolated between the original and result by this amount.
  12143. * @default 1
  12144. */
  12145. get: function() {
  12146. return this.uniforms.uAlpha;
  12147. },
  12148. set: function(value) {
  12149. this.uniforms.uAlpha = value;
  12150. },
  12151. enumerable: false,
  12152. configurable: true
  12153. });
  12154. return ColorMatrixFilter2;
  12155. })(Filter)
  12156. );
  12157. ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;
  12158. // node_modules/@pixi/filter-displacement/dist/esm/filter-displacement.mjs
  12159. var extendStatics14 = function(d, b) {
  12160. extendStatics14 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  12161. d2.__proto__ = b2;
  12162. } || function(d2, b2) {
  12163. for (var p in b2) {
  12164. if (b2.hasOwnProperty(p)) {
  12165. d2[p] = b2[p];
  12166. }
  12167. }
  12168. };
  12169. return extendStatics14(d, b);
  12170. };
  12171. function __extends14(d, b) {
  12172. extendStatics14(d, b);
  12173. function __() {
  12174. this.constructor = d;
  12175. }
  12176. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12177. }
  12178. var fragment5 = "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n";
  12179. var vertex3 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n";
  12180. var DisplacementFilter = (
  12181. /** @class */
  12182. (function(_super) {
  12183. __extends14(DisplacementFilter2, _super);
  12184. function DisplacementFilter2(sprite, scale) {
  12185. var _this = this;
  12186. var maskMatrix = new Matrix();
  12187. sprite.renderable = false;
  12188. _this = _super.call(this, vertex3, fragment5, {
  12189. mapSampler: sprite._texture,
  12190. filterMatrix: maskMatrix,
  12191. scale: { x: 1, y: 1 },
  12192. rotation: new Float32Array([1, 0, 0, 1])
  12193. }) || this;
  12194. _this.maskSprite = sprite;
  12195. _this.maskMatrix = maskMatrix;
  12196. if (scale === null || scale === void 0) {
  12197. scale = 20;
  12198. }
  12199. _this.scale = new Point(scale, scale);
  12200. return _this;
  12201. }
  12202. DisplacementFilter2.prototype.apply = function(filterManager, input, output, clearMode) {
  12203. this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);
  12204. this.uniforms.scale.x = this.scale.x;
  12205. this.uniforms.scale.y = this.scale.y;
  12206. var wt = this.maskSprite.worldTransform;
  12207. var lenX = Math.sqrt(wt.a * wt.a + wt.b * wt.b);
  12208. var lenY = Math.sqrt(wt.c * wt.c + wt.d * wt.d);
  12209. if (lenX !== 0 && lenY !== 0) {
  12210. this.uniforms.rotation[0] = wt.a / lenX;
  12211. this.uniforms.rotation[1] = wt.b / lenX;
  12212. this.uniforms.rotation[2] = wt.c / lenY;
  12213. this.uniforms.rotation[3] = wt.d / lenY;
  12214. }
  12215. filterManager.applyFilter(this, input, output, clearMode);
  12216. };
  12217. Object.defineProperty(DisplacementFilter2.prototype, "map", {
  12218. /** The texture used for the displacement map. Must be power of 2 sized texture. */
  12219. get: function() {
  12220. return this.uniforms.mapSampler;
  12221. },
  12222. set: function(value) {
  12223. this.uniforms.mapSampler = value;
  12224. },
  12225. enumerable: false,
  12226. configurable: true
  12227. });
  12228. return DisplacementFilter2;
  12229. })(Filter)
  12230. );
  12231. // node_modules/@pixi/filter-fxaa/dist/esm/filter-fxaa.mjs
  12232. var extendStatics15 = function(d, b) {
  12233. extendStatics15 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  12234. d2.__proto__ = b2;
  12235. } || function(d2, b2) {
  12236. for (var p in b2) {
  12237. if (b2.hasOwnProperty(p)) {
  12238. d2[p] = b2[p];
  12239. }
  12240. }
  12241. };
  12242. return extendStatics15(d, b);
  12243. };
  12244. function __extends15(d, b) {
  12245. extendStatics15(d, b);
  12246. function __() {
  12247. this.constructor = d;
  12248. }
  12249. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12250. }
  12251. var vertex4 = "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n";
  12252. var fragment6 = `varying vec2 v_rgbNW;
  12253. varying vec2 v_rgbNE;
  12254. varying vec2 v_rgbSW;
  12255. varying vec2 v_rgbSE;
  12256. varying vec2 v_rgbM;
  12257. varying vec2 vFragCoord;
  12258. uniform sampler2D uSampler;
  12259. uniform highp vec4 inputSize;
  12260. /**
  12261. Basic FXAA implementation based on the code on geeks3d.com with the
  12262. modification that the texture2DLod stuff was removed since it's
  12263. unsupported by WebGL.
  12264. --
  12265. From:
  12266. https://github.com/mitsuhiko/webgl-meincraft
  12267. Copyright (c) 2011 by Armin Ronacher.
  12268. Some rights reserved.
  12269. Redistribution and use in source and binary forms, with or without
  12270. modification, are permitted provided that the following conditions are
  12271. met:
  12272. * Redistributions of source code must retain the above copyright
  12273. notice, this list of conditions and the following disclaimer.
  12274. * Redistributions in binary form must reproduce the above
  12275. copyright notice, this list of conditions and the following
  12276. disclaimer in the documentation and/or other materials provided
  12277. with the distribution.
  12278. * The names of the contributors may not be used to endorse or
  12279. promote products derived from this software without specific
  12280. prior written permission.
  12281. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  12282. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  12283. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  12284. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  12285. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  12286. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  12287. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12288. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  12289. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12290. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  12291. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12292. */
  12293. #ifndef FXAA_REDUCE_MIN
  12294. #define FXAA_REDUCE_MIN (1.0/ 128.0)
  12295. #endif
  12296. #ifndef FXAA_REDUCE_MUL
  12297. #define FXAA_REDUCE_MUL (1.0 / 8.0)
  12298. #endif
  12299. #ifndef FXAA_SPAN_MAX
  12300. #define FXAA_SPAN_MAX 8.0
  12301. #endif
  12302. //optimized version for mobile, where dependent
  12303. //texture reads can be a bottleneck
  12304. vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
  12305. vec2 v_rgbNW, vec2 v_rgbNE,
  12306. vec2 v_rgbSW, vec2 v_rgbSE,
  12307. vec2 v_rgbM) {
  12308. vec4 color;
  12309. vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
  12310. vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
  12311. vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
  12312. vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
  12313. vec4 texColor = texture2D(tex, v_rgbM);
  12314. vec3 rgbM = texColor.xyz;
  12315. vec3 luma = vec3(0.299, 0.587, 0.114);
  12316. float lumaNW = dot(rgbNW, luma);
  12317. float lumaNE = dot(rgbNE, luma);
  12318. float lumaSW = dot(rgbSW, luma);
  12319. float lumaSE = dot(rgbSE, luma);
  12320. float lumaM = dot(rgbM, luma);
  12321. float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
  12322. float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
  12323. mediump vec2 dir;
  12324. dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
  12325. dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
  12326. float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
  12327. (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
  12328. float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
  12329. dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
  12330. max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
  12331. dir * rcpDirMin)) * inverseVP;
  12332. vec3 rgbA = 0.5 * (
  12333. texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
  12334. texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
  12335. vec3 rgbB = rgbA * 0.5 + 0.25 * (
  12336. texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
  12337. texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
  12338. float lumaB = dot(rgbB, luma);
  12339. if ((lumaB < lumaMin) || (lumaB > lumaMax))
  12340. color = vec4(rgbA, texColor.a);
  12341. else
  12342. color = vec4(rgbB, texColor.a);
  12343. return color;
  12344. }
  12345. void main() {
  12346. vec4 color;
  12347. color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
  12348. gl_FragColor = color;
  12349. }
  12350. `;
  12351. var FXAAFilter = (
  12352. /** @class */
  12353. (function(_super) {
  12354. __extends15(FXAAFilter2, _super);
  12355. function FXAAFilter2() {
  12356. return _super.call(this, vertex4, fragment6) || this;
  12357. }
  12358. return FXAAFilter2;
  12359. })(Filter)
  12360. );
  12361. // node_modules/@pixi/filter-noise/dist/esm/filter-noise.mjs
  12362. var extendStatics16 = function(d, b) {
  12363. extendStatics16 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  12364. d2.__proto__ = b2;
  12365. } || function(d2, b2) {
  12366. for (var p in b2) {
  12367. if (b2.hasOwnProperty(p)) {
  12368. d2[p] = b2[p];
  12369. }
  12370. }
  12371. };
  12372. return extendStatics16(d, b);
  12373. };
  12374. function __extends16(d, b) {
  12375. extendStatics16(d, b);
  12376. function __() {
  12377. this.constructor = d;
  12378. }
  12379. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12380. }
  12381. var fragment7 = "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n";
  12382. var NoiseFilter = (
  12383. /** @class */
  12384. (function(_super) {
  12385. __extends16(NoiseFilter2, _super);
  12386. function NoiseFilter2(noise, seed) {
  12387. if (noise === void 0) {
  12388. noise = 0.5;
  12389. }
  12390. if (seed === void 0) {
  12391. seed = Math.random();
  12392. }
  12393. var _this = _super.call(this, defaultFilterVertex, fragment7, {
  12394. uNoise: 0,
  12395. uSeed: 0
  12396. }) || this;
  12397. _this.noise = noise;
  12398. _this.seed = seed;
  12399. return _this;
  12400. }
  12401. Object.defineProperty(NoiseFilter2.prototype, "noise", {
  12402. /**
  12403. * The amount of noise to apply, this value should be in the range (0, 1].
  12404. * @default 0.5
  12405. */
  12406. get: function() {
  12407. return this.uniforms.uNoise;
  12408. },
  12409. set: function(value) {
  12410. this.uniforms.uNoise = value;
  12411. },
  12412. enumerable: false,
  12413. configurable: true
  12414. });
  12415. Object.defineProperty(NoiseFilter2.prototype, "seed", {
  12416. /** A seed value to apply to the random noise generation. `Math.random()` is a good value to use. */
  12417. get: function() {
  12418. return this.uniforms.uSeed;
  12419. },
  12420. set: function(value) {
  12421. this.uniforms.uSeed = value;
  12422. },
  12423. enumerable: false,
  12424. configurable: true
  12425. });
  12426. return NoiseFilter2;
  12427. })(Filter)
  12428. );
  12429. // node_modules/@pixi/mixin-cache-as-bitmap/dist/esm/mixin-cache-as-bitmap.mjs
  12430. var _tempMatrix = new Matrix();
  12431. DisplayObject.prototype._cacheAsBitmap = false;
  12432. DisplayObject.prototype._cacheData = null;
  12433. DisplayObject.prototype._cacheAsBitmapResolution = null;
  12434. DisplayObject.prototype._cacheAsBitmapMultisample = MSAA_QUALITY.NONE;
  12435. var CacheData = (
  12436. /** @class */
  12437. /* @__PURE__ */ (function() {
  12438. function CacheData2() {
  12439. this.textureCacheId = null;
  12440. this.originalRender = null;
  12441. this.originalRenderCanvas = null;
  12442. this.originalCalculateBounds = null;
  12443. this.originalGetLocalBounds = null;
  12444. this.originalUpdateTransform = null;
  12445. this.originalDestroy = null;
  12446. this.originalMask = null;
  12447. this.originalFilterArea = null;
  12448. this.originalContainsPoint = null;
  12449. this.sprite = null;
  12450. }
  12451. return CacheData2;
  12452. })()
  12453. );
  12454. Object.defineProperties(DisplayObject.prototype, {
  12455. /**
  12456. * The resolution to use for cacheAsBitmap. By default this will use the renderer's resolution
  12457. * but can be overriden for performance. Lower values will reduce memory usage at the expense
  12458. * of render quality. A falsey value of `null` or `0` will default to the renderer's resolution.
  12459. * If `cacheAsBitmap` is set to `true`, this will re-render with the new resolution.
  12460. * @member {number} cacheAsBitmapResolution
  12461. * @memberof PIXI.DisplayObject#
  12462. * @default null
  12463. */
  12464. cacheAsBitmapResolution: {
  12465. get: function() {
  12466. return this._cacheAsBitmapResolution;
  12467. },
  12468. set: function(resolution) {
  12469. if (resolution === this._cacheAsBitmapResolution) {
  12470. return;
  12471. }
  12472. this._cacheAsBitmapResolution = resolution;
  12473. if (this.cacheAsBitmap) {
  12474. this.cacheAsBitmap = false;
  12475. this.cacheAsBitmap = true;
  12476. }
  12477. }
  12478. },
  12479. /**
  12480. * The number of samples to use for cacheAsBitmap. If set to `null`, the renderer's
  12481. * sample count is used.
  12482. * If `cacheAsBitmap` is set to `true`, this will re-render with the new number of samples.
  12483. * @member {number} cacheAsBitmapMultisample
  12484. * @memberof PIXI.DisplayObject#
  12485. * @default PIXI.MSAA_QUALITY.NONE
  12486. */
  12487. cacheAsBitmapMultisample: {
  12488. get: function() {
  12489. return this._cacheAsBitmapMultisample;
  12490. },
  12491. set: function(multisample) {
  12492. if (multisample === this._cacheAsBitmapMultisample) {
  12493. return;
  12494. }
  12495. this._cacheAsBitmapMultisample = multisample;
  12496. if (this.cacheAsBitmap) {
  12497. this.cacheAsBitmap = false;
  12498. this.cacheAsBitmap = true;
  12499. }
  12500. }
  12501. },
  12502. /**
  12503. * Set this to true if you want this display object to be cached as a bitmap.
  12504. * This basically takes a snap shot of the display object as it is at that moment. It can
  12505. * provide a performance benefit for complex static displayObjects.
  12506. * To remove simply set this property to `false`
  12507. *
  12508. * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true
  12509. * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.
  12510. * @member {boolean}
  12511. * @memberof PIXI.DisplayObject#
  12512. */
  12513. cacheAsBitmap: {
  12514. get: function() {
  12515. return this._cacheAsBitmap;
  12516. },
  12517. set: function(value) {
  12518. if (this._cacheAsBitmap === value) {
  12519. return;
  12520. }
  12521. this._cacheAsBitmap = value;
  12522. var data;
  12523. if (value) {
  12524. if (!this._cacheData) {
  12525. this._cacheData = new CacheData();
  12526. }
  12527. data = this._cacheData;
  12528. data.originalRender = this.render;
  12529. data.originalRenderCanvas = this.renderCanvas;
  12530. data.originalUpdateTransform = this.updateTransform;
  12531. data.originalCalculateBounds = this.calculateBounds;
  12532. data.originalGetLocalBounds = this.getLocalBounds;
  12533. data.originalDestroy = this.destroy;
  12534. data.originalContainsPoint = this.containsPoint;
  12535. data.originalMask = this._mask;
  12536. data.originalFilterArea = this.filterArea;
  12537. this.render = this._renderCached;
  12538. this.renderCanvas = this._renderCachedCanvas;
  12539. this.destroy = this._cacheAsBitmapDestroy;
  12540. } else {
  12541. data = this._cacheData;
  12542. if (data.sprite) {
  12543. this._destroyCachedDisplayObject();
  12544. }
  12545. this.render = data.originalRender;
  12546. this.renderCanvas = data.originalRenderCanvas;
  12547. this.calculateBounds = data.originalCalculateBounds;
  12548. this.getLocalBounds = data.originalGetLocalBounds;
  12549. this.destroy = data.originalDestroy;
  12550. this.updateTransform = data.originalUpdateTransform;
  12551. this.containsPoint = data.originalContainsPoint;
  12552. this._mask = data.originalMask;
  12553. this.filterArea = data.originalFilterArea;
  12554. }
  12555. }
  12556. }
  12557. });
  12558. DisplayObject.prototype._renderCached = function _renderCached(renderer) {
  12559. if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
  12560. return;
  12561. }
  12562. this._initCachedDisplayObject(renderer);
  12563. this._cacheData.sprite.transform._worldID = this.transform._worldID;
  12564. this._cacheData.sprite.worldAlpha = this.worldAlpha;
  12565. this._cacheData.sprite._render(renderer);
  12566. };
  12567. DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) {
  12568. var _a3;
  12569. if (this._cacheData && this._cacheData.sprite) {
  12570. return;
  12571. }
  12572. var cacheAlpha = this.alpha;
  12573. this.alpha = 1;
  12574. renderer.batch.flush();
  12575. var bounds = this.getLocalBounds(null, true).clone();
  12576. if (this.filters && this.filters.length) {
  12577. var padding = this.filters[0].padding;
  12578. bounds.pad(padding);
  12579. }
  12580. bounds.ceil(settings.RESOLUTION);
  12581. var cachedRenderTexture = renderer.renderTexture.current;
  12582. var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();
  12583. var cachedDestinationFrame = renderer.renderTexture.destinationFrame.clone();
  12584. var cachedProjectionTransform = renderer.projection.transform;
  12585. var renderTexture = RenderTexture.create({
  12586. width: bounds.width,
  12587. height: bounds.height,
  12588. resolution: this.cacheAsBitmapResolution || renderer.resolution,
  12589. multisample: (_a3 = this.cacheAsBitmapMultisample) !== null && _a3 !== void 0 ? _a3 : renderer.multisample
  12590. });
  12591. var textureCacheId = "cacheAsBitmap_" + uid();
  12592. this._cacheData.textureCacheId = textureCacheId;
  12593. BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);
  12594. Texture.addToCache(renderTexture, textureCacheId);
  12595. var m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y);
  12596. this.render = this._cacheData.originalRender;
  12597. renderer.render(this, { renderTexture, clear: true, transform: m, skipUpdateTransform: false });
  12598. renderer.framebuffer.blit();
  12599. renderer.projection.transform = cachedProjectionTransform;
  12600. renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame, cachedDestinationFrame);
  12601. this.render = this._renderCached;
  12602. this.updateTransform = this.displayObjectUpdateTransform;
  12603. this.calculateBounds = this._calculateCachedBounds;
  12604. this.getLocalBounds = this._getCachedLocalBounds;
  12605. this._mask = null;
  12606. this.filterArea = null;
  12607. this.alpha = cacheAlpha;
  12608. var cachedSprite = new Sprite(renderTexture);
  12609. cachedSprite.transform.worldTransform = this.transform.worldTransform;
  12610. cachedSprite.anchor.x = -(bounds.x / bounds.width);
  12611. cachedSprite.anchor.y = -(bounds.y / bounds.height);
  12612. cachedSprite.alpha = cacheAlpha;
  12613. cachedSprite._bounds = this._bounds;
  12614. this._cacheData.sprite = cachedSprite;
  12615. this.transform._parentID = -1;
  12616. if (!this.parent) {
  12617. this.enableTempParent();
  12618. this.updateTransform();
  12619. this.disableTempParent(null);
  12620. } else {
  12621. this.updateTransform();
  12622. }
  12623. this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);
  12624. };
  12625. DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) {
  12626. if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
  12627. return;
  12628. }
  12629. this._initCachedDisplayObjectCanvas(renderer);
  12630. this._cacheData.sprite.worldAlpha = this.worldAlpha;
  12631. this._cacheData.sprite._renderCanvas(renderer);
  12632. };
  12633. DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) {
  12634. if (this._cacheData && this._cacheData.sprite) {
  12635. return;
  12636. }
  12637. var bounds = this.getLocalBounds(null, true);
  12638. var cacheAlpha = this.alpha;
  12639. this.alpha = 1;
  12640. var cachedRenderTarget = renderer.context;
  12641. var cachedProjectionTransform = renderer._projTransform;
  12642. bounds.ceil(settings.RESOLUTION);
  12643. var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });
  12644. var textureCacheId = "cacheAsBitmap_" + uid();
  12645. this._cacheData.textureCacheId = textureCacheId;
  12646. BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);
  12647. Texture.addToCache(renderTexture, textureCacheId);
  12648. var m = _tempMatrix;
  12649. this.transform.localTransform.copyTo(m);
  12650. m.invert();
  12651. m.tx -= bounds.x;
  12652. m.ty -= bounds.y;
  12653. this.renderCanvas = this._cacheData.originalRenderCanvas;
  12654. renderer.render(this, { renderTexture, clear: true, transform: m, skipUpdateTransform: false });
  12655. renderer.context = cachedRenderTarget;
  12656. renderer._projTransform = cachedProjectionTransform;
  12657. this.renderCanvas = this._renderCachedCanvas;
  12658. this.updateTransform = this.displayObjectUpdateTransform;
  12659. this.calculateBounds = this._calculateCachedBounds;
  12660. this.getLocalBounds = this._getCachedLocalBounds;
  12661. this._mask = null;
  12662. this.filterArea = null;
  12663. this.alpha = cacheAlpha;
  12664. var cachedSprite = new Sprite(renderTexture);
  12665. cachedSprite.transform.worldTransform = this.transform.worldTransform;
  12666. cachedSprite.anchor.x = -(bounds.x / bounds.width);
  12667. cachedSprite.anchor.y = -(bounds.y / bounds.height);
  12668. cachedSprite.alpha = cacheAlpha;
  12669. cachedSprite._bounds = this._bounds;
  12670. this._cacheData.sprite = cachedSprite;
  12671. this.transform._parentID = -1;
  12672. if (!this.parent) {
  12673. this.parent = renderer._tempDisplayObjectParent;
  12674. this.updateTransform();
  12675. this.parent = null;
  12676. } else {
  12677. this.updateTransform();
  12678. }
  12679. this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);
  12680. };
  12681. DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() {
  12682. this._bounds.clear();
  12683. this._cacheData.sprite.transform._worldID = this.transform._worldID;
  12684. this._cacheData.sprite._calculateBounds();
  12685. this._bounds.updateID = this._boundsID;
  12686. };
  12687. DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() {
  12688. return this._cacheData.sprite.getLocalBounds(null);
  12689. };
  12690. DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() {
  12691. this._cacheData.sprite._texture.destroy(true);
  12692. this._cacheData.sprite = null;
  12693. BaseTexture.removeFromCache(this._cacheData.textureCacheId);
  12694. Texture.removeFromCache(this._cacheData.textureCacheId);
  12695. this._cacheData.textureCacheId = null;
  12696. };
  12697. DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) {
  12698. this.cacheAsBitmap = false;
  12699. this.destroy(options);
  12700. };
  12701. // node_modules/@pixi/mixin-get-child-by-name/dist/esm/mixin-get-child-by-name.mjs
  12702. DisplayObject.prototype.name = null;
  12703. Container.prototype.getChildByName = function getChildByName(name, deep) {
  12704. for (var i = 0, j = this.children.length; i < j; i++) {
  12705. if (this.children[i].name === name) {
  12706. return this.children[i];
  12707. }
  12708. }
  12709. if (deep) {
  12710. for (var i = 0, j = this.children.length; i < j; i++) {
  12711. var child = this.children[i];
  12712. if (!child.getChildByName) {
  12713. continue;
  12714. }
  12715. var target = child.getChildByName(name, true);
  12716. if (target) {
  12717. return target;
  12718. }
  12719. }
  12720. }
  12721. return null;
  12722. };
  12723. // node_modules/@pixi/mixin-get-global-position/dist/esm/mixin-get-global-position.mjs
  12724. DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) {
  12725. if (point === void 0) {
  12726. point = new Point();
  12727. }
  12728. if (skipUpdate === void 0) {
  12729. skipUpdate = false;
  12730. }
  12731. if (this.parent) {
  12732. this.parent.toGlobal(this.position, point, skipUpdate);
  12733. } else {
  12734. point.x = this.position.x;
  12735. point.y = this.position.y;
  12736. }
  12737. return point;
  12738. };
  12739. // node_modules/@pixi/app/dist/esm/app.mjs
  12740. var ResizePlugin = (
  12741. /** @class */
  12742. (function() {
  12743. function ResizePlugin2() {
  12744. }
  12745. ResizePlugin2.init = function(options) {
  12746. var _this = this;
  12747. Object.defineProperty(
  12748. this,
  12749. "resizeTo",
  12750. /**
  12751. * The HTML element or window to automatically resize the
  12752. * renderer's view element to match width and height.
  12753. * @member {Window|HTMLElement}
  12754. * @name resizeTo
  12755. * @memberof PIXI.Application#
  12756. */
  12757. {
  12758. set: function(dom) {
  12759. globalThis.removeEventListener("resize", this.queueResize);
  12760. this._resizeTo = dom;
  12761. if (dom) {
  12762. globalThis.addEventListener("resize", this.queueResize);
  12763. this.resize();
  12764. }
  12765. },
  12766. get: function() {
  12767. return this._resizeTo;
  12768. }
  12769. }
  12770. );
  12771. this.queueResize = function() {
  12772. if (!_this._resizeTo) {
  12773. return;
  12774. }
  12775. _this.cancelResize();
  12776. _this._resizeId = requestAnimationFrame(function() {
  12777. return _this.resize();
  12778. });
  12779. };
  12780. this.cancelResize = function() {
  12781. if (_this._resizeId) {
  12782. cancelAnimationFrame(_this._resizeId);
  12783. _this._resizeId = null;
  12784. }
  12785. };
  12786. this.resize = function() {
  12787. if (!_this._resizeTo) {
  12788. return;
  12789. }
  12790. _this.cancelResize();
  12791. var width;
  12792. var height;
  12793. if (_this._resizeTo === globalThis.window) {
  12794. width = globalThis.innerWidth;
  12795. height = globalThis.innerHeight;
  12796. } else {
  12797. var _a3 = _this._resizeTo, clientWidth = _a3.clientWidth, clientHeight = _a3.clientHeight;
  12798. width = clientWidth;
  12799. height = clientHeight;
  12800. }
  12801. _this.renderer.resize(width, height);
  12802. };
  12803. this._resizeId = null;
  12804. this._resizeTo = null;
  12805. this.resizeTo = options.resizeTo || null;
  12806. };
  12807. ResizePlugin2.destroy = function() {
  12808. globalThis.removeEventListener("resize", this.queueResize);
  12809. this.cancelResize();
  12810. this.cancelResize = null;
  12811. this.queueResize = null;
  12812. this.resizeTo = null;
  12813. this.resize = null;
  12814. };
  12815. ResizePlugin2.extension = ExtensionType.Application;
  12816. return ResizePlugin2;
  12817. })()
  12818. );
  12819. var Application = (
  12820. /** @class */
  12821. (function() {
  12822. function Application2(options) {
  12823. var _this = this;
  12824. this.stage = new Container();
  12825. options = Object.assign({
  12826. forceCanvas: false
  12827. }, options);
  12828. this.renderer = autoDetectRenderer(options);
  12829. Application2._plugins.forEach(function(plugin) {
  12830. plugin.init.call(_this, options);
  12831. });
  12832. }
  12833. Application2.registerPlugin = function(plugin) {
  12834. deprecation("6.5.0", "Application.registerPlugin() is deprecated, use extensions.add()");
  12835. extensions.add({
  12836. type: ExtensionType.Application,
  12837. ref: plugin
  12838. });
  12839. };
  12840. Application2.prototype.render = function() {
  12841. this.renderer.render(this.stage);
  12842. };
  12843. Object.defineProperty(Application2.prototype, "view", {
  12844. /**
  12845. * Reference to the renderer's canvas element.
  12846. * @member {HTMLCanvasElement}
  12847. * @readonly
  12848. */
  12849. get: function() {
  12850. return this.renderer.view;
  12851. },
  12852. enumerable: false,
  12853. configurable: true
  12854. });
  12855. Object.defineProperty(Application2.prototype, "screen", {
  12856. /**
  12857. * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
  12858. * @member {PIXI.Rectangle}
  12859. * @readonly
  12860. */
  12861. get: function() {
  12862. return this.renderer.screen;
  12863. },
  12864. enumerable: false,
  12865. configurable: true
  12866. });
  12867. Application2.prototype.destroy = function(removeView, stageOptions) {
  12868. var _this = this;
  12869. var plugins = Application2._plugins.slice(0);
  12870. plugins.reverse();
  12871. plugins.forEach(function(plugin) {
  12872. plugin.destroy.call(_this);
  12873. });
  12874. this.stage.destroy(stageOptions);
  12875. this.stage = null;
  12876. this.renderer.destroy(removeView);
  12877. this.renderer = null;
  12878. };
  12879. Application2._plugins = [];
  12880. return Application2;
  12881. })()
  12882. );
  12883. extensions.handleByList(ExtensionType.Application, Application._plugins);
  12884. extensions.add(ResizePlugin);
  12885. // node_modules/@pixi/mesh-extras/dist/esm/mesh-extras.mjs
  12886. var extendStatics17 = function(d, b) {
  12887. extendStatics17 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  12888. d2.__proto__ = b2;
  12889. } || function(d2, b2) {
  12890. for (var p in b2) {
  12891. if (b2.hasOwnProperty(p)) {
  12892. d2[p] = b2[p];
  12893. }
  12894. }
  12895. };
  12896. return extendStatics17(d, b);
  12897. };
  12898. function __extends17(d, b) {
  12899. extendStatics17(d, b);
  12900. function __() {
  12901. this.constructor = d;
  12902. }
  12903. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12904. }
  12905. var PlaneGeometry = (
  12906. /** @class */
  12907. (function(_super) {
  12908. __extends17(PlaneGeometry2, _super);
  12909. function PlaneGeometry2(width, height, segWidth, segHeight) {
  12910. if (width === void 0) {
  12911. width = 100;
  12912. }
  12913. if (height === void 0) {
  12914. height = 100;
  12915. }
  12916. if (segWidth === void 0) {
  12917. segWidth = 10;
  12918. }
  12919. if (segHeight === void 0) {
  12920. segHeight = 10;
  12921. }
  12922. var _this = _super.call(this) || this;
  12923. _this.segWidth = segWidth;
  12924. _this.segHeight = segHeight;
  12925. _this.width = width;
  12926. _this.height = height;
  12927. _this.build();
  12928. return _this;
  12929. }
  12930. PlaneGeometry2.prototype.build = function() {
  12931. var total = this.segWidth * this.segHeight;
  12932. var verts = [];
  12933. var uvs = [];
  12934. var indices2 = [];
  12935. var segmentsX = this.segWidth - 1;
  12936. var segmentsY = this.segHeight - 1;
  12937. var sizeX = this.width / segmentsX;
  12938. var sizeY = this.height / segmentsY;
  12939. for (var i = 0; i < total; i++) {
  12940. var x = i % this.segWidth;
  12941. var y = i / this.segWidth | 0;
  12942. verts.push(x * sizeX, y * sizeY);
  12943. uvs.push(x / segmentsX, y / segmentsY);
  12944. }
  12945. var totalSub = segmentsX * segmentsY;
  12946. for (var i = 0; i < totalSub; i++) {
  12947. var xpos = i % segmentsX;
  12948. var ypos = i / segmentsX | 0;
  12949. var value = ypos * this.segWidth + xpos;
  12950. var value2 = ypos * this.segWidth + xpos + 1;
  12951. var value3 = (ypos + 1) * this.segWidth + xpos;
  12952. var value4 = (ypos + 1) * this.segWidth + xpos + 1;
  12953. indices2.push(value, value2, value3, value2, value4, value3);
  12954. }
  12955. this.buffers[0].data = new Float32Array(verts);
  12956. this.buffers[1].data = new Float32Array(uvs);
  12957. this.indexBuffer.data = new Uint16Array(indices2);
  12958. this.buffers[0].update();
  12959. this.buffers[1].update();
  12960. this.indexBuffer.update();
  12961. };
  12962. return PlaneGeometry2;
  12963. })(MeshGeometry)
  12964. );
  12965. var RopeGeometry = (
  12966. /** @class */
  12967. (function(_super) {
  12968. __extends17(RopeGeometry2, _super);
  12969. function RopeGeometry2(width, points, textureScale) {
  12970. if (width === void 0) {
  12971. width = 200;
  12972. }
  12973. if (textureScale === void 0) {
  12974. textureScale = 0;
  12975. }
  12976. var _this = _super.call(this, new Float32Array(points.length * 4), new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)) || this;
  12977. _this.points = points;
  12978. _this._width = width;
  12979. _this.textureScale = textureScale;
  12980. _this.build();
  12981. return _this;
  12982. }
  12983. Object.defineProperty(RopeGeometry2.prototype, "width", {
  12984. /**
  12985. * The width (i.e., thickness) of the rope.
  12986. * @readonly
  12987. */
  12988. get: function() {
  12989. return this._width;
  12990. },
  12991. enumerable: false,
  12992. configurable: true
  12993. });
  12994. RopeGeometry2.prototype.build = function() {
  12995. var points = this.points;
  12996. if (!points) {
  12997. return;
  12998. }
  12999. var vertexBuffer = this.getBuffer("aVertexPosition");
  13000. var uvBuffer = this.getBuffer("aTextureCoord");
  13001. var indexBuffer = this.getIndex();
  13002. if (points.length < 1) {
  13003. return;
  13004. }
  13005. if (vertexBuffer.data.length / 4 !== points.length) {
  13006. vertexBuffer.data = new Float32Array(points.length * 4);
  13007. uvBuffer.data = new Float32Array(points.length * 4);
  13008. indexBuffer.data = new Uint16Array((points.length - 1) * 6);
  13009. }
  13010. var uvs = uvBuffer.data;
  13011. var indices2 = indexBuffer.data;
  13012. uvs[0] = 0;
  13013. uvs[1] = 0;
  13014. uvs[2] = 0;
  13015. uvs[3] = 1;
  13016. var amount = 0;
  13017. var prev = points[0];
  13018. var textureWidth = this._width * this.textureScale;
  13019. var total = points.length;
  13020. for (var i = 0; i < total; i++) {
  13021. var index = i * 4;
  13022. if (this.textureScale > 0) {
  13023. var dx = prev.x - points[i].x;
  13024. var dy = prev.y - points[i].y;
  13025. var distance = Math.sqrt(dx * dx + dy * dy);
  13026. prev = points[i];
  13027. amount += distance / textureWidth;
  13028. } else {
  13029. amount = i / (total - 1);
  13030. }
  13031. uvs[index] = amount;
  13032. uvs[index + 1] = 0;
  13033. uvs[index + 2] = amount;
  13034. uvs[index + 3] = 1;
  13035. }
  13036. var indexCount = 0;
  13037. for (var i = 0; i < total - 1; i++) {
  13038. var index = i * 2;
  13039. indices2[indexCount++] = index;
  13040. indices2[indexCount++] = index + 1;
  13041. indices2[indexCount++] = index + 2;
  13042. indices2[indexCount++] = index + 2;
  13043. indices2[indexCount++] = index + 1;
  13044. indices2[indexCount++] = index + 3;
  13045. }
  13046. uvBuffer.update();
  13047. indexBuffer.update();
  13048. this.updateVertices();
  13049. };
  13050. RopeGeometry2.prototype.updateVertices = function() {
  13051. var points = this.points;
  13052. if (points.length < 1) {
  13053. return;
  13054. }
  13055. var lastPoint = points[0];
  13056. var nextPoint;
  13057. var perpX = 0;
  13058. var perpY = 0;
  13059. var vertices = this.buffers[0].data;
  13060. var total = points.length;
  13061. for (var i = 0; i < total; i++) {
  13062. var point = points[i];
  13063. var index = i * 4;
  13064. if (i < points.length - 1) {
  13065. nextPoint = points[i + 1];
  13066. } else {
  13067. nextPoint = point;
  13068. }
  13069. perpY = -(nextPoint.x - lastPoint.x);
  13070. perpX = nextPoint.y - lastPoint.y;
  13071. var perpLength = Math.sqrt(perpX * perpX + perpY * perpY);
  13072. var num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
  13073. perpX /= perpLength;
  13074. perpY /= perpLength;
  13075. perpX *= num;
  13076. perpY *= num;
  13077. vertices[index] = point.x + perpX;
  13078. vertices[index + 1] = point.y + perpY;
  13079. vertices[index + 2] = point.x - perpX;
  13080. vertices[index + 3] = point.y - perpY;
  13081. lastPoint = point;
  13082. }
  13083. this.buffers[0].update();
  13084. };
  13085. RopeGeometry2.prototype.update = function() {
  13086. if (this.textureScale > 0) {
  13087. this.build();
  13088. } else {
  13089. this.updateVertices();
  13090. }
  13091. };
  13092. return RopeGeometry2;
  13093. })(MeshGeometry)
  13094. );
  13095. var SimpleRope = (
  13096. /** @class */
  13097. (function(_super) {
  13098. __extends17(SimpleRope2, _super);
  13099. function SimpleRope2(texture, points, textureScale) {
  13100. if (textureScale === void 0) {
  13101. textureScale = 0;
  13102. }
  13103. var _this = this;
  13104. var ropeGeometry = new RopeGeometry(texture.height, points, textureScale);
  13105. var meshMaterial = new MeshMaterial(texture);
  13106. if (textureScale > 0) {
  13107. texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;
  13108. }
  13109. _this = _super.call(this, ropeGeometry, meshMaterial) || this;
  13110. _this.autoUpdate = true;
  13111. return _this;
  13112. }
  13113. SimpleRope2.prototype._render = function(renderer) {
  13114. var geometry = this.geometry;
  13115. if (this.autoUpdate || geometry._width !== this.shader.texture.height) {
  13116. geometry._width = this.shader.texture.height;
  13117. geometry.update();
  13118. }
  13119. _super.prototype._render.call(this, renderer);
  13120. };
  13121. return SimpleRope2;
  13122. })(Mesh)
  13123. );
  13124. var SimplePlane = (
  13125. /** @class */
  13126. (function(_super) {
  13127. __extends17(SimplePlane2, _super);
  13128. function SimplePlane2(texture, verticesX, verticesY) {
  13129. var _this = this;
  13130. var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);
  13131. var meshMaterial = new MeshMaterial(Texture.WHITE);
  13132. _this = _super.call(this, planeGeometry, meshMaterial) || this;
  13133. _this.texture = texture;
  13134. _this.autoResize = true;
  13135. return _this;
  13136. }
  13137. SimplePlane2.prototype.textureUpdated = function() {
  13138. this._textureID = this.shader.texture._updateID;
  13139. var geometry = this.geometry;
  13140. var _a3 = this.shader.texture, width = _a3.width, height = _a3.height;
  13141. if (this.autoResize && (geometry.width !== width || geometry.height !== height)) {
  13142. geometry.width = this.shader.texture.width;
  13143. geometry.height = this.shader.texture.height;
  13144. geometry.build();
  13145. }
  13146. };
  13147. Object.defineProperty(SimplePlane2.prototype, "texture", {
  13148. get: function() {
  13149. return this.shader.texture;
  13150. },
  13151. set: function(value) {
  13152. if (this.shader.texture === value) {
  13153. return;
  13154. }
  13155. this.shader.texture = value;
  13156. this._textureID = -1;
  13157. if (value.baseTexture.valid) {
  13158. this.textureUpdated();
  13159. } else {
  13160. value.once("update", this.textureUpdated, this);
  13161. }
  13162. },
  13163. enumerable: false,
  13164. configurable: true
  13165. });
  13166. SimplePlane2.prototype._render = function(renderer) {
  13167. if (this._textureID !== this.shader.texture._updateID) {
  13168. this.textureUpdated();
  13169. }
  13170. _super.prototype._render.call(this, renderer);
  13171. };
  13172. SimplePlane2.prototype.destroy = function(options) {
  13173. this.shader.texture.off("update", this.textureUpdated, this);
  13174. _super.prototype.destroy.call(this, options);
  13175. };
  13176. return SimplePlane2;
  13177. })(Mesh)
  13178. );
  13179. var SimpleMesh = (
  13180. /** @class */
  13181. (function(_super) {
  13182. __extends17(SimpleMesh2, _super);
  13183. function SimpleMesh2(texture, vertices, uvs, indices2, drawMode) {
  13184. if (texture === void 0) {
  13185. texture = Texture.EMPTY;
  13186. }
  13187. var _this = this;
  13188. var geometry = new MeshGeometry(vertices, uvs, indices2);
  13189. geometry.getBuffer("aVertexPosition").static = false;
  13190. var meshMaterial = new MeshMaterial(texture);
  13191. _this = _super.call(this, geometry, meshMaterial, null, drawMode) || this;
  13192. _this.autoUpdate = true;
  13193. return _this;
  13194. }
  13195. Object.defineProperty(SimpleMesh2.prototype, "vertices", {
  13196. /**
  13197. * Collection of vertices data.
  13198. * @type {Float32Array}
  13199. */
  13200. get: function() {
  13201. return this.geometry.getBuffer("aVertexPosition").data;
  13202. },
  13203. set: function(value) {
  13204. this.geometry.getBuffer("aVertexPosition").data = value;
  13205. },
  13206. enumerable: false,
  13207. configurable: true
  13208. });
  13209. SimpleMesh2.prototype._render = function(renderer) {
  13210. if (this.autoUpdate) {
  13211. this.geometry.getBuffer("aVertexPosition").update();
  13212. }
  13213. _super.prototype._render.call(this, renderer);
  13214. };
  13215. return SimpleMesh2;
  13216. })(Mesh)
  13217. );
  13218. var DEFAULT_BORDER_SIZE = 10;
  13219. var NineSlicePlane = (
  13220. /** @class */
  13221. (function(_super) {
  13222. __extends17(NineSlicePlane2, _super);
  13223. function NineSlicePlane2(texture, leftWidth, topHeight, rightWidth, bottomHeight) {
  13224. if (leftWidth === void 0) {
  13225. leftWidth = DEFAULT_BORDER_SIZE;
  13226. }
  13227. if (topHeight === void 0) {
  13228. topHeight = DEFAULT_BORDER_SIZE;
  13229. }
  13230. if (rightWidth === void 0) {
  13231. rightWidth = DEFAULT_BORDER_SIZE;
  13232. }
  13233. if (bottomHeight === void 0) {
  13234. bottomHeight = DEFAULT_BORDER_SIZE;
  13235. }
  13236. var _this = _super.call(this, Texture.WHITE, 4, 4) || this;
  13237. _this._origWidth = texture.orig.width;
  13238. _this._origHeight = texture.orig.height;
  13239. _this._width = _this._origWidth;
  13240. _this._height = _this._origHeight;
  13241. _this._leftWidth = leftWidth;
  13242. _this._rightWidth = rightWidth;
  13243. _this._topHeight = topHeight;
  13244. _this._bottomHeight = bottomHeight;
  13245. _this.texture = texture;
  13246. return _this;
  13247. }
  13248. NineSlicePlane2.prototype.textureUpdated = function() {
  13249. this._textureID = this.shader.texture._updateID;
  13250. this._refresh();
  13251. };
  13252. Object.defineProperty(NineSlicePlane2.prototype, "vertices", {
  13253. get: function() {
  13254. return this.geometry.getBuffer("aVertexPosition").data;
  13255. },
  13256. set: function(value) {
  13257. this.geometry.getBuffer("aVertexPosition").data = value;
  13258. },
  13259. enumerable: false,
  13260. configurable: true
  13261. });
  13262. NineSlicePlane2.prototype.updateHorizontalVertices = function() {
  13263. var vertices = this.vertices;
  13264. var scale = this._getMinScale();
  13265. vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;
  13266. vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - this._bottomHeight * scale;
  13267. vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;
  13268. };
  13269. NineSlicePlane2.prototype.updateVerticalVertices = function() {
  13270. var vertices = this.vertices;
  13271. var scale = this._getMinScale();
  13272. vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;
  13273. vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - this._rightWidth * scale;
  13274. vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;
  13275. };
  13276. NineSlicePlane2.prototype._getMinScale = function() {
  13277. var w = this._leftWidth + this._rightWidth;
  13278. var scaleW = this._width > w ? 1 : this._width / w;
  13279. var h = this._topHeight + this._bottomHeight;
  13280. var scaleH = this._height > h ? 1 : this._height / h;
  13281. var scale = Math.min(scaleW, scaleH);
  13282. return scale;
  13283. };
  13284. Object.defineProperty(NineSlicePlane2.prototype, "width", {
  13285. /** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
  13286. get: function() {
  13287. return this._width;
  13288. },
  13289. set: function(value) {
  13290. this._width = value;
  13291. this._refresh();
  13292. },
  13293. enumerable: false,
  13294. configurable: true
  13295. });
  13296. Object.defineProperty(NineSlicePlane2.prototype, "height", {
  13297. /** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
  13298. get: function() {
  13299. return this._height;
  13300. },
  13301. set: function(value) {
  13302. this._height = value;
  13303. this._refresh();
  13304. },
  13305. enumerable: false,
  13306. configurable: true
  13307. });
  13308. Object.defineProperty(NineSlicePlane2.prototype, "leftWidth", {
  13309. /** The width of the left column. */
  13310. get: function() {
  13311. return this._leftWidth;
  13312. },
  13313. set: function(value) {
  13314. this._leftWidth = value;
  13315. this._refresh();
  13316. },
  13317. enumerable: false,
  13318. configurable: true
  13319. });
  13320. Object.defineProperty(NineSlicePlane2.prototype, "rightWidth", {
  13321. /** The width of the right column. */
  13322. get: function() {
  13323. return this._rightWidth;
  13324. },
  13325. set: function(value) {
  13326. this._rightWidth = value;
  13327. this._refresh();
  13328. },
  13329. enumerable: false,
  13330. configurable: true
  13331. });
  13332. Object.defineProperty(NineSlicePlane2.prototype, "topHeight", {
  13333. /** The height of the top row. */
  13334. get: function() {
  13335. return this._topHeight;
  13336. },
  13337. set: function(value) {
  13338. this._topHeight = value;
  13339. this._refresh();
  13340. },
  13341. enumerable: false,
  13342. configurable: true
  13343. });
  13344. Object.defineProperty(NineSlicePlane2.prototype, "bottomHeight", {
  13345. /** The height of the bottom row. */
  13346. get: function() {
  13347. return this._bottomHeight;
  13348. },
  13349. set: function(value) {
  13350. this._bottomHeight = value;
  13351. this._refresh();
  13352. },
  13353. enumerable: false,
  13354. configurable: true
  13355. });
  13356. NineSlicePlane2.prototype._refresh = function() {
  13357. var texture = this.texture;
  13358. var uvs = this.geometry.buffers[1].data;
  13359. this._origWidth = texture.orig.width;
  13360. this._origHeight = texture.orig.height;
  13361. var _uvw = 1 / this._origWidth;
  13362. var _uvh = 1 / this._origHeight;
  13363. uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;
  13364. uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;
  13365. uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;
  13366. uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;
  13367. uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;
  13368. uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - _uvw * this._rightWidth;
  13369. uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;
  13370. uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - _uvh * this._bottomHeight;
  13371. this.updateHorizontalVertices();
  13372. this.updateVerticalVertices();
  13373. this.geometry.buffers[0].update();
  13374. this.geometry.buffers[1].update();
  13375. };
  13376. return NineSlicePlane2;
  13377. })(SimplePlane)
  13378. );
  13379. // node_modules/@pixi/sprite-animated/dist/esm/sprite-animated.mjs
  13380. var extendStatics18 = function(d, b) {
  13381. extendStatics18 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  13382. d2.__proto__ = b2;
  13383. } || function(d2, b2) {
  13384. for (var p in b2) {
  13385. if (b2.hasOwnProperty(p)) {
  13386. d2[p] = b2[p];
  13387. }
  13388. }
  13389. };
  13390. return extendStatics18(d, b);
  13391. };
  13392. function __extends18(d, b) {
  13393. extendStatics18(d, b);
  13394. function __() {
  13395. this.constructor = d;
  13396. }
  13397. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13398. }
  13399. var AnimatedSprite = (
  13400. /** @class */
  13401. (function(_super) {
  13402. __extends18(AnimatedSprite2, _super);
  13403. function AnimatedSprite2(textures, autoUpdate) {
  13404. if (autoUpdate === void 0) {
  13405. autoUpdate = true;
  13406. }
  13407. var _this = _super.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture) || this;
  13408. _this._textures = null;
  13409. _this._durations = null;
  13410. _this._autoUpdate = autoUpdate;
  13411. _this._isConnectedToTicker = false;
  13412. _this.animationSpeed = 1;
  13413. _this.loop = true;
  13414. _this.updateAnchor = false;
  13415. _this.onComplete = null;
  13416. _this.onFrameChange = null;
  13417. _this.onLoop = null;
  13418. _this._currentTime = 0;
  13419. _this._playing = false;
  13420. _this._previousFrame = null;
  13421. _this.textures = textures;
  13422. return _this;
  13423. }
  13424. AnimatedSprite2.prototype.stop = function() {
  13425. if (!this._playing) {
  13426. return;
  13427. }
  13428. this._playing = false;
  13429. if (this._autoUpdate && this._isConnectedToTicker) {
  13430. Ticker.shared.remove(this.update, this);
  13431. this._isConnectedToTicker = false;
  13432. }
  13433. };
  13434. AnimatedSprite2.prototype.play = function() {
  13435. if (this._playing) {
  13436. return;
  13437. }
  13438. this._playing = true;
  13439. if (this._autoUpdate && !this._isConnectedToTicker) {
  13440. Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);
  13441. this._isConnectedToTicker = true;
  13442. }
  13443. };
  13444. AnimatedSprite2.prototype.gotoAndStop = function(frameNumber) {
  13445. this.stop();
  13446. var previousFrame = this.currentFrame;
  13447. this._currentTime = frameNumber;
  13448. if (previousFrame !== this.currentFrame) {
  13449. this.updateTexture();
  13450. }
  13451. };
  13452. AnimatedSprite2.prototype.gotoAndPlay = function(frameNumber) {
  13453. var previousFrame = this.currentFrame;
  13454. this._currentTime = frameNumber;
  13455. if (previousFrame !== this.currentFrame) {
  13456. this.updateTexture();
  13457. }
  13458. this.play();
  13459. };
  13460. AnimatedSprite2.prototype.update = function(deltaTime) {
  13461. if (!this._playing) {
  13462. return;
  13463. }
  13464. var elapsed = this.animationSpeed * deltaTime;
  13465. var previousFrame = this.currentFrame;
  13466. if (this._durations !== null) {
  13467. var lag = this._currentTime % 1 * this._durations[this.currentFrame];
  13468. lag += elapsed / 60 * 1e3;
  13469. while (lag < 0) {
  13470. this._currentTime--;
  13471. lag += this._durations[this.currentFrame];
  13472. }
  13473. var sign2 = Math.sign(this.animationSpeed * deltaTime);
  13474. this._currentTime = Math.floor(this._currentTime);
  13475. while (lag >= this._durations[this.currentFrame]) {
  13476. lag -= this._durations[this.currentFrame] * sign2;
  13477. this._currentTime += sign2;
  13478. }
  13479. this._currentTime += lag / this._durations[this.currentFrame];
  13480. } else {
  13481. this._currentTime += elapsed;
  13482. }
  13483. if (this._currentTime < 0 && !this.loop) {
  13484. this.gotoAndStop(0);
  13485. if (this.onComplete) {
  13486. this.onComplete();
  13487. }
  13488. } else if (this._currentTime >= this._textures.length && !this.loop) {
  13489. this.gotoAndStop(this._textures.length - 1);
  13490. if (this.onComplete) {
  13491. this.onComplete();
  13492. }
  13493. } else if (previousFrame !== this.currentFrame) {
  13494. if (this.loop && this.onLoop) {
  13495. if (this.animationSpeed > 0 && this.currentFrame < previousFrame) {
  13496. this.onLoop();
  13497. } else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) {
  13498. this.onLoop();
  13499. }
  13500. }
  13501. this.updateTexture();
  13502. }
  13503. };
  13504. AnimatedSprite2.prototype.updateTexture = function() {
  13505. var currentFrame = this.currentFrame;
  13506. if (this._previousFrame === currentFrame) {
  13507. return;
  13508. }
  13509. this._previousFrame = currentFrame;
  13510. this._texture = this._textures[currentFrame];
  13511. this._textureID = -1;
  13512. this._textureTrimmedID = -1;
  13513. this._cachedTint = 16777215;
  13514. this.uvs = this._texture._uvs.uvsFloat32;
  13515. if (this.updateAnchor) {
  13516. this._anchor.copyFrom(this._texture.defaultAnchor);
  13517. }
  13518. if (this.onFrameChange) {
  13519. this.onFrameChange(this.currentFrame);
  13520. }
  13521. };
  13522. AnimatedSprite2.prototype.destroy = function(options) {
  13523. this.stop();
  13524. _super.prototype.destroy.call(this, options);
  13525. this.onComplete = null;
  13526. this.onFrameChange = null;
  13527. this.onLoop = null;
  13528. };
  13529. AnimatedSprite2.fromFrames = function(frames) {
  13530. var textures = [];
  13531. for (var i = 0; i < frames.length; ++i) {
  13532. textures.push(Texture.from(frames[i]));
  13533. }
  13534. return new AnimatedSprite2(textures);
  13535. };
  13536. AnimatedSprite2.fromImages = function(images) {
  13537. var textures = [];
  13538. for (var i = 0; i < images.length; ++i) {
  13539. textures.push(Texture.from(images[i]));
  13540. }
  13541. return new AnimatedSprite2(textures);
  13542. };
  13543. Object.defineProperty(AnimatedSprite2.prototype, "totalFrames", {
  13544. /**
  13545. * The total number of frames in the AnimatedSprite. This is the same as number of textures
  13546. * assigned to the AnimatedSprite.
  13547. * @readonly
  13548. * @default 0
  13549. */
  13550. get: function() {
  13551. return this._textures.length;
  13552. },
  13553. enumerable: false,
  13554. configurable: true
  13555. });
  13556. Object.defineProperty(AnimatedSprite2.prototype, "textures", {
  13557. /** The array of textures used for this AnimatedSprite. */
  13558. get: function() {
  13559. return this._textures;
  13560. },
  13561. set: function(value) {
  13562. if (value[0] instanceof Texture) {
  13563. this._textures = value;
  13564. this._durations = null;
  13565. } else {
  13566. this._textures = [];
  13567. this._durations = [];
  13568. for (var i = 0; i < value.length; i++) {
  13569. this._textures.push(value[i].texture);
  13570. this._durations.push(value[i].time);
  13571. }
  13572. }
  13573. this._previousFrame = null;
  13574. this.gotoAndStop(0);
  13575. this.updateTexture();
  13576. },
  13577. enumerable: false,
  13578. configurable: true
  13579. });
  13580. Object.defineProperty(AnimatedSprite2.prototype, "currentFrame", {
  13581. /**
  13582. * The AnimatedSprites current frame index.
  13583. * @readonly
  13584. */
  13585. get: function() {
  13586. var currentFrame = Math.floor(this._currentTime) % this._textures.length;
  13587. if (currentFrame < 0) {
  13588. currentFrame += this._textures.length;
  13589. }
  13590. return currentFrame;
  13591. },
  13592. enumerable: false,
  13593. configurable: true
  13594. });
  13595. Object.defineProperty(AnimatedSprite2.prototype, "playing", {
  13596. /**
  13597. * Indicates if the AnimatedSprite is currently playing.
  13598. * @readonly
  13599. */
  13600. get: function() {
  13601. return this._playing;
  13602. },
  13603. enumerable: false,
  13604. configurable: true
  13605. });
  13606. Object.defineProperty(AnimatedSprite2.prototype, "autoUpdate", {
  13607. /** Whether to use PIXI.Ticker.shared to auto update animation time. */
  13608. get: function() {
  13609. return this._autoUpdate;
  13610. },
  13611. set: function(value) {
  13612. if (value !== this._autoUpdate) {
  13613. this._autoUpdate = value;
  13614. if (!this._autoUpdate && this._isConnectedToTicker) {
  13615. Ticker.shared.remove(this.update, this);
  13616. this._isConnectedToTicker = false;
  13617. } else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {
  13618. Ticker.shared.add(this.update, this);
  13619. this._isConnectedToTicker = true;
  13620. }
  13621. }
  13622. },
  13623. enumerable: false,
  13624. configurable: true
  13625. });
  13626. return AnimatedSprite2;
  13627. })(Sprite)
  13628. );
  13629. // node_modules/pixi.js/dist/esm/pixi.mjs
  13630. extensions.add(
  13631. // Install renderer plugins
  13632. AccessibilityManager,
  13633. Extract,
  13634. InteractionManager,
  13635. ParticleRenderer,
  13636. Prepare,
  13637. BatchRenderer,
  13638. TilingSpriteRenderer,
  13639. // Install loader plugins
  13640. BitmapFontLoader,
  13641. CompressedTextureLoader,
  13642. DDSLoader,
  13643. KTXLoader,
  13644. SpritesheetLoader,
  13645. // Install application plugins
  13646. TickerPlugin,
  13647. AppLoaderPlugin
  13648. );
  13649. var filters = {
  13650. AlphaFilter,
  13651. BlurFilter,
  13652. BlurFilterPass,
  13653. ColorMatrixFilter,
  13654. DisplacementFilter,
  13655. FXAAFilter,
  13656. NoiseFilter
  13657. };
  13658. export {
  13659. ALPHA_MODES,
  13660. AbstractBatchRenderer,
  13661. AbstractMultiResource,
  13662. AbstractRenderer,
  13663. AccessibilityManager,
  13664. AnimatedSprite,
  13665. AppLoaderPlugin,
  13666. Application,
  13667. ArrayResource,
  13668. Attribute,
  13669. BLEND_MODES,
  13670. BUFFER_BITS,
  13671. BUFFER_TYPE,
  13672. BaseImageResource,
  13673. BasePrepare,
  13674. BaseRenderTexture,
  13675. BaseTexture,
  13676. BatchDrawCall,
  13677. BatchGeometry,
  13678. BatchPluginFactory,
  13679. BatchRenderer,
  13680. BatchShaderGenerator,
  13681. BatchSystem,
  13682. BatchTextureArray,
  13683. BitmapFont,
  13684. BitmapFontData,
  13685. BitmapFontLoader,
  13686. BitmapText,
  13687. BlobResource,
  13688. Bounds,
  13689. BrowserAdapter,
  13690. Buffer,
  13691. BufferResource,
  13692. CLEAR_MODES,
  13693. COLOR_MASK_BITS,
  13694. CanvasResource,
  13695. Circle,
  13696. CompressedTextureLoader,
  13697. CompressedTextureResource,
  13698. Container,
  13699. ContextSystem,
  13700. CountLimiter,
  13701. CubeResource,
  13702. DDSLoader,
  13703. DEG_TO_RAD,
  13704. DRAW_MODES,
  13705. DisplayObject,
  13706. ENV,
  13707. Ellipse,
  13708. ExtensionType,
  13709. Extract,
  13710. FORMATS,
  13711. FORMATS_TO_COMPONENTS,
  13712. FillStyle,
  13713. Filter,
  13714. FilterState,
  13715. FilterSystem,
  13716. Framebuffer,
  13717. FramebufferSystem,
  13718. GC_MODES,
  13719. GLFramebuffer,
  13720. GLProgram,
  13721. GLTexture,
  13722. GRAPHICS_CURVES,
  13723. Geometry,
  13724. GeometrySystem,
  13725. Graphics,
  13726. GraphicsData,
  13727. GraphicsGeometry,
  13728. IGLUniformData,
  13729. INSTALLED,
  13730. INTERNAL_FORMATS,
  13731. INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,
  13732. ImageBitmapResource,
  13733. ImageResource,
  13734. InteractionData,
  13735. InteractionEvent,
  13736. InteractionManager,
  13737. InteractionTrackingData,
  13738. KTXLoader,
  13739. LINE_CAP,
  13740. LINE_JOIN,
  13741. LineStyle,
  13742. Loader,
  13743. LoaderResource,
  13744. MASK_TYPES,
  13745. MIPMAP_MODES,
  13746. MSAA_QUALITY,
  13747. MaskData,
  13748. MaskSystem,
  13749. Matrix,
  13750. Mesh,
  13751. MeshBatchUvs,
  13752. MeshGeometry,
  13753. MeshMaterial,
  13754. NineSlicePlane,
  13755. ObjectRenderer,
  13756. ObservablePoint,
  13757. PI_2,
  13758. PRECISION,
  13759. ParticleContainer,
  13760. ParticleRenderer,
  13761. PlaneGeometry,
  13762. Point,
  13763. Polygon,
  13764. Prepare,
  13765. Program,
  13766. ProjectionSystem,
  13767. Quad,
  13768. QuadUv,
  13769. RAD_TO_DEG,
  13770. RENDERER_TYPE,
  13771. Rectangle,
  13772. RenderTexture,
  13773. RenderTexturePool,
  13774. RenderTextureSystem,
  13775. Renderer,
  13776. ResizePlugin,
  13777. Resource,
  13778. RopeGeometry,
  13779. RoundedRectangle,
  13780. Runner,
  13781. SAMPLER_TYPES,
  13782. SCALE_MODES,
  13783. SHAPES,
  13784. SVGResource,
  13785. ScissorSystem,
  13786. Shader,
  13787. ShaderSystem,
  13788. SimpleMesh,
  13789. SimplePlane,
  13790. SimpleRope,
  13791. Sprite,
  13792. SpriteMaskFilter,
  13793. Spritesheet,
  13794. SpritesheetLoader,
  13795. State,
  13796. StateSystem,
  13797. StencilSystem,
  13798. System,
  13799. TARGETS,
  13800. TEXT_GRADIENT,
  13801. TYPES,
  13802. TYPES_TO_BYTES_PER_COMPONENT,
  13803. TYPES_TO_BYTES_PER_PIXEL,
  13804. TemporaryDisplayObject,
  13805. Text,
  13806. TextFormat,
  13807. TextMetrics,
  13808. TextStyle,
  13809. Texture,
  13810. TextureGCSystem,
  13811. TextureLoader,
  13812. TextureMatrix,
  13813. TextureSystem,
  13814. TextureUvs,
  13815. Ticker,
  13816. TickerPlugin,
  13817. TilingSprite,
  13818. TilingSpriteRenderer,
  13819. TimeLimiter,
  13820. Transform,
  13821. UPDATE_PRIORITY,
  13822. UniformGroup,
  13823. VERSION,
  13824. VideoResource,
  13825. ViewableBuffer,
  13826. WRAP_MODES,
  13827. XMLFormat,
  13828. XMLStringFormat,
  13829. accessibleTarget,
  13830. autoDetectFormat,
  13831. autoDetectRenderer,
  13832. autoDetectResource,
  13833. checkMaxIfStatementsInShader,
  13834. createUBOElements,
  13835. defaultFilterVertex,
  13836. defaultVertex$1 as defaultVertex,
  13837. extensions,
  13838. filters,
  13839. generateProgram,
  13840. generateUniformBufferSync,
  13841. getTestContext,
  13842. getUBOData,
  13843. graphicsUtils,
  13844. groupD8,
  13845. interactiveTarget,
  13846. isMobile,
  13847. parseDDS,
  13848. parseKTX,
  13849. resources,
  13850. settings,
  13851. systems,
  13852. uniformParsers,
  13853. utils_exports as utils
  13854. };
  13855. /*! Bundled license information:
  13856. object-assign/index.js:
  13857. (*
  13858. object-assign
  13859. (c) Sindre Sorhus
  13860. @license MIT
  13861. *)
  13862. @pixi/polyfill/dist/esm/polyfill.mjs:
  13863. (*!
  13864. * @pixi/polyfill - v6.5.10
  13865. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13866. *
  13867. * @pixi/polyfill is licensed under the MIT License.
  13868. * http://www.opensource.org/licenses/mit-license
  13869. *)
  13870. @pixi/accessibility/dist/esm/accessibility.mjs:
  13871. (*!
  13872. * @pixi/accessibility - v6.5.10
  13873. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13874. *
  13875. * @pixi/accessibility is licensed under the MIT License.
  13876. * http://www.opensource.org/licenses/mit-license
  13877. *)
  13878. @pixi/interaction/dist/esm/interaction.mjs:
  13879. (*!
  13880. * @pixi/interaction - v6.5.10
  13881. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13882. *
  13883. * @pixi/interaction is licensed under the MIT License.
  13884. * http://www.opensource.org/licenses/mit-license
  13885. *)
  13886. (*! *****************************************************************************
  13887. Copyright (c) Microsoft Corporation.
  13888. Permission to use, copy, modify, and/or distribute this software for any
  13889. purpose with or without fee is hereby granted.
  13890. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13891. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  13892. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  13893. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13894. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  13895. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13896. PERFORMANCE OF THIS SOFTWARE.
  13897. ***************************************************************************** *)
  13898. @pixi/extract/dist/esm/extract.mjs:
  13899. (*!
  13900. * @pixi/extract - v6.5.10
  13901. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13902. *
  13903. * @pixi/extract is licensed under the MIT License.
  13904. * http://www.opensource.org/licenses/mit-license
  13905. *)
  13906. @pixi/loaders/dist/esm/loaders.mjs:
  13907. (*!
  13908. * @pixi/loaders - v6.5.10
  13909. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13910. *
  13911. * @pixi/loaders is licensed under the MIT License.
  13912. * http://www.opensource.org/licenses/mit-license
  13913. *)
  13914. @pixi/compressed-textures/dist/esm/compressed-textures.mjs:
  13915. (*!
  13916. * @pixi/compressed-textures - v6.5.10
  13917. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13918. *
  13919. * @pixi/compressed-textures is licensed under the MIT License.
  13920. * http://www.opensource.org/licenses/mit-license
  13921. *)
  13922. (*! *****************************************************************************
  13923. Copyright (c) Microsoft Corporation.
  13924. Permission to use, copy, modify, and/or distribute this software for any
  13925. purpose with or without fee is hereby granted.
  13926. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13927. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  13928. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  13929. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13930. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  13931. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13932. PERFORMANCE OF THIS SOFTWARE.
  13933. ***************************************************************************** *)
  13934. @pixi/particle-container/dist/esm/particle-container.mjs:
  13935. (*!
  13936. * @pixi/particle-container - v6.5.10
  13937. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13938. *
  13939. * @pixi/particle-container is licensed under the MIT License.
  13940. * http://www.opensource.org/licenses/mit-license
  13941. *)
  13942. (*! *****************************************************************************
  13943. Copyright (c) Microsoft Corporation.
  13944. Permission to use, copy, modify, and/or distribute this software for any
  13945. purpose with or without fee is hereby granted.
  13946. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13947. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  13948. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  13949. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13950. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  13951. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13952. PERFORMANCE OF THIS SOFTWARE.
  13953. ***************************************************************************** *)
  13954. @pixi/graphics/dist/esm/graphics.mjs:
  13955. (*!
  13956. * @pixi/graphics - v6.5.10
  13957. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13958. *
  13959. * @pixi/graphics is licensed under the MIT License.
  13960. * http://www.opensource.org/licenses/mit-license
  13961. *)
  13962. (*! *****************************************************************************
  13963. Copyright (c) Microsoft Corporation.
  13964. Permission to use, copy, modify, and/or distribute this software for any
  13965. purpose with or without fee is hereby granted.
  13966. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13967. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  13968. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  13969. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13970. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  13971. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13972. PERFORMANCE OF THIS SOFTWARE.
  13973. ***************************************************************************** *)
  13974. @pixi/sprite/dist/esm/sprite.mjs:
  13975. (*!
  13976. * @pixi/sprite - v6.5.10
  13977. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13978. *
  13979. * @pixi/sprite is licensed under the MIT License.
  13980. * http://www.opensource.org/licenses/mit-license
  13981. *)
  13982. (*! *****************************************************************************
  13983. Copyright (c) Microsoft Corporation.
  13984. Permission to use, copy, modify, and/or distribute this software for any
  13985. purpose with or without fee is hereby granted.
  13986. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13987. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  13988. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  13989. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13990. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  13991. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13992. PERFORMANCE OF THIS SOFTWARE.
  13993. ***************************************************************************** *)
  13994. @pixi/text/dist/esm/text.mjs:
  13995. (*!
  13996. * @pixi/text - v6.5.10
  13997. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  13998. *
  13999. * @pixi/text is licensed under the MIT License.
  14000. * http://www.opensource.org/licenses/mit-license
  14001. *)
  14002. (*! *****************************************************************************
  14003. Copyright (c) Microsoft Corporation.
  14004. Permission to use, copy, modify, and/or distribute this software for any
  14005. purpose with or without fee is hereby granted.
  14006. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14007. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14008. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14009. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14010. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14011. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14012. PERFORMANCE OF THIS SOFTWARE.
  14013. ***************************************************************************** *)
  14014. @pixi/prepare/dist/esm/prepare.mjs:
  14015. (*!
  14016. * @pixi/prepare - v6.5.10
  14017. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14018. *
  14019. * @pixi/prepare is licensed under the MIT License.
  14020. * http://www.opensource.org/licenses/mit-license
  14021. *)
  14022. (*! *****************************************************************************
  14023. Copyright (c) Microsoft Corporation.
  14024. Permission to use, copy, modify, and/or distribute this software for any
  14025. purpose with or without fee is hereby granted.
  14026. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14027. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14028. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14029. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14030. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14031. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14032. PERFORMANCE OF THIS SOFTWARE.
  14033. ***************************************************************************** *)
  14034. @pixi/spritesheet/dist/esm/spritesheet.mjs:
  14035. (*!
  14036. * @pixi/spritesheet - v6.5.10
  14037. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14038. *
  14039. * @pixi/spritesheet is licensed under the MIT License.
  14040. * http://www.opensource.org/licenses/mit-license
  14041. *)
  14042. @pixi/sprite-tiling/dist/esm/sprite-tiling.mjs:
  14043. (*!
  14044. * @pixi/sprite-tiling - v6.5.10
  14045. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14046. *
  14047. * @pixi/sprite-tiling is licensed under the MIT License.
  14048. * http://www.opensource.org/licenses/mit-license
  14049. *)
  14050. (*! *****************************************************************************
  14051. Copyright (c) Microsoft Corporation.
  14052. Permission to use, copy, modify, and/or distribute this software for any
  14053. purpose with or without fee is hereby granted.
  14054. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14055. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14056. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14057. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14058. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14059. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14060. PERFORMANCE OF THIS SOFTWARE.
  14061. ***************************************************************************** *)
  14062. @pixi/mesh/dist/esm/mesh.mjs:
  14063. (*!
  14064. * @pixi/mesh - v6.5.10
  14065. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14066. *
  14067. * @pixi/mesh is licensed under the MIT License.
  14068. * http://www.opensource.org/licenses/mit-license
  14069. *)
  14070. (*! *****************************************************************************
  14071. Copyright (c) Microsoft Corporation.
  14072. Permission to use, copy, modify, and/or distribute this software for any
  14073. purpose with or without fee is hereby granted.
  14074. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14075. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14076. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14077. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14078. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14079. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14080. PERFORMANCE OF THIS SOFTWARE.
  14081. ***************************************************************************** *)
  14082. @pixi/text-bitmap/dist/esm/text-bitmap.mjs:
  14083. (*!
  14084. * @pixi/text-bitmap - v6.5.10
  14085. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14086. *
  14087. * @pixi/text-bitmap is licensed under the MIT License.
  14088. * http://www.opensource.org/licenses/mit-license
  14089. *)
  14090. (*! *****************************************************************************
  14091. Copyright (c) Microsoft Corporation.
  14092. Permission to use, copy, modify, and/or distribute this software for any
  14093. purpose with or without fee is hereby granted.
  14094. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14095. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14096. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14097. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14098. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14099. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14100. PERFORMANCE OF THIS SOFTWARE.
  14101. ***************************************************************************** *)
  14102. @pixi/filter-alpha/dist/esm/filter-alpha.mjs:
  14103. (*!
  14104. * @pixi/filter-alpha - v6.5.10
  14105. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14106. *
  14107. * @pixi/filter-alpha is licensed under the MIT License.
  14108. * http://www.opensource.org/licenses/mit-license
  14109. *)
  14110. (*! *****************************************************************************
  14111. Copyright (c) Microsoft Corporation.
  14112. Permission to use, copy, modify, and/or distribute this software for any
  14113. purpose with or without fee is hereby granted.
  14114. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14115. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14116. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14117. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14118. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14119. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14120. PERFORMANCE OF THIS SOFTWARE.
  14121. ***************************************************************************** *)
  14122. @pixi/filter-blur/dist/esm/filter-blur.mjs:
  14123. (*!
  14124. * @pixi/filter-blur - v6.5.10
  14125. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14126. *
  14127. * @pixi/filter-blur is licensed under the MIT License.
  14128. * http://www.opensource.org/licenses/mit-license
  14129. *)
  14130. (*! *****************************************************************************
  14131. Copyright (c) Microsoft Corporation.
  14132. Permission to use, copy, modify, and/or distribute this software for any
  14133. purpose with or without fee is hereby granted.
  14134. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14135. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14136. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14137. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14138. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14139. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14140. PERFORMANCE OF THIS SOFTWARE.
  14141. ***************************************************************************** *)
  14142. @pixi/filter-color-matrix/dist/esm/filter-color-matrix.mjs:
  14143. (*!
  14144. * @pixi/filter-color-matrix - v6.5.10
  14145. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14146. *
  14147. * @pixi/filter-color-matrix is licensed under the MIT License.
  14148. * http://www.opensource.org/licenses/mit-license
  14149. *)
  14150. (*! *****************************************************************************
  14151. Copyright (c) Microsoft Corporation.
  14152. Permission to use, copy, modify, and/or distribute this software for any
  14153. purpose with or without fee is hereby granted.
  14154. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14155. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14156. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14157. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14158. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14159. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14160. PERFORMANCE OF THIS SOFTWARE.
  14161. ***************************************************************************** *)
  14162. @pixi/filter-displacement/dist/esm/filter-displacement.mjs:
  14163. (*!
  14164. * @pixi/filter-displacement - v6.5.10
  14165. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14166. *
  14167. * @pixi/filter-displacement is licensed under the MIT License.
  14168. * http://www.opensource.org/licenses/mit-license
  14169. *)
  14170. (*! *****************************************************************************
  14171. Copyright (c) Microsoft Corporation.
  14172. Permission to use, copy, modify, and/or distribute this software for any
  14173. purpose with or without fee is hereby granted.
  14174. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14175. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14176. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14177. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14178. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14179. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14180. PERFORMANCE OF THIS SOFTWARE.
  14181. ***************************************************************************** *)
  14182. @pixi/filter-fxaa/dist/esm/filter-fxaa.mjs:
  14183. (*!
  14184. * @pixi/filter-fxaa - v6.5.10
  14185. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14186. *
  14187. * @pixi/filter-fxaa is licensed under the MIT License.
  14188. * http://www.opensource.org/licenses/mit-license
  14189. *)
  14190. (*! *****************************************************************************
  14191. Copyright (c) Microsoft Corporation.
  14192. Permission to use, copy, modify, and/or distribute this software for any
  14193. purpose with or without fee is hereby granted.
  14194. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14195. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14196. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14197. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14198. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14199. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14200. PERFORMANCE OF THIS SOFTWARE.
  14201. ***************************************************************************** *)
  14202. @pixi/filter-noise/dist/esm/filter-noise.mjs:
  14203. (*!
  14204. * @pixi/filter-noise - v6.5.10
  14205. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14206. *
  14207. * @pixi/filter-noise is licensed under the MIT License.
  14208. * http://www.opensource.org/licenses/mit-license
  14209. *)
  14210. (*! *****************************************************************************
  14211. Copyright (c) Microsoft Corporation.
  14212. Permission to use, copy, modify, and/or distribute this software for any
  14213. purpose with or without fee is hereby granted.
  14214. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14215. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14216. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14217. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14218. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14219. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14220. PERFORMANCE OF THIS SOFTWARE.
  14221. ***************************************************************************** *)
  14222. @pixi/mixin-cache-as-bitmap/dist/esm/mixin-cache-as-bitmap.mjs:
  14223. (*!
  14224. * @pixi/mixin-cache-as-bitmap - v6.5.10
  14225. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14226. *
  14227. * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.
  14228. * http://www.opensource.org/licenses/mit-license
  14229. *)
  14230. @pixi/mixin-get-child-by-name/dist/esm/mixin-get-child-by-name.mjs:
  14231. (*!
  14232. * @pixi/mixin-get-child-by-name - v6.5.10
  14233. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14234. *
  14235. * @pixi/mixin-get-child-by-name is licensed under the MIT License.
  14236. * http://www.opensource.org/licenses/mit-license
  14237. *)
  14238. @pixi/mixin-get-global-position/dist/esm/mixin-get-global-position.mjs:
  14239. (*!
  14240. * @pixi/mixin-get-global-position - v6.5.10
  14241. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14242. *
  14243. * @pixi/mixin-get-global-position is licensed under the MIT License.
  14244. * http://www.opensource.org/licenses/mit-license
  14245. *)
  14246. @pixi/app/dist/esm/app.mjs:
  14247. (*!
  14248. * @pixi/app - v6.5.10
  14249. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14250. *
  14251. * @pixi/app is licensed under the MIT License.
  14252. * http://www.opensource.org/licenses/mit-license
  14253. *)
  14254. @pixi/mesh-extras/dist/esm/mesh-extras.mjs:
  14255. (*!
  14256. * @pixi/mesh-extras - v6.5.10
  14257. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14258. *
  14259. * @pixi/mesh-extras is licensed under the MIT License.
  14260. * http://www.opensource.org/licenses/mit-license
  14261. *)
  14262. (*! *****************************************************************************
  14263. Copyright (c) Microsoft Corporation.
  14264. Permission to use, copy, modify, and/or distribute this software for any
  14265. purpose with or without fee is hereby granted.
  14266. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14267. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14268. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14269. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14270. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14271. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14272. PERFORMANCE OF THIS SOFTWARE.
  14273. ***************************************************************************** *)
  14274. @pixi/sprite-animated/dist/esm/sprite-animated.mjs:
  14275. (*!
  14276. * @pixi/sprite-animated - v6.5.10
  14277. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14278. *
  14279. * @pixi/sprite-animated is licensed under the MIT License.
  14280. * http://www.opensource.org/licenses/mit-license
  14281. *)
  14282. (*! *****************************************************************************
  14283. Copyright (c) Microsoft Corporation.
  14284. Permission to use, copy, modify, and/or distribute this software for any
  14285. purpose with or without fee is hereby granted.
  14286. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  14287. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14288. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  14289. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  14290. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  14291. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14292. PERFORMANCE OF THIS SOFTWARE.
  14293. ***************************************************************************** *)
  14294. pixi.js/dist/esm/pixi.mjs:
  14295. (*!
  14296. * pixi.js - v6.5.10
  14297. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  14298. *
  14299. * pixi.js is licensed under the MIT License.
  14300. * http://www.opensource.org/licenses/mit-license
  14301. *)
  14302. */
  14303. //# sourceMappingURL=pixi__js.js.map