cocos2d-js-min.js 3.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985
  1. (function(t, e, i) {
  2. function n(i, r) {
  3. var s = e[i];
  4. if (!s) {
  5. var o = t[i];
  6. if (!o) return;
  7. var a = {};
  8. s = e[i] = {
  9. exports: a
  10. }, o[0]((function(t) {
  11. return n(o[1][t] || t)
  12. }), s, a)
  13. }
  14. return s.exports
  15. }
  16. for (var r = 0; r < i.length; r++) n(i[r])
  17. })({
  18. 1: [(function(t, e, i) {
  19. "use strict";
  20. t("../core/platform/CCClass");
  21. var n = t("../core/utils/misc");
  22. cc.Action = cc.Class({
  23. name: "cc.Action",
  24. ctor: function() {
  25. this.originalTarget = null, this.target = null, this.tag = cc.Action.TAG_INVALID
  26. },
  27. clone: function() {
  28. var t = new cc.Action;
  29. return t.originalTarget = null, t.target = null, t.tag = this.tag, t
  30. },
  31. isDone: function() {
  32. return !0
  33. },
  34. startWithTarget: function(t) {
  35. this.originalTarget = t, this.target = t
  36. },
  37. stop: function() {
  38. this.target = null
  39. },
  40. step: function(t) {
  41. cc.logID(1006)
  42. },
  43. update: function(t) {
  44. cc.logID(1007)
  45. },
  46. getTarget: function() {
  47. return this.target
  48. },
  49. setTarget: function(t) {
  50. this.target = t
  51. },
  52. getOriginalTarget: function() {
  53. return this.originalTarget
  54. },
  55. setOriginalTarget: function(t) {
  56. this.originalTarget = t
  57. },
  58. getTag: function() {
  59. return this.tag
  60. },
  61. setTag: function(t) {
  62. this.tag = t
  63. },
  64. retain: function() {},
  65. release: function() {}
  66. }), cc.Action.TAG_INVALID = -1, cc.FiniteTimeAction = cc.Class({
  67. name: "cc.FiniteTimeAction",
  68. extends: cc.Action,
  69. ctor: function() {
  70. this._duration = 0
  71. },
  72. getDuration: function() {
  73. return this._duration * (this._timesForRepeat || 1)
  74. },
  75. setDuration: function(t) {
  76. this._duration = t
  77. },
  78. reverse: function() {
  79. return cc.logID(1008), null
  80. },
  81. clone: function() {
  82. return new cc.FiniteTimeAction
  83. }
  84. }), cc.Speed = cc.Class({
  85. name: "cc.Speed",
  86. extends: cc.Action,
  87. ctor: function(t, e) {
  88. this._speed = 0, this._innerAction = null, t && this.initWithAction(t, e)
  89. },
  90. getSpeed: function() {
  91. return this._speed
  92. },
  93. setSpeed: function(t) {
  94. this._speed = t
  95. },
  96. initWithAction: function(t, e) {
  97. return t ? (this._innerAction = t, this._speed = e, !0) : (cc.errorID(1021), !1)
  98. },
  99. clone: function() {
  100. var t = new cc.Speed;
  101. return t.initWithAction(this._innerAction.clone(), this._speed), t
  102. },
  103. startWithTarget: function(t) {
  104. cc.Action.prototype.startWithTarget.call(this, t), this._innerAction.startWithTarget(t)
  105. },
  106. stop: function() {
  107. this._innerAction.stop(), cc.Action.prototype.stop.call(this)
  108. },
  109. step: function(t) {
  110. this._innerAction.step(t * this._speed)
  111. },
  112. isDone: function() {
  113. return this._innerAction.isDone()
  114. },
  115. reverse: function() {
  116. return new cc.Speed(this._innerAction.reverse(), this._speed)
  117. },
  118. setInnerAction: function(t) {
  119. this._innerAction !== t && (this._innerAction = t)
  120. },
  121. getInnerAction: function() {
  122. return this._innerAction
  123. }
  124. }), cc.speed = function(t, e) {
  125. return new cc.Speed(t, e)
  126. }, cc.Follow = cc.Class({
  127. name: "cc.Follow",
  128. extends: cc.Action,
  129. ctor: function(t, e) {
  130. this._followedNode = null, this._boundarySet = !1, this._boundaryFullyCovered = !1, this._halfScreenSize = null, this._fullScreenSize = null, this.leftBoundary = 0, this.rightBoundary = 0, this.topBoundary = 0, this.bottomBoundary = 0, this._worldRect = cc.rect(0, 0, 0, 0), t && (e ? this.initWithTarget(t, e) : this.initWithTarget(t))
  131. },
  132. clone: function() {
  133. var t = new cc.Follow,
  134. e = this._worldRect,
  135. i = new cc.Rect(e.x, e.y, e.width, e.height);
  136. return t.initWithTarget(this._followedNode, i), t
  137. },
  138. isBoundarySet: function() {
  139. return this._boundarySet
  140. },
  141. setBoudarySet: function(t) {
  142. this._boundarySet = t
  143. },
  144. initWithTarget: function(t, e) {
  145. if (!t) return cc.errorID(1022), !1;
  146. e = e || cc.rect(0, 0, 0, 0), this._followedNode = t, this._worldRect = e, this._boundarySet = !(0 === e.width && 0 === e.height), this._boundaryFullyCovered = !1;
  147. var i = cc.winSize;
  148. return this._fullScreenSize = cc.v2(i.width, i.height), this._halfScreenSize = this._fullScreenSize.mul(.5), this._boundarySet && (this.leftBoundary = -(e.x + e.width - this._fullScreenSize.x), this.rightBoundary = -e.x, this.topBoundary = -e.y, this.bottomBoundary = -(e.y + e.height - this._fullScreenSize.y), this.rightBoundary < this.leftBoundary && (this.rightBoundary = this.leftBoundary = (this.leftBoundary + this.rightBoundary) / 2), this.topBoundary < this.bottomBoundary && (this.topBoundary = this.bottomBoundary = (this.topBoundary + this.bottomBoundary) / 2), this.topBoundary === this.bottomBoundary && this.leftBoundary === this.rightBoundary && (this._boundaryFullyCovered = !0)), !0
  149. },
  150. step: function(t) {
  151. var e = this.target.convertToWorldSpaceAR(cc.Vec2.ZERO),
  152. i = this._followedNode.convertToWorldSpaceAR(cc.Vec2.ZERO),
  153. r = e.sub(i),
  154. s = this.target.parent.convertToNodeSpaceAR(r.add(this._halfScreenSize));
  155. if (this._boundarySet) {
  156. if (this._boundaryFullyCovered) return;
  157. this.target.setPosition(n.clampf(s.x, this.leftBoundary, this.rightBoundary), n.clampf(s.y, this.bottomBoundary, this.topBoundary))
  158. } else this.target.setPosition(s.x, s.y)
  159. },
  160. isDone: function() {
  161. return !this._followedNode.activeInHierarchy
  162. },
  163. stop: function() {
  164. this.target = null, cc.Action.prototype.stop.call(this)
  165. }
  166. }), cc.follow = function(t, e) {
  167. return new cc.Follow(t, e)
  168. }
  169. }), {
  170. "../core/platform/CCClass": 198,
  171. "../core/utils/misc": 300
  172. }],
  173. 2: [(function(t, e, i) {
  174. "use strict";
  175. function n(t, e, i, n, r, s) {
  176. var o = s * s,
  177. a = o * s,
  178. l = (1 - r) / 2,
  179. h = l * (2 * o - a - s),
  180. c = l * (-a + o) + (2 * a - 3 * o + 1),
  181. u = l * (a - 2 * o + s) + (-2 * a + 3 * o),
  182. _ = l * (a - o),
  183. f = t.x * h + e.x * c + i.x * u + n.x * _,
  184. d = t.y * h + e.y * c + i.y * u + n.y * _;
  185. return cc.v2(f, d)
  186. }
  187. function r(t, e) {
  188. return t[Math.min(t.length - 1, Math.max(e, 0))]
  189. }
  190. function s(t) {
  191. for (var e = [], i = t.length - 1; i >= 0; i--) e.push(cc.v2(t[i].x, t[i].y));
  192. return e
  193. }
  194. function o(t) {
  195. for (var e = [], i = 0; i < t.length; i++) e.push(cc.v2(t[i].x, t[i].y));
  196. return e
  197. }
  198. cc.CardinalSplineTo = cc.Class({
  199. name: "cc.CardinalSplineTo",
  200. extends: cc.ActionInterval,
  201. ctor: function(t, e, i) {
  202. this._points = [], this._deltaT = 0, this._tension = 0, this._previousPosition = null, this._accumulatedDiff = null, void 0 !== i && cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, i)
  203. },
  204. initWithDuration: function(t, e, i) {
  205. return e && 0 !== e.length ? !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this.setPoints(e), this._tension = i, !0) : (cc.errorID(1024), !1)
  206. },
  207. clone: function() {
  208. var t = new cc.CardinalSplineTo;
  209. return t.initWithDuration(this._duration, o(this._points), this._tension), t
  210. },
  211. startWithTarget: function(t) {
  212. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._deltaT = 1 / (this._points.length - 1), this._previousPosition = cc.v2(this.target.x, this.target.y), this._accumulatedDiff = cc.v2(0, 0)
  213. },
  214. update: function(t) {
  215. var e, i;
  216. t = this._computeEaseTime(t);
  217. var s = this._points;
  218. if (1 === t) e = s.length - 1, i = 1;
  219. else {
  220. var o = this._deltaT;
  221. i = (t - o * (e = 0 | t / o)) / o
  222. }
  223. var a, l, h = n(r(s, e - 1), r(s, e - 0), r(s, e + 1), r(s, e + 2), this._tension, i);
  224. if (cc.macro.ENABLE_STACKABLE_ACTIONS && (a = this.target.x - this._previousPosition.x, l = this.target.y - this._previousPosition.y, 0 !== a || 0 !== l)) {
  225. var c = this._accumulatedDiff;
  226. a = c.x + a, l = c.y + l, c.x = a, c.y = l, h.x += a, h.y += l
  227. }
  228. this.updatePosition(h)
  229. },
  230. reverse: function() {
  231. var t = s(this._points);
  232. return cc.cardinalSplineTo(this._duration, t, this._tension)
  233. },
  234. updatePosition: function(t) {
  235. this.target.setPosition(t), this._previousPosition = t
  236. },
  237. getPoints: function() {
  238. return this._points
  239. },
  240. setPoints: function(t) {
  241. this._points = t
  242. }
  243. }), cc.cardinalSplineTo = function(t, e, i) {
  244. return new cc.CardinalSplineTo(t, e, i)
  245. }, cc.CardinalSplineBy = cc.Class({
  246. name: "cc.CardinalSplineBy",
  247. extends: cc.CardinalSplineTo,
  248. ctor: function(t, e, i) {
  249. this._startPosition = cc.v2(0, 0), void 0 !== i && this.initWithDuration(t, e, i)
  250. },
  251. startWithTarget: function(t) {
  252. cc.CardinalSplineTo.prototype.startWithTarget.call(this, t), this._startPosition.x = t.x, this._startPosition.y = t.y
  253. },
  254. reverse: function() {
  255. for (var t, e = this._points.slice(), i = e[0], n = 1; n < e.length; ++n) t = e[n], e[n] = t.sub(i), i = t;
  256. var r = s(e);
  257. i = r[r.length - 1], r.pop(), i.x = -i.x, i.y = -i.y, r.unshift(i);
  258. for (n = 1; n < r.length; ++n)(t = r[n]).x = -t.x, t.y = -t.y, t.x += i.x, t.y += i.y, r[n] = t, i = t;
  259. return cc.cardinalSplineBy(this._duration, r, this._tension)
  260. },
  261. updatePosition: function(t) {
  262. var e = this._startPosition,
  263. i = t.x + e.x,
  264. n = t.y + e.y;
  265. this._previousPosition.x = i, this._previousPosition.y = n, this.target.setPosition(i, n)
  266. },
  267. clone: function() {
  268. var t = new cc.CardinalSplineBy;
  269. return t.initWithDuration(this._duration, o(this._points), this._tension), t
  270. }
  271. }), cc.cardinalSplineBy = function(t, e, i) {
  272. return new cc.CardinalSplineBy(t, e, i)
  273. }, cc.CatmullRomTo = cc.Class({
  274. name: "cc.CatmullRomTo",
  275. extends: cc.CardinalSplineTo,
  276. ctor: function(t, e) {
  277. e && this.initWithDuration(t, e)
  278. },
  279. initWithDuration: function(t, e) {
  280. return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5)
  281. },
  282. clone: function() {
  283. var t = new cc.CatmullRomTo;
  284. return t.initWithDuration(this._duration, o(this._points)), t
  285. }
  286. }), cc.catmullRomTo = function(t, e) {
  287. return new cc.CatmullRomTo(t, e)
  288. }, cc.CatmullRomBy = cc.Class({
  289. name: "cc.CatmullRomBy",
  290. extends: cc.CardinalSplineBy,
  291. ctor: function(t, e) {
  292. e && this.initWithDuration(t, e)
  293. },
  294. initWithDuration: function(t, e) {
  295. return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5)
  296. },
  297. clone: function() {
  298. var t = new cc.CatmullRomBy;
  299. return t.initWithDuration(this._duration, o(this._points)), t
  300. }
  301. }), cc.catmullRomBy = function(t, e) {
  302. return new cc.CatmullRomBy(t, e)
  303. }
  304. }), {}],
  305. 3: [(function(t, e, i) {
  306. "use strict";
  307. cc.easeIn = function(t) {
  308. return {
  309. _rate: t,
  310. easing: function(t) {
  311. return Math.pow(t, this._rate)
  312. },
  313. reverse: function() {
  314. return cc.easeIn(1 / this._rate)
  315. }
  316. }
  317. }, cc.easeOut = function(t) {
  318. return {
  319. _rate: t,
  320. easing: function(t) {
  321. return Math.pow(t, 1 / this._rate)
  322. },
  323. reverse: function() {
  324. return cc.easeOut(1 / this._rate)
  325. }
  326. }
  327. }, cc.easeInOut = function(t) {
  328. return {
  329. _rate: t,
  330. easing: function(t) {
  331. return (t *= 2) < 1 ? .5 * Math.pow(t, this._rate) : 1 - .5 * Math.pow(2 - t, this._rate)
  332. },
  333. reverse: function() {
  334. return cc.easeInOut(this._rate)
  335. }
  336. }
  337. };
  338. var n = {
  339. easing: function(t) {
  340. return 0 === t ? 0 : Math.pow(2, 10 * (t - 1))
  341. },
  342. reverse: function() {
  343. return r
  344. }
  345. };
  346. cc.easeExponentialIn = function() {
  347. return n
  348. };
  349. var r = {
  350. easing: function(t) {
  351. return 1 === t ? 1 : 1 - Math.pow(2, -10 * t)
  352. },
  353. reverse: function() {
  354. return n
  355. }
  356. };
  357. cc.easeExponentialOut = function() {
  358. return r
  359. };
  360. var s = {
  361. easing: function(t) {
  362. return 1 !== t && 0 !== t ? (t *= 2) < 1 ? .5 * Math.pow(2, 10 * (t - 1)) : .5 * (2 - Math.pow(2, -10 * (t - 1))) : t
  363. },
  364. reverse: function() {
  365. return s
  366. }
  367. };
  368. cc.easeExponentialInOut = function() {
  369. return s
  370. };
  371. var o = {
  372. easing: function(t) {
  373. return 0 === t || 1 === t ? t : -1 * Math.cos(t * Math.PI / 2) + 1
  374. },
  375. reverse: function() {
  376. return a
  377. }
  378. };
  379. cc.easeSineIn = function() {
  380. return o
  381. };
  382. var a = {
  383. easing: function(t) {
  384. return 0 === t || 1 === t ? t : Math.sin(t * Math.PI / 2)
  385. },
  386. reverse: function() {
  387. return o
  388. }
  389. };
  390. cc.easeSineOut = function() {
  391. return a
  392. };
  393. var l = {
  394. easing: function(t) {
  395. return 0 === t || 1 === t ? t : -.5 * (Math.cos(Math.PI * t) - 1)
  396. },
  397. reverse: function() {
  398. return l
  399. }
  400. };
  401. cc.easeSineInOut = function() {
  402. return l
  403. };
  404. var h = {
  405. easing: function(t) {
  406. return 0 === t || 1 === t ? t : (t -= 1, -Math.pow(2, 10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3))
  407. },
  408. reverse: function() {
  409. return c
  410. }
  411. };
  412. cc.easeElasticIn = function(t) {
  413. return t && .3 !== t ? {
  414. _period: t,
  415. easing: function(t) {
  416. return 0 === t || 1 === t ? t : (t -= 1, -Math.pow(2, 10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period))
  417. },
  418. reverse: function() {
  419. return cc.easeElasticOut(this._period)
  420. }
  421. } : h
  422. };
  423. var c = {
  424. easing: function(t) {
  425. return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3) + 1
  426. },
  427. reverse: function() {
  428. return h
  429. }
  430. };
  431. function u(t) {
  432. return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375
  433. }
  434. cc.easeElasticOut = function(t) {
  435. return t && .3 !== t ? {
  436. _period: t,
  437. easing: function(t) {
  438. return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period) + 1
  439. },
  440. reverse: function() {
  441. return cc.easeElasticIn(this._period)
  442. }
  443. } : c
  444. }, cc.easeElasticInOut = function(t) {
  445. return {
  446. _period: t = t || .3,
  447. easing: function(t) {
  448. var e = 0,
  449. i = this._period;
  450. if (0 === t || 1 === t) e = t;
  451. else {
  452. t *= 2, i || (i = this._period = .3 * 1.5);
  453. var n = i / 4;
  454. e = (t -= 1) < 0 ? -.5 * Math.pow(2, 10 * t) * Math.sin((t - n) * Math.PI * 2 / i) : Math.pow(2, -10 * t) * Math.sin((t - n) * Math.PI * 2 / i) * .5 + 1
  455. }
  456. return e
  457. },
  458. reverse: function() {
  459. return cc.easeElasticInOut(this._period)
  460. }
  461. }
  462. };
  463. var _ = {
  464. easing: function(t) {
  465. return 1 - u(1 - t)
  466. },
  467. reverse: function() {
  468. return f
  469. }
  470. };
  471. cc.easeBounceIn = function() {
  472. return _
  473. };
  474. var f = {
  475. easing: function(t) {
  476. return u(t)
  477. },
  478. reverse: function() {
  479. return _
  480. }
  481. };
  482. cc.easeBounceOut = function() {
  483. return f
  484. };
  485. var d = {
  486. easing: function(t) {
  487. return t < .5 ? .5 * (1 - u(1 - (t *= 2))) : .5 * u(2 * t - 1) + .5
  488. },
  489. reverse: function() {
  490. return d
  491. }
  492. };
  493. cc.easeBounceInOut = function() {
  494. return d
  495. };
  496. var p = {
  497. easing: function(t) {
  498. return 0 === t || 1 === t ? t : t * t * (2.70158 * t - 1.70158)
  499. },
  500. reverse: function() {
  501. return m
  502. }
  503. };
  504. cc.easeBackIn = function() {
  505. return p
  506. };
  507. var m = {
  508. easing: function(t) {
  509. return (t -= 1) * t * (2.70158 * t + 1.70158) + 1
  510. },
  511. reverse: function() {
  512. return p
  513. }
  514. };
  515. cc.easeBackOut = function() {
  516. return m
  517. };
  518. var y = {
  519. easing: function(t) {
  520. return (t *= 2) < 1 ? t * t * (3.5949095 * t - 2.5949095) / 2 : (t -= 2) * t * (3.5949095 * t + 2.5949095) / 2 + 1
  521. },
  522. reverse: function() {
  523. return y
  524. }
  525. };
  526. cc.easeBackInOut = function() {
  527. return y
  528. }, cc.easeBezierAction = function(t, e, i, n) {
  529. return {
  530. easing: function(r) {
  531. return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n
  532. },
  533. reverse: function() {
  534. return cc.easeBezierAction(n, i, e, t)
  535. }
  536. }
  537. };
  538. var v = {
  539. easing: function(t) {
  540. return Math.pow(t, 2)
  541. },
  542. reverse: function() {
  543. return v
  544. }
  545. };
  546. cc.easeQuadraticActionIn = function() {
  547. return v
  548. };
  549. var g = {
  550. easing: function(t) {
  551. return -t * (t - 2)
  552. },
  553. reverse: function() {
  554. return g
  555. }
  556. };
  557. cc.easeQuadraticActionOut = function() {
  558. return g
  559. };
  560. var x = {
  561. easing: function(t) {
  562. return (t *= 2) < 1 ? t * t * .5 : -.5 * (--t * (t - 2) - 1)
  563. },
  564. reverse: function() {
  565. return x
  566. }
  567. };
  568. cc.easeQuadraticActionInOut = function() {
  569. return x
  570. };
  571. var b = {
  572. easing: function(t) {
  573. return t * t * t * t
  574. },
  575. reverse: function() {
  576. return b
  577. }
  578. };
  579. cc.easeQuarticActionIn = function() {
  580. return b
  581. };
  582. var A = {
  583. easing: function(t) {
  584. return -((t -= 1) * t * t * t - 1)
  585. },
  586. reverse: function() {
  587. return A
  588. }
  589. };
  590. cc.easeQuarticActionOut = function() {
  591. return A
  592. };
  593. var C = {
  594. easing: function(t) {
  595. return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2)
  596. },
  597. reverse: function() {
  598. return C
  599. }
  600. };
  601. cc.easeQuarticActionInOut = function() {
  602. return C
  603. };
  604. var T = {
  605. easing: function(t) {
  606. return t * t * t * t * t
  607. },
  608. reverse: function() {
  609. return T
  610. }
  611. };
  612. cc.easeQuinticActionIn = function() {
  613. return T
  614. };
  615. var S = {
  616. easing: function(t) {
  617. return (t -= 1) * t * t * t * t + 1
  618. },
  619. reverse: function() {
  620. return S
  621. }
  622. };
  623. cc.easeQuinticActionOut = function() {
  624. return S
  625. };
  626. var w = {
  627. easing: function(t) {
  628. return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2)
  629. },
  630. reverse: function() {
  631. return w
  632. }
  633. };
  634. cc.easeQuinticActionInOut = function() {
  635. return w
  636. };
  637. var E = {
  638. easing: function(t) {
  639. return -1 * (Math.sqrt(1 - t * t) - 1)
  640. },
  641. reverse: function() {
  642. return E
  643. }
  644. };
  645. cc.easeCircleActionIn = function() {
  646. return E
  647. };
  648. var M = {
  649. easing: function(t) {
  650. return t -= 1, Math.sqrt(1 - t * t)
  651. },
  652. reverse: function() {
  653. return M
  654. }
  655. };
  656. cc.easeCircleActionOut = function() {
  657. return M
  658. };
  659. var D = {
  660. easing: function(t) {
  661. return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : (t -= 2, .5 * (Math.sqrt(1 - t * t) + 1))
  662. },
  663. reverse: function() {
  664. return D
  665. }
  666. };
  667. cc.easeCircleActionInOut = function() {
  668. return D
  669. };
  670. var B = {
  671. easing: function(t) {
  672. return t * t * t
  673. },
  674. reverse: function() {
  675. return B
  676. }
  677. };
  678. cc.easeCubicActionIn = function() {
  679. return B
  680. };
  681. var I = {
  682. easing: function(t) {
  683. return (t -= 1) * t * t + 1
  684. },
  685. reverse: function() {
  686. return I
  687. }
  688. };
  689. cc.easeCubicActionOut = function() {
  690. return I
  691. };
  692. var P = {
  693. easing: function(t) {
  694. return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2)
  695. },
  696. reverse: function() {
  697. return P
  698. }
  699. };
  700. cc.easeCubicActionInOut = function() {
  701. return P
  702. }
  703. }), {}],
  704. 4: [(function(t, e, i) {
  705. "use strict";
  706. cc.ActionInstant = cc.Class({
  707. name: "cc.ActionInstant",
  708. extends: cc.FiniteTimeAction,
  709. isDone: function() {
  710. return !0
  711. },
  712. step: function(t) {
  713. this.update(1)
  714. },
  715. update: function(t) {},
  716. reverse: function() {
  717. return this.clone()
  718. },
  719. clone: function() {
  720. return new cc.ActionInstant
  721. }
  722. }), cc.Show = cc.Class({
  723. name: "cc.Show",
  724. extends: cc.ActionInstant,
  725. update: function(t) {
  726. for (var e = this.target.getComponentsInChildren(cc.RenderComponent), i = 0; i < e.length; ++i) {
  727. e[i].enabled = !0
  728. }
  729. },
  730. reverse: function() {
  731. return new cc.Hide
  732. },
  733. clone: function() {
  734. return new cc.Show
  735. }
  736. }), cc.show = function() {
  737. return new cc.Show
  738. }, cc.Hide = cc.Class({
  739. name: "cc.Hide",
  740. extends: cc.ActionInstant,
  741. update: function(t) {
  742. for (var e = this.target.getComponentsInChildren(cc.RenderComponent), i = 0; i < e.length; ++i) {
  743. e[i].enabled = !1
  744. }
  745. },
  746. reverse: function() {
  747. return new cc.Show
  748. },
  749. clone: function() {
  750. return new cc.Hide
  751. }
  752. }), cc.hide = function() {
  753. return new cc.Hide
  754. }, cc.ToggleVisibility = cc.Class({
  755. name: "cc.ToggleVisibility",
  756. extends: cc.ActionInstant,
  757. update: function(t) {
  758. for (var e = this.target.getComponentsInChildren(cc.RenderComponent), i = 0; i < e.length; ++i) {
  759. var n = e[i];
  760. n.enabled = !n.enabled
  761. }
  762. },
  763. reverse: function() {
  764. return new cc.ToggleVisibility
  765. },
  766. clone: function() {
  767. return new cc.ToggleVisibility
  768. }
  769. }), cc.toggleVisibility = function() {
  770. return new cc.ToggleVisibility
  771. }, cc.RemoveSelf = cc.Class({
  772. name: "cc.RemoveSelf",
  773. extends: cc.ActionInstant,
  774. ctor: function(t) {
  775. this._isNeedCleanUp = !0, void 0 !== t && this.init(t)
  776. },
  777. update: function(t) {
  778. this.target.removeFromParent(this._isNeedCleanUp)
  779. },
  780. init: function(t) {
  781. return this._isNeedCleanUp = t, !0
  782. },
  783. reverse: function() {
  784. return new cc.RemoveSelf(this._isNeedCleanUp)
  785. },
  786. clone: function() {
  787. return new cc.RemoveSelf(this._isNeedCleanUp)
  788. }
  789. }), cc.removeSelf = function(t) {
  790. return new cc.RemoveSelf(t)
  791. }, cc.FlipX = cc.Class({
  792. name: "cc.FlipX",
  793. extends: cc.ActionInstant,
  794. ctor: function(t) {
  795. this._flippedX = !1, void 0 !== t && this.initWithFlipX(t)
  796. },
  797. initWithFlipX: function(t) {
  798. return this._flippedX = t, !0
  799. },
  800. update: function(t) {
  801. this.target.scaleX = Math.abs(this.target.scaleX) * (this._flippedX ? -1 : 1)
  802. },
  803. reverse: function() {
  804. return new cc.FlipX(!this._flippedX)
  805. },
  806. clone: function() {
  807. var t = new cc.FlipX;
  808. return t.initWithFlipX(this._flippedX), t
  809. }
  810. }), cc.flipX = function(t) {
  811. return new cc.FlipX(t)
  812. }, cc.FlipY = cc.Class({
  813. name: "cc.FlipY",
  814. extends: cc.ActionInstant,
  815. ctor: function(t) {
  816. this._flippedY = !1, void 0 !== t && this.initWithFlipY(t)
  817. },
  818. initWithFlipY: function(t) {
  819. return this._flippedY = t, !0
  820. },
  821. update: function(t) {
  822. this.target.scaleY = Math.abs(this.target.scaleY) * (this._flippedY ? -1 : 1)
  823. },
  824. reverse: function() {
  825. return new cc.FlipY(!this._flippedY)
  826. },
  827. clone: function() {
  828. var t = new cc.FlipY;
  829. return t.initWithFlipY(this._flippedY), t
  830. }
  831. }), cc.flipY = function(t) {
  832. return new cc.FlipY(t)
  833. }, cc.Place = cc.Class({
  834. name: "cc.Place",
  835. extends: cc.ActionInstant,
  836. ctor: function(t, e) {
  837. this._x = 0, this._y = 0, void 0 !== t && (void 0 !== t.x && (e = t.y, t = t.x), this.initWithPosition(t, e))
  838. },
  839. initWithPosition: function(t, e) {
  840. return this._x = t, this._y = e, !0
  841. },
  842. update: function(t) {
  843. this.target.setPosition(this._x, this._y)
  844. },
  845. clone: function() {
  846. var t = new cc.Place;
  847. return t.initWithPosition(this._x, this._y), t
  848. }
  849. }), cc.place = function(t, e) {
  850. return new cc.Place(t, e)
  851. }, cc.CallFunc = cc.Class({
  852. name: "cc.CallFunc",
  853. extends: cc.ActionInstant,
  854. ctor: function(t, e, i) {
  855. this._selectorTarget = null, this._function = null, this._data = null, this.initWithFunction(t, e, i)
  856. },
  857. initWithFunction: function(t, e, i) {
  858. return t && (this._function = t), e && (this._selectorTarget = e), void 0 !== i && (this._data = i), !0
  859. },
  860. execute: function() {
  861. this._function && this._function.call(this._selectorTarget, this.target, this._data)
  862. },
  863. update: function(t) {
  864. this.execute()
  865. },
  866. getTargetCallback: function() {
  867. return this._selectorTarget
  868. },
  869. setTargetCallback: function(t) {
  870. t !== this._selectorTarget && (this._selectorTarget && (this._selectorTarget = null), this._selectorTarget = t)
  871. },
  872. clone: function() {
  873. var t = new cc.CallFunc;
  874. return t.initWithFunction(this._function, this._selectorTarget, this._data), t
  875. }
  876. }), cc.callFunc = function(t, e, i) {
  877. return new cc.CallFunc(t, e, i)
  878. }
  879. }), {}],
  880. 5: [(function(t, e, i) {
  881. "use strict";
  882. function n(t, e, i, n, r) {
  883. return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n
  884. }
  885. cc.ActionInterval = cc.Class({
  886. name: "cc.ActionInterval",
  887. extends: cc.FiniteTimeAction,
  888. ctor: function(t) {
  889. this.MAX_VALUE = 2, this._elapsed = 0, this._firstTick = !1, this._easeList = null, this._speed = 1, this._timesForRepeat = 1, this._repeatForever = !1, this._repeatMethod = !1, this._speedMethod = !1, void 0 !== t && cc.ActionInterval.prototype.initWithDuration.call(this, t)
  890. },
  891. getElapsed: function() {
  892. return this._elapsed
  893. },
  894. initWithDuration: function(t) {
  895. return this._duration = 0 === t ? cc.macro.FLT_EPSILON : t, this._elapsed = 0, this._firstTick = !0, !0
  896. },
  897. isDone: function() {
  898. return this._elapsed >= this._duration
  899. },
  900. _cloneDecoration: function(t) {
  901. t._repeatForever = this._repeatForever, t._speed = this._speed, t._timesForRepeat = this._timesForRepeat, t._easeList = this._easeList, t._speedMethod = this._speedMethod, t._repeatMethod = this._repeatMethod
  902. },
  903. _reverseEaseList: function(t) {
  904. if (this._easeList) {
  905. t._easeList = [];
  906. for (var e = 0; e < this._easeList.length; e++) t._easeList.push(this._easeList[e].reverse())
  907. }
  908. },
  909. clone: function() {
  910. var t = new cc.ActionInterval(this._duration);
  911. return this._cloneDecoration(t), t
  912. },
  913. easing: function(t) {
  914. this._easeList ? this._easeList.length = 0 : this._easeList = [];
  915. for (var e = 0; e < arguments.length; e++) this._easeList.push(arguments[e]);
  916. return this
  917. },
  918. _computeEaseTime: function(t) {
  919. var e = this._easeList;
  920. if (!e || 0 === e.length) return t;
  921. for (var i = 0, n = e.length; i < n; i++) t = e[i].easing(t);
  922. return t
  923. },
  924. step: function(t) {
  925. this._firstTick ? (this._firstTick = !1, this._elapsed = 0) : this._elapsed += t;
  926. var e = this._elapsed / (this._duration > 1.192092896e-7 ? this._duration : 1.192092896e-7);
  927. e = 1 > e ? e : 1, this.update(e > 0 ? e : 0), this._repeatMethod && this._timesForRepeat > 1 && this.isDone() && (this._repeatForever || this._timesForRepeat--, this.startWithTarget(this.target), this.step(this._elapsed - this._duration))
  928. },
  929. startWithTarget: function(t) {
  930. cc.Action.prototype.startWithTarget.call(this, t), this._elapsed = 0, this._firstTick = !0
  931. },
  932. reverse: function() {
  933. return cc.logID(1010), null
  934. },
  935. setAmplitudeRate: function(t) {
  936. cc.logID(1011)
  937. },
  938. getAmplitudeRate: function() {
  939. return cc.logID(1012), 0
  940. },
  941. speed: function(t) {
  942. return t <= 0 ? (cc.logID(1013), this) : (this._speedMethod = !0, this._speed *= t, this)
  943. },
  944. getSpeed: function() {
  945. return this._speed
  946. },
  947. setSpeed: function(t) {
  948. return this._speed = t, this
  949. },
  950. repeat: function(t) {
  951. return t = Math.round(t), isNaN(t) || t < 1 ? (cc.logID(1014), this) : (this._repeatMethod = !0, this._timesForRepeat *= t, this)
  952. },
  953. repeatForever: function() {
  954. return this._repeatMethod = !0, this._timesForRepeat = this.MAX_VALUE, this._repeatForever = !0, this
  955. }
  956. }), cc.actionInterval = function(t) {
  957. return new cc.ActionInterval(t)
  958. }, cc.Sequence = cc.Class({
  959. name: "cc.Sequence",
  960. extends: cc.ActionInterval,
  961. ctor: function(t) {
  962. this._actions = [], this._split = null, this._last = 0, this._reversed = !1;
  963. var e = t instanceof Array ? t : arguments;
  964. if (1 !== e.length) {
  965. var i = e.length - 1;
  966. if (i >= 0 && null == e[i] && cc.logID(1015), i >= 0) {
  967. for (var n, r = e[0], s = 1; s < i; s++) e[s] && (n = r, r = cc.Sequence._actionOneTwo(n, e[s]));
  968. this.initWithTwoActions(r, e[i])
  969. }
  970. } else cc.errorID(1019)
  971. },
  972. initWithTwoActions: function(t, e) {
  973. if (!t || !e) return cc.errorID(1025), !1;
  974. var i = t._duration,
  975. n = e._duration,
  976. r = (i *= t._repeatMethod ? t._timesForRepeat : 1) + (n *= e._repeatMethod ? e._timesForRepeat : 1);
  977. return this.initWithDuration(r), this._actions[0] = t, this._actions[1] = e, !0
  978. },
  979. clone: function() {
  980. var t = new cc.Sequence;
  981. return this._cloneDecoration(t), t.initWithTwoActions(this._actions[0].clone(), this._actions[1].clone()), t
  982. },
  983. startWithTarget: function(t) {
  984. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._split = this._actions[0]._duration / this._duration, this._split *= this._actions[0]._repeatMethod ? this._actions[0]._timesForRepeat : 1, this._last = -1
  985. },
  986. stop: function() {
  987. -1 !== this._last && this._actions[this._last].stop(), cc.Action.prototype.stop.call(this)
  988. },
  989. update: function(t) {
  990. var e, i, n = 0,
  991. r = this._split,
  992. s = this._actions,
  993. o = this._last;
  994. (t = this._computeEaseTime(t)) < r ? (e = 0 !== r ? t / r : 1, 0 === n && 1 === o && this._reversed && (s[1].update(0), s[1].stop())) : (n = 1, e = 1 === r ? 1 : (t - r) / (1 - r), -1 === o && (s[0].startWithTarget(this.target), s[0].update(1), s[0].stop()), 0 === o && (s[0].update(1), s[0].stop())), i = s[n], o === n && i.isDone() || (o !== n && i.startWithTarget(this.target), e *= i._timesForRepeat, i.update(e > 1 ? e % 1 : e), this._last = n)
  995. },
  996. reverse: function() {
  997. var t = cc.Sequence._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse());
  998. return this._cloneDecoration(t), this._reverseEaseList(t), t._reversed = !0, t
  999. }
  1000. }), cc.sequence = function(t) {
  1001. var e = t instanceof Array ? t : arguments;
  1002. if (1 === e.length) return cc.errorID(1019), null;
  1003. var i = e.length - 1;
  1004. i >= 0 && null == e[i] && cc.logID(1015);
  1005. var n = null;
  1006. if (i >= 0) {
  1007. n = e[0];
  1008. for (var r = 1; r <= i; r++) e[r] && (n = cc.Sequence._actionOneTwo(n, e[r]))
  1009. }
  1010. return n
  1011. }, cc.Sequence._actionOneTwo = function(t, e) {
  1012. var i = new cc.Sequence;
  1013. return i.initWithTwoActions(t, e), i
  1014. }, cc.Repeat = cc.Class({
  1015. name: "cc.Repeat",
  1016. extends: cc.ActionInterval,
  1017. ctor: function(t, e) {
  1018. this._times = 0, this._total = 0, this._nextDt = 0, this._actionInstant = !1, this._innerAction = null, void 0 !== e && this.initWithAction(t, e)
  1019. },
  1020. initWithAction: function(t, e) {
  1021. var i = t._duration * e;
  1022. return !!this.initWithDuration(i) && (this._times = e, this._innerAction = t, t instanceof cc.ActionInstant && (this._actionInstant = !0, this._times -= 1), this._total = 0, !0)
  1023. },
  1024. clone: function() {
  1025. var t = new cc.Repeat;
  1026. return this._cloneDecoration(t), t.initWithAction(this._innerAction.clone(), this._times), t
  1027. },
  1028. startWithTarget: function(t) {
  1029. this._total = 0, this._nextDt = this._innerAction._duration / this._duration, cc.ActionInterval.prototype.startWithTarget.call(this, t), this._innerAction.startWithTarget(t)
  1030. },
  1031. stop: function() {
  1032. this._innerAction.stop(), cc.Action.prototype.stop.call(this)
  1033. },
  1034. update: function(t) {
  1035. t = this._computeEaseTime(t);
  1036. var e = this._innerAction,
  1037. i = this._duration,
  1038. n = this._times,
  1039. r = this._nextDt;
  1040. if (t >= r) {
  1041. for (; t > r && this._total < n;) e.update(1), this._total++, e.stop(), e.startWithTarget(this.target), r += e._duration / i, this._nextDt = r > 1 ? 1 : r;
  1042. t >= 1 && this._total < n && (e.update(1), this._total++), this._actionInstant || (this._total === n ? e.stop() : e.update(t - (r - e._duration / i)))
  1043. } else e.update(t * n % 1)
  1044. },
  1045. isDone: function() {
  1046. return this._total === this._times
  1047. },
  1048. reverse: function() {
  1049. var t = new cc.Repeat(this._innerAction.reverse(), this._times);
  1050. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1051. },
  1052. setInnerAction: function(t) {
  1053. this._innerAction !== t && (this._innerAction = t)
  1054. },
  1055. getInnerAction: function() {
  1056. return this._innerAction
  1057. }
  1058. }), cc.repeat = function(t, e) {
  1059. return new cc.Repeat(t, e)
  1060. }, cc.RepeatForever = cc.Class({
  1061. name: "cc.RepeatForever",
  1062. extends: cc.ActionInterval,
  1063. ctor: function(t) {
  1064. this._innerAction = null, t && this.initWithAction(t)
  1065. },
  1066. initWithAction: function(t) {
  1067. return t ? (this._innerAction = t, !0) : (cc.errorID(1026), !1)
  1068. },
  1069. clone: function() {
  1070. var t = new cc.RepeatForever;
  1071. return this._cloneDecoration(t), t.initWithAction(this._innerAction.clone()), t
  1072. },
  1073. startWithTarget: function(t) {
  1074. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._innerAction.startWithTarget(t)
  1075. },
  1076. step: function(t) {
  1077. var e = this._innerAction;
  1078. e.step(t), e.isDone() && (e.startWithTarget(this.target), e.step(e.getElapsed() - e._duration))
  1079. },
  1080. isDone: function() {
  1081. return !1
  1082. },
  1083. reverse: function() {
  1084. var t = new cc.RepeatForever(this._innerAction.reverse());
  1085. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1086. },
  1087. setInnerAction: function(t) {
  1088. this._innerAction !== t && (this._innerAction = t)
  1089. },
  1090. getInnerAction: function() {
  1091. return this._innerAction
  1092. }
  1093. }), cc.repeatForever = function(t) {
  1094. return new cc.RepeatForever(t)
  1095. }, cc.Spawn = cc.Class({
  1096. name: "cc.Spawn",
  1097. extends: cc.ActionInterval,
  1098. ctor: function(t) {
  1099. this._one = null, this._two = null;
  1100. var e = t instanceof Array ? t : arguments;
  1101. if (1 !== e.length) {
  1102. var i = e.length - 1;
  1103. if (i >= 0 && null == e[i] && cc.logID(1015), i >= 0) {
  1104. for (var n, r = e[0], s = 1; s < i; s++) e[s] && (n = r, r = cc.Spawn._actionOneTwo(n, e[s]));
  1105. this.initWithTwoActions(r, e[i])
  1106. }
  1107. } else cc.errorID(1020)
  1108. },
  1109. initWithTwoActions: function(t, e) {
  1110. if (!t || !e) return cc.errorID(1027), !1;
  1111. var i = !1,
  1112. n = t._duration,
  1113. r = e._duration;
  1114. return this.initWithDuration(Math.max(n, r)) && (this._one = t, this._two = e, n > r ? this._two = cc.Sequence._actionOneTwo(e, cc.delayTime(n - r)) : n < r && (this._one = cc.Sequence._actionOneTwo(t, cc.delayTime(r - n))), i = !0), i
  1115. },
  1116. clone: function() {
  1117. var t = new cc.Spawn;
  1118. return this._cloneDecoration(t), t.initWithTwoActions(this._one.clone(), this._two.clone()), t
  1119. },
  1120. startWithTarget: function(t) {
  1121. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._one.startWithTarget(t), this._two.startWithTarget(t)
  1122. },
  1123. stop: function() {
  1124. this._one.stop(), this._two.stop(), cc.Action.prototype.stop.call(this)
  1125. },
  1126. update: function(t) {
  1127. t = this._computeEaseTime(t), this._one && this._one.update(t), this._two && this._two.update(t)
  1128. },
  1129. reverse: function() {
  1130. var t = cc.Spawn._actionOneTwo(this._one.reverse(), this._two.reverse());
  1131. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1132. }
  1133. }), cc.spawn = function(t) {
  1134. var e = t instanceof Array ? t : arguments;
  1135. if (1 === e.length) return cc.errorID(1020), null;
  1136. e.length > 0 && null == e[e.length - 1] && cc.logID(1015);
  1137. for (var i = e[0], n = 1; n < e.length; n++) null != e[n] && (i = cc.Spawn._actionOneTwo(i, e[n]));
  1138. return i
  1139. }, cc.Spawn._actionOneTwo = function(t, e) {
  1140. var i = new cc.Spawn;
  1141. return i.initWithTwoActions(t, e), i
  1142. }, cc.RotateTo = cc.Class({
  1143. name: "cc.RotateTo",
  1144. extends: cc.ActionInterval,
  1145. ctor: function(t, e) {
  1146. this._startAngle = 0, this._dstAngle = 0, this._angle = 0, void 0 !== e && this.initWithDuration(t, e)
  1147. },
  1148. initWithDuration: function(t, e) {
  1149. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._dstAngle = e, !0)
  1150. },
  1151. clone: function() {
  1152. var t = new cc.RotateTo;
  1153. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._dstAngle), t
  1154. },
  1155. startWithTarget: function(t) {
  1156. cc.ActionInterval.prototype.startWithTarget.call(this, t);
  1157. var e = t.angle % 360,
  1158. i = cc.macro.ROTATE_ACTION_CCW ? this._dstAngle - e : e - this._dstAngle;
  1159. i > 180 && (i -= 360), i < -180 && (i += 360), this._startAngle = e, this._angle = cc.macro.ROTATE_ACTION_CCW ? i : -i
  1160. },
  1161. reverse: function() {
  1162. cc.logID(1016)
  1163. },
  1164. update: function(t) {
  1165. t = this._computeEaseTime(t), this.target && (this.target.angle = this._startAngle + this._angle * t)
  1166. }
  1167. }), cc.rotateTo = function(t, e) {
  1168. return new cc.RotateTo(t, e)
  1169. }, cc.RotateBy = cc.Class({
  1170. name: "cc.RotateBy",
  1171. extends: cc.ActionInterval,
  1172. ctor: function(t, e) {
  1173. e *= cc.macro.ROTATE_ACTION_CCW ? 1 : -1, this._deltaAngle = 0, this._startAngle = 0, void 0 !== e && this.initWithDuration(t, e)
  1174. },
  1175. initWithDuration: function(t, e) {
  1176. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._deltaAngle = e, !0)
  1177. },
  1178. clone: function() {
  1179. var t = new cc.RotateBy;
  1180. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._deltaAngle), t
  1181. },
  1182. startWithTarget: function(t) {
  1183. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startAngle = t.angle
  1184. },
  1185. update: function(t) {
  1186. t = this._computeEaseTime(t), this.target && (this.target.angle = this._startAngle + this._deltaAngle * t)
  1187. },
  1188. reverse: function() {
  1189. var t = new cc.RotateBy;
  1190. return t.initWithDuration(this._duration, -this._deltaAngle), this._cloneDecoration(t), this._reverseEaseList(t), t
  1191. }
  1192. }), cc.rotateBy = function(t, e) {
  1193. return new cc.RotateBy(t, e)
  1194. }, cc.MoveBy = cc.Class({
  1195. name: "cc.MoveBy",
  1196. extends: cc.ActionInterval,
  1197. ctor: function(t, e, i) {
  1198. this._positionDelta = cc.v2(0, 0), this._startPosition = cc.v2(0, 0), this._previousPosition = cc.v2(0, 0), void 0 !== e && cc.MoveBy.prototype.initWithDuration.call(this, t, e, i)
  1199. },
  1200. initWithDuration: function(t, e, i) {
  1201. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (void 0 !== e.x && (i = e.y, e = e.x), this._positionDelta.x = e, this._positionDelta.y = i, !0)
  1202. },
  1203. clone: function() {
  1204. var t = new cc.MoveBy;
  1205. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._positionDelta), t
  1206. },
  1207. startWithTarget: function(t) {
  1208. cc.ActionInterval.prototype.startWithTarget.call(this, t);
  1209. var e = t.x,
  1210. i = t.y;
  1211. this._previousPosition.x = e, this._previousPosition.y = i, this._startPosition.x = e, this._startPosition.y = i
  1212. },
  1213. update: function(t) {
  1214. if (t = this._computeEaseTime(t), this.target) {
  1215. var e = this._positionDelta.x * t,
  1216. i = this._positionDelta.y * t,
  1217. n = this._startPosition;
  1218. if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
  1219. var r = this.target.x,
  1220. s = this.target.y,
  1221. o = this._previousPosition;
  1222. n.x = n.x + r - o.x, n.y = n.y + s - o.y, e += n.x, i += n.y, o.x = e, o.y = i, this.target.setPosition(e, i)
  1223. } else this.target.setPosition(n.x + e, n.y + i)
  1224. }
  1225. },
  1226. reverse: function() {
  1227. var t = new cc.MoveBy(this._duration, cc.v2(-this._positionDelta.x, -this._positionDelta.y));
  1228. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1229. }
  1230. }), cc.moveBy = function(t, e, i) {
  1231. return new cc.MoveBy(t, e, i)
  1232. }, cc.MoveTo = cc.Class({
  1233. name: "cc.MoveTo",
  1234. extends: cc.MoveBy,
  1235. ctor: function(t, e, i) {
  1236. this._endPosition = cc.v2(0, 0), void 0 !== e && this.initWithDuration(t, e, i)
  1237. },
  1238. initWithDuration: function(t, e, i) {
  1239. return !!cc.MoveBy.prototype.initWithDuration.call(this, t, e, i) && (void 0 !== e.x && (i = e.y, e = e.x), this._endPosition.x = e, this._endPosition.y = i, !0)
  1240. },
  1241. clone: function() {
  1242. var t = new cc.MoveTo;
  1243. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endPosition), t
  1244. },
  1245. startWithTarget: function(t) {
  1246. cc.MoveBy.prototype.startWithTarget.call(this, t), this._positionDelta.x = this._endPosition.x - t.x, this._positionDelta.y = this._endPosition.y - t.y
  1247. }
  1248. }), cc.moveTo = function(t, e, i) {
  1249. return new cc.MoveTo(t, e, i)
  1250. }, cc.SkewTo = cc.Class({
  1251. name: "cc.SkewTo",
  1252. extends: cc.ActionInterval,
  1253. ctor: function(t, e, i) {
  1254. this._skewX = 0, this._skewY = 0, this._startSkewX = 0, this._startSkewY = 0, this._endSkewX = 0, this._endSkewY = 0, this._deltaX = 0, this._deltaY = 0, void 0 !== i && cc.SkewTo.prototype.initWithDuration.call(this, t, e, i)
  1255. },
  1256. initWithDuration: function(t, e, i) {
  1257. var n = !1;
  1258. return cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._endSkewX = e, this._endSkewY = i, n = !0), n
  1259. },
  1260. clone: function() {
  1261. var t = new cc.SkewTo;
  1262. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endSkewX, this._endSkewY), t
  1263. },
  1264. startWithTarget: function(t) {
  1265. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startSkewX = t.skewX % 180, this._deltaX = this._endSkewX - this._startSkewX, this._deltaX > 180 && (this._deltaX -= 360), this._deltaX < -180 && (this._deltaX += 360), this._startSkewY = t.skewY % 360, this._deltaY = this._endSkewY - this._startSkewY, this._deltaY > 180 && (this._deltaY -= 360), this._deltaY < -180 && (this._deltaY += 360)
  1266. },
  1267. update: function(t) {
  1268. t = this._computeEaseTime(t), this.target.skewX = this._startSkewX + this._deltaX * t, this.target.skewY = this._startSkewY + this._deltaY * t
  1269. }
  1270. }), cc.skewTo = function(t, e, i) {
  1271. return new cc.SkewTo(t, e, i)
  1272. }, cc.SkewBy = cc.Class({
  1273. name: "cc.SkewBy",
  1274. extends: cc.SkewTo,
  1275. ctor: function(t, e, i) {
  1276. void 0 !== i && this.initWithDuration(t, e, i)
  1277. },
  1278. initWithDuration: function(t, e, i) {
  1279. var n = !1;
  1280. return cc.SkewTo.prototype.initWithDuration.call(this, t, e, i) && (this._skewX = e, this._skewY = i, n = !0), n
  1281. },
  1282. clone: function() {
  1283. var t = new cc.SkewBy;
  1284. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._skewX, this._skewY), t
  1285. },
  1286. startWithTarget: function(t) {
  1287. cc.SkewTo.prototype.startWithTarget.call(this, t), this._deltaX = this._skewX, this._deltaY = this._skewY, this._endSkewX = this._startSkewX + this._deltaX, this._endSkewY = this._startSkewY + this._deltaY
  1288. },
  1289. reverse: function() {
  1290. var t = new cc.SkewBy(this._duration, -this._skewX, -this._skewY);
  1291. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1292. }
  1293. }), cc.skewBy = function(t, e, i) {
  1294. return new cc.SkewBy(t, e, i)
  1295. }, cc.JumpBy = cc.Class({
  1296. name: "cc.JumpBy",
  1297. extends: cc.ActionInterval,
  1298. ctor: function(t, e, i, n, r) {
  1299. this._startPosition = cc.v2(0, 0), this._previousPosition = cc.v2(0, 0), this._delta = cc.v2(0, 0), this._height = 0, this._jumps = 0, void 0 !== n && cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r)
  1300. },
  1301. initWithDuration: function(t, e, i, n, r) {
  1302. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (void 0 === r && (r = n, n = i, i = e.y, e = e.x), this._delta.x = e, this._delta.y = i, this._height = n, this._jumps = r, !0)
  1303. },
  1304. clone: function() {
  1305. var t = new cc.JumpBy;
  1306. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._delta, this._height, this._jumps), t
  1307. },
  1308. startWithTarget: function(t) {
  1309. cc.ActionInterval.prototype.startWithTarget.call(this, t);
  1310. var e = t.x,
  1311. i = t.y;
  1312. this._previousPosition.x = e, this._previousPosition.y = i, this._startPosition.x = e, this._startPosition.y = i
  1313. },
  1314. update: function(t) {
  1315. if (t = this._computeEaseTime(t), this.target) {
  1316. var e = t * this._jumps % 1,
  1317. i = 4 * this._height * e * (1 - e);
  1318. i += this._delta.y * t;
  1319. var n = this._delta.x * t,
  1320. r = this._startPosition;
  1321. if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
  1322. var s = this.target.x,
  1323. o = this.target.y,
  1324. a = this._previousPosition;
  1325. r.x = r.x + s - a.x, r.y = r.y + o - a.y, n += r.x, i += r.y, a.x = n, a.y = i, this.target.setPosition(n, i)
  1326. } else this.target.setPosition(r.x + n, r.y + i)
  1327. }
  1328. },
  1329. reverse: function() {
  1330. var t = new cc.JumpBy(this._duration, cc.v2(-this._delta.x, -this._delta.y), this._height, this._jumps);
  1331. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1332. }
  1333. }), cc.jumpBy = function(t, e, i, n, r) {
  1334. return new cc.JumpBy(t, e, i, n, r)
  1335. }, cc.JumpTo = cc.Class({
  1336. name: "cc.JumpTo",
  1337. extends: cc.JumpBy,
  1338. ctor: function(t, e, i, n, r) {
  1339. this._endPosition = cc.v2(0, 0), void 0 !== n && this.initWithDuration(t, e, i, n, r)
  1340. },
  1341. initWithDuration: function(t, e, i, n, r) {
  1342. return !!cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r) && (void 0 === r && (i = e.y, e = e.x), this._endPosition.x = e, this._endPosition.y = i, !0)
  1343. },
  1344. startWithTarget: function(t) {
  1345. cc.JumpBy.prototype.startWithTarget.call(this, t), this._delta.x = this._endPosition.x - this._startPosition.x, this._delta.y = this._endPosition.y - this._startPosition.y
  1346. },
  1347. clone: function() {
  1348. var t = new cc.JumpTo;
  1349. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endPosition, this._height, this._jumps), t
  1350. }
  1351. }), cc.jumpTo = function(t, e, i, n, r) {
  1352. return new cc.JumpTo(t, e, i, n, r)
  1353. }, cc.BezierBy = cc.Class({
  1354. name: "cc.BezierBy",
  1355. extends: cc.ActionInterval,
  1356. ctor: function(t, e) {
  1357. this._config = [], this._startPosition = cc.v2(0, 0), this._previousPosition = cc.v2(0, 0), e && cc.BezierBy.prototype.initWithDuration.call(this, t, e)
  1358. },
  1359. initWithDuration: function(t, e) {
  1360. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._config = e, !0)
  1361. },
  1362. clone: function() {
  1363. var t = new cc.BezierBy;
  1364. this._cloneDecoration(t);
  1365. for (var e = [], i = 0; i < this._config.length; i++) {
  1366. var n = this._config[i];
  1367. e.push(cc.v2(n.x, n.y))
  1368. }
  1369. return t.initWithDuration(this._duration, e), t
  1370. },
  1371. startWithTarget: function(t) {
  1372. cc.ActionInterval.prototype.startWithTarget.call(this, t);
  1373. var e = t.x,
  1374. i = t.y;
  1375. this._previousPosition.x = e, this._previousPosition.y = i, this._startPosition.x = e, this._startPosition.y = i
  1376. },
  1377. update: function(t) {
  1378. if (t = this._computeEaseTime(t), this.target) {
  1379. var e = this._config,
  1380. i = e[0].x,
  1381. r = e[1].x,
  1382. s = e[2].x,
  1383. o = e[0].y,
  1384. a = e[1].y,
  1385. l = e[2].y,
  1386. h = n(0, i, r, s, t),
  1387. c = n(0, o, a, l, t),
  1388. u = this._startPosition;
  1389. if (cc.macro.ENABLE_STACKABLE_ACTIONS) {
  1390. var _ = this.target.x,
  1391. f = this.target.y,
  1392. d = this._previousPosition;
  1393. u.x = u.x + _ - d.x, u.y = u.y + f - d.y, h += u.x, c += u.y, d.x = h, d.y = c, this.target.setPosition(h, c)
  1394. } else this.target.setPosition(u.x + h, u.y + c)
  1395. }
  1396. },
  1397. reverse: function() {
  1398. var t = this._config,
  1399. e = t[0].x,
  1400. i = t[0].y,
  1401. n = t[1].x,
  1402. r = t[1].y,
  1403. s = t[2].x,
  1404. o = t[2].y,
  1405. a = [cc.v2(n - s, r - o), cc.v2(e - s, i - o), cc.v2(-s, -o)],
  1406. l = new cc.BezierBy(this._duration, a);
  1407. return this._cloneDecoration(l), this._reverseEaseList(l), l
  1408. }
  1409. }), cc.bezierBy = function(t, e) {
  1410. return new cc.BezierBy(t, e)
  1411. }, cc.BezierTo = cc.Class({
  1412. name: "cc.BezierTo",
  1413. extends: cc.BezierBy,
  1414. ctor: function(t, e) {
  1415. this._toConfig = [], e && this.initWithDuration(t, e)
  1416. },
  1417. initWithDuration: function(t, e) {
  1418. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._toConfig = e, !0)
  1419. },
  1420. clone: function() {
  1421. var t = new cc.BezierTo;
  1422. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toConfig), t
  1423. },
  1424. startWithTarget: function(t) {
  1425. cc.BezierBy.prototype.startWithTarget.call(this, t);
  1426. var e = this._startPosition,
  1427. i = this._toConfig,
  1428. n = this._config;
  1429. n[0] = i[0].sub(e), n[1] = i[1].sub(e), n[2] = i[2].sub(e)
  1430. }
  1431. }), cc.bezierTo = function(t, e) {
  1432. return new cc.BezierTo(t, e)
  1433. }, cc.ScaleTo = cc.Class({
  1434. name: "cc.ScaleTo",
  1435. extends: cc.ActionInterval,
  1436. ctor: function(t, e, i) {
  1437. this._scaleX = 1, this._scaleY = 1, this._startScaleX = 1, this._startScaleY = 1, this._endScaleX = 0, this._endScaleY = 0, this._deltaX = 0, this._deltaY = 0, void 0 !== e && cc.ScaleTo.prototype.initWithDuration.call(this, t, e, i)
  1438. },
  1439. initWithDuration: function(t, e, i) {
  1440. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._endScaleX = e, this._endScaleY = null != i ? i : e, !0)
  1441. },
  1442. clone: function() {
  1443. var t = new cc.ScaleTo;
  1444. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endScaleX, this._endScaleY), t
  1445. },
  1446. startWithTarget: function(t) {
  1447. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startScaleX = t.scaleX, this._startScaleY = t.scaleY, this._deltaX = this._endScaleX - this._startScaleX, this._deltaY = this._endScaleY - this._startScaleY
  1448. },
  1449. update: function(t) {
  1450. t = this._computeEaseTime(t), this.target && (this.target.scaleX = this._startScaleX + this._deltaX * t, this.target.scaleY = this._startScaleY + this._deltaY * t)
  1451. }
  1452. }), cc.scaleTo = function(t, e, i) {
  1453. return new cc.ScaleTo(t, e, i)
  1454. }, cc.ScaleBy = cc.Class({
  1455. name: "cc.ScaleBy",
  1456. extends: cc.ScaleTo,
  1457. startWithTarget: function(t) {
  1458. cc.ScaleTo.prototype.startWithTarget.call(this, t), this._deltaX = this._startScaleX * this._endScaleX - this._startScaleX, this._deltaY = this._startScaleY * this._endScaleY - this._startScaleY
  1459. },
  1460. reverse: function() {
  1461. var t = new cc.ScaleBy(this._duration, 1 / this._endScaleX, 1 / this._endScaleY);
  1462. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1463. },
  1464. clone: function() {
  1465. var t = new cc.ScaleBy;
  1466. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._endScaleX, this._endScaleY), t
  1467. }
  1468. }), cc.scaleBy = function(t, e, i) {
  1469. return new cc.ScaleBy(t, e, i)
  1470. }, cc.Blink = cc.Class({
  1471. name: "cc.Blink",
  1472. extends: cc.ActionInterval,
  1473. ctor: function(t, e) {
  1474. this._times = 0, this._originalState = !1, void 0 !== e && this.initWithDuration(t, e)
  1475. },
  1476. initWithDuration: function(t, e) {
  1477. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._times = e, !0)
  1478. },
  1479. clone: function() {
  1480. var t = new cc.Blink;
  1481. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._times), t
  1482. },
  1483. update: function(t) {
  1484. if (t = this._computeEaseTime(t), this.target && !this.isDone()) {
  1485. var e = 1 / this._times,
  1486. i = t % e;
  1487. this.target.opacity = i > e / 2 ? 255 : 0
  1488. }
  1489. },
  1490. startWithTarget: function(t) {
  1491. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._originalState = t.opacity
  1492. },
  1493. stop: function() {
  1494. this.target.opacity = this._originalState, cc.ActionInterval.prototype.stop.call(this)
  1495. },
  1496. reverse: function() {
  1497. var t = new cc.Blink(this._duration, this._times);
  1498. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1499. }
  1500. }), cc.blink = function(t, e) {
  1501. return new cc.Blink(t, e)
  1502. }, cc.FadeTo = cc.Class({
  1503. name: "cc.FadeTo",
  1504. extends: cc.ActionInterval,
  1505. ctor: function(t, e) {
  1506. this._toOpacity = 0, this._fromOpacity = 0, void 0 !== e && cc.FadeTo.prototype.initWithDuration.call(this, t, e)
  1507. },
  1508. initWithDuration: function(t, e) {
  1509. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._toOpacity = e, !0)
  1510. },
  1511. clone: function() {
  1512. var t = new cc.FadeTo;
  1513. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toOpacity), t
  1514. },
  1515. update: function(t) {
  1516. t = this._computeEaseTime(t);
  1517. var e = void 0 !== this._fromOpacity ? this._fromOpacity : 255;
  1518. this.target.opacity = e + (this._toOpacity - e) * t
  1519. },
  1520. startWithTarget: function(t) {
  1521. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._fromOpacity = t.opacity
  1522. }
  1523. }), cc.fadeTo = function(t, e) {
  1524. return new cc.FadeTo(t, e)
  1525. }, cc.FadeIn = cc.Class({
  1526. name: "cc.FadeIn",
  1527. extends: cc.FadeTo,
  1528. ctor: function(t) {
  1529. null == t && (t = 0), this._reverseAction = null, this.initWithDuration(t, 255)
  1530. },
  1531. reverse: function() {
  1532. var t = new cc.FadeOut;
  1533. return t.initWithDuration(this._duration, 0), this._cloneDecoration(t), this._reverseEaseList(t), t
  1534. },
  1535. clone: function() {
  1536. var t = new cc.FadeIn;
  1537. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toOpacity), t
  1538. },
  1539. startWithTarget: function(t) {
  1540. this._reverseAction && (this._toOpacity = this._reverseAction._fromOpacity), cc.FadeTo.prototype.startWithTarget.call(this, t)
  1541. }
  1542. }), cc.fadeIn = function(t) {
  1543. return new cc.FadeIn(t)
  1544. }, cc.FadeOut = cc.Class({
  1545. name: "cc.FadeOut",
  1546. extends: cc.FadeTo,
  1547. ctor: function(t) {
  1548. null == t && (t = 0), this._reverseAction = null, this.initWithDuration(t, 0)
  1549. },
  1550. reverse: function() {
  1551. var t = new cc.FadeIn;
  1552. return t._reverseAction = this, t.initWithDuration(this._duration, 255), this._cloneDecoration(t), this._reverseEaseList(t), t
  1553. },
  1554. clone: function() {
  1555. var t = new cc.FadeOut;
  1556. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._toOpacity), t
  1557. }
  1558. }), cc.fadeOut = function(t) {
  1559. return new cc.FadeOut(t)
  1560. }, cc.TintTo = cc.Class({
  1561. name: "cc.TintTo",
  1562. extends: cc.ActionInterval,
  1563. ctor: function(t, e, i, n) {
  1564. this._to = cc.color(0, 0, 0), this._from = cc.color(0, 0, 0), e instanceof cc.Color && (n = e.b, i = e.g, e = e.r), void 0 !== n && this.initWithDuration(t, e, i, n)
  1565. },
  1566. initWithDuration: function(t, e, i, n) {
  1567. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._to = cc.color(e, i, n), !0)
  1568. },
  1569. clone: function() {
  1570. var t = new cc.TintTo;
  1571. this._cloneDecoration(t);
  1572. var e = this._to;
  1573. return t.initWithDuration(this._duration, e.r, e.g, e.b), t
  1574. },
  1575. startWithTarget: function(t) {
  1576. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._from = this.target.color
  1577. },
  1578. update: function(t) {
  1579. t = this._computeEaseTime(t);
  1580. var e = this._from,
  1581. i = this._to;
  1582. e && (this.target.color = cc.color(e.r + (i.r - e.r) * t, e.g + (i.g - e.g) * t, e.b + (i.b - e.b) * t))
  1583. }
  1584. }), cc.tintTo = function(t, e, i, n) {
  1585. return new cc.TintTo(t, e, i, n)
  1586. }, cc.TintBy = cc.Class({
  1587. name: "cc.TintBy",
  1588. extends: cc.ActionInterval,
  1589. ctor: function(t, e, i, n) {
  1590. this._deltaR = 0, this._deltaG = 0, this._deltaB = 0, this._fromR = 0, this._fromG = 0, this._fromB = 0, void 0 !== n && this.initWithDuration(t, e, i, n)
  1591. },
  1592. initWithDuration: function(t, e, i, n) {
  1593. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._deltaR = e, this._deltaG = i, this._deltaB = n, !0)
  1594. },
  1595. clone: function() {
  1596. var t = new cc.TintBy;
  1597. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._deltaR, this._deltaG, this._deltaB), t
  1598. },
  1599. startWithTarget: function(t) {
  1600. cc.ActionInterval.prototype.startWithTarget.call(this, t);
  1601. var e = t.color;
  1602. this._fromR = e.r, this._fromG = e.g, this._fromB = e.b
  1603. },
  1604. update: function(t) {
  1605. t = this._computeEaseTime(t), this.target.color = cc.color(this._fromR + this._deltaR * t, this._fromG + this._deltaG * t, this._fromB + this._deltaB * t)
  1606. },
  1607. reverse: function() {
  1608. var t = new cc.TintBy(this._duration, -this._deltaR, -this._deltaG, -this._deltaB);
  1609. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1610. }
  1611. }), cc.tintBy = function(t, e, i, n) {
  1612. return new cc.TintBy(t, e, i, n)
  1613. }, cc.DelayTime = cc.Class({
  1614. name: "cc.DelayTime",
  1615. extends: cc.ActionInterval,
  1616. update: function(t) {},
  1617. reverse: function() {
  1618. var t = new cc.DelayTime(this._duration);
  1619. return this._cloneDecoration(t), this._reverseEaseList(t), t
  1620. },
  1621. clone: function() {
  1622. var t = new cc.DelayTime;
  1623. return this._cloneDecoration(t), t.initWithDuration(this._duration), t
  1624. }
  1625. }), cc.delayTime = function(t) {
  1626. return new cc.DelayTime(t)
  1627. }, cc.ReverseTime = cc.Class({
  1628. name: "cc.ReverseTime",
  1629. extends: cc.ActionInterval,
  1630. ctor: function(t) {
  1631. this._other = null, t && this.initWithAction(t)
  1632. },
  1633. initWithAction: function(t) {
  1634. return t ? t === this._other ? (cc.errorID(1029), !1) : !!cc.ActionInterval.prototype.initWithDuration.call(this, t._duration) && (this._other = t, !0) : (cc.errorID(1028), !1)
  1635. },
  1636. clone: function() {
  1637. var t = new cc.ReverseTime;
  1638. return this._cloneDecoration(t), t.initWithAction(this._other.clone()), t
  1639. },
  1640. startWithTarget: function(t) {
  1641. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._other.startWithTarget(t)
  1642. },
  1643. update: function(t) {
  1644. t = this._computeEaseTime(t), this._other && this._other.update(1 - t)
  1645. },
  1646. reverse: function() {
  1647. return this._other.clone()
  1648. },
  1649. stop: function() {
  1650. this._other.stop(), cc.Action.prototype.stop.call(this)
  1651. }
  1652. }), cc.reverseTime = function(t) {
  1653. return new cc.ReverseTime(t)
  1654. }, cc.TargetedAction = cc.Class({
  1655. name: "cc.TargetedAction",
  1656. extends: cc.ActionInterval,
  1657. ctor: function(t, e) {
  1658. this._action = null, this._forcedTarget = null, e && this.initWithTarget(t, e)
  1659. },
  1660. initWithTarget: function(t, e) {
  1661. return !!this.initWithDuration(e._duration) && (this._forcedTarget = t, this._action = e, !0)
  1662. },
  1663. clone: function() {
  1664. var t = new cc.TargetedAction;
  1665. return this._cloneDecoration(t), t.initWithTarget(this._forcedTarget, this._action.clone()), t
  1666. },
  1667. startWithTarget: function(t) {
  1668. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._action.startWithTarget(this._forcedTarget)
  1669. },
  1670. stop: function() {
  1671. this._action.stop()
  1672. },
  1673. update: function(t) {
  1674. t = this._computeEaseTime(t), this._action.update(t)
  1675. },
  1676. getForcedTarget: function() {
  1677. return this._forcedTarget
  1678. },
  1679. setForcedTarget: function(t) {
  1680. this._forcedTarget !== t && (this._forcedTarget = t)
  1681. }
  1682. }), cc.targetedAction = function(t, e) {
  1683. return new cc.TargetedAction(t, e)
  1684. }
  1685. }), {}],
  1686. 6: [(function(t, e, i) {
  1687. "use strict";
  1688. t("../core/platform/CCClass");
  1689. var n = t("../core/platform/js"),
  1690. r = function() {
  1691. this.actions = [], this.target = null, this.actionIndex = 0, this.currentAction = null, this.paused = !1, this.lock = !1
  1692. };
  1693. cc.ActionManager = function() {
  1694. this._hashTargets = n.createMap(!0), this._arrayTargets = [], this._currentTarget = null, cc.director._scheduler && cc.director._scheduler.enableForTarget(this)
  1695. }, cc.ActionManager.prototype = {
  1696. constructor: cc.ActionManager,
  1697. _elementPool: [],
  1698. _searchElementByTarget: function(t, e) {
  1699. for (var i = 0; i < t.length; i++)
  1700. if (e === t[i].target) return t[i];
  1701. return null
  1702. },
  1703. _getElement: function(t, e) {
  1704. var i = this._elementPool.pop();
  1705. return i || (i = new r), i.target = t, i.paused = !!e, i
  1706. },
  1707. _putElement: function(t) {
  1708. t.actions.length = 0, t.actionIndex = 0, t.currentAction = null, t.paused = !1, t.target = null, t.lock = !1, this._elementPool.push(t)
  1709. },
  1710. addAction: function(t, e, i) {
  1711. if (t && e) {
  1712. var n = this._hashTargets[e._id];
  1713. n ? n.actions || (n.actions = []) : (n = this._getElement(e, i), this._hashTargets[e._id] = n, this._arrayTargets.push(n)), n.actions.push(t), t.startWithTarget(e)
  1714. } else cc.errorID(1e3)
  1715. },
  1716. removeAllActions: function() {
  1717. for (var t = this._arrayTargets, e = 0; e < t.length; e++) {
  1718. var i = t[e];
  1719. i && this._putElement(i)
  1720. }
  1721. this._arrayTargets.length = 0, this._hashTargets = n.createMap(!0)
  1722. },
  1723. removeAllActionsFromTarget: function(t, e) {
  1724. if (null != t) {
  1725. var i = this._hashTargets[t._id];
  1726. i && (i.actions.length = 0, this._deleteHashElement(i))
  1727. }
  1728. },
  1729. removeAction: function(t) {
  1730. if (null != t) {
  1731. var e = t.getOriginalTarget(),
  1732. i = this._hashTargets[e._id];
  1733. if (i) {
  1734. for (var n = 0; n < i.actions.length; n++)
  1735. if (i.actions[n] === t) {
  1736. i.actions.splice(n, 1), i.actionIndex >= n && i.actionIndex--;
  1737. break
  1738. }
  1739. } else cc.logID(1001)
  1740. }
  1741. },
  1742. removeActionByTag: function(t, e) {
  1743. t === cc.Action.TAG_INVALID && cc.logID(1002), cc.assertID(e, 1003);
  1744. var i = this._hashTargets[e._id];
  1745. if (i)
  1746. for (var n = i.actions.length, r = 0; r < n; ++r) {
  1747. var s = i.actions[r];
  1748. if (s && s.getTag() === t && s.getOriginalTarget() === e) {
  1749. this._removeActionAtIndex(r, i);
  1750. break
  1751. }
  1752. }
  1753. },
  1754. getActionByTag: function(t, e) {
  1755. t === cc.Action.TAG_INVALID && cc.logID(1004);
  1756. var i = this._hashTargets[e._id];
  1757. if (i) {
  1758. if (null != i.actions)
  1759. for (var n = 0; n < i.actions.length; ++n) {
  1760. var r = i.actions[n];
  1761. if (r && r.getTag() === t) return r
  1762. }
  1763. cc.logID(1005, t)
  1764. }
  1765. return null
  1766. },
  1767. getNumberOfRunningActionsInTarget: function(t) {
  1768. var e = this._hashTargets[t._id];
  1769. return e && e.actions ? e.actions.length : 0
  1770. },
  1771. pauseTarget: function(t) {
  1772. var e = this._hashTargets[t._id];
  1773. e && (e.paused = !0)
  1774. },
  1775. resumeTarget: function(t) {
  1776. var e = this._hashTargets[t._id];
  1777. e && (e.paused = !1)
  1778. },
  1779. pauseAllRunningActions: function() {
  1780. for (var t = [], e = this._arrayTargets, i = 0; i < e.length; i++) {
  1781. var n = e[i];
  1782. n && !n.paused && (n.paused = !0, t.push(n.target))
  1783. }
  1784. return t
  1785. },
  1786. resumeTargets: function(t) {
  1787. if (t)
  1788. for (var e = 0; e < t.length; e++) t[e] && this.resumeTarget(t[e])
  1789. },
  1790. pauseTargets: function(t) {
  1791. if (t)
  1792. for (var e = 0; e < t.length; e++) t[e] && this.pauseTarget(t[e])
  1793. },
  1794. purgeSharedManager: function() {
  1795. cc.director.getScheduler().unscheduleUpdate(this)
  1796. },
  1797. _removeActionAtIndex: function(t, e) {
  1798. e.actions[t];
  1799. e.actions.splice(t, 1), e.actionIndex >= t && e.actionIndex--, 0 === e.actions.length && this._deleteHashElement(e)
  1800. },
  1801. _deleteHashElement: function(t) {
  1802. var e = !1;
  1803. if (t && !t.lock && this._hashTargets[t.target._id]) {
  1804. delete this._hashTargets[t.target._id];
  1805. for (var i = this._arrayTargets, n = 0, r = i.length; n < r; n++)
  1806. if (i[n] === t) {
  1807. i.splice(n, 1);
  1808. break
  1809. }
  1810. this._putElement(t), e = !0
  1811. }
  1812. return e
  1813. },
  1814. update: function(t) {
  1815. for (var e, i = this._arrayTargets, n = 0; n < i.length; n++) {
  1816. if (this._currentTarget = i[n], !(e = this._currentTarget).paused && e.actions) {
  1817. for (e.lock = !0, e.actionIndex = 0; e.actionIndex < e.actions.length; e.actionIndex++)
  1818. if (e.currentAction = e.actions[e.actionIndex], e.currentAction) {
  1819. if (e.currentAction.step(t * (e.currentAction._speedMethod ? e.currentAction._speed : 1)), e.currentAction && e.currentAction.isDone()) {
  1820. e.currentAction.stop();
  1821. var r = e.currentAction;
  1822. e.currentAction = null, this.removeAction(r)
  1823. }
  1824. e.currentAction = null
  1825. }
  1826. e.lock = !1
  1827. }
  1828. 0 === e.actions.length && this._deleteHashElement(e) && n--
  1829. }
  1830. }
  1831. }
  1832. }), {
  1833. "../core/platform/CCClass": 198,
  1834. "../core/platform/js": 218
  1835. }],
  1836. 7: [(function(t, e, i) {
  1837. "use strict";
  1838. t("./CCActionManager"), t("./CCAction"), t("./CCActionInterval"), t("./CCActionInstant"), t("./CCActionEase"), t("./CCActionCatmullRom"), t("./tween")
  1839. }), {
  1840. "./CCAction": 1,
  1841. "./CCActionCatmullRom": 2,
  1842. "./CCActionEase": 3,
  1843. "./CCActionInstant": 4,
  1844. "./CCActionInterval": 5,
  1845. "./CCActionManager": 6,
  1846. "./tween": 8
  1847. }],
  1848. 8: [(function(t, e, i) {
  1849. "use strict";
  1850. var n = cc.Class({
  1851. name: "cc.TweenAction",
  1852. extends: cc.ActionInterval,
  1853. ctor: function(t, e, i) {
  1854. if (this._opts = i = i || Object.create(null), this._props = Object.create(null), i.progress = i.progress || this.progress, i.easing && "string" == typeof i.easing) {
  1855. var n = i.easing;
  1856. i.easing = cc.easing[n], !i.easing && cc.warnID(1031, n)
  1857. }
  1858. var r = this._opts.relative;
  1859. for (var s in e) {
  1860. var o = e[s],
  1861. a = void 0,
  1862. l = void 0;
  1863. if (void 0 !== o.value && (o.easing || o.progress) && ("string" == typeof o.easing ? !(a = cc.easing[o.easing]) && cc.warnID(1031, o.easing) : a = o.easing, l = o.progress, o = o.value), "number" == typeof o || o.lerp && (!r || o.add || o.mul) && o.clone) {
  1864. var h = Object.create(null);
  1865. h.value = o, h.easing = a, h.progress = l, this._props[s] = h
  1866. } else cc.warn("Can not animate " + s + " property, because it do not have [lerp, (add|mul), clone] function.")
  1867. }
  1868. this._originProps = e, this.initWithDuration(t)
  1869. },
  1870. clone: function() {
  1871. var t = new n(this._duration, this._originProps, this._opts);
  1872. return this._cloneDecoration(t), t
  1873. },
  1874. startWithTarget: function(t) {
  1875. cc.ActionInterval.prototype.startWithTarget.call(this, t);
  1876. var e = !!this._opts.relative,
  1877. i = this._props;
  1878. for (var n in i) {
  1879. var r = t[n],
  1880. s = i[n];
  1881. "number" == typeof r ? (s.start = r, s.current = r, s.end = e ? r + s.value : s.value) : (s.start = r.clone(), s.current = r.clone(), s.end = e ? (r.add || r.mul).call(r, s.value) : s.value)
  1882. }
  1883. },
  1884. update: function(t) {
  1885. var e = this._opts,
  1886. i = t;
  1887. e.easing && (i = e.easing(t));
  1888. var n = this.target;
  1889. if (n) {
  1890. var r = this._props,
  1891. s = this._opts.progress;
  1892. for (var o in r) {
  1893. var a = r[o],
  1894. l = a.easing ? a.easing(t) : i,
  1895. h = a.current = (a.progress || s)(a.start, a.end, a.current, l);
  1896. n[o] = h
  1897. }
  1898. }
  1899. },
  1900. progress: function(t, e, i, n) {
  1901. return "number" == typeof t ? i = t + (e - t) * n : t.lerp(e, n, i), i
  1902. }
  1903. }),
  1904. r = cc.Class({
  1905. name: "cc.SetAction",
  1906. extends: cc.ActionInstant,
  1907. ctor: function(t) {
  1908. this._props = {}, void 0 !== t && this.init(t)
  1909. },
  1910. init: function(t) {
  1911. for (var e in t) this._props[e] = t[e];
  1912. return !0
  1913. },
  1914. update: function() {
  1915. var t = this._props,
  1916. e = this.target;
  1917. for (var i in t) e[i] = t[i]
  1918. },
  1919. clone: function() {
  1920. var t = new r;
  1921. return t.init(this._props), t
  1922. }
  1923. });
  1924. function s(t) {
  1925. this._actions = [], this._finalAction = null, this._target = t
  1926. }
  1927. s.prototype.then = function(t) {
  1928. return t instanceof cc.Action ? this._actions.push(t.clone()) : this._actions.push(t._union()), this
  1929. }, s.prototype.target = function(t) {
  1930. return this._target = t, this
  1931. }, s.prototype.start = function() {
  1932. return this._target ? (this._finalAction && cc.director.getActionManager().removeAction(this._finalAction), this._finalAction = this._union(), cc.director.getActionManager().addAction(this._finalAction, this._target, !1), this) : (cc.warn("Please set target to tween first"), this)
  1933. }, s.prototype.stop = function() {
  1934. return this._finalAction && cc.director.getActionManager().removeAction(this._finalAction), this
  1935. }, s.prototype.clone = function(t) {
  1936. var e = this._union();
  1937. return cc.tween(t).then(e.clone())
  1938. }, s.prototype.union = function() {
  1939. var t = this._union();
  1940. return this._actions.length = 0, this._actions.push(t), this
  1941. }, s.prototype._union = function() {
  1942. var t = this._actions;
  1943. return t = 1 === t.length ? t[0] : cc.sequence(t)
  1944. };
  1945. var o = [];
  1946. function a(t) {
  1947. return function() {
  1948. o.length = 0;
  1949. for (var e = arguments.length, i = 0; i < e; i++) {
  1950. var n = o[i] = arguments[i];
  1951. n instanceof s && (o[i] = n._union())
  1952. }
  1953. return t.apply(this, o)
  1954. }
  1955. }
  1956. for (var l = {
  1957. to: function(t, e, i) {
  1958. return (i = i || Object.create(null)).relative = !1, new n(t, e, i)
  1959. },
  1960. by: function(t, e, i) {
  1961. return (i = i || Object.create(null)).relative = !0, new n(t, e, i)
  1962. },
  1963. set: function(t) {
  1964. return new r(t)
  1965. },
  1966. delay: cc.delayTime,
  1967. call: cc.callFunc,
  1968. hide: cc.hide,
  1969. show: cc.show,
  1970. removeSelf: cc.removeSelf,
  1971. sequence: a(cc.sequence),
  1972. parallel: a(cc.spawn)
  1973. }, h = {
  1974. repeat: cc.repeat,
  1975. repeatForever: function(t) {
  1976. return cc.repeat(t, 1e9)
  1977. },
  1978. reverseTime: cc.reverseTime
  1979. }, c = Object.keys(l), u = function(t) {
  1980. var e = c[t];
  1981. s.prototype[e] = function() {
  1982. var t = l[e].apply(l, arguments);
  1983. return this._actions.push(t), this
  1984. }
  1985. }, _ = 0; _ < c.length; _++) u(_);
  1986. c = Object.keys(h);
  1987. var f = function(t) {
  1988. var e = c[t];
  1989. s.prototype[e] = function() {
  1990. var t = this._actions,
  1991. i = arguments[arguments.length - 1],
  1992. n = arguments.length - 1;
  1993. i instanceof cc.Tween ? i = i._union() : i instanceof cc.Action || (i = t[t.length - 1], t.length -= 1, n += 1);
  1994. for (var r = [i], s = 0; s < n; s++) r.push(arguments[s]);
  1995. return i = h[e].apply(this, r), t.push(i), this
  1996. }
  1997. };
  1998. for (_ = 0; _ < c.length; _++) f(_);
  1999. cc.tween = function(t) {
  2000. return new s(t)
  2001. }, cc.Tween = s
  2002. }), {}],
  2003. 9: [(function(t, e, i) {
  2004. "use strict";
  2005. var n = cc.js,
  2006. r = t("./playable"),
  2007. s = t("./animation-curves"),
  2008. o = s.EventAnimCurve,
  2009. a = s.EventInfo,
  2010. l = t("./types").WrapModeMask,
  2011. h = t("../core/utils/binary-search").binarySearchEpsilon;
  2012. function c(t, e) {
  2013. r.call(this), this.target = t, this.animation = e, this._anims = new n.array.MutableForwardIterator([])
  2014. }
  2015. n.extend(c, r);
  2016. var u = c.prototype;
  2017. function _(t, e) {
  2018. var i = e.clip;
  2019. e.duration = i.duration, e.speed = i.speed, e.wrapMode = i.wrapMode, e.frameRate = i.sample, (e.wrapMode & l.Loop) === l.Loop ? e.repeatCount = 1 / 0 : e.repeatCount = 1;
  2020. var n = e.curves = i.createCurves(e, t),
  2021. r = i.events;
  2022. if (r)
  2023. for (var s = void 0, c = 0, u = r.length; c < u; c++) {
  2024. s || ((s = new o).target = t, n.push(s));
  2025. var _ = r[c],
  2026. f = _.frame / e.duration,
  2027. d = void 0,
  2028. p = h(s.ratios, f);
  2029. p >= 0 ? d = s.events[p] : (d = new a, s.ratios.push(f), s.events.push(d)), d.add(_.func, _.params)
  2030. }
  2031. }
  2032. u.playState = function(t, e) {
  2033. t.clip && (t.curveLoaded || _(this.target, t), t.animator = this, t.play(), "number" == typeof e && t.setTime(e), this.play())
  2034. }, u.stopStatesExcept = function(t) {
  2035. var e = this._anims,
  2036. i = e.array;
  2037. for (e.i = 0; e.i < i.length; ++e.i) {
  2038. var n = i[e.i];
  2039. n !== t && this.stopState(n)
  2040. }
  2041. }, u.addAnimation = function(t) {
  2042. -1 === this._anims.array.indexOf(t) && this._anims.push(t), t._setEventTarget(this.animation)
  2043. }, u.removeAnimation = function(t) {
  2044. var e = this._anims.array.indexOf(t);
  2045. e >= 0 ? (this._anims.fastRemoveAt(e), 0 === this._anims.array.length && this.stop()) : cc.errorID(3908), t.animator = null
  2046. }, u.sample = function() {
  2047. var t = this._anims,
  2048. e = t.array;
  2049. for (t.i = 0; t.i < e.length; ++t.i) {
  2050. e[t.i].sample()
  2051. }
  2052. }, u.stopState = function(t) {
  2053. t && t.stop()
  2054. }, u.pauseState = function(t) {
  2055. t && t.pause()
  2056. }, u.resumeState = function(t) {
  2057. t && t.resume(), this.isPaused && this.resume()
  2058. }, u.setStateTime = function(t, e) {
  2059. if (void 0 !== e) t && (t.setTime(e), t.sample());
  2060. else {
  2061. e = t;
  2062. for (var i = this._anims.array, n = 0; n < i.length; ++n) {
  2063. var r = i[n];
  2064. r.setTime(e), r.sample()
  2065. }
  2066. }
  2067. }, u.onStop = function() {
  2068. var t = this._anims,
  2069. e = t.array;
  2070. for (t.i = 0; t.i < e.length; ++t.i) {
  2071. e[t.i].stop()
  2072. }
  2073. }, u.onPause = function() {
  2074. for (var t = this._anims.array, e = 0; e < t.length; ++e) {
  2075. var i = t[e];
  2076. i.pause(), i.animator = null
  2077. }
  2078. }, u.onResume = function() {
  2079. for (var t = this._anims.array, e = 0; e < t.length; ++e) {
  2080. var i = t[e];
  2081. i.animator = this, i.resume()
  2082. }
  2083. }, u._reloadClip = function(t) {
  2084. _(this.target, t)
  2085. }, e.exports = c
  2086. }), {
  2087. "../core/utils/binary-search": 292,
  2088. "./animation-curves": 11,
  2089. "./playable": 18,
  2090. "./types": 19
  2091. }],
  2092. 10: [(function(t, e, i) {
  2093. "use strict";
  2094. var n = t("./types").WrapMode,
  2095. r = t("./animation-curves"),
  2096. s = r.DynamicAnimCurve,
  2097. o = r.quickFindIndex,
  2098. a = t("./motion-path-helper").sampleMotionPaths,
  2099. l = t("../core/utils/binary-search").binarySearchEpsilon,
  2100. h = cc.Class({
  2101. name: "cc.AnimationClip",
  2102. extends: cc.Asset,
  2103. properties: {
  2104. _duration: {
  2105. default: 0,
  2106. type: cc.Float
  2107. },
  2108. duration: {
  2109. get: function() {
  2110. return this._duration
  2111. }
  2112. },
  2113. sample: {
  2114. default: 60
  2115. },
  2116. speed: {
  2117. default: 1
  2118. },
  2119. wrapMode: {
  2120. default: n.Normal
  2121. },
  2122. curveData: {
  2123. default: {},
  2124. visible: !1
  2125. },
  2126. events: {
  2127. default: [],
  2128. visible: !1
  2129. }
  2130. },
  2131. statics: {
  2132. createWithSpriteFrames: function(t, e) {
  2133. if (!Array.isArray(t)) return cc.errorID(3905), null;
  2134. var i = new h;
  2135. i.sample = e || i.sample, i._duration = t.length / i.sample;
  2136. for (var n = [], r = 1 / i.sample, s = 0, o = t.length; s < o; s++) n[s] = {
  2137. frame: s * r,
  2138. value: t[s]
  2139. };
  2140. return i.curveData = {
  2141. comps: {
  2142. "cc.Sprite": {
  2143. spriteFrame: n
  2144. }
  2145. }
  2146. }, i
  2147. }
  2148. },
  2149. onLoad: function() {
  2150. this._duration = Number.parseFloat(this.duration), this.speed = Number.parseFloat(this.speed), this.wrapMode = Number.parseInt(this.wrapMode), this.frameRate = Number.parseFloat(this.sample)
  2151. },
  2152. createPropCurve: function(t, e, i) {
  2153. var n = [],
  2154. r = t instanceof cc.Node && "position" === e,
  2155. h = new s;
  2156. h.target = t, h.prop = e;
  2157. for (var c = 0, u = i.length; c < u; c++) {
  2158. var _ = i[c],
  2159. f = _.frame / this.duration;
  2160. h.ratios.push(f), r && n.push(_.motionPath);
  2161. var d = _.value;
  2162. h.values.push(d);
  2163. var p = _.curve;
  2164. if (p) {
  2165. if ("string" == typeof p) {
  2166. h.types.push(p);
  2167. continue
  2168. }
  2169. if (Array.isArray(p)) {
  2170. p[0] === p[1] && p[2] === p[3] ? h.types.push(s.Linear) : h.types.push(s.Bezier(p));
  2171. continue
  2172. }
  2173. }
  2174. h.types.push(s.Linear)
  2175. }
  2176. r && a(n, h, this.duration, this.sample, t);
  2177. for (var m = h.ratios, y = void 0, v = void 0, g = !0, x = 1, b = m.length; x < b; x++)
  2178. if (y = m[x] - m[x - 1], 1 === x) v = y;
  2179. else if (Math.abs(y - v) > 1e-6) {
  2180. g = !1;
  2181. break
  2182. }
  2183. h._findFrameIndex = g ? o : l;
  2184. var A = h.values[0];
  2185. return void 0 === A || null === A || h._lerp || ("number" == typeof A ? h._lerp = s.prototype._lerpNumber : A instanceof cc.Quat ? h._lerp = s.prototype._lerpQuat : A instanceof cc.Vec2 || A instanceof cc.Vec3 ? h._lerp = s.prototype._lerpVector : A.lerp && (h._lerp = s.prototype._lerpObject)), h
  2186. },
  2187. createTargetCurves: function(t, e, i) {
  2188. var n = e.props,
  2189. r = e.comps;
  2190. if (n)
  2191. for (var s in n) {
  2192. var o = n[s],
  2193. a = this.createPropCurve(t, s, o);
  2194. i.push(a)
  2195. }
  2196. if (r)
  2197. for (var l in r) {
  2198. var h = t.getComponent(l);
  2199. if (h) {
  2200. var c = r[l];
  2201. for (var u in c) {
  2202. var _ = c[u],
  2203. f = this.createPropCurve(h, u, _);
  2204. i.push(f)
  2205. }
  2206. }
  2207. }
  2208. },
  2209. createCurves: function(t, e) {
  2210. var i = this.curveData,
  2211. n = i.paths,
  2212. r = [];
  2213. for (var s in this.createTargetCurves(e, i, r), n) {
  2214. var o = cc.find(s, e);
  2215. if (o) {
  2216. var a = n[s];
  2217. this.createTargetCurves(o, a, r)
  2218. }
  2219. }
  2220. return r
  2221. }
  2222. });
  2223. cc.AnimationClip = e.exports = h
  2224. }), {
  2225. "../core/utils/binary-search": 292,
  2226. "./animation-curves": 11,
  2227. "./motion-path-helper": 17,
  2228. "./types": 19
  2229. }],
  2230. 11: [(function(t, e, i) {
  2231. "use strict";
  2232. var n = t("./bezier").bezierByTime,
  2233. r = t("../core/utils/binary-search").binarySearchEpsilon,
  2234. s = t("./types").WrapModeMask,
  2235. o = t("./types").WrappedInfo;
  2236. function a(t, e) {
  2237. if ("string" == typeof e) {
  2238. var i = cc.easing[e];
  2239. i ? t = i(t) : cc.errorID(3906, e)
  2240. } else Array.isArray(e) && (t = n(e, t));
  2241. return t
  2242. }
  2243. var l = cc.Class({
  2244. name: "cc.AnimCurve",
  2245. sample: function(t, e, i) {},
  2246. onTimeChangedManually: void 0
  2247. });
  2248. function h(t, e) {
  2249. var i = t.length - 1;
  2250. if (0 === i) return 0;
  2251. var n = t[0];
  2252. if (e < n) return 0;
  2253. var r = t[i];
  2254. if (e > r) return ~t.length;
  2255. var s = (e = (e - n) / (r - n)) / (1 / i),
  2256. o = 0 | s;
  2257. return s - o < 1e-6 ? o : o + 1 - s < 1e-6 ? o + 1 : ~(o + 1)
  2258. }
  2259. var c = cc.Class({
  2260. name: "cc.DynamicAnimCurve",
  2261. extends: l,
  2262. ctor: function() {
  2263. this._cachedIndex = 0
  2264. },
  2265. properties: {
  2266. target: null,
  2267. prop: "",
  2268. values: [],
  2269. ratios: [],
  2270. types: []
  2271. },
  2272. _findFrameIndex: r,
  2273. _lerp: void 0,
  2274. _lerpNumber: function(t, e, i) {
  2275. return t + (e - t) * i
  2276. },
  2277. _lerpObject: function(t, e, i) {
  2278. return t.lerp(e, i)
  2279. },
  2280. _lerpQuat: (function() {
  2281. var t = cc.quat();
  2282. return function(e, i, n) {
  2283. return e.lerp(i, n, t)
  2284. }
  2285. })(),
  2286. _lerpVector: (function() {
  2287. var t = cc.v3();
  2288. return function(e, i, n) {
  2289. return e.lerp(i, n, t)
  2290. }
  2291. })(),
  2292. sample: function(t, e, i) {
  2293. var n = this.values,
  2294. r = this.ratios,
  2295. s = r.length;
  2296. if (0 !== s) {
  2297. var o = !0,
  2298. l = this._cachedIndex;
  2299. if (l < 0 && (l = ~l) > 0 && l < r.length) {
  2300. var h = r[l - 1],
  2301. c = r[l];
  2302. e > h && e < c && (o = !1)
  2303. }
  2304. o && (this._cachedIndex = this._findFrameIndex(r, e));
  2305. var u = void 0,
  2306. _ = this._cachedIndex;
  2307. if (_ < 0)
  2308. if ((_ = ~_) <= 0) u = n[0];
  2309. else if (_ >= s) u = n[s - 1];
  2310. else {
  2311. var f = n[_ - 1];
  2312. if (this._lerp) {
  2313. var d = r[_ - 1],
  2314. p = r[_],
  2315. m = this.types[_ - 1],
  2316. y = (e - d) / (p - d);
  2317. m && (y = a(y, m));
  2318. var v = n[_];
  2319. u = this._lerp(f, v, y)
  2320. } else u = f
  2321. } else u = n[_];
  2322. this.target[this.prop] = u
  2323. }
  2324. }
  2325. });
  2326. c.Linear = null, c.Bezier = function(t) {
  2327. return t
  2328. };
  2329. var u = function() {
  2330. this.events = []
  2331. };
  2332. u.prototype.add = function(t, e) {
  2333. this.events.push({
  2334. func: t || "",
  2335. params: e || []
  2336. })
  2337. };
  2338. var _ = cc.Class({
  2339. name: "cc.EventAnimCurve",
  2340. extends: l,
  2341. properties: {
  2342. target: null,
  2343. ratios: [],
  2344. events: [],
  2345. _wrappedInfo: {
  2346. default: function() {
  2347. return new o
  2348. }
  2349. },
  2350. _lastWrappedInfo: null,
  2351. _ignoreIndex: NaN
  2352. },
  2353. _wrapIterations: function(t) {
  2354. return t - (0 | t) == 0 && (t -= 1), 0 | t
  2355. },
  2356. sample: function(t, e, i) {
  2357. var n = this.ratios.length,
  2358. a = i.getWrappedInfo(i.time, this._wrappedInfo),
  2359. l = a.direction,
  2360. h = r(this.ratios, a.ratio);
  2361. if (h < 0 && (h = ~h - 1, l < 0 && (h += 1)), this._ignoreIndex !== h && (this._ignoreIndex = NaN), a.frameIndex = h, !this._lastWrappedInfo) return this._fireEvent(h), void(this._lastWrappedInfo = new o(a));
  2362. var c = i.wrapMode,
  2363. u = this._wrapIterations(a.iterations),
  2364. _ = this._lastWrappedInfo,
  2365. f = this._wrapIterations(_.iterations),
  2366. d = _.frameIndex,
  2367. p = _.direction,
  2368. m = -1 !== f && u !== f;
  2369. if (d === h && m && 1 === n) this._fireEvent(0);
  2370. else if (d !== h || m) {
  2371. l = p;
  2372. do {
  2373. if (d !== h) {
  2374. if (-1 === l && 0 === d && h > 0 ? ((c & s.PingPong) === s.PingPong ? l *= -1 : d = n, f++) : 1 === l && d === n - 1 && h < n - 1 && ((c & s.PingPong) === s.PingPong ? l *= -1 : d = -1, f++), d === h) break;
  2375. if (f > u) break
  2376. }
  2377. d += l, cc.director.getAnimationManager().pushDelayEvent(this, "_fireEvent", [d])
  2378. } while (d !== h && d > -1 && d < n)
  2379. }
  2380. this._lastWrappedInfo.set(a)
  2381. },
  2382. _fireEvent: function(t) {
  2383. if (!(t < 0 || t >= this.events.length || this._ignoreIndex === t)) {
  2384. var e = this.events[t].events;
  2385. if (this.target.isValid)
  2386. for (var i = this.target._components, n = 0; n < e.length; n++)
  2387. for (var r = e[n], s = r.func, o = 0; o < i.length; o++) {
  2388. var a = i[o],
  2389. l = a[s];
  2390. l && l.apply(a, r.params)
  2391. }
  2392. }
  2393. },
  2394. onTimeChangedManually: function(t, e) {
  2395. this._lastWrappedInfo = null, this._ignoreIndex = NaN;
  2396. var i = e.getWrappedInfo(t, this._wrappedInfo),
  2397. n = i.direction,
  2398. s = r(this.ratios, i.ratio);
  2399. s < 0 && (s = ~s - 1, n < 0 && (s += 1), this._ignoreIndex = s)
  2400. }
  2401. });
  2402. e.exports = {
  2403. AnimCurve: l,
  2404. DynamicAnimCurve: c,
  2405. EventAnimCurve: _,
  2406. EventInfo: u,
  2407. computeRatioByType: a,
  2408. quickFindIndex: h
  2409. }
  2410. }), {
  2411. "../core/utils/binary-search": 292,
  2412. "./bezier": 14,
  2413. "./types": 19
  2414. }],
  2415. 12: [(function(t, e, i) {
  2416. "use strict";
  2417. var n = cc.js,
  2418. r = cc.Class({
  2419. ctor: function() {
  2420. this._anims = new n.array.MutableForwardIterator([]), this._delayEvents = [], cc.director._scheduler && cc.director._scheduler.enableForTarget(this)
  2421. },
  2422. update: function(t) {
  2423. var e = this._anims,
  2424. i = e.array;
  2425. for (e.i = 0; e.i < i.length; ++e.i) {
  2426. var n = i[e.i];
  2427. n._isPlaying && !n._isPaused && n.update(t)
  2428. }
  2429. for (var r = this._delayEvents, s = 0; s < r.length; s++) {
  2430. var o = r[s];
  2431. o.target[o.func].apply(o.target, o.args)
  2432. }
  2433. r.length = 0
  2434. },
  2435. destruct: function() {},
  2436. addAnimation: function(t) {
  2437. -1 === this._anims.array.indexOf(t) && this._anims.push(t)
  2438. },
  2439. removeAnimation: function(t) {
  2440. var e = this._anims.array.indexOf(t);
  2441. e >= 0 ? this._anims.fastRemoveAt(e) : cc.errorID(3907)
  2442. },
  2443. pushDelayEvent: function(t, e, i) {
  2444. this._delayEvents.push({
  2445. target: t,
  2446. func: e,
  2447. args: i
  2448. })
  2449. }
  2450. });
  2451. cc.AnimationManager = e.exports = r
  2452. }), {}],
  2453. 13: [(function(t, e, i) {
  2454. "use strict";
  2455. var n = cc.js,
  2456. r = t("./playable"),
  2457. s = t("./types"),
  2458. o = s.WrappedInfo,
  2459. a = s.WrapMode,
  2460. l = s.WrapModeMask;
  2461. function h(t, e) {
  2462. r.call(this), this._currentFramePlayed = !1, this._delay = 0, this._delayTime = 0, this._wrappedInfo = new o, this._lastWrappedInfo = null, this._process = u, this._clip = t, this._name = e || t && t.name, this.animator = null, this.curves = [], this.delay = 0, this.repeatCount = 1, this.duration = 1, this.speed = 1, this.wrapMode = a.Normal, this.time = 0, this._target = null, this._lastframeEventOn = !1, this.emit = function() {
  2463. for (var t = new Array(arguments.length), e = 0, i = t.length; e < i; e++) t[e] = arguments[e];
  2464. cc.director.getAnimationManager().pushDelayEvent(this, "_emit", t)
  2465. }
  2466. }
  2467. n.extend(h, r);
  2468. var c = h.prototype;
  2469. function u() {
  2470. var t, e = this.sample();
  2471. this._lastframeEventOn && (t = this._lastWrappedInfo ? this._lastWrappedInfo : this._lastWrappedInfo = new o(e), this.repeatCount > 1 && (0 | e.iterations) > (0 | t.iterations) && this.emit("lastframe", this), t.set(e));
  2472. e.stopped && (this.stop(), this.emit("finished", this))
  2473. }
  2474. function _() {
  2475. var t = this.time,
  2476. e = this.duration;
  2477. t > e ? 0 === (t %= e) && (t = e) : t < 0 && 0 !== (t %= e) && (t += e);
  2478. for (var i = t / e, n = this.curves, r = 0, s = n.length; r < s; r++) {
  2479. n[r].sample(t, i, this)
  2480. }
  2481. this._lastframeEventOn && (void 0 === this._lastIterations && (this._lastIterations = i), (this.time > 0 && this._lastIterations > i || this.time < 0 && this._lastIterations < i) && this.emit("lastframe", this), this._lastIterations = i)
  2482. }
  2483. c._emit = function(t, e) {
  2484. this._target && this._target.isValid && this._target.emit(t, t, e)
  2485. }, c.on = function(t, e, i) {
  2486. return this._target && this._target.isValid ? ("lastframe" === t && (this._lastframeEventOn = !0), this._target.on(t, e, i)) : null
  2487. }, c.once = function(t, e, i) {
  2488. if (this._target && this._target.isValid) {
  2489. "lastframe" === t && (this._lastframeEventOn = !0);
  2490. var n = this;
  2491. return this._target.once(t, (function(t) {
  2492. e.call(i, t), n._lastframeEventOn = !1
  2493. }))
  2494. }
  2495. return null
  2496. }, c.off = function(t, e, i) {
  2497. this._target && this._target.isValid && ("lastframe" === t && (this._target.hasEventListener(t) || (this._lastframeEventOn = !1)), this._target.off(t, e, i))
  2498. }, c._setEventTarget = function(t) {
  2499. this._target = t
  2500. }, c.onPlay = function() {
  2501. this.setTime(0), this._delayTime = this._delay, cc.director.getAnimationManager().addAnimation(this), this.animator && this.animator.addAnimation(this), this.emit("play", this)
  2502. }, c.onStop = function() {
  2503. this.isPaused || cc.director.getAnimationManager().removeAnimation(this), this.animator && this.animator.removeAnimation(this), this.emit("stop", this)
  2504. }, c.onResume = function() {
  2505. cc.director.getAnimationManager().addAnimation(this), this.emit("resume", this)
  2506. }, c.onPause = function() {
  2507. cc.director.getAnimationManager().removeAnimation(this), this.emit("pause", this)
  2508. }, c.setTime = function(t) {
  2509. this._currentFramePlayed = !1, this.time = t || 0;
  2510. for (var e = this.curves, i = 0, n = e.length; i < n; i++) {
  2511. var r = e[i];
  2512. r.onTimeChangedManually && r.onTimeChangedManually(t, this)
  2513. }
  2514. }, c.update = function(t) {
  2515. this._delayTime > 0 && (this._delayTime -= t, this._delayTime > 0) || (this._currentFramePlayed ? this.time += t * this.speed : this._currentFramePlayed = !0, this._process())
  2516. }, c._needRevers = function(t) {
  2517. var e = this.wrapMode,
  2518. i = !1;
  2519. (e & l.PingPong) === l.PingPong && (t - (0 | t) == 0 && t > 0 && (t -= 1), 1 & t && (i = !i));
  2520. return (e & l.Reverse) === l.Reverse && (i = !i), i
  2521. }, c.getWrappedInfo = function(t, e) {
  2522. e = e || new o;
  2523. var i = !1,
  2524. n = this.duration,
  2525. r = this.repeatCount,
  2526. s = t > 0 ? t / n : -t / n;
  2527. if (s >= r) {
  2528. s = r, i = !0;
  2529. var a = r - (0 | r);
  2530. 0 === a && (a = 1), t = a * n * (t > 0 ? 1 : -1)
  2531. }
  2532. if (t > n) {
  2533. var h = t % n;
  2534. t = 0 === h ? n : h
  2535. } else t < 0 && 0 !== (t %= n) && (t += n);
  2536. var c = !1,
  2537. u = this._wrapMode & l.ShouldWrap;
  2538. u && (c = this._needRevers(s));
  2539. var _ = c ? -1 : 1;
  2540. return this.speed < 0 && (_ *= -1), u && c && (t = n - t), e.ratio = t / n, e.time = t, e.direction = _, e.stopped = i, e.iterations = s, e
  2541. }, c.sample = function() {
  2542. for (var t = this.getWrappedInfo(this.time, this._wrappedInfo), e = this.curves, i = 0, n = e.length; i < n; i++) {
  2543. e[i].sample(t.time, t.ratio, this)
  2544. }
  2545. return t
  2546. }, n.get(c, "clip", (function() {
  2547. return this._clip
  2548. })), n.get(c, "name", (function() {
  2549. return this._name
  2550. })), n.obsolete(c, "AnimationState.length", "duration"), n.getset(c, "curveLoaded", (function() {
  2551. return this.curves.length > 0
  2552. }), (function() {
  2553. this.curves.length = 0
  2554. })), n.getset(c, "wrapMode", (function() {
  2555. return this._wrapMode
  2556. }), (function(t) {
  2557. this._wrapMode = t, this.time = 0, t & l.Loop ? this.repeatCount = 1 / 0 : this.repeatCount = 1
  2558. })), n.getset(c, "repeatCount", (function() {
  2559. return this._repeatCount
  2560. }), (function(t) {
  2561. this._repeatCount = t;
  2562. var e = this._wrapMode & l.ShouldWrap,
  2563. i = (this.wrapMode & l.Reverse) === l.Reverse;
  2564. this._process = t !== 1 / 0 || e || i ? u : _
  2565. })), n.getset(c, "delay", (function() {
  2566. return this._delay
  2567. }), (function(t) {
  2568. this._delayTime = this._delay = t
  2569. })), cc.AnimationState = e.exports = h
  2570. }), {
  2571. "./playable": 18,
  2572. "./types": 19
  2573. }],
  2574. 14: [(function(t, e, i) {
  2575. "use strict";
  2576. function n(t, e, i, n, r) {
  2577. var s = 1 - r;
  2578. return s * (s * (t + (3 * e - t) * r) + 3 * i * r * r) + n * r * r * r
  2579. }
  2580. var r = Math.cos,
  2581. s = Math.acos,
  2582. o = Math.max,
  2583. a = 2 * Math.PI,
  2584. l = Math.sqrt;
  2585. function h(t) {
  2586. return t < 0 ? -Math.pow(-t, 1 / 3) : Math.pow(t, 1 / 3)
  2587. }
  2588. function c(t, e) {
  2589. var i, n, c, u, _ = e - 0,
  2590. f = e - t[0],
  2591. d = 3 * _,
  2592. p = 3 * f,
  2593. m = 3 * (e - t[2]),
  2594. y = 1 / (-_ + p - m + (e - 1)),
  2595. v = (d - 6 * f + m) * y,
  2596. g = v * (1 / 3),
  2597. x = (-d + p) * y,
  2598. b = 1 / 3 * (3 * x - v * v),
  2599. A = b * (1 / 3),
  2600. C = (2 * v * v * v - 9 * v * x + 27 * (_ * y)) / 27,
  2601. T = C / 2,
  2602. S = T * T + A * A * A;
  2603. if (S < 0) {
  2604. var w = 1 / 3 * -b,
  2605. E = l(w * w * w),
  2606. M = -C / (2 * E),
  2607. D = s(M < -1 ? -1 : M > 1 ? 1 : M),
  2608. B = 2 * h(E);
  2609. return n = B * r(D * (1 / 3)) - g, c = B * r((D + a) * (1 / 3)) - g, u = B * r((D + 2 * a) * (1 / 3)) - g, 0 <= n && n <= 1 ? 0 <= c && c <= 1 ? 0 <= u && u <= 1 ? o(n, c, u) : o(n, c) : 0 <= u && u <= 1 ? o(n, u) : n : 0 <= c && c <= 1 ? 0 <= u && u <= 1 ? o(c, u) : c : u
  2610. }
  2611. if (0 === S) return c = -(i = T < 0 ? h(-T) : -h(T)) - g, 0 <= (n = 2 * i - g) && n <= 1 ? 0 <= c && c <= 1 ? o(n, c) : n : c;
  2612. var I = l(S);
  2613. return n = (i = h(-T + I)) - h(T + I) - g
  2614. }
  2615. function u(t, e) {
  2616. var i = c(t, e),
  2617. n = t[1];
  2618. return ((1 - i) * (n + (t[3] - n) * i) * 3 + i * i) * i
  2619. }
  2620. e.exports = {
  2621. bezier: n,
  2622. bezierByTime: u
  2623. }
  2624. }), {}],
  2625. 15: [(function(t, e, i) {
  2626. "use strict";
  2627. var n = {
  2628. constant: function() {
  2629. return 0
  2630. },
  2631. linear: function(t) {
  2632. return t
  2633. },
  2634. quadIn: function(t) {
  2635. return t * t
  2636. },
  2637. quadOut: function(t) {
  2638. return t * (2 - t)
  2639. },
  2640. quadInOut: function(t) {
  2641. return (t *= 2) < 1 ? .5 * t * t : -.5 * (--t * (t - 2) - 1)
  2642. },
  2643. cubicIn: function(t) {
  2644. return t * t * t
  2645. },
  2646. cubicOut: function(t) {
  2647. return --t * t * t + 1
  2648. },
  2649. cubicInOut: function(t) {
  2650. return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2)
  2651. },
  2652. quartIn: function(t) {
  2653. return t * t * t * t
  2654. },
  2655. quartOut: function(t) {
  2656. return 1 - --t * t * t * t
  2657. },
  2658. quartInOut: function(t) {
  2659. return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2)
  2660. },
  2661. quintIn: function(t) {
  2662. return t * t * t * t * t
  2663. },
  2664. quintOut: function(t) {
  2665. return --t * t * t * t * t + 1
  2666. },
  2667. quintInOut: function(t) {
  2668. return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2)
  2669. },
  2670. sineIn: function(t) {
  2671. return 1 - Math.cos(t * Math.PI / 2)
  2672. },
  2673. sineOut: function(t) {
  2674. return Math.sin(t * Math.PI / 2)
  2675. },
  2676. sineInOut: function(t) {
  2677. return .5 * (1 - Math.cos(Math.PI * t))
  2678. },
  2679. expoIn: function(t) {
  2680. return 0 === t ? 0 : Math.pow(1024, t - 1)
  2681. },
  2682. expoOut: function(t) {
  2683. return 1 === t ? 1 : 1 - Math.pow(2, -10 * t)
  2684. },
  2685. expoInOut: function(t) {
  2686. return 0 === t ? 0 : 1 === t ? 1 : (t *= 2) < 1 ? .5 * Math.pow(1024, t - 1) : .5 * (2 - Math.pow(2, -10 * (t - 1)))
  2687. },
  2688. circIn: function(t) {
  2689. return 1 - Math.sqrt(1 - t * t)
  2690. },
  2691. circOut: function(t) {
  2692. return Math.sqrt(1 - --t * t)
  2693. },
  2694. circInOut: function(t) {
  2695. return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1)
  2696. },
  2697. elasticIn: function(t) {
  2698. var e, i = .1;
  2699. return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), -i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4))
  2700. },
  2701. elasticOut: function(t) {
  2702. var e, i = .1;
  2703. return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), i * Math.pow(2, -10 * t) * Math.sin((t - e) * (2 * Math.PI) / .4) + 1)
  2704. },
  2705. elasticInOut: function(t) {
  2706. var e, i = .1;
  2707. return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), (t *= 2) < 1 ? i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4) * -.5 : i * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4) * .5 + 1)
  2708. },
  2709. backIn: function(t) {
  2710. var e = 1.70158;
  2711. return t * t * ((e + 1) * t - e)
  2712. },
  2713. backOut: function(t) {
  2714. var e = 1.70158;
  2715. return --t * t * ((e + 1) * t + e) + 1
  2716. },
  2717. backInOut: function(t) {
  2718. var e = 2.5949095;
  2719. return (t *= 2) < 1 ? t * t * ((e + 1) * t - e) * .5 : .5 * ((t -= 2) * t * ((e + 1) * t + e) + 2)
  2720. },
  2721. bounceIn: function(t) {
  2722. return 1 - n.bounceOut(1 - t)
  2723. },
  2724. bounceOut: function(t) {
  2725. return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375
  2726. },
  2727. bounceInOut: function(t) {
  2728. return t < .5 ? .5 * n.bounceIn(2 * t) : .5 * n.bounceOut(2 * t - 1) + .5
  2729. },
  2730. smooth: function(t) {
  2731. return t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t)
  2732. },
  2733. fade: function(t) {
  2734. return t <= 0 ? 0 : t >= 1 ? 1 : t * t * t * (t * (6 * t - 15) + 10)
  2735. }
  2736. };
  2737. function r(t, e) {
  2738. return function(i) {
  2739. return i < .5 ? e(2 * i) / 2 : t(2 * i - 1) / 2 + .5
  2740. }
  2741. }
  2742. n.quadOutIn = r(n.quadIn, n.quadOut), n.cubicOutIn = r(n.cubicIn, n.cubicOut), n.quartOutIn = r(n.quartIn, n.quartOut), n.quintOutIn = r(n.quintIn, n.quintOut), n.sineOutIn = r(n.sineIn, n.sineOut), n.expoOutIn = r(n.expoIn, n.expoOut), n.circOutIn = r(n.circIn, n.circOut), n.backOutIn = r(n.backIn, n.backOut), n.bounceIn = function(t) {
  2743. return 1 - n.bounceOut(1 - t)
  2744. }, n.bounceInOut = function(t) {
  2745. return t < .5 ? .5 * n.bounceIn(2 * t) : .5 * n.bounceOut(2 * t - 1) + .5
  2746. }, n.bounceOutIn = r(n.bounceIn, n.bounceOut), cc.easing = e.exports = n
  2747. }), {}],
  2748. 16: [(function(t, e, i) {
  2749. "use strict";
  2750. t("./bezier"), t("./easing"), t("./types"), t("./motion-path-helper"), t("./animation-curves"), t("./animation-clip"), t("./animation-manager"), t("./animation-state"), t("./animation-animator")
  2751. }), {
  2752. "./animation-animator": 9,
  2753. "./animation-clip": 10,
  2754. "./animation-curves": 11,
  2755. "./animation-manager": 12,
  2756. "./animation-state": 13,
  2757. "./bezier": 14,
  2758. "./easing": 15,
  2759. "./motion-path-helper": 17,
  2760. "./types": 19
  2761. }],
  2762. 17: [(function(t, e, i) {
  2763. "use strict";
  2764. var n = t("./animation-curves").DynamicAnimCurve,
  2765. r = t("./animation-curves").computeRatioByType,
  2766. s = t("./bezier").bezier,
  2767. o = t("../core/utils/binary-search").binarySearchEpsilon,
  2768. a = cc.v2;
  2769. function l(t) {
  2770. this.points = t || [], this.beziers = [], this.ratios = [], this.progresses = [], this.length = 0, this.computeBeziers()
  2771. }
  2772. function h() {
  2773. this.start = a(), this.end = a(), this.startCtrlPoint = a(), this.endCtrlPoint = a()
  2774. }
  2775. function c(t) {
  2776. if (!Array.isArray(t)) return !1;
  2777. for (var e = 0, i = t.length; e < i; e++) {
  2778. var n = t[e];
  2779. if (!Array.isArray(n) || 6 !== n.length) return !1
  2780. }
  2781. return !0
  2782. }
  2783. function u(t, e, i, s, h) {
  2784. function u(t) {
  2785. return t instanceof cc.Vec2 ? { in: t,
  2786. pos: t,
  2787. out: t
  2788. } : Array.isArray(t) && 6 === t.length ? { in: a(t[2], t[3]),
  2789. pos: a(t[0], t[1]),
  2790. out: a(t[4], t[5])
  2791. } : { in: cc.Vec2.ZERO,
  2792. pos: cc.Vec2.ZERO,
  2793. out: cc.Vec2.ZERO
  2794. }
  2795. }
  2796. var _ = e.values = e.values.map((function(t) {
  2797. return Array.isArray(t) && (t = 2 === t.length ? cc.v2(t[0], t[1]) : cc.v3(t[0], t[1], t[2])), t
  2798. }));
  2799. if (0 !== t.length && 0 !== _.length) {
  2800. for (var f = !1, d = 0; d < t.length; d++) {
  2801. var p = t[d];
  2802. if (p && !c(p) && (cc.errorID(3904, h ? h.name : "", "position", d), p = null), p && p.length > 0) {
  2803. f = !0;
  2804. break
  2805. }
  2806. }
  2807. if (f && 1 !== _.length) {
  2808. for (var m = e.types, y = e.ratios, v = e.values = [], g = e.types = [], x = e.ratios = [], b = 0, A = n.Linear, C = 0, T = t.length; C < T - 1; C++) {
  2809. var S, w = t[C],
  2810. E = y[C],
  2811. M = y[C + 1] - E,
  2812. D = _[C],
  2813. B = _[C + 1],
  2814. I = m[C],
  2815. P = [],
  2816. R = b / M,
  2817. O = 1 / (M * i * s);
  2818. if (w && w.length > 0) {
  2819. var L = [];
  2820. L.push(u(D));
  2821. for (var F = 0, N = w.length; F < N; F++) {
  2822. var V = u(w[F]);
  2823. L.push(V)
  2824. }
  2825. L.push(u(B));
  2826. var k = new l(L);
  2827. k.computeBeziers();
  2828. for (var G = k.progresses; 1 - R > 1e-6;) {
  2829. var U, z, j, W;
  2830. if ((S = r(S = R, I)) < 0) W = (0 - S) * (z = k.beziers[0]).getLength(), j = z.start.sub(z.endCtrlPoint).normalize(), U = z.start.add(j.mul(W));
  2831. else if (S > 1) W = (S - 1) * (z = k.beziers[k.beziers.length - 1]).getLength(), j = z.end.sub(z.startCtrlPoint).normalize(), U = z.end.add(j.mul(W));
  2832. else {
  2833. var H = o(G, S);
  2834. H < 0 && (H = ~H), S -= H > 0 ? G[H - 1] : 0, S /= k.ratios[H], U = k.beziers[H].getPointAt(S)
  2835. }
  2836. P.push(U), R += O
  2837. }
  2838. } else
  2839. for (; 1 - R > 1e-6;) S = r(S = R, I), P.push(D.lerp(B, S)), R += O;
  2840. A = "constant" === I ? I : n.Linear;
  2841. for (F = 0, N = P.length; F < N; F++) {
  2842. var X = E + b + O * F * M;
  2843. Y(P[F], A, X)
  2844. }
  2845. b = Math.abs(R - 1) > 1e-6 ? (R - 1) * M : 0
  2846. }
  2847. y[y.length - 1] !== x[x.length - 1] && Y(_[_.length - 1], A, y[y.length - 1])
  2848. }
  2849. }
  2850. function Y(t, e, i) {
  2851. v.push(t), g.push(e), x.push(i)
  2852. }
  2853. }
  2854. l.prototype.computeBeziers = function() {
  2855. var t;
  2856. this.beziers.length = 0, this.ratios.length = 0, this.progresses.length = 0, this.length = 0;
  2857. for (var e = 1; e < this.points.length; e++) {
  2858. var i = this.points[e - 1],
  2859. n = this.points[e];
  2860. (t = new h).start = i.pos, t.startCtrlPoint = i.out, t.end = n.pos, t.endCtrlPoint = n.in, this.beziers.push(t), this.length += t.getLength()
  2861. }
  2862. var r = 0;
  2863. for (e = 0; e < this.beziers.length; e++) t = this.beziers[e], this.ratios[e] = t.getLength() / this.length, this.progresses[e] = r += this.ratios[e];
  2864. return this.beziers
  2865. }, h.prototype.getPointAt = function(t) {
  2866. var e = this.getUtoTmapping(t);
  2867. return this.getPoint(e)
  2868. }, h.prototype.getPoint = function(t) {
  2869. var e = s(this.start.x, this.startCtrlPoint.x, this.endCtrlPoint.x, this.end.x, t),
  2870. i = s(this.start.y, this.startCtrlPoint.y, this.endCtrlPoint.y, this.end.y, t);
  2871. return new a(e, i)
  2872. }, h.prototype.getLength = function() {
  2873. var t = this.getLengths();
  2874. return t[t.length - 1]
  2875. }, h.prototype.getLengths = function(t) {
  2876. if (t || (t = this.__arcLengthDivisions ? this.__arcLengthDivisions : 200), this.cacheArcLengths && this.cacheArcLengths.length === t + 1) return this.cacheArcLengths;
  2877. var e, i, n = [],
  2878. r = this.getPoint(0),
  2879. s = a(),
  2880. o = 0;
  2881. for (n.push(0), i = 1; i <= t; i++) e = this.getPoint(i / t), s.x = r.x - e.x, s.y = r.y - e.y, o += s.mag(), n.push(o), r = e;
  2882. return this.cacheArcLengths = n, n
  2883. }, h.prototype.getUtoTmapping = function(t, e) {
  2884. var i, n = this.getLengths(),
  2885. r = 0,
  2886. s = n.length;
  2887. i = e || t * n[s - 1];
  2888. for (var o, a = 0, l = s - 1; a <= l;)
  2889. if ((o = n[r = Math.floor(a + (l - a) / 2)] - i) < 0) a = r + 1;
  2890. else {
  2891. if (!(o > 0)) {
  2892. l = r;
  2893. break
  2894. }
  2895. l = r - 1
  2896. }
  2897. if (n[r = l] === i) return r / (s - 1);
  2898. var h = n[r];
  2899. return (r + (i - h) / (n[r + 1] - h)) / (s - 1)
  2900. }, e.exports = {
  2901. sampleMotionPaths: u,
  2902. Curve: l,
  2903. Bezier: h
  2904. }
  2905. }), {
  2906. "../core/utils/binary-search": 292,
  2907. "./animation-curves": 11,
  2908. "./bezier": 14
  2909. }],
  2910. 18: [(function(t, e, i) {
  2911. "use strict";
  2912. var n = cc.js,
  2913. r = t("../core/CCDebug");
  2914. function s() {
  2915. this._isPlaying = !1, this._isPaused = !1, this._stepOnce = !1
  2916. }
  2917. var o = s.prototype;
  2918. n.get(o, "isPlaying", (function() {
  2919. return this._isPlaying
  2920. }), !0), n.get(o, "isPaused", (function() {
  2921. return this._isPaused
  2922. }), !0);
  2923. var a = function() {};
  2924. o.onPlay = a, o.onPause = a, o.onResume = a, o.onStop = a, o.onError = a, o.play = function() {
  2925. this._isPlaying ? this._isPaused ? (this._isPaused = !1, this.onResume()) : this.onError(r.getError(3912)) : (this._isPlaying = !0, this.onPlay())
  2926. }, o.stop = function() {
  2927. this._isPlaying && (this._isPlaying = !1, this.onStop(), this._isPaused = !1)
  2928. }, o.pause = function() {
  2929. this._isPlaying && !this._isPaused && (this._isPaused = !0, this.onPause())
  2930. }, o.resume = function() {
  2931. this._isPlaying && this._isPaused && (this._isPaused = !1, this.onResume())
  2932. }, o.step = function() {
  2933. this.pause(), this._stepOnce = !0, this._isPlaying || this.play()
  2934. }, e.exports = s
  2935. }), {
  2936. "../core/CCDebug": 49
  2937. }],
  2938. 19: [(function(t, e, i) {
  2939. "use strict";
  2940. var n = {
  2941. Loop: 2,
  2942. ShouldWrap: 4,
  2943. PingPong: 22,
  2944. Reverse: 36
  2945. },
  2946. r = cc.Enum({
  2947. Default: 0,
  2948. Normal: 1,
  2949. Reverse: n.Reverse,
  2950. Loop: n.Loop,
  2951. LoopReverse: n.Loop | n.Reverse,
  2952. PingPong: n.PingPong,
  2953. PingPongReverse: n.PingPong | n.Reverse
  2954. });
  2955. function s(t) {
  2956. t ? this.set(t) : (this.ratio = 0, this.time = 0, this.direction = 1, this.stopped = !0, this.iterations = 0, this.frameIndex = void 0)
  2957. }
  2958. cc.WrapMode = r, s.prototype.set = function(t) {
  2959. this.ratio = t.ratio, this.time = t.time, this.direction = t.direction, this.stopped = t.stopped, this.iterations = t.iterations, this.frameIndex = t.frameIndex
  2960. }, e.exports = {
  2961. WrapModeMask: n,
  2962. WrapMode: r,
  2963. WrappedInfo: s
  2964. }
  2965. }), {}],
  2966. 20: [(function(t, e, i) {
  2967. "use strict";
  2968. var n = t("../core/event/event-target"),
  2969. r = t("../core/platform/CCSys"),
  2970. s = t("../core/assets/CCAudioClip").LoadMode,
  2971. o = !1,
  2972. a = [],
  2973. l = function t(e) {
  2974. n.call(this), this._src = e, this._element = null, this.id = 0, this._volume = 1, this._loop = !1, this._nextTime = 0, this._state = t.State.INITIALZING, this._onended = function() {
  2975. this._state = t.State.STOPPED, this.emit("ended")
  2976. }.bind(this)
  2977. };
  2978. cc.js.extend(l, n), l.State = {
  2979. ERROR: -1,
  2980. INITIALZING: 0,
  2981. PLAYING: 1,
  2982. PAUSED: 2,
  2983. STOPPED: 3
  2984. }, (function(t) {
  2985. t._bindEnded = function(t) {
  2986. t = t || this._onended;
  2987. var e = this._element;
  2988. this._src && e instanceof HTMLAudioElement ? e.addEventListener("ended", t) : e.onended = t
  2989. }, t._unbindEnded = function() {
  2990. var t = this._element;
  2991. t instanceof HTMLAudioElement ? t.removeEventListener("ended", this._onended) : t && (t.onended = null)
  2992. }, t._onLoaded = function() {
  2993. this._createElement(), this.setVolume(this._volume), this.setLoop(this._loop), 0 !== this._nextTime && this.setCurrentTime(this._nextTime), this.getState() === l.State.PLAYING ? this.play() : this._state = l.State.INITIALZING
  2994. }, t._createElement = function() {
  2995. var t = this._src._nativeAsset;
  2996. t instanceof HTMLAudioElement ? (this._element || (this._element = document.createElement("audio")), this._element.src = t.src) : this._element = new c(t, this)
  2997. }, t.play = function() {
  2998. this._state = l.State.PLAYING, this._element && (this._bindEnded(), this._element.play(), this._touchToPlay())
  2999. }, t._touchToPlay = function() {
  3000. if (this._src && this._src.loadMode === s.DOM_AUDIO && this._element.paused && a.push({
  3001. instance: this,
  3002. offset: 0,
  3003. audio: this._element
  3004. }), !o) {
  3005. o = !0;
  3006. var t = "ontouchend" in window ? "touchend" : "mousedown";
  3007. cc.game.canvas.addEventListener(t, (function() {
  3008. for (var t = void 0; t = a.pop();) t.audio.play(t.offset)
  3009. }))
  3010. }
  3011. }, t.destroy = function() {
  3012. this._element = null
  3013. }, t.pause = function() {
  3014. this._element && this.getState() === l.State.PLAYING && (this._unbindEnded(), this._element.pause(), this._state = l.State.PAUSED)
  3015. }, t.resume = function() {
  3016. this._element && this.getState() === l.State.PAUSED && (this._bindEnded(), this._element.play(), this._state = l.State.PLAYING)
  3017. }, t.stop = function() {
  3018. if (this._element) {
  3019. this._element.pause();
  3020. try {
  3021. this._element.currentTime = 0
  3022. } catch (t) {}
  3023. for (var t = 0; t < a.length; t++)
  3024. if (a[t].instance === this) {
  3025. a.splice(t, 1);
  3026. break
  3027. }
  3028. this._unbindEnded(), this.emit("stop"), this._state = l.State.STOPPED
  3029. }
  3030. }, t.setLoop = function(t) {
  3031. this._loop = t, this._element && (this._element.loop = t)
  3032. }, t.getLoop = function() {
  3033. return this._loop
  3034. }, t.setVolume = function(t) {
  3035. this._volume = t, this._element && (this._element.volume = t)
  3036. }, t.getVolume = function() {
  3037. return this._volume
  3038. }, t.setCurrentTime = function(t) {
  3039. if (this._element) {
  3040. this._nextTime = 0, this._unbindEnded(), this._bindEnded(function() {
  3041. this._bindEnded()
  3042. }.bind(this));
  3043. try {
  3044. this._element.currentTime = t
  3045. } catch (i) {
  3046. var e = this._element;
  3047. if (e.addEventListener) {
  3048. e.addEventListener("loadedmetadata", (function i() {
  3049. e.removeEventListener("loadedmetadata", i), e.currentTime = t
  3050. }))
  3051. }
  3052. }
  3053. } else this._nextTime = t
  3054. }, t.getCurrentTime = function() {
  3055. return this._element ? this._element.currentTime : 0
  3056. }, t.getDuration = function() {
  3057. return this._element ? this._element.duration : 0
  3058. }, t.getState = function() {
  3059. return this._forceUpdatingState(), this._state
  3060. }, t._forceUpdatingState = function() {
  3061. var t = this._element;
  3062. t && (l.State.PLAYING === this._state && t.paused ? this._state = l.State.STOPPED : l.State.STOPPED !== this._state || t.paused || (this._state = l.State.PLAYING))
  3063. }, Object.defineProperty(t, "src", {
  3064. get: function() {
  3065. return this._src
  3066. },
  3067. set: function(t) {
  3068. if (this._unbindEnded(), t)
  3069. if (this._src = t, t.loaded) this._onLoaded();
  3070. else {
  3071. var e = this;
  3072. t.once("load", (function() {
  3073. t === e._src && e._onLoaded()
  3074. })), cc.loader.load({
  3075. url: t.nativeUrl,
  3076. skips: ["Loader"]
  3077. }, (function(e, i) {
  3078. e ? cc.error(e) : t.loaded || (t._nativeAsset = i)
  3079. }))
  3080. }
  3081. else this._src = null, this._element instanceof HTMLAudioElement ? this._element.src = "" : this._element = null, this._state = l.State.INITIALZING;
  3082. return t
  3083. },
  3084. enumerable: !0,
  3085. configurable: !0
  3086. }), Object.defineProperty(t, "paused", {
  3087. get: function() {
  3088. return !this._element || this._element.paused
  3089. },
  3090. enumerable: !0,
  3091. configurable: !0
  3092. })
  3093. })(l.prototype);
  3094. var h = void 0;
  3095. h = cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE || cc.sys.browserType === cc.sys.BROWSER_TYPE_BAIDU || cc.sys.browserType === cc.sys.BROWSER_TYPE_UC ? .01 : 0;
  3096. var c = function(t, e) {
  3097. this._audio = e, this._context = r.__audioSupport.context, this._buffer = t, this._gainObj = this._context.createGain(), this.volume = 1, this._gainObj.connect(this._context.destination), this._loop = !1, this._startTime = -1, this._currentSource = null, this.playedLength = 0, this._currentTimer = null, this._endCallback = function() {
  3098. this.onended && this.onended(this)
  3099. }.bind(this)
  3100. };
  3101. (function(t) {
  3102. t.play = function(t) {
  3103. this._currentSource && !this.paused && (this._currentSource.onended = null, this._currentSource.stop(0), this.playedLength = 0);
  3104. var e = this._context.createBufferSource();
  3105. e.buffer = this._buffer, e.connect(this._gainObj), e.loop = this._loop, this._startTime = this._context.currentTime, (t = t || this.playedLength) && (this._startTime -= t);
  3106. var i = this._buffer.duration,
  3107. n = t,
  3108. r = void 0;
  3109. if (this._loop ? e.start ? e.start(0, n) : e.notoGrainOn ? e.noteGrainOn(0, n) : e.noteOn(0, n) : (r = i - t, e.start ? e.start(0, n, r) : e.noteGrainOn ? e.noteGrainOn(0, n, r) : e.noteOn(0, n, r)), this._currentSource = e, e.onended = this._endCallback, (!e.context.state || "suspended" === e.context.state) && 0 === this._context.currentTime) {
  3110. var s = this;
  3111. clearTimeout(this._currentTimer), this._currentTimer = setTimeout((function() {
  3112. 0 === s._context.currentTime && a.push({
  3113. instance: s._audio,
  3114. offset: t,
  3115. audio: s
  3116. })
  3117. }), 10)
  3118. }
  3119. }, t.pause = function() {
  3120. if (clearTimeout(this._currentTimer), !this.paused) {
  3121. this.playedLength = this._context.currentTime - this._startTime, this.playedLength %= this._buffer.duration;
  3122. var t = this._currentSource;
  3123. this._currentSource = null, this._startTime = -1, t && t.stop(0)
  3124. }
  3125. }, Object.defineProperty(t, "paused", {
  3126. get: function() {
  3127. return (!this._currentSource || !this._currentSource.loop) && (-1 === this._startTime || this._context.currentTime - this._startTime > this._buffer.duration)
  3128. },
  3129. enumerable: !0,
  3130. configurable: !0
  3131. }), Object.defineProperty(t, "loop", {
  3132. get: function() {
  3133. return this._loop
  3134. },
  3135. set: function(t) {
  3136. return this._currentSource && (this._currentSource.loop = t), this._loop = t
  3137. },
  3138. enumerable: !0,
  3139. configurable: !0
  3140. }), Object.defineProperty(t, "volume", {
  3141. get: function() {
  3142. return this._volume
  3143. },
  3144. set: function(t) {
  3145. if (this._volume = t, this._gainObj.gain.setTargetAtTime) try {
  3146. this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, h)
  3147. } catch (e) {
  3148. this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, .01)
  3149. } else this._gainObj.gain.value = t;
  3150. r.os === r.OS_IOS && !this.paused && this._currentSource && (this._currentSource.onended = null, this.pause(), this.play())
  3151. },
  3152. enumerable: !0,
  3153. configurable: !0
  3154. }), Object.defineProperty(t, "currentTime", {
  3155. get: function() {
  3156. return this.paused ? this.playedLength : (this.playedLength = this._context.currentTime - this._startTime, this.playedLength %= this._buffer.duration, this.playedLength)
  3157. },
  3158. set: function(t) {
  3159. return this.paused ? this.playedLength = t : (this.pause(), this.playedLength = t, this.play()), t
  3160. },
  3161. enumerable: !0,
  3162. configurable: !0
  3163. }), Object.defineProperty(t, "duration", {
  3164. get: function() {
  3165. return this._buffer.duration
  3166. },
  3167. enumerable: !0,
  3168. configurable: !0
  3169. })
  3170. })(c.prototype), e.exports = cc.Audio = l
  3171. }), {
  3172. "../core/assets/CCAudioClip": 57,
  3173. "../core/event/event-target": 131,
  3174. "../core/platform/CCSys": 207
  3175. }],
  3176. 21: [(function(t, e, i) {
  3177. "use strict";
  3178. var n = t("./CCAudio"),
  3179. r = t("../core/assets/CCAudioClip"),
  3180. s = cc.js,
  3181. o = 0,
  3182. a = s.createMap(!0),
  3183. l = {},
  3184. h = [],
  3185. c = function(t) {
  3186. t._finishCallback = null, t.off("ended"), t.off("stop"), t.src = null, h.includes(t) || (h.length < 32 ? h.push(t) : t.destroy())
  3187. },
  3188. u = function(t) {
  3189. var e = o++,
  3190. i = l[t];
  3191. if (i || (i = l[t] = []), d._maxAudioInstance <= i.length) {
  3192. var r = i.shift();
  3193. _(r).stop()
  3194. }
  3195. var s = h.pop() || new n,
  3196. u = function() {
  3197. if (_(this.id)) {
  3198. delete a[this.id];
  3199. var t = i.indexOf(this.id);
  3200. cc.js.array.fastRemoveAt(i, t)
  3201. }
  3202. c(this)
  3203. };
  3204. return s.on("ended", (function() {
  3205. this._finishCallback && this._finishCallback(), u.call(this)
  3206. }), s), s.on("stop", u, s), s.id = e, a[e] = s, i.push(e), s
  3207. },
  3208. _ = function(t) {
  3209. return a[t]
  3210. },
  3211. f = function(t) {
  3212. return void 0 === t ? t = 1 : "string" == typeof t && (t = Number.parseFloat(t)), t
  3213. },
  3214. d = {
  3215. AudioState: n.State,
  3216. _maxWebAudioSize: 2097152,
  3217. _maxAudioInstance: 24,
  3218. _id2audio: a,
  3219. play: function(t, e, i) {
  3220. var n, s = t;
  3221. if ("string" == typeof t) cc.warnID(8401, "cc.audioEngine", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio"), n = u(s = t), r._loadByUrl(s, (function(t, e) {
  3222. e && (n.src = e)
  3223. }));
  3224. else {
  3225. if (!t) return;
  3226. s = t.nativeUrl, (n = u(s)).src = t
  3227. }
  3228. return n.setLoop(e || !1), i = f(i), n.setVolume(i), n.play(), n.id
  3229. },
  3230. setLoop: function(t, e) {
  3231. var i = _(t);
  3232. i && i.setLoop && i.setLoop(e)
  3233. },
  3234. isLoop: function(t) {
  3235. var e = _(t);
  3236. return !(!e || !e.getLoop) && e.getLoop()
  3237. },
  3238. setVolume: function(t, e) {
  3239. var i = _(t);
  3240. i && i.setVolume(e)
  3241. },
  3242. getVolume: function(t) {
  3243. var e = _(t);
  3244. return e ? e.getVolume() : 1
  3245. },
  3246. setCurrentTime: function(t, e) {
  3247. var i = _(t);
  3248. return !!i && (i.setCurrentTime(e), !0)
  3249. },
  3250. getCurrentTime: function(t) {
  3251. var e = _(t);
  3252. return e ? e.getCurrentTime() : 0
  3253. },
  3254. getDuration: function(t) {
  3255. var e = _(t);
  3256. return e ? e.getDuration() : 0
  3257. },
  3258. getState: function(t) {
  3259. var e = _(t);
  3260. return e ? e.getState() : this.AudioState.ERROR
  3261. },
  3262. setFinishCallback: function(t, e) {
  3263. var i = _(t);
  3264. i && (i._finishCallback = e)
  3265. },
  3266. pause: function(t) {
  3267. var e = _(t);
  3268. return !!e && (e.pause(), !0)
  3269. },
  3270. _pauseIDCache: [],
  3271. pauseAll: function() {
  3272. for (var t in a) {
  3273. var e = a[t];
  3274. e.getState() === n.State.PLAYING && (this._pauseIDCache.push(t), e.pause())
  3275. }
  3276. },
  3277. resume: function(t) {
  3278. var e = _(t);
  3279. e && e.resume()
  3280. },
  3281. resumeAll: function() {
  3282. for (var t = 0; t < this._pauseIDCache.length; ++t) {
  3283. var e = this._pauseIDCache[t],
  3284. i = _(e);
  3285. i && i.resume()
  3286. }
  3287. this._pauseIDCache.length = 0
  3288. },
  3289. stop: function(t) {
  3290. var e = _(t);
  3291. return !!e && (e.stop(), !0)
  3292. },
  3293. stopAll: function() {
  3294. for (var t in a) {
  3295. var e = a[t];
  3296. e && e.stop()
  3297. }
  3298. },
  3299. setMaxAudioInstance: function(t) {
  3300. this._maxAudioInstance = t
  3301. },
  3302. getMaxAudioInstance: function() {
  3303. return this._maxAudioInstance
  3304. },
  3305. uncache: function(t) {
  3306. var e = t;
  3307. if ("string" == typeof t) cc.warnID(8401, "cc.audioEngine", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio"), e = t;
  3308. else {
  3309. if (!t) return;
  3310. e = t.nativeUrl
  3311. }
  3312. var i = l[e];
  3313. if (i)
  3314. for (; i.length > 0;) {
  3315. var n = i.pop(),
  3316. r = a[n];
  3317. r && (r.stop(), delete a[n])
  3318. }
  3319. },
  3320. uncacheAll: function() {
  3321. this.stopAll();
  3322. var t = void 0;
  3323. for (var e in a)(t = a[e]) && t.destroy();
  3324. for (; t = h.pop();) t.destroy();
  3325. a = s.createMap(!0), l = {}
  3326. },
  3327. getProfile: function(t) {},
  3328. preload: function(t, e) {
  3329. cc.loader.load(t, e && function(t) {
  3330. t || e()
  3331. })
  3332. },
  3333. setMaxWebAudioSize: function(t) {
  3334. this._maxWebAudioSize = 1024 * t
  3335. },
  3336. _breakCache: null,
  3337. _break: function() {
  3338. for (var t in this._breakCache = [], a) {
  3339. var e = a[t];
  3340. e.getState() === n.State.PLAYING && (this._breakCache.push(t), e.pause())
  3341. }
  3342. },
  3343. _restore: function() {
  3344. if (this._breakCache) {
  3345. for (; this._breakCache.length > 0;) {
  3346. var t = this._breakCache.pop(),
  3347. e = _(t);
  3348. e && e.resume && e.resume()
  3349. }
  3350. this._breakCache = null
  3351. }
  3352. },
  3353. _music: {
  3354. id: -1,
  3355. loop: !1,
  3356. volume: 1
  3357. },
  3358. _effect: {
  3359. volume: 1,
  3360. pauseCache: []
  3361. },
  3362. playMusic: function(t, e) {
  3363. var i = this._music;
  3364. return this.stop(i.id), i.id = this.play(t, e, i.volume), i.loop = e, i.id
  3365. },
  3366. stopMusic: function() {
  3367. this.stop(this._music.id)
  3368. },
  3369. pauseMusic: function() {
  3370. return this.pause(this._music.id), this._music.id
  3371. },
  3372. resumeMusic: function() {
  3373. return this.resume(this._music.id), this._music.id
  3374. },
  3375. getMusicVolume: function() {
  3376. return this._music.volume
  3377. },
  3378. setMusicVolume: function(t) {
  3379. t = f(t);
  3380. var e = this._music;
  3381. return e.volume = t, this.setVolume(e.id, e.volume), e.volume
  3382. },
  3383. isMusicPlaying: function() {
  3384. return this.getState(this._music.id) === this.AudioState.PLAYING
  3385. },
  3386. playEffect: function(t, e) {
  3387. return this.play(t, e || !1, this._effect.volume)
  3388. },
  3389. setEffectsVolume: function(t) {
  3390. t = f(t);
  3391. var e = this._music.id;
  3392. for (var i in this._effect.volume = t, a) {
  3393. var n = a[i];
  3394. n && n.id !== e && d.setVolume(i, t)
  3395. }
  3396. },
  3397. getEffectsVolume: function() {
  3398. return this._effect.volume
  3399. },
  3400. pauseEffect: function(t) {
  3401. return this.pause(t)
  3402. },
  3403. pauseAllEffects: function() {
  3404. var t = this._music.id,
  3405. e = this._effect;
  3406. for (var i in e.pauseCache.length = 0, a) {
  3407. var n = a[i];
  3408. if (n && n.id !== t) n.getState() === this.AudioState.PLAYING && (e.pauseCache.push(i), n.pause())
  3409. }
  3410. },
  3411. resumeEffect: function(t) {
  3412. this.resume(t)
  3413. },
  3414. resumeAllEffects: function() {
  3415. for (var t = this._effect.pauseCache, e = 0; e < t.length; ++e) {
  3416. var i = t[e],
  3417. n = a[i];
  3418. n && n.resume()
  3419. }
  3420. },
  3421. stopEffect: function(t) {
  3422. return this.stop(t)
  3423. },
  3424. stopAllEffects: function() {
  3425. var t = this._music.id;
  3426. for (var e in a) {
  3427. var i = a[e];
  3428. if (i && i.id !== t) i.getState() === d.AudioState.PLAYING && i.stop()
  3429. }
  3430. }
  3431. };
  3432. e.exports = cc.audioEngine = d
  3433. }), {
  3434. "../core/assets/CCAudioClip": 57,
  3435. "./CCAudio": 20
  3436. }],
  3437. 22: [(function(t, e, i) {
  3438. "use strict";
  3439. var n = {
  3440. name: "Jacob__Codec"
  3441. };
  3442. n.Base64 = t("./base64"), n.GZip = t("./gzip"), n.unzip = function() {
  3443. return n.GZip.gunzip.apply(n.GZip, arguments)
  3444. }, n.unzipBase64 = function() {
  3445. var t = n.Base64.decode.apply(n.Base64, arguments);
  3446. try {
  3447. return n.GZip.gunzip.call(n.GZip, t)
  3448. } catch (e) {
  3449. return t.slice(7)
  3450. }
  3451. }, n.unzipBase64AsArray = function(t, e) {
  3452. e = e || 1;
  3453. var i, n, r, s = this.unzipBase64(t),
  3454. o = [];
  3455. for (i = 0, r = s.length / e; i < r; i++)
  3456. for (o[i] = 0, n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
  3457. return o
  3458. }, n.unzipAsArray = function(t, e) {
  3459. e = e || 1;
  3460. var i, n, r, s = this.unzip(t),
  3461. o = [];
  3462. for (i = 0, r = s.length / e; i < r; i++)
  3463. for (o[i] = 0, n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
  3464. return o
  3465. }, cc.codec = e.exports = n
  3466. }), {
  3467. "./base64": 23,
  3468. "./gzip": 24
  3469. }],
  3470. 23: [(function(t, e, i) {
  3471. "use strict";
  3472. var n = t("../core/utils/misc").BASE64_VALUES,
  3473. r = {
  3474. name: "Jacob__Codec__Base64",
  3475. decode: function(t) {
  3476. var e, i, r, s, o, a, l = [],
  3477. h = 0;
  3478. for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); h < t.length;) e = n[t.charCodeAt(h++)] << 2 | (s = n[t.charCodeAt(h++)]) >> 4, i = (15 & s) << 4 | (o = n[t.charCodeAt(h++)]) >> 2, r = (3 & o) << 6 | (a = n[t.charCodeAt(h++)]), l.push(String.fromCharCode(e)), 64 !== o && l.push(String.fromCharCode(i)), 64 !== a && l.push(String.fromCharCode(r));
  3479. return l = l.join("")
  3480. },
  3481. decodeAsArray: function(t, e) {
  3482. var i, n, r, s = this.decode(t),
  3483. o = [];
  3484. for (i = 0, r = s.length / e; i < r; i++)
  3485. for (o[i] = 0, n = e - 1; n >= 0; --n) o[i] += s.charCodeAt(i * e + n) << 8 * n;
  3486. return o
  3487. }
  3488. };
  3489. e.exports = r
  3490. }), {
  3491. "../core/utils/misc": 300
  3492. }],
  3493. 24: [(function(t, e, i) {
  3494. "use strict";
  3495. var n = function(t) {
  3496. this.data = t, this.debug = !1, this.gpflags = void 0, this.files = 0, this.unzipped = [], this.buf32k = new Array(32768), this.bIdx = 0, this.modeZIP = !1, this.bytepos = 0, this.bb = 1, this.bits = 0, this.nameBuf = [], this.fileout = void 0, this.literalTree = new Array(n.LITERALS), this.distanceTree = new Array(32), this.treepos = 0, this.Places = null, this.len = 0, this.fpos = new Array(17), this.fpos[0] = 0, this.flens = void 0, this.fmax = void 0
  3497. };
  3498. n.gunzip = function(t) {
  3499. return t.constructor === Array || (t.constructor, String), new n(t).gunzip()[0][0]
  3500. }, n.HufNode = function() {
  3501. this.b0 = 0, this.b1 = 0, this.jump = null, this.jumppos = -1
  3502. }, n.LITERALS = 288, n.NAMEMAX = 256, n.bitReverse = [0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255], n.cplens = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], n.cplext = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99], n.cpdist = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], n.cpdext = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], n.border = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], n.prototype.gunzip = function() {
  3503. return this.outputArr = [], this.nextFile(), this.unzipped
  3504. }, n.prototype.readByte = function() {
  3505. return this.bits += 8, this.bytepos < this.data.length ? this.data.charCodeAt(this.bytepos++) : -1
  3506. }, n.prototype.byteAlign = function() {
  3507. this.bb = 1
  3508. }, n.prototype.readBit = function() {
  3509. var t;
  3510. return this.bits++, t = 1 & this.bb, this.bb >>= 1, 0 === this.bb && (this.bb = this.readByte(), t = 1 & this.bb, this.bb = this.bb >> 1 | 128), t
  3511. }, n.prototype.readBits = function(t) {
  3512. for (var e = 0, i = t; i--;) e = e << 1 | this.readBit();
  3513. return t && (e = n.bitReverse[e] >> 8 - t), e
  3514. }, n.prototype.flushBuffer = function() {
  3515. this.bIdx = 0
  3516. }, n.prototype.addBuffer = function(t) {
  3517. this.buf32k[this.bIdx++] = t, this.outputArr.push(String.fromCharCode(t)), 32768 === this.bIdx && (this.bIdx = 0)
  3518. }, n.prototype.IsPat = function() {
  3519. for (;;) {
  3520. if (this.fpos[this.len] >= this.fmax) return -1;
  3521. if (this.flens[this.fpos[this.len]] === this.len) return this.fpos[this.len]++;
  3522. this.fpos[this.len]++
  3523. }
  3524. }, n.prototype.Rec = function() {
  3525. var t, e = this.Places[this.treepos];
  3526. if (17 === this.len) return -1;
  3527. if (this.treepos++, this.len++, (t = this.IsPat()) >= 0) e.b0 = t;
  3528. else if (e.b0 = 32768, this.Rec()) return -1;
  3529. if ((t = this.IsPat()) >= 0) e.b1 = t, e.jump = null;
  3530. else if (e.b1 = 32768, e.jump = this.Places[this.treepos], e.jumppos = this.treepos, this.Rec()) return -1;
  3531. return this.len--, 0
  3532. }, n.prototype.CreateTree = function(t, e, i, n) {
  3533. var r;
  3534. for (this.Places = t, this.treepos = 0, this.flens = i, this.fmax = e, r = 0; r < 17; r++) this.fpos[r] = 0;
  3535. return this.len = 0, this.Rec() ? -1 : 0
  3536. }, n.prototype.DecodeValue = function(t) {
  3537. for (var e, i, n = 0, r = t[n];;)
  3538. if (this.readBit()) {
  3539. if (!(32768 & r.b1)) return r.b1;
  3540. for (r = r.jump, e = t.length, i = 0; i < e; i++)
  3541. if (t[i] === r) {
  3542. n = i;
  3543. break
  3544. }
  3545. } else {
  3546. if (!(32768 & r.b0)) return r.b0;
  3547. r = t[++n]
  3548. }
  3549. return -1
  3550. }, n.prototype.DeflateLoop = function() {
  3551. var t, e, i;
  3552. do {
  3553. var r, s;
  3554. if (t = this.readBit(), 0 === (e = this.readBits(2)))
  3555. for (this.byteAlign(), r = this.readByte(), r |= this.readByte() << 8, s = this.readByte(), 65535 & (r ^ ~(s |= this.readByte() << 8)) && document.write("BlockLen checksum mismatch\n"); r--;) o = this.readByte(), this.addBuffer(o);
  3556. else if (1 === e)
  3557. for (;;)
  3558. if ((a = n.bitReverse[this.readBits(7)] >> 1) > 23 ? (a = a << 1 | this.readBit()) > 199 ? a = (a -= 128) << 1 | this.readBit() : (a -= 48) > 143 && (a += 136) : a += 256, a < 256) this.addBuffer(a);
  3559. else {
  3560. if (256 === a) break;
  3561. for (a -= 257, p = this.readBits(n.cplext[a]) + n.cplens[a], a = n.bitReverse[this.readBits(5)] >> 3, n.cpdext[a] > 8 ? (m = this.readBits(8), m |= this.readBits(n.cpdext[a] - 8) << 8) : m = this.readBits(n.cpdext[a]), m += n.cpdist[a], a = 0; a < p; a++) {
  3562. var o = this.buf32k[this.bIdx - m & 32767];
  3563. this.addBuffer(o)
  3564. }
  3565. }
  3566. else if (2 === e) {
  3567. var a, l, h, c, u, _ = new Array(320);
  3568. for (h = 257 + this.readBits(5), c = 1 + this.readBits(5), u = 4 + this.readBits(4), a = 0; a < 19; a++) _[a] = 0;
  3569. for (a = 0; a < u; a++) _[n.border[a]] = this.readBits(3);
  3570. for (p = this.distanceTree.length, i = 0; i < p; i++) this.distanceTree[i] = new n.HufNode;
  3571. if (this.CreateTree(this.distanceTree, 19, _, 0)) return this.flushBuffer(), 1;
  3572. l = h + c, i = 0;
  3573. for (; i < l;)
  3574. if (0, (a = this.DecodeValue(this.distanceTree)) < 16) _[i++] = a;
  3575. else if (16 === a) {
  3576. var f;
  3577. if (i + (a = 3 + this.readBits(2)) > l) return this.flushBuffer(), 1;
  3578. for (f = i ? _[i - 1] : 0; a--;) _[i++] = f
  3579. } else {
  3580. if (i + (a = 17 === a ? 3 + this.readBits(3) : 11 + this.readBits(7)) > l) return this.flushBuffer(), 1;
  3581. for (; a--;) _[i++] = 0
  3582. }
  3583. for (p = this.literalTree.length, i = 0; i < p; i++) this.literalTree[i] = new n.HufNode;
  3584. if (this.CreateTree(this.literalTree, h, _, 0)) return this.flushBuffer(), 1;
  3585. for (p = this.literalTree.length, i = 0; i < p; i++) this.distanceTree[i] = new n.HufNode;
  3586. var d = new Array;
  3587. for (i = h; i < _.length; i++) d[i - h] = _[i];
  3588. if (this.CreateTree(this.distanceTree, c, d, 0)) return this.flushBuffer(), 1;
  3589. for (;;)
  3590. if ((a = this.DecodeValue(this.literalTree)) >= 256) {
  3591. var p, m;
  3592. if (0 === (a -= 256)) break;
  3593. for (a--, p = this.readBits(n.cplext[a]) + n.cplens[a], a = this.DecodeValue(this.distanceTree), n.cpdext[a] > 8 ? (m = this.readBits(8), m |= this.readBits(n.cpdext[a] - 8) << 8) : m = this.readBits(n.cpdext[a]), m += n.cpdist[a]; p--;) {
  3594. o = this.buf32k[this.bIdx - m & 32767];
  3595. this.addBuffer(o)
  3596. }
  3597. } else this.addBuffer(a)
  3598. }
  3599. } while (!t);
  3600. return this.flushBuffer(), this.byteAlign(), 0
  3601. }, n.prototype.unzipFile = function(t) {
  3602. var e;
  3603. for (this.gunzip(), e = 0; e < this.unzipped.length; e++)
  3604. if (this.unzipped[e][1] === t) return this.unzipped[e][0]
  3605. }, n.prototype.nextFile = function() {
  3606. this.outputArr = [], this.modeZIP = !1;
  3607. var t = [];
  3608. if (t[0] = this.readByte(), t[1] = this.readByte(), 120 === t[0] && 218 === t[1] && (this.DeflateLoop(), this.unzipped[this.files] = [this.outputArr.join(""), "geonext.gxt"], this.files++), 31 === t[0] && 139 === t[1] && (this.skipdir(), this.unzipped[this.files] = [this.outputArr.join(""), "file"], this.files++), 80 === t[0] && 75 === t[1] && (this.modeZIP = !0, t[2] = this.readByte(), t[3] = this.readByte(), 3 === t[2] && 4 === t[3])) {
  3609. t[0] = this.readByte(), t[1] = this.readByte(), this.gpflags = this.readByte(), this.gpflags |= this.readByte() << 8;
  3610. var e = this.readByte();
  3611. e |= this.readByte() << 8, this.readByte(), this.readByte(), this.readByte(), this.readByte();
  3612. this.readByte();
  3613. this.readByte() << 8, this.readByte() << 16, this.readByte() << 24;
  3614. this.readByte();
  3615. this.readByte() << 8, this.readByte() << 16, this.readByte() << 24;
  3616. var i = this.readByte();
  3617. i |= this.readByte() << 8;
  3618. var r = this.readByte();
  3619. for (r |= this.readByte() << 8, o = 0, this.nameBuf = []; i--;) {
  3620. var s = this.readByte();
  3621. "/" === s | ":" === s ? o = 0 : o < n.NAMEMAX - 1 && (this.nameBuf[o++] = String.fromCharCode(s))
  3622. }
  3623. this.fileout || (this.fileout = this.nameBuf);
  3624. for (var o = 0; o < r;) s = this.readByte(), o++;
  3625. 8 === e && (this.DeflateLoop(), this.unzipped[this.files] = [this.outputArr.join(""), this.nameBuf.join("")], this.files++), this.skipdir()
  3626. }
  3627. }, n.prototype.skipdir = function() {
  3628. var t, e, i = [];
  3629. if (8 & this.gpflags && (i[0] = this.readByte(), i[1] = this.readByte(), i[2] = this.readByte(), i[3] = this.readByte(), this.readByte(), this.readByte() << 8, this.readByte() << 16, this.readByte() << 24, this.readByte(), this.readByte() << 8, this.readByte() << 16, this.readByte() << 24), this.modeZIP && this.nextFile(), i[0] = this.readByte(), 8 !== i[0]) return 0;
  3630. if (this.gpflags = this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), 4 & this.gpflags)
  3631. for (i[0] = this.readByte(), i[2] = this.readByte(), this.len = i[0] + 256 * i[1], t = 0; t < this.len; t++) this.readByte();
  3632. if (8 & this.gpflags)
  3633. for (t = 0, this.nameBuf = []; e = this.readByte();) "7" !== e && ":" !== e || (t = 0), t < n.NAMEMAX - 1 && (this.nameBuf[t++] = e);
  3634. if (16 & this.gpflags)
  3635. for (; e = this.readByte(););
  3636. 2 & this.gpflags && (this.readByte(), this.readByte()), this.DeflateLoop(), this.readByte(), this.readByte(), this.readByte(), this.readByte(), this.modeZIP && this.nextFile()
  3637. }, e.exports = n
  3638. }), {}],
  3639. 25: [(function(t, e, i) {
  3640. "use strict";
  3641. (function() {
  3642. function t(t) {
  3643. throw t
  3644. }
  3645. var e = void 0,
  3646. i = !0,
  3647. n = this;
  3648. function r(t, i) {
  3649. var r, s = t.split("."),
  3650. o = n;
  3651. !(s[0] in o) && o.execScript && o.execScript("var " + s[0]);
  3652. for (; s.length && (r = s.shift());) s.length || i === e ? o = o[r] ? o[r] : o[r] = {} : o[r] = i
  3653. }
  3654. var s = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array;
  3655. function o(t) {
  3656. if ("string" == typeof t) {
  3657. var e, i, n = t.split("");
  3658. for (e = 0, i = n.length; e < i; e++) n[e] = (255 & n[e].charCodeAt(0)) >>> 0;
  3659. t = n
  3660. }
  3661. for (var r, s = 1, o = 0, a = t.length, l = 0; 0 < a;) {
  3662. a -= r = 1024 < a ? 1024 : a;
  3663. do {
  3664. o += s += t[l++]
  3665. } while (--r);
  3666. s %= 65521, o %= 65521
  3667. }
  3668. return (o << 16 | s) >>> 0
  3669. }
  3670. function a(e, i) {
  3671. this.index = "number" == typeof i ? i : 0, this.i = 0, this.buffer = e instanceof(s ? Uint8Array : Array) ? e : new(s ? Uint8Array : Array)(32768), 2 * this.buffer.length <= this.index && t(Error("invalid index")), this.buffer.length <= this.index && this.f()
  3672. }
  3673. a.prototype.f = function() {
  3674. var t, e = this.buffer,
  3675. i = e.length,
  3676. n = new(s ? Uint8Array : Array)(i << 1);
  3677. if (s) n.set(e);
  3678. else
  3679. for (t = 0; t < i; ++t) n[t] = e[t];
  3680. return this.buffer = n
  3681. }, a.prototype.d = function(t, e, i) {
  3682. var n, r = this.buffer,
  3683. s = this.index,
  3684. o = this.i,
  3685. a = r[s];
  3686. if (i && 1 < e && (t = 8 < e ? (f[255 & t] << 24 | f[t >>> 8 & 255] << 16 | f[t >>> 16 & 255] << 8 | f[t >>> 24 & 255]) >> 32 - e : f[t] >> 8 - e), 8 > e + o) a = a << e | t, o += e;
  3687. else
  3688. for (n = 0; n < e; ++n) a = a << 1 | t >> e - n - 1 & 1, 8 == ++o && (o = 0, r[s++] = f[a], a = 0, s === r.length && (r = this.f()));
  3689. r[s] = a, this.buffer = r, this.i = o, this.index = s
  3690. }, a.prototype.finish = function() {
  3691. var t, e = this.buffer,
  3692. i = this.index;
  3693. return 0 < this.i && (e[i] <<= 8 - this.i, e[i] = f[e[i]], i++), s ? t = e.subarray(0, i) : (e.length = i, t = e), t
  3694. };
  3695. var l, h = new(s ? Uint8Array : Array)(256);
  3696. for (l = 0; 256 > l; ++l) {
  3697. for (var c = _ = l, u = 7, _ = _ >>> 1; _; _ >>>= 1) c <<= 1, c |= 1 & _, --u;
  3698. h[l] = (c << u & 255) >>> 0
  3699. }
  3700. var f = h;
  3701. function d(t) {
  3702. this.buffer = new(s ? Uint16Array : Array)(2 * t), this.length = 0
  3703. }
  3704. function p(t) {
  3705. var e, i, n, r, o, a, l, h, c, u = t.length,
  3706. _ = 0,
  3707. f = Number.POSITIVE_INFINITY;
  3708. for (h = 0; h < u; ++h) t[h] > _ && (_ = t[h]), t[h] < f && (f = t[h]);
  3709. for (e = 1 << _, i = new(s ? Uint32Array : Array)(e), n = 1, r = 0, o = 2; n <= _;) {
  3710. for (h = 0; h < u; ++h)
  3711. if (t[h] === n) {
  3712. for (a = 0, l = r, c = 0; c < n; ++c) a = a << 1 | 1 & l, l >>= 1;
  3713. for (c = a; c < e; c += o) i[c] = n << 16 | h;
  3714. ++r
  3715. }++n, r <<= 1, o <<= 1
  3716. }
  3717. return [i, _, f]
  3718. }
  3719. function m(t, e) {
  3720. this.h = v, this.w = 0, this.input = t, this.b = 0, e && (e.lazy && (this.w = e.lazy), "number" == typeof e.compressionType && (this.h = e.compressionType), e.outputBuffer && (this.a = s && e.outputBuffer instanceof Array ? new Uint8Array(e.outputBuffer) : e.outputBuffer), "number" == typeof e.outputIndex && (this.b = e.outputIndex)), this.a || (this.a = new(s ? Uint8Array : Array)(32768))
  3721. }
  3722. s && new Uint32Array([0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117]), d.prototype.getParent = function(t) {
  3723. return 2 * ((t - 2) / 4 | 0)
  3724. }, d.prototype.push = function(t, e) {
  3725. var i, n, r, s = this.buffer;
  3726. for (i = this.length, s[this.length++] = e, s[this.length++] = t; 0 < i && (n = this.getParent(i), s[i] > s[n]);) r = s[i], s[i] = s[n], s[n] = r, r = s[i + 1], s[i + 1] = s[n + 1], s[n + 1] = r, i = n;
  3727. return this.length
  3728. }, d.prototype.pop = function() {
  3729. var t, e, i, n, r, s = this.buffer;
  3730. for (e = s[0], t = s[1], this.length -= 2, s[0] = s[this.length], s[1] = s[this.length + 1], r = 0; !((n = 2 * r + 2) >= this.length) && (n + 2 < this.length && s[n + 2] > s[n] && (n += 2), s[n] > s[r]);) i = s[r], s[r] = s[n], s[n] = i, i = s[r + 1], s[r + 1] = s[n + 1], s[n + 1] = i, r = n;
  3731. return {
  3732. index: t,
  3733. value: e,
  3734. length: this.length
  3735. }
  3736. };
  3737. var y, v = 2,
  3738. g = {
  3739. NONE: 0,
  3740. r: 1,
  3741. j: v,
  3742. N: 3
  3743. },
  3744. x = [];
  3745. for (y = 0; 288 > y; y++) switch (i) {
  3746. case 143 >= y:
  3747. x.push([y + 48, 8]);
  3748. break;
  3749. case 255 >= y:
  3750. x.push([y - 144 + 400, 9]);
  3751. break;
  3752. case 279 >= y:
  3753. x.push([y - 256 + 0, 7]);
  3754. break;
  3755. case 287 >= y:
  3756. x.push([y - 280 + 192, 8]);
  3757. break;
  3758. default:
  3759. t("invalid literal: " + y)
  3760. }
  3761. function b(t, e) {
  3762. this.length = t, this.G = e
  3763. }
  3764. function A() {
  3765. var e = C;
  3766. switch (i) {
  3767. case 3 === e:
  3768. return [257, e - 3, 0];
  3769. case 4 === e:
  3770. return [258, e - 4, 0];
  3771. case 5 === e:
  3772. return [259, e - 5, 0];
  3773. case 6 === e:
  3774. return [260, e - 6, 0];
  3775. case 7 === e:
  3776. return [261, e - 7, 0];
  3777. case 8 === e:
  3778. return [262, e - 8, 0];
  3779. case 9 === e:
  3780. return [263, e - 9, 0];
  3781. case 10 === e:
  3782. return [264, e - 10, 0];
  3783. case 12 >= e:
  3784. return [265, e - 11, 1];
  3785. case 14 >= e:
  3786. return [266, e - 13, 1];
  3787. case 16 >= e:
  3788. return [267, e - 15, 1];
  3789. case 18 >= e:
  3790. return [268, e - 17, 1];
  3791. case 22 >= e:
  3792. return [269, e - 19, 2];
  3793. case 26 >= e:
  3794. return [270, e - 23, 2];
  3795. case 30 >= e:
  3796. return [271, e - 27, 2];
  3797. case 34 >= e:
  3798. return [272, e - 31, 2];
  3799. case 42 >= e:
  3800. return [273, e - 35, 3];
  3801. case 50 >= e:
  3802. return [274, e - 43, 3];
  3803. case 58 >= e:
  3804. return [275, e - 51, 3];
  3805. case 66 >= e:
  3806. return [276, e - 59, 3];
  3807. case 82 >= e:
  3808. return [277, e - 67, 4];
  3809. case 98 >= e:
  3810. return [278, e - 83, 4];
  3811. case 114 >= e:
  3812. return [279, e - 99, 4];
  3813. case 130 >= e:
  3814. return [280, e - 115, 4];
  3815. case 162 >= e:
  3816. return [281, e - 131, 5];
  3817. case 194 >= e:
  3818. return [282, e - 163, 5];
  3819. case 226 >= e:
  3820. return [283, e - 195, 5];
  3821. case 257 >= e:
  3822. return [284, e - 227, 5];
  3823. case 258 === e:
  3824. return [285, e - 258, 0];
  3825. default:
  3826. t("invalid length: " + e)
  3827. }
  3828. }
  3829. m.prototype.n = function() {
  3830. var n, r, o, l, h = this.input;
  3831. switch (this.h) {
  3832. case 0:
  3833. for (o = 0, l = h.length; o < l;) {
  3834. var c, u, _, f = r = s ? h.subarray(o, o + 65535) : h.slice(o, o + 65535),
  3835. d = (o += r.length) === l,
  3836. p = e,
  3837. m = e,
  3838. y = this.a,
  3839. g = this.b;
  3840. if (s) {
  3841. for (y = new Uint8Array(this.a.buffer); y.length <= g + f.length + 5;) y = new Uint8Array(y.length << 1);
  3842. y.set(this.a)
  3843. }
  3844. if (c = d ? 1 : 0, y[g++] = 0 | c, _ = 65536 + ~(u = f.length) & 65535, y[g++] = 255 & u, y[g++] = u >>> 8 & 255, y[g++] = 255 & _, y[g++] = _ >>> 8 & 255, s) y.set(f, g), g += f.length, y = y.subarray(0, g);
  3845. else {
  3846. for (p = 0, m = f.length; p < m; ++p) y[g++] = f[p];
  3847. y.length = g
  3848. }
  3849. this.b = g, this.a = y
  3850. }
  3851. break;
  3852. case 1:
  3853. var b = new a(new Uint8Array(this.a.buffer), this.b);
  3854. b.d(1, 1, i), b.d(1, 2, i);
  3855. var A, C, T, S = E(this, h);
  3856. for (A = 0, C = S.length; A < C; A++)
  3857. if (T = S[A], a.prototype.d.apply(b, x[T]), 256 < T) b.d(S[++A], S[++A], i), b.d(S[++A], 5), b.d(S[++A], S[++A], i);
  3858. else if (256 === T) break;
  3859. this.a = b.finish(), this.b = this.a.length;
  3860. break;
  3861. case v:
  3862. var w, B, I, P, R, O, L, F, N, V, k, G, U, z, j, W = new a(new Uint8Array(this.a), this.b),
  3863. H = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
  3864. X = Array(19);
  3865. for (w = v, W.d(1, 1, i), W.d(w, 2, i), B = E(this, h), L = D(O = M(this.L, 15)), N = D(F = M(this.K, 7)), I = 286; 257 < I && 0 === O[I - 1]; I--);
  3866. for (P = 30; 1 < P && 0 === F[P - 1]; P--);
  3867. var Y, q, J, Z, K, Q, $ = I,
  3868. tt = P,
  3869. et = new(s ? Uint32Array : Array)($ + tt),
  3870. it = new(s ? Uint32Array : Array)(316),
  3871. nt = new(s ? Uint8Array : Array)(19);
  3872. for (Y = q = 0; Y < $; Y++) et[q++] = O[Y];
  3873. for (Y = 0; Y < tt; Y++) et[q++] = F[Y];
  3874. if (!s)
  3875. for (Y = 0, Z = nt.length; Y < Z; ++Y) nt[Y] = 0;
  3876. for (Y = K = 0, Z = et.length; Y < Z; Y += q) {
  3877. for (q = 1; Y + q < Z && et[Y + q] === et[Y]; ++q);
  3878. if (J = q, 0 === et[Y])
  3879. if (3 > J)
  3880. for (; 0 < J--;) it[K++] = 0, nt[0]++;
  3881. else
  3882. for (; 0 < J;)(Q = 138 > J ? J : 138) > J - 3 && Q < J && (Q = J - 3), 10 >= Q ? (it[K++] = 17, it[K++] = Q - 3, nt[17]++) : (it[K++] = 18, it[K++] = Q - 11, nt[18]++), J -= Q;
  3883. else if (it[K++] = et[Y], nt[et[Y]]++, 3 > --J)
  3884. for (; 0 < J--;) it[K++] = et[Y], nt[et[Y]]++;
  3885. else
  3886. for (; 0 < J;)(Q = 6 > J ? J : 6) > J - 3 && Q < J && (Q = J - 3), it[K++] = 16, it[K++] = Q - 3, nt[16]++, J -= Q
  3887. }
  3888. for (n = s ? it.subarray(0, K) : it.slice(0, K), V = M(nt, 7), z = 0; 19 > z; z++) X[z] = V[H[z]];
  3889. for (R = 19; 4 < R && 0 === X[R - 1]; R--);
  3890. for (k = D(V), W.d(I - 257, 5, i), W.d(P - 1, 5, i), W.d(R - 4, 4, i), z = 0; z < R; z++) W.d(X[z], 3, i);
  3891. for (z = 0, j = n.length; z < j; z++)
  3892. if (G = n[z], W.d(k[G], V[G], i), 16 <= G) {
  3893. switch (z++, G) {
  3894. case 16:
  3895. U = 2;
  3896. break;
  3897. case 17:
  3898. U = 3;
  3899. break;
  3900. case 18:
  3901. U = 7;
  3902. break;
  3903. default:
  3904. t("invalid code: " + G)
  3905. }
  3906. W.d(n[z], U, i)
  3907. }
  3908. var rt, st, ot, at, lt, ht, ct, ut, _t = [L, O],
  3909. ft = [N, F];
  3910. for (lt = _t[0], ht = _t[1], ct = ft[0], ut = ft[1], rt = 0, st = B.length; rt < st; ++rt)
  3911. if (ot = B[rt], W.d(lt[ot], ht[ot], i), 256 < ot) W.d(B[++rt], B[++rt], i), at = B[++rt], W.d(ct[at], ut[at], i), W.d(B[++rt], B[++rt], i);
  3912. else if (256 === ot) break;
  3913. this.a = W.finish(), this.b = this.a.length;
  3914. break;
  3915. default:
  3916. t("invalid compression type")
  3917. }
  3918. return this.a
  3919. };
  3920. var C, T, S = [];
  3921. for (C = 3; 258 >= C; C++) T = A(), S[C] = T[2] << 24 | T[1] << 16 | T[0];
  3922. var w = s ? new Uint32Array(S) : S;
  3923. function E(n, r) {
  3924. function o(e, n) {
  3925. var r, s, o, a, l = e.G,
  3926. h = [],
  3927. c = 0;
  3928. switch (r = w[e.length], h[c++] = 65535 & r, h[c++] = r >> 16 & 255, h[c++] = r >> 24, i) {
  3929. case 1 === l:
  3930. s = [0, l - 1, 0];
  3931. break;
  3932. case 2 === l:
  3933. s = [1, l - 2, 0];
  3934. break;
  3935. case 3 === l:
  3936. s = [2, l - 3, 0];
  3937. break;
  3938. case 4 === l:
  3939. s = [3, l - 4, 0];
  3940. break;
  3941. case 6 >= l:
  3942. s = [4, l - 5, 1];
  3943. break;
  3944. case 8 >= l:
  3945. s = [5, l - 7, 1];
  3946. break;
  3947. case 12 >= l:
  3948. s = [6, l - 9, 2];
  3949. break;
  3950. case 16 >= l:
  3951. s = [7, l - 13, 2];
  3952. break;
  3953. case 24 >= l:
  3954. s = [8, l - 17, 3];
  3955. break;
  3956. case 32 >= l:
  3957. s = [9, l - 25, 3];
  3958. break;
  3959. case 48 >= l:
  3960. s = [10, l - 33, 4];
  3961. break;
  3962. case 64 >= l:
  3963. s = [11, l - 49, 4];
  3964. break;
  3965. case 96 >= l:
  3966. s = [12, l - 65, 5];
  3967. break;
  3968. case 128 >= l:
  3969. s = [13, l - 97, 5];
  3970. break;
  3971. case 192 >= l:
  3972. s = [14, l - 129, 6];
  3973. break;
  3974. case 256 >= l:
  3975. s = [15, l - 193, 6];
  3976. break;
  3977. case 384 >= l:
  3978. s = [16, l - 257, 7];
  3979. break;
  3980. case 512 >= l:
  3981. s = [17, l - 385, 7];
  3982. break;
  3983. case 768 >= l:
  3984. s = [18, l - 513, 8];
  3985. break;
  3986. case 1024 >= l:
  3987. s = [19, l - 769, 8];
  3988. break;
  3989. case 1536 >= l:
  3990. s = [20, l - 1025, 9];
  3991. break;
  3992. case 2048 >= l:
  3993. s = [21, l - 1537, 9];
  3994. break;
  3995. case 3072 >= l:
  3996. s = [22, l - 2049, 10];
  3997. break;
  3998. case 4096 >= l:
  3999. s = [23, l - 3073, 10];
  4000. break;
  4001. case 6144 >= l:
  4002. s = [24, l - 4097, 11];
  4003. break;
  4004. case 8192 >= l:
  4005. s = [25, l - 6145, 11];
  4006. break;
  4007. case 12288 >= l:
  4008. s = [26, l - 8193, 12];
  4009. break;
  4010. case 16384 >= l:
  4011. s = [27, l - 12289, 12];
  4012. break;
  4013. case 24576 >= l:
  4014. s = [28, l - 16385, 13];
  4015. break;
  4016. case 32768 >= l:
  4017. s = [29, l - 24577, 13];
  4018. break;
  4019. default:
  4020. t("invalid distance")
  4021. }
  4022. for (r = s, h[c++] = r[0], h[c++] = r[1], h[c++] = r[2], o = 0, a = h.length; o < a; ++o) y[v++] = h[o];
  4023. x[h[0]]++, A[h[3]]++, g = e.length + n - 1, d = null
  4024. }
  4025. var a, l, h, c, u, _, f, d, p, m = {},
  4026. y = s ? new Uint16Array(2 * r.length) : [],
  4027. v = 0,
  4028. g = 0,
  4029. x = new(s ? Uint32Array : Array)(286),
  4030. A = new(s ? Uint32Array : Array)(30),
  4031. C = n.w;
  4032. if (!s) {
  4033. for (h = 0; 285 >= h;) x[h++] = 0;
  4034. for (h = 0; 29 >= h;) A[h++] = 0
  4035. }
  4036. for (x[256] = 1, a = 0, l = r.length; a < l; ++a) {
  4037. for (h = u = 0, c = 3; h < c && a + h !== l; ++h) u = u << 8 | r[a + h];
  4038. if (m[u] === e && (m[u] = []), _ = m[u], !(0 < g--)) {
  4039. for (; 0 < _.length && 32768 < a - _[0];) _.shift();
  4040. if (a + 3 >= l) {
  4041. for (d && o(d, -1), h = 0, c = l - a; h < c; ++h) p = r[a + h], y[v++] = p, ++x[p];
  4042. break
  4043. }
  4044. if (0 < _.length) {
  4045. var T = e,
  4046. S = e,
  4047. E = 0,
  4048. M = e,
  4049. D = e,
  4050. B = e,
  4051. I = r.length,
  4052. P = (D = 0, _.length);
  4053. t: for (; D < P; D++) {
  4054. if (T = _[P - D - 1], M = 3, 3 < E) {
  4055. for (B = E; 3 < B; B--)
  4056. if (r[T + B - 1] !== r[a + B - 1]) continue t;
  4057. M = E
  4058. }
  4059. for (; 258 > M && a + M < I && r[T + M] === r[a + M];) ++M;
  4060. if (M > E && (S = T, E = M), 258 === M) break
  4061. }
  4062. f = new b(E, a - S), d ? d.length < f.length ? (p = r[a - 1], y[v++] = p, ++x[p], o(f, 0)) : o(d, -1) : f.length < C ? d = f : o(f, 0)
  4063. } else d ? o(d, -1) : (p = r[a], y[v++] = p, ++x[p])
  4064. }
  4065. _.push(a)
  4066. }
  4067. return y[v++] = 256, x[256]++, n.L = x, n.K = A, s ? y.subarray(0, v) : y
  4068. }
  4069. function M(t, e) {
  4070. function i(t) {
  4071. var e = C[t][T[t]];
  4072. e === v ? (i(t + 1), i(t + 1)) : --b[e], ++T[t]
  4073. }
  4074. var n, r, o, a, l, h = t.length,
  4075. c = new d(572),
  4076. u = new(s ? Uint8Array : Array)(h);
  4077. if (!s)
  4078. for (a = 0; a < h; a++) u[a] = 0;
  4079. for (a = 0; a < h; ++a) 0 < t[a] && c.push(a, t[a]);
  4080. if (n = Array(c.length / 2), r = new(s ? Uint32Array : Array)(c.length / 2), 1 === n.length) return u[c.pop().index] = 1, u;
  4081. for (a = 0, l = c.length / 2; a < l; ++a) n[a] = c.pop(), r[a] = n[a].value;
  4082. var _, f, p, m, y, v = r.length,
  4083. g = new(s ? Uint16Array : Array)(e),
  4084. x = new(s ? Uint8Array : Array)(e),
  4085. b = new(s ? Uint8Array : Array)(v),
  4086. A = Array(e),
  4087. C = Array(e),
  4088. T = Array(e),
  4089. S = (1 << e) - v,
  4090. w = 1 << e - 1;
  4091. for (g[e - 1] = v, f = 0; f < e; ++f) S < w ? x[f] = 0 : (x[f] = 1, S -= w), S <<= 1, g[e - 2 - f] = (g[e - 1 - f] / 2 | 0) + v;
  4092. for (g[0] = x[0], A[0] = Array(g[0]), C[0] = Array(g[0]), f = 1; f < e; ++f) g[f] > 2 * g[f - 1] + x[f] && (g[f] = 2 * g[f - 1] + x[f]), A[f] = Array(g[f]), C[f] = Array(g[f]);
  4093. for (_ = 0; _ < v; ++_) b[_] = e;
  4094. for (p = 0; p < g[e - 1]; ++p) A[e - 1][p] = r[p], C[e - 1][p] = p;
  4095. for (_ = 0; _ < e; ++_) T[_] = 0;
  4096. for (1 === x[e - 1] && (--b[0], ++T[e - 1]), f = e - 2; 0 <= f; --f) {
  4097. for (m = _ = 0, y = T[f + 1], p = 0; p < g[f]; p++)(m = A[f + 1][y] + A[f + 1][y + 1]) > r[_] ? (A[f][p] = m, C[f][p] = v, y += 2) : (A[f][p] = r[_], C[f][p] = _, ++_);
  4098. T[f] = 0, 1 === x[f] && i(f)
  4099. }
  4100. for (o = b, a = 0, l = n.length; a < l; ++a) u[n[a].index] = o[a];
  4101. return u
  4102. }
  4103. function D(e) {
  4104. var i, n, r, o, a = new(s ? Uint16Array : Array)(e.length),
  4105. l = [],
  4106. h = [],
  4107. c = 0;
  4108. for (i = 0, n = e.length; i < n; i++) l[e[i]] = 1 + (0 | l[e[i]]);
  4109. for (i = 1, n = 16; i <= n; i++) h[i] = c, (c += 0 | l[i]) > 1 << i && t("overcommitted"), c <<= 1;
  4110. for (65536 > c && t("undercommitted"), i = 0, n = e.length; i < n; i++)
  4111. for (c = h[e[i]], h[e[i]] += 1, r = a[i] = 0, o = e[i]; r < o; r++) a[i] = a[i] << 1 | 1 & c, c >>>= 1;
  4112. return a
  4113. }
  4114. function B(t, e) {
  4115. this.input = t, this.a = new(s ? Uint8Array : Array)(32768), this.h = I.j;
  4116. var i, n = {};
  4117. for (i in !e && (e = {}) || "number" != typeof e.compressionType || (this.h = e.compressionType), e) n[i] = e[i];
  4118. n.outputBuffer = this.a, this.z = new m(this.input, n)
  4119. }
  4120. var I = g;
  4121. function P(e, i) {
  4122. switch (this.k = [], this.l = 32768, this.e = this.g = this.c = this.q = 0, this.input = s ? new Uint8Array(e) : e, this.s = !1, this.m = O, this.B = !1, !i && (i = {}) || (i.index && (this.c = i.index), i.bufferSize && (this.l = i.bufferSize), i.bufferType && (this.m = i.bufferType), i.resize && (this.B = i.resize)), this.m) {
  4123. case R:
  4124. this.b = 32768, this.a = new(s ? Uint8Array : Array)(32768 + this.l + 258);
  4125. break;
  4126. case O:
  4127. this.b = 0, this.a = new(s ? Uint8Array : Array)(this.l), this.f = this.J, this.t = this.H, this.o = this.I;
  4128. break;
  4129. default:
  4130. t(Error("invalid inflate mode"))
  4131. }
  4132. }
  4133. B.prototype.n = function() {
  4134. var e, i, n, r, a, l, h, c = 0;
  4135. switch (h = this.a, e = ct) {
  4136. case ct:
  4137. i = Math.LOG2E * Math.log(32768) - 8;
  4138. break;
  4139. default:
  4140. t(Error("invalid compression method"))
  4141. }
  4142. switch (n = i << 4 | e, h[c++] = n, e) {
  4143. case ct:
  4144. switch (this.h) {
  4145. case I.NONE:
  4146. a = 0;
  4147. break;
  4148. case I.r:
  4149. a = 1;
  4150. break;
  4151. case I.j:
  4152. a = 2;
  4153. break;
  4154. default:
  4155. t(Error("unsupported compression type"))
  4156. }
  4157. break;
  4158. default:
  4159. t(Error("invalid compression method"))
  4160. }
  4161. return r = a << 6 | 0, h[c++] = r | 31 - (256 * n + r) % 31, l = o(this.input), this.z.b = c, c = (h = this.z.n()).length, s && ((h = new Uint8Array(h.buffer)).length <= c + 4 && (this.a = new Uint8Array(h.length + 4), this.a.set(h), h = this.a), h = h.subarray(0, c + 4)), h[c++] = l >> 24 & 255, h[c++] = l >> 16 & 255, h[c++] = l >> 8 & 255, h[c++] = 255 & l, h
  4162. }, r("Zlib.Deflate", B), r("Zlib.Deflate.compress", (function(t, e) {
  4163. return new B(t, e).n()
  4164. })), r("Zlib.Deflate.CompressionType", I), r("Zlib.Deflate.CompressionType.NONE", I.NONE), r("Zlib.Deflate.CompressionType.FIXED", I.r), r("Zlib.Deflate.CompressionType.DYNAMIC", I.j);
  4165. var R = 0,
  4166. O = 1,
  4167. L = {
  4168. D: R,
  4169. C: O
  4170. };
  4171. P.prototype.p = function() {
  4172. for (; !this.s;) {
  4173. var n = tt(this, 3);
  4174. switch (1 & n && (this.s = i), n >>>= 1) {
  4175. case 0:
  4176. var r = this.input,
  4177. o = this.c,
  4178. a = this.a,
  4179. l = this.b,
  4180. h = e,
  4181. c = e,
  4182. u = e,
  4183. _ = a.length,
  4184. f = e;
  4185. switch (this.e = this.g = 0, (h = r[o++]) === e && t(Error("invalid uncompressed block header: LEN (first byte)")), c = h, (h = r[o++]) === e && t(Error("invalid uncompressed block header: LEN (second byte)")), c |= h << 8, (h = r[o++]) === e && t(Error("invalid uncompressed block header: NLEN (first byte)")), u = h, (h = r[o++]) === e && t(Error("invalid uncompressed block header: NLEN (second byte)")), c === ~(u |= h << 8) && t(Error("invalid uncompressed block header: length verify")), o + c > r.length && t(Error("input buffer is broken")), this.m) {
  4186. case R:
  4187. for (; l + c > a.length;) {
  4188. if (c -= f = _ - l, s) a.set(r.subarray(o, o + f), l), l += f, o += f;
  4189. else
  4190. for (; f--;) a[l++] = r[o++];
  4191. this.b = l, a = this.f(), l = this.b
  4192. }
  4193. break;
  4194. case O:
  4195. for (; l + c > a.length;) a = this.f({
  4196. v: 2
  4197. });
  4198. break;
  4199. default:
  4200. t(Error("invalid inflate mode"))
  4201. }
  4202. if (s) a.set(r.subarray(o, o + c), l), l += c, o += c;
  4203. else
  4204. for (; c--;) a[l++] = r[o++];
  4205. this.c = o, this.b = l, this.a = a;
  4206. break;
  4207. case 1:
  4208. this.o(K, $);
  4209. break;
  4210. case 2:
  4211. it(this);
  4212. break;
  4213. default:
  4214. t(Error("unknown BTYPE: " + n))
  4215. }
  4216. }
  4217. return this.t()
  4218. };
  4219. var F, N, V = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
  4220. k = s ? new Uint16Array(V) : V,
  4221. G = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258],
  4222. U = s ? new Uint16Array(G) : G,
  4223. z = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0],
  4224. j = s ? new Uint8Array(z) : z,
  4225. W = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577],
  4226. H = s ? new Uint16Array(W) : W,
  4227. X = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13],
  4228. Y = s ? new Uint8Array(X) : X,
  4229. q = new(s ? Uint8Array : Array)(288);
  4230. for (F = 0, N = q.length; F < N; ++F) q[F] = 143 >= F ? 8 : 255 >= F ? 9 : 279 >= F ? 7 : 8;
  4231. var J, Z, K = p(q),
  4232. Q = new(s ? Uint8Array : Array)(30);
  4233. for (J = 0, Z = Q.length; J < Z; ++J) Q[J] = 5;
  4234. var $ = p(Q);
  4235. function tt(i, n) {
  4236. for (var r, s = i.g, o = i.e, a = i.input, l = i.c; o < n;)(r = a[l++]) === e && t(Error("input buffer is broken")), s |= r << o, o += 8;
  4237. return r = s & (1 << n) - 1, i.g = s >>> n, i.e = o - n, i.c = l, r
  4238. }
  4239. function et(i, n) {
  4240. for (var r, s, o, a = i.g, l = i.e, h = i.input, c = i.c, u = n[0], _ = n[1]; l < _;)(r = h[c++]) === e && t(Error("input buffer is broken")), a |= r << l, l += 8;
  4241. return o = (s = u[a & (1 << _) - 1]) >>> 16, i.g = a >> o, i.e = l - o, i.c = c, 65535 & s
  4242. }
  4243. function it(t) {
  4244. function e(t, e, i) {
  4245. var n, r, s, o;
  4246. for (o = 0; o < t;) switch (n = et(this, e)) {
  4247. case 16:
  4248. for (s = 3 + tt(this, 2); s--;) i[o++] = r;
  4249. break;
  4250. case 17:
  4251. for (s = 3 + tt(this, 3); s--;) i[o++] = 0;
  4252. r = 0;
  4253. break;
  4254. case 18:
  4255. for (s = 11 + tt(this, 7); s--;) i[o++] = 0;
  4256. r = 0;
  4257. break;
  4258. default:
  4259. r = i[o++] = n
  4260. }
  4261. return i
  4262. }
  4263. var i, n, r, o, a = tt(t, 5) + 257,
  4264. l = tt(t, 5) + 1,
  4265. h = tt(t, 4) + 4,
  4266. c = new(s ? Uint8Array : Array)(k.length);
  4267. for (o = 0; o < h; ++o) c[k[o]] = tt(t, 3);
  4268. i = p(c), n = new(s ? Uint8Array : Array)(a), r = new(s ? Uint8Array : Array)(l), t.o(p(e.call(t, a, i, n)), p(e.call(t, l, i, r)))
  4269. }
  4270. function nt(e, i) {
  4271. var n, r;
  4272. switch (this.input = e, this.c = 0, !i && (i = {}) || (i.index && (this.c = i.index), i.verify && (this.M = i.verify)), n = e[this.c++], r = e[this.c++], 15 & n) {
  4273. case ct:
  4274. this.method = ct;
  4275. break;
  4276. default:
  4277. t(Error("unsupported compression method"))
  4278. }
  4279. 0 != ((n << 8) + r) % 31 && t(Error("invalid fcheck flag:" + ((n << 8) + r) % 31)), 32 & r && t(Error("fdict flag is not supported")), this.A = new P(e, {
  4280. index: this.c,
  4281. bufferSize: i.bufferSize,
  4282. bufferType: i.bufferType,
  4283. resize: i.resize
  4284. })
  4285. }
  4286. P.prototype.o = function(t, e) {
  4287. var i = this.a,
  4288. n = this.b;
  4289. this.u = t;
  4290. for (var r, s, o, a, l = i.length - 258; 256 !== (r = et(this, t));)
  4291. if (256 > r) n >= l && (this.b = n, i = this.f(), n = this.b), i[n++] = r;
  4292. else
  4293. for (a = U[s = r - 257], 0 < j[s] && (a += tt(this, j[s])), r = et(this, e), o = H[r], 0 < Y[r] && (o += tt(this, Y[r])), n >= l && (this.b = n, i = this.f(), n = this.b); a--;) i[n] = i[n++ - o];
  4294. for (; 8 <= this.e;) this.e -= 8, this.c--;
  4295. this.b = n
  4296. }, P.prototype.I = function(t, e) {
  4297. var i = this.a,
  4298. n = this.b;
  4299. this.u = t;
  4300. for (var r, s, o, a, l = i.length; 256 !== (r = et(this, t));)
  4301. if (256 > r) n >= l && (l = (i = this.f()).length), i[n++] = r;
  4302. else
  4303. for (a = U[s = r - 257], 0 < j[s] && (a += tt(this, j[s])), r = et(this, e), o = H[r], 0 < Y[r] && (o += tt(this, Y[r])), n + a > l && (l = (i = this.f()).length); a--;) i[n] = i[n++ - o];
  4304. for (; 8 <= this.e;) this.e -= 8, this.c--;
  4305. this.b = n
  4306. }, P.prototype.f = function() {
  4307. var t, e, i = new(s ? Uint8Array : Array)(this.b - 32768),
  4308. n = this.b - 32768,
  4309. r = this.a;
  4310. if (s) i.set(r.subarray(32768, i.length));
  4311. else
  4312. for (t = 0, e = i.length; t < e; ++t) i[t] = r[t + 32768];
  4313. if (this.k.push(i), this.q += i.length, s) r.set(r.subarray(n, n + 32768));
  4314. else
  4315. for (t = 0; 32768 > t; ++t) r[t] = r[n + t];
  4316. return this.b = 32768, r
  4317. }, P.prototype.J = function(t) {
  4318. var e, i, n, r = this.input.length / this.c + 1 | 0,
  4319. o = this.input,
  4320. a = this.a;
  4321. return t && ("number" == typeof t.v && (r = t.v), "number" == typeof t.F && (r += t.F)), 2 > r ? i = (n = (o.length - this.c) / this.u[2] / 2 * 258 | 0) < a.length ? a.length + n : a.length << 1 : i = a.length * r, s ? (e = new Uint8Array(i)).set(a) : e = a, this.a = e
  4322. }, P.prototype.t = function() {
  4323. var t, e, i, n, r, o = 0,
  4324. a = this.a,
  4325. l = this.k,
  4326. h = new(s ? Uint8Array : Array)(this.q + (this.b - 32768));
  4327. if (0 === l.length) return s ? this.a.subarray(32768, this.b) : this.a.slice(32768, this.b);
  4328. for (e = 0, i = l.length; e < i; ++e)
  4329. for (n = 0, r = (t = l[e]).length; n < r; ++n) h[o++] = t[n];
  4330. for (e = 32768, i = this.b; e < i; ++e) h[o++] = a[e];
  4331. return this.k = [], this.buffer = h
  4332. }, P.prototype.H = function() {
  4333. var t, e = this.b;
  4334. return s ? this.B ? (t = new Uint8Array(e)).set(this.a.subarray(0, e)) : t = this.a.subarray(0, e) : (this.a.length > e && (this.a.length = e), t = this.a), this.buffer = t
  4335. }, nt.prototype.p = function() {
  4336. var e, i = this.input;
  4337. return e = this.A.p(), this.c = this.A.c, this.M && ((i[this.c++] << 24 | i[this.c++] << 16 | i[this.c++] << 8 | i[this.c++]) >>> 0 !== o(e) && t(Error("invalid adler-32 checksum"))), e
  4338. }, r("Zlib.Inflate", nt), r("Zlib.Inflate.BufferType", L), L.ADAPTIVE = L.C, L.BLOCK = L.D, r("Zlib.Inflate.prototype.decompress", nt.prototype.p);
  4339. s && new Uint16Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  4340. s && new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258]);
  4341. s && new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0]);
  4342. s && new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577]);
  4343. s && new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]);
  4344. var rt, st, ot = new(s ? Uint8Array : Array)(288);
  4345. for (rt = 0, st = ot.length; rt < st; ++rt) ot[rt] = 143 >= rt ? 8 : 255 >= rt ? 9 : 279 >= rt ? 7 : 8;
  4346. p(ot);
  4347. var at, lt, ht = new(s ? Uint8Array : Array)(30);
  4348. for (at = 0, lt = ht.length; at < lt; ++at) ht[at] = 5;
  4349. p(ht);
  4350. var ct = 8
  4351. }).call(window);
  4352. var n = window.Zlib;
  4353. n.Deflate = n.Deflate, n.Deflate.compress = n.Deflate.compress, n.Inflate = n.Inflate, n.Inflate.BufferType = n.Inflate.BufferType, n.Inflate.prototype.decompress = n.Inflate.prototype.decompress, e.exports = n
  4354. }), {}],
  4355. 26: [(function(t, e, i) {
  4356. "use strict";
  4357. i.__esModule = !0, i.default = void 0;
  4358. var n, r, s, o, a, l, h, c, u, _, f, d, p, m, y, v, g, x, b, A, C, T, S, w = (function() {
  4359. function t(t, e) {
  4360. for (var i = 0; i < e.length; i++) {
  4361. var n = e[i];
  4362. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  4363. }
  4364. }
  4365. return function(e, i, n) {
  4366. return i && t(e.prototype, i), n && t(e, n), e
  4367. }
  4368. })(),
  4369. E = I(t("../../renderer/enums")),
  4370. M = t("../value-types"),
  4371. D = t("../vmath"),
  4372. B = I(t("../vmath/mat4"));
  4373. function I(t) {
  4374. return t && t.__esModule ? t : {
  4375. default: t
  4376. }
  4377. }
  4378. function P(t, e, i, n) {
  4379. i && Object.defineProperty(t, e, {
  4380. enumerable: i.enumerable,
  4381. configurable: i.configurable,
  4382. writable: i.writable,
  4383. value: i.initializer ? i.initializer.call(n) : void 0
  4384. })
  4385. }
  4386. function R(t, e) {
  4387. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  4388. }
  4389. function O(t, e) {
  4390. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  4391. return !e || "object" != typeof e && "function" != typeof e ? t : e
  4392. }
  4393. function L(t, e) {
  4394. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  4395. t.prototype = Object.create(e && e.prototype, {
  4396. constructor: {
  4397. value: t,
  4398. enumerable: !1,
  4399. writable: !0,
  4400. configurable: !0
  4401. }
  4402. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  4403. }
  4404. function F(t, e, i, n, r) {
  4405. var s = {};
  4406. return Object.keys(n).forEach((function(t) {
  4407. s[t] = n[t]
  4408. })), s.enumerable = !!s.enumerable, s.configurable = !!s.configurable, ("value" in s || s.initializer) && (s.writable = !0), s = i.slice().reverse().reduce((function(i, n) {
  4409. return n(t, e, i) || i
  4410. }), s), r && void 0 !== s.initializer && (s.value = s.initializer ? s.initializer.call(r) : void 0, s.initializer = void 0), void 0 === s.initializer && (Object.defineProperty(t, e, s), s = null), s
  4411. }
  4412. var N = null;
  4413. N = t("../../renderer/scene/light");
  4414. var V = t("../renderer/index"),
  4415. k = t("../platform/CCEnum"),
  4416. G = t("../components/CCComponent"),
  4417. U = t("../platform/CCClassDecorator"),
  4418. z = U.ccclass,
  4419. j = U.menu,
  4420. W = U.inspector,
  4421. H = U.property,
  4422. X = U.executeInEditMode,
  4423. Y = (B.default.create(), k({
  4424. DIRECTIONAL: 0,
  4425. POINT: 1,
  4426. SPOT: 2,
  4427. AMBIENT: 3
  4428. })),
  4429. q = k({
  4430. NONE: 0,
  4431. HARD: 2
  4432. }),
  4433. J = (n = z("cc.Light"), r = j("i18n:MAIN_MENU.component.renderers/Light"), s = W("packages://inspector/inspectors/comps/light.js"), o = H({
  4434. type: Y
  4435. }), a = H({
  4436. type: q
  4437. }), n(l = r(l = X(l = s((S = T = (function(t) {
  4438. function e() {
  4439. R(this, e);
  4440. var i = O(this, t.call(this));
  4441. return P(i, "_type", c, i), P(i, "_color", u, i), P(i, "_intensity", _, i), P(i, "_range", f, i), P(i, "_spotAngle", d, i), P(i, "_spotExp", p, i), P(i, "_shadowType", m, i), P(i, "_shadowResolution", y, i), P(i, "_shadowDarkness", v, i), P(i, "_shadowMinDepth", g, i), P(i, "_shadowMaxDepth", x, i), P(i, "_shadowDepthScale", b, i), P(i, "_shadowFrustumSize", A, i), P(i, "_shadowBias", C, i), i._light = new N, i
  4442. }
  4443. return L(e, t), w(e, [{
  4444. key: "type",
  4445. get: function() {
  4446. return this._type
  4447. },
  4448. set: function(t) {
  4449. this._type = t;
  4450. var e = E.default.LIGHT_DIRECTIONAL;
  4451. t === Y.POINT ? e = E.default.LIGHT_POINT : t === Y.SPOT ? e = E.default.LIGHT_SPOT : t === Y.AMBIENT && (e = E.default.LIGHT_AMBIENT), this._light.setType(e)
  4452. }
  4453. }, {
  4454. key: "color",
  4455. get: function() {
  4456. return this._color
  4457. },
  4458. set: function(t) {
  4459. this._color = t, this._light.setColor(t.r / 255, t.g / 255, t.b / 255)
  4460. }
  4461. }, {
  4462. key: "intensity",
  4463. get: function() {
  4464. return this._intensity
  4465. },
  4466. set: function(t) {
  4467. this._intensity = t, this._light.setIntensity(t)
  4468. }
  4469. }, {
  4470. key: "range",
  4471. get: function() {
  4472. return this._range
  4473. },
  4474. set: function(t) {
  4475. this._range = t, this._light.setRange(t)
  4476. }
  4477. }, {
  4478. key: "spotAngle",
  4479. get: function() {
  4480. return this._spotAngle
  4481. },
  4482. set: function(t) {
  4483. this._spotAngle = t, this._light.setSpotAngle((0, D.toRadian)(t))
  4484. }
  4485. }, {
  4486. key: "spotExp",
  4487. get: function() {
  4488. return this._spotExp
  4489. },
  4490. set: function(t) {
  4491. this._spotExp = t, this._light.setSpotExp(t)
  4492. }
  4493. }, {
  4494. key: "shadowType",
  4495. get: function() {
  4496. return this._shadowType
  4497. },
  4498. set: function(t) {
  4499. this._shadowType = t;
  4500. var e = E.default.SHADOW_NONE;
  4501. t === q.HARD ? e = E.default.SHADOW_HARD : t === q.SOFT && (e = E.default.SHADOW_SOFT), this._light.setShadowType(e)
  4502. }
  4503. }, {
  4504. key: "shadowResolution",
  4505. get: function() {
  4506. return this._shadowResolution
  4507. },
  4508. set: function(t) {
  4509. this._shadowResolution = t, this._light.setShadowResolution(t)
  4510. }
  4511. }, {
  4512. key: "shadowDarkness",
  4513. get: function() {
  4514. return this._shadowDarkness
  4515. },
  4516. set: function(t) {
  4517. this._shadowDarkness = t, this._light.setShadowDarkness(t)
  4518. }
  4519. }, {
  4520. key: "shadowMinDepth",
  4521. get: function() {
  4522. return this._shadowMinDepth
  4523. },
  4524. set: function(t) {
  4525. this._shadowMinDepth = t, this._light.setShadowMinDepth(t)
  4526. }
  4527. }, {
  4528. key: "shadowMaxDepth",
  4529. get: function() {
  4530. return this._shadowMaxDepth
  4531. },
  4532. set: function(t) {
  4533. this._shadowMaxDepth = t, this._light.setShadowMaxDepth(t)
  4534. }
  4535. }, {
  4536. key: "shadowDepthScale",
  4537. get: function() {
  4538. return this._shadowDepthScale
  4539. },
  4540. set: function(t) {
  4541. this._shadowDepthScale = t, this._light.setShadowDepthScale(t)
  4542. }
  4543. }, {
  4544. key: "shadowFrustumSize",
  4545. get: function() {
  4546. return this._shadowFrustumSize
  4547. },
  4548. set: function(t) {
  4549. this._shadowFrustumSize = t, this._light.setShadowFrustumSize(t)
  4550. }
  4551. }]), e.prototype.onLoad = function() {
  4552. this._light.setNode(this.node), this.type = this._type, this.color = this._color, this.intensity = this._intensity, this.range = this._range, this.spotAngle = this._spotAngle, this.spotExp = this._spotExp, this.shadowType = this._shadowType, this.shadowResolution = this._shadowResolution, this.shadowDarkness = this._shadowDarkness, this.shadowMaxDepth = this._shadowMaxDepth, this.shadowDepthScale = this._shadowDepthScale, this.shadowFrustumSize = this._shadowFrustumSize, this.shadowBias = this._shadowBias
  4553. }, e.prototype.onEnable = function() {
  4554. V.scene.addLight(this._light)
  4555. }, e.prototype.onDisable = function() {
  4556. V.scene.removeLight(this._light)
  4557. }, e
  4558. })(G), T.Type = Y, T.ShadowType = q, c = F((h = S).prototype, "_type", [H], {
  4559. enumerable: !0,
  4560. initializer: function() {
  4561. return Y.DIRECTIONAL
  4562. }
  4563. }), u = F(h.prototype, "_color", [H], {
  4564. enumerable: !0,
  4565. initializer: function() {
  4566. return M.Color.WHITE
  4567. }
  4568. }), _ = F(h.prototype, "_intensity", [H], {
  4569. enumerable: !0,
  4570. initializer: function() {
  4571. return 1
  4572. }
  4573. }), f = F(h.prototype, "_range", [H], {
  4574. enumerable: !0,
  4575. initializer: function() {
  4576. return 1e3
  4577. }
  4578. }), d = F(h.prototype, "_spotAngle", [H], {
  4579. enumerable: !0,
  4580. initializer: function() {
  4581. return 60
  4582. }
  4583. }), p = F(h.prototype, "_spotExp", [H], {
  4584. enumerable: !0,
  4585. initializer: function() {
  4586. return 1
  4587. }
  4588. }), m = F(h.prototype, "_shadowType", [H], {
  4589. enumerable: !0,
  4590. initializer: function() {
  4591. return q.NONE
  4592. }
  4593. }), y = F(h.prototype, "_shadowResolution", [H], {
  4594. enumerable: !0,
  4595. initializer: function() {
  4596. return 1024
  4597. }
  4598. }), v = F(h.prototype, "_shadowDarkness", [H], {
  4599. enumerable: !0,
  4600. initializer: function() {
  4601. return .5
  4602. }
  4603. }), g = F(h.prototype, "_shadowMinDepth", [H], {
  4604. enumerable: !0,
  4605. initializer: function() {
  4606. return 1
  4607. }
  4608. }), x = F(h.prototype, "_shadowMaxDepth", [H], {
  4609. enumerable: !0,
  4610. initializer: function() {
  4611. return 4096
  4612. }
  4613. }), b = F(h.prototype, "_shadowDepthScale", [H], {
  4614. enumerable: !0,
  4615. initializer: function() {
  4616. return 250
  4617. }
  4618. }), A = F(h.prototype, "_shadowFrustumSize", [H], {
  4619. enumerable: !0,
  4620. initializer: function() {
  4621. return 1024
  4622. }
  4623. }), C = F(h.prototype, "_shadowBias", [H], {
  4624. enumerable: !0,
  4625. initializer: function() {
  4626. return 5e-4
  4627. }
  4628. }), F(h.prototype, "type", [o], Object.getOwnPropertyDescriptor(h.prototype, "type"), h.prototype), F(h.prototype, "color", [H], Object.getOwnPropertyDescriptor(h.prototype, "color"), h.prototype), F(h.prototype, "intensity", [H], Object.getOwnPropertyDescriptor(h.prototype, "intensity"), h.prototype), F(h.prototype, "range", [H], Object.getOwnPropertyDescriptor(h.prototype, "range"), h.prototype), F(h.prototype, "spotAngle", [H], Object.getOwnPropertyDescriptor(h.prototype, "spotAngle"), h.prototype), F(h.prototype, "spotExp", [H], Object.getOwnPropertyDescriptor(h.prototype, "spotExp"), h.prototype), F(h.prototype, "shadowType", [a], Object.getOwnPropertyDescriptor(h.prototype, "shadowType"), h.prototype), F(h.prototype, "shadowResolution", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowResolution"), h.prototype), F(h.prototype, "shadowDarkness", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowDarkness"), h.prototype), F(h.prototype, "shadowMinDepth", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowMinDepth"), h.prototype), F(h.prototype, "shadowMaxDepth", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowMaxDepth"), h.prototype), F(h.prototype, "shadowDepthScale", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowDepthScale"), h.prototype), F(h.prototype, "shadowFrustumSize", [H], Object.getOwnPropertyDescriptor(h.prototype, "shadowFrustumSize"), h.prototype), l = h)) || l) || l) || l) || l);
  4629. i.default = J, cc.Light = J, e.exports = i.default
  4630. }), {
  4631. "../../renderer/enums": 355,
  4632. "../../renderer/scene/light": 381,
  4633. "../components/CCComponent": 95,
  4634. "../platform/CCClassDecorator": 199,
  4635. "../platform/CCEnum": 200,
  4636. "../renderer/index": 247,
  4637. "../value-types": 315,
  4638. "../vmath": 326,
  4639. "../vmath/mat4": 330
  4640. }],
  4641. 27: [(function(t, e, i) {
  4642. "use strict";
  4643. var n = cc.Class({
  4644. name: "cc.Model",
  4645. extends: cc.Asset,
  4646. ctor: function() {
  4647. this._rootNode = null
  4648. },
  4649. properties: {
  4650. _nodes: {
  4651. default: []
  4652. },
  4653. _precomputeJointMatrix: !1,
  4654. nodes: {
  4655. get: function() {
  4656. return this._nodes
  4657. }
  4658. },
  4659. rootNode: {
  4660. get: function() {
  4661. return this._rootNode
  4662. }
  4663. },
  4664. precomputeJointMatrix: {
  4665. get: function() {
  4666. return this._precomputeJointMatrix
  4667. }
  4668. }
  4669. },
  4670. onLoad: function() {
  4671. var t = this._nodes;
  4672. this._rootNode = t[0];
  4673. for (var e = 0; e < t.length; e++) {
  4674. var i = t[e];
  4675. i.position = cc.v3.apply(this, i.position), i.scale = cc.v3.apply(this, i.scale), i.quat = cc.quat.apply(this, i.quat), i.uniqueBindPose && (i.uniqueBindPose = cc.mat4.apply(this, i.uniqueBindPose));
  4676. var n = i.bindpose;
  4677. if (n)
  4678. for (var r in n) n[r] = cc.mat4.apply(this, n[r]);
  4679. var s = i.children;
  4680. if (s)
  4681. for (var o = 0; o < s.length; o++) s[o] = t[s[o]]
  4682. }
  4683. }
  4684. });
  4685. cc.Model = e.exports = n
  4686. }), {}],
  4687. 28: [(function(t, e, i) {
  4688. "use strict";
  4689. var n = cc.vmath.quat,
  4690. r = cc.quat(),
  4691. s = cc.v3();
  4692. cc.Rotate3DTo = cc.Class({
  4693. name: "cc.Rotate3DTo",
  4694. extends: cc.ActionInterval,
  4695. ctor: function(t, e, i, n) {
  4696. this._startQuat = cc.quat(), this._dstQuat = cc.quat(), void 0 !== e && this.initWithDuration(t, e, i, n)
  4697. },
  4698. initWithDuration: function(t, e, i, n) {
  4699. if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
  4700. var r = this._dstQuat;
  4701. return e instanceof cc.Quat ? r.set(e) : (e instanceof cc.Vec3 ? (i = e.y, n = e.z, e = e.x) : (i = i || 0, n = n || 0), cc.vmath.quat.fromEuler(r, e, i, n)), !0
  4702. }
  4703. return !1
  4704. },
  4705. clone: function() {
  4706. var t = new cc.Rotate3DTo;
  4707. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._dstQuat), t
  4708. },
  4709. startWithTarget: function(t) {
  4710. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._startQuat.set(t.quat)
  4711. },
  4712. reverse: function() {
  4713. cc.logID(1016)
  4714. },
  4715. update: function(t) {
  4716. t = this._computeEaseTime(t), this.target && (n.slerp(r, this._startQuat, this._dstQuat, t), this.target.setRotation(r))
  4717. }
  4718. }), cc.rotate3DTo = function(t, e, i, n) {
  4719. return new cc.Rotate3DTo(t, e, i, n)
  4720. }, cc.Rotate3DBy = cc.Class({
  4721. name: "cc.Rotate3DBy",
  4722. extends: cc.ActionInterval,
  4723. ctor: function(t, e, i, n) {
  4724. this._angle = cc.v3(), this._quat = cc.quat(), this._lastDt = 0, void 0 !== e && this.initWithDuration(t, e, i, n)
  4725. },
  4726. initWithDuration: function(t, e, i, n) {
  4727. return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (e instanceof cc.Vec3 ? (i = e.y, n = e.z, e = e.x) : (i = i || 0, n = n || 0), cc.vmath.vec3.set(this._angle, e, i, n), !0)
  4728. },
  4729. clone: function() {
  4730. var t = new cc.Rotate3DBy;
  4731. return this._cloneDecoration(t), t.initWithDuration(this._duration, this._angle), t
  4732. },
  4733. startWithTarget: function(t) {
  4734. cc.ActionInterval.prototype.startWithTarget.call(this, t), this._quat.set(t.quat), this._lastDt = 0
  4735. },
  4736. update: (function() {
  4737. var t = Math.PI / 180;
  4738. return function(e) {
  4739. if (e = this._computeEaseTime(e), this.target) {
  4740. var i = this._angle,
  4741. r = this._quat,
  4742. s = e - this._lastDt,
  4743. o = i.x,
  4744. a = i.y,
  4745. l = i.z;
  4746. o && n.rotateX(r, r, o * t * s), a && n.rotateY(r, r, a * t * s), l && n.rotateZ(r, r, l * t * s), this.target.setRotation(r), this._lastDt = e
  4747. }
  4748. }
  4749. })(),
  4750. reverse: function() {
  4751. var t = this._angle;
  4752. s.x = -t.x, s.y = -t.y, s.z = -t.z;
  4753. var e = new cc.Rotate3DBy(this._duration, s);
  4754. return this._cloneDecoration(e), this._reverseEaseList(e), e
  4755. }
  4756. }), cc.rotate3DBy = function(t, e, i, n) {
  4757. return new cc.Rotate3DBy(t, e, i, n)
  4758. }
  4759. }), {}],
  4760. 29: [(function(t, e, i) {
  4761. "use strict";
  4762. t("./polyfill-3d"), t("./primitive"), t("./CCModel"), t("./skeleton/CCSkeleton"), t("./skeleton/CCSkeletonAnimationClip"), t("./actions"), t("./skeleton/CCSkeletonAnimation"), t("./skeleton/CCSkinnedMeshRenderer"), t("./skeleton/skinned-mesh-renderer"), t("./CCLightComponent")
  4763. }), {
  4764. "./CCLightComponent": 26,
  4765. "./CCModel": 27,
  4766. "./actions": 28,
  4767. "./polyfill-3d": 30,
  4768. "./primitive": 35,
  4769. "./skeleton/CCSkeleton": 44,
  4770. "./skeleton/CCSkeletonAnimation": 45,
  4771. "./skeleton/CCSkeletonAnimationClip": 46,
  4772. "./skeleton/CCSkinnedMeshRenderer": 47,
  4773. "./skeleton/skinned-mesh-renderer": 48
  4774. }],
  4775. 30: [(function(t, e, i) {
  4776. "use strict";
  4777. var n = t("../vmath"),
  4778. r = t("../CCNode"),
  4779. s = r.EventType,
  4780. o = r._LocalDirtyFlag,
  4781. a = t("../renderer/render-flow"),
  4782. l = Math.PI / 180,
  4783. h = 1,
  4784. c = 2;
  4785. function u() {
  4786. if (this._localMatDirty) {
  4787. var t = this._matrix,
  4788. e = t.m;
  4789. if (n.mat4.fromTRSArray(t, this._trs), this._skewX || this._skewY) {
  4790. var i = e[0],
  4791. r = e[1],
  4792. s = e[4],
  4793. o = e[5],
  4794. a = Math.tan(this._skewX * l),
  4795. h = Math.tan(this._skewY * l);
  4796. a === 1 / 0 && (a = 99999999), h === 1 / 0 && (h = 99999999), e[0] = i + s * h, e[1] = r + o * h, e[4] = s + i * a, e[5] = o + r * a
  4797. }
  4798. this._localMatDirty = 0, this._worldMatDirty = !0
  4799. }
  4800. }
  4801. function _() {
  4802. if (this._localMatDirty && this._updateLocalMatrix(), this._parent) {
  4803. var t = this._parent._worldMatrix;
  4804. n.mat4.mul(this._worldMatrix, t, this._matrix)
  4805. } else n.mat4.copy(this._worldMatrix, this._matrix);
  4806. this._worldMatDirty = !1
  4807. }
  4808. function f(t, e, i) {
  4809. var n = void 0;
  4810. void 0 === e ? (n = t.x, e = t.y, i = t.z || 0) : (n = t, i = i || 0);
  4811. var r = this._trs;
  4812. r[0] === n && r[1] === e && r[2] === i || (r[0] = n, r[1] = e, r[2] = i, this.setLocalDirty(o.POSITION), this._renderFlag |= a.FLAG_WORLD_TRANSFORM, this._eventMask & h && this.emit(s.POSITION_CHANGED))
  4813. }
  4814. var d = cc.Node.prototype,
  4815. p = d._updateLocalMatrix,
  4816. m = d._calculWorldMatrix,
  4817. y = d._upgrade_1x_to_2x,
  4818. v = d._mulMat;
  4819. d.setPosition = f, d.setScale = function(t, e, i) {
  4820. t && "number" != typeof t ? (e = t.y, i = void 0 === t.z ? 1 : t.z, t = t.x) : void 0 !== t && void 0 === e ? (e = t, i = t) : void 0 === i && (i = 1);
  4821. var n = this._trs;
  4822. n[7] === t && n[8] === e && n[9] === i || (n[7] = t, n[8] = e, n[9] = i, this.setLocalDirty(o.SCALE), this._renderFlag |= a.FLAG_TRANSFORM, this._eventMask & c && this.emit(s.SCALE_CHANGED))
  4823. }, d._upgrade_1x_to_2x = function() {
  4824. this._is3DNode && this._update3DFunction(), y.call(this)
  4825. }, d._update3DFunction = function() {
  4826. this._is3DNode ? (this._updateLocalMatrix = u, this._calculWorldMatrix = _, this._mulMat = n.mat4.mul) : (this._updateLocalMatrix = p, this._calculWorldMatrix = m, this._mulMat = v), this._renderComponent && this._renderComponent._on3DNodeChanged && this._renderComponent._on3DNodeChanged(), this._renderFlag |= a.FLAG_TRANSFORM, this._localMatDirty = o.ALL
  4827. }, cc.js.getset(d, "position", d.getPosition, f, !1, !0), cc.js.getset(d, "is3DNode", (function() {
  4828. return this._is3DNode
  4829. }), (function(t) {
  4830. this._is3DNode = t, this._update3DFunction()
  4831. })), cc.js.getset(d, "scaleZ", (function() {
  4832. return this._trs[9]
  4833. }), (function(t) {
  4834. this._trs[9] !== t && (this._trs[9] = t, this.setLocalDirty(o.SCALE), this._renderFlag |= a.FLAG_TRANSFORM, this._eventMask & c && this.emit(s.SCALE_CHANGED))
  4835. })), cc.js.getset(d, "z", (function() {
  4836. return this._trs[2]
  4837. }), (function(t) {
  4838. var e = this._trs;
  4839. t !== e[2] && (e[2] = t, this.setLocalDirty(o.POSITION), this._renderFlag |= a.FLAG_WORLD_TRANSFORM, this._eventMask & h && this.emit(s.POSITION_CHANGED))
  4840. })), cc.js.getset(d, "eulerAngles", (function() {
  4841. return n.trs.toEuler(this._eulerAngles, this._trs)
  4842. }), (function(t) {
  4843. n.trs.fromEuler(this._trs, t), this.setLocalDirty(o.ROTATION), this._renderFlag |= a.FLAG_TRANSFORM
  4844. })), cc.js.getset(d, "quat", (function() {
  4845. var t = this._trs;
  4846. return cc.quat(t[3], t[4], t[5], t[6])
  4847. }), d.setRotation)
  4848. }), {
  4849. "../CCNode": 52,
  4850. "../renderer/render-flow": 248,
  4851. "../vmath": 326
  4852. }],
  4853. 31: [(function(t, e, i) {
  4854. "use strict";
  4855. i.__esModule = !0, i.default = function() {
  4856. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  4857. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
  4858. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1,
  4859. y = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
  4860. v = void 0 !== y.widthSegments ? y.widthSegments : 1,
  4861. g = void 0 !== y.heightSegments ? y.heightSegments : 1,
  4862. x = void 0 !== y.lengthSegments ? y.lengthSegments : 1,
  4863. b = void 0 !== y.invWinding && y.invWinding,
  4864. A = .5 * t,
  4865. C = .5 * e,
  4866. T = .5 * i,
  4867. S = [n.vec3.set(h, -A, -C, T), n.vec3.set(c, A, -C, T), n.vec3.set(u, A, C, T), n.vec3.set(_, -A, C, T), n.vec3.set(f, A, -C, -T), n.vec3.set(d, -A, -C, -T), n.vec3.set(p, -A, C, -T), n.vec3.set(m, A, C, -T)],
  4868. w = [
  4869. [2, 3, 1],
  4870. [4, 5, 7],
  4871. [7, 6, 2],
  4872. [1, 0, 4],
  4873. [1, 4, 2],
  4874. [5, 0, 6]
  4875. ],
  4876. E = [
  4877. [0, 0, 1],
  4878. [0, 0, -1],
  4879. [0, 1, 0],
  4880. [0, -1, 0],
  4881. [1, 0, 0],
  4882. [-1, 0, 0]
  4883. ],
  4884. M = [],
  4885. D = [],
  4886. B = [],
  4887. I = [],
  4888. P = n.vec3.create(-A, -C, -T),
  4889. R = n.vec3.create(A, C, T),
  4890. O = Math.sqrt(A * A + C * C + T * T);
  4891. function L(t, e, i) {
  4892. var r = void 0,
  4893. h = void 0,
  4894. c = void 0,
  4895. u = void 0,
  4896. _ = M.length / 3,
  4897. f = w[t],
  4898. d = E[t];
  4899. for (u = 0; u <= i; u++)
  4900. for (c = 0; c <= e; c++)
  4901. if (r = c / e, h = u / i, n.vec3.lerp(s, S[f[0]], S[f[1]], r), n.vec3.lerp(o, S[f[0]], S[f[2]], h), n.vec3.sub(a, o, S[f[0]]), n.vec3.add(l, s, a), M.push(l.x, l.y, l.z), D.push(d[0], d[1], d[2]), B.push(r, h), c < e && u < i) {
  4902. var p = e + 1,
  4903. m = c + u * p,
  4904. y = c + (u + 1) * p,
  4905. v = c + 1 + (u + 1) * p,
  4906. g = c + 1 + u * p;
  4907. b ? (I.push(_ + m, _ + y, _ + g), I.push(_ + g, _ + y, _ + v)) : (I.push(_ + m, _ + g, _ + y), I.push(_ + y, _ + g, _ + v))
  4908. }
  4909. }
  4910. return L(0, v, g), L(4, x, g), L(1, v, g), L(5, x, g), L(3, v, x), L(2, v, x), new r.default(M, D, B, I, P, R, O)
  4911. };
  4912. var n = t("../../vmath"),
  4913. r = (function(t) {
  4914. return t && t.__esModule ? t : {
  4915. default: t
  4916. }
  4917. })(t("./vertex-data"));
  4918. var s = n.vec3.create(0, 0, 0),
  4919. o = n.vec3.create(0, 0, 0),
  4920. a = n.vec3.create(0, 0, 0),
  4921. l = n.vec3.create(0, 0, 0),
  4922. h = n.vec3.create(0, 0, 0),
  4923. c = n.vec3.create(0, 0, 0),
  4924. u = n.vec3.create(0, 0, 0),
  4925. _ = n.vec3.create(0, 0, 0),
  4926. f = n.vec3.create(0, 0, 0),
  4927. d = n.vec3.create(0, 0, 0),
  4928. p = n.vec3.create(0, 0, 0),
  4929. m = n.vec3.create(0, 0, 0);
  4930. e.exports = i.default
  4931. }), {
  4932. "../../vmath": 326,
  4933. "./vertex-data": 42
  4934. }],
  4935. 32: [(function(t, e, i) {
  4936. "use strict";
  4937. i.__esModule = !0, i.default = function() {
  4938. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5,
  4939. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .5,
  4940. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2,
  4941. a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
  4942. l = i - t - e,
  4943. h = a.sides || 32,
  4944. c = a.heightSegments || 32,
  4945. u = e / i,
  4946. _ = l / i,
  4947. f = t / i,
  4948. d = Math.floor(c * u),
  4949. p = Math.floor(c * f),
  4950. m = Math.floor(c * _),
  4951. y = l + e - i / 2,
  4952. v = e - i / 2,
  4953. g = e - i / 2,
  4954. x = a.arc || 2 * Math.PI,
  4955. b = [],
  4956. A = [],
  4957. C = [],
  4958. T = [],
  4959. S = Math.max(t, e),
  4960. w = n.vec3.create(-S, -i / 2, -S),
  4961. E = n.vec3.create(S, i / 2, S),
  4962. M = i / 2,
  4963. D = 0,
  4964. B = [];
  4965. return (function() {
  4966. for (var t = 0; t <= d; ++t)
  4967. for (var i = t * Math.PI / d / 2, n = Math.sin(i), r = -Math.cos(i), s = 0; s <= h; ++s) {
  4968. var o = 2 * s * Math.PI / h - Math.PI / 2,
  4969. a = Math.sin(o),
  4970. l = Math.cos(o),
  4971. u = a * n,
  4972. _ = r,
  4973. f = l * n,
  4974. p = s / h,
  4975. m = t / c;
  4976. if (b.push(u * e, _ * e + g, f * e), A.push(u, _, f), C.push(p, m), t < d && s < h) {
  4977. var y = h + 1,
  4978. v = y * t + s,
  4979. x = y * (t + 1) + s,
  4980. S = y * (t + 1) + s + 1,
  4981. w = y * t + s + 1;
  4982. T.push(v, w, x), T.push(w, S, x)
  4983. }++D
  4984. }
  4985. })(), (function() {
  4986. for (var i = (t - e) / l, r = 0; r <= m; r++) {
  4987. for (var a = [], c = r / m, f = c * (t - e) + e, d = 0; d <= h; ++d) {
  4988. var p = d / h,
  4989. y = c * _ + u,
  4990. g = p * x - x / 4,
  4991. S = Math.sin(g),
  4992. w = Math.cos(g);
  4993. b.push(f * S), b.push(c * l + v), b.push(f * w), n.vec3.normalize(s, n.vec3.set(o, S, -i, w)), A.push(s.x), A.push(s.y), A.push(s.z), C.push(p, y), a.push(D), ++D
  4994. }
  4995. B.push(a)
  4996. }
  4997. for (var E = 0; E < m; ++E)
  4998. for (var M = 0; M < h; ++M) {
  4999. var I = B[E][M],
  5000. P = B[E + 1][M],
  5001. R = B[E + 1][M + 1],
  5002. O = B[E][M + 1];
  5003. T.push(I), T.push(O), T.push(P), T.push(O), T.push(R), T.push(P)
  5004. }
  5005. })(), (function() {
  5006. for (var e = 0; e <= p; ++e)
  5007. for (var i = e * Math.PI / p / 2 + Math.PI / 2, n = Math.sin(i), r = -Math.cos(i), s = 0; s <= h; ++s) {
  5008. var o = 2 * s * Math.PI / h - Math.PI / 2,
  5009. a = Math.sin(o),
  5010. l = Math.cos(o),
  5011. u = a * n,
  5012. _ = r,
  5013. d = l * n,
  5014. v = s / h,
  5015. g = e / c + (1 - f);
  5016. if (b.push(u * t, _ * t + y, d * t), A.push(u, _, d), C.push(v, g), e < p && s < h) {
  5017. var x = h + 1,
  5018. S = x * e + s + B[m][h] + 1,
  5019. w = x * (e + 1) + s + B[m][h] + 1,
  5020. E = x * (e + 1) + s + 1 + B[m][h] + 1,
  5021. M = x * e + s + 1 + B[m][h] + 1;
  5022. T.push(S, M, w), T.push(M, E, w)
  5023. }
  5024. }
  5025. })(), new r.default(b, A, C, T, w, E, M)
  5026. };
  5027. var n = t("../../vmath"),
  5028. r = (function(t) {
  5029. return t && t.__esModule ? t : {
  5030. default: t
  5031. }
  5032. })(t("./vertex-data"));
  5033. var s = n.vec3.create(0, 0, 0),
  5034. o = n.vec3.create(0, 0, 0);
  5035. e.exports = i.default
  5036. }), {
  5037. "../../vmath": 326,
  5038. "./vertex-data": 42
  5039. }],
  5040. 33: [(function(t, e, i) {
  5041. "use strict";
  5042. i.__esModule = !0, i.default = function() {
  5043. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5,
  5044. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
  5045. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
  5046. return (0, n.default)(0, t, e, i)
  5047. };
  5048. var n = (function(t) {
  5049. return t && t.__esModule ? t : {
  5050. default: t
  5051. }
  5052. })(t("./cylinder"));
  5053. e.exports = i.default
  5054. }), {
  5055. "./cylinder": 34
  5056. }],
  5057. 34: [(function(t, e, i) {
  5058. "use strict";
  5059. i.__esModule = !0, i.default = function() {
  5060. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5,
  5061. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .5,
  5062. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2,
  5063. a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
  5064. l = .5 * i,
  5065. h = a.radialSegments || 32,
  5066. c = a.heightSegments || 1,
  5067. u = void 0 === a.capped || a.capped,
  5068. _ = a.arc || 2 * Math.PI,
  5069. f = 0;
  5070. u || (t > 0 && f++, e > 0 && f++);
  5071. var d = (h + 1) * (c + 1);
  5072. u && (d += (h + 1) * f + h * f);
  5073. var p = h * c * 2 * 3;
  5074. u && (p += h * f * 3);
  5075. var m = new Array(p),
  5076. y = new Array(3 * d),
  5077. v = new Array(3 * d),
  5078. g = new Array(2 * d),
  5079. x = Math.max(t, e),
  5080. b = n.vec3.create(-x, -l, -x),
  5081. A = n.vec3.create(x, l, x),
  5082. C = Math.sqrt(x * x + l * l),
  5083. T = 0,
  5084. S = 0;
  5085. return (function() {
  5086. for (var r = [], a = t - e, u = a * a / i * Math.sign(a), f = 0; f <= c; f++) {
  5087. for (var d = [], p = f / c, x = p * a + e, b = 0; b <= h; ++b) {
  5088. var A = b / h,
  5089. C = A * _,
  5090. w = Math.sin(C),
  5091. E = Math.cos(C);
  5092. y[3 * T] = x * w, y[3 * T + 1] = p * i - l, y[3 * T + 2] = x * E, n.vec3.normalize(s, n.vec3.set(o, w, -u, E)), v[3 * T] = s.x, v[3 * T + 1] = s.y, v[3 * T + 2] = s.z, g[2 * T] = 2 * (1 - A) % 1, g[2 * T + 1] = p, d.push(T), ++T
  5093. }
  5094. r.push(d)
  5095. }
  5096. for (var M = 0; M < c; ++M)
  5097. for (var D = 0; D < h; ++D) {
  5098. var B = r[M][D],
  5099. I = r[M + 1][D],
  5100. P = r[M + 1][D + 1],
  5101. R = r[M][D + 1];
  5102. m[S] = B, m[++S] = R, m[++S] = I, m[++S] = R, m[++S] = P, m[++S] = I, ++S
  5103. }
  5104. })(), u && (e > 0 && w(!1), t > 0 && w(!0)), new r.default(y, v, g, m, b, A, C);
  5105. function w(i) {
  5106. var n, r, s = i ? t : e,
  5107. o = i ? 1 : -1;
  5108. n = T;
  5109. for (var a = 1; a <= h; ++a) y[3 * T] = 0, y[3 * T + 1] = l * o, y[3 * T + 2] = 0, v[3 * T] = 0, v[3 * T + 1] = o, v[3 * T + 2] = 0, g[2 * T] = .5, g[2 * T + 1] = .5, ++T;
  5110. r = T;
  5111. for (var c = 0; c <= h; ++c) {
  5112. var u = c / h * _,
  5113. f = Math.cos(u),
  5114. d = Math.sin(u);
  5115. y[3 * T] = s * d, y[3 * T + 1] = l * o, y[3 * T + 2] = s * f, v[3 * T] = 0, v[3 * T + 1] = o, v[3 * T + 2] = 0, g[2 * T] = .5 - .5 * d * o, g[2 * T + 1] = .5 + .5 * f, ++T
  5116. }
  5117. for (var p = 0; p < h; ++p) {
  5118. var x = n + p,
  5119. b = r + p;
  5120. i ? (m[S] = b + 1, m[++S] = x, m[++S] = b, ++S) : (m[S] = x, m[++S] = b + 1, m[++S] = b, ++S)
  5121. }
  5122. }
  5123. };
  5124. var n = t("../../vmath"),
  5125. r = (function(t) {
  5126. return t && t.__esModule ? t : {
  5127. default: t
  5128. }
  5129. })(t("./vertex-data"));
  5130. var s = n.vec3.create(0, 0, 0),
  5131. o = n.vec3.create(0, 0, 0);
  5132. e.exports = i.default
  5133. }), {
  5134. "../../vmath": 326,
  5135. "./vertex-data": 42
  5136. }],
  5137. 35: [(function(t, e, i) {
  5138. "use strict";
  5139. var n = d(t("./utils")),
  5140. r = d(t("./box")),
  5141. s = d(t("./cone")),
  5142. o = d(t("./cylinder")),
  5143. a = d(t("./plane")),
  5144. l = d(t("./quad")),
  5145. h = d(t("./sphere")),
  5146. c = d(t("./torus")),
  5147. u = d(t("./capsule")),
  5148. _ = t("./polyhedron"),
  5149. f = d(t("./vertex-data"));
  5150. function d(t) {
  5151. return t && t.__esModule ? t : {
  5152. default: t
  5153. }
  5154. }
  5155. cc.primitive = Object.assign({
  5156. box: r.default,
  5157. cone: s.default,
  5158. cylinder: o.default,
  5159. plane: a.default,
  5160. quad: l.default,
  5161. sphere: h.default,
  5162. torus: c.default,
  5163. capsule: u.default,
  5164. polyhedron: _.polyhedron,
  5165. PolyhedronType: _.PolyhedronType,
  5166. VertexData: f.default
  5167. }, n.default)
  5168. }), {
  5169. "./box": 31,
  5170. "./capsule": 32,
  5171. "./cone": 33,
  5172. "./cylinder": 34,
  5173. "./plane": 36,
  5174. "./polyhedron": 37,
  5175. "./quad": 38,
  5176. "./sphere": 39,
  5177. "./torus": 40,
  5178. "./utils": 41,
  5179. "./vertex-data": 42
  5180. }],
  5181. 36: [(function(t, e, i) {
  5182. "use strict";
  5183. i.__esModule = !0, i.default = function() {
  5184. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 10,
  5185. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 10,
  5186. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
  5187. _ = void 0 !== i.widthSegments ? i.widthSegments : 10,
  5188. f = void 0 !== i.lengthSegments ? i.lengthSegments : 10,
  5189. d = .5 * t,
  5190. p = .5 * e,
  5191. m = [],
  5192. y = [],
  5193. v = [],
  5194. g = [],
  5195. x = n.vec3.create(-d, 0, -p),
  5196. b = n.vec3.create(d, 0, p),
  5197. A = Math.sqrt(t * t + e * e);
  5198. n.vec3.set(h, -d, 0, p), n.vec3.set(c, d, 0, p), n.vec3.set(u, -d, 0, -p);
  5199. for (var C = 0; C <= f; C++)
  5200. for (var T = 0; T <= _; T++) {
  5201. var S = T / _,
  5202. w = C / f;
  5203. if (n.vec3.lerp(s, h, c, S), n.vec3.lerp(o, h, u, w), n.vec3.sub(a, o, h), n.vec3.add(l, s, a), m.push(l.x, l.y, l.z), y.push(0, 1, 0), v.push(S, w), T < _ && C < f) {
  5204. var E = _ + 1,
  5205. M = T + C * E,
  5206. D = T + (C + 1) * E,
  5207. B = T + 1 + (C + 1) * E,
  5208. I = T + 1 + C * E;
  5209. g.push(M, I, D), g.push(I, B, D)
  5210. }
  5211. }
  5212. return new r.default(m, y, v, g, x, b, A)
  5213. };
  5214. var n = t("../../vmath"),
  5215. r = (function(t) {
  5216. return t && t.__esModule ? t : {
  5217. default: t
  5218. }
  5219. })(t("./vertex-data"));
  5220. var s = n.vec3.create(0, 0, 0),
  5221. o = n.vec3.create(0, 0, 0),
  5222. a = n.vec3.create(0, 0, 0),
  5223. l = n.vec3.create(0, 0, 0),
  5224. h = n.vec3.create(0, 0, 0),
  5225. c = n.vec3.create(0, 0, 0),
  5226. u = n.vec3.create(0, 0, 0);
  5227. e.exports = i.default
  5228. }), {
  5229. "../../vmath": 326,
  5230. "./vertex-data": 42
  5231. }],
  5232. 37: [(function(t, e, i) {
  5233. "use strict";
  5234. i.__esModule = !0, i.polyhedron = i.PolyhedronType = void 0;
  5235. var n = t("./utils"),
  5236. r = t("../../vmath"),
  5237. s = (function(t) {
  5238. return t && t.__esModule ? t : {
  5239. default: t
  5240. }
  5241. })(t("./vertex-data"));
  5242. i.PolyhedronType = cc.Enum({
  5243. Tetrahedron: 0,
  5244. Octahedron: 1,
  5245. Dodecahedron: 2,
  5246. Icosahedron: 3,
  5247. Rhombicuboctahedron: 4,
  5248. TriangularPrism: 5,
  5249. PentagonalPrism: 6,
  5250. HexagonalPrism: 7,
  5251. SquarePyramid: 8,
  5252. PentagonalPyramid: 9,
  5253. TriangularDipyramid: 10,
  5254. PentagonalDipyramid: 11,
  5255. ElongatedSquareDipyramid: 12,
  5256. ElongatedPentagonalDipyramid: 13,
  5257. ElongatedPentagonalCupola: 14
  5258. });
  5259. var o = [];
  5260. o[0] = {
  5261. vertex: [
  5262. [0, 0, 1.732051],
  5263. [1.632993, 0, -.5773503],
  5264. [-.8164966, 1.414214, -.5773503],
  5265. [-.8164966, -1.414214, -.5773503]
  5266. ],
  5267. face: [
  5268. [0, 1, 2],
  5269. [0, 2, 3],
  5270. [0, 3, 1],
  5271. [1, 3, 2]
  5272. ]
  5273. }, o[1] = {
  5274. vertex: [
  5275. [0, 0, 1.414214],
  5276. [1.414214, 0, 0],
  5277. [0, 1.414214, 0],
  5278. [-1.414214, 0, 0],
  5279. [0, -1.414214, 0],
  5280. [0, 0, -1.414214]
  5281. ],
  5282. face: [
  5283. [0, 1, 2],
  5284. [0, 2, 3],
  5285. [0, 3, 4],
  5286. [0, 4, 1],
  5287. [1, 4, 5],
  5288. [1, 5, 2],
  5289. [2, 5, 3],
  5290. [3, 5, 4]
  5291. ]
  5292. }, o[2] = {
  5293. vertex: [
  5294. [0, 0, 1.070466],
  5295. [.7136442, 0, .7978784],
  5296. [-.3568221, .618034, .7978784],
  5297. [-.3568221, -.618034, .7978784],
  5298. [.7978784, .618034, .3568221],
  5299. [.7978784, -.618034, .3568221],
  5300. [-.9341724, .381966, .3568221],
  5301. [.1362939, 1, .3568221],
  5302. [.1362939, -1, .3568221],
  5303. [-.9341724, -.381966, .3568221],
  5304. [.9341724, .381966, -.3568221],
  5305. [.9341724, -.381966, -.3568221],
  5306. [-.7978784, .618034, -.3568221],
  5307. [-.1362939, 1, -.3568221],
  5308. [-.1362939, -1, -.3568221],
  5309. [-.7978784, -.618034, -.3568221],
  5310. [.3568221, .618034, -.7978784],
  5311. [.3568221, -.618034, -.7978784],
  5312. [-.7136442, 0, -.7978784],
  5313. [0, 0, -1.070466]
  5314. ],
  5315. face: [
  5316. [0, 1, 4, 7, 2],
  5317. [0, 2, 6, 9, 3],
  5318. [0, 3, 8, 5, 1],
  5319. [1, 5, 11, 10, 4],
  5320. [2, 7, 13, 12, 6],
  5321. [3, 9, 15, 14, 8],
  5322. [4, 10, 16, 13, 7],
  5323. [5, 8, 14, 17, 11],
  5324. [6, 12, 18, 15, 9],
  5325. [10, 11, 17, 19, 16],
  5326. [12, 13, 16, 19, 18],
  5327. [14, 15, 18, 19, 17]
  5328. ]
  5329. }, o[3] = {
  5330. vertex: [
  5331. [0, 0, 1.175571],
  5332. [1.051462, 0, .5257311],
  5333. [.3249197, 1, .5257311],
  5334. [-.8506508, .618034, .5257311],
  5335. [-.8506508, -.618034, .5257311],
  5336. [.3249197, -1, .5257311],
  5337. [.8506508, .618034, -.5257311],
  5338. [.8506508, -.618034, -.5257311],
  5339. [-.3249197, 1, -.5257311],
  5340. [-1.051462, 0, -.5257311],
  5341. [-.3249197, -1, -.5257311],
  5342. [0, 0, -1.175571]
  5343. ],
  5344. face: [
  5345. [0, 1, 2],
  5346. [0, 2, 3],
  5347. [0, 3, 4],
  5348. [0, 4, 5],
  5349. [0, 5, 1],
  5350. [1, 5, 7],
  5351. [1, 7, 6],
  5352. [1, 6, 2],
  5353. [2, 6, 8],
  5354. [2, 8, 3],
  5355. [3, 8, 9],
  5356. [3, 9, 4],
  5357. [4, 9, 10],
  5358. [4, 10, 5],
  5359. [5, 10, 7],
  5360. [6, 7, 11],
  5361. [6, 11, 8],
  5362. [7, 10, 11],
  5363. [8, 11, 9],
  5364. [9, 11, 10]
  5365. ]
  5366. }, o[4] = {
  5367. vertex: [
  5368. [0, 0, 1.070722],
  5369. [.7148135, 0, .7971752],
  5370. [-.104682, .7071068, .7971752],
  5371. [-.6841528, .2071068, .7971752],
  5372. [-.104682, -.7071068, .7971752],
  5373. [.6101315, .7071068, .5236279],
  5374. [1.04156, .2071068, .1367736],
  5375. [.6101315, -.7071068, .5236279],
  5376. [-.3574067, 1, .1367736],
  5377. [-.7888348, -.5, .5236279],
  5378. [-.9368776, .5, .1367736],
  5379. [-.3574067, -1, .1367736],
  5380. [.3574067, 1, -.1367736],
  5381. [.9368776, -.5, -.1367736],
  5382. [.7888348, .5, -.5236279],
  5383. [.3574067, -1, -.1367736],
  5384. [-.6101315, .7071068, -.5236279],
  5385. [-1.04156, -.2071068, -.1367736],
  5386. [-.6101315, -.7071068, -.5236279],
  5387. [.104682, .7071068, -.7971752],
  5388. [.6841528, -.2071068, -.7971752],
  5389. [.104682, -.7071068, -.7971752],
  5390. [-.7148135, 0, -.7971752],
  5391. [0, 0, -1.070722]
  5392. ],
  5393. face: [
  5394. [0, 2, 3],
  5395. [1, 6, 5],
  5396. [4, 9, 11],
  5397. [7, 15, 13],
  5398. [8, 16, 10],
  5399. [12, 14, 19],
  5400. [17, 22, 18],
  5401. [20, 21, 23],
  5402. [0, 1, 5, 2],
  5403. [0, 3, 9, 4],
  5404. [0, 4, 7, 1],
  5405. [1, 7, 13, 6],
  5406. [2, 5, 12, 8],
  5407. [2, 8, 10, 3],
  5408. [3, 10, 17, 9],
  5409. [4, 11, 15, 7],
  5410. [5, 6, 14, 12],
  5411. [6, 13, 20, 14],
  5412. [8, 12, 19, 16],
  5413. [9, 17, 18, 11],
  5414. [10, 16, 22, 17],
  5415. [11, 18, 21, 15],
  5416. [13, 15, 21, 20],
  5417. [14, 20, 23, 19],
  5418. [16, 19, 23, 22],
  5419. [18, 22, 23, 21]
  5420. ]
  5421. }, o[5] = {
  5422. vertex: [
  5423. [0, 0, 1.322876],
  5424. [1.309307, 0, .1889822],
  5425. [-.9819805, .8660254, .1889822],
  5426. [.1636634, -1.299038, .1889822],
  5427. [.3273268, .8660254, -.9449112],
  5428. [-.8183171, -.4330127, -.9449112]
  5429. ],
  5430. face: [
  5431. [0, 3, 1],
  5432. [2, 4, 5],
  5433. [0, 1, 4, 2],
  5434. [0, 2, 5, 3],
  5435. [1, 3, 5, 4]
  5436. ]
  5437. }, o[6] = {
  5438. vertex: [
  5439. [0, 0, 1.159953],
  5440. [1.013464, 0, .5642542],
  5441. [-.3501431, .9510565, .5642542],
  5442. [-.7715208, -.6571639, .5642542],
  5443. [.6633206, .9510565, -.03144481],
  5444. [.8682979, -.6571639, -.3996071],
  5445. [-1.121664, .2938926, -.03144481],
  5446. [-.2348831, -1.063314, -.3996071],
  5447. [.5181548, .2938926, -.9953061],
  5448. [-.5850262, -.112257, -.9953061]
  5449. ],
  5450. face: [
  5451. [0, 1, 4, 2],
  5452. [0, 2, 6, 3],
  5453. [1, 5, 8, 4],
  5454. [3, 6, 9, 7],
  5455. [5, 7, 9, 8],
  5456. [0, 3, 7, 5, 1],
  5457. [2, 4, 8, 9, 6]
  5458. ]
  5459. }, o[7] = {
  5460. vertex: [
  5461. [0, 0, 1.118034],
  5462. [.8944272, 0, .6708204],
  5463. [-.2236068, .8660254, .6708204],
  5464. [-.7826238, -.4330127, .6708204],
  5465. [.6708204, .8660254, .2236068],
  5466. [1.006231, -.4330127, -.2236068],
  5467. [-1.006231, .4330127, .2236068],
  5468. [-.6708204, -.8660254, -.2236068],
  5469. [.7826238, .4330127, -.6708204],
  5470. [.2236068, -.8660254, -.6708204],
  5471. [-.8944272, 0, -.6708204],
  5472. [0, 0, -1.118034]
  5473. ],
  5474. face: [
  5475. [0, 1, 4, 2],
  5476. [0, 2, 6, 3],
  5477. [1, 5, 8, 4],
  5478. [3, 6, 10, 7],
  5479. [5, 9, 11, 8],
  5480. [7, 10, 11, 9],
  5481. [0, 3, 7, 9, 5, 1],
  5482. [2, 4, 8, 11, 10, 6]
  5483. ]
  5484. }, o[8] = {
  5485. vertex: [
  5486. [-.729665, .670121, .319155],
  5487. [-.655235, -.29213, -.754096],
  5488. [-.093922, -.607123, .537818],
  5489. [.702196, .595691, .485187],
  5490. [.776626, -.36656, -.588064]
  5491. ],
  5492. face: [
  5493. [1, 4, 2],
  5494. [0, 1, 2],
  5495. [3, 0, 2],
  5496. [4, 3, 2],
  5497. [4, 1, 0, 3]
  5498. ]
  5499. }, o[9] = {
  5500. vertex: [
  5501. [-.868849, -.100041, .61257],
  5502. [-.329458, .976099, .28078],
  5503. [-.26629, -.013796, -.477654],
  5504. [-.13392, -1.034115, .229829],
  5505. [.738834, .707117, -.307018],
  5506. [.859683, -.535264, -.338508]
  5507. ],
  5508. face: [
  5509. [3, 0, 2],
  5510. [5, 3, 2],
  5511. [4, 5, 2],
  5512. [1, 4, 2],
  5513. [0, 1, 2],
  5514. [0, 3, 5, 4, 1]
  5515. ]
  5516. }, o[10] = {
  5517. vertex: [
  5518. [-.610389, .243975, .531213],
  5519. [-.187812, -.48795, -.664016],
  5520. [-.187812, .9759, -.664016],
  5521. [.187812, -.9759, .664016],
  5522. [.798201, .243975, .132803]
  5523. ],
  5524. face: [
  5525. [1, 3, 0],
  5526. [3, 4, 0],
  5527. [3, 1, 4],
  5528. [0, 2, 1],
  5529. [0, 4, 2],
  5530. [2, 4, 1]
  5531. ]
  5532. }, o[11] = {
  5533. vertex: [
  5534. [-1.028778, .392027, -.048786],
  5535. [-.640503, -.646161, .621837],
  5536. [-.125162, -.395663, -.540059],
  5537. [.004683, .888447, -.651988],
  5538. [.125161, .395663, .540059],
  5539. [.632925, -.791376, .433102],
  5540. [1.031672, .157063, -.354165]
  5541. ],
  5542. face: [
  5543. [3, 2, 0],
  5544. [2, 1, 0],
  5545. [2, 5, 1],
  5546. [0, 4, 3],
  5547. [0, 1, 4],
  5548. [4, 1, 5],
  5549. [2, 3, 6],
  5550. [3, 4, 6],
  5551. [5, 2, 6],
  5552. [4, 5, 6]
  5553. ]
  5554. }, o[12] = {
  5555. vertex: [
  5556. [-.669867, .334933, -.529576],
  5557. [-.669867, .334933, .529577],
  5558. [-.4043, 1.212901, 0],
  5559. [-.334933, -.669867, -.529576],
  5560. [-.334933, -.669867, .529577],
  5561. [.334933, .669867, -.529576],
  5562. [.334933, .669867, .529577],
  5563. [.4043, -1.212901, 0],
  5564. [.669867, -.334933, -.529576],
  5565. [.669867, -.334933, .529577]
  5566. ],
  5567. face: [
  5568. [8, 9, 7],
  5569. [6, 5, 2],
  5570. [3, 8, 7],
  5571. [5, 0, 2],
  5572. [4, 3, 7],
  5573. [0, 1, 2],
  5574. [9, 4, 7],
  5575. [1, 6, 2],
  5576. [9, 8, 5, 6],
  5577. [8, 3, 0, 5],
  5578. [3, 4, 1, 0],
  5579. [4, 9, 6, 1]
  5580. ]
  5581. }, o[13] = {
  5582. vertex: [
  5583. [-.931836, .219976, -.264632],
  5584. [-.636706, .318353, .692816],
  5585. [-.613483, -.735083, -.264632],
  5586. [-.326545, .979634, 0],
  5587. [-.318353, -.636706, .692816],
  5588. [-.159176, .477529, -.856368],
  5589. [.159176, -.477529, -.856368],
  5590. [.318353, .636706, .692816],
  5591. [.326545, -.979634, 0],
  5592. [.613482, .735082, -.264632],
  5593. [.636706, -.318353, .692816],
  5594. [.931835, -.219977, -.264632]
  5595. ],
  5596. face: [
  5597. [11, 10, 8],
  5598. [7, 9, 3],
  5599. [6, 11, 8],
  5600. [9, 5, 3],
  5601. [2, 6, 8],
  5602. [5, 0, 3],
  5603. [4, 2, 8],
  5604. [0, 1, 3],
  5605. [10, 4, 8],
  5606. [1, 7, 3],
  5607. [10, 11, 9, 7],
  5608. [11, 6, 5, 9],
  5609. [6, 2, 0, 5],
  5610. [2, 4, 1, 0],
  5611. [4, 10, 7, 1]
  5612. ]
  5613. }, o[14] = {
  5614. vertex: [
  5615. [-.93465, .300459, -.271185],
  5616. [-.838689, -.260219, -.516017],
  5617. [-.711319, .717591, .128359],
  5618. [-.710334, -.156922, .080946],
  5619. [-.599799, .556003, -.725148],
  5620. [-.503838, -.004675, -.969981],
  5621. [-.487004, .26021, .48049],
  5622. [-.460089, -.750282, -.512622],
  5623. [-.376468, .973135, -.325605],
  5624. [-.331735, -.646985, .084342],
  5625. [-.254001, .831847, .530001],
  5626. [-.125239, -.494738, -.966586],
  5627. [.029622, .027949, .730817],
  5628. [.056536, -.982543, -.262295],
  5629. [.08085, 1.087391, .076037],
  5630. [.125583, -.532729, .485984],
  5631. [.262625, .599586, .780328],
  5632. [.391387, -.726999, -.716259],
  5633. [.513854, -.868287, .139347],
  5634. [.597475, .85513, .326364],
  5635. [.641224, .109523, .783723],
  5636. [.737185, -.451155, .538891],
  5637. [.848705, -.612742, -.314616],
  5638. [.976075, .365067, .32976],
  5639. [1.072036, -.19561, .084927]
  5640. ],
  5641. face: [
  5642. [15, 18, 21],
  5643. [12, 20, 16],
  5644. [6, 10, 2],
  5645. [3, 0, 1],
  5646. [9, 7, 13],
  5647. [2, 8, 4, 0],
  5648. [0, 4, 5, 1],
  5649. [1, 5, 11, 7],
  5650. [7, 11, 17, 13],
  5651. [13, 17, 22, 18],
  5652. [18, 22, 24, 21],
  5653. [21, 24, 23, 20],
  5654. [20, 23, 19, 16],
  5655. [16, 19, 14, 10],
  5656. [10, 14, 8, 2],
  5657. [15, 9, 13, 18],
  5658. [12, 15, 21, 20],
  5659. [6, 12, 16, 10],
  5660. [3, 6, 2, 0],
  5661. [9, 3, 1, 7],
  5662. [9, 15, 12, 6, 3],
  5663. [22, 17, 11, 5, 4, 8, 14, 19, 23, 24]
  5664. ]
  5665. };
  5666. i.polyhedron = function(t) {
  5667. var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
  5668. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
  5669. t = t && (t < 0 || t >= o.length) ? 0 : t || 0;
  5670. for (var a = i.sizeX || e, l = i.sizeY || e, h = i.sizeZ || e, c = o[t], u = c.face.length, _ = [], f = [], d = [], p = [], m = r.vec3.create(1 / 0, 1 / 0, 1 / 0), y = r.vec3.create(-1 / 0, -1 / 0, -1 / 0), v = 0; v < c.vertex.length; v++) {
  5671. var g = c.vertex[v][0] * a,
  5672. x = c.vertex[v][1] * l,
  5673. b = c.vertex[v][2] * h;
  5674. m.x = Math.min(m.x, g), m.y = Math.min(m.y, x), m.z = Math.min(m.z, b), y.x = Math.max(y.x, g), y.y = Math.max(y.y, x), y.z = Math.max(y.z, b), _.push(g, x, b), p.push(0, 0)
  5675. }
  5676. for (var A = 0; A < u; A++)
  5677. for (var C = 0; C < c.face[A].length - 2; C++) f.push(c.face[A][0], c.face[A][C + 2], c.face[A][C + 1]);
  5678. (0, n.calcNormals)(_, f, d);
  5679. var T = Math.sqrt(Math.pow(y.x - m.x, 2), Math.pow(y.y - m.y, 2), Math.pow(y.z - m.z, 2));
  5680. return new s.default(_, d, p, f, m, y, T)
  5681. }
  5682. }), {
  5683. "../../vmath": 326,
  5684. "./utils": 41,
  5685. "./vertex-data": 42
  5686. }],
  5687. 38: [(function(t, e, i) {
  5688. "use strict";
  5689. i.__esModule = !0, i.default = function() {
  5690. return new r.default(s, o, a, l, h, c, u)
  5691. };
  5692. var n = t("../../vmath"),
  5693. r = (function(t) {
  5694. return t && t.__esModule ? t : {
  5695. default: t
  5696. }
  5697. })(t("./vertex-data"));
  5698. var s = [-.5, -.5, 0, -.5, .5, 0, .5, .5, 0, .5, -.5, 0],
  5699. o = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],
  5700. a = [0, 0, 0, 1, 1, 1, 1, 0],
  5701. l = [0, 3, 1, 3, 2, 1],
  5702. h = n.vec3.create(-.5, -.5, 0),
  5703. c = n.vec3.create(.5, .5, 0),
  5704. u = Math.sqrt(.5);
  5705. e.exports = i.default
  5706. }), {
  5707. "../../vmath": 326,
  5708. "./vertex-data": 42
  5709. }],
  5710. 39: [(function(t, e, i) {
  5711. "use strict";
  5712. i.__esModule = !0, i.default = function() {
  5713. for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .5, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = void 0 !== e.segments ? e.segments : 32, s = [], o = [], a = [], l = [], h = n.vec3.create(-t, -t, -t), c = n.vec3.create(t, t, t), u = t, _ = 0; _ <= i; ++_)
  5714. for (var f = _ * Math.PI / i, d = Math.sin(f), p = -Math.cos(f), m = 0; m <= i; ++m) {
  5715. var y = 2 * m * Math.PI / i - Math.PI / 2,
  5716. v = Math.sin(y) * d,
  5717. g = p,
  5718. x = Math.cos(y) * d,
  5719. b = m / i,
  5720. A = _ / i;
  5721. if (s.push(v * t, g * t, x * t), o.push(v, g, x), a.push(b, A), _ < i && m < i) {
  5722. var C = i + 1,
  5723. T = C * _ + m,
  5724. S = C * (_ + 1) + m,
  5725. w = C * (_ + 1) + m + 1,
  5726. E = C * _ + m + 1;
  5727. l.push(T, E, S), l.push(E, w, S)
  5728. }
  5729. }
  5730. return new r.default(s, o, a, l, h, c, u)
  5731. };
  5732. var n = t("../../vmath"),
  5733. r = (function(t) {
  5734. return t && t.__esModule ? t : {
  5735. default: t
  5736. }
  5737. })(t("./vertex-data"));
  5738. e.exports = i.default
  5739. }), {
  5740. "../../vmath": 326,
  5741. "./vertex-data": 42
  5742. }],
  5743. 40: [(function(t, e, i) {
  5744. "use strict";
  5745. i.__esModule = !0, i.default = function() {
  5746. for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : .4, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .1, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, s = i.radialSegments || 32, o = i.tubularSegments || 32, a = i.arc || 2 * Math.PI, l = [], h = [], c = [], u = [], _ = n.vec3.create(-t - e, -e, -t - e), f = n.vec3.create(t + e, e, t + e), d = t + e, p = 0; p <= s; p++)
  5747. for (var m = 0; m <= o; m++) {
  5748. var y = m / o,
  5749. v = p / s,
  5750. g = y * a,
  5751. x = v * Math.PI * 2,
  5752. b = (t + e * Math.cos(x)) * Math.sin(g),
  5753. A = e * Math.sin(x),
  5754. C = (t + e * Math.cos(x)) * Math.cos(g),
  5755. T = Math.sin(g) * Math.cos(x),
  5756. S = Math.sin(x),
  5757. w = Math.cos(g) * Math.cos(x);
  5758. if (l.push(b, A, C), h.push(T, S, w), c.push(y, v), m < o && p < s) {
  5759. var E = o + 1,
  5760. M = E * p + m,
  5761. D = E * (p + 1) + m,
  5762. B = E * (p + 1) + m + 1,
  5763. I = E * p + m + 1;
  5764. u.push(M, I, D), u.push(I, B, D)
  5765. }
  5766. }
  5767. return new r.default(l, h, c, u, _, f, d)
  5768. };
  5769. var n = t("../../vmath"),
  5770. r = (function(t) {
  5771. return t && t.__esModule ? t : {
  5772. default: t
  5773. }
  5774. })(t("./vertex-data"));
  5775. e.exports = i.default
  5776. }), {
  5777. "../../vmath": 326,
  5778. "./vertex-data": 42
  5779. }],
  5780. 41: [(function(t, e, i) {
  5781. "use strict";
  5782. i.__esModule = !0, i.wireframe = function(t) {
  5783. for (var e = [
  5784. [0, 1],
  5785. [1, 2],
  5786. [2, 0]
  5787. ], i = [], n = {}, r = 0; r < t.length; r += 3)
  5788. for (var s = 0; s < 3; ++s) {
  5789. var o = t[r + e[s][0]],
  5790. a = t[r + e[s][1]],
  5791. l = o > a ? a << 16 | o : o << 16 | a;
  5792. void 0 === n[l] && (n[l] = 0, i.push(o, a))
  5793. }
  5794. return i
  5795. }, i.invWinding = function(t) {
  5796. for (var e = [], i = 0; i < t.length; i += 3) e.push(t[i], t[i + 2], t[i + 1]);
  5797. return e
  5798. }, i.toWavefrontOBJ = function(t) {
  5799. for (var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, i = t.positions, n = t.uvs, r = t.normals, s = t.indices, o = function(t) {
  5800. return s[t] + 1 + "/" + (s[t] + 1) + "/" + (s[t] + 1)
  5801. }, a = "", l = 0; l < i.length; l += 3) a += "v " + i[l] * e + " " + i[l + 1] * e + " " + i[l + 2] * e + "\n";
  5802. for (var h = 0; h < n.length; h += 2) a += "vt " + n[h] + " " + n[h + 1] + "\n";
  5803. for (var c = 0; c < r.length; c += 3) a += "vn " + r[c] + " " + r[c + 1] + " " + r[c + 2] + "\n";
  5804. for (var u = 0; u < s.length; u += 3) a += "f " + o(u) + " " + o(u + 1) + " " + o(u + 2) + "\n";
  5805. return a
  5806. }, i.normals = function(t, e) {
  5807. for (var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, n = new Array(2 * t.length), r = 0; r < t.length / 3; ++r) {
  5808. var s = 3 * r,
  5809. o = 6 * r;
  5810. n[o + 0] = t[s + 0], n[o + 1] = t[s + 1], n[o + 2] = t[s + 2], n[o + 3] = t[s + 0] + e[s + 0] * i, n[o + 4] = t[s + 1] + e[s + 1] * i, n[o + 5] = t[s + 2] + e[s + 2] * i
  5811. }
  5812. return n
  5813. }, i.calcNormals = function(t, e, i) {
  5814. for (var s = 0, o = (i = i || new Array(t.length)).length; s < o; s++) i[s] = 0;
  5815. for (var a = void 0, l = void 0, h = void 0, c = cc.v3(), u = cc.v3(), _ = cc.v3(), f = cc.v3(), d = cc.v3(), p = 0, m = e.length; p < m; p += 3) a = 3 * e[p + 0], l = 3 * e[p + 1], h = 3 * e[p + 2], r(c, t, a), r(u, t, l), r(_, t, h), n.vec3.sub(f, _, u), n.vec3.sub(d, c, u), n.vec3.cross(f, f, d), i[a] += f.x, i[a + 1] += f.y, i[a + 2] += f.z, i[l] += f.x, i[l + 1] += f.y, i[l + 2] += f.z, i[h] += f.x, i[h + 1] += f.y, i[h + 2] += f.z;
  5816. for (var y = cc.v3(), v = 0, g = i.length; v < g; v += 3) y.x = i[v], y.y = i[v + 1], y.z = i[v + 2], y.normalizeSelf(), i[v] = y.x, i[v + 1] = y.y, i[v + 2] = y.z;
  5817. return i
  5818. };
  5819. var n = t("../../vmath");
  5820. function r(t, e, i) {
  5821. t.x = e[i], t.y = e[i + 1], t.z = e[i + 2]
  5822. }
  5823. }), {
  5824. "../../vmath": 326
  5825. }],
  5826. 42: [(function(t, e, i) {
  5827. "use strict";
  5828. i.__esModule = !0, i.default = function(t, e, i, n, r, s, o) {
  5829. this.positions = t, this.normals = e, this.uvs = i, this.indices = n, this.minPos = r, this.maxPos = s, this.boundingRadius = o
  5830. }, e.exports = i.default
  5831. }), {}],
  5832. 43: [(function(t, e, i) {
  5833. "use strict";
  5834. var n = t("../../../animation/animation-curves"),
  5835. r = n.DynamicAnimCurve,
  5836. s = n.quickFindIndex,
  5837. o = cc.Class({
  5838. name: "cc.JointMatrixCurve",
  5839. extends: r,
  5840. _findFrameIndex: s,
  5841. sample: function(t, e) {
  5842. var i = this.ratios,
  5843. n = this._findFrameIndex(i, e);
  5844. n < -1 && (n = ~n - 1);
  5845. for (var r = this.pairs, s = 0; s < r.length; s++) {
  5846. var o = r[s];
  5847. o.target._jointMatrix = o.values[n]
  5848. }
  5849. }
  5850. });
  5851. e.exports = o
  5852. }), {
  5853. "../../../animation/animation-curves": 11
  5854. }],
  5855. 44: [(function(t, e, i) {
  5856. "use strict";
  5857. var n = cc.Class({
  5858. name: "cc.Skeleton",
  5859. extends: cc.Asset,
  5860. ctor: function() {
  5861. this._bindposes = [], this._uniqueBindPoses = [], this._jointPaths = []
  5862. },
  5863. properties: {
  5864. _model: cc.Model,
  5865. _jointIndices: [],
  5866. _skinIndex: -1,
  5867. jointPaths: {
  5868. get: function() {
  5869. return this._jointPaths
  5870. }
  5871. },
  5872. bindposes: {
  5873. get: function() {
  5874. return this._bindposes
  5875. }
  5876. },
  5877. uniqueBindPoses: {
  5878. get: function() {
  5879. return this._uniqueBindPoses
  5880. }
  5881. },
  5882. model: {
  5883. get: function() {
  5884. return this._model
  5885. }
  5886. }
  5887. },
  5888. onLoad: function() {
  5889. for (var t = this._model.nodes, e = this._jointIndices, i = this._jointPaths, n = this._bindposes, r = this._uniqueBindPoses, s = 0; s < e.length; s++) {
  5890. var o = t[e[s]];
  5891. i[s] = o.path, o.uniqueBindPose ? n[s] = r[s] = o.uniqueBindPose : n[s] = o.bindpose[this._skinIndex]
  5892. }
  5893. }
  5894. });
  5895. cc.Skeleton = e.exports = n
  5896. }), {}],
  5897. 45: [(function(t, e, i) {
  5898. "use strict";
  5899. var n = t("../../components/CCAnimation"),
  5900. r = t("../CCModel"),
  5901. s = t("./CCSkeletonAnimationClip"),
  5902. o = cc.Class({
  5903. name: "cc.SkeletonAnimation",
  5904. extends: n,
  5905. editor: !1,
  5906. properties: {
  5907. _model: {
  5908. default: null,
  5909. type: r
  5910. },
  5911. _defaultClip: {
  5912. override: !0,
  5913. default: null,
  5914. type: s
  5915. },
  5916. _clips: {
  5917. override: !0,
  5918. default: [],
  5919. type: [s],
  5920. visible: !0
  5921. },
  5922. defaultClip: {
  5923. override: !0,
  5924. get: function() {
  5925. return this._defaultClip
  5926. },
  5927. set: function(t) {
  5928. this._defaultClip = t
  5929. },
  5930. type: s
  5931. },
  5932. model: {
  5933. get: function() {
  5934. return this._model
  5935. },
  5936. set: function(t) {
  5937. this._model = t, this._updateClipModel()
  5938. },
  5939. type: r
  5940. }
  5941. },
  5942. __preload: function() {
  5943. this._updateClipModel()
  5944. },
  5945. _updateClipModel: function() {
  5946. this._defaultClip && (this._defaultClip._model = this._model);
  5947. for (var t = this._clips, e = 0; e < t.length; e++) t[e]._model = this._model
  5948. },
  5949. addClip: function(t, e) {
  5950. return t._model = this._model, n.prototype.addClip.call(this, t, e)
  5951. },
  5952. searchClips: !1
  5953. });
  5954. cc.SkeletonAnimation = e.exports = o
  5955. }), {
  5956. "../../components/CCAnimation": 90,
  5957. "../CCModel": 27,
  5958. "./CCSkeletonAnimationClip": 46,
  5959. "fire-path": void 0
  5960. }],
  5961. 46: [(function(t, e, i) {
  5962. "use strict";
  5963. var n = (function(t) {
  5964. return t && t.__esModule ? t : {
  5965. default: t
  5966. }
  5967. })(t("../../vmath/mat4"));
  5968. var r = t("../../../animation/animation-clip"),
  5969. s = t("./CCJointMatrixCurve");
  5970. function o(t) {
  5971. var e = new Float32Array(16);
  5972. return e.set(t.m), e
  5973. }
  5974. var a = cc.Class({
  5975. name: "cc.SkeletonAnimationClip",
  5976. extends: r,
  5977. properties: {
  5978. _nativeAsset: {
  5979. override: !0,
  5980. get: function() {
  5981. return this._buffer
  5982. },
  5983. set: function(t) {
  5984. var e = ArrayBuffer.isView(t) ? t.buffer : t;
  5985. this._buffer = new Float32Array(e || t, 0, e.byteLength / 4)
  5986. }
  5987. },
  5988. description: {
  5989. default: null,
  5990. type: Object
  5991. },
  5992. curveData: {
  5993. visible: !1,
  5994. override: !0,
  5995. get: function() {
  5996. return this._curveData || {}
  5997. },
  5998. set: function() {}
  5999. }
  6000. },
  6001. statics: {
  6002. preventDeferredLoadDependents: !0
  6003. },
  6004. _init: function() {
  6005. return this._curveData ? this._curveData : (this._curveData = {}, this._generateCommonCurve(), this._model.precomputeJointMatrix && this._generateJointMatrixCurve(), this._curveData)
  6006. },
  6007. _generateCommonCurve: function() {
  6008. var t = this._buffer,
  6009. e = this.description,
  6010. i = 0;
  6011. function n() {
  6012. return t[i++]
  6013. }
  6014. this._curveData.paths || (this._curveData.paths = {});
  6015. var r = this._curveData.paths;
  6016. for (var s in e) {
  6017. var o = e[s],
  6018. a = {};
  6019. for (var l in r[s] = {
  6020. props: a
  6021. }, o) {
  6022. var h = [],
  6023. c = o[l].frameCount;
  6024. i = o[l].offset;
  6025. for (var u = 0; u < c; u++) {
  6026. var _ = n(),
  6027. f = void 0;
  6028. "position" === l || "scale" === l ? f = cc.v3(n(), n(), n()) : "quat" === l && (f = cc.quat(n(), n(), n(), n())), h.push({
  6029. frame: _,
  6030. value: f
  6031. })
  6032. }
  6033. a[l] = h
  6034. }
  6035. }
  6036. },
  6037. _generateJointMatrixCurve: function() {
  6038. var t = this._model.rootNode,
  6039. e = this._curveData.paths,
  6040. i = {
  6041. ratios: [],
  6042. jointMatrixMap: {}
  6043. },
  6044. r = i.jointMatrixMap;
  6045. function s(i, a, l) {
  6046. var h = void 0,
  6047. c = e[i.path];
  6048. if (i !== t && c) {
  6049. var u = c.props;
  6050. for (var _ in u)
  6051. for (var f = u[_], d = 0; d < f.length; d++) {
  6052. var p = f[d];
  6053. if (Math.abs(p.frame - a) < 1e-4) {
  6054. i[_].set(p.value);
  6055. break
  6056. }
  6057. if (p.frame > a) {
  6058. var m = f[d - 1],
  6059. y = (a - m.frame) / (p.frame - m.frame);
  6060. m.value.lerp(p.value, y, i[_]);
  6061. break
  6062. }
  6063. }
  6064. h = n.default.create(), n.default.fromRTS(h, i.quat, i.position, i.scale), l && n.default.mul(h, l, h), u._jointMatrix || (u._jointMatrix = []);
  6065. var v = void 0;
  6066. i.uniqueBindPose && (v = n.default.create(), n.default.mul(v, h, i.uniqueBindPose)), r[i.path] || (r[i.path] = []), v ? r[i.path].push(o(v)) : r[i.path].push(h)
  6067. }
  6068. var g = i.children;
  6069. for (var x in g) {
  6070. s(g[x], a, h)
  6071. }
  6072. }
  6073. for (var a = 0, l = this.duration, h = 1 / this.sample; a < l;) i.ratios.push(a / l), s(t, a), a += h;
  6074. this._curveData = i
  6075. },
  6076. _createJointMatrixCurve: function(t, e) {
  6077. var i = new s;
  6078. i.ratios = this.curveData.ratios, i.pairs = [];
  6079. var n = this.curveData.jointMatrixMap;
  6080. for (var r in n) {
  6081. var o = cc.find(r, e);
  6082. o && i.pairs.push({
  6083. target: o,
  6084. values: n[r]
  6085. })
  6086. }
  6087. return [i]
  6088. },
  6089. createCurves: function(t, e) {
  6090. return this._model ? (this._init(), this._model.precomputeJointMatrix ? this._createJointMatrixCurve(t, e) : r.prototype.createCurves.call(this, t, e)) : (cc.warn("Skeleton Animation Clip [" + this.name + "] Can not find model"), [])
  6091. }
  6092. });
  6093. cc.SkeletonAnimationClip = e.exports = a
  6094. }), {
  6095. "../../../animation/animation-clip": 10,
  6096. "../../vmath/mat4": 330,
  6097. "./CCJointMatrixCurve": 43
  6098. }],
  6099. 47: [(function(t, e, i) {
  6100. "use strict";
  6101. var n = t("./CCSkeleton"),
  6102. r = t("../../mesh/CCMeshRenderer"),
  6103. s = t("../../renderer/render-flow"),
  6104. o = t("../../../renderer/enums"),
  6105. a = cc.vmath.mat4,
  6106. l = a.create(),
  6107. h = a.create(),
  6108. c = cc.Class({
  6109. name: "cc.SkinnedMeshRenderer",
  6110. extends: r,
  6111. editor: !1,
  6112. ctor: function() {
  6113. this._jointsData = this._jointsFloat32Data = null, this._jointsTexture = null, this._joints = [], this._dummyNode = new cc.Node, this._jointsTextureOptions = null, this._usingRGBA8Texture = !1
  6114. },
  6115. properties: {
  6116. _skeleton: n,
  6117. _rootBone: cc.Node,
  6118. skeleton: {
  6119. get: function() {
  6120. return this._skeleton
  6121. },
  6122. set: function(t) {
  6123. this._skeleton = t, this._init(), this._activateMaterial(!0)
  6124. },
  6125. type: n
  6126. },
  6127. rootBone: {
  6128. get: function() {
  6129. return this._rootBone
  6130. },
  6131. set: function(t) {
  6132. this._rootBone = t, this._init()
  6133. },
  6134. type: cc.Node
  6135. },
  6136. enableAutoBatch: {
  6137. get: function() {
  6138. return !1
  6139. },
  6140. visible: !1,
  6141. override: !0
  6142. }
  6143. },
  6144. _activateMaterial: function(t) {
  6145. this._jointsData ? this._super(t) : this.disableRender()
  6146. },
  6147. __preload: function() {
  6148. this._resetAssembler(), this._init()
  6149. },
  6150. _init: function() {
  6151. this._model = this._skeleton && this._skeleton.model, this._calFunc = null, this._initJoints(), this._initJointsTexture(), this._initCalcFunc(), this._updateRenderNode()
  6152. },
  6153. _calcWorldMatrixToRoot: function(t) {
  6154. var e = t._worldMatrixToRoot;
  6155. if (!e) {
  6156. t._worldMatrixToRoot = e = cc.mat4(), t.getLocalMatrix(e);
  6157. var i = t.parent;
  6158. i !== this.rootBone && (i._worldMatrixToRoot || this._calcWorldMatrixToRoot(i), a.mul(e, i._worldMatrixToRoot, e))
  6159. }
  6160. },
  6161. _initJoints: function() {
  6162. var t = this._joints;
  6163. if (t.length = 0, this.skeleton && this.rootBone) {
  6164. for (var e = this._useJointMatrix(), i = this.skeleton.jointPaths, n = this.rootBone, r = 0; r < i.length; r++) {
  6165. var o = cc.find(i[r], n);
  6166. o || cc.warn("Can not find joint in root bone [%s] with path [%s]", n.name, i[r]), e && (o._renderFlag &= ~s.FLAG_CHILDREN, this._calcWorldMatrixToRoot(o)), t.push(o)
  6167. }
  6168. if (e)
  6169. for (var h = this.skeleton.uniqueBindPoses, c = 0; c < i.length; c++) {
  6170. var u = t[c];
  6171. h[c] ? (a.mul(l, u._worldMatrixToRoot, h[c]), u._jointMatrix = a.array([], l)) : u._jointMatrix = u._worldMatrixToRoot
  6172. }
  6173. }
  6174. },
  6175. _initJointsTexture: function() {
  6176. if (this._skeleton) {
  6177. var t = this._joints.length,
  6178. e = this._customProperties,
  6179. i = !1;
  6180. if (t <= cc.sys.getMaxJointMatrixSize() && (i = !0, this._jointsData = this._jointsFloat32Data = new Float32Array(16 * t), e.setProperty("cc_jointMatrices", this._jointsFloat32Data, o.PARAM_FLOAT4, !0), e.define("CC_USE_JOINTS_TEXTRUE", !1)), !i) {
  6181. var n = !!cc.sys.glExtension("OES_texture_float"),
  6182. r = void 0;
  6183. r = t > 256 ? 64 : t > 64 ? 32 : t > 16 ? 16 : 8, this._jointsData = this._jointsFloat32Data = new Float32Array(r * r * 4);
  6184. var s = cc.Texture2D.PixelFormat.RGBA32F,
  6185. a = r,
  6186. l = r;
  6187. n || (this._jointsData = new Uint8Array(this._jointsFloat32Data.buffer), s = cc.Texture2D.PixelFormat.RGBA8888, a *= 4, this._usingRGBA8Texture = !0, cc.warn("SkinnedMeshRenderer [" + this.node.name + "] has too many joints [" + t + "] and device do not support float32 texture, fallback to use RGBA8888 texture, which is much slower."));
  6188. var h = this._jointsTexture || new cc.Texture2D,
  6189. c = cc.Texture2D.Filter.NEAREST;
  6190. h.setFilters(c, c), h.initWithData(this._jointsData, s, a, l), this._jointsTexture = h, this._jointsTextureOptions = {
  6191. format: s,
  6192. width: h.width,
  6193. height: h.height,
  6194. images: []
  6195. }, e.setProperty("cc_jointsTexture", h.getImpl(), o.PARAM_TEXTURE_2D), e.setProperty("cc_jointsTextureSize", new Float32Array([a, l]), o.PARAM_FLOAT2), e.define("CC_JOINTS_TEXTURE_FLOAT32", n), e.define("CC_USE_JOINTS_TEXTRUE", !0)
  6196. }
  6197. e.define("CC_USE_SKINNING", !0)
  6198. }
  6199. },
  6200. _setJointsDataWithArray: function(t, e) {
  6201. this._jointsFloat32Data.set(e, 16 * t)
  6202. },
  6203. _setJointsDataWithMatrix: function(t, e) {
  6204. this._jointsFloat32Data.set(e.m, 16 * t)
  6205. },
  6206. _commitJointsData: function() {
  6207. this._jointsTexture && (this._jointsTextureOptions.images[0] = this._jointsData, this._jointsTexture.update(this._jointsTextureOptions))
  6208. },
  6209. _useJointMatrix: function() {
  6210. return this._model && this._model.precomputeJointMatrix
  6211. },
  6212. _updateRenderNode: function() {
  6213. this._useJointMatrix() || this._usingRGBA8Texture ? this._assembler.setRenderNode(this.rootBone) : this._assembler.setRenderNode(this._dummyNode)
  6214. },
  6215. _initCalcFunc: function() {
  6216. this._useJointMatrix() ? this._calFunc = this._calJointMatrix : this._usingRGBA8Texture ? this._calFunc = this._calRGBA8WorldMatrix : this._calFunc = this._calWorldMatrix
  6217. },
  6218. _calJointMatrix: function() {
  6219. for (var t = this._joints, e = this.skeleton.bindposes, i = this.skeleton.uniqueBindPoses, n = 0; n < t.length; ++n) {
  6220. var r = t[n]._jointMatrix;
  6221. i[n] ? this._setJointsDataWithArray(n, r) : (a.multiply(l, r, e[n]), this._setJointsDataWithMatrix(n, l))
  6222. }
  6223. },
  6224. _calRGBA8WorldMatrix: function() {
  6225. var t = this._joints,
  6226. e = this.skeleton.bindposes;
  6227. this.rootBone._updateWorldMatrix();
  6228. for (var i = this.rootBone._worldMatrix, n = a.invert(h, i), r = 0; r < t.length; ++r) {
  6229. var s = t[r];
  6230. s._updateWorldMatrix(), a.multiply(l, n, s._worldMatrix), a.multiply(l, l, e[r]), this._setJointsDataWithMatrix(r, l)
  6231. }
  6232. },
  6233. _calWorldMatrix: function() {
  6234. for (var t = this._joints, e = this.skeleton.bindposes, i = 0; i < t.length; ++i) {
  6235. var n = t[i];
  6236. n._updateWorldMatrix(), a.multiply(l, n._worldMatrix, e[i]), this._setJointsDataWithMatrix(i, l)
  6237. }
  6238. },
  6239. calcJointMatrix: function() {
  6240. this.skeleton && this.rootBone && (this._calFunc.call(this), this._commitJointsData())
  6241. }
  6242. });
  6243. cc.SkinnedMeshRenderer = e.exports = c
  6244. }), {
  6245. "../../../renderer/enums": 355,
  6246. "../../mesh/CCMeshRenderer": 166,
  6247. "../../renderer/render-flow": 248,
  6248. "./CCSkeleton": 44
  6249. }],
  6250. 48: [(function(t, e, i) {
  6251. "use strict";
  6252. function n(t, e) {
  6253. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  6254. }
  6255. function r(t, e) {
  6256. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  6257. return !e || "object" != typeof e && "function" != typeof e ? t : e
  6258. }
  6259. function s(t, e) {
  6260. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  6261. t.prototype = Object.create(e && e.prototype, {
  6262. constructor: {
  6263. value: t,
  6264. enumerable: !1,
  6265. writable: !0,
  6266. configurable: !0
  6267. }
  6268. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  6269. }
  6270. i.__esModule = !0;
  6271. var o = t("./CCSkinnedMeshRenderer"),
  6272. a = t("../../mesh/mesh-renderer"),
  6273. l = (t("../../renderer/render-flow"), (function(t) {
  6274. function e() {
  6275. return n(this, e), r(this, t.apply(this, arguments))
  6276. }
  6277. return s(e, t), e.prototype.fillBuffers = function(e, i) {
  6278. e.calcJointMatrix(), t.prototype.fillBuffers.call(this, e, i)
  6279. }, e
  6280. })(a));
  6281. i.default = l, cc.Assembler.register(o, l), e.exports = i.default
  6282. }), {
  6283. "../../mesh/mesh-renderer": 169,
  6284. "../../renderer/render-flow": 248,
  6285. "./CCSkinnedMeshRenderer": 47
  6286. }],
  6287. 49: [(function(t, e, i) {
  6288. "use strict";
  6289. var n = t("./platform/utils"),
  6290. r = (t("../../DebugInfos"), "https://github.com/cocos-creator/engine/blob/master/EngineErrorMap.md"),
  6291. s = void 0;
  6292. cc.log = cc.warn = cc.error = cc.assert = console.log.bind ? console.log.bind(console) : console.log;
  6293. function o(t) {
  6294. return function() {
  6295. var e = arguments[0],
  6296. i = t + " " + e + ", please go to " + r + "#" + e + " to see details.";
  6297. if (1 === arguments.length) return i;
  6298. if (2 === arguments.length) return i + " Arguments: " + arguments[1];
  6299. var n = cc.js.shiftArguments.apply(null, arguments);
  6300. return i + " Arguments: " + n.join(", ")
  6301. }
  6302. }
  6303. cc._throw = function(t) {
  6304. n.callInNextTick((function() {
  6305. throw t
  6306. }))
  6307. };
  6308. var a = o("Log");
  6309. cc.logID = function() {
  6310. cc.log(a.apply(null, arguments))
  6311. };
  6312. var l = o("Warning");
  6313. cc.warnID = function() {
  6314. cc.warn(l.apply(null, arguments))
  6315. };
  6316. var h = o("Error");
  6317. cc.errorID = function() {
  6318. cc.error(h.apply(null, arguments))
  6319. };
  6320. var c = o("Assert");
  6321. cc.assertID = function(t) {
  6322. t || cc.assert(!1, c.apply(null, cc.js.shiftArguments.apply(null, arguments)))
  6323. };
  6324. var u = cc.Enum({
  6325. NONE: 0,
  6326. INFO: 1,
  6327. WARN: 2,
  6328. ERROR: 3,
  6329. INFO_FOR_WEB_PAGE: 4,
  6330. WARN_FOR_WEB_PAGE: 5,
  6331. ERROR_FOR_WEB_PAGE: 6
  6332. });
  6333. e.exports = cc.debug = {
  6334. DebugMode: u,
  6335. _resetDebugSetting: function(t) {
  6336. if (cc.log = cc.warn = cc.error = cc.assert = function() {}, t !== u.NONE) {
  6337. if (t > u.ERROR) {
  6338. var e = function(t) {
  6339. if (cc.game.canvas) {
  6340. if (!s) {
  6341. var e = document.createElement("Div");
  6342. e.setAttribute("id", "logInfoDiv"), e.setAttribute("width", "200"), e.setAttribute("height", cc.game.canvas.height);
  6343. var i = e.style;
  6344. i.zIndex = "99999", i.position = "absolute", i.top = i.left = "0", (s = document.createElement("textarea")).setAttribute("rows", "20"), s.setAttribute("cols", "30"), s.setAttribute("disabled", "true");
  6345. var n = s.style;
  6346. n.backgroundColor = "transparent", n.borderBottom = "1px solid #cccccc", n.borderTopWidth = n.borderLeftWidth = n.borderRightWidth = "0px", n.borderTopStyle = n.borderLeftStyle = n.borderRightStyle = "none", n.padding = "0px", n.margin = 0, e.appendChild(s), cc.game.canvas.parentNode.appendChild(e)
  6347. }
  6348. s.value = s.value + t + "\r\n", s.scrollTop = s.scrollHeight
  6349. }
  6350. };
  6351. cc.error = function() {
  6352. e("ERROR : " + cc.js.formatStr.apply(null, arguments))
  6353. }, cc.assert = function(t, i) {
  6354. !t && i && (i = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments)), e("ASSERT: " + i))
  6355. }, t !== u.ERROR_FOR_WEB_PAGE && (cc.warn = function() {
  6356. e("WARN : " + cc.js.formatStr.apply(null, arguments))
  6357. }), t === u.INFO_FOR_WEB_PAGE && (cc.log = function() {
  6358. e(cc.js.formatStr.apply(null, arguments))
  6359. })
  6360. } else console && console.log.apply && (console.error || (console.error = console.log), console.warn || (console.warn = console.log), console.error.bind ? cc.error = console.error.bind(console) : cc.error = function() {
  6361. return console.error.apply(console, arguments)
  6362. }, cc.assert = function(t, e) {
  6363. if (!t) throw e && (e = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments))), new Error(e)
  6364. });
  6365. t !== u.ERROR && (console.warn.bind ? cc.warn = console.warn.bind(console) : cc.warn = function() {
  6366. return console.warn.apply(console, arguments)
  6367. }), t === u.INFO && (console.log.bind ? cc.log = console.log.bind(console) : cc.log = function() {
  6368. return console.log.apply(console, arguments)
  6369. })
  6370. }
  6371. },
  6372. getError: o("ERROR"),
  6373. isDisplayStats: function() {
  6374. return !!cc.profiler && cc.profiler.isShowingStats()
  6375. },
  6376. setDisplayStats: function(t) {
  6377. cc.profiler && (t ? cc.profiler.showStats() : cc.profiler.hideStats(), cc.game.config.showFPS = !!t)
  6378. }
  6379. }
  6380. }), {
  6381. "../../DebugInfos": void 0,
  6382. "./platform/utils": 222
  6383. }],
  6384. 50: [(function(t, e, i) {
  6385. "use strict";
  6386. var n = t("./event/event-target"),
  6387. r = t("./load-pipeline/auto-release-utils"),
  6388. s = t("./component-scheduler"),
  6389. o = t("./node-activator"),
  6390. a = t("./platform/CCObject"),
  6391. l = t("./CCGame"),
  6392. h = t("./renderer"),
  6393. c = t("./event-manager"),
  6394. u = t("./CCScheduler");
  6395. cc.Director = function() {
  6396. n.call(this), this._paused = !1, this._purgeDirectorInNextLoop = !1, this._winSizeInPoints = null, this._loadingScene = "", this._scene = null, this._totalFrames = 0, this._lastUpdate = 0, this._deltaTime = 0, this._startTime = 0, this._scheduler = null, this._compScheduler = null, this._nodeActivator = null, this._actionManager = null;
  6397. var t = this;
  6398. l.on(l.EVENT_SHOW, (function() {
  6399. t._lastUpdate = performance.now()
  6400. })), l.once(l.EVENT_ENGINE_INITED, this.init, this)
  6401. }, cc.Director.prototype = {
  6402. constructor: cc.Director,
  6403. init: function() {
  6404. return this._totalFrames = 0, this._lastUpdate = performance.now(), this._startTime = this._lastUpdate, this._paused = !1, this._purgeDirectorInNextLoop = !1, this._winSizeInPoints = cc.size(0, 0), this._scheduler = new u, cc.ActionManager ? (this._actionManager = new cc.ActionManager, this._scheduler.scheduleUpdate(this._actionManager, u.PRIORITY_SYSTEM, !1)) : this._actionManager = null, this.sharedInit(), !0
  6405. },
  6406. sharedInit: function() {
  6407. this._compScheduler = new s, this._nodeActivator = new o, c && c.setEnabled(!0), cc.AnimationManager ? (this._animationManager = new cc.AnimationManager, this._scheduler.scheduleUpdate(this._animationManager, u.PRIORITY_SYSTEM, !1)) : this._animationManager = null, cc.CollisionManager ? (this._collisionManager = new cc.CollisionManager, this._scheduler.scheduleUpdate(this._collisionManager, u.PRIORITY_SYSTEM, !1)) : this._collisionManager = null, cc.PhysicsManager ? (this._physicsManager = new cc.PhysicsManager, this._scheduler.scheduleUpdate(this._physicsManager, u.PRIORITY_SYSTEM, !1)) : this._physicsManager = null, cc._widgetManager && cc._widgetManager.init(this), cc.loader.init(this)
  6408. },
  6409. calculateDeltaTime: function(t) {
  6410. t || (t = performance.now()), this._deltaTime = t > this._lastUpdate ? (t - this._lastUpdate) / 1e3 : 0, this._lastUpdate = t
  6411. },
  6412. convertToGL: function(t) {
  6413. var e = l.container,
  6414. i = cc.view,
  6415. n = e.getBoundingClientRect(),
  6416. r = n.left + window.pageXOffset - e.clientLeft,
  6417. s = n.top + window.pageYOffset - e.clientTop,
  6418. o = i._devicePixelRatio * (t.x - r),
  6419. a = i._devicePixelRatio * (s + n.height - t.y);
  6420. return i._isRotated ? cc.v2(i._viewportRect.width - a, o) : cc.v2(o, a)
  6421. },
  6422. convertToUI: function(t) {
  6423. var e = l.container,
  6424. i = cc.view,
  6425. n = e.getBoundingClientRect(),
  6426. r = n.left + window.pageXOffset - e.clientLeft,
  6427. s = n.top + window.pageYOffset - e.clientTop,
  6428. o = cc.v2(0, 0);
  6429. return i._isRotated ? (o.x = r + t.y / i._devicePixelRatio, o.y = s + n.height - (i._viewportRect.width - t.x) / i._devicePixelRatio) : (o.x = r + t.x * i._devicePixelRatio, o.y = s + n.height - t.y * i._devicePixelRatio), o
  6430. },
  6431. end: function() {
  6432. this._purgeDirectorInNextLoop = !0
  6433. },
  6434. getWinSize: function() {
  6435. return cc.size(cc.winSize)
  6436. },
  6437. getWinSizeInPixels: function() {
  6438. return cc.size(cc.winSize)
  6439. },
  6440. pause: function() {
  6441. this._paused || (this._paused = !0)
  6442. },
  6443. purgeCachedData: function() {
  6444. cc.loader.releaseAll()
  6445. },
  6446. purgeDirector: function() {
  6447. this._scheduler.unscheduleAll(), this._compScheduler.unscheduleAll(), this._nodeActivator.reset(), c && c.setEnabled(!1), cc.isValid(this._scene) && this._scene.destroy(), this._scene = null, cc.renderer.clear(), cc.AssetLibrary.resetBuiltins(), cc.game.pause(), cc.loader.releaseAll()
  6448. },
  6449. reset: function() {
  6450. this.purgeDirector(), c && c.setEnabled(!0), this._actionManager && this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1), this._animationManager && this._scheduler.scheduleUpdate(this._animationManager, cc.Scheduler.PRIORITY_SYSTEM, !1), this._collisionManager && this._scheduler.scheduleUpdate(this._collisionManager, cc.Scheduler.PRIORITY_SYSTEM, !1), this._physicsManager && this._scheduler.scheduleUpdate(this._physicsManager, cc.Scheduler.PRIORITY_SYSTEM, !1), cc.game.resume()
  6451. },
  6452. runSceneImmediate: function(t, e, i) {
  6453. cc.assertID(t instanceof cc.Scene, 1216), t._load();
  6454. for (var n = Object.keys(l._persistRootNodes).map((function(t) {
  6455. return l._persistRootNodes[t]
  6456. })), s = 0; s < n.length; s++) {
  6457. var o = n[s],
  6458. h = t.getChildByUuid(o.uuid);
  6459. if (h) {
  6460. var c = h.getSiblingIndex();
  6461. h._destroyImmediate(), t.insertChild(o, c)
  6462. } else o.parent = t
  6463. }
  6464. var u = this._scene,
  6465. _ = u && u.autoReleaseAssets && u.dependAssets;
  6466. r.autoRelease(_, t.dependAssets, n), cc.isValid(u) && u.destroy(), this._scene = null, a._deferredDestroy(), e && e(), this.emit(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, t), this._scene = t, t._activate(), cc.game.resume(), i && i(null, t), this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, t)
  6467. },
  6468. runScene: function(t, e, i) {
  6469. cc.assertID(t, 1205), cc.assertID(t instanceof cc.Scene, 1216), t._load(), this.once(cc.Director.EVENT_AFTER_UPDATE, (function() {
  6470. this.runSceneImmediate(t, e, i)
  6471. }), this)
  6472. },
  6473. _getSceneUuid: function(t) {
  6474. var e = l._sceneInfos;
  6475. if ("string" == typeof t) {
  6476. t.endsWith(".fire") || (t += ".fire"), "/" === t[0] || t.startsWith("db://") || (t = "/" + t);
  6477. for (var i = 0; i < e.length; i++) {
  6478. var n = e[i];
  6479. if (n.url.endsWith(t)) return n
  6480. }
  6481. } else if ("number" == typeof t) {
  6482. if (0 <= t && t < e.length) return e[t];
  6483. cc.errorID(1206, t)
  6484. } else cc.errorID(1207, t);
  6485. return null
  6486. },
  6487. loadScene: function(t, e, i) {
  6488. if (this._loadingScene) return cc.warnID(1208, t, this._loadingScene), !1;
  6489. var n = this._getSceneUuid(t);
  6490. if (n) {
  6491. var r = n.uuid;
  6492. return this.emit(cc.Director.EVENT_BEFORE_SCENE_LOADING, t), this._loadingScene = t, this._loadSceneByUuid(r, e, i), !0
  6493. }
  6494. return cc.errorID(1209, t), !1
  6495. },
  6496. preloadScene: function(t, e, i) {
  6497. void 0 === i && (i = e, e = null);
  6498. var n = this._getSceneUuid(t);
  6499. if (n) this.emit(cc.Director.EVENT_BEFORE_SCENE_LOADING, t), cc.loader.load({
  6500. uuid: n.uuid,
  6501. type: "uuid"
  6502. }, e, (function(e, n) {
  6503. e && cc.errorID(1210, t, e.message), i && i(e, n)
  6504. }));
  6505. else {
  6506. var r = 'Can not preload the scene "' + t + '" because it is not in the build settings.';
  6507. i(new Error(r)), cc.error("preloadScene: " + r)
  6508. }
  6509. },
  6510. _loadSceneByUuid: function(t, e, i, n) {
  6511. console.time("LoadScene " + t), cc.AssetLibrary.loadAsset(t, (function(n, r) {
  6512. console.timeEnd("LoadScene " + t);
  6513. var s = cc.director;
  6514. if (s._loadingScene = "", n) n = "Failed to load scene: " + n, cc.error(n);
  6515. else {
  6516. if (r instanceof cc.SceneAsset) {
  6517. var o = r.scene;
  6518. return o._id = r._uuid, o._name = r._name, void s.runSceneImmediate(o, i, e)
  6519. }
  6520. n = "The asset " + t + " is not a scene", cc.error(n)
  6521. }
  6522. e && e(n)
  6523. }))
  6524. },
  6525. resume: function() {
  6526. this._paused && (this._lastUpdate = performance.now(), this._lastUpdate || cc.logID(1200), this._paused = !1, this._deltaTime = 0)
  6527. },
  6528. setDepthTest: function(t) {
  6529. cc.Camera.main && (cc.Camera.main.depth = !!t)
  6530. },
  6531. setClearColor: function(t) {
  6532. cc.Camera.main && (cc.Camera.main.backgroundColor = t)
  6533. },
  6534. getRunningScene: function() {
  6535. return this._scene
  6536. },
  6537. getScene: function() {
  6538. return this._scene
  6539. },
  6540. getAnimationInterval: function() {
  6541. return 1e3 / l.getFrameRate()
  6542. },
  6543. setAnimationInterval: function(t) {
  6544. l.setFrameRate(Math.round(1e3 / t))
  6545. },
  6546. getDeltaTime: function() {
  6547. return this._deltaTime
  6548. },
  6549. getTotalTime: function() {
  6550. return performance.now() - this._startTime
  6551. },
  6552. getTotalFrames: function() {
  6553. return this._totalFrames
  6554. },
  6555. isPaused: function() {
  6556. return this._paused
  6557. },
  6558. getScheduler: function() {
  6559. return this._scheduler
  6560. },
  6561. setScheduler: function(t) {
  6562. this._scheduler !== t && (this._scheduler = t)
  6563. },
  6564. getActionManager: function() {
  6565. return this._actionManager
  6566. },
  6567. setActionManager: function(t) {
  6568. this._actionManager !== t && (this._actionManager && this._scheduler.unscheduleUpdate(this._actionManager), this._actionManager = t, this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1))
  6569. },
  6570. getAnimationManager: function() {
  6571. return this._animationManager
  6572. },
  6573. getCollisionManager: function() {
  6574. return this._collisionManager
  6575. },
  6576. getPhysicsManager: function() {
  6577. return this._physicsManager
  6578. },
  6579. startAnimation: function() {
  6580. cc.game.resume()
  6581. },
  6582. stopAnimation: function() {
  6583. cc.game.pause()
  6584. },
  6585. _resetDeltaTime: function() {
  6586. this._lastUpdate = performance.now(), this._deltaTime = 0
  6587. },
  6588. mainLoop: function(t) {
  6589. this._purgeDirectorInNextLoop ? (this._purgeDirectorInNextLoop = !1, this.purgeDirector()) : (this.calculateDeltaTime(t), this._paused || (this.emit(cc.Director.EVENT_BEFORE_UPDATE), this._compScheduler.startPhase(), this._compScheduler.updatePhase(this._deltaTime), this._scheduler.update(this._deltaTime), this._compScheduler.lateUpdatePhase(this._deltaTime), this.emit(cc.Director.EVENT_AFTER_UPDATE), a._deferredDestroy()), this.emit(cc.Director.EVENT_BEFORE_DRAW), h.render(this._scene, this._deltaTime), this.emit(cc.Director.EVENT_AFTER_DRAW), c.frameUpdateListeners(), this._totalFrames++)
  6590. },
  6591. __fastOn: function(t, e, i) {
  6592. this.on(t, e, i)
  6593. },
  6594. __fastOff: function(t, e, i) {
  6595. this.off(t, e, i)
  6596. }
  6597. }, cc.js.addon(cc.Director.prototype, n.prototype), cc.Director.EVENT_PROJECTION_CHANGED = "director_projection_changed", cc.Director.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading", cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch", cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch", cc.Director.EVENT_BEFORE_UPDATE = "director_before_update", cc.Director.EVENT_AFTER_UPDATE = "director_after_update", cc.Director.EVENT_BEFORE_VISIT = "director_before_draw", cc.Director.EVENT_AFTER_VISIT = "director_before_draw", cc.Director.EVENT_BEFORE_DRAW = "director_before_draw", cc.Director.EVENT_AFTER_DRAW = "director_after_draw", cc.Director.PROJECTION_2D = 0, cc.Director.PROJECTION_3D = 1, cc.Director.PROJECTION_CUSTOM = 3, cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_2D, cc.director = new cc.Director, e.exports = cc.director
  6598. }), {
  6599. "./CCGame": 51,
  6600. "./CCScheduler": 55,
  6601. "./component-scheduler": 89,
  6602. "./event-manager": 129,
  6603. "./event/event-target": 131,
  6604. "./load-pipeline/auto-release-utils": 149,
  6605. "./node-activator": 170,
  6606. "./platform/CCObject": 204,
  6607. "./renderer": 247
  6608. }],
  6609. 51: [(function(t, e, i) {
  6610. "use strict";
  6611. var n = t("./event/event-target");
  6612. t("../audio/CCAudioEngine");
  6613. var r = t("./CCDebug"),
  6614. s = t("./renderer/index.js"),
  6615. o = t("../core/renderer/utils/dynamic-atlas/manager"),
  6616. a = {
  6617. EVENT_HIDE: "game_on_hide",
  6618. EVENT_SHOW: "game_on_show",
  6619. EVENT_RESTART: "game_on_restart",
  6620. EVENT_GAME_INITED: "game_inited",
  6621. EVENT_ENGINE_INITED: "engine_inited",
  6622. EVENT_RENDERER_INITED: "engine_inited",
  6623. RENDER_TYPE_CANVAS: 0,
  6624. RENDER_TYPE_WEBGL: 1,
  6625. RENDER_TYPE_OPENGL: 2,
  6626. _persistRootNodes: {},
  6627. _paused: !0,
  6628. _configLoaded: !1,
  6629. _isCloning: !1,
  6630. _prepared: !1,
  6631. _rendererInitialized: !1,
  6632. _renderContext: null,
  6633. _intervalId: null,
  6634. _lastTime: null,
  6635. _frameTime: null,
  6636. _sceneInfos: [],
  6637. frame: null,
  6638. container: null,
  6639. canvas: null,
  6640. renderType: -1,
  6641. config: null,
  6642. onStart: null,
  6643. setFrameRate: function(t) {
  6644. this.config.frameRate = t, this._intervalId && window.cancelAnimFrame(this._intervalId), this._intervalId = 0, this._paused = !0, this._setAnimFrame(), this._runMainLoop()
  6645. },
  6646. getFrameRate: function() {
  6647. return this.config.frameRate
  6648. },
  6649. step: function() {
  6650. cc.director.mainLoop()
  6651. },
  6652. pause: function() {
  6653. this._paused || (this._paused = !0, cc.audioEngine && cc.audioEngine._break(), this._intervalId && window.cancelAnimFrame(this._intervalId), this._intervalId = 0)
  6654. },
  6655. resume: function() {
  6656. this._paused && (this._paused = !1, cc.audioEngine && cc.audioEngine._restore(), cc.director._resetDeltaTime(), this._runMainLoop())
  6657. },
  6658. isPaused: function() {
  6659. return this._paused
  6660. },
  6661. restart: function() {
  6662. cc.director.once(cc.Director.EVENT_AFTER_DRAW, (function() {
  6663. for (var t in a._persistRootNodes) a.removePersistRootNode(a._persistRootNodes[t]);
  6664. cc.director.getScene().destroy(), cc.Object._deferredDestroy(), cc.audioEngine && cc.audioEngine.uncacheAll(), cc.director.reset(), a.pause(), cc.AssetLibrary._loadBuiltins((function() {
  6665. a.onStart(), a.emit(a.EVENT_RESTART)
  6666. }))
  6667. }))
  6668. },
  6669. end: function() {
  6670. close()
  6671. },
  6672. _initEngine: function() {
  6673. this._rendererInitialized || (this._initRenderer(), this._initEvents(), this.emit(this.EVENT_ENGINE_INITED))
  6674. },
  6675. _prepareFinished: function(t) {
  6676. var e = this;
  6677. this._initEngine(), this._setAnimFrame(), cc.AssetLibrary._loadBuiltins((function() {
  6678. console.log("Cocos Creator v" + cc.ENGINE_VERSION), e._prepared = !0, e._runMainLoop(), e.emit(e.EVENT_GAME_INITED), t && t()
  6679. }))
  6680. },
  6681. eventTargetOn: n.prototype.on,
  6682. eventTargetOnce: n.prototype.once,
  6683. on: function(t, e, i) {
  6684. this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOn(t, e, i)
  6685. },
  6686. once: function(t, e, i) {
  6687. this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOnce(t, e, i)
  6688. },
  6689. prepare: function(t) {
  6690. if (this._prepared) t && t();
  6691. else {
  6692. var e = this.config.jsList;
  6693. if (e && e.length > 0) {
  6694. var i = this;
  6695. cc.loader.load(e, (function(e) {
  6696. if (e) throw new Error(JSON.stringify(e));
  6697. i._prepareFinished(t)
  6698. }))
  6699. } else this._prepareFinished(t)
  6700. }
  6701. },
  6702. run: function(t, e) {
  6703. this._initConfig(t), this.onStart = e, this.prepare(a.onStart && a.onStart.bind(a))
  6704. },
  6705. addPersistRootNode: function(t) {
  6706. if (cc.Node.isNode(t) && t.uuid) {
  6707. var e = t.uuid;
  6708. if (!this._persistRootNodes[e]) {
  6709. var i = cc.director._scene;
  6710. if (cc.isValid(i))
  6711. if (t.parent) {
  6712. if (!(t.parent instanceof cc.Scene)) return void cc.warnID(3801);
  6713. if (t.parent !== i) return void cc.warnID(3802)
  6714. } else t.parent = i;
  6715. this._persistRootNodes[e] = t, t._persistNode = !0
  6716. }
  6717. } else cc.warnID(3800)
  6718. },
  6719. removePersistRootNode: function(t) {
  6720. var e = t.uuid || "";
  6721. t === this._persistRootNodes[e] && (delete this._persistRootNodes[e], t._persistNode = !1)
  6722. },
  6723. isPersistRootNode: function(t) {
  6724. return t._persistNode
  6725. },
  6726. _setAnimFrame: function() {
  6727. this._lastTime = performance.now();
  6728. var t = a.config.frameRate;
  6729. this._frameTime = 1e3 / t, 60 !== t && 30 !== t ? (window.requestAnimFrame = this._stTime, window.cancelAnimFrame = this._ctTime) : (window.requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || this._stTime, window.cancelAnimFrame = window.cancelAnimationFrame || window.cancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame || window.msCancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.oCancelAnimationFrame || this._ctTime)
  6730. },
  6731. _stTime: function(t) {
  6732. var e = performance.now(),
  6733. i = Math.max(0, a._frameTime - (e - a._lastTime)),
  6734. n = window.setTimeout((function() {
  6735. t()
  6736. }), i);
  6737. return a._lastTime = e + i, n
  6738. },
  6739. _ctTime: function(t) {
  6740. window.clearTimeout(t)
  6741. },
  6742. _runMainLoop: function() {
  6743. if (this._prepared) {
  6744. var t, e = this,
  6745. i = e.config,
  6746. n = cc.director,
  6747. s = !0,
  6748. o = i.frameRate;
  6749. r.setDisplayStats(i.showFPS), t = function(i) {
  6750. if (!e._paused) {
  6751. if (e._intervalId = window.requestAnimFrame(t), 30 === o && (s = !s)) return;
  6752. n.mainLoop(i)
  6753. }
  6754. }, e._intervalId = window.requestAnimFrame(t), e._paused = !1
  6755. }
  6756. },
  6757. _initConfig: function(t) {
  6758. "number" != typeof t.debugMode && (t.debugMode = 0), t.exposeClassName = !!t.exposeClassName, "number" != typeof t.frameRate && (t.frameRate = 60);
  6759. var e = t.renderMode;
  6760. ("number" != typeof e || e > 2 || e < 0) && (t.renderMode = 0), "boolean" != typeof t.registerSystemEvent && (t.registerSystemEvent = !0), t.showFPS = !!t.showFPS, this._sceneInfos = t.scenes || [], this.collisionMatrix = t.collisionMatrix || [], this.groupList = t.groupList || [], r._resetDebugSetting(t.debugMode), this.config = t, this._configLoaded = !0
  6761. },
  6762. _determineRenderType: function() {
  6763. var t = this.config,
  6764. e = parseInt(t.renderMode) || 0;
  6765. this.renderType = this.RENDER_TYPE_CANVAS;
  6766. var i = !1;
  6767. if (0 === e ? cc.sys.capabilities.opengl ? (this.renderType = this.RENDER_TYPE_WEBGL, i = !0) : cc.sys.capabilities.canvas && (this.renderType = this.RENDER_TYPE_CANVAS, i = !0) : 1 === e && cc.sys.capabilities.canvas ? (this.renderType = this.RENDER_TYPE_CANVAS, i = !0) : 2 === e && cc.sys.capabilities.opengl && (this.renderType = this.RENDER_TYPE_WEBGL, i = !0), !i) throw new Error(r.getError(3820, e))
  6768. },
  6769. _initRenderer: function() {
  6770. if (!this._rendererInitialized) {
  6771. var t = this.config.id,
  6772. e = void 0,
  6773. i = void 0,
  6774. n = void 0,
  6775. r = void 0,
  6776. a = t instanceof HTMLElement ? t : document.querySelector(t) || document.querySelector("#" + t);
  6777. if ("CANVAS" === a.tagName ? (e = a.width, i = a.height, this.canvas = n = a, this.container = r = document.createElement("DIV"), n.parentNode && n.parentNode.insertBefore(r, n)) : ("DIV" !== a.tagName && cc.warnID(3819), e = a.clientWidth, i = a.clientHeight, this.canvas = n = document.createElement("CANVAS"), this.container = r = document.createElement("DIV"), a.appendChild(r)), r.setAttribute("id", "Cocos2dGameContainer"), r.appendChild(n), this.frame = r.parentNode === document.body ? document.documentElement : r.parentNode, (function(t, e) {
  6778. (" " + t.className + " ").indexOf(" " + e + " ") > -1 || (t.className && (t.className += " "), t.className += e)
  6779. })(n, "gameCanvas"), n.setAttribute("width", e || 480), n.setAttribute("height", i || 320), n.setAttribute("tabindex", 99), this._determineRenderType(), this.renderType === this.RENDER_TYPE_WEBGL) {
  6780. var l = {
  6781. stencil: !0,
  6782. antialias: cc.macro.ENABLE_WEBGL_ANTIALIAS,
  6783. alpha: cc.macro.ENABLE_TRANSPARENT_CANVAS
  6784. };
  6785. s.initWebGL(n, l), this._renderContext = s.device._gl, !cc.macro.CLEANUP_IMAGE_CACHE && o && (o.enabled = !0)
  6786. }
  6787. this._renderContext || (this.renderType = this.RENDER_TYPE_CANVAS, s.initCanvas(n), this._renderContext = s.device._ctx), this.canvas.oncontextmenu = function() {
  6788. if (!cc._isContextMenuEnable) return !1
  6789. }, this._rendererInitialized = !0
  6790. }
  6791. },
  6792. _initEvents: function() {
  6793. var t, e = window;
  6794. this.config.registerSystemEvent && _cc.inputManager.registerSystemEvent(this.canvas), void 0 !== document.hidden ? t = "hidden" : void 0 !== document.mozHidden ? t = "mozHidden" : void 0 !== document.msHidden ? t = "msHidden" : void 0 !== document.webkitHidden && (t = "webkitHidden");
  6795. var i = !1;
  6796. function n() {
  6797. i || (i = !0, a.emit(a.EVENT_HIDE))
  6798. }
  6799. function r(t, e, n, r, s) {
  6800. i && (i = !1, a.emit(a.EVENT_SHOW, t, e, n, r, s))
  6801. }
  6802. if (t)
  6803. for (var s = ["visibilitychange", "mozvisibilitychange", "msvisibilitychange", "webkitvisibilitychange", "qbrowserVisibilityChange"], o = 0; o < s.length; o++) document.addEventListener(s[o], (function(e) {
  6804. var i = document[t];
  6805. (i = i || e.hidden) ? n(): r()
  6806. }));
  6807. else e.addEventListener("blur", n), e.addEventListener("focus", r);
  6808. navigator.userAgent.indexOf("MicroMessenger") > -1 && (e.onfocus = r), "onpageshow" in window && "onpagehide" in window && (e.addEventListener("pagehide", n), e.addEventListener("pageshow", r), document.addEventListener("pagehide", n), document.addEventListener("pageshow", r)), this.on(a.EVENT_HIDE, (function() {
  6809. a.pause()
  6810. })), this.on(a.EVENT_SHOW, (function() {
  6811. a.resume()
  6812. }))
  6813. }
  6814. };
  6815. n.call(a), cc.js.addon(a, n.prototype), cc.game = e.exports = a
  6816. }), {
  6817. "../audio/CCAudioEngine": 21,
  6818. "../core/renderer/utils/dynamic-atlas/manager": 250,
  6819. "./CCDebug": 49,
  6820. "./event/event-target": 131,
  6821. "./renderer/index.js": 247
  6822. }],
  6823. 52: [(function(t, e, i) {
  6824. "use strict";
  6825. var n = t("./vmath"),
  6826. r = t("./utils/base-node"),
  6827. s = t("./utils/prefab-helper"),
  6828. o = t("./utils/trans-pool").NodeMemPool,
  6829. a = t("./utils/affine-transform"),
  6830. l = t("./event-manager"),
  6831. h = t("./platform/CCMacro"),
  6832. c = t("./platform/js"),
  6833. u = (t("./event/event"), t("./event/event-target")),
  6834. _ = t("./renderer/render-flow"),
  6835. f = cc.Object.Flags.Destroying,
  6836. d = Math.PI / 180,
  6837. p = !!cc.ActionManager,
  6838. m = function() {},
  6839. y = cc.v3(),
  6840. v = cc.quat(),
  6841. g = cc.v3(),
  6842. x = cc.v3(),
  6843. b = cc.quat(),
  6844. A = cc.quat(),
  6845. C = cc.v3(),
  6846. T = cc.v3(),
  6847. S = cc.v3(),
  6848. w = cc.v3(),
  6849. E = cc.v3(),
  6850. M = cc.quat(),
  6851. D = cc.quat(),
  6852. B = cc.v3(),
  6853. I = n.quat.create(),
  6854. P = cc.v3(),
  6855. R = cc.v3(),
  6856. O = cc.quat(),
  6857. L = cc.quat(),
  6858. F = (cc.quat(), n.mat4.create()),
  6859. N = n.vec3.create(),
  6860. V = new Array(16);
  6861. V.length = 0;
  6862. var k = cc.Enum({
  6863. DEBUG: 31
  6864. }),
  6865. G = cc.Enum({
  6866. POSITION: 1,
  6867. SCALE: 2,
  6868. ROTATION: 4,
  6869. SKEW: 8,
  6870. TRS: 7,
  6871. RS: 6,
  6872. ALL: 65535
  6873. }),
  6874. U = cc.Enum({
  6875. TOUCH_START: "touchstart",
  6876. TOUCH_MOVE: "touchmove",
  6877. TOUCH_END: "touchend",
  6878. TOUCH_CANCEL: "touchcancel",
  6879. MOUSE_DOWN: "mousedown",
  6880. MOUSE_MOVE: "mousemove",
  6881. MOUSE_ENTER: "mouseenter",
  6882. MOUSE_LEAVE: "mouseleave",
  6883. MOUSE_UP: "mouseup",
  6884. MOUSE_WHEEL: "mousewheel",
  6885. POSITION_CHANGED: "position-changed",
  6886. ROTATION_CHANGED: "rotation-changed",
  6887. SCALE_CHANGED: "scale-changed",
  6888. SIZE_CHANGED: "size-changed",
  6889. ANCHOR_CHANGED: "anchor-changed",
  6890. COLOR_CHANGED: "color-changed",
  6891. CHILD_ADDED: "child-added",
  6892. CHILD_REMOVED: "child-removed",
  6893. CHILD_REORDER: "child-reorder",
  6894. GROUP_CHANGED: "group-changed",
  6895. SIBLING_ORDER_CHANGED: "sibling-order-changed"
  6896. }),
  6897. z = [U.TOUCH_START, U.TOUCH_MOVE, U.TOUCH_END, U.TOUCH_CANCEL],
  6898. j = [U.MOUSE_DOWN, U.MOUSE_ENTER, U.MOUSE_MOVE, U.MOUSE_LEAVE, U.MOUSE_UP, U.MOUSE_WHEEL],
  6899. W = !0,
  6900. H = function(t, e) {
  6901. if (0 !== t) {
  6902. var i = "";
  6903. W && cc.warn("`cc.Node.skewX/Y` is deprecated since v2.2.1, please use 3D node instead.", i), W = !1
  6904. }
  6905. },
  6906. X = null,
  6907. Y = function(t, e) {
  6908. var i = t.getLocation(),
  6909. n = this.owner;
  6910. return !!n._hitTest(i, this) && (e.type = U.TOUCH_START, e.touch = t, e.bubbles = !0, n.dispatchEvent(e), !0)
  6911. },
  6912. q = function(t, e) {
  6913. var i = this.owner;
  6914. e.type = U.TOUCH_MOVE, e.touch = t, e.bubbles = !0, i.dispatchEvent(e)
  6915. },
  6916. J = function(t, e) {
  6917. var i = t.getLocation(),
  6918. n = this.owner;
  6919. n._hitTest(i, this) ? e.type = U.TOUCH_END : e.type = U.TOUCH_CANCEL, e.touch = t, e.bubbles = !0, n.dispatchEvent(e)
  6920. },
  6921. Z = function(t, e) {
  6922. t.getLocation();
  6923. var i = this.owner;
  6924. e.type = U.TOUCH_CANCEL, e.touch = t, e.bubbles = !0, i.dispatchEvent(e)
  6925. },
  6926. K = function(t) {
  6927. var e = t.getLocation(),
  6928. i = this.owner;
  6929. i._hitTest(e, this) && (t.type = U.MOUSE_DOWN, t.bubbles = !0, i.dispatchEvent(t))
  6930. },
  6931. Q = function(t) {
  6932. var e = t.getLocation(),
  6933. i = this.owner;
  6934. if (i._hitTest(e, this)) this._previousIn || (X && X._mouseListener && (t.type = U.MOUSE_LEAVE, X.dispatchEvent(t), X._mouseListener._previousIn = !1), X = this.owner, t.type = U.MOUSE_ENTER, i.dispatchEvent(t), this._previousIn = !0), t.type = U.MOUSE_MOVE, t.bubbles = !0, i.dispatchEvent(t);
  6935. else {
  6936. if (!this._previousIn) return;
  6937. t.type = U.MOUSE_LEAVE, i.dispatchEvent(t), this._previousIn = !1, X = null
  6938. }
  6939. t.stopPropagation()
  6940. },
  6941. $ = function(t) {
  6942. var e = t.getLocation(),
  6943. i = this.owner;
  6944. i._hitTest(e, this) && (t.type = U.MOUSE_UP, t.bubbles = !0, i.dispatchEvent(t), t.stopPropagation())
  6945. },
  6946. tt = function(t) {
  6947. var e = t.getLocation(),
  6948. i = this.owner;
  6949. i._hitTest(e, this) && (t.type = U.MOUSE_WHEEL, t.bubbles = !0, i.dispatchEvent(t), t.stopPropagation())
  6950. };
  6951. function et(t) {
  6952. var e = cc.Mask;
  6953. if (e)
  6954. for (var i = 0, n = t; n && cc.Node.isNode(n); n = n._parent, ++i)
  6955. if (n.getComponent(e)) return {
  6956. index: i,
  6957. node: n
  6958. };
  6959. return null
  6960. }
  6961. function it(t, e) {
  6962. if (!(t._objFlags & f)) {
  6963. var i = 0;
  6964. if (t._bubblingListeners)
  6965. for (; i < e.length; ++i)
  6966. if (t._bubblingListeners.hasEventListener(e[i])) return !0;
  6967. if (t._capturingListeners)
  6968. for (; i < e.length; ++i)
  6969. if (t._capturingListeners.hasEventListener(e[i])) return !0;
  6970. return !1
  6971. }
  6972. return !0
  6973. }
  6974. function nt(t, e) {
  6975. var i, n;
  6976. for (e.target = t, V.length = 0, t._getCapturingTargets(e.type, V), e.eventPhase = 1, n = V.length - 1; n >= 0; --n)
  6977. if ((i = V[n])._capturingListeners && (e.currentTarget = i, i._capturingListeners.emit(e.type, e, V), e._propagationStopped)) return void(V.length = 0);
  6978. if (V.length = 0, e.eventPhase = 2, e.currentTarget = t, t._capturingListeners && t._capturingListeners.emit(e.type, e), !e._propagationImmediateStopped && t._bubblingListeners && t._bubblingListeners.emit(e.type, e), !e._propagationStopped && e.bubbles)
  6979. for (t._getBubblingTargets(e.type, V), e.eventPhase = 3, n = 0; n < V.length; ++n)
  6980. if ((i = V[n])._bubblingListeners && (e.currentTarget = i, i._bubblingListeners.emit(e.type, e), e._propagationStopped)) return void(V.length = 0);
  6981. V.length = 0
  6982. }
  6983. function rt(t) {
  6984. var e = t.groupIndex;
  6985. return 0 === e && t.parent && (e = rt(t.parent)), e
  6986. }
  6987. function st(t) {
  6988. var e = rt(t);
  6989. t._cullingMask = 1 << e;
  6990. for (var i = 0; i < t._children.length; i++) st(t._children[i])
  6991. }
  6992. var ot = {
  6993. name: "cc.Node",
  6994. extends: r,
  6995. properties: {
  6996. _opacity: 255,
  6997. _color: cc.Color.WHITE,
  6998. _contentSize: cc.Size,
  6999. _anchorPoint: cc.v2(.5, .5),
  7000. _position: void 0,
  7001. _scale: void 0,
  7002. _trs: null,
  7003. _eulerAngles: cc.Vec3,
  7004. _skewX: 0,
  7005. _skewY: 0,
  7006. _zIndex: {
  7007. default: void 0,
  7008. type: cc.Integer
  7009. },
  7010. _localZOrder: {
  7011. default: 0,
  7012. serializable: !1
  7013. },
  7014. _is3DNode: !1,
  7015. _groupIndex: {
  7016. default: 0,
  7017. formerlySerializedAs: "groupIndex"
  7018. },
  7019. groupIndex: {
  7020. get: function() {
  7021. return this._groupIndex
  7022. },
  7023. set: function(t) {
  7024. this._groupIndex = t, st(this), this.emit(U.GROUP_CHANGED, this)
  7025. }
  7026. },
  7027. group: {
  7028. get: function() {
  7029. return cc.game.groupList[this.groupIndex] || ""
  7030. },
  7031. set: function(t) {
  7032. this.groupIndex = cc.game.groupList.indexOf(t)
  7033. }
  7034. },
  7035. x: {
  7036. get: function() {
  7037. return this._trs[0]
  7038. },
  7039. set: function(t) {
  7040. var e = this._trs;
  7041. if (t !== e[0]) {
  7042. e[0] = t, this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED)
  7043. }
  7044. }
  7045. },
  7046. y: {
  7047. get: function() {
  7048. return this._trs[1]
  7049. },
  7050. set: function(t) {
  7051. var e = this._trs;
  7052. if (t !== e[1]) {
  7053. e[1] = t, this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED)
  7054. }
  7055. }
  7056. },
  7057. rotation: {
  7058. get: function() {
  7059. return -this.angle
  7060. },
  7061. set: function(t) {
  7062. this.angle = -t
  7063. }
  7064. },
  7065. angle: {
  7066. get: function() {
  7067. return this._eulerAngles.z
  7068. },
  7069. set: function(t) {
  7070. n.vec3.set(this._eulerAngles, 0, 0, t), n.trs.fromAngleZ(this._trs, t), this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED)
  7071. }
  7072. },
  7073. rotationX: {
  7074. get: function() {
  7075. return this._eulerAngles.x
  7076. },
  7077. set: function(t) {
  7078. this._eulerAngles.x !== t && (this._eulerAngles.x = t, this._eulerAngles.x === this._eulerAngles.y ? n.trs.fromAngleZ(this._trs, -t) : n.trs.fromEulerNumber(this._trs, t, this._eulerAngles.y, 0), this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED))
  7079. }
  7080. },
  7081. rotationY: {
  7082. get: function() {
  7083. return this._eulerAngles.y
  7084. },
  7085. set: function(t) {
  7086. this._eulerAngles.y !== t && (this._eulerAngles.y = t, this._eulerAngles.x === this._eulerAngles.y ? n.trs.fromAngleZ(this._trs, -t) : n.trs.fromEulerNumber(this._trs, this._eulerAngles.x, t, 0), this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED))
  7087. }
  7088. },
  7089. scale: {
  7090. get: function() {
  7091. return this._trs[7]
  7092. },
  7093. set: function(t) {
  7094. this.setScale(t)
  7095. }
  7096. },
  7097. scaleX: {
  7098. get: function() {
  7099. return this._trs[7]
  7100. },
  7101. set: function(t) {
  7102. this._trs[7] !== t && (this._trs[7] = t, this.setLocalDirty(G.SCALE), 2 & this._eventMask && this.emit(U.SCALE_CHANGED))
  7103. }
  7104. },
  7105. scaleY: {
  7106. get: function() {
  7107. return this._trs[8]
  7108. },
  7109. set: function(t) {
  7110. this._trs[8] !== t && (this._trs[8] = t, this.setLocalDirty(G.SCALE), 2 & this._eventMask && this.emit(U.SCALE_CHANGED))
  7111. }
  7112. },
  7113. skewX: {
  7114. get: function() {
  7115. return this._skewX
  7116. },
  7117. set: function(t) {
  7118. H(t), this._skewX = t, this.setLocalDirty(G.SKEW)
  7119. }
  7120. },
  7121. skewY: {
  7122. get: function() {
  7123. return this._skewY
  7124. },
  7125. set: function(t) {
  7126. H(t), this._skewY = t, this.setLocalDirty(G.SKEW)
  7127. }
  7128. },
  7129. opacity: {
  7130. get: function() {
  7131. return this._opacity
  7132. },
  7133. set: function(t) {
  7134. t = cc.misc.clampf(t, 0, 255), this._opacity !== t && (this._opacity = t, this._renderFlag |= _.FLAG_OPACITY_COLOR)
  7135. },
  7136. range: [0, 255]
  7137. },
  7138. color: {
  7139. get: function() {
  7140. return this._color.clone()
  7141. },
  7142. set: function(t) {
  7143. this._color.equals(t) || (this._color.set(t), this._renderFlag |= _.FLAG_COLOR, 32 & this._eventMask && this.emit(U.COLOR_CHANGED, t))
  7144. }
  7145. },
  7146. anchorX: {
  7147. get: function() {
  7148. return this._anchorPoint.x
  7149. },
  7150. set: function(t) {
  7151. var e = this._anchorPoint;
  7152. e.x !== t && (e.x = t, 16 & this._eventMask && this.emit(U.ANCHOR_CHANGED))
  7153. }
  7154. },
  7155. anchorY: {
  7156. get: function() {
  7157. return this._anchorPoint.y
  7158. },
  7159. set: function(t) {
  7160. var e = this._anchorPoint;
  7161. e.y !== t && (e.y = t, 16 & this._eventMask && this.emit(U.ANCHOR_CHANGED))
  7162. }
  7163. },
  7164. width: {
  7165. get: function() {
  7166. return this._contentSize.width
  7167. },
  7168. set: function(t) {
  7169. t !== this._contentSize.width && (this._contentSize.width = t, 8 & this._eventMask && this.emit(U.SIZE_CHANGED))
  7170. }
  7171. },
  7172. height: {
  7173. get: function() {
  7174. return this._contentSize.height
  7175. },
  7176. set: function(t) {
  7177. t !== this._contentSize.height && (this._contentSize.height = t, 8 & this._eventMask && this.emit(U.SIZE_CHANGED))
  7178. }
  7179. },
  7180. zIndex: {
  7181. get: function() {
  7182. return this._localZOrder >> 16
  7183. },
  7184. set: function(t) {
  7185. t > h.MAX_ZINDEX ? (cc.warnID(1636), t = h.MAX_ZINDEX) : t < h.MIN_ZINDEX && (cc.warnID(1637), t = h.MIN_ZINDEX), this.zIndex !== t && (this._localZOrder = 65535 & this._localZOrder | t << 16, this.emit(U.SIBLING_ORDER_CHANGED), this._parent && this._onSiblingIndexChanged())
  7186. }
  7187. }
  7188. },
  7189. ctor: function() {
  7190. this._reorderChildDirty = !1, this._widget = null, this._renderComponent = null, this._capturingListeners = null, this._bubblingListeners = null, this._touchListener = null, this._mouseListener = null, this._initDataFromPool(), this._eventMask = 0, this._cullingMask = 1, this._childArrivalOrder = 1, this._renderFlag = _.FLAG_TRANSFORM | _.FLAG_OPACITY_COLOR
  7191. },
  7192. statics: {
  7193. EventType: U,
  7194. _LocalDirtyFlag: G,
  7195. isNode: function(t) {
  7196. return t instanceof at && (t.constructor === at || !(t instanceof cc.Scene))
  7197. },
  7198. BuiltinGroupIndex: k
  7199. },
  7200. _onSiblingIndexChanged: function() {
  7201. for (var t = this._parent, e = t._children, i = 0, n = e.length; i < n; i++) e[i]._updateOrderOfArrival();
  7202. t._delaySort()
  7203. },
  7204. _onPreDestroy: function() {
  7205. this._onPreDestroyBase();
  7206. p && cc.director.getActionManager().removeAllActionsFromTarget(this), X === this && (X = null), (this._touchListener || this._mouseListener) && (l.removeListeners(this), this._touchListener && (this._touchListener.owner = null, this._touchListener.mask = null, this._touchListener = null), this._mouseListener && (this._mouseListener.owner = null, this._mouseListener.mask = null, this._mouseListener = null)), this._backDataIntoPool(), this._reorderChildDirty && cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this)
  7207. },
  7208. _onPostActivated: function(t) {
  7209. var e = p ? cc.director.getActionManager() : null;
  7210. if (t)
  7211. if (this._renderFlag |= _.FLAG_WORLD_TRANSFORM, e && e.resumeTarget(this), l.resumeTarget(this), this._touchListener) {
  7212. var i = this._touchListener.mask = et(this);
  7213. this._mouseListener && (this._mouseListener.mask = i)
  7214. } else this._mouseListener && (this._mouseListener.mask = et(this));
  7215. else e && e.pauseTarget(this), l.pauseTarget(this)
  7216. },
  7217. _onHierarchyChanged: function(t) {
  7218. this._updateOrderOfArrival(), st(this), this._parent && this._parent._delaySort(), this._renderFlag |= _.FLAG_WORLD_TRANSFORM, this._onHierarchyChangedBase(t), cc._widgetManager && (cc._widgetManager._nodesOrderDirty = !0)
  7219. },
  7220. _initDataFromPool: function() {
  7221. this._spaceInfo || (this._spaceInfo = o.pop());
  7222. var t = this._spaceInfo;
  7223. this._matrix = n.mat4.create(t.localMat), n.mat4.identity(this._matrix), this._worldMatrix = n.mat4.create(t.worldMat), n.mat4.identity(this._worldMatrix), this._localMatDirty = G.ALL, this._worldMatDirty = !0;
  7224. var e = this._trs = this._spaceInfo.trs;
  7225. e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 0, e[6] = 1, e[7] = 1, e[8] = 1, e[9] = 1
  7226. },
  7227. _backDataIntoPool: function() {
  7228. o.push(this._spaceInfo), this._matrix = null, this._worldMatrix = null, this._trs = null, this._spaceInfo = null
  7229. },
  7230. _toEuler: function() {
  7231. if (this.is3DNode) n.trs.toEuler(this._eulerAngles, this._trs);
  7232. else {
  7233. var t = Math.asin(this._trs[5]) / d * 2;
  7234. n.vec3.set(this._eulerAngles, 0, 0, t)
  7235. }
  7236. },
  7237. _fromEuler: function() {
  7238. this.is3DNode ? n.trs.fromEuler(this._trs, this._eulerAngles) : n.trs.fromAngleZ(this._trs, this._eulerAngles.z)
  7239. },
  7240. _upgrade_1x_to_2x: function() {
  7241. var t = this._trs;
  7242. if (t) {
  7243. var e = t;
  7244. t = this._trs = this._spaceInfo.trs, 11 === e.length ? t.set(e.subarray(1)) : t.set(e)
  7245. } else t = this._trs = this._spaceInfo.trs;
  7246. void 0 !== this._zIndex && (this._localZOrder = this._zIndex << 16, this._zIndex = void 0), this._fromEuler(), 0 !== this._localZOrder && (this._zIndex = (4294901760 & this._localZOrder) >> 16), this._color.a < 255 && 255 === this._opacity && (this._opacity = this._color.a, this._color.a = 255)
  7247. },
  7248. _onBatchCreated: function() {
  7249. var t = this._prefab;
  7250. t && t.sync && t.root === this && s.syncWithPrefab(this), this._upgrade_1x_to_2x(), this._updateOrderOfArrival(), this._cullingMask = 1 << rt(this), this._activeInHierarchy || (p && cc.director.getActionManager().pauseTarget(this), l.pauseTarget(this));
  7251. for (var e = this._children, i = 0, n = e.length; i < n; i++) e[i]._onBatchCreated();
  7252. e.length > 0 && (this._renderFlag |= _.FLAG_CHILDREN)
  7253. },
  7254. _onBatchRestored: function() {
  7255. if (this._upgrade_1x_to_2x(), this._cullingMask = 1 << rt(this), !this._activeInHierarchy) {
  7256. var t = cc.director.getActionManager();
  7257. t && t.pauseTarget(this), l.pauseTarget(this)
  7258. }
  7259. for (var e = this._children, i = 0, n = e.length; i < n; i++) e[i]._onBatchRestored();
  7260. e.length > 0 && (this._renderFlag |= _.FLAG_CHILDREN)
  7261. },
  7262. _checknSetupSysEvent: function(t) {
  7263. var e = !1,
  7264. i = !1;
  7265. return -1 !== z.indexOf(t) ? (this._touchListener || (this._touchListener = cc.EventListener.create({
  7266. event: cc.EventListener.TOUCH_ONE_BY_ONE,
  7267. swallowTouches: !0,
  7268. owner: this,
  7269. mask: et(this),
  7270. onTouchBegan: Y,
  7271. onTouchMoved: q,
  7272. onTouchEnded: J,
  7273. onTouchCancelled: Z
  7274. }), l.addListener(this._touchListener, this), e = !0), i = !0) : -1 !== j.indexOf(t) && (this._mouseListener || (this._mouseListener = cc.EventListener.create({
  7275. event: cc.EventListener.MOUSE,
  7276. _previousIn: !1,
  7277. owner: this,
  7278. mask: et(this),
  7279. onMouseDown: K,
  7280. onMouseMove: Q,
  7281. onMouseUp: $,
  7282. onMouseScroll: tt
  7283. }), l.addListener(this._mouseListener, this), e = !0), i = !0), e && !this._activeInHierarchy && cc.director.getScheduler().schedule((function() {
  7284. this._activeInHierarchy || l.pauseTarget(this)
  7285. }), this, 0, 0, 0, !1), i
  7286. },
  7287. on: function(t, e, i, n) {
  7288. if (this._checknSetupSysEvent(t)) return this._onDispatch(t, e, i, n);
  7289. switch (t) {
  7290. case U.POSITION_CHANGED:
  7291. this._eventMask |= 1;
  7292. break;
  7293. case U.SCALE_CHANGED:
  7294. this._eventMask |= 2;
  7295. break;
  7296. case U.ROTATION_CHANGED:
  7297. this._eventMask |= 4;
  7298. break;
  7299. case U.SIZE_CHANGED:
  7300. this._eventMask |= 8;
  7301. break;
  7302. case U.ANCHOR_CHANGED:
  7303. this._eventMask |= 16;
  7304. break;
  7305. case U.COLOR_CHANGED:
  7306. this._eventMask |= 32
  7307. }
  7308. return this._bubblingListeners || (this._bubblingListeners = new u), this._bubblingListeners.on(t, e, i)
  7309. },
  7310. once: function(t, e, i, n) {
  7311. (this._checknSetupSysEvent(t) && n ? this._capturingListeners = this._capturingListeners || new u : this._bubblingListeners = this._bubblingListeners || new u).once(t, e, i)
  7312. },
  7313. _onDispatch: function(t, e, i, n) {
  7314. if ("boolean" == typeof i ? (n = i, i = void 0) : n = !!n, e) {
  7315. var r = null;
  7316. return (r = n ? this._capturingListeners = this._capturingListeners || new u : this._bubblingListeners = this._bubblingListeners || new u).hasEventListener(t, e, i) || (r.on(t, e, i), i && i.__eventTargets && i.__eventTargets.push(this)), e
  7317. }
  7318. cc.errorID(6800)
  7319. },
  7320. off: function(t, e, i, n) {
  7321. var r = -1 !== z.indexOf(t),
  7322. s = !r && -1 !== j.indexOf(t);
  7323. if (r || s) this._offDispatch(t, e, i, n), r ? this._touchListener && !it(this, z) && (l.removeListener(this._touchListener), this._touchListener = null) : s && this._mouseListener && !it(this, j) && (l.removeListener(this._mouseListener), this._mouseListener = null);
  7324. else if (this._bubblingListeners) {
  7325. if (this._bubblingListeners.off(t, e, i), !this._bubblingListeners.hasEventListener(t)) switch (t) {
  7326. case U.POSITION_CHANGED:
  7327. this._eventMask &= -2;
  7328. break;
  7329. case U.SCALE_CHANGED:
  7330. this._eventMask &= -3;
  7331. break;
  7332. case U.ROTATION_CHANGED:
  7333. this._eventMask &= -5;
  7334. break;
  7335. case U.SIZE_CHANGED:
  7336. this._eventMask &= -9;
  7337. break;
  7338. case U.ANCHOR_CHANGED:
  7339. this._eventMask &= -17;
  7340. break;
  7341. case U.COLOR_CHANGED:
  7342. this._eventMask &= -33
  7343. }
  7344. }
  7345. },
  7346. _offDispatch: function(t, e, i, n) {
  7347. if ("boolean" == typeof i ? (n = i, i = void 0) : n = !!n, e) {
  7348. var r = n ? this._capturingListeners : this._bubblingListeners;
  7349. r && (r.off(t, e, i), i && i.__eventTargets && c.array.fastRemove(i.__eventTargets, this))
  7350. } else this._capturingListeners && this._capturingListeners.removeAll(t), this._bubblingListeners && this._bubblingListeners.removeAll(t)
  7351. },
  7352. targetOff: function(t) {
  7353. var e = this._bubblingListeners;
  7354. e && (e.targetOff(t), 1 & this._eventMask && !e.hasEventListener(U.POSITION_CHANGED) && (this._eventMask &= -2), 2 & this._eventMask && !e.hasEventListener(U.SCALE_CHANGED) && (this._eventMask &= -3), 4 & this._eventMask && !e.hasEventListener(U.ROTATION_CHANGED) && (this._eventMask &= -5), 8 & this._eventMask && !e.hasEventListener(U.SIZE_CHANGED) && (this._eventMask &= -9), 16 & this._eventMask && !e.hasEventListener(U.ANCHOR_CHANGED) && (this._eventMask &= -17), 32 & this._eventMask && !e.hasEventListener(U.COLOR_CHANGED) && (this._eventMask &= -33)), this._capturingListeners && this._capturingListeners.targetOff(t), t && t.__eventTargets && c.array.fastRemove(t.__eventTargets, this), this._touchListener && !it(this, z) && (l.removeListener(this._touchListener), this._touchListener = null), this._mouseListener && !it(this, j) && (l.removeListener(this._mouseListener), this._mouseListener = null)
  7355. },
  7356. hasEventListener: function(t) {
  7357. var e = !1;
  7358. return this._bubblingListeners && (e = this._bubblingListeners.hasEventListener(t)), !e && this._capturingListeners && (e = this._capturingListeners.hasEventListener(t)), e
  7359. },
  7360. emit: function(t, e, i, n, r, s) {
  7361. this._bubblingListeners && this._bubblingListeners.emit(t, e, i, n, r, s)
  7362. },
  7363. dispatchEvent: function(t) {
  7364. nt(this, t), V.length = 0
  7365. },
  7366. pauseSystemEvents: function(t) {
  7367. l.pauseTarget(this, t)
  7368. },
  7369. resumeSystemEvents: function(t) {
  7370. l.resumeTarget(this, t)
  7371. },
  7372. _hitTest: function(t, e) {
  7373. var i = this._contentSize.width,
  7374. r = this._contentSize.height,
  7375. s = P,
  7376. o = R,
  7377. a = cc.Camera.findCamera(this);
  7378. if (a ? a.getScreenToWorldPoint(t, s) : s.set(t), this._updateWorldMatrix(), !n.mat4.invert(F, this._worldMatrix)) return !1;
  7379. if (n.vec2.transformMat4(o, s, F), o.x += this._anchorPoint.x * i, o.y += this._anchorPoint.y * r, o.x >= 0 && o.y >= 0 && o.x <= i && o.y <= r) {
  7380. if (e && e.mask) {
  7381. for (var l = e.mask, h = this, c = 0; h && c < l.index; ++c, h = h.parent);
  7382. if (h === l.node) {
  7383. var u = h.getComponent(cc.Mask);
  7384. return !u || !u.enabledInHierarchy || u._hitTest(s)
  7385. }
  7386. return e.mask = null, !0
  7387. }
  7388. return !0
  7389. }
  7390. return !1
  7391. },
  7392. _getCapturingTargets: function(t, e) {
  7393. for (var i = this.parent; i;) i._capturingListeners && i._capturingListeners.hasEventListener(t) && e.push(i), i = i.parent
  7394. },
  7395. _getBubblingTargets: function(t, e) {
  7396. for (var i = this.parent; i;) i._bubblingListeners && i._bubblingListeners.hasEventListener(t) && e.push(i), i = i.parent
  7397. },
  7398. runAction: p ? function(t) {
  7399. if (this.active) return cc.assertID(t, 1618), cc.director.getActionManager().addAction(t, this, !1), t
  7400. } : m,
  7401. pauseAllActions: p ? function() {
  7402. cc.director.getActionManager().pauseTarget(this)
  7403. } : m,
  7404. resumeAllActions: p ? function() {
  7405. cc.director.getActionManager().resumeTarget(this)
  7406. } : m,
  7407. stopAllActions: p ? function() {
  7408. cc.director.getActionManager().removeAllActionsFromTarget(this)
  7409. } : m,
  7410. stopAction: p ? function(t) {
  7411. cc.director.getActionManager().removeAction(t)
  7412. } : m,
  7413. stopActionByTag: p ? function(t) {
  7414. t !== cc.Action.TAG_INVALID ? cc.director.getActionManager().removeActionByTag(t, this) : cc.logID(1612)
  7415. } : m,
  7416. getActionByTag: p ? function(t) {
  7417. return t === cc.Action.TAG_INVALID ? (cc.logID(1613), null) : cc.director.getActionManager().getActionByTag(t, this)
  7418. } : function() {
  7419. return null
  7420. },
  7421. getNumberOfRunningActions: p ? function() {
  7422. return cc.director.getActionManager().getNumberOfRunningActionsInTarget(this)
  7423. } : function() {
  7424. return 0
  7425. },
  7426. getPosition: function(t) {
  7427. return t = t || cc.v3(), n.trs.toPosition(t, this._trs)
  7428. },
  7429. setPosition: function(t, e) {
  7430. var i;
  7431. void 0 === e ? (i = t.x, e = t.y) : i = t;
  7432. var n = this._trs;
  7433. n[0] === i && n[1] === e || (n[0] = i, n[1] = e, this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED))
  7434. },
  7435. getScale: function(t) {
  7436. return void 0 !== t ? n.trs.toScale(t, this._trs) : (cc.warnID(1400, "cc.Node.getScale", "cc.Node.scale or cc.Node.getScale(cc.Vec3)"), this._trs[7])
  7437. },
  7438. setScale: function(t, e) {
  7439. t && "number" != typeof t ? (e = t.y, t = t.x) : void 0 === e && (e = t);
  7440. var i = this._trs;
  7441. i[7] === t && i[8] === e || (i[7] = t, i[8] = e, this.setLocalDirty(G.SCALE), 2 & this._eventMask && this.emit(U.SCALE_CHANGED))
  7442. },
  7443. getRotation: function(t) {
  7444. return t instanceof cc.Quat ? n.trs.toRotation(t, this._trs) : -this.angle
  7445. },
  7446. setRotation: function(t, e, i, n) {
  7447. if ("number" == typeof t && void 0 === e) this.angle = -t;
  7448. else {
  7449. var r = t;
  7450. void 0 === e && (r = t.x, e = t.y, i = t.z, n = t.w);
  7451. var s = this._trs;
  7452. s[3] === r && s[4] === e && s[5] === i && s[6] === n || (s[3] = r, s[4] = e, s[5] = i, s[6] = n, this.setLocalDirty(G.ROTATION), 4 & this._eventMask && this.emit(U.ROTATION_CHANGED))
  7453. }
  7454. },
  7455. getContentSize: function() {
  7456. return cc.size(this._contentSize.width, this._contentSize.height)
  7457. },
  7458. setContentSize: function(t, e) {
  7459. var i = this._contentSize;
  7460. if (void 0 === e) {
  7461. if (t.width === i.width && t.height === i.height) return;
  7462. 0, i.width = t.width, i.height = t.height
  7463. } else {
  7464. if (t === i.width && e === i.height) return;
  7465. 0, i.width = t, i.height = e
  7466. }
  7467. 8 & this._eventMask && this.emit(U.SIZE_CHANGED)
  7468. },
  7469. getAnchorPoint: function() {
  7470. return cc.v2(this._anchorPoint)
  7471. },
  7472. setAnchorPoint: function(t, e) {
  7473. var i = this._anchorPoint;
  7474. if (void 0 === e) {
  7475. if (t.x === i.x && t.y === i.y) return;
  7476. i.x = t.x, i.y = t.y
  7477. } else {
  7478. if (t === i.x && e === i.y) return;
  7479. i.x = t, i.y = e
  7480. }
  7481. this.setLocalDirty(G.POSITION), 16 & this._eventMask && this.emit(U.ANCHOR_CHANGED)
  7482. },
  7483. _invTransformPoint: function(t, e) {
  7484. this._parent ? this._parent._invTransformPoint(t, e) : n.vec3.copy(t, e);
  7485. var i = this._trs;
  7486. return n.trs.toPosition(g, i), n.vec3.sub(t, t, g), n.trs.toRotation(b, i), n.quat.conjugate(A, b), n.vec3.transformQuat(t, t, A), n.trs.toScale(g, i), n.vec3.inverseSafe(x, g), n.vec3.mul(t, t, x), t
  7487. },
  7488. getWorldPosition: function(t) {
  7489. n.trs.toPosition(t, this._trs);
  7490. for (var e = this._parent, i = void 0; e;) i = e._trs, n.trs.toScale(y, i), n.vec3.mul(t, t, y), n.trs.toRotation(v, i), n.vec3.transformQuat(t, t, v), n.trs.toPosition(y, i), n.vec3.add(t, t, y), e = e._parent;
  7491. return t
  7492. },
  7493. setWorldPosition: function(t) {
  7494. var e = this._trs;
  7495. this._parent ? this._parent._invTransformPoint(C, t) : n.vec3.copy(C, t), n.trs.fromPosition(e, C), this.setLocalDirty(G.POSITION), 1 & this._eventMask && this.emit(U.POSITION_CHANGED)
  7496. },
  7497. getWorldRotation: function(t) {
  7498. n.trs.toRotation(O, this._trs), n.quat.copy(t, O);
  7499. for (var e = this._parent; e;) n.trs.toRotation(O, e._trs), n.quat.mul(t, O, t), e = e._parent;
  7500. return t
  7501. },
  7502. setWorldRotation: function(t) {
  7503. this._parent ? (this._parent.getWorldRotation(L), n.quat.conjugate(L, L), n.quat.mul(L, L, t)) : n.quat.copy(L, t), n.trs.fromRotation(this._trs, L), this.setLocalDirty(G.ROTATION)
  7504. },
  7505. getWorldScale: function(t) {
  7506. n.trs.toScale(T, this._trs), n.vec3.copy(t, T);
  7507. for (var e = this._parent; e;) n.trs.toScale(T, e._trs), n.vec3.mul(t, t, T), e = e._parent;
  7508. return t
  7509. },
  7510. setWorldScale: function(t) {
  7511. this._parent ? (this._parent.getWorldScale(S), n.vec3.div(S, t, S)) : n.vec3.copy(S, t), n.trs.fromScale(this._trs, S), this.setLocalDirty(G.SCALE)
  7512. },
  7513. getWorldRT: function(t) {
  7514. var e = w,
  7515. i = M,
  7516. r = this._trs;
  7517. n.trs.toPosition(e, r), n.trs.toRotation(i, r);
  7518. for (var s = this._parent; s;) r = s._trs, n.trs.toScale(E, r), n.vec3.mul(e, e, E), n.trs.toRotation(D, r), n.vec3.transformQuat(e, e, D), n.trs.toPosition(E, r), n.vec3.add(e, e, E), n.quat.mul(i, D, i), s = s._parent;
  7519. return n.mat4.fromRT(t, i, e), t
  7520. },
  7521. lookAt: function(t, e) {
  7522. this.getWorldPosition(B), n.vec3.sub(B, B, t), n.vec3.normalize(B, B), n.quat.fromViewUp(I, B, e), this.setWorldRotation(I)
  7523. },
  7524. _updateLocalMatrix: function() {
  7525. var t = this._localMatDirty;
  7526. if (t) {
  7527. var e = this._matrix.m,
  7528. i = this._trs;
  7529. if (t & (G.RS | G.SKEW)) {
  7530. var n = -this._eulerAngles.z,
  7531. r = this._skewX || this._skewY,
  7532. s = i[7],
  7533. o = i[8];
  7534. if (n || r) {
  7535. var a = 1,
  7536. l = 0,
  7537. h = 0,
  7538. c = 1;
  7539. if (n) {
  7540. var u = n * d;
  7541. h = Math.sin(u), a = c = Math.cos(u), l = -h
  7542. }
  7543. if (e[0] = a *= s, e[1] = l *= s, e[4] = h *= o, e[5] = c *= o, r) {
  7544. var _ = e[0],
  7545. f = e[1],
  7546. p = e[4],
  7547. m = e[5],
  7548. y = Math.tan(this._skewX * d),
  7549. v = Math.tan(this._skewY * d);
  7550. y === 1 / 0 && (y = 99999999), v === 1 / 0 && (v = 99999999), e[0] = _ + p * v, e[1] = f + m * v, e[4] = p + _ * y, e[5] = m + f * y
  7551. }
  7552. } else e[0] = s, e[1] = 0, e[4] = 0, e[5] = o
  7553. }
  7554. e[12] = i[0], e[13] = i[1], this._localMatDirty = 0, this._worldMatDirty = !0
  7555. }
  7556. },
  7557. _calculWorldMatrix: function() {
  7558. this._localMatDirty && this._updateLocalMatrix();
  7559. var t = this._parent;
  7560. t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : n.mat4.copy(this._worldMatrix, this._matrix), this._worldMatDirty = !1
  7561. },
  7562. _mulMat: function(t, e, i) {
  7563. var n = e.m,
  7564. r = i.m,
  7565. s = t.m,
  7566. o = n[0],
  7567. a = n[1],
  7568. l = n[4],
  7569. h = n[5],
  7570. c = n[12],
  7571. u = n[13],
  7572. _ = r[0],
  7573. f = r[1],
  7574. d = r[4],
  7575. p = r[5],
  7576. m = r[12],
  7577. y = r[13];
  7578. 0 !== a || 0 !== l ? (s[0] = _ * o + f * l, s[1] = _ * a + f * h, s[4] = d * o + p * l, s[5] = d * a + p * h, s[12] = o * m + l * y + c, s[13] = a * m + h * y + u) : (s[0] = _ * o, s[1] = f * h, s[4] = d * o, s[5] = p * h, s[12] = o * m + c, s[13] = h * y + u)
  7579. },
  7580. _updateWorldMatrix: function() {
  7581. if (this._parent && this._parent._updateWorldMatrix(), this._worldMatDirty) {
  7582. this._calculWorldMatrix();
  7583. for (var t = this._children, e = 0, i = t.length; e < i; e++) t[e]._worldMatDirty = !0
  7584. }
  7585. },
  7586. setLocalDirty: function(t) {
  7587. this._localMatDirty |= t, this._worldMatDirty = !0, t === G.POSITION ? this._renderFlag |= _.FLAG_WORLD_TRANSFORM : this._renderFlag |= _.FLAG_TRANSFORM
  7588. },
  7589. setWorldDirty: function() {
  7590. this._worldMatDirty = !0
  7591. },
  7592. getLocalMatrix: function(t) {
  7593. return this._updateLocalMatrix(), n.mat4.copy(t, this._matrix)
  7594. },
  7595. getWorldMatrix: function(t) {
  7596. return this._updateWorldMatrix(), n.mat4.copy(t, this._worldMatrix)
  7597. },
  7598. convertToNodeSpaceAR: function(t, e) {
  7599. return this._updateWorldMatrix(), n.mat4.invert(F, this._worldMatrix), t instanceof cc.Vec2 ? (e = e || new cc.Vec2, n.vec2.transformMat4(e, t, F)) : (e = e || new cc.Vec3, n.vec3.transformMat4(e, t, F))
  7600. },
  7601. convertToWorldSpaceAR: function(t, e) {
  7602. return this._updateWorldMatrix(), t instanceof cc.Vec2 ? (e = e || new cc.Vec2, n.vec2.transformMat4(e, t, this._worldMatrix)) : (e = e || new cc.Vec3, n.vec3.transformMat4(e, t, this._worldMatrix))
  7603. },
  7604. convertToNodeSpace: function(t) {
  7605. this._updateWorldMatrix(), n.mat4.invert(F, this._worldMatrix);
  7606. var e = new cc.Vec2;
  7607. return n.vec2.transformMat4(e, t, F), e.x += this._anchorPoint.x * this._contentSize.width, e.y += this._anchorPoint.y * this._contentSize.height, e
  7608. },
  7609. convertToWorldSpace: function(t) {
  7610. this._updateWorldMatrix();
  7611. var e = new cc.Vec2(t.x - this._anchorPoint.x * this._contentSize.width, t.y - this._anchorPoint.y * this._contentSize.height);
  7612. return n.vec2.transformMat4(e, e, this._worldMatrix)
  7613. },
  7614. getNodeToParentTransform: function(t) {
  7615. t || (t = a.identity()), this._updateLocalMatrix();
  7616. var e = this._contentSize;
  7617. return N.x = -this._anchorPoint.x * e.width, N.y = -this._anchorPoint.y * e.height, n.mat4.copy(F, this._matrix), n.mat4.translate(F, F, N), a.fromMat4(t, F)
  7618. },
  7619. getNodeToParentTransformAR: function(t) {
  7620. return t || (t = a.identity()), this._updateLocalMatrix(), a.fromMat4(t, this._matrix)
  7621. },
  7622. getNodeToWorldTransform: function(t) {
  7623. t || (t = a.identity()), this._updateWorldMatrix();
  7624. var e = this._contentSize;
  7625. return N.x = -this._anchorPoint.x * e.width, N.y = -this._anchorPoint.y * e.height, n.mat4.copy(F, this._worldMatrix), n.mat4.translate(F, F, N), a.fromMat4(t, F)
  7626. },
  7627. getNodeToWorldTransformAR: function(t) {
  7628. return t || (t = a.identity()), this._updateWorldMatrix(), a.fromMat4(t, this._worldMatrix)
  7629. },
  7630. getParentToNodeTransform: function(t) {
  7631. return t || (t = a.identity()), this._updateLocalMatrix(), n.mat4.invert(F, this._matrix), a.fromMat4(t, F)
  7632. },
  7633. getWorldToNodeTransform: function(t) {
  7634. return t || (t = a.identity()), this._updateWorldMatrix(), n.mat4.invert(F, this._worldMatrix), a.fromMat4(t, F)
  7635. },
  7636. convertTouchToNodeSpace: function(t) {
  7637. return this.convertToNodeSpace(t.getLocation())
  7638. },
  7639. convertTouchToNodeSpaceAR: function(t) {
  7640. return this.convertToNodeSpaceAR(t.getLocation())
  7641. },
  7642. getBoundingBox: function() {
  7643. this._updateLocalMatrix();
  7644. var t = this._contentSize.width,
  7645. e = this._contentSize.height,
  7646. i = cc.rect(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e);
  7647. return i.transformMat4(i, this._matrix)
  7648. },
  7649. getBoundingBoxToWorld: function() {
  7650. return this._parent ? (this._parent._updateWorldMatrix(), this._getBoundingBoxTo(this._parent._worldMatrix)) : this.getBoundingBox()
  7651. },
  7652. _getBoundingBoxTo: function(t) {
  7653. this._updateLocalMatrix();
  7654. var e = this._contentSize.width,
  7655. i = this._contentSize.height,
  7656. r = cc.rect(-this._anchorPoint.x * e, -this._anchorPoint.y * i, e, i);
  7657. t = n.mat4.mul(this._worldMatrix, t, this._matrix);
  7658. if (r.transformMat4(r, t), !this._children) return r;
  7659. for (var s = this._children, o = 0; o < s.length; o++) {
  7660. var a = s[o];
  7661. if (a && a.active) {
  7662. var l = a._getBoundingBoxTo(t);
  7663. l && r.union(r, l)
  7664. }
  7665. }
  7666. return r
  7667. },
  7668. _updateOrderOfArrival: function() {
  7669. var t = this._parent ? ++this._parent._childArrivalOrder : 0;
  7670. if (this._localZOrder = 4294901760 & this._localZOrder | t, 65535 === t) {
  7671. var e = this._parent._children;
  7672. e.forEach((function(t, e) {
  7673. t._localZOrder = 4294901760 & t._localZOrder | e + 1
  7674. })), this._parent._childArrivalOrder = e.length
  7675. }
  7676. this.emit(U.SIBLING_ORDER_CHANGED)
  7677. },
  7678. addChild: function(t, e, i) {
  7679. cc.assertID(t, 1606), cc.assertID(null === t._parent, 1605), t.parent = this, void 0 !== e && (t.zIndex = e), void 0 !== i && (t.name = i)
  7680. },
  7681. cleanup: function() {
  7682. p && cc.director.getActionManager().removeAllActionsFromTarget(this), l.removeListeners(this);
  7683. var t, e, i = this._children.length;
  7684. for (t = 0; t < i; ++t)(e = this._children[t]) && e.cleanup()
  7685. },
  7686. sortAllChildren: function() {
  7687. if (this._reorderChildDirty) {
  7688. l._setDirtyForNode(this), this._reorderChildDirty = !1;
  7689. var t = this._children;
  7690. if (t.length > 1) {
  7691. var e, i, n, r = t.length;
  7692. for (e = 1; e < r; e++) {
  7693. for (n = t[e], i = e - 1; i >= 0 && n._localZOrder < t[i]._localZOrder;) t[i + 1] = t[i], i--;
  7694. t[i + 1] = n
  7695. }
  7696. this.emit(U.CHILD_REORDER, this)
  7697. }
  7698. cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this)
  7699. }
  7700. },
  7701. _delaySort: function() {
  7702. this._reorderChildDirty || (this._reorderChildDirty = !0, cc.director.__fastOn(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this))
  7703. },
  7704. _restoreProperties: !1,
  7705. onRestore: !1
  7706. };
  7707. var at = cc.Class(ot),
  7708. lt = at.prototype;
  7709. c.getset(lt, "position", lt.getPosition, lt.setPosition, !1, !0), cc.Node = e.exports = at
  7710. }), {
  7711. "./event-manager": 129,
  7712. "./event/event": 132,
  7713. "./event/event-target": 131,
  7714. "./platform/CCMacro": 203,
  7715. "./platform/js": 218,
  7716. "./renderer/render-flow": 248,
  7717. "./utils/affine-transform": 290,
  7718. "./utils/base-node": 291,
  7719. "./utils/prefab-helper": 303,
  7720. "./utils/trans-pool": 309,
  7721. "./vmath": 326
  7722. }],
  7723. 53: [(function(t, e, i) {
  7724. "use strict";
  7725. var n = t("./CCNode"),
  7726. r = t("./renderer/render-flow"),
  7727. s = (cc.Object.Flags.HideInHierarchy, n._LocalDirtyFlag),
  7728. o = cc.Class({
  7729. name: "cc.PrivateNode",
  7730. extends: n,
  7731. properties: {
  7732. x: {
  7733. get: function() {
  7734. return this._originPos.x
  7735. },
  7736. set: function(t) {
  7737. var e = this._originPos;
  7738. t !== e.x && (e.x = t, this._posDirty(!0))
  7739. },
  7740. override: !0
  7741. },
  7742. y: {
  7743. get: function() {
  7744. return this._originPos.y
  7745. },
  7746. set: function(t) {
  7747. var e = this._originPos;
  7748. t !== e.y && (e.y = t, this._posDirty(!0))
  7749. },
  7750. override: !0
  7751. },
  7752. zIndex: {
  7753. get: function() {
  7754. return cc.macro.MIN_ZINDEX
  7755. },
  7756. set: function() {
  7757. cc.warnID(1638)
  7758. },
  7759. override: !0
  7760. },
  7761. showInEditor: {
  7762. default: !1,
  7763. editorOnly: !0,
  7764. override: !0
  7765. }
  7766. },
  7767. ctor: function(t) {
  7768. this._localZOrder = cc.macro.MIN_ZINDEX << 16, this._originPos = cc.v2()
  7769. },
  7770. _posDirty: function(t) {
  7771. this.setLocalDirty(s.POSITION), this._renderFlag |= r.FLAG_TRANSFORM, !0 === t && 1 & this._eventMask && this.emit(n.EventType.POSITION_CHANGED)
  7772. },
  7773. _updateLocalMatrix: function() {
  7774. if (this._localMatDirty) {
  7775. var t = this.parent;
  7776. t && (this._trs[0] = this._originPos.x - (t._anchorPoint.x - .5) * t._contentSize.width, this._trs[1] = this._originPos.y - (t._anchorPoint.y - .5) * t._contentSize.height), this._super()
  7777. }
  7778. },
  7779. getPosition: function() {
  7780. return new cc.Vec2(this._originPos)
  7781. },
  7782. setPosition: function(t, e) {
  7783. void 0 === e && (e = (t = t.x).y);
  7784. var i = this._originPos;
  7785. i.x === t && i.y === e || (i.x = t, i.y = e, this._posDirty(!0))
  7786. },
  7787. setParent: function(t) {
  7788. var e = this._parent;
  7789. this._super(t), e !== t && (e && e.off(n.EventType.ANCHOR_CHANGED, this._posDirty, this), t && t.on(n.EventType.ANCHOR_CHANGED, this._posDirty, this))
  7790. },
  7791. _updateOrderOfArrival: function() {}
  7792. });
  7793. cc.js.getset(o.prototype, "parent", o.prototype.getParent, o.prototype.setParent), cc.js.getset(o.prototype, "position", o.prototype.getPosition, o.prototype.setPosition), cc.PrivateNode = e.exports = o
  7794. }), {
  7795. "./CCNode": 52,
  7796. "./renderer/render-flow": 248
  7797. }],
  7798. 54: [(function(t, e, i) {
  7799. "use strict";
  7800. cc.Scene = cc.Class({
  7801. name: "cc.Scene",
  7802. extends: t("./CCNode"),
  7803. properties: {
  7804. _is3DNode: {
  7805. default: !0,
  7806. override: !0
  7807. },
  7808. autoReleaseAssets: {
  7809. default: void 0,
  7810. type: cc.Boolean
  7811. }
  7812. },
  7813. ctor: function() {
  7814. this._anchorPoint.x = 0, this._anchorPoint.y = 0, this._activeInHierarchy = !1, this._inited = !cc.game._isCloning, this.dependAssets = null
  7815. },
  7816. destroy: function() {
  7817. if (cc.Object.prototype.destroy.call(this))
  7818. for (var t = this._children, e = 0; e < t.length; ++e) t[e].active = !1;
  7819. this._active = !1, this._activeInHierarchy = !1
  7820. },
  7821. _onHierarchyChanged: function() {},
  7822. _instantiate: null,
  7823. _load: function() {
  7824. this._inited || (this._onBatchCreated(), this._inited = !0)
  7825. },
  7826. _activate: function(t) {
  7827. t = !1 !== t, cc.director._nodeActivator.activateNode(this, t)
  7828. }
  7829. }), e.exports = cc.Scene
  7830. }), {
  7831. "./CCNode": 52
  7832. }],
  7833. 55: [(function(t, e, i) {
  7834. "use strict";
  7835. var n = t("./platform/js"),
  7836. r = new(t("./platform/id-generater"))("Scheduler"),
  7837. s = function(t, e, i, n) {
  7838. this.target = t, this.priority = e, this.paused = i, this.markedForDeletion = n
  7839. },
  7840. o = [];
  7841. s.get = function(t, e, i, n) {
  7842. var r = o.pop();
  7843. return r ? (r.target = t, r.priority = e, r.paused = i, r.markedForDeletion = n) : r = new s(t, e, i, n), r
  7844. }, s.put = function(t) {
  7845. o.length < 20 && (t.target = null, o.push(t))
  7846. };
  7847. var a = function(t, e, i, n) {
  7848. this.list = t, this.entry = e, this.target = i, this.callback = n
  7849. },
  7850. l = [];
  7851. a.get = function(t, e, i, n) {
  7852. var r = l.pop();
  7853. return r ? (r.list = t, r.entry = e, r.target = i, r.callback = n) : r = new a(t, e, i, n), r
  7854. }, a.put = function(t) {
  7855. l.length < 20 && (t.list = t.entry = t.target = t.callback = null, l.push(t))
  7856. };
  7857. var h = function(t, e, i, n, r, s) {
  7858. var o = this;
  7859. o.timers = t, o.target = e, o.timerIndex = i, o.currentTimer = n, o.currentTimerSalvaged = r, o.paused = s
  7860. },
  7861. c = [];
  7862. function u() {
  7863. this._lock = !1, this._scheduler = null, this._elapsed = -1, this._runForever = !1, this._useDelay = !1, this._timesExecuted = 0, this._repeat = 0, this._delay = 0, this._interval = 0, this._target = null, this._callback = null
  7864. }
  7865. h.get = function(t, e, i, n, r, s) {
  7866. var o = c.pop();
  7867. return o ? (o.timers = t, o.target = e, o.timerIndex = i, o.currentTimer = n, o.currentTimerSalvaged = r, o.paused = s) : o = new h(t, e, i, n, r, s), o
  7868. }, h.put = function(t) {
  7869. c.length < 20 && (t.timers = t.target = t.currentTimer = null, c.push(t))
  7870. };
  7871. var _ = u.prototype;
  7872. _.initWithCallback = function(t, e, i, n, r, s) {
  7873. return this._lock = !1, this._scheduler = t, this._target = i, this._callback = e, this._elapsed = -1, this._interval = n, this._delay = s, this._useDelay = this._delay > 0, this._repeat = r, this._runForever = this._repeat === cc.macro.REPEAT_FOREVER, !0
  7874. }, _.getInterval = function() {
  7875. return this._interval
  7876. }, _.setInterval = function(t) {
  7877. this._interval = t
  7878. }, _.update = function(t) {
  7879. -1 === this._elapsed ? (this._elapsed = 0, this._timesExecuted = 0) : (this._elapsed += t, this._runForever && !this._useDelay ? this._elapsed >= this._interval && (this.trigger(), this._elapsed = 0) : (this._useDelay ? this._elapsed >= this._delay && (this.trigger(), this._elapsed -= this._delay, this._timesExecuted += 1, this._useDelay = !1) : this._elapsed >= this._interval && (this.trigger(), this._elapsed = 0, this._timesExecuted += 1), this._callback && !this._runForever && this._timesExecuted > this._repeat && this.cancel()))
  7880. }, _.getCallback = function() {
  7881. return this._callback
  7882. }, _.trigger = function() {
  7883. this._target && this._callback && (this._lock = !0, this._callback.call(this._target, this._elapsed), this._lock = !1)
  7884. }, _.cancel = function() {
  7885. this._scheduler.unschedule(this._callback, this._target)
  7886. };
  7887. var f = [];
  7888. u.get = function() {
  7889. return f.pop() || new u
  7890. }, u.put = function(t) {
  7891. f.length < 20 && !t._lock && (t._scheduler = t._target = t._callback = null, f.push(t))
  7892. }, cc.Scheduler = function() {
  7893. this._timeScale = 1, this._updatesNegList = [], this._updates0List = [], this._updatesPosList = [], this._hashForUpdates = n.createMap(!0), this._hashForTimers = n.createMap(!0), this._currentTarget = null, this._currentTargetSalvaged = !1, this._updateHashLocked = !1, this._arrayForTimers = []
  7894. }, cc.Scheduler.prototype = {
  7895. constructor: cc.Scheduler,
  7896. _removeHashElement: function(t) {
  7897. delete this._hashForTimers[t.target._id];
  7898. for (var e = this._arrayForTimers, i = 0, n = e.length; i < n; i++)
  7899. if (e[i] === t) {
  7900. e.splice(i, 1);
  7901. break
  7902. }
  7903. h.put(t)
  7904. },
  7905. _removeUpdateFromHash: function(t) {
  7906. var e = t.target._id,
  7907. i = this._hashForUpdates[e];
  7908. if (i) {
  7909. for (var n = i.list, r = i.entry, o = 0, l = n.length; o < l; o++)
  7910. if (n[o] === r) {
  7911. n.splice(o, 1);
  7912. break
  7913. }
  7914. delete this._hashForUpdates[e], s.put(r), a.put(i)
  7915. }
  7916. },
  7917. _priorityIn: function(t, e, i) {
  7918. for (var n = 0; n < t.length; n++)
  7919. if (i < t[n].priority) return void t.splice(n, 0, e);
  7920. t.push(e)
  7921. },
  7922. _appendIn: function(t, e) {
  7923. t.push(e)
  7924. },
  7925. enableForTarget: function(t) {
  7926. t._id || (t.__instanceId ? cc.warnID(1513) : t._id = r.getNewId())
  7927. },
  7928. setTimeScale: function(t) {
  7929. this._timeScale = t
  7930. },
  7931. getTimeScale: function() {
  7932. return this._timeScale
  7933. },
  7934. update: function(t) {
  7935. var e, i, n, r;
  7936. for (this._updateHashLocked = !0, 1 !== this._timeScale && (t *= this._timeScale), e = 0, n = (i = this._updatesNegList).length; e < n; e++)(r = i[e]).paused || r.markedForDeletion || r.target.update(t);
  7937. for (e = 0, n = (i = this._updates0List).length; e < n; e++)(r = i[e]).paused || r.markedForDeletion || r.target.update(t);
  7938. for (e = 0, n = (i = this._updatesPosList).length; e < n; e++)(r = i[e]).paused || r.markedForDeletion || r.target.update(t);
  7939. var s, o = this._arrayForTimers;
  7940. for (e = 0; e < o.length; e++) {
  7941. if (s = o[e], this._currentTarget = s, this._currentTargetSalvaged = !1, !s.paused)
  7942. for (s.timerIndex = 0; s.timerIndex < s.timers.length; ++s.timerIndex) s.currentTimer = s.timers[s.timerIndex], s.currentTimerSalvaged = !1, s.currentTimer.update(t), s.currentTimer = null;
  7943. this._currentTargetSalvaged && 0 === this._currentTarget.timers.length && (this._removeHashElement(this._currentTarget), --e)
  7944. }
  7945. for (e = 0, i = this._updatesNegList; e < i.length;)(r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
  7946. for (e = 0, i = this._updates0List; e < i.length;)(r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
  7947. for (e = 0, i = this._updatesPosList; e < i.length;)(r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++;
  7948. this._updateHashLocked = !1, this._currentTarget = null
  7949. },
  7950. schedule: function(t, e, i, n, r, s) {
  7951. if ("function" != typeof t) {
  7952. var o = t;
  7953. t = e, e = o
  7954. }
  7955. 4 !== arguments.length && 5 !== arguments.length || (s = !!n, n = cc.macro.REPEAT_FOREVER, r = 0), cc.assertID(e, 1502);
  7956. var a = e._id;
  7957. a || (e.__instanceId ? (cc.warnID(1513), a = e._id = e.__instanceId) : cc.errorID(1510));
  7958. var l, c, _ = this._hashForTimers[a];
  7959. if (_ ? _.paused !== s && cc.warnID(1511) : (_ = h.get(null, e, 0, null, null, s), this._arrayForTimers.push(_), this._hashForTimers[a] = _), null == _.timers) _.timers = [];
  7960. else
  7961. for (c = 0; c < _.timers.length; ++c)
  7962. if ((l = _.timers[c]) && t === l._callback) return cc.logID(1507, l.getInterval(), i), void(l._interval = i);
  7963. (l = u.get()).initWithCallback(this, t, e, i, n, r), _.timers.push(l), this._currentTarget === _ && this._currentTargetSalvaged && (this._currentTargetSalvaged = !1)
  7964. },
  7965. scheduleUpdate: function(t, e, i) {
  7966. var n = t._id;
  7967. n || (t.__instanceId ? (cc.warnID(1513), n = t._id = t.__instanceId) : cc.errorID(1510));
  7968. var r = this._hashForUpdates[n];
  7969. if (r && r.entry) {
  7970. if (r.entry.priority === e) return r.entry.markedForDeletion = !1, void(r.entry.paused = i);
  7971. if (this._updateHashLocked) return cc.logID(1506), r.entry.markedForDeletion = !1, void(r.entry.paused = i);
  7972. this.unscheduleUpdate(t)
  7973. }
  7974. var o, l = s.get(t, e, i, !1);
  7975. 0 === e ? (o = this._updates0List, this._appendIn(o, l)) : (o = e < 0 ? this._updatesNegList : this._updatesPosList, this._priorityIn(o, l, e)), this._hashForUpdates[n] = a.get(o, l, t, null)
  7976. },
  7977. unschedule: function(t, e) {
  7978. if (e && t) {
  7979. var i = e._id;
  7980. i || (e.__instanceId ? (cc.warnID(1513), i = e._id = e.__instanceId) : cc.errorID(1510));
  7981. var n = this._hashForTimers[i];
  7982. if (n)
  7983. for (var r = n.timers, s = 0, o = r.length; s < o; s++) {
  7984. var a = r[s];
  7985. if (t === a._callback) return a !== n.currentTimer || n.currentTimerSalvaged || (n.currentTimerSalvaged = !0), r.splice(s, 1), u.put(a), n.timerIndex >= s && n.timerIndex--, void(0 === r.length && (this._currentTarget === n ? this._currentTargetSalvaged = !0 : this._removeHashElement(n)))
  7986. }
  7987. }
  7988. },
  7989. unscheduleUpdate: function(t) {
  7990. if (t) {
  7991. var e = t._id;
  7992. e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
  7993. var i = this._hashForUpdates[e];
  7994. i && (this._updateHashLocked ? i.entry.markedForDeletion = !0 : this._removeUpdateFromHash(i.entry))
  7995. }
  7996. },
  7997. unscheduleAllForTarget: function(t) {
  7998. if (t) {
  7999. var e = t._id;
  8000. e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
  8001. var i = this._hashForTimers[e];
  8002. if (i) {
  8003. var n = i.timers;
  8004. n.indexOf(i.currentTimer) > -1 && !i.currentTimerSalvaged && (i.currentTimerSalvaged = !0);
  8005. for (var r = 0, s = n.length; r < s; r++) u.put(n[r]);
  8006. n.length = 0, this._currentTarget === i ? this._currentTargetSalvaged = !0 : this._removeHashElement(i)
  8007. }
  8008. this.unscheduleUpdate(t)
  8009. }
  8010. },
  8011. unscheduleAll: function() {
  8012. this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)
  8013. },
  8014. unscheduleAllWithMinPriority: function(t) {
  8015. var e, i, n, r = this._arrayForTimers;
  8016. for (e = r.length - 1; e >= 0; e--) i = r[e], this.unscheduleAllForTarget(i.target);
  8017. var s = 0;
  8018. if (t < 0)
  8019. for (e = 0; e < this._updatesNegList.length;) s = this._updatesNegList.length, (n = this._updatesNegList[e]) && n.priority >= t && this.unscheduleUpdate(n.target), s == this._updatesNegList.length && e++;
  8020. if (t <= 0)
  8021. for (e = 0; e < this._updates0List.length;) s = this._updates0List.length, (n = this._updates0List[e]) && this.unscheduleUpdate(n.target), s == this._updates0List.length && e++;
  8022. for (e = 0; e < this._updatesPosList.length;) s = this._updatesPosList.length, (n = this._updatesPosList[e]) && n.priority >= t && this.unscheduleUpdate(n.target), s == this._updatesPosList.length && e++
  8023. },
  8024. isScheduled: function(t, e) {
  8025. cc.assertID(t, 1508), cc.assertID(e, 1509);
  8026. var i = e._id;
  8027. i || (e.__instanceId ? (cc.warnID(1513), i = e._id = e.__instanceId) : cc.errorID(1510));
  8028. var n = this._hashForTimers[i];
  8029. if (!n) return !1;
  8030. if (null == n.timers) return !1;
  8031. for (var r = n.timers, s = 0; s < r.length; ++s) {
  8032. if (t === r[s]._callback) return !0
  8033. }
  8034. return !1
  8035. },
  8036. pauseAllTargets: function() {
  8037. return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)
  8038. },
  8039. pauseAllTargetsWithMinPriority: function(t) {
  8040. var e, i, n, r, s = [],
  8041. o = this._arrayForTimers;
  8042. for (i = 0, n = o.length; i < n; i++)(e = o[i]) && (e.paused = !0, s.push(e.target));
  8043. if (t < 0)
  8044. for (i = 0; i < this._updatesNegList.length; i++)(r = this._updatesNegList[i]) && r.priority >= t && (r.paused = !0, s.push(r.target));
  8045. if (t <= 0)
  8046. for (i = 0; i < this._updates0List.length; i++)(r = this._updates0List[i]) && (r.paused = !0, s.push(r.target));
  8047. for (i = 0; i < this._updatesPosList.length; i++)(r = this._updatesPosList[i]) && r.priority >= t && (r.paused = !0, s.push(r.target));
  8048. return s
  8049. },
  8050. resumeTargets: function(t) {
  8051. if (t)
  8052. for (var e = 0; e < t.length; e++) this.resumeTarget(t[e])
  8053. },
  8054. pauseTarget: function(t) {
  8055. cc.assertID(t, 1503);
  8056. var e = t._id;
  8057. e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
  8058. var i = this._hashForTimers[e];
  8059. i && (i.paused = !0);
  8060. var n = this._hashForUpdates[e];
  8061. n && (n.entry.paused = !0)
  8062. },
  8063. resumeTarget: function(t) {
  8064. cc.assertID(t, 1504);
  8065. var e = t._id;
  8066. e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
  8067. var i = this._hashForTimers[e];
  8068. i && (i.paused = !1);
  8069. var n = this._hashForUpdates[e];
  8070. n && (n.entry.paused = !1)
  8071. },
  8072. isTargetPaused: function(t) {
  8073. cc.assertID(t, 1505);
  8074. var e = t._id;
  8075. e || (t.__instanceId ? (cc.warnID(1513), e = t._id = t.__instanceId) : cc.errorID(1510));
  8076. var i = this._hashForTimers[e];
  8077. if (i) return i.paused;
  8078. var n = this._hashForUpdates[e];
  8079. return !!n && n.entry.paused
  8080. }
  8081. }, cc.Scheduler.PRIORITY_SYSTEM = 1 << 31, cc.Scheduler.PRIORITY_NON_SYSTEM = cc.Scheduler.PRIORITY_SYSTEM + 1, e.exports = cc.Scheduler
  8082. }), {
  8083. "./platform/id-generater": 214,
  8084. "./platform/js": 218
  8085. }],
  8086. 56: [(function(t, e, i) {
  8087. "use strict";
  8088. var n = t("./CCRawAsset");
  8089. cc.Asset = cc.Class({
  8090. name: "cc.Asset",
  8091. extends: n,
  8092. ctor: function() {
  8093. this.loaded = !0, this.url = ""
  8094. },
  8095. properties: {
  8096. nativeUrl: {
  8097. get: function() {
  8098. if (this._native) {
  8099. var t = this._native;
  8100. if (47 === t.charCodeAt(0)) return t.slice(1);
  8101. if (cc.AssetLibrary) {
  8102. var e = cc.AssetLibrary.getLibUrlNoExt(this._uuid, !0);
  8103. return 46 === t.charCodeAt(0) ? e + t : e + "/" + t
  8104. }
  8105. cc.errorID(6400)
  8106. }
  8107. return ""
  8108. },
  8109. visible: !1
  8110. },
  8111. _native: "",
  8112. _nativeAsset: {
  8113. get: function() {
  8114. return this._$nativeAsset
  8115. },
  8116. set: function(t) {
  8117. this._$nativeAsset = t
  8118. }
  8119. }
  8120. },
  8121. statics: {
  8122. deserialize: !1,
  8123. preventDeferredLoadDependents: !1,
  8124. preventPreloadNativeObject: !1
  8125. },
  8126. toString: function() {
  8127. return this.nativeUrl
  8128. },
  8129. serialize: !1,
  8130. createNode: null,
  8131. _setRawAsset: function(t, e) {
  8132. this._native = !1 !== e ? t || void 0 : "/" + t
  8133. }
  8134. }), e.exports = cc.Asset
  8135. }), {
  8136. "./CCRawAsset": 65
  8137. }],
  8138. 57: [(function(t, e, i) {
  8139. "use strict";
  8140. var n = t("./CCAsset"),
  8141. r = t("../event/event-target"),
  8142. s = cc.Enum({
  8143. WEB_AUDIO: 0,
  8144. DOM_AUDIO: 1
  8145. }),
  8146. o = cc.Class({
  8147. name: "cc.AudioClip",
  8148. extends: n,
  8149. mixins: [r],
  8150. ctor: function() {
  8151. this.loaded = !1, this._audio = null
  8152. },
  8153. properties: {
  8154. loadMode: {
  8155. default: s.WEB_AUDIO,
  8156. type: s
  8157. },
  8158. _nativeAsset: {
  8159. get: function() {
  8160. return this._audio
  8161. },
  8162. set: function(t) {
  8163. t instanceof cc.AudioClip ? this._audio = t._nativeAsset : this._audio = t, this._audio && (this.loaded = !0, this.emit("load"))
  8164. },
  8165. override: !0
  8166. }
  8167. },
  8168. statics: {
  8169. LoadMode: s,
  8170. _loadByUrl: function(t, e) {
  8171. var i = cc.loader.getItem(t) || cc.loader.getItem(t + "?useDom=1");
  8172. i && i.complete ? i._owner instanceof o ? e(null, i._owner) : e(null, i.content) : cc.loader.load(t, (function(n, r) {
  8173. if (n) return e(n);
  8174. i = cc.loader.getItem(t) || cc.loader.getItem(t + "?useDom=1"), e(null, i.content)
  8175. }))
  8176. }
  8177. },
  8178. destroy: function() {
  8179. cc.audioEngine.uncache(this), this._super()
  8180. }
  8181. });
  8182. cc.AudioClip = o, e.exports = o
  8183. }), {
  8184. "../event/event-target": 131,
  8185. "./CCAsset": 56
  8186. }],
  8187. 58: [(function(t, e, i) {
  8188. "use strict";
  8189. var n = function() {
  8190. this.u = 0, this.v = 0, this.w = 0, this.h = 0, this.offsetX = 0, this.offsetY = 0, this.textureID = 0, this.valid = !1, this.xAdvance = 0
  8191. },
  8192. r = function(t) {
  8193. this._letterDefinitions = {}, this._texture = t
  8194. };
  8195. r.prototype = {
  8196. constructor: r,
  8197. addLetterDefinitions: function(t, e) {
  8198. this._letterDefinitions[t] = e
  8199. },
  8200. cloneLetterDefinition: function() {
  8201. var t = {};
  8202. for (var e in this._letterDefinitions) {
  8203. var i = new n;
  8204. cc.js.mixin(i, this._letterDefinitions[e]), t[e] = i
  8205. }
  8206. return t
  8207. },
  8208. getTexture: function() {
  8209. return this._texture
  8210. },
  8211. getLetter: function(t) {
  8212. return this._letterDefinitions[t]
  8213. },
  8214. getLetterDefinitionForChar: function(t) {
  8215. var e = t.charCodeAt(0);
  8216. return this._letterDefinitions.hasOwnProperty(e) ? this._letterDefinitions[e] : null
  8217. },
  8218. clear: function() {
  8219. this._letterDefinitions = {}
  8220. }
  8221. };
  8222. var s = cc.Class({
  8223. name: "cc.BitmapFont",
  8224. extends: cc.Font,
  8225. properties: {
  8226. fntDataStr: {
  8227. default: ""
  8228. },
  8229. spriteFrame: {
  8230. default: null,
  8231. type: cc.SpriteFrame
  8232. },
  8233. fontSize: {
  8234. default: -1
  8235. },
  8236. _fntConfig: null,
  8237. _fontDefDictionary: null
  8238. },
  8239. onLoad: function() {
  8240. var t = this.spriteFrame;
  8241. !this._fontDefDictionary && t && (this._fontDefDictionary = new r(t._texture));
  8242. var e = this._fntConfig;
  8243. if (e) {
  8244. var i = e.fontDefDictionary;
  8245. for (var s in i) {
  8246. var o = new n,
  8247. a = i[s].rect;
  8248. o.offsetX = i[s].xOffset, o.offsetY = i[s].yOffset, o.w = a.width, o.h = a.height, o.u = a.x, o.v = a.y, o.textureID = 0, o.valid = !0, o.xAdvance = i[s].xAdvance, this._fontDefDictionary.addLetterDefinitions(s, o)
  8249. }
  8250. }
  8251. }
  8252. });
  8253. cc.BitmapFont = s, cc.BitmapFont.FontLetterDefinition = n, cc.BitmapFont.FontAtlas = r, e.exports = s
  8254. }), {}],
  8255. 59: [(function(t, e, i) {
  8256. "use strict";
  8257. var n = cc.Class({
  8258. name: "cc.BufferAsset",
  8259. extends: cc.Asset,
  8260. ctor: function() {
  8261. this._buffer = null
  8262. },
  8263. properties: {
  8264. _nativeAsset: {
  8265. get: function() {
  8266. return this._buffer
  8267. },
  8268. set: function(t) {
  8269. this._buffer = t.buffer || t
  8270. },
  8271. override: !0
  8272. },
  8273. buffer: function() {
  8274. return this._buffer
  8275. }
  8276. }
  8277. });
  8278. cc.BufferAsset = e.exports = n
  8279. }), {}],
  8280. 60: [(function(t, e, i) {
  8281. "use strict";
  8282. var n = t("./CCAsset"),
  8283. r = t("../../renderer/core/effect"),
  8284. s = cc.Class({
  8285. name: "cc.EffectAsset",
  8286. extends: n,
  8287. ctor: function() {
  8288. this._effect = null
  8289. },
  8290. properties: {
  8291. properties: Object,
  8292. techniques: [],
  8293. shaders: []
  8294. },
  8295. onLoad: function() {
  8296. if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
  8297. for (var t = cc.renderer._forward._programLib, e = 0; e < this.shaders.length; e++) t.define(this.shaders[e]);
  8298. this._initEffect()
  8299. }
  8300. },
  8301. _initEffect: function() {
  8302. this._effect || (this._effect = r.parseEffect(this))
  8303. },
  8304. getInstantiatedEffect: function() {
  8305. return this._initEffect(), this._effect.clone()
  8306. }
  8307. });
  8308. e.exports = cc.EffectAsset = s
  8309. }), {
  8310. "../../renderer/core/effect": 349,
  8311. "./CCAsset": 56
  8312. }],
  8313. 61: [(function(t, e, i) {
  8314. "use strict";
  8315. var n = cc.Class({
  8316. name: "cc.Font",
  8317. extends: cc.Asset
  8318. });
  8319. cc.Font = e.exports = n
  8320. }), {}],
  8321. 62: [(function(t, e, i) {
  8322. "use strict";
  8323. var n = cc.Class({
  8324. name: "cc.JsonAsset",
  8325. extends: cc.Asset,
  8326. properties: {
  8327. json: null
  8328. }
  8329. });
  8330. e.exports = cc.JsonAsset = n
  8331. }), {}],
  8332. 63: [(function(t, e, i) {
  8333. "use strict";
  8334. var n = cc.Class({
  8335. name: "cc.LabelAtlas",
  8336. extends: cc.BitmapFont,
  8337. onLoad: function() {
  8338. this.spriteFrame ? this._fntConfig ? this._super() : cc.warnID(9101, this.name) : cc.warnID(9100, this.name)
  8339. }
  8340. });
  8341. cc.LabelAtlas = n, e.exports = n
  8342. }), {}],
  8343. 64: [(function(t, e, i) {
  8344. "use strict";
  8345. var n = cc.Enum({
  8346. AUTO: 0,
  8347. SINGLE_INSTANCE: 1,
  8348. MULTI_INSTANCE: 2
  8349. }),
  8350. r = cc.Class({
  8351. name: "cc.Prefab",
  8352. extends: cc.Asset,
  8353. ctor: function() {
  8354. this._createFunction = null, this._instantiatedTimes = 0
  8355. },
  8356. properties: {
  8357. data: null,
  8358. optimizationPolicy: n.AUTO,
  8359. asyncLoadAssets: !1,
  8360. readonly: {
  8361. default: !1,
  8362. editorOnly: !0
  8363. }
  8364. },
  8365. statics: {
  8366. OptimizationPolicy: n,
  8367. OptimizationPolicyThreshold: 3
  8368. },
  8369. createNode: !1,
  8370. compileCreateFunction: function() {
  8371. var e = t("../platform/instantiate-jit");
  8372. this._createFunction = e.compile(this.data)
  8373. },
  8374. _doInstantiate: function(t) {
  8375. return this.data._prefab ? this.data._prefab._synced = !0 : cc.warnID(3700), this._createFunction || this.compileCreateFunction(), this._createFunction(t)
  8376. },
  8377. _instantiate: function() {
  8378. var t;
  8379. return this.optimizationPolicy !== n.SINGLE_INSTANCE && (this.optimizationPolicy === n.MULTI_INSTANCE || this._instantiatedTimes + 1 >= r.OptimizationPolicyThreshold) ? (t = this._doInstantiate(), this.data._instantiate(t)) : (this.data._prefab._synced = !0, t = this.data._instantiate()), ++this._instantiatedTimes, t
  8380. },
  8381. destroy: function() {
  8382. this.data && this.data.destroy(), this._super()
  8383. }
  8384. });
  8385. cc.Prefab = e.exports = r, cc.js.obsolete(cc, "cc._Prefab", "Prefab")
  8386. }), {
  8387. "../platform/instantiate-jit": 216
  8388. }],
  8389. 65: [(function(t, e, i) {
  8390. "use strict";
  8391. var n = t("../platform/CCObject"),
  8392. r = t("../platform/js");
  8393. cc.RawAsset = cc.Class({
  8394. name: "cc.RawAsset",
  8395. extends: n,
  8396. ctor: function() {
  8397. Object.defineProperty(this, "_uuid", {
  8398. value: "",
  8399. writable: !0
  8400. })
  8401. }
  8402. }), r.value(cc.RawAsset, "isRawAssetType", (function(t) {
  8403. return r.isChildClassOf(t, cc.RawAsset) && !r.isChildClassOf(t, cc.Asset)
  8404. })), r.value(cc.RawAsset, "wasRawAssetType", (function(t) {
  8405. return t === cc.Texture2D || t === cc.AudioClip || t === cc.ParticleAsset || t === cc.Asset
  8406. })), e.exports = cc.RawAsset
  8407. }), {
  8408. "../platform/CCObject": 204,
  8409. "../platform/js": 218
  8410. }],
  8411. 66: [(function(t, e, i) {
  8412. "use strict";
  8413. var n = (function(t) {
  8414. return t && t.__esModule ? t : {
  8415. default: t
  8416. }
  8417. })(t("../../renderer/gfx"));
  8418. var r = t("../renderer"),
  8419. s = t("./CCTexture2D"),
  8420. o = cc.Class({
  8421. name: "cc.RenderTexture",
  8422. extends: s,
  8423. ctor: function() {
  8424. this._framebuffer = null
  8425. },
  8426. initWithSize: function(t, e, i) {
  8427. this.width = Math.floor(t || cc.visibleRect.width), this.height = Math.floor(e || cc.visibleRect.height), this._resetUnderlyingMipmaps();
  8428. var s = {
  8429. colors: [this._texture]
  8430. };
  8431. this._depthStencilBuffer && this._depthStencilBuffer.destroy();
  8432. var o = void 0;
  8433. i && (o = new n.default.RenderBuffer(r.device, i, t, e), i === n.default.RB_FMT_D24S8 ? s.depthStencil = o : i === n.default.RB_FMT_S8 ? s.stencil = o : i === n.default.RB_FMT_D16 && (s.depth = o)), this._depthStencilBuffer = o, this._framebuffer && this._framebuffer.destroy(), this._framebuffer = new n.default.FrameBuffer(r.device, t, e, s), this._packable = !1, this.loaded = !0, this.emit("load")
  8434. },
  8435. updateSize: function(t, e) {
  8436. this.width = Math.floor(t || cc.visibleRect.width), this.height = Math.floor(e || cc.visibleRect.height), this._resetUnderlyingMipmaps();
  8437. var i = this._depthStencilBuffer;
  8438. i && i.update(this.width, this.height), this._framebuffer._width = t, this._framebuffer._height = e
  8439. },
  8440. drawTextureAt: function(t, e, i) {
  8441. t._image && this._texture.updateSubImage({
  8442. x: e,
  8443. y: i,
  8444. image: t._image,
  8445. width: t.width,
  8446. height: t.height,
  8447. level: 0,
  8448. flipY: !1,
  8449. premultiplyAlpha: t._premultiplyAlpha
  8450. })
  8451. },
  8452. readPixels: function(t, e, i, n, r) {
  8453. if (!this._framebuffer || !this._texture) return t;
  8454. e = e || 0, i = i || 0;
  8455. var s = n || this.width,
  8456. o = r || this.height;
  8457. t = t || new Uint8Array(s * o * 4);
  8458. var a = cc.game._renderContext,
  8459. l = a.getParameter(a.FRAMEBUFFER_BINDING);
  8460. return a.bindFramebuffer(a.FRAMEBUFFER, this._framebuffer.getHandle()), a.readPixels(e, i, s, o, a.RGBA, a.UNSIGNED_BYTE, t), a.bindFramebuffer(a.FRAMEBUFFER, l), t
  8461. },
  8462. destroy: function() {
  8463. this._super(), this._framebuffer && (this._framebuffer.destroy(), this._framebuffer = null)
  8464. }
  8465. });
  8466. cc.RenderTexture = e.exports = o
  8467. }), {
  8468. "../../renderer/gfx": 360,
  8469. "../renderer": 247,
  8470. "./CCTexture2D": 73
  8471. }],
  8472. 67: [(function(t, e, i) {
  8473. "use strict";
  8474. var n = cc.Class({
  8475. name: "cc.SceneAsset",
  8476. extends: cc.Asset,
  8477. properties: {
  8478. scene: null,
  8479. asyncLoadAssets: void 0
  8480. }
  8481. });
  8482. cc.SceneAsset = n, e.exports = n
  8483. }), {}],
  8484. 68: [(function(t, e, i) {
  8485. "use strict";
  8486. var n = cc.Class({
  8487. name: "cc.Script",
  8488. extends: cc.Asset
  8489. });
  8490. cc._Script = n;
  8491. var r = cc.Class({
  8492. name: "cc.JavaScript",
  8493. extends: n
  8494. });
  8495. cc._JavaScript = r;
  8496. var s = cc.Class({
  8497. name: "cc.CoffeeScript",
  8498. extends: n
  8499. });
  8500. cc._CoffeeScript = s;
  8501. var o = cc.Class({
  8502. name: "cc.TypeScript",
  8503. extends: n
  8504. });
  8505. cc._TypeScript = o
  8506. }), {}],
  8507. 69: [(function(t, e, i) {
  8508. "use strict";
  8509. var n = cc.Class({
  8510. name: "cc.SpriteAtlas",
  8511. extends: cc.Asset,
  8512. properties: {
  8513. _spriteFrames: {
  8514. default: {}
  8515. }
  8516. },
  8517. getTexture: function() {
  8518. var t = Object.keys(this._spriteFrames);
  8519. if (t.length > 0) {
  8520. var e = this._spriteFrames[t[0]];
  8521. return e ? e.getTexture() : null
  8522. }
  8523. return null
  8524. },
  8525. getSpriteFrame: function(t) {
  8526. var e = this._spriteFrames[t];
  8527. return e ? (e.name || (e.name = t), e) : null
  8528. },
  8529. getSpriteFrames: function() {
  8530. var t = [],
  8531. e = this._spriteFrames;
  8532. for (var i in e) t.push(this.getSpriteFrame(i));
  8533. return t
  8534. }
  8535. });
  8536. cc.SpriteAtlas = n, e.exports = n
  8537. }), {}],
  8538. 70: [(function(t, e, i) {
  8539. "use strict";
  8540. var n = t("../event/event-target"),
  8541. r = t("../utils/texture-util"),
  8542. s = [{
  8543. u: 0,
  8544. v: 0
  8545. }, {
  8546. u: 0,
  8547. v: 0
  8548. }, {
  8549. u: 0,
  8550. v: 0
  8551. }, {
  8552. u: 0,
  8553. v: 0
  8554. }],
  8555. o = cc.Class({
  8556. name: "cc.SpriteFrame",
  8557. extends: t("../assets/CCAsset"),
  8558. mixins: [n],
  8559. properties: {
  8560. _textureSetter: {
  8561. set: function(t) {
  8562. t && (this._texture !== t && this._refreshTexture(t), this._textureFilename = t.url)
  8563. }
  8564. },
  8565. insetTop: {
  8566. get: function() {
  8567. return this._capInsets[1]
  8568. },
  8569. set: function(t) {
  8570. this._capInsets[1] = t, this._texture && this._calculateSlicedUV()
  8571. }
  8572. },
  8573. insetBottom: {
  8574. get: function() {
  8575. return this._capInsets[3]
  8576. },
  8577. set: function(t) {
  8578. this._capInsets[3] = t, this._texture && this._calculateSlicedUV()
  8579. }
  8580. },
  8581. insetLeft: {
  8582. get: function() {
  8583. return this._capInsets[0]
  8584. },
  8585. set: function(t) {
  8586. this._capInsets[0] = t, this._texture && this._calculateSlicedUV()
  8587. }
  8588. },
  8589. insetRight: {
  8590. get: function() {
  8591. return this._capInsets[2]
  8592. },
  8593. set: function(t) {
  8594. this._capInsets[2] = t, this._texture && this._calculateSlicedUV()
  8595. }
  8596. }
  8597. },
  8598. ctor: function() {
  8599. n.call(this);
  8600. var t = arguments[0],
  8601. e = arguments[1],
  8602. i = arguments[2],
  8603. r = arguments[3],
  8604. s = arguments[4];
  8605. this._rect = null, this.uv = [], this._texture = null, this._original = null, this._offset = null, this._originalSize = null, this._rotated = !1, this.vertices = null, this._capInsets = [0, 0, 0, 0], this.uvSliced = [], this._textureFilename = "", void 0 !== t && this.setTexture(t, e, i, r, s)
  8606. },
  8607. textureLoaded: function() {
  8608. return this._texture && this._texture.loaded
  8609. },
  8610. isRotated: function() {
  8611. return this._rotated
  8612. },
  8613. setRotated: function(t) {
  8614. this._rotated = t, this._texture && this._calculateUV()
  8615. },
  8616. getRect: function() {
  8617. return cc.rect(this._rect)
  8618. },
  8619. setRect: function(t) {
  8620. this._rect = t, this._texture && this._calculateUV()
  8621. },
  8622. getOriginalSize: function() {
  8623. return cc.size(this._originalSize)
  8624. },
  8625. setOriginalSize: function(t) {
  8626. this._originalSize ? (this._originalSize.width = t.width, this._originalSize.height = t.height) : this._originalSize = cc.size(t)
  8627. },
  8628. getTexture: function() {
  8629. return this._texture
  8630. },
  8631. _textureLoadedCallback: function() {
  8632. var t = this._texture;
  8633. if (t) {
  8634. var e = t.width,
  8635. i = t.height;
  8636. this._rect ? this._checkRect(this._texture) : this._rect = cc.rect(0, 0, e, i), this._originalSize || this.setOriginalSize(cc.size(e, i)), this._offset || this.setOffset(cc.v2(0, 0)), this._calculateUV(), this.emit("load")
  8637. }
  8638. },
  8639. _refreshTexture: function(t) {
  8640. this._texture = t, t.loaded ? this._textureLoadedCallback() : t.once("load", this._textureLoadedCallback, this)
  8641. },
  8642. getOffset: function() {
  8643. return cc.v2(this._offset)
  8644. },
  8645. setOffset: function(t) {
  8646. this._offset = cc.v2(t)
  8647. },
  8648. clone: function() {
  8649. return new o(this._texture || this._textureFilename, this._rect, this._rotated, this._offset, this._originalSize)
  8650. },
  8651. setTexture: function(t, e, i, n, r) {
  8652. this._rect = e || null, n ? this.setOffset(n) : this._offset = null, r ? this.setOriginalSize(r) : this._originalSize = null, this._rotated = i || !1;
  8653. var s = t;
  8654. return "string" == typeof s && s && (this._textureFilename = s, this._loadTexture()), s instanceof cc.Texture2D && this._texture !== s && this._refreshTexture(s), !0
  8655. },
  8656. _loadTexture: function() {
  8657. if (this._textureFilename) {
  8658. var t = r.loadImage(this._textureFilename);
  8659. this._refreshTexture(t)
  8660. }
  8661. },
  8662. ensureLoadTexture: function() {
  8663. this._texture ? this._texture.loaded || (this._refreshTexture(this._texture), r.postLoadTexture(this._texture)) : this._textureFilename && this._loadTexture()
  8664. },
  8665. _checkRect: function(t) {
  8666. var e = this._rect,
  8667. i = e.x,
  8668. n = e.y;
  8669. this._rotated ? (i += e.height, n += e.width) : (i += e.width, n += e.height), i > t.width && cc.errorID(3300, t.url + "/" + this.name, i, t.width), n > t.height && cc.errorID(3400, t.url + "/" + this.name, n, t.height)
  8670. },
  8671. _calculateSlicedUV: function() {
  8672. var t = this._rect,
  8673. e = this._texture.width,
  8674. i = this._texture.height,
  8675. n = this._capInsets[0],
  8676. r = this._capInsets[2],
  8677. o = t.width - n - r,
  8678. a = this._capInsets[1],
  8679. l = this._capInsets[3],
  8680. h = t.height - a - l,
  8681. c = this.uvSliced;
  8682. if (c.length = 0, this._rotated) {
  8683. s[0].u = t.x / e, s[1].u = (t.x + l) / e, s[2].u = (t.x + l + h) / e, s[3].u = (t.x + t.height) / e, s[3].v = t.y / i, s[2].v = (t.y + n) / i, s[1].v = (t.y + n + o) / i, s[0].v = (t.y + t.width) / i;
  8684. for (var u = 0; u < 4; ++u)
  8685. for (var _ = s[u], f = 0; f < 4; ++f) {
  8686. var d = s[3 - f];
  8687. c.push({
  8688. u: _.u,
  8689. v: d.v
  8690. })
  8691. }
  8692. } else {
  8693. s[0].u = t.x / e, s[1].u = (t.x + n) / e, s[2].u = (t.x + n + o) / e, s[3].u = (t.x + t.width) / e, s[3].v = t.y / i, s[2].v = (t.y + a) / i, s[1].v = (t.y + a + h) / i, s[0].v = (t.y + t.height) / i;
  8694. for (var p = 0; p < 4; ++p)
  8695. for (var m = s[p], y = 0; y < 4; ++y) {
  8696. var v = s[y];
  8697. c.push({
  8698. u: v.u,
  8699. v: m.v
  8700. })
  8701. }
  8702. }
  8703. },
  8704. _setDynamicAtlasFrame: function(t) {
  8705. t && (this._original = {
  8706. _texture: this._texture,
  8707. _x: this._rect.x,
  8708. _y: this._rect.y
  8709. }, this._texture = t.texture, this._rect.x = t.x, this._rect.y = t.y, this._calculateUV())
  8710. },
  8711. _resetDynamicAtlasFrame: function() {
  8712. this._original && (this._rect.x = this._original._x, this._rect.y = this._original._y, this._texture = this._original._texture, this._original = null, this._calculateUV())
  8713. },
  8714. _calculateUV: function() {
  8715. var t = this._rect,
  8716. e = this._texture,
  8717. i = this.uv,
  8718. n = e.width,
  8719. r = e.height;
  8720. if (this._rotated) {
  8721. var s = 0 === n ? 0 : t.x / n,
  8722. o = 0 === n ? 0 : (t.x + t.height) / n,
  8723. a = 0 === r ? 0 : (t.y + t.width) / r,
  8724. l = 0 === r ? 0 : t.y / r;
  8725. i[0] = s, i[1] = l, i[2] = s, i[3] = a, i[4] = o, i[5] = l, i[6] = o, i[7] = a
  8726. } else {
  8727. var h = 0 === n ? 0 : t.x / n,
  8728. c = 0 === n ? 0 : (t.x + t.width) / n,
  8729. u = 0 === r ? 0 : (t.y + t.height) / r,
  8730. _ = 0 === r ? 0 : t.y / r;
  8731. i[0] = h, i[1] = u, i[2] = c, i[3] = u, i[4] = h, i[5] = _, i[6] = c, i[7] = _
  8732. }
  8733. var f = this.vertices;
  8734. if (f) {
  8735. f.nu.length = 0, f.nv.length = 0;
  8736. for (var d = 0; d < f.u.length; d++) f.nu[d] = f.u[d] / n, f.nv[d] = f.v[d] / r
  8737. }
  8738. this._calculateSlicedUV()
  8739. },
  8740. _serialize: !1,
  8741. _deserialize: function(t, e) {
  8742. var i = t.rect;
  8743. i && (this._rect = new cc.Rect(i[0], i[1], i[2], i[3])), t.offset && this.setOffset(new cc.Vec2(t.offset[0], t.offset[1])), t.originalSize && this.setOriginalSize(new cc.Size(t.originalSize[0], t.originalSize[1])), this._rotated = 1 === t.rotated, this._name = t.name;
  8744. var n = t.capInsets;
  8745. n && (this._capInsets[0] = n[0], this._capInsets[1] = n[1], this._capInsets[2] = n[2], this._capInsets[3] = n[3]), this.vertices = t.vertices, this.vertices && (this.vertices.nu = [], this.vertices.nv = []);
  8746. var r = t.texture;
  8747. r && e.result.push(this, "_textureSetter", r)
  8748. }
  8749. }),
  8750. a = o.prototype;
  8751. a.copyWithZone = a.clone, a.copy = a.clone, a.initWithTexture = a.setTexture, cc.SpriteFrame = o, e.exports = o
  8752. }), {
  8753. "../assets/CCAsset": 56,
  8754. "../event/event-target": 131,
  8755. "../utils/texture-util": 308
  8756. }],
  8757. 71: [(function(t, e, i) {
  8758. "use strict";
  8759. var n = t("./CCFont"),
  8760. r = cc.Class({
  8761. name: "cc.TTFFont",
  8762. extends: n,
  8763. properties: {
  8764. _fontFamily: null,
  8765. _nativeAsset: {
  8766. type: cc.String,
  8767. get: function() {
  8768. return this._fontFamily
  8769. },
  8770. set: function(t) {
  8771. this._fontFamily = t || "Arial"
  8772. },
  8773. override: !0
  8774. }
  8775. }
  8776. });
  8777. cc.TTFFont = e.exports = r
  8778. }), {
  8779. "./CCFont": 61
  8780. }],
  8781. 72: [(function(t, e, i) {
  8782. "use strict";
  8783. var n = cc.Class({
  8784. name: "cc.TextAsset",
  8785. extends: cc.Asset,
  8786. properties: {
  8787. text: ""
  8788. },
  8789. toString: function() {
  8790. return this.text
  8791. }
  8792. });
  8793. e.exports = cc.TextAsset = n
  8794. }), {}],
  8795. 73: [(function(t, e, i) {
  8796. "use strict";
  8797. var n = (function(t) {
  8798. return t && t.__esModule ? t : {
  8799. default: t
  8800. }
  8801. })(t("../../renderer/gfx"));
  8802. var r = t("../event/event-target"),
  8803. s = t("../renderer");
  8804. t("../platform/CCClass");
  8805. var o = new(t("../platform/id-generater"))("Tex"),
  8806. a = 1024,
  8807. l = cc.Enum({
  8808. RGB565: n.default.TEXTURE_FMT_R5_G6_B5,
  8809. RGB5A1: n.default.TEXTURE_FMT_R5_G5_B5_A1,
  8810. RGBA4444: n.default.TEXTURE_FMT_R4_G4_B4_A4,
  8811. RGB888: n.default.TEXTURE_FMT_RGB8,
  8812. RGBA8888: n.default.TEXTURE_FMT_RGBA8,
  8813. RGBA32F: n.default.TEXTURE_FMT_RGBA32F,
  8814. A8: n.default.TEXTURE_FMT_A8,
  8815. I8: n.default.TEXTURE_FMT_L8,
  8816. AI8: n.default.TEXTURE_FMT_L8_A8,
  8817. RGB_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_2BPPV1,
  8818. RGBA_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_2BPPV1,
  8819. RGB_A_PVRTC_2BPPV1: a++,
  8820. RGB_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_4BPPV1,
  8821. RGBA_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_4BPPV1,
  8822. RGB_A_PVRTC_4BPPV1: a++,
  8823. RGB_ETC1: n.default.TEXTURE_FMT_RGB_ETC1,
  8824. RGBA_ETC1: a++,
  8825. RGB_ETC2: n.default.TEXTURE_FMT_RGB_ETC2,
  8826. RGBA_ETC2: n.default.TEXTURE_FMT_RGBA_ETC2
  8827. }),
  8828. h = cc.Enum({
  8829. REPEAT: 10497,
  8830. CLAMP_TO_EDGE: 33071,
  8831. MIRRORED_REPEAT: 33648
  8832. }),
  8833. c = cc.Enum({
  8834. LINEAR: 9729,
  8835. NEAREST: 9728
  8836. }),
  8837. u = {
  8838. 9728: 0,
  8839. 9729: 1
  8840. },
  8841. _ = [],
  8842. f = {
  8843. width: void 0,
  8844. height: void 0,
  8845. minFilter: void 0,
  8846. magFilter: void 0,
  8847. wrapS: void 0,
  8848. wrapT: void 0,
  8849. format: void 0,
  8850. genMipmaps: void 0,
  8851. images: void 0,
  8852. image: void 0,
  8853. flipY: void 0,
  8854. premultiplyAlpha: void 0
  8855. };
  8856. function d() {
  8857. for (var t in f) f[t] = void 0;
  8858. return _.length = 0, f.images = _, f.flipY = !1, f
  8859. }
  8860. var p = cc.Class({
  8861. name: "cc.Texture2D",
  8862. extends: t("../assets/CCAsset"),
  8863. mixins: [r],
  8864. properties: {
  8865. _nativeAsset: {
  8866. get: function() {
  8867. return this._image
  8868. },
  8869. set: function(t) {
  8870. t._compressed && t._data ? this.initWithData(t._data, this._format, t.width, t.height) : this.initWithElement(t)
  8871. },
  8872. override: !0
  8873. },
  8874. _format: l.RGBA8888,
  8875. _premultiplyAlpha: !1,
  8876. _flipY: !1,
  8877. _minFilter: c.LINEAR,
  8878. _magFilter: c.LINEAR,
  8879. _mipFilter: c.LINEAR,
  8880. _wrapS: h.CLAMP_TO_EDGE,
  8881. _wrapT: h.CLAMP_TO_EDGE,
  8882. _genMipmaps: !1,
  8883. genMipmaps: {
  8884. get: function() {
  8885. return this._genMipmaps
  8886. },
  8887. set: function(t) {
  8888. if (this._genMipmaps !== t) {
  8889. var e = d();
  8890. e.genMipmaps = t, this.update(e)
  8891. }
  8892. }
  8893. },
  8894. _packable: !0,
  8895. packable: {
  8896. get: function() {
  8897. return this._packable
  8898. },
  8899. set: function(t) {
  8900. this._packable = t
  8901. }
  8902. }
  8903. },
  8904. statics: {
  8905. PixelFormat: l,
  8906. WrapMode: h,
  8907. Filter: c,
  8908. _FilterIndex: u,
  8909. extnames: [".png", ".jpg", ".jpeg", ".bmp", ".webp", ".pvr", ".pkm"]
  8910. },
  8911. ctor: function() {
  8912. this._id = o.getNewId(), this.loaded = !1, this.width = 0, this.height = 0, this._hashDirty = !0, this._hash = 0, this._texture = null
  8913. },
  8914. getImpl: function() {
  8915. return this._texture
  8916. },
  8917. getId: function() {
  8918. return this._id
  8919. },
  8920. toString: function() {
  8921. return this.url || ""
  8922. },
  8923. update: function(t) {
  8924. if (t) {
  8925. var e = !1;
  8926. void 0 !== t.width && (this.width = t.width), void 0 !== t.height && (this.height = t.height), void 0 !== t.minFilter && (this._minFilter = t.minFilter, t.minFilter = u[t.minFilter]), void 0 !== t.magFilter && (this._magFilter = t.magFilter, t.magFilter = u[t.magFilter]), void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter, t.mipFilter = u[t.mipFilter]), void 0 !== t.wrapS && (this._wrapS = t.wrapS), void 0 !== t.wrapT && (this._wrapT = t.wrapT), void 0 !== t.format && (this._format = t.format), void 0 !== t.flipY && (this._flipY = t.flipY, e = !0), void 0 !== t.premultiplyAlpha && (this._premultiplyAlpha = t.premultiplyAlpha, e = !0), void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps), e && this._image && (t.image = this._image), t.images && t.images.length > 0 ? this._image = t.images[0] : void 0 !== t.image && (this._image = t.image, t.images || (_.length = 0, t.images = _), t.images.push(t.image)), t.images && t.images.length > 0 && this._texture.update(t), this._hashDirty = !0
  8927. }
  8928. },
  8929. initWithElement: function(t) {
  8930. if (t)
  8931. if (this._image = t, t.complete || t instanceof HTMLCanvasElement) this.handleLoadedTexture();
  8932. else {
  8933. var e = this;
  8934. t.addEventListener("load", (function() {
  8935. e.handleLoadedTexture()
  8936. })), t.addEventListener("error", (function(t) {
  8937. cc.warnID(3119, t.message)
  8938. }))
  8939. }
  8940. },
  8941. initWithData: function(t, e, i, n) {
  8942. var r = d();
  8943. return r.image = t, r.images = [r.image], r.genMipmaps = this._genMipmaps, r.premultiplyAlpha = this._premultiplyAlpha, r.flipY = this._flipY, r.minFilter = u[this._minFilter], r.magFilter = u[this._magFilter], r.wrapS = this._wrapS, r.wrapT = this._wrapT, r.format = this._getGFXPixelFormat(e), r.width = i, r.height = n, this._texture ? this._texture.update(r) : this._texture = new s.Texture2D(s.device, r), this.width = i, this.height = n, this._checkPackable(), this.loaded = !0, this.emit("load"), !0
  8944. },
  8945. getHtmlElementObj: function() {
  8946. return this._image
  8947. },
  8948. destroy: function() {
  8949. this._image = null, this._texture && this._texture.destroy(), this._super()
  8950. },
  8951. getPixelFormat: function() {
  8952. return this._format
  8953. },
  8954. hasPremultipliedAlpha: function() {
  8955. return this._premultiplyAlpha || !1
  8956. },
  8957. handleLoadedTexture: function() {
  8958. if (this._image && this._image.width && this._image.height) {
  8959. this.width = this._image.width, this.height = this._image.height;
  8960. var t = d();
  8961. t.image = this._image, t.images = [t.image], t.width = this.width, t.height = this.height, t.genMipmaps = this._genMipmaps, t.format = this._getGFXPixelFormat(this._format), t.premultiplyAlpha = this._premultiplyAlpha, t.flipY = this._flipY, t.minFilter = u[this._minFilter], t.magFilter = u[this._magFilter], t.wrapS = this._wrapS, t.wrapT = this._wrapT, this._texture ? this._texture.update(t) : this._texture = new s.Texture2D(s.device, t), this._checkPackable(), this.loaded = !0, this.emit("load"), cc.macro.CLEANUP_IMAGE_CACHE && this._image instanceof HTMLImageElement && this._clearImage()
  8962. }
  8963. },
  8964. description: function() {
  8965. return "<cc.Texture2D | Name = " + this.url + " | Dimensions = " + this.width + " x " + this.height + ">"
  8966. },
  8967. releaseTexture: function() {
  8968. this._image = null, this._texture && this._texture.destroy()
  8969. },
  8970. setWrapMode: function(t, e) {
  8971. if (this._wrapS !== t || this._wrapT !== e) {
  8972. var i = d();
  8973. i.wrapS = t, i.wrapT = e, this.update(i)
  8974. }
  8975. },
  8976. setFilters: function(t, e) {
  8977. if (this._minFilter !== t || this._magFilter !== e) {
  8978. var i = d();
  8979. i.minFilter = t, i.magFilter = e, this.update(i)
  8980. }
  8981. },
  8982. setFlipY: function(t) {
  8983. if (this._flipY !== t) {
  8984. var e = d();
  8985. e.flipY = t, this.update(e)
  8986. }
  8987. },
  8988. setPremultiplyAlpha: function(t) {
  8989. if (this._premultiplyAlpha !== t) {
  8990. var e = d();
  8991. e.premultiplyAlpha = t, this.update(e)
  8992. }
  8993. },
  8994. _checkPackable: function() {
  8995. var t = cc.dynamicAtlasManager;
  8996. if (t)
  8997. if (this._isCompressed()) this._packable = !1;
  8998. else {
  8999. var e = this.width,
  9000. i = this.height;
  9001. !this._image || e > t.maxFrameSize || i > t.maxFrameSize || e <= t.minFrameSize || i <= t.minFrameSize || this._getHash() !== t.Atlas.DEFAULT_HASH ? this._packable = !1 : this._image && this._image instanceof HTMLCanvasElement && (this._packable = !0)
  9002. }
  9003. },
  9004. _getOpts: function() {
  9005. var t = d();
  9006. return t.width = this.width, t.height = this.height, t.genMipmaps = this._genMipmaps, t.format = this._format, t.premultiplyAlpha = this._premultiplyAlpha, t.anisotropy = this._anisotropy, t.flipY = this._flipY, t.minFilter = u[this._minFilter], t.magFilter = u[this._magFilter], t.mipFilter = u[this._mipFilter], t.wrapS = this._wrapS, t.wrapT = this._wrapT, t
  9007. },
  9008. _getGFXPixelFormat: function(t) {
  9009. return t === l.RGBA_ETC1 ? t = l.RGB_ETC1 : t === l.RGB_A_PVRTC_4BPPV1 ? t = l.RGB_PVRTC_4BPPV1 : t === l.RGB_A_PVRTC_2BPPV1 && (t = l.RGB_PVRTC_2BPPV1), t
  9010. },
  9011. _resetUnderlyingMipmaps: function(t) {
  9012. var e = this._getOpts();
  9013. e.images = t || [null], this._texture ? this._texture.update(e) : this._texture = new s.Texture2D(s.device, e)
  9014. },
  9015. _serialize: !1,
  9016. _deserialize: function(t, e) {
  9017. var i = cc.renderer.device,
  9018. n = t.split(","),
  9019. r = n[0];
  9020. if (r) {
  9021. for (var s = r.split("_"), o = "", a = "", h = 999, c = this._format, u = cc.macro.SUPPORT_TEXTURE_FORMATS, _ = 0; _ < s.length; _++) {
  9022. var f = s[_].split("@"),
  9023. d = f[0];
  9024. d = p.extnames[d.charCodeAt(0) - 48] || d;
  9025. var m = u.indexOf(d);
  9026. if (-1 !== m && m < h) {
  9027. var y = f[1] ? parseInt(f[1]) : this._format;
  9028. if (".pvr" === d && !i.ext("WEBGL_compressed_texture_pvrtc")) continue;
  9029. if (!(y !== l.RGB_ETC1 && y !== l.RGBA_ETC1 || i.ext("WEBGL_compressed_texture_etc1"))) continue;
  9030. if (!(y !== l.RGB_ETC2 && y !== l.RGBA_ETC2 || i.ext("WEBGL_compressed_texture_etc"))) continue;
  9031. if (".webp" === d && !cc.sys.capabilities.webp) continue;
  9032. h = m, a = d, c = y
  9033. } else o || (o = d)
  9034. }
  9035. a ? (this._setRawAsset(a), this._format = c) : (this._setRawAsset(o), cc.warnID(3120, e.customEnv.url, o, o))
  9036. }
  9037. 8 === n.length && (this._minFilter = parseInt(n[1]), this._magFilter = parseInt(n[2]), this._wrapS = parseInt(n[3]), this._wrapT = parseInt(n[4]), this._premultiplyAlpha = 49 === n[5].charCodeAt(0), this._genMipmaps = 49 === n[6].charCodeAt(0), this._packable = 49 === n[7].charCodeAt(0))
  9038. },
  9039. _getHash: function() {
  9040. if (!this._hashDirty) return this._hash;
  9041. var t = this._genMipmaps ? 1 : 0,
  9042. e = this._premultiplyAlpha ? 1 : 0,
  9043. i = this._flipY ? 1 : 0,
  9044. n = this._minFilter === c.LINEAR ? 1 : 2,
  9045. r = this._magFilter === c.LINEAR ? 1 : 2,
  9046. s = this._wrapS === h.REPEAT ? 1 : this._wrapS === h.CLAMP_TO_EDGE ? 2 : 3,
  9047. o = this._wrapT === h.REPEAT ? 1 : this._wrapT === h.CLAMP_TO_EDGE ? 2 : 3,
  9048. a = this._format;
  9049. this._image;
  9050. return this._hash = Number("" + n + r + a + s + o + t + e + i), this._hashDirty = !1, this._hash
  9051. },
  9052. _isCompressed: function() {
  9053. return this._texture && this._texture._compressed
  9054. },
  9055. _clearImage: function() {
  9056. cc.loader.removeItem(this._image.id || this._image.src), this._image.src = ""
  9057. }
  9058. });
  9059. cc.Texture2D = e.exports = p
  9060. }), {
  9061. "../../renderer/gfx": 360,
  9062. "../assets/CCAsset": 56,
  9063. "../event/event-target": 131,
  9064. "../platform/CCClass": 198,
  9065. "../platform/id-generater": 214,
  9066. "../renderer": 247
  9067. }],
  9068. 74: [(function(t, e, i) {
  9069. "use strict";
  9070. t("./CCRawAsset"), t("./CCAsset"), t("./CCFont"), t("./CCPrefab"), t("./CCAudioClip"), t("./CCScripts"), t("./CCSceneAsset"), t("./CCSpriteFrame"), t("./CCTexture2D"), t("./CCRenderTexture"), t("./CCTTFFont"), t("./CCSpriteAtlas"), t("./CCBitmapFont"), t("./CCLabelAtlas"), t("./CCTextAsset"), t("./CCJsonAsset"), t("./CCBufferAsset"), t("./CCEffectAsset"), t("./material/CCMaterial")
  9071. }), {
  9072. "./CCAsset": 56,
  9073. "./CCAudioClip": 57,
  9074. "./CCBitmapFont": 58,
  9075. "./CCBufferAsset": 59,
  9076. "./CCEffectAsset": 60,
  9077. "./CCFont": 61,
  9078. "./CCJsonAsset": 62,
  9079. "./CCLabelAtlas": 63,
  9080. "./CCPrefab": 64,
  9081. "./CCRawAsset": 65,
  9082. "./CCRenderTexture": 66,
  9083. "./CCSceneAsset": 67,
  9084. "./CCScripts": 68,
  9085. "./CCSpriteAtlas": 69,
  9086. "./CCSpriteFrame": 70,
  9087. "./CCTTFFont": 71,
  9088. "./CCTextAsset": 72,
  9089. "./CCTexture2D": 73,
  9090. "./material/CCMaterial": 75
  9091. }],
  9092. 75: [(function(t, e, i) {
  9093. "use strict";
  9094. var n = o(t("../../../renderer/murmurhash2_gc")),
  9095. r = o(t("./utils")),
  9096. s = o(t("./material-pool"));
  9097. function o(t) {
  9098. return t && t.__esModule ? t : {
  9099. default: t
  9100. }
  9101. }
  9102. var a = t("../CCAsset"),
  9103. l = t("../CCTexture2D"),
  9104. h = l.PixelFormat,
  9105. c = t("../CCEffectAsset"),
  9106. u = t("../../utils/texture-util"),
  9107. _ = cc.Class({
  9108. name: "cc.Material",
  9109. extends: a,
  9110. ctor: function() {
  9111. this._manualHash = !1, this._dirty = !0, this._effect = null, this._owner = null, this._hash = 0
  9112. },
  9113. properties: {
  9114. _effectAsset: {
  9115. type: c,
  9116. default: null
  9117. },
  9118. _defines: {
  9119. default: {},
  9120. type: Object
  9121. },
  9122. _props: {
  9123. default: {},
  9124. type: Object
  9125. },
  9126. effectName: void 0,
  9127. effectAsset: {
  9128. get: function() {
  9129. return this._effectAsset
  9130. },
  9131. set: function(t) {
  9132. cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS && (this._effectAsset = t, t ? this._effect = this._effectAsset.getInstantiatedEffect() : cc.error("Can not set an empty effect asset."))
  9133. }
  9134. },
  9135. effect: {
  9136. get: function() {
  9137. return this._effect
  9138. }
  9139. },
  9140. owner: {
  9141. get: function() {
  9142. return this._owner
  9143. }
  9144. }
  9145. },
  9146. statics: {
  9147. getBuiltinMaterial: function(t) {
  9148. return cc.AssetLibrary.getBuiltin("material", "builtin-" + t)
  9149. },
  9150. getInstantiatedBuiltinMaterial: function(t, e) {
  9151. var i = this.getBuiltinMaterial(t);
  9152. return _.getInstantiatedMaterial(i, e)
  9153. },
  9154. getInstantiatedMaterial: function(t, e) {
  9155. return t._owner === e ? t : s.default.get(t, e)
  9156. }
  9157. },
  9158. copy: function(t) {
  9159. for (var e in this.effectAsset = t.effectAsset, t._defines) this.define(e, t._defines[e]);
  9160. for (var i in t._props) this.setProperty(i, t._props[i])
  9161. },
  9162. setProperty: function(t, e, i) {
  9163. if ((this._props[t] !== e || i) && (this._props[t] = e, this._dirty = !0, this._effect))
  9164. if (e instanceof l) {
  9165. var n = function() {
  9166. this._effect.setProperty(t, e);
  9167. var i = e.getPixelFormat();
  9168. i !== h.RGBA_ETC1 && i !== h.RGB_A_PVRTC_4BPPV1 && i !== h.RGB_A_PVRTC_2BPPV1 || this.define("CC_USE_ALPHA_ATLAS_" + t.toUpperCase(), !0)
  9169. };
  9170. e.loaded ? n.call(this) : (e.once("load", n, this), u.postLoadTexture(e))
  9171. } else this._effect.setProperty(t, e)
  9172. },
  9173. getProperty: function(t) {
  9174. return this._props[t]
  9175. },
  9176. define: function(t, e, i) {
  9177. (this._defines[t] !== e || i) && (this._defines[t] = e, this._dirty = !0, this._effect && this._effect.define(t, e))
  9178. },
  9179. getDefine: function(t) {
  9180. return this._defines[t]
  9181. },
  9182. setDirty: function(t) {
  9183. this._dirty = t
  9184. },
  9185. updateHash: function(t) {
  9186. void 0 === t || null === t ? t = this.computeHash() : this._manualHash = !0, this._dirty = !1, this._hash = t, this._effect && this._effect.updateHash(this._hash)
  9187. },
  9188. computeHash: function() {
  9189. var t = this._effect,
  9190. e = "";
  9191. return t && (e += r.default.serializeDefines(t._defines), e += r.default.serializeTechniques(t._techniques), e += r.default.serializeUniforms(t._properties)), (0, n.default)(e, 666)
  9192. },
  9193. getHash: function() {
  9194. return this._dirty ? (this._manualHash || this.updateHash(), this._dirty = !1, this._hash) : this._hash
  9195. },
  9196. onLoad: function() {
  9197. if (this.effectAsset = this._effectAsset, this._effect) {
  9198. for (var t in this._defines) this.define(t, this._defines[t], !0);
  9199. for (var e in this._props) this.setProperty(e, this._props[e], !0)
  9200. }
  9201. }
  9202. });
  9203. e.exports = cc.Material = _
  9204. }), {
  9205. "../../../renderer/murmurhash2_gc": 378,
  9206. "../../utils/texture-util": 308,
  9207. "../CCAsset": 56,
  9208. "../CCEffectAsset": 60,
  9209. "../CCTexture2D": 73,
  9210. "./material-pool": 77,
  9211. "./utils": 78
  9212. }],
  9213. 76: [(function(t, e, i) {
  9214. "use strict";
  9215. i.__esModule = !0, i.default = void 0;
  9216. var n = s(t("../../../renderer/murmurhash2_gc")),
  9217. r = s(t("./utils"));
  9218. function s(t) {
  9219. return t && t.__esModule ? t : {
  9220. default: t
  9221. }
  9222. }
  9223. function o(t, e) {
  9224. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  9225. }
  9226. var a = (function() {
  9227. function t() {
  9228. o(this, t), this._properties = {}, this._defines = {}, this._dirty = !1
  9229. }
  9230. return t.prototype.setProperty = function(t, e, i, n) {
  9231. var r = this._properties[t];
  9232. if (r) {
  9233. if (r.value === e) return
  9234. } else(r = Object.create(null)).name = t, r.type = i, r.directly = n, this._properties[t] = r;
  9235. this._dirty = !0, r.directly = n, r.value = e
  9236. }, t.prototype.getProperty = function(t) {
  9237. var e = this._properties[t];
  9238. return e ? e.value : null
  9239. }, t.prototype.define = function(t, e) {
  9240. this._defines[t] !== e && (this._dirty = !0, this._defines[t] = e)
  9241. }, t.prototype.getDefine = function(t) {
  9242. return this._defines[t]
  9243. }, t.prototype.extractProperties = function() {
  9244. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  9245. return Object.assign(t, this._properties), t
  9246. }, t.prototype.extractDefines = function() {
  9247. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  9248. return Object.assign(t, this._defines), t
  9249. }, t.prototype.getHash = function() {
  9250. if (!this._dirty) return this._hash;
  9251. this._dirty = !1;
  9252. var t = "";
  9253. return t += r.default.serializeDefines(this._defines), t += r.default.serializeUniforms(this._properties), this._hash = (0, n.default)(t, 666)
  9254. }, t
  9255. })();
  9256. i.default = a, cc.CustomProperties = a, e.exports = i.default
  9257. }), {
  9258. "../../../renderer/murmurhash2_gc": 378,
  9259. "./utils": 78
  9260. }],
  9261. 77: [(function(t, e, i) {
  9262. "use strict";
  9263. i.__esModule = !0;
  9264. var n = s(t("./utils")),
  9265. r = s(t("../../utils/pool"));
  9266. function s(t) {
  9267. return t && t.__esModule ? t : {
  9268. default: t
  9269. }
  9270. }
  9271. function o(t, e) {
  9272. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  9273. }
  9274. function a(t, e) {
  9275. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  9276. return !e || "object" != typeof e && "function" != typeof e ? t : e
  9277. }
  9278. function l(t, e) {
  9279. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  9280. t.prototype = Object.create(e && e.prototype, {
  9281. constructor: {
  9282. value: t,
  9283. enumerable: !1,
  9284. writable: !0,
  9285. configurable: !0
  9286. }
  9287. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  9288. }
  9289. var h = new(function(t) {
  9290. function e() {
  9291. var i, n;
  9292. o(this, e);
  9293. for (var r = arguments.length, s = Array(r), l = 0; l < r; l++) s[l] = arguments[l];
  9294. return i = n = a(this, t.call.apply(t, [this].concat(s))), n.enabled = !1, n._pool = {}, a(n, i)
  9295. }
  9296. return l(e, t), e.prototype.get = function(t, e) {
  9297. var i = this._pool,
  9298. r = void 0;
  9299. if (this.enabled) {
  9300. var s = t.effectAsset._uuid;
  9301. if (i[s]) {
  9302. var o = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques);
  9303. r = i[s][o] && i[s][o].pop()
  9304. }
  9305. }
  9306. return r ? this.count-- : ((r = new cc.Material).copy(t), r._name = t._name + " (Instance)", r._uuid = t._uuid), r._owner = e, r
  9307. }, e.prototype.put = function(t) {
  9308. if (this.enabled && t._owner) {
  9309. var e = this._pool,
  9310. i = t.effectAsset._uuid;
  9311. e[i] || (e[i] = {});
  9312. var r = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques);
  9313. e[i][r] || (e[i][r] = []), this.count > this.maxSize || (this._clean(t), e[i][r].push(t), this.count++)
  9314. }
  9315. }, e.prototype.clear = function() {
  9316. this._pool = {}, this.count = 0
  9317. }, e.prototype._clean = function(t) {
  9318. t._owner = null
  9319. }, e
  9320. }(r.default));
  9321. r.default.register("material", h), i.default = h, e.exports = i.default
  9322. }), {
  9323. "../../utils/pool": 302,
  9324. "./utils": 78
  9325. }],
  9326. 78: [(function(t, e, i) {
  9327. "use strict";
  9328. i.__esModule = !0;
  9329. var n = (function(t) {
  9330. return t && t.__esModule ? t : {
  9331. default: t
  9332. }
  9333. })(t("../../../renderer/enums"));
  9334. function r(t) {
  9335. var e = t._programName + t._cullMode;
  9336. return t._blend && (e += t._blendEq + t._blendAlphaEq + t._blendSrc + t._blendDst + t._blendSrcAlpha + t._blendDstAlpha + t._blendColor), t._depthTest && (e += t._depthWrite + t._depthFunc), t._stencilTest && (e += t._stencilFuncFront + t._stencilRefFront + t._stencilMaskFront + t._stencilFailOpFront + t._stencilZFailOpFront + t._stencilZPassOpFront + t._stencilWriteMaskFront + t._stencilFuncBack + t._stencilRefBack + t._stencilMaskBack + t._stencilFailOpBack + t._stencilZFailOpBack + t._stencilZPassOpBack + t._stencilWriteMaskBack), e
  9337. }
  9338. i.default = {
  9339. serializeDefines: function(t) {
  9340. var e = "";
  9341. for (var i in t) e += i + t[i];
  9342. return e
  9343. },
  9344. serializeTechniques: function(t) {
  9345. for (var e = "", i = 0; i < t.length; i++) {
  9346. var n = t[i];
  9347. e += n.stageIDs;
  9348. for (var s = 0; s < n.passes.length; s++) e += r(n.passes[s])
  9349. }
  9350. return e
  9351. },
  9352. serializeUniforms: function(t) {
  9353. var e = "";
  9354. for (var i in t) {
  9355. var r = t[i],
  9356. s = r.value;
  9357. s && (r.type === n.default.PARAM_TEXTURE_2D || r.type === n.default.PARAM_TEXTURE_CUBE ? e += s._id + ";" : e += s.toString() + ";")
  9358. }
  9359. return e
  9360. }
  9361. }, e.exports = i.default
  9362. }), {
  9363. "../../../renderer/enums": 355
  9364. }],
  9365. 79: [(function(t, e, i) {
  9366. "use strict";
  9367. t("../CCNode").EventType;
  9368. var n = 56,
  9369. r = 7,
  9370. s = cc.Enum({
  9371. ONCE: 0,
  9372. ON_WINDOW_RESIZE: 1,
  9373. ALWAYS: 2
  9374. });
  9375. function o(t) {
  9376. return t instanceof cc.Scene ? cc.visibleRect : t._contentSize
  9377. }
  9378. function a(t, e, i, n) {
  9379. for (var r = t._parent.scaleX, s = t._parent.scaleY, o = 0, a = 0, l = t._parent;;) {
  9380. if (o += l.x, a += l.y, !(l = l._parent)) return i.x = i.y = 0, void(n.x = n.y = 1);
  9381. if (l === e) break;
  9382. var h = l.scaleX,
  9383. c = l.scaleY;
  9384. o *= h, a *= c, r *= h, s *= c
  9385. }
  9386. n.x = 0 !== r ? 1 / r : 1, n.y = 0 !== s ? 1 / s : 1, i.x = -o, i.y = -a
  9387. }
  9388. var l = cc.Vec2.ZERO,
  9389. h = cc.Vec2.ONE;
  9390. function c(t, e) {
  9391. var i, s, c, u = e._target;
  9392. u ? a(t, i = u, s = l, c = h) : i = t._parent;
  9393. var _ = o(i),
  9394. f = i._anchorPoint,
  9395. d = i instanceof cc.Scene,
  9396. p = t.x,
  9397. m = t.y,
  9398. y = t._anchorPoint;
  9399. if (e._alignFlags & n) {
  9400. var v, g, x = _.width;
  9401. d ? (v = cc.visibleRect.left.x, g = cc.visibleRect.right.x) : g = (v = -f.x * x) + x, v += e._isAbsLeft ? e._left : e._left * x, g -= e._isAbsRight ? e._right : e._right * x, u && (v += s.x, v *= c.x, g += s.x, g *= c.x);
  9402. var b, A = y.x,
  9403. C = t.scaleX;
  9404. if (C < 0 && (A = 1 - A, C = -C), e.isStretchWidth) b = g - v, 0 !== C && (t.width = b / C), p = v + A * b;
  9405. else if (b = t.width * C, e.isAlignHorizontalCenter) {
  9406. var T = e._isAbsHorizontalCenter ? e._horizontalCenter : e._horizontalCenter * x,
  9407. S = (.5 - f.x) * _.width;
  9408. u && (T *= c.x, S += s.x, S *= c.x), p = S + (A - .5) * b + T
  9409. } else p = e.isAlignLeft ? v + A * b : g + (A - 1) * b
  9410. }
  9411. if (e._alignFlags & r) {
  9412. var w, E, M = _.height;
  9413. d ? (E = cc.visibleRect.bottom.y, w = cc.visibleRect.top.y) : w = (E = -f.y * M) + M, E += e._isAbsBottom ? e._bottom : e._bottom * M, w -= e._isAbsTop ? e._top : e._top * M, u && (E += s.y, E *= c.y, w += s.y, w *= c.y);
  9414. var D, B = y.y,
  9415. I = t.scaleY;
  9416. if (I < 0 && (B = 1 - B, I = -I), e.isStretchHeight) D = w - E, 0 !== I && (t.height = D / I), m = E + B * D;
  9417. else if (D = t.height * I, e.isAlignVerticalCenter) {
  9418. var P = e._isAbsVerticalCenter ? e._verticalCenter : e._verticalCenter * M,
  9419. R = (.5 - f.y) * _.height;
  9420. u && (P *= c.y, R += s.y, R *= c.y), m = R + (B - .5) * D + P
  9421. } else m = e.isAlignBottom ? E + B * D : w + (B - 1) * D
  9422. }
  9423. t.setPosition(p, m)
  9424. }
  9425. function u(t) {
  9426. var e = t._widget;
  9427. e && (c(t, e), e.alignMode !== s.ALWAYS ? e.enabled = !1 : f.push(e));
  9428. for (var i = t._children, n = 0; n < i.length; n++) {
  9429. var r = i[n];
  9430. r._active && u(r)
  9431. }
  9432. }
  9433. function _() {
  9434. var t = cc.director.getScene();
  9435. if (t) {
  9436. if (d.isAligning = !0, d._nodesOrderDirty) f.length = 0, u(t), d._nodesOrderDirty = !1;
  9437. else {
  9438. var e, i = d._activeWidgetsIterator;
  9439. for (i.i = 0; i.i < f.length; ++i.i) c((e = f[i.i]).node, e)
  9440. }
  9441. d.isAligning = !1
  9442. }
  9443. }
  9444. var f = [];
  9445. var d = cc._widgetManager = e.exports = {
  9446. _AlignFlags: {
  9447. TOP: 1,
  9448. MID: 2,
  9449. BOT: 4,
  9450. LEFT: 8,
  9451. CENTER: 16,
  9452. RIGHT: 32
  9453. },
  9454. isAligning: !1,
  9455. _nodesOrderDirty: !1,
  9456. _activeWidgetsIterator: new cc.js.array.MutableForwardIterator(f),
  9457. init: function(t) {
  9458. t.on(cc.Director.EVENT_AFTER_UPDATE, _), cc.sys.isMobile ? window.addEventListener("resize", this.onResized.bind(this)) : cc.view.on("canvas-resize", this.onResized, this)
  9459. },
  9460. add: function(t) {
  9461. t.node._widget = t, this._nodesOrderDirty = !0
  9462. },
  9463. remove: function(t) {
  9464. t.node._widget = null, this._activeWidgetsIterator.remove(t)
  9465. },
  9466. onResized: function() {
  9467. var t = cc.director.getScene();
  9468. t && this.refreshWidgetOnResized(t)
  9469. },
  9470. refreshWidgetOnResized: function(t) {
  9471. var e = cc.Node.isNode(t) && t.getComponent(cc.Widget);
  9472. e && e.alignMode === s.ON_WINDOW_RESIZE && (e.enabled = !0);
  9473. for (var i = t._children, n = 0; n < i.length; n++) {
  9474. var r = i[n];
  9475. this.refreshWidgetOnResized(r)
  9476. }
  9477. },
  9478. updateAlignment: function t(e) {
  9479. var i = e._parent;
  9480. cc.Node.isNode(i) && t(i);
  9481. var n = e._widget || e.getComponent(cc.Widget);
  9482. n && i && c(e, n)
  9483. },
  9484. AlignMode: s
  9485. }
  9486. }), {
  9487. "../CCNode": 52
  9488. }],
  9489. 80: [(function(t, e, i) {
  9490. "use strict";
  9491. var n = (function(t) {
  9492. return t && t.__esModule ? t : {
  9493. default: t
  9494. }
  9495. })(t("../geom-utils"));
  9496. var r = t("../utils/affine-transform"),
  9497. s = t("../renderer/index"),
  9498. o = t("../renderer/render-flow"),
  9499. a = t("../CCGame"),
  9500. l = null;
  9501. l = t("../../renderer/scene/camera");
  9502. var h = cc.vmath.mat4,
  9503. c = cc.vmath.vec2,
  9504. u = cc.vmath.vec3,
  9505. _ = h.create(),
  9506. f = h.create(),
  9507. d = cc.v3(),
  9508. p = cc.v3(),
  9509. m = cc.v3(),
  9510. y = [],
  9511. v = null;
  9512. function g() {
  9513. if (v) {
  9514. var t = v.getNode(),
  9515. e = cc.game.canvas;
  9516. t.z = e.height / 1.1566, t.x = e.width / 2, t.y = e.height / 2
  9517. }
  9518. }
  9519. var x = cc.Enum({
  9520. COLOR: 1,
  9521. DEPTH: 2,
  9522. STENCIL: 4
  9523. }),
  9524. b = cc.Enum({
  9525. OPAQUE: 1,
  9526. TRANSPARENT: 2
  9527. }),
  9528. A = cc.Class({
  9529. name: "cc.Camera",
  9530. extends: cc.Component,
  9531. ctor: function() {
  9532. if (a.renderType !== a.RENDER_TYPE_CANVAS) {
  9533. var t = new l;
  9534. t.setStages(["opaque"]), t.dirty = !0, this._inited = !1, this._camera = t
  9535. } else this._inited = !0
  9536. },
  9537. editor: !1,
  9538. properties: {
  9539. _cullingMask: 4294967295,
  9540. _clearFlags: x.DEPTH | x.STENCIL,
  9541. _backgroundColor: cc.color(0, 0, 0, 255),
  9542. _depth: 0,
  9543. _zoomRatio: 1,
  9544. _targetTexture: null,
  9545. _fov: 60,
  9546. _orthoSize: 10,
  9547. _nearClip: 1,
  9548. _farClip: 4096,
  9549. _ortho: !0,
  9550. _rect: cc.rect(0, 0, 1, 1),
  9551. _renderStages: 1,
  9552. _alignWithScreen: !0,
  9553. zoomRatio: {
  9554. get: function() {
  9555. return this._zoomRatio
  9556. },
  9557. set: function(t) {
  9558. this._zoomRatio = t
  9559. },
  9560. tooltip: !1
  9561. },
  9562. fov: {
  9563. get: function() {
  9564. return this._fov
  9565. },
  9566. set: function(t) {
  9567. this._fov = t
  9568. },
  9569. tooltip: !1
  9570. },
  9571. orthoSize: {
  9572. get: function() {
  9573. return this._orthoSize
  9574. },
  9575. set: function(t) {
  9576. this._orthoSize = t
  9577. },
  9578. tooltip: !1
  9579. },
  9580. nearClip: {
  9581. get: function() {
  9582. return this._nearClip
  9583. },
  9584. set: function(t) {
  9585. this._nearClip = t, this._updateClippingpPlanes()
  9586. },
  9587. tooltip: !1
  9588. },
  9589. farClip: {
  9590. get: function() {
  9591. return this._farClip
  9592. },
  9593. set: function(t) {
  9594. this._farClip = t, this._updateClippingpPlanes()
  9595. },
  9596. tooltip: !1
  9597. },
  9598. ortho: {
  9599. get: function() {
  9600. return this._ortho
  9601. },
  9602. set: function(t) {
  9603. this._ortho = t, this._updateProjection()
  9604. },
  9605. tooltip: !1
  9606. },
  9607. rect: {
  9608. get: function() {
  9609. return this._rect
  9610. },
  9611. set: function(t) {
  9612. this._rect = t, this._updateRect()
  9613. },
  9614. tooltip: !1
  9615. },
  9616. cullingMask: {
  9617. get: function() {
  9618. return this._cullingMask
  9619. },
  9620. set: function(t) {
  9621. this._cullingMask = t, this._updateCameraMask()
  9622. },
  9623. tooltip: !1
  9624. },
  9625. clearFlags: {
  9626. get: function() {
  9627. return this._clearFlags
  9628. },
  9629. set: function(t) {
  9630. this._clearFlags = t, this._camera && this._camera.setClearFlags(t)
  9631. },
  9632. tooltip: !1
  9633. },
  9634. backgroundColor: {
  9635. get: function() {
  9636. return this._backgroundColor
  9637. },
  9638. set: function(t) {
  9639. this._backgroundColor = t, this._updateBackgroundColor()
  9640. },
  9641. tooltip: !1
  9642. },
  9643. depth: {
  9644. get: function() {
  9645. return this._depth
  9646. },
  9647. set: function(t) {
  9648. this._depth = t, this._camera && this._camera.setPriority(t)
  9649. },
  9650. tooltip: !1
  9651. },
  9652. targetTexture: {
  9653. get: function() {
  9654. return this._targetTexture
  9655. },
  9656. set: function(t) {
  9657. this._targetTexture = t, this._updateTargetTexture()
  9658. },
  9659. tooltip: !1
  9660. },
  9661. renderStages: {
  9662. get: function() {
  9663. return this._renderStages
  9664. },
  9665. set: function(t) {
  9666. this._renderStages = t, this._updateStages()
  9667. },
  9668. tooltip: !1
  9669. },
  9670. alignWithScreen: {
  9671. get: function() {
  9672. return this._alignWithScreen
  9673. },
  9674. set: function(t) {
  9675. this._alignWithScreen = t
  9676. }
  9677. },
  9678. _is3D: {
  9679. get: function() {
  9680. return this.node && this.node._is3DNode
  9681. }
  9682. }
  9683. },
  9684. statics: {
  9685. main: null,
  9686. cameras: y,
  9687. ClearFlags: x,
  9688. findCamera: function(t) {
  9689. for (var e = 0, i = y.length; e < i; e++) {
  9690. var n = y[e];
  9691. if (n.containsNode(t)) return n
  9692. }
  9693. return null
  9694. },
  9695. _findRendererCamera: function(t) {
  9696. for (var e = s.scene._cameras, i = 0; i < e._count; i++)
  9697. if (e._data[i]._cullingMask & t._cullingMask) return e._data[i];
  9698. return null
  9699. },
  9700. _setupDebugCamera: function() {
  9701. if (!v && a.renderType !== a.RENDER_TYPE_CANVAS) {
  9702. var t = new l;
  9703. v = t, t.setStages(["opaque"]), t.setFov(60 * Math.PI / 180), t.setNear(.1), t.setFar(4096), t.dirty = !0, t.cullingMask = 1 << cc.Node.BuiltinGroupIndex.DEBUG, t.setPriority(cc.macro.MAX_ZINDEX), t.setClearFlags(0), t.setColor(0, 0, 0, 0);
  9704. var e = new cc.Node;
  9705. t.setNode(e), g(), cc.view.on("design-resolution-changed", g), s.scene.addCamera(t)
  9706. }
  9707. }
  9708. },
  9709. _updateCameraMask: function() {
  9710. if (this._camera) {
  9711. var t = this._cullingMask & ~(1 << cc.Node.BuiltinGroupIndex.DEBUG);
  9712. this._camera.cullingMask = t
  9713. }
  9714. },
  9715. _updateBackgroundColor: function() {
  9716. if (this._camera) {
  9717. var t = this._backgroundColor;
  9718. this._camera.setColor(t.r / 255, t.g / 255, t.b / 255, t.a / 255)
  9719. }
  9720. },
  9721. _updateTargetTexture: function() {
  9722. if (this._camera) {
  9723. var t = this._targetTexture;
  9724. this._camera.setFrameBuffer(t ? t._framebuffer : null)
  9725. }
  9726. },
  9727. _updateClippingpPlanes: function() {
  9728. this._camera && (this._camera.setNear(this._nearClip), this._camera.setFar(this._farClip))
  9729. },
  9730. _updateProjection: function() {
  9731. if (this._camera) {
  9732. var t = this._ortho ? 1 : 0;
  9733. this._camera.setType(t)
  9734. }
  9735. },
  9736. _updateRect: function() {
  9737. if (this._camera) {
  9738. var t = this._rect;
  9739. this._camera.setRect(t.x, t.y, t.width, t.height)
  9740. }
  9741. },
  9742. _updateStages: function() {
  9743. var t = this._renderStages,
  9744. e = [];
  9745. t & b.OPAQUE && e.push("opaque"), t & b.TRANSPARENT && e.push("transparent"), this._camera.setStages(e)
  9746. },
  9747. _init: function() {
  9748. if (!this._inited) {
  9749. this._inited = !0;
  9750. var t = this._camera;
  9751. t && (t.setNode(this.node), t.setClearFlags(this._clearFlags), t.setPriority(this._depth), this._updateBackgroundColor(), this._updateCameraMask(), this._updateTargetTexture(), this._updateClippingpPlanes(), this._updateProjection(), this._updateStages(), this._updateRect(), this.beforeDraw())
  9752. }
  9753. },
  9754. onLoad: function() {
  9755. this._init()
  9756. },
  9757. onEnable: function() {
  9758. a.renderType !== a.RENDER_TYPE_CANVAS && (cc.director.on(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this), s.scene.addCamera(this._camera)), y.push(this)
  9759. },
  9760. onDisable: function() {
  9761. a.renderType !== a.RENDER_TYPE_CANVAS && (cc.director.off(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this), s.scene.removeCamera(this._camera)), cc.js.array.remove(y, this)
  9762. },
  9763. getScreenToWorldMatrix2D: function(t) {
  9764. return this.getWorldToScreenMatrix2D(t), h.invert(t, t), t
  9765. },
  9766. getWorldToScreenMatrix2D: function(t) {
  9767. this.node.getWorldRT(_);
  9768. var e = this.zoomRatio,
  9769. i = _.m;
  9770. i[0] *= e, i[1] *= e, i[4] *= e, i[5] *= e;
  9771. var n = i[12],
  9772. r = i[13],
  9773. s = cc.visibleRect.center;
  9774. return i[12] = s.x - (i[0] * n + i[4] * r), i[13] = s.y - (i[1] * n + i[5] * r), t !== _ && h.copy(t, _), t
  9775. },
  9776. getScreenToWorldPoint: function(t, e) {
  9777. return this.node.is3DNode ? (e = e || new cc.Vec3, this._camera.screenToWorld(e, t, cc.visibleRect.width, cc.visibleRect.height)) : (e = e || new cc.Vec2, this.getScreenToWorldMatrix2D(_), c.transformMat4(e, t, _)), e
  9778. },
  9779. getWorldToScreenPoint: function(t, e) {
  9780. return this.node.is3DNode ? (e = e || new cc.Vec3, this._camera.worldToScreen(e, t, cc.visibleRect.width, cc.visibleRect.height)) : (e = e || new cc.Vec2, this.getWorldToScreenMatrix2D(_), c.transformMat4(e, t, _)), e
  9781. },
  9782. getRay: function(t) {
  9783. return n.default ? (u.set(m, t.x, t.y, 1), this._camera.screenToWorld(p, m, cc.visibleRect.width, cc.visibleRect.height), this.ortho ? (u.set(m, t.x, t.y, -1), this._camera.screenToWorld(d, m, cc.visibleRect.width, cc.visibleRect.height)) : this.node.getWorldPosition(d), n.default.Ray.fromPoints(n.default.Ray.create(), d, p)) : t
  9784. },
  9785. containsNode: function(t) {
  9786. return t._cullingMask & this.cullingMask
  9787. },
  9788. render: function(t) {
  9789. if (!(t = t || cc.director.getScene())) return null;
  9790. this.node.getWorldMatrix(_), this.beforeDraw(), o.render(t), s._forward.renderCamera(this._camera, s.scene)
  9791. },
  9792. _onAlignWithScreen: function() {
  9793. var t = cc.game.canvas.height / cc.view._scaleY;
  9794. this._targetTexture && (t = cc.visibleRect.height);
  9795. var e = this._fov * cc.macro.RAD;
  9796. this.node.z = t / (2 * Math.tan(e / 2)), e = 2 * Math.atan(Math.tan(e / 2) / this.zoomRatio), this._camera.setFov(e), this._camera.setOrthoHeight(t / 2 / this.zoomRatio), this.node.setRotation(0, 0, 0, 1)
  9797. },
  9798. beforeDraw: function() {
  9799. if (this._camera) {
  9800. if (this._alignWithScreen) this._onAlignWithScreen();
  9801. else {
  9802. var t = this._fov * cc.macro.RAD;
  9803. t = 2 * Math.atan(Math.tan(t / 2) / this.zoomRatio), this._camera.setFov(t), this._camera.setOrthoHeight(this._orthoSize * this.zoomRatio)
  9804. }
  9805. this._camera.dirty = !0
  9806. }
  9807. }
  9808. });
  9809. cc.js.mixin(A.prototype, {
  9810. getNodeToCameraTransform: function(t) {
  9811. var e = r.identity();
  9812. return t.getWorldMatrix(f), this.containsNode(t) && (this.getWorldToCameraMatrix(_), h.mul(f, f, _)), r.fromMat4(e, f), e
  9813. },
  9814. getCameraToWorldPoint: function(t, e) {
  9815. return this.getScreenToWorldPoint(t, e)
  9816. },
  9817. getWorldToCameraPoint: function(t, e) {
  9818. return this.getWorldToScreenPoint(t, e)
  9819. },
  9820. getCameraToWorldMatrix: function(t) {
  9821. return this.getScreenToWorldMatrix2D(t)
  9822. },
  9823. getWorldToCameraMatrix: function(t) {
  9824. return this.getWorldToScreenMatrix2D(t)
  9825. }
  9826. }), e.exports = cc.Camera = A
  9827. }), {
  9828. "../../renderer/scene/camera": 380,
  9829. "../CCGame": 51,
  9830. "../geom-utils": 136,
  9831. "../renderer/index": 247,
  9832. "../renderer/render-flow": 248,
  9833. "../utils/affine-transform": 290
  9834. }],
  9835. 81: [(function(t, e, i) {
  9836. "use strict";
  9837. cc.Collider.Box = cc.Class({
  9838. properties: {
  9839. _offset: cc.v2(0, 0),
  9840. _size: cc.size(100, 100),
  9841. offset: {
  9842. tooltip: !1,
  9843. get: function() {
  9844. return this._offset
  9845. },
  9846. set: function(t) {
  9847. this._offset = t
  9848. },
  9849. type: cc.Vec2
  9850. },
  9851. size: {
  9852. tooltip: !1,
  9853. get: function() {
  9854. return this._size
  9855. },
  9856. set: function(t) {
  9857. this._size.width = t.width < 0 ? 0 : t.width, this._size.height = t.height < 0 ? 0 : t.height
  9858. },
  9859. type: cc.Size
  9860. }
  9861. },
  9862. resetInEditor: !1
  9863. });
  9864. var n = cc.Class({
  9865. name: "cc.BoxCollider",
  9866. extends: cc.Collider,
  9867. mixins: [cc.Collider.Box],
  9868. editor: !1
  9869. });
  9870. cc.BoxCollider = e.exports = n
  9871. }), {}],
  9872. 82: [(function(t, e, i) {
  9873. "use strict";
  9874. cc.Collider.Circle = cc.Class({
  9875. properties: {
  9876. _offset: cc.v2(0, 0),
  9877. _radius: 50,
  9878. offset: {
  9879. get: function() {
  9880. return this._offset
  9881. },
  9882. set: function(t) {
  9883. this._offset = t
  9884. },
  9885. type: cc.Vec2
  9886. },
  9887. radius: {
  9888. tooltip: !1,
  9889. get: function() {
  9890. return this._radius
  9891. },
  9892. set: function(t) {
  9893. this._radius = t < 0 ? 0 : t
  9894. }
  9895. }
  9896. },
  9897. resetInEditor: !1
  9898. });
  9899. var n = cc.Class({
  9900. name: "cc.CircleCollider",
  9901. extends: cc.Collider,
  9902. mixins: [cc.Collider.Circle],
  9903. editor: !1
  9904. });
  9905. cc.CircleCollider = e.exports = n
  9906. }), {}],
  9907. 83: [(function(t, e, i) {
  9908. "use strict";
  9909. var n = cc.Class({
  9910. name: "cc.Collider",
  9911. extends: cc.Component,
  9912. properties: {
  9913. editing: {
  9914. default: !1,
  9915. serializable: !1,
  9916. tooltip: !1
  9917. },
  9918. tag: {
  9919. tooltip: !1,
  9920. default: 0,
  9921. range: [0, 1e7],
  9922. type: cc.Integer
  9923. }
  9924. },
  9925. onDisable: function() {
  9926. cc.director.getCollisionManager().removeCollider(this)
  9927. },
  9928. onEnable: function() {
  9929. cc.director.getCollisionManager().addCollider(this)
  9930. }
  9931. });
  9932. cc.Collider = e.exports = n
  9933. }), {}],
  9934. 84: [(function(t, e, i) {
  9935. "use strict";
  9936. var n = t("./CCContact"),
  9937. r = n.CollisionType,
  9938. s = t("../CCNode").EventType,
  9939. o = cc.vmath,
  9940. a = cc.v2();
  9941. function l(t, e, i, n, r, s) {
  9942. var o = t.x,
  9943. a = t.y,
  9944. l = t.width,
  9945. h = t.height,
  9946. c = e.m,
  9947. u = c[0],
  9948. _ = c[1],
  9949. f = c[4],
  9950. d = c[5],
  9951. p = u * o + f * a + c[12],
  9952. m = _ * o + d * a + c[13],
  9953. y = u * l,
  9954. v = _ * l,
  9955. g = f * h,
  9956. x = d * h;
  9957. n.x = p, n.y = m, r.x = y + p, r.y = v + m, i.x = g + p, i.y = x + m, s.x = y + g + p, s.y = v + x + m
  9958. }
  9959. var h = cc.Class({
  9960. mixins: [cc.EventTarget],
  9961. properties: {
  9962. enabled: !1,
  9963. enabledDrawBoundingBox: !1
  9964. },
  9965. ctor: function() {
  9966. this._contacts = [], this._colliders = [], this._debugDrawer = null, this._enabledDebugDraw = !1, cc.director._scheduler && cc.director._scheduler.enableForTarget(this)
  9967. },
  9968. update: function(t) {
  9969. if (this.enabled) {
  9970. var e = void 0,
  9971. i = void 0,
  9972. n = this._colliders;
  9973. for (e = 0, i = n.length; e < i; e++) this.updateCollider(n[e]);
  9974. var s = this._contacts,
  9975. o = [];
  9976. for (e = 0, i = s.length; e < i; e++) {
  9977. var a = s[e].updateState();
  9978. a !== r.None && o.push([a, s[e]])
  9979. }
  9980. for (e = 0, i = o.length; e < i; e++) {
  9981. var l = o[e];
  9982. this._doCollide(l[0], l[1])
  9983. }
  9984. this.drawColliders()
  9985. }
  9986. },
  9987. _doCollide: function(t, e) {
  9988. var i = void 0;
  9989. switch (t) {
  9990. case r.CollisionEnter:
  9991. i = "onCollisionEnter";
  9992. break;
  9993. case r.CollisionStay:
  9994. i = "onCollisionStay";
  9995. break;
  9996. case r.CollisionExit:
  9997. i = "onCollisionExit"
  9998. }
  9999. var n = e.collider1,
  10000. s = e.collider2,
  10001. o = n.node._components,
  10002. a = s.node._components,
  10003. l = void 0,
  10004. h = void 0,
  10005. c = void 0;
  10006. for (l = 0, h = o.length; l < h; l++)(c = o[l])[i] && c[i](s, n);
  10007. for (l = 0, h = a.length; l < h; l++)(c = a[l])[i] && c[i](n, s)
  10008. },
  10009. shouldCollide: function(t, e) {
  10010. var i = t.node,
  10011. n = e.node,
  10012. r = cc.game.collisionMatrix;
  10013. return i !== n && r[i.groupIndex][n.groupIndex]
  10014. },
  10015. initCollider: function(t) {
  10016. if (!t.world) {
  10017. var e = t.world = {};
  10018. e.aabb = cc.rect(), e.preAabb = cc.rect(), e.matrix = o.mat4.create(), e.radius = 0, t instanceof cc.BoxCollider ? (e.position = null, e.points = [cc.v2(), cc.v2(), cc.v2(), cc.v2()]) : t instanceof cc.PolygonCollider ? (e.position = null, e.points = t.points.map((function(t) {
  10019. return cc.v2(t.x, t.y)
  10020. }))) : t instanceof cc.CircleCollider && (e.position = cc.v2(), e.points = null)
  10021. }
  10022. },
  10023. updateCollider: function(t) {
  10024. var e = t.offset,
  10025. i = t.world,
  10026. n = i.aabb,
  10027. r = i.matrix;
  10028. t.node.getWorldMatrix(r);
  10029. var s = i.preAabb;
  10030. if (s.x = n.x, s.y = n.y, s.width = n.width, s.height = n.height, t instanceof cc.BoxCollider) {
  10031. var h = t.size;
  10032. n.x = e.x - h.width / 2, n.y = e.y - h.height / 2, n.width = h.width, n.height = h.height;
  10033. var c = i.points,
  10034. u = c[0],
  10035. _ = c[1],
  10036. f = c[2],
  10037. d = c[3];
  10038. l(n, r, u, _, f, d);
  10039. var p = Math.min(u.x, _.x, f.x, d.x),
  10040. m = Math.min(u.y, _.y, f.y, d.y),
  10041. y = Math.max(u.x, _.x, f.x, d.x),
  10042. v = Math.max(u.y, _.y, f.y, d.y);
  10043. n.x = p, n.y = m, n.width = y - p, n.height = v - m
  10044. } else if (t instanceof cc.CircleCollider) {
  10045. o.vec2.transformMat4(a, t.offset, r), i.position.x = a.x, i.position.y = a.y;
  10046. var g = r.m,
  10047. x = g[12],
  10048. b = g[13];
  10049. g[12] = g[13] = 0, a.x = t.radius, a.y = 0, o.vec2.transformMat4(a, a, r);
  10050. var A = Math.sqrt(a.x * a.x + a.y * a.y);
  10051. i.radius = A, n.x = i.position.x - A, n.y = i.position.y - A, n.width = 2 * A, n.height = 2 * A, g[12] = x, g[13] = b
  10052. } else if (t instanceof cc.PolygonCollider) {
  10053. var C = t.points,
  10054. T = i.points;
  10055. T.length = C.length;
  10056. for (var S = 1e6, w = 1e6, E = -1e6, M = -1e6, D = 0, B = C.length; D < B; D++) {
  10057. T[D] || (T[D] = cc.v2()), a.x = C[D].x + e.x, a.y = C[D].y + e.y, o.vec2.transformMat4(a, a, r);
  10058. var I = a.x,
  10059. P = a.y;
  10060. T[D].x = I, T[D].y = P, I > E && (E = I), I < S && (S = I), P > M && (M = P), P < w && (w = P)
  10061. }
  10062. n.x = S, n.y = w, n.width = E - S, n.height = M - w
  10063. }
  10064. },
  10065. addCollider: function(t) {
  10066. var e = this._colliders;
  10067. if (-1 === e.indexOf(t)) {
  10068. for (var i = 0, r = e.length; i < r; i++) {
  10069. var o = e[i];
  10070. if (this.shouldCollide(t, o)) {
  10071. var a = new n(t, o);
  10072. this._contacts.push(a)
  10073. }
  10074. }
  10075. e.push(t), this.initCollider(t)
  10076. }
  10077. t.node.on(s.GROUP_CHANGED, this.onNodeGroupChanged, this)
  10078. },
  10079. removeCollider: function(t) {
  10080. var e = this._colliders,
  10081. i = e.indexOf(t);
  10082. if (i >= 0) {
  10083. e.splice(i, 1);
  10084. for (var n = this._contacts, o = n.length - 1; o >= 0; o--) {
  10085. var a = n[o];
  10086. a.collider1 !== t && a.collider2 !== t || (a.touching && this._doCollide(r.CollisionExit, a), n.splice(o, 1))
  10087. }
  10088. t.node.off(s.GROUP_CHANGED, this.onNodeGroupChanged, this)
  10089. } else cc.errorID(6600)
  10090. },
  10091. onNodeGroupChanged: function(t) {
  10092. for (var e = t.getComponents(cc.Collider), i = 0, n = e.length; i < n; i++) {
  10093. var r = e[i];
  10094. cc.PhysicsCollider && r instanceof cc.PhysicsCollider || (this.removeCollider(r), this.addCollider(r))
  10095. }
  10096. },
  10097. drawColliders: function() {
  10098. if (this._enabledDebugDraw) {
  10099. this._checkDebugDrawValid();
  10100. var t = this._debugDrawer;
  10101. t.clear();
  10102. for (var e = this._colliders, i = 0, n = e.length; i < n; i++) {
  10103. var r = e[i];
  10104. if (t.strokeColor = cc.Color.WHITE, r instanceof cc.BoxCollider || r instanceof cc.PolygonCollider) {
  10105. var s = r.world.points;
  10106. if (s.length > 0) {
  10107. t.moveTo(s[0].x, s[0].y);
  10108. for (var o = 1; o < s.length; o++) t.lineTo(s[o].x, s[o].y);
  10109. t.close(), t.stroke()
  10110. }
  10111. } else r instanceof cc.CircleCollider && (t.circle(r.world.position.x, r.world.position.y, r.world.radius), t.stroke());
  10112. if (this.enabledDrawBoundingBox) {
  10113. var a = r.world.aabb;
  10114. t.strokeColor = cc.Color.BLUE, t.moveTo(a.xMin, a.yMin), t.lineTo(a.xMin, a.yMax), t.lineTo(a.xMax, a.yMax), t.lineTo(a.xMax, a.yMin), t.close(), t.stroke()
  10115. }
  10116. }
  10117. }
  10118. },
  10119. _checkDebugDrawValid: function() {
  10120. if (!this._debugDrawer || !this._debugDrawer.isValid) {
  10121. var t = new cc.Node("COLLISION_MANAGER_DEBUG_DRAW");
  10122. t.zIndex = cc.macro.MAX_ZINDEX, cc.game.addPersistRootNode(t), this._debugDrawer = t.addComponent(cc.Graphics)
  10123. }
  10124. }
  10125. });
  10126. cc.js.getset(h.prototype, "enabledDebugDraw", (function() {
  10127. return this._enabledDebugDraw
  10128. }), (function(t) {
  10129. t && !this._enabledDebugDraw ? (this._checkDebugDrawValid(), this._debugDrawer.node.active = !0) : !t && this._enabledDebugDraw && (this._debugDrawer.clear(!0), this._debugDrawer.node.active = !1), this._enabledDebugDraw = t
  10130. })), cc.CollisionManager = e.exports = h
  10131. }), {
  10132. "../CCNode": 52,
  10133. "./CCContact": 85
  10134. }],
  10135. 85: [(function(t, e, i) {
  10136. "use strict";
  10137. var n = t("./CCIntersection"),
  10138. r = cc.Enum({
  10139. None: 0,
  10140. CollisionEnter: 1,
  10141. CollisionStay: 2,
  10142. CollisionExit: 3
  10143. });
  10144. function s(t, e) {
  10145. this.collider1 = t, this.collider2 = e, this.touching = !1;
  10146. var i = t instanceof cc.BoxCollider || t instanceof cc.PolygonCollider,
  10147. r = e instanceof cc.BoxCollider || e instanceof cc.PolygonCollider,
  10148. s = t instanceof cc.CircleCollider,
  10149. o = e instanceof cc.CircleCollider;
  10150. i && r ? this.testFunc = n.polygonPolygon : s && o ? this.testFunc = n.circleCircle : i && o ? this.testFunc = n.polygonCircle : s && r ? (this.testFunc = n.polygonCircle, this.collider1 = e, this.collider2 = t) : cc.errorID(6601, cc.js.getClassName(t), cc.js.getClassName(e))
  10151. }
  10152. s.prototype.test = function() {
  10153. var t = this.collider1.world,
  10154. e = this.collider2.world;
  10155. return !!t.aabb.intersects(e.aabb) && (this.testFunc === n.polygonPolygon ? this.testFunc(t.points, e.points) : this.testFunc === n.circleCircle ? this.testFunc(t, e) : this.testFunc === n.polygonCircle && this.testFunc(t.points, e))
  10156. }, s.prototype.updateState = function() {
  10157. var t = this.test(),
  10158. e = r.None;
  10159. return t && !this.touching ? (this.touching = !0, e = r.CollisionEnter) : t && this.touching ? e = r.CollisionStay : !t && this.touching && (this.touching = !1, e = r.CollisionExit), e
  10160. }, s.CollisionType = r, e.exports = s
  10161. }), {
  10162. "./CCIntersection": 86
  10163. }],
  10164. 86: [(function(t, e, i) {
  10165. "use strict";
  10166. var n = {};
  10167. function r(t, e, i, n) {
  10168. var r = (n.x - i.x) * (t.y - i.y) - (n.y - i.y) * (t.x - i.x),
  10169. s = (e.x - t.x) * (t.y - i.y) - (e.y - t.y) * (t.x - i.x),
  10170. o = (n.y - i.y) * (e.x - t.x) - (n.x - i.x) * (e.y - t.y);
  10171. if (0 !== o) {
  10172. var a = r / o,
  10173. l = s / o;
  10174. if (0 <= a && a <= 1 && 0 <= l && l <= 1) return !0
  10175. }
  10176. return !1
  10177. }
  10178. function s(t, e, i) {
  10179. for (var n = i.length, s = 0; s < n; ++s) {
  10180. if (r(t, e, i[s], i[(s + 1) % n])) return !0
  10181. }
  10182. return !1
  10183. }
  10184. function o(t, e) {
  10185. for (var i = !1, n = t.x, r = t.y, s = e.length, o = 0, a = s - 1; o < s; a = o++) {
  10186. var l = e[o].x,
  10187. h = e[o].y,
  10188. c = e[a].x,
  10189. u = e[a].y;
  10190. h > r != u > r && n < (c - l) * (r - h) / (u - h) + l && (i = !i)
  10191. }
  10192. return i
  10193. }
  10194. function a(t, e, i, n) {
  10195. var r, s = i.x - e.x,
  10196. o = i.y - e.y,
  10197. a = s * s + o * o,
  10198. l = ((t.x - e.x) * s + (t.y - e.y) * o) / a;
  10199. return r = n ? a ? l < 0 ? e : l > 1 ? i : cc.v2(e.x + l * s, e.y + l * o) : e : cc.v2(e.x + l * s, e.y + l * o), s = t.x - r.x, o = t.y - r.y, Math.sqrt(s * s + o * o)
  10200. }
  10201. n.lineLine = r, n.lineRect = function(t, e, i) {
  10202. var n = new cc.Vec2(i.x, i.y),
  10203. s = new cc.Vec2(i.x, i.yMax),
  10204. o = new cc.Vec2(i.xMax, i.yMax),
  10205. a = new cc.Vec2(i.xMax, i.y);
  10206. return !!(r(t, e, n, s) || r(t, e, s, o) || r(t, e, o, a) || r(t, e, a, n))
  10207. }, n.linePolygon = s, n.rectRect = function(t, e) {
  10208. var i = t.x,
  10209. n = t.y,
  10210. r = t.x + t.width,
  10211. s = t.y + t.height,
  10212. o = e.x,
  10213. a = e.y,
  10214. l = e.x + e.width,
  10215. h = e.y + e.height;
  10216. return i <= l && r >= o && n <= h && s >= a
  10217. }, n.rectPolygon = function(t, e) {
  10218. var i, n, r = new cc.Vec2(t.x, t.y),
  10219. a = new cc.Vec2(t.x, t.yMax),
  10220. l = new cc.Vec2(t.xMax, t.yMax),
  10221. h = new cc.Vec2(t.xMax, t.y);
  10222. if (s(r, a, e)) return !0;
  10223. if (s(a, l, e)) return !0;
  10224. if (s(l, h, e)) return !0;
  10225. if (s(h, r, e)) return !0;
  10226. for (i = 0, n = e.length; i < n; ++i)
  10227. if (o(e[i], t)) return !0;
  10228. return !!(o(r, e) || o(a, e) || o(l, e) || o(h, e))
  10229. }, n.polygonPolygon = function(t, e) {
  10230. var i, n;
  10231. for (i = 0, n = t.length; i < n; ++i)
  10232. if (s(t[i], t[(i + 1) % n], e)) return !0;
  10233. for (i = 0, n = e.length; i < n; ++i)
  10234. if (o(e[i], t)) return !0;
  10235. for (i = 0, n = t.length; i < n; ++i)
  10236. if (o(t[i], e)) return !0;
  10237. return !1
  10238. }, n.circleCircle = function(t, e) {
  10239. return t.position.sub(e.position).mag() < t.radius + e.radius
  10240. }, n.polygonCircle = function(t, e) {
  10241. var i = e.position;
  10242. if (o(i, t)) return !0;
  10243. for (var n = 0, r = t.length; n < r; n++)
  10244. if (a(i, 0 === n ? t[t.length - 1] : t[n - 1], t[n], !0) < e.radius) return !0;
  10245. return !1
  10246. }, n.pointInPolygon = o, n.pointLineDistance = a, cc.Intersection = e.exports = n
  10247. }), {}],
  10248. 87: [(function(t, e, i) {
  10249. "use strict";
  10250. cc.Collider.Polygon = cc.Class({
  10251. properties: {
  10252. threshold: {
  10253. default: 1,
  10254. serializable: !1,
  10255. visible: !1
  10256. },
  10257. _offset: cc.v2(0, 0),
  10258. offset: {
  10259. get: function() {
  10260. return this._offset
  10261. },
  10262. set: function(t) {
  10263. this._offset = t
  10264. },
  10265. type: cc.Vec2
  10266. },
  10267. points: {
  10268. tooltip: !1,
  10269. default: function() {
  10270. return [cc.v2(-50, -50), cc.v2(50, -50), cc.v2(50, 50), cc.v2(-50, 50)]
  10271. },
  10272. type: [cc.Vec2]
  10273. }
  10274. },
  10275. resetPointsByContour: !1
  10276. });
  10277. var n = cc.Class({
  10278. name: "cc.PolygonCollider",
  10279. extends: cc.Collider,
  10280. mixins: [cc.Collider.Polygon],
  10281. editor: !1
  10282. });
  10283. cc.PolygonCollider = e.exports = n
  10284. }), {}],
  10285. 88: [(function(t, e, i) {
  10286. "use strict";
  10287. t("./CCCollisionManager"), t("./CCCollider"), t("./CCBoxCollider"), t("./CCCircleCollider"), t("./CCPolygonCollider")
  10288. }), {
  10289. "./CCBoxCollider": 81,
  10290. "./CCCircleCollider": 82,
  10291. "./CCCollider": 83,
  10292. "./CCCollisionManager": 84,
  10293. "./CCPolygonCollider": 87
  10294. }],
  10295. 89: [(function(t, e, i) {
  10296. "use strict";
  10297. t("./platform/CCClass");
  10298. var n = t("./platform/CCObject").Flags,
  10299. r = t("./platform/js").array,
  10300. s = n.IsStartCalled,
  10301. o = n.IsOnEnableCalled;
  10302. n.IsEditorOnEnableCalled;
  10303. function a(t, e) {
  10304. for (var i = e.constructor._executionOrder, n = e._id, r = 0, s = t.length - 1, o = s >>> 1; r <= s; o = r + s >>> 1) {
  10305. var a = t[o],
  10306. l = a.constructor._executionOrder;
  10307. if (l > i) s = o - 1;
  10308. else if (l < i) r = o + 1;
  10309. else {
  10310. var h = a._id;
  10311. if (h > n) s = o - 1;
  10312. else {
  10313. if (!(h < n)) return o;
  10314. r = o + 1
  10315. }
  10316. }
  10317. }
  10318. return ~r
  10319. }
  10320. function l(t, e) {
  10321. for (var i = t.array, n = t.i + 1; n < i.length;) {
  10322. var r = i[n];
  10323. r._enabled && r.node._activeInHierarchy ? ++n : (t.removeAt(n), e && (r._objFlags &= ~e))
  10324. }
  10325. }
  10326. var h = cc.Class({
  10327. __ctor__: function(t) {
  10328. var e = r.MutableForwardIterator;
  10329. this._zero = new e([]), this._neg = new e([]), this._pos = new e([]), this._invoke = t
  10330. },
  10331. statics: {
  10332. stableRemoveInactive: l
  10333. },
  10334. add: null,
  10335. remove: null,
  10336. invoke: null
  10337. });
  10338. function c(t, e) {
  10339. return t.constructor._executionOrder - e.constructor._executionOrder
  10340. }
  10341. var u = cc.Class({
  10342. extends: h,
  10343. add: function(t) {
  10344. var e = t.constructor._executionOrder;
  10345. (0 === e ? this._zero : e < 0 ? this._neg : this._pos).array.push(t)
  10346. },
  10347. remove: function(t) {
  10348. var e = t.constructor._executionOrder;
  10349. (0 === e ? this._zero : e < 0 ? this._neg : this._pos).fastRemove(t)
  10350. },
  10351. cancelInactive: function(t) {
  10352. l(this._zero, t), l(this._neg, t), l(this._pos, t)
  10353. },
  10354. invoke: function() {
  10355. var t = this._neg;
  10356. t.array.length > 0 && (t.array.sort(c), this._invoke(t), t.array.length = 0), this._invoke(this._zero), this._zero.array.length = 0;
  10357. var e = this._pos;
  10358. e.array.length > 0 && (e.array.sort(c), this._invoke(e), e.array.length = 0)
  10359. }
  10360. }),
  10361. _ = cc.Class({
  10362. extends: h,
  10363. add: function(t) {
  10364. var e = t.constructor._executionOrder;
  10365. if (0 === e) this._zero.array.push(t);
  10366. else {
  10367. var i = e < 0 ? this._neg.array : this._pos.array,
  10368. n = a(i, t);
  10369. n < 0 && i.splice(~n, 0, t)
  10370. }
  10371. },
  10372. remove: function(t) {
  10373. var e = t.constructor._executionOrder;
  10374. if (0 === e) this._zero.fastRemove(t);
  10375. else {
  10376. var i = e < 0 ? this._neg : this._pos,
  10377. n = a(i.array, t);
  10378. n >= 0 && i.removeAt(n)
  10379. }
  10380. },
  10381. invoke: function(t) {
  10382. this._neg.array.length > 0 && this._invoke(this._neg, t), this._invoke(this._zero, t), this._pos.array.length > 0 && this._invoke(this._pos, t)
  10383. }
  10384. });
  10385. function f(t, e, i, n) {
  10386. var r = "var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];" + t + "}";
  10387. return n = e ? Function("it", "dt", r) : Function("it", r), t = Function("c", "dt", t),
  10388. function(e, r) {
  10389. try {
  10390. n(e, r)
  10391. } catch (n) {
  10392. cc._throw(n);
  10393. var s = e.array;
  10394. for (i && (s[e.i]._objFlags |= i), ++e.i; e.i < s.length; ++e.i) try {
  10395. t(s[e.i], r)
  10396. } catch (t) {
  10397. cc._throw(t), i && (s[e.i]._objFlags |= i)
  10398. }
  10399. }
  10400. }
  10401. }
  10402. var d = f("c.start();c._objFlags|=" + s, !1, s),
  10403. p = f("c.update(dt)", !0),
  10404. m = f("c.lateUpdate(dt)", !0);
  10405. function y() {
  10406. this.startInvoker = new u(d), this.updateInvoker = new _(p), this.lateUpdateInvoker = new _(m), this.scheduleInNextFrame = [], this._updating = !1
  10407. }
  10408. var v = cc.Class({
  10409. ctor: y,
  10410. unscheduleAll: y,
  10411. statics: {
  10412. LifeCycleInvoker: h,
  10413. OneOffInvoker: u,
  10414. createInvokeImpl: f,
  10415. invokeOnEnable: function(t) {
  10416. var e = cc.director._compScheduler,
  10417. i = t.array;
  10418. for (t.i = 0; t.i < i.length; ++t.i) {
  10419. var n = i[t.i];
  10420. if (n._enabled) n.onEnable(), !n.node._activeInHierarchy || e._onEnabled(n)
  10421. }
  10422. }
  10423. },
  10424. _onEnabled: function(t) {
  10425. cc.director.getScheduler().resumeTarget(t), t._objFlags |= o, this._updating ? this.scheduleInNextFrame.push(t) : this._scheduleImmediate(t)
  10426. },
  10427. _onDisabled: function(t) {
  10428. cc.director.getScheduler().pauseTarget(t), t._objFlags &= ~o;
  10429. var e = this.scheduleInNextFrame.indexOf(t);
  10430. e >= 0 ? r.fastRemoveAt(this.scheduleInNextFrame, e) : (!t.start || t._objFlags & s || this.startInvoker.remove(t), t.update && this.updateInvoker.remove(t), t.lateUpdate && this.lateUpdateInvoker.remove(t))
  10431. },
  10432. enableComp: function(t, e) {
  10433. if (!(t._objFlags & o)) {
  10434. if (t.onEnable) {
  10435. if (e) return void e.add(t);
  10436. if (t.onEnable(), !t.node._activeInHierarchy) return
  10437. }
  10438. this._onEnabled(t)
  10439. }
  10440. },
  10441. disableComp: function(t) {
  10442. t._objFlags & o && (t.onDisable && t.onDisable(), this._onDisabled(t))
  10443. },
  10444. _scheduleImmediate: function(t) {
  10445. !t.start || t._objFlags & s || this.startInvoker.add(t), t.update && this.updateInvoker.add(t), t.lateUpdate && this.lateUpdateInvoker.add(t)
  10446. },
  10447. _deferredSchedule: function() {
  10448. for (var t = this.scheduleInNextFrame, e = 0, i = t.length; e < i; e++) {
  10449. var n = t[e];
  10450. this._scheduleImmediate(n)
  10451. }
  10452. t.length = 0
  10453. },
  10454. startPhase: function() {
  10455. this._updating = !0, this.scheduleInNextFrame.length > 0 && this._deferredSchedule(), this.startInvoker.invoke()
  10456. },
  10457. updatePhase: function(t) {
  10458. this.updateInvoker.invoke(t)
  10459. },
  10460. lateUpdatePhase: function(t) {
  10461. this.lateUpdateInvoker.invoke(t), this._updating = !1
  10462. }
  10463. });
  10464. e.exports = v
  10465. }), {
  10466. "./platform/CCClass": 198,
  10467. "./platform/CCObject": 204,
  10468. "./platform/js": 218,
  10469. "./utils/misc": 300
  10470. }],
  10471. 90: [(function(t, e, i) {
  10472. "use strict";
  10473. var n = t("../../animation/animation-animator"),
  10474. r = t("../../animation/animation-clip"),
  10475. s = t("../event/event-target"),
  10476. o = t("../platform/js");
  10477. function a(t, e) {
  10478. return t === e || t && e && (t.name === e.name || t._uuid === e._uuid)
  10479. }
  10480. var l = cc.Enum({
  10481. PLAY: "play",
  10482. STOP: "stop",
  10483. PAUSE: "pause",
  10484. RESUME: "resume",
  10485. LASTFRAME: "lastframe",
  10486. FINISHED: "finished"
  10487. }),
  10488. h = cc.Class({
  10489. name: "cc.Animation",
  10490. extends: t("./CCComponent"),
  10491. mixins: [s],
  10492. editor: !1,
  10493. statics: {
  10494. EventType: l
  10495. },
  10496. ctor: function() {
  10497. cc.EventTarget.call(this), this._animator = null, this._nameToState = o.createMap(!0), this._didInit = !1, this._currentClip = null
  10498. },
  10499. properties: {
  10500. _defaultClip: {
  10501. default: null,
  10502. type: r
  10503. },
  10504. defaultClip: {
  10505. type: r,
  10506. get: function() {
  10507. return this._defaultClip
  10508. },
  10509. set: function(t) {},
  10510. tooltip: !1
  10511. },
  10512. currentClip: {
  10513. get: function() {
  10514. return this._currentClip
  10515. },
  10516. set: function(t) {
  10517. this._currentClip = t
  10518. },
  10519. type: r,
  10520. visible: !1
  10521. },
  10522. _writableClips: {
  10523. get: function() {
  10524. return this._clips
  10525. },
  10526. set: function(t) {
  10527. this._didInit = !1, this._clips = t, this._init()
  10528. },
  10529. type: [r]
  10530. },
  10531. _clips: {
  10532. default: [],
  10533. type: [r],
  10534. tooltip: !1,
  10535. visible: !0
  10536. },
  10537. playOnLoad: {
  10538. default: !1,
  10539. tooltip: !1
  10540. }
  10541. },
  10542. start: function() {
  10543. if (this.playOnLoad && this._defaultClip && !(this._animator && this._animator.isPlaying)) {
  10544. var t = this.getAnimationState(this._defaultClip.name);
  10545. this._animator.playState(t)
  10546. }
  10547. },
  10548. onEnable: function() {
  10549. this._animator && this._animator.resume()
  10550. },
  10551. onDisable: function() {
  10552. this._animator && this._animator.pause()
  10553. },
  10554. onDestroy: function() {
  10555. this.stop()
  10556. },
  10557. getClips: function() {
  10558. return this._clips
  10559. },
  10560. play: function(t, e) {
  10561. var i = this.playAdditive(t, e);
  10562. return this._animator.stopStatesExcept(i), i
  10563. },
  10564. playAdditive: function(t, e) {
  10565. this._init();
  10566. var i = this.getAnimationState(t || this._defaultClip && this._defaultClip.name);
  10567. if (i) {
  10568. this.enabled = !0;
  10569. var n = this._animator;
  10570. n.isPlaying && i.isPlaying ? i.isPaused ? n.resumeState(i) : (n.stopState(i), n.playState(i, e)) : n.playState(i, e), this.enabledInHierarchy || n.pause(), this.currentClip = i.clip
  10571. }
  10572. return i
  10573. },
  10574. stop: function(t) {
  10575. if (this._didInit)
  10576. if (t) {
  10577. var e = this._nameToState[t];
  10578. e && this._animator.stopState(e)
  10579. } else this._animator.stop()
  10580. },
  10581. pause: function(t) {
  10582. if (this._didInit)
  10583. if (t) {
  10584. var e = this._nameToState[t];
  10585. e && this._animator.pauseState(e)
  10586. } else this.enabled = !1
  10587. },
  10588. resume: function(t) {
  10589. if (this._didInit)
  10590. if (t) {
  10591. var e = this._nameToState[t];
  10592. e && this._animator.resumeState(e)
  10593. } else this.enabled = !0
  10594. },
  10595. setCurrentTime: function(t, e) {
  10596. if (this._init(), e) {
  10597. var i = this._nameToState[e];
  10598. i && this._animator.setStateTime(i, t)
  10599. } else this._animator.setStateTime(t)
  10600. },
  10601. getAnimationState: function(t) {
  10602. this._init();
  10603. var e = this._nameToState[t];
  10604. return e && !e.curveLoaded && this._animator._reloadClip(e), e || null
  10605. },
  10606. addClip: function(t, e) {
  10607. if (t) {
  10608. this._init(), cc.js.array.contains(this._clips, t) || this._clips.push(t), e = e || t.name;
  10609. var i = this._nameToState[e];
  10610. if (i) {
  10611. if (i.clip === t) return i;
  10612. var n = this._clips.indexOf(i.clip); - 1 !== n && this._clips.splice(n, 1)
  10613. }
  10614. var r = new cc.AnimationState(t, e);
  10615. return this._nameToState[e] = r, r
  10616. }
  10617. cc.warnID(3900)
  10618. },
  10619. removeClip: function(t, e) {
  10620. if (t) {
  10621. this._init();
  10622. var i = void 0;
  10623. for (var n in this._nameToState) {
  10624. if ((i = this._nameToState[n]).clip === t) break
  10625. }
  10626. if (t === this._defaultClip) {
  10627. if (!e) return void cc.warnID(3902);
  10628. this._defaultClip = null
  10629. }
  10630. if (i && i.isPlaying) {
  10631. if (!e) return void cc.warnID(3903);
  10632. this.stop(i.name)
  10633. }
  10634. this._clips = this._clips.filter((function(e) {
  10635. return e !== t
  10636. })), i && delete this._nameToState[i.name]
  10637. } else cc.warnID(3901)
  10638. },
  10639. sample: function(t) {
  10640. if (this._init(), t) {
  10641. var e = this._nameToState[t];
  10642. e && e.sample()
  10643. } else this._animator.sample()
  10644. },
  10645. on: function(t, e, i, n) {
  10646. this._init();
  10647. var r = this._EventTargetOn(t, e, i, n);
  10648. if ("lastframe" === t) {
  10649. var s = this._nameToState;
  10650. for (var o in s) s[o]._lastframeEventOn = !0
  10651. }
  10652. return r
  10653. },
  10654. off: function(t, e, i, n) {
  10655. if (this._init(), "lastframe" === t) {
  10656. var r = this._nameToState;
  10657. for (var s in r) r[s]._lastframeEventOn = !1
  10658. }
  10659. this._EventTargetOff(t, e, i, n)
  10660. },
  10661. _init: function() {
  10662. this._didInit || (this._didInit = !0, this._animator = new n(this.node, this), this._createStates())
  10663. },
  10664. _createStates: function() {
  10665. this._nameToState = o.createMap(!0);
  10666. for (var t = null, e = !1, i = 0; i < this._clips.length; ++i) {
  10667. var n = this._clips[i];
  10668. n && (t = new cc.AnimationState(n), this._nameToState[t.name] = t, a(this._defaultClip, n) && (e = t))
  10669. }
  10670. this._defaultClip && !e && (t = new cc.AnimationState(this._defaultClip), this._nameToState[t.name] = t)
  10671. }
  10672. });
  10673. h.prototype._EventTargetOn = s.prototype.on, h.prototype._EventTargetOff = s.prototype.off, cc.Animation = e.exports = h
  10674. }), {
  10675. "../../animation/animation-animator": 9,
  10676. "../../animation/animation-clip": 10,
  10677. "../event/event-target": 131,
  10678. "../platform/js": 218,
  10679. "./CCComponent": 95
  10680. }],
  10681. 91: [(function(t, e, i) {
  10682. "use strict";
  10683. var n = t("../utils/misc"),
  10684. r = t("./CCComponent"),
  10685. s = t("../assets/CCAudioClip"),
  10686. o = cc.Class({
  10687. name: "cc.AudioSource",
  10688. extends: r,
  10689. editor: !1,
  10690. ctor: function() {
  10691. this.audio = new cc.Audio
  10692. },
  10693. properties: {
  10694. _clip: {
  10695. default: null,
  10696. type: s
  10697. },
  10698. _volume: 1,
  10699. _mute: !1,
  10700. _loop: !1,
  10701. _pausedFlag: {
  10702. default: !1,
  10703. serializable: !1
  10704. },
  10705. isPlaying: {
  10706. get: function() {
  10707. return this.audio.getState() === cc.Audio.State.PLAYING
  10708. },
  10709. visible: !1
  10710. },
  10711. clip: {
  10712. get: function() {
  10713. return this._clip
  10714. },
  10715. set: function(t) {
  10716. if ("string" != typeof t) t !== this._clip && (this._clip = t, this.audio.stop(), this.preload && (this.audio.src = this._clip));
  10717. else {
  10718. cc.warnID(8401, "cc.AudioSource", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio");
  10719. var e = this;
  10720. s._loadByUrl(t, (function(t, i) {
  10721. i && (e.clip = i)
  10722. }))
  10723. }
  10724. },
  10725. type: s,
  10726. tooltip: !1,
  10727. animatable: !1
  10728. },
  10729. volume: {
  10730. get: function() {
  10731. return this._volume
  10732. },
  10733. set: function(t) {
  10734. return t = n.clamp01(t), this._volume = t, this._mute || this.audio.setVolume(t), t
  10735. },
  10736. tooltip: !1
  10737. },
  10738. mute: {
  10739. get: function() {
  10740. return this._mute
  10741. },
  10742. set: function(t) {
  10743. return this._mute = t, this.audio.setVolume(t ? 0 : this._volume), t
  10744. },
  10745. animatable: !1,
  10746. tooltip: !1
  10747. },
  10748. loop: {
  10749. get: function() {
  10750. return this._loop
  10751. },
  10752. set: function(t) {
  10753. return this._loop = t, this.audio.setLoop(t), t
  10754. },
  10755. animatable: !1,
  10756. tooltip: !1
  10757. },
  10758. playOnLoad: {
  10759. default: !1,
  10760. tooltip: !1,
  10761. animatable: !1
  10762. },
  10763. preload: {
  10764. default: !1,
  10765. animatable: !1
  10766. }
  10767. },
  10768. _ensureDataLoaded: function() {
  10769. this.audio.src !== this._clip && (this.audio.src = this._clip)
  10770. },
  10771. _pausedCallback: function() {
  10772. this.audio.getState() === cc.Audio.State.PLAYING && (this.audio.pause(), this._pausedFlag = !0)
  10773. },
  10774. _restoreCallback: function() {
  10775. this._pausedFlag && this.audio.resume(), this._pausedFlag = !1
  10776. },
  10777. onLoad: function() {
  10778. this.audio.setVolume(this._mute ? 0 : this._volume), this.audio.setLoop(this._loop)
  10779. },
  10780. onEnable: function() {
  10781. this.preload && (this.audio.src = this._clip), this.playOnLoad && this.play(), cc.game.on(cc.game.EVENT_HIDE, this._pausedCallback, this), cc.game.on(cc.game.EVENT_SHOW, this._restoreCallback, this)
  10782. },
  10783. onDisable: function() {
  10784. this.stop(), cc.game.off(cc.game.EVENT_HIDE, this._pausedCallback, this), cc.game.off(cc.game.EVENT_SHOW, this._restoreCallback, this)
  10785. },
  10786. onDestroy: function() {
  10787. this.stop(), this.audio.destroy(), cc.audioEngine.uncache(this._clip)
  10788. },
  10789. play: function() {
  10790. if (this._clip) {
  10791. var t = this.audio;
  10792. this._clip.loaded && t.stop(), this._ensureDataLoaded(), t.setCurrentTime(0), t.play()
  10793. }
  10794. },
  10795. stop: function() {
  10796. this.audio.stop()
  10797. },
  10798. pause: function() {
  10799. this.audio.pause()
  10800. },
  10801. resume: function() {
  10802. this._ensureDataLoaded(), this.audio.resume()
  10803. },
  10804. rewind: function() {
  10805. this.audio.setCurrentTime(0)
  10806. },
  10807. getCurrentTime: function() {
  10808. return this.audio.getCurrentTime()
  10809. },
  10810. setCurrentTime: function(t) {
  10811. return this.audio.setCurrentTime(t), t
  10812. },
  10813. getDuration: function() {
  10814. return this.audio.getDuration()
  10815. }
  10816. });
  10817. cc.AudioSource = e.exports = o
  10818. }), {
  10819. "../assets/CCAudioClip": 57,
  10820. "../utils/misc": 300,
  10821. "./CCComponent": 95
  10822. }],
  10823. 92: [(function(t, e, i) {
  10824. "use strict";
  10825. var n = ["touchstart", "touchmove", "touchend", "mousedown", "mousemove", "mouseup", "mouseenter", "mouseleave", "mousewheel"];
  10826. function r(t) {
  10827. t.stopPropagation()
  10828. }
  10829. var s = cc.Class({
  10830. name: "cc.BlockInputEvents",
  10831. extends: t("./CCComponent"),
  10832. editor: {
  10833. menu: "i18n:MAIN_MENU.component.ui/Block Input Events",
  10834. inspector: "packages://inspector/inspectors/comps/block-input-events.js",
  10835. help: "i18n:COMPONENT.help_url.block_input_events"
  10836. },
  10837. onEnable: function() {
  10838. for (var t = 0; t < n.length; t++) this.node.on(n[t], r, this)
  10839. },
  10840. onDisable: function() {
  10841. for (var t = 0; t < n.length; t++) this.node.off(n[t], r, this)
  10842. }
  10843. });
  10844. cc.BlockInputEvents = e.exports = s
  10845. }), {
  10846. "./CCComponent": 95
  10847. }],
  10848. 93: [(function(t, e, i) {
  10849. "use strict";
  10850. var n = t("./CCComponent"),
  10851. r = t("../utils/gray-sprite-state"),
  10852. s = cc.Enum({
  10853. NONE: 0,
  10854. COLOR: 1,
  10855. SPRITE: 2,
  10856. SCALE: 3
  10857. }),
  10858. o = cc.Enum({
  10859. NORMAL: 0,
  10860. HOVER: 1,
  10861. PRESSED: 2,
  10862. DISABLED: 3
  10863. }),
  10864. a = cc.Class({
  10865. name: "cc.Button",
  10866. extends: n,
  10867. mixins: [r],
  10868. ctor: function() {
  10869. this._pressed = !1, this._hovered = !1, this._fromColor = null, this._toColor = null, this._time = 0, this._transitionFinished = !0, this._fromScale = cc.Vec2.ZERO, this._toScale = cc.Vec2.ZERO, this._originalScale = null, this._graySpriteMaterial = null, this._spriteMaterial = null, this._sprite = null
  10870. },
  10871. editor: !1,
  10872. properties: {
  10873. interactable: {
  10874. default: !0,
  10875. tooltip: !1,
  10876. notify: function() {
  10877. this._updateState(), this.interactable || this._resetState()
  10878. },
  10879. animatable: !1
  10880. },
  10881. _resizeToTarget: {
  10882. animatable: !1,
  10883. set: function(t) {
  10884. t && this._resizeNodeToTargetNode()
  10885. }
  10886. },
  10887. enableAutoGrayEffect: {
  10888. default: !1,
  10889. tooltip: !1,
  10890. notify: function() {
  10891. this._updateDisabledState()
  10892. }
  10893. },
  10894. transition: {
  10895. default: s.NONE,
  10896. tooltip: !1,
  10897. type: s,
  10898. animatable: !1,
  10899. notify: function(t) {
  10900. this._updateTransition(t)
  10901. },
  10902. formerlySerializedAs: "transition"
  10903. },
  10904. normalColor: {
  10905. default: cc.Color.WHITE,
  10906. displayName: "Normal",
  10907. tooltip: !1,
  10908. notify: function() {
  10909. this.transition === s.Color && this._getButtonState() === o.NORMAL && (this._getTarget().opacity = this.normalColor.a), this._updateState()
  10910. }
  10911. },
  10912. pressedColor: {
  10913. default: cc.color(211, 211, 211),
  10914. displayName: "Pressed",
  10915. tooltip: !1,
  10916. notify: function() {
  10917. this.transition === s.Color && this._getButtonState() === o.PRESSED && (this._getTarget().opacity = this.pressedColor.a), this._updateState()
  10918. },
  10919. formerlySerializedAs: "pressedColor"
  10920. },
  10921. hoverColor: {
  10922. default: cc.Color.WHITE,
  10923. displayName: "Hover",
  10924. tooltip: !1,
  10925. notify: function() {
  10926. this.transition === s.Color && this._getButtonState() === o.HOVER && (this._getTarget().opacity = this.hoverColor.a), this._updateState()
  10927. },
  10928. formerlySerializedAs: "hoverColor"
  10929. },
  10930. disabledColor: {
  10931. default: cc.color(124, 124, 124),
  10932. displayName: "Disabled",
  10933. tooltip: !1,
  10934. notify: function() {
  10935. this.transition === s.Color && this._getButtonState() === o.DISABLED && (this._getTarget().opacity = this.disabledColor.a), this._updateState()
  10936. }
  10937. },
  10938. duration: {
  10939. default: .1,
  10940. range: [0, 10],
  10941. tooltip: !1
  10942. },
  10943. zoomScale: {
  10944. default: 1.2,
  10945. tooltip: !1
  10946. },
  10947. normalSprite: {
  10948. default: null,
  10949. type: cc.SpriteFrame,
  10950. displayName: "Normal",
  10951. tooltip: !1,
  10952. notify: function() {
  10953. this._updateState()
  10954. }
  10955. },
  10956. pressedSprite: {
  10957. default: null,
  10958. type: cc.SpriteFrame,
  10959. displayName: "Pressed",
  10960. tooltip: !1,
  10961. formerlySerializedAs: "pressedSprite",
  10962. notify: function() {
  10963. this._updateState()
  10964. }
  10965. },
  10966. hoverSprite: {
  10967. default: null,
  10968. type: cc.SpriteFrame,
  10969. displayName: "Hover",
  10970. tooltip: !1,
  10971. formerlySerializedAs: "hoverSprite",
  10972. notify: function() {
  10973. this._updateState()
  10974. }
  10975. },
  10976. disabledSprite: {
  10977. default: null,
  10978. type: cc.SpriteFrame,
  10979. displayName: "Disabled",
  10980. tooltip: !1,
  10981. notify: function() {
  10982. this._updateState()
  10983. }
  10984. },
  10985. target: {
  10986. default: null,
  10987. type: cc.Node,
  10988. tooltip: !1,
  10989. notify: function(t) {
  10990. this._applyTarget(), t && this.target !== t && this._unregisterTargetEvent(t)
  10991. }
  10992. },
  10993. clickEvents: {
  10994. default: [],
  10995. type: cc.Component.EventHandler,
  10996. tooltip: !1
  10997. }
  10998. },
  10999. statics: {
  11000. Transition: s
  11001. },
  11002. __preload: function() {
  11003. this._applyTarget(), this._resetState()
  11004. },
  11005. _resetState: function() {
  11006. this._pressed = !1, this._hovered = !1;
  11007. var t = this._getTarget(),
  11008. e = this.transition,
  11009. i = this._originalScale;
  11010. e === s.COLOR && this.interactable ? this._setTargetColor(this.normalColor) : e === s.SCALE && i && t.setScale(i.x, i.y), this._transitionFinished = !0
  11011. },
  11012. onEnable: function() {
  11013. this.normalSprite && this.normalSprite.ensureLoadTexture(), this.hoverSprite && this.hoverSprite.ensureLoadTexture(), this.pressedSprite && this.pressedSprite.ensureLoadTexture(), this.disabledSprite && this.disabledSprite.ensureLoadTexture(), this._registerNodeEvent()
  11014. },
  11015. onDisable: function() {
  11016. this._resetState(), this._unregisterNodeEvent()
  11017. },
  11018. _getTarget: function() {
  11019. return this.target ? this.target : this.node
  11020. },
  11021. _onTargetSpriteFrameChanged: function(t) {
  11022. this.transition === s.SPRITE && this._setCurrentStateSprite(t.spriteFrame)
  11023. },
  11024. _onTargetColorChanged: function(t) {
  11025. this.transition === s.COLOR && this._setCurrentStateColor(t)
  11026. },
  11027. _onTargetScaleChanged: function() {
  11028. var t = this._getTarget();
  11029. this._originalScale && (this.transition !== s.SCALE || this._transitionFinished) && (this._originalScale.x = t.scaleX, this._originalScale.y = t.scaleY)
  11030. },
  11031. _setTargetColor: function(t) {
  11032. var e = this._getTarget();
  11033. e.color = t, e.opacity = t.a
  11034. },
  11035. _getStateColor: function(t) {
  11036. switch (t) {
  11037. case o.NORMAL:
  11038. return this.normalColor;
  11039. case o.HOVER:
  11040. return this.hoverColor;
  11041. case o.PRESSED:
  11042. return this.pressedColor;
  11043. case o.DISABLED:
  11044. return this.disabledColor
  11045. }
  11046. },
  11047. _getStateSprite: function(t) {
  11048. switch (t) {
  11049. case o.NORMAL:
  11050. return this.normalSprite;
  11051. case o.HOVER:
  11052. return this.hoverSprite;
  11053. case o.PRESSED:
  11054. return this.pressedSprite;
  11055. case o.DISABLED:
  11056. return this.disabledSprite
  11057. }
  11058. },
  11059. _setCurrentStateColor: function(t) {
  11060. switch (this._getButtonState()) {
  11061. case o.NORMAL:
  11062. this.normalColor = t;
  11063. break;
  11064. case o.HOVER:
  11065. this.hoverColor = t;
  11066. break;
  11067. case o.PRESSED:
  11068. this.pressedColor = t;
  11069. break;
  11070. case o.DISABLED:
  11071. this.disabledColor = t
  11072. }
  11073. },
  11074. _setCurrentStateSprite: function(t) {
  11075. switch (this._getButtonState()) {
  11076. case o.NORMAL:
  11077. this.normalSprite = t;
  11078. break;
  11079. case o.HOVER:
  11080. this.hoverSprite = t;
  11081. break;
  11082. case o.PRESSED:
  11083. this.pressedSprite = t;
  11084. break;
  11085. case o.DISABLED:
  11086. this.disabledSprite = t
  11087. }
  11088. },
  11089. update: function(t) {
  11090. var e = this._getTarget();
  11091. if (!this._transitionFinished && (this.transition === s.COLOR || this.transition === s.SCALE)) {
  11092. this.time += t;
  11093. var i = 1;
  11094. if (this.duration > 0 && (i = this.time / this.duration), i >= 1 && (i = 1), this.transition === s.COLOR) {
  11095. var n = this._fromColor.lerp(this._toColor, i);
  11096. this._setTargetColor(n)
  11097. } else this.transition === s.SCALE && this._originalScale && (e.scale = this._fromScale.lerp(this._toScale, i));
  11098. 1 === i && (this._transitionFinished = !0)
  11099. }
  11100. },
  11101. _registerNodeEvent: function() {
  11102. this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this), this.node.on(cc.Node.EventType.MOUSE_ENTER, this._onMouseMoveIn, this), this.node.on(cc.Node.EventType.MOUSE_LEAVE, this._onMouseMoveOut, this)
  11103. },
  11104. _unregisterNodeEvent: function() {
  11105. this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this), this.node.off(cc.Node.EventType.MOUSE_ENTER, this._onMouseMoveIn, this), this.node.off(cc.Node.EventType.MOUSE_LEAVE, this._onMouseMoveOut, this)
  11106. },
  11107. _registerTargetEvent: function(t) {
  11108. t.on(cc.Node.EventType.SCALE_CHANGED, this._onTargetScaleChanged, this)
  11109. },
  11110. _unregisterTargetEvent: function(t) {
  11111. t.off(cc.Node.EventType.SCALE_CHANGED, this._onTargetScaleChanged, this)
  11112. },
  11113. _getTargetSprite: function(t) {
  11114. var e = null;
  11115. return t && (e = t.getComponent(cc.Sprite)), e
  11116. },
  11117. _applyTarget: function() {
  11118. var t = this._getTarget();
  11119. this._sprite = this._getTargetSprite(t), this._originalScale || (this._originalScale = cc.Vec2.ZERO), this._originalScale.x = t.scaleX, this._originalScale.y = t.scaleY, this._registerTargetEvent(t)
  11120. },
  11121. _onTouchBegan: function(t) {
  11122. this.interactable && this.enabledInHierarchy && (this._pressed = !0, this._updateState(), t.stopPropagation())
  11123. },
  11124. _onTouchMove: function(t) {
  11125. if (this.interactable && this.enabledInHierarchy && this._pressed) {
  11126. var e = t.touch,
  11127. i = this.node._hitTest(e.getLocation()),
  11128. n = this._getTarget(),
  11129. r = this._originalScale;
  11130. if (this.transition === s.SCALE && r) i ? (this._fromScale.x = r.x, this._fromScale.y = r.y, this._toScale.x = r.x * this.zoomScale, this._toScale.y = r.y * this.zoomScale, this._transitionFinished = !1) : (this.time = 0, this._transitionFinished = !0, n.setScale(r.x, r.y));
  11131. else {
  11132. var a = void 0;
  11133. a = i ? o.PRESSED : o.NORMAL, this._applyTransition(a)
  11134. }
  11135. t.stopPropagation()
  11136. }
  11137. },
  11138. _onTouchEnded: function(t) {
  11139. this.interactable && this.enabledInHierarchy && (this._pressed && (cc.Component.EventHandler.emitEvents(this.clickEvents, t), this.node.emit("click", this)), this._pressed = !1, this._updateState(), t.stopPropagation())
  11140. },
  11141. _onTouchCancel: function() {
  11142. this.interactable && this.enabledInHierarchy && (this._pressed = !1, this._updateState())
  11143. },
  11144. _onMouseMoveIn: function() {
  11145. !this._pressed && this.interactable && this.enabledInHierarchy && (this.transition !== s.SPRITE || this.hoverSprite) && (this._hovered || (this._hovered = !0, this._updateState()))
  11146. },
  11147. _onMouseMoveOut: function() {
  11148. this._hovered && (this._hovered = !1, this._updateState())
  11149. },
  11150. _updateState: function() {
  11151. var t = this._getButtonState();
  11152. this._applyTransition(t), this._updateDisabledState()
  11153. },
  11154. _getButtonState: function() {
  11155. return this.interactable ? this._pressed ? o.PRESSED : this._hovered ? o.HOVER : o.NORMAL : o.DISABLED
  11156. },
  11157. _updateColorTransitionImmediately: function(t) {
  11158. var e = this._getStateColor(t);
  11159. this._setTargetColor(e), this._fromColor = e.clone(), this._toColor = e
  11160. },
  11161. _updateColorTransition: function(t) {
  11162. if (t === o.DISABLED) this._updateColorTransitionImmediately(t);
  11163. else {
  11164. var e = this._getTarget(),
  11165. i = this._getStateColor(t);
  11166. this._fromColor = e.color.clone(), this._toColor = i, this.time = 0, this._transitionFinished = !1
  11167. }
  11168. },
  11169. _updateSpriteTransition: function(t) {
  11170. var e = this._getStateSprite(t);
  11171. this._sprite && e && (this._sprite.spriteFrame = e)
  11172. },
  11173. _updateScaleTransition: function(t) {
  11174. t === o.PRESSED ? this._zoomUp() : this._zoomBack()
  11175. },
  11176. _zoomUp: function() {
  11177. this._originalScale && (this._fromScale.x = this._originalScale.x, this._fromScale.y = this._originalScale.y, this._toScale.x = this._originalScale.x * this.zoomScale, this._toScale.y = this._originalScale.y * this.zoomScale, this.time = 0, this._transitionFinished = !1)
  11178. },
  11179. _zoomBack: function() {
  11180. if (this._originalScale) {
  11181. var t = this._getTarget();
  11182. this._fromScale.x = t.scaleX, this._fromScale.y = t.scaleY, this._toScale.x = this._originalScale.x, this._toScale.y = this._originalScale.y, this.time = 0, this._transitionFinished = !1
  11183. }
  11184. },
  11185. _updateTransition: function(t) {
  11186. t === s.COLOR ? this._updateColorTransitionImmediately(o.NORMAL) : t === s.SPRITE && this._updateSpriteTransition(o.NORMAL), this._updateState()
  11187. },
  11188. _applyTransition: function(t) {
  11189. var e = this.transition;
  11190. e === s.COLOR ? this._updateColorTransition(t) : e === s.SPRITE ? this._updateSpriteTransition(t) : e === s.SCALE && this._updateScaleTransition(t)
  11191. },
  11192. _resizeNodeToTargetNode: !1,
  11193. _updateDisabledState: function() {
  11194. if (this._sprite) {
  11195. var t = !1;
  11196. this.enableAutoGrayEffect && (this.transition === s.SPRITE && this.disabledSprite || this.interactable || (t = !0)), this._switchGrayMaterial(t, this._sprite)
  11197. }
  11198. }
  11199. });
  11200. cc.Button = e.exports = a
  11201. }), {
  11202. "../utils/gray-sprite-state": 296,
  11203. "./CCComponent": 95
  11204. }],
  11205. 94: [(function(t, e, i) {
  11206. "use strict";
  11207. var n = t("../camera/CCCamera"),
  11208. r = t("./CCComponent"),
  11209. s = cc.Class({
  11210. name: "cc.Canvas",
  11211. extends: r,
  11212. editor: !1,
  11213. resetInEditor: !1,
  11214. statics: {
  11215. instance: null
  11216. },
  11217. properties: {
  11218. _designResolution: cc.size(960, 640),
  11219. designResolution: {
  11220. get: function() {
  11221. return cc.size(this._designResolution)
  11222. },
  11223. set: function(t) {
  11224. this._designResolution.width = t.width, this._designResolution.height = t.height, this.applySettings(), this.alignWithScreen()
  11225. },
  11226. tooltip: !1
  11227. },
  11228. _fitWidth: !1,
  11229. _fitHeight: !0,
  11230. fitHeight: {
  11231. get: function() {
  11232. return this._fitHeight
  11233. },
  11234. set: function(t) {
  11235. this._fitHeight !== t && (this._fitHeight = t, this.applySettings(), this.alignWithScreen())
  11236. },
  11237. tooltip: !1
  11238. },
  11239. fitWidth: {
  11240. get: function() {
  11241. return this._fitWidth
  11242. },
  11243. set: function(t) {
  11244. this._fitWidth !== t && (this._fitWidth = t, this.applySettings(), this.alignWithScreen())
  11245. },
  11246. tooltip: !1
  11247. }
  11248. },
  11249. ctor: function() {
  11250. this._thisOnResized = this.alignWithScreen.bind(this)
  11251. },
  11252. __preload: function() {
  11253. if (s.instance) return cc.errorID(6700, this.node.name, s.instance.node.name);
  11254. s.instance = this, cc.sys.isMobile ? window.addEventListener("resize", this._thisOnResized) : cc.view.on("canvas-resize", this._thisOnResized), this.applySettings(), this.alignWithScreen();
  11255. var t = cc.find("Main Camera", this.node);
  11256. t || ((t = new cc.Node("Main Camera")).parent = this.node, t.setSiblingIndex(0));
  11257. var e = t.getComponent(n);
  11258. if (!e) {
  11259. e = t.addComponent(n);
  11260. var i = n.ClearFlags;
  11261. e.clearFlags = i.COLOR | i.DEPTH | i.STENCIL, e.depth = -1
  11262. }
  11263. n.main = e
  11264. },
  11265. onDestroy: function() {
  11266. cc.sys.isMobile ? window.removeEventListener("resize", this._thisOnResized) : cc.view.off("canvas-resize", this._thisOnResized), s.instance === this && (s.instance = null)
  11267. },
  11268. alignWithScreen: function() {
  11269. var t, e, i = e = cc.visibleRect;
  11270. t = cc.view.getDesignResolutionSize();
  11271. var n = 0,
  11272. r = 0;
  11273. !this.fitHeight && !this.fitWidth && (n = .5 * (t.width - i.width), r = .5 * (t.height - i.height)), this.node.setPosition(.5 * i.width + n, .5 * i.height + r), this.node.width = e.width, this.node.height = e.height
  11274. },
  11275. applySettings: function() {
  11276. var t, e = cc.ResolutionPolicy;
  11277. t = this.fitHeight && this.fitWidth ? e.SHOW_ALL : this.fitHeight || this.fitWidth ? this.fitWidth ? e.FIXED_WIDTH : e.FIXED_HEIGHT : e.NO_BORDER;
  11278. var i = this._designResolution;
  11279. cc.view.setDesignResolutionSize(i.width, i.height, t)
  11280. }
  11281. });
  11282. cc.Canvas = e.exports = s
  11283. }), {
  11284. "../camera/CCCamera": 80,
  11285. "./CCComponent": 95
  11286. }],
  11287. 95: [(function(t, e, i) {
  11288. "use strict";
  11289. var n = t("../platform/CCObject"),
  11290. r = t("../platform/js"),
  11291. s = new(t("../platform/id-generater"))("Comp"),
  11292. o = (n.Flags.IsOnEnableCalled, n.Flags.IsOnLoadCalled),
  11293. a = cc.Class({
  11294. name: "cc.Component",
  11295. extends: n,
  11296. ctor: function() {
  11297. this._id = s.getNewId(), this.__eventTargets = []
  11298. },
  11299. properties: {
  11300. node: {
  11301. default: null,
  11302. visible: !1
  11303. },
  11304. name: {
  11305. get: function() {
  11306. if (this._name) return this._name;
  11307. var t = cc.js.getClassName(this),
  11308. e = t.lastIndexOf(".");
  11309. return e >= 0 && (t = t.slice(e + 1)), this.node.name + "<" + t + ">"
  11310. },
  11311. set: function(t) {
  11312. this._name = t
  11313. },
  11314. visible: !1
  11315. },
  11316. uuid: {
  11317. get: function() {
  11318. return this._id
  11319. },
  11320. visible: !1
  11321. },
  11322. __scriptAsset: !1,
  11323. _enabled: !0,
  11324. enabled: {
  11325. get: function() {
  11326. return this._enabled
  11327. },
  11328. set: function(t) {
  11329. if (this._enabled !== t && (this._enabled = t, this.node._activeInHierarchy)) {
  11330. var e = cc.director._compScheduler;
  11331. t ? e.enableComp(this) : e.disableComp(this)
  11332. }
  11333. },
  11334. visible: !1,
  11335. animatable: !0
  11336. },
  11337. enabledInHierarchy: {
  11338. get: function() {
  11339. return this._enabled && this.node._activeInHierarchy
  11340. },
  11341. visible: !1
  11342. },
  11343. _isOnLoadCalled: {
  11344. get: function() {
  11345. return this._objFlags & o
  11346. }
  11347. }
  11348. },
  11349. update: null,
  11350. lateUpdate: null,
  11351. __preload: null,
  11352. onLoad: null,
  11353. start: null,
  11354. onEnable: null,
  11355. onDisable: null,
  11356. onDestroy: null,
  11357. onFocusInEditor: null,
  11358. onLostFocusInEditor: null,
  11359. resetInEditor: null,
  11360. addComponent: function(t) {
  11361. return this.node.addComponent(t)
  11362. },
  11363. getComponent: function(t) {
  11364. return this.node.getComponent(t)
  11365. },
  11366. getComponents: function(t) {
  11367. return this.node.getComponents(t)
  11368. },
  11369. getComponentInChildren: function(t) {
  11370. return this.node.getComponentInChildren(t)
  11371. },
  11372. getComponentsInChildren: function(t) {
  11373. return this.node.getComponentsInChildren(t)
  11374. },
  11375. _getLocalBounds: null,
  11376. onRestore: null,
  11377. destroy: function() {
  11378. this._super() && this._enabled && this.node._activeInHierarchy && cc.director._compScheduler.disableComp(this)
  11379. },
  11380. _onPreDestroy: function() {
  11381. this.unscheduleAllCallbacks();
  11382. for (var t = this.__eventTargets, e = 0, i = t.length; e < i; ++e) {
  11383. var n = t[e];
  11384. n && n.targetOff(this)
  11385. }
  11386. t.length = 0, cc.director._nodeActivator.destroyComp(this), this.node._removeComponent(this)
  11387. },
  11388. _instantiate: function(t) {
  11389. return t || (t = cc.instantiate._clone(this, this)), t.node = null, t
  11390. },
  11391. schedule: function(t, e, i, n) {
  11392. cc.assertID(t, 1619), cc.assertID(e >= 0, 1620), e = e || 0, i = isNaN(i) ? cc.macro.REPEAT_FOREVER : i, n = n || 0;
  11393. var r = cc.director.getScheduler(),
  11394. s = r.isTargetPaused(this);
  11395. r.schedule(t, this, e, i, n, s)
  11396. },
  11397. scheduleOnce: function(t, e) {
  11398. this.schedule(t, 0, 0, e)
  11399. },
  11400. unschedule: function(t) {
  11401. t && cc.director.getScheduler().unschedule(t, this)
  11402. },
  11403. unscheduleAllCallbacks: function() {
  11404. cc.director.getScheduler().unscheduleAllForTarget(this)
  11405. }
  11406. });
  11407. a._requireComponent = null, a._executionOrder = 0, r.value(a, "_registerEditorProps", (function(t, e) {
  11408. var i = e.requireComponent;
  11409. i && (t._requireComponent = i);
  11410. var n = e.executionOrder;
  11411. n && "number" == typeof n && (t._executionOrder = n)
  11412. })), a.prototype.__scriptUuid = "", cc.Component = e.exports = a
  11413. }), {
  11414. "../platform/CCObject": 204,
  11415. "../platform/id-generater": 214,
  11416. "../platform/js": 218
  11417. }],
  11418. 96: [(function(t, e, i) {
  11419. "use strict";
  11420. cc.Component.EventHandler = cc.Class({
  11421. name: "cc.ClickEvent",
  11422. properties: {
  11423. target: {
  11424. default: null,
  11425. type: cc.Node
  11426. },
  11427. component: "",
  11428. _componentId: "",
  11429. _componentName: {
  11430. get: function() {
  11431. return this._genCompIdIfNeeded(), this._compId2Name(this._componentId)
  11432. },
  11433. set: function(t) {
  11434. this._componentId = this._compName2Id(t)
  11435. }
  11436. },
  11437. handler: {
  11438. default: ""
  11439. },
  11440. customEventData: {
  11441. default: ""
  11442. }
  11443. },
  11444. statics: {
  11445. emitEvents: function(t) {
  11446. var e = void 0;
  11447. if (arguments.length > 0)
  11448. for (var i = 0, n = (e = new Array(arguments.length - 1)).length; i < n; i++) e[i] = arguments[i + 1];
  11449. for (var r = 0, s = t.length; r < s; r++) {
  11450. var o = t[r];
  11451. o instanceof cc.Component.EventHandler && o.emit(e)
  11452. }
  11453. }
  11454. },
  11455. emit: function(t) {
  11456. var e = this.target;
  11457. if (cc.isValid(e)) {
  11458. this._genCompIdIfNeeded();
  11459. var i = cc.js._getClassById(this._componentId),
  11460. n = e.getComponent(i);
  11461. if (cc.isValid(n)) {
  11462. var r = n[this.handler];
  11463. "function" == typeof r && (null != this.customEventData && "" !== this.customEventData && (t = t.slice()).push(this.customEventData), r.apply(n, t))
  11464. }
  11465. }
  11466. },
  11467. _compName2Id: function(t) {
  11468. var e = cc.js.getClassByName(t);
  11469. return cc.js._getClassId(e)
  11470. },
  11471. _compId2Name: function(t) {
  11472. var e = cc.js._getClassById(t);
  11473. return cc.js.getClassName(e)
  11474. },
  11475. _genCompIdIfNeeded: function() {
  11476. this._componentId || (this._componentName = this.component, this.component = "")
  11477. }
  11478. })
  11479. }), {}],
  11480. 97: [(function(t, e, i) {
  11481. "use strict";
  11482. var n = t("../platform/CCMacro"),
  11483. r = t("./CCRenderComponent"),
  11484. s = t("../assets/material/CCMaterial"),
  11485. o = t("../renderer/utils/label/label-frame"),
  11486. a = n.TextAlignment,
  11487. l = n.VerticalTextAlignment,
  11488. h = cc.Enum({
  11489. NONE: 0,
  11490. CLAMP: 1,
  11491. SHRINK: 2,
  11492. RESIZE_HEIGHT: 3
  11493. }),
  11494. c = cc.Enum({
  11495. NONE: 0,
  11496. BITMAP: 1,
  11497. CHAR: 2
  11498. }),
  11499. u = cc.Class({
  11500. name: "cc.Label",
  11501. extends: r,
  11502. ctor: function() {
  11503. this._actualFontSize = 0, this._assemblerData = null, this._frame = null, this._ttfTexture = null, this._letterTexture = null, cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? this._activateMaterial = this._activateMaterialCanvas : this._activateMaterial = this._activateMaterialWebgl
  11504. },
  11505. editor: !1,
  11506. properties: {
  11507. _useOriginalSize: !0,
  11508. _string: {
  11509. default: "",
  11510. formerlySerializedAs: "_N$string"
  11511. },
  11512. string: {
  11513. get: function() {
  11514. return this._string
  11515. },
  11516. set: function(t) {
  11517. var e = this._string;
  11518. this._string = "" + t, this.string !== e && this._lazyUpdateRenderData(), this._checkStringEmpty()
  11519. },
  11520. multiline: !0,
  11521. tooltip: !1
  11522. },
  11523. horizontalAlign: {
  11524. default: a.LEFT,
  11525. type: a,
  11526. tooltip: !1,
  11527. notify: function(t) {
  11528. this.horizontalAlign !== t && this._lazyUpdateRenderData()
  11529. },
  11530. animatable: !1
  11531. },
  11532. verticalAlign: {
  11533. default: l.TOP,
  11534. type: l,
  11535. tooltip: !1,
  11536. notify: function(t) {
  11537. this.verticalAlign !== t && this._lazyUpdateRenderData()
  11538. },
  11539. animatable: !1
  11540. },
  11541. actualFontSize: {
  11542. displayName: "Actual Font Size",
  11543. animatable: !1,
  11544. readonly: !0,
  11545. get: function() {
  11546. return this._actualFontSize
  11547. },
  11548. tooltip: !1
  11549. },
  11550. _fontSize: 40,
  11551. fontSize: {
  11552. get: function() {
  11553. return this._fontSize
  11554. },
  11555. set: function(t) {
  11556. this._fontSize !== t && (this._fontSize = t, this._lazyUpdateRenderData())
  11557. },
  11558. range: [0, 512],
  11559. tooltip: !1
  11560. },
  11561. fontFamily: {
  11562. default: "Arial",
  11563. tooltip: !1,
  11564. notify: function(t) {
  11565. this.fontFamily !== t && this._lazyUpdateRenderData()
  11566. },
  11567. animatable: !1
  11568. },
  11569. _lineHeight: 40,
  11570. lineHeight: {
  11571. get: function() {
  11572. return this._lineHeight
  11573. },
  11574. set: function(t) {
  11575. this._lineHeight !== t && (this._lineHeight = t, this._lazyUpdateRenderData())
  11576. },
  11577. tooltip: !1
  11578. },
  11579. overflow: {
  11580. default: h.NONE,
  11581. type: h,
  11582. tooltip: !1,
  11583. notify: function(t) {
  11584. this.overflow !== t && this._lazyUpdateRenderData()
  11585. },
  11586. animatable: !1
  11587. },
  11588. _enableWrapText: !0,
  11589. enableWrapText: {
  11590. get: function() {
  11591. return this._enableWrapText
  11592. },
  11593. set: function(t) {
  11594. this._enableWrapText !== t && (this._enableWrapText = t, this._lazyUpdateRenderData())
  11595. },
  11596. animatable: !1,
  11597. tooltip: !1
  11598. },
  11599. _N$file: null,
  11600. font: {
  11601. get: function() {
  11602. return this._N$file
  11603. },
  11604. set: function(t) {
  11605. this.font !== t && (t || (this._isSystemFontUsed = !0), this._N$file = t, t && this._isSystemFontUsed && (this._isSystemFontUsed = !1), "string" == typeof t && cc.warnID(4e3), this._resetAssembler(), this._applyFontTexture(!0), this._lazyUpdateRenderData())
  11606. },
  11607. type: cc.Font,
  11608. tooltip: !1,
  11609. animatable: !1
  11610. },
  11611. _isSystemFontUsed: !0,
  11612. useSystemFont: {
  11613. get: function() {
  11614. return this._isSystemFontUsed
  11615. },
  11616. set: function(t) {
  11617. this._isSystemFontUsed !== t && (this._isSystemFontUsed = !!t, t && (this.font = null, this._resetAssembler(), this._applyFontTexture(!0), this._lazyUpdateRenderData(), this._checkStringEmpty()))
  11618. },
  11619. animatable: !1,
  11620. tooltip: !1
  11621. },
  11622. _bmFontOriginalSize: {
  11623. displayName: "BMFont Original Size",
  11624. get: function() {
  11625. return this._N$file instanceof cc.BitmapFont ? this._N$file.fontSize : -1
  11626. },
  11627. visible: !0,
  11628. animatable: !1
  11629. },
  11630. _spacingX: 0,
  11631. spacingX: {
  11632. get: function() {
  11633. return this._spacingX
  11634. },
  11635. set: function(t) {
  11636. this._spacingX = t, this._lazyUpdateRenderData()
  11637. },
  11638. tooltip: !1
  11639. },
  11640. _batchAsBitmap: !1,
  11641. cacheMode: {
  11642. default: c.NONE,
  11643. type: c,
  11644. tooltip: !1,
  11645. notify: function(t) {
  11646. this.cacheMode !== t && (t !== c.BITMAP || this.font instanceof cc.BitmapFont || this._frame && this._frame._resetDynamicAtlasFrame(), t === c.CHAR && (this._ttfTexture = null), this._resetAssembler(), this._applyFontTexture(!0), this._lazyUpdateRenderData())
  11647. },
  11648. animatable: !1
  11649. },
  11650. _isBold: {
  11651. default: !1,
  11652. serializable: !1
  11653. },
  11654. _isItalic: {
  11655. default: !1,
  11656. serializable: !1
  11657. },
  11658. _isUnderline: {
  11659. default: !1,
  11660. serializable: !1
  11661. }
  11662. },
  11663. statics: {
  11664. HorizontalAlign: a,
  11665. VerticalAlign: l,
  11666. Overflow: h,
  11667. CacheMode: c,
  11668. _shareAtlas: null,
  11669. clearCharCache: function() {
  11670. u._shareAtlas && u._shareAtlas.clearAllCache()
  11671. }
  11672. },
  11673. onLoad: function() {
  11674. this._batchAsBitmap && this.cacheMode === c.NONE && (this.cacheMode = c.BITMAP, this._batchAsBitmap = !1), cc.game.renderType === cc.game.RENDER_TYPE_CANVAS && (this.cacheMode = c.NONE)
  11675. },
  11676. onEnable: function() {
  11677. this._super(), this.node.on(cc.Node.EventType.SIZE_CHANGED, this._lazyUpdateRenderData, this), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._lazyUpdateRenderData, this), this._forceUpdateRenderData(), this._checkStringEmpty()
  11678. },
  11679. onDisable: function() {
  11680. this._super(), this.node.off(cc.Node.EventType.SIZE_CHANGED, this._lazyUpdateRenderData, this), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._lazyUpdateRenderData, this)
  11681. },
  11682. onDestroy: function() {
  11683. this._assembler && this._assembler._resetAssemblerData && this._assembler._resetAssemblerData(this._assemblerData), this._assemblerData = null, this._letterTexture = null, this._ttfTexture && (this._ttfTexture.destroy(), this._ttfTexture = null), this._super()
  11684. },
  11685. _updateColor: function() {
  11686. this.font instanceof cc.BitmapFont || this._lazyUpdateRenderData(), r.prototype._updateColor.call(this)
  11687. },
  11688. _resetAssembler: function() {
  11689. this._frame = null, r.prototype._resetAssembler.call(this)
  11690. },
  11691. _canRender: function() {
  11692. var t = this._super(),
  11693. e = this.font;
  11694. if (e instanceof cc.BitmapFont) {
  11695. var i = e.spriteFrame;
  11696. i && i.textureLoaded() || (t = !1)
  11697. }
  11698. return t
  11699. },
  11700. _checkStringEmpty: function() {
  11701. this.markForRender(!!this.string)
  11702. },
  11703. _on3DNodeChanged: function() {
  11704. this._resetAssembler(), this._applyFontTexture(!0)
  11705. },
  11706. _applyFontTexture: function(t) {
  11707. var e = this.font;
  11708. if (e instanceof cc.BitmapFont) {
  11709. var i = e.spriteFrame;
  11710. this._frame = i;
  11711. var n = this,
  11712. r = function() {
  11713. n._frame._texture = i._texture, n._activateMaterial(t), t && n._assembler && n._assembler.updateRenderData(n)
  11714. };
  11715. i && i.textureLoaded() ? r() : (this.disableRender(), i && (i.once("load", r, this), i.ensureLoadTexture()))
  11716. } else this._frame || (this._frame = new o), this.cacheMode === c.CHAR ? (this._letterTexture = this._assembler._getAssemblerData(), this._frame._refreshTexture(this._letterTexture)) : this._ttfTexture || (this._ttfTexture = new cc.Texture2D, this._assemblerData = this._assembler._getAssemblerData(), this._ttfTexture.initWithElement(this._assemblerData.canvas)), this.cacheMode !== c.CHAR && (this._frame._resetDynamicAtlasFrame(), this._frame._refreshTexture(this._ttfTexture)), this._activateMaterial(t), t && this._assembler && this._assembler.updateRenderData(this)
  11717. },
  11718. _activateMaterialCanvas: function(t) {
  11719. t && (this._frame._texture.url = this.uuid + "_texture", this.markForUpdateRenderData(!0), this.markForRender(!0))
  11720. },
  11721. _activateMaterialWebgl: function(t) {
  11722. if (t)
  11723. if (this._frame) {
  11724. var e = this.sharedMaterials[0];
  11725. (e = e ? s.getInstantiatedMaterial(e, this) : s.getInstantiatedBuiltinMaterial("2d-sprite", this)).setProperty("texture", this._frame._texture), this.setMaterial(0, e), this.markForUpdateRenderData(!0), this.markForRender(!0)
  11726. } else this.disableRender()
  11727. },
  11728. _lazyUpdateRenderData: function() {
  11729. this.setVertsDirty(), this.markForUpdateRenderData(!0)
  11730. },
  11731. _forceUpdateRenderData: function() {
  11732. this.setVertsDirty(), this._resetAssembler(), this._applyFontTexture(!0), this.markForUpdateRenderData(!0)
  11733. },
  11734. _enableBold: function(t) {
  11735. this._isBold = !!t
  11736. },
  11737. _enableItalics: function(t) {
  11738. this._isItalic = !!t
  11739. },
  11740. _enableUnderline: function(t) {
  11741. this._isUnderline = !!t
  11742. }
  11743. });
  11744. cc.Label = e.exports = u
  11745. }), {
  11746. "../assets/material/CCMaterial": 75,
  11747. "../platform/CCMacro": 203,
  11748. "../renderer/utils/label/label-frame": 252,
  11749. "./CCRenderComponent": 106
  11750. }],
  11751. 98: [(function(t, e, i) {
  11752. "use strict";
  11753. var n = cc.Class({
  11754. name: "cc.LabelOutline",
  11755. extends: t("./CCComponent"),
  11756. editor: !1,
  11757. properties: {
  11758. _color: cc.Color.WHITE,
  11759. _width: 1,
  11760. color: {
  11761. tooltip: !1,
  11762. get: function() {
  11763. return this._color
  11764. },
  11765. set: function(t) {
  11766. this._color = t, this._updateRenderData()
  11767. }
  11768. },
  11769. width: {
  11770. tooltip: !1,
  11771. get: function() {
  11772. return this._width
  11773. },
  11774. set: function(t) {
  11775. this._width !== t && (this._width = t, this._updateRenderData())
  11776. },
  11777. range: [0, 512]
  11778. }
  11779. },
  11780. onEnable: function() {
  11781. this._updateRenderData()
  11782. },
  11783. onDisable: function() {
  11784. this._updateRenderData()
  11785. },
  11786. _updateRenderData: function() {
  11787. var t = this.node.getComponent(cc.Label);
  11788. t && t._lazyUpdateRenderData()
  11789. }
  11790. });
  11791. cc.LabelOutline = e.exports = n
  11792. }), {
  11793. "./CCComponent": 95
  11794. }],
  11795. 99: [(function(t, e, i) {
  11796. "use strict";
  11797. var n = cc.Class({
  11798. name: "cc.LabelShadow",
  11799. extends: t("./CCComponent"),
  11800. editor: !1,
  11801. properties: {
  11802. _color: cc.Color.WHITE,
  11803. _offset: cc.v2(2, 2),
  11804. _blur: 2,
  11805. color: {
  11806. tooltip: !1,
  11807. get: function() {
  11808. return this._color
  11809. },
  11810. set: function(t) {
  11811. this._color = t, this._updateRenderData()
  11812. }
  11813. },
  11814. offset: {
  11815. tooltip: !1,
  11816. get: function() {
  11817. return this._offset
  11818. },
  11819. set: function(t) {
  11820. this._offset = t, this._updateRenderData()
  11821. }
  11822. },
  11823. blur: {
  11824. tooltip: !1,
  11825. get: function() {
  11826. return this._blur
  11827. },
  11828. set: function(t) {
  11829. this._blur = t, this._updateRenderData()
  11830. },
  11831. range: [0, 1024]
  11832. }
  11833. },
  11834. onEnable: function() {
  11835. this._updateRenderData()
  11836. },
  11837. onDisable: function() {
  11838. this._updateRenderData()
  11839. },
  11840. _updateRenderData: function() {
  11841. var t = this.node.getComponent(cc.Label);
  11842. t && t._lazyUpdateRenderData()
  11843. }
  11844. });
  11845. cc.LabelShadow = e.exports = n
  11846. }), {
  11847. "./CCComponent": 95
  11848. }],
  11849. 100: [(function(t, e, i) {
  11850. "use strict";
  11851. var n = t("../CCNode").EventType,
  11852. r = cc.Enum({
  11853. NONE: 0,
  11854. HORIZONTAL: 1,
  11855. VERTICAL: 2,
  11856. GRID: 3
  11857. }),
  11858. s = cc.Enum({
  11859. NONE: 0,
  11860. CONTAINER: 1,
  11861. CHILDREN: 2
  11862. }),
  11863. o = cc.Enum({
  11864. HORIZONTAL: 0,
  11865. VERTICAL: 1
  11866. }),
  11867. a = cc.Enum({
  11868. BOTTOM_TO_TOP: 0,
  11869. TOP_TO_BOTTOM: 1
  11870. }),
  11871. l = cc.Enum({
  11872. LEFT_TO_RIGHT: 0,
  11873. RIGHT_TO_LEFT: 1
  11874. }),
  11875. h = cc.Class({
  11876. name: "cc.Layout",
  11877. extends: t("./CCComponent"),
  11878. editor: !1,
  11879. properties: {
  11880. _layoutSize: cc.size(300, 200),
  11881. _layoutDirty: {
  11882. default: !0,
  11883. serializable: !1
  11884. },
  11885. _resize: s.NONE,
  11886. _N$layoutType: r.NONE,
  11887. type: {
  11888. type: r,
  11889. get: function() {
  11890. return this._N$layoutType
  11891. },
  11892. set: function(t) {
  11893. this._N$layoutType = t, this._doLayoutDirty()
  11894. },
  11895. tooltip: !1,
  11896. animatable: !1
  11897. },
  11898. resizeMode: {
  11899. type: s,
  11900. tooltip: !1,
  11901. animatable: !1,
  11902. get: function() {
  11903. return this._resize
  11904. },
  11905. set: function(t) {
  11906. this.type === r.NONE && t === s.CHILDREN || (this._resize = t, this._doLayoutDirty())
  11907. }
  11908. },
  11909. cellSize: {
  11910. default: cc.size(40, 40),
  11911. tooltip: !1,
  11912. type: cc.Size,
  11913. notify: function() {
  11914. this._doLayoutDirty()
  11915. }
  11916. },
  11917. startAxis: {
  11918. default: o.HORIZONTAL,
  11919. tooltip: !1,
  11920. type: o,
  11921. notify: function() {
  11922. this._doLayoutDirty()
  11923. },
  11924. animatable: !1
  11925. },
  11926. _N$padding: {
  11927. default: 0
  11928. },
  11929. paddingLeft: {
  11930. default: 0,
  11931. tooltip: !1,
  11932. notify: function() {
  11933. this._doLayoutDirty()
  11934. }
  11935. },
  11936. paddingRight: {
  11937. default: 0,
  11938. tooltip: !1,
  11939. notify: function() {
  11940. this._doLayoutDirty()
  11941. }
  11942. },
  11943. paddingTop: {
  11944. default: 0,
  11945. tooltip: !1,
  11946. notify: function() {
  11947. this._doLayoutDirty()
  11948. }
  11949. },
  11950. paddingBottom: {
  11951. default: 0,
  11952. tooltip: !1,
  11953. notify: function() {
  11954. this._doLayoutDirty()
  11955. }
  11956. },
  11957. spacingX: {
  11958. default: 0,
  11959. notify: function() {
  11960. this._doLayoutDirty()
  11961. },
  11962. tooltip: !1
  11963. },
  11964. spacingY: {
  11965. default: 0,
  11966. notify: function() {
  11967. this._doLayoutDirty()
  11968. },
  11969. tooltip: !1
  11970. },
  11971. verticalDirection: {
  11972. default: a.TOP_TO_BOTTOM,
  11973. type: a,
  11974. notify: function() {
  11975. this._doLayoutDirty()
  11976. },
  11977. tooltip: !1,
  11978. animatable: !1
  11979. },
  11980. horizontalDirection: {
  11981. default: l.LEFT_TO_RIGHT,
  11982. type: l,
  11983. notify: function() {
  11984. this._doLayoutDirty()
  11985. },
  11986. tooltip: !1,
  11987. animatable: !1
  11988. },
  11989. affectedByScale: {
  11990. default: !1,
  11991. notify: function() {
  11992. this._doLayoutDirty()
  11993. },
  11994. animatable: !1,
  11995. tooltip: !1
  11996. }
  11997. },
  11998. statics: {
  11999. Type: r,
  12000. VerticalDirection: a,
  12001. HorizontalDirection: l,
  12002. ResizeMode: s,
  12003. AxisDirection: o
  12004. },
  12005. _migratePaddingData: function() {
  12006. this.paddingLeft = this._N$padding, this.paddingRight = this._N$padding, this.paddingTop = this._N$padding, this.paddingBottom = this._N$padding, this._N$padding = 0
  12007. },
  12008. onEnable: function() {
  12009. this._addEventListeners(), this.node.getContentSize().equals(cc.size(0, 0)) && this.node.setContentSize(this._layoutSize), 0 !== this._N$padding && this._migratePaddingData(), this._doLayoutDirty()
  12010. },
  12011. onDisable: function() {
  12012. this._removeEventListeners()
  12013. },
  12014. _doLayoutDirty: function() {
  12015. this._layoutDirty = !0
  12016. },
  12017. _doScaleDirty: function() {
  12018. this._layoutDirty = this._layoutDirty || this.affectedByScale
  12019. },
  12020. _addEventListeners: function() {
  12021. cc.director.on(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this), this.node.on(n.SIZE_CHANGED, this._resized, this), this.node.on(n.ANCHOR_CHANGED, this._doLayoutDirty, this), this.node.on(n.CHILD_ADDED, this._childAdded, this), this.node.on(n.CHILD_REMOVED, this._childRemoved, this), this.node.on(n.CHILD_REORDER, this._doLayoutDirty, this), this._addChildrenEventListeners()
  12022. },
  12023. _removeEventListeners: function() {
  12024. cc.director.off(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this), this.node.off(n.SIZE_CHANGED, this._resized, this), this.node.off(n.ANCHOR_CHANGED, this._doLayoutDirty, this), this.node.off(n.CHILD_ADDED, this._childAdded, this), this.node.off(n.CHILD_REMOVED, this._childRemoved, this), this.node.off(n.CHILD_REORDER, this._doLayoutDirty, this), this._removeChildrenEventListeners()
  12025. },
  12026. _addChildrenEventListeners: function() {
  12027. for (var t = this.node.children, e = 0; e < t.length; ++e) {
  12028. var i = t[e];
  12029. i.on(n.SCALE_CHANGED, this._doScaleDirty, this), i.on(n.SIZE_CHANGED, this._doLayoutDirty, this), i.on(n.POSITION_CHANGED, this._doLayoutDirty, this), i.on(n.ANCHOR_CHANGED, this._doLayoutDirty, this), i.on("active-in-hierarchy-changed", this._doLayoutDirty, this)
  12030. }
  12031. },
  12032. _removeChildrenEventListeners: function() {
  12033. for (var t = this.node.children, e = 0; e < t.length; ++e) {
  12034. var i = t[e];
  12035. i.off(n.SCALE_CHANGED, this._doScaleDirty, this), i.off(n.SIZE_CHANGED, this._doLayoutDirty, this), i.off(n.POSITION_CHANGED, this._doLayoutDirty, this), i.off(n.ANCHOR_CHANGED, this._doLayoutDirty, this), i.off("active-in-hierarchy-changed", this._doLayoutDirty, this)
  12036. }
  12037. },
  12038. _childAdded: function(t) {
  12039. t.on(n.SCALE_CHANGED, this._doScaleDirty, this), t.on(n.SIZE_CHANGED, this._doLayoutDirty, this), t.on(n.POSITION_CHANGED, this._doLayoutDirty, this), t.on(n.ANCHOR_CHANGED, this._doLayoutDirty, this), t.on("active-in-hierarchy-changed", this._doLayoutDirty, this), this._doLayoutDirty()
  12040. },
  12041. _childRemoved: function(t) {
  12042. t.off(n.SCALE_CHANGED, this._doScaleDirty, this), t.off(n.SIZE_CHANGED, this._doLayoutDirty, this), t.off(n.POSITION_CHANGED, this._doLayoutDirty, this), t.off(n.ANCHOR_CHANGED, this._doLayoutDirty, this), t.off("active-in-hierarchy-changed", this._doLayoutDirty, this), this._doLayoutDirty()
  12043. },
  12044. _resized: function() {
  12045. this._layoutSize = this.node.getContentSize(), this._doLayoutDirty()
  12046. },
  12047. _doLayoutHorizontally: function(t, e, i, n) {
  12048. var o = this.node.getAnchorPoint(),
  12049. h = this.node.children,
  12050. c = 1,
  12051. u = this.paddingLeft,
  12052. _ = -o.x * t;
  12053. this.horizontalDirection === l.RIGHT_TO_LEFT && (c = -1, _ = (1 - o.x) * t, u = this.paddingRight);
  12054. for (var f = _ + c * u - c * this.spacingX, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, x = 0, b = 0; b < h.length; ++b) {
  12055. (C = h[b]).activeInHierarchy && x++
  12056. }
  12057. var A = this.cellSize.width;
  12058. this.type !== r.GRID && this.resizeMode === s.CHILDREN && (A = (t - (this.paddingLeft + this.paddingRight) - (x - 1) * this.spacingX) / x);
  12059. for (b = 0; b < h.length; ++b) {
  12060. var C = h[b],
  12061. T = this._getUsedScaleValue(C.scaleX),
  12062. S = this._getUsedScaleValue(C.scaleY);
  12063. if (C.activeInHierarchy) {
  12064. this._resize === s.CHILDREN && (C.width = A / T, this.type === r.GRID && (C.height = this.cellSize.height / S));
  12065. var w = C.anchorX,
  12066. E = C.width * T,
  12067. M = C.height * S;
  12068. m > p && (p = m), M >= p && (m = p, p = M, g = C.getAnchorPoint().y), this.horizontalDirection === l.RIGHT_TO_LEFT && (w = 1 - C.anchorX), f = f + c * w * E + c * this.spacingX;
  12069. var D = c * (1 - w) * E;
  12070. if (e) {
  12071. var B = f + D + c * (c > 0 ? this.paddingRight : this.paddingLeft),
  12072. I = this.horizontalDirection === l.LEFT_TO_RIGHT && B > (1 - o.x) * t,
  12073. P = this.horizontalDirection === l.RIGHT_TO_LEFT && B < -o.x * t;
  12074. (I || P) && (M >= p ? (0 === m && (m = p), d += m, m = p) : (d += p, m = M, p = 0), f = _ + c * (u + w * E), y++)
  12075. }
  12076. var R = i(C, d, y);
  12077. t >= E + this.paddingLeft + this.paddingRight && n && C.setPosition(cc.v2(f, R));
  12078. var O, L = 1,
  12079. F = 0 === p ? M : p;
  12080. this.verticalDirection === a.TOP_TO_BOTTOM ? (v = v || this.node._contentSize.height, (O = R + (L = -1) * (F * g + this.paddingBottom)) < v && (v = O)) : (v = v || -this.node._contentSize.height, (O = R + L * (F * g + this.paddingTop)) > v && (v = O)), f += D
  12081. }
  12082. }
  12083. return v
  12084. },
  12085. _getVerticalBaseHeight: function(t) {
  12086. var e = 0,
  12087. i = 0;
  12088. if (this.resizeMode === s.CONTAINER) {
  12089. for (var n = 0; n < t.length; ++n) {
  12090. var r = t[n];
  12091. r.activeInHierarchy && (i++, e += r.height * this._getUsedScaleValue(r.scaleY))
  12092. }
  12093. e += (i - 1) * this.spacingY + this.paddingBottom + this.paddingTop
  12094. } else e = this.node.getContentSize().height;
  12095. return e
  12096. },
  12097. _doLayoutVertically: function(t, e, i, n) {
  12098. var o = this.node.getAnchorPoint(),
  12099. h = this.node.children,
  12100. c = 1,
  12101. u = this.paddingBottom,
  12102. _ = -o.y * t;
  12103. this.verticalDirection === a.TOP_TO_BOTTOM && (c = -1, _ = (1 - o.y) * t, u = this.paddingTop);
  12104. for (var f = _ + c * u - c * this.spacingY, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, x = 0, b = 0; b < h.length; ++b) {
  12105. (C = h[b]).activeInHierarchy && x++
  12106. }
  12107. var A = this.cellSize.height;
  12108. this.type !== r.GRID && this.resizeMode === s.CHILDREN && (A = (t - (this.paddingTop + this.paddingBottom) - (x - 1) * this.spacingY) / x);
  12109. for (b = 0; b < h.length; ++b) {
  12110. var C = h[b],
  12111. T = this._getUsedScaleValue(C.scaleX),
  12112. S = this._getUsedScaleValue(C.scaleY);
  12113. if (C.activeInHierarchy) {
  12114. this.resizeMode === s.CHILDREN && (C.height = A / S, this.type === r.GRID && (C.width = this.cellSize.width / T));
  12115. var w = C.anchorY,
  12116. E = C.width * T,
  12117. M = C.height * S;
  12118. m > p && (p = m), E >= p && (m = p, p = E, g = C.getAnchorPoint().x), this.verticalDirection === a.TOP_TO_BOTTOM && (w = 1 - C.anchorY), f = f + c * w * M + c * this.spacingY;
  12119. var D = c * (1 - w) * M;
  12120. if (e) {
  12121. var B = f + D + c * (c > 0 ? this.paddingTop : this.paddingBottom),
  12122. I = this.verticalDirection === a.BOTTOM_TO_TOP && B > (1 - o.y) * t,
  12123. P = this.verticalDirection === a.TOP_TO_BOTTOM && B < -o.y * t;
  12124. (I || P) && (E >= p ? (0 === m && (m = p), d += m, m = p) : (d += p, m = E, p = 0), f = _ + c * (u + w * M), y++)
  12125. }
  12126. var R = i(C, d, y);
  12127. t >= M + (this.paddingTop + this.paddingBottom) && n && C.setPosition(cc.v2(R, f));
  12128. var O, L = 1,
  12129. F = 0 === p ? E : p;
  12130. this.horizontalDirection === l.RIGHT_TO_LEFT ? (L = -1, v = v || this.node._contentSize.width, (O = R + L * (F * g + this.paddingLeft)) < v && (v = O)) : (v = v || -this.node._contentSize.width, (O = R + L * (F * g + this.paddingRight)) > v && (v = O)), f += D
  12131. }
  12132. }
  12133. return v
  12134. },
  12135. _doLayoutBasic: function() {
  12136. for (var t = this.node.children, e = null, i = 0; i < t.length; ++i) {
  12137. var n = t[i];
  12138. n.activeInHierarchy && (e ? e.union(e, n.getBoundingBoxToWorld()) : e = n.getBoundingBoxToWorld())
  12139. }
  12140. if (e) {
  12141. var r = this.node.convertToNodeSpaceAR(cc.v2(e.x, e.y));
  12142. r = cc.v2(r.x - this.paddingLeft, r.y - this.paddingBottom);
  12143. var s = this.node.convertToNodeSpaceAR(cc.v2(e.xMax, e.yMax)),
  12144. o = (s = cc.v2(s.x + this.paddingRight, s.y + this.paddingTop)).sub(r);
  12145. if (0 !== (o = cc.size(parseFloat(o.x.toFixed(2)), parseFloat(o.y.toFixed(2)))).width) {
  12146. var a = -r.x / o.width;
  12147. this.node.anchorX = parseFloat(a.toFixed(2))
  12148. }
  12149. if (0 !== o.height) {
  12150. var l = -r.y / o.height;
  12151. this.node.anchorY = parseFloat(l.toFixed(2))
  12152. }
  12153. this.node.setContentSize(o)
  12154. }
  12155. },
  12156. _doLayoutGridAxisHorizontal: function(t, e) {
  12157. var i = e.width,
  12158. n = 1,
  12159. r = -t.y * e.height,
  12160. o = this.paddingBottom;
  12161. this.verticalDirection === a.TOP_TO_BOTTOM && (n = -1, r = (1 - t.y) * e.height, o = this.paddingTop);
  12162. var l = function(t, e, i) {
  12163. return r + n * (e + t.anchorY * t.height * this._getUsedScaleValue(t.scaleY) + o + i * this.spacingY)
  12164. }.bind(this),
  12165. h = 0;
  12166. if (this.resizeMode === s.CONTAINER) {
  12167. var c = this._doLayoutHorizontally(i, !0, l, !1);
  12168. (h = r - c) < 0 && (h *= -1), r = -t.y * h, this.verticalDirection === a.TOP_TO_BOTTOM && (n = -1, r = (1 - t.y) * h)
  12169. }
  12170. this._doLayoutHorizontally(i, !0, l, !0), this.resizeMode === s.CONTAINER && this.node.setContentSize(i, h)
  12171. },
  12172. _doLayoutGridAxisVertical: function(t, e) {
  12173. var i = e.height,
  12174. n = 1,
  12175. r = -t.x * e.width,
  12176. o = this.paddingLeft;
  12177. this.horizontalDirection === l.RIGHT_TO_LEFT && (n = -1, r = (1 - t.x) * e.width, o = this.paddingRight);
  12178. var a = function(t, e, i) {
  12179. return r + n * (e + t.anchorX * t.width * this._getUsedScaleValue(t.scaleX) + o + i * this.spacingX)
  12180. }.bind(this),
  12181. h = 0;
  12182. if (this.resizeMode === s.CONTAINER) {
  12183. var c = this._doLayoutVertically(i, !0, a, !1);
  12184. (h = r - c) < 0 && (h *= -1), r = -t.x * h, this.horizontalDirection === l.RIGHT_TO_LEFT && (n = -1, r = (1 - t.x) * h)
  12185. }
  12186. this._doLayoutVertically(i, !0, a, !0), this.resizeMode === s.CONTAINER && this.node.setContentSize(h, i)
  12187. },
  12188. _doLayoutGrid: function() {
  12189. var t = this.node.getAnchorPoint(),
  12190. e = this.node.getContentSize();
  12191. this.startAxis === o.HORIZONTAL ? this._doLayoutGridAxisHorizontal(t, e) : this.startAxis === o.VERTICAL && this._doLayoutGridAxisVertical(t, e)
  12192. },
  12193. _getHorizontalBaseWidth: function(t) {
  12194. var e = 0,
  12195. i = 0;
  12196. if (this.resizeMode === s.CONTAINER) {
  12197. for (var n = 0; n < t.length; ++n) {
  12198. var r = t[n];
  12199. r.activeInHierarchy && (i++, e += r.width * this._getUsedScaleValue(r.scaleX))
  12200. }
  12201. e += (i - 1) * this.spacingX + this.paddingLeft + this.paddingRight
  12202. } else e = this.node.getContentSize().width;
  12203. return e
  12204. },
  12205. _doLayout: function() {
  12206. if (this.type === r.HORIZONTAL) {
  12207. var t = this._getHorizontalBaseWidth(this.node.children);
  12208. this._doLayoutHorizontally(t, !1, (function(t) {
  12209. return t.y
  12210. }), !0), this.node.width = t
  12211. } else if (this.type === r.VERTICAL) {
  12212. var e = this._getVerticalBaseHeight(this.node.children);
  12213. this._doLayoutVertically(e, !1, (function(t) {
  12214. return t.x
  12215. }), !0), this.node.height = e
  12216. } else this.type === r.NONE ? this.resizeMode === s.CONTAINER && this._doLayoutBasic() : this.type === r.GRID && this._doLayoutGrid()
  12217. },
  12218. _getUsedScaleValue: function(t) {
  12219. return this.affectedByScale ? Math.abs(t) : 1
  12220. },
  12221. updateLayout: function() {
  12222. this._layoutDirty && this.node.children.length > 0 && (this._doLayout(), this._layoutDirty = !1)
  12223. }
  12224. });
  12225. Object.defineProperty(h.prototype, "padding", {
  12226. get: function() {
  12227. return cc.warnID(4100), this.paddingLeft
  12228. },
  12229. set: function(t) {
  12230. this._N$padding = t, this._migratePaddingData(), this._doLayoutDirty()
  12231. }
  12232. }), cc.Layout = e.exports = h
  12233. }), {
  12234. "../CCNode": 52,
  12235. "./CCComponent": 95
  12236. }],
  12237. 101: [(function(t, e, i) {
  12238. "use strict";
  12239. var n = (function(t) {
  12240. return t && t.__esModule ? t : {
  12241. default: t
  12242. }
  12243. })(t("../../renderer/gfx")),
  12244. r = t("../vmath");
  12245. var s = t("../utils/misc"),
  12246. o = t("../assets/material/CCMaterial"),
  12247. a = t("./CCRenderComponent"),
  12248. l = t("../renderer/render-flow"),
  12249. h = t("../graphics/graphics"),
  12250. c = t("../CCNode"),
  12251. u = cc.v2(),
  12252. _ = r.mat4.create(),
  12253. f = [];
  12254. function d(t, e, i) {
  12255. f.length = 0;
  12256. for (var n = 2 * Math.PI / i, r = 0; r < i; ++r) f.push(cc.v2(e.x * Math.cos(n * r) + t.x, e.y * Math.sin(n * r) + t.y));
  12257. return f
  12258. }
  12259. var p = cc.Enum({
  12260. RECT: 0,
  12261. ELLIPSE: 1,
  12262. IMAGE_STENCIL: 2
  12263. }),
  12264. m = cc.Class({
  12265. name: "cc.Mask",
  12266. extends: a,
  12267. editor: !1,
  12268. ctor: function() {
  12269. this._graphics = null, this._enableMaterial = null, this._exitMaterial = null, this._clearMaterial = null
  12270. },
  12271. properties: {
  12272. _spriteFrame: {
  12273. default: null,
  12274. type: cc.SpriteFrame
  12275. },
  12276. _type: p.RECT,
  12277. type: {
  12278. get: function() {
  12279. return this._type
  12280. },
  12281. set: function(t) {
  12282. this._type !== t && this._resetAssembler(), this._type = t, this._type !== p.IMAGE_STENCIL && (this.spriteFrame = null, this.alphaThreshold = 0, this._updateGraphics()), this._activateMaterial()
  12283. },
  12284. type: p,
  12285. tooltip: !1
  12286. },
  12287. spriteFrame: {
  12288. type: cc.SpriteFrame,
  12289. tooltip: !1,
  12290. get: function() {
  12291. return this._spriteFrame
  12292. },
  12293. set: function(t) {
  12294. var e = this._spriteFrame;
  12295. e !== t && (this._spriteFrame = t, this._applySpriteFrame(e))
  12296. }
  12297. },
  12298. alphaThreshold: {
  12299. default: .1,
  12300. type: cc.Float,
  12301. range: [0, 1, .1],
  12302. slide: !0,
  12303. tooltip: !1,
  12304. notify: function() {
  12305. if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
  12306. var t = this.sharedMaterials[0];
  12307. t && t.setProperty("alphaThreshold", this.alphaThreshold)
  12308. } else cc.warnID(4201)
  12309. }
  12310. },
  12311. inverted: {
  12312. default: !1,
  12313. type: cc.Boolean,
  12314. tooltip: !1,
  12315. notify: function() {
  12316. cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS || cc.warnID(4202)
  12317. }
  12318. },
  12319. _segments: 64,
  12320. segements: {
  12321. get: function() {
  12322. return this._segments
  12323. },
  12324. set: function(t) {
  12325. this._segments = s.clampf(t, 3, 1e4), this._updateGraphics()
  12326. },
  12327. type: cc.Integer,
  12328. tooltip: !1
  12329. },
  12330. _resizeToTarget: {
  12331. animatable: !1,
  12332. set: function(t) {
  12333. t && this._resizeNodeToTargetNode()
  12334. }
  12335. }
  12336. },
  12337. statics: {
  12338. Type: p
  12339. },
  12340. onLoad: function() {
  12341. this._createGraphics()
  12342. },
  12343. onRestore: function() {
  12344. this._createGraphics(), this._type !== p.IMAGE_STENCIL ? this._updateGraphics() : this._applySpriteFrame()
  12345. },
  12346. onEnable: function() {
  12347. this._super(), this._type === p.IMAGE_STENCIL ? this._spriteFrame && this._spriteFrame.textureLoaded() || (this.markForRender(!1), this._spriteFrame && (this.markForUpdateRenderData(!1), this._spriteFrame.once("load", this._onTextureLoaded, this), this._spriteFrame.ensureLoadTexture())) : this._updateGraphics(), this.node.on(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this), this.node._renderFlag |= l.FLAG_POST_RENDER, this._activateMaterial()
  12348. },
  12349. onDisable: function() {
  12350. this._super(), this.node.off(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this), this.node._renderFlag &= ~l.FLAG_POST_RENDER
  12351. },
  12352. onDestroy: function() {
  12353. this._super(), this._removeGraphics()
  12354. },
  12355. _resizeNodeToTargetNode: !1,
  12356. _onTextureLoaded: function() {
  12357. this.setVertsDirty(), this._assembler && this._assembler._renderData && this.markForUpdateRenderData(!0), this.enabledInHierarchy && this._activateMaterial()
  12358. },
  12359. _applySpriteFrame: function(t) {
  12360. t && t.off && t.off("load", this._onTextureLoaded, this);
  12361. var e = this._spriteFrame;
  12362. e ? e.textureLoaded() ? this._onTextureLoaded(null) : (e.once("load", this._onTextureLoaded, this), e.ensureLoadTexture()) : this.disableRender()
  12363. },
  12364. _activateMaterial: function() {
  12365. if (this._type !== p.IMAGE_STENCIL || this.spriteFrame && this.spriteFrame.textureLoaded()) {
  12366. if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
  12367. var t = this.sharedMaterials[0];
  12368. if ((t = t ? o.getInstantiatedMaterial(t, this) : o.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("USE_ALPHA_TEST", !0), this._type === p.IMAGE_STENCIL) {
  12369. var e = this.spriteFrame.getTexture();
  12370. t.define("CC_USE_MODEL", !1), t.define("USE_TEXTURE", !0), t.setProperty("texture", e), t.setProperty("alphaThreshold", this.alphaThreshold)
  12371. } else t.define("CC_USE_MODEL", !0), t.define("USE_TEXTURE", !1);
  12372. this._enableMaterial || (this._enableMaterial = o.getInstantiatedBuiltinMaterial("2d-sprite", this)), this._exitMaterial || (this._exitMaterial = o.getInstantiatedBuiltinMaterial("2d-sprite", this), this._exitMaterial.effect.setStencilEnabled(n.default.STENCIL_DISABLE)), this._clearMaterial || (this._clearMaterial = o.getInstantiatedBuiltinMaterial("clear-stencil", this)), this.setMaterial(0, t)
  12373. }
  12374. this.markForRender(!0)
  12375. } else this.markForRender(!1)
  12376. },
  12377. _createGraphics: function() {
  12378. this._graphics || (this._graphics = new h, cc.Assembler.init(this._graphics), this._graphics.node = this.node, this._graphics.lineWidth = 0, this._graphics.strokeColor = cc.color(0, 0, 0, 0)), this._clearGraphics || (this._clearGraphics = new h, cc.Assembler.init(this._clearGraphics), this._clearGraphics.node = new c, this._clearGraphics._activateMaterial(), this._clearGraphics.lineWidth = 0, this._clearGraphics.rect(-1, -1, 2, 2), this._clearGraphics.fill())
  12379. },
  12380. _updateGraphics: function() {
  12381. var t = this.node,
  12382. e = this._graphics;
  12383. e.clear(!1);
  12384. var i = t._contentSize.width,
  12385. n = t._contentSize.height,
  12386. r = -i * t._anchorPoint.x,
  12387. s = -n * t._anchorPoint.y;
  12388. if (this._type === p.RECT) e.rect(r, s, i, n);
  12389. else if (this._type === p.ELLIPSE) {
  12390. for (var o = d(cc.v2(r + i / 2, s + n / 2), {
  12391. x: i / 2,
  12392. y: n / 2
  12393. }, this._segments), a = 0; a < o.length; ++a) {
  12394. var l = o[a];
  12395. 0 === a ? e.moveTo(l.x, l.y) : e.lineTo(l.x, l.y)
  12396. }
  12397. e.close()
  12398. }
  12399. cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? e.stroke() : e.fill()
  12400. },
  12401. _removeGraphics: function() {
  12402. this._graphics && (this._graphics.destroy(), this._graphics = null), this._clearGraphics && (this._clearGraphics.destroy(), this._clearGraphics = null)
  12403. },
  12404. _hitTest: function(t) {
  12405. var e = this.node,
  12406. i = e.getContentSize(),
  12407. n = i.width,
  12408. s = i.height,
  12409. o = u;
  12410. if (e._updateWorldMatrix(), !r.mat4.invert(_, e._worldMatrix)) return !1;
  12411. r.vec2.transformMat4(o, t, _), o.x += e._anchorPoint.x * n, o.y += e._anchorPoint.y * s;
  12412. var a = !1;
  12413. if (this.type === p.RECT || this.type === p.IMAGE_STENCIL) a = o.x >= 0 && o.y >= 0 && o.x <= n && o.y <= s;
  12414. else if (this.type === p.ELLIPSE) {
  12415. var l = n / 2,
  12416. h = s / 2,
  12417. c = o.x - .5 * n,
  12418. f = o.y - .5 * s;
  12419. a = c * c / (l * l) + f * f / (h * h) < 1
  12420. }
  12421. return this.inverted && (a = !a), a
  12422. },
  12423. markForUpdateRenderData: function(t) {
  12424. t && this.enabledInHierarchy ? this.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA : t || (this.node._renderFlag &= ~l.FLAG_UPDATE_RENDER_DATA)
  12425. },
  12426. markForRender: function(t) {
  12427. t && this.enabledInHierarchy ? this.node._renderFlag |= l.FLAG_RENDER | l.FLAG_UPDATE_RENDER_DATA | l.FLAG_POST_RENDER : t || (this.node._renderFlag &= ~(l.FLAG_RENDER | l.FLAG_POST_RENDER))
  12428. },
  12429. disableRender: function() {
  12430. this.node._renderFlag &= ~(l.FLAG_RENDER | l.FLAG_UPDATE_RENDER_DATA | l.FLAG_POST_RENDER)
  12431. }
  12432. });
  12433. cc.Mask = e.exports = m
  12434. }), {
  12435. "../../renderer/gfx": 360,
  12436. "../CCNode": 52,
  12437. "../assets/material/CCMaterial": 75,
  12438. "../graphics/graphics": 140,
  12439. "../renderer/render-flow": 248,
  12440. "../utils/misc": 300,
  12441. "../vmath": 326,
  12442. "./CCRenderComponent": 106
  12443. }],
  12444. 102: [(function(t, e, i) {
  12445. "use strict";
  12446. var n = t("../components/CCRenderComponent"),
  12447. r = t("../assets/material/CCMaterial"),
  12448. s = t("../utils/texture-util"),
  12449. o = t("../../core/utils/blend-func"),
  12450. a = cc.Class({
  12451. name: "cc.MotionStreak",
  12452. extends: n,
  12453. mixins: [o],
  12454. editor: !1,
  12455. ctor: function() {
  12456. this._points = []
  12457. },
  12458. properties: {
  12459. preview: {
  12460. default: !1,
  12461. editorOnly: !0,
  12462. notify: !1,
  12463. animatable: !1
  12464. },
  12465. _fadeTime: 1,
  12466. fadeTime: {
  12467. get: function() {
  12468. return this._fadeTime
  12469. },
  12470. set: function(t) {
  12471. this._fadeTime = t, this.reset()
  12472. },
  12473. animatable: !1,
  12474. tooltip: !1
  12475. },
  12476. _minSeg: 1,
  12477. minSeg: {
  12478. get: function() {
  12479. return this._minSeg
  12480. },
  12481. set: function(t) {
  12482. this._minSeg = t
  12483. },
  12484. animatable: !1,
  12485. tooltip: !1
  12486. },
  12487. _stroke: 64,
  12488. stroke: {
  12489. get: function() {
  12490. return this._stroke
  12491. },
  12492. set: function(t) {
  12493. this._stroke = t
  12494. },
  12495. animatable: !1,
  12496. tooltip: !1
  12497. },
  12498. _texture: {
  12499. default: null,
  12500. type: cc.Texture2D
  12501. },
  12502. texture: {
  12503. get: function() {
  12504. return this._texture
  12505. },
  12506. set: function(t) {
  12507. this._texture !== t && (this._texture = t, t && t.loaded ? this._activateMaterial() : (this.disableRender(), this._ensureLoadTexture()))
  12508. },
  12509. type: cc.Texture2D,
  12510. animatable: !1,
  12511. tooltip: !1
  12512. },
  12513. _color: cc.Color.WHITE,
  12514. color: {
  12515. get: function() {
  12516. return this._color
  12517. },
  12518. set: function(t) {
  12519. this._color = t
  12520. },
  12521. type: cc.Color,
  12522. tooltip: !1
  12523. },
  12524. _fastMode: !1,
  12525. fastMode: {
  12526. get: function() {
  12527. return this._fastMode
  12528. },
  12529. set: function(t) {
  12530. this._fastMode = t
  12531. },
  12532. animatable: !1,
  12533. tooltip: !1
  12534. }
  12535. },
  12536. onEnable: function() {
  12537. this._super(), this._texture && this._texture.loaded ? this._activateMaterial() : (this.disableRender(), this._ensureLoadTexture()), this.reset()
  12538. },
  12539. _ensureLoadTexture: function() {
  12540. if (this._texture && !this._texture.loaded) {
  12541. var t = this;
  12542. s.postLoadTexture(this._texture, (function() {
  12543. t._activateMaterial()
  12544. }))
  12545. }
  12546. },
  12547. _activateMaterial: function() {
  12548. if (this._texture && this._texture.loaded) {
  12549. var t = this.sharedMaterials[0];
  12550. (t = t ? r.getInstantiatedMaterial(t, this) : r.getInstantiatedBuiltinMaterial("2d-sprite", this)).setProperty("texture", this._texture), this.setMaterial(0, t), this.markForRender(!0)
  12551. } else this.disableRender()
  12552. },
  12553. onFocusInEditor: !1,
  12554. onLostFocusInEditor: !1,
  12555. reset: function() {
  12556. this._points.length = 0, this._assembler._renderData.clear()
  12557. },
  12558. update: function(t) {
  12559. this._assembler.update(this, t)
  12560. }
  12561. });
  12562. cc.MotionStreak = e.exports = a
  12563. }), {
  12564. "../../core/utils/blend-func": 293,
  12565. "../assets/material/CCMaterial": 75,
  12566. "../components/CCRenderComponent": 106,
  12567. "../utils/texture-util": 308
  12568. }],
  12569. 103: [(function(t, e, i) {
  12570. "use strict";
  12571. var n = cc.Enum({
  12572. Unified: 0,
  12573. Free: 1
  12574. }),
  12575. r = cc.Enum({
  12576. Horizontal: 0,
  12577. Vertical: 1
  12578. }),
  12579. s = cc.Enum({
  12580. PAGE_TURNING: 0
  12581. }),
  12582. o = cc.Class({
  12583. name: "cc.PageView",
  12584. extends: cc.ScrollView,
  12585. editor: !1,
  12586. ctor: function() {
  12587. this._curPageIdx = 0, this._lastPageIdx = 0, this._pages = [], this._initContentPos = cc.v2(), this._scrollCenterOffsetX = [], this._scrollCenterOffsetY = []
  12588. },
  12589. properties: {
  12590. sizeMode: {
  12591. default: n.Unified,
  12592. type: n,
  12593. tooltip: !1,
  12594. notify: function() {
  12595. this._syncSizeMode()
  12596. }
  12597. },
  12598. direction: {
  12599. default: r.Horizontal,
  12600. type: r,
  12601. tooltip: !1,
  12602. notify: function() {
  12603. this._syncScrollDirection()
  12604. }
  12605. },
  12606. scrollThreshold: {
  12607. default: .5,
  12608. type: cc.Float,
  12609. slide: !0,
  12610. range: [0, 1, .01],
  12611. tooltip: !1
  12612. },
  12613. autoPageTurningThreshold: {
  12614. default: 100,
  12615. type: cc.Float,
  12616. tooltip: !1
  12617. },
  12618. pageTurningEventTiming: {
  12619. default: .1,
  12620. type: cc.Float,
  12621. range: [0, 1, .01],
  12622. tooltip: !1
  12623. },
  12624. indicator: {
  12625. default: null,
  12626. type: cc.PageViewIndicator,
  12627. tooltip: !1,
  12628. notify: function() {
  12629. this.indicator && this.indicator.setPageView(this)
  12630. }
  12631. },
  12632. pageTurningSpeed: {
  12633. default: .3,
  12634. type: cc.Float,
  12635. tooltip: !1
  12636. },
  12637. pageEvents: {
  12638. default: [],
  12639. type: cc.Component.EventHandler,
  12640. tooltip: !1
  12641. }
  12642. },
  12643. statics: {
  12644. SizeMode: n,
  12645. Direction: r,
  12646. EventType: s
  12647. },
  12648. __preload: function() {
  12649. this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this)
  12650. },
  12651. onEnable: function() {
  12652. this._super(), this.node.on("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this)
  12653. },
  12654. onDisable: function() {
  12655. this._super(), this.node.off("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this)
  12656. },
  12657. onLoad: function() {
  12658. this._initPages(), this.indicator && this.indicator.setPageView(this)
  12659. },
  12660. onDestroy: function() {
  12661. this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this)
  12662. },
  12663. getCurrentPageIndex: function() {
  12664. return this._curPageIdx
  12665. },
  12666. setCurrentPageIndex: function(t) {
  12667. this.scrollToPage(t, !0)
  12668. },
  12669. getPages: function() {
  12670. return this._pages
  12671. },
  12672. addPage: function(t) {
  12673. t && -1 === this._pages.indexOf(t) && this.content && (this.content.addChild(t), this._pages.push(t), this._updatePageView())
  12674. },
  12675. insertPage: function(t, e) {
  12676. e < 0 || !t || -1 !== this._pages.indexOf(t) || !this.content || (e >= this._pages.length ? this.addPage(t) : (this._pages.splice(e, 0, t), this.content.addChild(t), this._updatePageView()))
  12677. },
  12678. removePage: function(t) {
  12679. if (t && this.content) {
  12680. var e = this._pages.indexOf(t); - 1 !== e ? this.removePageAtIndex(e) : cc.warnID(4300, t.name)
  12681. }
  12682. },
  12683. removePageAtIndex: function(t) {
  12684. var e = this._pages;
  12685. if (!(t < 0 || t >= e.length)) {
  12686. var i = e[t];
  12687. i && (this.content.removeChild(i), e.splice(t, 1), this._updatePageView())
  12688. }
  12689. },
  12690. removeAllPages: function() {
  12691. if (this.content) {
  12692. for (var t = this._pages, e = 0, i = t.length; e < i; e++) this.content.removeChild(t[e]);
  12693. this._pages.length = 0, this._updatePageView()
  12694. }
  12695. },
  12696. scrollToPage: function(t, e) {
  12697. t < 0 || t >= this._pages.length || (e = void 0 !== e ? e : .3, this._curPageIdx = t, this.scrollToOffset(this._moveOffsetValue(t), e, !0), this.indicator && this.indicator._changedState())
  12698. },
  12699. getScrollEndedEventTiming: function() {
  12700. return this.pageTurningEventTiming
  12701. },
  12702. _syncScrollDirection: function() {
  12703. this.horizontal = this.direction === r.Horizontal, this.vertical = this.direction === r.Vertical
  12704. },
  12705. _syncSizeMode: function() {
  12706. if (this.content) {
  12707. var t = this.content.getComponent(cc.Layout);
  12708. if (t) {
  12709. if (this.sizeMode === n.Free && this._pages.length > 0) {
  12710. var e = this._pages[this._pages.length - 1];
  12711. this.direction === r.Horizontal ? (t.paddingLeft = (this._view.width - this._pages[0].width) / 2, t.paddingRight = (this._view.width - e.width) / 2) : this.direction === r.Vertical && (t.paddingTop = (this._view.height - this._pages[0].height) / 2, t.paddingBottom = (this._view.height - e.height) / 2)
  12712. }
  12713. t.updateLayout()
  12714. }
  12715. }
  12716. },
  12717. _updatePageView: function() {
  12718. var t = this.content.getComponent(cc.Layout);
  12719. t && t.enabled && t.updateLayout();
  12720. var e = this._pages.length;
  12721. this._curPageIdx >= e && (this._curPageIdx = 0 === e ? 0 : e - 1, this._lastPageIdx = this._curPageIdx);
  12722. for (var i = this._initContentPos, n = 0; n < e; ++n) {
  12723. var s = this._pages[n];
  12724. s.setSiblingIndex(n), this.direction === r.Horizontal ? this._scrollCenterOffsetX[n] = Math.abs(i.x + s.x) : this._scrollCenterOffsetY[n] = Math.abs(i.y + s.y)
  12725. }
  12726. this.indicator && this.indicator._refresh()
  12727. },
  12728. _updateAllPagesSize: function() {
  12729. if (this.sizeMode === n.Unified)
  12730. for (var t = this._pages, e = this._view.getContentSize(), i = 0, r = t.length; i < r; i++) t[i].setContentSize(e)
  12731. },
  12732. _initPages: function() {
  12733. if (this.content) {
  12734. this._initContentPos = this.content.position;
  12735. for (var t = this.content.children, e = 0; e < t.length; ++e) {
  12736. var i = t[e];
  12737. this._pages.indexOf(i) >= 0 || this._pages.push(i)
  12738. }
  12739. this._syncScrollDirection(), this._syncSizeMode(), this._updatePageView()
  12740. }
  12741. },
  12742. _dispatchPageTurningEvent: function() {
  12743. this._lastPageIdx !== this._curPageIdx && (this._lastPageIdx = this._curPageIdx, cc.Component.EventHandler.emitEvents(this.pageEvents, this, s.PAGE_TURNING), this.node.emit("page-turning", this))
  12744. },
  12745. _isScrollable: function(t, e, i) {
  12746. if (this.sizeMode === n.Free) {
  12747. var s, o;
  12748. if (this.direction === r.Horizontal) return s = this._scrollCenterOffsetX[e], o = this._scrollCenterOffsetX[i], Math.abs(t.x) >= Math.abs(s - o) * this.scrollThreshold;
  12749. if (this.direction === r.Vertical) return s = this._scrollCenterOffsetY[e], o = this._scrollCenterOffsetY[i], Math.abs(t.y) >= Math.abs(s - o) * this.scrollThreshold
  12750. } else {
  12751. if (this.direction === r.Horizontal) return Math.abs(t.x) >= this._view.width * this.scrollThreshold;
  12752. if (this.direction === r.Vertical) return Math.abs(t.y) >= this._view.height * this.scrollThreshold
  12753. }
  12754. },
  12755. _isQuicklyScrollable: function(t) {
  12756. if (this.direction === r.Horizontal) {
  12757. if (Math.abs(t.x) > this.autoPageTurningThreshold) return !0
  12758. } else if (this.direction === r.Vertical && Math.abs(t.y) > this.autoPageTurningThreshold) return !0;
  12759. return !1
  12760. },
  12761. _moveOffsetValue: function(t) {
  12762. var e = cc.v2(0, 0);
  12763. return this.sizeMode === n.Free ? this.direction === r.Horizontal ? e.x = this._scrollCenterOffsetX[t] : this.direction === r.Vertical && (e.y = this._scrollCenterOffsetY[t]) : this.direction === r.Horizontal ? e.x = t * this._view.width : this.direction === r.Vertical && (e.y = t * this._view.height), e
  12764. },
  12765. _getDragDirection: function(t) {
  12766. return this.direction === r.Horizontal ? 0 === t.x ? 0 : t.x > 0 ? 1 : -1 : this.direction === r.Vertical ? 0 === t.y ? 0 : t.y < 0 ? 1 : -1 : void 0
  12767. },
  12768. _handleReleaseLogic: function(t) {
  12769. this._autoScrollToPage(), this._scrolling && (this._scrolling = !1, this._autoScrolling || this._dispatchEvent("scroll-ended"))
  12770. },
  12771. _autoScrollToPage: function() {
  12772. var t = this._startBounceBackIfNeeded(),
  12773. e = this._touchBeganPosition.sub(this._touchEndPosition);
  12774. if (t) {
  12775. var i = this._getDragDirection(e);
  12776. if (0 === i) return;
  12777. this._curPageIdx = i > 0 ? this._pages.length - 1 : 0, this.indicator && this.indicator._changedState()
  12778. } else {
  12779. var n = this._curPageIdx,
  12780. r = n + this._getDragDirection(e),
  12781. s = this.pageTurningSpeed * Math.abs(n - r);
  12782. if (r < this._pages.length) {
  12783. if (this._isScrollable(e, n, r)) return void this.scrollToPage(r, s);
  12784. var o = this._calculateTouchMoveVelocity();
  12785. if (this._isQuicklyScrollable(o)) return void this.scrollToPage(r, s)
  12786. }
  12787. this.scrollToPage(n, s)
  12788. }
  12789. },
  12790. _onTouchBegan: function(t, e) {
  12791. this._touchBeganPosition = t.touch.getLocation(), this._super(t, e)
  12792. },
  12793. _onTouchMoved: function(t, e) {
  12794. this._super(t, e)
  12795. },
  12796. _onTouchEnded: function(t, e) {
  12797. this._touchEndPosition = t.touch.getLocation(), this._super(t, e)
  12798. },
  12799. _onTouchCancelled: function(t, e) {
  12800. this._touchEndPosition = t.touch.getLocation(), this._super(t, e)
  12801. },
  12802. _onMouseWheel: function() {}
  12803. });
  12804. cc.PageView = e.exports = o
  12805. }), {}],
  12806. 104: [(function(t, e, i) {
  12807. "use strict";
  12808. var n = cc.Enum({
  12809. HORIZONTAL: 0,
  12810. VERTICAL: 1
  12811. }),
  12812. r = cc.Class({
  12813. name: "cc.PageViewIndicator",
  12814. extends: t("./CCComponent"),
  12815. editor: !1,
  12816. properties: {
  12817. _layout: null,
  12818. _pageView: null,
  12819. _indicators: [],
  12820. spriteFrame: {
  12821. default: null,
  12822. type: cc.SpriteFrame,
  12823. tooltip: !1
  12824. },
  12825. direction: {
  12826. default: n.HORIZONTAL,
  12827. type: n,
  12828. tooltip: !1
  12829. },
  12830. cellSize: {
  12831. default: cc.size(20, 20),
  12832. tooltip: !1
  12833. },
  12834. spacing: {
  12835. default: 0,
  12836. tooltip: !1
  12837. }
  12838. },
  12839. statics: {
  12840. Direction: n
  12841. },
  12842. onLoad: function() {
  12843. this._updateLayout()
  12844. },
  12845. setPageView: function(t) {
  12846. this._pageView = t, this._refresh()
  12847. },
  12848. _updateLayout: function() {
  12849. this._layout = this.getComponent(cc.Layout), this._layout || (this._layout = this.addComponent(cc.Layout)), this.direction === n.HORIZONTAL ? (this._layout.type = cc.Layout.Type.HORIZONTAL, this._layout.spacingX = this.spacing) : this.direction === n.VERTICAL && (this._layout.type = cc.Layout.Type.VERTICAL, this._layout.spacingY = this.spacing), this._layout.resizeMode = cc.Layout.ResizeMode.CONTAINER
  12850. },
  12851. _createIndicator: function() {
  12852. var t = new cc.Node;
  12853. return t.addComponent(cc.Sprite).spriteFrame = this.spriteFrame, t.parent = this.node, t.width = this.cellSize.width, t.height = this.cellSize.height, t
  12854. },
  12855. _changedState: function() {
  12856. var t = this._indicators;
  12857. if (0 !== t.length) {
  12858. var e = this._pageView._curPageIdx;
  12859. if (!(e >= t.length)) {
  12860. for (var i = 0; i < t.length; ++i) {
  12861. t[i].opacity = 127.5
  12862. }
  12863. t[e].opacity = 255
  12864. }
  12865. }
  12866. },
  12867. _refresh: function() {
  12868. if (this._pageView) {
  12869. var t = this._indicators,
  12870. e = this._pageView.getPages();
  12871. if (e.length !== t.length) {
  12872. var i = 0;
  12873. if (e.length > t.length)
  12874. for (i = 0; i < e.length; ++i) t[i] || (t[i] = this._createIndicator());
  12875. else
  12876. for (i = t.length - e.length; i > 0; --i) {
  12877. var n = t[i - 1];
  12878. this.node.removeChild(n), t.splice(i - 1, 1)
  12879. }
  12880. this._layout && this._layout.enabledInHierarchy && this._layout.updateLayout(), this._changedState()
  12881. }
  12882. }
  12883. }
  12884. });
  12885. cc.PageViewIndicator = e.exports = r
  12886. }), {
  12887. "./CCComponent": 95
  12888. }],
  12889. 105: [(function(t, e, i) {
  12890. "use strict";
  12891. var n = t("../utils/misc"),
  12892. r = t("./CCComponent"),
  12893. s = cc.Enum({
  12894. HORIZONTAL: 0,
  12895. VERTICAL: 1,
  12896. FILLED: 2
  12897. }),
  12898. o = cc.Class({
  12899. name: "cc.ProgressBar",
  12900. extends: r,
  12901. editor: !1,
  12902. _initBarSprite: function() {
  12903. if (this.barSprite) {
  12904. var t = this.barSprite.node;
  12905. if (!t) return;
  12906. var e = this.node.getContentSize(),
  12907. i = this.node.getAnchorPoint(),
  12908. n = t.getContentSize();
  12909. t.parent === this.node && this.node.setContentSize(n), this.barSprite.fillType === cc.Sprite.FillType.RADIAL && (this.mode = s.FILLED);
  12910. var r = t.getContentSize();
  12911. if (this.mode === s.HORIZONTAL ? this.totalLength = r.width : this.mode === s.VERTICAL ? this.totalLength = r.height : this.totalLength = this.barSprite.fillRange, t.parent === this.node) {
  12912. var o = -e.width * i.x;
  12913. t.setPosition(cc.v2(o, 0))
  12914. }
  12915. }
  12916. },
  12917. _updateBarStatus: function() {
  12918. if (this.barSprite) {
  12919. var t = this.barSprite.node;
  12920. if (!t) return;
  12921. var e, i, r, o = t.getAnchorPoint(),
  12922. a = t.getContentSize(),
  12923. l = t.getPosition(),
  12924. h = cc.v2(0, .5),
  12925. c = n.clamp01(this.progress),
  12926. u = this.totalLength * c;
  12927. switch (this.mode) {
  12928. case s.HORIZONTAL:
  12929. this.reverse && (h = cc.v2(1, .5)), e = cc.size(u, a.height), i = this.totalLength, r = a.height;
  12930. break;
  12931. case s.VERTICAL:
  12932. h = this.reverse ? cc.v2(.5, 1) : cc.v2(.5, 0), e = cc.size(a.width, u), i = a.width, r = this.totalLength
  12933. }
  12934. if (this.mode === s.FILLED) this.barSprite.type !== cc.Sprite.Type.FILLED ? cc.warn("ProgressBar FILLED mode only works when barSprite's Type is FILLED!") : (this.reverse && (u *= -1), this.barSprite.fillRange = u);
  12935. else if (this.barSprite.type !== cc.Sprite.Type.FILLED) {
  12936. var _ = h.x - o.x,
  12937. f = h.y - o.y,
  12938. d = cc.v2(i * _, r * f);
  12939. t.setPosition(l.x + d.x, l.y + d.y), t.setAnchorPoint(h), t.setContentSize(e)
  12940. } else cc.warn("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")
  12941. }
  12942. },
  12943. properties: {
  12944. barSprite: {
  12945. default: null,
  12946. type: cc.Sprite,
  12947. tooltip: !1,
  12948. notify: function() {
  12949. this._initBarSprite()
  12950. },
  12951. animatable: !1
  12952. },
  12953. mode: {
  12954. default: s.HORIZONTAL,
  12955. type: s,
  12956. tooltip: !1,
  12957. notify: function() {
  12958. if (this.barSprite) {
  12959. var t = this.barSprite.node;
  12960. if (!t) return;
  12961. var e = t.getContentSize();
  12962. this.mode === s.HORIZONTAL ? this.totalLength = e.width : this.mode === s.VERTICAL ? this.totalLength = e.height : this.mode === s.FILLED && (this.totalLength = this.barSprite.fillRange)
  12963. }
  12964. },
  12965. animatable: !1
  12966. },
  12967. _N$totalLength: 1,
  12968. totalLength: {
  12969. range: [0, Number.MAX_VALUE],
  12970. tooltip: !1,
  12971. get: function() {
  12972. return this._N$totalLength
  12973. },
  12974. set: function(t) {
  12975. this.mode === s.FILLED && (t = n.clamp01(t)), this._N$totalLength = t, this._updateBarStatus()
  12976. }
  12977. },
  12978. progress: {
  12979. default: 1,
  12980. type: cc.Float,
  12981. range: [0, 1, .1],
  12982. slide: !0,
  12983. tooltip: !1,
  12984. notify: function() {
  12985. this._updateBarStatus()
  12986. }
  12987. },
  12988. reverse: {
  12989. default: !1,
  12990. tooltip: !1,
  12991. notify: function() {
  12992. this.barSprite && (this.barSprite.fillStart = 1 - this.barSprite.fillStart), this._updateBarStatus()
  12993. },
  12994. animatable: !1
  12995. }
  12996. },
  12997. statics: {
  12998. Mode: s
  12999. }
  13000. });
  13001. cc.ProgressBar = e.exports = o
  13002. }), {
  13003. "../utils/misc": 300,
  13004. "./CCComponent": 95
  13005. }],
  13006. 106: [(function(t, e, i) {
  13007. "use strict";
  13008. var n = (function(t) {
  13009. return t && t.__esModule ? t : {
  13010. default: t
  13011. }
  13012. })(t("../renderer/assembler"));
  13013. var r = t("./CCComponent"),
  13014. s = t("../renderer/render-flow"),
  13015. o = t("../assets/material/CCMaterial"),
  13016. a = cc.Class({
  13017. name: "RenderComponent",
  13018. extends: r,
  13019. editor: !1,
  13020. properties: {
  13021. _materials: {
  13022. default: [],
  13023. type: o
  13024. },
  13025. sharedMaterials: {
  13026. get: function() {
  13027. return this._materials
  13028. },
  13029. set: function(t) {
  13030. this._materials = t, this._activateMaterial(!0)
  13031. },
  13032. type: [o],
  13033. displayName: "Materials",
  13034. animatable: !1
  13035. }
  13036. },
  13037. ctor: function() {
  13038. this._vertsDirty = !0, this._material = null, this._assembler = null
  13039. },
  13040. _resetAssembler: function() {
  13041. this.setVertsDirty(!0), n.default.init(this), this._updateColor()
  13042. },
  13043. __preload: function() {
  13044. this._resetAssembler()
  13045. },
  13046. onEnable: function() {
  13047. this.node._renderComponent && (this.node._renderComponent.enabled = !1), this.node._renderComponent = this, this.node.on(cc.Node.EventType.SIZE_CHANGED, this._onNodeSizeDirty, this), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._onNodeSizeDirty, this), this.node._renderFlag |= s.FLAG_RENDER | s.FLAG_UPDATE_RENDER_DATA | s.FLAG_OPACITY_COLOR
  13048. },
  13049. onDisable: function() {
  13050. this.node._renderComponent = null, this.node.off(cc.Node.EventType.SIZE_CHANGED, this._onNodeSizeDirty, this), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._onNodeSizeDirty, this), this.disableRender()
  13051. },
  13052. onDestroy: function() {
  13053. for (var t = this._materials, e = 0; e < t.length; e++) cc.pool.material.put(t[e]);
  13054. t.length = 0, cc.pool.assembler.put(this._assembler)
  13055. },
  13056. setVertsDirty: function() {
  13057. this._vertsDirty = !0, this.markForUpdateRenderData(!0)
  13058. },
  13059. _onNodeSizeDirty: function() {
  13060. this.setVertsDirty()
  13061. },
  13062. _on3DNodeChanged: function() {
  13063. this.setVertsDirty()
  13064. },
  13065. _canRender: function() {
  13066. return this._enabled && this.node._activeInHierarchy
  13067. },
  13068. markForUpdateRenderData: function(t) {
  13069. t && this._canRender() ? this.node._renderFlag |= s.FLAG_UPDATE_RENDER_DATA : t || (this.node._renderFlag &= ~s.FLAG_UPDATE_RENDER_DATA)
  13070. },
  13071. markForRender: function(t) {
  13072. t && this._canRender() ? this.node._renderFlag |= s.FLAG_RENDER : t || (this.node._renderFlag &= ~s.FLAG_RENDER)
  13073. },
  13074. disableRender: function() {
  13075. this.node._renderFlag &= ~(s.FLAG_RENDER | s.FLAG_UPDATE_RENDER_DATA)
  13076. },
  13077. getMaterial: function(t) {
  13078. if (t < 0 || t >= this._materials.length) return null;
  13079. var e = this._materials[t];
  13080. if (!e) return null;
  13081. var i = o.getInstantiatedMaterial(e, this);
  13082. return i !== e && this.setMaterial(t, i), this._materials[t]
  13083. },
  13084. setMaterial: function(t, e) {
  13085. this._materials[t] = e, e && this.markForUpdateRenderData(!0)
  13086. },
  13087. _activateMaterial: function(t) {},
  13088. _updateColor: function() {
  13089. this._assembler.updateColor && this._assembler.updateColor(this)
  13090. },
  13091. _checkBacth: function(t, e) {
  13092. var i = this.sharedMaterials[0];
  13093. (i && i.getHash() !== t.material.getHash() || t.cullingMask !== e) && (t._flush(), t.node = i.getDefine("CC_USE_MODEL") ? this.node : t._dummyNode, t.material = i, t.cullingMask = e)
  13094. }
  13095. });
  13096. cc.RenderComponent = e.exports = a
  13097. }), {
  13098. "../assets/material/CCMaterial": 75,
  13099. "../renderer/assembler": 227,
  13100. "../renderer/render-flow": 248,
  13101. "./CCComponent": 95
  13102. }],
  13103. 107: [(function(t, e, i) {
  13104. "use strict";
  13105. var n = t("../platform/js"),
  13106. r = t("../platform/CCMacro"),
  13107. s = t("../utils/text-utils"),
  13108. o = new(t("../utils/html-text-parser")),
  13109. a = r.TextAlignment,
  13110. l = r.VerticalTextAlignment;
  13111. var h = new n.Pool(function(t) {
  13112. if (!cc.isValid(t)) return !1;
  13113. var e = t.getComponent(cc.LabelOutline);
  13114. return e && (e.width = 0), !0
  13115. }, 20);
  13116. h.get = function(t, e) {
  13117. var i = this._get();
  13118. i || (i = new cc.PrivateNode("RICHTEXT_CHILD"));
  13119. var n = i.getComponent(cc.Label);
  13120. return n || (n = i.addComponent(cc.Label)), i.setPosition(0, 0), i.setAnchorPoint(.5, .5), i.setContentSize(128, 128), i.skewX = 0, "string" != typeof t && (t = "" + t), e.font instanceof cc.Font ? n.font = e.font : n.fontFamily = e.fontFamily, n.string = t, n.horizontalAlign = a.LEFT, n.verticalAlign = l.TOP, n.fontSize = e.fontSize || 40, n.overflow = 0, n.enableWrapText = !0, n.lineHeight = 40, n._enableBold(!1), n._enableItalics(!1), n._enableUnderline(!1), i
  13121. };
  13122. var c = cc.Class({
  13123. name: "cc.RichText",
  13124. extends: cc.Component,
  13125. ctor: function() {
  13126. this._textArray = null, this._labelSegments = [], this._labelSegmentsCache = [], this._linesWidth = [], this._updateRichTextStatus = this._updateRichText
  13127. },
  13128. editor: !1,
  13129. properties: {
  13130. string: {
  13131. default: "<color=#00ff00>Rich</c><color=#0fffff>Text</color>",
  13132. multiline: !0,
  13133. tooltip: !1,
  13134. notify: function() {
  13135. this._updateRichTextStatus()
  13136. }
  13137. },
  13138. horizontalAlign: {
  13139. default: a.LEFT,
  13140. type: a,
  13141. tooltip: !1,
  13142. animatable: !1,
  13143. notify: function(t) {
  13144. this.horizontalAlign !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
  13145. }
  13146. },
  13147. fontSize: {
  13148. default: 40,
  13149. tooltip: !1,
  13150. notify: function(t) {
  13151. this.fontSize !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
  13152. }
  13153. },
  13154. _fontFamily: "Arial",
  13155. fontFamily: {
  13156. tooltip: !1,
  13157. get: function() {
  13158. return this._fontFamily
  13159. },
  13160. set: function(t) {
  13161. this._fontFamily !== t && (this._fontFamily = t, this._layoutDirty = !0, this._updateRichTextStatus())
  13162. },
  13163. animatable: !1
  13164. },
  13165. font: {
  13166. default: null,
  13167. type: cc.TTFFont,
  13168. tooltip: !1,
  13169. notify: function(t) {
  13170. this.font !== t && (this._layoutDirty = !0, this.font ? (this.useSystemFont = !1, this._onTTFLoaded()) : this.useSystemFont = !0, this._updateRichTextStatus())
  13171. }
  13172. },
  13173. _isSystemFontUsed: !0,
  13174. useSystemFont: {
  13175. get: function() {
  13176. return this._isSystemFontUsed
  13177. },
  13178. set: function(t) {
  13179. this._isSystemFontUsed !== t && (this._isSystemFontUsed = t, this._layoutDirty = !0, this._updateRichTextStatus())
  13180. },
  13181. animatable: !1,
  13182. tooltip: !1
  13183. },
  13184. maxWidth: {
  13185. default: 0,
  13186. tooltip: !1,
  13187. notify: function(t) {
  13188. this.maxWidth !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
  13189. }
  13190. },
  13191. lineHeight: {
  13192. default: 40,
  13193. tooltip: !1,
  13194. notify: function(t) {
  13195. this.lineHeight !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
  13196. }
  13197. },
  13198. imageAtlas: {
  13199. default: null,
  13200. type: cc.SpriteAtlas,
  13201. tooltip: !1,
  13202. notify: function(t) {
  13203. this.imageAtlas !== t && (this._layoutDirty = !0, this._updateRichTextStatus())
  13204. }
  13205. },
  13206. handleTouchEvent: {
  13207. default: !0,
  13208. tooltip: !1,
  13209. notify: function(t) {
  13210. this.handleTouchEvent !== t && this.enabledInHierarchy && (this.handleTouchEvent ? this._addEventListeners() : this._removeEventListeners())
  13211. }
  13212. }
  13213. },
  13214. statics: {
  13215. HorizontalAlign: a,
  13216. VerticalAlign: l
  13217. },
  13218. onEnable: function() {
  13219. this.handleTouchEvent && this._addEventListeners(), this._updateRichText(), this._activateChildren(!0)
  13220. },
  13221. onDisable: function() {
  13222. this.handleTouchEvent && this._removeEventListeners(), this._activateChildren(!1)
  13223. },
  13224. start: function() {
  13225. this._onTTFLoaded()
  13226. },
  13227. _onColorChanged: function(t) {
  13228. this.node.children.forEach((function(e) {
  13229. e.color = t
  13230. }))
  13231. },
  13232. _addEventListeners: function() {
  13233. this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.on(cc.Node.EventType.COLOR_CHANGED, this._onColorChanged, this)
  13234. },
  13235. _removeEventListeners: function() {
  13236. this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.off(cc.Node.EventType.COLOR_CHANGED, this._onColorChanged, this)
  13237. },
  13238. _updateLabelSegmentTextAttributes: function() {
  13239. this._labelSegments.forEach(function(t) {
  13240. this._applyTextAttribute(t)
  13241. }.bind(this))
  13242. },
  13243. _createFontLabel: function(t) {
  13244. return h.get(t, this)
  13245. },
  13246. _onTTFLoaded: function() {
  13247. if (this.font instanceof cc.TTFFont)
  13248. if (this.font._nativeAsset) this._layoutDirty = !0, this._updateRichText();
  13249. else {
  13250. var t = this;
  13251. cc.loader.load(this.font.nativeUrl, (function(e, i) {
  13252. t._layoutDirty = !0, t._updateRichText()
  13253. }))
  13254. }
  13255. else this._layoutDirty = !0, this._updateRichText()
  13256. },
  13257. _measureText: function(t, e) {
  13258. var i = this,
  13259. n = function(e) {
  13260. var n = void 0;
  13261. return 0 === i._labelSegmentsCache.length ? (n = i._createFontLabel(e), i._labelSegmentsCache.push(n)) : (n = i._labelSegmentsCache[0]).getComponent(cc.Label).string = e, n._styleIndex = t, i._applyTextAttribute(n), n.getContentSize().width
  13262. };
  13263. return e ? n(e) : n
  13264. },
  13265. _onTouchEnded: function(t) {
  13266. for (var e = this, i = this.node.getComponents(cc.Component), n = function(n) {
  13267. var r = e._labelSegments[n],
  13268. s = r._clickHandler,
  13269. o = r._clickParam;
  13270. s && e._containsTouchLocation(r, t.touch.getLocation()) && (i.forEach((function(e) {
  13271. e.enabledInHierarchy && e[s] && e[s](t, o)
  13272. })), t.stopPropagation())
  13273. }, r = 0; r < this._labelSegments.length; ++r) n(r)
  13274. },
  13275. _containsTouchLocation: function(t, e) {
  13276. return t.getBoundingBoxToWorld().contains(e)
  13277. },
  13278. _resetState: function() {
  13279. for (var t = this.node.children, e = t.length - 1; e >= 0; e--) {
  13280. var i = t[e];
  13281. "RICHTEXT_CHILD" !== i.name && "RICHTEXT_Image_CHILD" !== i.name || (i.parent === this.node ? i.parent = null : t.splice(e, 1), "RICHTEXT_CHILD" === i.name && h.put(i))
  13282. }
  13283. this._labelSegments.length = 0, this._labelSegmentsCache.length = 0, this._linesWidth.length = 0, this._lineOffsetX = 0, this._lineCount = 1, this._labelWidth = 0, this._labelHeight = 0, this._layoutDirty = !0
  13284. },
  13285. onRestore: !1,
  13286. _activateChildren: function(t) {
  13287. for (var e = this.node.children.length - 1; e >= 0; e--) {
  13288. var i = this.node.children[e];
  13289. "RICHTEXT_CHILD" !== i.name && "RICHTEXT_Image_CHILD" !== i.name || (i.active = t)
  13290. }
  13291. },
  13292. _addLabelSegment: function(t, e) {
  13293. var i = void 0;
  13294. return 0 === this._labelSegmentsCache.length ? i = this._createFontLabel(t) : (i = this._labelSegmentsCache.pop()).getComponent(cc.Label).string = t, i._styleIndex = e, i._lineCount = this._lineCount, i.active = this.node.active, i.setAnchorPoint(0, 0), this._applyTextAttribute(i), this.node.addChild(i), this._labelSegments.push(i), i
  13295. },
  13296. _updateRichTextWithMaxWidth: function(t, e, i) {
  13297. var n = e;
  13298. if (this._lineOffsetX > 0 && n + this._lineOffsetX > this.maxWidth)
  13299. for (var r = 0; this._lineOffsetX <= this.maxWidth;) {
  13300. var o = this._getFirstWordLen(t, r, t.length),
  13301. a = t.substr(r, o),
  13302. l = this._measureText(i, a);
  13303. if (!(this._lineOffsetX + l <= this.maxWidth)) {
  13304. if (r > 0) {
  13305. var h = t.substr(0, r);
  13306. this._addLabelSegment(h, i), t = t.substr(r, t.length), n = this._measureText(i, t)
  13307. }
  13308. this._updateLineInfo();
  13309. break
  13310. }
  13311. this._lineOffsetX += l, r += o
  13312. }
  13313. if (n > this.maxWidth)
  13314. for (var c = s.fragmentText(t, n, this.maxWidth, this._measureText(i)), u = 0; u < c.length; ++u) {
  13315. var _ = c[u],
  13316. f = this._addLabelSegment(_, i).getContentSize();
  13317. this._lineOffsetX += f.width, c.length > 1 && u < c.length - 1 && this._updateLineInfo()
  13318. } else this._lineOffsetX += n, this._addLabelSegment(t, i)
  13319. },
  13320. _isLastComponentCR: function(t) {
  13321. return t.length - 1 === t.lastIndexOf("\n")
  13322. },
  13323. _updateLineInfo: function() {
  13324. this._linesWidth.push(this._lineOffsetX), this._lineOffsetX = 0, this._lineCount++
  13325. },
  13326. _needsUpdateTextLayout: function(t) {
  13327. if (this._layoutDirty || !this._textArray || !t) return !0;
  13328. if (this._textArray.length !== t.length) return !0;
  13329. for (var e = 0; e < this._textArray.length; ++e) {
  13330. var i = this._textArray[e],
  13331. n = t[e];
  13332. if (i.text !== n.text) return !0;
  13333. if (i.style) {
  13334. if (n.style) {
  13335. if (!!n.style.outline != !!i.style.outline) return !0;
  13336. if (i.style.size !== n.style.size || i.style.italic !== n.style.italic || i.style.isImage !== n.style.isImage) return !0;
  13337. if (i.style.isImage === n.style.isImage && i.style.src !== n.style.src) return !0
  13338. } else if (i.style.size || i.style.italic || i.style.isImage || i.style.outline) return !0
  13339. } else if (n.style && (n.style.size || n.style.italic || n.style.isImage || n.style.outline)) return !0
  13340. }
  13341. return !1
  13342. },
  13343. _addRichTextImageElement: function(t) {
  13344. var e = t.style.src,
  13345. i = this.imageAtlas.getSpriteFrame(e);
  13346. if (i) {
  13347. var n = new cc.PrivateNode("RICHTEXT_Image_CHILD"),
  13348. r = n.addComponent(cc.Sprite);
  13349. n.setAnchorPoint(0, 0), r.type = cc.Sprite.Type.SLICED, r.sizeMode = cc.Sprite.SizeMode.CUSTOM, this.node.addChild(n), this._labelSegments.push(n);
  13350. var s = i.getRect(),
  13351. o = 1,
  13352. a = s.width,
  13353. l = s.height,
  13354. h = t.style.imageWidth,
  13355. c = t.style.imageHeight;
  13356. c > 0 && c < this.lineHeight ? (a *= o = c / l, l *= o) : (a *= o = this.lineHeight / l, l *= o), h > 0 && (a = h), this.maxWidth > 0 ? (this._lineOffsetX + a > this.maxWidth && this._updateLineInfo(), this._lineOffsetX += a) : (this._lineOffsetX += a, this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX)), r.spriteFrame = i, n.setContentSize(a, l), n._lineCount = this._lineCount, t.style.event ? (t.style.event.click && (n._clickHandler = t.style.event.click), t.style.event.param ? n._clickParam = t.style.event.param : n._clickParam = "") : n._clickHandler = null
  13357. } else cc.warnID(4400)
  13358. },
  13359. _updateRichText: function() {
  13360. if (this.enabled) {
  13361. var t = o.parse(this.string);
  13362. if (!this._needsUpdateTextLayout(t)) return this._textArray = t, void this._updateLabelSegmentTextAttributes();
  13363. this._textArray = t, this._resetState();
  13364. for (var e = !1, i = void 0, n = 0; n < this._textArray.length; ++n) {
  13365. var r = this._textArray[n],
  13366. a = r.text;
  13367. if ("" === a) {
  13368. if (r.style && r.style.newline) {
  13369. this._updateLineInfo();
  13370. continue
  13371. }
  13372. if (r.style && r.style.isImage && this.imageAtlas) {
  13373. this._addRichTextImageElement(r);
  13374. continue
  13375. }
  13376. }
  13377. for (var l = a.split("\n"), h = 0; h < l.length; ++h) {
  13378. var c = l[h];
  13379. if ("" !== c)
  13380. if (e = !1, this.maxWidth > 0) {
  13381. var u = this._measureText(n, c);
  13382. this._updateRichTextWithMaxWidth(c, u, n), l.length > 1 && h < l.length - 1 && this._updateLineInfo()
  13383. } else i = this._addLabelSegment(c, n).getContentSize(), this._lineOffsetX += i.width, this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX), l.length > 1 && h < l.length - 1 && this._updateLineInfo();
  13384. else {
  13385. if (this._isLastComponentCR(a) && h === l.length - 1) continue;
  13386. this._updateLineInfo(), e = !0
  13387. }
  13388. }
  13389. }
  13390. e || this._linesWidth.push(this._lineOffsetX), this.maxWidth > 0 && (this._labelWidth = this.maxWidth), this._labelHeight = (this._lineCount + s.BASELINE_RATIO) * this.lineHeight, this.node.setContentSize(this._labelWidth, this._labelHeight), this._updateRichTextPosition(), this._layoutDirty = !1
  13391. }
  13392. },
  13393. _getFirstWordLen: function(t, e, i) {
  13394. var n = t.charAt(e);
  13395. if (s.isUnicodeCJK(n) || s.isUnicodeSpace(n)) return 1;
  13396. for (var r = 1, o = e + 1; o < i && (n = t.charAt(o), !s.isUnicodeSpace(n) && !s.isUnicodeCJK(n)); ++o) r++;
  13397. return r
  13398. },
  13399. _updateRichTextPosition: function() {
  13400. for (var t = 0, e = 1, i = this._lineCount, n = 0; n < this._labelSegments.length; ++n) {
  13401. var r = this._labelSegments[n],
  13402. s = r._lineCount;
  13403. s > e && (t = 0, e = s);
  13404. var o = 0;
  13405. switch (this.horizontalAlign) {
  13406. case a.LEFT:
  13407. o = -this._labelWidth / 2;
  13408. break;
  13409. case a.CENTER:
  13410. o = -this._linesWidth[s - 1] / 2;
  13411. break;
  13412. case a.RIGHT:
  13413. o = this._labelWidth / 2 - this._linesWidth[s - 1]
  13414. }
  13415. r.x = t + o;
  13416. var l = r.getContentSize();
  13417. r.y = this.lineHeight * (i - s) - this._labelHeight / 2, s === e && (t += l.width)
  13418. }
  13419. },
  13420. _convertLiteralColorValue: function(t) {
  13421. var e = t.toUpperCase();
  13422. return cc.Color[e] ? cc.Color[e] : cc.color().fromHEX(t)
  13423. },
  13424. _applyTextAttribute: function(t) {
  13425. var e = t.getComponent(cc.Label);
  13426. if (e) {
  13427. var i = t._styleIndex;
  13428. this._isSystemFontUsed && (e.fontFamily = this._fontFamily), e.useSystemFont = this._isSystemFontUsed, e.lineHeight = this.lineHeight, e.horizontalAlign = a.LEFT, e.verticalAlign = l.CENTER;
  13429. var n = null;
  13430. if (this._textArray[i] && (n = this._textArray[i].style), n && n.color ? t.color = this._convertLiteralColorValue(n.color) : t.color = this.node.color, e._enableBold(n && n.bold), e._enableItalics(n && n.italic), n && n.italic && (t.skewX = 12), e._enableUnderline(n && n.underline), n && n.outline) {
  13431. var r = t.getComponent(cc.LabelOutline);
  13432. r || (r = t.addComponent(cc.LabelOutline)), r.color = this._convertLiteralColorValue(n.outline.color), r.width = n.outline.width
  13433. }
  13434. n && n.size ? e.fontSize = n.size : e.fontSize = this.fontSize, e._forceUpdateRenderData(), n && n.event ? (n.event.click && (t._clickHandler = n.event.click), n.event.param ? t._clickParam = n.event.param : t._clickParam = "") : t._clickHandler = null
  13435. }
  13436. },
  13437. onDestroy: function() {
  13438. for (var t = 0; t < this._labelSegments.length; ++t) this._labelSegments[t].removeFromParent(), h.put(this._labelSegments[t])
  13439. }
  13440. });
  13441. cc.RichText = e.exports = c
  13442. }), {
  13443. "../platform/CCMacro": 203,
  13444. "../platform/js": 218,
  13445. "../utils/html-text-parser": 297,
  13446. "../utils/text-utils": 307
  13447. }],
  13448. 108: [(function(t, e, i) {
  13449. "use strict";
  13450. var n = t("../utils/misc"),
  13451. r = (t("./CCComponent"), cc.Enum({
  13452. HORIZONTAL: 0,
  13453. VERTICAL: 1
  13454. })),
  13455. s = cc.Class({
  13456. name: "cc.Scrollbar",
  13457. extends: t("./CCComponent"),
  13458. editor: !1,
  13459. properties: {
  13460. _scrollView: null,
  13461. _touching: !1,
  13462. _autoHideRemainingTime: {
  13463. default: 0,
  13464. serializable: !1
  13465. },
  13466. _opacity: 255,
  13467. handle: {
  13468. default: null,
  13469. type: cc.Sprite,
  13470. tooltip: !1,
  13471. notify: function() {
  13472. this._onScroll(cc.v2(0, 0))
  13473. },
  13474. animatable: !1
  13475. },
  13476. direction: {
  13477. default: r.HORIZONTAL,
  13478. type: r,
  13479. tooltip: !1,
  13480. notify: function() {
  13481. this._onScroll(cc.v2(0, 0))
  13482. },
  13483. animatable: !1
  13484. },
  13485. enableAutoHide: {
  13486. default: !0,
  13487. animatable: !1,
  13488. tooltip: !1
  13489. },
  13490. autoHideTime: {
  13491. default: 1,
  13492. animatable: !1,
  13493. tooltip: !1
  13494. }
  13495. },
  13496. statics: {
  13497. Direction: r
  13498. },
  13499. setTargetScrollView: function(t) {
  13500. this._scrollView = t
  13501. },
  13502. _convertToScrollViewSpace: function(t) {
  13503. var e = this._scrollView.node,
  13504. i = t.convertToWorldSpaceAR(cc.v2(-t.anchorX * t.width, -t.anchorY * t.height)),
  13505. n = e.convertToNodeSpaceAR(i);
  13506. return n.x += e.anchorX * e.width, n.y += e.anchorY * e.height, n
  13507. },
  13508. _setOpacity: function(t) {
  13509. this.handle && (this.node.opacity = t, this.handle.node.opacity = t)
  13510. },
  13511. _onScroll: function(t) {
  13512. if (this._scrollView) {
  13513. var e = this._scrollView.content;
  13514. if (e) {
  13515. var i = e.getContentSize(),
  13516. n = this._scrollView.node.getContentSize(),
  13517. s = this.node.getContentSize();
  13518. if (this._conditionalDisableScrollBar(i, n)) return;
  13519. this.enableAutoHide && (this._autoHideRemainingTime = this.autoHideTime, this._setOpacity(this._opacity));
  13520. var o = 0,
  13521. a = 0,
  13522. l = 0,
  13523. h = 0,
  13524. c = 0;
  13525. this.direction === r.HORIZONTAL ? (o = i.width, a = n.width, c = s.width, l = t.x, h = -this._convertToScrollViewSpace(e).x) : this.direction === r.VERTICAL && (o = i.height, a = n.height, c = s.height, l = t.y, h = -this._convertToScrollViewSpace(e).y);
  13526. var u = this._calculateLength(o, a, c, l),
  13527. _ = this._calculatePosition(o, a, c, h, l, u);
  13528. this._updateLength(u), this._updateHanlderPosition(_)
  13529. }
  13530. }
  13531. },
  13532. _updateHanlderPosition: function(t) {
  13533. if (this.handle) {
  13534. var e = this._fixupHandlerPosition();
  13535. this.handle.node.setPosition(t.x + e.x, t.y + e.y)
  13536. }
  13537. },
  13538. _fixupHandlerPosition: function() {
  13539. var t = this.node.getContentSize(),
  13540. e = this.node.getAnchorPoint(),
  13541. i = this.handle.node.getContentSize(),
  13542. n = this.handle.node.parent,
  13543. s = this.node.convertToWorldSpaceAR(cc.v2(-t.width * e.x, -t.height * e.y)),
  13544. o = n.convertToNodeSpaceAR(s);
  13545. return this.direction === r.HORIZONTAL ? o = cc.v2(o.x, o.y + (t.height - i.height) / 2) : this.direction === r.VERTICAL && (o = cc.v2(o.x + (t.width - i.width) / 2, o.y)), this.handle.node.setPosition(o), o
  13546. },
  13547. _onTouchBegan: function() {
  13548. this.enableAutoHide && (this._touching = !0)
  13549. },
  13550. _conditionalDisableScrollBar: function(t, e) {
  13551. return t.width <= e.width && this.direction === r.HORIZONTAL || t.height <= e.height && this.direction === r.VERTICAL
  13552. },
  13553. _onTouchEnded: function() {
  13554. if (this.enableAutoHide && (this._touching = !1, !(this.autoHideTime <= 0))) {
  13555. if (this._scrollView) {
  13556. var t = this._scrollView.content;
  13557. if (t) {
  13558. var e = t.getContentSize(),
  13559. i = this._scrollView.node.getContentSize();
  13560. if (this._conditionalDisableScrollBar(e, i)) return
  13561. }
  13562. }
  13563. this._autoHideRemainingTime = this.autoHideTime
  13564. }
  13565. },
  13566. _calculateLength: function(t, e, i, n) {
  13567. var r = t;
  13568. return n && (r += 20 * (n > 0 ? n : -n)), i * (e / r)
  13569. },
  13570. _calculatePosition: function(t, e, i, s, o, a) {
  13571. var l = t - e;
  13572. o && (l += Math.abs(o));
  13573. var h = 0;
  13574. l && (h = s / l, h = n.clamp01(h));
  13575. var c = (i - a) * h;
  13576. return this.direction === r.VERTICAL ? cc.v2(0, c) : cc.v2(c, 0)
  13577. },
  13578. _updateLength: function(t) {
  13579. if (this.handle) {
  13580. var e = this.handle.node,
  13581. i = e.getContentSize();
  13582. e.setAnchorPoint(cc.v2(0, 0)), this.direction === r.HORIZONTAL ? e.setContentSize(t, i.height) : e.setContentSize(i.width, t)
  13583. }
  13584. },
  13585. _processAutoHide: function(t) {
  13586. if (this.enableAutoHide && !(this._autoHideRemainingTime <= 0) && !this._touching && (this._autoHideRemainingTime -= t, this._autoHideRemainingTime <= this.autoHideTime)) {
  13587. this._autoHideRemainingTime = Math.max(0, this._autoHideRemainingTime);
  13588. var e = this._opacity * (this._autoHideRemainingTime / this.autoHideTime);
  13589. this._setOpacity(e)
  13590. }
  13591. },
  13592. start: function() {
  13593. this.enableAutoHide && this._setOpacity(0)
  13594. },
  13595. hide: function() {
  13596. this._autoHideRemainingTime = 0, this._setOpacity(0)
  13597. },
  13598. show: function() {
  13599. this._autoHideRemainingTime = this.autoHideTime, this._setOpacity(this._opacity)
  13600. },
  13601. update: function(t) {
  13602. this._processAutoHide(t)
  13603. }
  13604. });
  13605. cc.Scrollbar = e.exports = s
  13606. }), {
  13607. "../utils/misc": 300,
  13608. "./CCComponent": 95
  13609. }],
  13610. 109: [(function(t, e, i) {
  13611. "use strict";
  13612. var n = t("../CCNode").EventType,
  13613. r = function(t) {
  13614. return (t -= 1) * t * t * t * t + 1
  13615. },
  13616. s = function() {
  13617. return (new Date).getMilliseconds()
  13618. },
  13619. o = cc.Enum({
  13620. SCROLL_TO_TOP: 0,
  13621. SCROLL_TO_BOTTOM: 1,
  13622. SCROLL_TO_LEFT: 2,
  13623. SCROLL_TO_RIGHT: 3,
  13624. SCROLLING: 4,
  13625. BOUNCE_TOP: 5,
  13626. BOUNCE_BOTTOM: 6,
  13627. BOUNCE_LEFT: 7,
  13628. BOUNCE_RIGHT: 8,
  13629. SCROLL_ENDED: 9,
  13630. TOUCH_UP: 10,
  13631. AUTOSCROLL_ENDED_WITH_THRESHOLD: 11,
  13632. SCROLL_BEGAN: 12
  13633. }),
  13634. a = {
  13635. "scroll-to-top": o.SCROLL_TO_TOP,
  13636. "scroll-to-bottom": o.SCROLL_TO_BOTTOM,
  13637. "scroll-to-left": o.SCROLL_TO_LEFT,
  13638. "scroll-to-right": o.SCROLL_TO_RIGHT,
  13639. scrolling: o.SCROLLING,
  13640. "bounce-bottom": o.BOUNCE_BOTTOM,
  13641. "bounce-left": o.BOUNCE_LEFT,
  13642. "bounce-right": o.BOUNCE_RIGHT,
  13643. "bounce-top": o.BOUNCE_TOP,
  13644. "scroll-ended": o.SCROLL_ENDED,
  13645. "touch-up": o.TOUCH_UP,
  13646. "scroll-ended-with-threshold": o.AUTOSCROLL_ENDED_WITH_THRESHOLD,
  13647. "scroll-began": o.SCROLL_BEGAN
  13648. },
  13649. l = cc.Class({
  13650. name: "cc.ScrollView",
  13651. extends: t("./CCViewGroup"),
  13652. editor: !1,
  13653. ctor: function() {
  13654. this._topBoundary = 0, this._bottomBoundary = 0, this._leftBoundary = 0, this._rightBoundary = 0, this._touchMoveDisplacements = [], this._touchMoveTimeDeltas = [], this._touchMovePreviousTimestamp = 0, this._touchMoved = !1, this._autoScrolling = !1, this._autoScrollAttenuate = !1, this._autoScrollStartPosition = cc.v2(0, 0), this._autoScrollTargetDelta = cc.v2(0, 0), this._autoScrollTotalTime = 0, this._autoScrollAccumulatedTime = 0, this._autoScrollCurrentlyOutOfBoundary = !1, this._autoScrollBraking = !1, this._autoScrollBrakingStartPosition = cc.v2(0, 0), this._outOfBoundaryAmount = cc.v2(0, 0), this._outOfBoundaryAmountDirty = !0, this._stopMouseWheel = !1, this._mouseWheelEventElapsedTime = 0, this._isScrollEndedWithThresholdEventFired = !1, this._scrollEventEmitMask = 0, this._isBouncing = !1, this._scrolling = !1
  13655. },
  13656. properties: {
  13657. content: {
  13658. default: void 0,
  13659. type: cc.Node,
  13660. tooltip: !1,
  13661. formerlySerializedAs: "content",
  13662. notify: function(t) {
  13663. this._calculateBoundary()
  13664. }
  13665. },
  13666. horizontal: {
  13667. default: !0,
  13668. animatable: !1,
  13669. tooltip: !1
  13670. },
  13671. vertical: {
  13672. default: !0,
  13673. animatable: !1,
  13674. tooltip: !1
  13675. },
  13676. inertia: {
  13677. default: !0,
  13678. tooltip: !1
  13679. },
  13680. brake: {
  13681. default: .5,
  13682. type: cc.Float,
  13683. range: [0, 1, .1],
  13684. tooltip: !1
  13685. },
  13686. elastic: {
  13687. default: !0,
  13688. animatable: !1,
  13689. tooltip: !1
  13690. },
  13691. bounceDuration: {
  13692. default: 1,
  13693. range: [0, 10],
  13694. tooltip: !1
  13695. },
  13696. horizontalScrollBar: {
  13697. default: void 0,
  13698. type: cc.Scrollbar,
  13699. tooltip: !1,
  13700. notify: function() {
  13701. this.horizontalScrollBar && (this.horizontalScrollBar.setTargetScrollView(this), this._updateScrollBar(0))
  13702. },
  13703. animatable: !1
  13704. },
  13705. verticalScrollBar: {
  13706. default: void 0,
  13707. type: cc.Scrollbar,
  13708. tooltip: !1,
  13709. notify: function() {
  13710. this.verticalScrollBar && (this.verticalScrollBar.setTargetScrollView(this), this._updateScrollBar(0))
  13711. },
  13712. animatable: !1
  13713. },
  13714. scrollEvents: {
  13715. default: [],
  13716. type: cc.Component.EventHandler,
  13717. tooltip: !1
  13718. },
  13719. cancelInnerEvents: {
  13720. default: !0,
  13721. animatable: !1,
  13722. tooltip: !1
  13723. },
  13724. _view: {
  13725. get: function() {
  13726. if (this.content) return this.content.parent
  13727. }
  13728. }
  13729. },
  13730. statics: {
  13731. EventType: o
  13732. },
  13733. scrollToBottom: function(t, e) {
  13734. var i = this._calculateMovePercentDelta({
  13735. anchor: cc.v2(0, 0),
  13736. applyToHorizontal: !1,
  13737. applyToVertical: !0
  13738. });
  13739. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i, !0)
  13740. },
  13741. scrollToTop: function(t, e) {
  13742. var i = this._calculateMovePercentDelta({
  13743. anchor: cc.v2(0, 1),
  13744. applyToHorizontal: !1,
  13745. applyToVertical: !0
  13746. });
  13747. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13748. },
  13749. scrollToLeft: function(t, e) {
  13750. var i = this._calculateMovePercentDelta({
  13751. anchor: cc.v2(0, 0),
  13752. applyToHorizontal: !0,
  13753. applyToVertical: !1
  13754. });
  13755. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13756. },
  13757. scrollToRight: function(t, e) {
  13758. var i = this._calculateMovePercentDelta({
  13759. anchor: cc.v2(1, 0),
  13760. applyToHorizontal: !0,
  13761. applyToVertical: !1
  13762. });
  13763. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13764. },
  13765. scrollToTopLeft: function(t, e) {
  13766. var i = this._calculateMovePercentDelta({
  13767. anchor: cc.v2(0, 1),
  13768. applyToHorizontal: !0,
  13769. applyToVertical: !0
  13770. });
  13771. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13772. },
  13773. scrollToTopRight: function(t, e) {
  13774. var i = this._calculateMovePercentDelta({
  13775. anchor: cc.v2(1, 1),
  13776. applyToHorizontal: !0,
  13777. applyToVertical: !0
  13778. });
  13779. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13780. },
  13781. scrollToBottomLeft: function(t, e) {
  13782. var i = this._calculateMovePercentDelta({
  13783. anchor: cc.v2(0, 0),
  13784. applyToHorizontal: !0,
  13785. applyToVertical: !0
  13786. });
  13787. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13788. },
  13789. scrollToBottomRight: function(t, e) {
  13790. var i = this._calculateMovePercentDelta({
  13791. anchor: cc.v2(1, 0),
  13792. applyToHorizontal: !0,
  13793. applyToVertical: !0
  13794. });
  13795. t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i)
  13796. },
  13797. scrollToOffset: function(t, e, i) {
  13798. var n = this.getMaxScrollOffset(),
  13799. r = cc.v2(0, 0);
  13800. 0 === n.x ? r.x = 0 : r.x = t.x / n.x, 0 === n.y ? r.y = 1 : r.y = (n.y - t.y) / n.y, this.scrollTo(r, e, i)
  13801. },
  13802. getScrollOffset: function() {
  13803. var t = this._getContentTopBoundary() - this._topBoundary,
  13804. e = this._getContentLeftBoundary() - this._leftBoundary;
  13805. return cc.v2(e, t)
  13806. },
  13807. getMaxScrollOffset: function() {
  13808. var t = this._view.getContentSize(),
  13809. e = this.content.getContentSize(),
  13810. i = e.width - t.width,
  13811. n = e.height - t.height;
  13812. return i = i >= 0 ? i : 0, n = n >= 0 ? n : 0, cc.v2(i, n)
  13813. },
  13814. scrollToPercentHorizontal: function(t, e, i) {
  13815. var n = this._calculateMovePercentDelta({
  13816. anchor: cc.v2(t, 0),
  13817. applyToHorizontal: !0,
  13818. applyToVertical: !1
  13819. });
  13820. e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n)
  13821. },
  13822. scrollTo: function(t, e, i) {
  13823. var n = this._calculateMovePercentDelta({
  13824. anchor: cc.v2(t),
  13825. applyToHorizontal: !0,
  13826. applyToVertical: !0
  13827. });
  13828. e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n)
  13829. },
  13830. scrollToPercentVertical: function(t, e, i) {
  13831. var n = this._calculateMovePercentDelta({
  13832. anchor: cc.v2(0, t),
  13833. applyToHorizontal: !1,
  13834. applyToVertical: !0
  13835. });
  13836. e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n)
  13837. },
  13838. stopAutoScroll: function() {
  13839. this._autoScrolling = !1, this._autoScrollAccumulatedTime = this._autoScrollTotalTime
  13840. },
  13841. setContentPosition: function(t) {
  13842. t.fuzzyEquals(this.getContentPosition(), 1e-4) || (this.content.setPosition(t), this._outOfBoundaryAmountDirty = !0)
  13843. },
  13844. getContentPosition: function() {
  13845. return this.content.getPosition()
  13846. },
  13847. isScrolling: function() {
  13848. return this._scrolling
  13849. },
  13850. isAutoScrolling: function() {
  13851. return this._autoScrolling
  13852. },
  13853. _registerEvent: function() {
  13854. this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this, !0), this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this, !0), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this, !0), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this, !0), this.node.on(cc.Node.EventType.MOUSE_WHEEL, this._onMouseWheel, this, !0)
  13855. },
  13856. _unregisterEvent: function() {
  13857. this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this, !0), this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this, !0), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this, !0), this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this, !0), this.node.off(cc.Node.EventType.MOUSE_WHEEL, this._onMouseWheel, this, !0)
  13858. },
  13859. _onMouseWheel: function(t, e) {
  13860. if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
  13861. var i = cc.v2(0, 0),
  13862. n = -.1;
  13863. 0, this.vertical ? i = cc.v2(0, t.getScrollY() * n) : this.horizontal && (i = cc.v2(t.getScrollY() * n, 0)), this._mouseWheelEventElapsedTime = 0, this._processDeltaMove(i), this._stopMouseWheel || (this._handlePressLogic(), this.schedule(this._checkMouseWheel, 1 / 60), this._stopMouseWheel = !0), this._stopPropagationIfTargetIsMe(t)
  13864. }
  13865. },
  13866. _checkMouseWheel: function(t) {
  13867. if (!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4)) return this._processInertiaScroll(), this.unschedule(this._checkMouseWheel), void(this._stopMouseWheel = !1);
  13868. this._mouseWheelEventElapsedTime += t, this._mouseWheelEventElapsedTime > .1 && (this._onScrollBarTouchEnded(), this.unschedule(this._checkMouseWheel), this._stopMouseWheel = !1)
  13869. },
  13870. _calculateMovePercentDelta: function(t) {
  13871. var e = t.anchor,
  13872. i = t.applyToHorizontal,
  13873. n = t.applyToVertical;
  13874. this._calculateBoundary(), e = e.clampf(cc.v2(0, 0), cc.v2(1, 1));
  13875. var r = this._view.getContentSize(),
  13876. s = this.content.getContentSize(),
  13877. o = this._getContentBottomBoundary() - this._bottomBoundary;
  13878. o = -o;
  13879. var a = this._getContentLeftBoundary() - this._leftBoundary;
  13880. a = -a;
  13881. var l = cc.v2(0, 0),
  13882. h = 0;
  13883. return i && (h = s.width - r.width, l.x = a - h * e.x), n && (h = s.height - r.height, l.y = o - h * e.y), l
  13884. },
  13885. _moveContentToTopLeft: function(t) {
  13886. var e = this.content.getContentSize(),
  13887. i = this._getContentBottomBoundary() - this._bottomBoundary;
  13888. i = -i;
  13889. var n = cc.v2(0, 0),
  13890. r = 0,
  13891. s = this._getContentLeftBoundary() - this._leftBoundary;
  13892. s = -s, e.height < t.height && (r = e.height - t.height, n.y = i - r), e.width < t.width && (r = e.width - t.width, n.x = s), this._updateScrollBarState(), this._moveContent(n), this._adjustContentOutOfBoundary()
  13893. },
  13894. _calculateBoundary: function() {
  13895. if (this.content) {
  13896. var t = this.content.getComponent(cc.Layout);
  13897. t && t.enabledInHierarchy && t.updateLayout();
  13898. var e = this._view.getContentSize(),
  13899. i = e.width * this._view.anchorX,
  13900. n = e.height * this._view.anchorY;
  13901. this._leftBoundary = -i, this._bottomBoundary = -n, this._rightBoundary = this._leftBoundary + e.width, this._topBoundary = this._bottomBoundary + e.height, this._moveContentToTopLeft(e)
  13902. }
  13903. },
  13904. _hasNestedViewGroup: function(t, e) {
  13905. if (t.eventPhase === cc.Event.CAPTURING_PHASE) {
  13906. if (e)
  13907. for (var i = 0; i < e.length; ++i) {
  13908. var n = e[i];
  13909. if (this.node === n) return !!t.target.getComponent(cc.ViewGroup);
  13910. if (n.getComponent(cc.ViewGroup)) return !0
  13911. }
  13912. return !1
  13913. }
  13914. },
  13915. _stopPropagationIfTargetIsMe: function(t) {
  13916. t.eventPhase === cc.Event.AT_TARGET && t.target === this.node && t.stopPropagation()
  13917. },
  13918. _onTouchBegan: function(t, e) {
  13919. if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
  13920. var i = t.touch;
  13921. this.content && this._handlePressLogic(i), this._touchMoved = !1, this._stopPropagationIfTargetIsMe(t)
  13922. }
  13923. },
  13924. _onTouchMoved: function(t, e) {
  13925. if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
  13926. var i = t.touch;
  13927. if (this.content && this._handleMoveLogic(i), this.cancelInnerEvents) {
  13928. if (i.getLocation().sub(i.getStartLocation()).mag() > 7 && !this._touchMoved && t.target !== this.node) {
  13929. var n = new cc.Event.EventTouch(t.getTouches(), t.bubbles);
  13930. n.type = cc.Node.EventType.TOUCH_CANCEL, n.touch = t.touch, n.simulate = !0, t.target.dispatchEvent(n), this._touchMoved = !0
  13931. }
  13932. this._stopPropagationIfTargetIsMe(t)
  13933. }
  13934. }
  13935. },
  13936. _onTouchEnded: function(t, e) {
  13937. if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
  13938. this._dispatchEvent("touch-up");
  13939. var i = t.touch;
  13940. this.content && this._handleReleaseLogic(i), this._touchMoved ? t.stopPropagation() : this._stopPropagationIfTargetIsMe(t)
  13941. }
  13942. },
  13943. _onTouchCancelled: function(t, e) {
  13944. if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) {
  13945. if (!t.simulate) {
  13946. var i = t.touch;
  13947. this.content && this._handleReleaseLogic(i)
  13948. }
  13949. this._stopPropagationIfTargetIsMe(t)
  13950. }
  13951. },
  13952. _processDeltaMove: function(t) {
  13953. this._scrollChildren(t), this._gatherTouchMove(t)
  13954. },
  13955. _handleMoveLogic: function(t) {
  13956. var e = t.getDelta();
  13957. this._processDeltaMove(e)
  13958. },
  13959. _scrollChildren: function(t) {
  13960. var e = t = this._clampDelta(t),
  13961. i = void 0;
  13962. this.elastic && (i = this._getHowMuchOutOfBoundary(), e.x *= 0 === i.x ? 1 : .5, e.y *= 0 === i.y ? 1 : .5), this.elastic || (i = this._getHowMuchOutOfBoundary(e), e = e.add(i));
  13963. var n = -1;
  13964. if (e.y > 0) this.content.y - this.content.anchorY * this.content.height + e.y > this._bottomBoundary && (n = "scroll-to-bottom");
  13965. else if (e.y < 0) {
  13966. this.content.y - this.content.anchorY * this.content.height + this.content.height + e.y <= this._topBoundary && (n = "scroll-to-top")
  13967. }
  13968. if (e.x < 0) this.content.x - this.content.anchorX * this.content.width + this.content.width + e.x <= this._rightBoundary && (n = "scroll-to-right");
  13969. else if (e.x > 0) {
  13970. this.content.x - this.content.anchorX * this.content.width + e.x >= this._leftBoundary && (n = "scroll-to-left")
  13971. }
  13972. this._moveContent(e, !1), 0 === e.x && 0 === e.y || (this._scrolling || (this._scrolling = !0, this._dispatchEvent("scroll-began")), this._dispatchEvent("scrolling")), -1 !== n && this._dispatchEvent(n)
  13973. },
  13974. _handlePressLogic: function() {
  13975. this._autoScrolling && this._dispatchEvent("scroll-ended"), this._autoScrolling = !1, this._isBouncing = !1, this._touchMovePreviousTimestamp = s(), this._touchMoveDisplacements.length = 0, this._touchMoveTimeDeltas.length = 0, this._onScrollBarTouchBegan()
  13976. },
  13977. _clampDelta: function(t) {
  13978. var e = this.content.getContentSize(),
  13979. i = this._view.getContentSize();
  13980. return e.width < i.width && (t.x = 0), e.height < i.height && (t.y = 0), t
  13981. },
  13982. _gatherTouchMove: function(t) {
  13983. for (t = this._clampDelta(t); this._touchMoveDisplacements.length >= 5;) this._touchMoveDisplacements.shift(), this._touchMoveTimeDeltas.shift();
  13984. this._touchMoveDisplacements.push(t);
  13985. var e = s();
  13986. this._touchMoveTimeDeltas.push((e - this._touchMovePreviousTimestamp) / 1e3), this._touchMovePreviousTimestamp = e
  13987. },
  13988. _startBounceBackIfNeeded: function() {
  13989. if (!this.elastic) return !1;
  13990. var t = this._getHowMuchOutOfBoundary();
  13991. if ((t = this._clampDelta(t)).fuzzyEquals(cc.v2(0, 0), 1e-4)) return !1;
  13992. var e = Math.max(this.bounceDuration, 0);
  13993. return this._startAutoScroll(t, e, !0), this._isBouncing || (t.y > 0 && this._dispatchEvent("bounce-top"), t.y < 0 && this._dispatchEvent("bounce-bottom"), t.x > 0 && this._dispatchEvent("bounce-right"), t.x < 0 && this._dispatchEvent("bounce-left"), this._isBouncing = !0), !0
  13994. },
  13995. _processInertiaScroll: function() {
  13996. if (!this._startBounceBackIfNeeded() && this.inertia) {
  13997. var t = this._calculateTouchMoveVelocity();
  13998. !t.fuzzyEquals(cc.v2(0, 0), 1e-4) && this.brake < 1 && this._startInertiaScroll(t)
  13999. }
  14000. this._onScrollBarTouchEnded()
  14001. },
  14002. _handleReleaseLogic: function(t) {
  14003. var e = t.getDelta();
  14004. this._gatherTouchMove(e), this._processInertiaScroll(), this._scrolling && (this._scrolling = !1, this._autoScrolling || this._dispatchEvent("scroll-ended"))
  14005. },
  14006. _isOutOfBoundary: function() {
  14007. return !this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4)
  14008. },
  14009. _isNecessaryAutoScrollBrake: function() {
  14010. if (this._autoScrollBraking) return !0;
  14011. if (this._isOutOfBoundary()) {
  14012. if (!this._autoScrollCurrentlyOutOfBoundary) return this._autoScrollCurrentlyOutOfBoundary = !0, this._autoScrollBraking = !0, this._autoScrollBrakingStartPosition = this.getContentPosition(), !0
  14013. } else this._autoScrollCurrentlyOutOfBoundary = !1;
  14014. return !1
  14015. },
  14016. getScrollEndedEventTiming: function() {
  14017. return 1e-4
  14018. },
  14019. _processAutoScrolling: function(t) {
  14020. var e = this._isNecessaryAutoScrollBrake(),
  14021. i = e ? .05 : 1;
  14022. this._autoScrollAccumulatedTime += t * (1 / i);
  14023. var n = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
  14024. this._autoScrollAttenuate && (n = r(n));
  14025. var s = this._autoScrollStartPosition.add(this._autoScrollTargetDelta.mul(n)),
  14026. o = Math.abs(n - 1) <= 1e-4;
  14027. if (Math.abs(n - 1) <= this.getScrollEndedEventTiming() && !this._isScrollEndedWithThresholdEventFired && (this._dispatchEvent("scroll-ended-with-threshold"), this._isScrollEndedWithThresholdEventFired = !0), this.elastic) {
  14028. var a = s.sub(this._autoScrollBrakingStartPosition);
  14029. e && (a = a.mul(i)), s = this._autoScrollBrakingStartPosition.add(a)
  14030. } else {
  14031. var l = s.sub(this.getContentPosition()),
  14032. h = this._getHowMuchOutOfBoundary(l);
  14033. h.fuzzyEquals(cc.v2(0, 0), 1e-4) || (s = s.add(h), o = !0)
  14034. }
  14035. o && (this._autoScrolling = !1);
  14036. var c = s.sub(this.getContentPosition());
  14037. this._moveContent(this._clampDelta(c), o), this._dispatchEvent("scrolling"), this._autoScrolling || (this._isBouncing = !1, this._scrolling = !1, this._dispatchEvent("scroll-ended"))
  14038. },
  14039. _startInertiaScroll: function(t) {
  14040. var e = t.mul(.7);
  14041. this._startAttenuatingAutoScroll(e, t)
  14042. },
  14043. _calculateAttenuatedFactor: function(t) {
  14044. return this.brake <= 0 ? 1 - this.brake : (1 - this.brake) * (1 / (1 + 14e-6 * t + t * t * 8e-9))
  14045. },
  14046. _startAttenuatingAutoScroll: function(t, e) {
  14047. var i = this._calculateAutoScrollTimeByInitalSpeed(e.mag()),
  14048. n = t.normalize(),
  14049. r = this.content.getContentSize(),
  14050. s = this._view.getContentSize(),
  14051. o = r.width - s.width,
  14052. a = r.height - s.height,
  14053. l = this._calculateAttenuatedFactor(o),
  14054. h = this._calculateAttenuatedFactor(a);
  14055. n = cc.v2(n.x * o * (1 - this.brake) * l, n.y * a * h * (1 - this.brake));
  14056. var c = t.mag(),
  14057. u = n.mag() / c;
  14058. n = n.add(t), this.brake > 0 && u > 7 && (u = Math.sqrt(u), n = t.mul(u).add(t)), this.brake > 0 && u > 3 && (i *= u = 3), 0 === this.brake && u > 1 && (i *= u), this._startAutoScroll(n, i, !0)
  14059. },
  14060. _calculateAutoScrollTimeByInitalSpeed: function(t) {
  14061. return Math.sqrt(Math.sqrt(t / 5))
  14062. },
  14063. _startAutoScroll: function(t, e, i) {
  14064. var n = this._flattenVectorByDirection(t);
  14065. this._autoScrolling = !0, this._autoScrollTargetDelta = n, this._autoScrollAttenuate = i, this._autoScrollStartPosition = this.getContentPosition(), this._autoScrollTotalTime = e, this._autoScrollAccumulatedTime = 0, this._autoScrollBraking = !1, this._isScrollEndedWithThresholdEventFired = !1, this._autoScrollBrakingStartPosition = cc.v2(0, 0), this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4) || (this._autoScrollCurrentlyOutOfBoundary = !0)
  14066. },
  14067. _calculateTouchMoveVelocity: function() {
  14068. var t = 0;
  14069. if ((t = this._touchMoveTimeDeltas.reduce((function(t, e) {
  14070. return t + e
  14071. }), t)) <= 0 || t >= .5) return cc.v2(0, 0);
  14072. var e = cc.v2(0, 0);
  14073. return e = this._touchMoveDisplacements.reduce((function(t, e) {
  14074. return t.add(e)
  14075. }), e), cc.v2(e.x * (1 - this.brake) / t, e.y * (1 - this.brake) / t)
  14076. },
  14077. _flattenVectorByDirection: function(t) {
  14078. var e = t;
  14079. return e.x = this.horizontal ? e.x : 0, e.y = this.vertical ? e.y : 0, e
  14080. },
  14081. _moveContent: function(t, e) {
  14082. var i = this._flattenVectorByDirection(t),
  14083. n = this.getContentPosition().add(i);
  14084. this.setContentPosition(n);
  14085. var r = this._getHowMuchOutOfBoundary();
  14086. this._updateScrollBar(r), this.elastic && e && this._startBounceBackIfNeeded()
  14087. },
  14088. _getContentLeftBoundary: function() {
  14089. return this.getContentPosition().x - this.content.getAnchorPoint().x * this.content.getContentSize().width
  14090. },
  14091. _getContentRightBoundary: function() {
  14092. var t = this.content.getContentSize();
  14093. return this._getContentLeftBoundary() + t.width
  14094. },
  14095. _getContentTopBoundary: function() {
  14096. var t = this.content.getContentSize();
  14097. return this._getContentBottomBoundary() + t.height
  14098. },
  14099. _getContentBottomBoundary: function() {
  14100. return this.getContentPosition().y - this.content.getAnchorPoint().y * this.content.getContentSize().height
  14101. },
  14102. _getHowMuchOutOfBoundary: function(t) {
  14103. if ((t = t || cc.v2(0, 0)).fuzzyEquals(cc.v2(0, 0), 1e-4) && !this._outOfBoundaryAmountDirty) return this._outOfBoundaryAmount;
  14104. var e = cc.v2(0, 0);
  14105. return this._getContentLeftBoundary() + t.x > this._leftBoundary ? e.x = this._leftBoundary - (this._getContentLeftBoundary() + t.x) : this._getContentRightBoundary() + t.x < this._rightBoundary && (e.x = this._rightBoundary - (this._getContentRightBoundary() + t.x)), this._getContentTopBoundary() + t.y < this._topBoundary ? e.y = this._topBoundary - (this._getContentTopBoundary() + t.y) : this._getContentBottomBoundary() + t.y > this._bottomBoundary && (e.y = this._bottomBoundary - (this._getContentBottomBoundary() + t.y)), t.fuzzyEquals(cc.v2(0, 0), 1e-4) && (this._outOfBoundaryAmount = e, this._outOfBoundaryAmountDirty = !1), e = this._clampDelta(e)
  14106. },
  14107. _updateScrollBarState: function() {
  14108. if (this.content) {
  14109. var t = this.content.getContentSize(),
  14110. e = this._view.getContentSize();
  14111. this.verticalScrollBar && (t.height < e.height ? this.verticalScrollBar.hide() : this.verticalScrollBar.show()), this.horizontalScrollBar && (t.width < e.width ? this.horizontalScrollBar.hide() : this.horizontalScrollBar.show())
  14112. }
  14113. },
  14114. _updateScrollBar: function(t) {
  14115. this.horizontalScrollBar && this.horizontalScrollBar._onScroll(t), this.verticalScrollBar && this.verticalScrollBar._onScroll(t)
  14116. },
  14117. _onScrollBarTouchBegan: function() {
  14118. this.horizontalScrollBar && this.horizontalScrollBar._onTouchBegan(), this.verticalScrollBar && this.verticalScrollBar._onTouchBegan()
  14119. },
  14120. _onScrollBarTouchEnded: function() {
  14121. this.horizontalScrollBar && this.horizontalScrollBar._onTouchEnded(), this.verticalScrollBar && this.verticalScrollBar._onTouchEnded()
  14122. },
  14123. _dispatchEvent: function(t) {
  14124. if ("scroll-ended" === t) this._scrollEventEmitMask = 0;
  14125. else if ("scroll-to-top" === t || "scroll-to-bottom" === t || "scroll-to-left" === t || "scroll-to-right" === t) {
  14126. var e = 1 << a[t];
  14127. if (this._scrollEventEmitMask & e) return;
  14128. this._scrollEventEmitMask |= e
  14129. }
  14130. cc.Component.EventHandler.emitEvents(this.scrollEvents, this, a[t]), this.node.emit(t, this)
  14131. },
  14132. _adjustContentOutOfBoundary: function() {
  14133. if (this._outOfBoundaryAmountDirty = !0, this._isOutOfBoundary()) {
  14134. var t = this._getHowMuchOutOfBoundary(cc.v2(0, 0)),
  14135. e = this.getContentPosition().add(t);
  14136. this.content && (this.content.setPosition(e), this._updateScrollBar(0))
  14137. }
  14138. },
  14139. start: function() {
  14140. this._calculateBoundary(), this.content && cc.director.once(cc.Director.EVENT_BEFORE_DRAW, this._adjustContentOutOfBoundary, this)
  14141. },
  14142. _hideScrollbar: function() {
  14143. this.horizontalScrollBar && this.horizontalScrollBar.hide(), this.verticalScrollBar && this.verticalScrollBar.hide()
  14144. },
  14145. onDisable: function() {
  14146. this._unregisterEvent(), this.content && (this.content.off(n.SIZE_CHANGED, this._calculateBoundary, this), this.content.off(n.SCALE_CHANGED, this._calculateBoundary, this), this._view && (this._view.off(n.POSITION_CHANGED, this._calculateBoundary, this), this._view.off(n.SCALE_CHANGED, this._calculateBoundary, this), this._view.off(n.SIZE_CHANGED, this._calculateBoundary, this))), this._hideScrollbar(), this.stopAutoScroll()
  14147. },
  14148. onEnable: function() {
  14149. this._registerEvent(), this.content && (this.content.on(n.SIZE_CHANGED, this._calculateBoundary, this), this.content.on(n.SCALE_CHANGED, this._calculateBoundary, this), this._view && (this._view.on(n.POSITION_CHANGED, this._calculateBoundary, this), this._view.on(n.SCALE_CHANGED, this._calculateBoundary, this), this._view.on(n.SIZE_CHANGED, this._calculateBoundary, this))), this._updateScrollBarState()
  14150. },
  14151. update: function(t) {
  14152. this._autoScrolling && this._processAutoScrolling(t)
  14153. }
  14154. });
  14155. cc.ScrollView = e.exports = l
  14156. }), {
  14157. "../CCNode": 52,
  14158. "./CCViewGroup": 116
  14159. }],
  14160. 110: [(function(t, e, i) {
  14161. "use strict";
  14162. var n = t("../utils/misc"),
  14163. r = t("./CCComponent"),
  14164. s = cc.Enum({
  14165. Horizontal: 0,
  14166. Vertical: 1
  14167. }),
  14168. o = cc.Class({
  14169. name: "cc.Slider",
  14170. extends: r,
  14171. editor: !1,
  14172. ctor: function() {
  14173. this._offset = cc.v2(), this._touchHandle = !1, this._dragging = !1
  14174. },
  14175. properties: {
  14176. handle: {
  14177. default: null,
  14178. type: cc.Button,
  14179. tooltip: !1,
  14180. notify: function() {
  14181. 0
  14182. }
  14183. },
  14184. direction: {
  14185. default: s.Horizontal,
  14186. type: s,
  14187. tooltip: !1
  14188. },
  14189. progress: {
  14190. default: .5,
  14191. type: cc.Float,
  14192. range: [0, 1, .1],
  14193. slide: !0,
  14194. tooltip: !1,
  14195. notify: function() {
  14196. this._updateHandlePosition()
  14197. }
  14198. },
  14199. slideEvents: {
  14200. default: [],
  14201. type: cc.Component.EventHandler,
  14202. tooltip: !1
  14203. }
  14204. },
  14205. statics: {
  14206. Direction: s
  14207. },
  14208. __preload: function() {
  14209. this._updateHandlePosition()
  14210. },
  14211. onEnable: function() {
  14212. this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this), this.handle && this.handle.isValid && (this.handle.node.on(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this), this.handle.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.handle.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this))
  14213. },
  14214. onDisable: function() {
  14215. this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this), this.handle && this.handle.isValid && (this.handle.node.off(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this), this.handle.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), this.handle.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this))
  14216. },
  14217. _onHandleDragStart: function(t) {
  14218. this._dragging = !0, this._touchHandle = !0, this._offset = this.handle.node.convertToNodeSpaceAR(t.touch.getLocation()), t.stopPropagation()
  14219. },
  14220. _onTouchBegan: function(t) {
  14221. this.handle && (this._dragging = !0, this._touchHandle || this._handleSliderLogic(t.touch), t.stopPropagation())
  14222. },
  14223. _onTouchMoved: function(t) {
  14224. this._dragging && (this._handleSliderLogic(t.touch), t.stopPropagation())
  14225. },
  14226. _onTouchEnded: function(t) {
  14227. this._dragging = !1, this._touchHandle = !1, this._offset = cc.v2(), t.stopPropagation()
  14228. },
  14229. _onTouchCancelled: function(t) {
  14230. this._dragging = !1, t.stopPropagation()
  14231. },
  14232. _handleSliderLogic: function(t) {
  14233. this._updateProgress(t), this._emitSlideEvent()
  14234. },
  14235. _emitSlideEvent: function() {
  14236. cc.Component.EventHandler.emitEvents(this.slideEvents, this), this.node.emit("slide", this)
  14237. },
  14238. _updateProgress: function(t) {
  14239. if (this.handle) {
  14240. var e = this.node,
  14241. i = e.convertToNodeSpaceAR(t.getLocation());
  14242. this.direction === s.Horizontal ? this.progress = n.clamp01((i.x - this._offset.x + e.anchorX * e.width) / e.width) : this.progress = n.clamp01((i.y - this._offset.y + e.anchorY * e.height) / e.height)
  14243. }
  14244. },
  14245. _updateHandlePosition: function() {
  14246. if (this.handle) {
  14247. var t;
  14248. t = this.direction === s.Horizontal ? cc.v2(-this.node.width * this.node.anchorX + this.progress * this.node.width, 0) : cc.v2(0, -this.node.height * this.node.anchorY + this.progress * this.node.height);
  14249. var e = this.node.convertToWorldSpaceAR(t);
  14250. this.handle.node.position = this.handle.node.parent.convertToNodeSpaceAR(e)
  14251. }
  14252. }
  14253. });
  14254. cc.Slider = e.exports = o
  14255. }), {
  14256. "../utils/misc": 300,
  14257. "./CCComponent": 95
  14258. }],
  14259. 111: [(function(t, e, i) {
  14260. "use strict";
  14261. var n = t("../utils/misc"),
  14262. r = (t("../CCNode").EventType, t("./CCRenderComponent")),
  14263. s = t("../utils/blend-func"),
  14264. o = (t("../renderer/render-flow"), t("../assets/material/CCMaterial")),
  14265. a = cc.Enum({
  14266. SIMPLE: 0,
  14267. SLICED: 1,
  14268. TILED: 2,
  14269. FILLED: 3,
  14270. MESH: 4
  14271. }),
  14272. l = cc.Enum({
  14273. HORIZONTAL: 0,
  14274. VERTICAL: 1,
  14275. RADIAL: 2
  14276. }),
  14277. h = cc.Enum({
  14278. CUSTOM: 0,
  14279. TRIMMED: 1,
  14280. RAW: 2
  14281. }),
  14282. c = cc.Enum({
  14283. NORMAL: 0,
  14284. GRAY: 1
  14285. }),
  14286. u = cc.Class({
  14287. name: "cc.Sprite",
  14288. extends: r,
  14289. mixins: [s],
  14290. editor: !1,
  14291. ctor: function() {
  14292. cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? this._activateMaterial = this._activateMaterialCanvas : this._activateMaterial = this._activateMaterialWebgl
  14293. },
  14294. properties: {
  14295. _spriteFrame: {
  14296. default: null,
  14297. type: cc.SpriteFrame
  14298. },
  14299. _type: a.SIMPLE,
  14300. _sizeMode: h.TRIMMED,
  14301. _fillType: 0,
  14302. _fillCenter: cc.v2(0, 0),
  14303. _fillStart: 0,
  14304. _fillRange: 0,
  14305. _isTrimmedMode: !0,
  14306. _atlas: {
  14307. default: null,
  14308. type: cc.SpriteAtlas,
  14309. tooltip: !1,
  14310. editorOnly: !0,
  14311. visible: !0,
  14312. animatable: !1
  14313. },
  14314. spriteFrame: {
  14315. get: function() {
  14316. return this._spriteFrame
  14317. },
  14318. set: function(t, e) {
  14319. var i = this._spriteFrame;
  14320. i !== t && (this._spriteFrame = t, this.markForUpdateRenderData(!1), this._applySpriteFrame(i))
  14321. },
  14322. type: cc.SpriteFrame
  14323. },
  14324. type: {
  14325. get: function() {
  14326. return this._type
  14327. },
  14328. set: function(t) {
  14329. this._type !== t && (this._type = t, this._resetAssembler())
  14330. },
  14331. type: a,
  14332. animatable: !1,
  14333. tooltip: !1
  14334. },
  14335. fillType: {
  14336. get: function() {
  14337. return this._fillType
  14338. },
  14339. set: function(t) {
  14340. t !== this._fillType && (this._fillType = t, this._resetAssembler())
  14341. },
  14342. type: l,
  14343. tooltip: !1
  14344. },
  14345. fillCenter: {
  14346. get: function() {
  14347. return this._fillCenter
  14348. },
  14349. set: function(t) {
  14350. this._fillCenter.x = t.x, this._fillCenter.y = t.y, this._type === a.FILLED && this.setVertsDirty()
  14351. },
  14352. tooltip: !1
  14353. },
  14354. fillStart: {
  14355. get: function() {
  14356. return this._fillStart
  14357. },
  14358. set: function(t) {
  14359. this._fillStart = n.clampf(t, -1, 1), this._type === a.FILLED && this.setVertsDirty()
  14360. },
  14361. tooltip: !1
  14362. },
  14363. fillRange: {
  14364. get: function() {
  14365. return this._fillRange
  14366. },
  14367. set: function(t) {
  14368. this._fillRange = n.clampf(t, -1, 1), this._type === a.FILLED && this.setVertsDirty()
  14369. },
  14370. tooltip: !1
  14371. },
  14372. trim: {
  14373. get: function() {
  14374. return this._isTrimmedMode
  14375. },
  14376. set: function(t) {
  14377. this._isTrimmedMode !== t && (this._isTrimmedMode = t, this._type !== a.SIMPLE && this._type !== a.MESH || this.setVertsDirty())
  14378. },
  14379. animatable: !1,
  14380. tooltip: !1
  14381. },
  14382. sizeMode: {
  14383. get: function() {
  14384. return this._sizeMode
  14385. },
  14386. set: function(t) {
  14387. this._sizeMode = t, t !== h.CUSTOM && this._applySpriteSize()
  14388. },
  14389. animatable: !1,
  14390. type: h,
  14391. tooltip: !1
  14392. }
  14393. },
  14394. statics: {
  14395. FillType: l,
  14396. Type: a,
  14397. SizeMode: h,
  14398. State: c
  14399. },
  14400. setVisible: function(t) {
  14401. this.enabled = t
  14402. },
  14403. setState: function() {},
  14404. getState: function() {},
  14405. onEnable: function() {
  14406. this._super(), this._spriteFrame && this._spriteFrame.textureLoaded() ? this._activateMaterial() : (this.disableRender(), this._spriteFrame && (this._spriteFrame.once("load", this._onTextureLoaded, this), this._spriteFrame.ensureLoadTexture()))
  14407. },
  14408. _on3DNodeChanged: function() {
  14409. this._resetAssembler()
  14410. },
  14411. _activateMaterialCanvas: function() {
  14412. this.setVertsDirty(), this.markForUpdateRenderData(!0), this.markForRender(!0)
  14413. },
  14414. _activateMaterialWebgl: function() {
  14415. var t = this._spriteFrame;
  14416. if (t && t.textureLoaded()) {
  14417. var e = this.sharedMaterials[0];
  14418. (e = e ? o.getInstantiatedMaterial(e, this) : o.getInstantiatedBuiltinMaterial("2d-sprite", this)).setProperty("texture", t.getTexture()), this.setVertsDirty(), this.setMaterial(0, e), this.markForRender(!0)
  14419. } else this.disableRender()
  14420. },
  14421. _applyAtlas: !1,
  14422. _canRender: function() {
  14423. if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
  14424. if (!this._enabled) return !1
  14425. } else if (!this._enabled || !this.sharedMaterials[0] || !this.node._activeInHierarchy) return !1;
  14426. var t = this._spriteFrame;
  14427. return !(!t || !t.textureLoaded())
  14428. },
  14429. _applySpriteSize: function() {
  14430. if (this._spriteFrame) {
  14431. if (h.RAW === this._sizeMode) {
  14432. var t = this._spriteFrame._originalSize;
  14433. this.node.setContentSize(t)
  14434. } else if (h.TRIMMED === this._sizeMode) {
  14435. var e = this._spriteFrame._rect;
  14436. this.node.setContentSize(e.width, e.height)
  14437. }
  14438. this.setVertsDirty(), this._activateMaterial()
  14439. }
  14440. },
  14441. _onTextureLoaded: function() {
  14442. this.isValid && this._applySpriteSize()
  14443. },
  14444. _applySpriteFrame: function(t) {
  14445. t && !t.textureLoaded() && t.off("load", this._onTextureLoaded, this);
  14446. var e = this._spriteFrame;
  14447. e ? e.textureLoaded() ? this._applySpriteSize() : (this.markForRender(!1), e.once("load", this._onTextureLoaded, this), e.ensureLoadTexture()) : this.markForRender(!1)
  14448. },
  14449. _resized: !1
  14450. });
  14451. cc.Sprite = e.exports = u
  14452. }), {
  14453. "../CCNode": 52,
  14454. "../assets/material/CCMaterial": 75,
  14455. "../renderer/render-flow": 248,
  14456. "../utils/blend-func": 293,
  14457. "../utils/misc": 300,
  14458. "./CCRenderComponent": 106
  14459. }],
  14460. 112: [(function(t, e, i) {
  14461. "use strict";
  14462. var n = cc.Enum({
  14463. NONE: 0,
  14464. CHECKBOX: 1,
  14465. TEXT_ATLAS: 2,
  14466. SLIDER_BAR: 3,
  14467. LIST_VIEW: 4,
  14468. PAGE_VIEW: 5
  14469. }),
  14470. r = cc.Enum({
  14471. VERTICAL: 0,
  14472. HORIZONTAL: 1
  14473. }),
  14474. s = cc.Enum({
  14475. TOP: 0,
  14476. CENTER: 1,
  14477. BOTTOM: 2
  14478. }),
  14479. o = cc.Enum({
  14480. LEFT: 0,
  14481. CENTER: 1,
  14482. RIGHT: 2
  14483. }),
  14484. a = cc.Class({
  14485. name: "cc.StudioComponent",
  14486. extends: cc.Component,
  14487. editor: !1,
  14488. properties: !1,
  14489. statics: {
  14490. ComponentType: n,
  14491. ListDirection: r,
  14492. VerticalAlign: s,
  14493. HorizontalAlign: o
  14494. }
  14495. }),
  14496. l = t("../utils/prefab-helper");
  14497. a.PlaceHolder = cc.Class({
  14498. name: "cc.StudioComponent.PlaceHolder",
  14499. extends: cc.Component,
  14500. properties: {
  14501. _baseUrl: "",
  14502. nestedPrefab: cc.Prefab
  14503. },
  14504. onLoad: function() {
  14505. this.nestedPrefab && this._replaceWithNestedPrefab()
  14506. },
  14507. _replaceWithNestedPrefab: function() {
  14508. var t = this.node,
  14509. e = t._prefab;
  14510. e.root = t, e.asset = this.nestedPrefab, l.syncWithPrefab(t)
  14511. }
  14512. }), cc.StudioComponent = e.exports = a;
  14513. var h = cc.Class({
  14514. name: "cc.StudioWidget",
  14515. extends: cc.Widget,
  14516. editor: !1,
  14517. _validateTargetInDEV: function() {}
  14518. });
  14519. cc.StudioWidget = e.exports = h
  14520. }), {
  14521. "../utils/prefab-helper": 303
  14522. }],
  14523. 113: [(function(t, e, i) {
  14524. "use strict";
  14525. var n = t("../utils/gray-sprite-state"),
  14526. r = cc.Class({
  14527. name: "cc.Toggle",
  14528. extends: t("./CCButton"),
  14529. mixins: [n],
  14530. editor: !1,
  14531. properties: {
  14532. _N$isChecked: !0,
  14533. isChecked: {
  14534. get: function() {
  14535. return this._N$isChecked
  14536. },
  14537. set: function(t) {
  14538. if (t !== this._N$isChecked) {
  14539. var e = this.toggleGroup || this._toggleContainer;
  14540. e && e.enabled && this._N$isChecked && !e.allowSwitchOff || (this._N$isChecked = t, this._updateCheckMark(), e && e.enabled && e.updateToggles(this), this._emitToggleEvents())
  14541. }
  14542. },
  14543. tooltip: !1
  14544. },
  14545. toggleGroup: {
  14546. default: null,
  14547. tooltip: !1,
  14548. type: t("./CCToggleGroup")
  14549. },
  14550. checkMark: {
  14551. default: null,
  14552. type: cc.Sprite,
  14553. tooltip: !1
  14554. },
  14555. checkEvents: {
  14556. default: [],
  14557. type: cc.Component.EventHandler
  14558. },
  14559. _resizeToTarget: {
  14560. animatable: !1,
  14561. set: function(t) {
  14562. t && this._resizeNodeToTargetNode()
  14563. }
  14564. }
  14565. },
  14566. onEnable: function() {
  14567. this._super(), this._registerToggleEvent(), this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.addToggle(this)
  14568. },
  14569. onDisable: function() {
  14570. this._super(), this._unregisterToggleEvent(), this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.removeToggle(this)
  14571. },
  14572. _hideCheckMark: function() {
  14573. this._N$isChecked = !1, this._updateCheckMark()
  14574. },
  14575. toggle: function(t) {
  14576. this.isChecked = !this.isChecked
  14577. },
  14578. check: function() {
  14579. this.isChecked = !0
  14580. },
  14581. uncheck: function() {
  14582. this.isChecked = !1
  14583. },
  14584. _updateCheckMark: function() {
  14585. this.checkMark && (this.checkMark.node.active = !!this.isChecked)
  14586. },
  14587. _updateDisabledState: function() {
  14588. if (this._super(), this.enableAutoGrayEffect && this.checkMark) {
  14589. var t = !this.interactable;
  14590. this._switchGrayMaterial(t, this.checkMark)
  14591. }
  14592. },
  14593. _registerToggleEvent: function() {
  14594. this.node.on("click", this.toggle, this)
  14595. },
  14596. _unregisterToggleEvent: function() {
  14597. this.node.off("click", this.toggle, this)
  14598. },
  14599. _emitToggleEvents: function() {
  14600. this.node.emit("toggle", this), this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, this)
  14601. }
  14602. });
  14603. cc.Toggle = e.exports = r, t("../platform/js").get(r.prototype, "_toggleContainer", (function() {
  14604. var t = this.node.parent;
  14605. return cc.Node.isNode(t) ? t.getComponent(cc.ToggleContainer) : null
  14606. }))
  14607. }), {
  14608. "../platform/js": 218,
  14609. "../utils/gray-sprite-state": 296,
  14610. "./CCButton": 93,
  14611. "./CCToggleGroup": 115
  14612. }],
  14613. 114: [(function(t, e, i) {
  14614. "use strict";
  14615. var n = cc.Class({
  14616. name: "cc.ToggleContainer",
  14617. extends: cc.Component,
  14618. editor: !1,
  14619. properties: {
  14620. allowSwitchOff: {
  14621. tooltip: !1,
  14622. default: !1
  14623. },
  14624. checkEvents: {
  14625. default: [],
  14626. type: cc.Component.EventHandler
  14627. }
  14628. },
  14629. updateToggles: function(t) {
  14630. this.enabledInHierarchy && t.isChecked && (this.toggleItems.forEach((function(e) {
  14631. e !== t && e.isChecked && e.enabled && e._hideCheckMark()
  14632. })), this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, t))
  14633. },
  14634. _allowOnlyOneToggleChecked: function() {
  14635. var t = !1;
  14636. return this.toggleItems.forEach((function(e) {
  14637. t ? e._hideCheckMark() : e.isChecked && (t = !0)
  14638. })), t
  14639. },
  14640. _makeAtLeastOneToggleChecked: function() {
  14641. if (!this._allowOnlyOneToggleChecked() && !this.allowSwitchOff) {
  14642. var t = this.toggleItems;
  14643. t.length > 0 && t[0].check()
  14644. }
  14645. },
  14646. onEnable: function() {
  14647. this.node.on("child-added", this._allowOnlyOneToggleChecked, this), this.node.on("child-removed", this._makeAtLeastOneToggleChecked, this)
  14648. },
  14649. onDisable: function() {
  14650. this.node.off("child-added", this._allowOnlyOneToggleChecked, this), this.node.off("child-removed", this._makeAtLeastOneToggleChecked, this)
  14651. },
  14652. start: function() {
  14653. this._makeAtLeastOneToggleChecked()
  14654. }
  14655. });
  14656. t("../platform/js").get(n.prototype, "toggleItems", (function() {
  14657. return this.node.getComponentsInChildren(cc.Toggle)
  14658. })), cc.ToggleContainer = e.exports = n
  14659. }), {
  14660. "../platform/js": 218
  14661. }],
  14662. 115: [(function(t, e, i) {
  14663. "use strict";
  14664. var n = cc.Class({
  14665. name: "cc.ToggleGroup",
  14666. extends: cc.Component,
  14667. ctor: function() {
  14668. this._toggleItems = []
  14669. },
  14670. editor: !1,
  14671. properties: {
  14672. allowSwitchOff: {
  14673. tooltip: !1,
  14674. default: !1
  14675. },
  14676. toggleItems: {
  14677. get: function() {
  14678. return this._toggleItems
  14679. }
  14680. }
  14681. },
  14682. updateToggles: function(t) {
  14683. this.enabledInHierarchy && this._toggleItems.forEach((function(e) {
  14684. t.isChecked && e !== t && e.isChecked && e.enabled && e._hideCheckMark()
  14685. }))
  14686. },
  14687. addToggle: function(t) {
  14688. -1 === this._toggleItems.indexOf(t) && this._toggleItems.push(t), this._allowOnlyOneToggleChecked()
  14689. },
  14690. removeToggle: function(t) {
  14691. var e = this._toggleItems.indexOf(t);
  14692. e > -1 && this._toggleItems.splice(e, 1), this._makeAtLeastOneToggleChecked()
  14693. },
  14694. _allowOnlyOneToggleChecked: function() {
  14695. var t = !1;
  14696. return this._toggleItems.forEach((function(e) {
  14697. t && e.enabled && e._hideCheckMark(), e.isChecked && e.enabled && (t = !0)
  14698. })), t
  14699. },
  14700. _makeAtLeastOneToggleChecked: function() {
  14701. this._allowOnlyOneToggleChecked() || this.allowSwitchOff || this._toggleItems.length > 0 && (this._toggleItems[0].isChecked = !0)
  14702. },
  14703. start: function() {
  14704. this._makeAtLeastOneToggleChecked()
  14705. }
  14706. }),
  14707. r = !1;
  14708. t("../platform/js").get(cc, "ToggleGroup", (function() {
  14709. return r || (cc.logID(1405, "cc.ToggleGroup", "cc.ToggleContainer"), r = !0), n
  14710. })), e.exports = n
  14711. }), {
  14712. "../platform/js": 218
  14713. }],
  14714. 116: [(function(t, e, i) {
  14715. "use strict";
  14716. var n = cc.Class({
  14717. name: "cc.ViewGroup",
  14718. extends: t("./CCComponent")
  14719. });
  14720. cc.ViewGroup = e.exports = n
  14721. }), {
  14722. "./CCComponent": 95
  14723. }],
  14724. 117: [(function(t, e, i) {
  14725. "use strict";
  14726. var n = t("../base-ui/CCWidgetManager"),
  14727. r = n.AlignMode,
  14728. s = n._AlignFlags,
  14729. o = s.TOP,
  14730. a = s.MID,
  14731. l = s.BOT,
  14732. h = s.LEFT,
  14733. c = s.CENTER,
  14734. u = s.RIGHT,
  14735. _ = o | l,
  14736. f = h | u,
  14737. d = cc.Class({
  14738. name: "cc.Widget",
  14739. extends: t("./CCComponent"),
  14740. editor: !1,
  14741. properties: {
  14742. target: {
  14743. get: function() {
  14744. return this._target
  14745. },
  14746. set: function(t) {
  14747. this._target = t
  14748. },
  14749. type: cc.Node,
  14750. tooltip: !1
  14751. },
  14752. isAlignTop: {
  14753. get: function() {
  14754. return (this._alignFlags & o) > 0
  14755. },
  14756. set: function(t) {
  14757. this._setAlign(o, t)
  14758. },
  14759. animatable: !1,
  14760. tooltip: !1
  14761. },
  14762. isAlignVerticalCenter: {
  14763. get: function() {
  14764. return (this._alignFlags & a) > 0
  14765. },
  14766. set: function(t) {
  14767. t ? (this.isAlignTop = !1, this.isAlignBottom = !1, this._alignFlags |= a) : this._alignFlags &= ~a
  14768. },
  14769. animatable: !1,
  14770. tooltip: !1
  14771. },
  14772. isAlignBottom: {
  14773. get: function() {
  14774. return (this._alignFlags & l) > 0
  14775. },
  14776. set: function(t) {
  14777. this._setAlign(l, t)
  14778. },
  14779. animatable: !1,
  14780. tooltip: !1
  14781. },
  14782. isAlignLeft: {
  14783. get: function() {
  14784. return (this._alignFlags & h) > 0
  14785. },
  14786. set: function(t) {
  14787. this._setAlign(h, t)
  14788. },
  14789. animatable: !1,
  14790. tooltip: !1
  14791. },
  14792. isAlignHorizontalCenter: {
  14793. get: function() {
  14794. return (this._alignFlags & c) > 0
  14795. },
  14796. set: function(t) {
  14797. t ? (this.isAlignLeft = !1, this.isAlignRight = !1, this._alignFlags |= c) : this._alignFlags &= ~c
  14798. },
  14799. animatable: !1,
  14800. tooltip: !1
  14801. },
  14802. isAlignRight: {
  14803. get: function() {
  14804. return (this._alignFlags & u) > 0
  14805. },
  14806. set: function(t) {
  14807. this._setAlign(u, t)
  14808. },
  14809. animatable: !1,
  14810. tooltip: !1
  14811. },
  14812. isStretchWidth: {
  14813. get: function() {
  14814. return (this._alignFlags & f) === f
  14815. },
  14816. visible: !1
  14817. },
  14818. isStretchHeight: {
  14819. get: function() {
  14820. return (this._alignFlags & _) === _
  14821. },
  14822. visible: !1
  14823. },
  14824. top: {
  14825. get: function() {
  14826. return this._top
  14827. },
  14828. set: function(t) {
  14829. this._top = t
  14830. },
  14831. tooltip: !1
  14832. },
  14833. bottom: {
  14834. get: function() {
  14835. return this._bottom
  14836. },
  14837. set: function(t) {
  14838. this._bottom = t
  14839. },
  14840. tooltip: !1
  14841. },
  14842. left: {
  14843. get: function() {
  14844. return this._left
  14845. },
  14846. set: function(t) {
  14847. this._left = t
  14848. },
  14849. tooltip: !1
  14850. },
  14851. right: {
  14852. get: function() {
  14853. return this._right
  14854. },
  14855. set: function(t) {
  14856. this._right = t
  14857. },
  14858. tooltip: !1
  14859. },
  14860. horizontalCenter: {
  14861. get: function() {
  14862. return this._horizontalCenter
  14863. },
  14864. set: function(t) {
  14865. this._horizontalCenter = t
  14866. },
  14867. tooltip: !1
  14868. },
  14869. verticalCenter: {
  14870. get: function() {
  14871. return this._verticalCenter
  14872. },
  14873. set: function(t) {
  14874. this._verticalCenter = t
  14875. },
  14876. tooltip: !1
  14877. },
  14878. isAbsoluteHorizontalCenter: {
  14879. get: function() {
  14880. return this._isAbsHorizontalCenter
  14881. },
  14882. set: function(t) {
  14883. this._isAbsHorizontalCenter = t
  14884. },
  14885. animatable: !1
  14886. },
  14887. isAbsoluteVerticalCenter: {
  14888. get: function() {
  14889. return this._isAbsVerticalCenter
  14890. },
  14891. set: function(t) {
  14892. this._isAbsVerticalCenter = t
  14893. },
  14894. animatable: !1
  14895. },
  14896. isAbsoluteTop: {
  14897. get: function() {
  14898. return this._isAbsTop
  14899. },
  14900. set: function(t) {
  14901. this._isAbsTop = t
  14902. },
  14903. animatable: !1
  14904. },
  14905. isAbsoluteBottom: {
  14906. get: function() {
  14907. return this._isAbsBottom
  14908. },
  14909. set: function(t) {
  14910. this._isAbsBottom = t
  14911. },
  14912. animatable: !1
  14913. },
  14914. isAbsoluteLeft: {
  14915. get: function() {
  14916. return this._isAbsLeft
  14917. },
  14918. set: function(t) {
  14919. this._isAbsLeft = t
  14920. },
  14921. animatable: !1
  14922. },
  14923. isAbsoluteRight: {
  14924. get: function() {
  14925. return this._isAbsRight
  14926. },
  14927. set: function(t) {
  14928. this._isAbsRight = t
  14929. },
  14930. animatable: !1
  14931. },
  14932. alignMode: {
  14933. default: r.ON_WINDOW_RESIZE,
  14934. type: r,
  14935. tooltip: !1
  14936. },
  14937. _wasAlignOnce: {
  14938. default: void 0,
  14939. formerlySerializedAs: "isAlignOnce"
  14940. },
  14941. _target: null,
  14942. _alignFlags: 0,
  14943. _left: 0,
  14944. _right: 0,
  14945. _top: 0,
  14946. _bottom: 0,
  14947. _verticalCenter: 0,
  14948. _horizontalCenter: 0,
  14949. _isAbsLeft: !0,
  14950. _isAbsRight: !0,
  14951. _isAbsTop: !0,
  14952. _isAbsBottom: !0,
  14953. _isAbsHorizontalCenter: !0,
  14954. _isAbsVerticalCenter: !0,
  14955. _originalWidth: 0,
  14956. _originalHeight: 0
  14957. },
  14958. statics: {
  14959. AlignMode: r
  14960. },
  14961. onLoad: function() {
  14962. void 0 !== this._wasAlignOnce && (this.alignMode = this._wasAlignOnce ? r.ONCE : r.ALWAYS, this._wasAlignOnce = void 0)
  14963. },
  14964. onEnable: function() {
  14965. n.add(this)
  14966. },
  14967. onDisable: function() {
  14968. n.remove(this)
  14969. },
  14970. _validateTargetInDEV: !1,
  14971. _setAlign: function(t, e) {
  14972. if (e !== (this._alignFlags & t) > 0) {
  14973. var i = (t & f) > 0;
  14974. e ? (this._alignFlags |= t, i ? (this.isAlignHorizontalCenter = !1, this.isStretchWidth && (this._originalWidth = this.node.width)) : (this.isAlignVerticalCenter = !1, this.isStretchHeight && (this._originalHeight = this.node.height))) : (i ? this.isStretchWidth && (this.node.width = this._originalWidth) : this.isStretchHeight && (this.node.height = this._originalHeight), this._alignFlags &= ~t)
  14975. }
  14976. },
  14977. updateAlignment: function() {
  14978. n.updateAlignment(this.node)
  14979. }
  14980. });
  14981. Object.defineProperty(d.prototype, "isAlignOnce", {
  14982. get: function() {
  14983. return this.alignMode === r.ONCE
  14984. },
  14985. set: function(t) {
  14986. this.alignMode = t ? r.ONCE : r.ALWAYS
  14987. }
  14988. }), cc.Widget = e.exports = d
  14989. }), {
  14990. "../base-ui/CCWidgetManager": 79,
  14991. "./CCComponent": 95
  14992. }],
  14993. 118: [(function(t, e, i) {
  14994. "use strict";
  14995. var n = t("../../platform/CCMacro"),
  14996. r = t("../editbox/EditBoxImplBase"),
  14997. s = t("../CCLabel"),
  14998. o = t("./types"),
  14999. a = o.InputMode,
  15000. l = o.InputFlag,
  15001. h = o.KeyboardReturnType;
  15002. function c(t) {
  15003. return t.replace(/(?:^|\s)\S/g, (function(t) {
  15004. return t.toUpperCase()
  15005. }))
  15006. }
  15007. function u(t) {
  15008. return t.charAt(0).toUpperCase() + t.slice(1)
  15009. }
  15010. var _ = cc.Class({
  15011. name: "cc.EditBox",
  15012. extends: cc.Component,
  15013. editor: !1,
  15014. properties: {
  15015. _useOriginalSize: !0,
  15016. _string: "",
  15017. string: {
  15018. tooltip: !1,
  15019. get: function() {
  15020. return this._string
  15021. },
  15022. set: function(t) {
  15023. t = "" + t, this.maxLength >= 0 && t.length >= this.maxLength && (t = t.slice(0, this.maxLength)), this._string = t, this._updateString(t)
  15024. }
  15025. },
  15026. textLabel: {
  15027. tooltip: !1,
  15028. default: null,
  15029. type: s,
  15030. notify: function(t) {
  15031. this.textLabel && this.textLabel !== t && (this._updateTextLabel(), this._updateLabels())
  15032. }
  15033. },
  15034. placeholderLabel: {
  15035. tooltip: !1,
  15036. default: null,
  15037. type: s,
  15038. notify: function(t) {
  15039. this.placeholderLabel && this.placeholderLabel !== t && (this._updatePlaceholderLabel(), this._updateLabels())
  15040. }
  15041. },
  15042. background: {
  15043. tooltip: !1,
  15044. default: null,
  15045. type: cc.Sprite,
  15046. notify: function(t) {
  15047. this.background && this.background !== t && this._updateBackgroundSprite()
  15048. }
  15049. },
  15050. _N$backgroundImage: {
  15051. default: void 0,
  15052. type: cc.SpriteFrame
  15053. },
  15054. backgroundImage: {
  15055. get: function() {
  15056. return this.background ? this.background.spriteFrame : null
  15057. },
  15058. set: function(t) {
  15059. this.background && (this.background.spriteFrame = t)
  15060. }
  15061. },
  15062. returnType: {
  15063. default: h.DEFAULT,
  15064. tooltip: !1,
  15065. displayName: "KeyboardReturnType",
  15066. type: h
  15067. },
  15068. _N$returnType: {
  15069. default: void 0,
  15070. type: cc.Float
  15071. },
  15072. inputFlag: {
  15073. tooltip: !1,
  15074. default: l.DEFAULT,
  15075. type: l,
  15076. notify: function() {
  15077. this._updateString(this._string)
  15078. }
  15079. },
  15080. inputMode: {
  15081. tooltip: !1,
  15082. default: a.ANY,
  15083. type: a,
  15084. notify: function(t) {
  15085. this.inputMode !== t && (this._updateTextLabel(), this._updatePlaceholderLabel())
  15086. }
  15087. },
  15088. fontSize: {
  15089. get: function() {
  15090. return this.textLabel ? this.textLabel.fontSize : null
  15091. },
  15092. set: function(t) {
  15093. this.textLabel && (this.textLabel.fontSize = t)
  15094. }
  15095. },
  15096. _N$fontSize: {
  15097. default: void 0,
  15098. type: cc.Float
  15099. },
  15100. lineHeight: {
  15101. get: function() {
  15102. return this.textLabel ? this.textLabel.lineHeight : null
  15103. },
  15104. set: function(t) {
  15105. this.textLabel && (this.textLabel.lineHeight = t)
  15106. }
  15107. },
  15108. _N$lineHeight: {
  15109. default: void 0,
  15110. type: cc.Float
  15111. },
  15112. fontColor: {
  15113. get: function() {
  15114. return this.textLabel ? this.textLabel.node.color : null
  15115. },
  15116. set: function(t) {
  15117. this.textLabel && (this.textLabel.node.color = t, this.textLabel.node.opacity = t.a)
  15118. }
  15119. },
  15120. _N$fontColor: void 0,
  15121. placeholder: {
  15122. tooltip: !1,
  15123. get: function() {
  15124. return this.placeholderLabel ? this.placeholderLabel.string : ""
  15125. },
  15126. set: function(t) {
  15127. this.placeholderLabel && (this.placeholderLabel.string = t)
  15128. }
  15129. },
  15130. _N$placeholder: {
  15131. default: void 0,
  15132. type: cc.String
  15133. },
  15134. placeholderFontSize: {
  15135. get: function() {
  15136. return this.placeholderLabel ? this.placeholderLabel.fontSize : null
  15137. },
  15138. set: function(t) {
  15139. this.placeholderLabel && (this.placeholderLabel.fontSize = t)
  15140. }
  15141. },
  15142. _N$placeholderFontSize: {
  15143. default: void 0,
  15144. type: cc.Float
  15145. },
  15146. placeholderFontColor: {
  15147. get: function() {
  15148. return this.placeholderLabel ? this.placeholderLabel.node.color : null
  15149. },
  15150. set: function(t) {
  15151. this.placeholderLabel && (this.placeholderLabel.node.color = t, this.placeholderLabel.node.opacity = t.a)
  15152. }
  15153. },
  15154. _N$placeholderFontColor: void 0,
  15155. maxLength: {
  15156. tooltip: !1,
  15157. default: 20
  15158. },
  15159. _N$maxLength: {
  15160. default: void 0,
  15161. type: cc.Float
  15162. },
  15163. stayOnTop: {
  15164. default: !1,
  15165. notify: function() {
  15166. cc.warn("editBox.stayOnTop is removed since v2.1.")
  15167. }
  15168. },
  15169. _tabIndex: 0,
  15170. tabIndex: {
  15171. tooltip: !1,
  15172. get: function() {
  15173. return this._tabIndex
  15174. },
  15175. set: function(t) {
  15176. this._tabIndex !== t && (this._tabIndex = t, this._impl && this._impl.setTabIndex(t))
  15177. }
  15178. },
  15179. editingDidBegan: {
  15180. default: [],
  15181. type: cc.Component.EventHandler
  15182. },
  15183. textChanged: {
  15184. default: [],
  15185. type: cc.Component.EventHandler
  15186. },
  15187. editingDidEnded: {
  15188. default: [],
  15189. type: cc.Component.EventHandler
  15190. },
  15191. editingReturn: {
  15192. default: [],
  15193. type: cc.Component.EventHandler
  15194. }
  15195. },
  15196. statics: {
  15197. _ImplClass: r,
  15198. KeyboardReturnType: h,
  15199. InputFlag: l,
  15200. InputMode: a
  15201. },
  15202. _init: function() {
  15203. this._upgradeComp(), this._isLabelVisible = !0, this.node.on(cc.Node.EventType.SIZE_CHANGED, this._syncSize, this), (this._impl = new _._ImplClass).init(this), this._updateString(this._string), this._syncSize()
  15204. },
  15205. _updateBackgroundSprite: function() {
  15206. var t = this.background;
  15207. if (!t) {
  15208. var e = this.node.getChildByName("BACKGROUND_SPRITE");
  15209. e || (e = new cc.Node("BACKGROUND_SPRITE")), (t = e.getComponent(cc.Sprite)) || (t = e.addComponent(cc.Sprite)), e.parent = this.node, this.background = t
  15210. }
  15211. t.type = cc.Sprite.Type.SLICED, void 0 !== this._N$backgroundImage && (t.spriteFrame = this._N$backgroundImage, this._N$backgroundImage = void 0)
  15212. },
  15213. _updateTextLabel: function() {
  15214. var t = this.textLabel;
  15215. if (!t) {
  15216. var e = this.node.getChildByName("TEXT_LABEL");
  15217. e || (e = new cc.Node("TEXT_LABEL")), (t = e.getComponent(s)) || (t = e.addComponent(s)), e.parent = this.node, this.textLabel = t
  15218. }
  15219. t.node.setAnchorPoint(0, 1), t.overflow = s.Overflow.CLAMP, this.inputMode === a.ANY ? (t.verticalAlign = n.VerticalTextAlignment.TOP, t.enableWrapText = !0) : (t.verticalAlign = n.VerticalTextAlignment.CENTER, t.enableWrapText = !1), t.string = this._updateLabelStringStyle(this._string), void 0 !== this._N$fontColor && (t.node.color = this._N$fontColor, t.node.opacity = this._N$fontColor.a, this._N$fontColor = void 0), void 0 !== this._N$fontSize && (t.fontSize = this._N$fontSize, this._N$fontSize = void 0), void 0 !== this._N$lineHeight && (t.lineHeight = this._N$lineHeight, this._N$lineHeight = void 0)
  15220. },
  15221. _updatePlaceholderLabel: function() {
  15222. var t = this.placeholderLabel;
  15223. if (!t) {
  15224. var e = this.node.getChildByName("PLACEHOLDER_LABEL");
  15225. e || (e = new cc.Node("PLACEHOLDER_LABEL")), (t = e.getComponent(s)) || (t = e.addComponent(s)), e.parent = this.node, this.placeholderLabel = t
  15226. }
  15227. t.node.setAnchorPoint(0, 1), t.overflow = s.Overflow.CLAMP, this.inputMode === a.ANY ? (t.verticalAlign = n.VerticalTextAlignment.TOP, t.enableWrapText = !0) : (t.verticalAlign = n.VerticalTextAlignment.CENTER, t.enableWrapText = !1), t.string = this.placeholder, void 0 !== this._N$placeholderFontColor && (t.node.color = this._N$placeholderFontColor, t.node.opacity = this._N$placeholderFontColor.a, this._N$placeholderFontColor = void 0), void 0 !== this._N$placeholderFontSize && (t.fontSize = this._N$placeholderFontSize, this._N$placeholderFontSize = void 0)
  15228. },
  15229. _upgradeComp: function() {
  15230. void 0 !== this._N$returnType && (this.returnType = this._N$returnType, this._N$returnType = void 0), void 0 !== this._N$maxLength && (this.maxLength = this._N$maxLength, this._N$maxLength = void 0), void 0 !== this._N$backgroundImage && this._updateBackgroundSprite(), void 0 === this._N$fontColor && void 0 === this._N$fontSize && void 0 === this._N$lineHeight || this._updateTextLabel(), void 0 === this._N$placeholderFontColor && void 0 === this._N$placeholderFontSize || this._updatePlaceholderLabel(), void 0 !== this._N$placeholder && (this.placeholder = this._N$placeholder, this._N$placeholder = void 0)
  15231. },
  15232. _syncSize: function() {
  15233. if (this._impl) {
  15234. var t = this.node.getContentSize();
  15235. this._impl.setSize(t.width, t.height)
  15236. }
  15237. },
  15238. _showLabels: function() {
  15239. this._isLabelVisible = !0, this._updateLabels()
  15240. },
  15241. _hideLabels: function() {
  15242. this._isLabelVisible = !1, this.textLabel && (this.textLabel.node.active = !1), this.placeholderLabel && (this.placeholderLabel.node.active = !1)
  15243. },
  15244. _updateLabels: function() {
  15245. if (this._isLabelVisible) {
  15246. var t = this._string;
  15247. this.textLabel && (this.textLabel.node.active = "" !== t), this.placeholderLabel && (this.placeholderLabel.node.active = "" === t)
  15248. }
  15249. },
  15250. _updateString: function(t) {
  15251. var e = this.textLabel;
  15252. if (e) {
  15253. var i = t;
  15254. i && (i = this._updateLabelStringStyle(i)), e.string = i, this._updateLabels()
  15255. }
  15256. },
  15257. _updateLabelStringStyle: function(t, e) {
  15258. var i = this.inputFlag;
  15259. if (e || i !== l.PASSWORD) i === l.INITIAL_CAPS_ALL_CHARACTERS ? t = t.toUpperCase() : i === l.INITIAL_CAPS_WORD ? t = c(t) : i === l.INITIAL_CAPS_SENTENCE && (t = u(t));
  15260. else {
  15261. for (var n = "", r = t.length, s = 0; s < r; ++s) n += "\u25cf";
  15262. t = n
  15263. }
  15264. return t
  15265. },
  15266. editBoxEditingDidBegan: function() {
  15267. cc.Component.EventHandler.emitEvents(this.editingDidBegan, this), this.node.emit("editing-did-began", this)
  15268. },
  15269. editBoxEditingDidEnded: function() {
  15270. cc.Component.EventHandler.emitEvents(this.editingDidEnded, this), this.node.emit("editing-did-ended", this)
  15271. },
  15272. editBoxTextChanged: function(t) {
  15273. t = this._updateLabelStringStyle(t, !0), this.string = t, cc.Component.EventHandler.emitEvents(this.textChanged, t, this), this.node.emit("text-changed", this)
  15274. },
  15275. editBoxEditingReturn: function() {
  15276. cc.Component.EventHandler.emitEvents(this.editingReturn, this), this.node.emit("editing-return", this)
  15277. },
  15278. onEnable: function() {
  15279. this._registerEvent(), this._impl && this._impl.enable()
  15280. },
  15281. onDisable: function() {
  15282. this._unregisterEvent(), this._impl && this._impl.disable()
  15283. },
  15284. onDestroy: function() {
  15285. this._impl && this._impl.clear()
  15286. },
  15287. __preload: function() {
  15288. this._init()
  15289. },
  15290. _registerEvent: function() {
  15291. this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this)
  15292. },
  15293. _unregisterEvent: function() {
  15294. this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this)
  15295. },
  15296. _onTouchBegan: function(t) {
  15297. t.stopPropagation()
  15298. },
  15299. _onTouchCancel: function(t) {
  15300. t.stopPropagation()
  15301. },
  15302. _onTouchEnded: function(t) {
  15303. this._impl && this._impl.beginEditing(), t.stopPropagation()
  15304. },
  15305. setFocus: function() {
  15306. cc.warnID(1400, "setFocus()", "focus()"), this._impl && this._impl.setFocus(!0)
  15307. },
  15308. focus: function() {
  15309. this._impl && this._impl.setFocus(!0)
  15310. },
  15311. blur: function() {
  15312. this._impl && this._impl.setFocus(!1)
  15313. },
  15314. isFocused: function() {
  15315. return !!this._impl && this._impl.isFocused()
  15316. },
  15317. update: function() {
  15318. this._impl && this._impl.update()
  15319. }
  15320. });
  15321. cc.EditBox = e.exports = _, cc.sys.isBrowser && t("./WebEditBoxImpl")
  15322. }), {
  15323. "../../platform/CCMacro": 203,
  15324. "../CCLabel": 97,
  15325. "../editbox/EditBoxImplBase": 119,
  15326. "./WebEditBoxImpl": 120,
  15327. "./types": 122
  15328. }],
  15329. 119: [(function(t, e, i) {
  15330. "use strict";
  15331. var n = cc.Class({
  15332. ctor: function() {
  15333. this._delegate = null, this._editing = !1
  15334. },
  15335. init: function(t) {},
  15336. enable: function() {},
  15337. disable: function() {
  15338. this._editing && this.endEditing()
  15339. },
  15340. clear: function() {},
  15341. update: function() {},
  15342. setTabIndex: function(t) {},
  15343. setSize: function(t, e) {},
  15344. setFocus: function(t) {
  15345. t ? this.beginEditing() : this.endEditing()
  15346. },
  15347. isFocused: function() {
  15348. return this._editing
  15349. },
  15350. beginEditing: function() {},
  15351. endEditing: function() {}
  15352. });
  15353. e.exports = n
  15354. }), {}],
  15355. 120: [(function(t, e, i) {
  15356. "use strict";
  15357. var n = t("../../platform/utils"),
  15358. r = t("../../platform/CCMacro"),
  15359. s = t("./types"),
  15360. o = t("../CCLabel"),
  15361. a = t("./tabIndexUtil"),
  15362. l = cc.EditBox,
  15363. h = cc.js,
  15364. c = s.InputMode,
  15365. u = s.InputFlag,
  15366. _ = s.KeyboardReturnType,
  15367. f = cc.vmath,
  15368. d = {
  15369. zoomInvalid: !1
  15370. };
  15371. cc.sys.OS_ANDROID !== cc.sys.os || cc.sys.browserType !== cc.sys.BROWSER_TYPE_SOUGOU && cc.sys.browserType !== cc.sys.BROWSER_TYPE_360 || (d.zoomInvalid = !0);
  15372. var p = 0,
  15373. m = cc.v3(),
  15374. y = null,
  15375. v = !1,
  15376. g = !1,
  15377. x = l._ImplClass;
  15378. function b() {
  15379. x.call(this), this._domId = "EditBoxId_" + ++p, this._placeholderStyleSheet = null, this._elem = null, this._isTextArea = !1, this._worldMat = f.mat4.create(), this._cameraMat = f.mat4.create(), this._m00 = 0, this._m01 = 0, this._m04 = 0, this._m05 = 0, this._m12 = 0, this._m13 = 0, this._w = 0, this._h = 0, this._inputMode = null, this._inputFlag = null, this._returnType = null, this._eventListeners = {}, this._textLabelFont = null, this._textLabelFontSize = null, this._textLabelFontColor = null, this._textLabelAlign = null, this._placeholderLabelFont = null, this._placeholderLabelFontSize = null, this._placeholderLabelFontColor = null, this._placeholderLabelAlign = null, this._placeholderLineHeight = null
  15380. }
  15381. h.extend(b, x), l._ImplClass = b, Object.assign(b.prototype, {
  15382. init: function(t) {
  15383. t && (this._delegate = t, t.inputMode === c.ANY ? this._createTextArea() : this._createInput(), a.add(this), this.setTabIndex(t.tabIndex), this._initStyleSheet(), this._registerEventListeners(), this._addDomToGameContainer(), v = cc.view.isAutoFullScreenEnabled(), g = cc.view._resizeWithBrowserSize)
  15384. },
  15385. clear: function() {
  15386. this._removeEventListeners(), this._removeDomFromGameContainer(), a.remove(this), y === this && (y = null)
  15387. },
  15388. update: function() {
  15389. this._updateMatrix()
  15390. },
  15391. setTabIndex: function(t) {
  15392. this._elem.tabIndex = t, a.resort()
  15393. },
  15394. setSize: function(t, e) {
  15395. var i = this._elem;
  15396. i.style.width = t + "px", i.style.height = e + "px"
  15397. },
  15398. beginEditing: function() {
  15399. y && y !== this && y.setFocus(!1), this._editing = !0, y = this, this._delegate.editBoxEditingDidBegan(), this._showDom(), this._elem.focus()
  15400. },
  15401. endEditing: function() {
  15402. this._elem && this._elem.blur()
  15403. },
  15404. _createInput: function() {
  15405. this._isTextArea = !1, this._elem = document.createElement("input")
  15406. },
  15407. _createTextArea: function() {
  15408. this._isTextArea = !0, this._elem = document.createElement("textarea")
  15409. },
  15410. _addDomToGameContainer: function() {
  15411. cc.game.container.appendChild(this._elem), document.head.appendChild(this._placeholderStyleSheet)
  15412. },
  15413. _removeDomFromGameContainer: function() {
  15414. n.contains(cc.game.container, this._elem) && cc.game.container.removeChild(this._elem), n.contains(document.head, this._placeholderStyleSheet) && document.head.removeChild(this._placeholderStyleSheet), delete this._elem, delete this._placeholderStyleSheet
  15415. },
  15416. _showDom: function() {
  15417. this._updateMaxLength(), this._updateInputType(), this._updateStyleSheet(), this._elem.style.display = "", this._delegate._hideLabels(), cc.sys.isMobile && this._showDomOnMobile()
  15418. },
  15419. _hideDom: function() {
  15420. this._elem.style.display = "none", this._delegate._showLabels(), cc.sys.isMobile && this._hideDomOnMobile()
  15421. },
  15422. _showDomOnMobile: function() {
  15423. cc.sys.os === cc.sys.OS_ANDROID && (v && (cc.view.enableAutoFullScreen(!1), cc.screen.exitFullScreen()), g && cc.view.resizeWithBrowserSize(!1), this._adjustWindowScroll())
  15424. },
  15425. _hideDomOnMobile: function() {
  15426. cc.sys.os === cc.sys.OS_ANDROID && setTimeout((function() {
  15427. y || (v && cc.view.enableAutoFullScreen(!0), g && cc.view.resizeWithBrowserSize(!0))
  15428. }), 800), this._scrollBackWindow()
  15429. },
  15430. _adjustWindowScroll: function() {
  15431. var t = this;
  15432. setTimeout((function() {
  15433. window.scrollY < 100 && t._elem.scrollIntoView({
  15434. block: "start",
  15435. inline: "nearest",
  15436. behavior: "smooth"
  15437. })
  15438. }), 800)
  15439. },
  15440. _scrollBackWindow: function() {
  15441. setTimeout((function() {
  15442. var t = cc.sys;
  15443. t.browserType !== t.BROWSER_TYPE_WECHAT || t.os !== t.OS_IOS ? window.scrollTo(0, 0) : window.top && window.top.scrollTo(0, 0)
  15444. }), 800)
  15445. },
  15446. _updateMatrix: function() {
  15447. var t = this._delegate.node;
  15448. t.getWorldMatrix(this._worldMat);
  15449. var e = this._worldMat,
  15450. i = e.m;
  15451. if (this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
  15452. this._m00 = i[0], this._m01 = i[1], this._m04 = i[4], this._m05 = i[5], this._m12 = i[12], this._m13 = i[13], this._w = t._contentSize.width, this._h = t._contentSize.height;
  15453. var n = cc.view._scaleX,
  15454. r = cc.view._scaleY,
  15455. s = cc.view._viewportRect,
  15456. o = cc.view._devicePixelRatio;
  15457. m.x = -t._anchorPoint.x * this._w, m.y = -t._anchorPoint.y * this._h, f.mat4.translate(e, e, m);
  15458. var a = void 0;
  15459. cc.Camera.findCamera(t).getWorldToScreenMatrix2D(this._cameraMat), a = this._cameraMat, f.mat4.mul(a, a, e), n /= o, r /= o;
  15460. var l = cc.game.container,
  15461. h = a.m,
  15462. c = h[0] * n,
  15463. u = h[1],
  15464. _ = h[4],
  15465. p = h[5] * r,
  15466. y = l && l.style.paddingLeft && parseInt(l.style.paddingLeft);
  15467. y += s.x / o;
  15468. var v = l && l.style.paddingBottom && parseInt(l.style.paddingBottom);
  15469. v += s.y / o;
  15470. var g = h[12] * n + y,
  15471. x = h[13] * r + v;
  15472. d.zoomInvalid && (this.setSize(t.width * c, t.height * p), c = 1, p = 1);
  15473. var b = this._elem,
  15474. A = "matrix(" + c + "," + -u + "," + -_ + "," + p + "," + g + "," + -x + ")";
  15475. b.style.transform = A, b.style["-webkit-transform"] = A, b.style["transform-origin"] = "0px 100% 0px", b.style["-webkit-transform-origin"] = "0px 100% 0px"
  15476. }
  15477. },
  15478. _updateInputType: function() {
  15479. var t = this._delegate,
  15480. e = t.inputMode,
  15481. i = t.inputFlag,
  15482. n = t.returnType,
  15483. r = this._elem;
  15484. if (this._inputMode !== e || this._inputFlag !== i || this._returnType !== n) {
  15485. if (this._inputMode = e, this._inputFlag = i, this._returnType = n, this._isTextArea) {
  15486. var s = "none";
  15487. return i === u.INITIAL_CAPS_ALL_CHARACTERS ? s = "uppercase" : i === u.INITIAL_CAPS_WORD && (s = "capitalize"), void(r.style.textTransform = s)
  15488. }
  15489. if (i !== u.PASSWORD) {
  15490. var o = r.type;
  15491. e === c.EMAIL_ADDR ? o = "email" : e === c.NUMERIC || e === c.DECIMAL ? o = "number" : e === c.PHONE_NUMBER ? (o = "number", r.pattern = "[0-9]*") : e === c.URL ? o = "url" : (o = "text", n === _.SEARCH && (o = "search")), r.type = o;
  15492. var a = "none";
  15493. i === u.INITIAL_CAPS_ALL_CHARACTERS ? a = "uppercase" : i === u.INITIAL_CAPS_WORD && (a = "capitalize"), r.style.textTransform = a
  15494. } else r.type = "password"
  15495. }
  15496. },
  15497. _updateMaxLength: function() {
  15498. var t = this._delegate.maxLength;
  15499. t < 0 && (t = 65535), this._elem.maxLength = t
  15500. },
  15501. _initStyleSheet: function() {
  15502. var t = this._elem;
  15503. t.style.display = "none", t.style.border = 0, t.style.background = "transparent", t.style.width = "100%", t.style.height = "100%", t.style.active = 0, t.style.outline = "medium", t.style.padding = "0", t.style.textTransform = "uppercase", t.style.position = "absolute", t.style.bottom = "0px", t.style.left = "2px", t.className = "cocosEditBox", t.id = this._domId, this._isTextArea ? (t.style.resize = "none", t.style.overflow_y = "scroll") : (t.type = "text", t.style["-moz-appearance"] = "textfield"), this._placeholderStyleSheet = document.createElement("style")
  15504. },
  15505. _updateStyleSheet: function() {
  15506. var t = this._delegate,
  15507. e = this._elem;
  15508. e.value = t.string, e.placeholder = t.placeholder, this._updateTextLabel(t.textLabel), this._updatePlaceholderLabel(t.placeholderLabel)
  15509. },
  15510. _updateTextLabel: function(t) {
  15511. if (t) {
  15512. var e = t.font;
  15513. e = !e || e instanceof cc.BitmapFont ? t.fontFamily : e._fontFamily;
  15514. var i = t.fontSize * t.node.scaleY;
  15515. if (this._textLabelFont !== e || this._textLabelFontSize !== i || this._textLabelFontColor !== t.fontColor || this._textLabelAlign !== t.horizontalAlign) {
  15516. this._textLabelFont = e, this._textLabelFontSize = i, this._textLabelFontColor = t.fontColor, this._textLabelAlign = t.horizontalAlign;
  15517. var n = this._elem;
  15518. switch (n.style.fontSize = i + "px", n.style.color = t.node.color.toCSS("rgba"), n.style.fontFamily = e, t.horizontalAlign) {
  15519. case o.HorizontalAlign.LEFT:
  15520. n.style.textAlign = "left";
  15521. break;
  15522. case o.HorizontalAlign.CENTER:
  15523. n.style.textAlign = "center";
  15524. break;
  15525. case o.HorizontalAlign.RIGHT:
  15526. n.style.textAlign = "right"
  15527. }
  15528. }
  15529. }
  15530. },
  15531. _updatePlaceholderLabel: function(t) {
  15532. if (t) {
  15533. var e = t.font;
  15534. e = !e || e instanceof cc.BitmapFont ? t.fontFamily : t.font._fontFamily;
  15535. var i = t.fontSize * t.node.scaleY;
  15536. if (this._placeholderLabelFont !== e || this._placeholderLabelFontSize !== i || this._placeholderLabelFontColor !== t.fontColor || this._placeholderLabelAlign !== t.horizontalAlign || this._placeholderLineHeight !== t.fontSize) {
  15537. this._placeholderLabelFont = e, this._placeholderLabelFontSize = i, this._placeholderLabelFontColor = t.fontColor, this._placeholderLabelAlign = t.horizontalAlign, this._placeholderLineHeight = t.fontSize;
  15538. var n = this._placeholderStyleSheet,
  15539. r = t.node.color.toCSS("rgba"),
  15540. s = t.fontSize,
  15541. a = void 0;
  15542. switch (t.horizontalAlign) {
  15543. case o.HorizontalAlign.LEFT:
  15544. a = "left";
  15545. break;
  15546. case o.HorizontalAlign.CENTER:
  15547. a = "center";
  15548. break;
  15549. case o.HorizontalAlign.RIGHT:
  15550. a = "right"
  15551. }
  15552. n.innerHTML = "#" + this._domId + "::-webkit-input-placeholder,#" + this._domId + "::-moz-placeholder,#" + this._domId + ":-ms-input-placeholder{text-transform: initial; font-family: " + e + "; font-size: " + i + "px; color: " + r + "; line-height: " + s + "px; text-align: " + a + ";}", cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE && (n.innerHTML += "#" + this._domId + "::-ms-clear{display: none;}")
  15553. }
  15554. }
  15555. },
  15556. _registerEventListeners: function() {
  15557. var t = this,
  15558. e = this._elem,
  15559. i = !1,
  15560. n = this._eventListeners;
  15561. n.compositionStart = function() {
  15562. i = !0
  15563. }, n.compositionEnd = function() {
  15564. i = !1, t._delegate.editBoxTextChanged(e.value)
  15565. }, n.onInput = function() {
  15566. i || t._delegate.editBoxTextChanged(e.value)
  15567. }, n.onClick = function(e) {
  15568. t._editing && cc.sys.isMobile && t._adjustWindowScroll()
  15569. }, n.onKeydown = function(i) {
  15570. i.keyCode === r.KEY.enter ? (i.stopPropagation(), t._delegate.editBoxEditingReturn(), t._isTextArea || e.blur()) : i.keyCode === r.KEY.tab && (i.stopPropagation(), i.preventDefault(), a.next(t))
  15571. }, n.onBlur = function() {
  15572. t._editing = !1, y = null, t._hideDom(), t._delegate.editBoxEditingDidEnded()
  15573. }, e.addEventListener("compositionstart", n.compositionStart), e.addEventListener("compositionend", n.compositionEnd), e.addEventListener("input", n.onInput), e.addEventListener("keydown", n.onKeydown), e.addEventListener("blur", n.onBlur), e.addEventListener("touchstart", n.onClick)
  15574. },
  15575. _removeEventListeners: function() {
  15576. var t = this._elem,
  15577. e = this._eventListeners;
  15578. t.removeEventListener("compositionstart", e.compositionStart), t.removeEventListener("compositionend", e.compositionEnd), t.removeEventListener("input", e.onInput), t.removeEventListener("keydown", e.onKeydown), t.removeEventListener("blur", e.onBlur), t.removeEventListener("touchstart", e.onClick), e.compositionStart = null, e.compositionEnd = null, e.onInput = null, e.onKeydown = null, e.onBlur = null, e.onClick = null
  15579. }
  15580. })
  15581. }), {
  15582. "../../platform/CCMacro": 203,
  15583. "../../platform/utils": 222,
  15584. "../CCLabel": 97,
  15585. "./tabIndexUtil": 121,
  15586. "./types": 122
  15587. }],
  15588. 121: [(function(t, e, i) {
  15589. "use strict";
  15590. e.exports = {
  15591. _tabIndexList: [],
  15592. add: function(t) {
  15593. var e = this._tabIndexList; - 1 === e.indexOf(t) && e.push(t)
  15594. },
  15595. remove: function(t) {
  15596. var e = this._tabIndexList,
  15597. i = e.indexOf(t); - 1 !== i && e.splice(i, 1)
  15598. },
  15599. resort: function() {
  15600. this._tabIndexList.sort((function(t, e) {
  15601. return t._delegate._tabIndex - e._delegate._tabIndex
  15602. }))
  15603. },
  15604. next: function(t) {
  15605. var e = this._tabIndexList,
  15606. i = e.indexOf(t);
  15607. if (t.setFocus(!1), -1 !== i) {
  15608. var n = e[i + 1];
  15609. n && n._delegate._tabIndex >= 0 && n.setFocus(!0)
  15610. }
  15611. }
  15612. }
  15613. }), {}],
  15614. 122: [(function(t, e, i) {
  15615. "use strict";
  15616. var n = cc.Enum({
  15617. DEFAULT: 0,
  15618. DONE: 1,
  15619. SEND: 2,
  15620. SEARCH: 3,
  15621. GO: 4,
  15622. NEXT: 5
  15623. }),
  15624. r = cc.Enum({
  15625. ANY: 0,
  15626. EMAIL_ADDR: 1,
  15627. NUMERIC: 2,
  15628. PHONE_NUMBER: 3,
  15629. URL: 4,
  15630. DECIMAL: 5,
  15631. SINGLE_LINE: 6
  15632. }),
  15633. s = cc.Enum({
  15634. PASSWORD: 0,
  15635. SENSITIVE: 1,
  15636. INITIAL_CAPS_WORD: 2,
  15637. INITIAL_CAPS_SENTENCE: 3,
  15638. INITIAL_CAPS_ALL_CHARACTERS: 4,
  15639. DEFAULT: 5
  15640. });
  15641. e.exports = {
  15642. KeyboardReturnType: n,
  15643. InputMode: r,
  15644. InputFlag: s
  15645. }
  15646. }), {}],
  15647. 123: [(function(t, e, i) {
  15648. "use strict";
  15649. t("./CCComponent"), t("./CCComponentEventHandler"), t("./missing-script");
  15650. var n = t("./WXSubContextView"),
  15651. r = t("./SwanSubContextView");
  15652. n || (n = cc.Class({
  15653. name: "cc.WXSubContextView",
  15654. extends: cc.Component
  15655. })), r || (r = cc.Class({
  15656. name: "cc.SwanSubContextView",
  15657. extends: cc.Component
  15658. }));
  15659. var s = [t("./CCSprite"), t("./CCWidget"), t("./CCCanvas"), t("./CCAudioSource"), t("./CCAnimation"), t("./CCButton"), t("./CCLabel"), t("./CCProgressBar"), t("./CCMask"), t("./CCScrollBar"), t("./CCScrollView"), t("./CCPageViewIndicator"), t("./CCPageView"), t("./CCSlider"), t("./CCLayout"), t("./editbox/CCEditBox"), t("./CCLabelOutline"), t("./CCLabelShadow"), t("./CCRichText"), t("./CCToggleContainer"), t("./CCToggleGroup"), t("./CCToggle"), t("./CCBlockInputEvents"), t("./CCMotionStreak"), n, r];
  15660. e.exports = s
  15661. }), {
  15662. "./CCAnimation": 90,
  15663. "./CCAudioSource": 91,
  15664. "./CCBlockInputEvents": 92,
  15665. "./CCButton": 93,
  15666. "./CCCanvas": 94,
  15667. "./CCComponent": 95,
  15668. "./CCComponentEventHandler": 96,
  15669. "./CCLabel": 97,
  15670. "./CCLabelOutline": 98,
  15671. "./CCLabelShadow": 99,
  15672. "./CCLayout": 100,
  15673. "./CCMask": 101,
  15674. "./CCMotionStreak": 102,
  15675. "./CCPageView": 103,
  15676. "./CCPageViewIndicator": 104,
  15677. "./CCProgressBar": 105,
  15678. "./CCRichText": 107,
  15679. "./CCScrollBar": 108,
  15680. "./CCScrollView": 109,
  15681. "./CCSlider": 110,
  15682. "./CCSprite": 111,
  15683. "./CCToggle": 113,
  15684. "./CCToggleContainer": 114,
  15685. "./CCToggleGroup": 115,
  15686. "./CCWidget": 117,
  15687. "./SwanSubContextView": void 0,
  15688. "./WXSubContextView": void 0,
  15689. "./editbox/CCEditBox": 118,
  15690. "./missing-script": 124
  15691. }],
  15692. 124: [(function(t, e, i) {
  15693. "use strict";
  15694. var n = cc.js,
  15695. r = t("../utils/misc").BUILTIN_CLASSID_RE,
  15696. s = cc.Class({
  15697. name: "cc.MissingClass",
  15698. properties: {
  15699. _$erialized: {
  15700. default: null,
  15701. visible: !1,
  15702. editorOnly: !0
  15703. }
  15704. }
  15705. }),
  15706. o = cc.Class({
  15707. name: "cc.MissingScript",
  15708. extends: cc.Component,
  15709. editor: {
  15710. inspector: "packages://inspector/inspectors/comps/missing-script.js"
  15711. },
  15712. properties: {
  15713. compiled: {
  15714. default: !1,
  15715. serializable: !1
  15716. },
  15717. _$erialized: {
  15718. default: null,
  15719. visible: !1,
  15720. editorOnly: !0
  15721. }
  15722. },
  15723. ctor: !1,
  15724. statics: {
  15725. safeFindClass: function(t, e) {
  15726. var i = n._getClassById(t);
  15727. return i || (t ? (cc.deserialize.reportMissingClass(t), o.getMissingWrapper(t, e)) : null)
  15728. },
  15729. getMissingWrapper: function(t, e) {
  15730. return e.node && (/^[0-9a-zA-Z+/]{23}$/.test(t) || r.test(t)) ? o : s
  15731. }
  15732. },
  15733. onLoad: function() {
  15734. cc.warnID(4600, this.node.name)
  15735. }
  15736. });
  15737. cc._MissingScript = e.exports = o
  15738. }), {
  15739. "../utils/misc": 300
  15740. }],
  15741. 125: [(function(t, e, i) {
  15742. "use strict";
  15743. var n = cc.js;
  15744. t("../event/event");
  15745. var r = function(t, e) {
  15746. cc.Event.call(this, cc.Event.MOUSE, e), this._eventType = t, this._button = 0, this._x = 0, this._y = 0, this._prevX = 0, this._prevY = 0, this._scrollX = 0, this._scrollY = 0
  15747. };
  15748. n.extend(r, cc.Event);
  15749. var s = r.prototype;
  15750. s.setScrollData = function(t, e) {
  15751. this._scrollX = t, this._scrollY = e
  15752. }, s.getScrollX = function() {
  15753. return this._scrollX
  15754. }, s.getScrollY = function() {
  15755. return this._scrollY
  15756. }, s.setLocation = function(t, e) {
  15757. this._x = t, this._y = e
  15758. }, s.getLocation = function() {
  15759. return cc.v2(this._x, this._y)
  15760. }, s.getLocationInView = function() {
  15761. return cc.v2(this._x, cc.view._designResolutionSize.height - this._y)
  15762. }, s._setPrevCursor = function(t, e) {
  15763. this._prevX = t, this._prevY = e
  15764. }, s.getPreviousLocation = function() {
  15765. return cc.v2(this._prevX, this._prevY)
  15766. }, s.getDelta = function() {
  15767. return cc.v2(this._x - this._prevX, this._y - this._prevY)
  15768. }, s.getDeltaX = function() {
  15769. return this._x - this._prevX
  15770. }, s.getDeltaY = function() {
  15771. return this._y - this._prevY
  15772. }, s.setButton = function(t) {
  15773. this._button = t
  15774. }, s.getButton = function() {
  15775. return this._button
  15776. }, s.getLocationX = function() {
  15777. return this._x
  15778. }, s.getLocationY = function() {
  15779. return this._y
  15780. }, r.NONE = 0, r.DOWN = 1, r.UP = 2, r.MOVE = 3, r.SCROLL = 4, r.BUTTON_LEFT = 0, r.BUTTON_RIGHT = 2, r.BUTTON_MIDDLE = 1, r.BUTTON_4 = 3, r.BUTTON_5 = 4, r.BUTTON_6 = 5, r.BUTTON_7 = 6, r.BUTTON_8 = 7;
  15781. var o = function(t, e) {
  15782. cc.Event.call(this, cc.Event.TOUCH, e), this._eventCode = 0, this._touches = t || [], this.touch = null, this.currentTouch = null
  15783. };
  15784. n.extend(o, cc.Event), (s = o.prototype).getEventCode = function() {
  15785. return this._eventCode
  15786. }, s.getTouches = function() {
  15787. return this._touches
  15788. }, s._setEventCode = function(t) {
  15789. this._eventCode = t
  15790. }, s._setTouches = function(t) {
  15791. this._touches = t
  15792. }, s.setLocation = function(t, e) {
  15793. this.touch && this.touch.setTouchInfo(this.touch.getID(), t, e)
  15794. }, s.getLocation = function() {
  15795. return this.touch ? this.touch.getLocation() : cc.v2()
  15796. }, s.getLocationInView = function() {
  15797. return this.touch ? this.touch.getLocationInView() : cc.v2()
  15798. }, s.getPreviousLocation = function() {
  15799. return this.touch ? this.touch.getPreviousLocation() : cc.v2()
  15800. }, s.getStartLocation = function() {
  15801. return this.touch ? this.touch.getStartLocation() : cc.v2()
  15802. }, s.getID = function() {
  15803. return this.touch ? this.touch.getID() : null
  15804. }, s.getDelta = function() {
  15805. return this.touch ? this.touch.getDelta() : cc.v2()
  15806. }, s.getDeltaX = function() {
  15807. return this.touch ? this.touch.getDelta().x : 0
  15808. }, s.getDeltaY = function() {
  15809. return this.touch ? this.touch.getDelta().y : 0
  15810. }, s.getLocationX = function() {
  15811. return this.touch ? this.touch.getLocationX() : 0
  15812. }, s.getLocationY = function() {
  15813. return this.touch ? this.touch.getLocationY() : 0
  15814. }, o.MAX_TOUCHES = 5, o.BEGAN = 0, o.MOVED = 1, o.ENDED = 2, o.CANCELED = 3;
  15815. var a = function(t, e) {
  15816. cc.Event.call(this, cc.Event.ACCELERATION, e), this.acc = t
  15817. };
  15818. n.extend(a, cc.Event);
  15819. var l = function(t, e, i) {
  15820. cc.Event.call(this, cc.Event.KEYBOARD, i), this.keyCode = t, this.isPressed = e
  15821. };
  15822. n.extend(l, cc.Event), cc.Event.EventMouse = r, cc.Event.EventTouch = o, cc.Event.EventAcceleration = a, cc.Event.EventKeyboard = l, e.exports = cc.Event
  15823. }), {
  15824. "../event/event": 132
  15825. }],
  15826. 126: [(function(t, e, i) {
  15827. "use strict";
  15828. var n = t("../platform/js");
  15829. cc.EventListener = function(t, e, i) {
  15830. this._onEvent = i, this._type = t || 0, this._listenerID = e || "", this._registered = !1, this._fixedPriority = 0, this._node = null, this._target = null, this._paused = !0, this._isEnabled = !0
  15831. }, cc.EventListener.prototype = {
  15832. constructor: cc.EventListener,
  15833. _setPaused: function(t) {
  15834. this._paused = t
  15835. },
  15836. _isPaused: function() {
  15837. return this._paused
  15838. },
  15839. _setRegistered: function(t) {
  15840. this._registered = t
  15841. },
  15842. _isRegistered: function() {
  15843. return this._registered
  15844. },
  15845. _getType: function() {
  15846. return this._type
  15847. },
  15848. _getListenerID: function() {
  15849. return this._listenerID
  15850. },
  15851. _setFixedPriority: function(t) {
  15852. this._fixedPriority = t
  15853. },
  15854. _getFixedPriority: function() {
  15855. return this._fixedPriority
  15856. },
  15857. _setSceneGraphPriority: function(t) {
  15858. this._target = t, this._node = t
  15859. },
  15860. _getSceneGraphPriority: function() {
  15861. return this._node
  15862. },
  15863. checkAvailable: function() {
  15864. return null !== this._onEvent
  15865. },
  15866. clone: function() {
  15867. return null
  15868. },
  15869. setEnabled: function(t) {
  15870. this._isEnabled = t
  15871. },
  15872. isEnabled: function() {
  15873. return this._isEnabled
  15874. },
  15875. retain: function() {},
  15876. release: function() {}
  15877. }, cc.EventListener.UNKNOWN = 0, cc.EventListener.TOUCH_ONE_BY_ONE = 1, cc.EventListener.TOUCH_ALL_AT_ONCE = 2, cc.EventListener.KEYBOARD = 3, cc.EventListener.MOUSE = 4, cc.EventListener.ACCELERATION = 6, cc.EventListener.CUSTOM = 8;
  15878. var r = cc.EventListener.ListenerID = {
  15879. MOUSE: "__cc_mouse",
  15880. TOUCH_ONE_BY_ONE: "__cc_touch_one_by_one",
  15881. TOUCH_ALL_AT_ONCE: "__cc_touch_all_at_once",
  15882. KEYBOARD: "__cc_keyboard",
  15883. ACCELERATION: "__cc_acceleration"
  15884. },
  15885. s = function(t, e) {
  15886. this._onCustomEvent = e, cc.EventListener.call(this, cc.EventListener.CUSTOM, t, this._callback)
  15887. };
  15888. n.extend(s, cc.EventListener), n.mixin(s.prototype, {
  15889. _onCustomEvent: null,
  15890. _callback: function(t) {
  15891. null !== this._onCustomEvent && this._onCustomEvent(t)
  15892. },
  15893. checkAvailable: function() {
  15894. return cc.EventListener.prototype.checkAvailable.call(this) && null !== this._onCustomEvent
  15895. },
  15896. clone: function() {
  15897. return new s(this._listenerID, this._onCustomEvent)
  15898. }
  15899. });
  15900. var o = function() {
  15901. cc.EventListener.call(this, cc.EventListener.MOUSE, r.MOUSE, this._callback)
  15902. };
  15903. n.extend(o, cc.EventListener), n.mixin(o.prototype, {
  15904. onMouseDown: null,
  15905. onMouseUp: null,
  15906. onMouseMove: null,
  15907. onMouseScroll: null,
  15908. _callback: function(t) {
  15909. var e = cc.Event.EventMouse;
  15910. switch (t._eventType) {
  15911. case e.DOWN:
  15912. this.onMouseDown && this.onMouseDown(t);
  15913. break;
  15914. case e.UP:
  15915. this.onMouseUp && this.onMouseUp(t);
  15916. break;
  15917. case e.MOVE:
  15918. this.onMouseMove && this.onMouseMove(t);
  15919. break;
  15920. case e.SCROLL:
  15921. this.onMouseScroll && this.onMouseScroll(t)
  15922. }
  15923. },
  15924. clone: function() {
  15925. var t = new o;
  15926. return t.onMouseDown = this.onMouseDown, t.onMouseUp = this.onMouseUp, t.onMouseMove = this.onMouseMove, t.onMouseScroll = this.onMouseScroll, t
  15927. },
  15928. checkAvailable: function() {
  15929. return !0
  15930. }
  15931. });
  15932. var a = function() {
  15933. cc.EventListener.call(this, cc.EventListener.TOUCH_ONE_BY_ONE, r.TOUCH_ONE_BY_ONE, null), this._claimedTouches = []
  15934. };
  15935. n.extend(a, cc.EventListener), n.mixin(a.prototype, {
  15936. constructor: a,
  15937. _claimedTouches: null,
  15938. swallowTouches: !1,
  15939. onTouchBegan: null,
  15940. onTouchMoved: null,
  15941. onTouchEnded: null,
  15942. onTouchCancelled: null,
  15943. setSwallowTouches: function(t) {
  15944. this.swallowTouches = t
  15945. },
  15946. isSwallowTouches: function() {
  15947. return this.swallowTouches
  15948. },
  15949. clone: function() {
  15950. var t = new a;
  15951. return t.onTouchBegan = this.onTouchBegan, t.onTouchMoved = this.onTouchMoved, t.onTouchEnded = this.onTouchEnded, t.onTouchCancelled = this.onTouchCancelled, t.swallowTouches = this.swallowTouches, t
  15952. },
  15953. checkAvailable: function() {
  15954. return !!this.onTouchBegan || (cc.logID(1801), !1)
  15955. }
  15956. });
  15957. var l = function() {
  15958. cc.EventListener.call(this, cc.EventListener.TOUCH_ALL_AT_ONCE, r.TOUCH_ALL_AT_ONCE, null)
  15959. };
  15960. n.extend(l, cc.EventListener), n.mixin(l.prototype, {
  15961. constructor: l,
  15962. onTouchesBegan: null,
  15963. onTouchesMoved: null,
  15964. onTouchesEnded: null,
  15965. onTouchesCancelled: null,
  15966. clone: function() {
  15967. var t = new l;
  15968. return t.onTouchesBegan = this.onTouchesBegan, t.onTouchesMoved = this.onTouchesMoved, t.onTouchesEnded = this.onTouchesEnded, t.onTouchesCancelled = this.onTouchesCancelled, t
  15969. },
  15970. checkAvailable: function() {
  15971. return null !== this.onTouchesBegan || null !== this.onTouchesMoved || null !== this.onTouchesEnded || null !== this.onTouchesCancelled || (cc.logID(1802), !1)
  15972. }
  15973. });
  15974. var h = function(t) {
  15975. this._onAccelerationEvent = t, cc.EventListener.call(this, cc.EventListener.ACCELERATION, r.ACCELERATION, this._callback)
  15976. };
  15977. n.extend(h, cc.EventListener), n.mixin(h.prototype, {
  15978. constructor: h,
  15979. _onAccelerationEvent: null,
  15980. _callback: function(t) {
  15981. this._onAccelerationEvent(t.acc, t)
  15982. },
  15983. checkAvailable: function() {
  15984. return cc.assertID(this._onAccelerationEvent, 1803), !0
  15985. },
  15986. clone: function() {
  15987. return new h(this._onAccelerationEvent)
  15988. }
  15989. });
  15990. var c = function() {
  15991. cc.EventListener.call(this, cc.EventListener.KEYBOARD, r.KEYBOARD, this._callback)
  15992. };
  15993. n.extend(c, cc.EventListener), n.mixin(c.prototype, {
  15994. constructor: c,
  15995. onKeyPressed: null,
  15996. onKeyReleased: null,
  15997. _callback: function(t) {
  15998. t.isPressed ? this.onKeyPressed && this.onKeyPressed(t.keyCode, t) : this.onKeyReleased && this.onKeyReleased(t.keyCode, t)
  15999. },
  16000. clone: function() {
  16001. var t = new c;
  16002. return t.onKeyPressed = this.onKeyPressed, t.onKeyReleased = this.onKeyReleased, t
  16003. },
  16004. checkAvailable: function() {
  16005. return null !== this.onKeyPressed || null !== this.onKeyReleased || (cc.logID(1800), !1)
  16006. }
  16007. }), cc.EventListener.create = function(t) {
  16008. cc.assertID(t && t.event, 1900);
  16009. var e = t.event;
  16010. delete t.event;
  16011. var i = null;
  16012. for (var n in e === cc.EventListener.TOUCH_ONE_BY_ONE ? i = new a : e === cc.EventListener.TOUCH_ALL_AT_ONCE ? i = new l : e === cc.EventListener.MOUSE ? i = new o : e === cc.EventListener.CUSTOM ? (i = new s(t.eventName, t.callback), delete t.eventName, delete t.callback) : e === cc.EventListener.KEYBOARD ? i = new c : e === cc.EventListener.ACCELERATION && (i = new h(t.callback), delete t.callback), t) i[n] = t[n];
  16013. return i
  16014. }, e.exports = cc.EventListener
  16015. }), {
  16016. "../platform/js": 218
  16017. }],
  16018. 127: [(function(t, e, i) {
  16019. "use strict";
  16020. var n = t("../platform/js");
  16021. t("./CCEventListener");
  16022. var r = cc.EventListener.ListenerID,
  16023. s = function() {
  16024. this._fixedListeners = [], this._sceneGraphListeners = [], this.gt0Index = 0
  16025. };
  16026. s.prototype = {
  16027. constructor: s,
  16028. size: function() {
  16029. return this._fixedListeners.length + this._sceneGraphListeners.length
  16030. },
  16031. empty: function() {
  16032. return 0 === this._fixedListeners.length && 0 === this._sceneGraphListeners.length
  16033. },
  16034. push: function(t) {
  16035. 0 === t._getFixedPriority() ? this._sceneGraphListeners.push(t) : this._fixedListeners.push(t)
  16036. },
  16037. clearSceneGraphListeners: function() {
  16038. this._sceneGraphListeners.length = 0
  16039. },
  16040. clearFixedListeners: function() {
  16041. this._fixedListeners.length = 0
  16042. },
  16043. clear: function() {
  16044. this._sceneGraphListeners.length = 0, this._fixedListeners.length = 0
  16045. },
  16046. getFixedPriorityListeners: function() {
  16047. return this._fixedListeners
  16048. },
  16049. getSceneGraphPriorityListeners: function() {
  16050. return this._sceneGraphListeners
  16051. }
  16052. };
  16053. var o = function(t) {
  16054. var e = cc.Event,
  16055. i = t.type;
  16056. return i === e.ACCELERATION ? r.ACCELERATION : i === e.KEYBOARD ? r.KEYBOARD : i.startsWith(e.MOUSE) ? r.MOUSE : (i.startsWith(e.TOUCH) && cc.logID(2e3), "")
  16057. },
  16058. a = {
  16059. DIRTY_NONE: 0,
  16060. DIRTY_FIXED_PRIORITY: 1,
  16061. DIRTY_SCENE_GRAPH_PRIORITY: 2,
  16062. DIRTY_ALL: 3,
  16063. _listenersMap: {},
  16064. _priorityDirtyFlagMap: {},
  16065. _nodeListenersMap: {},
  16066. _toAddedListeners: [],
  16067. _toRemovedListeners: [],
  16068. _dirtyListeners: {},
  16069. _inDispatch: 0,
  16070. _isEnabled: !1,
  16071. _internalCustomListenerIDs: [],
  16072. _setDirtyForNode: function(t) {
  16073. var e = this._nodeListenersMap[t._id];
  16074. if (void 0 !== e)
  16075. for (var i = 0, n = e.length; i < n; i++) {
  16076. var r = e[i]._getListenerID();
  16077. null == this._dirtyListeners[r] && (this._dirtyListeners[r] = !0)
  16078. }
  16079. if (t.getChildren) {
  16080. var s = t.getChildren(),
  16081. o = 0;
  16082. for (n = s ? s.length : 0; o < n; o++) this._setDirtyForNode(s[o])
  16083. }
  16084. },
  16085. pauseTarget: function(t, e) {
  16086. if (t instanceof cc._BaseNode) {
  16087. var i, n, r = this._nodeListenersMap[t._id];
  16088. if (r)
  16089. for (i = 0, n = r.length; i < n; i++) r[i]._setPaused(!0);
  16090. if (!0 === e) {
  16091. var s = t.getChildren();
  16092. for (i = 0, n = s ? s.length : 0; i < n; i++) this.pauseTarget(s[i], !0)
  16093. }
  16094. } else cc.warnID(3506)
  16095. },
  16096. resumeTarget: function(t, e) {
  16097. if (t instanceof cc._BaseNode) {
  16098. var i, n, r = this._nodeListenersMap[t._id];
  16099. if (r)
  16100. for (i = 0, n = r.length; i < n; i++) r[i]._setPaused(!1);
  16101. if (this._setDirtyForNode(t), !0 === e && t.getChildren) {
  16102. var s = t.getChildren();
  16103. for (i = 0, n = s ? s.length : 0; i < n; i++) this.resumeTarget(s[i], !0)
  16104. }
  16105. } else cc.warnID(3506)
  16106. },
  16107. _addListener: function(t) {
  16108. 0 === this._inDispatch ? this._forceAddEventListener(t) : this._toAddedListeners.push(t)
  16109. },
  16110. _forceAddEventListener: function(t) {
  16111. var e = t._getListenerID(),
  16112. i = this._listenersMap[e];
  16113. if (i || (i = new s, this._listenersMap[e] = i), i.push(t), 0 === t._getFixedPriority()) {
  16114. this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY);
  16115. var n = t._getSceneGraphPriority();
  16116. null === n && cc.logID(3507), this._associateNodeAndEventListener(n, t), n.activeInHierarchy && this.resumeTarget(n)
  16117. } else this._setDirty(e, this.DIRTY_FIXED_PRIORITY)
  16118. },
  16119. _getListeners: function(t) {
  16120. return this._listenersMap[t]
  16121. },
  16122. _updateDirtyFlagForSceneGraph: function() {
  16123. var t = this._dirtyListeners;
  16124. for (var e in t) this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY);
  16125. this._dirtyListeners = {}
  16126. },
  16127. _removeAllListenersInVector: function(t) {
  16128. if (t)
  16129. for (var e, i = t.length - 1; i >= 0; i--)(e = t[i])._setRegistered(!1), null != e._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(e._getSceneGraphPriority(), e), e._setSceneGraphPriority(null)), 0 === this._inDispatch && cc.js.array.removeAt(t, i)
  16130. },
  16131. _removeListenersForListenerID: function(t) {
  16132. var e, i = this._listenersMap[t];
  16133. if (i) {
  16134. var n = i.getFixedPriorityListeners(),
  16135. r = i.getSceneGraphPriorityListeners();
  16136. this._removeAllListenersInVector(r), this._removeAllListenersInVector(n), delete this._priorityDirtyFlagMap[t], this._inDispatch || (i.clear(), delete this._listenersMap[t])
  16137. }
  16138. var s, o = this._toAddedListeners;
  16139. for (e = o.length - 1; e >= 0; e--)(s = o[e]) && s._getListenerID() === t && cc.js.array.removeAt(o, e)
  16140. },
  16141. _sortEventListeners: function(t) {
  16142. var e = this.DIRTY_NONE,
  16143. i = this._priorityDirtyFlagMap;
  16144. (i[t] && (e = i[t]), e !== this.DIRTY_NONE) && (i[t] = this.DIRTY_NONE, e & this.DIRTY_FIXED_PRIORITY && this._sortListenersOfFixedPriority(t), e & this.DIRTY_SCENE_GRAPH_PRIORITY && cc.director.getScene() && this._sortListenersOfSceneGraphPriority(t))
  16145. },
  16146. _sortListenersOfSceneGraphPriority: function(t) {
  16147. var e = this._getListeners(t);
  16148. if (e) {
  16149. var i = e.getSceneGraphPriorityListeners();
  16150. i && 0 !== i.length && e.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes)
  16151. }
  16152. },
  16153. _sortEventListenersOfSceneGraphPriorityDes: function(t, e) {
  16154. var i = t._getSceneGraphPriority(),
  16155. n = e._getSceneGraphPriority();
  16156. if (!(e && n && n._activeInHierarchy && null !== n._parent)) return -1;
  16157. if (!t || !i || !i._activeInHierarchy || null === i._parent) return 1;
  16158. for (var r = i, s = n, o = !1; r._parent._id !== s._parent._id;) r = null === r._parent._parent ? (o = !0) && n : r._parent, s = null === s._parent._parent ? (o = !0) && i : s._parent;
  16159. if (r._id === s._id) {
  16160. if (r._id === n._id) return -1;
  16161. if (r._id === i._id) return 1
  16162. }
  16163. return o ? r._localZOrder - s._localZOrder : s._localZOrder - r._localZOrder
  16164. },
  16165. _sortListenersOfFixedPriority: function(t) {
  16166. var e = this._listenersMap[t];
  16167. if (e) {
  16168. var i = e.getFixedPriorityListeners();
  16169. if (i && 0 !== i.length) {
  16170. i.sort(this._sortListenersOfFixedPriorityAsc);
  16171. for (var n = 0, r = i.length; n < r && !(i[n]._getFixedPriority() >= 0);) ++n;
  16172. e.gt0Index = n
  16173. }
  16174. }
  16175. },
  16176. _sortListenersOfFixedPriorityAsc: function(t, e) {
  16177. return t._getFixedPriority() - e._getFixedPriority()
  16178. },
  16179. _onUpdateListeners: function(t) {
  16180. var e, i, n, r = t.getFixedPriorityListeners(),
  16181. s = t.getSceneGraphPriorityListeners(),
  16182. o = this._toRemovedListeners;
  16183. if (s)
  16184. for (e = s.length - 1; e >= 0; e--)(i = s[e])._isRegistered() || (cc.js.array.removeAt(s, e), -1 !== (n = o.indexOf(i)) && o.splice(n, 1));
  16185. if (r)
  16186. for (e = r.length - 1; e >= 0; e--)(i = r[e])._isRegistered() || (cc.js.array.removeAt(r, e), -1 !== (n = o.indexOf(i)) && o.splice(n, 1));
  16187. s && 0 === s.length && t.clearSceneGraphListeners(), r && 0 === r.length && t.clearFixedListeners()
  16188. },
  16189. frameUpdateListeners: function() {
  16190. var t = this._listenersMap,
  16191. e = this._priorityDirtyFlagMap;
  16192. for (var i in t) t[i].empty() && (delete e[i], delete t[i]);
  16193. var n = this._toAddedListeners;
  16194. if (0 !== n.length) {
  16195. for (var r = 0, s = n.length; r < s; r++) this._forceAddEventListener(n[r]);
  16196. n.length = 0
  16197. }
  16198. 0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners()
  16199. },
  16200. _updateTouchListeners: function(t) {
  16201. var e = this._inDispatch;
  16202. if (cc.assertID(e > 0, 3508), !(e > 1)) {
  16203. var i;
  16204. (i = this._listenersMap[r.TOUCH_ONE_BY_ONE]) && this._onUpdateListeners(i), (i = this._listenersMap[r.TOUCH_ALL_AT_ONCE]) && this._onUpdateListeners(i), cc.assertID(1 === e, 3509);
  16205. var n = this._toAddedListeners;
  16206. if (0 !== n.length) {
  16207. for (var s = 0, o = n.length; s < o; s++) this._forceAddEventListener(n[s]);
  16208. this._toAddedListeners.length = 0
  16209. }
  16210. 0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners()
  16211. }
  16212. },
  16213. _cleanToRemovedListeners: function() {
  16214. for (var t = this._toRemovedListeners, e = 0; e < t.length; e++) {
  16215. var i = t[e],
  16216. n = this._listenersMap[i._getListenerID()];
  16217. if (n) {
  16218. var r, s = n.getFixedPriorityListeners(),
  16219. o = n.getSceneGraphPriorityListeners();
  16220. o && -1 !== (r = o.indexOf(i)) && o.splice(r, 1), s && -1 !== (r = s.indexOf(i)) && s.splice(r, 1)
  16221. }
  16222. }
  16223. t.length = 0
  16224. },
  16225. _onTouchEventCallback: function(t, e) {
  16226. if (!t._isRegistered()) return !1;
  16227. var i = e.event,
  16228. n = i.currentTouch;
  16229. i.currentTarget = t._node;
  16230. var r, s = !1,
  16231. o = i.getEventCode(),
  16232. l = cc.Event.EventTouch;
  16233. return o === l.BEGAN ? t.onTouchBegan && (s = t.onTouchBegan(n, i)) && t._registered && t._claimedTouches.push(n) : t._claimedTouches.length > 0 && -1 !== (r = t._claimedTouches.indexOf(n)) && (s = !0, o === l.MOVED && t.onTouchMoved ? t.onTouchMoved(n, i) : o === l.ENDED ? (t.onTouchEnded && t.onTouchEnded(n, i), t._registered && t._claimedTouches.splice(r, 1)) : o === l.CANCELLED && (t.onTouchCancelled && t.onTouchCancelled(n, i), t._registered && t._claimedTouches.splice(r, 1))), i.isStopped() ? (a._updateTouchListeners(i), !0) : !(!s || !t.swallowTouches) && (e.needsMutableSet && e.touches.splice(n, 1), !0)
  16234. },
  16235. _dispatchTouchEvent: function(t) {
  16236. this._sortEventListeners(r.TOUCH_ONE_BY_ONE), this._sortEventListeners(r.TOUCH_ALL_AT_ONCE);
  16237. var e = this._getListeners(r.TOUCH_ONE_BY_ONE),
  16238. i = this._getListeners(r.TOUCH_ALL_AT_ONCE);
  16239. if (null !== e || null !== i) {
  16240. var n = t.getTouches(),
  16241. s = cc.js.array.copy(n),
  16242. o = {
  16243. event: t,
  16244. needsMutableSet: e && i,
  16245. touches: s,
  16246. selTouch: null
  16247. };
  16248. if (e)
  16249. for (var a = 0; a < n.length; a++) t.currentTouch = n[a], t._propagationStopped = t._propagationImmediateStopped = !1, this._dispatchEventToListeners(e, this._onTouchEventCallback, o);
  16250. i && s.length > 0 && (this._dispatchEventToListeners(i, this._onTouchesEventCallback, {
  16251. event: t,
  16252. touches: s
  16253. }), t.isStopped()) || this._updateTouchListeners(t)
  16254. }
  16255. },
  16256. _onTouchesEventCallback: function(t, e) {
  16257. if (!t._registered) return !1;
  16258. var i = cc.Event.EventTouch,
  16259. n = e.event,
  16260. r = e.touches,
  16261. s = n.getEventCode();
  16262. return n.currentTarget = t._node, s === i.BEGAN && t.onTouchesBegan ? t.onTouchesBegan(r, n) : s === i.MOVED && t.onTouchesMoved ? t.onTouchesMoved(r, n) : s === i.ENDED && t.onTouchesEnded ? t.onTouchesEnded(r, n) : s === i.CANCELLED && t.onTouchesCancelled && t.onTouchesCancelled(r, n), !!n.isStopped() && (a._updateTouchListeners(n), !0)
  16263. },
  16264. _associateNodeAndEventListener: function(t, e) {
  16265. var i = this._nodeListenersMap[t._id];
  16266. i || (i = [], this._nodeListenersMap[t._id] = i), i.push(e)
  16267. },
  16268. _dissociateNodeAndEventListener: function(t, e) {
  16269. var i = this._nodeListenersMap[t._id];
  16270. i && (cc.js.array.remove(i, e), 0 === i.length && delete this._nodeListenersMap[t._id])
  16271. },
  16272. _dispatchEventToListeners: function(t, e, i) {
  16273. var n, r, s = !1,
  16274. o = t.getFixedPriorityListeners(),
  16275. a = t.getSceneGraphPriorityListeners(),
  16276. l = 0;
  16277. if (o && 0 !== o.length)
  16278. for (; l < t.gt0Index; ++l)
  16279. if ((r = o[l]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
  16280. s = !0;
  16281. break
  16282. }
  16283. if (a && !s)
  16284. for (n = 0; n < a.length; n++)
  16285. if ((r = a[n]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
  16286. s = !0;
  16287. break
  16288. }
  16289. if (o && !s)
  16290. for (; l < o.length; ++l)
  16291. if ((r = o[l]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) {
  16292. s = !0;
  16293. break
  16294. }
  16295. },
  16296. _setDirty: function(t, e) {
  16297. var i = this._priorityDirtyFlagMap;
  16298. null == i[t] ? i[t] = e : i[t] = e | i[t]
  16299. },
  16300. _sortNumberAsc: function(t, e) {
  16301. return t - e
  16302. },
  16303. hasEventListener: function(t) {
  16304. return !!this._getListeners(t)
  16305. },
  16306. addListener: function(t, e) {
  16307. if (cc.assertID(t && e, 3503), cc.js.isNumber(e) || e instanceof cc._BaseNode) {
  16308. if (t instanceof cc.EventListener) {
  16309. if (t._isRegistered()) return void cc.logID(3505)
  16310. } else cc.assertID(!cc.js.isNumber(e), 3504), t = cc.EventListener.create(t);
  16311. if (t.checkAvailable()) {
  16312. if (cc.js.isNumber(e)) {
  16313. if (0 === e) return void cc.logID(3500);
  16314. t._setSceneGraphPriority(null), t._setFixedPriority(e), t._setRegistered(!0), t._setPaused(!1), this._addListener(t)
  16315. } else t._setSceneGraphPriority(e), t._setFixedPriority(0), t._setRegistered(!0), this._addListener(t);
  16316. return t
  16317. }
  16318. } else cc.warnID(3506)
  16319. },
  16320. addCustomListener: function(t, e) {
  16321. var i = new cc.EventListener.create({
  16322. event: cc.EventListener.CUSTOM,
  16323. eventName: t,
  16324. callback: e
  16325. });
  16326. return this.addListener(i, 1), i
  16327. },
  16328. removeListener: function(t) {
  16329. if (null != t) {
  16330. var e, i = this._listenersMap;
  16331. for (var n in i) {
  16332. var r = i[n],
  16333. s = r.getFixedPriorityListeners(),
  16334. o = r.getSceneGraphPriorityListeners();
  16335. if ((e = this._removeListenerInVector(o, t)) ? this._setDirty(t._getListenerID(), this.DIRTY_SCENE_GRAPH_PRIORITY) : (e = this._removeListenerInVector(s, t)) && this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY), r.empty() && (delete this._priorityDirtyFlagMap[t._getListenerID()], delete i[n]), e) break
  16336. }
  16337. if (!e)
  16338. for (var a = this._toAddedListeners, l = a.length - 1; l >= 0; l--) {
  16339. var h = a[l];
  16340. if (h === t) {
  16341. cc.js.array.removeAt(a, l), h._setRegistered(!1);
  16342. break
  16343. }
  16344. }
  16345. }
  16346. },
  16347. _removeListenerInCallback: function(t, e) {
  16348. if (null == t) return !1;
  16349. for (var i = t.length - 1; i >= 0; i--) {
  16350. var n = t[i];
  16351. if (n._onCustomEvent === e || n._onEvent === e) return n._setRegistered(!1), null != n._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n), n._setSceneGraphPriority(null)), 0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n), !0
  16352. }
  16353. return !1
  16354. },
  16355. _removeListenerInVector: function(t, e) {
  16356. if (null == t) return !1;
  16357. for (var i = t.length - 1; i >= 0; i--) {
  16358. var n = t[i];
  16359. if (n === e) return n._setRegistered(!1), null != n._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n), n._setSceneGraphPriority(null)), 0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n), !0
  16360. }
  16361. return !1
  16362. },
  16363. removeListeners: function(t, e) {
  16364. var i = this;
  16365. if (cc.js.isNumber(t) || t instanceof cc._BaseNode)
  16366. if (void 0 !== t._id) {
  16367. var n, s = i._nodeListenersMap[t._id];
  16368. if (s) {
  16369. var o = cc.js.array.copy(s);
  16370. for (n = 0; n < o.length; n++) i.removeListener(o[n]);
  16371. delete i._nodeListenersMap[t._id]
  16372. }
  16373. var a = i._toAddedListeners;
  16374. for (n = 0; n < a.length;) {
  16375. var l = a[n];
  16376. l._getSceneGraphPriority() === t ? (l._setSceneGraphPriority(null), l._setRegistered(!1), a.splice(n, 1)) : ++n
  16377. }
  16378. if (!0 === e) {
  16379. var h, c = t.getChildren();
  16380. for (n = 0, h = c.length; n < h; n++) i.removeListeners(c[n], !0)
  16381. }
  16382. } else t === cc.EventListener.TOUCH_ONE_BY_ONE ? i._removeListenersForListenerID(r.TOUCH_ONE_BY_ONE) : t === cc.EventListener.TOUCH_ALL_AT_ONCE ? i._removeListenersForListenerID(r.TOUCH_ALL_AT_ONCE) : t === cc.EventListener.MOUSE ? i._removeListenersForListenerID(r.MOUSE) : t === cc.EventListener.ACCELERATION ? i._removeListenersForListenerID(r.ACCELERATION) : t === cc.EventListener.KEYBOARD ? i._removeListenersForListenerID(r.KEYBOARD) : cc.logID(3501);
  16383. else cc.warnID(3506)
  16384. },
  16385. removeCustomListeners: function(t) {
  16386. this._removeListenersForListenerID(t)
  16387. },
  16388. removeAllListeners: function() {
  16389. var t = this._listenersMap,
  16390. e = this._internalCustomListenerIDs;
  16391. for (var i in t) - 1 === e.indexOf(i) && this._removeListenersForListenerID(i)
  16392. },
  16393. setPriority: function(t, e) {
  16394. if (null != t) {
  16395. var i = this._listenersMap;
  16396. for (var n in i) {
  16397. var r = i[n].getFixedPriorityListeners();
  16398. if (r)
  16399. if (-1 !== r.indexOf(t)) return null != t._getSceneGraphPriority() && cc.logID(3502), void(t._getFixedPriority() !== e && (t._setFixedPriority(e), this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY)))
  16400. }
  16401. }
  16402. },
  16403. setEnabled: function(t) {
  16404. this._isEnabled = t
  16405. },
  16406. isEnabled: function() {
  16407. return this._isEnabled
  16408. },
  16409. dispatchEvent: function(t) {
  16410. if (this._isEnabled)
  16411. if (this._updateDirtyFlagForSceneGraph(), this._inDispatch++, t && t.getType) {
  16412. if (t.getType().startsWith(cc.Event.TOUCH)) return this._dispatchTouchEvent(t), void this._inDispatch--;
  16413. var e = o(t);
  16414. this._sortEventListeners(e);
  16415. var i = this._listenersMap[e];
  16416. null != i && (this._dispatchEventToListeners(i, this._onListenerCallback, t), this._onUpdateListeners(i)), this._inDispatch--
  16417. } else cc.errorID(3511)
  16418. },
  16419. _onListenerCallback: function(t, e) {
  16420. return e.currentTarget = t._target, t._onEvent(e), e.isStopped()
  16421. },
  16422. dispatchCustomEvent: function(t, e) {
  16423. var i = new cc.Event.EventCustom(t);
  16424. i.setUserData(e), this.dispatchEvent(i)
  16425. }
  16426. };
  16427. n.get(cc, "eventManager", (function() {
  16428. return cc.warnID(1405, "cc.eventManager", "cc.EventTarget or cc.systemEvent"), a
  16429. })), e.exports = a
  16430. }), {
  16431. "../platform/js": 218,
  16432. "./CCEventListener": 126
  16433. }],
  16434. 128: [(function(t, e, i) {
  16435. "use strict";
  16436. cc.Touch = function(t, e, i) {
  16437. this._lastModified = 0, this.setTouchInfo(i, t, e)
  16438. }, cc.Touch.prototype = {
  16439. constructor: cc.Touch,
  16440. getLocation: function() {
  16441. return cc.v2(this._point.x, this._point.y)
  16442. },
  16443. getLocationX: function() {
  16444. return this._point.x
  16445. },
  16446. getLocationY: function() {
  16447. return this._point.y
  16448. },
  16449. getPreviousLocation: function() {
  16450. return cc.v2(this._prevPoint.x, this._prevPoint.y)
  16451. },
  16452. getStartLocation: function() {
  16453. return cc.v2(this._startPoint.x, this._startPoint.y)
  16454. },
  16455. getDelta: function() {
  16456. return this._point.sub(this._prevPoint)
  16457. },
  16458. getLocationInView: function() {
  16459. return cc.v2(this._point.x, cc.view._designResolutionSize.height - this._point.y)
  16460. },
  16461. getPreviousLocationInView: function() {
  16462. return cc.v2(this._prevPoint.x, cc.view._designResolutionSize.height - this._prevPoint.y)
  16463. },
  16464. getStartLocationInView: function() {
  16465. return cc.v2(this._startPoint.x, cc.view._designResolutionSize.height - this._startPoint.y)
  16466. },
  16467. getID: function() {
  16468. return this._id
  16469. },
  16470. setTouchInfo: function(t, e, i) {
  16471. this._prevPoint = this._point, this._point = cc.v2(e || 0, i || 0), this._id = t, this._startPointCaptured || (this._startPoint = cc.v2(this._point), cc.view._convertPointWithScale(this._startPoint), this._startPointCaptured = !0)
  16472. },
  16473. _setPoint: function(t, e) {
  16474. void 0 === e ? (this._point.x = t.x, this._point.y = t.y) : (this._point.x = t, this._point.y = e)
  16475. },
  16476. _setPrevPoint: function(t, e) {
  16477. this._prevPoint = void 0 === e ? cc.v2(t.x, t.y) : cc.v2(t || 0, e || 0)
  16478. }
  16479. }
  16480. }), {}],
  16481. 129: [(function(t, e, i) {
  16482. "use strict";
  16483. t("./CCEvent"), t("./CCTouch"), t("./CCEventListener");
  16484. var n = t("./CCEventManager");
  16485. e.exports = n
  16486. }), {
  16487. "./CCEvent": 125,
  16488. "./CCEventListener": 126,
  16489. "./CCEventManager": 127,
  16490. "./CCTouch": 128
  16491. }],
  16492. 130: [(function(t, e, i) {
  16493. "use strict";
  16494. var n = cc.js,
  16495. r = t("../platform/callbacks-invoker");
  16496. function s() {
  16497. r.call(this)
  16498. }
  16499. n.extend(s, r), s.prototype.emit = function(t, e) {
  16500. var i = t.type,
  16501. n = this._callbackTable[i];
  16502. if (n) {
  16503. var r = !n.isInvoking;
  16504. n.isInvoking = !0;
  16505. for (var s = n.callbackInfos, o = 0, a = s.length; o < a; ++o) {
  16506. var l = s[o];
  16507. if (l && l.callback && (l.callback.call(l.target, t, e), t._propagationImmediateStopped)) break
  16508. }
  16509. r && (n.isInvoking = !1, n.containCanceled && n.purgeCanceled())
  16510. }
  16511. }, e.exports = s
  16512. }), {
  16513. "../platform/callbacks-invoker": 211
  16514. }],
  16515. 131: [(function(t, e, i) {
  16516. "use strict";
  16517. var n = t("../platform/js"),
  16518. r = t("../platform/callbacks-invoker"),
  16519. s = n.array.fastRemove;
  16520. function o() {
  16521. r.call(this)
  16522. }
  16523. n.extend(o, r);
  16524. var a = o.prototype;
  16525. a.__on = a.on, a.on = function(t, e, i, n) {
  16526. if (e) return this.hasEventListener(t, e, i) || (this.__on(t, e, i, n), i && i.__eventTargets && i.__eventTargets.push(this)), e;
  16527. cc.errorID(6800)
  16528. }, a.__off = a.off, a.off = function(t, e, i) {
  16529. if (e) this.__off(t, e, i), i && i.__eventTargets && s(i.__eventTargets, this);
  16530. else {
  16531. var n = this._callbackTable[t];
  16532. if (!n) return;
  16533. for (var r = n.callbackInfos, o = 0; o < r.length; ++o) {
  16534. var a = r[o] && r[o].target;
  16535. a && a.__eventTargets && s(a.__eventTargets, this)
  16536. }
  16537. this.removeAll(t)
  16538. }
  16539. }, a.targetOff = function(t) {
  16540. this.removeAll(t), t && t.__eventTargets && s(t.__eventTargets, this)
  16541. }, a.once = function(t, e, i) {
  16542. this.on(t, e, i, !0)
  16543. }, a.dispatchEvent = function(t) {
  16544. this.emit(t.type, t)
  16545. }, cc.EventTarget = e.exports = o
  16546. }), {
  16547. "../platform/callbacks-invoker": 211,
  16548. "../platform/js": 218
  16549. }],
  16550. 132: [(function(t, e, i) {
  16551. "use strict";
  16552. var n = t("../platform/js");
  16553. cc.Event = function(t, e) {
  16554. this.type = t, this.bubbles = !!e, this.target = null, this.currentTarget = null, this.eventPhase = 0, this._propagationStopped = !1, this._propagationImmediateStopped = !1
  16555. }, cc.Event.prototype = {
  16556. constructor: cc.Event,
  16557. unuse: function() {
  16558. this.type = cc.Event.NO_TYPE, this.target = null, this.currentTarget = null, this.eventPhase = cc.Event.NONE, this._propagationStopped = !1, this._propagationImmediateStopped = !1
  16559. },
  16560. reuse: function(t, e) {
  16561. this.type = t, this.bubbles = e || !1
  16562. },
  16563. stopPropagation: function() {
  16564. this._propagationStopped = !0
  16565. },
  16566. stopPropagationImmediate: function() {
  16567. this._propagationImmediateStopped = !0
  16568. },
  16569. isStopped: function() {
  16570. return this._propagationStopped || this._propagationImmediateStopped
  16571. },
  16572. getCurrentTarget: function() {
  16573. return this.currentTarget
  16574. },
  16575. getType: function() {
  16576. return this.type
  16577. }
  16578. }, cc.Event.NO_TYPE = "no_type", cc.Event.TOUCH = "touch", cc.Event.MOUSE = "mouse", cc.Event.KEYBOARD = "keyboard", cc.Event.ACCELERATION = "acceleration", cc.Event.NONE = 0, cc.Event.CAPTURING_PHASE = 1, cc.Event.AT_TARGET = 2, cc.Event.BUBBLING_PHASE = 3;
  16579. var r = function(t, e) {
  16580. cc.Event.call(this, t, e), this.detail = null
  16581. };
  16582. n.extend(r, cc.Event), r.prototype.reset = r, r.prototype.setUserData = function(t) {
  16583. this.detail = t
  16584. }, r.prototype.getUserData = function() {
  16585. return this.detail
  16586. }, r.prototype.getEventName = cc.Event.prototype.getType;
  16587. var s = new n.Pool(10);
  16588. r.put = function(t) {
  16589. s.put(t)
  16590. }, r.get = function(t, e) {
  16591. var i = s._get();
  16592. return i ? i.reset(t, e) : i = new r(t, e), i
  16593. }, cc.Event.EventCustom = r, e.exports = cc.Event
  16594. }), {
  16595. "../platform/js": 218
  16596. }],
  16597. 133: [(function(t, e, i) {
  16598. "use strict";
  16599. t("./event"), t("./event-listeners"), t("./event-target"), t("./system-event")
  16600. }), {
  16601. "./event": 132,
  16602. "./event-listeners": 130,
  16603. "./event-target": 131,
  16604. "./system-event": 134
  16605. }],
  16606. 134: [(function(t, e, i) {
  16607. "use strict";
  16608. var n = t("../event/event-target"),
  16609. r = t("../event-manager"),
  16610. s = t("../platform/CCInputManager"),
  16611. o = cc.Enum({
  16612. KEY_DOWN: "keydown",
  16613. KEY_UP: "keyup",
  16614. DEVICEMOTION: "devicemotion"
  16615. }),
  16616. a = null,
  16617. l = null,
  16618. h = cc.Class({
  16619. name: "SystemEvent",
  16620. extends: n,
  16621. statics: {
  16622. EventType: o
  16623. },
  16624. setAccelerometerEnabled: function(t) {
  16625. t && window.DeviceMotionEvent && "function" == typeof DeviceMotionEvent.requestPermission ? DeviceMotionEvent.requestPermission().then((function(t) {
  16626. console.log("Device Motion Event request permission: " + t), s.setAccelerometerEnabled("granted" === t)
  16627. })) : s.setAccelerometerEnabled(t)
  16628. },
  16629. setAccelerometerInterval: function(t) {
  16630. s.setAccelerometerInterval(t)
  16631. },
  16632. on: function(t, e, i, n) {
  16633. this._super(t, e, i, n), t !== o.KEY_DOWN && t !== o.KEY_UP || (a || (a = cc.EventListener.create({
  16634. event: cc.EventListener.KEYBOARD,
  16635. onKeyPressed: function(t, e) {
  16636. e.type = o.KEY_DOWN, cc.systemEvent.dispatchEvent(e)
  16637. },
  16638. onKeyReleased: function(t, e) {
  16639. e.type = o.KEY_UP, cc.systemEvent.dispatchEvent(e)
  16640. }
  16641. })), r.hasEventListener(cc.EventListener.ListenerID.KEYBOARD) || r.addListener(a, 1)), t === o.DEVICEMOTION && (l || (l = cc.EventListener.create({
  16642. event: cc.EventListener.ACCELERATION,
  16643. callback: function(t, e) {
  16644. e.type = o.DEVICEMOTION, cc.systemEvent.dispatchEvent(e)
  16645. }
  16646. })), r.hasEventListener(cc.EventListener.ListenerID.ACCELERATION) || r.addListener(l, 1))
  16647. },
  16648. off: function(t, e, i) {
  16649. if (this._super(t, e, i), a && (t === o.KEY_DOWN || t === o.KEY_UP)) {
  16650. var n = this.hasEventListener(o.KEY_DOWN),
  16651. s = this.hasEventListener(o.KEY_UP);
  16652. n || s || r.removeListener(a)
  16653. }
  16654. l && t === o.DEVICEMOTION && r.removeListener(l)
  16655. }
  16656. });
  16657. cc.SystemEvent = e.exports = h, cc.systemEvent = new cc.SystemEvent
  16658. }), {
  16659. "../event-manager": 129,
  16660. "../event/event-target": 131,
  16661. "../platform/CCInputManager": 202
  16662. }],
  16663. 135: [(function(t, e, i) {
  16664. "use strict";
  16665. var n = cc.vmath.vec3,
  16666. r = cc.vmath.mat3,
  16667. s = n.create(),
  16668. o = n.create(),
  16669. a = r.create(),
  16670. l = function(t, e, i) {
  16671. var r = a.m,
  16672. s = i.m;
  16673. r[0] = Math.abs(s[0]), r[1] = Math.abs(s[1]), r[2] = Math.abs(s[2]), r[3] = Math.abs(s[4]), r[4] = Math.abs(s[5]), r[5] = Math.abs(s[6]), r[6] = Math.abs(s[8]), r[7] = Math.abs(s[9]), r[8] = Math.abs(s[10]), n.transformMat3(t, e, a)
  16674. };
  16675. function h(t, e, i, n, r, s) {
  16676. this.center = cc.v3(t, e, i), this.halfExtents = cc.v3(n, r, s)
  16677. }
  16678. var c = h.prototype;
  16679. c.getBoundary = function(t, e) {
  16680. n.sub(t, this.center, this.halfExtents), n.add(e, this.center, this.halfExtents)
  16681. }, c.transform = function(t, e, i, r, s) {
  16682. s || (s = this), n.transformMat4(s.center, this.center, t), l(s.halfExtents, this.halfExtents, t)
  16683. }, h.create = function(t, e, i, n, r, s) {
  16684. return new h(t, e, i, n, r, s)
  16685. }, h.clone = function(t) {
  16686. return new h(t.center.x, t.center.y, t.center.z, t.halfExtents.x, t.halfExtents.y, t.halfExtents.z)
  16687. }, h.copy = function(t, e) {
  16688. return n.copy(t.center, e.center), n.copy(t.halfExtents, e.halfExtents), t
  16689. }, h.fromPoints = function(t, e, i) {
  16690. return n.scale(t.center, n.add(s, e, i), .5), n.scale(t.halfExtents, n.sub(o, i, e), .5), t
  16691. }, h.set = function(t, e, i, r, s, o, a) {
  16692. return n.set(t.center, e, i, r), n.set(t.halfExtents, s, o, a), t
  16693. }, e.exports = h
  16694. }), {}],
  16695. 136: [(function(t, e, i) {
  16696. "use strict";
  16697. i.__esModule = !0, cc.geomUtils = {
  16698. Triangle: t("./triangle"),
  16699. Aabb: t("./aabb"),
  16700. Ray: t("./ray"),
  16701. intersect: t("./intersect")
  16702. }, i.default = cc.geomUtils, e.exports = i.default
  16703. }), {
  16704. "./aabb": 135,
  16705. "./intersect": 137,
  16706. "./ray": 138,
  16707. "./triangle": 139
  16708. }],
  16709. 137: [(function(t, e, i) {
  16710. "use strict";
  16711. var n = s(t("../../renderer/gfx")),
  16712. r = s(t("../../renderer/memop/recycle-pool"));
  16713. function s(t) {
  16714. return t && t.__esModule ? t : {
  16715. default: t
  16716. }
  16717. }
  16718. var o = t("./aabb"),
  16719. a = t("./ray"),
  16720. l = t("./triangle"),
  16721. h = cc.vmath.mat4,
  16722. c = cc.vmath.vec3,
  16723. u = {};
  16724. u.rayAabb = (function() {
  16725. var t = c.create(),
  16726. e = c.create();
  16727. return function(i, n) {
  16728. var r = i.o,
  16729. s = i.d,
  16730. o = 1 / s.x,
  16731. a = 1 / s.y,
  16732. l = 1 / s.z;
  16733. c.sub(t, n.center, n.halfExtents), c.add(e, n.center, n.halfExtents);
  16734. var h = (t.x - r.x) * o,
  16735. u = (e.x - r.x) * o,
  16736. _ = (t.y - r.y) * a,
  16737. f = (e.y - r.y) * a,
  16738. d = (t.z - r.z) * l,
  16739. p = (e.z - r.z) * l,
  16740. m = Math.max(Math.max(Math.min(h, u), Math.min(_, f)), Math.min(d, p)),
  16741. y = Math.min(Math.min(Math.max(h, u), Math.max(_, f)), Math.max(d, p));
  16742. return y < 0 || m > y ? 0 : m
  16743. }
  16744. })(), u.rayTriangle = (function() {
  16745. var t = c.create(0, 0, 0),
  16746. e = c.create(0, 0, 0),
  16747. i = c.create(0, 0, 0),
  16748. n = c.create(0, 0, 0),
  16749. r = c.create(0, 0, 0);
  16750. return function(s, o) {
  16751. c.sub(t, o.b, o.a), c.sub(e, o.c, o.a), c.cross(i, s.d, e);
  16752. var a = c.dot(t, i);
  16753. if (a <= 0) return 0;
  16754. c.sub(n, s.o, o.a);
  16755. var l = c.dot(n, i);
  16756. if (l < 0 || l > a) return 0;
  16757. c.cross(r, n, t);
  16758. var h = c.dot(s.d, r);
  16759. if (h < 0 || l + h > a) return 0;
  16760. var u = c.dot(e, r) / a;
  16761. return u < 0 ? 0 : u
  16762. }
  16763. })(), u.rayMesh = (function() {
  16764. var t = l.create(),
  16765. e = 1 / 0,
  16766. i = {
  16767. 5120: "getInt8",
  16768. 5121: "getUint8",
  16769. 5122: "getInt16",
  16770. 5123: "getUint16",
  16771. 5124: "getInt32",
  16772. 5125: "getUint32",
  16773. 5126: "getFloat32"
  16774. },
  16775. r = (function() {
  16776. var t = new ArrayBuffer(2);
  16777. return new DataView(t).setInt16(0, 256, !0), 256 === new Int16Array(t)[0]
  16778. })();
  16779. function s(t, e, i, n, s) {
  16780. c.set(t, e[i](s, r), e[i](s += n, r), e[i](s += n, r))
  16781. }
  16782. return function(r, o) {
  16783. e = 1 / 0;
  16784. for (var a = o._subMeshes, l = 0; l < a.length; l++)
  16785. if (a[l]._primitiveType === n.default.PT_TRIANGLES)
  16786. for (var h = o._subDatas[l] || o._subDatas[0], c = h.vData, _ = new DataView(c.buffer, c.byteOffset, c.byteLength), f = h.getIData(Uint16Array), d = h.vfm.element(n.default.ATTR_POSITION), p = d.offset, m = d.stride, y = i[d.type], v = 0; v < f.length; v += 3) {
  16787. s(t.a, _, y, 4, f[v] * m + p), s(t.b, _, y, 4, f[v + 1] * m + p), s(t.c, _, y, 4, f[v + 2] * m + p);
  16788. var g = u.rayTriangle(r, t);
  16789. g > 0 && g < e && (e = g)
  16790. }
  16791. return e
  16792. }
  16793. })(), u.raycast = (function() {
  16794. function t(e, i) {
  16795. for (var n = e.children, r = n.length - 1; r >= 0; r--) {
  16796. t(n[r], i)
  16797. }
  16798. i(e)
  16799. }
  16800. function e(t, e) {
  16801. return t.distance - e.distance
  16802. }
  16803. function i(t, e, i) {
  16804. var n = i.m,
  16805. r = e.x,
  16806. s = e.y,
  16807. o = e.z,
  16808. a = n[3] * r + n[7] * s + n[11] * o;
  16809. return a = a ? 1 / a : 1, t.x = (n[0] * r + n[4] * s + n[8] * o) * a, t.y = (n[1] * r + n[5] * s + n[9] * o) * a, t.z = (n[2] * r + n[6] * s + n[10] * o) * a, t
  16810. }
  16811. var n = new r.default(function() {
  16812. return {
  16813. distance: 0,
  16814. node: null
  16815. }
  16816. }, 1),
  16817. s = [],
  16818. l = o.create(),
  16819. _ = c.create(),
  16820. f = c.create(),
  16821. d = a.create(),
  16822. p = h.create(),
  16823. m = h.create(),
  16824. y = c.create();
  16825. function v(t) {
  16826. return t > 0 && t < 1 / 0
  16827. }
  16828. return function(r, a, g, x) {
  16829. return n.reset(), s.length = 0, t(r = r || cc.director.getScene(), (function(t) {
  16830. if (!x || x(t)) {
  16831. h.invert(m, t.getWorldMatrix(p)), c.transformMat4(d.o, a.o, m), c.normalize(d.d, i(d.d, a.d, m));
  16832. var e = 1 / 0,
  16833. r = t._renderComponent;
  16834. if (r instanceof cc.MeshRenderer ? e = u.rayAabb(d, r._boundingBox) : t.width && t.height && (c.set(_, -t.width * t.anchorX, -t.height * t.anchorY, t.z), c.set(f, t.width * (1 - t.anchorX), t.height * (1 - t.anchorY), t.z), o.fromPoints(l, _, f), e = u.rayAabb(d, l)), v(e) && (g && (e = g(d, t, e)), v(e))) {
  16835. c.scale(y, d.d, e), i(y, y, p);
  16836. var b = n.add();
  16837. b.node = t, b.distance = cc.vmath.vec3.mag(y), s.push(b)
  16838. }
  16839. }
  16840. })), s.sort(e), s
  16841. }
  16842. })(), e.exports = u
  16843. }), {
  16844. "../../renderer/gfx": 360,
  16845. "../../renderer/memop/recycle-pool": 375,
  16846. "./aabb": 135,
  16847. "./ray": 138,
  16848. "./triangle": 139
  16849. }],
  16850. 138: [(function(t, e, i) {
  16851. "use strict";
  16852. var n = cc.vmath.vec3;
  16853. function r(t, e, i, n, r, s) {
  16854. this.o = cc.v3(t, e, i), this.d = cc.v3(n, r, s)
  16855. }
  16856. r.create = function(t, e, i, n, s, o) {
  16857. return new r(t, e, i, n, s, o)
  16858. }, r.clone = function(t) {
  16859. return new r(t.o.x, t.o.y, t.o.z, t.d.x, t.d.y, t.d.z)
  16860. }, r.copy = function(t, e) {
  16861. return t.o.x = e.o.x, t.o.y = e.o.y, t.o.z = e.o.z, t.d.x = e.d.x, t.d.y = e.d.y, t.d.z = e.d.z, t
  16862. }, r.set = function(t, e, i, n, r, s, o) {
  16863. return t.o.x = e, t.o.y = i, t.o.z = n, t.d.x = r, t.d.y = s, t.d.z = o, t
  16864. }, r.fromPoints = function(t, e, i) {
  16865. return n.copy(t.o, e), n.normalize(t.d, n.sub(t.d, i, e)), t
  16866. }, e.exports = r
  16867. }), {}],
  16868. 139: [(function(t, e, i) {
  16869. "use strict";
  16870. var n = cc.vmath.vec3;
  16871. function r(t, e, i, n, r, s, o, a, l) {
  16872. this.a = cc.v3(t, e, i), this.b = cc.v3(n, r, s), this.c = cc.v3(o, a, l)
  16873. }
  16874. r.create = function(t, e, i, n, s, o, a, l, h) {
  16875. return new r(t, e, i, n, s, o, a, l, h)
  16876. }, r.clone = function(t) {
  16877. return new r(t.a.x, t.a.y, t.a.z, t.b.x, t.b.y, t.b.z, t.c.x, t.c.y, t.c.z)
  16878. }, r.copy = function(t, e) {
  16879. return n.copy(t.a, e.a), n.copy(t.b, e.b), n.copy(t.c, e.c), t
  16880. }, r.fromPoints = function(t, e, i, r) {
  16881. return n.copy(t.a, e), n.copy(t.b, i), n.copy(t.c, r), t
  16882. }, r.set = function(t, e, i, n, r, s, o, a, l, h) {
  16883. return t.a.x = e, t.a.y = i, t.a.z = n, t.b.x = r, t.b.y = s, t.b.z = o, t.c.x = a, t.c.y = l, t.c.z = h, t
  16884. }, e.exports = r
  16885. }), {}],
  16886. 140: [(function(t, e, i) {
  16887. "use strict";
  16888. var n = t("../components/CCRenderComponent"),
  16889. r = t("../assets/material/CCMaterial"),
  16890. s = t("./types"),
  16891. o = s.LineCap,
  16892. a = s.LineJoin,
  16893. l = cc.Class({
  16894. name: "cc.Graphics",
  16895. extends: n,
  16896. editor: !1,
  16897. ctor: function() {
  16898. this._impl = new l._Impl(this)
  16899. },
  16900. properties: {
  16901. _lineWidth: 1,
  16902. _strokeColor: cc.Color.BLACK,
  16903. _lineJoin: a.MITER,
  16904. _lineCap: o.BUTT,
  16905. _fillColor: cc.Color.WHITE,
  16906. _miterLimit: 10,
  16907. lineWidth: {
  16908. get: function() {
  16909. return this._lineWidth
  16910. },
  16911. set: function(t) {
  16912. this._lineWidth = t, this._impl.lineWidth = t
  16913. }
  16914. },
  16915. lineJoin: {
  16916. get: function() {
  16917. return this._lineJoin
  16918. },
  16919. set: function(t) {
  16920. this._lineJoin = t, this._impl.lineJoin = t
  16921. },
  16922. type: a
  16923. },
  16924. lineCap: {
  16925. get: function() {
  16926. return this._lineCap
  16927. },
  16928. set: function(t) {
  16929. this._lineCap = t, this._impl.lineCap = t
  16930. },
  16931. type: o
  16932. },
  16933. strokeColor: {
  16934. get: function() {
  16935. return this._strokeColor
  16936. },
  16937. set: function(t) {
  16938. this._impl.strokeColor = this._strokeColor = cc.color(t)
  16939. }
  16940. },
  16941. fillColor: {
  16942. get: function() {
  16943. return this._fillColor
  16944. },
  16945. set: function(t) {
  16946. this._impl.fillColor = this._fillColor = cc.color(t)
  16947. }
  16948. },
  16949. miterLimit: {
  16950. get: function() {
  16951. return this._miterLimit
  16952. },
  16953. set: function(t) {
  16954. this._miterLimit = t, this._impl.miterLimit = t
  16955. }
  16956. }
  16957. },
  16958. statics: {
  16959. LineJoin: a,
  16960. LineCap: o
  16961. },
  16962. onRestore: function() {
  16963. this._impl || (this._impl = new l._Impl(this))
  16964. },
  16965. onEnable: function() {
  16966. this._super(), this._activateMaterial()
  16967. },
  16968. onDestroy: function() {
  16969. this.clear(!0), this._super(), this._impl = null
  16970. },
  16971. _activateMaterial: function() {
  16972. if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
  16973. var t = this.sharedMaterials[0];
  16974. (t = t ? r.getInstantiatedMaterial(t, this) : r.getInstantiatedBuiltinMaterial("2d-base", this)).define("CC_USE_MODEL", !0), this.setMaterial(0, t)
  16975. } else this.disableRender()
  16976. },
  16977. moveTo: function(t, e) {
  16978. this._impl.moveTo(t, e)
  16979. },
  16980. lineTo: function(t, e) {
  16981. this._impl.lineTo(t, e)
  16982. },
  16983. bezierCurveTo: function(t, e, i, n, r, s) {
  16984. this._impl.bezierCurveTo(t, e, i, n, r, s)
  16985. },
  16986. quadraticCurveTo: function(t, e, i, n) {
  16987. this._impl.quadraticCurveTo(t, e, i, n)
  16988. },
  16989. arc: function(t, e, i, n, r, s) {
  16990. this._impl.arc(t, e, i, n, r, s)
  16991. },
  16992. ellipse: function(t, e, i, n) {
  16993. this._impl.ellipse(t, e, i, n)
  16994. },
  16995. circle: function(t, e, i) {
  16996. this._impl.circle(t, e, i)
  16997. },
  16998. rect: function(t, e, i, n) {
  16999. this._impl.rect(t, e, i, n)
  17000. },
  17001. roundRect: function(t, e, i, n, r) {
  17002. this._impl.roundRect(t, e, i, n, r)
  17003. },
  17004. fillRect: function(t, e, i, n) {
  17005. this.rect(t, e, i, n), this.fill()
  17006. },
  17007. clear: function(t) {
  17008. this._impl.clear(t), this._assembler && this._assembler.clear(t)
  17009. },
  17010. close: function() {
  17011. this._impl.close()
  17012. },
  17013. stroke: function() {
  17014. this._assembler || this._resetAssembler(), this._assembler.stroke(this)
  17015. },
  17016. fill: function() {
  17017. this._assembler || this._resetAssembler(), this._assembler.fill(this)
  17018. }
  17019. });
  17020. cc.Graphics = e.exports = l, cc.Graphics.Types = s, cc.Graphics.Helper = t("./helper")
  17021. }), {
  17022. "../assets/material/CCMaterial": 75,
  17023. "../components/CCRenderComponent": 106,
  17024. "./helper": 141,
  17025. "./types": 143
  17026. }],
  17027. 141: [(function(t, e, i) {
  17028. "use strict";
  17029. var n = t("./types").PointFlags,
  17030. r = Math.PI,
  17031. s = Math.min,
  17032. o = Math.max,
  17033. a = Math.cos,
  17034. l = Math.sin,
  17035. h = Math.abs,
  17036. c = Math.sign,
  17037. u = .5522847493;
  17038. e.exports = {
  17039. arc: function(t, e, i, n, c, u, _) {
  17040. var f, d, p, m = 0,
  17041. y = 0,
  17042. v = 0,
  17043. g = 0,
  17044. x = 0,
  17045. b = 0,
  17046. A = 0,
  17047. C = 0,
  17048. T = 0,
  17049. S = 0,
  17050. w = 0,
  17051. E = 0,
  17052. M = 0;
  17053. if (y = u - c, _ = _ || !1)
  17054. if (h(y) >= 2 * r) y = 2 * r;
  17055. else
  17056. for (; y < 0;) y += 2 * r;
  17057. else if (h(y) >= 2 * r) y = 2 * -r;
  17058. else
  17059. for (; y > 0;) y -= 2 * r;
  17060. for (p = 0 | o(1, s(h(y) / (.5 * r) + .5, 5)), v = h(4 / 3 * (1 - a(f = y / p / 2)) / l(f)), _ || (v = -v), d = 0; d <= p; d++) b = e + (g = a(m = c + y * (d / p))) * n, A = i + (x = l(m)) * n, C = -x * n * v, T = g * n * v, 0 === d ? t.moveTo(b, A) : t.bezierCurveTo(S + E, w + M, b - C, A - T, b, A), S = b, w = A, E = C, M = T
  17061. },
  17062. ellipse: function(t, e, i, n, r) {
  17063. t.moveTo(e - n, i), t.bezierCurveTo(e - n, i + r * u, e - n * u, i + r, e, i + r), t.bezierCurveTo(e + n * u, i + r, e + n, i + r * u, e + n, i), t.bezierCurveTo(e + n, i - r * u, e + n * u, i - r, e, i - r), t.bezierCurveTo(e - n * u, i - r, e - n, i - r * u, e - n, i), t.close()
  17064. },
  17065. roundRect: function(t, e, i, n, r, o) {
  17066. if (o < .1) t.rect(e, i, n, r);
  17067. else {
  17068. var a = s(o, .5 * h(n)) * c(n),
  17069. l = s(o, .5 * h(r)) * c(r);
  17070. t.moveTo(e, i + l), t.lineTo(e, i + r - l), t.bezierCurveTo(e, i + r - l * (1 - u), e + a * (1 - u), i + r, e + a, i + r), t.lineTo(e + n - a, i + r), t.bezierCurveTo(e + n - a * (1 - u), i + r, e + n, i + r - l * (1 - u), e + n, i + r - l), t.lineTo(e + n, i + l), t.bezierCurveTo(e + n, i + l * (1 - u), e + n - a * (1 - u), i, e + n - a, i), t.lineTo(e + a, i), t.bezierCurveTo(e + a * (1 - u), i, e, i + l * (1 - u), e, i + l), t.close()
  17071. }
  17072. },
  17073. tesselateBezier: function t(e, i, r, s, o, a, l, c, u, _, f) {
  17074. var d, p, m, y, v, g, x, b, A, C, T, S, w, E, M, D;
  17075. _ > 10 || (v = .5 * (a + c), g = .5 * (l + u), x = .5 * ((d = .5 * (i + s)) + (m = .5 * (s + a))), b = .5 * ((p = .5 * (r + o)) + (y = .5 * (o + l))), ((M = h((s - c) * (E = u - r) - (o - u) * (w = c - i))) + (D = h((a - c) * E - (l - u) * w))) * (M + D) < e._tessTol * (w * w + E * E) ? e._addPoint(c, u, 0 === f ? f | n.PT_BEVEL : f) : (t(e, i, r, d, p, x, b, T = .5 * (x + (A = .5 * (m + v))), S = .5 * (b + (C = .5 * (y + g))), _ + 1, 0), t(e, T, S, A, C, v, g, c, u, _ + 1, f)))
  17076. }
  17077. }
  17078. }), {
  17079. "./types": 143
  17080. }],
  17081. 142: [(function(t, e, i) {
  17082. "use strict";
  17083. t("./graphics")
  17084. }), {
  17085. "./graphics": 140
  17086. }],
  17087. 143: [(function(t, e, i) {
  17088. "use strict";
  17089. var n = cc.Enum({
  17090. BUTT: 0,
  17091. ROUND: 1,
  17092. SQUARE: 2
  17093. }),
  17094. r = cc.Enum({
  17095. BEVEL: 0,
  17096. ROUND: 1,
  17097. MITER: 2
  17098. }),
  17099. s = cc.Enum({
  17100. PT_CORNER: 1,
  17101. PT_LEFT: 2,
  17102. PT_BEVEL: 4,
  17103. PT_INNERBEVEL: 8
  17104. });
  17105. e.exports = {
  17106. LineCap: n,
  17107. LineJoin: r,
  17108. PointFlags: s
  17109. }
  17110. }), {}],
  17111. 144: [(function(t, e, i) {
  17112. "use strict";
  17113. t("./platform"), t("./assets"), t("./CCNode"), t("./CCPrivateNode"), t("./CCScene"), t("./components"), t("./graphics"), t("./collider"), t("./collider/CCIntersection"), t("./physics"), t("./camera/CCCamera"), t("./geom-utils"), t("./mesh"), t("./3d"), t("./3d/polyfill-3d"), t("./base-ui/CCWidgetManager")
  17114. }), {
  17115. "./3d": 29,
  17116. "./3d/polyfill-3d": 30,
  17117. "./CCNode": 52,
  17118. "./CCPrivateNode": 53,
  17119. "./CCScene": 54,
  17120. "./assets": 74,
  17121. "./base-ui/CCWidgetManager": 79,
  17122. "./camera/CCCamera": 80,
  17123. "./collider": 88,
  17124. "./collider/CCIntersection": 86,
  17125. "./components": 123,
  17126. "./geom-utils": 136,
  17127. "./graphics": 142,
  17128. "./mesh": 167,
  17129. "./physics": 182,
  17130. "./platform": 215
  17131. }],
  17132. 145: [(function(t, e, i) {
  17133. "use strict";
  17134. var n = t("../platform/js"),
  17135. r = t("./pipeline"),
  17136. s = t("./loading-items"),
  17137. o = t("./asset-loader"),
  17138. a = t("./downloader"),
  17139. l = t("./loader"),
  17140. h = t("./asset-table"),
  17141. c = t("../platform/utils").callInNextTick,
  17142. u = t("./auto-release-utils"),
  17143. _ = Object.create(null);
  17144. _.assets = new h, _.internal = new h;
  17145. var f = {
  17146. url: null,
  17147. raw: !1
  17148. };
  17149. function d(t) {
  17150. var e, i, n;
  17151. if ("object" == typeof t) {
  17152. if (i = t, t.url) return i;
  17153. e = t.uuid
  17154. } else i = {}, e = t;
  17155. return n = i.type ? "uuid" === i.type : cc.AssetLibrary._uuidInSettings(e), cc.AssetLibrary._getAssetInfoInRuntime(e, f), i.url = n ? f.url : e, f.url && "uuid" === i.type && f.raw ? (i.type = null, i.isRawAsset = !0) : n || (i.isRawAsset = !0), i
  17156. }
  17157. var p = [],
  17158. m = [];
  17159. function y() {
  17160. var t = new o,
  17161. e = new a,
  17162. i = new l;
  17163. r.call(this, [t, e, i]), this.assetLoader = t, this.md5Pipe = null, this.downloader = e, this.loader = i, this.onProgress = null, this._autoReleaseSetting = n.createMap(!0)
  17164. }
  17165. n.extend(y, r);
  17166. var v = y.prototype;
  17167. v.init = function(t) {}, v.getXMLHttpRequest = function() {
  17168. return window.XMLHttpRequest ? new window.XMLHttpRequest : new ActiveXObject("MSXML2.XMLHTTP")
  17169. }, v.addDownloadHandlers = function(t) {
  17170. this.downloader.addHandlers(t)
  17171. }, v.addLoadHandlers = function(t) {
  17172. this.loader.addHandlers(t)
  17173. }, v.load = function(t, e, i) {
  17174. void 0 === i && (i = e, e = this.onProgress || null);
  17175. var n, r = this,
  17176. o = !1;
  17177. t instanceof Array || (t ? (o = !0, t = [t]) : t = []), p.length = 0;
  17178. for (var a = 0; a < t.length; ++a) {
  17179. var l = t[a];
  17180. if (l && l.id && (cc.warnID(4920, l.id), l.uuid || l.url || (l.url = l.id)), (n = d(l)).url || n.uuid) {
  17181. var h = this._cache[n.url];
  17182. p.push(h || n)
  17183. }
  17184. }
  17185. var u = s.create(this, e, (function(t, e) {
  17186. c((function() {
  17187. if (i) {
  17188. if (o) {
  17189. var s = n.url;
  17190. i.call(r, t, e.getContent(s))
  17191. } else i.call(r, t, e);
  17192. i = null
  17193. }
  17194. e.destroy()
  17195. }))
  17196. }));
  17197. s.initQueueDeps(u), u.append(p), p.length = 0
  17198. }, v.flowInDeps = function(t, e, i) {
  17199. m.length = 0;
  17200. for (var n = 0; n < e.length; ++n) {
  17201. var r = d(e[n]);
  17202. if (r.url || r.uuid) {
  17203. var o = this._cache[r.url];
  17204. o ? m.push(o) : m.push(r)
  17205. }
  17206. }
  17207. var a = s.create(this, t ? function(t, e, i) {
  17208. this._ownerQueue && this._ownerQueue.onProgress && this._ownerQueue._childOnProgress(i)
  17209. } : null, (function(e, n) {
  17210. i(e, n), t && t.deps && (t.deps.length = 0), n.destroy()
  17211. }));
  17212. if (t) {
  17213. var l = s.getQueue(t);
  17214. a._ownerQueue = l._ownerQueue || l
  17215. }
  17216. var h = a.append(m, t);
  17217. return m.length = 0, h
  17218. }, v._assetTables = _, v._getResUuid = function(t, e, i, n) {
  17219. var r = _[i = i || "assets"];
  17220. if (!t || !r) return null;
  17221. var s = t.indexOf("?"); - 1 !== s && (t = t.substr(0, s));
  17222. var o = r.getUuid(t, e);
  17223. if (!o) {
  17224. var a = cc.path.extname(t);
  17225. a && (t = t.slice(0, -a.length), (o = r.getUuid(t, e)) && !n && cc.warnID(4901, t, a))
  17226. }
  17227. return o
  17228. }, v._getReferenceKey = function(t) {
  17229. var e;
  17230. return "object" == typeof t ? e = t._uuid || null : "string" == typeof t && (e = this._getResUuid(t, null, null, !0) || t), e ? (cc.AssetLibrary._getAssetInfoInRuntime(e, f), this._cache[f.url] ? f.url : e) : (cc.warnID(4800, t), e)
  17231. }, v._urlNotFound = function(t, e, i) {
  17232. c((function() {
  17233. t = cc.url.normalize(t);
  17234. var r = (e ? n.getClassName(e) : "Asset") + ' in "resources/' + t + '" does not exist.';
  17235. i && i(new Error(r), [])
  17236. }))
  17237. }, v._parseLoadResArgs = function(t, e, i) {
  17238. if (void 0 === i) {
  17239. var r = t instanceof Array || n.isChildClassOf(t, cc.RawAsset);
  17240. e ? (i = e, r && (e = this.onProgress || null)) : void 0 !== e || r || (i = t, e = this.onProgress || null, t = null), void 0 === e || r || (e = t, t = null)
  17241. }
  17242. return {
  17243. type: t,
  17244. onProgress: e,
  17245. onComplete: i
  17246. }
  17247. }, v.loadRes = function(t, e, i, n, r) {
  17248. 5 !== arguments.length && (r = n, n = i, i = "assets");
  17249. var s = this._parseLoadResArgs(e, n, r);
  17250. e = s.type, n = s.onProgress, r = s.onComplete;
  17251. var o = this,
  17252. a = o._getResUuid(t, e, i);
  17253. a ? this.load({
  17254. type: "uuid",
  17255. uuid: a
  17256. }, n, (function(t, e) {
  17257. e && o.setAutoReleaseRecursively(a, !1), r && r(t, e)
  17258. })) : o._urlNotFound(t, e, r)
  17259. }, v._loadResUuids = function(t, e, i, n) {
  17260. if (t.length > 0) {
  17261. var r = this,
  17262. s = t.map((function(t) {
  17263. return {
  17264. type: "uuid",
  17265. uuid: t
  17266. }
  17267. }));
  17268. this.load(s, e, (function(t, e) {
  17269. if (i) {
  17270. for (var o = [], a = n && [], l = 0; l < s.length; ++l) {
  17271. var h = s[l].uuid,
  17272. c = this._getReferenceKey(h),
  17273. u = e.getContent(c);
  17274. u && (r.setAutoReleaseRecursively(h, !1), o.push(u), a && a.push(n[l]))
  17275. }
  17276. n ? i(t, o, a) : i(t, o)
  17277. }
  17278. }))
  17279. } else i && c((function() {
  17280. n ? i(null, [], []) : i(null, [])
  17281. }))
  17282. }, v.loadResArray = function(t, e, i, n, r) {
  17283. 5 !== arguments.length && (r = n, n = i, i = "assets");
  17284. var s = this._parseLoadResArgs(e, n, r);
  17285. e = s.type, n = s.onProgress, r = s.onComplete;
  17286. for (var o = [], a = e instanceof Array, l = 0; l < t.length; l++) {
  17287. var h = t[l],
  17288. c = a ? e[l] : e,
  17289. u = this._getResUuid(h, c, i);
  17290. if (!u) return void this._urlNotFound(h, c, r);
  17291. o.push(u)
  17292. }
  17293. this._loadResUuids(o, n, r)
  17294. }, v.loadResDir = function(t, e, i, n, r) {
  17295. if (5 !== arguments.length && (r = n, n = i, i = "assets"), _[i]) {
  17296. var s = this._parseLoadResArgs(e, n, r);
  17297. e = s.type, n = s.onProgress, r = s.onComplete;
  17298. var o = [],
  17299. a = _[i].getUuidArray(t, e, o);
  17300. this._loadResUuids(a, n, r, o)
  17301. }
  17302. }, v.getRes = function(t, e) {
  17303. var i = this._cache[t];
  17304. if (!i) {
  17305. var n = this._getResUuid(t, e, null, !0);
  17306. if (!n) return null;
  17307. var r = this._getReferenceKey(n);
  17308. i = this._cache[r]
  17309. }
  17310. return i && i.alias && (i = i.alias), i && i.complete ? i.content : null
  17311. }, v.getResCount = function() {
  17312. return Object.keys(this._cache).length
  17313. }, v.getDependsRecursively = function(t) {
  17314. if (t) {
  17315. var e = this._getReferenceKey(t),
  17316. i = u.getDependsRecursively(e);
  17317. return i.push(e), i
  17318. }
  17319. return []
  17320. }, v.release = function(t) {
  17321. if (Array.isArray(t))
  17322. for (var e = 0; e < t.length; e++) {
  17323. var i = t[e];
  17324. this.release(i)
  17325. } else if (t) {
  17326. var n = this._getReferenceKey(t);
  17327. if (n && n in cc.AssetLibrary.getBuiltinDeps()) return;
  17328. var r = this.getItem(n);
  17329. if (r) {
  17330. this.removeItem(n);
  17331. t = r.content
  17332. }
  17333. if (t instanceof cc.Asset) {
  17334. var s = t.nativeUrl;
  17335. s && this.release(s), t.destroy()
  17336. }
  17337. }
  17338. }, v.releaseAsset = function(t) {
  17339. var e = t._uuid;
  17340. e && this.release(e)
  17341. }, v.releaseRes = function(t, e, i) {
  17342. var n = this._getResUuid(t, e, i);
  17343. n ? this.release(n) : cc.errorID(4914, t)
  17344. }, v.releaseResDir = function(t, e, i) {
  17345. if (_[i = i || "assets"])
  17346. for (var n = _[i].getUuidArray(t, e), r = 0; r < n.length; r++) {
  17347. var s = n[r];
  17348. this.release(s)
  17349. }
  17350. }, v.releaseAll = function() {
  17351. for (var t in this._cache) this.release(t)
  17352. }, v.removeItem = function(t) {
  17353. var e = r.prototype.removeItem.call(this, t);
  17354. return delete this._autoReleaseSetting[t], e
  17355. }, v.setAutoRelease = function(t, e) {
  17356. var i = this._getReferenceKey(t);
  17357. i && (this._autoReleaseSetting[i] = !!e)
  17358. }, v.setAutoReleaseRecursively = function(t, e) {
  17359. e = !!e;
  17360. var i = this._getReferenceKey(t);
  17361. if (i) {
  17362. this._autoReleaseSetting[i] = e;
  17363. for (var n = u.getDependsRecursively(i), r = 0; r < n.length; r++) {
  17364. var s = n[r];
  17365. this._autoReleaseSetting[s] = e
  17366. }
  17367. } else 0
  17368. }, v.isAutoRelease = function(t) {
  17369. var e = this._getReferenceKey(t);
  17370. return !!e && !!this._autoReleaseSetting[e]
  17371. }, cc.loader = new y, e.exports = cc.loader
  17372. }), {
  17373. "../platform/js": 218,
  17374. "../platform/utils": 222,
  17375. "./asset-loader": 146,
  17376. "./asset-table": 147,
  17377. "./auto-release-utils": 149,
  17378. "./downloader": 151,
  17379. "./loader": 154,
  17380. "./loading-items": 155,
  17381. "./pipeline": 158,
  17382. "./released-asset-checker": 159
  17383. }],
  17384. 146: [(function(t, e, i) {
  17385. "use strict";
  17386. t("../utils/CCPath");
  17387. var n = t("../CCDebug"),
  17388. r = t("./pipeline"),
  17389. s = t("./loading-items"),
  17390. o = "AssetLoader",
  17391. a = function(t) {
  17392. this.id = o, this.async = !0, this.pipeline = null
  17393. };
  17394. a.ID = o;
  17395. var l = [];
  17396. a.prototype.handle = function(t, e) {
  17397. var i = t.uuid;
  17398. if (!i) return t.content || null;
  17399. cc.AssetLibrary.queryAssetInfo(i, (function(r, o, a) {
  17400. if (r) e(r);
  17401. else if (t.url = t.rawUrl = o, t.isRawAsset = a, a) {
  17402. var h = cc.path.extname(o).toLowerCase();
  17403. if (!h) return void e(new Error(n.getError(4931, i, o)));
  17404. h = h.substr(1);
  17405. var c = s.getQueue(t);
  17406. l[0] = {
  17407. queueId: t.queueId,
  17408. id: o,
  17409. url: o,
  17410. type: h,
  17411. error: null,
  17412. alias: t,
  17413. complete: !0
  17414. }, c.append(l), t.type = h, e(null, t.content)
  17415. } else t.type = "uuid", e(null, t.content)
  17416. }))
  17417. }, r.AssetLoader = e.exports = a
  17418. }), {
  17419. "../CCDebug": 49,
  17420. "../utils/CCPath": 289,
  17421. "./loading-items": 155,
  17422. "./pipeline": 158
  17423. }],
  17424. 147: [(function(t, e, i) {
  17425. "use strict";
  17426. var n = t("../utils/misc").pushToMap,
  17427. r = t("../platform/js");
  17428. function s(t, e) {
  17429. this.uuid = t, this.type = e
  17430. }
  17431. function o() {
  17432. this._pathToUuid = r.createMap(!0)
  17433. }
  17434. function a(t, e) {
  17435. if (t.length > e.length) {
  17436. var i = t.charCodeAt(e.length);
  17437. return 46 === i || 47 === i
  17438. }
  17439. return !0
  17440. }
  17441. var l = o.prototype;
  17442. l.getUuid = function(t, e) {
  17443. t = cc.url.normalize(t);
  17444. var i = this._pathToUuid[t];
  17445. if (i)
  17446. if (Array.isArray(i)) {
  17447. if (!e) return i[0].uuid;
  17448. for (var n = 0; n < i.length; n++) {
  17449. var s = i[n];
  17450. if (r.isChildClassOf(s.type, e)) return s.uuid
  17451. }
  17452. } else {
  17453. if (!e || r.isChildClassOf(i.type, e)) return i.uuid
  17454. }
  17455. return ""
  17456. }, l.getUuidArray = function(t, e, i) {
  17457. "/" === (t = cc.url.normalize(t))[t.length - 1] && (t = t.slice(0, -1));
  17458. var n = this._pathToUuid,
  17459. s = [],
  17460. o = r.isChildClassOf;
  17461. for (var l in n)
  17462. if (l.startsWith(t) && a(l, t) || !t) {
  17463. var h = n[l];
  17464. if (Array.isArray(h))
  17465. for (var c = 0; c < h.length; c++) {
  17466. var u = h[c];
  17467. (!e || o(u.type, e)) && (s.push(u.uuid), i && i.push(l))
  17468. } else(!e || o(h.type, e)) && (s.push(h.uuid), i && i.push(l))
  17469. }
  17470. return s
  17471. }, l.add = function(t, e, i, r) {
  17472. t = t.substring(0, t.length - cc.path.extname(t).length);
  17473. var o = new s(e, i);
  17474. n(this._pathToUuid, t, o, r)
  17475. }, l._getInfo_DEBUG = !1, l.reset = function() {
  17476. this._pathToUuid = r.createMap(!0)
  17477. }, e.exports = o
  17478. }), {
  17479. "../platform/js": 218,
  17480. "../utils/misc": 300
  17481. }],
  17482. 148: [(function(t, e, i) {
  17483. "use strict";
  17484. var n = t("../platform/CCSys"),
  17485. r = t("../CCDebug"),
  17486. s = n.__audioSupport,
  17487. o = s.format,
  17488. a = s.context;
  17489. function l(t, e) {
  17490. var i = document.createElement("audio");
  17491. i.src = t.url;
  17492. var n = function() {
  17493. clearTimeout(r), i.removeEventListener("canplaythrough", o, !1), i.removeEventListener("error", a, !1), s.USE_LOADER_EVENT && i.removeEventListener(s.USE_LOADER_EVENT, o, !1)
  17494. },
  17495. r = setTimeout((function() {
  17496. 0 === i.readyState ? a() : o()
  17497. }), 8e3),
  17498. o = function() {
  17499. n(), e(null, i)
  17500. },
  17501. a = function() {
  17502. n();
  17503. var i = "load audio failure - " + t.url;
  17504. cc.log(i), e(i)
  17505. };
  17506. i.addEventListener("canplaythrough", o, !1), i.addEventListener("error", a, !1), s.USE_LOADER_EVENT && i.addEventListener(s.USE_LOADER_EVENT, o, !1)
  17507. }
  17508. function h(t, e) {
  17509. a || e(new Error(r.getError(4926)));
  17510. var i = cc.loader.getXMLHttpRequest();
  17511. i.open("GET", t.url, !0), i.responseType = "arraybuffer", i.onload = function() {
  17512. a.decodeAudioData(i.response, (function(t) {
  17513. e(null, t)
  17514. }), (function() {
  17515. e("decode error - " + t.id, null)
  17516. }))
  17517. }, i.onerror = function() {
  17518. e("request error - " + t.id, null)
  17519. }, i.send()
  17520. }
  17521. e.exports = function(t, e) {
  17522. if (0 === o.length) return new Error(r.getError(4927));
  17523. var i;
  17524. i = s.WEB_AUDIO ? t._owner instanceof cc.AudioClip ? t._owner.loadMode === cc.AudioClip.LoadMode.WEB_AUDIO ? h : l : t.urlParam && t.urlParam.useDom ? l : h : l, i(t, e)
  17525. }
  17526. }), {
  17527. "../CCDebug": 49,
  17528. "../platform/CCSys": 207
  17529. }],
  17530. 149: [(function(t, e, i) {
  17531. "use strict";
  17532. var n = t("../platform/js");
  17533. function r(t, e) {
  17534. var i = cc.loader.getItem(t);
  17535. if (i) {
  17536. var n = i.dependKeys;
  17537. if (n)
  17538. for (var s = 0; s < n.length; s++) {
  17539. var o = n[s];
  17540. e[o] || (e[o] = !0, r(o, e))
  17541. }
  17542. }
  17543. }
  17544. function s(t, e) {
  17545. if (t._uuid) {
  17546. var i = cc.loader._getReferenceKey(t);
  17547. e[i] || (e[i] = !0, r(i, e))
  17548. }
  17549. }
  17550. function o(t, e) {
  17551. for (var i = Object.getOwnPropertyNames(t), n = 0; n < i.length; n++) {
  17552. var r = t[i[n]];
  17553. if ("object" == typeof r && r)
  17554. if (Array.isArray(r))
  17555. for (var o = 0; o < r.length; o++) {
  17556. var a = r[o];
  17557. a instanceof cc.RawAsset && s(a, e)
  17558. } else if (r.constructor && r.constructor !== Object) r instanceof cc.RawAsset && s(r, e);
  17559. else
  17560. for (var l = Object.getOwnPropertyNames(r), h = 0; h < l.length; h++) {
  17561. var c = r[l[h]];
  17562. c instanceof cc.RawAsset && s(c, e)
  17563. }
  17564. }
  17565. }
  17566. function a(t, e) {
  17567. for (var i = 0; i < t._components.length; i++) o(t._components[i], e);
  17568. for (var n = 0; n < t._children.length; n++) a(t._children[n], e)
  17569. }
  17570. e.exports = {
  17571. autoRelease: function(t, e, i) {
  17572. var r = cc.loader._autoReleaseSetting,
  17573. s = n.createMap();
  17574. if (e)
  17575. for (var o = 0; o < e.length; o++) s[e[o]] = !0;
  17576. for (var l = 0; l < i.length; l++) a(i[l], s);
  17577. if (t)
  17578. for (var h = 0; h < t.length; h++) {
  17579. var c = t[h];
  17580. !1 === r[c] || s[c] || cc.loader.release(c)
  17581. }
  17582. for (var u = Object.keys(r), _ = 0; _ < u.length; _++) {
  17583. var f = u[_];
  17584. !0 !== r[f] || s[f] || cc.loader.release(f)
  17585. }
  17586. },
  17587. getDependsRecursively: function(t) {
  17588. var e = {};
  17589. return r(t, e), Object.keys(e)
  17590. }
  17591. }
  17592. }), {
  17593. "../platform/js": 218
  17594. }],
  17595. 150: [(function(t, e, i) {
  17596. "use strict";
  17597. e.exports = function(t, e) {
  17598. var i = t.url,
  17599. n = cc.loader.getXMLHttpRequest(),
  17600. r = "Load binary data failed: " + i;
  17601. n.open("GET", i, !0), n.responseType = "arraybuffer", n.onload = function() {
  17602. var t = n.response;
  17603. if (t) {
  17604. var i = new Uint8Array(t);
  17605. e(null, i)
  17606. } else e({
  17607. status: n.status,
  17608. errorMessage: r + "(no response)"
  17609. })
  17610. }, n.onerror = function() {
  17611. e({
  17612. status: n.status,
  17613. errorMessage: r + "(error)"
  17614. })
  17615. }, n.ontimeout = function() {
  17616. e({
  17617. status: n.status,
  17618. errorMessage: r + "(time out)"
  17619. })
  17620. }, n.send(null)
  17621. }
  17622. }), {}],
  17623. 151: [(function(t, e, i) {
  17624. "use strict";
  17625. var n = t("../platform/js"),
  17626. r = t("../CCDebug");
  17627. t("../utils/CCPath");
  17628. var s, o = t("./pipeline"),
  17629. a = t("./pack-downloader"),
  17630. l = t("./binary-downloader"),
  17631. h = t("./text-downloader"),
  17632. c = t("./utils").urlAppendTimestamp;
  17633. function u() {
  17634. return null
  17635. }
  17636. function _(t, e, i) {
  17637. var n = t.url,
  17638. s = document,
  17639. o = document.createElement("script");
  17640. function a() {
  17641. o.parentNode.removeChild(o), o.removeEventListener("load", a, !1), o.removeEventListener("error", l, !1), e(null, n)
  17642. }
  17643. function l() {
  17644. o.parentNode.removeChild(o), o.removeEventListener("load", a, !1), o.removeEventListener("error", l, !1), e(new Error(r.getError(4928, n)))
  17645. }
  17646. "file:" !== window.location.protocol && (o.crossOrigin = "anonymous"), o.async = i, o.src = c(n), o.addEventListener("load", a, !1), o.addEventListener("error", l, !1), s.body.appendChild(o)
  17647. }
  17648. function f(t, e, i, n) {
  17649. void 0 === i && (i = !0);
  17650. var s = c(t.url);
  17651. if (n = n || new Image, i && "file:" !== window.location.protocol ? n.crossOrigin = "anonymous" : n.crossOrigin = null, n.complete && n.naturalWidth > 0 && n.src === s) return n;
  17652. var o = function i() {
  17653. n.removeEventListener("load", i), n.removeEventListener("error", a), n.id = t.id, e(null, n)
  17654. },
  17655. a = function i() {
  17656. n.removeEventListener("load", o), n.removeEventListener("error", i), "https:" !== window.location.protocol && n.crossOrigin && "anonymous" === n.crossOrigin.toLowerCase() ? f(t, e, !1, n) : e(new Error(r.getError(4930, s)))
  17657. };
  17658. n.addEventListener("load", o), n.addEventListener("error", a), n.src = s
  17659. }
  17660. var d = {
  17661. js: _,
  17662. png: f,
  17663. jpg: f,
  17664. bmp: f,
  17665. jpeg: f,
  17666. gif: f,
  17667. ico: f,
  17668. tiff: f,
  17669. webp: f,
  17670. image: f,
  17671. pvr: l,
  17672. pkm: l,
  17673. mp3: s = t("./audio-downloader"),
  17674. ogg: s,
  17675. wav: s,
  17676. m4a: s,
  17677. txt: h,
  17678. xml: h,
  17679. vsh: h,
  17680. fsh: h,
  17681. atlas: h,
  17682. tmx: h,
  17683. tsx: h,
  17684. json: h,
  17685. ExportJson: h,
  17686. plist: h,
  17687. fnt: h,
  17688. font: u,
  17689. eot: u,
  17690. ttf: u,
  17691. woff: u,
  17692. svg: u,
  17693. ttc: u,
  17694. uuid: function(t, e) {
  17695. var i = a.load(t, e);
  17696. return void 0 === i ? this.extMap.json(t, e) : i || void 0
  17697. },
  17698. binary: l,
  17699. bin: l,
  17700. dbbin: l,
  17701. default: h
  17702. },
  17703. p = "Downloader",
  17704. m = function(t) {
  17705. this.id = p, this.async = !0, this.pipeline = null, this._curConcurrent = 0, this._loadQueue = [], this._subpackages = {}, this.extMap = n.mixin(t, d)
  17706. };
  17707. m.ID = p, m.PackDownloader = a, m.prototype.addHandlers = function(t) {
  17708. n.mixin(this.extMap, t)
  17709. }, m.prototype._handleLoadQueue = function() {
  17710. for (; this._curConcurrent < cc.macro.DOWNLOAD_MAX_CONCURRENT;) {
  17711. var t = this._loadQueue.shift();
  17712. if (!t) break;
  17713. var e = this.handle(t.item, t.callback);
  17714. void 0 !== e && (e instanceof Error ? t.callback(e) : t.callback(null, e))
  17715. }
  17716. }, m.prototype.handle = function(t, e) {
  17717. var i = this,
  17718. n = this.extMap[t.type] || this.extMap.default,
  17719. r = void 0;
  17720. if (this._curConcurrent < cc.macro.DOWNLOAD_MAX_CONCURRENT) {
  17721. if (this._curConcurrent++, void 0 !== (r = n.call(this, t, (function(t, n) {
  17722. i._curConcurrent = Math.max(0, i._curConcurrent - 1), i._handleLoadQueue(), e && e(t, n)
  17723. })))) return this._curConcurrent = Math.max(0, this._curConcurrent - 1), this._handleLoadQueue(), r
  17724. } else if (t.ignoreMaxConcurrency) {
  17725. if (void 0 !== (r = n.call(this, t, e))) return r
  17726. } else this._loadQueue.push({
  17727. item: t,
  17728. callback: e
  17729. })
  17730. }, m.prototype.loadSubpackage = function(t, e) {
  17731. var i = this._subpackages[t];
  17732. i ? i.loaded ? e && e() : _({
  17733. url: i.path + "index.js"
  17734. }, (function(t) {
  17735. t || (i.loaded = !0), e && e(t)
  17736. })) : e && e(new Error("Can't find subpackage " + t))
  17737. }, o.Downloader = e.exports = m
  17738. }), {
  17739. "../CCDebug": 49,
  17740. "../platform/js": 218,
  17741. "../utils/CCPath": 289,
  17742. "./audio-downloader": 148,
  17743. "./binary-downloader": 150,
  17744. "./pack-downloader": 157,
  17745. "./pipeline": 158,
  17746. "./text-downloader": 161,
  17747. "./utils": 163
  17748. }],
  17749. 152: [(function(t, e, i) {
  17750. "use strict";
  17751. var n = t("../utils/text-utils"),
  17752. r = null,
  17753. s = "BES bswy:->@123\u4e01\u3041\u1101",
  17754. o = {},
  17755. a = -1,
  17756. l = [],
  17757. h = 3e3,
  17758. c = (function() {
  17759. var t = void 0;
  17760. return function() {
  17761. if (void 0 === t)
  17762. if (window.FontFace) {
  17763. var e = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),
  17764. i = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor);
  17765. t = e ? parseInt(e[1], 10) > 42 : !i
  17766. } else t = !1;
  17767. return t
  17768. }
  17769. })();
  17770. function u() {
  17771. for (var t = !0, e = Date.now(), i = l.length - 1; i >= 0; i--) {
  17772. var o = l[i],
  17773. c = o.fontFamilyName;
  17774. if (e - o.startTime > h) cc.warnID(4933, c), o.callback(null, c), l.splice(i, 1);
  17775. else {
  17776. var u = o.refWidth;
  17777. r.font = "40px " + c, u !== n.safeMeasureText(r, s) ? (l.splice(i, 1), o.callback(null, c)) : t = !1
  17778. }
  17779. }
  17780. t && (clearInterval(a), a = -1)
  17781. }
  17782. function _(t, e, i) {
  17783. var n = new Promise(function(i, n) {
  17784. (function r() {
  17785. Date.now() - t >= h ? n() : document.fonts.load("40px " + e).then((function(t) {
  17786. t.length >= 1 ? i() : setTimeout(r, 100)
  17787. }), (function() {
  17788. n()
  17789. }))
  17790. })()
  17791. }),
  17792. r = null,
  17793. s = new Promise(function(t, e) {
  17794. r = setTimeout(e, h)
  17795. });
  17796. Promise.race([s, n]).then((function() {
  17797. r && (clearTimeout(r), r = null), i(null, e)
  17798. }), (function() {
  17799. cc.warnID(4933, e), i(null, e)
  17800. }))
  17801. }
  17802. var f = {
  17803. loadFont: function(t, e) {
  17804. var i = t.url,
  17805. h = f._getFontFamily(i);
  17806. if (o[h]) return h;
  17807. if (!r) {
  17808. var d = document.createElement("canvas");
  17809. d.width = 100, d.height = 100, r = d.getContext("2d")
  17810. }
  17811. var p = "40px " + h;
  17812. r.font = p;
  17813. var m = n.safeMeasureText(r, s),
  17814. y = document.createElement("style");
  17815. y.type = "text/css";
  17816. var v = "";
  17817. isNaN(h - 0) ? v += "@font-face { font-family:" + h + "; src:" : v += "@font-face { font-family:'" + h + "'; src:", v += "url('" + i + "');", y.textContent = v + "}", document.body.appendChild(y);
  17818. var g = document.createElement("div"),
  17819. x = g.style;
  17820. if (x.fontFamily = h, g.innerHTML = ".", x.position = "absolute", x.left = "-100px", x.top = "-100px", document.body.appendChild(g), c()) _(Date.now(), h, e);
  17821. else {
  17822. var b = {
  17823. fontFamilyName: h,
  17824. refWidth: m,
  17825. callback: e,
  17826. startTime: Date.now()
  17827. };
  17828. l.push(b), -1 === a && (a = setInterval(u, 100))
  17829. }
  17830. o[h] = y
  17831. },
  17832. _getFontFamily: function(t) {
  17833. var e = t.lastIndexOf(".ttf");
  17834. if (-1 === e) return t;
  17835. var i, n = t.lastIndexOf("/");
  17836. return -1 !== (i = -1 === n ? t.substring(0, e) + "_LABEL" : t.substring(n + 1, e) + "_LABEL").indexOf(" ") && (i = '"' + i + '"'), i
  17837. }
  17838. };
  17839. e.exports = f
  17840. }), {
  17841. "../utils/text-utils": 307
  17842. }],
  17843. 153: [(function(t, e, i) {
  17844. "use strict";
  17845. t("./downloader"), t("./loader"), t("./loading-items"), t("./pipeline"), t("./CCLoader")
  17846. }), {
  17847. "./CCLoader": 145,
  17848. "./downloader": 151,
  17849. "./loader": 154,
  17850. "./loading-items": 155,
  17851. "./pipeline": 158
  17852. }],
  17853. 154: [(function(t, e, i) {
  17854. "use strict";
  17855. var n = t("../platform/js"),
  17856. r = t("../platform/CCSAXParser").plistParser,
  17857. s = t("./pipeline"),
  17858. o = t("../assets/CCTexture2D"),
  17859. a = t("./uuid-loader"),
  17860. l = t("./font-loader");
  17861. function h(t) {
  17862. if ("string" != typeof t.content) return new Error("JSON Loader: Input item doesn't contain string content");
  17863. try {
  17864. return JSON.parse(t.content)
  17865. } catch (e) {
  17866. return new Error("JSON Loader: Parse json [" + t.id + "] failed : " + e)
  17867. }
  17868. }
  17869. function c(t) {
  17870. if (t._owner instanceof cc.Asset) return null;
  17871. var e = t.content;
  17872. if (cc.sys.platform !== cc.sys.FB_PLAYABLE_ADS && !(e instanceof Image)) return new Error("Image Loader: Input item doesn't contain Image content");
  17873. var i = t.texture || new o;
  17874. return i._uuid = t.uuid, i.url = t.url, i._setRawAsset(t.rawUrl, !1), i._nativeAsset = e, i
  17875. }
  17876. function u(t, e) {
  17877. if (t._owner instanceof cc.Asset) return null;
  17878. var i = new cc.AudioClip;
  17879. return i._setRawAsset(t.rawUrl, !1), i._nativeAsset = t.content, i.url = t.url, i
  17880. }
  17881. function _(t) {
  17882. return t.load ? t.load(t.content) : null
  17883. }
  17884. var f = 13,
  17885. d = 55727696,
  17886. p = 0,
  17887. m = 6,
  17888. y = 7,
  17889. v = 12;
  17890. var g = 16,
  17891. x = 6,
  17892. b = 8,
  17893. A = 10,
  17894. C = 12,
  17895. T = 14,
  17896. S = 0,
  17897. w = 1,
  17898. E = 3;
  17899. function M(t, e) {
  17900. return t[e] << 8 | t[e + 1]
  17901. }
  17902. var D = {
  17903. png: c,
  17904. jpg: c,
  17905. bmp: c,
  17906. jpeg: c,
  17907. gif: c,
  17908. ico: c,
  17909. tiff: c,
  17910. webp: c,
  17911. image: c,
  17912. pvr: function(t) {
  17913. var e = t.content instanceof ArrayBuffer ? t.content : t.content.buffer,
  17914. i = new Int32Array(e, 0, f);
  17915. if (i[p] != d) return new Error("Invalid magic number in PVR header");
  17916. var n = i[y],
  17917. r = i[m],
  17918. s = i[v] + 52;
  17919. return {
  17920. _data: new Uint8Array(e, s),
  17921. _compressed: !0,
  17922. width: n,
  17923. height: r
  17924. }
  17925. },
  17926. pkm: function(t) {
  17927. var e = t.content instanceof ArrayBuffer ? t.content : t.content.buffer,
  17928. i = new Uint8Array(e),
  17929. n = M(i, x);
  17930. if (n !== S && n !== w && n !== E) return new Error("Invalid magic number in ETC header");
  17931. var r = M(i, C),
  17932. s = M(i, T);
  17933. return M(i, b), M(i, A), {
  17934. _data: new Uint8Array(e, g),
  17935. _compressed: !0,
  17936. width: r,
  17937. height: s
  17938. }
  17939. },
  17940. mp3: u,
  17941. ogg: u,
  17942. wav: u,
  17943. m4a: u,
  17944. json: h,
  17945. ExportJson: h,
  17946. plist: function(t) {
  17947. if ("string" != typeof t.content) return new Error("Plist Loader: Input item doesn't contain string content");
  17948. var e = r.parse(t.content);
  17949. return e || new Error("Plist Loader: Parse [" + t.id + "] failed")
  17950. },
  17951. uuid: a,
  17952. prefab: a,
  17953. fire: a,
  17954. scene: a,
  17955. binary: _,
  17956. dbbin: _,
  17957. bin: _,
  17958. font: l.loadFont,
  17959. eot: l.loadFont,
  17960. ttf: l.loadFont,
  17961. woff: l.loadFont,
  17962. svg: l.loadFont,
  17963. ttc: l.loadFont,
  17964. default: function() {
  17965. return null
  17966. }
  17967. },
  17968. B = function(t) {
  17969. this.id = "Loader", this.async = !0, this.pipeline = null, this.extMap = n.mixin(t, D)
  17970. };
  17971. B.ID = "Loader", B.prototype.addHandlers = function(t) {
  17972. this.extMap = n.mixin(this.extMap, t)
  17973. }, B.prototype.handle = function(t, e) {
  17974. return (this.extMap[t.type] || this.extMap.default).call(this, t, e)
  17975. }, s.Loader = e.exports = B
  17976. }), {
  17977. "../assets/CCTexture2D": 73,
  17978. "../platform/CCSAXParser": 205,
  17979. "../platform/js": 218,
  17980. "./font-loader": 152,
  17981. "./pipeline": 158,
  17982. "./uuid-loader": 164
  17983. }],
  17984. 155: [(function(t, e, i) {
  17985. "use strict";
  17986. var n = t("../platform/callbacks-invoker");
  17987. t("../utils/CCPath");
  17988. var r = t("../platform/js"),
  17989. s = 0 | 998 * Math.random(),
  17990. o = r.createMap(!0),
  17991. a = [],
  17992. l = {
  17993. WORKING: 1,
  17994. COMPLETE: 2,
  17995. ERROR: 3
  17996. },
  17997. h = r.createMap(!0);
  17998. function c(t) {
  17999. return "string" == typeof(t.url || t)
  18000. }
  18001. function u(t) {
  18002. if (t) {
  18003. var e = t.split("?");
  18004. if (e && e[0] && e[1]) {
  18005. var i = {};
  18006. return e[1].split("&").forEach((function(t) {
  18007. var e = t.split("=");
  18008. i[e[0]] = e[1]
  18009. })), i
  18010. }
  18011. }
  18012. }
  18013. function _(t, e) {
  18014. var i = "object" == typeof t ? t.url : t,
  18015. n = {
  18016. queueId: e,
  18017. id: i,
  18018. url: i,
  18019. rawUrl: void 0,
  18020. urlParam: u(i),
  18021. type: "",
  18022. error: null,
  18023. content: null,
  18024. complete: !1,
  18025. states: {},
  18026. deps: null
  18027. };
  18028. if ("object" == typeof t && (r.mixin(n, t), t.skips))
  18029. for (var s = 0; s < t.skips.length; s++) {
  18030. var o = t.skips[s];
  18031. n.states[o] = l.COMPLETE
  18032. }
  18033. return n.rawUrl = n.url, i && !n.type && (n.type = cc.path.extname(i).toLowerCase().substr(1)), n
  18034. }
  18035. var f = [];
  18036. function d(t, e, i) {
  18037. if (!t || !e) return !1;
  18038. var n = !1;
  18039. if (f.push(e.id), e.deps) {
  18040. var r, s, o = e.deps;
  18041. for (r = 0; r < o.length; r++) {
  18042. if ((s = o[r]).id === t.id) {
  18043. n = !0;
  18044. break
  18045. }
  18046. if (!(f.indexOf(s.id) >= 0) && (s.deps && d(t, s, !0))) {
  18047. n = !0;
  18048. break
  18049. }
  18050. }
  18051. }
  18052. return i || (f.length = 0), n
  18053. }
  18054. var p = function(t, e, i, a) {
  18055. n.call(this), this._id = ++s, o[this._id] = this, this._pipeline = t, this._errorUrls = r.createMap(!0), this._appending = !1, this._ownerQueue = null, this.onProgress = i, this.onComplete = a, this.map = r.createMap(!0), this.completed = {}, this.totalCount = 0, this.completedCount = 0, this._pipeline ? this.active = !0 : this.active = !1, e && (e.length > 0 ? this.append(e) : this.allComplete())
  18056. };
  18057. p.ItemState = new cc.Enum(l), p.create = function(t, e, i, n) {
  18058. void 0 === i ? "function" == typeof e && (n = e, e = i = null) : void 0 === n && ("function" == typeof e ? (n = i, i = e, e = null) : (n = i, i = null));
  18059. var r = a.pop();
  18060. return r ? (r._pipeline = t, r.onProgress = i, r.onComplete = n, o[r._id] = r, r._pipeline && (r.active = !0), e && r.append(e)) : r = new p(t, e, i, n), r
  18061. }, p.getQueue = function(t) {
  18062. return t.queueId ? o[t.queueId] : null
  18063. }, p.itemComplete = function(t) {
  18064. var e = o[t.queueId];
  18065. e && e.itemComplete(t.id)
  18066. }, p.initQueueDeps = function(t) {
  18067. var e = h[t._id];
  18068. e ? (e.completed.length = 0, e.deps.length = 0) : e = h[t._id] = {
  18069. completed: [],
  18070. deps: []
  18071. }
  18072. }, p.registerQueueDep = function(t, e) {
  18073. var i = t.queueId || t;
  18074. if (!i) return !1;
  18075. var n = h[i];
  18076. if (n) - 1 === n.deps.indexOf(e) && n.deps.push(e);
  18077. else if (t.id)
  18078. for (var r in h) {
  18079. var s = h[r]; - 1 !== s.deps.indexOf(t.id) && -1 === s.deps.indexOf(e) && s.deps.push(e)
  18080. }
  18081. }, p.finishDep = function(t) {
  18082. for (var e in h) {
  18083. var i = h[e]; - 1 !== i.deps.indexOf(t) && -1 === i.completed.indexOf(t) && i.completed.push(t)
  18084. }
  18085. };
  18086. var m = p.prototype;
  18087. r.mixin(m, n.prototype), m.append = function(t, e) {
  18088. if (!this.active) return [];
  18089. e && !e.deps && (e.deps = []), this._appending = !0;
  18090. var i, n, r, s = [];
  18091. for (i = 0; i < t.length; ++i)
  18092. if (!(n = t[i]).queueId || this.map[n.id]) {
  18093. if (c(n)) {
  18094. var a = (r = _(n, this._id)).id;
  18095. this.map[a] || (this.map[a] = r, this.totalCount++, e && e.deps.push(r), p.registerQueueDep(e || this._id, a), s.push(r))
  18096. }
  18097. } else {
  18098. if (this.map[n.id] = n, e && e.deps.push(n), n.complete || d(e, n)) {
  18099. this.totalCount++, this.itemComplete(n.id);
  18100. continue
  18101. }
  18102. var l = this,
  18103. h = o[n.queueId];
  18104. h && (this.totalCount++, p.registerQueueDep(e || this._id, n.id), h.addListener(n.id, (function(t) {
  18105. l.itemComplete(t.id)
  18106. })))
  18107. }
  18108. return this._appending = !1, this.completedCount === this.totalCount ? this.allComplete() : this._pipeline.flowIn(s), s
  18109. }, m._childOnProgress = function(t) {
  18110. if (this.onProgress) {
  18111. var e = h[this._id];
  18112. this.onProgress(e ? e.completed.length : this.completedCount, e ? e.deps.length : this.totalCount, t)
  18113. }
  18114. }, m.allComplete = function() {
  18115. var t = r.isEmptyObject(this._errorUrls) ? null : this._errorUrls;
  18116. this.onComplete && this.onComplete(t, this)
  18117. }, m.isCompleted = function() {
  18118. return this.completedCount >= this.totalCount
  18119. }, m.isItemCompleted = function(t) {
  18120. return !!this.completed[t]
  18121. }, m.exists = function(t) {
  18122. return !!this.map[t]
  18123. }, m.getContent = function(t) {
  18124. var e = this.map[t],
  18125. i = null;
  18126. return e && (e.content ? i = e.content : e.alias && (i = e.alias.content)), i
  18127. }, m.getError = function(t) {
  18128. var e = this.map[t],
  18129. i = null;
  18130. return e && (e.error ? i = e.error : e.alias && (i = e.alias.error)), i
  18131. }, m.addListener = n.prototype.on, m.hasListener = n.prototype.hasEventListener, m.removeListener = n.prototype.off, m.removeAllListeners = n.prototype.removeAll, m.removeItem = function(t) {
  18132. var e = this.map[t];
  18133. e && this.completed[e.alias || t] && (delete this.completed[t], delete this.map[t], e.alias && (delete this.completed[e.alias.id], delete this.map[e.alias.id]), this.completedCount--, this.totalCount--)
  18134. }, m.itemComplete = function(t) {
  18135. var e = this.map[t];
  18136. if (e) {
  18137. var i = t in this._errorUrls;
  18138. if (e.error instanceof Error || r.isString(e.error) ? this._errorUrls[t] = e.error : e.error ? r.mixin(this._errorUrls, e.error) : !e.error && i && delete this._errorUrls[t], this.completed[t] = e, this.completedCount++, p.finishDep(e.id), this.onProgress) {
  18139. var n = h[this._id];
  18140. this.onProgress(n ? n.completed.length : this.completedCount, n ? n.deps.length : this.totalCount, e)
  18141. }
  18142. this.emit(t, e), this.removeAll(t), !this._appending && this.completedCount >= this.totalCount && this.allComplete()
  18143. }
  18144. }, m.destroy = function() {
  18145. this.active = !1, this._appending = !1, this._pipeline = null, this._ownerQueue = null, r.clear(this._errorUrls), this.onProgress = null, this.onComplete = null, this.map = r.createMap(!0), this.completed = {}, this.totalCount = 0, this.completedCount = 0, n.call(this), h[this._id] && (h[this._id].completed.length = 0, h[this._id].deps.length = 0), delete o[this._id], delete h[this._id], -1 === a.indexOf(this) && a.length < 10 && a.push(this)
  18146. }, cc.LoadingItems = e.exports = p
  18147. }), {
  18148. "../platform/callbacks-invoker": 211,
  18149. "../platform/js": 218,
  18150. "../utils/CCPath": 289
  18151. }],
  18152. 156: [(function(t, e, i) {
  18153. "use strict";
  18154. var n = t("./pipeline"),
  18155. r = "MD5Pipe",
  18156. s = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/,
  18157. o = function(t, e, i) {
  18158. this.id = r, this.async = !1, this.pipeline = null, this.md5AssetsMap = t, this.md5NativeAssetsMap = e, this.libraryBase = i
  18159. };
  18160. o.ID = r, o.prototype.handle = function(t) {
  18161. return t.url = this.transformURL(t.url), null
  18162. }, o.prototype.transformURL = function(t) {
  18163. var e = !t.startsWith(this.libraryBase) ? this.md5NativeAssetsMap : this.md5AssetsMap;
  18164. return t = t.replace(s, (function(t, i) {
  18165. var n = e[i];
  18166. return n ? t + "." + n : t
  18167. }))
  18168. }, n.MD5Pipe = e.exports = o
  18169. }), {
  18170. "./pipeline": 158
  18171. }],
  18172. 157: [(function(t, e, i) {
  18173. "use strict";
  18174. var n = t("./unpackers"),
  18175. r = t("../utils/misc").pushToMap,
  18176. s = {
  18177. Invalid: 0,
  18178. Removed: 1,
  18179. Downloading: 2,
  18180. Loaded: 3
  18181. };
  18182. function o() {
  18183. this.unpacker = null, this.state = s.Invalid, this.duration = 0
  18184. }
  18185. var a = {},
  18186. l = {},
  18187. h = {},
  18188. c = [],
  18189. u = null;
  18190. function _(t, e) {
  18191. return new Error("Can not retrieve " + t + " from packer " + e)
  18192. }
  18193. e.exports = {
  18194. msToRelease: 12e4,
  18195. initPacks: function(t) {
  18196. for (var e in l = t, a = {}, t)
  18197. for (var i = t[e], n = 0; n < i.length; n++) {
  18198. var s = i[n],
  18199. o = 1 === i.length;
  18200. r(a, s, e, o)
  18201. }
  18202. },
  18203. _loadNewPack: function(t, e, i) {
  18204. var n = this,
  18205. r = cc.AssetLibrary.getLibUrlNoExt(e) + ".json";
  18206. cc.loader.load({
  18207. url: r,
  18208. ignoreMaxConcurrency: !0
  18209. }, (function(s, o) {
  18210. if (s) return cc.errorID(4916, t), i(s);
  18211. h[e].url = r;
  18212. var a = n._doLoadNewPack(t, e, o);
  18213. a ? i(null, a) : i(_(t, e))
  18214. }))
  18215. },
  18216. _doPreload: function(t, e) {
  18217. var i = h[t];
  18218. i || ((i = h[t] = new o).state = s.Downloading), i.state !== s.Loaded && (i.unpacker = new n.JsonUnpacker, i.unpacker.load(l[t], e), i.state = s.Loaded)
  18219. },
  18220. _doLoadNewPack: function(t, e, i) {
  18221. var r = h[e];
  18222. if (r.state !== s.Loaded) {
  18223. "string" == typeof i && (i = JSON.parse(i)), Array.isArray(i) ? r.unpacker = new n.JsonUnpacker : i.type === n.TextureUnpacker.ID && (r.unpacker = new n.TextureUnpacker), r.unpacker.load(l[e], i), r.state = s.Loaded, r.duration = 0, c.push(e);
  18224. var o = this;
  18225. u || (u = setInterval((function() {
  18226. for (var t = o.msToRelease / 5e3, e = c.length - 1; e >= 0; e--) {
  18227. var i = c[e];
  18228. ++h[i].duration > t && o.release(i)
  18229. }
  18230. 0 === c.length && (clearInterval(u), u = null)
  18231. }), 5e3))
  18232. }
  18233. return r.unpacker.retrieve(t)
  18234. },
  18235. _selectLoadedPack: function(t) {
  18236. for (var e = s.Invalid, i = "", n = 0; n < t.length; n++) {
  18237. var r = t[n],
  18238. o = h[r];
  18239. if (o) {
  18240. var a = o.state;
  18241. if (a === s.Loaded) return r;
  18242. a > e && (e = a, i = r)
  18243. }
  18244. }
  18245. return e !== s.Invalid ? i : t[0]
  18246. },
  18247. load: function(t, e) {
  18248. var i = t.uuid,
  18249. n = a[i];
  18250. if (n) {
  18251. Array.isArray(n) && (n = this._selectLoadedPack(n));
  18252. var r = h[n];
  18253. if (r && r.state === s.Loaded) {
  18254. r.duration = 0;
  18255. var l = r.unpacker.retrieve(i);
  18256. return l || _(i, n)
  18257. }
  18258. return r || (console.log("Create unpacker %s for %s", n, i), (r = h[n] = new o).state = s.Downloading), this._loadNewPack(i, n, e), null
  18259. }
  18260. },
  18261. release: function(t) {
  18262. var e = h[t];
  18263. e && (cc.loader.release(e.url), delete h[t], cc.js.array.fastRemove(c, t))
  18264. }
  18265. }
  18266. }), {
  18267. "../utils/misc": 300,
  18268. "./unpackers": 162
  18269. }],
  18270. 158: [(function(t, e, i) {
  18271. "use strict";
  18272. var n = t("../platform/js"),
  18273. r = t("./loading-items"),
  18274. s = r.ItemState;
  18275. function o(t, e) {
  18276. var i = t.id,
  18277. n = e.states[i],
  18278. r = t.next,
  18279. a = t.pipeline;
  18280. if (!e.error && n !== s.WORKING && n !== s.ERROR)
  18281. if (n === s.COMPLETE) r ? o(r, e) : a.flowOut(e);
  18282. else {
  18283. e.states[i] = s.WORKING;
  18284. var l = t.handle(e, (function(t, n) {
  18285. t ? (e.error = t, e.states[i] = s.ERROR, a.flowOut(e)) : (n && (e.content = n), e.states[i] = s.COMPLETE, r ? o(r, e) : a.flowOut(e))
  18286. }));
  18287. l instanceof Error ? (e.error = l, e.states[i] = s.ERROR, a.flowOut(e)) : void 0 !== l && (null !== l && (e.content = l), e.states[i] = s.COMPLETE, r ? o(r, e) : a.flowOut(e))
  18288. }
  18289. }
  18290. var a = function(t) {
  18291. this._pipes = t, this._cache = n.createMap(!0);
  18292. for (var e = 0; e < t.length; ++e) {
  18293. var i = t[e];
  18294. i.handle && i.id && (i.pipeline = this, i.next = e < t.length - 1 ? t[e + 1] : null)
  18295. }
  18296. };
  18297. a.ItemState = s;
  18298. var l = a.prototype;
  18299. l.insertPipe = function(t, e) {
  18300. if (!t.handle || !t.id || e > this._pipes.length) cc.warnID(4921);
  18301. else if (this._pipes.indexOf(t) > 0) cc.warnID(4922);
  18302. else {
  18303. t.pipeline = this;
  18304. var i = null;
  18305. e < this._pipes.length && (i = this._pipes[e]);
  18306. var n = null;
  18307. e > 0 && (n = this._pipes[e - 1]), n && (n.next = t), t.next = i, this._pipes.splice(e, 0, t)
  18308. }
  18309. }, l.insertPipeAfter = function(t, e) {
  18310. var i = this._pipes.indexOf(t);
  18311. i < 0 || this.insertPipe(e, i + 1)
  18312. }, l.appendPipe = function(t) {
  18313. t.handle && t.id && (t.pipeline = this, t.next = null, this._pipes.length > 0 && (this._pipes[this._pipes.length - 1].next = t), this._pipes.push(t))
  18314. }, l.flowIn = function(t) {
  18315. var e, i, n = this._pipes[0];
  18316. if (n) {
  18317. for (e = 0; e < t.length; e++) i = t[e], this._cache[i.id] = i;
  18318. for (e = 0; e < t.length; e++) o(n, i = t[e])
  18319. } else
  18320. for (e = 0; e < t.length; e++) this.flowOut(t[e])
  18321. }, l.flowInDeps = function(t, e, i) {
  18322. return r.create(this, (function(t, e) {
  18323. i(t, e), e.destroy()
  18324. })).append(e, t)
  18325. }, l.flowOut = function(t) {
  18326. t.error ? delete this._cache[t.id] : this._cache[t.id] || (this._cache[t.id] = t), t.complete = !0, r.itemComplete(t)
  18327. }, l.copyItemStates = function(t, e) {
  18328. if (e instanceof Array)
  18329. for (var i = 0; i < e.length; ++i) e[i].states = t.states;
  18330. else e.states = t.states
  18331. }, l.getItem = function(t) {
  18332. var e = this._cache[t];
  18333. return e ? (e.alias && (e = e.alias), e) : e
  18334. }, l.removeItem = function(t) {
  18335. var e = this._cache[t];
  18336. return e && e.complete && delete this._cache[t], e
  18337. }, l.clear = function() {
  18338. for (var t in this._cache) {
  18339. var e = this._cache[t];
  18340. delete this._cache[t], e.complete || (e.error = new Error("Canceled manually"), this.flowOut(e))
  18341. }
  18342. }, cc.Pipeline = e.exports = a
  18343. }), {
  18344. "../platform/js": 218,
  18345. "./loading-items": 155
  18346. }],
  18347. 159: [(function(t, e, i) {
  18348. "use strict"
  18349. }), {
  18350. "../platform/js": 218
  18351. }],
  18352. 160: [(function(t, e, i) {
  18353. "use strict";
  18354. var n = t("./pipeline"),
  18355. r = "SubPackPipe",
  18356. s = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/;
  18357. function o(t) {
  18358. var e = t.match(s);
  18359. return e ? e[1] : ""
  18360. }
  18361. var a = Object.create(null),
  18362. l = function(t) {
  18363. for (var e in this.id = r, this.async = !1, this.pipeline = null, t) {
  18364. var i = t[e];
  18365. i.uuids && i.uuids.forEach((function(t) {
  18366. a[t] = i.path
  18367. }))
  18368. }
  18369. };
  18370. l.ID = r, l.prototype.handle = function(t) {
  18371. return t.url = this.transformURL(t.url), null
  18372. }, l.prototype.transformURL = function(t) {
  18373. var e = o(t);
  18374. if (e) {
  18375. var i = a[e];
  18376. if (i) return t.replace("res/raw-assets/", i + "raw-assets/")
  18377. }
  18378. return t
  18379. }, n.SubPackPipe = e.exports = l
  18380. }), {
  18381. "./pipeline": 158
  18382. }],
  18383. 161: [(function(t, e, i) {
  18384. "use strict";
  18385. var n = t("./utils").urlAppendTimestamp;
  18386. e.exports = function(t, e) {
  18387. var i = t.url;
  18388. i = n(i);
  18389. var r = cc.loader.getXMLHttpRequest(),
  18390. s = "Load text file failed: " + i;
  18391. r.open("GET", i, !0), r.overrideMimeType && r.overrideMimeType("text/plain; charset=utf-8"), r.onload = function() {
  18392. 4 === r.readyState ? 200 === r.status || 0 === r.status ? e(null, r.responseText) : e({
  18393. status: r.status,
  18394. errorMessage: s + "(wrong status)"
  18395. }) : e({
  18396. status: r.status,
  18397. errorMessage: s + "(wrong readyState)"
  18398. })
  18399. }, r.onerror = function() {
  18400. e({
  18401. status: r.status,
  18402. errorMessage: s + "(error)"
  18403. })
  18404. }, r.ontimeout = function() {
  18405. e({
  18406. status: r.status,
  18407. errorMessage: s + "(time out)"
  18408. })
  18409. }, r.send(null)
  18410. }
  18411. }), {
  18412. "./utils": 163
  18413. }],
  18414. 162: [(function(t, e, i) {
  18415. "use strict";
  18416. var n = t("../assets/CCTexture2D"),
  18417. r = t("../platform/js");
  18418. function s() {
  18419. this.jsons = {}
  18420. }
  18421. function o() {
  18422. this.contents = {}
  18423. }
  18424. s.prototype.load = function(t, e) {
  18425. e.length !== t.length && cc.errorID(4915);
  18426. for (var i = 0; i < t.length; i++) {
  18427. var n = t[i],
  18428. r = e[i];
  18429. this.jsons[n] = r
  18430. }
  18431. }, s.prototype.retrieve = function(t) {
  18432. return this.jsons[t] || null
  18433. }, o.ID = r._getClassId(n), o.prototype.load = function(t, e) {
  18434. var i = e.data.split("|");
  18435. i.length !== t.length && cc.errorID(4915);
  18436. for (var n = 0; n < t.length; n++) this.contents[t[n]] = i[n]
  18437. }, o.prototype.retrieve = function(t) {
  18438. var e = this.contents[t];
  18439. return e ? {
  18440. __type__: o.ID,
  18441. content: e
  18442. } : null
  18443. }, e.exports = {
  18444. JsonUnpacker: s,
  18445. TextureUnpacker: o
  18446. }
  18447. }), {
  18448. "../assets/CCTexture2D": 73,
  18449. "../platform/js": 218
  18450. }],
  18451. 163: [(function(t, e, i) {
  18452. "use strict";
  18453. var n = /\?/;
  18454. e.exports = {
  18455. urlAppendTimestamp: function(t) {
  18456. return cc.game.config.noCache && "string" == typeof t && (n.test(t) ? t += "&_t=" + (new Date - 0) : t += "?_t=" + (new Date - 0)), t
  18457. }
  18458. }
  18459. }), {}],
  18460. 164: [(function(t, e, i) {
  18461. "use strict";
  18462. var n = t("../platform/js"),
  18463. r = t("../CCDebug");
  18464. t("../platform/deserialize");
  18465. var s = t("./loading-items");
  18466. function o(t) {
  18467. return t && (t[0] && "cc.Scene" === t[0].__type__ || t[1] && "cc.Scene" === t[1].__type__ || t[0] && "cc.Prefab" === t[0].__type__)
  18468. }
  18469. function a(t, e, i, n) {
  18470. var r, s, o, a = i.uuidList,
  18471. l = i.uuidObjList,
  18472. h = i.uuidPropList,
  18473. c = i._stillUseUrl,
  18474. u = t.dependKeys = [];
  18475. if (n)
  18476. for (r = [], s = 0; s < a.length; s++) {
  18477. o = a[s];
  18478. var _ = l[s],
  18479. f = h[s],
  18480. d = cc.AssetLibrary._getAssetInfoInRuntime(o);
  18481. if (d.raw) {
  18482. var p = d.url;
  18483. _[f] = p, u.push(p)
  18484. } else r.push({
  18485. type: "uuid",
  18486. uuid: o,
  18487. deferredLoadRaw: !0,
  18488. _owner: _,
  18489. _ownerProp: f,
  18490. _stillUseUrl: c[s]
  18491. })
  18492. } else {
  18493. for (r = new Array(a.length), s = 0; s < a.length; s++) o = a[s], r[s] = {
  18494. type: "uuid",
  18495. uuid: o,
  18496. _owner: l[s],
  18497. _ownerProp: h[s],
  18498. _stillUseUrl: c[s]
  18499. };
  18500. e._native && !e.constructor.preventPreloadNativeObject && r.push({
  18501. url: e.nativeUrl,
  18502. _owner: e,
  18503. _ownerProp: "_nativeAsset"
  18504. })
  18505. }
  18506. return r
  18507. }
  18508. function l(t, e, i, n, r) {
  18509. e.content = i;
  18510. var o = e.dependKeys;
  18511. t.flowInDeps(e, n, (function(t, e) {
  18512. var a, l = e.map;
  18513. for (var h in l)(a = l[h]).uuid && a.content && (a.content._uuid = a.uuid);
  18514. function c(t) {
  18515. var e = t.content;
  18516. this._stillUseUrl && (e = e && cc.RawAsset.wasRawAssetType(e.constructor) ? e.nativeUrl : t.rawUrl), "_nativeAsset" === this._ownerProp && (this._owner.url = t.url), this._owner[this._ownerProp] = e, t.uuid !== i._uuid && o.indexOf(t.id) < 0 && o.push(t.id)
  18517. }
  18518. for (var u = 0; u < n.length; u++) {
  18519. var _ = n[u],
  18520. f = _.uuid,
  18521. d = _.url;
  18522. _._owner, _._ownerProp;
  18523. if (a = l[d]) {
  18524. var p = _;
  18525. if (a.complete || a.content) {
  18526. if (a.error) cc._throw(a.error.message || a.error.errorMessage || a.error);
  18527. else c.call(p, a)
  18528. } else {
  18529. var m = s.getQueue(a),
  18530. y = m._callbackTable[f];
  18531. y ? y.unshift(c, p) : m.addListener(f, c, p)
  18532. }
  18533. }
  18534. }
  18535. if (!t && i.onLoad) try {
  18536. i.onLoad()
  18537. } catch (t) {
  18538. cc._throw(t)
  18539. }
  18540. r(t, i)
  18541. }))
  18542. }
  18543. function h(t, e, i) {
  18544. var n = e.deferredLoadRaw;
  18545. return n ? t instanceof cc.Asset && t.constructor.preventDeferredLoadDependents && (n = !1) : i && (t instanceof cc.SceneAsset || t instanceof cc.Prefab) && (n = t.asyncLoadAssets), n
  18546. }
  18547. function c(t, e) {
  18548. var i, s;
  18549. if ("string" == typeof t.content) try {
  18550. i = JSON.parse(t.content)
  18551. } catch (e) {
  18552. return new Error(r.getError(4923, t.id, e.stack))
  18553. } else {
  18554. if ("object" != typeof t.content) return new Error(r.getError(4924));
  18555. i = t.content
  18556. }
  18557. var c = o(i);
  18558. s = c ? cc._MissingScript.safeFindClass : function(t) {
  18559. var e = n._getClassById(t);
  18560. return e || (cc.warnID(4903, t), Object)
  18561. };
  18562. var u, _ = cc.deserialize.Details.pool.get();
  18563. try {
  18564. u = cc.deserialize(i, _, {
  18565. classFinder: s,
  18566. target: t.existingAsset,
  18567. customEnv: t
  18568. })
  18569. } catch (e) {
  18570. cc.deserialize.Details.pool.put(_);
  18571. var f = e.stack;
  18572. return new Error(r.getError(4925, t.id, f))
  18573. }
  18574. u._uuid = t.uuid, u.url = u.nativeUrl;
  18575. var d = a(t, u, _, h(u, t, c));
  18576. if (cc.deserialize.Details.pool.put(_), 0 === d.length) return u.onLoad && u.onLoad(), e(null, u);
  18577. l(this.pipeline, t, u, d, e)
  18578. }
  18579. e.exports = c, c.isSceneObj = o
  18580. }), {
  18581. "../CCDebug": 49,
  18582. "../platform/deserialize": 213,
  18583. "../platform/js": 218,
  18584. "./loading-items": 155
  18585. }],
  18586. 165: [(function(t, e, i) {
  18587. "use strict";
  18588. var n = o(t("../../renderer/core/input-assembler")),
  18589. r = o(t("../../renderer/gfx")),
  18590. s = t("./mesh-data");
  18591. function o(t) {
  18592. return t && t.__esModule ? t : {
  18593. default: t
  18594. }
  18595. }
  18596. var a = t("../renderer"),
  18597. l = t("../event/event-target");
  18598. function h(t, e, i) {
  18599. t[e] = i._val
  18600. }
  18601. function c(t, e, i) {
  18602. t[e] = i.x, t[e + 1] = i.y
  18603. }
  18604. function u(t, e, i) {
  18605. t[e] = i.x, t[e + 1] = i.y, t[e + 2] = i.z
  18606. }
  18607. var _ = cc.Class({
  18608. name: "cc.Mesh",
  18609. extends: cc.Asset,
  18610. mixins: [l],
  18611. properties: {
  18612. _nativeAsset: {
  18613. override: !0,
  18614. get: function() {
  18615. return this._buffer
  18616. },
  18617. set: function(t) {
  18618. this._buffer = ArrayBuffer.isView(t) ? t.buffer : t, this.initWithBuffer()
  18619. }
  18620. },
  18621. _vertexBundles: {
  18622. default: null,
  18623. type: s.VertexBundle
  18624. },
  18625. _primitives: {
  18626. default: null,
  18627. Primitive: s.Primitive
  18628. },
  18629. _minPos: cc.v3(),
  18630. _maxPos: cc.v3(),
  18631. subMeshes: {
  18632. get: function() {
  18633. return this._subMeshes
  18634. },
  18635. set: function(t) {
  18636. this._subMeshes = t
  18637. }
  18638. },
  18639. subDatas: {
  18640. get: function() {
  18641. return this._subDatas
  18642. }
  18643. }
  18644. },
  18645. ctor: function() {
  18646. this._subMeshes = [], this.loaded = !1, this._subDatas = []
  18647. },
  18648. initWithBuffer: function() {
  18649. this._subMeshes.length = 0;
  18650. for (var t = this._primitives, e = 0; e < t.length; e++) {
  18651. var i = t[e],
  18652. o = i.data,
  18653. l = new Uint8Array(this._buffer, o.offset, o.length),
  18654. h = this._vertexBundles[i.vertexBundleIndices[0]],
  18655. c = h.data,
  18656. u = new r.default.VertexFormat(h.formats),
  18657. _ = new Uint8Array(this._buffer, c.offset, c.length),
  18658. f = this._canVertexFormatBatch(u),
  18659. d = new s.MeshData;
  18660. d.vData = _, d.iData = l, d.vfm = u, d.offset = c.offset, d.canBatch = f, this._subDatas.push(d);
  18661. var p = new r.default.VertexBuffer(a.device, u, r.default.USAGE_STATIC, _),
  18662. m = new r.default.IndexBuffer(a.device, i.indexUnit, r.default.USAGE_STATIC, l);
  18663. this._subMeshes.push(new n.default(p, m))
  18664. }
  18665. this.loaded = !0, this.emit("load")
  18666. },
  18667. _canVertexFormatBatch: function(t) {
  18668. var e = t._attr2el[r.default.ATTR_POSITION];
  18669. return !e || e.type === r.default.ATTR_TYPE_FLOAT32 && t._bytes % 4 == 0
  18670. },
  18671. init: function(t, e) {
  18672. var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
  18673. o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
  18674. l = new Uint8Array(t._bytes * e),
  18675. h = new s.MeshData;
  18676. h.vData = l, h.vfm = t, h.vDirty = !0, h.canBatch = this._canVertexFormatBatch(t);
  18677. var c = new r.default.VertexBuffer(a.device, t, i ? r.default.USAGE_DYNAMIC : r.default.USAGE_STATIC, l);
  18678. h.vb = c, this._subMeshes[o] = new n.default(h.vb);
  18679. var u = this._subDatas[o];
  18680. u && (u.vb && u.vb.destroy(), u.ib && u.ib.destroy()), this._subDatas[o] = h, this.loaded = !0, this.emit("load"), this.emit("init-format")
  18681. },
  18682. setVertices: function(t, e, i) {
  18683. i = i || 0;
  18684. var n = this._subDatas[i],
  18685. s = n.vfm.element(t);
  18686. if (!s) return cc.warn("Cannot find " + t + " attribute in vertex defines.");
  18687. var o = "number" == typeof e[0],
  18688. a = s.num,
  18689. l = o ? e.length / a | 0 : e.length;
  18690. n.vData.byteLength < l * s.stride && (n.vData = new Uint8Array(l * n.vfm._bytes));
  18691. var _ = void 0,
  18692. f = 4;
  18693. t === r.default.ATTR_COLOR ? o ? (_ = n.getVData(), f = 1) : _ = n.getVData(Uint32Array) : _ = n.getVData(Float32Array);
  18694. var d = s.stride / f,
  18695. p = s.offset / f;
  18696. if (o)
  18697. for (var m = 0, y = e.length / a; m < y; m++)
  18698. for (var v = m * a, g = m * d + p, x = 0; x < a; x++) _[g + x] = e[v + x];
  18699. else {
  18700. var b = void 0;
  18701. b = t === r.default.ATTR_COLOR ? h : 2 === a ? c : u;
  18702. for (var A = 0, C = e.length; A < C; A++) {
  18703. b(_, A * d + p, e[A])
  18704. }
  18705. }
  18706. n.vDirty = !0
  18707. },
  18708. setIndices: function(t, e, i) {
  18709. e = e || 0;
  18710. var n = t;
  18711. t instanceof Uint16Array ? n = new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : Array.isArray(t) && (n = new Uint16Array(t), n = new Uint8Array(n.buffer, n.byteOffset, n.byteLength));
  18712. var s = i ? r.default.USAGE_DYNAMIC : r.default.USAGE_STATIC,
  18713. o = this._subDatas[e];
  18714. if (o.ib) o.iData = n, o.iDirty = !0;
  18715. else {
  18716. o.iData = n;
  18717. var l = new r.default.IndexBuffer(a.device, r.default.INDEX_FMT_UINT16, s, n, n.byteLength / r.default.IndexBuffer.BYTES_PER_INDEX[r.default.INDEX_FMT_UINT16]);
  18718. o.ib = l, this._subMeshes[e]._indexBuffer = o.ib
  18719. }
  18720. },
  18721. setPrimitiveType: function(t, e) {
  18722. e = e || 0, this._subMeshes[e] ? this._subMeshes[e]._primitiveType = t : cc.warn("Do not have sub mesh at index " + e)
  18723. },
  18724. clear: function() {
  18725. this._subMeshes.length = 0;
  18726. for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) {
  18727. var n = t[e].vb;
  18728. n && n.destroy();
  18729. var r = t[e].ib;
  18730. r && r.destroy()
  18731. }
  18732. t.length = 0
  18733. },
  18734. setBoundingBox: function(t, e) {
  18735. this._minPos = t, this._maxPos = e
  18736. },
  18737. destroy: function() {
  18738. this.clear()
  18739. },
  18740. _uploadData: function() {
  18741. for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) {
  18742. var n = t[e];
  18743. if (n.vDirty) {
  18744. var r = n.vb,
  18745. s = n.vData;
  18746. r.update(0, s), n.vDirty = !1
  18747. }
  18748. if (n.iDirty) {
  18749. var o = n.ib,
  18750. a = n.iData;
  18751. o.update(0, a), n.iDirty = !1
  18752. }
  18753. }
  18754. }
  18755. });
  18756. cc.Mesh = e.exports = _
  18757. }), {
  18758. "../../renderer/core/input-assembler": 350,
  18759. "../../renderer/gfx": 360,
  18760. "../event/event-target": 131,
  18761. "../renderer": 247,
  18762. "./mesh-data": 168
  18763. }],
  18764. 166: [(function(t, e, i) {
  18765. "use strict";
  18766. var n = a(t("../../renderer/gfx")),
  18767. r = a(t("../../renderer/core/input-assembler")),
  18768. s = a(t("../geom-utils")),
  18769. o = (a(t("../assets/material/custom-properties")), t("../utils/mesh-util"));
  18770. function a(t) {
  18771. return t && t.__esModule ? t : {
  18772. default: t
  18773. }
  18774. }
  18775. var l = t("../components/CCRenderComponent"),
  18776. h = t("./CCMesh"),
  18777. c = t("../renderer/render-flow"),
  18778. u = t("../renderer"),
  18779. _ = t("../assets/material/CCMaterial"),
  18780. f = cc.Color.BLACK,
  18781. d = cc.Enum({
  18782. OFF: 0,
  18783. ON: 1
  18784. }),
  18785. p = cc.Class({
  18786. name: "cc.MeshRenderer",
  18787. extends: l,
  18788. editor: !1,
  18789. properties: {
  18790. _mesh: {
  18791. default: null,
  18792. type: h
  18793. },
  18794. _receiveShadows: !1,
  18795. _shadowCastingMode: d.OFF,
  18796. _enableAutoBatch: !1,
  18797. mesh: {
  18798. get: function() {
  18799. return this._mesh
  18800. },
  18801. set: function(t) {
  18802. this._mesh !== t && (this._setMesh(t), t ? (this.markForRender(!0), this._activateMaterial(!0), this.markForUpdateRenderData(!0), this.node._renderFlag |= c.FLAG_TRANSFORM) : this.markForRender(!1))
  18803. },
  18804. type: h,
  18805. animatable: !1
  18806. },
  18807. textures: {
  18808. default: [],
  18809. type: cc.Texture2D,
  18810. visible: !1
  18811. },
  18812. receiveShadows: {
  18813. get: function() {
  18814. return this._receiveShadows
  18815. },
  18816. set: function(t) {
  18817. this._receiveShadows = t, this._updateReceiveShadow()
  18818. },
  18819. animatable: !1
  18820. },
  18821. shadowCastingMode: {
  18822. get: function() {
  18823. return this._shadowCastingMode
  18824. },
  18825. set: function(t) {
  18826. this._shadowCastingMode = t, this._updateCastShadow()
  18827. },
  18828. type: d,
  18829. animatable: !1
  18830. },
  18831. enableAutoBatch: {
  18832. get: function() {
  18833. return this._enableAutoBatch
  18834. },
  18835. set: function(t) {
  18836. this._enableAutoBatch = t
  18837. }
  18838. }
  18839. },
  18840. statics: {
  18841. ShadowCastingMode: d
  18842. },
  18843. ctor: function() {
  18844. this._wireFrameDatas = [], this._boundingBox = null, this._customProperties = new cc.CustomProperties
  18845. },
  18846. onEnable: function() {
  18847. if (this._super(), this._mesh && !this._mesh.loaded) {
  18848. this.disableRender();
  18849. var t = this;
  18850. this._mesh.once("load", (function() {
  18851. t._setMesh(t._mesh), t._activateMaterial()
  18852. })), (0, o.postLoadMesh)(this._mesh)
  18853. } else this._setMesh(this._mesh), this._activateMaterial();
  18854. this._updateRenderNode()
  18855. },
  18856. onDestroy: function() {
  18857. this._setMesh(null), cc.pool.assembler.put(this._assembler)
  18858. },
  18859. _updateRenderNode: function() {
  18860. this._assembler.setRenderNode(this.node)
  18861. },
  18862. _setMesh: function(t) {
  18863. this._mesh && this._mesh.off("init-format", this._updateMeshAttribute, this), t && t.on("init-format", this._updateMeshAttribute, this), this._mesh = t
  18864. },
  18865. _getDefaultMaterial: function() {
  18866. return _.getBuiltinMaterial("unlit")
  18867. },
  18868. _activateMaterial: function(t) {
  18869. var e = this._mesh;
  18870. if (e && 0 !== e._subDatas.length) {
  18871. s.default && (this._boundingBox = s.default.Aabb.fromPoints(s.default.Aabb.create(), e._minPos, e._maxPos));
  18872. var i = this.textures;
  18873. if (i && i.length > 0)
  18874. for (var n = 0; n < i.length; n++) {
  18875. var r = this.sharedMaterials[n];
  18876. r || ((r = cc.Material.getInstantiatedMaterial(this._getDefaultMaterial(), this)).setProperty("diffuseTexture", i[n]), this.setMaterial(n, r))
  18877. }
  18878. var o = this.sharedMaterials;
  18879. if (!o[0]) {
  18880. var a = this._getDefaultMaterial();
  18881. o[0] = a
  18882. }
  18883. this._updateReceiveShadow(), this._updateCastShadow(), this._updateMeshAttribute(), this.markForUpdateRenderData(!0), this.markForRender(!0)
  18884. } else this.disableRender()
  18885. },
  18886. _updateReceiveShadow: function() {
  18887. this._customProperties.define("CC_USE_SHADOW_MAP", this._receiveShadows)
  18888. },
  18889. _updateCastShadow: function() {
  18890. this._customProperties.define("CC_SHADOW_CASTING", this._shadowCastingMode === d.ON)
  18891. },
  18892. _updateMeshAttribute: function() {
  18893. var t = this._mesh && this._mesh.subDatas;
  18894. if (t) {
  18895. var e = t[0].vfm;
  18896. this._customProperties.define("CC_USE_ATTRIBUTE_COLOR", !!e.element(n.default.ATTR_COLOR)), this._customProperties.define("CC_USE_ATTRIBUTE_UV0", !!e.element(n.default.ATTR_UV0)), this._customProperties.define("CC_USE_ATTRIBUTE_NORMAL", !!e.element(n.default.ATTR_NORMAL)), this._customProperties.define("CC_USE_ATTRIBUTE_TANGENT", !!e.element(n.default.ATTR_TANGENT)), this._wireFrameDatas.length = 0
  18897. }
  18898. },
  18899. _updateWireFrameDatas: function() {
  18900. var t = this._wireFrameDatas,
  18901. e = this._mesh.subMeshes;
  18902. if (e.length !== t.length) {
  18903. t.length = e.length;
  18904. for (var i = this._mesh._subDatas, n = 0; n < e.length; n++) t[n] = this._createWireFrameData(e[n], i[n].iData)
  18905. }
  18906. },
  18907. _createWireFrameData: function(t, e) {
  18908. var i = new _;
  18909. i.copy(_.getBuiltinMaterial("unlit")), i.setProperty("diffuseColor", f);
  18910. for (var s = [], o = 0; o < e.length; o += 3) {
  18911. var a = e[o + 0],
  18912. l = e[o + 1],
  18913. h = e[o + 2];
  18914. s.push(a, l, l, h, h, a)
  18915. }
  18916. var c = new Uint16Array(s),
  18917. d = new n.default.IndexBuffer(u.device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, c, c.length);
  18918. return {
  18919. material: i,
  18920. ia: new r.default(t._vertexBuffer, d, n.default.PT_LINES)
  18921. }
  18922. },
  18923. _checkBacth: function() {}
  18924. });
  18925. cc.MeshRenderer = e.exports = p
  18926. }), {
  18927. "../../renderer/core/input-assembler": 350,
  18928. "../../renderer/gfx": 360,
  18929. "../assets/material/CCMaterial": 75,
  18930. "../assets/material/custom-properties": 76,
  18931. "../components/CCRenderComponent": 106,
  18932. "../geom-utils": 136,
  18933. "../renderer": 247,
  18934. "../renderer/render-flow": 248,
  18935. "../utils/mesh-util": 299,
  18936. "./CCMesh": 165
  18937. }],
  18938. 167: [(function(t, e, i) {
  18939. "use strict";
  18940. t("./CCMesh"), t("./CCMeshRenderer"), t("./mesh-renderer")
  18941. }), {
  18942. "./CCMesh": 165,
  18943. "./CCMeshRenderer": 166,
  18944. "./mesh-renderer": 169
  18945. }],
  18946. 168: [(function(t, e, i) {
  18947. "use strict";
  18948. i.__esModule = !0, i.Primitive = i.VertexBundle = i.VertexFormat = i.BufferRange = void 0, i.MeshData = o;
  18949. var n = (function(t) {
  18950. return t && t.__esModule ? t : {
  18951. default: t
  18952. }
  18953. })(t("../../renderer/gfx"));
  18954. var r = i.BufferRange = cc.Class({
  18955. name: "cc.BufferRange",
  18956. properties: {
  18957. offset: 0,
  18958. length: 0
  18959. }
  18960. }),
  18961. s = i.VertexFormat = cc.Class({
  18962. name: "cc.mesh.VertexFormat",
  18963. properties: {
  18964. name: "",
  18965. type: -1,
  18966. num: -1,
  18967. normalize: !1
  18968. }
  18969. });
  18970. i.VertexBundle = cc.Class({
  18971. name: "cc.mesh.VertexBundle",
  18972. properties: {
  18973. data: {
  18974. default: null,
  18975. type: r
  18976. },
  18977. formats: {
  18978. default: [],
  18979. type: s
  18980. },
  18981. verticesCount: 0
  18982. }
  18983. }), i.Primitive = cc.Class({
  18984. name: "cc.mesh.Primitive",
  18985. properties: {
  18986. vertexBundleIndices: {
  18987. default: [],
  18988. type: cc.Float
  18989. },
  18990. data: {
  18991. default: null,
  18992. type: r
  18993. },
  18994. indexUnit: n.default.INDEX_FMT_UINT16,
  18995. topology: n.default.PT_TRIANGLES
  18996. }
  18997. });
  18998. function o() {
  18999. this.vData = null, this.float32VData = null, this.uint32VData = null, this.iData = null, this.uint16IData = null, this.vfm = null, this.offset = 0, this.vb = null, this.ib = null, this.vDirty = !1, this.iDirty = !1
  19000. }
  19001. o.prototype.getVData = function(t) {
  19002. return t === Float32Array ? (this.float32VData || (this.float32VData = new Float32Array(this.vData.buffer, this.vData.byteOffset, this.vData.byteLength / 4)), this.float32VData) : t === Uint32Array ? (this.uint32VData || (this.uint32VData = new Uint32Array(this.vData.buffer, this.vData.byteOffset, this.vData.byteLength / 4)), this.uint32VData) : this.vData
  19003. }, o.prototype.getIData = function(t) {
  19004. return t === Uint16Array ? (this.uint16IData || (this.uint16IData = new Uint16Array(this.iData.buffer, this.iData.byteOffset, this.iData.byteLength / 2)), this.uint16IData) : this.iData
  19005. }
  19006. }), {
  19007. "../../renderer/gfx": 360
  19008. }],
  19009. 169: [(function(t, e, i) {
  19010. "use strict";
  19011. i.__esModule = !0, i.default = void 0;
  19012. var n = o(t("../renderer/assembler")),
  19013. r = o(t("../../renderer/gfx")),
  19014. s = o(t("../vmath/vec3"));
  19015. function o(t) {
  19016. return t && t.__esModule ? t : {
  19017. default: t
  19018. }
  19019. }
  19020. function a(t, e) {
  19021. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  19022. }
  19023. function l(t, e) {
  19024. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  19025. return !e || "object" != typeof e && "function" != typeof e ? t : e
  19026. }
  19027. function h(t, e) {
  19028. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  19029. t.prototype = Object.create(e && e.prototype, {
  19030. constructor: {
  19031. value: t,
  19032. enumerable: !1,
  19033. writable: !0,
  19034. configurable: !0
  19035. }
  19036. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  19037. }
  19038. var c = t("./CCMeshRenderer"),
  19039. u = (function(t) {
  19040. function e(i) {
  19041. a(this, e);
  19042. var n = l(this, t.call(this, i));
  19043. return n._renderNode = null, n
  19044. }
  19045. return h(e, t), e.prototype.setRenderNode = function(t) {
  19046. this._renderNode = t
  19047. }, e.prototype.fillBuffers = function(t, e) {
  19048. if (t.mesh) {
  19049. t.mesh._uploadData();
  19050. for (var i = e.customProperties && e.customProperties.getHash() === t._customProperties.getHash(), n = e.cullingMask === t.node._cullingMask, s = t.enableAutoBatch, o = t.sharedMaterials, a = t.mesh._subMeshes, l = t.mesh.subDatas, h = 0; h < a.length; h++) {
  19051. var c = a[h],
  19052. u = l[h],
  19053. _ = o[h] || o[0];
  19054. s && u.canBatch && c._primitiveType === r.default.PT_TRIANGLES ? (i && n && _.getHash() === e.material.getHash() || (e._flush(), e.material = _, e.cullingMask = t.node._cullingMask, e.customProperties = t._customProperties, e.node = e._dummyNode), this._fillBuffer(t, u, e)) : (e._flush(), e.material = _, e.cullingMask = t.node._cullingMask, e.customProperties = t._customProperties, e.node = this._renderNode, e._flushIA(c))
  19055. }
  19056. cc.macro.SHOW_MESH_WIREFRAME && this._drawWireFrames(t, e)
  19057. }
  19058. }, e.prototype._fillBuffer = function(t, e, i) {
  19059. for (var n = t.node._worldMatrix, o = e.getVData(Float32Array), a = e.vfm, l = a._attr2el[r.default.ATTR_POSITION].offset / 4, h = a._bytes / 4, c = o.length / h | 0, u = e.getIData(Uint16Array), _ = u.length, f = i.getBuffer("mesh", a), d = f.request(c, _), p = d.indiceOffset, m = d.byteOffset >> 2, y = d.vertexOffset, v = f._vData, g = f._iData, x = cc.v3(), b = 0; b < c; b++) {
  19060. for (var A = b * h, C = 0; C < l; C++) v[m++] = o[A + C];
  19061. x.x = o[A + l], x.y = o[A + l + 1], x.z = o[A + l + 2], s.default.transformMat4(x, x, n), v[m++] = x.x, v[m++] = x.y, v[m++] = x.z;
  19062. for (var T = l + 3; T < h; T++) v[m++] = o[A + T]
  19063. }
  19064. for (var S = 0; S < _; S++) g[p + S] = y + u[S]
  19065. }, e.prototype._drawWireFrames = function(t, e) {
  19066. e._flush(), t._updateWireFrameDatas(), e.node = this._renderNode;
  19067. for (var i = t._wireFrameDatas, n = 0; n < i.length; n++) {
  19068. var r = i[n],
  19069. s = r.material;
  19070. e.material = s, e._flushIA(r.ia)
  19071. }
  19072. }, e
  19073. })(n.default);
  19074. i.default = u, n.default.register(c, u), e.exports = i.default
  19075. }), {
  19076. "../../renderer/gfx": 360,
  19077. "../renderer/assembler": 227,
  19078. "../vmath/vec3": 335,
  19079. "./CCMeshRenderer": 166
  19080. }],
  19081. 170: [(function(t, e, i) {
  19082. "use strict";
  19083. var n = t("./component-scheduler"),
  19084. r = t("./platform/CCObject").Flags,
  19085. s = t("./platform/js"),
  19086. o = r.IsPreloadStarted,
  19087. a = r.IsOnLoadStarted,
  19088. l = r.IsOnLoadCalled,
  19089. h = r.Deactivating,
  19090. c = cc.Class({
  19091. extends: n.LifeCycleInvoker,
  19092. add: function(t) {
  19093. this._zero.array.push(t)
  19094. },
  19095. remove: function(t) {
  19096. this._zero.fastRemove(t)
  19097. },
  19098. cancelInactive: function(t) {
  19099. n.LifeCycleInvoker.stableRemoveInactive(this._zero, t)
  19100. },
  19101. invoke: function() {
  19102. this._invoke(this._zero), this._zero.array.length = 0
  19103. }
  19104. }),
  19105. u = n.createInvokeImpl("c.__preload();"),
  19106. _ = n.createInvokeImpl("c.onLoad();c._objFlags|=" + l, !1, l),
  19107. f = new s.Pool(4);
  19108. function d(t, e, i) {
  19109. e ? t._removeComponent(e) : s.array.removeAt(t._components, i)
  19110. }
  19111. function p() {
  19112. this._activatingStack = []
  19113. }
  19114. f.get = function() {
  19115. var t = this._get() || {
  19116. preload: new c(u),
  19117. onLoad: new n.OneOffInvoker(_),
  19118. onEnable: new n.OneOffInvoker(n.invokeOnEnable)
  19119. };
  19120. t.preload._zero.i = -1;
  19121. var e = t.onLoad;
  19122. return e._zero.i = -1, e._neg.i = -1, e._pos.i = -1, (e = t.onEnable)._zero.i = -1, e._neg.i = -1, e._pos.i = -1, t
  19123. };
  19124. var m = cc.Class({
  19125. ctor: p,
  19126. reset: p,
  19127. _activateNodeRecursively: function(t, e, i, n) {
  19128. if (t._objFlags & h) cc.errorID(3816, t.name);
  19129. else {
  19130. t._activeInHierarchy = !0;
  19131. for (var r = t._components.length, s = 0; s < r; ++s) {
  19132. var o = t._components[s];
  19133. o instanceof cc.Component ? this.activateComp(o, e, i, n) : (d(t, o, s), --s, --r)
  19134. }
  19135. t._childArrivalOrder = t._children.length;
  19136. for (var a = 0, l = t._children.length; a < l; ++a) {
  19137. var c = t._children[a];
  19138. c._localZOrder = 4294901760 & c._localZOrder | a + 1, c._active && this._activateNodeRecursively(c, e, i, n)
  19139. }
  19140. t._onPostActivated(!0)
  19141. }
  19142. },
  19143. _deactivateNodeRecursively: function(t) {
  19144. t._objFlags |= h, t._activeInHierarchy = !1;
  19145. for (var e = t._components.length, i = 0; i < e; ++i) {
  19146. var n = t._components[i];
  19147. if (n._enabled && (cc.director._compScheduler.disableComp(n), t._activeInHierarchy)) return void(t._objFlags &= ~h)
  19148. }
  19149. for (var r = 0, s = t._children.length; r < s; ++r) {
  19150. var o = t._children[r];
  19151. if (o._activeInHierarchy && (this._deactivateNodeRecursively(o), t._activeInHierarchy)) return void(t._objFlags &= ~h)
  19152. }
  19153. t._onPostActivated(!1), t._objFlags &= ~h
  19154. },
  19155. activateNode: function(t, e) {
  19156. if (e) {
  19157. var i = f.get();
  19158. this._activatingStack.push(i), this._activateNodeRecursively(t, i.preload, i.onLoad, i.onEnable), i.preload.invoke(), i.onLoad.invoke(), i.onEnable.invoke(), this._activatingStack.pop(), f.put(i)
  19159. } else {
  19160. this._deactivateNodeRecursively(t);
  19161. for (var n = this._activatingStack, r = 0; r < n.length; r++) {
  19162. var s = n[r];
  19163. s.preload.cancelInactive(o), s.onLoad.cancelInactive(a), s.onEnable.cancelInactive()
  19164. }
  19165. }
  19166. t.emit("active-in-hierarchy-changed", t)
  19167. },
  19168. activateComp: function(t, e, i, n) {
  19169. if (cc.isValid(t, !0) && (t._objFlags & o || (t._objFlags |= o, t.__preload && (e ? e.add(t) : t.__preload())), t._objFlags & a || (t._objFlags |= a, t.onLoad ? i ? i.add(t) : (t.onLoad(), t._objFlags |= l) : t._objFlags |= l), t._enabled)) {
  19170. if (!t.node._activeInHierarchy) return;
  19171. cc.director._compScheduler.enableComp(t, n)
  19172. }
  19173. },
  19174. destroyComp: function(t) {
  19175. cc.director._compScheduler.disableComp(t), t.onDestroy && t._objFlags & l && t.onDestroy()
  19176. },
  19177. resetComp: !1
  19178. });
  19179. e.exports = m
  19180. }), {
  19181. "./component-scheduler": 89,
  19182. "./platform/CCObject": 204,
  19183. "./platform/js": 218,
  19184. "./utils/misc": 300
  19185. }],
  19186. 171: [(function(t, e, i) {
  19187. "use strict";
  19188. var n = t("./CCPhysicsTypes").PTM_RATIO,
  19189. r = t("./CCPhysicsTypes").ContactType,
  19190. s = [],
  19191. o = [cc.v2(), cc.v2()],
  19192. a = new b2.WorldManifold,
  19193. l = {
  19194. points: [],
  19195. separations: [],
  19196. normal: cc.v2()
  19197. };
  19198. function h() {
  19199. this.localPoint = cc.v2(), this.normalImpulse = 0, this.tangentImpulse = 0
  19200. }
  19201. var c = [new h, new h],
  19202. u = (new b2.Manifold, {
  19203. type: 0,
  19204. localPoint: cc.v2(),
  19205. localNormal: cc.v2(),
  19206. points: []
  19207. }),
  19208. _ = {
  19209. normalImpulses: [],
  19210. tangentImpulses: []
  19211. };
  19212. function f() {}
  19213. f.prototype.init = function(t) {
  19214. this.colliderA = t.GetFixtureA().collider, this.colliderB = t.GetFixtureB().collider, this.disabled = !1, this.disabledOnce = !1, this._impulse = null, this._inverted = !1, this._b2contact = t, t._contact = this
  19215. }, f.prototype.reset = function() {
  19216. this.setTangentSpeed(0), this.resetFriction(), this.resetRestitution(), this.colliderA = null, this.colliderB = null, this.disabled = !1, this._impulse = null, this._b2contact._contact = null, this._b2contact = null
  19217. }, f.prototype.getWorldManifold = function() {
  19218. var t = l.points,
  19219. e = l.separations,
  19220. i = l.normal;
  19221. this._b2contact.GetWorldManifold(a);
  19222. var r = a.points,
  19223. s = a.separations,
  19224. h = this._b2contact.GetManifold().pointCount;
  19225. t.length = e.length = h;
  19226. for (var c = 0; c < h; c++) {
  19227. var u = o[c];
  19228. u.x = r[c].x * n, u.y = r[c].y * n, t[c] = u, e[c] = s[c] * n
  19229. }
  19230. return i.x = a.normal.x, i.y = a.normal.y, this._inverted && (i.x *= -1, i.y *= -1), l
  19231. }, f.prototype.getManifold = function() {
  19232. for (var t = u.points, e = u.localNormal, i = u.localPoint, r = this._b2contact.GetManifold(), s = r.points, o = t.length = r.pointCount, a = 0; a < o; a++) {
  19233. var l = c[a],
  19234. h = s[a];
  19235. l.localPoint.x = h.localPoint.x * n, l.localPoint.Y = h.localPoint.Y * n, l.normalImpulse = h.normalImpulse * n, l.tangentImpulse = h.tangentImpulse, t[a] = l
  19236. }
  19237. return i.x = r.localPoint.x * n, i.y = r.localPoint.y * n, e.x = r.localNormal.x, e.y = r.localNormal.y, u.type = r.type, this._inverted && (e.x *= -1, e.y *= -1), u
  19238. }, f.prototype.getImpulse = function() {
  19239. var t = this._impulse;
  19240. if (!t) return null;
  19241. for (var e = _.normalImpulses, i = _.tangentImpulses, r = t.count, s = 0; s < r; s++) e[s] = t.normalImpulses[s] * n, i[s] = t.tangentImpulses[s];
  19242. return i.length = e.length = r, _
  19243. }, f.prototype.emit = function(t) {
  19244. var e;
  19245. switch (t) {
  19246. case r.BEGIN_CONTACT:
  19247. e = "onBeginContact";
  19248. break;
  19249. case r.END_CONTACT:
  19250. e = "onEndContact";
  19251. break;
  19252. case r.PRE_SOLVE:
  19253. e = "onPreSolve";
  19254. break;
  19255. case r.POST_SOLVE:
  19256. e = "onPostSolve"
  19257. }
  19258. var i, n, s, o, a = this.colliderA,
  19259. l = this.colliderB,
  19260. h = a.body,
  19261. c = l.body;
  19262. if (h.enabledContactListener)
  19263. for (i = h.node._components, this._inverted = !1, n = 0, s = i.length; n < s; n++)(o = i[n])[e] && o[e](this, a, l);
  19264. if (c.enabledContactListener)
  19265. for (i = c.node._components, this._inverted = !0, n = 0, s = i.length; n < s; n++)(o = i[n])[e] && o[e](this, l, a);
  19266. (this.disabled || this.disabledOnce) && (this.setEnabled(!1), this.disabledOnce = !1)
  19267. }, f.get = function(t) {
  19268. var e;
  19269. return (e = 0 === s.length ? new cc.PhysicsContact : s.pop()).init(t), e
  19270. }, f.put = function(t) {
  19271. var e = t._contact;
  19272. e && (s.push(e), e.reset())
  19273. };
  19274. var d = f.prototype;
  19275. d.setEnabled = function(t) {
  19276. this._b2contact.SetEnabled(t)
  19277. }, d.isTouching = function() {
  19278. return this._b2contact.IsTouching()
  19279. }, d.setTangentSpeed = function(t) {
  19280. this._b2contact.SetTangentSpeed(t / n)
  19281. }, d.getTangentSpeed = function() {
  19282. return this._b2contact.GetTangentSpeed() * n
  19283. }, d.setFriction = function(t) {
  19284. this._b2contact.SetFriction(t)
  19285. }, d.getFriction = function() {
  19286. return this._b2contact.GetFriction()
  19287. }, d.resetFriction = function() {
  19288. return this._b2contact.ResetFriction()
  19289. }, d.setRestitution = function(t) {
  19290. this._b2contact.SetRestitution(t)
  19291. }, d.getRestitution = function() {
  19292. return this._b2contact.GetRestitution()
  19293. }, d.resetRestitution = function() {
  19294. return this._b2contact.ResetRestitution()
  19295. }, f.ContactType = r, cc.PhysicsContact = e.exports = f
  19296. }), {
  19297. "./CCPhysicsTypes": 173
  19298. }],
  19299. 172: [(function(t, e, i) {
  19300. "use strict";
  19301. var n = t("./CCPhysicsTypes"),
  19302. r = n.ContactType,
  19303. s = n.BodyType,
  19304. o = n.RayCastType,
  19305. a = n.DrawBits,
  19306. l = n.PTM_RATIO,
  19307. h = (n.ANGLE_TO_PHYSICS_ANGLE, n.PHYSICS_ANGLE_TO_ANGLE),
  19308. c = t("./utils").convertToNodeRotation,
  19309. u = t("./platform/CCPhysicsDebugDraw"),
  19310. _ = new b2.AABB,
  19311. f = new b2.Vec2,
  19312. d = new b2.Vec2,
  19313. p = cc.v2(),
  19314. m = cc.Class({
  19315. mixins: [cc.EventTarget],
  19316. statics: {
  19317. DrawBits: a,
  19318. PTM_RATIO: l,
  19319. VELOCITY_ITERATIONS: 10,
  19320. POSITION_ITERATIONS: 10,
  19321. FIXED_TIME_STEP: 1 / 60,
  19322. MAX_ACCUMULATOR: .2
  19323. },
  19324. ctor: function() {
  19325. this._debugDrawFlags = 0, this._debugDrawer = null, this._world = null, this._bodies = [], this._joints = [], this._contactMap = {}, this._contactID = 0, this._delayEvents = [], this._accumulator = 0, cc.director._scheduler && cc.director._scheduler.enableForTarget(this), this.enabledAccumulator = !1
  19326. },
  19327. pushDelayEvent: function(t, e, i) {
  19328. this._steping ? this._delayEvents.push({
  19329. target: t,
  19330. func: e,
  19331. args: i
  19332. }) : t[e].apply(t, i)
  19333. },
  19334. update: function(t) {
  19335. var e = this._world;
  19336. if (e && this.enabled) {
  19337. this.emit("before-step"), this._steping = !0;
  19338. var i = m.VELOCITY_ITERATIONS,
  19339. n = m.POSITION_ITERATIONS;
  19340. if (this.enabledAccumulator) {
  19341. this._accumulator += t;
  19342. var r = m.FIXED_TIME_STEP,
  19343. s = m.MAX_ACCUMULATOR;
  19344. for (this._accumulator > s && (this._accumulator = s); this._accumulator > r;) e.Step(r, i, n), this._accumulator -= r
  19345. } else {
  19346. var o = 1 / cc.game.config.frameRate;
  19347. e.Step(o, i, n)
  19348. }
  19349. this.debugDrawFlags && (this._checkDebugDrawValid(), this._debugDrawer.clear(), e.DrawDebugData()), this._steping = !1;
  19350. for (var a = this._delayEvents, l = 0, h = a.length; l < h; l++) {
  19351. var c = a[l];
  19352. c.target[c.func].apply(c.target, c.args)
  19353. }
  19354. a.length = 0, this._syncNode()
  19355. }
  19356. },
  19357. testPoint: function(t) {
  19358. var e = f.x = t.x / l,
  19359. i = f.y = t.y / l,
  19360. n = .2 / l;
  19361. _.lowerBound.x = e - n, _.lowerBound.y = i - n, _.upperBound.x = e + n, _.upperBound.y = i + n;
  19362. var r = this._aabbQueryCallback;
  19363. r.init(f), this._world.QueryAABB(r, _);
  19364. var s = r.getFixture();
  19365. return s ? s.collider : null
  19366. },
  19367. testAABB: function(t) {
  19368. _.lowerBound.x = t.xMin / l, _.lowerBound.y = t.yMin / l, _.upperBound.x = t.xMax / l, _.upperBound.y = t.yMax / l;
  19369. var e = this._aabbQueryCallback;
  19370. return e.init(), this._world.QueryAABB(e, _), e.getFixtures().map((function(t) {
  19371. return t.collider
  19372. }))
  19373. },
  19374. rayCast: function(t, e, i) {
  19375. if (t.equals(e)) return [];
  19376. i = i || o.Closest, f.x = t.x / l, f.y = t.y / l, d.x = e.x / l, d.y = e.y / l;
  19377. var n = this._raycastQueryCallback;
  19378. n.init(i), this._world.RayCast(n, f, d);
  19379. var r = n.getFixtures();
  19380. if (r.length > 0) {
  19381. for (var s = n.getPoints(), a = n.getNormals(), h = n.getFractions(), c = [], u = 0, _ = r.length; u < _; u++) {
  19382. var p = r[u],
  19383. m = p.collider;
  19384. if (i === o.AllClosest) {
  19385. var y = c.find((function(t) {
  19386. return t.collider === m
  19387. }));
  19388. if (y) {
  19389. h[u] < y.fraction && (y.fixtureIndex = m._getFixtureIndex(p), y.point.x = s[u].x * l, y.point.y = s[u].y * l, y.normal.x = a[u].x, y.normal.y = a[u].y, y.fraction = h[u]);
  19390. continue
  19391. }
  19392. }
  19393. c.push({
  19394. collider: m,
  19395. fixtureIndex: m._getFixtureIndex(p),
  19396. point: cc.v2(s[u].x * l, s[u].y * l),
  19397. normal: cc.v2(a[u]),
  19398. fraction: h[u]
  19399. })
  19400. }
  19401. return c
  19402. }
  19403. return []
  19404. },
  19405. syncPosition: function() {
  19406. for (var t = this._bodies, e = 0; e < t.length; e++) t[e].syncPosition()
  19407. },
  19408. syncRotation: function() {
  19409. for (var t = this._bodies, e = 0; e < t.length; e++) t[e].syncRotation()
  19410. },
  19411. _registerContactFixture: function(t) {
  19412. this._contactListener.registerContactFixture(t)
  19413. },
  19414. _unregisterContactFixture: function(t) {
  19415. this._contactListener.unregisterContactFixture(t)
  19416. },
  19417. _addBody: function(t, e) {
  19418. var i = this._world,
  19419. n = t.node;
  19420. i && n && (t._b2Body = i.CreateBody(e), t._b2Body.body = t, this._bodies.push(t))
  19421. },
  19422. _removeBody: function(t) {
  19423. var e = this._world;
  19424. e && (t._b2Body.body = null, e.DestroyBody(t._b2Body), t._b2Body = null, cc.js.array.remove(this._bodies, t))
  19425. },
  19426. _addJoint: function(t, e) {
  19427. var i = this._world.CreateJoint(e);
  19428. i && (i._joint = t, t._joint = i, this._joints.push(t))
  19429. },
  19430. _removeJoint: function(t) {
  19431. t._isValid() && this._world.DestroyJoint(t._joint), t._joint && (t._joint._joint = null), cc.js.array.remove(this._joints, t)
  19432. },
  19433. _initCallback: function() {
  19434. if (this._world) {
  19435. if (!this._contactListener) {
  19436. var t = new cc.PhysicsContactListener;
  19437. t.setBeginContact(this._onBeginContact), t.setEndContact(this._onEndContact), t.setPreSolve(this._onPreSolve), t.setPostSolve(this._onPostSolve), this._world.SetContactListener(t), this._contactListener = t, this._aabbQueryCallback = new cc.PhysicsAABBQueryCallback, this._raycastQueryCallback = new cc.PhysicsRayCastCallback
  19438. }
  19439. } else cc.warn("Please init PhysicsManager first")
  19440. },
  19441. _init: function() {
  19442. this.enabled = !0, this.debugDrawFlags = a.e_shapeBit
  19443. },
  19444. _getWorld: function() {
  19445. return this._world
  19446. },
  19447. _syncNode: function() {
  19448. for (var t = this._bodies, e = 0, i = t.length; e < i; e++) {
  19449. var n = t[e],
  19450. r = n.node,
  19451. o = n._b2Body,
  19452. a = o.GetPosition();
  19453. p.x = a.x * l, p.y = a.y * l;
  19454. var u = o.GetAngle() * h;
  19455. null !== r.parent.parent && (p = r.parent.convertToNodeSpaceAR(p), u = c(r.parent, u));
  19456. var _ = r._eventMask;
  19457. r._eventMask = 0, r.position = p, r.angle = -u, r._eventMask = _, n.type === s.Animated && n.resetVelocity()
  19458. }
  19459. },
  19460. _onBeginContact: function(t) {
  19461. cc.PhysicsContact.get(t).emit(r.BEGIN_CONTACT)
  19462. },
  19463. _onEndContact: function(t) {
  19464. var e = t._contact;
  19465. e && (e.emit(r.END_CONTACT), cc.PhysicsContact.put(t))
  19466. },
  19467. _onPreSolve: function(t) {
  19468. var e = t._contact;
  19469. e && e.emit(r.PRE_SOLVE)
  19470. },
  19471. _onPostSolve: function(t, e) {
  19472. var i = t._contact;
  19473. i && (i._impulse = e, i.emit(r.POST_SOLVE), i._impulse = null)
  19474. },
  19475. _checkDebugDrawValid: function() {
  19476. if (!this._debugDrawer || !this._debugDrawer.isValid) {
  19477. var t = new cc.Node("PHYSICS_MANAGER_DEBUG_DRAW");
  19478. t.zIndex = cc.macro.MAX_ZINDEX, cc.game.addPersistRootNode(t), this._debugDrawer = t.addComponent(cc.Graphics);
  19479. var e = new u(this._debugDrawer);
  19480. e.SetFlags(this.debugDrawFlags), this._world.SetDebugDraw(e)
  19481. }
  19482. }
  19483. });
  19484. cc.js.getset(m.prototype, "enabled", (function() {
  19485. return this._enabled
  19486. }), (function(t) {
  19487. if (t && !this._world) {
  19488. var e = new b2.World(new b2.Vec2(0, -10));
  19489. e.SetAllowSleeping(!0), this._world = e, this._initCallback()
  19490. }
  19491. this._enabled = t
  19492. })), cc.js.getset(m.prototype, "debugDrawFlags", (function() {
  19493. return this._debugDrawFlags
  19494. }), (function(t) {
  19495. t && !this._debugDrawFlags ? this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !0) : !t && this._debugDrawFlags && this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !1), t && (this._checkDebugDrawValid(), this._world.m_debugDraw.SetFlags(t)), this._debugDrawFlags = t, t && (this._checkDebugDrawValid(), this._world.m_debugDraw.SetFlags(t))
  19496. })), cc.js.getset(m.prototype, "gravity", (function() {
  19497. if (this._world) {
  19498. var t = this._world.GetGravity();
  19499. return cc.v2(t.x * l, t.y * l)
  19500. }
  19501. return cc.v2()
  19502. }), (function(t) {
  19503. this._world && this._world.SetGravity(new b2.Vec2(t.x / l, t.y / l))
  19504. })), cc.PhysicsManager = e.exports = m
  19505. }), {
  19506. "./CCPhysicsTypes": 173,
  19507. "./platform/CCPhysicsDebugDraw": 194,
  19508. "./utils": 196
  19509. }],
  19510. 173: [(function(t, e, i) {
  19511. "use strict";
  19512. var n = cc.Enum({
  19513. Static: 0,
  19514. Kinematic: 1,
  19515. Dynamic: 2,
  19516. Animated: 3
  19517. });
  19518. cc.RigidBodyType = n;
  19519. var r = cc.Enum({
  19520. Closest: 0,
  19521. Any: 1,
  19522. AllClosest: 2,
  19523. All: 3
  19524. });
  19525. cc.RayCastType = r, e.exports = {
  19526. BodyType: n,
  19527. ContactType: {
  19528. BEGIN_CONTACT: "begin-contact",
  19529. END_CONTACT: "end-contact",
  19530. PRE_SOLVE: "pre-solve",
  19531. POST_SOLVE: "post-solve"
  19532. },
  19533. RayCastType: r,
  19534. DrawBits: b2.DrawFlags,
  19535. PTM_RATIO: 32,
  19536. ANGLE_TO_PHYSICS_ANGLE: -Math.PI / 180,
  19537. PHYSICS_ANGLE_TO_ANGLE: -180 / Math.PI
  19538. }
  19539. }), {}],
  19540. 174: [(function(t, e, i) {
  19541. "use strict";
  19542. function n(t, e) {
  19543. var i = e.length;
  19544. return e[t < 0 ? i - -t % i : t % i]
  19545. }
  19546. function r(t, e, i) {
  19547. for (var r = []; e < t;) e += i.length;
  19548. for (; t <= e; ++t) r.push(n(t, i));
  19549. return r
  19550. }
  19551. function s(t, e, i) {
  19552. if (o(t, i)) {
  19553. if (h(n(t, i), n(t - 1, i), n(e, i)) && c(n(t, i), n(t + 1, i), n(e, i))) return !1
  19554. } else if (c(n(t, i), n(t + 1, i), n(e, i)) || h(n(t, i), n(t - 1, i), n(e, i))) return !1;
  19555. if (o(e, i)) {
  19556. if (h(n(e, i), n(e - 1, i), n(t, i)) && c(n(e, i), n(e + 1, i), n(t, i))) return !1
  19557. } else if (c(n(e, i), n(e + 1, i), n(t, i)) || h(n(e, i), n(e - 1, i), n(t, i))) return !1;
  19558. for (var r = 0; r < i.length; ++r)
  19559. if ((r + 1) % i.length != t && r != t && (r + 1) % i.length != e && r != e) {
  19560. var s = cc.v2();
  19561. if (m(n(t, i), n(e, i), n(r, i), n(r + 1, i), s)) return !1
  19562. }
  19563. return !0
  19564. }
  19565. function o(t, e) {
  19566. return a(t, e)
  19567. }
  19568. function a(t, e, i) {
  19569. if (void 0 === i) {
  19570. var r = t,
  19571. s = e;
  19572. t = n(r - 1, s), e = n(r, s), i = n(r + 1, s)
  19573. }
  19574. return v(t, e, i) < 0
  19575. }
  19576. function l(t, e, i) {
  19577. return v(t, e, i) > 0
  19578. }
  19579. function h(t, e, i) {
  19580. return v(t, e, i) >= 0
  19581. }
  19582. function c(t, e, i) {
  19583. return v(t, e, i) <= 0
  19584. }
  19585. function u(t, e) {
  19586. var i = e.x - t.x,
  19587. n = e.y - t.y;
  19588. return i * i + n * n
  19589. }
  19590. function _(t) {
  19591. f(t) || t.reverse()
  19592. }
  19593. function f(t) {
  19594. return t.length < 3 || d(t) > 0
  19595. }
  19596. function d(t) {
  19597. var e, i = 0;
  19598. for (e = 0; e < t.length; e++) {
  19599. var n = (e + 1) % t.length;
  19600. i += t[e].x * t[n].y, i -= t[e].y * t[n].x
  19601. }
  19602. return i /= 2
  19603. }
  19604. function p(t, e, i, n) {
  19605. var r = cc.v2(),
  19606. s = e.y - t.y,
  19607. o = t.x - e.x,
  19608. a = s * t.x + o * t.y,
  19609. l = n.y - i.y,
  19610. h = i.x - n.x,
  19611. c = l * i.x + h * i.y,
  19612. u = s * h - l * o;
  19613. return y(u, 0) || (r.x = (h * a - o * c) / u, r.y = (s * c - l * a) / u), r
  19614. }
  19615. function m(t, e, i, n, r) {
  19616. if (t == i || t == n || e == i || e == n) return !1;
  19617. var s = t.x,
  19618. o = t.y,
  19619. a = e.x,
  19620. l = e.y,
  19621. h = i.x,
  19622. c = i.y,
  19623. u = n.x,
  19624. _ = n.y;
  19625. if (Math.max(s, a) < Math.min(h, u) || Math.max(h, u) < Math.min(s, a)) return !1;
  19626. if (Math.max(o, l) < Math.min(c, _) || Math.max(c, _) < Math.min(o, l)) return !1;
  19627. var f = (u - h) * (o - c) - (_ - c) * (s - h),
  19628. d = (a - s) * (o - c) - (l - o) * (s - h),
  19629. p = (_ - c) * (a - s) - (u - h) * (l - o);
  19630. return !(Math.abs(p) < 1e-6) && (d /= p, 0 < (f /= p) && f < 1 && 0 < d && d < 1 && (r.x = s + f * (a - s), r.y = o + f * (l - o), !0))
  19631. }
  19632. function y(t, e) {
  19633. return Math.abs(t - e) <= 1e-6
  19634. }
  19635. function v(t, e, i) {
  19636. return t.x * (e.y - i.y) + e.x * (i.y - t.y) + i.x * (t.y - e.y)
  19637. }
  19638. e.exports = {
  19639. ConvexPartition: function t(e) {
  19640. _(e);
  19641. for (var i, f, d, m, y, v, g = [], x = cc.v2(), b = cc.v2(), A = 0, C = 0, T = 0; T < e.length; ++T)
  19642. if (o(T, e)) {
  19643. f = d = 1e8;
  19644. for (var S = 0; S < e.length; ++S) l(n(T - 1, e), n(T, e), n(S, e)) && c(n(T - 1, e), n(T, e), n(S - 1, e)) && (m = p(n(T - 1, e), n(T, e), n(S, e), n(S - 1, e)), a(n(T + 1, e), n(T, e), m) && (i = u(n(T, e), m)) < f && (f = i, x = m, A = S)), l(n(T + 1, e), n(T, e), n(S + 1, e)) && c(n(T + 1, e), n(T, e), n(S, e)) && (m = p(n(T + 1, e), n(T, e), n(S, e), n(S + 1, e)), l(n(T - 1, e), n(T, e), m) && (i = u(n(T, e), m)) < d && (d = i, C = S, b = m));
  19645. if (A == (C + 1) % e.length) {
  19646. var w = x.add(b).div(2);
  19647. (y = r(T, C, e)).push(w), (v = r(A, T, e)).push(w)
  19648. } else {
  19649. for (var E = 0, M = A; C < A;) C += e.length;
  19650. for (S = A; S <= C; ++S)
  19651. if (s(T, S, e)) {
  19652. var D = 1 / (u(n(T, e), n(S, e)) + 1);
  19653. o(S, e) ? c(n(S - 1, e), n(S, e), n(T, e)) && h(n(S + 1, e), n(S, e), n(T, e)) ? D += 3 : D += 2 : D += 1, D > E && (M = S, E = D)
  19654. }
  19655. y = r(T, M, e), v = r(M, T, e)
  19656. }
  19657. return g = (g = g.concat(t(y))).concat(t(v))
  19658. }
  19659. g.push(e);
  19660. for (T = g.length - 1; T >= 0; T--) 0 == g[T].length && g.splice(T, 0);
  19661. return g
  19662. },
  19663. ForceCounterClockWise: _,
  19664. IsCounterClockWise: f
  19665. }
  19666. }), {}],
  19667. 175: [(function(t, e, i) {
  19668. "use strict";
  19669. var n = t("../CCNode").EventType,
  19670. r = t("./CCPhysicsTypes").PTM_RATIO,
  19671. s = t("./CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
  19672. o = t("./CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE,
  19673. a = t("./utils").getWorldRotation,
  19674. l = t("./CCPhysicsTypes").BodyType,
  19675. h = new b2.Vec2,
  19676. c = new b2.Vec2,
  19677. u = cc.Vec2.ZERO,
  19678. _ = cc.Class({
  19679. name: "cc.RigidBody",
  19680. extends: cc.Component,
  19681. editor: !1,
  19682. properties: {
  19683. _type: l.Dynamic,
  19684. _allowSleep: !0,
  19685. _gravityScale: 1,
  19686. _linearDamping: 0,
  19687. _angularDamping: 0,
  19688. _linearVelocity: cc.v2(0, 0),
  19689. _angularVelocity: 0,
  19690. _fixedRotation: !1,
  19691. enabled: {
  19692. get: function() {
  19693. return this._enabled
  19694. },
  19695. set: function() {
  19696. cc.warnID(8200)
  19697. },
  19698. visible: !1,
  19699. override: !0
  19700. },
  19701. enabledContactListener: {
  19702. default: !1,
  19703. tooltip: !1
  19704. },
  19705. bullet: {
  19706. default: !1,
  19707. tooltip: !1
  19708. },
  19709. type: {
  19710. type: l,
  19711. tooltip: !1,
  19712. get: function() {
  19713. return this._type
  19714. },
  19715. set: function(t) {
  19716. this._type = t, this._b2Body && (t === l.Animated ? this._b2Body.SetType(l.Kinematic) : this._b2Body.SetType(t))
  19717. }
  19718. },
  19719. allowSleep: {
  19720. tooltip: !1,
  19721. get: function() {
  19722. return this._b2Body ? this._b2Body.IsSleepingAllowed() : this._allowSleep
  19723. },
  19724. set: function(t) {
  19725. this._allowSleep = t, this._b2Body && this._b2Body.SetSleepingAllowed(t)
  19726. }
  19727. },
  19728. gravityScale: {
  19729. tooltip: !1,
  19730. get: function() {
  19731. return this._gravityScale
  19732. },
  19733. set: function(t) {
  19734. this._gravityScale = t, this._b2Body && this._b2Body.SetGravityScale(t)
  19735. }
  19736. },
  19737. linearDamping: {
  19738. tooltip: !1,
  19739. get: function() {
  19740. return this._linearDamping
  19741. },
  19742. set: function(t) {
  19743. this._linearDamping = t, this._b2Body && this._b2Body.SetLinearDamping(this._linearDamping)
  19744. }
  19745. },
  19746. angularDamping: {
  19747. tooltip: !1,
  19748. get: function() {
  19749. return this._angularDamping
  19750. },
  19751. set: function(t) {
  19752. this._angularDamping = t, this._b2Body && this._b2Body.SetAngularDamping(t)
  19753. }
  19754. },
  19755. linearVelocity: {
  19756. tooltip: !1,
  19757. type: cc.Vec2,
  19758. get: function() {
  19759. var t = this._linearVelocity;
  19760. if (this._b2Body) {
  19761. var e = this._b2Body.GetLinearVelocity();
  19762. t.x = e.x * r, t.y = e.y * r
  19763. }
  19764. return t
  19765. },
  19766. set: function(t) {
  19767. this._linearVelocity = t;
  19768. var e = this._b2Body;
  19769. if (e) {
  19770. var i = e.m_linearVelocity;
  19771. i.Set(t.x / r, t.y / r), e.SetLinearVelocity(i)
  19772. }
  19773. }
  19774. },
  19775. angularVelocity: {
  19776. tooltip: !1,
  19777. get: function() {
  19778. return this._b2Body ? this._b2Body.GetAngularVelocity() * o : this._angularVelocity
  19779. },
  19780. set: function(t) {
  19781. this._angularVelocity = t, this._b2Body && this._b2Body.SetAngularVelocity(t * s)
  19782. }
  19783. },
  19784. fixedRotation: {
  19785. tooltip: !1,
  19786. get: function() {
  19787. return this._fixedRotation
  19788. },
  19789. set: function(t) {
  19790. this._fixedRotation = t, this._b2Body && this._b2Body.SetFixedRotation(t)
  19791. }
  19792. },
  19793. awake: {
  19794. visible: !1,
  19795. tooltip: !1,
  19796. get: function() {
  19797. return !!this._b2Body && this._b2Body.IsAwake()
  19798. },
  19799. set: function(t) {
  19800. this._b2Body && this._b2Body.SetAwake(t)
  19801. }
  19802. },
  19803. awakeOnLoad: {
  19804. default: !0,
  19805. tooltip: !1,
  19806. animatable: !1
  19807. },
  19808. active: {
  19809. visible: !1,
  19810. get: function() {
  19811. return !!this._b2Body && this._b2Body.IsActive()
  19812. },
  19813. set: function(t) {
  19814. this._b2Body && this._b2Body.SetActive(t)
  19815. }
  19816. }
  19817. },
  19818. getLocalPoint: function(t, e) {
  19819. if (e = e || cc.v2(), this._b2Body) {
  19820. h.Set(t.x / r, t.y / r);
  19821. var i = this._b2Body.GetLocalPoint(h, e);
  19822. e.x = i.x * r, e.y = i.y * r
  19823. }
  19824. return e
  19825. },
  19826. getWorldPoint: function(t, e) {
  19827. if (e = e || cc.v2(), this._b2Body) {
  19828. h.Set(t.x / r, t.y / r);
  19829. var i = this._b2Body.GetWorldPoint(h, e);
  19830. e.x = i.x * r, e.y = i.y * r
  19831. }
  19832. return e
  19833. },
  19834. getWorldVector: function(t, e) {
  19835. if (e = e || cc.v2(), this._b2Body) {
  19836. h.Set(t.x / r, t.y / r);
  19837. var i = this._b2Body.GetWorldVector(h, e);
  19838. e.x = i.x * r, e.y = i.y * r
  19839. }
  19840. return e
  19841. },
  19842. getLocalVector: function(t, e) {
  19843. if (e = e || cc.v2(), this._b2Body) {
  19844. h.Set(t.x / r, t.y / r);
  19845. var i = this._b2Body.GetLocalVector(h, e);
  19846. e.x = i.x * r, e.y = i.y * r
  19847. }
  19848. return e
  19849. },
  19850. getWorldPosition: function(t) {
  19851. if (t = t || cc.v2(), this._b2Body) {
  19852. var e = this._b2Body.GetPosition();
  19853. t.x = e.x * r, t.y = e.y * r
  19854. }
  19855. return t
  19856. },
  19857. getWorldRotation: function() {
  19858. return this._b2Body ? this._b2Body.GetAngle() * o : 0
  19859. },
  19860. getLocalCenter: function(t) {
  19861. if (t = t || cc.v2(), this._b2Body) {
  19862. var e = this._b2Body.GetLocalCenter();
  19863. t.x = e.x * r, t.y = e.y * r
  19864. }
  19865. return t
  19866. },
  19867. getWorldCenter: function(t) {
  19868. if (t = t || cc.v2(), this._b2Body) {
  19869. var e = this._b2Body.GetWorldCenter();
  19870. t.x = e.x * r, t.y = e.y * r
  19871. }
  19872. return t
  19873. },
  19874. getLinearVelocityFromWorldPoint: function(t, e) {
  19875. if (e = e || cc.v2(), this._b2Body) {
  19876. h.Set(t.x / r, t.y / r);
  19877. var i = this._b2Body.GetLinearVelocityFromWorldPoint(h, e);
  19878. e.x = i.x * r, e.y = i.y * r
  19879. }
  19880. return e
  19881. },
  19882. getMass: function() {
  19883. return this._b2Body ? this._b2Body.GetMass() : 0
  19884. },
  19885. getInertia: function() {
  19886. return this._b2Body ? this._b2Body.GetInertia() * r * r : 0
  19887. },
  19888. getJointList: function() {
  19889. if (!this._b2Body) return [];
  19890. var t = [],
  19891. e = this._b2Body.GetJointList();
  19892. if (!e) return [];
  19893. t.push(e.joint._joint);
  19894. for (var i = e.prev; i;) t.push(i.joint._joint), i = i.prev;
  19895. for (var n = e.next; n;) t.push(n.joint._joint), n = n.next;
  19896. return t
  19897. },
  19898. applyForce: function(t, e, i) {
  19899. this._b2Body && (h.Set(t.x / r, t.y / r), c.Set(e.x / r, e.y / r), this._b2Body.ApplyForce(h, c, i))
  19900. },
  19901. applyForceToCenter: function(t, e) {
  19902. this._b2Body && (h.Set(t.x / r, t.y / r), this._b2Body.ApplyForceToCenter(h, e))
  19903. },
  19904. applyTorque: function(t, e) {
  19905. this._b2Body && this._b2Body.ApplyTorque(t / r, e)
  19906. },
  19907. applyLinearImpulse: function(t, e, i) {
  19908. this._b2Body && (h.Set(t.x / r, t.y / r), c.Set(e.x / r, e.y / r), this._b2Body.ApplyLinearImpulse(h, c, i))
  19909. },
  19910. applyAngularImpulse: function(t, e) {
  19911. this._b2Body && this._b2Body.ApplyAngularImpulse(t / r / r, e)
  19912. },
  19913. syncPosition: function(t) {
  19914. var e = this._b2Body;
  19915. if (e) {
  19916. var i, n = this.node.convertToWorldSpaceAR(u);
  19917. if ((i = this.type === l.Animated ? e.GetLinearVelocity() : e.GetPosition()).x = n.x / r, i.y = n.y / r, this.type === l.Animated && t) {
  19918. var s = e.GetPosition(),
  19919. o = cc.game.config.frameRate;
  19920. i.x = (i.x - s.x) * o, i.y = (i.y - s.y) * o, e.SetAwake(!0), e.SetLinearVelocity(i)
  19921. } else e.SetTransformVec(i, e.GetAngle())
  19922. }
  19923. },
  19924. syncRotation: function(t) {
  19925. var e = this._b2Body;
  19926. if (e) {
  19927. var i = s * a(this.node);
  19928. if (this.type === l.Animated && t) {
  19929. var n = e.GetAngle(),
  19930. r = cc.game.config.frameRate;
  19931. e.SetAwake(!0), e.SetAngularVelocity((i - n) * r)
  19932. } else e.SetTransformVec(e.GetPosition(), i)
  19933. }
  19934. },
  19935. resetVelocity: function() {
  19936. var t = this._b2Body;
  19937. if (t) {
  19938. var e = t.m_linearVelocity;
  19939. e.Set(0, 0), t.SetLinearVelocity(e), t.SetAngularVelocity(0)
  19940. }
  19941. },
  19942. onEnable: function() {
  19943. this._init()
  19944. },
  19945. onDisable: function() {
  19946. this._destroy()
  19947. },
  19948. _registerNodeEvents: function() {
  19949. var t = this.node;
  19950. t.on(n.POSITION_CHANGED, this._onNodePositionChanged, this), t.on(n.ROTATION_CHANGED, this._onNodeRotationChanged, this), t.on(n.SCALE_CHANGED, this._onNodeScaleChanged, this)
  19951. },
  19952. _unregisterNodeEvents: function() {
  19953. var t = this.node;
  19954. t.off(n.POSITION_CHANGED, this._onNodePositionChanged, this), t.off(n.ROTATION_CHANGED, this._onNodeRotationChanged, this), t.off(n.SCALE_CHANGED, this._onNodeScaleChanged, this)
  19955. },
  19956. _onNodePositionChanged: function() {
  19957. this.syncPosition(!0)
  19958. },
  19959. _onNodeRotationChanged: function(t) {
  19960. this.syncRotation(!0)
  19961. },
  19962. _onNodeScaleChanged: function(t) {
  19963. if (this._b2Body)
  19964. for (var e = this.getComponents(cc.PhysicsCollider), i = 0; i < e.length; i++) e[i].apply()
  19965. },
  19966. _init: function() {
  19967. cc.director.getPhysicsManager().pushDelayEvent(this, "__init", [])
  19968. },
  19969. _destroy: function() {
  19970. cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", [])
  19971. },
  19972. __init: function() {
  19973. if (!this._inited) {
  19974. this._registerNodeEvents();
  19975. var t = new b2.BodyDef;
  19976. this.type === l.Animated ? t.type = l.Kinematic : t.type = this.type, t.allowSleep = this.allowSleep, t.gravityScale = this.gravityScale, t.linearDamping = this.linearDamping, t.angularDamping = this.angularDamping;
  19977. var e = this.linearVelocity;
  19978. t.linearVelocity = new b2.Vec2(e.x / r, e.y / r), t.angularVelocity = this.angularVelocity * s, t.fixedRotation = this.fixedRotation, t.bullet = this.bullet;
  19979. var i = this.node,
  19980. n = i.convertToWorldSpaceAR(u);
  19981. t.position = new b2.Vec2(n.x / r, n.y / r), t.angle = -Math.PI / 180 * a(i), t.awake = this.awakeOnLoad, cc.director.getPhysicsManager()._addBody(this, t), this._inited = !0
  19982. }
  19983. },
  19984. __destroy: function() {
  19985. this._inited && (cc.director.getPhysicsManager()._removeBody(this), this._unregisterNodeEvents(), this._inited = !1)
  19986. },
  19987. _getBody: function() {
  19988. return this._b2Body
  19989. }
  19990. });
  19991. cc.RigidBody = e.exports = _
  19992. }), {
  19993. "../CCNode": 52,
  19994. "./CCPhysicsTypes": 173,
  19995. "./utils": 196
  19996. }],
  19997. 176: [(function(t, e, i) {
  19998. "use strict";
  19999. var n = t("../../../external/box2d/box2d");
  20000. for (var r in window.b2 = {}, n)
  20001. if (-1 === r.indexOf("b2_")) {
  20002. var s = r.replace("b2", "");
  20003. b2[s] = n[r]
  20004. }
  20005. b2.maxPolygonVertices = 8
  20006. }), {
  20007. "../../../external/box2d/box2d": 421
  20008. }],
  20009. 177: [(function(t, e, i) {
  20010. "use strict";
  20011. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20012. r = cc.Class({
  20013. name: "cc.PhysicsBoxCollider",
  20014. extends: cc.PhysicsCollider,
  20015. mixins: [cc.Collider.Box],
  20016. editor: {
  20017. menu: !1,
  20018. requireComponent: cc.RigidBody
  20019. },
  20020. _createShape: function(t) {
  20021. var e = Math.abs(t.x),
  20022. i = Math.abs(t.y),
  20023. r = this.size.width / 2 / n * e,
  20024. s = this.size.height / 2 / n * i,
  20025. o = this.offset.x / n * e,
  20026. a = this.offset.y / n * i,
  20027. l = new b2.PolygonShape;
  20028. return l.SetAsBox(r, s, new b2.Vec2(o, a), 0), l
  20029. }
  20030. });
  20031. cc.PhysicsBoxCollider = e.exports = r
  20032. }), {
  20033. "../CCPhysicsTypes": 173
  20034. }],
  20035. 178: [(function(t, e, i) {
  20036. "use strict";
  20037. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20038. r = cc.Class({
  20039. name: "cc.PhysicsChainCollider",
  20040. extends: cc.PhysicsCollider,
  20041. editor: {
  20042. menu: !1,
  20043. inspector: !1,
  20044. requireComponent: cc.RigidBody
  20045. },
  20046. properties: {
  20047. loop: !1,
  20048. points: {
  20049. default: function() {
  20050. return [cc.v2(-50, 0), cc.v2(50, 0)]
  20051. },
  20052. type: [cc.Vec2]
  20053. },
  20054. threshold: {
  20055. default: 1,
  20056. serializable: !1,
  20057. visible: !1
  20058. }
  20059. },
  20060. _createShape: function(t) {
  20061. for (var e = new b2.ChainShape, i = this.points, r = [], s = 0; s < i.length; s++) {
  20062. var o = i[s];
  20063. r.push(new b2.Vec2(o.x / n * t.x, o.y / n * t.y))
  20064. }
  20065. return this.loop ? e.CreateLoop(r, r.length) : e.CreateChain(r, r.length), e
  20066. },
  20067. resetInEditor: !1,
  20068. resetPointsByContour: !1
  20069. });
  20070. cc.PhysicsChainCollider = e.exports = r
  20071. }), {
  20072. "../CCPhysicsTypes": 173
  20073. }],
  20074. 179: [(function(t, e, i) {
  20075. "use strict";
  20076. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20077. r = cc.Class({
  20078. name: "cc.PhysicsCircleCollider",
  20079. extends: cc.PhysicsCollider,
  20080. mixins: [cc.Collider.Circle],
  20081. editor: {
  20082. menu: !1,
  20083. requireComponent: cc.RigidBody
  20084. },
  20085. _createShape: function(t) {
  20086. var e = Math.abs(t.x),
  20087. i = Math.abs(t.y),
  20088. r = this.offset.x / n * e,
  20089. s = this.offset.y / n * i,
  20090. o = new b2.CircleShape;
  20091. return o.m_radius = this.radius / n * e, o.m_p = new b2.Vec2(r, s), o
  20092. }
  20093. });
  20094. cc.PhysicsCircleCollider = e.exports = r
  20095. }), {
  20096. "../CCPhysicsTypes": 173
  20097. }],
  20098. 180: [(function(t, e, i) {
  20099. "use strict";
  20100. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20101. r = t("../utils").getWorldScale,
  20102. s = cc.Class({
  20103. name: "cc.PhysicsCollider",
  20104. extends: cc.Collider,
  20105. ctor: function() {
  20106. this._fixtures = [], this._shapes = [], this._inited = !1, this._rect = cc.rect()
  20107. },
  20108. properties: {
  20109. _density: 1,
  20110. _sensor: !1,
  20111. _friction: .2,
  20112. _restitution: 0,
  20113. density: {
  20114. tooltip: !1,
  20115. get: function() {
  20116. return this._density
  20117. },
  20118. set: function(t) {
  20119. this._density = t
  20120. }
  20121. },
  20122. sensor: {
  20123. tooltip: !1,
  20124. get: function() {
  20125. return this._sensor
  20126. },
  20127. set: function(t) {
  20128. this._sensor = t
  20129. }
  20130. },
  20131. friction: {
  20132. tooltip: !1,
  20133. get: function() {
  20134. return this._friction
  20135. },
  20136. set: function(t) {
  20137. this._friction = t
  20138. }
  20139. },
  20140. restitution: {
  20141. tooltip: !1,
  20142. get: function() {
  20143. return this._restitution
  20144. },
  20145. set: function(t) {
  20146. this._restitution = t
  20147. }
  20148. },
  20149. body: {
  20150. default: null,
  20151. type: cc.RigidBody,
  20152. visible: !1
  20153. }
  20154. },
  20155. onDisable: function() {
  20156. this._destroy()
  20157. },
  20158. onEnable: function() {
  20159. this._init()
  20160. },
  20161. start: function() {
  20162. this._init()
  20163. },
  20164. _getFixtureIndex: function(t) {
  20165. return this._fixtures.indexOf(t)
  20166. },
  20167. _init: function() {
  20168. cc.director.getPhysicsManager().pushDelayEvent(this, "__init", [])
  20169. },
  20170. _destroy: function() {
  20171. cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", [])
  20172. },
  20173. __init: function() {
  20174. if (!this._inited) {
  20175. var t = this.body || this.getComponent(cc.RigidBody);
  20176. if (t) {
  20177. var e = t._getBody();
  20178. if (e) {
  20179. var i = t.node,
  20180. n = r(i);
  20181. this._scale = n;
  20182. var s = 0 === n.x && 0 === n.y ? [] : this._createShape(n);
  20183. s instanceof Array || (s = [s]);
  20184. for (var o = 1 << i.groupIndex, a = 0, l = cc.game.collisionMatrix[i.groupIndex], h = 0; h < l.length; h++) l[h] && (a |= 1 << h);
  20185. for (var c = {
  20186. categoryBits: o,
  20187. maskBits: a,
  20188. groupIndex: 0
  20189. }, u = cc.director.getPhysicsManager(), _ = 0; _ < s.length; _++) {
  20190. var f = s[_],
  20191. d = new b2.FixtureDef;
  20192. d.density = this.density, d.isSensor = this.sensor, d.friction = this.friction, d.restitution = this.restitution, d.shape = f, d.filter = c;
  20193. var p = e.CreateFixture(d);
  20194. p.collider = this, t.enabledContactListener && u._registerContactFixture(p), this._shapes.push(f), this._fixtures.push(p)
  20195. }
  20196. this.body = t, this._inited = !0
  20197. }
  20198. }
  20199. }
  20200. },
  20201. __destroy: function() {
  20202. if (this._inited) {
  20203. for (var t = this._fixtures, e = this.body._getBody(), i = cc.director.getPhysicsManager(), n = t.length - 1; n >= 0; n--) {
  20204. var r = t[n];
  20205. r.collider = null, i._unregisterContactFixture(r), e && e.DestroyFixture(r)
  20206. }
  20207. this.body = null, this._fixtures.length = 0, this._shapes.length = 0, this._inited = !1
  20208. }
  20209. },
  20210. _createShape: function() {},
  20211. apply: function() {
  20212. this._destroy(), this._init()
  20213. },
  20214. getAABB: function() {
  20215. for (var t = 1e7, e = 1e7, i = -1e7, r = -1e7, s = this._fixtures, o = 0; o < s.length; o++)
  20216. for (var a = s[o], l = a.GetShape().GetChildCount(), h = 0; h < l; h++) {
  20217. var c = a.GetAABB(h);
  20218. c.lowerBound.x < t && (t = c.lowerBound.x), c.lowerBound.y < e && (e = c.lowerBound.y), c.upperBound.x > i && (i = c.upperBound.x), c.upperBound.y > r && (r = c.upperBound.y)
  20219. }
  20220. t *= n, e *= n, i *= n, r *= n;
  20221. var u = this._rect;
  20222. return u.x = t, u.y = e, u.width = i - t, u.height = r - e, u
  20223. }
  20224. });
  20225. cc.PhysicsCollider = e.exports = s
  20226. }), {
  20227. "../CCPhysicsTypes": 173,
  20228. "../utils": 196
  20229. }],
  20230. 181: [(function(t, e, i) {
  20231. "use strict";
  20232. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20233. r = t("../CCPolygonSeparator"),
  20234. s = cc.Class({
  20235. name: "cc.PhysicsPolygonCollider",
  20236. extends: cc.PhysicsCollider,
  20237. mixins: [cc.Collider.Polygon],
  20238. editor: {
  20239. menu: !1,
  20240. inspector: !1,
  20241. requireComponent: cc.RigidBody
  20242. },
  20243. _createShape: function(t) {
  20244. var e = [],
  20245. i = this.points;
  20246. i.length > 0 && i[0].equals(i[i.length - 1]) && (i.length -= 1);
  20247. for (var s = r.ConvexPartition(i), o = this.offset, a = 0; a < s.length; a++) {
  20248. for (var l = s[a], h = null, c = [], u = null, _ = 0, f = l.length; _ < f; _++) {
  20249. h || (h = new b2.PolygonShape);
  20250. var d = l[_],
  20251. p = (d.x + o.x) / n * t.x,
  20252. m = (d.y + o.y) / n * t.y,
  20253. y = new b2.Vec2(p, m);
  20254. c.push(y), u || (u = y), c.length === b2.maxPolygonVertices && (h.Set(c, c.length), e.push(h), h = null, _ < f - 1 && (c = [u, c[c.length - 1]]))
  20255. }
  20256. h && (h.Set(c, c.length), e.push(h))
  20257. }
  20258. return e
  20259. }
  20260. });
  20261. cc.PhysicsPolygonCollider = e.exports = s
  20262. }), {
  20263. "../CCPhysicsTypes": 173,
  20264. "../CCPolygonSeparator": 174
  20265. }],
  20266. 182: [(function(t, e, i) {
  20267. "use strict";
  20268. t("./box2d-adapter"), t("./CCPhysicsManager"), t("./CCRigidBody"), t("./CCPhysicsContact"), t("./collider/CCPhysicsCollider"), t("./collider/CCPhysicsChainCollider"), t("./collider/CCPhysicsCircleCollider"), t("./collider/CCPhysicsBoxCollider"), t("./collider/CCPhysicsPolygonCollider"), t("./joint/CCJoint"), t("./joint/CCDistanceJoint"), t("./joint/CCRevoluteJoint"), t("./joint/CCMouseJoint"), t("./joint/CCMotorJoint"), t("./joint/CCPrismaticJoint"), t("./joint/CCWeldJoint"), t("./joint/CCWheelJoint"), t("./joint/CCRopeJoint"), t("./platform/CCPhysicsContactListner"), t("./platform/CCPhysicsAABBQueryCallback"), t("./platform/CCPhysicsRayCastCallback")
  20269. }), {
  20270. "./CCPhysicsContact": 171,
  20271. "./CCPhysicsManager": 172,
  20272. "./CCRigidBody": 175,
  20273. "./box2d-adapter": 176,
  20274. "./collider/CCPhysicsBoxCollider": 177,
  20275. "./collider/CCPhysicsChainCollider": 178,
  20276. "./collider/CCPhysicsCircleCollider": 179,
  20277. "./collider/CCPhysicsCollider": 180,
  20278. "./collider/CCPhysicsPolygonCollider": 181,
  20279. "./joint/CCDistanceJoint": 183,
  20280. "./joint/CCJoint": 184,
  20281. "./joint/CCMotorJoint": 185,
  20282. "./joint/CCMouseJoint": 186,
  20283. "./joint/CCPrismaticJoint": 187,
  20284. "./joint/CCRevoluteJoint": 188,
  20285. "./joint/CCRopeJoint": 189,
  20286. "./joint/CCWeldJoint": 190,
  20287. "./joint/CCWheelJoint": 191,
  20288. "./platform/CCPhysicsAABBQueryCallback": 192,
  20289. "./platform/CCPhysicsContactListner": 193,
  20290. "./platform/CCPhysicsRayCastCallback": 195
  20291. }],
  20292. 183: [(function(t, e, i) {
  20293. "use strict";
  20294. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20295. r = cc.Class({
  20296. name: "cc.DistanceJoint",
  20297. extends: cc.Joint,
  20298. editor: !1,
  20299. properties: {
  20300. _distance: 1,
  20301. _frequency: 0,
  20302. _dampingRatio: 0,
  20303. distance: {
  20304. tooltip: !1,
  20305. get: function() {
  20306. return this._distance
  20307. },
  20308. set: function(t) {
  20309. this._distance = t, this._joint && this._joint.SetLength(t)
  20310. }
  20311. },
  20312. frequency: {
  20313. tooltip: !1,
  20314. get: function() {
  20315. return this._frequency
  20316. },
  20317. set: function(t) {
  20318. this._frequency = t, this._joint && this._joint.SetFrequency(t)
  20319. }
  20320. },
  20321. dampingRatio: {
  20322. tooltip: !1,
  20323. get: function() {
  20324. return this._dampingRatio
  20325. },
  20326. set: function(t) {
  20327. this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
  20328. }
  20329. }
  20330. },
  20331. _createJointDef: function() {
  20332. var t = new b2.DistanceJointDef;
  20333. return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.length = this.distance / n, t.dampingRatio = this.dampingRatio, t.frequencyHz = this.frequency, t
  20334. }
  20335. });
  20336. cc.DistanceJoint = e.exports = r
  20337. }), {
  20338. "../CCPhysicsTypes": 173
  20339. }],
  20340. 184: [(function(t, e, i) {
  20341. "use strict";
  20342. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20343. r = cc.Class({
  20344. name: "cc.Joint",
  20345. extends: cc.Component,
  20346. editor: {
  20347. requireComponent: cc.RigidBody
  20348. },
  20349. properties: {
  20350. anchor: {
  20351. default: cc.v2(0, 0),
  20352. tooltip: !1
  20353. },
  20354. connectedAnchor: {
  20355. default: cc.v2(0, 0),
  20356. tooltip: !1
  20357. },
  20358. connectedBody: {
  20359. default: null,
  20360. type: cc.RigidBody,
  20361. tooltip: !1
  20362. },
  20363. collideConnected: {
  20364. default: !1,
  20365. tooltip: !1
  20366. }
  20367. },
  20368. onDisable: function() {
  20369. this._destroy()
  20370. },
  20371. onEnable: function() {
  20372. this._init()
  20373. },
  20374. start: function() {
  20375. this._init()
  20376. },
  20377. apply: function() {
  20378. this._destroy(), this._init()
  20379. },
  20380. getWorldAnchor: function() {
  20381. if (this._joint) {
  20382. var t = this._joint.GetAnchorA();
  20383. return cc.v2(t.x * n, t.y * n)
  20384. }
  20385. return cc.Vec2.ZERO
  20386. },
  20387. getWorldConnectedAnchor: function() {
  20388. if (this._joint) {
  20389. var t = this._joint.GetAnchorB();
  20390. return cc.v2(t.x * n, t.y * n)
  20391. }
  20392. return cc.Vec2.ZERO
  20393. },
  20394. getReactionForce: function(t) {
  20395. var e = cc.v2();
  20396. return this._joint ? this._joint.GetReactionForce(t, e) : e
  20397. },
  20398. getReactionTorque: function(t) {
  20399. return this._joint ? this._joint.GetReactionTorque(t) : 0
  20400. },
  20401. _init: function() {
  20402. cc.director.getPhysicsManager().pushDelayEvent(this, "__init", [])
  20403. },
  20404. _destroy: function() {
  20405. cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", [])
  20406. },
  20407. __init: function() {
  20408. if (!this._inited && (this.body = this.getComponent(cc.RigidBody), this._isValid())) {
  20409. var t = this._createJointDef();
  20410. if (!t) return;
  20411. t.bodyA = this.body._getBody(), t.bodyB = this.connectedBody._getBody(), t.collideConnected = this.collideConnected, cc.director.getPhysicsManager()._addJoint(this, t), this._inited = !0
  20412. }
  20413. },
  20414. __destroy: function() {
  20415. this._inited && (cc.director.getPhysicsManager()._removeJoint(this), this._joint = null, this._inited = !1)
  20416. },
  20417. _createJointDef: function() {
  20418. return null
  20419. },
  20420. _isValid: function() {
  20421. return this.body && this.body._getBody() && this.connectedBody && this.connectedBody._getBody()
  20422. }
  20423. });
  20424. cc.Joint = e.exports = r
  20425. }), {
  20426. "../CCPhysicsTypes": 173
  20427. }],
  20428. 185: [(function(t, e, i) {
  20429. "use strict";
  20430. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20431. r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
  20432. s = cc.Class({
  20433. name: "cc.MotorJoint",
  20434. extends: cc.Joint,
  20435. editor: !1,
  20436. properties: {
  20437. _linearOffset: cc.v2(0, 0),
  20438. _angularOffset: 0,
  20439. _maxForce: 1,
  20440. _maxTorque: 1,
  20441. _correctionFactor: .3,
  20442. anchor: {
  20443. tooltip: !1,
  20444. default: cc.v2(0, 0),
  20445. override: !0,
  20446. visible: !1
  20447. },
  20448. connectedAnchor: {
  20449. tooltip: !1,
  20450. default: cc.v2(0, 0),
  20451. override: !0,
  20452. visible: !1
  20453. },
  20454. linearOffset: {
  20455. tooltip: !1,
  20456. get: function() {
  20457. return this._linearOffset
  20458. },
  20459. set: function(t) {
  20460. this._linearOffset = t, this._joint && this._joint.SetLinearOffset(new b2.Vec2(t.x / n, t.y / n))
  20461. }
  20462. },
  20463. angularOffset: {
  20464. tooltip: !1,
  20465. get: function() {
  20466. return this._angularOffset
  20467. },
  20468. set: function(t) {
  20469. this._angularOffset = t, this._joint && this._joint.SetAngularOffset(t)
  20470. }
  20471. },
  20472. maxForce: {
  20473. tooltip: !1,
  20474. get: function() {
  20475. return this._maxForce
  20476. },
  20477. set: function(t) {
  20478. this._maxForce = t, this._joint && this._joint.SetMaxForce(t)
  20479. }
  20480. },
  20481. maxTorque: {
  20482. tooltip: !1,
  20483. get: function() {
  20484. return this._maxTorque
  20485. },
  20486. set: function(t) {
  20487. this._maxTorque = t, this._joint && this._joint.SetMaxTorque(t)
  20488. }
  20489. },
  20490. correctionFactor: {
  20491. tooltip: !1,
  20492. get: function() {
  20493. return this._correctionFactor
  20494. },
  20495. set: function(t) {
  20496. this._correctionFactor = t, this._joint && this._joint.SetCorrectionFactor(t)
  20497. }
  20498. }
  20499. },
  20500. _createJointDef: function() {
  20501. var t = new b2.MotorJointDef;
  20502. return t.linearOffset = new b2.Vec2(this.linearOffset.x / n, this.linearOffset.y / n), t.angularOffset = this.angularOffset * r, t.maxForce = this.maxForce, t.maxTorque = this.maxTorque, t.correctionFactor = this.correctionFactor, t
  20503. }
  20504. });
  20505. cc.MotorJoint = e.exports = s
  20506. }), {
  20507. "../CCPhysicsTypes": 173
  20508. }],
  20509. 186: [(function(t, e, i) {
  20510. "use strict";
  20511. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20512. r = new b2.Vec2,
  20513. s = cc.Class({
  20514. name: "cc.MouseJoint",
  20515. extends: cc.Joint,
  20516. editor: !1,
  20517. properties: {
  20518. _target: 1,
  20519. _frequency: 5,
  20520. _dampingRatio: .7,
  20521. _maxForce: 0,
  20522. connectedBody: {
  20523. default: null,
  20524. type: cc.RigidBody,
  20525. visible: !1,
  20526. override: !0
  20527. },
  20528. collideConnected: {
  20529. default: !0,
  20530. visible: !1,
  20531. override: !0
  20532. },
  20533. anchor: {
  20534. tooltip: !1,
  20535. default: cc.v2(0, 0),
  20536. override: !0,
  20537. visible: !1
  20538. },
  20539. connectedAnchor: {
  20540. tooltip: !1,
  20541. default: cc.v2(0, 0),
  20542. override: !0,
  20543. visible: !1
  20544. },
  20545. mouseRegion: {
  20546. tooltip: !1,
  20547. default: null,
  20548. type: cc.Node
  20549. },
  20550. target: {
  20551. tooltip: !1,
  20552. visible: !1,
  20553. get: function() {
  20554. return this._target
  20555. },
  20556. set: function(t) {
  20557. this._target = t, this._joint && (r.x = t.x / n, r.y = t.y / n, this._joint.SetTarget(r))
  20558. }
  20559. },
  20560. frequency: {
  20561. tooltip: !1,
  20562. get: function() {
  20563. return this._frequency
  20564. },
  20565. set: function(t) {
  20566. this._frequency = t, this._joint && this._joint.SetFrequency(t)
  20567. }
  20568. },
  20569. dampingRatio: {
  20570. tooltip: !1,
  20571. get: function() {
  20572. return this._dampingRatio
  20573. },
  20574. set: function(t) {
  20575. this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
  20576. }
  20577. },
  20578. maxForce: {
  20579. tooltip: !1,
  20580. visible: !1,
  20581. get: function() {
  20582. return this._maxForce
  20583. },
  20584. set: function(t) {
  20585. this._maxForce = t, this._joint && this._joint.SetMaxForce(t)
  20586. }
  20587. }
  20588. },
  20589. onLoad: function() {
  20590. var t = this.mouseRegion || this.node;
  20591. t.on(cc.Node.EventType.TOUCH_START, this.onTouchBegan, this), t.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this), t.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this), t.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this)
  20592. },
  20593. onEnable: function() {},
  20594. start: function() {},
  20595. onTouchBegan: function(t) {
  20596. var e = cc.director.getPhysicsManager(),
  20597. i = this._pressPoint = t.touch.getLocation();
  20598. cc.Camera && cc.Camera.main && (i = cc.Camera.main.getScreenToWorldPoint(i));
  20599. var n = e.testPoint(i);
  20600. n && ((this.connectedBody = n.body).awake = !0, this.maxForce = 1e3 * this.connectedBody.getMass(), this.target = i, this._init())
  20601. },
  20602. onTouchMove: function(t) {
  20603. this._pressPoint = t.touch.getLocation()
  20604. },
  20605. onTouchEnd: function(t) {
  20606. this._destroy(), this._pressPoint = null
  20607. },
  20608. _createJointDef: function() {
  20609. var t = new b2.MouseJointDef;
  20610. return r.x = this.target.x / n, r.y = this.target.y / n, t.target = r, t.maxForce = this.maxForce, t.dampingRatio = this.dampingRatio, t.frequencyHz = this.frequency, t
  20611. },
  20612. update: function() {
  20613. if (this._pressPoint && this._isValid()) {
  20614. var t = cc.Camera.findCamera(this.node);
  20615. this.target = t ? t.getScreenToWorldPoint(this._pressPoint) : this._pressPoint
  20616. }
  20617. }
  20618. });
  20619. cc.MouseJoint = e.exports = s
  20620. }), {
  20621. "../CCPhysicsTypes": 173
  20622. }],
  20623. 187: [(function(t, e, i) {
  20624. "use strict";
  20625. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20626. r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
  20627. s = cc.Class({
  20628. name: "cc.PrismaticJoint",
  20629. extends: cc.Joint,
  20630. editor: !1,
  20631. properties: {
  20632. localAxisA: {
  20633. default: cc.v2(1, 0),
  20634. tooltip: !1
  20635. },
  20636. referenceAngle: {
  20637. default: 0,
  20638. tooltip: !1
  20639. },
  20640. enableLimit: {
  20641. default: !1,
  20642. tooltip: !1
  20643. },
  20644. enableMotor: {
  20645. default: !1,
  20646. tooltip: !1
  20647. },
  20648. lowerLimit: {
  20649. default: 0,
  20650. tooltip: !1
  20651. },
  20652. upperLimit: {
  20653. default: 0,
  20654. tooltip: !1
  20655. },
  20656. _maxMotorForce: 0,
  20657. _motorSpeed: 0,
  20658. maxMotorForce: {
  20659. tooltip: !1,
  20660. get: function() {
  20661. return this._maxMotorForce
  20662. },
  20663. set: function(t) {
  20664. this._maxMotorForce = t, this._joint && this._joint.SetMaxMotorForce(t)
  20665. }
  20666. },
  20667. motorSpeed: {
  20668. tooltip: !1,
  20669. get: function() {
  20670. return this._motorSpeed
  20671. },
  20672. set: function(t) {
  20673. this._motorSpeed = t, this._joint && this._joint.SetMotorSpeed(t)
  20674. }
  20675. }
  20676. },
  20677. _createJointDef: function() {
  20678. var t = new b2.PrismaticJointDef;
  20679. return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.localAxisA = new b2.Vec2(this.localAxisA.x, this.localAxisA.y), t.referenceAngle = this.referenceAngle * r, t.enableLimit = this.enableLimit, t.lowerTranslation = this.lowerLimit / n, t.upperTranslation = this.upperLimit / n, t.enableMotor = this.enableMotor, t.maxMotorForce = this.maxMotorForce, t.motorSpeed = this.motorSpeed, t
  20680. }
  20681. });
  20682. cc.PrismaticJoint = e.exports = s
  20683. }), {
  20684. "../CCPhysicsTypes": 173
  20685. }],
  20686. 188: [(function(t, e, i) {
  20687. "use strict";
  20688. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20689. r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
  20690. s = t("../CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE,
  20691. o = cc.Class({
  20692. name: "cc.RevoluteJoint",
  20693. extends: cc.Joint,
  20694. editor: !1,
  20695. properties: {
  20696. _maxMotorTorque: 0,
  20697. _motorSpeed: 0,
  20698. _enableLimit: !1,
  20699. _enableMotor: !1,
  20700. referenceAngle: {
  20701. default: 0,
  20702. tooltip: !1
  20703. },
  20704. lowerAngle: {
  20705. default: 0,
  20706. tooltip: !1
  20707. },
  20708. upperAngle: {
  20709. default: 0,
  20710. tooltip: !1
  20711. },
  20712. maxMotorTorque: {
  20713. tooltip: !1,
  20714. get: function() {
  20715. return this._maxMotorTorque
  20716. },
  20717. set: function(t) {
  20718. this._maxMotorTorque = t, this._joint && this._joint.SetMaxMotorTorque(t)
  20719. }
  20720. },
  20721. motorSpeed: {
  20722. tooltip: !1,
  20723. get: function() {
  20724. return this._motorSpeed
  20725. },
  20726. set: function(t) {
  20727. this._motorSpeed = t, this._joint && this._joint.SetMotorSpeed(t * r)
  20728. }
  20729. },
  20730. enableLimit: {
  20731. tooltip: !1,
  20732. get: function() {
  20733. return this._enableLimit
  20734. },
  20735. set: function(t) {
  20736. this._enableLimit = t, this._joint && this._joint.EnableLimit(t)
  20737. }
  20738. },
  20739. enableMotor: {
  20740. tooltip: !1,
  20741. get: function() {
  20742. return this._enableMotor
  20743. },
  20744. set: function(t) {
  20745. this._enableMotor = t, this._joint && this._joint.EnableMotor(t)
  20746. }
  20747. }
  20748. },
  20749. getJointAngle: function() {
  20750. return this._joint ? this._joint.GetJointAngle() * s : 0
  20751. },
  20752. setLimits: function(t, e) {
  20753. if (this._joint) return this._joint.SetLimits(t * r, e * r)
  20754. },
  20755. _createJointDef: function() {
  20756. var t = new b2.RevoluteJointDef;
  20757. return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.lowerAngle = this.upperAngle * r, t.upperAngle = this.lowerAngle * r, t.maxMotorTorque = this.maxMotorTorque, t.motorSpeed = this.motorSpeed * r, t.enableLimit = this.enableLimit, t.enableMotor = this.enableMotor, t.referenceAngle = this.referenceAngle * r, t
  20758. }
  20759. });
  20760. cc.RevoluteJoint = e.exports = o
  20761. }), {
  20762. "../CCPhysicsTypes": 173
  20763. }],
  20764. 189: [(function(t, e, i) {
  20765. "use strict";
  20766. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20767. r = cc.Class({
  20768. name: "cc.RopeJoint",
  20769. extends: cc.Joint,
  20770. editor: !1,
  20771. properties: {
  20772. _maxLength: 1,
  20773. maxLength: {
  20774. tooltip: !1,
  20775. get: function() {
  20776. return this._maxLength
  20777. },
  20778. set: function(t) {
  20779. this._maxLength = t, this._joint && this._joint.SetMaxLength(t)
  20780. }
  20781. }
  20782. },
  20783. _createJointDef: function() {
  20784. var t = new b2.RopeJointDef;
  20785. return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.maxLength = this.maxLength / n, t
  20786. }
  20787. });
  20788. cc.RopeJoint = e.exports = r
  20789. }), {
  20790. "../CCPhysicsTypes": 173
  20791. }],
  20792. 190: [(function(t, e, i) {
  20793. "use strict";
  20794. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20795. r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
  20796. s = cc.Class({
  20797. name: "cc.WeldJoint",
  20798. extends: cc.Joint,
  20799. editor: !1,
  20800. properties: {
  20801. referenceAngle: {
  20802. default: 0,
  20803. tooltip: !1
  20804. },
  20805. _frequency: 0,
  20806. _dampingRatio: 0,
  20807. frequency: {
  20808. tooltip: !1,
  20809. get: function() {
  20810. return this._frequency
  20811. },
  20812. set: function(t) {
  20813. this._frequency = t, this._joint && this._joint.SetFrequency(t)
  20814. }
  20815. },
  20816. dampingRatio: {
  20817. tooltip: !1,
  20818. get: function() {
  20819. return this._dampingRatio
  20820. },
  20821. set: function(t) {
  20822. this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
  20823. }
  20824. }
  20825. },
  20826. _createJointDef: function() {
  20827. var t = new b2.WeldJointDef;
  20828. return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.referenceAngle = this.referenceAngle * r, t.frequencyHz = this.frequency, t.dampingRatio = this.dampingRatio, t
  20829. }
  20830. });
  20831. cc.WeldJoint = e.exports = s
  20832. }), {
  20833. "../CCPhysicsTypes": 173
  20834. }],
  20835. 191: [(function(t, e, i) {
  20836. "use strict";
  20837. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20838. r = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,
  20839. s = cc.Class({
  20840. name: "cc.WheelJoint",
  20841. extends: cc.Joint,
  20842. editor: !1,
  20843. properties: {
  20844. _maxMotorTorque: 0,
  20845. _motorSpeed: 0,
  20846. _enableMotor: !1,
  20847. _frequency: 2,
  20848. _dampingRatio: .7,
  20849. localAxisA: {
  20850. default: cc.v2(1, 0),
  20851. tooltip: !1
  20852. },
  20853. maxMotorTorque: {
  20854. tooltip: !1,
  20855. get: function() {
  20856. return this._maxMotorTorque
  20857. },
  20858. set: function(t) {
  20859. this._maxMotorTorque = t, this._joint && this._joint.SetMaxMotorTorque(t)
  20860. }
  20861. },
  20862. motorSpeed: {
  20863. tooltip: !1,
  20864. get: function() {
  20865. return this._motorSpeed
  20866. },
  20867. set: function(t) {
  20868. this._motorSpeed = t, this._joint && this._joint.SetMotorSpeed(t * r)
  20869. }
  20870. },
  20871. enableMotor: {
  20872. tooltip: !1,
  20873. get: function() {
  20874. return this._enableMotor
  20875. },
  20876. set: function(t) {
  20877. this._enableMotor = t, this._joint && this._joint.EnableMotor(t)
  20878. }
  20879. },
  20880. frequency: {
  20881. tooltip: !1,
  20882. get: function() {
  20883. return this._frequency
  20884. },
  20885. set: function(t) {
  20886. this._frequency = t, this._joint && this._joint.SetFrequency(t)
  20887. }
  20888. },
  20889. dampingRatio: {
  20890. tooltip: !1,
  20891. get: function() {
  20892. return this._dampingRatio
  20893. },
  20894. set: function(t) {
  20895. this._dampingRatio = t, this._joint && this._joint.SetDampingRatio(t)
  20896. }
  20897. }
  20898. },
  20899. _createJointDef: function() {
  20900. var t = new b2.WheelJointDef;
  20901. return t.localAnchorA = new b2.Vec2(this.anchor.x / n, this.anchor.y / n), t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / n, this.connectedAnchor.y / n), t.localAxisA = new b2.Vec2(this.localAxisA.x, this.localAxisA.y), t.maxMotorTorque = this.maxMotorTorque, t.motorSpeed = this.motorSpeed * r, t.enableMotor = this.enableMotor, t.dampingRatio = this.dampingRatio, t.frequencyHz = this.frequency, t
  20902. }
  20903. });
  20904. cc.WheelJoint = e.exports = s
  20905. }), {
  20906. "../CCPhysicsTypes": 173
  20907. }],
  20908. 192: [(function(t, e, i) {
  20909. "use strict";
  20910. var n = t("../CCPhysicsTypes").BodyType;
  20911. function r() {
  20912. this._point = new b2.Vec2, this._isPoint = !1, this._fixtures = []
  20913. }
  20914. r.prototype.init = function(t) {
  20915. t ? (this._isPoint = !0, this._point.x = t.x, this._point.y = t.y) : this._isPoint = !1, this._fixtures.length = 0
  20916. }, r.prototype.ReportFixture = function(t) {
  20917. if (t.GetBody().GetType() === n.Dynamic)
  20918. if (this._isPoint) {
  20919. if (t.TestPoint(this._point)) return this._fixtures.push(t), !1
  20920. } else this._fixtures.push(t);
  20921. return !0
  20922. }, r.prototype.getFixture = function() {
  20923. return this._fixtures[0]
  20924. }, r.prototype.getFixtures = function() {
  20925. return this._fixtures
  20926. }, cc.PhysicsAABBQueryCallback = e.exports = r
  20927. }), {
  20928. "../CCPhysicsTypes": 173
  20929. }],
  20930. 193: [(function(t, e, i) {
  20931. "use strict";
  20932. function n() {
  20933. this._contactFixtures = []
  20934. }
  20935. n.prototype.setBeginContact = function(t) {
  20936. this._BeginContact = t
  20937. }, n.prototype.setEndContact = function(t) {
  20938. this._EndContact = t
  20939. }, n.prototype.setPreSolve = function(t) {
  20940. this._PreSolve = t
  20941. }, n.prototype.setPostSolve = function(t) {
  20942. this._PostSolve = t
  20943. }, n.prototype.BeginContact = function(t) {
  20944. if (this._BeginContact) {
  20945. var e = t.GetFixtureA(),
  20946. i = t.GetFixtureB(),
  20947. n = this._contactFixtures;
  20948. t._shouldReport = !1, -1 === n.indexOf(e) && -1 === n.indexOf(i) || (t._shouldReport = !0, this._BeginContact(t))
  20949. }
  20950. }, n.prototype.EndContact = function(t) {
  20951. this._EndContact && t._shouldReport && (t._shouldReport = !1, this._EndContact(t))
  20952. }, n.prototype.PreSolve = function(t, e) {
  20953. this._PreSolve && t._shouldReport && this._PreSolve(t, e)
  20954. }, n.prototype.PostSolve = function(t, e) {
  20955. this._PostSolve && t._shouldReport && this._PostSolve(t, e)
  20956. }, n.prototype.registerContactFixture = function(t) {
  20957. this._contactFixtures.push(t)
  20958. }, n.prototype.unregisterContactFixture = function(t) {
  20959. cc.js.array.remove(this._contactFixtures, t)
  20960. }, cc.PhysicsContactListener = e.exports = n
  20961. }), {}],
  20962. 194: [(function(t, e, i) {
  20963. "use strict";
  20964. var n = t("../CCPhysicsTypes").PTM_RATIO,
  20965. r = cc.v2(),
  20966. s = cc.Color.GREEN,
  20967. o = cc.Color.RED;
  20968. function a(t) {
  20969. b2.Draw.call(this), this._drawer = t, this._xf = this._dxf = new b2.Transform
  20970. }
  20971. cc.js.extend(a, b2.Draw), cc.js.mixin(a.prototype, {
  20972. _DrawPolygon: function(t, e) {
  20973. for (var i = this._drawer, s = 0; s < e; s++) {
  20974. b2.Transform.MulXV(this._xf, t[s], r);
  20975. var o = r.x * n,
  20976. a = r.y * n;
  20977. 0 === s ? i.moveTo(o, a) : i.lineTo(o, a)
  20978. }
  20979. i.close()
  20980. },
  20981. DrawPolygon: function(t, e, i) {
  20982. this._applyStrokeColor(i), this._DrawPolygon(t, e), this._drawer.stroke()
  20983. },
  20984. DrawSolidPolygon: function(t, e, i) {
  20985. this._applyFillColor(i), this._DrawPolygon(t, e), this._drawer.fill(), this._drawer.stroke()
  20986. },
  20987. _DrawCircle: function(t, e) {
  20988. var i = this._xf.p;
  20989. this._drawer.circle((t.x + i.x) * n, (t.y + i.y) * n, e * n)
  20990. },
  20991. DrawCircle: function(t, e, i) {
  20992. this._applyStrokeColor(i), this._DrawCircle(t, e), this._drawer.stroke()
  20993. },
  20994. DrawSolidCircle: function(t, e, i, n) {
  20995. this._applyFillColor(n), this._DrawCircle(t, e), this._drawer.fill()
  20996. },
  20997. DrawSegment: function(t, e, i) {
  20998. var s = this._drawer;
  20999. if (t.x === e.x && t.y === e.y) return this._applyFillColor(i), this._DrawCircle(t, 2 / n), void s.fill();
  21000. this._applyStrokeColor(i), b2.Transform.MulXV(this._xf, t, r), s.moveTo(r.x * n, r.y * n), b2.Transform.MulXV(this._xf, e, r), s.lineTo(r.x * n, r.y * n), s.stroke()
  21001. },
  21002. DrawTransform: function(t) {
  21003. var e = this._drawer;
  21004. e.strokeColor = o, r.x = r.y = 0, b2.Transform.MulXV(t, r, r), e.moveTo(r.x * n, r.y * n), r.x = 1, r.y = 0, b2.Transform.MulXV(t, r, r), e.lineTo(r.x * n, r.y * n), e.stroke(), e.strokeColor = s, r.x = r.y = 0, b2.Transform.MulXV(t, r, r), e.moveTo(r.x * n, r.y * n), r.x = 0, r.y = 1, b2.Transform.MulXV(t, r, r), e.lineTo(r.x * n, r.y * n), e.stroke()
  21005. },
  21006. DrawPoint: function(t, e, i) {},
  21007. _applyStrokeColor: function(t) {
  21008. var e = this._drawer.strokeColor;
  21009. e.r = 255 * t.r, e.g = 255 * t.g, e.b = 255 * t.b, e.a = 150, this._drawer.strokeColor = e
  21010. },
  21011. _applyFillColor: function(t) {
  21012. var e = this._drawer.fillColor;
  21013. e.r = 255 * t.r, e.g = 255 * t.g, e.b = 255 * t.b, e.a = 150, this._drawer.fillColor = e
  21014. },
  21015. PushTransform: function(t) {
  21016. this._xf = t
  21017. },
  21018. PopTransform: function() {
  21019. this._xf = this._dxf
  21020. }
  21021. }), e.exports = a
  21022. }), {
  21023. "../CCPhysicsTypes": 173
  21024. }],
  21025. 195: [(function(t, e, i) {
  21026. "use strict";
  21027. function n() {
  21028. this._type = 0, this._fixtures = [], this._points = [], this._normals = [], this._fractions = []
  21029. }
  21030. n.prototype.init = function(t) {
  21031. this._type = t, this._fixtures.length = 0, this._points.length = 0, this._normals.length = 0, this._fractions.length = 0
  21032. }, n.prototype.ReportFixture = function(t, e, i, n) {
  21033. return 0 === this._type ? (this._fixtures[0] = t, this._points[0] = e, this._normals[0] = i, this._fractions[0] = n, n) : (this._fixtures.push(t), this._points.push(cc.v2(e)), this._normals.push(cc.v2(i)), this._fractions.push(n), 1 === this._type ? 0 : this._type >= 2 ? 1 : n)
  21034. }, n.prototype.getFixtures = function() {
  21035. return this._fixtures
  21036. }, n.prototype.getPoints = function() {
  21037. return this._points
  21038. }, n.prototype.getNormals = function() {
  21039. return this._normals
  21040. }, n.prototype.getFractions = function() {
  21041. return this._fractions
  21042. }, cc.PhysicsRayCastCallback = e.exports = n
  21043. }), {}],
  21044. 196: [(function(t, e, i) {
  21045. "use strict";
  21046. e.exports = {
  21047. getWorldRotation: function(t) {
  21048. for (var e = t.angle, i = t.parent; i.parent;) e += i.angle, i = i.parent;
  21049. return -e
  21050. },
  21051. getWorldScale: function(t) {
  21052. for (var e = t.scaleX, i = t.scaleY, n = t.parent; n.parent;) e *= n.scaleX, i *= n.scaleY, n = n.parent;
  21053. return cc.v2(e, i)
  21054. },
  21055. convertToNodeRotation: function(t, e) {
  21056. e -= -t.angle;
  21057. for (var i = t.parent; i.parent;) e -= -i.angle, i = i.parent;
  21058. return e
  21059. }
  21060. }
  21061. }), {}],
  21062. 197: [(function(t, e, i) {
  21063. "use strict";
  21064. t("../assets/CCAsset");
  21065. var n = t("./utils").callInNextTick,
  21066. r = t("../load-pipeline/CCLoader"),
  21067. s = t("../load-pipeline/asset-table"),
  21068. o = t("../load-pipeline/pack-downloader"),
  21069. a = t("../load-pipeline/auto-release-utils"),
  21070. l = t("../utils/decode-uuid"),
  21071. h = t("../load-pipeline/md5-pipe"),
  21072. c = t("../load-pipeline/subpackage-pipe"),
  21073. u = t("./js"),
  21074. _ = "",
  21075. f = "",
  21076. d = u.createMap(!0);
  21077. function p(t) {
  21078. return t && (t.constructor === cc.SceneAsset || t instanceof cc.Scene)
  21079. }
  21080. function m(t, e) {
  21081. this.url = t, this.type = e
  21082. }
  21083. var y = {
  21084. loadAsset: function(t, e, i) {
  21085. if ("string" != typeof t) return n(e, new Error("[AssetLibrary] uuid must be string"), null);
  21086. var s = {
  21087. uuid: t,
  21088. type: "uuid"
  21089. };
  21090. i && i.existingAsset && (s.existingAsset = i.existingAsset), r.load(s, (function(i, n) {
  21091. if (i || !n) {
  21092. var s = "string" == typeof i ? i : i ? i.message || i.errorMessage || JSON.stringify(i) : "Unknown error";
  21093. i = new Error("[AssetLibrary] loading JSON or dependencies failed:" + s)
  21094. } else {
  21095. if (n.constructor === cc.SceneAsset) {
  21096. var o = cc.loader._getReferenceKey(t);
  21097. n.scene.dependAssets = a.getDependsRecursively(o)
  21098. }
  21099. if (p(n)) {
  21100. var l = cc.loader._getReferenceKey(t);
  21101. r.removeItem(l)
  21102. }
  21103. }
  21104. e && e(i, n)
  21105. }))
  21106. },
  21107. getLibUrlNoExt: function(t, e) {
  21108. return t = l(t), (e ? f + "assets/" : _) + t.slice(0, 2) + "/" + t
  21109. },
  21110. _queryAssetInfoInEditor: function(t, e) {
  21111. 0
  21112. },
  21113. _getAssetInfoInRuntime: function(t, e) {
  21114. e = e || {
  21115. url: null,
  21116. raw: !1
  21117. };
  21118. var i = d[t];
  21119. return i && !u.isChildClassOf(i.type, cc.Asset) ? (e.url = f + i.url, e.raw = !0) : (e.url = this.getLibUrlNoExt(t) + ".json", e.raw = !1), e
  21120. },
  21121. _uuidInSettings: function(t) {
  21122. return t in d
  21123. },
  21124. queryAssetInfo: function(t, e) {
  21125. var i = this._getAssetInfoInRuntime(t);
  21126. e(null, i.url, i.raw)
  21127. },
  21128. parseUuidInEditor: function(t) {},
  21129. loadJson: function(t, e) {
  21130. var i = "" + ((new Date).getTime() + Math.random()),
  21131. n = {
  21132. uuid: i,
  21133. type: "uuid",
  21134. content: t,
  21135. skips: [r.assetLoader.id, r.downloader.id]
  21136. };
  21137. r.load(n, (function(t, n) {
  21138. if (t) t = new Error("[AssetLibrary] loading JSON or dependencies failed: " + t.message);
  21139. else {
  21140. if (n.constructor === cc.SceneAsset) {
  21141. var s = cc.loader._getReferenceKey(i);
  21142. n.scene.dependAssets = a.getDependsRecursively(s)
  21143. }
  21144. if (p(n)) {
  21145. var o = cc.loader._getReferenceKey(i);
  21146. r.removeItem(o)
  21147. }
  21148. }
  21149. n._uuid = "", e && e(t, n)
  21150. }))
  21151. },
  21152. getAssetByUuid: function(t) {
  21153. return y._uuidToAsset[t] || null
  21154. },
  21155. init: function(t) {
  21156. var e = t.libraryPath;
  21157. if (e = e.replace(/\\/g, "/"), _ = cc.path.stripSep(e) + "/", f = t.rawAssetsBase, t.subpackages) {
  21158. var i = new c(t.subpackages);
  21159. cc.loader.insertPipeAfter(cc.loader.assetLoader, i), cc.loader.subPackPipe = i
  21160. }
  21161. var n = t.md5AssetsMap;
  21162. if (n && n.import) {
  21163. var a = 0,
  21164. p = 0,
  21165. y = u.createMap(!0),
  21166. v = n.import;
  21167. for (a = 0; a < v.length; a += 2) y[p = l(v[a])] = v[a + 1];
  21168. var g = u.createMap(!0);
  21169. for (v = n["raw-assets"], a = 0; a < v.length; a += 2) g[p = l(v[a])] = v[a + 1];
  21170. var x = new h(y, g, _);
  21171. cc.loader.insertPipeAfter(cc.loader.assetLoader, x), cc.loader.md5Pipe = x
  21172. }
  21173. var b = r._assetTables;
  21174. for (var A in b) b[A].reset();
  21175. var C = t.rawAssets;
  21176. if (C)
  21177. for (var T in C) {
  21178. var S = C[T];
  21179. for (var p in S) {
  21180. var w = S[p],
  21181. E = w[0],
  21182. M = w[1],
  21183. D = cc.js._getClassById(M);
  21184. if (D) {
  21185. d[p] = new m(T + "/" + E, D);
  21186. var B = cc.path.extname(E);
  21187. B && (E = E.slice(0, -B.length));
  21188. var I = 1 === w[2];
  21189. b[T] || (b[T] = new s), b[T].add(E, p, D, !I)
  21190. } else cc.error("Cannot get", M)
  21191. }
  21192. }
  21193. t.packedAssets && o.initPacks(t.packedAssets), cc.url._init(t.mountPaths && t.mountPaths.assets || f + "assets")
  21194. },
  21195. _uuidToAsset: {}
  21196. },
  21197. v = {
  21198. effect: {},
  21199. material: {}
  21200. },
  21201. g = {};
  21202. function x(t, e, i) {
  21203. var n = t + "s",
  21204. r = v[t] = {},
  21205. s = "internal";
  21206. cc.loader.loadResDir(n, e, s, (function() {}), (function(t, e) {
  21207. if (t) cc.error(t);
  21208. else
  21209. for (var n = 0; n < e.length; n++) {
  21210. var s = e[n];
  21211. cc.loader.getDependsRecursively(s).forEach((function(t) {
  21212. return g[t] = !0
  21213. })), r["" + s.name] = s
  21214. }
  21215. i()
  21216. }))
  21217. }
  21218. y._loadBuiltins = function(t) {
  21219. if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) return t && t();
  21220. x("effect", cc.EffectAsset, (function() {
  21221. x("material", cc.Material, t)
  21222. }))
  21223. }, y.getBuiltin = function(t, e) {
  21224. return v[t][e]
  21225. }, y.getBuiltins = function(t) {
  21226. return t ? v[t] : v
  21227. }, y.resetBuiltins = function() {
  21228. v = {
  21229. effect: {},
  21230. material: {}
  21231. }, g = {}
  21232. }, y.getBuiltinDeps = function() {
  21233. return g
  21234. }, e.exports = cc.AssetLibrary = y
  21235. }), {
  21236. "../assets/CCAsset": 56,
  21237. "../load-pipeline/CCLoader": 145,
  21238. "../load-pipeline/asset-table": 147,
  21239. "../load-pipeline/auto-release-utils": 149,
  21240. "../load-pipeline/md5-pipe": 156,
  21241. "../load-pipeline/pack-downloader": 157,
  21242. "../load-pipeline/subpackage-pipe": 160,
  21243. "../utils/decode-uuid": 294,
  21244. "./js": 218,
  21245. "./utils": 222
  21246. }],
  21247. 198: [(function(t, e, i) {
  21248. "use strict";
  21249. var n = t("./js"),
  21250. r = t("./CCEnum"),
  21251. s = t("./utils"),
  21252. o = (s.isPlainEmptyObj_DEV, s.cloneable_DEV, t("./attribute")),
  21253. a = o.DELIMETER,
  21254. l = t("./preprocess-class");
  21255. t("./requiring-frame");
  21256. var h = ["name", "extends", "mixins", "ctor", "__ctor__", "properties", "statics", "editor", "__ES6__"];
  21257. function c(t, e) {
  21258. t.indexOf(e) < 0 && t.push(e)
  21259. }
  21260. var u = {
  21261. datas: null,
  21262. push: function(t) {
  21263. if (this.datas) this.datas.push(t);
  21264. else {
  21265. this.datas = [t];
  21266. var e = this;
  21267. setTimeout((function() {
  21268. e.init()
  21269. }), 0)
  21270. }
  21271. },
  21272. init: function() {
  21273. var t = this.datas;
  21274. if (t) {
  21275. for (var e = 0; e < t.length; ++e) {
  21276. var i = t[e],
  21277. r = i.cls,
  21278. s = i.props;
  21279. "function" == typeof s && (s = s());
  21280. var o = n.getClassName(r);
  21281. s ? M(r, o, s, r.$super, i.mixins) : cc.errorID(3633, o)
  21282. }
  21283. this.datas = null
  21284. }
  21285. }
  21286. };
  21287. function _(t, e) {
  21288. c(t.__props__, e)
  21289. }
  21290. function f(t, e, i, n, r) {
  21291. var s = n.default;
  21292. o.setClassAttr(t, i, "default", s), _(t, i), I(t, n, e, i, !1)
  21293. }
  21294. function d(t, e, i, r, s) {
  21295. var a = r.get,
  21296. l = r.set,
  21297. h = t.prototype,
  21298. c = Object.getOwnPropertyDescriptor(h, i),
  21299. u = !c;
  21300. a && (I(t, r, e, i, !0), o.setClassAttr(t, i, "serializable", !1), s || n.get(h, i, a, u, u)), l && (s || n.set(h, i, l, u, u))
  21301. }
  21302. function p(t) {
  21303. return "function" == typeof t ? t() : t
  21304. }
  21305. function m(t, e, i) {
  21306. for (var r in e) t.hasOwnProperty(r) || i && !i(r) || Object.defineProperty(t, r, n.getPropertyDescriptor(e, r))
  21307. }
  21308. function y(t, e, i, r) {
  21309. var s, a, l = r.__ctor__,
  21310. h = r.ctor,
  21311. c = r.__ES6__;
  21312. c ? (s = [h], a = h) : (s = l ? [l] : S(e, i, r), a = T(s, e, t, r), n.value(a, "extend", (function(t) {
  21313. return t.extends = this, D(t)
  21314. }), !0)), n.value(a, "__ctors__", s.length > 0 ? s : null, !0);
  21315. var u = a.prototype;
  21316. if (e && (c || (n.extend(a, e), u = a.prototype), a.$super = e), i) {
  21317. for (var _ = i.length - 1; _ >= 0; _--) {
  21318. var f = i[_];
  21319. m(u, f.prototype), m(a, f, (function(t) {
  21320. return f.hasOwnProperty(t) && !0
  21321. })), D._isCCClass(f) && m(o.getClassAttrs(a), o.getClassAttrs(f))
  21322. }
  21323. u.constructor = a
  21324. }
  21325. return c || (u.__initProps__ = C), n.setClassName(t, a), a
  21326. }
  21327. function v(t, e, i, r) {
  21328. var s = cc.Component,
  21329. o = cc._RF.peek();
  21330. if (o && n.isChildClassOf(e, s)) {
  21331. if (n.isChildClassOf(o.cls, s)) return cc.errorID(3615), null;
  21332. 0, t = t || o.script
  21333. }
  21334. var a = y(t, e, i, r);
  21335. if (o)
  21336. if (n.isChildClassOf(e, s)) {
  21337. var l = o.uuid;
  21338. l && n._setClassId(l, a), o.cls = a
  21339. } else n.isChildClassOf(o.cls, s) || (o.cls = a);
  21340. return a
  21341. }
  21342. function g(t) {
  21343. for (var e = n.getClassName(t), i = t.constructor, r = "new " + e + "(", s = 0; s < i.__props__.length; s++) {
  21344. var o = t[i.__props__[s]];
  21345. 0, r += o, s < i.__props__.length - 1 && (r += ",")
  21346. }
  21347. return r + ")"
  21348. }
  21349. function x(t) {
  21350. return JSON.stringify(t).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")
  21351. }
  21352. function b(t, e) {
  21353. for (var i = [], n = "", r = 0; r < e.length; r++) {
  21354. var s = e[r],
  21355. o = s + a + "default";
  21356. if (o in t) {
  21357. var l, h;
  21358. l = A.test(s) ? "this." + s + "=" : "this[" + x(s) + "]=";
  21359. var c = t[o];
  21360. if ("object" == typeof c && c) h = c instanceof cc.ValueType ? g(c) : Array.isArray(c) ? "[]" : "{}";
  21361. else if ("function" == typeof c) {
  21362. var u = i.length;
  21363. i.push(c), h = "F[" + u + "]()"
  21364. } else h = "string" == typeof c ? x(c) : c;
  21365. n += l = l + h + ";\n"
  21366. }
  21367. }
  21368. return 0 === i.length ? Function(n) : Function("F", "return (function(){\n" + n + "})")(i)
  21369. }
  21370. var A = /^[A-Za-z_$][0-9A-Za-z_$]*$/;
  21371. function C(t) {
  21372. var e = o.getClassAttrs(t),
  21373. i = t.__props__;
  21374. null === i && (u.init(), i = t.__props__);
  21375. var n = b(e, i);
  21376. t.prototype.__initProps__ = n, n.call(this)
  21377. }
  21378. var T = function(t, e, i, n) {
  21379. var r = "return function CCClass(){\n";
  21380. e && E(e, n, i) && (r += "this._super=null;\n"), r += "this.__initProps__(CCClass);\n";
  21381. var s = t.length;
  21382. if (s > 0) {
  21383. 0;
  21384. var o = "].apply(this,arguments);\n";
  21385. if (1 === s) r += "CCClass.__ctors__[0" + o;
  21386. else {
  21387. r += "var cs=CCClass.__ctors__;\n";
  21388. for (var a = 0; a < s; a++) r += "cs[" + a + o
  21389. }
  21390. 0
  21391. }
  21392. return r += "}", Function(r)()
  21393. };
  21394. function S(t, e, i) {
  21395. function n(t) {
  21396. return D._isCCClass(t) ? t.__ctors__ || [] : [t]
  21397. }
  21398. for (var r = [], s = [t].concat(e), o = 0; o < s.length; o++) {
  21399. var a = s[o];
  21400. if (a)
  21401. for (var l = n(a), h = 0; h < l.length; h++) c(r, l[h])
  21402. }
  21403. var u = i.ctor;
  21404. return u && r.push(u), r
  21405. }
  21406. var w = /xyz/.test((function() {
  21407. xyz
  21408. })) ? /\b\._super\b/ : /.*/;
  21409. /xyz/.test((function() {
  21410. xyz
  21411. }));
  21412. function E(t, e, i) {
  21413. var r = !1;
  21414. for (var s in e)
  21415. if (!(h.indexOf(s) >= 0)) {
  21416. var o = e[s];
  21417. if ("function" == typeof o) {
  21418. var a = n.getPropertyDescriptor(t.prototype, s);
  21419. if (a) {
  21420. var l = a.value;
  21421. if ("function" == typeof l) {
  21422. w.test(o) && (r = !0, e[s] = (function(t, e) {
  21423. return function() {
  21424. var i = this._super;
  21425. this._super = t;
  21426. var n = e.apply(this, arguments);
  21427. return this._super = i, n
  21428. }
  21429. })(l, o));
  21430. continue
  21431. }
  21432. }
  21433. 0
  21434. }
  21435. }
  21436. return r
  21437. }
  21438. function M(t, e, i, n, r, s) {
  21439. if (t.__props__ = [], n && n.__props__ && (t.__props__ = n.__props__.slice()), r)
  21440. for (var h = 0; h < r.length; ++h) {
  21441. var c = r[h];
  21442. c.__props__ && (t.__props__ = t.__props__.concat(c.__props__.filter((function(e) {
  21443. return t.__props__.indexOf(e) < 0
  21444. }))))
  21445. }
  21446. if (i)
  21447. for (var u in l.preprocessAttrs(i, e, t, s), i) {
  21448. var _ = i[u];
  21449. "default" in _ ? f(t, e, u, _) : d(t, e, u, _, s)
  21450. }
  21451. var p = o.getClassAttrs(t);
  21452. t.__values__ = t.__props__.filter((function(t) {
  21453. return !1 !== p[t + a + "serializable"]
  21454. }))
  21455. }
  21456. function D(t) {
  21457. var e = (t = t || {}).name,
  21458. i = t.extends,
  21459. r = t.mixins,
  21460. s = v(e, i, r, t);
  21461. e || (e = cc.js.getClassName(s)), s._sealed = !0, i && (i._sealed = !1);
  21462. var o = t.properties;
  21463. "function" == typeof o || i && null === i.__props__ || r && r.some((function(t) {
  21464. return null === t.__props__
  21465. })) ? (u.push({
  21466. cls: s,
  21467. props: o,
  21468. mixins: r
  21469. }), s.__props__ = s.__values__ = null) : M(s, e, o, i, t.mixins, t.__ES6__);
  21470. var a, c = t.statics;
  21471. if (c)
  21472. for (a in c) s[a] = c[a];
  21473. for (var _ in t)
  21474. if (!(h.indexOf(_) >= 0)) {
  21475. var f = t[_];
  21476. l.validateMethodWithProps(f, _, e, s, i) && n.value(s.prototype, _, f, !0, !0)
  21477. }
  21478. var d = t.editor;
  21479. return d && n.isChildClassOf(i, cc.Component) && cc.Component._registerEditorProps(s, d), s
  21480. }
  21481. D._isCCClass = function(t) {
  21482. return t && t.hasOwnProperty("__ctors__")
  21483. }, D._fastDefine = function(t, e, i) {
  21484. n.setClassName(t, e);
  21485. for (var r = e.__props__ = e.__values__ = Object.keys(i), s = o.getClassAttrs(e), l = 0; l < r.length; l++) {
  21486. var h = r[l];
  21487. s[h + a + "visible"] = !1, s[h + a + "default"] = i[h]
  21488. }
  21489. }, D.Attr = o, D.attr = o.attr, D.getInheritanceChain = function(t) {
  21490. for (var e = []; t = n.getSuper(t);) t !== Object && e.push(t);
  21491. return e
  21492. };
  21493. var B = {
  21494. Integer: "Number",
  21495. Float: "Number",
  21496. Boolean: "Boolean",
  21497. String: "String"
  21498. };
  21499. function I(t, e, i, n, s) {
  21500. var l = null,
  21501. h = "";
  21502. function c() {
  21503. return h = n + a, l = o.getClassAttrs(t)
  21504. }
  21505. var u = e.type;
  21506. if (u) {
  21507. var _ = B[u];
  21508. _ ? (l || c())[h + "type"] = u : "Object" === u || (u === o.ScriptUuid ? ((l || c())[h + "type"] = "Script", l[h + "ctor"] = cc.ScriptAsset) : "object" == typeof u ? r.isEnum(u) && ((l || c())[h + "type"] = "Enum", l[h + "enumList"] = r.getList(u)) : "function" == typeof u && ((l || c())[h + "type"] = "Object", l[h + "ctor"] = u))
  21509. }
  21510. function f(t, i) {
  21511. if (t in e) {
  21512. var n = e[t];
  21513. typeof n === i && ((l || c())[h + t] = n)
  21514. }
  21515. }
  21516. e.editorOnly && ((l || c())[h + "editorOnly"] = !0), e.url && ((l || c())[h + "saveUrlAsAsset"] = !0), !1 === e.serializable && ((l || c())[h + "serializable"] = !1), f("formerlySerializedAs", "string");
  21517. var d = e.range;
  21518. d && Array.isArray(d) && d.length >= 2 && ((l || c())[h + "min"] = d[0], l[h + "max"] = d[1], d.length > 2 && (l[h + "step"] = d[2])), f("min", "number"), f("max", "number"), f("step", "number")
  21519. }
  21520. cc.Class = D, e.exports = {
  21521. isArray: function(t) {
  21522. return t = p(t), Array.isArray(t)
  21523. },
  21524. fastDefine: D._fastDefine,
  21525. getNewValueTypeCode: g,
  21526. IDENTIFIER_RE: A,
  21527. escapeForJS: x,
  21528. getDefault: p
  21529. }
  21530. }), {
  21531. "./CCEnum": 200,
  21532. "./attribute": 210,
  21533. "./js": 218,
  21534. "./preprocess-class": 219,
  21535. "./requiring-frame": 220,
  21536. "./utils": 222
  21537. }],
  21538. 199: [(function(t, e, i) {
  21539. "use strict";
  21540. t("./CCClass");
  21541. var n = t("./preprocess-class"),
  21542. r = t("./js"),
  21543. s = "__ccclassCache__";
  21544. function o(t) {
  21545. return t
  21546. }
  21547. function a(t, e) {
  21548. return t[e] || (t[e] = {})
  21549. }
  21550. function l(t) {
  21551. return function(e) {
  21552. return "function" == typeof e ? t(e) : function(i) {
  21553. return t(i, e)
  21554. }
  21555. }
  21556. }
  21557. function h(t, e, i) {
  21558. return function(t) {
  21559. return function(i) {
  21560. return e(i, t)
  21561. }
  21562. }
  21563. }
  21564. var c = h.bind(null, !1);
  21565. function u(t) {
  21566. return h.bind(null, !1)
  21567. }
  21568. var _ = u(),
  21569. f = u();
  21570. function d(t, e) {
  21571. return a(t, s)
  21572. }
  21573. function p(t) {
  21574. var e;
  21575. try {
  21576. e = t()
  21577. } catch (e) {
  21578. return t
  21579. }
  21580. return "object" != typeof e || null === e ? e : t
  21581. }
  21582. function m(t) {
  21583. var e;
  21584. try {
  21585. e = new t
  21586. } catch (t) {
  21587. return {}
  21588. }
  21589. return e
  21590. }
  21591. function y(t, e, i, s, o, a) {
  21592. var l;
  21593. s && (l = n.getFullFormOfProperty(s));
  21594. var h = e[i],
  21595. c = r.mixin(h || {}, l || s || {});
  21596. if (o && (o.get || o.set)) {
  21597. o.get && (c.get = o.get), o.set && (c.set = o.set)
  21598. } else {
  21599. 0;
  21600. var u = void 0;
  21601. if (o) o.initializer && (u = p(o.initializer), !0);
  21602. else {
  21603. var _ = a.default || (a.default = m(t));
  21604. _.hasOwnProperty(i) && (u = _[i], !0)
  21605. }
  21606. 0, c.default = u
  21607. }
  21608. e[i] = c
  21609. }
  21610. var v = l((function(t, e) {
  21611. var i = r.getSuper(t);
  21612. i === Object && (i = null);
  21613. var n = {
  21614. name: e,
  21615. extends: i,
  21616. ctor: t,
  21617. __ES6__: !0
  21618. },
  21619. o = t[s];
  21620. if (o) {
  21621. var a = o.proto;
  21622. a && r.mixin(n, a), t[s] = void 0
  21623. }
  21624. return cc.Class(n)
  21625. }));
  21626. function g(t, e, i) {
  21627. return t((function(t, n) {
  21628. var r = d(t);
  21629. if (r) {
  21630. var s = void 0 !== i ? i : n;
  21631. a(a(r, "proto"), "editor")[e] = s
  21632. }
  21633. }), e)
  21634. }
  21635. function x(t) {
  21636. return t(o)
  21637. }
  21638. var b = x(l),
  21639. A = g(c, "requireComponent"),
  21640. C = x(_),
  21641. T = g(f, "executionOrder"),
  21642. S = x(l),
  21643. w = x(l),
  21644. E = x(_),
  21645. M = x(_),
  21646. D = x(_);
  21647. cc._decorator = e.exports = {
  21648. ccclass: v,
  21649. property: function(t, e, i) {
  21650. var n = null;
  21651. function r(t, e, i) {
  21652. var r = d(t.constructor);
  21653. if (r) {
  21654. var s = a(a(r, "proto"), "properties");
  21655. y(t.constructor, s, e, n, i, r)
  21656. }
  21657. }
  21658. if (void 0 === e) return n = t, r;
  21659. r(t, e, i)
  21660. },
  21661. executeInEditMode: b,
  21662. requireComponent: A,
  21663. menu: C,
  21664. executionOrder: T,
  21665. disallowMultiple: S,
  21666. playOnFocus: w,
  21667. inspector: E,
  21668. icon: M,
  21669. help: D,
  21670. mixins: function() {
  21671. for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
  21672. return function(e) {
  21673. var i = d(e);
  21674. i && (a(i, "proto").mixins = t)
  21675. }
  21676. }
  21677. }
  21678. }), {
  21679. "./CCClass": 198,
  21680. "./js": 218,
  21681. "./preprocess-class": 219,
  21682. "./utils": 222
  21683. }],
  21684. 200: [(function(t, e, i) {
  21685. "use strict";
  21686. var n = t("./js");
  21687. function r(t) {
  21688. if ("__enums__" in t) return t;
  21689. n.value(t, "__enums__", null, !0);
  21690. for (var e = -1, i = Object.keys(t), r = 0; r < i.length; r++) {
  21691. var s = i[r],
  21692. o = t[s];
  21693. if (-1 === o) o = ++e, t[s] = o;
  21694. else if ("number" == typeof o) e = o;
  21695. else if ("string" == typeof o && Number.isInteger(parseFloat(s))) continue;
  21696. var a = "" + o;
  21697. s !== a && n.value(t, a, s)
  21698. }
  21699. return t
  21700. }
  21701. r.isEnum = function(t) {
  21702. return t && t.hasOwnProperty("__enums__")
  21703. }, r.getList = function(t) {
  21704. if (t.__enums__) return t.__enums__;
  21705. var e = t.__enums__ = [];
  21706. for (var i in t) {
  21707. var n = t[i];
  21708. Number.isInteger(n) && e.push({
  21709. name: i,
  21710. value: n
  21711. })
  21712. }
  21713. return e.sort((function(t, e) {
  21714. return t.value - e.value
  21715. })), e
  21716. }, e.exports = cc.Enum = r
  21717. }), {
  21718. "./js": 218
  21719. }],
  21720. 201: [(function(t, e, i) {
  21721. "use strict";
  21722. var n = t("../event-manager"),
  21723. r = t("./CCInputManager"),
  21724. s = void 0;
  21725. cc.Acceleration = function(t, e, i, n) {
  21726. this.x = t || 0, this.y = e || 0, this.z = i || 0, this.timestamp = n || 0
  21727. }, r.setAccelerometerEnabled = function(t) {
  21728. var e = this;
  21729. if (e._accelEnabled !== t) {
  21730. e._accelEnabled = t;
  21731. var i = cc.director.getScheduler();
  21732. i.enableForTarget(e), e._accelEnabled ? (e._registerAccelerometerEvent(), e._accelCurTime = 0, i.scheduleUpdate(e)) : (e._unregisterAccelerometerEvent(), e._accelCurTime = 0, i.unscheduleUpdate(e))
  21733. }
  21734. }, r.setAccelerometerInterval = function(t) {
  21735. this._accelInterval !== t && (this._accelInterval = t)
  21736. }, r._registerKeyboardEvent = function() {
  21737. cc.game.canvas.addEventListener("keydown", (function(t) {
  21738. n.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode, !0)), t.stopPropagation(), t.preventDefault()
  21739. }), !1), cc.game.canvas.addEventListener("keyup", (function(t) {
  21740. n.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode, !1)), t.stopPropagation(), t.preventDefault()
  21741. }), !1)
  21742. }, r._registerAccelerometerEvent = function() {
  21743. var t = window,
  21744. e = this;
  21745. e._acceleration = new cc.Acceleration, e._accelDeviceEvent = t.DeviceMotionEvent || t.DeviceOrientationEvent, cc.sys.browserType === cc.sys.BROWSER_TYPE_MOBILE_QQ && (e._accelDeviceEvent = window.DeviceOrientationEvent);
  21746. var i = e._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation",
  21747. n = navigator.userAgent;
  21748. (/Android/.test(n) || /Adr/.test(n) && cc.sys.browserType === cc.BROWSER_TYPE_UC) && (e._minus = -1), s = e.didAccelerate.bind(e), t.addEventListener(i, s, !1)
  21749. }, r._unregisterAccelerometerEvent = function() {
  21750. var t = window,
  21751. e = this._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation";
  21752. s && t.removeEventListener(e, s, !1)
  21753. }, r.didAccelerate = function(t) {
  21754. var e = this,
  21755. i = window;
  21756. if (e._accelEnabled) {
  21757. var n = e._acceleration,
  21758. r = void 0,
  21759. s = void 0,
  21760. o = void 0;
  21761. if (e._accelDeviceEvent === window.DeviceMotionEvent) {
  21762. var a = t.accelerationIncludingGravity;
  21763. r = e._accelMinus * a.x * .1, s = e._accelMinus * a.y * .1, o = .1 * a.z
  21764. } else r = t.gamma / 90 * .981, s = -t.beta / 90 * .981, o = t.alpha / 90 * .981;
  21765. if (cc.view._isRotated) {
  21766. var l = r;
  21767. r = -s, s = l
  21768. }
  21769. n.x = r, n.y = s, n.z = o, n.timestamp = t.timeStamp || Date.now();
  21770. var h = n.x;
  21771. 90 === i.orientation ? (n.x = -n.y, n.y = h) : -90 === i.orientation ? (n.x = n.y, n.y = -h) : 180 === i.orientation && (n.x = -n.x, n.y = -n.y), cc.sys.os === cc.sys.OS_ANDROID && cc.sys.browserType !== cc.sys.BROWSER_TYPE_MOBILE_QQ && (n.x = -n.x, n.y = -n.y)
  21772. }
  21773. }
  21774. }), {
  21775. "../event-manager": 129,
  21776. "./CCInputManager": 202
  21777. }],
  21778. 202: [(function(t, e, i) {
  21779. "use strict";
  21780. var n = t("./CCMacro"),
  21781. r = t("./CCSys"),
  21782. s = t("../event-manager"),
  21783. o = n.TOUCH_TIMEOUT,
  21784. a = cc.v2(),
  21785. l = {
  21786. _mousePressed: !1,
  21787. _isRegisterEvent: !1,
  21788. _preTouchPoint: cc.v2(0, 0),
  21789. _prevMousePoint: cc.v2(0, 0),
  21790. _preTouchPool: [],
  21791. _preTouchPoolPointer: 0,
  21792. _touches: [],
  21793. _touchesIntegerDict: {},
  21794. _indexBitsUsed: 0,
  21795. _maxTouches: 8,
  21796. _accelEnabled: !1,
  21797. _accelInterval: .2,
  21798. _accelMinus: 1,
  21799. _accelCurTime: 0,
  21800. _acceleration: null,
  21801. _accelDeviceEvent: null,
  21802. _canvasBoundingRect: {
  21803. left: 0,
  21804. top: 0,
  21805. adjustedLeft: 0,
  21806. adjustedTop: 0,
  21807. width: 0,
  21808. height: 0
  21809. },
  21810. _getUnUsedIndex: function() {
  21811. for (var t = this._indexBitsUsed, e = cc.sys.now(), i = 0; i < this._maxTouches; i++) {
  21812. if (!(1 & t)) return this._indexBitsUsed |= 1 << i, i;
  21813. var n = this._touches[i];
  21814. if (e - n._lastModified > o) return this._removeUsedIndexBit(i), delete this._touchesIntegerDict[n.getID()], i;
  21815. t >>= 1
  21816. }
  21817. return -1
  21818. },
  21819. _removeUsedIndexBit: function(t) {
  21820. if (!(t < 0 || t >= this._maxTouches)) {
  21821. var e = 1 << t;
  21822. e = ~e, this._indexBitsUsed &= e
  21823. }
  21824. },
  21825. _glView: null,
  21826. _updateCanvasBoundingRect: function() {
  21827. var t = cc.game.canvas,
  21828. e = this._canvasBoundingRect,
  21829. i = document.documentElement,
  21830. n = window.pageXOffset - i.clientLeft,
  21831. r = window.pageYOffset - i.clientTop;
  21832. if (t.getBoundingClientRect) {
  21833. var s = t.getBoundingClientRect();
  21834. e.left = s.left + n, e.top = s.top + r, e.width = s.width, e.height = s.height
  21835. } else t instanceof HTMLCanvasElement ? (e.left = n, e.top = r, e.width = t.width, e.height = t.height) : (e.left = n, e.top = r, e.width = parseInt(t.style.width), e.height = parseInt(t.style.height))
  21836. },
  21837. handleTouchesBegin: function(t) {
  21838. for (var e = void 0, i = void 0, n = void 0, o = [], a = this._touchesIntegerDict, l = r.now(), h = 0, c = t.length; h < c; h++)
  21839. if (null == a[n = (e = t[h]).getID()]) {
  21840. var u = this._getUnUsedIndex();
  21841. if (-1 === u) {
  21842. cc.logID(2300, u);
  21843. continue
  21844. }(i = this._touches[u] = new cc.Touch(e._point.x, e._point.y, e.getID()))._lastModified = l, i._setPrevPoint(e._prevPoint), a[n] = u, o.push(i)
  21845. }
  21846. if (o.length > 0) {
  21847. this._glView._convertTouchesWithScale(o);
  21848. var _ = new cc.Event.EventTouch(o);
  21849. _._eventCode = cc.Event.EventTouch.BEGAN, s.dispatchEvent(_)
  21850. }
  21851. },
  21852. handleTouchesMove: function(t) {
  21853. for (var e = void 0, i = void 0, n = void 0, o = [], a = this._touches, l = r.now(), h = 0, c = t.length; h < c; h++) n = (e = t[h]).getID(), null != (i = this._touchesIntegerDict[n]) && a[i] && (a[i]._setPoint(e._point), a[i]._setPrevPoint(e._prevPoint), a[i]._lastModified = l, o.push(a[i]));
  21854. if (o.length > 0) {
  21855. this._glView._convertTouchesWithScale(o);
  21856. var u = new cc.Event.EventTouch(o);
  21857. u._eventCode = cc.Event.EventTouch.MOVED, s.dispatchEvent(u)
  21858. }
  21859. },
  21860. handleTouchesEnd: function(t) {
  21861. var e = this.getSetOfTouchesEndOrCancel(t);
  21862. if (e.length > 0) {
  21863. this._glView._convertTouchesWithScale(e);
  21864. var i = new cc.Event.EventTouch(e);
  21865. i._eventCode = cc.Event.EventTouch.ENDED, s.dispatchEvent(i)
  21866. }
  21867. this._preTouchPool.length = 0
  21868. },
  21869. handleTouchesCancel: function(t) {
  21870. var e = this.getSetOfTouchesEndOrCancel(t);
  21871. if (e.length > 0) {
  21872. this._glView._convertTouchesWithScale(e);
  21873. var i = new cc.Event.EventTouch(e);
  21874. i._eventCode = cc.Event.EventTouch.CANCELLED, s.dispatchEvent(i)
  21875. }
  21876. this._preTouchPool.length = 0
  21877. },
  21878. getSetOfTouchesEndOrCancel: function(t) {
  21879. for (var e = void 0, i = void 0, n = void 0, r = [], s = this._touches, o = this._touchesIntegerDict, a = 0, l = t.length; a < l; a++) null != (i = o[n = (e = t[a]).getID()]) && s[i] && (s[i]._setPoint(e._point), s[i]._setPrevPoint(e._prevPoint), r.push(s[i]), this._removeUsedIndexBit(i), delete o[n]);
  21880. return r
  21881. },
  21882. getPreTouch: function(t) {
  21883. for (var e = null, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--)
  21884. if (i[r].getID() === n) {
  21885. e = i[r];
  21886. break
  21887. }
  21888. return e || (e = t), e
  21889. },
  21890. setPreTouch: function(t) {
  21891. for (var e = !1, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--)
  21892. if (i[r].getID() === n) {
  21893. i[r] = t, e = !0;
  21894. break
  21895. }
  21896. e || (i.length <= 50 ? i.push(t) : (i[this._preTouchPoolPointer] = t, this._preTouchPoolPointer = (this._preTouchPoolPointer + 1) % 50))
  21897. },
  21898. getTouchByXY: function(t, e, i) {
  21899. var n = this._preTouchPoint,
  21900. r = this._glView.convertToLocationInView(t, e, i),
  21901. s = new cc.Touch(r.x, r.y, 0);
  21902. return s._setPrevPoint(n.x, n.y), n.x = r.x, n.y = r.y, s
  21903. },
  21904. getMouseEvent: function(t, e, i) {
  21905. var n = this._prevMousePoint,
  21906. r = new cc.Event.EventMouse(i);
  21907. return r._setPrevCursor(n.x, n.y), n.x = t.x, n.y = t.y, this._glView._convertMouseToLocationInView(n, e), r.setLocation(n.x, n.y), r
  21908. },
  21909. getPointByEvent: function(t, e) {
  21910. return null != t.pageX ? {
  21911. x: t.pageX,
  21912. y: t.pageY
  21913. } : (e.left -= document.body.scrollLeft, e.top -= document.body.scrollTop, {
  21914. x: t.clientX,
  21915. y: t.clientY
  21916. })
  21917. },
  21918. getTouchesByEvent: function(t, e) {
  21919. for (var i = [], n = this._glView, s = void 0, o = void 0, l = void 0, h = this._preTouchPoint, c = t.changedTouches.length, u = 0; u < c; u++)
  21920. if (s = t.changedTouches[u]) {
  21921. var _ = void 0;
  21922. _ = r.BROWSER_TYPE_FIREFOX === r.browserType ? n.convertToLocationInView(s.pageX, s.pageY, e, a) : n.convertToLocationInView(s.clientX, s.clientY, e, a), null != s.identifier ? (o = new cc.Touch(_.x, _.y, s.identifier), l = this.getPreTouch(o).getLocation(), o._setPrevPoint(l.x, l.y), this.setPreTouch(o)) : (o = new cc.Touch(_.x, _.y))._setPrevPoint(h.x, h.y), h.x = _.x, h.y = _.y, i.push(o)
  21923. }
  21924. return i
  21925. },
  21926. registerSystemEvent: function(t) {
  21927. if (!this._isRegisterEvent) {
  21928. this._glView = cc.view;
  21929. var e = this,
  21930. i = this._canvasBoundingRect;
  21931. window.addEventListener("resize", this._updateCanvasBoundingRect.bind(this));
  21932. var n = r.isMobile,
  21933. o = "mouse" in r.capabilities,
  21934. a = "touches" in r.capabilities;
  21935. if (o) {
  21936. n || (window.addEventListener("mousedown", (function() {
  21937. e._mousePressed = !0
  21938. }), !1), window.addEventListener("mouseup", (function(t) {
  21939. if (e._mousePressed) {
  21940. e._mousePressed = !1;
  21941. var n = e.getPointByEvent(t, i);
  21942. if (!cc.rect(i.left, i.top, i.width, i.height).contains(n)) {
  21943. e.handleTouchesEnd([e.getTouchByXY(n.x, n.y, i)]);
  21944. var r = e.getMouseEvent(n, i, cc.Event.EventMouse.UP);
  21945. r.setButton(t.button), s.dispatchEvent(r)
  21946. }
  21947. }
  21948. }), !1));
  21949. for (var l = cc.Event.EventMouse, h = [!n && ["mousedown", l.DOWN, function(i, n, r, s) {
  21950. e._mousePressed = !0, e.handleTouchesBegin([e.getTouchByXY(r.x, r.y, s)]), t.focus()
  21951. }], !n && ["mouseup", l.UP, function(t, i, n, r) {
  21952. e._mousePressed = !1, e.handleTouchesEnd([e.getTouchByXY(n.x, n.y, r)])
  21953. }], !n && ["mousemove", l.MOVE, function(t, i, n, r) {
  21954. e.handleTouchesMove([e.getTouchByXY(n.x, n.y, r)]), e._mousePressed || i.setButton(null)
  21955. }],
  21956. ["mousewheel", l.SCROLL, function(t, e) {
  21957. e.setScrollData(0, t.wheelDelta)
  21958. }],
  21959. ["DOMMouseScroll", l.SCROLL, function(t, e) {
  21960. e.setScrollData(0, -120 * t.detail)
  21961. }]
  21962. ], c = 0; c < h.length; ++c) {
  21963. var u = h[c];
  21964. u && (function() {
  21965. var n = u[0],
  21966. r = u[1],
  21967. o = u[2];
  21968. t.addEventListener(n, (function(t) {
  21969. var n = e.getPointByEvent(t, i),
  21970. a = e.getMouseEvent(n, i, r);
  21971. a.setButton(t.button), o(t, a, n, i), s.dispatchEvent(a), t.stopPropagation(), t.preventDefault()
  21972. }), !1)
  21973. })()
  21974. }
  21975. }
  21976. if (window.navigator.msPointerEnabled) {
  21977. var _ = {
  21978. MSPointerDown: e.handleTouchesBegin,
  21979. MSPointerMove: e.handleTouchesMove,
  21980. MSPointerUp: e.handleTouchesEnd,
  21981. MSPointerCancel: e.handleTouchesCancel
  21982. },
  21983. f = function(n) {
  21984. var r = _[n];
  21985. t.addEventListener(n, (function(t) {
  21986. var n = document.documentElement;
  21987. i.adjustedLeft = i.left - n.scrollLeft, i.adjustedTop = i.top - n.scrollTop, r.call(e, [e.getTouchByXY(t.clientX, t.clientY, i)]), t.stopPropagation()
  21988. }), !1)
  21989. };
  21990. for (var d in _) f(d)
  21991. }
  21992. if (a) {
  21993. var p = {
  21994. touchstart: function(i) {
  21995. e.handleTouchesBegin(i), t.focus()
  21996. },
  21997. touchmove: function(t) {
  21998. e.handleTouchesMove(t)
  21999. },
  22000. touchend: function(t) {
  22001. e.handleTouchesEnd(t)
  22002. },
  22003. touchcancel: function(t) {
  22004. e.handleTouchesCancel(t)
  22005. }
  22006. },
  22007. m = function(n) {
  22008. var r = p[n];
  22009. t.addEventListener(n, (function(t) {
  22010. if (t.changedTouches) {
  22011. var n = document.body;
  22012. i.adjustedLeft = i.left - (n.scrollLeft || 0), i.adjustedTop = i.top - (n.scrollTop || 0), r(e.getTouchesByEvent(t, i)), t.stopPropagation(), t.preventDefault()
  22013. }
  22014. }), !1)
  22015. };
  22016. for (var d in p) m(d)
  22017. }
  22018. this._registerKeyboardEvent(), this._isRegisterEvent = !0
  22019. }
  22020. },
  22021. _registerKeyboardEvent: function() {},
  22022. _registerAccelerometerEvent: function() {},
  22023. update: function(t) {
  22024. this._accelCurTime > this._accelInterval && (this._accelCurTime -= this._accelInterval, s.dispatchEvent(new cc.Event.EventAcceleration(this._acceleration))), this._accelCurTime += t
  22025. }
  22026. };
  22027. e.exports = _cc.inputManager = l
  22028. }), {
  22029. "../event-manager": 129,
  22030. "./CCMacro": 203,
  22031. "./CCSys": 207
  22032. }],
  22033. 203: [(function(t, e, i) {
  22034. "use strict";
  22035. cc.macro = {
  22036. RAD: Math.PI / 180,
  22037. DEG: 180 / Math.PI,
  22038. REPEAT_FOREVER: Number.MAX_VALUE - 1,
  22039. FLT_EPSILON: 1.192092896e-7,
  22040. MIN_ZINDEX: -Math.pow(2, 15),
  22041. MAX_ZINDEX: Math.pow(2, 15) - 1,
  22042. ONE: 1,
  22043. ZERO: 0,
  22044. SRC_ALPHA: 770,
  22045. SRC_ALPHA_SATURATE: 776,
  22046. SRC_COLOR: 768,
  22047. DST_ALPHA: 772,
  22048. DST_COLOR: 774,
  22049. ONE_MINUS_SRC_ALPHA: 771,
  22050. ONE_MINUS_SRC_COLOR: 769,
  22051. ONE_MINUS_DST_ALPHA: 773,
  22052. ONE_MINUS_DST_COLOR: 775,
  22053. ONE_MINUS_CONSTANT_ALPHA: 32772,
  22054. ONE_MINUS_CONSTANT_COLOR: 32770,
  22055. ORIENTATION_PORTRAIT: 1,
  22056. ORIENTATION_LANDSCAPE: 2,
  22057. ORIENTATION_AUTO: 3,
  22058. DENSITYDPI_DEVICE: "device-dpi",
  22059. DENSITYDPI_HIGH: "high-dpi",
  22060. DENSITYDPI_MEDIUM: "medium-dpi",
  22061. DENSITYDPI_LOW: "low-dpi",
  22062. FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: !0,
  22063. DIRECTOR_STATS_POSITION: cc.v2(0, 0),
  22064. ENABLE_STACKABLE_ACTIONS: !0,
  22065. TOUCH_TIMEOUT: 5e3,
  22066. BATCH_VERTEX_COUNT: 2e4,
  22067. ENABLE_TILEDMAP_CULLING: !0,
  22068. DOWNLOAD_MAX_CONCURRENT: 64,
  22069. ENABLE_TRANSPARENT_CANVAS: !1,
  22070. ENABLE_WEBGL_ANTIALIAS: !1,
  22071. ENABLE_CULLING: !1,
  22072. CLEANUP_IMAGE_CACHE: !1,
  22073. SHOW_MESH_WIREFRAME: !1,
  22074. ROTATE_ACTION_CCW: !1
  22075. };
  22076. cc.macro.SUPPORT_TEXTURE_FORMATS = [".pkm", ".pvr", ".webp", ".jpg", ".jpeg", ".bmp", ".png"], cc.macro.KEY = {
  22077. none: 0,
  22078. back: 6,
  22079. menu: 18,
  22080. backspace: 8,
  22081. tab: 9,
  22082. enter: 13,
  22083. shift: 16,
  22084. ctrl: 17,
  22085. alt: 18,
  22086. pause: 19,
  22087. capslock: 20,
  22088. escape: 27,
  22089. space: 32,
  22090. pageup: 33,
  22091. pagedown: 34,
  22092. end: 35,
  22093. home: 36,
  22094. left: 37,
  22095. up: 38,
  22096. right: 39,
  22097. down: 40,
  22098. select: 41,
  22099. insert: 45,
  22100. Delete: 46,
  22101. 0: 48,
  22102. 1: 49,
  22103. 2: 50,
  22104. 3: 51,
  22105. 4: 52,
  22106. 5: 53,
  22107. 6: 54,
  22108. 7: 55,
  22109. 8: 56,
  22110. 9: 57,
  22111. a: 65,
  22112. b: 66,
  22113. c: 67,
  22114. d: 68,
  22115. e: 69,
  22116. f: 70,
  22117. g: 71,
  22118. h: 72,
  22119. i: 73,
  22120. j: 74,
  22121. k: 75,
  22122. l: 76,
  22123. m: 77,
  22124. n: 78,
  22125. o: 79,
  22126. p: 80,
  22127. q: 81,
  22128. r: 82,
  22129. s: 83,
  22130. t: 84,
  22131. u: 85,
  22132. v: 86,
  22133. w: 87,
  22134. x: 88,
  22135. y: 89,
  22136. z: 90,
  22137. num0: 96,
  22138. num1: 97,
  22139. num2: 98,
  22140. num3: 99,
  22141. num4: 100,
  22142. num5: 101,
  22143. num6: 102,
  22144. num7: 103,
  22145. num8: 104,
  22146. num9: 105,
  22147. "*": 106,
  22148. "+": 107,
  22149. "-": 109,
  22150. numdel: 110,
  22151. "/": 111,
  22152. f1: 112,
  22153. f2: 113,
  22154. f3: 114,
  22155. f4: 115,
  22156. f5: 116,
  22157. f6: 117,
  22158. f7: 118,
  22159. f8: 119,
  22160. f9: 120,
  22161. f10: 121,
  22162. f11: 122,
  22163. f12: 123,
  22164. numlock: 144,
  22165. scrolllock: 145,
  22166. ";": 186,
  22167. semicolon: 186,
  22168. equal: 187,
  22169. "=": 187,
  22170. ",": 188,
  22171. comma: 188,
  22172. dash: 189,
  22173. ".": 190,
  22174. period: 190,
  22175. forwardslash: 191,
  22176. grave: 192,
  22177. "[": 219,
  22178. openbracket: 219,
  22179. backslash: 220,
  22180. "]": 221,
  22181. closebracket: 221,
  22182. quote: 222,
  22183. dpadLeft: 1e3,
  22184. dpadRight: 1001,
  22185. dpadUp: 1003,
  22186. dpadDown: 1004,
  22187. dpadCenter: 1005
  22188. }, cc.macro.ImageFormat = cc.Enum({
  22189. JPG: 0,
  22190. PNG: 1,
  22191. TIFF: 2,
  22192. WEBP: 3,
  22193. PVR: 4,
  22194. ETC: 5,
  22195. S3TC: 6,
  22196. ATITC: 7,
  22197. TGA: 8,
  22198. RAWDATA: 9,
  22199. UNKNOWN: 10
  22200. }), cc.macro.BlendFactor = cc.Enum({
  22201. ONE: 1,
  22202. ZERO: 0,
  22203. SRC_ALPHA: 770,
  22204. SRC_COLOR: 768,
  22205. DST_ALPHA: 772,
  22206. DST_COLOR: 774,
  22207. ONE_MINUS_SRC_ALPHA: 771,
  22208. ONE_MINUS_SRC_COLOR: 769,
  22209. ONE_MINUS_DST_ALPHA: 773,
  22210. ONE_MINUS_DST_COLOR: 775
  22211. }), cc.macro.TextAlignment = cc.Enum({
  22212. LEFT: 0,
  22213. CENTER: 1,
  22214. RIGHT: 2
  22215. }), cc.macro.VerticalTextAlignment = cc.Enum({
  22216. TOP: 0,
  22217. CENTER: 1,
  22218. BOTTOM: 2
  22219. }), e.exports = cc.macro
  22220. }), {}],
  22221. 204: [(function(t, e, i) {
  22222. "use strict";
  22223. var n = t("./js"),
  22224. r = t("./CCClass"),
  22225. s = 1;
  22226. function o() {
  22227. this._name = "", this._objFlags = 0
  22228. }
  22229. r.fastDefine("cc.Object", o, {
  22230. _name: "",
  22231. _objFlags: 0
  22232. }), n.value(o, "Flags", {
  22233. Destroyed: s,
  22234. DontSave: 8,
  22235. EditorOnly: 16,
  22236. Dirty: 32,
  22237. DontDestroy: 64,
  22238. PersistentMask: -4192741,
  22239. Destroying: 128,
  22240. Deactivating: 256,
  22241. LockedInEditor: 512,
  22242. HideInHierarchy: 1024,
  22243. IsPreloadStarted: 8192,
  22244. IsOnLoadStarted: 32768,
  22245. IsOnLoadCalled: 16384,
  22246. IsOnEnableCalled: 2048,
  22247. IsStartCalled: 65536,
  22248. IsEditorOnEnableCalled: 4096,
  22249. IsPositionLocked: 1 << 21,
  22250. IsRotationLocked: 1 << 17,
  22251. IsScaleLocked: 1 << 18,
  22252. IsAnchorLocked: 1 << 19,
  22253. IsSizeLocked: 1 << 20
  22254. });
  22255. var a = [];
  22256. function l() {
  22257. for (var t = a.length, e = 0; e < t; ++e) {
  22258. var i = a[e];
  22259. i._objFlags & s || i._destroyImmediate()
  22260. }
  22261. t === a.length ? a.length = 0 : a.splice(0, t)
  22262. }
  22263. n.value(o, "_deferredDestroy", l);
  22264. var h = o.prototype;
  22265. n.getset(h, "name", (function() {
  22266. return this._name
  22267. }), (function(t) {
  22268. this._name = t
  22269. }), !0), n.get(h, "isValid", (function() {
  22270. return !(this._objFlags & s)
  22271. }), !0);
  22272. function c(t, e) {
  22273. var i, n = t instanceof cc._BaseNode || t instanceof cc.Component,
  22274. s = n ? "_id" : null,
  22275. o = {};
  22276. for (i in t)
  22277. if (t.hasOwnProperty(i)) {
  22278. if (i === s) continue;
  22279. switch (typeof t[i]) {
  22280. case "string":
  22281. o[i] = "";
  22282. break;
  22283. case "object":
  22284. case "function":
  22285. o[i] = null
  22286. }
  22287. }
  22288. if (cc.Class._isCCClass(e))
  22289. for (var a = cc.Class.Attr.getClassAttrs(e), l = e.__props__, h = 0; h < l.length; h++) {
  22290. var c = (i = l[h]) + cc.Class.Attr.DELIMETER + "default";
  22291. if (c in a) {
  22292. if (n && "_id" === i) continue;
  22293. switch (typeof a[c]) {
  22294. case "string":
  22295. o[i] = "";
  22296. break;
  22297. case "object":
  22298. case "function":
  22299. o[i] = null;
  22300. break;
  22301. case "undefined":
  22302. o[i] = void 0
  22303. }
  22304. }
  22305. }
  22306. var u = "";
  22307. for (i in o) {
  22308. var _;
  22309. _ = r.IDENTIFIER_RE.test(i) ? "o." + i + "=" : "o[" + r.escapeForJS(i) + "]=";
  22310. var f = o[i];
  22311. "" === f && (f = '""'), u += _ + f + ";\n"
  22312. }
  22313. return Function("o", u)
  22314. }
  22315. h.destroy = function() {
  22316. return this._objFlags & s ? (cc.warnID(5e3), !1) : !(4 & this._objFlags) && (this._objFlags |= 4, a.push(this), !0)
  22317. }, h._destruct = function() {
  22318. var t = this.constructor,
  22319. e = t.__destruct__;
  22320. e || (e = c(this, t), n.value(t, "__destruct__", e, !0)), e(this)
  22321. }, h._onPreDestroy = null, h._destroyImmediate = function() {
  22322. this._objFlags & s ? cc.errorID(5e3) : (this._onPreDestroy && this._onPreDestroy(), this._destruct(), this._objFlags |= s)
  22323. }, h._deserialize = null, cc.isValid = function(t, e) {
  22324. return "object" == typeof t ? !(!t || t._objFlags & (e ? 4 | s : s)) : void 0 !== t
  22325. }, cc.Object = e.exports = o
  22326. }), {
  22327. "./CCClass": 198,
  22328. "./js": 218
  22329. }],
  22330. 205: [(function(t, e, i) {
  22331. "use strict";
  22332. var n = t("../platform/js");
  22333. cc.SAXParser = function() {
  22334. window.DOMParser ? (this._isSupportDOMParser = !0, this._parser = new DOMParser) : (this._isSupportDOMParser = !1, this._parser = null)
  22335. }, cc.SAXParser.prototype = {
  22336. constructor: cc.SAXParser,
  22337. parse: function(t) {
  22338. return this._parseXML(t)
  22339. },
  22340. _parseXML: function(t) {
  22341. var e;
  22342. return this._isSupportDOMParser ? e = this._parser.parseFromString(t, "text/xml") : ((e = new ActiveXObject("Microsoft.XMLDOM")).async = "false", e.loadXML(t)), e
  22343. }
  22344. }, cc.PlistParser = function() {
  22345. cc.SAXParser.call(this)
  22346. }, n.extend(cc.PlistParser, cc.SAXParser), n.mixin(cc.PlistParser.prototype, {
  22347. parse: function(t) {
  22348. var e = this._parseXML(t),
  22349. i = e.documentElement;
  22350. if ("plist" !== i.tagName) return cc.warnID(5100), {};
  22351. for (var n = null, r = 0, s = i.childNodes.length; r < s && 1 !== (n = i.childNodes[r]).nodeType; r++);
  22352. return e = null, this._parseNode(n)
  22353. },
  22354. _parseNode: function(t) {
  22355. var e = null,
  22356. i = t.tagName;
  22357. if ("dict" === i) e = this._parseDict(t);
  22358. else if ("array" === i) e = this._parseArray(t);
  22359. else if ("string" === i)
  22360. if (1 === t.childNodes.length) e = t.firstChild.nodeValue;
  22361. else {
  22362. e = "";
  22363. for (var n = 0; n < t.childNodes.length; n++) e += t.childNodes[n].nodeValue
  22364. }
  22365. else "false" === i ? e = !1 : "true" === i ? e = !0 : "real" === i ? e = parseFloat(t.firstChild.nodeValue) : "integer" === i && (e = parseInt(t.firstChild.nodeValue, 10));
  22366. return e
  22367. },
  22368. _parseArray: function(t) {
  22369. for (var e = [], i = 0, n = t.childNodes.length; i < n; i++) {
  22370. var r = t.childNodes[i];
  22371. 1 === r.nodeType && e.push(this._parseNode(r))
  22372. }
  22373. return e
  22374. },
  22375. _parseDict: function(t) {
  22376. for (var e = {}, i = null, n = 0, r = t.childNodes.length; n < r; n++) {
  22377. var s = t.childNodes[n];
  22378. 1 === s.nodeType && ("key" === s.tagName ? i = s.firstChild.nodeValue : e[i] = this._parseNode(s))
  22379. }
  22380. return e
  22381. }
  22382. }), cc.saxParser = new cc.SAXParser, cc.plistParser = new cc.PlistParser, e.exports = {
  22383. saxParser: cc.saxParser,
  22384. plistParser: cc.plistParser
  22385. }
  22386. }), {
  22387. "../platform/js": 218
  22388. }],
  22389. 206: [(function(t, e, i) {
  22390. "use strict";
  22391. cc.screen = {
  22392. _supportsFullScreen: !1,
  22393. _onfullscreenchange: null,
  22394. _onfullscreenerror: null,
  22395. _preOnFullScreenChange: null,
  22396. _preOnFullScreenError: null,
  22397. _preOnTouch: null,
  22398. _touchEvent: "",
  22399. _fn: null,
  22400. _fnMap: [
  22401. ["requestFullscreen", "exitFullscreen", "fullscreenchange", "fullscreenEnabled", "fullscreenElement", "fullscreenerror"],
  22402. ["requestFullScreen", "exitFullScreen", "fullScreenchange", "fullScreenEnabled", "fullScreenElement", "fullscreenerror"],
  22403. ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitIsFullScreen", "webkitCurrentFullScreenElement", "webkitfullscreenerror"],
  22404. ["mozRequestFullScreen", "mozCancelFullScreen", "mozfullscreenchange", "mozFullScreen", "mozFullScreenElement", "mozfullscreenerror"],
  22405. ["msRequestFullscreen", "msExitFullscreen", "MSFullscreenChange", "msFullscreenEnabled", "msFullscreenElement", "msfullscreenerror"]
  22406. ],
  22407. init: function() {
  22408. this._fn = {};
  22409. var t, e, i, n, r = this._fnMap;
  22410. for (t = 0, e = r.length; t < e; t++)
  22411. if ((i = r[t]) && void 0 !== document[i[1]]) {
  22412. for (t = 0, n = i.length; t < n; t++) this._fn[r[0][t]] = i[t];
  22413. break
  22414. }
  22415. this._supportsFullScreen = void 0 !== this._fn.requestFullscreen, this._touchEvent = "ontouchend" in window ? "touchend" : "mousedown"
  22416. },
  22417. fullScreen: function() {
  22418. return !!this._supportsFullScreen && !!(document[this._fn.fullscreenElement] || document[this._fn.webkitFullscreenElement] || document[this._fn.mozFullScreenElement])
  22419. },
  22420. requestFullScreen: function(t, e, i) {
  22421. if (t && "video" === t.tagName.toLowerCase()) {
  22422. if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser && t.readyState > 0) return void(t.webkitEnterFullscreen && t.webkitEnterFullscreen());
  22423. t.setAttribute("x5-video-player-fullscreen", "true")
  22424. }
  22425. if (this._supportsFullScreen) {
  22426. if (t = t || document.documentElement, e) {
  22427. var n = this._fn.fullscreenchange;
  22428. this._onfullscreenchange && document.removeEventListener(n, this._onfullscreenchange), this._onfullscreenchange = e, document.addEventListener(n, e, !1)
  22429. }
  22430. if (i) {
  22431. var r = this._fn.fullscreenerror;
  22432. this._onfullscreenerror && document.removeEventListener(r, this._onfullscreenerror), this._onfullscreenerror = i, document.addEventListener(r, i, {
  22433. once: !0
  22434. })
  22435. }
  22436. t[this._fn.requestFullscreen]()
  22437. }
  22438. },
  22439. exitFullScreen: function(t) {
  22440. if (t && "video" === t.tagName.toLowerCase()) {
  22441. if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser) return void(t.webkitExitFullscreen && t.webkitExitFullscreen());
  22442. t.setAttribute("x5-video-player-fullscreen", "false")
  22443. }
  22444. return !this._supportsFullScreen || document[this._fn.exitFullscreen]()
  22445. },
  22446. autoFullScreen: function(t, e) {
  22447. t = t || document.body, this._ensureFullScreen(t, e), this.requestFullScreen(t, e)
  22448. },
  22449. disableAutoFullScreen: function(t) {
  22450. var e = cc.game.canvas || t,
  22451. i = this._touchEvent;
  22452. this._preOnTouch && (e.removeEventListener(i, this._preOnTouch), this._preOnTouch = null)
  22453. },
  22454. _ensureFullScreen: function(t, e) {
  22455. var i = this,
  22456. n = cc.game.canvas || t,
  22457. r = this._fn.fullscreenerror,
  22458. s = this._touchEvent;
  22459. function o() {
  22460. i._preOnFullScreenError = null, i._preOnTouch && n.removeEventListener(s, i._preOnTouch), i._preOnTouch = function() {
  22461. i._preOnTouch = null, i.requestFullScreen(t, e)
  22462. }, n.addEventListener(s, i._preOnTouch, {
  22463. once: !0
  22464. })
  22465. }
  22466. this._preOnFullScreenError && t.removeEventListener(r, this._preOnFullScreenError), this._preOnFullScreenError = o, t.addEventListener(r, o, {
  22467. once: !0
  22468. })
  22469. }
  22470. }, cc.screen.init()
  22471. }), {}],
  22472. 207: [(function(t, e, i) {
  22473. "use strict";
  22474. window._CCSettings && _CCSettings.platform;
  22475. var n = "undefined" == typeof window ? global : window;
  22476. var r = cc && cc.sys ? cc.sys : (function() {
  22477. cc.sys = {};
  22478. var t = cc.sys;
  22479. if (t.LANGUAGE_ENGLISH = "en", t.LANGUAGE_CHINESE = "zh", t.LANGUAGE_FRENCH = "fr", t.LANGUAGE_ITALIAN = "it", t.LANGUAGE_GERMAN = "de", t.LANGUAGE_SPANISH = "es", t.LANGUAGE_DUTCH = "du", t.LANGUAGE_RUSSIAN = "ru", t.LANGUAGE_KOREAN = "ko", t.LANGUAGE_JAPANESE = "ja", t.LANGUAGE_HUNGARIAN = "hu", t.LANGUAGE_PORTUGUESE = "pt", t.LANGUAGE_ARABIC = "ar", t.LANGUAGE_NORWEGIAN = "no", t.LANGUAGE_POLISH = "pl", t.LANGUAGE_TURKISH = "tr", t.LANGUAGE_UKRAINIAN = "uk", t.LANGUAGE_ROMANIAN = "ro", t.LANGUAGE_BULGARIAN = "bg", t.LANGUAGE_UNKNOWN = "unknown", t.OS_IOS = "iOS", t.OS_ANDROID = "Android", t.OS_WINDOWS = "Windows", t.OS_MARMALADE = "Marmalade", t.OS_LINUX = "Linux", t.OS_BADA = "Bada", t.OS_BLACKBERRY = "Blackberry", t.OS_OSX = "OS X", t.OS_WP8 = "WP8", t.OS_WINRT = "WINRT", t.OS_UNKNOWN = "Unknown", t.UNKNOWN = -1, t.WIN32 = 0, t.LINUX = 1, t.MACOS = 2, t.ANDROID = 3, t.IPHONE = 4, t.IPAD = 5, t.BLACKBERRY = 6, t.NACL = 7, t.EMSCRIPTEN = 8, t.TIZEN = 9, t.WINRT = 10, t.WP8 = 11, t.MOBILE_BROWSER = 100, t.DESKTOP_BROWSER = 101, t.EDITOR_PAGE = 102, t.EDITOR_CORE = 103, t.WECHAT_GAME = 104, t.QQ_PLAY = 105, t.FB_PLAYABLE_ADS = 106, t.BAIDU_GAME = 107, t.VIVO_GAME = 108, t.OPPO_GAME = 109, t.HUAWEI_GAME = 110, t.XIAOMI_GAME = 111, t.JKW_GAME = 112, t.ALIPAY_GAME = 113, t.WECHAT_GAME_SUB = 114, t.BAIDU_GAME_SUB = 115, t.BROWSER_TYPE_WECHAT = "wechat", t.BROWSER_TYPE_WECHAT_GAME = "wechatgame", t.BROWSER_TYPE_WECHAT_GAME_SUB = "wechatgamesub", t.BROWSER_TYPE_BAIDU_GAME = "baidugame", t.BROWSER_TYPE_BAIDU_GAME_SUB = "baidugamesub", t.BROWSER_TYPE_XIAOMI_GAME = "xiaomigame", t.BROWSER_TYPE_ALIPAY_GAME = "alipaygame", t.BROWSER_TYPE_QQ_PLAY = "qqplay", t.BROWSER_TYPE_ANDROID = "androidbrowser", t.BROWSER_TYPE_IE = "ie", t.BROWSER_TYPE_EDGE = "edge", t.BROWSER_TYPE_QQ = "qqbrowser", t.BROWSER_TYPE_MOBILE_QQ = "mqqbrowser", t.BROWSER_TYPE_UC = "ucbrowser", t.BROWSER_TYPE_UCBS = "ucbs", t.BROWSER_TYPE_360 = "360browser", t.BROWSER_TYPE_BAIDU_APP = "baiduboxapp", t.BROWSER_TYPE_BAIDU = "baidubrowser", t.BROWSER_TYPE_MAXTHON = "maxthon", t.BROWSER_TYPE_OPERA = "opera", t.BROWSER_TYPE_OUPENG = "oupeng", t.BROWSER_TYPE_MIUI = "miuibrowser", t.BROWSER_TYPE_FIREFOX = "firefox", t.BROWSER_TYPE_SAFARI = "safari", t.BROWSER_TYPE_CHROME = "chrome", t.BROWSER_TYPE_LIEBAO = "liebao", t.BROWSER_TYPE_QZONE = "qzone", t.BROWSER_TYPE_SOUGOU = "sogou", t.BROWSER_TYPE_UNKNOWN = "unknown", t.isNative = !1, t.isBrowser = "object" == typeof window && "object" == typeof document && !0, t.glExtension = function(t) {
  22480. return !!cc.renderer.device.ext(t)
  22481. }, t.getMaxJointMatrixSize = function() {
  22482. if (!t._maxJointMatrixSize) {
  22483. var e = cc.game._renderContext,
  22484. i = Math.floor(e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS) / 4) - 10;
  22485. t._maxJointMatrixSize = i < 50 ? 0 : 50
  22486. }
  22487. return t._maxJointMatrixSize
  22488. }, n.__globalAdapter && n.__globalAdapter.adaptSys) n.__globalAdapter.adaptSys(t);
  22489. else {
  22490. var e = window,
  22491. i = e.navigator,
  22492. r = document,
  22493. s = r.documentElement,
  22494. o = i.userAgent.toLowerCase();
  22495. t.isMobile = /mobile|android|iphone|ipad/.test(o), "undefined" != typeof FbPlayableAd ? t.platform = t.FB_PLAYABLE_ADS : t.platform = t.isMobile ? t.MOBILE_BROWSER : t.DESKTOP_BROWSER;
  22496. var a = i.language;
  22497. a = a || i.browserLanguage, t.languageCode = a.toLowerCase(), a = a ? a.split("-")[0] : t.LANGUAGE_ENGLISH, t.language = a;
  22498. var l = !1,
  22499. h = !1,
  22500. c = "",
  22501. u = 0,
  22502. _ = /android (\d+(?:\.\d+)*)/i.exec(o) || /android (\d+(?:\.\d+)*)/i.exec(i.platform);
  22503. _ && (l = !0, c = _[1] || "", u = parseInt(c) || 0), (_ = /(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(o)) ? (h = !0, c = _[2] || "", u = parseInt(c) || 0) : (/(iPhone|iPad|iPod)/.exec(i.platform) || "MacIntel" === i.platform && i.maxTouchPoints && i.maxTouchPoints > 1) && (h = !0, c = "", u = 0);
  22504. var f = t.OS_UNKNOWN; - 1 !== i.appVersion.indexOf("Win") ? f = t.OS_WINDOWS : h ? f = t.OS_IOS : -1 !== i.appVersion.indexOf("Mac") ? f = t.OS_OSX : -1 !== i.appVersion.indexOf("X11") && -1 === i.appVersion.indexOf("Linux") ? f = t.OS_UNIX : l ? f = t.OS_ANDROID : -1 === i.appVersion.indexOf("Linux") && -1 === o.indexOf("ubuntu") || (f = t.OS_LINUX), t.os = f, t.osVersion = c, t.osMainVersion = u, t.browserType = t.BROWSER_TYPE_UNKNOWN, (function() {
  22505. var e = /mqqbrowser|micromessenger|qq|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o) || /qqbrowser|ucbrowser|ubrowser|edge/i.exec(o) || /chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),
  22506. i = e ? e[0].toLowerCase() : t.BROWSER_TYPE_UNKNOWN;
  22507. "safari" === i && l ? i = t.BROWSER_TYPE_ANDROID : "qq" === i && o.match(/android.*applewebkit/i) && (i = t.BROWSER_TYPE_ANDROID);
  22508. var n = {
  22509. micromessenger: t.BROWSER_TYPE_WECHAT,
  22510. trident: t.BROWSER_TYPE_IE,
  22511. edge: t.BROWSER_TYPE_EDGE,
  22512. "360 aphone": t.BROWSER_TYPE_360,
  22513. mxbrowser: t.BROWSER_TYPE_MAXTHON,
  22514. "opr/": t.BROWSER_TYPE_OPERA,
  22515. ubrowser: t.BROWSER_TYPE_UC
  22516. };
  22517. t.browserType = n[i] || i
  22518. })(), t.browserVersion = "", (function() {
  22519. var e = o.match(/(mqqbrowser|micromessenger|qq|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i);
  22520. e || (e = o.match(/(qqbrowser|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i)), t.browserVersion = e ? e[4] : ""
  22521. })();
  22522. var d = window.innerWidth || document.documentElement.clientWidth,
  22523. p = window.innerHeight || document.documentElement.clientHeight,
  22524. m = window.devicePixelRatio || 1;
  22525. t.windowPixelResolution = {
  22526. width: m * d,
  22527. height: m * p
  22528. }, t._checkWebGLRenderMode = function() {
  22529. if (cc.game.renderType !== cc.game.RENDER_TYPE_WEBGL) throw new Error("This feature supports WebGL render mode only.")
  22530. };
  22531. var y = document.createElement("canvas");
  22532. try {
  22533. var v = t.localStorage = e.localStorage;
  22534. v.setItem("storage", ""), v.removeItem("storage"), v = null
  22535. } catch (e) {
  22536. var g = function() {
  22537. cc.warnID(5200)
  22538. };
  22539. t.localStorage = {
  22540. getItem: g,
  22541. setItem: g,
  22542. removeItem: g,
  22543. clear: g
  22544. }
  22545. }
  22546. var x = y.toDataURL("image/webp").startsWith("data:image/webp"),
  22547. b = !!y.getContext("2d"),
  22548. A = !1;
  22549. e.WebGLRenderingContext && (A = !0);
  22550. var C, T = t.capabilities = {
  22551. canvas: b,
  22552. opengl: A,
  22553. webp: x
  22554. };
  22555. (void 0 !== s.ontouchstart || void 0 !== r.ontouchstart || i.msPointerEnabled) && (T.touches = !0), void 0 !== s.onmouseup && (T.mouse = !0), void 0 !== s.onkeyup && (T.keyboard = !0), (e.DeviceMotionEvent || e.DeviceOrientationEvent) && (T.accelerometer = !0), (function() {
  22556. t.browserVersion;
  22557. var e = !!(window.AudioContext || window.webkitAudioContext || window.mozAudioContext);
  22558. C = {
  22559. ONLY_ONE: !1,
  22560. WEB_AUDIO: e,
  22561. DELAY_CREATE_CTX: !1
  22562. }, t.os === t.OS_IOS && (C.USE_LOADER_EVENT = "loadedmetadata"), t.browserType === t.BROWSER_TYPE_FIREFOX && (C.DELAY_CREATE_CTX = !0, C.USE_LOADER_EVENT = "canplay"), t.os === t.OS_ANDROID && t.browserType === t.BROWSER_TYPE_UC && (C.ONE_SOURCE = !0)
  22563. })();
  22564. try {
  22565. C.WEB_AUDIO && (C.context = new(window.AudioContext || window.webkitAudioContext || window.mozAudioContext), C.DELAY_CREATE_CTX && setTimeout((function() {
  22566. C.context = new(window.AudioContext || window.webkitAudioContext || window.mozAudioContext)
  22567. }), 0))
  22568. } catch (t) {
  22569. C.WEB_AUDIO = !1, cc.logID(5201)
  22570. }
  22571. var S = [];
  22572. (function() {
  22573. var t = document.createElement("audio");
  22574. t.canPlayType && (t.canPlayType('audio/ogg; codecs="vorbis"') && S.push(".ogg"), t.canPlayType("audio/mpeg") && S.push(".mp3"), t.canPlayType('audio/wav; codecs="1"') && S.push(".wav"), t.canPlayType("audio/mp4") && S.push(".mp4"), t.canPlayType("audio/x-m4a") && S.push(".m4a"))
  22575. })(), C.format = S, t.__audioSupport = C
  22576. }
  22577. return t.NetworkType = {
  22578. NONE: 0,
  22579. LAN: 1,
  22580. WWAN: 2
  22581. }, t.getNetworkType = function() {
  22582. return t.NetworkType.LAN
  22583. }, t.getBatteryLevel = function() {
  22584. return 1
  22585. }, t.garbageCollect = function() {}, t.restartVM = function() {}, t.getSafeAreaRect = function() {
  22586. var t = cc.view.getVisibleSize();
  22587. return cc.rect(0, 0, t.width, t.height)
  22588. }, t.isObjectValid = function(t) {
  22589. return !!t
  22590. }, t.dump = function() {
  22591. var t = "";
  22592. t += "isMobile : " + this.isMobile + "\r\n", t += "language : " + this.language + "\r\n", t += "browserType : " + this.browserType + "\r\n", t += "browserVersion : " + this.browserVersion + "\r\n", t += "capabilities : " + JSON.stringify(this.capabilities) + "\r\n", t += "os : " + this.os + "\r\n", t += "osVersion : " + this.osVersion + "\r\n", t += "platform : " + this.platform + "\r\n", t += "Using " + (cc.game.renderType === cc.game.RENDER_TYPE_WEBGL ? "WEBGL" : "CANVAS") + " renderer.\r\n", cc.log(t)
  22593. }, t.openURL = function(t) {
  22594. window.open(t)
  22595. }, t.now = function() {
  22596. return Date.now ? Date.now() : +new Date
  22597. }, t
  22598. })();
  22599. e.exports = r
  22600. }), {}],
  22601. 208: [(function(t, e, i) {
  22602. "use strict";
  22603. var n = t("../event/event-target"),
  22604. r = t("../platform/js"),
  22605. s = t("../renderer");
  22606. t("../platform/CCClass");
  22607. var o = {
  22608. init: function() {
  22609. this.html = document.getElementsByTagName("html")[0]
  22610. },
  22611. availWidth: function(t) {
  22612. return t && t !== this.html ? t.clientWidth : window.innerWidth
  22613. },
  22614. availHeight: function(t) {
  22615. return t && t !== this.html ? t.clientHeight : window.innerHeight
  22616. },
  22617. meta: {
  22618. width: "device-width"
  22619. },
  22620. adaptationType: cc.sys.browserType
  22621. };
  22622. switch (cc.sys.os === cc.sys.OS_IOS && (o.adaptationType = cc.sys.BROWSER_TYPE_SAFARI), o.adaptationType) {
  22623. case cc.sys.BROWSER_TYPE_SAFARI:
  22624. o.meta["minimal-ui"] = "true";
  22625. case cc.sys.BROWSER_TYPE_SOUGOU:
  22626. case cc.sys.BROWSER_TYPE_UC:
  22627. o.availWidth = function(t) {
  22628. return t.clientWidth
  22629. }, o.availHeight = function(t) {
  22630. return t.clientHeight
  22631. }
  22632. }
  22633. var a = null,
  22634. l = function() {
  22635. n.call(this);
  22636. var t = this,
  22637. e = cc.ContainerStrategy,
  22638. i = cc.ContentStrategy;
  22639. o.init(this), t._frameSize = cc.size(0, 0), t._designResolutionSize = cc.size(0, 0), t._originalDesignResolutionSize = cc.size(0, 0), t._scaleX = 1, t._scaleY = 1, t._viewportRect = cc.rect(0, 0, 0, 0), t._visibleRect = cc.rect(0, 0, 0, 0), t._autoFullScreen = !1, t._devicePixelRatio = 1, t._maxPixelRatio = 2, t._retinaEnabled = !1, t._resizeCallback = null, t._resizing = !1, t._resizeWithBrowserSize = !1, t._orientationChanging = !0, t._isRotated = !1, t._orientation = cc.macro.ORIENTATION_AUTO, t._isAdjustViewport = !0, t._antiAliasEnabled = !1, t._resolutionPolicy = null, t._rpExactFit = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.EXACT_FIT), t._rpShowAll = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.SHOW_ALL), t._rpNoBorder = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.NO_BORDER), t._rpFixedHeight = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.FIXED_HEIGHT), t._rpFixedWidth = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME, i.FIXED_WIDTH), cc.game.once(cc.game.EVENT_ENGINE_INITED, this.init, this)
  22640. };
  22641. cc.js.extend(l, n), cc.js.mixin(l.prototype, {
  22642. init: function() {
  22643. this._initFrameSize(), this.enableAntiAlias(!0);
  22644. var t = cc.game.canvas.width,
  22645. e = cc.game.canvas.height;
  22646. this._designResolutionSize.width = t, this._designResolutionSize.height = e, this._originalDesignResolutionSize.width = t, this._originalDesignResolutionSize.height = e, this._viewportRect.width = t, this._viewportRect.height = e, this._visibleRect.width = t, this._visibleRect.height = e, cc.winSize.width = this._visibleRect.width, cc.winSize.height = this._visibleRect.height, cc.visibleRect && cc.visibleRect.init(this._visibleRect)
  22647. },
  22648. _resizeEvent: function(t) {
  22649. var e, i = (e = this.setDesignResolutionSize ? this : cc.view)._frameSize.width,
  22650. n = e._frameSize.height,
  22651. r = e._isRotated;
  22652. if (cc.sys.isMobile) {
  22653. var s = cc.game.container.style,
  22654. o = s.margin;
  22655. s.margin = "0", s.display = "none", e._initFrameSize(), s.margin = o, s.display = "block"
  22656. } else e._initFrameSize();
  22657. if (!0 === t || e._isRotated !== r || e._frameSize.width !== i || e._frameSize.height !== n) {
  22658. var a = e._originalDesignResolutionSize.width,
  22659. l = e._originalDesignResolutionSize.height;
  22660. e._resizing = !0, a > 0 && e.setDesignResolutionSize(a, l, e._resolutionPolicy), e._resizing = !1, e.emit("canvas-resize"), e._resizeCallback && e._resizeCallback.call()
  22661. }
  22662. },
  22663. _orientationChange: function() {
  22664. cc.view._orientationChanging = !0, cc.view._resizeEvent()
  22665. },
  22666. resizeWithBrowserSize: function(t) {
  22667. t ? this._resizeWithBrowserSize || (this._resizeWithBrowserSize = !0, window.addEventListener("resize", this._resizeEvent), window.addEventListener("orientationchange", this._orientationChange)) : this._resizeWithBrowserSize && (this._resizeWithBrowserSize = !1, window.removeEventListener("resize", this._resizeEvent), window.removeEventListener("orientationchange", this._orientationChange))
  22668. },
  22669. setResizeCallback: function(t) {
  22670. "function" != typeof t && null != t || (this._resizeCallback = t)
  22671. },
  22672. setOrientation: function(t) {
  22673. if ((t &= cc.macro.ORIENTATION_AUTO) && this._orientation !== t) {
  22674. this._orientation = t;
  22675. var e = this._originalDesignResolutionSize.width,
  22676. i = this._originalDesignResolutionSize.height;
  22677. this.setDesignResolutionSize(e, i, this._resolutionPolicy)
  22678. }
  22679. },
  22680. _initFrameSize: function() {
  22681. var t = this._frameSize,
  22682. e = o.availWidth(cc.game.frame),
  22683. i = o.availHeight(cc.game.frame),
  22684. n = e >= i;
  22685. !cc.sys.isMobile || n && this._orientation & cc.macro.ORIENTATION_LANDSCAPE || !n && this._orientation & cc.macro.ORIENTATION_PORTRAIT ? (t.width = e, t.height = i, cc.game.container.style["-webkit-transform"] = "rotate(0deg)", cc.game.container.style.transform = "rotate(0deg)", this._isRotated = !1) : (t.width = i, t.height = e, cc.game.container.style["-webkit-transform"] = "rotate(90deg)", cc.game.container.style.transform = "rotate(90deg)", cc.game.container.style["-webkit-transform-origin"] = "0px 0px 0px", cc.game.container.style.transformOrigin = "0px 0px 0px", this._isRotated = !0), this._orientationChanging && setTimeout((function() {
  22686. cc.view._orientationChanging = !1
  22687. }), 1e3)
  22688. },
  22689. _setViewportMeta: function(t, e) {
  22690. var i = document.getElementById("cocosMetaElement");
  22691. i && e && document.head.removeChild(i);
  22692. var n, r, s, o = document.getElementsByName("viewport"),
  22693. a = o ? o[0] : null;
  22694. for (r in n = a ? a.content : "", (i = i || document.createElement("meta")).id = "cocosMetaElement", i.name = "viewport", i.content = "", t) - 1 == n.indexOf(r) ? n += "," + r + "=" + t[r] : e && (s = new RegExp(r + "s*=s*[^,]+"), n.replace(s, r + "=" + t[r]));
  22695. /^,/.test(n) && (n = n.substr(1)), i.content = n, a && (a.content = n), document.head.appendChild(i)
  22696. },
  22697. _adjustViewportMeta: function() {
  22698. this._isAdjustViewport && (this._setViewportMeta(o.meta, !1), this._isAdjustViewport = !1)
  22699. },
  22700. adjustViewportMeta: function(t) {
  22701. this._isAdjustViewport = t
  22702. },
  22703. enableRetina: function(t) {
  22704. this._retinaEnabled = !!t
  22705. },
  22706. isRetinaEnabled: function() {
  22707. return this._retinaEnabled
  22708. },
  22709. enableAntiAlias: function(t) {
  22710. if (this._antiAliasEnabled !== t)
  22711. if (this._antiAliasEnabled = t, cc.game.renderType === cc.game.RENDER_TYPE_WEBGL) {
  22712. var e = cc.loader._cache;
  22713. for (var i in e) {
  22714. var n = e[i],
  22715. r = n && n.content instanceof cc.Texture2D ? n.content : null;
  22716. if (r) {
  22717. var s = cc.Texture2D.Filter;
  22718. t ? r.setFilters(s.LINEAR, s.LINEAR) : r.setFilters(s.NEAREST, s.NEAREST)
  22719. }
  22720. }
  22721. } else if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
  22722. var o = cc.game.canvas.getContext("2d");
  22723. o.imageSmoothingEnabled = t, o.mozImageSmoothingEnabled = t
  22724. }
  22725. },
  22726. isAntiAliasEnabled: function() {
  22727. return this._antiAliasEnabled
  22728. },
  22729. enableAutoFullScreen: function(t) {
  22730. t && t !== this._autoFullScreen && cc.sys.isMobile ? (this._autoFullScreen = !0, cc.screen.autoFullScreen(cc.game.frame)) : (this._autoFullScreen = !1, cc.screen.disableAutoFullScreen(cc.game.frame))
  22731. },
  22732. isAutoFullScreenEnabled: function() {
  22733. return this._autoFullScreen
  22734. },
  22735. setCanvasSize: function(t, e) {
  22736. var i = cc.game.canvas,
  22737. n = cc.game.container;
  22738. i.width = t * this._devicePixelRatio, i.height = e * this._devicePixelRatio, i.style.width = t + "px", i.style.height = e + "px", n.style.width = t + "px", n.style.height = e + "px", this._resizeEvent()
  22739. },
  22740. getCanvasSize: function() {
  22741. return cc.size(cc.game.canvas.width, cc.game.canvas.height)
  22742. },
  22743. getFrameSize: function() {
  22744. return cc.size(this._frameSize.width, this._frameSize.height)
  22745. },
  22746. setFrameSize: function(t, e) {
  22747. this._frameSize.width = t, this._frameSize.height = e, cc.game.frame.style.width = t + "px", cc.game.frame.style.height = e + "px", this._resizeEvent(!0)
  22748. },
  22749. getVisibleSize: function() {
  22750. return cc.size(this._visibleRect.width, this._visibleRect.height)
  22751. },
  22752. getVisibleSizeInPixel: function() {
  22753. return cc.size(this._visibleRect.width * this._scaleX, this._visibleRect.height * this._scaleY)
  22754. },
  22755. getVisibleOrigin: function() {
  22756. return cc.v2(this._visibleRect.x, this._visibleRect.y)
  22757. },
  22758. getVisibleOriginInPixel: function() {
  22759. return cc.v2(this._visibleRect.x * this._scaleX, this._visibleRect.y * this._scaleY)
  22760. },
  22761. getResolutionPolicy: function() {
  22762. return this._resolutionPolicy
  22763. },
  22764. setResolutionPolicy: function(t) {
  22765. var e = this;
  22766. if (t instanceof cc.ResolutionPolicy) e._resolutionPolicy = t;
  22767. else {
  22768. var i = cc.ResolutionPolicy;
  22769. t === i.EXACT_FIT && (e._resolutionPolicy = e._rpExactFit), t === i.SHOW_ALL && (e._resolutionPolicy = e._rpShowAll), t === i.NO_BORDER && (e._resolutionPolicy = e._rpNoBorder), t === i.FIXED_HEIGHT && (e._resolutionPolicy = e._rpFixedHeight), t === i.FIXED_WIDTH && (e._resolutionPolicy = e._rpFixedWidth)
  22770. }
  22771. },
  22772. setDesignResolutionSize: function(t, e, i) {
  22773. if (t > 0 || e > 0) {
  22774. this.setResolutionPolicy(i);
  22775. var n = this._resolutionPolicy;
  22776. if (n && n.preApply(this), cc.sys.isMobile && this._adjustViewportMeta(), this._orientationChanging = !0, this._resizing || this._initFrameSize(), n) {
  22777. this._originalDesignResolutionSize.width = this._designResolutionSize.width = t, this._originalDesignResolutionSize.height = this._designResolutionSize.height = e;
  22778. var r = n.apply(this, this._designResolutionSize);
  22779. if (r.scale && 2 === r.scale.length && (this._scaleX = r.scale[0], this._scaleY = r.scale[1]), r.viewport) {
  22780. var o = this._viewportRect,
  22781. a = this._visibleRect,
  22782. l = r.viewport;
  22783. o.x = l.x, o.y = l.y, o.width = l.width, o.height = l.height, a.x = 0, a.y = 0, a.width = l.width / this._scaleX, a.height = l.height / this._scaleY
  22784. }
  22785. n.postApply(this), cc.winSize.width = this._visibleRect.width, cc.winSize.height = this._visibleRect.height, cc.visibleRect && cc.visibleRect.init(this._visibleRect), s.updateCameraViewport(), _cc.inputManager._updateCanvasBoundingRect(), this.emit("design-resolution-changed")
  22786. } else cc.logID(2201)
  22787. } else cc.logID(2200)
  22788. },
  22789. getDesignResolutionSize: function() {
  22790. return cc.size(this._designResolutionSize.width, this._designResolutionSize.height)
  22791. },
  22792. setRealPixelResolution: function(t, e, i) {
  22793. this._setViewportMeta({
  22794. width: t
  22795. }, !0), document.documentElement.style.width = t + "px", document.body.style.width = t + "px", document.body.style.left = "0px", document.body.style.top = "0px", this.setDesignResolutionSize(t, e, i)
  22796. },
  22797. setViewportInPoints: function(t, e, i, n) {
  22798. var r = this._scaleX,
  22799. s = this._scaleY;
  22800. cc.game._renderContext.viewport(t * r + this._viewportRect.x, e * s + this._viewportRect.y, i * r, n * s)
  22801. },
  22802. setScissorInPoints: function(t, e, i, n) {
  22803. var r = this._scaleX,
  22804. s = this._scaleY,
  22805. o = Math.ceil(t * r + this._viewportRect.x),
  22806. l = Math.ceil(e * s + this._viewportRect.y),
  22807. h = Math.ceil(i * r),
  22808. c = Math.ceil(n * s),
  22809. u = cc.game._renderContext;
  22810. if (!a) {
  22811. var _ = u.getParameter(u.SCISSOR_BOX);
  22812. a = cc.rect(_[0], _[1], _[2], _[3])
  22813. }
  22814. a.x === o && a.y === l && a.width === h && a.height === c || (a.x = o, a.y = l, a.width = h, a.height = c, u.scissor(o, l, h, c))
  22815. },
  22816. isScissorEnabled: function() {
  22817. return cc.game._renderContext.isEnabled(gl.SCISSOR_TEST)
  22818. },
  22819. getScissorRect: function() {
  22820. if (!a) {
  22821. var t = gl.getParameter(gl.SCISSOR_BOX);
  22822. a = cc.rect(t[0], t[1], t[2], t[3])
  22823. }
  22824. var e = 1 / this._scaleX,
  22825. i = 1 / this._scaleY;
  22826. return cc.rect((a.x - this._viewportRect.x) * e, (a.y - this._viewportRect.y) * i, a.width * e, a.height * i)
  22827. },
  22828. getViewportRect: function() {
  22829. return this._viewportRect
  22830. },
  22831. getScaleX: function() {
  22832. return this._scaleX
  22833. },
  22834. getScaleY: function() {
  22835. return this._scaleY
  22836. },
  22837. getDevicePixelRatio: function() {
  22838. return this._devicePixelRatio
  22839. },
  22840. convertToLocationInView: function(t, e, i, n) {
  22841. var r = n || cc.v2(),
  22842. s = i.adjustedLeft ? i.adjustedLeft : i.left,
  22843. o = i.adjustedTop ? i.adjustedTop : i.top,
  22844. a = this._devicePixelRatio * (t - s),
  22845. l = this._devicePixelRatio * (o + i.height - e);
  22846. return this._isRotated ? (r.x = cc.game.canvas.width - l, r.y = a) : (r.x = a, r.y = l), r
  22847. },
  22848. _convertMouseToLocationInView: function(t, e) {
  22849. var i = this._viewportRect;
  22850. t.x = (this._devicePixelRatio * (t.x - e.left) - i.x) / this._scaleX, t.y = (this._devicePixelRatio * (e.top + e.height - t.y) - i.y) / this._scaleY
  22851. },
  22852. _convertPointWithScale: function(t) {
  22853. var e = this._viewportRect;
  22854. t.x = (t.x - e.x) / this._scaleX, t.y = (t.y - e.y) / this._scaleY
  22855. },
  22856. _convertTouchesWithScale: function(t) {
  22857. for (var e, i, n, r = this._viewportRect, s = this._scaleX, o = this._scaleY, a = 0; a < t.length; a++) i = (e = t[a])._point, n = e._prevPoint, i.x = (i.x - r.x) / s, i.y = (i.y - r.y) / o, n.x = (n.x - r.x) / s, n.y = (n.y - r.y) / o
  22858. }
  22859. }), cc.ContainerStrategy = cc.Class({
  22860. name: "ContainerStrategy",
  22861. preApply: function(t) {},
  22862. apply: function(t, e) {},
  22863. postApply: function(t) {},
  22864. _setupContainer: function(t, e, i) {
  22865. var n = cc.game.canvas;
  22866. this._setupStyle(t, e, i);
  22867. var r = t._devicePixelRatio = 1;
  22868. t.isRetinaEnabled() && (r = t._devicePixelRatio = Math.min(t._maxPixelRatio, window.devicePixelRatio || 1)), n.width = e * r, n.height = i * r
  22869. },
  22870. _setupStyle: function(t, e, i) {
  22871. var n = cc.game.canvas,
  22872. r = cc.game.container;
  22873. cc.sys.os === cc.sys.OS_ANDROID && (document.body.style.width = (t._isRotated ? i : e) + "px", document.body.style.height = (t._isRotated ? e : i) + "px"), r.style.width = n.style.width = e + "px", r.style.height = n.style.height = i + "px"
  22874. },
  22875. _fixContainer: function() {
  22876. document.body.insertBefore(cc.game.container, document.body.firstChild);
  22877. var t = document.body.style;
  22878. t.width = window.innerWidth + "px", t.height = window.innerHeight + "px", t.overflow = "hidden";
  22879. var e = cc.game.container.style;
  22880. e.position = "fixed", e.left = e.top = "0px", document.body.scrollTop = 0
  22881. }
  22882. }), cc.ContentStrategy = cc.Class({
  22883. name: "ContentStrategy",
  22884. ctor: function() {
  22885. this._result = {
  22886. scale: [1, 1],
  22887. viewport: null
  22888. }
  22889. },
  22890. _buildResult: function(t, e, i, n, r, s) {
  22891. Math.abs(t - i) < 2 && (i = t), Math.abs(e - n) < 2 && (n = e);
  22892. var o = cc.rect((t - i) / 2, (e - n) / 2, i, n);
  22893. return cc.game.renderType, cc.game.RENDER_TYPE_CANVAS, this._result.scale = [r, s], this._result.viewport = o, this._result
  22894. },
  22895. preApply: function(t) {},
  22896. apply: function(t, e) {
  22897. return {
  22898. scale: [1, 1]
  22899. }
  22900. },
  22901. postApply: function(t) {}
  22902. }), (function() {
  22903. var t = cc.Class({
  22904. name: "EqualToFrame",
  22905. extends: cc.ContainerStrategy,
  22906. apply: function(t) {
  22907. var e = t._frameSize.height,
  22908. i = cc.game.container.style;
  22909. this._setupContainer(t, t._frameSize.width, t._frameSize.height), t._isRotated ? i.margin = "0 0 0 " + e + "px" : i.margin = "0px", i.padding = "0px"
  22910. }
  22911. }),
  22912. e = cc.Class({
  22913. name: "ProportionalToFrame",
  22914. extends: cc.ContainerStrategy,
  22915. apply: function(t, e) {
  22916. var i, n, r = t._frameSize.width,
  22917. s = t._frameSize.height,
  22918. o = cc.game.container.style,
  22919. a = e.width,
  22920. l = e.height,
  22921. h = r / a,
  22922. c = s / l;
  22923. h < c ? (i = r, n = l * h) : (i = a * c, n = s);
  22924. var u = Math.round((r - i) / 2),
  22925. _ = Math.round((s - n) / 2);
  22926. i = r - 2 * u, n = s - 2 * _, this._setupContainer(t, i, n), t._isRotated ? o.margin = "0 0 0 " + s + "px" : o.margin = "0px", o.paddingLeft = u + "px", o.paddingRight = u + "px", o.paddingTop = _ + "px", o.paddingBottom = _ + "px"
  22927. }
  22928. }),
  22929. i = (cc.Class({
  22930. name: "EqualToWindow",
  22931. extends: t,
  22932. preApply: function(t) {
  22933. this._super(t), cc.game.frame = document.documentElement
  22934. },
  22935. apply: function(t) {
  22936. this._super(t), this._fixContainer()
  22937. }
  22938. }), cc.Class({
  22939. name: "ProportionalToWindow",
  22940. extends: e,
  22941. preApply: function(t) {
  22942. this._super(t), cc.game.frame = document.documentElement
  22943. },
  22944. apply: function(t, e) {
  22945. this._super(t, e), this._fixContainer()
  22946. }
  22947. }), cc.Class({
  22948. name: "OriginalContainer",
  22949. extends: cc.ContainerStrategy,
  22950. apply: function(t) {
  22951. this._setupContainer(t, cc.game.canvas.width, cc.game.canvas.height)
  22952. }
  22953. })),
  22954. n = ("undefined" == typeof window ? global : window).__globalAdapter;
  22955. n && (n.adaptContainerStrategy && n.adaptContainerStrategy(cc.ContainerStrategy.prototype), n.adaptView && n.adaptView(l.prototype)), cc.ContainerStrategy.EQUAL_TO_FRAME = new t, cc.ContainerStrategy.PROPORTION_TO_FRAME = new e, cc.ContainerStrategy.ORIGINAL_CONTAINER = new i;
  22956. var r = cc.Class({
  22957. name: "ExactFit",
  22958. extends: cc.ContentStrategy,
  22959. apply: function(t, e) {
  22960. var i = cc.game.canvas.width,
  22961. n = cc.game.canvas.height,
  22962. r = i / e.width,
  22963. s = n / e.height;
  22964. return this._buildResult(i, n, i, n, r, s)
  22965. }
  22966. }),
  22967. s = cc.Class({
  22968. name: "ShowAll",
  22969. extends: cc.ContentStrategy,
  22970. apply: function(t, e) {
  22971. var i, n, r = cc.game.canvas.width,
  22972. s = cc.game.canvas.height,
  22973. o = e.width,
  22974. a = e.height,
  22975. l = r / o,
  22976. h = s / a,
  22977. c = 0;
  22978. return l < h ? (i = r, n = a * (c = l)) : (i = o * (c = h), n = s), this._buildResult(r, s, i, n, c, c)
  22979. }
  22980. }),
  22981. o = cc.Class({
  22982. name: "NoBorder",
  22983. extends: cc.ContentStrategy,
  22984. apply: function(t, e) {
  22985. var i, n, r, s = cc.game.canvas.width,
  22986. o = cc.game.canvas.height,
  22987. a = e.width,
  22988. l = e.height,
  22989. h = s / a,
  22990. c = o / l;
  22991. return h < c ? (n = a * (i = c), r = o) : (n = s, r = l * (i = h)), this._buildResult(s, o, n, r, i, i)
  22992. }
  22993. }),
  22994. a = cc.Class({
  22995. name: "FixedHeight",
  22996. extends: cc.ContentStrategy,
  22997. apply: function(t, e) {
  22998. var i = cc.game.canvas.width,
  22999. n = cc.game.canvas.height,
  23000. r = n / e.height,
  23001. s = i,
  23002. o = n;
  23003. return this._buildResult(i, n, s, o, r, r)
  23004. }
  23005. }),
  23006. h = cc.Class({
  23007. name: "FixedWidth",
  23008. extends: cc.ContentStrategy,
  23009. apply: function(t, e) {
  23010. var i = cc.game.canvas.width,
  23011. n = cc.game.canvas.height,
  23012. r = i / e.width,
  23013. s = i,
  23014. o = n;
  23015. return this._buildResult(i, n, s, o, r, r)
  23016. }
  23017. });
  23018. cc.ContentStrategy.EXACT_FIT = new r, cc.ContentStrategy.SHOW_ALL = new s, cc.ContentStrategy.NO_BORDER = new o, cc.ContentStrategy.FIXED_HEIGHT = new a, cc.ContentStrategy.FIXED_WIDTH = new h
  23019. })(), cc.ResolutionPolicy = cc.Class({
  23020. name: "cc.ResolutionPolicy",
  23021. ctor: function(t, e) {
  23022. this._containerStrategy = null, this._contentStrategy = null, this.setContainerStrategy(t), this.setContentStrategy(e)
  23023. },
  23024. preApply: function(t) {
  23025. this._containerStrategy.preApply(t), this._contentStrategy.preApply(t)
  23026. },
  23027. apply: function(t, e) {
  23028. return this._containerStrategy.apply(t, e), this._contentStrategy.apply(t, e)
  23029. },
  23030. postApply: function(t) {
  23031. this._containerStrategy.postApply(t), this._contentStrategy.postApply(t)
  23032. },
  23033. setContainerStrategy: function(t) {
  23034. t instanceof cc.ContainerStrategy && (this._containerStrategy = t)
  23035. },
  23036. setContentStrategy: function(t) {
  23037. t instanceof cc.ContentStrategy && (this._contentStrategy = t)
  23038. }
  23039. }), r.get(cc.ResolutionPolicy.prototype, "canvasSize", (function() {
  23040. return cc.v2(cc.game.canvas.width, cc.game.canvas.height)
  23041. })), cc.ResolutionPolicy.EXACT_FIT = 0, cc.ResolutionPolicy.NO_BORDER = 1, cc.ResolutionPolicy.SHOW_ALL = 2, cc.ResolutionPolicy.FIXED_HEIGHT = 3, cc.ResolutionPolicy.FIXED_WIDTH = 4, cc.ResolutionPolicy.UNKNOWN = 5, cc.view = new l, cc.winSize = cc.size(), e.exports = cc.view
  23042. }), {
  23043. "../event/event-target": 131,
  23044. "../platform/CCClass": 198,
  23045. "../platform/js": 218,
  23046. "../renderer": 247
  23047. }],
  23048. 209: [(function(t, e, i) {
  23049. "use strict";
  23050. cc.visibleRect = {
  23051. topLeft: cc.v2(0, 0),
  23052. topRight: cc.v2(0, 0),
  23053. top: cc.v2(0, 0),
  23054. bottomLeft: cc.v2(0, 0),
  23055. bottomRight: cc.v2(0, 0),
  23056. bottom: cc.v2(0, 0),
  23057. center: cc.v2(0, 0),
  23058. left: cc.v2(0, 0),
  23059. right: cc.v2(0, 0),
  23060. width: 0,
  23061. height: 0,
  23062. init: function(t) {
  23063. var e = this.width = t.width,
  23064. i = this.height = t.height,
  23065. n = t.x,
  23066. r = t.y,
  23067. s = r + i,
  23068. o = n + e;
  23069. this.topLeft.x = n, this.topLeft.y = s, this.topRight.x = o, this.topRight.y = s, this.top.x = n + e / 2, this.top.y = s, this.bottomLeft.x = n, this.bottomLeft.y = r, this.bottomRight.x = o, this.bottomRight.y = r, this.bottom.x = n + e / 2, this.bottom.y = r, this.center.x = n + e / 2, this.center.y = r + i / 2, this.left.x = n, this.left.y = r + i / 2, this.right.x = o, this.right.y = r + i / 2
  23070. }
  23071. }
  23072. }), {}],
  23073. 210: [(function(t, e, i) {
  23074. "use strict";
  23075. var n = t("./js"),
  23076. r = (t("./utils").isPlainEmptyObj_DEV, "$_$");
  23077. function s(t, e) {
  23078. var i = e ? Object.create(e) : {};
  23079. return n.value(t, "__attrs__", i), i
  23080. }
  23081. function o(t) {
  23082. if ("function" != typeof t) {
  23083. return s(t, l(t.constructor))
  23084. }
  23085. for (var e, i = cc.Class.getInheritanceChain(t), n = i.length - 1; n >= 0; n--) {
  23086. var r = i[n];
  23087. r.hasOwnProperty("__attrs__") && r.__attrs__ || s(r, (e = i[n + 1]) && e.__attrs__)
  23088. }
  23089. return s(t, (e = i[0]) && e.__attrs__), t.__attrs__
  23090. }
  23091. function a(t, e, i) {
  23092. var n = l(t),
  23093. s = e + r,
  23094. o = {};
  23095. for (var a in n) a.startsWith(s) && (o[a.slice(s.length)] = n[a]);
  23096. return o
  23097. }
  23098. function l(t) {
  23099. return t.hasOwnProperty("__attrs__") && t.__attrs__ || o(t)
  23100. }
  23101. function h(t, e) {
  23102. this.name = t, this.default = e
  23103. }
  23104. h.prototype.toString = function() {
  23105. return this.name
  23106. }, cc.Integer = new h("Integer", 0), cc.Float = new h("Float", 0), cc.Boolean = new h("Boolean", !1), cc.String = new h("String", ""), e.exports = {
  23107. PrimitiveType: h,
  23108. attr: a,
  23109. getClassAttrs: l,
  23110. setClassAttr: function(t, e, i, n) {
  23111. l(t)[e + r + i] = n
  23112. },
  23113. DELIMETER: r,
  23114. getTypeChecker_ET: !1,
  23115. getObjTypeChecker_ET: !1,
  23116. ScriptUuid: {}
  23117. }
  23118. }), {
  23119. "./CCClass": 198,
  23120. "./js": 218,
  23121. "./utils": 222
  23122. }],
  23123. 211: [(function(t, e, i) {
  23124. "use strict";
  23125. var n = t("./js"),
  23126. r = n.array.fastRemoveAt;
  23127. function s() {}
  23128. function o() {
  23129. this.callback = s, this.target = void 0, this.once = !1
  23130. }
  23131. o.prototype.set = function(t, e, i) {
  23132. this.callback = t, this.target = e, this.once = !!i
  23133. };
  23134. var a = new n.Pool(function(t) {
  23135. return t.callback = s, t.target = void 0, t.once = !1, !0
  23136. }, 32);
  23137. function l() {
  23138. this.callbackInfos = [], this.isInvoking = !1, this.containCanceled = !1
  23139. }
  23140. a.get = function() {
  23141. return this._get() || new o
  23142. };
  23143. var h = l.prototype;
  23144. h.removeByCallback = function(t) {
  23145. for (var e = 0; e < this.callbackInfos.length; ++e) {
  23146. var i = this.callbackInfos[e];
  23147. i && i.callback === t && (a.put(i), r(this.callbackInfos, e), --e)
  23148. }
  23149. }, h.removeByTarget = function(t) {
  23150. for (var e = 0; e < this.callbackInfos.length; ++e) {
  23151. var i = this.callbackInfos[e];
  23152. i && i.target === t && (a.put(i), r(this.callbackInfos, e), --e)
  23153. }
  23154. }, h.cancel = function(t) {
  23155. var e = this.callbackInfos[t];
  23156. e && (a.put(e), this.callbackInfos[t] = null), this.containCanceled = !0
  23157. }, h.cancelAll = function() {
  23158. for (var t = 0; t < this.callbackInfos.length; t++) {
  23159. var e = this.callbackInfos[t];
  23160. e && (a.put(e), this.callbackInfos[t] = null)
  23161. }
  23162. this.containCanceled = !0
  23163. }, h.purgeCanceled = function() {
  23164. for (var t = this.callbackInfos.length - 1; t >= 0; --t) {
  23165. this.callbackInfos[t] || r(this.callbackInfos, t)
  23166. }
  23167. this.containCanceled = !1
  23168. }, h.clear = function() {
  23169. this.cancelAll(), this.callbackInfos.length = 0, this.isInvoking = !1, this.containCanceled = !1
  23170. };
  23171. var c = new n.Pool(function(t) {
  23172. return t.callback = s, t.target = void 0, t.once = !1, !0
  23173. }, 16);
  23174. function u() {
  23175. this._callbackTable = n.createMap(!0)
  23176. }
  23177. c.get = function() {
  23178. return this._get() || new l
  23179. }, (h = u.prototype).on = function(t, e, i, n) {
  23180. var r = this._callbackTable[t];
  23181. r || (r = this._callbackTable[t] = c.get());
  23182. var s = a.get();
  23183. s.set(e, i, n), r.callbackInfos.push(s)
  23184. }, h.hasEventListener = function(t, e, i) {
  23185. var n = this._callbackTable[t];
  23186. if (!n) return !1;
  23187. var r = n.callbackInfos;
  23188. if (!e) {
  23189. if (n.isInvoking) {
  23190. for (var s = 0; s < r.length; ++s)
  23191. if (r[s]) return !0;
  23192. return !1
  23193. }
  23194. return r.length > 0
  23195. }
  23196. for (var o = 0; o < r.length; ++o) {
  23197. var a = r[o];
  23198. if (a && a.callback === e && a.target === i) return !0
  23199. }
  23200. return !1
  23201. }, h.removeAll = function(t) {
  23202. if ("string" == typeof t) {
  23203. var e = this._callbackTable[t];
  23204. e && (e.isInvoking ? e.cancelAll() : (e.clear(), c.put(e), delete this._callbackTable[t]))
  23205. } else if (t)
  23206. for (var i in this._callbackTable) {
  23207. var n = this._callbackTable[i];
  23208. if (n.isInvoking)
  23209. for (var r = n.callbackInfos, s = 0; s < r.length; ++s) {
  23210. var o = r[s];
  23211. o && o.target === t && n.cancel(s)
  23212. } else n.removeByTarget(t)
  23213. }
  23214. }, h.off = function(t, e, i) {
  23215. var n = this._callbackTable[t];
  23216. if (n)
  23217. for (var s = n.callbackInfos, o = 0; o < s.length; ++o) {
  23218. var l = s[o];
  23219. if (l && l.callback === e && l.target === i) {
  23220. n.isInvoking ? n.cancel(o) : (r(s, o), a.put(l));
  23221. break
  23222. }
  23223. }
  23224. }, h.emit = function(t, e, i, n, r, s) {
  23225. var o = this._callbackTable[t];
  23226. if (o) {
  23227. var a = !o.isInvoking;
  23228. o.isInvoking = !0;
  23229. for (var l = o.callbackInfos, h = 0, c = l.length; h < c; ++h) {
  23230. var u = l[h];
  23231. if (u) {
  23232. var _ = u.target,
  23233. f = u.callback;
  23234. u.once && this.off(t, f, _), _ ? f.call(_, e, i, n, r, s) : f(e, i, n, r, s)
  23235. }
  23236. }
  23237. a && (o.isInvoking = !1, o.containCanceled && o.purgeCanceled())
  23238. }
  23239. }, e.exports = u
  23240. }), {
  23241. "./js": 218
  23242. }],
  23243. 212: [(function(t, e, i) {
  23244. "use strict";
  23245. function n(t, e) {
  23246. for (var i = 0; i < e.length; i++) {
  23247. var r = e[i];
  23248. Array.isArray(r) ? n(t, r) : t.push(r)
  23249. }
  23250. }
  23251. e.exports = {
  23252. flattenCodeArray: function(t) {
  23253. var e = [];
  23254. return n(e, t), e.join("")
  23255. }
  23256. }
  23257. }), {}],
  23258. 213: [(function(t, e, i) {
  23259. "use strict";
  23260. var n = t("./js"),
  23261. r = t("./attribute"),
  23262. s = t("./CCClass"),
  23263. o = t("../utils/misc"),
  23264. a = function() {
  23265. this.uuidList = [], this.uuidObjList = [], this.uuidPropList = [], this._stillUseUrl = n.createMap(!0)
  23266. };
  23267. a.prototype.reset = function() {
  23268. this.uuidList.length = 0, this.uuidObjList.length = 0, this.uuidPropList.length = 0, n.clear(this._stillUseUrl)
  23269. }, a.prototype.push = function(t, e, i, n) {
  23270. n && (this._stillUseUrl[this.uuidList.length] = !0), this.uuidList.push(i), this.uuidObjList.push(t), this.uuidPropList.push(e)
  23271. }, (a.pool = new n.Pool(function(t) {
  23272. t.reset()
  23273. }, 10)).get = function() {
  23274. return this._get() || new a
  23275. };
  23276. var l = (function() {
  23277. function t(t, e, i, n, r) {
  23278. this.result = t, this.customEnv = n, this.deserializedList = [], this.deserializedData = null, this._classFinder = i, this._idList = [], this._idObjList = [], this._idPropList = []
  23279. }
  23280. function e(t) {
  23281. var e, i, n, r = t.deserializedList,
  23282. s = t._idPropList,
  23283. o = t._idList,
  23284. a = t._idObjList;
  23285. t._classFinder && t._classFinder.onDereferenced;
  23286. for (e = 0; e < o.length; e++) i = s[e], n = o[e], a[e][i] = r[n]
  23287. }
  23288. var i = t.prototype;
  23289. function a(t, e, i, r, s, o) {
  23290. if (e instanceof cc.ValueType) {
  23291. s || t.push("if(prop){");
  23292. var a = n.getClassName(e);
  23293. t.push("s._deserializeTypedObject(o" + i + ",prop," + a + ");"), s || t.push("}else o" + i + "=null;")
  23294. } else t.push("if(prop){"), t.push("s._deserializeObjField(o,prop," + r + ",null," + !!o + ");"), t.push("}else o" + i + "=null;")
  23295. }
  23296. i.deserialize = function(t) {
  23297. if (Array.isArray(t)) {
  23298. var i = t,
  23299. n = i.length;
  23300. this.deserializedList.length = n;
  23301. for (var r = 0; r < n; r++) {
  23302. if (i[r]) this.deserializedList[r] = this._deserializeObject(i[r], !1)
  23303. }
  23304. this.deserializedData = n > 0 ? this.deserializedList[0] : []
  23305. } else this.deserializedList.length = 1, this.deserializedData = t ? this._deserializeObject(t, !1) : null, this.deserializedList[0] = this.deserializedData;
  23306. return e(this), this.deserializedData
  23307. }, i._deserializeObject = function(t, e, i, r, s) {
  23308. var o, a = null,
  23309. l = null,
  23310. c = t.__type__;
  23311. if ("TypedArray" === c) {
  23312. var u = t.array;
  23313. a = new window[t.ctor](u.length);
  23314. for (var _ = 0; _ < u.length; ++_) a[_] = u[_];
  23315. return a
  23316. }
  23317. if (c) {
  23318. if (!(l = this._classFinder(c, t, r, s))) return this._classFinder === n._getClassById && cc.deserialize.reportMissingClass(c), null;
  23319. if ((a = new l)._deserialize) return a._deserialize(t.content, this), a;
  23320. cc.Class._isCCClass(l) ? h(this, a, t, l, i) : this._deserializeTypedObject(a, t, l)
  23321. } else if (Array.isArray(t)) {
  23322. a = new Array(t.length);
  23323. for (var f = 0; f < t.length; f++) "object" == typeof(o = t[f]) && o ? this._deserializeObjField(a, o, "" + f, null, e) : a[f] = o
  23324. } else a = {}, this._deserializePrimitiveObject(a, t);
  23325. return a
  23326. }, i._deserializeObjField = function(t, e, i, n, r) {
  23327. var s = e.__id__;
  23328. if (void 0 === s) {
  23329. var o = e.__uuid__;
  23330. o ? this.result.push(t, i, o, r) : t[i] = this._deserializeObject(e, r)
  23331. } else {
  23332. var a = this.deserializedList[s];
  23333. a ? t[i] = a : (this._idList.push(s), this._idObjList.push(t), this._idPropList.push(i))
  23334. }
  23335. }, i._deserializePrimitiveObject = function(t, e) {
  23336. for (var i in e)
  23337. if (e.hasOwnProperty(i)) {
  23338. var n = e[i];
  23339. "object" != typeof n ? "__type__" !== i && (t[i] = n) : n ? this._deserializeObjField(t, n, i) : t[i] = null
  23340. }
  23341. }, i._deserializeTypedObject = function(t, e, i) {
  23342. if (i === cc.Vec2) return t.x = e.x || 0, void(t.y = e.y || 0);
  23343. if (i === cc.Vec3) return t.x = e.x || 0, t.y = e.y || 0, void(t.z = e.z || 0);
  23344. if (i !== cc.Color) {
  23345. if (i === cc.Size) return t.width = e.width || 0, void(t.height = e.height || 0);
  23346. for (var n = r.DELIMETER + "default", o = r.getClassAttrs(i), a = i.__props__ || Object.keys(t), l = 0; l < a.length; l++) {
  23347. var h = a[l],
  23348. c = e[h];
  23349. void 0 !== c && e.hasOwnProperty(h) || (c = s.getDefault(o[h + n])), "object" != typeof c ? t[h] = c : c ? this._deserializeObjField(t, c, h) : t[h] = null
  23350. }
  23351. } else {
  23352. t.r = e.r || 0, t.g = e.g || 0, t.b = e.b || 0;
  23353. var u = e.a;
  23354. t.a = void 0 === u ? 255 : u
  23355. }
  23356. };
  23357. var l = function(t, e) {
  23358. for (var i = r.DELIMETER + "type", l = (r.DELIMETER, r.DELIMETER + "default"), h = r.DELIMETER + "saveUrlAsAsset", c = r.DELIMETER + "formerlySerializedAs", u = r.getClassAttrs(e), _ = e.__values__, f = ["var prop;"], d = o.BUILTIN_CLASSID_RE.test(n._getClassId(e)), p = 0; p < _.length; p++) {
  23359. var m, y, v = _[p];
  23360. 0, s.IDENTIFIER_RE.test(v) ? (y = '"' + v + '"', m = "." + v) : m = "[" + (y = s.escapeForJS(v)) + "]";
  23361. var g = m;
  23362. if (u[v + c]) {
  23363. var x = u[v + c];
  23364. g = s.IDENTIFIER_RE.test(x) ? "." + x : "[" + s.escapeForJS(x) + "]"
  23365. }
  23366. f.push("prop=d" + g + ";"), f.push('if(typeof prop!=="undefined"){');
  23367. var b = u[v + h],
  23368. A = s.getDefault(u[v + l]);
  23369. if (d) {
  23370. var C, T = u[v + i];
  23371. if (void 0 === A && T) C = T instanceof r.PrimitiveType;
  23372. else {
  23373. var S = typeof A;
  23374. C = "string" === S && !b || "number" === S || "boolean" === S
  23375. }
  23376. C ? f.push("o" + m + "=prop;") : a(f, A, m, y, !0, b)
  23377. } else f.push('if(typeof prop!=="object"){o' + m + "=prop;}else{"), a(f, A, m, y, !1, b), f.push("}");
  23378. f.push("}")
  23379. }(cc.js.isChildClassOf(e, cc._BaseNode) || cc.js.isChildClassOf(e, cc.Component)) && f.push("d._id&&(o._id=d._id);");
  23380. return "_$erialized" === _[_.length - 1] && (f.push("o._$erialized=JSON.parse(JSON.stringify(d));"), f.push("s._deserializePrimitiveObject(o._$erialized,d);")), Function("s", "o", "d", "k", "t", f.join(""))
  23381. };
  23382. function h(t, e, i, r, s) {
  23383. var o;
  23384. r.hasOwnProperty("__deserialize__") ? o = r.__deserialize__ : (o = l(t, r), n.value(r, "__deserialize__", o, !0)), o(t, e, i, r, s)
  23385. }
  23386. return t.pool = new n.Pool(function(t) {
  23387. t.result = null, t.customEnv = null, t.deserializedList.length = 0, t.deserializedData = null, t._classFinder = null, t._idList.length = 0, t._idObjList.length = 0, t._idPropList.length = 0
  23388. }, 1), t.pool.get = function(e, i, n, r, s) {
  23389. var o = this._get();
  23390. return o ? (o.result = e, o.customEnv = r, o._classFinder = n, o) : new t(e, i, n, r, s)
  23391. }, t
  23392. })();
  23393. cc.deserialize = function(t, e, i) {
  23394. var r = (i = i || {}).classFinder || n._getClassById,
  23395. s = i.createAssetRefs || cc.sys.platform === cc.sys.EDITOR_CORE,
  23396. o = i.customEnv,
  23397. h = i.ignoreEditorOnly;
  23398. "string" == typeof t && (t = JSON.parse(t));
  23399. var c = !e;
  23400. e = e || a.pool.get();
  23401. var u = l.pool.get(e, !1, r, o, h);
  23402. cc.game._isCloning = !0;
  23403. var _ = u.deserialize(t);
  23404. return cc.game._isCloning = !1, l.pool.put(u), s && e.assignAssetsBy(Editor.serialize.asAsset), c && a.pool.put(e), _
  23405. }, cc.deserialize.Details = a, cc.deserialize.reportMissingClass = function(t) {
  23406. cc.warnID(5302, t)
  23407. }
  23408. }), {
  23409. "../utils/misc": 300,
  23410. "./CCClass": 198,
  23411. "./attribute": 210,
  23412. "./js": 218
  23413. }],
  23414. 214: [(function(t, e, i) {
  23415. "use strict";
  23416. var n = ".";
  23417. function r(t) {
  23418. this.id = 0 | 998 * Math.random(), this.prefix = t ? t + n : ""
  23419. }
  23420. r.prototype.getNewId = function() {
  23421. return this.prefix + ++this.id
  23422. }, r.global = new r("global"), e.exports = r
  23423. }), {}],
  23424. 215: [(function(t, e, i) {
  23425. "use strict";
  23426. t("./js"), t("./CCClass"), t("./CCClassDecorator"), t("./CCEnum"), t("./CCObject"), t("./callbacks-invoker"), t("./url"), t("./deserialize"), t("./instantiate"), t("./instantiate-jit"), t("./requiring-frame"), t("./CCSys"), t("./CCMacro"), t("./CCAssetLibrary"), t("./CCVisibleRect")
  23427. }), {
  23428. "./CCAssetLibrary": 197,
  23429. "./CCClass": 198,
  23430. "./CCClassDecorator": 199,
  23431. "./CCEnum": 200,
  23432. "./CCMacro": 203,
  23433. "./CCObject": 204,
  23434. "./CCSys": 207,
  23435. "./CCVisibleRect": 209,
  23436. "./callbacks-invoker": 211,
  23437. "./deserialize": 213,
  23438. "./instantiate": 217,
  23439. "./instantiate-jit": 216,
  23440. "./js": 218,
  23441. "./requiring-frame": 220,
  23442. "./url": 221
  23443. }],
  23444. 216: [(function(t, e, i) {
  23445. "use strict";
  23446. var n = t("./CCObject"),
  23447. r = n.Flags.Destroyed,
  23448. s = n.Flags.PersistentMask,
  23449. o = t("./attribute"),
  23450. a = t("./js"),
  23451. l = t("./CCClass"),
  23452. h = t("./compiler"),
  23453. c = o.DELIMETER + "default",
  23454. u = l.IDENTIFIER_RE,
  23455. _ = l.escapeForJS,
  23456. f = "var ",
  23457. d = "o",
  23458. p = "t",
  23459. m = {
  23460. "cc.Node": "cc.Node",
  23461. "cc.Sprite": "cc.Sprite",
  23462. "cc.Label": "cc.Label",
  23463. "cc.Button": "cc.Button",
  23464. "cc.Widget": "cc.Widget",
  23465. "cc.Animation": "cc.Animation",
  23466. "cc.ClickEvent": !1,
  23467. "cc.PrefabInfo": !1
  23468. };
  23469. try {
  23470. !Float32Array.name && (Float32Array.name = "Float32Array"), !Float64Array.name && (Float64Array.name = "Float64Array"), !Int8Array.name && (Int8Array.name = "Int8Array"), !Int16Array.name && (Int16Array.name = "Int16Array"), !Int32Array.name && (Int32Array.name = "Int32Array"), !Uint8Array.name && (Uint8Array.name = "Uint8Array"), !Uint16Array.name && (Uint16Array.name = "Uint16Array"), !Uint32Array.name && (Uint32Array.name = "Uint32Array")
  23471. } catch (t) {}
  23472. function y(t) {
  23473. if (t === Float32Array) return "Float32Array";
  23474. if (t === Float64Array) return "Float64Array";
  23475. if (t === Int8Array) return "Int8Array";
  23476. if (t === Int16Array) return "Int16Array";
  23477. if (t === Int32Array) return "Int32Array";
  23478. if (t === Uint8Array) return "Uint8Array";
  23479. if (t === Uint16Array) return "Uint16Array";
  23480. if (t === Uint32Array) return "Uint32Array";
  23481. throw new Error("Unknown TypedArray could not be instantiated: " + t)
  23482. }
  23483. function v(t, e) {
  23484. this.varName = t, this.expression = e
  23485. }
  23486. function g(t, e) {
  23487. return e instanceof v ? new v(e.varName, t + e.expression) : t + e
  23488. }
  23489. function x(t, e, i) {
  23490. Array.isArray(i) ? (i[0] = g(e, i[0]), t.push(i)) : t.push(g(e, i) + ";")
  23491. }
  23492. function b(t) {
  23493. this._exps = [], this._targetExp = t
  23494. }
  23495. function A(t, e) {
  23496. if ("function" == typeof t) try {
  23497. t = t()
  23498. } catch (t) {
  23499. return !1
  23500. }
  23501. if (t === e) return !0;
  23502. if (t && e) {
  23503. if (t instanceof cc.ValueType && t.equals(e)) return !0;
  23504. if (Array.isArray(t) && Array.isArray(e) || t.constructor === Object && e.constructor === Object) try {
  23505. return Array.isArray(t) && Array.isArray(e) && 0 === t.length && 0 === e.length
  23506. } catch (t) {}
  23507. }
  23508. return !1
  23509. }
  23510. function C(t) {
  23511. return u.test(t) ? "." + t : "[" + _(t) + "]"
  23512. }
  23513. function T(t, e) {
  23514. var i;
  23515. this.parent = e, this.objsToClear_iN$t = [], this.codeArray = [], this.objs = [], this.funcs = [], this.funcModuleCache = a.createMap(), a.mixin(this.funcModuleCache, m), this.globalVariables = [], this.globalVariableId = 0, this.localVariableId = 0, this.codeArray.push(f + d + "," + p + ";", "if(R){", d + "=R;", "}else{", d + "=R=new " + this.getFuncModule(t.constructor, !0) + "();", "}"), a.value(t, "_iN$t", {
  23516. globalVar: "R"
  23517. }, !0), this.objsToClear_iN$t.push(t), this.enumerateObject(this.codeArray, t), this.globalVariables.length > 0 && (i = f + this.globalVariables.join(",") + ";");
  23518. var n = h.flattenCodeArray(["return (function(R){", i || [], this.codeArray, "return o;", "})"]);
  23519. this.result = Function("O", "F", n)(this.objs, this.funcs);
  23520. for (var r = 0, s = this.objsToClear_iN$t.length; r < s; ++r) this.objsToClear_iN$t[r]._iN$t = null;
  23521. this.objsToClear_iN$t.length = 0
  23522. }
  23523. v.prototype.toString = function() {
  23524. return f + this.varName + "=" + this.expression + ";"
  23525. }, b.prototype.append = function(t, e) {
  23526. this._exps.push([t, e])
  23527. }, b.prototype.writeCode = function(t) {
  23528. var e;
  23529. if (this._exps.length > 1) t.push(p + "=" + this._targetExp + ";"), e = p;
  23530. else {
  23531. if (1 !== this._exps.length) return;
  23532. e = this._targetExp
  23533. }
  23534. for (var i = 0; i < this._exps.length; i++) {
  23535. var n = this._exps[i];
  23536. x(t, e + C(n[0]) + "=", n[1])
  23537. }
  23538. }, b.pool = new a.Pool(function(t) {
  23539. t._exps.length = 0, t._targetExp = null
  23540. }, 1), b.pool.get = function(t) {
  23541. var e = this._get() || new b;
  23542. return e._targetExp = t, e
  23543. };
  23544. var S = T.prototype;
  23545. S.getFuncModule = function(t, e) {
  23546. var i = a.getClassName(t);
  23547. if (i) {
  23548. var n = this.funcModuleCache[i];
  23549. if (n) return n;
  23550. if (void 0 === n) {
  23551. var r = -1 !== i.indexOf(".");
  23552. if (r) try {
  23553. if (r = t === Function("return " + i)()) return this.funcModuleCache[i] = i, i
  23554. } catch (t) {}
  23555. }
  23556. }
  23557. var s = this.funcs.indexOf(t);
  23558. s < 0 && (s = this.funcs.length, this.funcs.push(t));
  23559. var o = "F[" + s + "]";
  23560. return e && (o = "(" + o + ")"), this.funcModuleCache[i] = o, o
  23561. }, S.getObjRef = function(t) {
  23562. var e = this.objs.indexOf(t);
  23563. return e < 0 && (e = this.objs.length, this.objs.push(t)), "O[" + e + "]"
  23564. }, S.setValueType = function(t, e, i, n) {
  23565. var r = b.pool.get(n),
  23566. s = e.constructor.__props__;
  23567. s || (s = Object.keys(e));
  23568. for (var o = 0; o < s.length; o++) {
  23569. var a = s[o],
  23570. l = i[a];
  23571. if (e[a] !== l) {
  23572. var h = this.enumerateField(i, a, l);
  23573. r.append(a, h)
  23574. }
  23575. }
  23576. r.writeCode(t), b.pool.put(r)
  23577. }, S.enumerateCCClass = function(t, e, i) {
  23578. for (var n = i.__values__, r = o.getClassAttrs(i), s = 0; s < n.length; s++) {
  23579. var a = n[s],
  23580. h = e[a],
  23581. u = r[a + c];
  23582. if (!A(u, h))
  23583. if ("object" == typeof h && h instanceof cc.ValueType && (u = l.getDefault(u)) && u.constructor === h.constructor) {
  23584. var _ = d + C(a);
  23585. this.setValueType(t, u, h, _)
  23586. } else this.setObjProp(t, e, a, h)
  23587. }
  23588. }, S.instantiateArray = function(t) {
  23589. if (0 === t.length) return "[]";
  23590. var e = "a" + ++this.localVariableId,
  23591. i = [new v(e, "new Array(" + t.length + ")")];
  23592. a.value(t, "_iN$t", {
  23593. globalVar: "",
  23594. source: i
  23595. }, !0), this.objsToClear_iN$t.push(t);
  23596. for (var n = 0; n < t.length; ++n) {
  23597. x(i, e + "[" + n + "]=", this.enumerateField(t, n, t[n]))
  23598. }
  23599. return i
  23600. }, S.instantiateTypedArray = function(t) {
  23601. var e = t.constructor.name || y(t.constructor);
  23602. if (0 === t.length) return "new " + e;
  23603. var i = "a" + ++this.localVariableId,
  23604. n = [new v(i, "new " + e + "(" + t.length + ")")];
  23605. t._iN$t = {
  23606. globalVar: "",
  23607. source: n
  23608. }, this.objsToClear_iN$t.push(t);
  23609. for (var r = 0; r < t.length; ++r) {
  23610. if (0 !== t[r]) x(n, i + "[" + r + "]=", t[r])
  23611. }
  23612. return n
  23613. }, S.enumerateField = function(t, e, i) {
  23614. if ("object" == typeof i && i) {
  23615. var r = i._iN$t;
  23616. if (r) {
  23617. var o = r.globalVar;
  23618. if (!o) {
  23619. o = r.globalVar = "v" + ++this.globalVariableId, this.globalVariables.push(o);
  23620. var a = r.source[0];
  23621. r.source[0] = g(o + "=", a)
  23622. }
  23623. return o
  23624. }
  23625. return ArrayBuffer.isView(i) ? this.instantiateTypedArray(i) : Array.isArray(i) ? this.instantiateArray(i) : this.instantiateObj(i)
  23626. }
  23627. return "function" == typeof i ? this.getFuncModule(i) : "string" == typeof i ? _(i) : ("_objFlags" === e && t instanceof n && (i &= s), i)
  23628. }, S.setObjProp = function(t, e, i, n) {
  23629. x(t, d + C(i) + "=", this.enumerateField(e, i, n))
  23630. }, S.enumerateObject = function(t, e) {
  23631. var i = e.constructor;
  23632. if (cc.Class._isCCClass(i)) this.enumerateCCClass(t, e, i);
  23633. else
  23634. for (var n in e)
  23635. if (e.hasOwnProperty(n) && (95 !== n.charCodeAt(0) || 95 !== n.charCodeAt(1) || "__type__" === n)) {
  23636. var r = e[n];
  23637. "object" == typeof r && r && r === e._iN$t || this.setObjProp(t, e, n, r)
  23638. }
  23639. }, S.instantiateObj = function(t) {
  23640. if (t instanceof cc.ValueType) return l.getNewValueTypeCode(t);
  23641. if (t instanceof cc.Asset) return this.getObjRef(t);
  23642. if (t._objFlags & r) return null;
  23643. var e, i = t.constructor;
  23644. if (cc.Class._isCCClass(i)) {
  23645. if (this.parent)
  23646. if (this.parent instanceof cc.Component) {
  23647. if (t instanceof cc._BaseNode || t instanceof cc.Component) return this.getObjRef(t)
  23648. } else if (this.parent instanceof cc._BaseNode)
  23649. if (t instanceof cc._BaseNode) {
  23650. if (!t.isChildOf(this.parent)) return this.getObjRef(t)
  23651. } else if (t instanceof cc.Component && !t.node.isChildOf(this.parent)) return this.getObjRef(t);
  23652. e = new v(d, "new " + this.getFuncModule(i, !0) + "()")
  23653. } else if (i === Object) e = new v(d, "{}");
  23654. else {
  23655. if (i) return this.getObjRef(t);
  23656. e = new v(d, "Object.create(null)")
  23657. }
  23658. var n = [e];
  23659. return a.value(t, "_iN$t", {
  23660. globalVar: "",
  23661. source: n
  23662. }, !0), this.objsToClear_iN$t.push(t), this.enumerateObject(n, t), ["(function(){", n, "return o;})();"]
  23663. }, e.exports = {
  23664. compile: function(t) {
  23665. return new T(t, t instanceof cc._BaseNode && t).result
  23666. },
  23667. equalsToDefault: A
  23668. }
  23669. }), {
  23670. "./CCClass": 198,
  23671. "./CCObject": 204,
  23672. "./attribute": 210,
  23673. "./compiler": 212,
  23674. "./js": 218
  23675. }],
  23676. 217: [(function(t, e, i) {
  23677. "use strict";
  23678. var n = t("./CCObject"),
  23679. r = t("../value-types/value-type"),
  23680. s = n.Flags.Destroyed,
  23681. o = n.Flags.PersistentMask,
  23682. a = t("./utils").isDomNode,
  23683. l = t("./js");
  23684. function h(t, e) {
  23685. if (!e) {
  23686. if ("object" != typeof t || Array.isArray(t)) return null;
  23687. if (!t) return null;
  23688. if (!cc.isValid(t)) return null;
  23689. 0
  23690. }
  23691. var i;
  23692. if (t instanceof n) {
  23693. if (t._instantiate) return cc.game._isCloning = !0, i = t._instantiate(), cc.game._isCloning = !1, i;
  23694. if (t instanceof cc.Asset) return null
  23695. }
  23696. return cc.game._isCloning = !0, i = u(t), cc.game._isCloning = !1, i
  23697. }
  23698. var c = [];
  23699. function u(t, e) {
  23700. if (Array.isArray(t)) return null;
  23701. if (a && a(t)) return null;
  23702. var i;
  23703. if (t._iN$t) i = t._iN$t;
  23704. else if (t.constructor) {
  23705. i = new(0, t.constructor)
  23706. } else i = Object.create(null);
  23707. f(t, i, e);
  23708. for (var n = 0, r = c.length; n < r; ++n) c[n]._iN$t = null;
  23709. return c.length = 0, i
  23710. }
  23711. function _(t, e, i, n) {
  23712. for (var s = t.__values__, o = 0; o < s.length; o++) {
  23713. var a = s[o],
  23714. l = e[a];
  23715. if ("object" == typeof l && l) {
  23716. var h = i[a];
  23717. h instanceof r && h.constructor === l.constructor ? h.set(l) : i[a] = l._iN$t || d(l, n)
  23718. } else i[a] = l
  23719. }
  23720. }
  23721. function f(t, e, i) {
  23722. l.value(t, "_iN$t", e, !0), c.push(t);
  23723. var r = t.constructor;
  23724. if (cc.Class._isCCClass(r)) _(r, t, e, i);
  23725. else
  23726. for (var s in t)
  23727. if (t.hasOwnProperty(s) && (95 !== s.charCodeAt(0) || 95 !== s.charCodeAt(1) || "__type__" === s)) {
  23728. var a = t[s];
  23729. if ("object" == typeof a && a) {
  23730. if (a === e) continue;
  23731. e[s] = a._iN$t || d(a, i)
  23732. } else e[s] = a
  23733. }
  23734. t instanceof n && (e._objFlags &= o)
  23735. }
  23736. function d(t, e) {
  23737. if (t instanceof r) return t.clone();
  23738. if (t instanceof cc.Asset) return t;
  23739. var i;
  23740. if (ArrayBuffer.isView(t)) {
  23741. var n = t.length;
  23742. i = new t.constructor(n), t._iN$t = i, c.push(t);
  23743. for (var o = 0; o < n; ++o) i[o] = t[o];
  23744. return i
  23745. }
  23746. if (Array.isArray(t)) {
  23747. var a = t.length;
  23748. i = new Array(a), l.value(t, "_iN$t", i, !0), c.push(t);
  23749. for (var h = 0; h < a; ++h) {
  23750. var u = t[h];
  23751. i[h] = "object" == typeof u && u ? u._iN$t || d(u, e) : u
  23752. }
  23753. return i
  23754. }
  23755. if (t._objFlags & s) return null;
  23756. var _ = t.constructor;
  23757. if (cc.Class._isCCClass(_)) {
  23758. if (e)
  23759. if (e instanceof cc.Component) {
  23760. if (t instanceof cc._BaseNode || t instanceof cc.Component) return t
  23761. } else if (e instanceof cc._BaseNode)
  23762. if (t instanceof cc._BaseNode) {
  23763. if (!t.isChildOf(e)) return t
  23764. } else if (t instanceof cc.Component && !t.node.isChildOf(e)) return t;
  23765. i = new _
  23766. } else if (_ === Object) i = {};
  23767. else {
  23768. if (_) return t;
  23769. i = Object.create(null)
  23770. }
  23771. return f(t, i, e), i
  23772. }
  23773. h._clone = u, cc.instantiate = h, e.exports = h
  23774. }), {
  23775. "../value-types/value-type": 320,
  23776. "./CCObject": 204,
  23777. "./js": 218,
  23778. "./utils": 222
  23779. }],
  23780. 218: [(function(t, e, i) {
  23781. "use strict";
  23782. var n = new(t("./id-generater"))("TmpCId.");
  23783. function r(t, e) {
  23784. for (; t;) {
  23785. var i = Object.getOwnPropertyDescriptor(t, e);
  23786. if (i) return i;
  23787. t = Object.getPrototypeOf(t)
  23788. }
  23789. return null
  23790. }
  23791. function s(t, e, i) {
  23792. var n = r(e, t);
  23793. Object.defineProperty(i, t, n)
  23794. }
  23795. var o = {
  23796. isNumber: function(t) {
  23797. return "number" == typeof t || t instanceof Number
  23798. },
  23799. isString: function(t) {
  23800. return "string" == typeof t || t instanceof String
  23801. },
  23802. addon: function(t) {
  23803. t = t || {};
  23804. for (var e = 1, i = arguments.length; e < i; e++) {
  23805. var n = arguments[e];
  23806. if (n) {
  23807. if ("object" != typeof n) {
  23808. cc.errorID(5402, n);
  23809. continue
  23810. }
  23811. for (var r in n) r in t || s(r, n, t)
  23812. }
  23813. }
  23814. return t
  23815. },
  23816. mixin: function(t) {
  23817. t = t || {};
  23818. for (var e = 1, i = arguments.length; e < i; e++) {
  23819. var n = arguments[e];
  23820. if (n) {
  23821. if ("object" != typeof n) {
  23822. cc.errorID(5403, n);
  23823. continue
  23824. }
  23825. for (var r in n) s(r, n, t)
  23826. }
  23827. }
  23828. return t
  23829. },
  23830. extend: function(t, e) {
  23831. for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
  23832. return t.prototype = Object.create(e.prototype, {
  23833. constructor: {
  23834. value: t,
  23835. writable: !0,
  23836. configurable: !0
  23837. }
  23838. }), t
  23839. },
  23840. getSuper: function(t) {
  23841. var e = t.prototype,
  23842. i = e && Object.getPrototypeOf(e);
  23843. return i && i.constructor
  23844. },
  23845. isChildClassOf: function(t, e) {
  23846. if (t && e) {
  23847. if ("function" != typeof t) return !1;
  23848. if ("function" != typeof e) return !1;
  23849. if (t === e) return !0;
  23850. for (;;) {
  23851. if (!(t = o.getSuper(t))) return !1;
  23852. if (t === e) return !0
  23853. }
  23854. }
  23855. return !1
  23856. },
  23857. clear: function(t) {
  23858. for (var e = Object.keys(t), i = 0; i < e.length; i++) delete t[e[i]]
  23859. },
  23860. isEmptyObject: function(t) {
  23861. for (var e in t) return !1;
  23862. return !0
  23863. },
  23864. getPropertyDescriptor: r
  23865. },
  23866. a = {
  23867. value: void 0,
  23868. enumerable: !1,
  23869. writable: !1,
  23870. configurable: !0
  23871. };
  23872. o.value = function(t, e, i, n, r) {
  23873. a.value = i, a.writable = n, a.enumerable = r, Object.defineProperty(t, e, a), a.value = void 0
  23874. };
  23875. var l = {
  23876. get: null,
  23877. set: null,
  23878. enumerable: !1
  23879. };
  23880. o.getset = function(t, e, i, n, r, s) {
  23881. "function" != typeof n && (r = n, n = void 0), l.get = i, l.set = n, l.enumerable = r, l.configurable = s, Object.defineProperty(t, e, l), l.get = null, l.set = null
  23882. };
  23883. var h = {
  23884. get: null,
  23885. enumerable: !1,
  23886. configurable: !1
  23887. };
  23888. o.get = function(t, e, i, n, r) {
  23889. h.get = i, h.enumerable = n, h.configurable = r, Object.defineProperty(t, e, h), h.get = null
  23890. };
  23891. var c = {
  23892. set: null,
  23893. enumerable: !1,
  23894. configurable: !1
  23895. };
  23896. o.set = function(t, e, i, n, r) {
  23897. c.set = i, c.enumerable = n, c.configurable = r, Object.defineProperty(t, e, c), c.set = null
  23898. }, o.getClassName = function(t) {
  23899. if ("function" == typeof t) {
  23900. var e = t.prototype;
  23901. if (e && e.hasOwnProperty("__classname__") && e.__classname__) return e.__classname__;
  23902. var i = "";
  23903. if (t.name && (i = t.name), t.toString) {
  23904. var n, r = t.toString();
  23905. (n = "[" === r.charAt(0) ? r.match(/\[\w+\s*(\w+)\]/) : r.match(/function\s*(\w+)/)) && 2 === n.length && (i = n[1])
  23906. }
  23907. return "Object" !== i ? i : ""
  23908. }
  23909. return t && t.constructor ? o.getClassName(t.constructor) : ""
  23910. }, (function() {
  23911. var t = {},
  23912. e = {};
  23913. function i(t, e, i) {
  23914. return o.getset(o, e, (function() {
  23915. return Object.assign({}, i)
  23916. }), (function(t) {
  23917. o.clear(i), Object.assign(i, t)
  23918. })),
  23919. function(e, n) {
  23920. if (n.prototype.hasOwnProperty(t) && delete i[n.prototype[t]], o.value(n.prototype, t, e), e) {
  23921. var r = i[e];
  23922. if (r && r !== n) {
  23923. var s = "A Class already exists with the same " + t + ' : "' + e + '".';
  23924. 0, cc.error(s)
  23925. } else i[e] = n
  23926. }
  23927. }
  23928. }
  23929. o._setClassId = i("__cid__", "_registeredClassIds", t);
  23930. var r = i("__classname__", "_registeredClassNames", e);
  23931. o.setClassName = function(t, e) {
  23932. if (r(t, e), !e.prototype.hasOwnProperty("__cid__")) {
  23933. var i = t || n.getNewId();
  23934. i && o._setClassId(i, e)
  23935. }
  23936. }, o.unregisterClass = function() {
  23937. for (var i = 0; i < arguments.length; i++) {
  23938. var n = arguments[i].prototype,
  23939. r = n.__cid__;
  23940. r && delete t[r];
  23941. var s = n.__classname__;
  23942. s && delete e[s]
  23943. }
  23944. }, o._getClassById = function(e) {
  23945. return t[e]
  23946. }, o.getClassByName = function(t) {
  23947. return e[t]
  23948. }, o._getClassId = function(t, e) {
  23949. if (e = void 0 === e || e, "function" == typeof t && t.prototype.hasOwnProperty("__cid__")) return t.prototype.__cid__;
  23950. if (t && t.constructor) {
  23951. var i = t.constructor.prototype;
  23952. if (i && i.hasOwnProperty("__cid__")) return t.__cid__
  23953. }
  23954. return ""
  23955. }
  23956. })(), o.obsolete = function(t, e, i, n) {
  23957. var r = /([^.]+)$/,
  23958. s = r.exec(e)[0],
  23959. a = r.exec(i)[0];
  23960. function l() {
  23961. return this[a]
  23962. }
  23963. n ? o.getset(t, s, l, (function(t) {
  23964. this[a] = t
  23965. })) : o.get(t, s, l)
  23966. }, o.obsoletes = function(t, e, i, n) {
  23967. for (var r in i) {
  23968. var s = i[r];
  23969. o.obsolete(t, e + "." + r, s, n)
  23970. }
  23971. };
  23972. var u = /(%d)|(%s)/,
  23973. _ = /%s/;
  23974. function f(t, e) {
  23975. t.splice(e, 1)
  23976. }
  23977. function d(t, e) {
  23978. var i = t.indexOf(e);
  23979. return i >= 0 && (f(t, i), !0)
  23980. }
  23981. o.formatStr = function() {
  23982. var t = arguments.length;
  23983. if (0 === t) return "";
  23984. var e = arguments[0];
  23985. if (1 === t) return "" + e;
  23986. if ("string" == typeof e && u.test(e))
  23987. for (var i = 1; i < t; ++i) {
  23988. var n = arguments[i],
  23989. r = "number" == typeof n ? u : _;
  23990. r.test(e) ? e = e.replace(r, n) : e += " " + n
  23991. } else
  23992. for (var s = 1; s < t; ++s) e += " " + arguments[s];
  23993. return e
  23994. }, o.shiftArguments = function() {
  23995. for (var t = arguments.length - 1, e = new Array(t), i = 0; i < t; ++i) e[i] = arguments[i + 1];
  23996. return e
  23997. }, o.createMap = function(t) {
  23998. var e = Object.create(null);
  23999. if (t) {
  24000. e["."] = !0, e["/"] = !0, delete e["."], delete e["/"]
  24001. }
  24002. return e
  24003. };
  24004. var p = Array.prototype.indexOf;
  24005. function m(t, e) {
  24006. void 0 === e && (e = t, t = null), this.get = null, this.count = 0, this._pool = new Array(e), this._cleanup = t
  24007. }
  24008. o.array = {
  24009. remove: d,
  24010. fastRemove: function(t, e) {
  24011. var i = t.indexOf(e);
  24012. i >= 0 && (t[i] = t[t.length - 1], --t.length)
  24013. },
  24014. removeAt: f,
  24015. fastRemoveAt: function(t, e) {
  24016. var i = t.length;
  24017. e < 0 || e >= i || (t[e] = t[i - 1], t.length = i - 1)
  24018. },
  24019. contains: function(t, e) {
  24020. return t.indexOf(e) >= 0
  24021. },
  24022. verifyType: function(t, e) {
  24023. if (t && t.length > 0)
  24024. for (var i = 0; i < t.length; i++)
  24025. if (!(t[i] instanceof e)) return cc.logID(1300), !1;
  24026. return !0
  24027. },
  24028. removeArray: function(t, e) {
  24029. for (var i = 0, n = e.length; i < n; i++) d(t, e[i])
  24030. },
  24031. appendObjectsAt: function(t, e, i) {
  24032. return t.splice.apply(t, [i, 0].concat(e)), t
  24033. },
  24034. copy: function(t) {
  24035. var e, i = t.length,
  24036. n = new Array(i);
  24037. for (e = 0; e < i; e += 1) n[e] = t[e];
  24038. return n
  24039. },
  24040. indexOf: p,
  24041. MutableForwardIterator: t("../utils/mutable-forward-iterator")
  24042. }, m.prototype._get = function() {
  24043. if (this.count > 0) {
  24044. --this.count;
  24045. var t = this._pool[this.count];
  24046. return this._pool[this.count] = null, t
  24047. }
  24048. return null
  24049. }, m.prototype.put = function(t) {
  24050. var e = this._pool;
  24051. if (this.count < e.length) {
  24052. if (this._cleanup && !1 === this._cleanup(t)) return;
  24053. e[this.count] = t, ++this.count
  24054. }
  24055. }, m.prototype.resize = function(t) {
  24056. t >= 0 && (this._pool.length = t, this.count > t && (this.count = t))
  24057. }, o.Pool = m, cc.js = o, e.exports = o
  24058. }), {
  24059. "../utils/mutable-forward-iterator": 301,
  24060. "./id-generater": 214
  24061. }],
  24062. 219: [(function(t, e, i) {
  24063. "use strict";
  24064. var n = t("./js"),
  24065. r = t("./attribute"),
  24066. s = {
  24067. url: {
  24068. canUsedInGet: !0
  24069. },
  24070. default: {},
  24071. serializable: {},
  24072. editorOnly: {},
  24073. formerlySerializedAs: {}
  24074. };
  24075. function o(t, e, i, n) {
  24076. if (!t.get && !t.set)
  24077. if (t.hasOwnProperty("default")) {
  24078. var r = "_N$" + e;
  24079. t.get = function() {
  24080. return this[r]
  24081. }, t.set = function(t) {
  24082. var e = this[r];
  24083. this[r] = t, i.call(this, e)
  24084. };
  24085. var o = {};
  24086. for (var a in n[r] = o, s) {
  24087. var l = s[a];
  24088. t.hasOwnProperty(a) && (o[a] = t[a], l.canUsedInGet || delete t[a])
  24089. }
  24090. } else 0
  24091. }
  24092. function a(t, e, i, n) {
  24093. Array.isArray(n) && n.length > 0 && (n = n[0]), t.type = n
  24094. }
  24095. function l(t, e, i, n) {
  24096. if (Array.isArray(e)) {
  24097. if (!(e.length > 0)) return cc.errorID(5508, i, n);
  24098. if (cc.RawAsset.isRawAssetType(e[0])) return t.url = e[0], void delete t.type;
  24099. t.type = e = e[0]
  24100. }
  24101. "function" == typeof e && (e === String ? t.type = cc.String : e === Boolean ? t.type = cc.Boolean : e === Number && (t.type = cc.Float))
  24102. }
  24103. i.getFullFormOfProperty = function(t, e, i) {
  24104. if (t && t.constructor === Object) return null;
  24105. if (Array.isArray(t) && t.length > 0) {
  24106. t[0];
  24107. return {
  24108. default: [],
  24109. type: t,
  24110. _short: !0
  24111. }
  24112. }
  24113. if ("function" == typeof t) {
  24114. var s = t;
  24115. return cc.RawAsset.isRawAssetType(s) || cc.RawAsset.wasRawAssetType(s) ? {
  24116. default: "",
  24117. url: s,
  24118. _short: !0
  24119. } : {
  24120. default: n.isChildClassOf(s, cc.ValueType) ? new s : null,
  24121. type: s,
  24122. _short: !0
  24123. }
  24124. }
  24125. return t instanceof r.PrimitiveType ? {
  24126. default: t.default,
  24127. _short: !0
  24128. } : {
  24129. default: t,
  24130. _short: !0
  24131. }
  24132. }, i.preprocessAttrs = function(t, e, n, r) {
  24133. for (var s in t) {
  24134. var h = t[s],
  24135. c = i.getFullFormOfProperty(h, s, e);
  24136. if (c && (h = t[s] = c), h) {
  24137. var u = h.notify;
  24138. u && o(h, s, u, t), "type" in h && l(h, h.type, e, s), "url" in h && a(h, 0, 0, h.url), "type" in h && h.type
  24139. }
  24140. }
  24141. }, i.validateMethodWithProps = function(t, e, i, n, r) {
  24142. return "function" == typeof t || null === t
  24143. }
  24144. }), {
  24145. "./CCClass": 198,
  24146. "./attribute": 210,
  24147. "./js": 218
  24148. }],
  24149. 220: [(function(t, e, i) {
  24150. "use strict";
  24151. var n = [];
  24152. cc._RF = {
  24153. push: function(t, e, i) {
  24154. void 0 === i && (i = e, e = ""), n.push({
  24155. uuid: e,
  24156. script: i,
  24157. module: t,
  24158. exports: t.exports,
  24159. beh: null
  24160. })
  24161. },
  24162. pop: function() {
  24163. var t = n.pop(),
  24164. e = t.module,
  24165. i = e.exports;
  24166. if (i === t.exports) {
  24167. for (var r in i) return;
  24168. e.exports = i = t.cls
  24169. }
  24170. },
  24171. peek: function() {
  24172. return n[n.length - 1]
  24173. }
  24174. }
  24175. }), {}],
  24176. 221: [(function(t, e, i) {
  24177. "use strict";
  24178. cc.url = {
  24179. _rawAssets: "",
  24180. normalize: function(t) {
  24181. return t && (46 === t.charCodeAt(0) && 47 === t.charCodeAt(1) ? t = t.slice(2) : 47 === t.charCodeAt(0) && (t = t.slice(1))), t
  24182. },
  24183. raw: function(t) {
  24184. if ((t = this.normalize(t)).startsWith("resources/")) {
  24185. var e = cc.loader._getResUuid(t.slice(10), cc.Asset, null, !0);
  24186. if (e) return cc.AssetLibrary.getLibUrlNoExt(e, !0) + cc.path.extname(t)
  24187. } else cc.errorID(7002, t);
  24188. return this._rawAssets + t
  24189. },
  24190. _init: function(t) {
  24191. this._rawAssets = cc.path.stripSep(t) + "/"
  24192. }
  24193. }, e.exports = cc.url
  24194. }), {}],
  24195. 222: [(function(t, e, i) {
  24196. "use strict";
  24197. t("./js");
  24198. e.exports = {
  24199. contains: function(t, e) {
  24200. if ("function" == typeof t.contains) return t.contains(e);
  24201. if ("function" == typeof t.compareDocumentPosition) return !!(16 & t.compareDocumentPosition(e));
  24202. var i = e.parentNode;
  24203. if (i)
  24204. do {
  24205. if (i === t) return !0;
  24206. i = i.parentNode
  24207. } while (null !== i);
  24208. return !1
  24209. },
  24210. isDomNode: "object" == typeof window && ("function" == typeof Node ? function(t) {
  24211. return t instanceof Node
  24212. } : function(t) {
  24213. return t && "object" == typeof t && "number" == typeof t.nodeType && "string" == typeof t.nodeName
  24214. }),
  24215. callInNextTick: function(t, e, i) {
  24216. t && setTimeout((function() {
  24217. t(e, i)
  24218. }), 0)
  24219. }
  24220. }
  24221. }), {
  24222. "./js": 218
  24223. }],
  24224. 223: [(function(t, e, i) {
  24225. "use strict";
  24226. t("./platform/js"), t("./value-types"), t("./utils"), t("./platform/CCInputManager"), t("./platform/CCInputExtension"), t("./event"), t("./platform/CCSys"), t("./platform/CCMacro"), t("./load-pipeline"), t("./CCDirector"), t("./renderer"), t("./platform/CCView"), t("./platform/CCScreen"), t("./CCScheduler"), t("./event-manager")
  24227. }), {
  24228. "./CCDirector": 50,
  24229. "./CCScheduler": 55,
  24230. "./event": 133,
  24231. "./event-manager": 129,
  24232. "./load-pipeline": 153,
  24233. "./platform/CCInputExtension": 201,
  24234. "./platform/CCInputManager": 202,
  24235. "./platform/CCMacro": 203,
  24236. "./platform/CCScreen": 206,
  24237. "./platform/CCSys": 207,
  24238. "./platform/CCView": 208,
  24239. "./platform/js": 218,
  24240. "./renderer": 247,
  24241. "./utils": 298,
  24242. "./value-types": 315
  24243. }],
  24244. 224: [(function(t, e, i) {
  24245. "use strict";
  24246. i.__esModule = !0, i.default = void 0;
  24247. var n = (function() {
  24248. function t(t, e) {
  24249. for (var i = 0; i < e.length; i++) {
  24250. var n = e[i];
  24251. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  24252. }
  24253. }
  24254. return function(e, i, n) {
  24255. return i && t(e.prototype, i), n && t(e, n), e
  24256. }
  24257. })(),
  24258. r = a(t("./assembler")),
  24259. s = a(t("./utils/dynamic-atlas/manager")),
  24260. o = a(t("./webgl/render-data"));
  24261. function a(t) {
  24262. return t && t.__esModule ? t : {
  24263. default: t
  24264. }
  24265. }
  24266. function l(t, e) {
  24267. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24268. }
  24269. function h(t, e) {
  24270. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  24271. return !e || "object" != typeof e && "function" != typeof e ? t : e
  24272. }
  24273. function c(t, e) {
  24274. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  24275. t.prototype = Object.create(e && e.prototype, {
  24276. constructor: {
  24277. value: t,
  24278. enumerable: !1,
  24279. writable: !0,
  24280. configurable: !0
  24281. }
  24282. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  24283. }
  24284. var u = (function(t) {
  24285. function e() {
  24286. l(this, e);
  24287. var i = h(this, t.call(this));
  24288. return i._renderData = new o.default, i._renderData.init(i), i.initData(), i.initLocal(), i
  24289. }
  24290. return c(e, t), e.prototype.initData = function() {
  24291. this._renderData.createQuadData(0, this.verticesFloats, this.indicesCount)
  24292. }, e.prototype.initLocal = function() {
  24293. this._local = [], this._local.length = 4
  24294. }, e.prototype.updateColor = function(t, e) {
  24295. var i = this._renderData.uintVDatas[0];
  24296. if (i) {
  24297. e = e || t.node.color._val;
  24298. for (var n = this.floatsPerVert, r = this.colorOffset, s = i.length; r < s; r += n) i[r] = e
  24299. }
  24300. }, e.prototype.getBuffer = function() {
  24301. return cc.renderer._handle._meshBuffer
  24302. }, e.prototype.updateWorldVerts = function(t) {
  24303. var e = this._local,
  24304. i = this._renderData.vDatas[0],
  24305. n = t.node._worldMatrix.m,
  24306. r = n[0],
  24307. s = n[1],
  24308. o = n[4],
  24309. a = n[5],
  24310. l = n[12],
  24311. h = n[13],
  24312. c = e[0],
  24313. u = e[2],
  24314. _ = e[1],
  24315. f = e[3];
  24316. if (1 === r && 0 === s && 0 === o && 1 === a) i[0] = c + l, i[1] = _ + h, i[5] = u + l, i[6] = _ + h, i[10] = c + l, i[11] = f + h, i[15] = u + l, i[16] = f + h;
  24317. else {
  24318. var d = r * c,
  24319. p = r * u,
  24320. m = s * c,
  24321. y = s * u,
  24322. v = o * _,
  24323. g = o * f,
  24324. x = a * _,
  24325. b = a * f;
  24326. i[0] = d + v + l, i[1] = m + x + h, i[5] = p + v + l, i[6] = y + x + h, i[10] = d + g + l, i[11] = m + b + h, i[15] = p + g + l, i[16] = y + b + h
  24327. }
  24328. }, e.prototype.fillBuffers = function(t, e) {
  24329. e.worldMatDirty && this.updateWorldVerts(t);
  24330. var i = this._renderData,
  24331. n = i.vDatas[0],
  24332. r = i.iDatas[0],
  24333. s = this.getBuffer(e),
  24334. o = s.request(this.verticesCount, this.indicesCount),
  24335. a = o.byteOffset >> 2,
  24336. l = s._vData;
  24337. n.length + a > l.length ? l.set(n.subarray(0, l.length - a), a) : l.set(n, a);
  24338. for (var h = s._iData, c = o.indiceOffset, u = o.vertexOffset, _ = 0, f = r.length; _ < f; _++) h[c++] = u + r[_]
  24339. }, e.prototype.packToDynamicAtlas = function(t, e) {
  24340. if (e) {
  24341. if (!e._original && s.default && e._texture.packable) {
  24342. var i = s.default.insertSpriteFrame(e);
  24343. i && e._setDynamicAtlasFrame(i)
  24344. }
  24345. var n = t.sharedMaterials[0];
  24346. if (!n) return;
  24347. n.getProperty("texture") !== e._texture && (t._vertsDirty = !0, t._activateMaterial(!0))
  24348. }
  24349. }, n(e, [{
  24350. key: "verticesFloats",
  24351. get: function() {
  24352. return this.verticesCount * this.floatsPerVert
  24353. }
  24354. }]), e
  24355. })(r.default);
  24356. i.default = u, cc.js.addon(u.prototype, {
  24357. floatsPerVert: 5,
  24358. verticesCount: 4,
  24359. indicesCount: 6,
  24360. uvOffset: 2,
  24361. colorOffset: 4
  24362. }), cc.Assembler2D = u, e.exports = i.default
  24363. }), {
  24364. "./assembler": 227,
  24365. "./utils/dynamic-atlas/manager": 250,
  24366. "./webgl/render-data": 286
  24367. }],
  24368. 225: [(function(t, e, i) {
  24369. "use strict";
  24370. i.__esModule = !0;
  24371. for (var n = t("./webgl/vertex-format"), r = cc.vmath.vec3, s = [], o = 0; o < 4; o++) s.push(r.create());
  24372. var a = {
  24373. floatsPerVert: 6,
  24374. uvOffset: 3,
  24375. colorOffset: 5,
  24376. getBuffer: function(t) {
  24377. return t._meshBuffer3D
  24378. },
  24379. getVfmt: function() {
  24380. return n.vfmt3D
  24381. },
  24382. updateWorldVerts: function(t) {
  24383. var e = t.node._worldMatrix,
  24384. i = this._local,
  24385. n = this._renderData.vDatas[0];
  24386. r.set(s[0], i[0], i[1], 0), r.set(s[1], i[2], i[1], 0), r.set(s[2], i[0], i[3], 0), r.set(s[3], i[2], i[3], 0);
  24387. for (var o = this.floatsPerVert, a = 0; a < 4; a++) {
  24388. var l = s[a];
  24389. r.transformMat4(l, l, e);
  24390. var h = o * a;
  24391. n[h] = l.x, n[h + 1] = l.y, n[h + 2] = l.z
  24392. }
  24393. }
  24394. };
  24395. cc.Assembler3D = a, i.default = a, e.exports = i.default
  24396. }), {
  24397. "./webgl/vertex-format": 288
  24398. }],
  24399. 226: [(function(t, e, i) {
  24400. "use strict";
  24401. i.__esModule = !0;
  24402. var n = (function(t) {
  24403. return t && t.__esModule ? t : {
  24404. default: t
  24405. }
  24406. })(t("../utils/pool"));
  24407. function r(t, e) {
  24408. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24409. }
  24410. function s(t, e) {
  24411. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  24412. return !e || "object" != typeof e && "function" != typeof e ? t : e
  24413. }
  24414. function o(t, e) {
  24415. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  24416. t.prototype = Object.create(e && e.prototype, {
  24417. constructor: {
  24418. value: t,
  24419. enumerable: !1,
  24420. writable: !0,
  24421. configurable: !0
  24422. }
  24423. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  24424. }
  24425. var a = 0;
  24426. function l(t) {
  24427. return Object.getOwnPropertyDescriptor(t, "__assemblerId__") || (t.__assemblerId__ = ++a), t.__assemblerId__
  24428. }
  24429. var h = new(function(t) {
  24430. function e() {
  24431. var i, n;
  24432. r(this, e);
  24433. for (var o = arguments.length, a = Array(o), l = 0; l < o; l++) a[l] = arguments[l];
  24434. return i = n = s(this, t.call.apply(t, [this].concat(a))), n._pool = {}, s(n, i)
  24435. }
  24436. return o(e, t), e.prototype.put = function(t) {
  24437. if (t && this.enabled) {
  24438. var e = l(t.constructor),
  24439. i = this._pool;
  24440. i[e] || (i[e] = []), this.count > this.maxSize || (this._clean(t), i[e].push(t), this.count++)
  24441. }
  24442. }, e.prototype.get = function(t) {
  24443. var e = void 0;
  24444. if (this.enabled) {
  24445. var i = this._pool,
  24446. n = l(t);
  24447. e = i[n] && i[n].pop()
  24448. }
  24449. return e ? this.count-- : e = new t, e
  24450. }, e.prototype.clear = function() {
  24451. this._pool = {}, this.count = 0
  24452. }, e.prototype._clean = function(t) {
  24453. t._renderComp = null
  24454. }, e
  24455. }(n.default));
  24456. n.default.register("assembler", h), i.default = h, e.exports = i.default
  24457. }), {
  24458. "../utils/pool": 302
  24459. }],
  24460. 227: [(function(t, e, i) {
  24461. "use strict";
  24462. i.__esModule = !0, i.default = void 0;
  24463. var n = t("./webgl/vertex-format"),
  24464. r = (function(t) {
  24465. return t && t.__esModule ? t : {
  24466. default: t
  24467. }
  24468. })(t("./assembler-pool"));
  24469. function s(t, e) {
  24470. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24471. }
  24472. var o = (function() {
  24473. function t() {
  24474. s(this, t), this._extendNative && this._extendNative()
  24475. }
  24476. return t.prototype.init = function(t) {
  24477. this._renderComp = t
  24478. }, t.prototype.updateRenderData = function(t) {}, t.prototype.fillBuffers = function(t, e) {}, t.prototype.getVfmt = function() {
  24479. return n.vfmtPosUvColor
  24480. }, t
  24481. })();
  24482. i.default = o, o.register = function(t, e) {
  24483. t.__assembler__ = e
  24484. }, o.init = function(t) {
  24485. for (var e = t.constructor, i = e.__assembler__; !i;) {
  24486. if (!(e = e.$super)) return void cc.warn("Can not find assembler for render component : [" + cc.js.getClassName(t) + "]");
  24487. i = e.__assembler__
  24488. }
  24489. if (i.getConstructor && (i = i.getConstructor(t)), !t._assembler || t._assembler.constructor !== i) {
  24490. var n = r.default.get(i);
  24491. n.init(t), t._assembler = n
  24492. }
  24493. }, cc.Assembler = o, e.exports = i.default
  24494. }), {
  24495. "./assembler-pool": 226,
  24496. "./webgl/vertex-format": 288
  24497. }],
  24498. 228: [(function(t, e, i) {
  24499. "use strict";
  24500. var n = function(t) {
  24501. var e;
  24502. try {
  24503. e = t.getContext("2d")
  24504. } catch (t) {
  24505. return void console.error(t)
  24506. }
  24507. this._canvas = t, this._ctx = e, this._caps = {}, this._stats = {
  24508. drawcalls: 0
  24509. }, this._vx = this._vy = this._vw = this._vh = 0, this._sx = this._sy = this._sw = this._sh = 0
  24510. };
  24511. n.prototype._restoreTexture = function(t) {}, n.prototype.setViewport = function(t, e, i, n) {
  24512. this._vx === t && this._vy === e && this._vw === i && this._vh === n || (this._vx = t, this._vy = e, this._vw = i, this._vh = n)
  24513. }, n.prototype.setScissor = function(t, e, i, n) {
  24514. this._sx === t && this._sy === e && this._sw === i && this._sh === n || (this._sx = t, this._sy = e, this._sw = i, this._sh = n)
  24515. }, n.prototype.clear = function(t) {
  24516. var e = this._ctx;
  24517. e.clearRect(this._vx, this._vy, this._vw, this._vh), !t || 0 === t[0] && 0 === t[1] && 0 === t[2] || (e.fillStyle = "rgb(" + t[0] + "," + t[1] + "," + t[2] + ")", e.globalAlpha = t[3], e.fillRect(this._vx, this._vy, this._vw, this._vh))
  24518. }, n.prototype.resetDrawCalls = function() {
  24519. this._stats.drawcalls = 0
  24520. }, n.prototype.getDrawCalls = function() {
  24521. return this._stats.drawcalls
  24522. }, e.exports = n
  24523. }), {}],
  24524. 229: [(function(t, e, i) {
  24525. "use strict";
  24526. var n = function(t, e) {
  24527. this._device = t, this._width = 4, this._height = 4, this._image = null, e && (void 0 !== e.width && (this._width = e.width), void 0 !== e.height && (this._height = e.height), this.updateImage(e))
  24528. };
  24529. n.prototype.update = function(t) {
  24530. this.updateImage(t)
  24531. }, n.prototype.updateImage = function(t) {
  24532. if (t.images && t.images[0]) {
  24533. var e = t.images[0];
  24534. e && e !== this._image && (this._image = e)
  24535. }
  24536. }, n.prototype.destroy = function() {
  24537. this._image = null
  24538. }, e.exports = n
  24539. }), {}],
  24540. 230: [(function(t, e, i) {
  24541. "use strict";
  24542. var n = function() {};
  24543. n.prototype = {
  24544. constructor: n,
  24545. clear: function() {},
  24546. render: function() {}
  24547. }, e.exports = n
  24548. }), {}],
  24549. 231: [(function(t, e, i) {
  24550. "use strict";
  24551. i.__esModule = !0, t("./render-flow"), t("./renderers");
  24552. var n = s(t("./forward-renderer")),
  24553. r = s(t("./render-component-handle"));
  24554. function s(t) {
  24555. return t && t.__esModule ? t : {
  24556. default: t
  24557. }
  24558. }
  24559. i.default = {
  24560. ForwardRenderer: n.default,
  24561. RenderComponentHandle: r.default
  24562. }, e.exports = i.default
  24563. }), {
  24564. "./forward-renderer": 230,
  24565. "./render-component-handle": 232,
  24566. "./render-flow": 233,
  24567. "./renderers": 236
  24568. }],
  24569. 232: [(function(t, e, i) {
  24570. "use strict";
  24571. var n = t("./renderers/utils"),
  24572. r = function(t, e) {
  24573. this._device = t, this._camera = e, this.parentOpacity = 1, this.parentOpacityDirty = 0, this.worldMatDirty = 0, this.walking = !1
  24574. };
  24575. r.prototype = {
  24576. constructor: r,
  24577. reset: function() {
  24578. var t = this._device._ctx,
  24579. e = this._device._canvas,
  24580. i = cc.Camera.main ? cc.Camera.main.backgroundColor : cc.color(),
  24581. r = "rgba(" + i.r + ", " + i.g + ", " + i.b + ", " + i.a / 255 + ")";
  24582. t.fillStyle = r, t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, e.width, e.height), t.fillRect(0, 0, e.width, e.height), this._device._stats.drawcalls = 0, n.context.reset()
  24583. },
  24584. terminate: function() {}
  24585. }, e.exports = r
  24586. }), {
  24587. "./renderers/utils": 246
  24588. }],
  24589. 233: [(function(t, e, i) {
  24590. "use strict";
  24591. var n = (function(t) {
  24592. return t && t.__esModule ? t : {
  24593. default: t
  24594. }
  24595. })(t("../render-flow"));
  24596. n.default.prototype._draw = function(t, e) {
  24597. var i = n.default.getBachther(),
  24598. r = i._device._ctx,
  24599. s = i._camera;
  24600. r.setTransform(s.a, s.b, s.c, s.d, s.tx, s.ty), r.scale(1, -1);
  24601. var o = t._renderComponent;
  24602. o._assembler[e](r, o), this._next._func(t)
  24603. }, n.default.prototype._render = function(t) {
  24604. this._draw(t, "draw")
  24605. }, n.default.prototype._postRender = function(t) {
  24606. this._draw(t, "postDraw")
  24607. }
  24608. }), {
  24609. "../render-flow": 248
  24610. }],
  24611. 234: [(function(t, e, i) {
  24612. "use strict";
  24613. var n = t("../../../../graphics/helper"),
  24614. r = t("../../../../graphics/types"),
  24615. s = t("../../../../platform/js"),
  24616. o = r.LineJoin,
  24617. a = r.LineCap;
  24618. function l() {
  24619. this.cmds = [], this.style = {
  24620. strokeStyle: "black",
  24621. fillStyle: "white",
  24622. lineCap: "butt",
  24623. lineJoin: "miter",
  24624. miterLimit: 10
  24625. }
  24626. }
  24627. var h = l.prototype;
  24628. s.mixin(h, {
  24629. moveTo: function(t, e) {
  24630. this.cmds.push(["moveTo", [t, e]])
  24631. },
  24632. lineTo: function(t, e) {
  24633. this.cmds.push(["lineTo", [t, e]])
  24634. },
  24635. bezierCurveTo: function(t, e, i, n, r, s) {
  24636. this.cmds.push(["bezierCurveTo", [t, e, i, n, r, s]])
  24637. },
  24638. quadraticCurveTo: function(t, e, i, n) {
  24639. this.cmds.push(["quadraticCurveTo", [t, e, i, n]])
  24640. },
  24641. arc: function(t, e, i, r, s, o) {
  24642. n.arc(this, t, e, i, r, s, o)
  24643. },
  24644. ellipse: function(t, e, i, r) {
  24645. n.ellipse(this, t, e, i, r)
  24646. },
  24647. circle: function(t, e, i) {
  24648. n.ellipse(this, t, e, i, i)
  24649. },
  24650. rect: function(t, e, i, n) {
  24651. this.moveTo(t, e), this.lineTo(t, e + n), this.lineTo(t + i, e + n), this.lineTo(t + i, e), this.close()
  24652. },
  24653. roundRect: function(t, e, i, r, s) {
  24654. n.roundRect(this, t, e, i, r, s)
  24655. },
  24656. clear: function(t, e) {
  24657. this.cmds.length = 0
  24658. },
  24659. close: function() {
  24660. this.cmds.push(["closePath", []])
  24661. },
  24662. stroke: function() {
  24663. this.cmds.push(["stroke", []])
  24664. },
  24665. fill: function() {
  24666. this.cmds.push(["fill", []])
  24667. }
  24668. }), s.set(h, "strokeColor", (function(t) {
  24669. var e = "rgba(" + (0 | t.r) + "," + (0 | t.g) + "," + (0 | t.b) + "," + t.a / 255 + ")";
  24670. this.cmds.push(["strokeStyle", e]), this.style.strokeStyle = e
  24671. })), s.set(h, "fillColor", (function(t) {
  24672. var e = "rgba(" + (0 | t.r) + "," + (0 | t.g) + "," + (0 | t.b) + "," + t.a / 255 + ")";
  24673. this.cmds.push(["fillStyle", e]), this.style.fillStyle = e
  24674. })), s.set(h, "lineWidth", (function(t) {
  24675. this.cmds.push(["lineWidth", t]), this.style.lineWidth = t
  24676. })), s.set(h, "lineCap", (function(t) {
  24677. var e = "butt";
  24678. t === a.BUTT ? e = "butt" : t === a.ROUND ? e = "round" : t === a.SQUARE && (e = "square"), this.cmds.push(["lineCap", e]), this.style.lineCap = e
  24679. })), s.set(h, "lineJoin", (function(t) {
  24680. var e = "bevel";
  24681. t === o.BEVEL ? e = "bevel" : t === o.ROUND ? e = "round" : t === o.MITER && (e = "miter"), this.cmds.push(["lineJoin", e]), this.style.lineJoin = e
  24682. })), s.set(h, "miterLimit", (function(t) {
  24683. this.cmds.push(["miterLimit", t]), this.style.miterLimit = t
  24684. })), cc.Graphics._Impl = l, e.exports = l
  24685. }), {
  24686. "../../../../graphics/helper": 141,
  24687. "../../../../graphics/types": 143,
  24688. "../../../../platform/js": 218
  24689. }],
  24690. 235: [(function(t, e, i) {
  24691. "use strict";
  24692. i.__esModule = !0, i.default = void 0;
  24693. var n = s(t("../../../assembler")),
  24694. r = (s(t("./impl")), s(t("../../../../graphics/graphics")));
  24695. function s(t) {
  24696. return t && t.__esModule ? t : {
  24697. default: t
  24698. }
  24699. }
  24700. function o(t, e) {
  24701. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24702. }
  24703. var a = (function() {
  24704. function t() {
  24705. o(this, t)
  24706. }
  24707. return t.prototype.init = function() {}, t.prototype.draw = function(t, e) {
  24708. var i = e.node,
  24709. n = i._worldMatrix.m,
  24710. r = n[0],
  24711. s = n[1],
  24712. o = n[4],
  24713. a = n[5],
  24714. l = n[12],
  24715. h = n[13];
  24716. t.transform(r, s, o, a, l, h), t.save(), t.globalAlpha = i.opacity / 255;
  24717. var c = e._impl.style;
  24718. t.strokeStyle = c.strokeStyle, t.fillStyle = c.fillStyle, t.lineWidth = c.lineWidth, t.lineJoin = c.lineJoin, t.miterLimit = c.miterLimit;
  24719. for (var u = !0, _ = e._impl.cmds, f = 0, d = _.length; f < d; f++) {
  24720. var p = _[f],
  24721. m = p[0],
  24722. y = p[1];
  24723. "moveTo" === m && u ? (t.beginPath(), u = !1) : "fill" !== m && "stroke" !== m && "fillRect" !== m || (u = !0), "function" == typeof t[m] ? t[m].apply(t, y) : t[m] = y
  24724. }
  24725. return t.restore(), 1
  24726. }, t.prototype.stroke = function(t) {
  24727. t._impl.stroke()
  24728. }, t.prototype.fill = function(t) {
  24729. t._impl.fill()
  24730. }, t.prototype.clear = function() {}, t
  24731. })();
  24732. i.default = a, n.default.register(r.default, a), e.exports = i.default
  24733. }), {
  24734. "../../../../graphics/graphics": 140,
  24735. "../../../assembler": 227,
  24736. "./impl": 234
  24737. }],
  24738. 236: [(function(t, e, i) {
  24739. "use strict";
  24740. t("../../../components/CCSprite"), t("../../../components/CCLabel"), t("../../../components/CCMask"), t("../../../graphics/graphics"), t("./sprite"), t("./label"), t("./graphics"), t("./mask")
  24741. }), {
  24742. "../../../components/CCLabel": 97,
  24743. "../../../components/CCMask": 101,
  24744. "../../../components/CCSprite": 111,
  24745. "../../../graphics/graphics": 140,
  24746. "./graphics": 235,
  24747. "./label": 238,
  24748. "./mask": 240,
  24749. "./sprite": 242
  24750. }],
  24751. 237: [(function(t, e, i) {
  24752. "use strict";
  24753. i.__esModule = !0, i.default = void 0;
  24754. var n = o(t("../../../utils/label/bmfont")),
  24755. r = o(t("../render-data")),
  24756. s = o(t("../utils"));
  24757. function o(t) {
  24758. return t && t.__esModule ? t : {
  24759. default: t
  24760. }
  24761. }
  24762. function a(t, e) {
  24763. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24764. }
  24765. function l(t, e) {
  24766. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  24767. return !e || "object" != typeof e && "function" != typeof e ? t : e
  24768. }
  24769. function h(t, e) {
  24770. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  24771. t.prototype = Object.create(e && e.prototype, {
  24772. constructor: {
  24773. value: t,
  24774. enumerable: !1,
  24775. writable: !0,
  24776. configurable: !0
  24777. }
  24778. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  24779. }
  24780. var c = (function(t) {
  24781. function e() {
  24782. return a(this, e), l(this, t.apply(this, arguments))
  24783. }
  24784. return h(e, t), e.prototype.init = function() {
  24785. this._renderData = new r.default
  24786. }, e.prototype.updateColor = function() {}, e.prototype.appendQuad = function(t, e, i, n, r, s, o) {
  24787. var a = this._renderData,
  24788. l = a.dataLength;
  24789. a.dataLength += 2;
  24790. var h = a.vertices,
  24791. c = i.width,
  24792. u = i.height,
  24793. _ = void 0,
  24794. f = void 0,
  24795. d = void 0,
  24796. p = void 0;
  24797. n ? (_ = i.x, d = i.x + u, f = i.y, p = i.y + c, h[l].u = _, h[l].v = p, h[l + 1].u = _, h[l + 1].v = f) : (_ = i.x, d = i.x + c, f = i.y, p = i.y + u, h[l].u = _, h[l].v = f, h[l + 1].u = d, h[l + 1].v = p), h[l].x = r, h[l].y = s - u * o, h[l + 1].x = r + c * o, h[l + 1].y = s
  24798. }, e.prototype.draw = function(t, e) {
  24799. var i = e.node,
  24800. n = i._worldMatrix.m,
  24801. r = n[0],
  24802. o = n[1],
  24803. a = n[4],
  24804. l = n[5],
  24805. h = n[12],
  24806. c = n[13];
  24807. t.transform(r, o, a, l, h, c), t.scale(1, -1), s.default.context.setGlobalAlpha(t, i.opacity / 255);
  24808. for (var u = e._frame._texture, _ = this._renderData.vertices, f = s.default.getColorizedImage(u, i._color), d = 0, p = _.length; d < p; d += 2) {
  24809. var m = _[d].x,
  24810. y = _[d].y,
  24811. v = _[d + 1].x - m,
  24812. g = _[d + 1].y - y;
  24813. y = -y - g;
  24814. var x = _[d].u,
  24815. b = _[d].v,
  24816. A = _[d + 1].u - x,
  24817. C = _[d + 1].v - b;
  24818. t.drawImage(f, x, b, A, C, m, y, v, g)
  24819. }
  24820. return 1
  24821. }, e
  24822. })(n.default);
  24823. i.default = c, e.exports = i.default
  24824. }), {
  24825. "../../../utils/label/bmfont": 251,
  24826. "../render-data": 241,
  24827. "../utils": 246
  24828. }],
  24829. 238: [(function(t, e, i) {
  24830. "use strict";
  24831. var n = a(t("../../../assembler")),
  24832. r = a(t("../../../../components/CCLabel")),
  24833. s = a(t("./ttf")),
  24834. o = a(t("./bmfont"));
  24835. function a(t) {
  24836. return t && t.__esModule ? t : {
  24837. default: t
  24838. }
  24839. }
  24840. var l = {
  24841. pool: [],
  24842. get: function() {
  24843. var t = this.pool.pop();
  24844. if (!t) {
  24845. var e = document.createElement("canvas");
  24846. t = {
  24847. canvas: e,
  24848. context: e.getContext("2d")
  24849. }
  24850. }
  24851. return t
  24852. },
  24853. put: function(t) {
  24854. this.pool.length >= 32 || this.pool.push(t)
  24855. }
  24856. };
  24857. r.default._canvasPool = l, n.default.register(r.default, {
  24858. getConstructor: function(t) {
  24859. var e = s.default;
  24860. return t.font instanceof cc.BitmapFont ? e = o.default : t.cacheMode === r.default.CacheMode.CHAR && cc.warn("sorry, canvas mode does not support CHAR mode currently!"), e
  24861. },
  24862. TTF: s.default,
  24863. Bmfont: o.default
  24864. })
  24865. }), {
  24866. "../../../../components/CCLabel": 97,
  24867. "../../../assembler": 227,
  24868. "./bmfont": 237,
  24869. "./ttf": 239
  24870. }],
  24871. 239: [(function(t, e, i) {
  24872. "use strict";
  24873. i.__esModule = !0, i.default = void 0;
  24874. var n = o(t("../../../utils/label/ttf")),
  24875. r = o(t("../render-data")),
  24876. s = o(t("../utils"));
  24877. function o(t) {
  24878. return t && t.__esModule ? t : {
  24879. default: t
  24880. }
  24881. }
  24882. function a(t, e) {
  24883. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24884. }
  24885. function l(t, e) {
  24886. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  24887. return !e || "object" != typeof e && "function" != typeof e ? t : e
  24888. }
  24889. function h(t, e) {
  24890. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  24891. t.prototype = Object.create(e && e.prototype, {
  24892. constructor: {
  24893. value: t,
  24894. enumerable: !1,
  24895. writable: !0,
  24896. configurable: !0
  24897. }
  24898. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  24899. }
  24900. var c = (function(t) {
  24901. function e() {
  24902. return a(this, e), l(this, t.apply(this, arguments))
  24903. }
  24904. return h(e, t), e.prototype.init = function() {
  24905. this._renderData = new r.default, this._renderData.dataLength = 2
  24906. }, e.prototype.updateColor = function() {}, e.prototype.updateVerts = function(t) {
  24907. var e = this._renderData,
  24908. i = t.node,
  24909. n = i.width,
  24910. r = i.height,
  24911. s = i.anchorX * n,
  24912. o = i.anchorY * r,
  24913. a = e.vertices;
  24914. a[0].x = -s, a[0].y = -o, a[1].x = n - s, a[1].y = r - o
  24915. }, e.prototype._updateTexture = function(t) {
  24916. n.default.prototype._updateTexture.call(this, t);
  24917. var e = t._frame._texture;
  24918. s.default.dropColorizedImage(e, t.node.color)
  24919. }, e.prototype.draw = function(t, e) {
  24920. var i = e.node,
  24921. n = i._worldMatrix.m,
  24922. r = n[0],
  24923. o = n[1],
  24924. a = n[4],
  24925. l = n[5],
  24926. h = n[12],
  24927. c = n[13];
  24928. t.transform(r, o, a, l, h, c), t.scale(1, -1), s.default.context.setGlobalAlpha(t, i.opacity / 255);
  24929. var u = e._frame._texture,
  24930. _ = this._renderData.vertices,
  24931. f = u.getHtmlElementObj(),
  24932. d = _[0].x,
  24933. p = _[0].y,
  24934. m = _[1].x - d,
  24935. y = _[1].y - p;
  24936. return p = -p - y, t.drawImage(f, d, p, m, y), 1
  24937. }, e
  24938. })(n.default);
  24939. i.default = c, e.exports = i.default
  24940. }), {
  24941. "../../../utils/label/ttf": 254,
  24942. "../render-data": 241,
  24943. "../utils": 246
  24944. }],
  24945. 240: [(function(t, e, i) {
  24946. "use strict";
  24947. i.__esModule = !0, i.default = void 0;
  24948. var n = (function(t) {
  24949. return t && t.__esModule ? t : {
  24950. default: t
  24951. }
  24952. })(t("../../assembler"));
  24953. function r(t, e) {
  24954. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  24955. }
  24956. function s(t, e) {
  24957. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  24958. return !e || "object" != typeof e && "function" != typeof e ? t : e
  24959. }
  24960. function o(t, e) {
  24961. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  24962. t.prototype = Object.create(e && e.prototype, {
  24963. constructor: {
  24964. value: t,
  24965. enumerable: !1,
  24966. writable: !0,
  24967. configurable: !0
  24968. }
  24969. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  24970. }
  24971. var a = t("../../../components/CCMask"),
  24972. l = (t("./graphics"), (function(t) {
  24973. function e() {
  24974. return r(this, e), s(this, t.apply(this, arguments))
  24975. }
  24976. return o(e, t), e.prototype.draw = function(t, e) {
  24977. t.save(), e._graphics._assembler.draw(t, e._graphics), t.clip()
  24978. }, e.prototype.postDraw = function(t, e) {
  24979. t.restore()
  24980. }, e
  24981. })(n.default));
  24982. i.default = l, n.default.register(a, l), e.exports = i.default
  24983. }), {
  24984. "../../../components/CCMask": 101,
  24985. "../../assembler": 227,
  24986. "./graphics": 235
  24987. }],
  24988. 241: [(function(t, e, i) {
  24989. "use strict";
  24990. i.__esModule = !0;
  24991. var n = (function() {
  24992. function t(t, e) {
  24993. for (var i = 0; i < e.length; i++) {
  24994. var n = e[i];
  24995. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  24996. }
  24997. }
  24998. return function(e, i, n) {
  24999. return i && t(e.prototype, i), n && t(e, n), e
  25000. }
  25001. })();
  25002. function r(t, e) {
  25003. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  25004. }
  25005. var s = (function() {
  25006. function t() {
  25007. r(this, t), this.vertices = []
  25008. }
  25009. return n(t, [{
  25010. key: "dataLength",
  25011. get: function() {
  25012. return this.vertices.length
  25013. },
  25014. set: function(t) {
  25015. var e = this.vertices.length;
  25016. this.vertices.length = t;
  25017. for (var i = e; i < t; i++) this.vertices[i] = {
  25018. x: 0,
  25019. y: 0,
  25020. u: 0,
  25021. v: 0
  25022. }
  25023. }
  25024. }]), t
  25025. })();
  25026. i.default = s, e.exports = i.default
  25027. }), {}],
  25028. 242: [(function(t, e, i) {
  25029. "use strict";
  25030. var n = l(t("../../../assembler")),
  25031. r = t("../../../../components/CCSprite"),
  25032. s = l(t("./simple")),
  25033. o = l(t("./sliced")),
  25034. a = l(t("./tiled"));
  25035. function l(t) {
  25036. return t && t.__esModule ? t : {
  25037. default: t
  25038. }
  25039. }
  25040. var h = {
  25041. getConstructor: function(t) {
  25042. var e = s.default;
  25043. switch (t.type) {
  25044. case r.Type.SLICED:
  25045. e = o.default;
  25046. break;
  25047. case r.Type.TILED:
  25048. e = a.default
  25049. }
  25050. return e
  25051. },
  25052. Simple: s.default,
  25053. Sliced: o.default,
  25054. Tiled: a.default
  25055. };
  25056. n.default.register(cc.Sprite, h)
  25057. }), {
  25058. "../../../../components/CCSprite": 111,
  25059. "../../../assembler": 227,
  25060. "./simple": 243,
  25061. "./sliced": 244,
  25062. "./tiled": 245
  25063. }],
  25064. 243: [(function(t, e, i) {
  25065. "use strict";
  25066. i.__esModule = !0, i.default = void 0;
  25067. var n = s(t("../../../assembler")),
  25068. r = s(t("../render-data"));
  25069. function s(t) {
  25070. return t && t.__esModule ? t : {
  25071. default: t
  25072. }
  25073. }
  25074. function o(t, e) {
  25075. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  25076. }
  25077. function a(t, e) {
  25078. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25079. return !e || "object" != typeof e && "function" != typeof e ? t : e
  25080. }
  25081. function l(t, e) {
  25082. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  25083. t.prototype = Object.create(e && e.prototype, {
  25084. constructor: {
  25085. value: t,
  25086. enumerable: !1,
  25087. writable: !0,
  25088. configurable: !0
  25089. }
  25090. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  25091. }
  25092. var h = t("../utils"),
  25093. c = (function(t) {
  25094. function e() {
  25095. return o(this, e), a(this, t.apply(this, arguments))
  25096. }
  25097. return l(e, t), e.prototype.init = function() {
  25098. this._renderData = new r.default, this._renderData.dataLength = 2
  25099. }, e.prototype.updateRenderData = function(t) {
  25100. t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1)
  25101. }, e.prototype.updateUVs = function(t) {
  25102. var e = t.spriteFrame,
  25103. i = this._renderData.vertices,
  25104. n = e._rect;
  25105. if (e._rotated) {
  25106. var r = n.x,
  25107. s = n.width,
  25108. o = n.y,
  25109. a = n.height;
  25110. i[0].u = r, i[0].v = o, i[1].u = a, i[1].v = s
  25111. } else {
  25112. var l = n.x,
  25113. h = n.width,
  25114. c = n.y,
  25115. u = n.height;
  25116. i[0].u = l, i[0].v = c, i[1].u = h, i[1].v = u
  25117. }
  25118. }, e.prototype.updateVerts = function(t) {
  25119. var e = this._renderData,
  25120. i = t.node,
  25121. n = e.vertices,
  25122. r = t.spriteFrame,
  25123. s = i.width,
  25124. o = i.height,
  25125. a = i.anchorX * s,
  25126. l = i.anchorY * o,
  25127. h = void 0,
  25128. c = void 0,
  25129. u = void 0,
  25130. _ = void 0;
  25131. if (t.trim) h = -a, c = -l, u = s, _ = o;
  25132. else {
  25133. var f = r._originalSize.width,
  25134. d = r._originalSize.height,
  25135. p = r._rect.width,
  25136. m = r._rect.height,
  25137. y = r._offset,
  25138. v = s / f,
  25139. g = o / d;
  25140. h = (y.x + (f - p) / 2) * v - a, c = (y.y + (d - m) / 2) * g - l, u = s, _ = o
  25141. }
  25142. r._rotated ? (n[0].y = h, n[0].x = c, n[1].y = u, n[1].x = _) : (n[0].x = h, n[0].y = c, n[1].x = u, n[1].y = _), e.vertDirty = !1
  25143. }, e.prototype.draw = function(t, e) {
  25144. var i = e.node,
  25145. n = e._spriteFrame,
  25146. r = i._worldMatrix.m,
  25147. s = r[0],
  25148. o = r[1],
  25149. a = r[4],
  25150. l = r[5],
  25151. c = r[12],
  25152. u = r[13];
  25153. t.transform(s, o, a, l, c, u), t.scale(1, -1), n._rotated && t.rotate(-Math.PI / 2), h.context.setGlobalAlpha(t, i.opacity / 255);
  25154. var _ = n._texture,
  25155. f = this._renderData.vertices,
  25156. d = h.getColorizedImage(_, i._color),
  25157. p = f[0].x,
  25158. m = f[0].y,
  25159. y = f[1].x,
  25160. v = f[1].y;
  25161. m = -m - v;
  25162. var g = f[0].u,
  25163. x = f[0].v,
  25164. b = f[1].u,
  25165. A = f[1].v;
  25166. return t.drawImage(d, g, x, b, A, p, m, y, v), 1
  25167. }, e
  25168. })(n.default);
  25169. i.default = c, e.exports = i.default
  25170. }), {
  25171. "../../../assembler": 227,
  25172. "../render-data": 241,
  25173. "../utils": 246
  25174. }],
  25175. 244: [(function(t, e, i) {
  25176. "use strict";
  25177. i.__esModule = !0, i.default = void 0;
  25178. s(t("../../../assembler"));
  25179. var n = s(t("../render-data")),
  25180. r = s(t("./simple"));
  25181. function s(t) {
  25182. return t && t.__esModule ? t : {
  25183. default: t
  25184. }
  25185. }
  25186. function o(t, e) {
  25187. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  25188. }
  25189. function a(t, e) {
  25190. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25191. return !e || "object" != typeof e && "function" != typeof e ? t : e
  25192. }
  25193. function l(t, e) {
  25194. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  25195. t.prototype = Object.create(e && e.prototype, {
  25196. constructor: {
  25197. value: t,
  25198. enumerable: !1,
  25199. writable: !0,
  25200. configurable: !0
  25201. }
  25202. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  25203. }
  25204. var h = t("../utils"),
  25205. c = (function(t) {
  25206. function e() {
  25207. return o(this, e), a(this, t.apply(this, arguments))
  25208. }
  25209. return l(e, t), e.prototype.init = function() {
  25210. this._renderData = new n.default, this._renderData.dataLength = 4
  25211. }, e.prototype.updateUVs = function(t) {
  25212. var e = t.spriteFrame,
  25213. i = this._renderData,
  25214. n = e._rect,
  25215. r = e.insetLeft,
  25216. s = e.insetRight,
  25217. o = n.width - r - s,
  25218. a = e.insetTop,
  25219. l = e.insetBottom,
  25220. h = n.height - a - l,
  25221. c = i.vertices;
  25222. e._rotated ? (c[0].u = n.x, c[1].u = l + n.x, c[2].u = l + h + n.x, c[3].u = n.x + n.height, c[3].v = n.y, c[2].v = r + n.y, c[1].v = r + o + n.y, c[0].v = n.y + n.width) : (c[0].u = n.x, c[1].u = r + n.x, c[2].u = r + o + n.x, c[3].u = n.x + n.width, c[3].v = n.y, c[2].v = a + n.y, c[1].v = a + h + n.y, c[0].v = n.y + n.height)
  25223. }, e.prototype.updateVerts = function(t) {
  25224. var e = this._renderData.vertices,
  25225. i = t.node,
  25226. n = i.width,
  25227. r = i.height,
  25228. s = i.anchorX * n,
  25229. o = i.anchorY * r,
  25230. a = t.spriteFrame,
  25231. l = a.insetLeft,
  25232. h = a.insetRight,
  25233. c = a.insetTop,
  25234. u = a.insetBottom,
  25235. _ = n - l - h,
  25236. f = r - c - u,
  25237. d = n / (l + h),
  25238. p = r / (c + u);
  25239. d = isNaN(d) || d > 1 ? 1 : d, p = isNaN(p) || p > 1 ? 1 : p, _ = _ < 0 ? 0 : _, f = f < 0 ? 0 : f, a._rotated ? (e[0].y = -s, e[0].x = -o, e[1].y = h * d - s, e[1].x = u * p - o, e[2].y = e[1].y + _, e[2].x = e[1].x + f, e[3].y = n - s, e[3].x = r - o) : (e[0].x = -s, e[0].y = -o, e[1].x = l * d - s, e[1].y = u * p - o, e[2].x = e[1].x + _, e[2].y = e[1].y + f, e[3].x = n - s, e[3].y = r - o), t._vertsDirty = !1
  25240. }, e.prototype.draw = function(t, e) {
  25241. var i = e.node,
  25242. n = e._spriteFrame,
  25243. r = i._worldMatrix.m,
  25244. s = r[0],
  25245. o = r[1],
  25246. a = r[4],
  25247. l = r[5],
  25248. c = r[12],
  25249. u = r[13];
  25250. t.transform(s, o, a, l, c, u), t.scale(1, -1), n._rotated && t.rotate(-Math.PI / 2), h.context.setGlobalAlpha(t, i.opacity / 255);
  25251. for (var _ = n._texture, f = this._renderData.vertices, d = h.getColorizedImage(_, i._color), p = 0, m = void 0, y = void 0, v = void 0, g = void 0, x = void 0, b = void 0, A = void 0, C = void 0, T = void 0, S = void 0, w = void 0, E = void 0, M = 0; M < 3; ++M) {
  25252. g = f[M], v = f[M + 1];
  25253. for (var D = 0; D < 3; ++D) m = f[D], y = f[D + 1], x = m.x, b = g.y, A = y.x - x, b = -b - (C = v.y - b), T = m.u, S = v.v, w = y.u - T, E = g.v - S, w > 0 && E > 0 && A > 0 && C > 0 && (t.drawImage(d, T, S, w, E, x, b, A, C), p++)
  25254. }
  25255. return p
  25256. }, e
  25257. })(r.default);
  25258. i.default = c, e.exports = i.default
  25259. }), {
  25260. "../../../assembler": 227,
  25261. "../render-data": 241,
  25262. "../utils": 246,
  25263. "./simple": 243
  25264. }],
  25265. 245: [(function(t, e, i) {
  25266. "use strict";
  25267. i.__esModule = !0, i.default = void 0;
  25268. var n = (function(t) {
  25269. return t && t.__esModule ? t : {
  25270. default: t
  25271. }
  25272. })(t("../../../assembler"));
  25273. function r(t, e) {
  25274. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  25275. }
  25276. function s(t, e) {
  25277. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25278. return !e || "object" != typeof e && "function" != typeof e ? t : e
  25279. }
  25280. function o(t, e) {
  25281. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  25282. t.prototype = Object.create(e && e.prototype, {
  25283. constructor: {
  25284. value: t,
  25285. enumerable: !1,
  25286. writable: !0,
  25287. configurable: !0
  25288. }
  25289. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  25290. }
  25291. var a = t("../utils"),
  25292. l = (function(t) {
  25293. function e() {
  25294. return r(this, e), s(this, t.apply(this, arguments))
  25295. }
  25296. return o(e, t), e.prototype.draw = function(t, e) {
  25297. var i = e.node,
  25298. n = i._worldMatrix.m,
  25299. r = n[0],
  25300. s = n[1],
  25301. o = n[4],
  25302. l = n[5],
  25303. h = n[12],
  25304. c = n[13];
  25305. t.transform(r, s, o, l, h, c), t.scale(1, -1), a.context.setGlobalAlpha(t, i.opacity / 255);
  25306. var u = e.spriteFrame,
  25307. _ = u._rect,
  25308. f = u._texture,
  25309. d = _.x,
  25310. p = _.y,
  25311. m = u._rotated ? _.height : _.width,
  25312. y = u._rotated ? _.width : _.height,
  25313. v = a.getFrameCache(f, i._color, d, p, m, y),
  25314. g = i.width,
  25315. x = i.height,
  25316. b = -i.anchorX * g,
  25317. A = -i.anchorY * x;
  25318. return A = -A - x, t.translate(b, A), t.fillStyle = t.createPattern(v, "repeat"), t.fillRect(0, 0, g, x), 1
  25319. }, e
  25320. })(n.default);
  25321. i.default = l, e.exports = i.default
  25322. }), {
  25323. "../../../assembler": 227,
  25324. "../utils": 246
  25325. }],
  25326. 246: [(function(t, e, i) {
  25327. "use strict";
  25328. function n(t, e, i, n, r, s, o) {
  25329. var a = e._image,
  25330. l = t.getContext("2d");
  25331. return t.width = s, t.height = o, l.globalCompositeOperation = "source-over", l.fillStyle = "rgb(" + i.r + "," + i.g + "," + i.b + ")", l.fillRect(0, 0, s, o), l.globalCompositeOperation = "multiply", l.drawImage(a, n, r, s, o, 0, 0, s, o), l.globalCompositeOperation = "destination-atop", l.drawImage(a, n, r, s, o, 0, 0, s, o), t
  25332. }
  25333. var r = {
  25334. canvasMap: {},
  25335. canvasUsed: {},
  25336. canvasPool: [],
  25337. checking: !1,
  25338. check: function() {
  25339. var t = !1;
  25340. for (var e in this.canvasUsed)
  25341. if (t = !0, this.canvasUsed[e]) this.canvasUsed[e] = !1;
  25342. else {
  25343. var i = this.canvasMap[e];
  25344. i.width = 0, i.height = 0, this.canvasPool.length < 32 && this.canvasPool.push(i), delete this.canvasMap[e], delete this.canvasUsed[e]
  25345. }
  25346. t || (cc.director.off(cc.Director.EVENT_AFTER_DRAW, this.check, this), this.checking = !1)
  25347. },
  25348. startCheck: function() {
  25349. cc.director.on(cc.Director.EVENT_AFTER_DRAW, this.check, this), this.checking = !0
  25350. },
  25351. getCanvas: function(t) {
  25352. return this.canvasUsed[t] = !0, this.canvasMap[t]
  25353. },
  25354. cacheCanvas: function(t, e) {
  25355. this.canvasMap[e] = t, this.canvasUsed[e] = !0, this.checking || this.startCheck()
  25356. },
  25357. dropImage: function(t) {
  25358. this.canvasMap[t] && delete this.canvasMap[t]
  25359. }
  25360. };
  25361. e.exports = {
  25362. getColorizedImage: function(t, e) {
  25363. if (!t) return null;
  25364. if (0 === t.width || 0 === t.height) return t._image;
  25365. var i = 16777215 & e._val;
  25366. if (16777215 === i) return t._image;
  25367. var s = t.url + i,
  25368. o = r.getCanvas(s);
  25369. return o || (n(o = r.canvasPool.pop() || document.createElement("canvas"), t, e, 0, 0, t.width, t.height), r.cacheCanvas(o, s)), o
  25370. },
  25371. getFrameCache: function(t, e, i, s, o, a) {
  25372. if (!t || !t.url || i < 0 || s < 0 || o <= 0 || a <= 0) return null;
  25373. var l = t.url,
  25374. h = !1,
  25375. c = 16777215 & e._val;
  25376. if (16777215 !== c && (l += c, h = !0), (0 !== i || 0 !== s && o !== t.width && a !== t.height) && (l += "_" + i + "_" + s + "_" + o + "_" + a, h = !0), !h) return t._image;
  25377. var u = r.getCanvas(l);
  25378. return u || (n(u = r.canvasPool.pop() || document.createElement("canvas"), t, e, i, s, o, a), r.cacheCanvas(u, l)), u
  25379. },
  25380. dropColorizedImage: function(t, e) {
  25381. var i = t.url + (16777215 & e._val);
  25382. r.dropImage(i)
  25383. }
  25384. };
  25385. var s = -1,
  25386. o = {
  25387. setGlobalAlpha: function(t, e) {
  25388. s !== e && (s = e, t.globalAlpha = s)
  25389. },
  25390. reset: function() {
  25391. s = -1
  25392. }
  25393. };
  25394. e.exports.context = o
  25395. }), {}],
  25396. 247: [(function(t, e, i) {
  25397. "use strict";
  25398. var n = a(t("../../renderer/config")),
  25399. r = a(t("../../renderer/gfx")),
  25400. s = a(t("../../renderer/core/input-assembler")),
  25401. o = a(t("../../renderer/core/pass"));
  25402. function a(t) {
  25403. return t && t.__esModule ? t : {
  25404. default: t
  25405. }
  25406. }
  25407. function l(t) {
  25408. return {
  25409. defaultTexture: new r.default.Texture2D(t, {
  25410. images: [],
  25411. width: 128,
  25412. height: 128,
  25413. wrapS: r.default.WRAP_REPEAT,
  25414. wrapT: r.default.WRAP_REPEAT,
  25415. format: r.default.TEXTURE_FMT_RGB8,
  25416. mipmap: !1
  25417. }),
  25418. programTemplates: [],
  25419. programChunks: {}
  25420. }
  25421. }
  25422. cc.renderer = e.exports = {
  25423. Texture2D: null,
  25424. InputAssembler: s.default,
  25425. Pass: o.default,
  25426. renderEngine: null,
  25427. canvas: null,
  25428. device: null,
  25429. scene: null,
  25430. drawCalls: 0,
  25431. _handle: null,
  25432. _cameraNode: null,
  25433. _camera: null,
  25434. _forward: null,
  25435. _flow: null,
  25436. initWebGL: function(e, i) {
  25437. t("./webgl/assemblers");
  25438. var s = t("./webgl/model-batcher");
  25439. this.Texture2D = r.default.Texture2D, this.canvas = e, this._flow = cc.RenderFlow;
  25440. var o = t("../../renderer/scene/scene"),
  25441. a = t("../../renderer/renderers/forward-renderer");
  25442. this.device = new r.default.Device(e, i), this.scene = new o;
  25443. var h = l(this.device);
  25444. this._forward = new a(this.device, h), this._handle = new s(this.device, this.scene), this._flow.init(this._handle, this._forward), n.default.addStage("shadowcast"), n.default.addStage("opaque"), n.default.addStage("transparent")
  25445. },
  25446. initCanvas: function(e) {
  25447. var i = t("./canvas"),
  25448. n = t("./canvas/Texture2D"),
  25449. r = t("./canvas/Device");
  25450. this.Device = r, this.Texture2D = n, this.canvas = e, this.device = new r(e), this._camera = {
  25451. a: 1,
  25452. b: 0,
  25453. c: 0,
  25454. d: 1,
  25455. tx: 0,
  25456. ty: 0
  25457. }, this._handle = new i.RenderComponentHandle(this.device, this._camera), this._forward = new i.ForwardRenderer, this._flow = cc.RenderFlow, this._flow.init(this._handle, this._forward)
  25458. },
  25459. updateCameraViewport: function() {
  25460. if (cc.director) {
  25461. var t = cc.director.getScene();
  25462. t && t.setScale(1, 1, 1)
  25463. }
  25464. if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) {
  25465. var e = cc.view.getViewportRect();
  25466. this.device.setViewport(e.x, e.y, e.width, e.height), this._camera.a = cc.view.getScaleX(), this._camera.d = cc.view.getScaleY(), this._camera.tx = e.x, this._camera.ty = e.y + e.height
  25467. }
  25468. },
  25469. render: function(t, e) {
  25470. this.device.resetDrawCalls(), t && (this._flow.render(t, e), this.drawCalls = this.device.getDrawCalls())
  25471. },
  25472. clear: function() {
  25473. this._handle.reset(), this._forward.clear()
  25474. }
  25475. }
  25476. }), {
  25477. "../../renderer/config": 347,
  25478. "../../renderer/core/input-assembler": 350,
  25479. "../../renderer/core/pass": 351,
  25480. "../../renderer/gfx": 360,
  25481. "../../renderer/renderers/forward-renderer": 379,
  25482. "../../renderer/scene/scene": 383,
  25483. "./canvas": 231,
  25484. "./canvas/Device": 228,
  25485. "./canvas/Texture2D": 229,
  25486. "./webgl/assemblers": 259,
  25487. "./webgl/model-batcher": 284
  25488. }],
  25489. 248: [(function(t, e, i) {
  25490. "use strict";
  25491. var n = 0,
  25492. r = 1 << n++,
  25493. s = 1 << n++,
  25494. o = 1 << n++,
  25495. a = 1 << n++,
  25496. l = o | a,
  25497. h = 1 << n++,
  25498. c = 1 << n++,
  25499. u = 1 << n++,
  25500. _ = c | u,
  25501. f = 1 << n++,
  25502. d = 1 << n++,
  25503. p = 1 << n++,
  25504. m = 1 << n++,
  25505. y = void 0,
  25506. v = void 0,
  25507. g = 0;
  25508. function x() {
  25509. this._func = w, this._next = null
  25510. }
  25511. var b = x.prototype;
  25512. b._doNothing = function() {}, b._localTransform = function(t) {
  25513. t._updateLocalMatrix(), t._renderFlag &= ~o, this._next._func(t)
  25514. }, b._worldTransform = function(t) {
  25515. y.worldMatDirty++;
  25516. var e = t._matrix,
  25517. i = t._trs,
  25518. n = e.m;
  25519. n[12] = i[0], n[13] = i[1], n[14] = i[2], t._mulMat(t._worldMatrix, t._parent._worldMatrix, e), t._renderFlag &= ~a, this._next._func(t), y.worldMatDirty--
  25520. }, b._opacity = function(t) {
  25521. y.parentOpacityDirty++, t._renderFlag &= ~c, this._next._func(t), y.parentOpacityDirty--
  25522. }, b._color = function(t) {
  25523. var e = t._renderComponent;
  25524. e && e._updateColor(), t._renderFlag &= ~u, this._next._func(t)
  25525. }, b._updateRenderData = function(t) {
  25526. var e = t._renderComponent;
  25527. e._assembler.updateRenderData(e), t._renderFlag &= ~h, this._next._func(t)
  25528. }, b._render = function(t) {
  25529. var e = t._renderComponent;
  25530. e._checkBacth(y, t._cullingMask), e._assembler.fillBuffers(e, y), this._next._func(t)
  25531. }, b._children = function(t) {
  25532. for (var e = g, i = y, n = i.parentOpacity, r = i.parentOpacity *= t._opacity / 255, s = (i.worldMatDirty ? a : 0) | (i.parentOpacityDirty ? _ : 0), o = t._children, l = 0, h = o.length; l < h; l++) {
  25533. var c = o[l];
  25534. if (c._renderFlag |= s, c._activeInHierarchy && 0 !== c._opacity) {
  25535. g = c._cullingMask = 0 === c.groupIndex ? e : 1 << c.groupIndex;
  25536. var u = c._color._val;
  25537. c._color._fastSetA(c._opacity * r), C[c._renderFlag]._func(c), c._color._val = u
  25538. }
  25539. }
  25540. i.parentOpacity = n, this._next._func(t)
  25541. }, b._postRender = function(t) {
  25542. var e = t._renderComponent;
  25543. e._checkBacth(y, t._cullingMask), e._assembler.postFillBuffers(e, y), this._next._func(t)
  25544. };
  25545. var A = new x;
  25546. A._func = A._doNothing, A._next = A;
  25547. var C = {};
  25548. function T(t, e) {
  25549. var i = new x;
  25550. switch (i._next = e || A, t) {
  25551. case r:
  25552. case s:
  25553. i._func = i._doNothing;
  25554. break;
  25555. case o:
  25556. i._func = i._localTransform;
  25557. break;
  25558. case a:
  25559. i._func = i._worldTransform;
  25560. break;
  25561. case c:
  25562. i._func = i._opacity;
  25563. break;
  25564. case u:
  25565. i._func = i._color;
  25566. break;
  25567. case h:
  25568. i._func = i._updateRenderData;
  25569. break;
  25570. case f:
  25571. i._func = i._render;
  25572. break;
  25573. case d:
  25574. i._func = i._children;
  25575. break;
  25576. case p:
  25577. i._func = i._postRender
  25578. }
  25579. return i
  25580. }
  25581. function S(t) {
  25582. for (var e = null, i = m; i > 0;) i & t && (e = T(i, e)), i >>= 1;
  25583. return e
  25584. }
  25585. function w(t) {
  25586. var e = t._renderFlag;
  25587. (C[e] = S(e))._func(t)
  25588. }
  25589. x.flows = C, x.createFlow = T, x.visitRootNode = function(t) {
  25590. g = 1 << t.groupIndex, t._renderFlag & a ? (y.worldMatDirty++, t._calculWorldMatrix(), t._renderFlag &= ~a, C[t._renderFlag]._func(t), y.worldMatDirty--) : C[t._renderFlag]._func(t)
  25591. }, x.render = function(t, e) {
  25592. y.reset(), y.walking = !0, x.visitRootNode(t), y.terminate(), y.walking = !1, v.render(y._renderScene, e)
  25593. }, x.init = function(t, e) {
  25594. y = t, v = e, C[0] = A;
  25595. for (var i = 1; i < m; i++) C[i] = new x
  25596. }, x.getBachther = function() {
  25597. return y
  25598. }, x.FLAG_DONOTHING = r, x.FLAG_BREAK_FLOW = s, x.FLAG_LOCAL_TRANSFORM = o, x.FLAG_WORLD_TRANSFORM = a, x.FLAG_TRANSFORM = l, x.FLAG_OPACITY = c, x.FLAG_COLOR = u, x.FLAG_OPACITY_COLOR = _, x.FLAG_UPDATE_RENDER_DATA = h, x.FLAG_RENDER = f, x.FLAG_CHILDREN = d, x.FLAG_POST_RENDER = p, x.FLAG_FINAL = m, e.exports = cc.RenderFlow = x
  25599. }), {}],
  25600. 249: [(function(t, e, i) {
  25601. "use strict";
  25602. var n = t("../../../assets/CCRenderTexture"),
  25603. r = 2;
  25604. function s(t, e) {
  25605. var i = new n;
  25606. i.initWithSize(t, e), i.update(), this._texture = i, this._x = r, this._y = r, this._nexty = r, this._width = t, this._height = e, this._innerTextureInfos = {}, this._innerSpriteFrames = []
  25607. }
  25608. s.DEFAULT_HASH = (new n)._getHash(), cc.js.mixin(s.prototype, {
  25609. insertSpriteFrame: function(t) {
  25610. var e = t._rect,
  25611. i = t._texture,
  25612. n = this._innerTextureInfos[i._id],
  25613. s = e.x,
  25614. o = e.y;
  25615. if (n) s += n.x, o += n.y;
  25616. else {
  25617. var a = i.width,
  25618. l = i.height;
  25619. if (this._x + a + r > this._width && (this._x = r, this._y = this._nexty), this._y + l + r > this._nexty && (this._nexty = this._y + l + r), this._nexty > this._height) return null;
  25620. cc.dynamicAtlasManager.textureBleeding && (this._texture.drawTextureAt(i, this._x - 1, this._y), this._texture.drawTextureAt(i, this._x + 1, this._y), this._texture.drawTextureAt(i, this._x, this._y - 1), this._texture.drawTextureAt(i, this._x, this._y + 1)), this._texture.drawTextureAt(i, this._x, this._y), this._innerTextureInfos[i._id] = {
  25621. x: this._x,
  25622. y: this._y,
  25623. texture: i
  25624. }, s += this._x, o += this._y, this._x += a + r, this._dirty = !0
  25625. }
  25626. var h = {
  25627. x: s,
  25628. y: o,
  25629. texture: this._texture
  25630. };
  25631. return this._innerSpriteFrames.push(t), h
  25632. },
  25633. update: function() {
  25634. this._dirty && (this._texture.update(), this._dirty = !1)
  25635. },
  25636. deleteInnerTexture: function(t) {
  25637. t && delete this._innerTextureInfos[t._id]
  25638. },
  25639. reset: function() {
  25640. this._x = r, this._y = r, this._nexty = r;
  25641. for (var t = this._innerSpriteFrames, e = 0, i = t.length; e < i; e++) {
  25642. var n = t[e];
  25643. n.isValid && n._resetDynamicAtlasFrame()
  25644. }
  25645. this._innerSpriteFrames.length = 0, this._innerTextureInfos = {}
  25646. },
  25647. destroy: function() {
  25648. this.reset(), this._texture.destroy()
  25649. }
  25650. }), e.exports = s
  25651. }), {
  25652. "../../../assets/CCRenderTexture": 66
  25653. }],
  25654. 250: [(function(t, e, i) {
  25655. "use strict";
  25656. var n = t("./atlas"),
  25657. r = [],
  25658. s = -1,
  25659. o = 5,
  25660. a = 2048,
  25661. l = 8,
  25662. h = 512,
  25663. c = !0;
  25664. function u() {
  25665. var t = r[++s];
  25666. return t || (t = new n(a, a), r.push(t)), t
  25667. }
  25668. function _() {
  25669. d.reset()
  25670. }
  25671. var f = !1,
  25672. d = {
  25673. Atlas: n,
  25674. get enabled() {
  25675. return f
  25676. },
  25677. set enabled(t) {
  25678. f !== t && (t ? (this.reset(), cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, _)) : cc.director.off(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, _), f = t)
  25679. },
  25680. get maxAtlasCount() {
  25681. return o
  25682. },
  25683. set maxAtlasCount(t) {
  25684. o = t
  25685. },
  25686. get textureBleeding() {
  25687. return c
  25688. },
  25689. set textureBleeding(t) {
  25690. c = t
  25691. },
  25692. get textureSize() {
  25693. return a
  25694. },
  25695. set textureSize(t) {
  25696. a = t
  25697. },
  25698. get maxFrameSize() {
  25699. return h
  25700. },
  25701. set maxFrameSize(t) {
  25702. h = t
  25703. },
  25704. get minFrameSize() {
  25705. return l
  25706. },
  25707. set minFrameSize(t) {
  25708. l = t
  25709. },
  25710. insertSpriteFrame: function(t) {
  25711. if (!f || s === o || !t || t._original) return null;
  25712. if (!t._texture.packable) return null;
  25713. var e = r[s];
  25714. e || (e = u());
  25715. var i = e.insertSpriteFrame(t);
  25716. return i || s === o ? i : (e = u()).insertSpriteFrame(t)
  25717. },
  25718. reset: function() {
  25719. for (var t = 0, e = r.length; t < e; t++) r[t].destroy();
  25720. r.length = 0, s = -1
  25721. },
  25722. deleteAtlasTexture: function(t) {
  25723. if (t._original) {
  25724. var e = t._original._texture;
  25725. if (e)
  25726. for (var i = 0, n = r.length; i < n; i++) r[i].deleteInnerTexture(e)
  25727. }
  25728. },
  25729. showDebug: !1,
  25730. update: function() {
  25731. if (this.enabled)
  25732. for (var t = 0; t <= s; t++) r[t].update()
  25733. }
  25734. };
  25735. e.exports = cc.dynamicAtlasManager = d
  25736. }), {
  25737. "./atlas": 249
  25738. }],
  25739. 251: [(function(t, e, i) {
  25740. "use strict";
  25741. i.__esModule = !0, i.default = void 0;
  25742. var n = (function(t) {
  25743. return t && t.__esModule ? t : {
  25744. default: t
  25745. }
  25746. })(t("../../assembler-2d"));
  25747. function r(t, e) {
  25748. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  25749. }
  25750. function s(t, e) {
  25751. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  25752. return !e || "object" != typeof e && "function" != typeof e ? t : e
  25753. }
  25754. function o(t, e) {
  25755. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  25756. t.prototype = Object.create(e && e.prototype, {
  25757. constructor: {
  25758. value: t,
  25759. enumerable: !1,
  25760. writable: !0,
  25761. configurable: !0
  25762. }
  25763. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  25764. }
  25765. var a = t("../../../utils/text-utils"),
  25766. l = t("../../../platform/CCMacro"),
  25767. h = t("../../../components/CCLabel").Overflow,
  25768. c = t("../utils").shareLabelInfo,
  25769. u = function() {
  25770. this.char = "", this.valid = !0, this.x = 0, this.y = 0, this.line = 0, this.hash = ""
  25771. },
  25772. _ = cc.rect(),
  25773. f = null,
  25774. d = [],
  25775. p = [],
  25776. m = [],
  25777. y = [],
  25778. v = null,
  25779. g = 0,
  25780. x = 0,
  25781. b = 0,
  25782. A = 0,
  25783. C = 0,
  25784. T = 1,
  25785. S = null,
  25786. w = cc.size(),
  25787. E = "",
  25788. M = 0,
  25789. D = 0,
  25790. B = 0,
  25791. I = 0,
  25792. P = 0,
  25793. R = 0,
  25794. O = 0,
  25795. L = !1,
  25796. F = 0,
  25797. N = 0,
  25798. V = 0,
  25799. k = (function(t) {
  25800. function e() {
  25801. return r(this, e), s(this, t.apply(this, arguments))
  25802. }
  25803. return o(e, t), e.prototype.updateRenderData = function(t) {
  25804. t._vertsDirty && f !== t && (f = t, this._reserveQuads(t, t.string.toString().length), this._updateFontFamily(t), this._updateProperties(t), this._updateLabelInfo(t), this._updateContent(), this.updateWorldVerts(t), f._actualFontSize = M, f.node.setContentSize(w), f._vertsDirty = !1, f = null, this._resetProperties())
  25805. }, e.prototype._updateFontScale = function() {
  25806. T = M / D
  25807. }, e.prototype._updateFontFamily = function(t) {
  25808. var e = t.font;
  25809. S = e.spriteFrame, v = e._fntConfig, c.fontAtlas = e._fontDefDictionary
  25810. }, e.prototype._updateLabelInfo = function() {
  25811. c.hash = "", c.margin = 0
  25812. }, e.prototype._updateProperties = function(t) {
  25813. E = t.string.toString(), M = t.fontSize, D = v ? v.fontSize : t.fontSize, B = t.horizontalAlign, I = t.verticalAlign, P = t.spacingX, O = t.overflow, R = t._lineHeight, w.width = t.node.width, w.height = t.node.height, O === h.NONE ? (L = !1, w.width += 2 * c.margin, w.height += 2 * c.margin) : O === h.RESIZE_HEIGHT ? (L = !0, w.height += 2 * c.margin) : L = t.enableWrapText, c.lineHeight = R, c.fontSize = M, this._setupBMFontOverflowMetrics()
  25814. }, e.prototype._resetProperties = function() {
  25815. v = null, S = null, c.hash = "", c.margin = 0
  25816. }, e.prototype._updateContent = function() {
  25817. this._updateFontScale(), this._computeHorizontalKerningForText(), this._alignText()
  25818. }, e.prototype._computeHorizontalKerningForText = function() {
  25819. for (var t = E, e = t.length, i = v.kerningDict, n = d, r = -1, s = 0; s < e; ++s) {
  25820. var o = t.charCodeAt(s),
  25821. a = i[r << 16 | 65535 & o] || 0;
  25822. n[s] = s < e - 1 ? a : 0, r = o
  25823. }
  25824. }, e.prototype._multilineTextWrap = function(t) {
  25825. for (var e = E.length, i = 0, n = 0, r = 0, s = 0, o = 0, l = 0, h = 0, u = null, _ = cc.v2(0, 0), f = 0; f < e;) {
  25826. var p = E.charAt(f);
  25827. if ("\n" !== p) {
  25828. for (var y = t(E, f, e), b = l, S = h, M = o, D = n, B = !1, I = 0; I < y; ++I) {
  25829. var O = f + I;
  25830. if ("\r" !== (p = E.charAt(O)))
  25831. if (u = c.fontAtlas.getLetterDefinitionForChar(p, c)) {
  25832. var k = D + u.offsetX * T - c.margin;
  25833. if (L && V > 0 && n > 0 && k + u.w * T > V && !a.isUnicodeSpace(p)) {
  25834. m.push(o), o = 0, i++, n = 0, r -= R * T + 0, B = !0;
  25835. break
  25836. }
  25837. _.x = k, _.y = r - u.offsetY * T + c.margin, this._recordLetterInfo(_, p, O, i), O + 1 < d.length && O < e - 1 && (D += d[O + 1]), D += u.xAdvance * T + P - 2 * c.margin, M = _.x + u.w * T - c.margin, b < _.y && (b = _.y), S > _.y - u.h * T && (S = _.y - u.h * T)
  25838. } else this._recordPlaceholderInfo(O, p), console.log("Can't find letter definition in texture atlas " + v.atlasName + " for letter:" + p);
  25839. else this._recordPlaceholderInfo(O, p)
  25840. }
  25841. B || (n = D, o = M, l < b && (l = b), h > S && (h = S), s < o && (s = o), f += y)
  25842. } else m.push(o), o = 0, i++, n = 0, r -= R * T + 0, this._recordPlaceholderInfo(f, p), f++
  25843. }
  25844. return m.push(o), x = (g = i + 1) * R * T, g > 1 && (x += 0 * (g - 1)), w.width = F, w.height = N, F <= 0 && (w.width = parseFloat(s.toFixed(2)) + 2 * c.margin), N <= 0 && (w.height = parseFloat(x.toFixed(2)) + 2 * c.margin), A = w.height, C = 0, l > 0 && (A = w.height + l), h < -x && (C = x + h), !0
  25845. }, e.prototype._getFirstCharLen = function() {
  25846. return 1
  25847. }, e.prototype._getFirstWordLen = function(t, e, i) {
  25848. var n = t.charAt(e);
  25849. if (a.isUnicodeCJK(n) || "\n" === n || a.isUnicodeSpace(n)) return 1;
  25850. var r = 1,
  25851. s = c.fontAtlas.getLetterDefinitionForChar(n, c);
  25852. if (!s) return r;
  25853. for (var o = s.xAdvance * T + P, l = e + 1; l < i && (n = t.charAt(l), s = c.fontAtlas.getLetterDefinitionForChar(n, c)); ++l) {
  25854. if (o + s.offsetX * T + s.w * T > V && !a.isUnicodeSpace(n) && V > 0) return r;
  25855. if (o += s.xAdvance * T + P, "\n" === n || a.isUnicodeSpace(n) || a.isUnicodeCJK(n)) break;
  25856. r++
  25857. }
  25858. return r
  25859. }, e.prototype._multilineTextWrapByWord = function() {
  25860. return this._multilineTextWrap(this._getFirstWordLen)
  25861. }, e.prototype._multilineTextWrapByChar = function() {
  25862. return this._multilineTextWrap(this._getFirstCharLen)
  25863. }, e.prototype._recordPlaceholderInfo = function(t, e) {
  25864. if (t >= p.length) {
  25865. var i = new u;
  25866. p.push(i)
  25867. }
  25868. p[t].char = e, p[t].hash = e.charCodeAt(0) + c.hash, p[t].valid = !1
  25869. }, e.prototype._recordLetterInfo = function(t, e, i, n) {
  25870. if (i >= p.length) {
  25871. var r = new u;
  25872. p.push(r)
  25873. }
  25874. var s = e.charCodeAt(0) + c.hash;
  25875. p[i].line = n, p[i].char = e, p[i].hash = s, p[i].valid = c.fontAtlas.getLetter(s).valid, p[i].x = t.x, p[i].y = t.y
  25876. }, e.prototype._alignText = function() {
  25877. x = 0, m.length = 0, this._multilineTextWrapByWord(), this._computeAlignmentOffset(), O === h.SHRINK && M > 0 && this._isVerticalClamp() && this._shrinkLabelToContentSize(this._isVerticalClamp), this._updateQuads() || O === h.SHRINK && this._shrinkLabelToContentSize(this._isHorizontalClamp)
  25878. }, e.prototype._scaleFontSizeDown = function(t) {
  25879. var e = !0;
  25880. t || (t = .1, e = !1), M = t, e && this._updateContent()
  25881. }, e.prototype._shrinkLabelToContentSize = function(t) {
  25882. for (var e = M, i = 0, n = !0; t();) {
  25883. var r = e - ++i;
  25884. if (n = !1, r <= 0) break;
  25885. T = r / D, this._multilineTextWrapByWord(), this._computeAlignmentOffset()
  25886. }
  25887. n || e - i >= 0 && this._scaleFontSizeDown(e - i)
  25888. }, e.prototype._isVerticalClamp = function() {
  25889. return x > w.height
  25890. }, e.prototype._isHorizontalClamp = function() {
  25891. for (var t = !1, e = 0, i = E.length; e < i; ++e) {
  25892. var n = p[e];
  25893. if (n.valid) {
  25894. var r = c.fontAtlas.getLetter(n.hash),
  25895. s = n.x + r.w * T,
  25896. o = n.line;
  25897. if (F > 0)
  25898. if (L) {
  25899. if (m[o] > w.width && (s > w.width || s < 0)) {
  25900. t = !0;
  25901. break
  25902. }
  25903. } else if (s > w.width) {
  25904. t = !0;
  25905. break
  25906. }
  25907. }
  25908. }
  25909. return t
  25910. }, e.prototype._isHorizontalClamped = function(t, e) {
  25911. var i = m[e],
  25912. n = t > w.width || t < 0;
  25913. return L ? i > w.width && n : n
  25914. }, e.prototype._updateQuads = function() {
  25915. var t = c.fontAtlas.getTexture(),
  25916. e = f.node;
  25917. this.verticesCount = this.indicesCount = 0, this._renderData && (this._renderData.dataLength = 0);
  25918. for (var i = w, n = e._anchorPoint.x * i.width, r = e._anchorPoint.y * i.height, s = !0, o = 0, a = E.length; o < a; ++o) {
  25919. var l = p[o];
  25920. if (l.valid) {
  25921. var u = c.fontAtlas.getLetter(l.hash);
  25922. _.height = u.h, _.width = u.w, _.x = u.u, _.y = u.v;
  25923. var d = l.y + b;
  25924. if (N > 0) {
  25925. if (d > A) {
  25926. var m = d - A;
  25927. _.y += m, _.height -= m, d -= m
  25928. }
  25929. d - u.h * T < C && O === h.CLAMP && (_.height = d < C ? 0 : d - C)
  25930. }
  25931. var v = l.line,
  25932. g = l.x + u.w / 2 * T + y[v];
  25933. if (F > 0 && this._isHorizontalClamped(g, v))
  25934. if (O === h.CLAMP) _.width = 0;
  25935. else if (O === h.SHRINK) {
  25936. if (w.width > u.w) {
  25937. s = !1;
  25938. break
  25939. }
  25940. _.width = 0
  25941. }
  25942. if (_.height > 0 && _.width > 0) {
  25943. var x = this._determineRect(_),
  25944. S = l.x + y[l.line];
  25945. this.appendQuad(f, t, _, x, S - n, d - r, T)
  25946. }
  25947. }
  25948. }
  25949. return this._quadsUpdated(f), s
  25950. }, e.prototype._determineRect = function(t) {
  25951. var e = S.isRotated(),
  25952. i = S._originalSize,
  25953. n = S._rect,
  25954. r = S._offset,
  25955. s = r.x + (i.width - n.width) / 2,
  25956. o = r.y - (i.height - n.height) / 2;
  25957. if (e) {
  25958. var a = t.x;
  25959. t.x = n.x + n.height - t.y - t.height - o, t.y = a + n.y - s, t.y < 0 && (t.height = t.height + o)
  25960. } else t.x += n.x - s, t.y += n.y + o;
  25961. return e
  25962. }, e.prototype._computeAlignmentOffset = function() {
  25963. switch (y.length = 0, B) {
  25964. case l.TextAlignment.LEFT:
  25965. for (var t = 0; t < g; ++t) y.push(0);
  25966. break;
  25967. case l.TextAlignment.CENTER:
  25968. for (var e = 0, i = m.length; e < i; e++) y.push((w.width - m[e]) / 2);
  25969. break;
  25970. case l.TextAlignment.RIGHT:
  25971. for (var n = 0, r = m.length; n < r; n++) y.push(w.width - m[n])
  25972. }
  25973. if (b = w.height, I !== l.VerticalTextAlignment.TOP) {
  25974. var s = w.height - x + (R - D) * T;
  25975. I === l.VerticalTextAlignment.BOTTOM ? b -= s : b -= s / 2
  25976. }
  25977. }, e.prototype._setupBMFontOverflowMetrics = function() {
  25978. var t = w.width,
  25979. e = w.height;
  25980. O === h.RESIZE_HEIGHT && (e = 0), O === h.NONE && (t = 0, e = 0), F = t, N = e, V = t
  25981. }, e.prototype.updateWorldVerts = function() {}, e.prototype.appendQuad = function(t, e, i, n, r, s, o) {}, e.prototype._quadsUpdated = function(t) {}, e.prototype._reserveQuads = function() {}, e
  25982. })(n.default);
  25983. i.default = k, e.exports = i.default
  25984. }), {
  25985. "../../../components/CCLabel": 97,
  25986. "../../../platform/CCMacro": 203,
  25987. "../../../utils/text-utils": 307,
  25988. "../../assembler-2d": 224,
  25989. "../utils": 255
  25990. }],
  25991. 252: [(function(t, e, i) {
  25992. "use strict";
  25993. function n() {
  25994. this._rect = null, this.uv = [], this._texture = null, this._original = null
  25995. }
  25996. n.prototype = {
  25997. constructor: n,
  25998. getRect: function() {
  25999. return cc.rect(this._rect)
  26000. },
  26001. setRect: function(t) {
  26002. this._rect = t, this._texture && this._calculateUV()
  26003. },
  26004. _setDynamicAtlasFrame: function(t) {
  26005. t && (this._original = {
  26006. _texture: this._texture,
  26007. _x: this._rect.x,
  26008. _y: this._rect.y
  26009. }, this._texture = t.texture, this._rect.x = t.x, this._rect.y = t.y, this._calculateUV())
  26010. },
  26011. _resetDynamicAtlasFrame: function() {
  26012. this._original && (this._rect.x = this._original._x, this._rect.y = this._original._y, this._texture = this._original._texture, this._original = null, this._calculateUV())
  26013. },
  26014. _refreshTexture: function(t) {
  26015. this._texture = t, this._rect = cc.rect(0, 0, t.width, t.height), this._calculateUV()
  26016. },
  26017. _calculateUV: function() {
  26018. var t = this._rect,
  26019. e = this._texture,
  26020. i = this.uv,
  26021. n = e.width,
  26022. r = e.height,
  26023. s = 0 === n ? 0 : t.x / n,
  26024. o = 0 === n ? 0 : (t.x + t.width) / n,
  26025. a = 0 === r ? 0 : (t.y + t.height) / r,
  26026. l = 0 === r ? 0 : t.y / r;
  26027. i[0] = s, i[1] = a, i[2] = o, i[3] = a, i[4] = s, i[5] = l, i[6] = o, i[7] = l
  26028. }
  26029. }, e.exports = n
  26030. }), {}],
  26031. 253: [(function(t, e, i) {
  26032. "use strict";
  26033. i.__esModule = !0, i.default = void 0;
  26034. var n = (function(t) {
  26035. return t && t.__esModule ? t : {
  26036. default: t
  26037. }
  26038. })(t("../../webgl/assemblers/label/2d/bmfont"));
  26039. function r(t, e) {
  26040. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  26041. }
  26042. function s(t, e) {
  26043. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  26044. return !e || "object" != typeof e && "function" != typeof e ? t : e
  26045. }
  26046. function o(t, e) {
  26047. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  26048. t.prototype = Object.create(e && e.prototype, {
  26049. constructor: {
  26050. value: t,
  26051. enumerable: !1,
  26052. writable: !0,
  26053. configurable: !0
  26054. }
  26055. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  26056. }
  26057. var a = t("../../../components/CCLabel"),
  26058. l = t("../../../components/CCLabelOutline"),
  26059. h = t("../../../utils/text-utils"),
  26060. c = t("../../../components/CCComponent"),
  26061. u = t("../../../assets/CCRenderTexture"),
  26062. _ = cc.js.isChildClassOf(l, c),
  26063. f = t("../utils").getFontFamily,
  26064. d = t("../utils").shareLabelInfo,
  26065. p = cc.BitmapFont.FontLetterDefinition,
  26066. m = cc.BitmapFont.FontAtlas,
  26067. y = cc.Color.WHITE,
  26068. v = 2,
  26069. g = (1 / 255).toFixed(3);
  26070. function x(t, e) {
  26071. this._texture = null, this._labelInfo = e, this._char = t, this._hash = null, this._data = null, this._canvas = null, this._context = null, this._width = 0, this._height = 0, this._offsetY = 0, this._hash = t.charCodeAt(0) + e.hash
  26072. }
  26073. function b(t, e) {
  26074. var i = new u;
  26075. i.initWithSize(t, e), i.update(), this._fontDefDictionary = new m(i), this._x = v, this._y = v, this._nexty = v, this._width = t, this._height = e, cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this)
  26076. }
  26077. function A(t) {
  26078. var e = t.color.toHEX("#rrggbb"),
  26079. i = "";
  26080. return t.isOutlined && (i = i + t.margin + t.out.toHEX("#rrggbb")), "" + t.fontSize + t.fontFamily + e + i
  26081. }
  26082. x.prototype = {
  26083. constructor: x,
  26084. updateRenderData: function() {
  26085. this._updateProperties(), this._updateTexture()
  26086. },
  26087. _updateProperties: function() {
  26088. this._texture = new cc.Texture2D, this._data = a._canvasPool.get(), this._canvas = this._data.canvas, this._context = this._data.context, this._context.font = this._labelInfo.fontDesc;
  26089. var t = h.safeMeasureText(this._context, this._char);
  26090. this._width = parseFloat(t.toFixed(2)) + 2 * this._labelInfo.margin, this._height = (1 + h.BASELINE_RATIO) * this._labelInfo.fontSize + 2 * this._labelInfo.margin, this._offsetY = -this._labelInfo.fontSize * h.BASELINE_RATIO / 2, this._canvas.width !== this._width && (this._canvas.width = this._width), this._canvas.height !== this._height && (this._canvas.height = this._height), this._texture.initWithElement(this._canvas)
  26091. },
  26092. _updateTexture: function() {
  26093. var t = this._context,
  26094. e = this._labelInfo,
  26095. i = this._canvas.width,
  26096. n = this._canvas.height,
  26097. r = i / 2,
  26098. s = n / 2 + this._labelInfo.fontSize * h.MIDDLE_RATIO,
  26099. o = e.color;
  26100. if (t.textAlign = "center", t.textBaseline = "alphabetic", t.clearRect(0, 0, i, n), t.fillStyle = "rgba(" + o.r + ", " + o.g + ", " + o.b + ", " + g + ")", t.fillRect(0, 0, i, n), t.font = e.fontDesc, t.lineJoin = "round", t.fillStyle = "rgba(" + o.r + ", " + o.g + ", " + o.b + ", 1)", e.isOutlined) {
  26101. var a = e.out || y;
  26102. t.strokeStyle = "rgba(" + a.r + ", " + a.g + ", " + a.b + ", " + a.a / 255 + ")", t.lineWidth = 2 * e.margin, t.strokeText(this._char, r, s)
  26103. }
  26104. t.fillText(this._char, r, s), this._texture.handleLoadedTexture()
  26105. },
  26106. destroy: function() {
  26107. this._texture.destroy(), this._texture = null, a._canvasPool.put(this._data)
  26108. }
  26109. }, cc.js.mixin(b.prototype, {
  26110. insertLetterTexture: function(t) {
  26111. var e = t._texture,
  26112. i = e.width,
  26113. n = e.height;
  26114. if (this._x + i + v > this._width && (this._x = v, this._y = this._nexty), this._y + n > this._nexty && (this._nexty = this._y + n + v), this._nexty > this._height) return null;
  26115. this._fontDefDictionary._texture.drawTextureAt(e, this._x, this._y), this._dirty = !0;
  26116. var r = new p;
  26117. return r.u = this._x, r.v = this._y, r.texture = this._fontDefDictionary._texture, r.valid = !0, r.w = t._width, r.h = t._height, r.xAdvance = t._width, r.offsetY = t._offsetY, this._x += i + v, this._fontDefDictionary.addLetterDefinitions(t._hash, r), r
  26118. },
  26119. update: function() {
  26120. this._dirty && (this._fontDefDictionary._texture.update(), this._dirty = !1)
  26121. },
  26122. reset: function() {
  26123. this._x = v, this._y = v, this._nexty = v;
  26124. for (var t = this._fontDefDictionary._letterDefinitions, e = 0, i = t.length; e < i; e++) {
  26125. var n = t[e];
  26126. n.isValid && n.destroy()
  26127. }
  26128. this._fontDefDictionary.clear()
  26129. },
  26130. destroy: function() {
  26131. this.reset(), this._fontDefDictionary._texture.destroy(), this._fontDefDictionary._texture = null
  26132. },
  26133. beforeSceneLoad: function() {
  26134. this.clearAllCache()
  26135. },
  26136. clearAllCache: function() {
  26137. this.destroy();
  26138. var t = new u;
  26139. t.initWithSize(this._width, this._height), t.update(), this._fontDefDictionary._texture = t
  26140. },
  26141. getLetter: function(t) {
  26142. return this._fontDefDictionary._letterDefinitions[t]
  26143. },
  26144. getTexture: function() {
  26145. return this._fontDefDictionary.getTexture()
  26146. },
  26147. getLetterDefinitionForChar: function(t, e) {
  26148. var i = t.charCodeAt(0) + e.hash,
  26149. n = this._fontDefDictionary._letterDefinitions[i];
  26150. if (!n) {
  26151. var r = new x(t, e);
  26152. r.updateRenderData(), n = this.insertLetterTexture(r), r.destroy()
  26153. }
  26154. return n
  26155. }
  26156. });
  26157. var C = null,
  26158. T = (function(t) {
  26159. function e() {
  26160. return r(this, e), s(this, t.apply(this, arguments))
  26161. }
  26162. return o(e, t), e.prototype._getAssemblerData = function() {
  26163. return C || (C = new b(2048, 2048), cc.Label._shareAtlas = C), C.getTexture()
  26164. }, e.prototype._updateFontFamily = function(t) {
  26165. d.fontAtlas = C, d.fontFamily = f(t);
  26166. var e = _ && t.getComponent(l);
  26167. e && e.enabled ? (d.isOutlined = !0, d.margin = e.width, d.out = e.color.clone(), d.out.a = e.color.a * t.node.color.a / 255) : (d.isOutlined = !1, d.margin = 0)
  26168. }, e.prototype._updateLabelInfo = function(t) {
  26169. d.fontDesc = this._getFontDesc(), d.color = t.node.color, d.hash = A(d)
  26170. }, e.prototype._getFontDesc = function() {
  26171. var t = d.fontSize.toString() + "px ";
  26172. return t += d.fontFamily
  26173. }, e.prototype._computeHorizontalKerningForText = function() {}, e.prototype._determineRect = function(t) {
  26174. return !1
  26175. }, e
  26176. })(n.default);
  26177. i.default = T, e.exports = i.default
  26178. }), {
  26179. "../../../assets/CCRenderTexture": 66,
  26180. "../../../components/CCComponent": 95,
  26181. "../../../components/CCLabel": 97,
  26182. "../../../components/CCLabelOutline": 98,
  26183. "../../../utils/text-utils": 307,
  26184. "../../webgl/assemblers/label/2d/bmfont": 260,
  26185. "../utils": 255
  26186. }],
  26187. 254: [(function(t, e, i) {
  26188. "use strict";
  26189. i.__esModule = !0, i.default = void 0;
  26190. var n = (function(t) {
  26191. return t && t.__esModule ? t : {
  26192. default: t
  26193. }
  26194. })(t("../../assembler-2d"));
  26195. function r(t, e) {
  26196. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  26197. }
  26198. function s(t, e) {
  26199. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  26200. return !e || "object" != typeof e && "function" != typeof e ? t : e
  26201. }
  26202. function o(t, e) {
  26203. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  26204. t.prototype = Object.create(e && e.prototype, {
  26205. constructor: {
  26206. value: t,
  26207. enumerable: !1,
  26208. writable: !0,
  26209. configurable: !0
  26210. }
  26211. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  26212. }
  26213. var a = t("../../../utils/text-utils"),
  26214. l = t("../../../platform/CCMacro"),
  26215. h = t("../../../components/CCLabel"),
  26216. c = t("../../../components/CCLabelOutline"),
  26217. u = t("../../../components/CCLabelShadow"),
  26218. _ = h.Overflow,
  26219. f = t("../utils").deleteFromDynamicAtlas,
  26220. d = t("../utils").getFontFamily,
  26221. p = (1 / 255).toFixed(3),
  26222. m = null,
  26223. y = null,
  26224. v = null,
  26225. g = "",
  26226. x = "",
  26227. b = 0,
  26228. A = 0,
  26229. C = [],
  26230. T = cc.Size.ZERO,
  26231. S = 0,
  26232. w = 0,
  26233. E = 0,
  26234. M = null,
  26235. D = "",
  26236. B = _.NONE,
  26237. I = !1,
  26238. P = null,
  26239. R = cc.Color.WHITE,
  26240. O = null,
  26241. L = cc.Color.BLACK,
  26242. F = cc.rect(),
  26243. N = cc.Size.ZERO,
  26244. V = cc.Size.ZERO,
  26245. k = !1,
  26246. G = !1,
  26247. U = !1,
  26248. z = 0,
  26249. j = cc.Vec2.ZERO,
  26250. W = 0,
  26251. H = void 0,
  26252. X = (function(t) {
  26253. function e() {
  26254. return r(this, e), s(this, t.apply(this, arguments))
  26255. }
  26256. return o(e, t), e.prototype._getAssemblerData = function() {
  26257. return (H = h._canvasPool.get()).canvas.width = H.canvas.height = 1, H
  26258. }, e.prototype._resetAssemblerData = function(t) {
  26259. t && h._canvasPool.put(t)
  26260. }, e.prototype.updateRenderData = function(e) {
  26261. t.prototype.updateRenderData.call(this, e), e._vertsDirty && (this._updateFontFamily(e), this._updateProperties(e), this._calculateLabelFont(), this._calculateSplitedStrings(), this._updateLabelDimensions(), this._calculateTextBaseline(), this._updateTexture(e), this._calDynamicAtlas(e), e._actualFontSize = b, e.node.setContentSize(V), this.updateVerts(e), e._vertsDirty = !1, m = null, y = null, v = null)
  26262. }, e.prototype.updateVerts = function() {}, e.prototype._updatePaddingRect = function() {
  26263. var t = 0,
  26264. e = 0,
  26265. i = 0,
  26266. n = 0,
  26267. r = 0;
  26268. if (N.width = N.height = 0, P && (t = e = i = n = r = P.width, N.width = N.height = 2 * r), O) {
  26269. var s = O.blur + r;
  26270. i = Math.max(i, -O._offset.x + s), n = Math.max(n, O._offset.x + s), t = Math.max(t, O._offset.y + s), e = Math.max(e, -O._offset.y + s)
  26271. }
  26272. if (G) {
  26273. var o = A * Math.tan(.20943951);
  26274. n += o, N.width += o
  26275. }
  26276. F.x = i, F.y = t, F.width = i + n, F.height = t + e
  26277. }, e.prototype._updateFontFamily = function(t) {
  26278. D = d(t)
  26279. }, e.prototype._updateProperties = function(t) {
  26280. var e = t._assemblerData;
  26281. m = e.context, y = e.canvas, v = t._frame._original ? t._frame._original._texture : t._frame._texture, x = t.string.toString(), b = t._fontSize, z = (A = b) / 8, B = t.overflow, T.width = t.node.width, T.height = t.node.height, V = t.node.getContentSize(), S = t._lineHeight, w = t.horizontalAlign, E = t.verticalAlign, M = t.node.color, k = t._isBold, G = t._isItalic, U = t._isUnderline, I = B !== _.NONE && (B === _.RESIZE_HEIGHT || t.enableWrapText), (P = (P = c && t.getComponent(c)) && P.enabled && P.width > 0 ? P : null) && R.set(P.color), (O = (O = u && t.getComponent(u)) && O.enabled ? O : null) && (L.set(O.color), L.a = L.a * t.node.color.a / 255), this._updatePaddingRect()
  26282. }, e.prototype._calculateFillTextStartPosition = function() {
  26283. var t = 0;
  26284. w === l.TextAlignment.RIGHT ? t = T.width - F.width : w === l.TextAlignment.CENTER && (t = (T.width - F.width) / 2);
  26285. var e = this._getLineHeight() * (C.length - 1),
  26286. i = b * (1 - a.BASELINE_RATIO / 2);
  26287. if (E !== l.VerticalTextAlignment.TOP) {
  26288. var n = e + F.height + b - T.height;
  26289. E === l.VerticalTextAlignment.BOTTOM ? i -= n : i -= n / 2
  26290. }
  26291. return cc.v2(t + F.x, i + F.y)
  26292. }, e.prototype._setupOutline = function() {
  26293. m.strokeStyle = "rgba(" + R.r + ", " + R.g + ", " + R.b + ", " + R.a / 255 + ")", m.lineWidth = 2 * P.width
  26294. }, e.prototype._setupShadow = function() {
  26295. m.shadowColor = "rgba(" + L.r + ", " + L.g + ", " + L.b + ", " + L.a / 255 + ")", m.shadowBlur = O.blur, m.shadowOffsetX = O.offset.x, m.shadowOffsetY = -O.offset.y
  26296. }, e.prototype._drawUnderline = function(t) {
  26297. P && (this._setupOutline(), m.strokeRect(j.x, j.y, t, z)), m.lineWidth = z, m.fillStyle = "rgba(" + M.r + ", " + M.g + ", " + M.b + ", " + M.a / 255 + ")", m.fillRect(j.x, j.y, t, z)
  26298. }, e.prototype._updateTexture = function() {
  26299. m.clearRect(0, 0, y.width, y.height);
  26300. var t = P ? R : M;
  26301. m.fillStyle = "rgba(" + t.r + ", " + t.g + ", " + t.b + ", " + p + ")", m.fillRect(0, 0, y.width, y.height), m.font = g;
  26302. var e = this._calculateFillTextStartPosition(),
  26303. i = this._getLineHeight();
  26304. m.lineJoin = "round", m.fillStyle = "rgba(" + M.r + ", " + M.g + ", " + M.b + ", 1)";
  26305. var n = C.length > 1,
  26306. r = this._measureText(m),
  26307. s = 0,
  26308. o = 0;
  26309. O && this._setupShadow(), P && P.width > 0 && this._setupOutline();
  26310. for (var a = 0; a < C.length; ++a) s = e.x, o = e.y + a * i, O && n && (P && P.width > 0 && m.strokeText(C[a], s, o), m.fillText(C[a], s, o)), U && (W = r(C[a]), w === l.TextAlignment.RIGHT ? j.x = e.x - W : w === l.TextAlignment.CENTER ? j.x = e.x - W / 2 : j.x = e.x, j.y = o, this._drawUnderline(W));
  26311. O && n && (m.shadowColor = "transparent");
  26312. for (var h = 0; h < C.length; ++h) s = e.x, o = e.y + h * i, P && P.width > 0 && m.strokeText(C[h], s, o), m.fillText(C[h], s, o);
  26313. O && (m.shadowColor = "transparent"), v.handleLoadedTexture()
  26314. }, e.prototype._calDynamicAtlas = function(t) {
  26315. if (t.cacheMode === h.CacheMode.BITMAP) {
  26316. var e = t._frame;
  26317. f(t, e), e._original || e.setRect(cc.rect(0, 0, y.width, y.height)), this.packToDynamicAtlas(t, e)
  26318. }
  26319. }, e.prototype._updateLabelDimensions = function() {
  26320. var t = x.split("\n");
  26321. if (B === _.RESIZE_HEIGHT) {
  26322. var e = (C.length + a.BASELINE_RATIO) * this._getLineHeight();
  26323. T.height = e + F.height, V.height = e + N.height
  26324. } else if (B === _.NONE) {
  26325. C = t;
  26326. for (var i = 0, n = 0, r = 0; r < t.length; ++r) {
  26327. var s = a.safeMeasureText(m, t[r]);
  26328. i = i > s ? i : s
  26329. }
  26330. n = (C.length + a.BASELINE_RATIO) * this._getLineHeight();
  26331. var o = parseFloat(i.toFixed(2)),
  26332. l = parseFloat(n.toFixed(2));
  26333. T.width = o + F.width, T.height = l + F.height, V.width = o + N.width, V.height = l + N.height
  26334. }
  26335. T.width = Math.min(T.width, 2048), T.height = Math.min(T.height, 2048), y.width !== T.width && (y.width = T.width), y.height !== T.height && (y.height = T.height)
  26336. }, e.prototype._calculateTextBaseline = function() {
  26337. var t = void 0;
  26338. t = w === l.TextAlignment.RIGHT ? "right" : w === l.TextAlignment.CENTER ? "center" : "left", m.textAlign = t, m.textBaseline = "alphabetic"
  26339. }, e.prototype._calculateSplitedStrings = function() {
  26340. var t = x.split("\n");
  26341. if (I) {
  26342. C = [];
  26343. for (var e = V.width, i = 0; i < t.length; ++i) {
  26344. var n = a.safeMeasureText(m, t[i]),
  26345. r = a.fragmentText(t[i], n, e, this._measureText(m));
  26346. C = C.concat(r)
  26347. }
  26348. } else C = t
  26349. }, e.prototype._getFontDesc = function() {
  26350. var t = b.toString() + "px ";
  26351. return t += D, k && (t = "bold " + t), G && (t = "italic " + t), t
  26352. }, e.prototype._getLineHeight = function() {
  26353. var t = S;
  26354. return 0 | (t = 0 === t ? b : t * b / A)
  26355. }, e.prototype._calculateParagraphLength = function(t, e) {
  26356. for (var i = [], n = 0; n < t.length; ++n) {
  26357. var r = a.safeMeasureText(e, t[n]);
  26358. i.push(r)
  26359. }
  26360. return i
  26361. }, e.prototype._measureText = function(t) {
  26362. return function(e) {
  26363. return a.safeMeasureText(t, e)
  26364. }
  26365. }, e.prototype._calculateLabelFont = function() {
  26366. if (g = this._getFontDesc(), m.font = g, B === _.SHRINK) {
  26367. var t = x.split("\n"),
  26368. e = this._calculateParagraphLength(t, m),
  26369. i = 0,
  26370. n = 0,
  26371. r = 0;
  26372. if (I) {
  26373. var s = V.width,
  26374. o = V.height;
  26375. if (s < 0 || o < 0) return g = this._getFontDesc(), void(m.font = g);
  26376. n = o + 1, r = s + 1;
  26377. for (var l = b + 1, h = "", c = !0, u = 0 | l; n > o || r > s;) {
  26378. if (c ? l = u / 2 | 0 : u = l = u - 1, l <= 0) {
  26379. cc.logID(4003);
  26380. break
  26381. }
  26382. for (b = l, g = this._getFontDesc(), m.font = g, n = 0, i = 0; i < t.length; ++i) {
  26383. var f = 0,
  26384. d = a.safeMeasureText(m, t[i]);
  26385. for (h = a.fragmentText(t[i], d, s, this._measureText(m)); f < h.length;) r = a.safeMeasureText(m, h[f]), n += this._getLineHeight(), ++f
  26386. }
  26387. c && (n > o ? u = 0 | l : (c = !1, n = o + 1))
  26388. }
  26389. } else {
  26390. for (n = t.length * this._getLineHeight(), i = 0; i < t.length; ++i) r < e[i] && (r = e[i]);
  26391. var p = (T.width - F.width) / r,
  26392. y = T.height / n;
  26393. b = A * Math.min(1, p, y) | 0, g = this._getFontDesc(), m.font = g
  26394. }
  26395. }
  26396. }, e
  26397. })(n.default);
  26398. i.default = X, e.exports = i.default
  26399. }), {
  26400. "../../../components/CCLabel": 97,
  26401. "../../../components/CCLabelOutline": 98,
  26402. "../../../components/CCLabelShadow": 99,
  26403. "../../../platform/CCMacro": 203,
  26404. "../../../utils/text-utils": 307,
  26405. "../../assembler-2d": 224,
  26406. "../utils": 255
  26407. }],
  26408. 255: [(function(t, e, i) {
  26409. "use strict";
  26410. var n = t("./dynamic-atlas/manager"),
  26411. r = cc.Color.WHITE,
  26412. s = {
  26413. fontAtlas: null,
  26414. fontSize: 0,
  26415. lineHeight: 0,
  26416. hAlign: 0,
  26417. vAlign: 0,
  26418. hash: "",
  26419. fontFamily: "",
  26420. fontDesc: "Arial",
  26421. color: r,
  26422. isOutlined: !1,
  26423. out: r,
  26424. margin: 0
  26425. };
  26426. e.exports = {
  26427. deleteFromDynamicAtlas: function(t, e) {
  26428. e && e._original && n && (n.deleteAtlasTexture(e), e._resetDynamicAtlasFrame())
  26429. },
  26430. getFontFamily: function(t) {
  26431. return t.useSystemFont ? t.fontFamily || "Arial" : t.font ? t.font._nativeAsset ? t.font._nativeAsset : (cc.loader.load(t.font.nativeUrl, (function(e, i) {
  26432. t.font._nativeAsset = i, t._lazyUpdateRenderData()
  26433. })), "Arial") : "Arial"
  26434. },
  26435. shareLabelInfo: s
  26436. }
  26437. }), {
  26438. "./dynamic-atlas/manager": 250
  26439. }],
  26440. 256: [(function(t, e, i) {
  26441. "use strict";
  26442. function n(t, e, i) {
  26443. i = i || 2;
  26444. var n, s, a, l, h, c, _, f = e && e.length,
  26445. d = f ? e[0] * i : t.length,
  26446. p = r(t, 0, d, i, !0),
  26447. m = [];
  26448. if (!p) return m;
  26449. if (f && (p = u(t, e, p, i)), t.length > 80 * i) {
  26450. n = a = t[0], s = l = t[1];
  26451. for (var y = i; y < d; y += i) h = t[y], c = t[y + 1], h < n && (n = h), c < s && (s = c), h > a && (a = h), c > l && (l = c);
  26452. _ = Math.max(a - n, l - s)
  26453. }
  26454. return o(p, m, i, n, s, _), m
  26455. }
  26456. function r(t, e, i, n, r) {
  26457. var s, o;
  26458. if (r === I(t, e, i, n) > 0)
  26459. for (s = e; s < i; s += n) o = M(s, t[s], t[s + 1], o);
  26460. else
  26461. for (s = i - n; s >= e; s -= n) o = M(s, t[s], t[s + 1], o);
  26462. return o && A(o, o.next) && (D(o), o = o.next), o
  26463. }
  26464. function s(t, e) {
  26465. if (!t) return t;
  26466. e || (e = t);
  26467. var i, n = t;
  26468. do {
  26469. if (i = !1, n.steiner || !A(n, n.next) && 0 !== b(n.prev, n, n.next)) n = n.next;
  26470. else {
  26471. if (D(n), (n = e = n.prev) === n.next) return null;
  26472. i = !0
  26473. }
  26474. } while (i || n !== e);
  26475. return e
  26476. }
  26477. function o(t, e, i, n, r, u, _) {
  26478. if (t) {
  26479. !_ && u && p(t, n, r, u);
  26480. for (var f, d, m = t; t.prev !== t.next;)
  26481. if (f = t.prev, d = t.next, u ? l(t, n, r, u) : a(t)) e.push(f.i / i), e.push(t.i / i), e.push(d.i / i), D(t), t = d.next, m = d.next;
  26482. else if ((t = d) === m) {
  26483. _ ? 1 === _ ? o(t = h(t, e, i), e, i, n, r, u, 2) : 2 === _ && c(t, e, i, n, r, u) : o(s(t), e, i, n, r, u, 1);
  26484. break
  26485. }
  26486. }
  26487. }
  26488. function a(t) {
  26489. var e = t.prev,
  26490. i = t,
  26491. n = t.next;
  26492. if (b(e, i, n) >= 0) return !1;
  26493. for (var r = t.next.next; r !== t.prev;) {
  26494. if (g(e.x, e.y, i.x, i.y, n.x, n.y, r.x, r.y) && b(r.prev, r, r.next) >= 0) return !1;
  26495. r = r.next
  26496. }
  26497. return !0
  26498. }
  26499. function l(t, e, i, n) {
  26500. var r = t.prev,
  26501. s = t,
  26502. o = t.next;
  26503. if (b(r, s, o) >= 0) return !1;
  26504. for (var a = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, l = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, h = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, c = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, u = y(a, l, e, i, n), _ = y(h, c, e, i, n), f = t.nextZ; f && f.z <= _;) {
  26505. if (f !== t.prev && f !== t.next && g(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && b(f.prev, f, f.next) >= 0) return !1;
  26506. f = f.nextZ
  26507. }
  26508. for (f = t.prevZ; f && f.z >= u;) {
  26509. if (f !== t.prev && f !== t.next && g(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && b(f.prev, f, f.next) >= 0) return !1;
  26510. f = f.prevZ
  26511. }
  26512. return !0
  26513. }
  26514. function h(t, e, i) {
  26515. var n = t;
  26516. do {
  26517. var r = n.prev,
  26518. s = n.next.next;
  26519. !A(r, s) && C(r, n, n.next, s) && S(r, s) && S(s, r) && (e.push(r.i / i), e.push(n.i / i), e.push(s.i / i), D(n), D(n.next), n = t = s), n = n.next
  26520. } while (n !== t);
  26521. return n
  26522. }
  26523. function c(t, e, i, n, r, a) {
  26524. var l = t;
  26525. do {
  26526. for (var h = l.next.next; h !== l.prev;) {
  26527. if (l.i !== h.i && x(l, h)) {
  26528. var c = E(l, h);
  26529. return l = s(l, l.next), c = s(c, c.next), o(l, e, i, n, r, a), void o(c, e, i, n, r, a)
  26530. }
  26531. h = h.next
  26532. }
  26533. l = l.next
  26534. } while (l !== t)
  26535. }
  26536. function u(t, e, i, n) {
  26537. var o, a, l, h = [];
  26538. for (o = 0, a = e.length; o < a; o++)(l = r(t, e[o] * n, o < a - 1 ? e[o + 1] * n : t.length, n, !1)) === l.next && (l.steiner = !0), h.push(v(l));
  26539. for (h.sort(_), o = 0; o < h.length; o++) f(h[o], i), i = s(i, i.next);
  26540. return i
  26541. }
  26542. function _(t, e) {
  26543. return t.x - e.x
  26544. }
  26545. function f(t, e) {
  26546. if (e = d(t, e)) {
  26547. var i = E(e, t);
  26548. s(i, i.next)
  26549. }
  26550. }
  26551. function d(t, e) {
  26552. var i, n = e,
  26553. r = t.x,
  26554. s = t.y,
  26555. o = -1 / 0;
  26556. do {
  26557. if (s <= n.y && s >= n.next.y) {
  26558. var a = n.x + (s - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
  26559. if (a <= r && a > o) {
  26560. if (o = a, a === r) {
  26561. if (s === n.y) return n;
  26562. if (s === n.next.y) return n.next
  26563. }
  26564. i = n.x < n.next.x ? n : n.next
  26565. }
  26566. }
  26567. n = n.next
  26568. } while (n !== e);
  26569. if (!i) return null;
  26570. if (r === o) return i.prev;
  26571. var l, h = i,
  26572. c = i.x,
  26573. u = i.y,
  26574. _ = 1 / 0;
  26575. for (n = i.next; n !== h;) r >= n.x && n.x >= c && g(s < u ? r : o, s, c, u, s < u ? o : r, s, n.x, n.y) && ((l = Math.abs(s - n.y) / (r - n.x)) < _ || l === _ && n.x > i.x) && S(n, t) && (i = n, _ = l), n = n.next;
  26576. return i
  26577. }
  26578. function p(t, e, i, n) {
  26579. var r = t;
  26580. do {
  26581. null === r.z && (r.z = y(r.x, r.y, e, i, n)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next
  26582. } while (r !== t);
  26583. r.prevZ.nextZ = null, r.prevZ = null, m(r)
  26584. }
  26585. function m(t) {
  26586. var e, i, n, r, s, o, a, l, h = 1;
  26587. do {
  26588. for (i = t, t = null, s = null, o = 0; i;) {
  26589. for (o++, n = i, a = 0, e = 0; e < h && (a++, n = n.nextZ); e++);
  26590. for (l = h; a > 0 || l > 0 && n;) 0 === a ? (r = n, n = n.nextZ, l--) : 0 !== l && n ? i.z <= n.z ? (r = i, i = i.nextZ, a--) : (r = n, n = n.nextZ, l--) : (r = i, i = i.nextZ, a--), s ? s.nextZ = r : t = r, r.prevZ = s, s = r;
  26591. i = n
  26592. }
  26593. s.nextZ = null, h *= 2
  26594. } while (o > 1);
  26595. return t
  26596. }
  26597. function y(t, e, i, n, r) {
  26598. return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) / r) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) / r) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1
  26599. }
  26600. function v(t) {
  26601. var e = t,
  26602. i = t;
  26603. do {
  26604. e.x < i.x && (i = e), e = e.next
  26605. } while (e !== t);
  26606. return i
  26607. }
  26608. function g(t, e, i, n, r, s, o, a) {
  26609. return (r - o) * (e - a) - (t - o) * (s - a) >= 0 && (t - o) * (n - a) - (i - o) * (e - a) >= 0 && (i - o) * (s - a) - (r - o) * (n - a) >= 0
  26610. }
  26611. function x(t, e) {
  26612. return t.next.i !== e.i && t.prev.i !== e.i && !T(t, e) && S(t, e) && S(e, t) && w(t, e)
  26613. }
  26614. function b(t, e, i) {
  26615. return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y)
  26616. }
  26617. function A(t, e) {
  26618. return t.x === e.x && t.y === e.y
  26619. }
  26620. function C(t, e, i, n) {
  26621. return !!(A(t, e) && A(i, n) || A(t, n) && A(i, e)) || b(t, e, i) > 0 != b(t, e, n) > 0 && b(i, n, t) > 0 != b(i, n, e) > 0
  26622. }
  26623. function T(t, e) {
  26624. var i = t;
  26625. do {
  26626. if (i.i !== t.i && i.next.i !== t.i && i.i !== e.i && i.next.i !== e.i && C(i, i.next, t, e)) return !0;
  26627. i = i.next
  26628. } while (i !== t);
  26629. return !1
  26630. }
  26631. function S(t, e) {
  26632. return b(t.prev, t, t.next) < 0 ? b(t, e, t.next) >= 0 && b(t, t.prev, e) >= 0 : b(t, e, t.prev) < 0 || b(t, t.next, e) < 0
  26633. }
  26634. function w(t, e) {
  26635. var i = t,
  26636. n = !1,
  26637. r = (t.x + e.x) / 2,
  26638. s = (t.y + e.y) / 2;
  26639. do {
  26640. i.y > s != i.next.y > s && r < (i.next.x - i.x) * (s - i.y) / (i.next.y - i.y) + i.x && (n = !n), i = i.next
  26641. } while (i !== t);
  26642. return n
  26643. }
  26644. function E(t, e) {
  26645. var i = new B(t.i, t.x, t.y),
  26646. n = new B(e.i, e.x, e.y),
  26647. r = t.next,
  26648. s = e.prev;
  26649. return t.next = e, e.prev = t, i.next = r, r.prev = i, n.next = i, i.prev = n, s.next = n, n.prev = s, n
  26650. }
  26651. function M(t, e, i, n) {
  26652. var r = new B(t, e, i);
  26653. return n ? (r.next = n.next, r.prev = n, n.next.prev = r, n.next = r) : (r.prev = r, r.next = r), r
  26654. }
  26655. function D(t) {
  26656. t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ)
  26657. }
  26658. function B(t, e, i) {
  26659. this.i = t, this.x = e, this.y = i, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1
  26660. }
  26661. function I(t, e, i, n) {
  26662. for (var r = 0, s = e, o = i - n; s < i; s += n) r += (t[o] - t[s]) * (t[s + 1] + t[o + 1]), o = s;
  26663. return r
  26664. }
  26665. cc.Graphics.earcut = e.exports = n, n.deviation = function(t, e, i, n) {
  26666. var r = e && e.length,
  26667. s = r ? e[0] * i : t.length,
  26668. o = Math.abs(I(t, 0, s, i));
  26669. if (r)
  26670. for (var a = 0, l = e.length; a < l; a++) {
  26671. var h = e[a] * i,
  26672. c = a < l - 1 ? e[a + 1] * i : t.length;
  26673. o -= Math.abs(I(t, h, c, i))
  26674. }
  26675. var u = 0;
  26676. for (a = 0; a < n.length; a += 3) {
  26677. var _ = n[a] * i,
  26678. f = n[a + 1] * i,
  26679. d = n[a + 2] * i;
  26680. u += Math.abs((t[_] - t[d]) * (t[f + 1] - t[_ + 1]) - (t[_] - t[f]) * (t[d + 1] - t[_ + 1]))
  26681. }
  26682. return 0 === o && 0 === u ? 0 : Math.abs((u - o) / o)
  26683. }, n.flatten = function(t) {
  26684. for (var e = t[0][0].length, i = {
  26685. vertices: [],
  26686. holes: [],
  26687. dimensions: e
  26688. }, n = 0, r = 0; r < t.length; r++) {
  26689. for (var s = 0; s < t[r].length; s++)
  26690. for (var o = 0; o < e; o++) i.vertices.push(t[r][s][o]);
  26691. r > 0 && (n += t[r - 1].length, i.holes.push(n))
  26692. }
  26693. return i
  26694. }
  26695. }), {}],
  26696. 257: [(function(t, e, i) {
  26697. "use strict";
  26698. var n = t("../../../../graphics/helper"),
  26699. r = t("../../../../graphics/types").PointFlags,
  26700. s = cc.Graphics.Point = cc.Class({
  26701. name: "cc.GraphicsPoint",
  26702. extends: cc.Vec2,
  26703. ctor: function(t, e) {
  26704. this.reset()
  26705. },
  26706. reset: function() {
  26707. this.dx = 0, this.dy = 0, this.dmx = 0, this.dmy = 0, this.flags = 0, this.len = 0
  26708. }
  26709. });
  26710. function o() {
  26711. this.reset()
  26712. }
  26713. function a(t) {
  26714. this._tessTol = .25, this._distTol = .01, this._updatePathOffset = !1, this._paths = null, this._pathLength = 0, this._pathOffset = 0, this._points = null, this._pointsOffset = 0, this._commandx = 0, this._commandy = 0, this._paths = [], this._points = []
  26715. }
  26716. cc.js.mixin(o.prototype, {
  26717. reset: function() {
  26718. this.closed = !1, this.nbevel = 0, this.complex = !0, this.points ? this.points.length = 0 : this.points = []
  26719. }
  26720. }), cc.js.mixin(a.prototype, {
  26721. moveTo: function(t, e) {
  26722. this._updatePathOffset && (this._pathOffset = this._pathLength, this._updatePathOffset = !1), this._addPath(), this._addPoint(t, e, r.PT_CORNER), this._commandx = t, this._commandy = e
  26723. },
  26724. lineTo: function(t, e) {
  26725. this._addPoint(t, e, r.PT_CORNER), this._commandx = t, this._commandy = e
  26726. },
  26727. bezierCurveTo: function(t, e, i, s, o, a) {
  26728. var l = this._curPath,
  26729. h = l.points[l.points.length - 1];
  26730. h.x !== t || h.y !== e || i !== o || s !== a ? (n.tesselateBezier(this, h.x, h.y, t, e, i, s, o, a, 0, r.PT_CORNER), this._commandx = o, this._commandy = a) : this.lineTo(o, a)
  26731. },
  26732. quadraticCurveTo: function(t, e, i, n) {
  26733. var r = this._commandx,
  26734. s = this._commandy;
  26735. this.bezierCurveTo(r + 2 / 3 * (t - r), s + 2 / 3 * (e - s), i + 2 / 3 * (t - i), n + 2 / 3 * (e - n), i, n)
  26736. },
  26737. arc: function(t, e, i, r, s, o) {
  26738. n.arc(this, t, e, i, r, s, o)
  26739. },
  26740. ellipse: function(t, e, i, r) {
  26741. n.ellipse(this, t, e, i, r), this._curPath.complex = !1
  26742. },
  26743. circle: function(t, e, i) {
  26744. n.ellipse(this, t, e, i, i), this._curPath.complex = !1
  26745. },
  26746. rect: function(t, e, i, n) {
  26747. this.moveTo(t, e), this.lineTo(t, e + n), this.lineTo(t + i, e + n), this.lineTo(t + i, e), this.close(), this._curPath.complex = !1
  26748. },
  26749. roundRect: function(t, e, i, r, s) {
  26750. n.roundRect(this, t, e, i, r, s), this._curPath.complex = !1
  26751. },
  26752. clear: function(t) {
  26753. this._pathLength = 0, this._pathOffset = 0, this._pointsOffset = 0, this._curPath = null, t && (this._paths.length = 0, this._points.length = 0)
  26754. },
  26755. close: function() {
  26756. this._curPath.closed = !0
  26757. },
  26758. _addPath: function() {
  26759. var t = this._pathLength,
  26760. e = this._paths[t];
  26761. return e ? e.reset() : (e = new o, this._paths.push(e)), this._pathLength++, this._curPath = e, e
  26762. },
  26763. _addPoint: function(t, e, i) {
  26764. var n = this._curPath;
  26765. if (n) {
  26766. var r, o = this._points,
  26767. a = n.points;
  26768. (r = o[this._pointsOffset++]) ? (r.x = t, r.y = e) : (r = new s(t, e), o.push(r)), r.flags = i, a.push(r)
  26769. }
  26770. }
  26771. }), cc.Graphics._Impl = a, e.exports = a
  26772. }), {
  26773. "../../../../graphics/helper": 141,
  26774. "../../../../graphics/types": 143
  26775. }],
  26776. 258: [(function(t, e, i) {
  26777. "use strict";
  26778. i.__esModule = !0, i.default = void 0;
  26779. var n = s(t("../../../assembler")),
  26780. r = s(t("../../../../../renderer/core/input-assembler"));
  26781. function s(t) {
  26782. return t && t.__esModule ? t : {
  26783. default: t
  26784. }
  26785. }
  26786. function o(t, e) {
  26787. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  26788. }
  26789. function a(t, e) {
  26790. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  26791. return !e || "object" != typeof e && "function" != typeof e ? t : e
  26792. }
  26793. function l(t, e) {
  26794. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  26795. t.prototype = Object.create(e && e.prototype, {
  26796. constructor: {
  26797. value: t,
  26798. enumerable: !1,
  26799. writable: !0,
  26800. configurable: !0
  26801. }
  26802. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  26803. }
  26804. var h = t("../../mesh-buffer"),
  26805. c = t("../../vertex-format").vfmtPosColor,
  26806. u = t("../../../index"),
  26807. _ = t("../../../../graphics/graphics"),
  26808. f = t("../../../../graphics/types").PointFlags,
  26809. d = _.LineJoin,
  26810. p = _.LineCap,
  26811. m = t("./earcut"),
  26812. y = (t("./impl"), Math.PI),
  26813. v = Math.min,
  26814. g = Math.max,
  26815. x = Math.ceil,
  26816. b = Math.acos,
  26817. A = Math.cos,
  26818. C = Math.sin,
  26819. T = Math.atan2;
  26820. function S(t, e, i) {
  26821. var n = 2 * b(t / (t + i));
  26822. return g(2, x(e / n))
  26823. }
  26824. function w(t, e, i) {
  26825. return t < e ? e : t > i ? i : t
  26826. }
  26827. var E = (function(t) {
  26828. function e(i) {
  26829. o(this, e);
  26830. var n = a(this, t.call(this, i));
  26831. return n._buffer = null, n._buffers = [], n._bufferOffset = 0, n
  26832. }
  26833. return l(e, t), e.prototype.getVfmt = function() {
  26834. return c
  26835. }, e.prototype.requestBuffer = function() {
  26836. var t = {
  26837. indiceStart: 0,
  26838. vertexStart: 0
  26839. },
  26840. e = new h(u._handle, c);
  26841. t.meshbuffer = e;
  26842. var i = new r.default(e._vb, e._ib);
  26843. return t.ia = i, this._buffers.push(t), t
  26844. }, e.prototype.getBuffers = function() {
  26845. return 0 === this._buffers.length && this.requestBuffer(), this._buffers
  26846. }, e.prototype.clear = function(t) {
  26847. this._bufferOffset = 0;
  26848. var e = this._buffers;
  26849. if (t) {
  26850. for (var i = 0, n = e.length; i < n; i++) {
  26851. var r = e[i];
  26852. r.meshbuffer.destroy(), r.meshbuffer = null
  26853. }
  26854. e.length = 0
  26855. } else
  26856. for (var s = 0, o = e.length; s < o; s++) {
  26857. var a = e[s];
  26858. a.indiceStart = 0, a.vertexStart = 0, a.meshbuffer.reset()
  26859. }
  26860. }, e.prototype.fillBuffers = function(t, e) {
  26861. e._flush(), e.node = t.node, e.material = t.sharedMaterials[0];
  26862. for (var i = this.getBuffers(), n = 0, r = i.length; n < r; n++) {
  26863. var s = i[n],
  26864. o = s.meshbuffer;
  26865. s.ia._count = s.indiceStart, e._flushIA(s.ia), o.uploadData()
  26866. }
  26867. }, e.prototype.genBuffer = function(t, e) {
  26868. var i = this.getBuffers(),
  26869. n = i[this._bufferOffset],
  26870. r = n.meshbuffer,
  26871. s = n.vertexStart + e;
  26872. return (s > 65535 || 3 * s > 131070) && (++this._bufferOffset, s = e, this._bufferOffset < i.length ? n = i[this._bufferOffset] : (n = this.requestBuffer(t), i[this._bufferOffset] = n), r = n.meshbuffer), s > r.vertexOffset && r.requestStatic(e, 3 * e), this._buffer = n, n
  26873. }, e.prototype.stroke = function(t) {
  26874. this._curColor = t._strokeColor._val, this._flattenPaths(t._impl), this._expandStroke(t), t._impl._updatePathOffset = !0
  26875. }, e.prototype.fill = function(t) {
  26876. this._curColor = t._fillColor._val, this._expandFill(t), t._impl._updatePathOffset = !0
  26877. }, e.prototype._expandStroke = function(t) {
  26878. var e = .5 * t.lineWidth,
  26879. i = t.lineCap,
  26880. n = t.lineJoin,
  26881. r = t.miterLimit,
  26882. s = t._impl,
  26883. o = S(e, y, s._tessTol);
  26884. this._calculateJoins(s, e, n, r);
  26885. for (var a = s._paths, l = 0, h = s._pathOffset, c = s._pathLength; h < c; h++) {
  26886. var u = a[h],
  26887. _ = u.points.length;
  26888. n === d.ROUND ? l += 2 * (_ + u.nbevel * (o + 2) + 1) : l += 2 * (_ + 5 * u.nbevel + 1), u.closed || (i === p.ROUND ? l += 2 * (2 * o + 2) : l += 12)
  26889. }
  26890. for (var m = this.genBuffer(t, l), v = m.meshbuffer, g = v._vData, x = v._iData, b = s._pathOffset, A = s._pathLength; b < A; b++) {
  26891. var C, T = a[b],
  26892. w = T.points,
  26893. E = w.length,
  26894. M = m.vertexStart,
  26895. D = void 0,
  26896. B = void 0,
  26897. I = void 0,
  26898. P = void 0;
  26899. if ((C = T.closed) ? (D = w[E - 1], B = w[0], I = 0, P = E) : (D = w[0], B = w[1], I = 1, P = E - 1), !C) {
  26900. var R = B.sub(D);
  26901. R.normalizeSelf();
  26902. var O = R.x,
  26903. L = R.y;
  26904. i === p.BUTT ? this._buttCapStart(D, O, L, e, 0) : i === p.SQUARE ? this._buttCapStart(D, O, L, e, e) : i === p.ROUND && this._roundCapStart(D, O, L, e, o)
  26905. }
  26906. for (var F = I; F < P; ++F) n === d.ROUND ? this._roundJoin(D, B, e, e, o) : 0 != (B.flags & (f.PT_BEVEL | f.PT_INNERBEVEL)) ? this._bevelJoin(D, B, e, e) : (this._vset(B.x + B.dmx * e, B.y + B.dmy * e), this._vset(B.x - B.dmx * e, B.y - B.dmy * e)), D = B, B = w[F + 1];
  26907. if (C) {
  26908. var N = 3 * M;
  26909. this._vset(g[N], g[N + 1]), this._vset(g[N + 3], g[N + 4])
  26910. } else {
  26911. var V = B.sub(D);
  26912. V.normalizeSelf();
  26913. var k = V.x,
  26914. G = V.y;
  26915. i === p.BUTT ? this._buttCapEnd(B, k, G, e, 0) : i === p.SQUARE ? this._buttCapEnd(B, k, G, e, e) : i === p.ROUND && this._roundCapEnd(B, k, G, e, o)
  26916. }
  26917. for (var U = m.indiceStart, z = M + 2, j = m.vertexStart; z < j; z++) x[U++] = z - 2, x[U++] = z - 1, x[U++] = z;
  26918. m.indiceStart = U
  26919. }
  26920. }, e.prototype._expandFill = function(t) {
  26921. for (var e = t._impl, i = e._paths, n = 0, r = e._pathOffset, s = e._pathLength; r < s; r++) {
  26922. n += i[r].points.length
  26923. }
  26924. for (var o = this.genBuffer(t, n), a = o.meshbuffer, l = a._vData, h = a._iData, c = e._pathOffset, u = e._pathLength; c < u; c++) {
  26925. var _ = i[c],
  26926. f = _.points,
  26927. d = f.length;
  26928. if (0 !== d) {
  26929. for (var p = o.vertexStart, y = 0; y < d; ++y) this._vset(f[y].x, f[y].y);
  26930. var v = o.indiceStart;
  26931. if (_.complex) {
  26932. for (var g = [], x = p, b = o.vertexStart; x < b; x++) {
  26933. var A = 3 * x;
  26934. g.push(l[A]), g.push(l[A + 1])
  26935. }
  26936. var C = m(g, null, 2);
  26937. if (!C || 0 === C.length) continue;
  26938. for (var T = 0, S = C.length; T < S; T++) h[v++] = C[T] + p
  26939. } else
  26940. for (var w = p, E = p + 2, M = o.vertexStart; E < M; E++) h[v++] = w, h[v++] = E - 1, h[v++] = E;
  26941. o.indiceStart = v
  26942. }
  26943. }
  26944. }, e.prototype._calculateJoins = function(t, e, i, n) {
  26945. var r = 0;
  26946. e > 0 && (r = 1 / e);
  26947. for (var s = t._paths, o = t._pathOffset, a = t._pathLength; o < a; o++) {
  26948. var l = s[o],
  26949. h = l.points,
  26950. c = h.length,
  26951. u = h[c - 1],
  26952. _ = h[0];
  26953. l.nbevel = 0;
  26954. for (var p = 0; p < c; p++) {
  26955. var m, y, x = u.dy,
  26956. b = -u.dx,
  26957. A = _.dy,
  26958. C = -_.dx;
  26959. if (_.dmx = .5 * (x + A), _.dmy = .5 * (b + C), (m = _.dmx * _.dmx + _.dmy * _.dmy) > 1e-6) {
  26960. var T = 1 / m;
  26961. T > 600 && (T = 600), _.dmx *= T, _.dmy *= T
  26962. }
  26963. _.dx * u.dy - u.dx * _.dy > 0 && (0, _.flags |= f.PT_LEFT), m * (y = g(11, v(u.len, _.len) * r)) * y < 1 && (_.flags |= f.PT_INNERBEVEL), _.flags & f.PT_CORNER && (m * n * n < 1 || i === d.BEVEL || i === d.ROUND) && (_.flags |= f.PT_BEVEL), 0 != (_.flags & (f.PT_BEVEL | f.PT_INNERBEVEL)) && l.nbevel++, u = _, _ = h[p + 1]
  26964. }
  26965. }
  26966. }, e.prototype._flattenPaths = function(t) {
  26967. for (var e = t._paths, i = t._pathOffset, n = t._pathLength; i < n; i++) {
  26968. var r = e[i],
  26969. s = r.points,
  26970. o = s[s.length - 1],
  26971. a = s[0];
  26972. o.equals(a) && (r.closed = !0, s.pop(), o = s[s.length - 1]);
  26973. for (var l = 0, h = s.length; l < h; l++) {
  26974. var c = a.sub(o);
  26975. o.len = c.mag(), (c.x || c.y) && c.normalizeSelf(), o.dx = c.x, o.dy = c.y, o = a, a = s[l + 1]
  26976. }
  26977. }
  26978. }, e.prototype._chooseBevel = function(t, e, i, n) {
  26979. var r = i.x,
  26980. s = i.y,
  26981. o = void 0,
  26982. a = void 0,
  26983. l = void 0,
  26984. h = void 0;
  26985. return 0 !== t ? (o = r + e.dy * n, a = s - e.dx * n, l = r + i.dy * n, h = s - i.dx * n) : (o = l = r + i.dmx * n, a = h = s + i.dmy * n), [o, a, l, h]
  26986. }, e.prototype._buttCapStart = function(t, e, i, n, r) {
  26987. var s = t.x - e * r,
  26988. o = t.y - i * r,
  26989. a = i,
  26990. l = -e;
  26991. this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n)
  26992. }, e.prototype._buttCapEnd = function(t, e, i, n, r) {
  26993. var s = t.x + e * r,
  26994. o = t.y + i * r,
  26995. a = i,
  26996. l = -e;
  26997. this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n)
  26998. }, e.prototype._roundCapStart = function(t, e, i, n, r) {
  26999. for (var s = t.x, o = t.y, a = i, l = -e, h = 0; h < r; h++) {
  27000. var c = h / (r - 1) * y,
  27001. u = A(c) * n,
  27002. _ = C(c) * n;
  27003. this._vset(s - a * u - e * _, o - l * u - i * _), this._vset(s, o)
  27004. }
  27005. this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n)
  27006. }, e.prototype._roundCapEnd = function(t, e, i, n, r) {
  27007. var s = t.x,
  27008. o = t.y,
  27009. a = i,
  27010. l = -e;
  27011. this._vset(s + a * n, o + l * n), this._vset(s - a * n, o - l * n);
  27012. for (var h = 0; h < r; h++) {
  27013. var c = h / (r - 1) * y,
  27014. u = A(c) * n,
  27015. _ = C(c) * n;
  27016. this._vset(s, o), this._vset(s - a * u + e * _, o - l * u + i * _)
  27017. }
  27018. }, e.prototype._roundJoin = function(t, e, i, n, r) {
  27019. var s = t.dy,
  27020. o = -t.dx,
  27021. a = e.dy,
  27022. l = -e.dx,
  27023. h = e.x,
  27024. c = e.y;
  27025. if (0 != (e.flags & f.PT_LEFT)) {
  27026. var u = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, i),
  27027. _ = u[0],
  27028. d = u[1],
  27029. p = u[2],
  27030. m = u[3],
  27031. v = T(-o, -s),
  27032. g = T(-l, -a);
  27033. g > v && (g -= 2 * y), this._vset(_, d), this._vset(h - s * n, e.y - o * n);
  27034. for (var b = w(x((v - g) / y) * r, 2, r), S = 0; S < b; S++) {
  27035. var E = v + S / (b - 1) * (g - v),
  27036. M = h + A(E) * n,
  27037. D = c + C(E) * n;
  27038. this._vset(h, c), this._vset(M, D)
  27039. }
  27040. this._vset(p, m), this._vset(h - a * n, c - l * n)
  27041. } else {
  27042. var B = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, -n),
  27043. I = B[0],
  27044. P = B[1],
  27045. R = B[2],
  27046. O = B[3],
  27047. L = T(o, s),
  27048. F = T(l, a);
  27049. F < L && (F += 2 * y), this._vset(h + s * n, c + o * n), this._vset(I, P);
  27050. for (var N = w(x((F - L) / y) * r, 2, r), V = 0; V < N; V++) {
  27051. var k = L + V / (N - 1) * (F - L),
  27052. G = h + A(k) * i,
  27053. U = c + C(k) * i;
  27054. this._vset(G, U), this._vset(h, c)
  27055. }
  27056. this._vset(h + a * n, c + l * n), this._vset(R, O)
  27057. }
  27058. }, e.prototype._bevelJoin = function(t, e, i, n) {
  27059. var r = void 0,
  27060. s = void 0,
  27061. o = void 0,
  27062. a = void 0,
  27063. l = void 0,
  27064. h = void 0,
  27065. c = void 0,
  27066. u = void 0,
  27067. _ = t.dy,
  27068. d = -t.dx,
  27069. p = e.dy,
  27070. m = -e.dx;
  27071. if (e.flags & f.PT_LEFT) {
  27072. var y = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, i);
  27073. l = y[0], h = y[1], c = y[2], u = y[3], this._vset(l, h), this._vset(e.x - _ * n, e.y - d * n), this._vset(c, u), this._vset(e.x - p * n, e.y - m * n)
  27074. } else {
  27075. var v = this._chooseBevel(e.flags & f.PT_INNERBEVEL, t, e, -n);
  27076. r = v[0], s = v[1], o = v[2], a = v[3], this._vset(e.x + _ * i, e.y + d * i), this._vset(r, s), this._vset(e.x + p * i, e.y + m * i), this._vset(o, a)
  27077. }
  27078. }, e.prototype._vset = function(t, e) {
  27079. var i = this._buffer,
  27080. n = i.meshbuffer,
  27081. r = 3 * i.vertexStart,
  27082. s = n._vData,
  27083. o = n._uintVData;
  27084. s[r] = t, s[r + 1] = e, o[r + 2] = this._curColor, i.vertexStart++, n._dirty = !0
  27085. }, e
  27086. })(n.default);
  27087. i.default = E, n.default.register(cc.Graphics, E), e.exports = i.default
  27088. }), {
  27089. "../../../../../renderer/core/input-assembler": 350,
  27090. "../../../../graphics/graphics": 140,
  27091. "../../../../graphics/types": 143,
  27092. "../../../assembler": 227,
  27093. "../../../index": 247,
  27094. "../../mesh-buffer": 283,
  27095. "../../vertex-format": 288,
  27096. "./earcut": 256,
  27097. "./impl": 257
  27098. }],
  27099. 259: [(function(t, e, i) {
  27100. "use strict";
  27101. cc.assemblers = {}, t("./sprite"), t("./mask-assembler"), t("./graphics"), t("./label"), t("./motion-streak")
  27102. }), {
  27103. "./graphics": 258,
  27104. "./label": 266,
  27105. "./mask-assembler": 267,
  27106. "./motion-streak": 268,
  27107. "./sprite": 281
  27108. }],
  27109. 260: [(function(t, e, i) {
  27110. "use strict";
  27111. function n(t, e) {
  27112. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27113. }
  27114. function r(t, e) {
  27115. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27116. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27117. }
  27118. function s(t, e) {
  27119. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27120. t.prototype = Object.create(e && e.prototype, {
  27121. constructor: {
  27122. value: t,
  27123. enumerable: !1,
  27124. writable: !0,
  27125. configurable: !0
  27126. }
  27127. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27128. }
  27129. i.__esModule = !0, i.default = void 0;
  27130. var o = 0,
  27131. a = (function(t) {
  27132. function e() {
  27133. return n(this, e), r(this, t.apply(this, arguments))
  27134. }
  27135. return s(e, t), e.prototype.initData = function() {
  27136. this._renderData.createFlexData(0, 4, 6, this.getVfmt())
  27137. }, e.prototype._reserveQuads = function(t, e) {
  27138. var i = 4 * e,
  27139. n = 6 * e,
  27140. r = this._renderData._flexBuffer;
  27141. r.reserve(i, n), r.used(i, n);
  27142. for (var s = this._renderData.iDatas[0], a = 0, l = 0, h = n; a < h; a += 6, l += 4) s[a] = l, s[a + 1] = l + 1, s[a + 2] = l + 2, s[a + 3] = l + 1, s[a + 4] = l + 3, s[a + 5] = l + 2;
  27143. o = 0
  27144. }, e.prototype._quadsUpdated = function(t) {
  27145. o = 0, this._renderData._flexBuffer.used(this.verticesCount, this.indicesCount)
  27146. }, e.prototype._getColor = function(t) {
  27147. return t.node._color._val
  27148. }, e.prototype.appendQuad = function(t, e, i, n, r, s, a) {
  27149. var l = this._renderData,
  27150. h = l.vDatas[0],
  27151. c = l.uintVDatas[0];
  27152. this.verticesCount += 4, this.indicesCount = this.verticesCount / 2 * 3;
  27153. var u = e.width,
  27154. _ = e.height,
  27155. f = i.width,
  27156. d = i.height,
  27157. p = this._getColor(t),
  27158. m = void 0,
  27159. y = void 0,
  27160. v = void 0,
  27161. g = void 0,
  27162. x = this.floatsPerVert,
  27163. b = o + this.uvOffset;
  27164. n ? (m = i.x / u, v = (i.x + d) / u, y = (i.y + f) / _, g = i.y / _, h[b] = m, h[b + 1] = g, h[b += x] = m, h[b + 1] = y, h[b += x] = v, h[b + 1] = g, h[b += x] = v, h[b + 1] = y) : (m = i.x / u, v = (i.x + f) / u, y = (i.y + d) / _, g = i.y / _, h[b] = m, h[b + 1] = y, h[b += x] = v, h[b + 1] = y, h[b += x] = m, h[b + 1] = g, h[b += x] = v, h[b + 1] = g), m = r, v = r + f * a, y = s - d * a, g = s, this.appendVerts(t, o, m, v, y, g);
  27165. for (var A = o + this.colorOffset, C = 0; C < 4; C++) c[A] = p, A += x;
  27166. o += 4 * this.floatsPerVert
  27167. }, e.prototype.appendVerts = function(t, e, i, n, r, s) {
  27168. var o = this._local,
  27169. a = this.floatsPerVert;
  27170. o[e] = i, o[e + 1] = r, o[e += a] = n, o[e + 1] = r, o[e += a] = i, o[e + 1] = s, o[e += a] = n, o[e + 1] = s
  27171. }, e.prototype.updateWorldVerts = function(t) {
  27172. for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < l.length; u += c) {
  27173. var _ = l[u],
  27174. f = l[u + 1];
  27175. h[u] = _ * i + f * r + o, h[u + 1] = _ * n + f * s + a
  27176. }
  27177. }, e
  27178. })(function(t) {
  27179. return t && t.__esModule ? t : {
  27180. default: t
  27181. }
  27182. }(t("../../../../utils/label/bmfont")).default);
  27183. i.default = a, e.exports = i.default
  27184. }), {
  27185. "../../../../utils/label/bmfont": 251
  27186. }],
  27187. 261: [(function(t, e, i) {
  27188. "use strict";
  27189. function n(t, e) {
  27190. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27191. }
  27192. function r(t, e) {
  27193. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27194. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27195. }
  27196. function s(t, e) {
  27197. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27198. t.prototype = Object.create(e && e.prototype, {
  27199. constructor: {
  27200. value: t,
  27201. enumerable: !1,
  27202. writable: !0,
  27203. configurable: !0
  27204. }
  27205. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27206. }
  27207. i.__esModule = !0;
  27208. t("../../../../../platform/js"), t("./bmfont");
  27209. var o = t("../../../../utils/label/letter-font"),
  27210. a = cc.color(255, 255, 255, 255),
  27211. l = (function(t) {
  27212. function e() {
  27213. return n(this, e), r(this, t.apply(this, arguments))
  27214. }
  27215. return s(e, t), e.prototype.createData = function(t) {
  27216. return t.requestRenderData()
  27217. }, e.prototype._getColor = function(t) {
  27218. return a._fastSetA(t.node._color.a), a._val
  27219. }, e.prototype.updateColor = function(e) {
  27220. var i = this._getColor(e);
  27221. t.prototype.updateColor.call(this, e, i)
  27222. }, e
  27223. })(o);
  27224. i.default = l, e.exports = i.default
  27225. }), {
  27226. "../../../../../platform/js": 218,
  27227. "../../../../utils/label/letter-font": 253,
  27228. "./bmfont": 260
  27229. }],
  27230. 262: [(function(t, e, i) {
  27231. "use strict";
  27232. i.__esModule = !0, i.default = void 0;
  27233. var n = (function(t) {
  27234. return t && t.__esModule ? t : {
  27235. default: t
  27236. }
  27237. })(t("../../../../utils/label/ttf"));
  27238. function r(t, e) {
  27239. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27240. }
  27241. function s(t, e) {
  27242. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27243. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27244. }
  27245. function o(t, e) {
  27246. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27247. t.prototype = Object.create(e && e.prototype, {
  27248. constructor: {
  27249. value: t,
  27250. enumerable: !1,
  27251. writable: !0,
  27252. configurable: !0
  27253. }
  27254. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27255. }
  27256. var a = t("../../../../../components/CCLabelShadow"),
  27257. l = cc.color(255, 255, 255, 255),
  27258. h = (function(t) {
  27259. function e() {
  27260. return r(this, e), s(this, t.apply(this, arguments))
  27261. }
  27262. return o(e, t), e.prototype.updateUVs = function(t) {
  27263. for (var e = this._renderData.vDatas[0], i = t._frame.uv, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; s++) {
  27264. var o = 2 * s,
  27265. a = r * s + n;
  27266. e[a] = i[o], e[a + 1] = i[o + 1]
  27267. }
  27268. }, e.prototype.updateColor = function(e) {
  27269. l._fastSetA(e.node._color.a);
  27270. var i = l._val;
  27271. t.prototype.updateColor.call(this, e, i)
  27272. }, e.prototype.updateVerts = function(t) {
  27273. var e = t.node,
  27274. i = t._ttfTexture.width,
  27275. n = t._ttfTexture.height,
  27276. r = e.anchorX * e.width,
  27277. s = e.anchorY * e.height,
  27278. o = a && t.getComponent(a);
  27279. if (o && o._enabled) {
  27280. var l = (i - e.width) / 2,
  27281. h = (n - e.height) / 2,
  27282. c = o.offset; - c.x > l ? r += i - e.width : l > c.x && (r += l - c.x), -c.y > h ? s += n - e.height : h > c.y && (s += h - c.y)
  27283. }
  27284. var u = this._local;
  27285. u[0] = -r, u[1] = -s, u[2] = i - r, u[3] = n - s, this.updateUVs(t), this.updateWorldVerts(t)
  27286. }, e
  27287. })(n.default);
  27288. i.default = h, e.exports = i.default
  27289. }), {
  27290. "../../../../../components/CCLabelShadow": 99,
  27291. "../../../../utils/label/ttf": 254
  27292. }],
  27293. 263: [(function(t, e, i) {
  27294. "use strict";
  27295. function n(t, e) {
  27296. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27297. }
  27298. function r(t, e) {
  27299. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27300. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27301. }
  27302. function s(t, e) {
  27303. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27304. t.prototype = Object.create(e && e.prototype, {
  27305. constructor: {
  27306. value: t,
  27307. enumerable: !1,
  27308. writable: !0,
  27309. configurable: !0
  27310. }
  27311. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27312. }
  27313. i.__esModule = !0;
  27314. var o = t("../../../../assembler-3d"),
  27315. a = t("../2d/bmfont"),
  27316. l = cc.vmath.vec3,
  27317. h = l.create(),
  27318. c = l.create(),
  27319. u = (function(t) {
  27320. function e() {
  27321. return n(this, e), r(this, t.apply(this, arguments))
  27322. }
  27323. return s(e, t), e
  27324. })(a);
  27325. i.default = u, cc.js.mixin(u.prototype, o, {
  27326. updateWorldVerts: function(t) {
  27327. for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0; s < n.length; s += r) l.set(h, i[s], i[s + 1], 0), l.transformMat4(c, h, e), n[s] = c.x, n[s + 1] = c.y, n[s + 2] = c.z
  27328. }
  27329. }), e.exports = i.default
  27330. }), {
  27331. "../../../../assembler-3d": 225,
  27332. "../2d/bmfont": 260
  27333. }],
  27334. 264: [(function(t, e, i) {
  27335. "use strict";
  27336. function n(t, e) {
  27337. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27338. }
  27339. function r(t, e) {
  27340. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27341. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27342. }
  27343. function s(t, e) {
  27344. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27345. t.prototype = Object.create(e && e.prototype, {
  27346. constructor: {
  27347. value: t,
  27348. enumerable: !1,
  27349. writable: !0,
  27350. configurable: !0
  27351. }
  27352. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27353. }
  27354. i.__esModule = !0;
  27355. var o = t("../../../../assembler-3d"),
  27356. a = (function(t) {
  27357. function e() {
  27358. return n(this, e), r(this, t.apply(this, arguments))
  27359. }
  27360. return s(e, t), e
  27361. })(t("../2d/letter"));
  27362. i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
  27363. }), {
  27364. "../../../../assembler-3d": 225,
  27365. "../2d/letter": 261
  27366. }],
  27367. 265: [(function(t, e, i) {
  27368. "use strict";
  27369. function n(t, e) {
  27370. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27371. }
  27372. function r(t, e) {
  27373. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27374. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27375. }
  27376. function s(t, e) {
  27377. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27378. t.prototype = Object.create(e && e.prototype, {
  27379. constructor: {
  27380. value: t,
  27381. enumerable: !1,
  27382. writable: !0,
  27383. configurable: !0
  27384. }
  27385. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27386. }
  27387. i.__esModule = !0;
  27388. var o = t("../../../../assembler-3d"),
  27389. a = (function(t) {
  27390. function e() {
  27391. return n(this, e), r(this, t.apply(this, arguments))
  27392. }
  27393. return s(e, t), e
  27394. })(t("../2d/ttf"));
  27395. i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
  27396. }), {
  27397. "../../../../assembler-3d": 225,
  27398. "../2d/ttf": 262
  27399. }],
  27400. 266: [(function(t, e, i) {
  27401. "use strict";
  27402. var n = u(t("../../../assembler")),
  27403. r = u(t("../../../../components/CCLabel")),
  27404. s = u(t("./2d/ttf")),
  27405. o = u(t("./2d/bmfont")),
  27406. a = u(t("./2d/letter")),
  27407. l = u(t("./3d/ttf")),
  27408. h = u(t("./3d/bmfont")),
  27409. c = u(t("./3d/letter"));
  27410. function u(t) {
  27411. return t && t.__esModule ? t : {
  27412. default: t
  27413. }
  27414. }
  27415. r.default._canvasPool = {
  27416. pool: [],
  27417. get: function() {
  27418. var t = this.pool.pop();
  27419. if (!t) {
  27420. var e = document.createElement("canvas");
  27421. t = {
  27422. canvas: e,
  27423. context: e.getContext("2d")
  27424. }
  27425. }
  27426. return t
  27427. },
  27428. put: function(t) {
  27429. this.pool.length >= 32 || this.pool.push(t)
  27430. }
  27431. }, n.default.register(cc.Label, {
  27432. getConstructor: function(t) {
  27433. var e = t.node.is3DNode,
  27434. i = e ? l.default : s.default;
  27435. return t.font instanceof cc.BitmapFont ? i = e ? h.default : o.default : t.cacheMode === r.default.CacheMode.CHAR && (cc.sys.browserType === cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB ? cc.warn("sorry, subdomain does not support CHAR mode currently!") : i = e ? c.default : a.default), i
  27436. },
  27437. TTF: s.default,
  27438. Bmfont: o.default,
  27439. Letter: a.default,
  27440. TTF3D: l.default,
  27441. Bmfont3D: h.default,
  27442. Letter3D: c.default
  27443. })
  27444. }), {
  27445. "../../../../components/CCLabel": 97,
  27446. "../../../assembler": 227,
  27447. "./2d/bmfont": 260,
  27448. "./2d/letter": 261,
  27449. "./2d/ttf": 262,
  27450. "./3d/bmfont": 263,
  27451. "./3d/letter": 264,
  27452. "./3d/ttf": 265
  27453. }],
  27454. 267: [(function(t, e, i) {
  27455. "use strict";
  27456. i.__esModule = !0, i.MaskAssembler = void 0;
  27457. var n = (function(t) {
  27458. return t && t.__esModule ? t : {
  27459. default: t
  27460. }
  27461. })(t("../../assembler"));
  27462. function r(t, e) {
  27463. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27464. }
  27465. function s(t, e) {
  27466. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27467. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27468. }
  27469. function o(t, e) {
  27470. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27471. t.prototype = Object.create(e && e.prototype, {
  27472. constructor: {
  27473. value: t,
  27474. enumerable: !1,
  27475. writable: !0,
  27476. configurable: !0
  27477. }
  27478. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27479. }
  27480. var a = t("../../../components/CCMask"),
  27481. l = t("../../render-flow"),
  27482. h = t("./sprite/2d/simple"),
  27483. c = t("./graphics"),
  27484. u = t("../../../../renderer/gfx"),
  27485. _ = t("../vertex-format").vfmtPos,
  27486. f = 8,
  27487. d = [];
  27488. function p() {
  27489. return 1 << d.length - 1
  27490. }
  27491. function m() {
  27492. for (var t = 0, e = 0; e < d.length; ++e) t += 1 << e;
  27493. return t
  27494. }
  27495. function y(t, e, i, n, r, s) {
  27496. var o = t.effect,
  27497. a = u.STENCIL_OP_KEEP,
  27498. l = u.STENCIL_OP_KEEP;
  27499. o.setStencil(u.STENCIL_ENABLE, e, n, r, i, a, l, s)
  27500. }
  27501. function v(t) {
  27502. d.length + 1 > f && cc.errorID(9e3, f), d.push(t)
  27503. }
  27504. function g(t, e) {
  27505. 0 === d.length && cc.errorID(9001), d.pop(), 0 === d.length ? e._flushMaterial(t._exitMaterial) : A(e)
  27506. }
  27507. function x(t, e) {
  27508. var i = u.DS_FUNC_NEVER,
  27509. n = p(),
  27510. r = n,
  27511. s = n,
  27512. o = t.inverted ? u.STENCIL_OP_REPLACE : u.STENCIL_OP_ZERO;
  27513. y(t._clearMaterial, i, o, n, r, s);
  27514. var a = e.getBuffer("mesh", _),
  27515. l = a.request(4, 6),
  27516. h = l.indiceOffset,
  27517. c = l.byteOffset >> 2,
  27518. f = l.vertexOffset,
  27519. d = a._vData,
  27520. m = a._iData;
  27521. d[c++] = -1, d[c++] = -1, d[c++] = -1, d[c++] = 1, d[c++] = 1, d[c++] = 1, d[c++] = 1, d[c++] = -1, m[h++] = f, m[h++] = f + 3, m[h++] = f + 1, m[h++] = f + 1, m[h++] = f + 3, m[h++] = f + 2, e.node = e._dummyNode, e.material = t._clearMaterial, e._flush()
  27522. }
  27523. function b(t, e) {
  27524. var i = u.DS_FUNC_NEVER,
  27525. n = p(),
  27526. r = n,
  27527. s = n,
  27528. o = t.inverted ? u.STENCIL_OP_ZERO : u.STENCIL_OP_REPLACE;
  27529. y(t.sharedMaterials[0], i, o, n, r, s), e.material = t.sharedMaterials[0], t._type === a.Type.IMAGE_STENCIL ? (e.node = e._dummyNode, h.prototype.fillBuffers.call(t._assembler, t, e), e._flush()) : (e.node = t.node, c.prototype.fillBuffers.call(t._graphics._assembler, t._graphics, e))
  27530. }
  27531. function A(t) {
  27532. var e = u.DS_FUNC_EQUAL,
  27533. i = u.STENCIL_OP_KEEP,
  27534. n = m(),
  27535. r = n,
  27536. s = p(),
  27537. o = d[d.length - 1];
  27538. y(o._enableMaterial, e, i, n, r, s), t._flushMaterial(o._enableMaterial)
  27539. }
  27540. var C = i.MaskAssembler = (function(t) {
  27541. function e() {
  27542. return r(this, e), s(this, t.apply(this, arguments))
  27543. }
  27544. return o(e, t), e.prototype.updateRenderData = function(t) {
  27545. t._type === a.Type.IMAGE_STENCIL ? t.spriteFrame ? h.prototype.updateRenderData.call(this, t) : t.setMaterial(0, null) : (t._graphics.setMaterial(0, t.sharedMaterials[0]), c.prototype.updateRenderData.call(t._graphics._assembler, t._graphics, t._graphics))
  27546. }, e.prototype.fillBuffers = function(t, e) {
  27547. (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && (v(t), x(t, e), b(t, e), A(e)), t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA
  27548. }, e.prototype.postFillBuffers = function(t, e) {
  27549. (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && g(t, e), t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA
  27550. }, e
  27551. })(h);
  27552. n.default.register(a, C)
  27553. }), {
  27554. "../../../../renderer/gfx": 360,
  27555. "../../../components/CCMask": 101,
  27556. "../../assembler": 227,
  27557. "../../render-flow": 248,
  27558. "../vertex-format": 288,
  27559. "./graphics": 258,
  27560. "./sprite/2d/simple": 272
  27561. }],
  27562. 268: [(function(t, e, i) {
  27563. "use strict";
  27564. i.__esModule = !0, i.default = void 0;
  27565. var n = (function(t) {
  27566. return t && t.__esModule ? t : {
  27567. default: t
  27568. }
  27569. })(t("../../assembler-2d"));
  27570. function r(t, e) {
  27571. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27572. }
  27573. function s(t, e) {
  27574. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27575. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27576. }
  27577. function o(t, e) {
  27578. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27579. t.prototype = Object.create(e && e.prototype, {
  27580. constructor: {
  27581. value: t,
  27582. enumerable: !1,
  27583. writable: !0,
  27584. configurable: !0
  27585. }
  27586. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27587. }
  27588. var a = t("../../../components/CCMotionStreak"),
  27589. l = t("../../render-flow");
  27590. function h(t, e) {
  27591. this.point = t || cc.v2(), this.dir = e || cc.v2(), this.distance = 0, this.time = 0
  27592. }
  27593. h.prototype.setPoint = function(t, e) {
  27594. this.point.x = t, this.point.y = e
  27595. }, h.prototype.setDir = function(t, e) {
  27596. this.dir.x = t, this.dir.y = e
  27597. };
  27598. cc.v2(), cc.v2();
  27599. var c = cc.v2(),
  27600. u = cc.v2();
  27601. function _(t, e) {
  27602. return t.x = -e.y, t.y = e.x, t
  27603. }
  27604. var f = (function(t) {
  27605. function e() {
  27606. return r(this, e), s(this, t.apply(this, arguments))
  27607. }
  27608. return o(e, t), e.prototype.initData = function() {
  27609. this._renderData.createFlexData(0, 16, 42)
  27610. }, e.prototype.update = function(t, e) {
  27611. var i = t._stroke / 2,
  27612. n = t.node._worldMatrix.m,
  27613. r = n[12],
  27614. s = n[13],
  27615. o = t._points,
  27616. a = void 0;
  27617. if (o.length > 1) {
  27618. var l = o[0].point.x - r,
  27619. f = o[0].point.y - s;
  27620. l * l + f * f < t.minSeg && (a = o[0])
  27621. }
  27622. a || (a = new h, o.splice(0, 0, a)), a.setPoint(r, s), a.time = t._fadeTime + e;
  27623. var d, p = 0;
  27624. if (!(o.length < 2)) {
  27625. var m = t._color,
  27626. y = m.r,
  27627. v = m.g,
  27628. g = m.b,
  27629. x = m.a,
  27630. b = o[1];
  27631. b.distance = a.point.sub(b.point, u).mag(), u.normalizeSelf(), b.setDir(u.x, u.y), a.setDir(u.x, u.y);
  27632. var A = this._renderData._flexBuffer;
  27633. A.reserve(2 * o.length, 6 * (o.length - 1));
  27634. for (var C = A.vData, T = A.uintVData, S = t._fadeTime, w = !1, E = o.length - 1; E >= 0; E--) {
  27635. var M = o[E],
  27636. D = M.point,
  27637. B = M.dir;
  27638. if (M.time -= e, M.time < 0) o.splice(E, 1);
  27639. else {
  27640. var I = M.time / S,
  27641. P = o[E - 1];
  27642. if (!w) {
  27643. if (!P) {
  27644. o.splice(E, 1);
  27645. continue
  27646. }
  27647. D.x = P.point.x - B.x * I, D.y = P.point.y - B.y * I
  27648. }
  27649. w = !0, _(c, B);
  27650. var R = (I * x << 24 >>> 0) + (g << 16) + (v << 8) + y,
  27651. O = 5 * p;
  27652. C[O] = D.x + c.x * i, C[O + 1] = D.y + c.y * i, C[O + 2] = 1, C[O + 3] = I, T[O + 4] = R, C[O += 5] = D.x - c.x * i, C[O + 1] = D.y - c.y * i, C[O + 2] = 0, C[O + 3] = I, T[O + 4] = R, p += 2
  27653. }
  27654. }
  27655. d = p <= 2 ? 0 : 3 * (p - 2), A.used(p, d)
  27656. }
  27657. }, e.prototype.fillBuffers = function(t, e) {
  27658. var i = this._renderData._flexBuffer,
  27659. n = i.vData,
  27660. r = i.usedVertices,
  27661. s = i.usedIndices,
  27662. o = i.usedVerticesFloats,
  27663. a = e._meshBuffer,
  27664. h = a.request(r, s),
  27665. c = h.byteOffset >> 2,
  27666. u = a._vData;
  27667. n.length + c > u.length ? u.set(n.subarray(0, o), c) : u.set(n, c);
  27668. for (var _ = a._iData, f = h.indiceOffset, d = h.vertexOffset, p = 0, m = r; p < m; p += 2) {
  27669. var y = d + p;
  27670. _[f++] = y, _[f++] = y + 2, _[f++] = y + 1, _[f++] = y + 1, _[f++] = y + 2, _[f++] = y + 3
  27671. }
  27672. t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA
  27673. }, e
  27674. })(n.default);
  27675. i.default = f, f.register(a, f), e.exports = i.default
  27676. }), {
  27677. "../../../components/CCMotionStreak": 102,
  27678. "../../assembler-2d": 224,
  27679. "../../render-flow": 248
  27680. }],
  27681. 269: [(function(t, e, i) {
  27682. "use strict";
  27683. i.__esModule = !0, i.default = void 0;
  27684. var n = (function(t) {
  27685. return t && t.__esModule ? t : {
  27686. default: t
  27687. }
  27688. })(t("../../../../assembler-2d"));
  27689. function r(t, e) {
  27690. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27691. }
  27692. function s(t, e) {
  27693. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27694. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27695. }
  27696. function o(t, e) {
  27697. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27698. t.prototype = Object.create(e && e.prototype, {
  27699. constructor: {
  27700. value: t,
  27701. enumerable: !1,
  27702. writable: !0,
  27703. configurable: !0
  27704. }
  27705. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27706. }
  27707. var a = t("../../../../../components/CCSprite").FillType,
  27708. l = (function(t) {
  27709. function e() {
  27710. return r(this, e), s(this, t.apply(this, arguments))
  27711. }
  27712. return o(e, t), e.prototype.updateRenderData = function(t) {
  27713. var e = t._spriteFrame;
  27714. if (e && (this.packToDynamicAtlas(t, e), t._vertsDirty)) {
  27715. var i = t._fillStart,
  27716. n = t._fillRange;
  27717. n < 0 && (i += n, n = -n), n = i + n, i = (i = i > 1 ? 1 : i) < 0 ? 0 : i, n = (n = n > 1 ? 1 : n) < 0 ? 0 : n;
  27718. var r = i + (n = (n -= i) < 0 ? 0 : n);
  27719. r = r > 1 ? 1 : r, this.updateUVs(t, i, r), this.updateVerts(t, i, r), t._vertsDirty = !1
  27720. }
  27721. }, e.prototype.updateUVs = function(t, e, i) {
  27722. var n = t._spriteFrame,
  27723. r = n._texture.width,
  27724. s = n._texture.height,
  27725. o = n._rect,
  27726. l = void 0,
  27727. h = void 0,
  27728. c = void 0,
  27729. u = void 0,
  27730. _ = void 0,
  27731. f = void 0,
  27732. d = void 0,
  27733. p = void 0,
  27734. m = void 0,
  27735. y = void 0;
  27736. n._rotated ? (l = o.x / r, h = (o.y + o.width) / s, c = _ = l, d = m = (o.x + o.height) / r, f = y = h, u = p = o.y / s) : (l = o.x / r, h = (o.y + o.height) / s, c = d = l, _ = m = (o.x + o.width) / r, u = f = h, p = y = o.y / s);
  27737. var v = this._renderData.vDatas[0],
  27738. g = this.uvOffset,
  27739. x = this.floatsPerVert;
  27740. switch (t._fillType) {
  27741. case a.HORIZONTAL:
  27742. v[g] = c + (_ - c) * e, v[g + 1] = u + (f - u) * e, v[g + x] = c + (_ - c) * i, v[g + x + 1] = u + (f - u) * i, v[g + 2 * x] = d + (m - d) * e, v[g + 2 * x + 1] = p + (y - p) * e, v[g + 3 * x] = d + (m - d) * i, v[g + 3 * x + 1] = p + (y - p) * i;
  27743. break;
  27744. case a.VERTICAL:
  27745. v[g] = c + (d - c) * e, v[g + 1] = u + (p - u) * e, v[g + x] = _ + (m - _) * e, v[g + x + 1] = f + (y - f) * e, v[g + 2 * x] = c + (d - c) * i, v[g + 2 * x + 1] = u + (p - u) * i, v[g + 3 * x] = _ + (m - _) * i, v[g + 3 * x + 1] = f + (y - f) * i;
  27746. break;
  27747. default:
  27748. cc.errorID(2626)
  27749. }
  27750. }, e.prototype.updateVerts = function(t, e, i) {
  27751. var n = t.node,
  27752. r = n.width,
  27753. s = n.height,
  27754. o = n.anchorX * r,
  27755. l = n.anchorY * s,
  27756. h = -o,
  27757. c = -l,
  27758. u = r - o,
  27759. _ = s - l,
  27760. f = void 0;
  27761. switch (t._fillType) {
  27762. case a.HORIZONTAL:
  27763. f = h + (u - h) * i, h = h + (u - h) * e, u = f;
  27764. break;
  27765. case a.VERTICAL:
  27766. f = c + (_ - c) * i, c = c + (_ - c) * e, _ = f;
  27767. break;
  27768. default:
  27769. cc.errorID(2626)
  27770. }
  27771. var d = this._local;
  27772. d[0] = h, d[1] = c, d[2] = u, d[3] = _, this.updateWorldVerts(t)
  27773. }, e
  27774. })(n.default);
  27775. i.default = l, e.exports = i.default
  27776. }), {
  27777. "../../../../../components/CCSprite": 111,
  27778. "../../../../assembler-2d": 224
  27779. }],
  27780. 270: [(function(t, e, i) {
  27781. "use strict";
  27782. function n(t, e) {
  27783. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27784. }
  27785. function r(t, e) {
  27786. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27787. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27788. }
  27789. function s(t, e) {
  27790. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27791. t.prototype = Object.create(e && e.prototype, {
  27792. constructor: {
  27793. value: t,
  27794. enumerable: !1,
  27795. writable: !0,
  27796. configurable: !0
  27797. }
  27798. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27799. }
  27800. i.__esModule = !0, i.default = void 0;
  27801. var o = (function(t) {
  27802. function e() {
  27803. return n(this, e), r(this, t.apply(this, arguments))
  27804. }
  27805. return s(e, t), e.prototype.initData = function(t) {
  27806. this._renderData.createFlexData(0, 4, 6, this.getVfmt())
  27807. }, e.prototype.updateRenderData = function(t) {
  27808. this.packToDynamicAtlas(t, t._spriteFrame);
  27809. var e = t.spriteFrame;
  27810. if (e) {
  27811. var i = e.vertices;
  27812. if (i) {
  27813. this.verticesCount = i.x.length, this.indicesCount = i.triangles.length;
  27814. var n = this._renderData._flexBuffer;
  27815. n.reserve(this.verticesCount, this.indicesCount) && (this.updateColor(t), t._vertsDirty = !0), n.used(this.verticesCount, this.indicesCount), this.updateIndices(i.triangles), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), this.updateWorldVerts(t), t._vertsDirty = !1)
  27816. }
  27817. }
  27818. }, e.prototype.updateIndices = function(t) {
  27819. this._renderData.iDatas[0].set(t)
  27820. }, e.prototype.updateUVs = function(t) {
  27821. for (var e = t.spriteFrame.vertices, i = e.nu, n = e.nv, r = this.uvOffset, s = this.floatsPerVert, o = this._renderData.vDatas[0], a = 0; a < i.length; a++) {
  27822. var l = s * a + r;
  27823. o[l] = i[a], o[l + 1] = n[a]
  27824. }
  27825. }, e.prototype.updateVerts = function(t) {
  27826. var e = t.node,
  27827. i = Math.abs(e.width),
  27828. n = Math.abs(e.height),
  27829. r = e.anchorX * i,
  27830. s = e.anchorY * n,
  27831. o = t.spriteFrame,
  27832. a = o.vertices,
  27833. l = a.x,
  27834. h = a.y,
  27835. c = o._originalSize.width,
  27836. u = o._originalSize.height,
  27837. _ = o._rect.width,
  27838. f = o._rect.height,
  27839. d = o._offset.x + (c - _) / 2,
  27840. p = o._offset.y + (u - f) / 2,
  27841. m = i / (t.trim ? _ : c),
  27842. y = n / (t.trim ? f : u),
  27843. v = this._local;
  27844. if (t.trim)
  27845. for (var g = 0, x = l.length; g < x; g++) {
  27846. var b = 2 * g;
  27847. v[b] = (l[g] - d) * m - r, v[b + 1] = (u - h[g] - p) * y - s
  27848. } else
  27849. for (var A = 0, C = l.length; A < C; A++) {
  27850. var T = 2 * A;
  27851. v[T] = l[A] * m - r, v[T + 1] = (u - h[A]) * y - s
  27852. }
  27853. }, e.prototype.updateWorldVerts = function(t) {
  27854. for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0, _ = this.verticesCount; u < _; u++) {
  27855. var f = l[2 * u],
  27856. d = l[2 * u + 1];
  27857. h[c * u] = f * i + d * r + o, h[c * u + 1] = f * n + d * s + a
  27858. }
  27859. }, e
  27860. })(function(t) {
  27861. return t && t.__esModule ? t : {
  27862. default: t
  27863. }
  27864. }(t("../../../../assembler-2d")).default);
  27865. i.default = o, e.exports = i.default
  27866. }), {
  27867. "../../../../assembler-2d": 224
  27868. }],
  27869. 271: [(function(t, e, i) {
  27870. "use strict";
  27871. i.__esModule = !0, i.default = void 0;
  27872. var n = (function(t) {
  27873. return t && t.__esModule ? t : {
  27874. default: t
  27875. }
  27876. })(t("../../../../assembler-2d"));
  27877. function r(t, e) {
  27878. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  27879. }
  27880. function s(t, e) {
  27881. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  27882. return !e || "object" != typeof e && "function" != typeof e ? t : e
  27883. }
  27884. function o(t, e) {
  27885. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  27886. t.prototype = Object.create(e && e.prototype, {
  27887. constructor: {
  27888. value: t,
  27889. enumerable: !1,
  27890. writable: !0,
  27891. configurable: !0
  27892. }
  27893. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  27894. }
  27895. var a = 2 * Math.PI,
  27896. l = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)],
  27897. h = [0, 0, 0, 0],
  27898. c = [0, 0, 0, 0, 0, 0, 0, 0],
  27899. u = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)],
  27900. _ = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)],
  27901. f = cc.v2(0, 0),
  27902. d = [];
  27903. function p(t, e, i, n, r, s, o) {
  27904. var a = Math.sin(s),
  27905. l = Math.cos(s),
  27906. h = void 0,
  27907. c = void 0;
  27908. if (0 !== Math.cos(s)) {
  27909. if (h = a / l, (t - r.x) * l > 0) {
  27910. var u = r.y + h * (t - r.x);
  27911. o[0].x = t, o[0].y = u
  27912. }
  27913. if ((e - r.x) * l > 0) {
  27914. var _ = r.y + h * (e - r.x);
  27915. o[2].x = e, o[2].y = _
  27916. }
  27917. }
  27918. if (0 !== Math.sin(s)) {
  27919. if (c = l / a, (n - r.y) * a > 0) {
  27920. var f = r.x + c * (n - r.y);
  27921. o[3].x = f, o[3].y = n
  27922. }
  27923. if ((i - r.y) * a > 0) {
  27924. var d = r.x + c * (i - r.y);
  27925. o[1].x = d, o[1].y = i
  27926. }
  27927. }
  27928. }
  27929. function m(t) {
  27930. var e = t.node,
  27931. i = e.width,
  27932. n = e.height,
  27933. r = e.anchorX * i,
  27934. s = e.anchorY * n,
  27935. o = -r,
  27936. a = -s,
  27937. c = i - r,
  27938. u = n - s,
  27939. _ = h;
  27940. _[0] = o, _[1] = a, _[2] = c, _[3] = u;
  27941. var p = t._fillCenter,
  27942. m = f.x = Math.min(Math.max(0, p.x), 1) * (c - o) + o,
  27943. y = f.y = Math.min(Math.max(0, p.y), 1) * (u - a) + a;
  27944. l[0].x = l[3].x = o, l[1].x = l[2].x = c, l[0].y = l[1].y = a, l[2].y = l[3].y = u, d.length = 0, m !== _[0] && (d[0] = [3, 0]), m !== _[2] && (d[2] = [1, 2]), y !== _[1] && (d[1] = [0, 1]), y !== _[3] && (d[3] = [2, 3])
  27945. }
  27946. function y(t) {
  27947. var e = t._texture.width,
  27948. i = t._texture.height,
  27949. n = t._rect,
  27950. r = void 0,
  27951. s = void 0,
  27952. o = void 0,
  27953. a = void 0,
  27954. l = c;
  27955. t._rotated ? (r = n.x / e, s = (n.x + n.height) / e, o = n.y / i, a = (n.y + n.width) / i, l[0] = l[2] = r, l[4] = l[6] = s, l[3] = l[7] = a, l[1] = l[5] = o) : (r = n.x / e, s = (n.x + n.width) / e, o = n.y / i, a = (n.y + n.height) / i, l[0] = l[4] = r, l[2] = l[6] = s, l[1] = l[3] = a, l[5] = l[7] = o)
  27956. }
  27957. function v(t, e) {
  27958. var i, n;
  27959. if (i = e.x - t.x, n = e.y - t.y, 0 !== i || 0 !== n) {
  27960. if (0 === i) return n > 0 ? .5 * Math.PI : 1.5 * Math.PI;
  27961. var r = Math.atan(n / i);
  27962. return i < 0 && (r += Math.PI), r
  27963. }
  27964. }
  27965. var g = (function(t) {
  27966. function e() {
  27967. return r(this, e), s(this, t.apply(this, arguments))
  27968. }
  27969. return o(e, t), e.prototype.initData = function(t) {
  27970. this._renderData.createFlexData(0, 4, 6, this.getVfmt()), this.updateIndices()
  27971. }, e.prototype.updateRenderData = function(e) {
  27972. t.prototype.updateRenderData.call(this, e);
  27973. var i = e.spriteFrame;
  27974. if (i && (this.packToDynamicAtlas(e, i), e._vertsDirty)) {
  27975. var n = e._fillStart,
  27976. r = e._fillRange;
  27977. for (r < 0 && (n += r, r = -r); n >= 1;) n -= 1;
  27978. for (; n < 0;) n += 1;
  27979. n *= a, r *= a, m(e), y(i), p(h[0], h[2], h[1], h[3], f, n, u), p(h[0], h[2], h[1], h[3], f, n + r, _), this.updateVerts(e, n, r), e._vertsDirty = !1
  27980. }
  27981. }, e.prototype.updateVerts = function(t, e, i) {
  27982. for (var n = e + i, r = this._local, s = 0, o = 3 * this.floatsPerVert, h = 0; h < 4; ++h) {
  27983. var c = d[h];
  27984. if (c)
  27985. if (i >= a) r.length = s + o, this._generateTriangle(r, s, f, l[c[0]], l[c[1]]), s += o;
  27986. else {
  27987. var p = v(f, l[c[0]]),
  27988. m = v(f, l[c[1]]);
  27989. m < p && (m += a), p -= a, m -= a;
  27990. for (var y = 0; y < 3; ++y) p >= n || (p >= e ? (r.length = s + o, m >= n ? this._generateTriangle(r, s, f, l[c[0]], _[h]) : this._generateTriangle(r, s, f, l[c[0]], l[c[1]]), s += o) : m <= e || (m <= n ? (r.length = s + o, this._generateTriangle(r, s, f, u[h], l[c[1]]), s += o) : (r.length = s + o, this._generateTriangle(r, s, f, u[h], _[h]), s += o))), p += a, m += a
  27991. }
  27992. }
  27993. this.allocWorldVerts(t), this.updateWorldVerts(t)
  27994. }, e.prototype.allocWorldVerts = function(t) {
  27995. var e = t.node._color._val,
  27996. i = this._renderData,
  27997. n = this.floatsPerVert,
  27998. r = this._local,
  27999. s = r.length / n;
  28000. this.verticesCount = this.indicesCount = s;
  28001. var o = i._flexBuffer;
  28002. o.reserve(s, s) && this.updateIndices(), o.used(this.verticesCount, this.indicesCount);
  28003. for (var a = i.vDatas[0], l = i.uintVDatas[0], h = this.uvOffset, c = 0; c < r.length; c += n) {
  28004. var u = c + h;
  28005. a[u] = r[u], a[u + 1] = r[u + 1], l[u + 2] = e
  28006. }
  28007. }, e.prototype.updateIndices = function() {
  28008. for (var t = this._renderData.iDatas[0], e = 0; e < t.length; e++) t[e] = e
  28009. }, e.prototype.updateWorldVerts = function(t) {
  28010. for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < l.length; u += c) {
  28011. var _ = l[u],
  28012. f = l[u + 1];
  28013. h[u] = _ * i + f * r + o, h[u + 1] = _ * n + f * s + a
  28014. }
  28015. }, e.prototype._generateTriangle = function(t, e, i, n, r) {
  28016. var s = h,
  28017. o = s[0],
  28018. a = s[1],
  28019. l = s[2],
  28020. c = s[3],
  28021. u = this.floatsPerVert;
  28022. t[e] = i.x, t[e + 1] = i.y, t[e + u] = n.x, t[e + u + 1] = n.y, t[e + 2 * u] = r.x, t[e + 2 * u + 1] = r.y;
  28023. var _ = this.uvOffset,
  28024. f = void 0,
  28025. d = void 0;
  28026. f = (i.x - o) / (l - o), d = (i.y - a) / (c - a), this._generateUV(f, d, t, e + _), f = (n.x - o) / (l - o), d = (n.y - a) / (c - a), this._generateUV(f, d, t, e + u + _), f = (r.x - o) / (l - o), d = (r.y - a) / (c - a), this._generateUV(f, d, t, e + 2 * u + _)
  28027. }, e.prototype._generateUV = function(t, e, i, n) {
  28028. var r = c,
  28029. s = r[0] + (r[2] - r[0]) * t,
  28030. o = r[4] + (r[6] - r[4]) * t,
  28031. a = r[1] + (r[3] - r[1]) * t,
  28032. l = r[5] + (r[7] - r[5]) * t;
  28033. i[n] = s + (o - s) * e, i[n + 1] = a + (l - a) * e
  28034. }, e
  28035. })(n.default);
  28036. i.default = g, e.exports = i.default
  28037. }), {
  28038. "../../../../assembler-2d": 224
  28039. }],
  28040. 272: [(function(t, e, i) {
  28041. "use strict";
  28042. function n(t, e) {
  28043. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28044. }
  28045. function r(t, e) {
  28046. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28047. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28048. }
  28049. function s(t, e) {
  28050. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28051. t.prototype = Object.create(e && e.prototype, {
  28052. constructor: {
  28053. value: t,
  28054. enumerable: !1,
  28055. writable: !0,
  28056. configurable: !0
  28057. }
  28058. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28059. }
  28060. i.__esModule = !0, i.default = void 0;
  28061. var o = (function(t) {
  28062. function e() {
  28063. return n(this, e), r(this, t.apply(this, arguments))
  28064. }
  28065. return s(e, t), e.prototype.updateRenderData = function(t) {
  28066. var e = t._spriteFrame;
  28067. e && (this.packToDynamicAtlas(t, e), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1))
  28068. }, e.prototype.updateUVs = function(t) {
  28069. for (var e = t._spriteFrame.uv, i = this.uvOffset, n = this.floatsPerVert, r = this._renderData.vDatas[0], s = 0; s < 4; s++) {
  28070. var o = 2 * s,
  28071. a = n * s + i;
  28072. r[a] = e[o], r[a + 1] = e[o + 1]
  28073. }
  28074. }, e.prototype.updateVerts = function(t) {
  28075. var e = t.node,
  28076. i = e.width,
  28077. n = e.height,
  28078. r = e.anchorX * i,
  28079. s = e.anchorY * n,
  28080. o = void 0,
  28081. a = void 0,
  28082. l = void 0,
  28083. h = void 0;
  28084. if (t.trim) o = -r, a = -s, l = i - r, h = n - s;
  28085. else {
  28086. var c = t.spriteFrame,
  28087. u = c._originalSize.width,
  28088. _ = c._originalSize.height,
  28089. f = c._rect.width,
  28090. d = c._rect.height,
  28091. p = c._offset,
  28092. m = i / u,
  28093. y = n / _,
  28094. v = p.x + (u - f) / 2,
  28095. g = p.x - (u - f) / 2;
  28096. o = v * m - r, a = (p.y + (_ - d) / 2) * y - s, l = i + g * m - r, h = n + (p.y - (_ - d) / 2) * y - s
  28097. }
  28098. var x = this._local;
  28099. x[0] = o, x[1] = a, x[2] = l, x[3] = h, this.updateWorldVerts(t)
  28100. }, e
  28101. })(function(t) {
  28102. return t && t.__esModule ? t : {
  28103. default: t
  28104. }
  28105. }(t("../../../../assembler-2d")).default);
  28106. i.default = o, e.exports = i.default
  28107. }), {
  28108. "../../../../assembler-2d": 224
  28109. }],
  28110. 273: [(function(t, e, i) {
  28111. "use strict";
  28112. function n(t, e) {
  28113. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28114. }
  28115. function r(t, e) {
  28116. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28117. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28118. }
  28119. function s(t, e) {
  28120. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28121. t.prototype = Object.create(e && e.prototype, {
  28122. constructor: {
  28123. value: t,
  28124. enumerable: !1,
  28125. writable: !0,
  28126. configurable: !0
  28127. }
  28128. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28129. }
  28130. i.__esModule = !0, i.default = void 0;
  28131. var o = (function(t) {
  28132. function e() {
  28133. return n(this, e), r(this, t.apply(this, arguments))
  28134. }
  28135. return s(e, t), e.prototype.initData = function(t) {
  28136. if (!(this._renderData.meshCount > 0)) {
  28137. this._renderData.createData(0, this.verticesFloats, this.indicesCount);
  28138. for (var e = this._renderData.iDatas[0], i = 0, n = 0; n < 3; ++n)
  28139. for (var r = 0; r < 3; ++r) {
  28140. var s = 4 * n + r;
  28141. e[i++] = s, e[i++] = s + 1, e[i++] = s + 4, e[i++] = s + 1, e[i++] = s + 5, e[i++] = s + 4
  28142. }
  28143. }
  28144. }, e.prototype.initLocal = function() {
  28145. this._local = [], this._local.length = 8
  28146. }, e.prototype.updateRenderData = function(t) {
  28147. var e = t._spriteFrame;
  28148. e && (this.packToDynamicAtlas(t, e), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1))
  28149. }, e.prototype.updateVerts = function(t) {
  28150. var e = t.node,
  28151. i = e.width,
  28152. n = e.height,
  28153. r = e.anchorX * i,
  28154. s = e.anchorY * n,
  28155. o = t.spriteFrame,
  28156. a = o.insetLeft,
  28157. l = o.insetRight,
  28158. h = o.insetTop,
  28159. c = o.insetBottom,
  28160. u = i - a - l,
  28161. _ = n - h - c,
  28162. f = i / (a + l),
  28163. d = n / (h + c);
  28164. f = isNaN(f) || f > 1 ? 1 : f, d = isNaN(d) || d > 1 ? 1 : d, u = u < 0 ? 0 : u, _ = _ < 0 ? 0 : _;
  28165. var p = this._local;
  28166. p[0] = -r, p[1] = -s, p[2] = a * f - r, p[3] = c * d - s, p[4] = p[2] + u, p[5] = p[3] + _, p[6] = i - r, p[7] = n - s, this.updateWorldVerts(t)
  28167. }, e.prototype.updateUVs = function(t) {
  28168. for (var e = this._renderData.vDatas[0], i = t.spriteFrame.uvSliced, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; ++s)
  28169. for (var o = 0; o < 4; ++o) {
  28170. var a = 4 * s + o,
  28171. l = i[a],
  28172. h = a * r;
  28173. e[h + n] = l.u, e[h + n + 1] = l.v
  28174. }
  28175. }, e.prototype.updateWorldVerts = function(t) {
  28176. for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], o = e[12], a = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < 4; ++u)
  28177. for (var _ = l[2 * u + 1], f = 0; f < 4; ++f) {
  28178. var d = l[2 * f],
  28179. p = (4 * u + f) * c;
  28180. h[p] = d * i + _ * r + o, h[p + 1] = d * n + _ * s + a
  28181. }
  28182. }, e
  28183. })(function(t) {
  28184. return t && t.__esModule ? t : {
  28185. default: t
  28186. }
  28187. }(t("../../../../assembler-2d")).default);
  28188. i.default = o, Object.assign(o.prototype, {
  28189. verticesCount: 16,
  28190. indicesCount: 54
  28191. }), e.exports = i.default
  28192. }), {
  28193. "../../../../assembler-2d": 224
  28194. }],
  28195. 274: [(function(t, e, i) {
  28196. "use strict";
  28197. function n(t, e) {
  28198. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28199. }
  28200. function r(t, e) {
  28201. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28202. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28203. }
  28204. function s(t, e) {
  28205. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28206. t.prototype = Object.create(e && e.prototype, {
  28207. constructor: {
  28208. value: t,
  28209. enumerable: !1,
  28210. writable: !0,
  28211. configurable: !0
  28212. }
  28213. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28214. }
  28215. i.__esModule = !0, i.default = void 0;
  28216. var o = (function(t) {
  28217. function e() {
  28218. return n(this, e), r(this, t.apply(this, arguments))
  28219. }
  28220. return s(e, t), e.prototype.initData = function(t) {
  28221. this.verticesCount = 0, this.contentWidth = 0, this.contentHeight = 0, this.rectWidth = 0, this.rectHeight = 0, this.hRepeat = 0, this.vRepeat = 0, this.row = 0, this.col = 0, this._renderData.createFlexData(0, 4, 6, this.getVfmt()), this._updateIndices()
  28222. }, e.prototype.initLocal = function() {
  28223. this._local = {
  28224. x: [],
  28225. y: []
  28226. }
  28227. }, e.prototype._updateIndices = function() {
  28228. for (var t = this._renderData.iDatas[0], e = 0, i = 0, n = t.length; e < n; e += 6, i += 4) t[e] = i, t[e + 1] = i + 1, t[e + 2] = i + 2, t[e + 3] = i + 1, t[e + 4] = i + 3, t[e + 5] = i + 2
  28229. }, e.prototype.updateRenderData = function(t) {
  28230. var e = t._spriteFrame;
  28231. if (e) {
  28232. this.packToDynamicAtlas(t, e);
  28233. var i = t.node,
  28234. n = this.contentWidth = Math.abs(i.width),
  28235. r = this.contentHeight = Math.abs(i.height),
  28236. s = e._rect,
  28237. o = this.rectWidth = s.width,
  28238. a = this.rectHeight = s.height,
  28239. l = this.hRepeat = n / o,
  28240. h = this.vRepeat = r / a,
  28241. c = (this.row = Math.ceil(h)) * (this.col = Math.ceil(l));
  28242. this.verticesCount = 4 * c, this.indicesCount = 6 * c;
  28243. var u = this._renderData._flexBuffer;
  28244. u.reserve(this.verticesCount, this.indicesCount) && (this._updateIndices(), this.updateColor(t)), u.used(this.verticesCount, this.indicesCount), t._vertsDirty && (this.updateUVs(t), this.updateVerts(t), t._vertsDirty = !1)
  28245. }
  28246. }, e.prototype.updateVerts = function(t) {
  28247. var e = t.node,
  28248. i = e.anchorX * e.width,
  28249. n = e.anchorY * e.height,
  28250. r = this.row,
  28251. s = this.col,
  28252. o = this.rectWidth,
  28253. a = this.rectHeight,
  28254. l = this.contentWidth,
  28255. h = this.contentHeight,
  28256. c = this._local,
  28257. u = c.x,
  28258. _ = c.y;
  28259. u.length = _.length = 0;
  28260. for (var f = 0; f <= s; ++f) u[f] = Math.min(o * f, l) - i;
  28261. for (var d = 0; d <= r; ++d) _[d] = Math.min(a * d, h) - n;
  28262. this.updateWorldVerts(t)
  28263. }, e.prototype.updateWorldVerts = function(t) {
  28264. for (var e = this._renderData, i = this._local, n = i.x, r = i.y, s = e.vDatas[0], o = this.row, a = this.col, l = t.node._worldMatrix.m, h = l[0], c = l[1], u = l[4], _ = l[5], f = l[12], d = l[13], p = void 0, m = void 0, y = void 0, v = void 0, g = this.floatsPerVert, x = 0, b = 0, A = o; b < A; ++b) {
  28265. y = r[b], v = r[b + 1];
  28266. for (var C = 0, T = a; C < T; ++C) p = n[C], m = n[C + 1], s[x] = p * h + y * u + f, s[x + 1] = p * c + y * _ + d, s[x += g] = m * h + y * u + f, s[x + 1] = m * c + y * _ + d, s[x += g] = p * h + v * u + f, s[x + 1] = p * c + v * _ + d, s[x += g] = m * h + v * u + f, s[x + 1] = m * c + v * _ + d, x += g
  28267. }
  28268. }, e.prototype.updateUVs = function(t) {
  28269. var e = this._renderData.vDatas[0];
  28270. if (e)
  28271. for (var i = this.row, n = this.col, r = this.hRepeat, s = this.vRepeat, o = t.spriteFrame.uv, a = t.spriteFrame._rotated, l = this.floatsPerVert, h = this.uvOffset, c = 0, u = i; c < u; ++c)
  28272. for (var _ = Math.min(1, s - c), f = 0, d = n; f < d; ++f) {
  28273. var p = Math.min(1, r - f);
  28274. a ? (e[h] = o[0], e[h + 1] = o[1], e[h += l] = o[0], e[h + 1] = o[1] + (o[7] - o[1]) * p, e[h += l] = o[0] + (o[6] - o[0]) * _, e[h + 1] = o[1], e[h += l] = e[h - l], e[h + 1] = e[h + 1 - 2 * l], h += l) : (e[h] = o[0], e[h + 1] = o[1], e[h += l] = o[0] + (o[6] - o[0]) * p, e[h + 1] = o[1], e[h += l] = o[0], e[h + 1] = o[1] + (o[7] - o[1]) * _, e[h += l] = e[h - 2 * l], e[h + 1] = e[h + 1 - l], h += l)
  28275. }
  28276. }, e
  28277. })(function(t) {
  28278. return t && t.__esModule ? t : {
  28279. default: t
  28280. }
  28281. }(t("../../../../assembler-2d")).default);
  28282. i.default = o, e.exports = i.default
  28283. }), {
  28284. "../../../../assembler-2d": 224
  28285. }],
  28286. 275: [(function(t, e, i) {
  28287. "use strict";
  28288. function n(t, e) {
  28289. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28290. }
  28291. function r(t, e) {
  28292. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28293. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28294. }
  28295. function s(t, e) {
  28296. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28297. t.prototype = Object.create(e && e.prototype, {
  28298. constructor: {
  28299. value: t,
  28300. enumerable: !1,
  28301. writable: !0,
  28302. configurable: !0
  28303. }
  28304. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28305. }
  28306. i.__esModule = !0;
  28307. var o = t("../../../../assembler-3d"),
  28308. a = (function(t) {
  28309. function e() {
  28310. return n(this, e), r(this, t.apply(this, arguments))
  28311. }
  28312. return s(e, t), e
  28313. })(t("../2d/bar-filled"));
  28314. i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
  28315. }), {
  28316. "../../../../assembler-3d": 225,
  28317. "../2d/bar-filled": 269
  28318. }],
  28319. 276: [(function(t, e, i) {
  28320. "use strict";
  28321. function n(t, e) {
  28322. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28323. }
  28324. function r(t, e) {
  28325. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28326. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28327. }
  28328. function s(t, e) {
  28329. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28330. t.prototype = Object.create(e && e.prototype, {
  28331. constructor: {
  28332. value: t,
  28333. enumerable: !1,
  28334. writable: !0,
  28335. configurable: !0
  28336. }
  28337. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28338. }
  28339. i.__esModule = !0;
  28340. var o = t("../../../../assembler-3d"),
  28341. a = t("../2d/mesh"),
  28342. l = cc.vmath.vec3,
  28343. h = cc.v3(),
  28344. c = (function(t) {
  28345. function e() {
  28346. return n(this, e), r(this, t.apply(this, arguments))
  28347. }
  28348. return s(e, t), e
  28349. })(a);
  28350. i.default = c, cc.js.mixin(c.prototype, o, {
  28351. updateWorldVerts: function(t) {
  28352. for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0, o = i.length / 2; s < o; s++) {
  28353. l.set(h, i[2 * s], i[2 * s + 1], 0), l.transformMat4(h, h, e);
  28354. var a = r * s;
  28355. n[a] = h.x, n[a + 1] = h.y, n[a + 2] = h.z
  28356. }
  28357. }
  28358. }), e.exports = i.default
  28359. }), {
  28360. "../../../../assembler-3d": 225,
  28361. "../2d/mesh": 270
  28362. }],
  28363. 277: [(function(t, e, i) {
  28364. "use strict";
  28365. function n(t, e) {
  28366. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28367. }
  28368. function r(t, e) {
  28369. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28370. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28371. }
  28372. function s(t, e) {
  28373. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28374. t.prototype = Object.create(e && e.prototype, {
  28375. constructor: {
  28376. value: t,
  28377. enumerable: !1,
  28378. writable: !0,
  28379. configurable: !0
  28380. }
  28381. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28382. }
  28383. i.__esModule = !0;
  28384. var o = t("../../../../assembler-3d"),
  28385. a = t("../2d/radial-filled"),
  28386. l = cc.vmath.vec3,
  28387. h = l.create(),
  28388. c = l.create(),
  28389. u = (function(t) {
  28390. function e() {
  28391. return n(this, e), r(this, t.apply(this, arguments))
  28392. }
  28393. return s(e, t), e
  28394. })(a);
  28395. i.default = u, cc.js.mixin(u.prototype, o, {
  28396. updateWorldVerts: function(t) {
  28397. for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0; s < n.length; s += r) l.set(h, i[s], i[s + 1], 0), l.transformMat4(c, h, e), n[s] = c.x, n[s + 1] = c.y, n[s + 2] = c.z
  28398. }
  28399. }), e.exports = i.default
  28400. }), {
  28401. "../../../../assembler-3d": 225,
  28402. "../2d/radial-filled": 271
  28403. }],
  28404. 278: [(function(t, e, i) {
  28405. "use strict";
  28406. function n(t, e) {
  28407. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28408. }
  28409. function r(t, e) {
  28410. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28411. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28412. }
  28413. function s(t, e) {
  28414. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28415. t.prototype = Object.create(e && e.prototype, {
  28416. constructor: {
  28417. value: t,
  28418. enumerable: !1,
  28419. writable: !0,
  28420. configurable: !0
  28421. }
  28422. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28423. }
  28424. i.__esModule = !0;
  28425. var o = t("../../../../assembler-3d"),
  28426. a = (function(t) {
  28427. function e() {
  28428. return n(this, e), r(this, t.apply(this, arguments))
  28429. }
  28430. return s(e, t), e
  28431. })(t("../2d/simple"));
  28432. i.default = a, cc.js.mixin(a.prototype, o), e.exports = i.default
  28433. }), {
  28434. "../../../../assembler-3d": 225,
  28435. "../2d/simple": 272
  28436. }],
  28437. 279: [(function(t, e, i) {
  28438. "use strict";
  28439. function n(t, e) {
  28440. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28441. }
  28442. function r(t, e) {
  28443. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28444. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28445. }
  28446. function s(t, e) {
  28447. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28448. t.prototype = Object.create(e && e.prototype, {
  28449. constructor: {
  28450. value: t,
  28451. enumerable: !1,
  28452. writable: !0,
  28453. configurable: !0
  28454. }
  28455. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28456. }
  28457. i.__esModule = !0;
  28458. var o = t("../../../../assembler-3d"),
  28459. a = t("../2d/sliced"),
  28460. l = cc.vmath.vec3,
  28461. h = l.create(),
  28462. c = l.create(),
  28463. u = (function(t) {
  28464. function e() {
  28465. return n(this, e), r(this, t.apply(this, arguments))
  28466. }
  28467. return s(e, t), e
  28468. })(a);
  28469. i.default = u, cc.js.mixin(u.prototype, o, {
  28470. updateWorldVerts: function(t) {
  28471. for (var e = t.node._worldMatrix, i = this._local, n = this._renderData.vDatas[0], r = this.floatsPerVert, s = 0; s < 4; ++s)
  28472. for (var o = i[2 * s + 1], a = 0; a < 4; ++a) {
  28473. var u = i[2 * a];
  28474. l.set(h, u, o, 0), l.transformMat4(c, h, e);
  28475. var _ = (4 * s + a) * r;
  28476. n[_] = c.x, n[_ + 1] = c.y, n[_ + 2] = c.z
  28477. }
  28478. }
  28479. }), e.exports = i.default
  28480. }), {
  28481. "../../../../assembler-3d": 225,
  28482. "../2d/sliced": 273
  28483. }],
  28484. 280: [(function(t, e, i) {
  28485. "use strict";
  28486. function n(t, e) {
  28487. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28488. }
  28489. function r(t, e) {
  28490. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28491. return !e || "object" != typeof e && "function" != typeof e ? t : e
  28492. }
  28493. function s(t, e) {
  28494. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  28495. t.prototype = Object.create(e && e.prototype, {
  28496. constructor: {
  28497. value: t,
  28498. enumerable: !1,
  28499. writable: !0,
  28500. configurable: !0
  28501. }
  28502. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  28503. }
  28504. i.__esModule = !0;
  28505. for (var o = t("../../../../assembler-3d"), a = t("../2d/tiled"), l = cc.vmath.vec3, h = [], c = 0; c < 4; c++) h.push(l.create());
  28506. var u = (function(t) {
  28507. function e() {
  28508. return n(this, e), r(this, t.apply(this, arguments))
  28509. }
  28510. return s(e, t), e
  28511. })(a);
  28512. i.default = u, cc.js.mixin(u.prototype, o, {
  28513. updateWorldVerts: function(t) {
  28514. for (var e = this._local, i = e.x, n = e.y, r = this._renderData.vDatas[0], s = this.row, o = this.col, a = t.node._worldMatrix, c = void 0, u = void 0, _ = void 0, f = void 0, d = 0, p = 0, m = s; p < m; ++p) {
  28515. _ = n[p], f = n[p + 1];
  28516. for (var y = 0, v = o; y < v; ++y) {
  28517. c = i[y], u = i[y + 1], l.set(h[0], c, _, 0), l.set(h[1], u, _, 0), l.set(h[2], c, f, 0), l.set(h[3], u, f, 0);
  28518. for (var g = 0; g < 4; g++) {
  28519. var x = h[g];
  28520. l.transformMat4(x, x, a);
  28521. var b = 6 * g;
  28522. r[d + b] = x.x, r[d + b + 1] = x.y, r[d + b + 2] = x.z
  28523. }
  28524. d += 24
  28525. }
  28526. }
  28527. }
  28528. }), e.exports = i.default
  28529. }), {
  28530. "../../../../assembler-3d": 225,
  28531. "../2d/tiled": 274
  28532. }],
  28533. 281: [(function(t, e, i) {
  28534. "use strict";
  28535. var n = y(t("../../../assembler")),
  28536. r = t("../../../../components/CCSprite"),
  28537. s = y(t("./2d/simple")),
  28538. o = y(t("./2d/sliced")),
  28539. a = y(t("./2d/tiled")),
  28540. l = y(t("./2d/radial-filled")),
  28541. h = y(t("./2d/bar-filled")),
  28542. c = y(t("./2d/mesh")),
  28543. u = y(t("./3d/simple")),
  28544. _ = y(t("./3d/sliced")),
  28545. f = y(t("./3d/tiled")),
  28546. d = y(t("./3d/radial-filled")),
  28547. p = y(t("./3d/bar-filled")),
  28548. m = y(t("./3d/mesh"));
  28549. function y(t) {
  28550. return t && t.__esModule ? t : {
  28551. default: t
  28552. }
  28553. }
  28554. var v = {
  28555. getConstructor: function(t) {
  28556. var e = t.node.is3DNode,
  28557. i = e ? u.default : s.default;
  28558. switch (t.type) {
  28559. case r.Type.SLICED:
  28560. i = e ? _.default : o.default;
  28561. break;
  28562. case r.Type.TILED:
  28563. i = e ? f.default : a.default;
  28564. break;
  28565. case r.Type.FILLED:
  28566. i = t._fillType === r.FillType.RADIAL ? e ? d.default : l.default : e ? p.default : h.default;
  28567. break;
  28568. case r.Type.MESH:
  28569. i = e ? m.default : c.default
  28570. }
  28571. return i
  28572. },
  28573. Simple: s.default,
  28574. Sliced: o.default,
  28575. Tiled: a.default,
  28576. RadialFilled: l.default,
  28577. BarFilled: h.default,
  28578. Mesh: c.default,
  28579. Simple3D: u.default,
  28580. Sliced3D: _.default,
  28581. Tiled3D: f.default,
  28582. RadialFilled3D: d.default,
  28583. BarFilled3D: p.default,
  28584. Mesh3D: m.default
  28585. };
  28586. n.default.register(cc.Sprite, v)
  28587. }), {
  28588. "../../../../components/CCSprite": 111,
  28589. "../../../assembler": 227,
  28590. "./2d/bar-filled": 269,
  28591. "./2d/mesh": 270,
  28592. "./2d/radial-filled": 271,
  28593. "./2d/simple": 272,
  28594. "./2d/sliced": 273,
  28595. "./2d/tiled": 274,
  28596. "./3d/bar-filled": 275,
  28597. "./3d/mesh": 276,
  28598. "./3d/radial-filled": 277,
  28599. "./3d/simple": 278,
  28600. "./3d/sliced": 279,
  28601. "./3d/tiled": 280
  28602. }],
  28603. 282: [(function(t, e, i) {
  28604. "use strict";
  28605. function n(t, e) {
  28606. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  28607. }
  28608. i.__esModule = !0;
  28609. var r = (function() {
  28610. function t(e, i, r, s, o) {
  28611. n(this, t), this._handler = e, this._index = i, this._vfmt = o, this._verticesBytes = o._bytes, this._initVerticesCount = r, this._initIndicesCount = s, this.reset()
  28612. }
  28613. return t.prototype._reallocVData = function(t, e) {
  28614. this.vData = new Float32Array(t), this.uintVData = new Uint32Array(this.vData.buffer), e && this.vData.set(e), this._handler.updateMesh(this._index, this.vData, this.iData)
  28615. }, t.prototype._reallocIData = function(t, e) {
  28616. this.iData = new Uint16Array(t), e && this.iData.set(e), this._handler.updateMesh(this._index, this.vData, this.iData)
  28617. }, t.prototype.reserve = function(t, e) {
  28618. var i = t * this._verticesBytes >> 2,
  28619. n = this.vData.length,
  28620. r = !1;
  28621. if (i > n) {
  28622. for (; n < i;) n *= 2;
  28623. this._reallocVData(n, this.vData), r = !0
  28624. }
  28625. var s = this.iData.length;
  28626. if (e > s) {
  28627. for (; s < e;) s *= 2;
  28628. this._reallocIData(e, this.iData), r = !0
  28629. }
  28630. return r
  28631. }, t.prototype.used = function(t, e) {
  28632. this.usedVertices = t, this.usedIndices = e, this.usedVerticesFloats = t * this._verticesBytes >> 2, this._handler.updateMeshRange(t, e)
  28633. }, t.prototype.reset = function() {
  28634. var t = this._initVerticesCount * this._verticesBytes >> 2;
  28635. this._reallocVData(t), this._reallocIData(this._initIndicesCount), this.usedVertices = 0, this.usedVerticesFloats = 0, this.usedIndices = 0
  28636. }, t
  28637. })();
  28638. i.default = r, cc.FlexBuffer = r, e.exports = i.default
  28639. }), {}],
  28640. 283: [(function(t, e, i) {
  28641. "use strict";
  28642. var n = (function(t) {
  28643. return t && t.__esModule ? t : {
  28644. default: t
  28645. }
  28646. })(t("../../../renderer/gfx"));
  28647. var r = cc.Class({
  28648. name: "cc.MeshBuffer",
  28649. ctor: function(t, e) {
  28650. this.init(t, e)
  28651. },
  28652. init: function(t, e) {
  28653. this.byteOffset = 0, this.indiceOffset = 0, this.vertexOffset = 0, this.indiceStart = 0, this._dirty = !1, this._vertexFormat = e, this._vertexBytes = this._vertexFormat._bytes, this._arrOffset = 0, this._vbArr = [], this._vb = new n.default.VertexBuffer(t._device, e, n.default.USAGE_DYNAMIC, new ArrayBuffer, 0), this._vbArr[0] = this._vb, this._ibArr = [], this._ib = new n.default.IndexBuffer(t._device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, new ArrayBuffer, 0), this._ibArr[0] = this._ib, this._vData = null, this._uintVData = null, this._iData = null, this._batcher = t, this._initVDataCount = 256 * e._bytes, this._initIDataCount = 1536, this._offsetInfo = {
  28654. byteOffset: 0,
  28655. vertexOffset: 0,
  28656. indiceOffset: 0
  28657. }, this._reallocBuffer()
  28658. },
  28659. uploadData: function() {
  28660. if (0 !== this.byteOffset && this._dirty) {
  28661. var t = new Float32Array(this._vData.buffer, 0, this.byteOffset >> 2),
  28662. e = new Uint16Array(this._iData.buffer, 0, this.indiceOffset);
  28663. this._vb.update(0, t), this._ib.update(0, e), this._dirty = !1
  28664. }
  28665. },
  28666. switchBuffer: function() {
  28667. var t = ++this._arrOffset;
  28668. this.byteOffset = 0, this.vertexOffset = 0, this.indiceOffset = 0, this.indiceStart = 0, t < this._vbArr.length ? (this._vb = this._vbArr[t], this._ib = this._ibArr[t]) : (this._vb = new n.default.VertexBuffer(this._batcher._device, this._vertexFormat, n.default.USAGE_DYNAMIC, new ArrayBuffer, 0), this._vbArr[t] = this._vb, this._ib = new n.default.IndexBuffer(this._batcher._device, n.default.INDEX_FMT_UINT16, n.default.USAGE_STATIC, new ArrayBuffer, 0), this._ibArr[t] = this._ib)
  28669. },
  28670. checkAndSwitchBuffer: function(t) {
  28671. this.vertexOffset + t > 65535 && (this.uploadData(), this._batcher._flush(), this.switchBuffer())
  28672. },
  28673. requestStatic: function(t, e) {
  28674. this.checkAndSwitchBuffer(t);
  28675. var i = this.byteOffset + t * this._vertexBytes,
  28676. n = this.indiceOffset + e,
  28677. r = this._vData.byteLength,
  28678. s = this._iData.length;
  28679. if (i > r || n > s) {
  28680. for (; r < i || s < n;) this._initVDataCount *= 2, this._initIDataCount *= 2, r = 4 * this._initVDataCount, s = this._initIDataCount;
  28681. this._reallocBuffer()
  28682. }
  28683. this._updateOffset(t, e, i)
  28684. },
  28685. _updateOffset: function(t, e, i) {
  28686. var n = this._offsetInfo;
  28687. n.vertexOffset = this.vertexOffset, this.vertexOffset += t, n.indiceOffset = this.indiceOffset, this.indiceOffset += e, n.byteOffset = this.byteOffset, this.byteOffset = i, this._dirty = !0
  28688. },
  28689. request: function(t, e) {
  28690. return this._batcher._buffer !== this && (this._batcher._flush(), this._batcher._buffer = this), this.requestStatic(t, e), this._offsetInfo
  28691. },
  28692. _reallocBuffer: function() {
  28693. this._reallocVData(!0), this._reallocIData(!0)
  28694. },
  28695. _reallocVData: function(t) {
  28696. var e = void 0;
  28697. this._vData && (e = new Uint8Array(this._vData.buffer)), this._vData = new Float32Array(this._initVDataCount), this._uintVData = new Uint32Array(this._vData.buffer);
  28698. var i = new Uint8Array(this._uintVData.buffer);
  28699. if (e && t)
  28700. for (var n = 0, r = e.length; n < r; n++) i[n] = e[n]
  28701. },
  28702. _reallocIData: function(t) {
  28703. var e = this._iData;
  28704. if (this._iData = new Uint16Array(this._initIDataCount), e && t)
  28705. for (var i = this._iData, n = 0, r = e.length; n < r; n++) i[n] = e[n]
  28706. },
  28707. reset: function() {
  28708. this._arrOffset = 0, this._vb = this._vbArr[0], this._ib = this._ibArr[0], this.byteOffset = 0, this.indiceOffset = 0, this.vertexOffset = 0, this.indiceStart = 0, this._dirty = !1
  28709. },
  28710. destroy: function() {
  28711. this.reset();
  28712. for (var t = 0; t < this._vbArr.length; t++) {
  28713. this._vbArr[t].destroy()
  28714. }
  28715. this._vbArr = null;
  28716. for (var e = 0; e < this._ibArr.length; e++) {
  28717. this._ibArr[e].destroy()
  28718. }
  28719. this._ibArr = null, this._ib = null, this._vb = null
  28720. },
  28721. forwardIndiceStartToOffset: function() {
  28722. this.indiceStart = this.indiceOffset
  28723. }
  28724. });
  28725. cc.MeshBuffer = e.exports = r
  28726. }), {
  28727. "../../../renderer/gfx": 360
  28728. }],
  28729. 284: [(function(t, e, i) {
  28730. "use strict";
  28731. var n = o(t("../../../renderer/core/input-assembler")),
  28732. r = o(t("../../../renderer/memop/recycle-pool")),
  28733. s = o(t("../../../renderer/scene/model"));
  28734. function o(t) {
  28735. return t && t.__esModule ? t : {
  28736. default: t
  28737. }
  28738. }
  28739. var a = t("./vertex-format"),
  28740. l = a.vfmtPosUvColor,
  28741. h = a.vfmt3D,
  28742. c = t("./quad-buffer"),
  28743. u = t("./mesh-buffer"),
  28744. _ = t("./spine-buffer"),
  28745. f = t("../../assets/material/CCMaterial"),
  28746. d = (new(t("../../platform/id-generater"))("VertextFormat"), {}),
  28747. p = new f,
  28748. m = new n.default;
  28749. m._count = 0;
  28750. var y = function(t, e) {
  28751. this._renderScene = e, this._device = t, this.walking = !1, this.material = p, this.cullingMask = 1, this._iaPool = new r.default(function() {
  28752. return new n.default
  28753. }, 16), this._modelPool = new r.default(function() {
  28754. return new s.default
  28755. }, 16), this._quadBuffer = this.getBuffer("quad", l), this._meshBuffer = this.getBuffer("mesh", l), this._quadBuffer3D = this.getBuffer("quad", h), this._meshBuffer3D = this.getBuffer("mesh", h), this._buffer = this._meshBuffer, this._batchedModels = [], this._dummyNode = new cc.Node, this._sortKey = 0, this.node = this._dummyNode, this.parentOpacity = 1, this.parentOpacityDirty = 0, this.worldMatDirty = 0, this.customProperties = null
  28756. };
  28757. y.prototype = {
  28758. constructor: y,
  28759. reset: function() {
  28760. this._iaPool.reset();
  28761. for (var t = this._renderScene, e = this._batchedModels, i = 0; i < e.length; ++i) e[i].setInputAssembler(null), e[i].setEffect(null), t.removeModel(e[i]);
  28762. for (var n in this._modelPool.reset(), e.length = 0, this._sortKey = 0, d) d[n].reset();
  28763. this._buffer = this._meshBuffer, this.node = this._dummyNode, this.material = p, this.cullingMask = 1, this.parentOpacity = 1, this.parentOpacityDirty = 0, this.worldMatDirty = 0, this.customProperties = null
  28764. },
  28765. _flushMaterial: function(t) {
  28766. if (t) {
  28767. this.material = t;
  28768. var e = t.effect;
  28769. if (e) {
  28770. var i = this._modelPool.add();
  28771. this._batchedModels.push(i), i.sortKey = this._sortKey++, i._cullingMask = this.cullingMask, i.setNode(this.node), i.setEffect(e, null), i.setInputAssembler(m), this._renderScene.addModel(i)
  28772. }
  28773. }
  28774. },
  28775. _flush: function() {
  28776. var t = this.material,
  28777. e = this._buffer,
  28778. i = e.indiceOffset - e.indiceStart;
  28779. if (this.walking && t && !(i <= 0)) {
  28780. var n = t.effect;
  28781. if (n) {
  28782. var r = this._iaPool.add();
  28783. r._vertexBuffer = e._vb, r._indexBuffer = e._ib, r._start = e.indiceStart, r._count = i;
  28784. var s = this._modelPool.add();
  28785. this._batchedModels.push(s), s.sortKey = this._sortKey++, s._cullingMask = this.cullingMask, s.setNode(this.node), s.setEffect(n, this.customProperties), s.setInputAssembler(r), this._renderScene.addModel(s), e.forwardIndiceStartToOffset()
  28786. }
  28787. }
  28788. },
  28789. _flushIA: function(t) {
  28790. if (t) {
  28791. var e = this.material.effect;
  28792. if (e) {
  28793. var i = this._modelPool.add();
  28794. this._batchedModels.push(i), i.sortKey = this._sortKey++, i._cullingMask = this.cullingMask, i.setNode(this.node), i.setEffect(e, this.customProperties), i.setInputAssembler(t), this._renderScene.addModel(i)
  28795. }
  28796. }
  28797. },
  28798. terminate: function() {
  28799. for (var t in cc.dynamicAtlasManager && cc.dynamicAtlasManager.enabled && cc.dynamicAtlasManager.update(), this._flush(), d) d[t].uploadData();
  28800. this.walking = !1
  28801. },
  28802. getBuffer: function(t, e) {
  28803. var i = t + e.getHash(),
  28804. n = d[i];
  28805. if (!n) {
  28806. if ("mesh" === t) n = new u(this, e);
  28807. else if ("quad" === t) n = new c(this, e);
  28808. else {
  28809. if ("spine" !== t) return cc.error("Not support buffer type [" + t + "]"), null;
  28810. n = new _(this, e)
  28811. }
  28812. d[i] = n
  28813. }
  28814. return n
  28815. }
  28816. }, e.exports = y
  28817. }), {
  28818. "../../../renderer/core/input-assembler": 350,
  28819. "../../../renderer/memop/recycle-pool": 375,
  28820. "../../../renderer/scene/model": 382,
  28821. "../../assets/material/CCMaterial": 75,
  28822. "../../platform/id-generater": 214,
  28823. "./mesh-buffer": 283,
  28824. "./quad-buffer": 285,
  28825. "./spine-buffer": 287,
  28826. "./vertex-format": 288
  28827. }],
  28828. 285: [(function(t, e, i) {
  28829. "use strict";
  28830. var n = t("./mesh-buffer"),
  28831. r = cc.Class({
  28832. name: "cc.QuadBuffer",
  28833. extends: n,
  28834. _fillQuadBuffer: function() {
  28835. for (var t = this._initIDataCount / 6, e = this._iData, i = 0, n = 0; i < t; i++) {
  28836. var r = 4 * i;
  28837. e[n++] = r, e[n++] = r + 1, e[n++] = r + 2, e[n++] = r + 1, e[n++] = r + 3, e[n++] = r + 2
  28838. }
  28839. var s = new Uint16Array(this._iData.buffer, 0, 6 * t);
  28840. this._ib.update(0, s)
  28841. },
  28842. uploadData: function() {
  28843. if (0 !== this.byteOffset && this._dirty) {
  28844. var t = new Float32Array(this._vData.buffer, 0, this.byteOffset >> 2);
  28845. this._vb.update(0, t), this._dirty = !1
  28846. }
  28847. },
  28848. switchBuffer: function() {
  28849. this._super();
  28850. var t = new Uint16Array(this._iData.buffer, 0, this._initIDataCount);
  28851. this._ib.update(0, t)
  28852. },
  28853. _reallocBuffer: function() {
  28854. this._reallocVData(!0), this._reallocIData(), this._fillQuadBuffer()
  28855. }
  28856. });
  28857. cc.QuadBuffer = e.exports = r
  28858. }), {
  28859. "./mesh-buffer": 283
  28860. }],
  28861. 286: [(function(t, e, i) {
  28862. "use strict";
  28863. i.__esModule = !0, i.default = s;
  28864. var n = (function(t) {
  28865. return t && t.__esModule ? t : {
  28866. default: t
  28867. }
  28868. })(t("./flex-buffer")),
  28869. r = t("./vertex-format");
  28870. function s() {
  28871. this.vDatas = [], this.uintVDatas = [], this.iDatas = [], this.meshCount = 0, this._infos = null, this._flexBuffer = null
  28872. }
  28873. cc.js.mixin(s.prototype, {
  28874. init: function(t) {},
  28875. clear: function() {
  28876. this.vDatas.length = 0, this.iDatas.length = 0, this.uintVDatas.length = 0, this.meshCount = 0, this._infos = null, this._flexBuffer && this._flexBuffer.reset()
  28877. },
  28878. updateMesh: function(t, e, i) {
  28879. this.vDatas[t] = e, this.uintVDatas[t] = new Uint32Array(e.buffer, 0, e.length), this.iDatas[t] = i, this.meshCount = this.vDatas.length
  28880. },
  28881. updateMeshRange: function(t, e) {},
  28882. createData: function(t, e, i) {
  28883. var n = new Float32Array(e),
  28884. r = new Uint16Array(i);
  28885. this.updateMesh(t, n, r)
  28886. },
  28887. createQuadData: function(t, e, i) {
  28888. this.createData(t, e, i), this.initQuadIndices(this.iDatas[t])
  28889. },
  28890. createFlexData: function(t, e, i, s) {
  28891. s = s || r.vfmtPosUvColor, this._flexBuffer = new n.default(this, t, e, i, s)
  28892. },
  28893. initQuadIndices: function(t) {
  28894. for (var e = t.length / 6, i = 0, n = 0; i < e; i++) {
  28895. var r = 4 * i;
  28896. t[n++] = r, t[n++] = r + 1, t[n++] = r + 2, t[n++] = r + 1, t[n++] = r + 3, t[n++] = r + 2
  28897. }
  28898. }
  28899. }), cc.RenderData = s, e.exports = i.default
  28900. }), {
  28901. "./flex-buffer": 282,
  28902. "./vertex-format": 288
  28903. }],
  28904. 287: [(function(t, e, i) {
  28905. "use strict";
  28906. var n = cc.Class({
  28907. name: "cc.SpineBuffer",
  28908. extends: t("./mesh-buffer"),
  28909. requestStatic: function(t, e) {
  28910. this.checkAndSwitchBuffer(t);
  28911. var i = this.byteOffset + t * this._vertexBytes,
  28912. n = this.indiceOffset + e,
  28913. r = this._vData.byteLength,
  28914. s = this._iData.length;
  28915. if (i > r || n > s) {
  28916. for (; r < i || s < n;) this._initVDataCount *= 2, this._initIDataCount *= 2, r = 4 * this._initVDataCount, s = this._initIDataCount;
  28917. this._reallocBuffer()
  28918. }
  28919. var o = this._offsetInfo;
  28920. o.vertexOffset = this.vertexOffset, o.indiceOffset = this.indiceOffset, o.byteOffset = this.byteOffset
  28921. },
  28922. adjust: function(t, e) {
  28923. this.vertexOffset += t, this.indiceOffset += e, this.byteOffset = this.byteOffset + t * this._vertexBytes, this._dirty = !0
  28924. }
  28925. });
  28926. cc.SpineBuffer = e.exports = n
  28927. }), {
  28928. "./mesh-buffer": 283
  28929. }],
  28930. 288: [(function(t, e, i) {
  28931. "use strict";
  28932. var n = (function(t) {
  28933. return t && t.__esModule ? t : {
  28934. default: t
  28935. }
  28936. })(t("../../../renderer/gfx"));
  28937. var r = new n.default.VertexFormat([{
  28938. name: n.default.ATTR_POSITION,
  28939. type: n.default.ATTR_TYPE_FLOAT32,
  28940. num: 3
  28941. }, {
  28942. name: n.default.ATTR_UV0,
  28943. type: n.default.ATTR_TYPE_FLOAT32,
  28944. num: 2
  28945. }, {
  28946. name: n.default.ATTR_COLOR,
  28947. type: n.default.ATTR_TYPE_UINT8,
  28948. num: 4,
  28949. normalize: !0
  28950. }]);
  28951. r.name = "vfmt3D", n.default.VertexFormat.XYZ_UV_Color = r;
  28952. var s = new n.default.VertexFormat([{
  28953. name: n.default.ATTR_POSITION,
  28954. type: n.default.ATTR_TYPE_FLOAT32,
  28955. num: 2
  28956. }, {
  28957. name: n.default.ATTR_UV0,
  28958. type: n.default.ATTR_TYPE_FLOAT32,
  28959. num: 2
  28960. }, {
  28961. name: n.default.ATTR_COLOR,
  28962. type: n.default.ATTR_TYPE_UINT8,
  28963. num: 4,
  28964. normalize: !0
  28965. }]);
  28966. s.name = "vfmtPosUvColor", n.default.VertexFormat.XY_UV_Color = s;
  28967. var o = new n.default.VertexFormat([{
  28968. name: n.default.ATTR_POSITION,
  28969. type: n.default.ATTR_TYPE_FLOAT32,
  28970. num: 2
  28971. }, {
  28972. name: n.default.ATTR_UV0,
  28973. type: n.default.ATTR_TYPE_FLOAT32,
  28974. num: 2
  28975. }, {
  28976. name: n.default.ATTR_COLOR,
  28977. type: n.default.ATTR_TYPE_UINT8,
  28978. num: 4,
  28979. normalize: !0
  28980. }, {
  28981. name: n.default.ATTR_COLOR0,
  28982. type: n.default.ATTR_TYPE_UINT8,
  28983. num: 4,
  28984. normalize: !0
  28985. }]);
  28986. o.name = "vfmtPosUvTwoColor", n.default.VertexFormat.XY_UV_Two_Color = o;
  28987. var a = new n.default.VertexFormat([{
  28988. name: n.default.ATTR_POSITION,
  28989. type: n.default.ATTR_TYPE_FLOAT32,
  28990. num: 2
  28991. }, {
  28992. name: n.default.ATTR_UV0,
  28993. type: n.default.ATTR_TYPE_FLOAT32,
  28994. num: 2
  28995. }]);
  28996. a.name = "vfmtPosUv", n.default.VertexFormat.XY_UV = a;
  28997. var l = new n.default.VertexFormat([{
  28998. name: n.default.ATTR_POSITION,
  28999. type: n.default.ATTR_TYPE_FLOAT32,
  29000. num: 2
  29001. }, {
  29002. name: n.default.ATTR_COLOR,
  29003. type: n.default.ATTR_TYPE_UINT8,
  29004. num: 4,
  29005. normalize: !0
  29006. }]);
  29007. l.name = "vfmtPosColor", n.default.VertexFormat.XY_Color = l;
  29008. var h = new n.default.VertexFormat([{
  29009. name: n.default.ATTR_POSITION,
  29010. type: n.default.ATTR_TYPE_FLOAT32,
  29011. num: 2
  29012. }]);
  29013. h.name = "vfmtPos", n.default.VertexFormat.XY = h, e.exports = {
  29014. vfmt3D: r,
  29015. vfmtPosUvColor: s,
  29016. vfmtPosUvTwoColor: o,
  29017. vfmtPosUv: a,
  29018. vfmtPosColor: l,
  29019. vfmtPos: h
  29020. }
  29021. }), {
  29022. "../../../renderer/gfx": 360
  29023. }],
  29024. 289: [(function(t, e, i) {
  29025. "use strict";
  29026. t("../platform/CCSys");
  29027. var n = /(\.[^\.\/\?\\]*)(\?.*)?$/,
  29028. r = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/,
  29029. s = /[^\.\/]+\/\.\.\//;
  29030. cc.path = {
  29031. join: function() {
  29032. for (var t = arguments.length, e = "", i = 0; i < t; i++) e = (e + ("" === e ? "" : "/") + arguments[i]).replace(/(\/|\\\\)$/, "");
  29033. return e
  29034. },
  29035. extname: function(t) {
  29036. var e = n.exec(t);
  29037. return e ? e[1] : ""
  29038. },
  29039. mainFileName: function(t) {
  29040. if (t) {
  29041. var e = t.lastIndexOf(".");
  29042. if (-1 !== e) return t.substring(0, e)
  29043. }
  29044. return t
  29045. },
  29046. basename: function(t, e) {
  29047. var i = t.indexOf("?");
  29048. i > 0 && (t = t.substring(0, i));
  29049. var n = /(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/, ""));
  29050. if (!n) return null;
  29051. var r = n[2];
  29052. return e && t.substring(t.length - e.length).toLowerCase() === e.toLowerCase() ? r.substring(0, r.length - e.length) : r
  29053. },
  29054. dirname: function(t) {
  29055. var e = r.exec(t);
  29056. return e ? e[2] : ""
  29057. },
  29058. changeExtname: function(t, e) {
  29059. e = e || "";
  29060. var i = t.indexOf("?"),
  29061. n = "";
  29062. return i > 0 && (n = t.substring(i), t = t.substring(0, i)), (i = t.lastIndexOf(".")) < 0 ? t + e + n : t.substring(0, i) + e + n
  29063. },
  29064. changeBasename: function(t, e, i) {
  29065. if (0 === e.indexOf(".")) return this.changeExtname(t, e);
  29066. var n = t.indexOf("?"),
  29067. r = "",
  29068. s = i ? this.extname(t) : "";
  29069. return n > 0 && (r = t.substring(n), t = t.substring(0, n)), n = (n = t.lastIndexOf("/")) <= 0 ? 0 : n + 1, t.substring(0, n) + e + s + r
  29070. },
  29071. _normalize: function(t) {
  29072. var e = t = String(t);
  29073. do {
  29074. e = t, t = t.replace(s, "")
  29075. } while (e.length !== t.length);
  29076. return t
  29077. },
  29078. sep: cc.sys.os === cc.sys.OS_WINDOWS ? "\\" : "/",
  29079. stripSep: function(t) {
  29080. return t.replace(/[\/\\]$/, "")
  29081. }
  29082. }, e.exports = cc.path
  29083. }), {
  29084. "../platform/CCSys": 207
  29085. }],
  29086. 290: [(function(t, e, i) {
  29087. "use strict";
  29088. var n = function(t, e, i, n, r, s) {
  29089. this.a = t, this.b = e, this.c = i, this.d = n, this.tx = r, this.ty = s
  29090. };
  29091. n.create = function(t, e, i, n, r, s) {
  29092. return {
  29093. a: t,
  29094. b: e,
  29095. c: i,
  29096. d: n,
  29097. tx: r,
  29098. ty: s
  29099. }
  29100. }, n.identity = function() {
  29101. return {
  29102. a: 1,
  29103. b: 0,
  29104. c: 0,
  29105. d: 1,
  29106. tx: 0,
  29107. ty: 0
  29108. }
  29109. }, n.clone = function(t) {
  29110. return {
  29111. a: t.a,
  29112. b: t.b,
  29113. c: t.c,
  29114. d: t.d,
  29115. tx: t.tx,
  29116. ty: t.ty
  29117. }
  29118. }, n.concat = function(t, e, i) {
  29119. var n = e.a,
  29120. r = e.b,
  29121. s = e.c,
  29122. o = e.d,
  29123. a = e.tx,
  29124. l = e.ty;
  29125. return t.a = n * i.a + r * i.c, t.b = n * i.b + r * i.d, t.c = s * i.a + o * i.c, t.d = s * i.b + o * i.d, t.tx = a * i.a + l * i.c + i.tx, t.ty = a * i.b + l * i.d + i.ty, t
  29126. }, n.invert = function(t, e) {
  29127. var i = e.a,
  29128. n = e.b,
  29129. r = e.c,
  29130. s = e.d,
  29131. o = 1 / (i * s - n * r),
  29132. a = e.tx,
  29133. l = e.ty;
  29134. return t.a = o * s, t.b = -o * n, t.c = -o * r, t.d = o * i, t.tx = o * (r * l - s * a), t.ty = o * (n * a - i * l), t
  29135. }, n.fromMat4 = function(t, e) {
  29136. var i = e.m;
  29137. return t.a = i[0], t.b = i[1], t.c = i[4], t.d = i[5], t.tx = i[12], t.ty = i[13], t
  29138. }, n.transformVec2 = function(t, e, i, n) {
  29139. var r, s;
  29140. return void 0 === n ? (n = i, r = e.x, s = e.y) : (r = e, s = i), t.x = n.a * r + n.c * s + n.tx, t.y = n.b * r + n.d * s + n.ty, t
  29141. }, n.transformSize = function(t, e, i) {
  29142. return t.width = i.a * e.width + i.c * e.height, t.height = i.b * e.width + i.d * e.height, t
  29143. }, n.transformRect = function(t, e, i) {
  29144. var n = e.x,
  29145. r = e.y,
  29146. s = n + e.width,
  29147. o = r + e.height,
  29148. a = i.a * n + i.c * r + i.tx,
  29149. l = i.b * n + i.d * r + i.ty,
  29150. h = i.a * s + i.c * r + i.tx,
  29151. c = i.b * s + i.d * r + i.ty,
  29152. u = i.a * n + i.c * o + i.tx,
  29153. _ = i.b * n + i.d * o + i.ty,
  29154. f = i.a * s + i.c * o + i.tx,
  29155. d = i.b * s + i.d * o + i.ty,
  29156. p = Math.min(a, h, u, f),
  29157. m = Math.max(a, h, u, f),
  29158. y = Math.min(l, c, _, d),
  29159. v = Math.max(l, c, _, d);
  29160. return t.x = p, t.y = y, t.width = m - p, t.height = v - y, t
  29161. }, n.transformObb = function(t, e, i, n, r, s) {
  29162. var o = r.x,
  29163. a = r.y,
  29164. l = r.width,
  29165. h = r.height,
  29166. c = s.a * o + s.c * a + s.tx,
  29167. u = s.b * o + s.d * a + s.ty,
  29168. _ = s.a * l,
  29169. f = s.b * l,
  29170. d = s.c * h,
  29171. p = s.d * h;
  29172. e.x = c, e.y = u, i.x = _ + c, i.y = f + u, t.x = d + c, t.y = p + u, n.x = _ + d + c, n.y = f + p + u
  29173. }, cc.AffineTransform = e.exports = n
  29174. }), {}],
  29175. 291: [(function(t, e, i) {
  29176. "use strict";
  29177. var n = t("../platform/CCObject").Flags,
  29178. r = t("./misc"),
  29179. s = t("../platform/js"),
  29180. o = t("../platform/id-generater"),
  29181. a = t("../event-manager"),
  29182. l = t("../renderer/render-flow"),
  29183. h = n.Destroying,
  29184. c = n.DontDestroy,
  29185. u = n.Deactivating,
  29186. _ = new o("Node");
  29187. function f(t) {
  29188. return t ? "string" == typeof t ? s.getClassByName(t) : t : (cc.errorID(3804), null)
  29189. }
  29190. function d(t, e) {
  29191. if (e._sealed)
  29192. for (var i = 0; i < t._components.length; ++i) {
  29193. var n = t._components[i];
  29194. if (n.constructor === e) return n
  29195. } else
  29196. for (var r = 0; r < t._components.length; ++r) {
  29197. var s = t._components[r];
  29198. if (s instanceof e) return s
  29199. }
  29200. return null
  29201. }
  29202. function p(t, e, i) {
  29203. if (e._sealed)
  29204. for (var n = 0; n < t._components.length; ++n) {
  29205. var r = t._components[n];
  29206. r.constructor === e && i.push(r)
  29207. } else
  29208. for (var s = 0; s < t._components.length; ++s) {
  29209. var o = t._components[s];
  29210. o instanceof e && i.push(o)
  29211. }
  29212. }
  29213. function m(t, e) {
  29214. for (var i = 0; i < t.length; ++i) {
  29215. var n = t[i],
  29216. r = d(n, e);
  29217. if (r) return r;
  29218. if (n._children.length > 0 && (r = m(n._children, e))) return r
  29219. }
  29220. return null
  29221. }
  29222. function y(t, e, i) {
  29223. for (var n = 0; n < t.length; ++n) {
  29224. var r = t[n];
  29225. p(r, e, i), r._children.length > 0 && y(r._children, e, i)
  29226. }
  29227. }
  29228. var v = cc.Class({
  29229. name: "cc._BaseNode",
  29230. extends: cc.Object,
  29231. properties: {
  29232. _parent: null,
  29233. _children: [],
  29234. _active: !0,
  29235. _components: [],
  29236. _prefab: null,
  29237. _persistNode: {
  29238. get: function() {
  29239. return (this._objFlags & c) > 0
  29240. },
  29241. set: function(t) {
  29242. t ? this._objFlags |= c : this._objFlags &= ~c
  29243. }
  29244. },
  29245. name: {
  29246. get: function() {
  29247. return this._name
  29248. },
  29249. set: function(t) {
  29250. this._name = t
  29251. }
  29252. },
  29253. uuid: {
  29254. get: function() {
  29255. return this._id
  29256. }
  29257. },
  29258. children: {
  29259. get: function() {
  29260. return this._children
  29261. }
  29262. },
  29263. childrenCount: {
  29264. get: function() {
  29265. return this._children.length
  29266. }
  29267. },
  29268. active: {
  29269. get: function() {
  29270. return this._active
  29271. },
  29272. set: function(t) {
  29273. if (t = !!t, this._active !== t) {
  29274. this._active = t;
  29275. var e = this._parent;
  29276. if (e) e._activeInHierarchy && cc.director._nodeActivator.activateNode(this, t)
  29277. }
  29278. }
  29279. },
  29280. activeInHierarchy: {
  29281. get: function() {
  29282. return this._activeInHierarchy
  29283. }
  29284. }
  29285. },
  29286. ctor: function(t) {
  29287. this._name = void 0 !== t ? t : "New Node", this._activeInHierarchy = !1, this._id = _.getNewId(), cc.director._scheduler && cc.director._scheduler.enableForTarget(this), this.__eventTargets = []
  29288. },
  29289. getParent: function() {
  29290. return this._parent
  29291. },
  29292. setParent: function(t) {
  29293. if (this._parent !== t) {
  29294. 0;
  29295. var e = this._parent;
  29296. if (this._parent = t || null, this._onSetParent(t), t && (a._setDirtyForNode(this), t._children.push(this), t.emit && t.emit("child-added", this), t._renderFlag |= l.FLAG_CHILDREN), e) {
  29297. if (!(e._objFlags & h)) {
  29298. var i = e._children.indexOf(this);
  29299. 0, e._children.splice(i, 1), e.emit && e.emit("child-removed", this), this._onHierarchyChanged(e), 0 === e._children.length && (e._renderFlag &= ~l.FLAG_CHILDREN)
  29300. }
  29301. } else t && this._onHierarchyChanged(null)
  29302. }
  29303. },
  29304. attr: function(t) {
  29305. s.mixin(this, t)
  29306. },
  29307. getChildByUuid: function(t) {
  29308. if (!t) return cc.log("Invalid uuid"), null;
  29309. for (var e = this._children, i = 0, n = e.length; i < n; i++)
  29310. if (e[i]._id === t) return e[i];
  29311. return null
  29312. },
  29313. getChildByName: function(t) {
  29314. if (!t) return cc.log("Invalid name"), null;
  29315. for (var e = this._children, i = 0, n = e.length; i < n; i++)
  29316. if (e[i]._name === t) return e[i];
  29317. return null
  29318. },
  29319. addChild: function(t) {
  29320. cc.assertID(t, 1606), cc.assertID(null === t._parent, 1605), t.setParent(this)
  29321. },
  29322. insertChild: function(t, e) {
  29323. t.parent = this, t.setSiblingIndex(e)
  29324. },
  29325. getSiblingIndex: function() {
  29326. return this._parent ? this._parent._children.indexOf(this) : 0
  29327. },
  29328. setSiblingIndex: function(t) {
  29329. if (this._parent)
  29330. if (this._parent._objFlags & u) cc.errorID(3821);
  29331. else {
  29332. var e = this._parent._children;
  29333. t = -1 !== t ? t : e.length - 1;
  29334. var i = e.indexOf(this);
  29335. t !== i && (e.splice(i, 1), t < e.length ? e.splice(t, 0, this) : e.push(this), this._onSiblingIndexChanged && this._onSiblingIndexChanged(t))
  29336. }
  29337. },
  29338. walk: function(t, e) {
  29339. var i, n, r, s, o = cc._BaseNode,
  29340. a = 1,
  29341. l = o._stacks[o._stackId];
  29342. l || (l = [], o._stacks.push(l)), o._stackId++, l.length = 0, l[0] = this;
  29343. var h = null;
  29344. for (s = !1; a;)
  29345. if (n = l[--a])
  29346. if (!s && t ? t(n) : s && e && e(n), l[a] = null, s) {
  29347. if (s = !1, i)
  29348. if (i[++r]) l[a] = i[r], a++;
  29349. else if (h && (l[a] = h, a++, s = !0, h._parent ? (r = (i = h._parent._children).indexOf(h), h = h._parent) : (h = null, i = null), r < 0)) break
  29350. } else n._children.length > 0 ? (h = n, i = n._children, r = 0, l[a] = i[r], a++) : (l[a] = n, a++, s = !0);
  29351. l.length = 0, o._stackId--
  29352. },
  29353. cleanup: function() {},
  29354. removeFromParent: function(t) {
  29355. this._parent && (void 0 === t && (t = !0), this._parent.removeChild(this, t))
  29356. },
  29357. removeChild: function(t, e) {
  29358. this._children.indexOf(t) > -1 && ((e || void 0 === e) && t.cleanup(), t.parent = null)
  29359. },
  29360. removeAllChildren: function(t) {
  29361. var e = this._children;
  29362. void 0 === t && (t = !0);
  29363. for (var i = e.length - 1; i >= 0; i--) {
  29364. var n = e[i];
  29365. n && (t && n.cleanup(), n.parent = null)
  29366. }
  29367. this._children.length = 0
  29368. },
  29369. isChildOf: function(t) {
  29370. var e = this;
  29371. do {
  29372. if (e === t) return !0;
  29373. e = e._parent
  29374. } while (e);
  29375. return !1
  29376. },
  29377. getComponent: function(t) {
  29378. var e = f(t);
  29379. return e ? d(this, e) : null
  29380. },
  29381. getComponents: function(t) {
  29382. var e = f(t),
  29383. i = [];
  29384. return e && p(this, e, i), i
  29385. },
  29386. getComponentInChildren: function(t) {
  29387. var e = f(t);
  29388. return e ? m(this._children, e) : null
  29389. },
  29390. getComponentsInChildren: function(t) {
  29391. var e = f(t),
  29392. i = [];
  29393. return e && (p(this, e, i), y(this._children, e, i)), i
  29394. },
  29395. _checkMultipleComp: !1,
  29396. addComponent: function(t) {
  29397. var e;
  29398. if ("string" == typeof t) {
  29399. if (!(e = s.getClassByName(t))) return cc.errorID(3807, t), cc._RFpeek() && cc.errorID(3808, t), null
  29400. } else {
  29401. if (!t) return cc.errorID(3804), null;
  29402. e = t
  29403. }
  29404. if ("function" != typeof e) return cc.errorID(3809), null;
  29405. if (!s.isChildClassOf(e, cc.Component)) return cc.errorID(3810), null;
  29406. var i = e._requireComponent;
  29407. if (i && !this.getComponent(i) && !this.addComponent(i)) return null;
  29408. var n = new e;
  29409. return n.node = this, this._components.push(n), this._activeInHierarchy && cc.director._nodeActivator.activateComp(n), n
  29410. },
  29411. _addComponentAt: !1,
  29412. removeComponent: function(t) {
  29413. t ? (t instanceof cc.Component || (t = this.getComponent(t)), t && t.destroy()) : cc.errorID(3813)
  29414. },
  29415. _getDependComponent: !1,
  29416. _removeComponent: function(t) {
  29417. if (t) {
  29418. if (!(this._objFlags & h)) {
  29419. var e = this._components.indexOf(t); - 1 !== e ? this._components.splice(e, 1) : t.node !== this && cc.errorID(3815)
  29420. }
  29421. } else cc.errorID(3814)
  29422. },
  29423. destroy: function() {
  29424. cc.Object.prototype.destroy.call(this) && (this.active = !1)
  29425. },
  29426. destroyAllChildren: function() {
  29427. for (var t = this._children, e = 0; e < t.length; ++e) t[e].destroy()
  29428. },
  29429. _onSetParent: function(t) {},
  29430. _onPostActivated: function() {},
  29431. _onBatchRestored: function() {},
  29432. _onBatchCreated: function() {},
  29433. _onHierarchyChanged: function(t) {
  29434. var e = this._parent;
  29435. !this._persistNode || e instanceof cc.Scene || cc.game.removePersistRootNode(this);
  29436. var i = this._active && !(!e || !e._activeInHierarchy);
  29437. this._activeInHierarchy !== i && cc.director._nodeActivator.activateNode(this, i)
  29438. },
  29439. _instantiate: function(t) {
  29440. t || (t = cc.instantiate._clone(this, this));
  29441. var e = this._prefab;
  29442. e && this === e.root && e.sync;
  29443. return t._parent = null, t._onBatchRestored(), t
  29444. },
  29445. _registerIfAttached: !1,
  29446. _onPreDestroy: function() {
  29447. var t, e;
  29448. this._objFlags |= h;
  29449. var i = this._parent,
  29450. n = i && i._objFlags & h;
  29451. var r = this._children;
  29452. for (t = 0, e = r.length; t < e; ++t) r[t]._destroyImmediate();
  29453. for (t = 0, e = this._components.length; t < e; ++t) {
  29454. this._components[t]._destroyImmediate()
  29455. }
  29456. var s = this.__eventTargets;
  29457. for (t = 0, e = s.length; t < e; ++t) {
  29458. var o = s[t];
  29459. o && o.targetOff(this)
  29460. }
  29461. if (s.length = 0, this._persistNode && cc.game.removePersistRootNode(this), !n && i) {
  29462. var a = i._children.indexOf(this);
  29463. i._children.splice(a, 1), i.emit && i.emit("child-removed", this)
  29464. }
  29465. return n
  29466. },
  29467. onRestore: !1
  29468. });
  29469. v.idGenerater = _, v._stacks = [
  29470. []
  29471. ], v._stackId = 0, v.prototype._onPreDestroyBase = v.prototype._onPreDestroy, v.prototype._onHierarchyChangedBase = v.prototype._onHierarchyChanged;
  29472. r.propertyDefine(v, ["parent", "name", "children", "childrenCount"], {}), cc._BaseNode = e.exports = v
  29473. }), {
  29474. "../event-manager": 129,
  29475. "../platform/CCObject": 204,
  29476. "../platform/id-generater": 214,
  29477. "../platform/js": 218,
  29478. "../renderer/render-flow": 248,
  29479. "./misc": 300
  29480. }],
  29481. 292: [(function(t, e, i) {
  29482. "use strict";
  29483. var n = 1e-6;
  29484. e.exports = {
  29485. binarySearchEpsilon: function(t, e) {
  29486. for (var i = 0, r = t.length - 1, s = r >>> 1; i <= r; s = i + r >>> 1) {
  29487. var o = t[s];
  29488. if (o > e + n) r = s - 1;
  29489. else {
  29490. if (!(o < e - n)) return s;
  29491. i = s + 1
  29492. }
  29493. }
  29494. return ~i
  29495. }
  29496. }
  29497. }), {}],
  29498. 293: [(function(t, e, i) {
  29499. "use strict";
  29500. var n = t("../components/CCRenderComponent"),
  29501. r = t("../platform/CCMacro").BlendFactor,
  29502. s = t("../../renderer/gfx"),
  29503. o = cc.Class({
  29504. properties: {
  29505. _srcBlendFactor: r.SRC_ALPHA,
  29506. _dstBlendFactor: r.ONE_MINUS_SRC_ALPHA,
  29507. srcBlendFactor: {
  29508. get: function() {
  29509. return this._srcBlendFactor
  29510. },
  29511. set: function(t) {
  29512. this._srcBlendFactor !== t && (this._srcBlendFactor = t, this._updateBlendFunc())
  29513. },
  29514. animatable: !1,
  29515. type: r,
  29516. tooltip: !1,
  29517. visible: !0
  29518. },
  29519. dstBlendFactor: {
  29520. get: function() {
  29521. return this._dstBlendFactor
  29522. },
  29523. set: function(t) {
  29524. this._dstBlendFactor !== t && (this._dstBlendFactor = t, this._updateBlendFunc())
  29525. },
  29526. animatable: !1,
  29527. type: r,
  29528. tooltip: !1,
  29529. visible: !0
  29530. }
  29531. },
  29532. setMaterial: function(t, e) {
  29533. this._materials[t] !== e && (n.prototype.setMaterial.call(this, t, e), e && this._updateMaterialBlendFunc(e))
  29534. },
  29535. _updateBlendFunc: function() {
  29536. for (var t = this._materials, e = 0; e < t.length; e++) {
  29537. var i = t[e];
  29538. this._updateMaterialBlendFunc(i)
  29539. }
  29540. },
  29541. _updateMaterialBlendFunc: function(t) {
  29542. t.effect.setBlend(!0, s.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor, s.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor), t.setDirty(!0)
  29543. }
  29544. });
  29545. e.exports = cc.BlendFunc = o
  29546. }), {
  29547. "../../renderer/gfx": 360,
  29548. "../components/CCRenderComponent": 106,
  29549. "../platform/CCMacro": 203
  29550. }],
  29551. 294: [(function(t, e, i) {
  29552. "use strict";
  29553. var n = t("./misc").BASE64_VALUES,
  29554. r = "0123456789abcdef".split(""),
  29555. s = ["", "", "", ""],
  29556. o = s.concat(s, "-", s, "-", s, "-", s, "-", s, s, s),
  29557. a = o.map((function(t, e) {
  29558. return "-" === t ? NaN : e
  29559. })).filter(isFinite);
  29560. e.exports = function(t) {
  29561. if (22 !== t.length) return t;
  29562. o[0] = t[0], o[1] = t[1];
  29563. for (var e = 2, i = 2; e < 22; e += 2) {
  29564. var s = n[t.charCodeAt(e)],
  29565. l = n[t.charCodeAt(e + 1)];
  29566. o[a[i++]] = r[s >> 2], o[a[i++]] = r[(3 & s) << 2 | l >> 4], o[a[i++]] = r[15 & l]
  29567. }
  29568. return o.join("")
  29569. }
  29570. }), {
  29571. "./misc": 300
  29572. }],
  29573. 295: [(function(t, e, i) {
  29574. "use strict";
  29575. cc.find = e.exports = function(t, e) {
  29576. if (null == t) return cc.errorID(5600), null;
  29577. if (e) 0;
  29578. else {
  29579. var i = cc.director.getScene();
  29580. if (!i) return null;
  29581. e = i
  29582. }
  29583. for (var n = e, r = "/" !== t[0] ? 0 : 1, s = t.split("/"), o = r; o < s.length; o++) {
  29584. var a = s[o],
  29585. l = n._children;
  29586. n = null;
  29587. for (var h = 0, c = l.length; h < c; ++h) {
  29588. var u = l[h];
  29589. if (u.name === a) {
  29590. n = u;
  29591. break
  29592. }
  29593. }
  29594. if (!n) return null
  29595. }
  29596. return n
  29597. }
  29598. }), {}],
  29599. 296: [(function(t, e, i) {
  29600. "use strict";
  29601. var n = t("../assets/material/CCMaterial"),
  29602. r = cc.Class({
  29603. properties: {
  29604. _normalMaterial: null,
  29605. normalMaterial: {
  29606. get: function() {
  29607. return this._normalMaterial
  29608. },
  29609. set: function(t) {
  29610. this._normalMaterial = t, this._updateDisabledState && this._updateDisabledState()
  29611. },
  29612. type: n,
  29613. tooltip: !1,
  29614. animatable: !1
  29615. },
  29616. _grayMaterial: null,
  29617. grayMaterial: {
  29618. get: function() {
  29619. return this._grayMaterial
  29620. },
  29621. set: function(t) {
  29622. this._grayMaterial = t, this._updateDisabledState && this._updateDisabledState()
  29623. },
  29624. type: n,
  29625. tooltip: !1,
  29626. animatable: !1
  29627. }
  29628. },
  29629. _switchGrayMaterial: function(t, e) {
  29630. if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) {
  29631. var i = void 0;
  29632. t ? ((i = this._grayMaterial) || (i = n.getBuiltinMaterial("2d-gray-sprite")), i = this._grayMaterial = n.getInstantiatedMaterial(i, e)) : ((i = this._normalMaterial) || (i = n.getBuiltinMaterial("2d-sprite", e)), i = this._normalMaterial = n.getInstantiatedMaterial(i, e)), e.setMaterial(0, i)
  29633. }
  29634. }
  29635. });
  29636. e.exports = r
  29637. }), {
  29638. "../assets/material/CCMaterial": 75
  29639. }],
  29640. 297: [(function(t, e, i) {
  29641. "use strict";
  29642. var n = /^(click)(\s)*=|(param)(\s)*=/,
  29643. r = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,
  29644. s = function() {
  29645. this._parsedObject = {}, this._specialSymbolArray = [], this._specialSymbolArray.push([/&lt;/g, "<"]), this._specialSymbolArray.push([/&gt;/g, ">"]), this._specialSymbolArray.push([/&amp;/g, "&"]), this._specialSymbolArray.push([/&quot;/g, '"']), this._specialSymbolArray.push([/&apos;/g, "'"])
  29646. };
  29647. s.prototype = {
  29648. constructor: s,
  29649. parse: function(t) {
  29650. this._resultObjectArray = [], this._stack = [];
  29651. for (var e = 0, i = t.length; e < i;) {
  29652. var n = t.indexOf("<", e);
  29653. if (n < 0) this._stack.pop(), this._processResult(t.substring(e)), e = i;
  29654. else {
  29655. this._processResult(t.substring(e, n));
  29656. var r = t.indexOf(">", e); - 1 === r ? r = n : "/" === t.charAt(n + 1) ? this._stack.pop() : this._addToStack(t.substring(n + 1, r)), e = r + 1
  29657. }
  29658. }
  29659. return this._resultObjectArray
  29660. },
  29661. _attributeToObject: function(t) {
  29662. var e, i, n, s, o = {},
  29663. a = (t = t.trim()).match(/^(color|size)(\s)*=/);
  29664. if (a) {
  29665. if (e = a[0], "" === (t = t.substring(e.length).trim())) return o;
  29666. switch (i = t.indexOf(" "), e[0]) {
  29667. case "c":
  29668. o.color = i > -1 ? t.substring(0, i).trim() : t;
  29669. break;
  29670. case "s":
  29671. o.size = parseInt(t)
  29672. }
  29673. return i > -1 && (s = t.substring(i + 1).trim(), n = this._processEventHandler(s), o.event = n), o
  29674. }
  29675. if ((a = t.match(/^(br(\s)*\/)/)) && a[0].length > 0 && (e = a[0].trim()).startsWith("br") && "/" === e[e.length - 1]) return o.isNewLine = !0, this._resultObjectArray.push({
  29676. text: "",
  29677. style: {
  29678. newline: !0
  29679. }
  29680. }), o;
  29681. if ((a = t.match(/^(img(\s)*src(\s)*=[^>]+\/)/)) && a[0].length > 0 && (e = a[0].trim()).startsWith("img") && "/" === e[e.length - 1]) {
  29682. var l;
  29683. a = t.match(r);
  29684. for (var h = !1; a;) e = (t = t.substring(t.indexOf(a[0]))).substr(0, a[0].length), u = (i = (l = t.substring(e.length).trim()).indexOf(" ")) > -1 ? l.substr(0, i) : l, e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase(), t = l.substring(i).trim(), "src" === e ? (o.isImage = !0, u.endsWith("/") && (u = u.substring(0, u.length - 1)), 0 === u.indexOf("'") ? (h = !0, u = u.substring(1, u.length - 1)) : 0 === u.indexOf('"') && (h = !0, u = u.substring(1, u.length - 1)), o.src = u) : "height" === e ? o.imageHeight = parseInt(u) : "width" === e ? o.imageWidth = parseInt(u) : "click" === e && (o.event = this._processEventHandler(e + "=" + u)), o.event && "param" === e && (o.event.param = u.replace(/^\"|\"$/g, "")), a = t.match(r);
  29685. return h && o.isImage && this._resultObjectArray.push({
  29686. text: "",
  29687. style: o
  29688. }), {}
  29689. }
  29690. if (a = t.match(/^(outline(\s)*[^>]*)/)) {
  29691. var c = {
  29692. color: "#ffffff",
  29693. width: 1
  29694. };
  29695. if (t = a[0].substring("outline".length).trim()) {
  29696. var u, _ = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
  29697. for (a = t.match(_); a;) e = (t = t.substring(t.indexOf(a[0]))).substr(0, a[0].length), u = (i = (l = t.substring(e.length).trim()).indexOf(" ")) > -1 ? l.substr(0, i) : l, e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase(), t = l.substring(i).trim(), "click" === e ? o.event = this._processEventHandler(e + "=" + u) : "color" === e ? c.color = u : "width" === e && (c.width = parseInt(u)), o.event && "param" === e && (o.event.param = u.replace(/^\"|\"$/g, "")), a = t.match(_)
  29698. }
  29699. o.outline = c
  29700. }
  29701. if ((a = t.match(/^(on|u|b|i)(\s)*/)) && a[0].length > 0) {
  29702. switch (e = a[0], t = t.substring(e.length).trim(), e[0]) {
  29703. case "u":
  29704. o.underline = !0;
  29705. break;
  29706. case "i":
  29707. o.italic = !0;
  29708. break;
  29709. case "b":
  29710. o.bold = !0
  29711. }
  29712. if ("" === t) return o;
  29713. n = this._processEventHandler(t), o.event = n
  29714. }
  29715. return o
  29716. },
  29717. _processEventHandler: function(t) {
  29718. for (var e = 0, i = {}, r = t.match(n), s = !1; r;) {
  29719. var o = r[0],
  29720. a = "";
  29721. if (s = !1, '"' === (t = t.substring(o.length).trim()).charAt(0))(e = t.indexOf('"', 1)) > -1 && (a = t.substring(1, e).trim(), s = !0), e++;
  29722. else if ("'" === t.charAt(0))(e = t.indexOf("'", 1)) > -1 && (a = t.substring(1, e).trim(), s = !0), e++;
  29723. else {
  29724. var l = t.match(/(\S)+/);
  29725. e = (a = l ? l[0] : "").length
  29726. }
  29727. s && (i[o = o.substring(0, o.length - 1).trim()] = a), r = (t = t.substring(e).trim()).match(n)
  29728. }
  29729. return i
  29730. },
  29731. _addToStack: function(t) {
  29732. var e = this._attributeToObject(t);
  29733. if (0 === this._stack.length) this._stack.push(e);
  29734. else {
  29735. if (e.isNewLine || e.isImage) return;
  29736. var i = this._stack[this._stack.length - 1];
  29737. for (var n in i) e[n] || (e[n] = i[n]);
  29738. this._stack.push(e)
  29739. }
  29740. },
  29741. _processResult: function(t) {
  29742. "" !== t && (t = this._escapeSpecialSymbol(t), this._stack.length > 0 ? this._resultObjectArray.push({
  29743. text: t,
  29744. style: this._stack[this._stack.length - 1]
  29745. }) : this._resultObjectArray.push({
  29746. text: t
  29747. }))
  29748. },
  29749. _escapeSpecialSymbol: function(t) {
  29750. for (var e = 0; e < this._specialSymbolArray.length; ++e) {
  29751. var i = this._specialSymbolArray[e][0],
  29752. n = this._specialSymbolArray[e][1];
  29753. t = t.replace(i, n)
  29754. }
  29755. return t
  29756. }
  29757. }, e.exports = s
  29758. }), {}],
  29759. 298: [(function(t, e, i) {
  29760. "use strict";
  29761. t("./CCPath"), t("./profiler/CCProfiler"), t("./find"), t("./mutable-forward-iterator")
  29762. }), {
  29763. "./CCPath": 289,
  29764. "./find": 295,
  29765. "./mutable-forward-iterator": 301,
  29766. "./profiler/CCProfiler": 304
  29767. }],
  29768. 299: [(function(t, e, i) {
  29769. "use strict";
  29770. i.__esModule = !0, i.postLoadMesh = function(t, e) {
  29771. if (t.loaded || !t.nativeUrl) return void(e && e());
  29772. cc.loader.load(t.nativeUrl, (function(i, n) {
  29773. n && (t._nativeAsset = n), e && e(i)
  29774. }))
  29775. }
  29776. }), {}],
  29777. 300: [(function(t, e, i) {
  29778. "use strict";
  29779. for (var n = t("../platform/js"), r = {
  29780. propertyDefine: function(t, e, i) {
  29781. function r(t, e, i, r) {
  29782. var s = Object.getOwnPropertyDescriptor(t, e);
  29783. if (s) s.get && (t[i] = s.get), s.set && r && (t[r] = s.set);
  29784. else {
  29785. var o = t[i];
  29786. n.getset(t, e, o, t[r])
  29787. }
  29788. }
  29789. for (var s, o = t.prototype, a = 0; a < e.length; a++) {
  29790. var l = (s = e[a])[0].toUpperCase() + s.slice(1);
  29791. r(o, s, "get" + l, "set" + l)
  29792. }
  29793. for (s in i) {
  29794. var h = i[s];
  29795. r(o, s, h[0], h[1])
  29796. }
  29797. },
  29798. NextPOT: function(t) {
  29799. return t -= 1, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, (t |= t >> 16) + 1
  29800. },
  29801. BUILTIN_CLASSID_RE: /^(?:cc|dragonBones|sp|ccsg)\..+/
  29802. }, s = new Array(123), o = 0; o < 123; ++o) s[o] = 64;
  29803. for (var a = 0; a < 64; ++a) s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(a)] = a;
  29804. r.BASE64_VALUES = s, r.pushToMap = function(t, e, i, n) {
  29805. var r = t[e];
  29806. r ? Array.isArray(r) ? n ? (r.push(r[0]), r[0] = i) : r.push(i) : t[e] = n ? [i, r] : [r, i] : t[e] = i
  29807. }, r.clampf = function(t, e, i) {
  29808. if (e > i) {
  29809. var n = e;
  29810. e = i, i = n
  29811. }
  29812. return t < e ? e : t < i ? t : i
  29813. }, r.clamp01 = function(t) {
  29814. return t < 0 ? 0 : t < 1 ? t : 1
  29815. }, r.lerp = function(t, e, i) {
  29816. return t + (e - t) * i
  29817. }, r.degreesToRadians = function(t) {
  29818. return t * cc.macro.RAD
  29819. }, r.radiansToDegrees = function(t) {
  29820. return t * cc.macro.DEG
  29821. }, cc.misc = e.exports = r
  29822. }), {
  29823. "../platform/js": 218
  29824. }],
  29825. 301: [(function(t, e, i) {
  29826. "use strict";
  29827. function n(t) {
  29828. this.i = 0, this.array = t
  29829. }
  29830. var r = n.prototype;
  29831. r.remove = function(t) {
  29832. var e = this.array.indexOf(t);
  29833. e >= 0 && this.removeAt(e)
  29834. }, r.removeAt = function(t) {
  29835. this.array.splice(t, 1), t <= this.i && --this.i
  29836. }, r.fastRemove = function(t) {
  29837. var e = this.array.indexOf(t);
  29838. e >= 0 && this.fastRemoveAt(e)
  29839. }, r.fastRemoveAt = function(t) {
  29840. var e = this.array;
  29841. e[t] = e[e.length - 1], --e.length, t <= this.i && --this.i
  29842. }, r.push = function(t) {
  29843. this.array.push(t)
  29844. }, e.exports = n
  29845. }), {}],
  29846. 302: [(function(t, e, i) {
  29847. "use strict";
  29848. function n(t, e) {
  29849. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  29850. }
  29851. i.__esModule = !0;
  29852. var r = (function() {
  29853. function t() {
  29854. n(this, t), this.enabled = !1, this.count = 0, this.maxSize = 1024
  29855. }
  29856. return t.prototype.get = function() {}, t.prototype.put = function() {}, t.prototype.clear = function() {}, t
  29857. })();
  29858. i.default = r, cc.pool = {}, r.register = function(t, e) {
  29859. cc.pool[t] = e
  29860. }, e.exports = i.default
  29861. }), {}],
  29862. 303: [(function(t, e, i) {
  29863. "use strict";
  29864. t("../vmath");
  29865. cc._PrefabInfo = cc.Class({
  29866. name: "cc.PrefabInfo",
  29867. properties: {
  29868. root: null,
  29869. asset: null,
  29870. fileId: "",
  29871. sync: !1,
  29872. _synced: {
  29873. default: !1,
  29874. serializable: !1
  29875. }
  29876. }
  29877. }), e.exports = {
  29878. syncWithPrefab: function(t) {
  29879. var e = t._prefab;
  29880. if (e._synced = !0, !e.asset) return cc.errorID(3701, t.name), void(t._prefab = null);
  29881. var i = t._objFlags,
  29882. n = t._parent,
  29883. r = t._id,
  29884. s = t._name,
  29885. o = t._active,
  29886. a = t._eulerAngles.x,
  29887. l = t._eulerAngles.y,
  29888. h = t._eulerAngles.z,
  29889. c = t._localZOrder,
  29890. u = t._globalZOrder,
  29891. _ = t._trs,
  29892. f = _[0],
  29893. d = _[1],
  29894. p = _[2];
  29895. cc.game._isCloning = !0, e.asset._doInstantiate(t), cc.game._isCloning = !1, t._objFlags = i, t._parent = n, t._id = r, t._prefab = e, t._name = s, t._active = o, t._localZOrder = c, t._globalZOrder = u, (_ = t._trs)[0] = f, _[1] = d, _[2] = p, t._eulerAngles.x = a, t._eulerAngles.y = l, t._eulerAngles.z = h
  29896. }
  29897. }
  29898. }), {
  29899. "../vmath": 326
  29900. }],
  29901. 304: [(function(t, e, i) {
  29902. "use strict";
  29903. var n = t("../../platform/CCMacro"),
  29904. r = t("./perf-counter"),
  29905. s = !1,
  29906. o = 15,
  29907. a = null,
  29908. l = null,
  29909. h = null;
  29910. function c() {
  29911. if (!a) {
  29912. a = {
  29913. frame: {
  29914. desc: "Frame time (ms)",
  29915. min: 0,
  29916. max: 50,
  29917. average: 500
  29918. },
  29919. fps: {
  29920. desc: "Framerate (FPS)",
  29921. below: 30,
  29922. average: 500
  29923. },
  29924. draws: {
  29925. desc: "Draw call"
  29926. },
  29927. logic: {
  29928. desc: "Game Logic (ms)",
  29929. min: 0,
  29930. max: 50,
  29931. average: 500,
  29932. color: "#080"
  29933. },
  29934. render: {
  29935. desc: "Renderer (ms)",
  29936. min: 0,
  29937. max: 50,
  29938. average: 500,
  29939. color: "#f90"
  29940. },
  29941. mode: {
  29942. desc: cc.game.renderType === cc.game.RENDER_TYPE_WEBGL ? "WebGL" : "Canvas",
  29943. min: 1
  29944. }
  29945. };
  29946. var t = performance.now();
  29947. for (var e in a) a[e]._counter = new r(e, a[e], t)
  29948. }
  29949. }
  29950. function u() {
  29951. if (!l || !l.isValid) {
  29952. (l = new cc.Node("PROFILER-NODE")).x = l.y = 10, l.groupIndex = cc.Node.BuiltinGroupIndex.DEBUG, cc.Camera._setupDebugCamera(), l.zIndex = n.MAX_ZINDEX, cc.game.addPersistRootNode(l);
  29953. var t = new cc.Node("LEFT-PANEL");
  29954. t.anchorX = t.anchorY = 0;
  29955. var e = t.addComponent(cc.Label);
  29956. e.fontSize = o, e.lineHeight = o, t.parent = l;
  29957. var i = new cc.Node("RIGHT-PANEL");
  29958. i.anchorX = 1, i.anchorY = 0, i.x = 200;
  29959. var r = i.addComponent(cc.Label);
  29960. r.horizontalAlign = cc.Label.HorizontalAlign.RIGHT, r.fontSize = o, r.lineHeight = o, i.parent = l, cc.sys.browserType !== cc.sys.BROWSER_TYPE_BAIDU_GAME_SUB && cc.sys.browserType !== cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB && (e.cacheMode = cc.Label.CacheMode.CHAR, r.cacheMode = cc.Label.CacheMode.CHAR), h = {
  29961. left: e,
  29962. right: r
  29963. }
  29964. }
  29965. }
  29966. function _() {
  29967. u();
  29968. var t = cc.director._lastUpdate;
  29969. a.frame._counter.start(t), a.logic._counter.start(t)
  29970. }
  29971. function f() {
  29972. var t = performance.now();
  29973. cc.director.isPaused() ? a.frame._counter.start(t) : a.logic._counter.end(t), a.render._counter.start(t)
  29974. }
  29975. function d() {
  29976. var t = performance.now();
  29977. a.render._counter.end(t), a.draws._counter.value = cc.renderer.drawCalls, a.frame._counter.end(t), a.fps._counter.frame(t);
  29978. var e = "",
  29979. i = "";
  29980. for (var n in a) {
  29981. var r = a[n];
  29982. r._counter.sample(t), e += r.desc + "\n", i += r._counter.human() + "\n"
  29983. }
  29984. h && (h.left.string = e, h.right.string = i)
  29985. }
  29986. cc.profiler = e.exports = {
  29987. isShowingStats: function() {
  29988. return s
  29989. },
  29990. hideStats: function() {
  29991. s && (l && (l.active = !1), cc.director.off(cc.Director.EVENT_BEFORE_UPDATE, _), cc.director.off(cc.Director.EVENT_AFTER_UPDATE, f), cc.director.off(cc.Director.EVENT_AFTER_DRAW, d), s = !1)
  29992. },
  29993. showStats: function() {
  29994. s || (c(), l && (l.active = !0), cc.director.on(cc.Director.EVENT_BEFORE_UPDATE, _), cc.director.on(cc.Director.EVENT_AFTER_UPDATE, f), cc.director.on(cc.Director.EVENT_AFTER_DRAW, d), s = !0)
  29995. }
  29996. }
  29997. }), {
  29998. "../../platform/CCMacro": 203,
  29999. "./perf-counter": 306
  30000. }],
  30001. 305: [(function(t, e, i) {
  30002. "use strict";
  30003. var n = cc.Class({
  30004. name: "cc.Counter",
  30005. ctor: function(t, e, i) {
  30006. this._id = t, this._opts = e || {}, this._value = 0, this._total = 0, this._averageValue = 0, this._accumValue = 0, this._accumSamples = 0, this._accumStart = i
  30007. },
  30008. properties: {
  30009. value: {
  30010. get: function() {
  30011. return this._value
  30012. },
  30013. set: function(t) {
  30014. this._value = t
  30015. }
  30016. }
  30017. },
  30018. _average: function(t, e) {
  30019. if (this._opts.average) {
  30020. this._accumValue += t, ++this._accumSamples;
  30021. var i = e;
  30022. i - this._accumStart >= this._opts.average && (this._averageValue = this._accumValue / this._accumSamples, this._accumValue = 0, this._accumStart = i, this._accumSamples = 0)
  30023. }
  30024. },
  30025. sample: function(t) {
  30026. this._average(this._value, t)
  30027. },
  30028. human: function() {
  30029. var t = this._opts.average ? this._averageValue : this._value;
  30030. return Math.round(100 * t) / 100
  30031. },
  30032. alarm: function() {
  30033. return this._opts.below && this._value < this._opts.below || this._opts.over && this._value > this._opts.over
  30034. }
  30035. });
  30036. e.exports = n
  30037. }), {}],
  30038. 306: [(function(t, e, i) {
  30039. "use strict";
  30040. var n = t("./counter"),
  30041. r = cc.Class({
  30042. name: "cc.PerfCounter",
  30043. extends: n,
  30044. ctor: function(t, e, i) {
  30045. this._time = i
  30046. },
  30047. start: function(t) {
  30048. this._time = t
  30049. },
  30050. end: function(t) {
  30051. this._value = t - this._time, this._average(this._value)
  30052. },
  30053. tick: function() {
  30054. this.end(), this.start()
  30055. },
  30056. frame: function(t) {
  30057. var e = t,
  30058. i = e - this._time;
  30059. this._total++, i > (this._opts.average || 1e3) && (this._value = 1e3 * this._total / i, this._total = 0, this._time = e, this._average(this._value))
  30060. }
  30061. });
  30062. e.exports = r
  30063. }), {
  30064. "./counter": 305
  30065. }],
  30066. 307: [(function(t, e, i) {
  30067. "use strict";
  30068. var n = .26;
  30069. var r = {
  30070. BASELINE_RATIO: n,
  30071. MIDDLE_RATIO: (n + 1) / 2 - n,
  30072. label_wordRex: /([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430-\u044f\u0410-\u042f\u0401\u0451]+|\S)/,
  30073. label_symbolRex: /^[!,.:;'}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/,
  30074. label_lastWordRex: /([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+|\S)$/,
  30075. label_lastEnglish: /[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+$/,
  30076. label_firstEnglish: /^[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]/,
  30077. label_firstEmoji: /^[\uD83C\uDF00-\uDFFF\uDC00-\uDE4F]/,
  30078. label_lastEmoji: /([\uDF00-\uDFFF\uDC00-\uDE4F]+|\S)$/,
  30079. label_wrapinspection: !0,
  30080. __CHINESE_REG: /^[\u4E00-\u9FFF\u3400-\u4DFF]+$/,
  30081. __JAPANESE_REG: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g,
  30082. __KOREAN_REG: /^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/,
  30083. isUnicodeCJK: function(t) {
  30084. return this.__CHINESE_REG.test(t) || this.__JAPANESE_REG.test(t) || this.__KOREAN_REG.test(t)
  30085. },
  30086. isUnicodeSpace: function(t) {
  30087. return (t = t.charCodeAt(0)) >= 9 && t <= 13 || 32 === t || 133 === t || 160 === t || 5760 === t || t >= 8192 && t <= 8202 || 8232 === t || 8233 === t || 8239 === t || 8287 === t || 12288 === t
  30088. },
  30089. safeMeasureText: function(t, e) {
  30090. var i = t.measureText(e);
  30091. return i && i.width || 0
  30092. },
  30093. fragmentText: function(t, e, i, n) {
  30094. var r = [];
  30095. if (0 === t.length || i < 0) return r.push(""), r;
  30096. for (var s = t; e > i && s.length > 1;) {
  30097. for (var o = s.length * (i / e) | 0, a = s.substring(o), l = e - n(a), h = a, c = 0, u = 0; l > i && u++ < 10;) o *= i / l, o |= 0, l = e - n(a = s.substring(o));
  30098. for (u = 0; l <= i && u++ < 10;) {
  30099. if (a) {
  30100. var _ = this.label_wordRex.exec(a);
  30101. c = _ ? _[0].length : 1, h = a
  30102. }
  30103. o += c, l = e - n(a = s.substring(o))
  30104. }
  30105. 0 === (o -= c) && (o = 1, h = h.substring(1));
  30106. var f, d = s.substring(0, 0 + o);
  30107. this.label_wrapinspection && this.label_symbolRex.test(h || a) && (0 === (o -= (f = this.label_lastWordRex.exec(d)) ? f[0].length : 0) && (o = 1), h = s.substring(o), d = s.substring(0, 0 + o)), this.label_firstEmoji.test(h) && (f = this.label_lastEmoji.exec(d)) && d !== f[0] && (o -= f[0].length, h = s.substring(o), d = s.substring(0, 0 + o)), this.label_firstEnglish.test(h) && (f = this.label_lastEnglish.exec(d)) && d !== f[0] && (o -= f[0].length, h = s.substring(o), d = s.substring(0, 0 + o)), 0 === r.length ? r.push(d) : (d = d.trimLeft()).length > 0 && r.push(d), e = n(s = h || a)
  30108. }
  30109. return 0 === r.length ? r.push(s) : (s = s.trimLeft()).length > 0 && r.push(s), r
  30110. }
  30111. };
  30112. cc.textUtils = e.exports = r
  30113. }), {}],
  30114. 308: [(function(t, e, i) {
  30115. "use strict";
  30116. var n = t("../assets/CCTexture2D"),
  30117. r = {
  30118. loadImage: function(t, e, i) {
  30119. cc.assertID(t, 3103);
  30120. var r = cc.loader.getRes(t);
  30121. return r ? r.loaded ? (e && e.call(i, null, r), r) : (r.once("load", (function() {
  30122. e && e.call(i, null, r)
  30123. }), i), r) : ((r = new n).url = t, cc.loader.load({
  30124. url: t,
  30125. texture: r
  30126. }, (function(t, n) {
  30127. if (t) return e && e.call(i, t || new Error("Unknown error"));
  30128. n.handleLoadedTexture(), e && e.call(i, null, n)
  30129. })), r)
  30130. },
  30131. cacheImage: function(t, e) {
  30132. if (t && e) {
  30133. var i = new n;
  30134. i.initWithElement(e);
  30135. var r = {
  30136. id: t,
  30137. url: t,
  30138. error: null,
  30139. content: i,
  30140. complete: !1
  30141. };
  30142. return cc.loader.flowOut(r), i
  30143. }
  30144. },
  30145. postLoadTexture: function(t, e) {
  30146. t.loaded ? e && e() : t.url ? cc.loader.load({
  30147. url: t.url,
  30148. skips: ["Loader"]
  30149. }, (function(i, n) {
  30150. n && (t.loaded || (t._nativeAsset = n)), e && e(i)
  30151. })) : e && e()
  30152. }
  30153. };
  30154. cc.textureUtil = e.exports = r
  30155. }), {
  30156. "../assets/CCTexture2D": 73
  30157. }],
  30158. 309: [(function(t, e, i) {
  30159. "use strict";
  30160. var n = t("./node-unit"),
  30161. r = t("./node-mem-pool");
  30162. e.exports = {
  30163. NodeMemPool: new r(n)
  30164. }
  30165. }), {
  30166. "./node-mem-pool": 311,
  30167. "./node-unit": 312
  30168. }],
  30169. 310: [(function(t, e, i) {
  30170. "use strict";
  30171. var n = function(t) {
  30172. this._unitClass = t, this._pool = [], this._findOrder = []
  30173. },
  30174. r = n.prototype;
  30175. r._initNative = function() {
  30176. this._nativeMemPool = new renderer.MemPool
  30177. }, r._buildUnit = function(t) {
  30178. var e = new this._unitClass(t, this);
  30179. return e
  30180. }, r._destroyUnit = function(t) {
  30181. this._pool[t] = null;
  30182. for (var e = 0, i = this._findOrder.length; e < i; e++) {
  30183. var n = this._findOrder[e];
  30184. if (n && n.unitID == t) {
  30185. this._findOrder.splice(e, 1);
  30186. break
  30187. }
  30188. }
  30189. }, r._findUnitID = function() {
  30190. for (var t = 0, e = this._pool; e[t];) t++;
  30191. return t
  30192. }, r.pop = function() {
  30193. for (var t = null, e = 0, i = this._findOrder, n = this._pool, r = i.length; e < r; e++) {
  30194. var s = i[e];
  30195. if (s && s.hasSpace()) {
  30196. t = s;
  30197. break
  30198. }
  30199. }
  30200. if (!t) {
  30201. var o = this._findUnitID();
  30202. t = this._buildUnit(o), n[o] = t, i.push(t), e = i.length - 1
  30203. }
  30204. var a = i[0];
  30205. return a !== t && (i[0] = t, i[e] = a), t.pop()
  30206. }, r.push = function(t) {
  30207. var e = this._pool[t.unitID];
  30208. return e.push(t.index), this._findOrder.length > 1 && e.isAllFree() && this._destroyUnit(t.unitID), e
  30209. }, e.exports = n
  30210. }), {}],
  30211. 311: [(function(t, e, i) {
  30212. "use strict";
  30213. var n = t("./mem-pool"),
  30214. r = function(t) {
  30215. n.call(this, t)
  30216. };
  30217. (function() {
  30218. var t = function() {};
  30219. t.prototype = n.prototype, r.prototype = new t
  30220. })();
  30221. var s = r.prototype;
  30222. s._initNative = function() {
  30223. this._nativeMemPool = new renderer.NodeMemPool
  30224. }, s._destroyUnit = function(t) {
  30225. n.prototype._destroyUnit.call(this, t)
  30226. }, e.exports = r
  30227. }), {
  30228. "./mem-pool": 310
  30229. }],
  30230. 312: [(function(t, e, i) {
  30231. "use strict";
  30232. var n = t("../../vmath/utils"),
  30233. r = (Uint32Array, 10 * n.FLOAT_BYTES),
  30234. s = 16 * n.FLOAT_BYTES,
  30235. o = 16 * n.FLOAT_BYTES,
  30236. a = (Uint32Array, Uint32Array, Int32Array, Uint8Array, Uint8Array, Uint32Array, n.FLOAT_BYTES, t("./unit-base")),
  30237. l = function(t, e) {
  30238. a.call(this, t, e);
  30239. var i = this._contentNum;
  30240. this.trsList = new n.FLOAT_ARRAY_TYPE(10 * i), this.localMatList = new n.FLOAT_ARRAY_TYPE(16 * i), this.worldMatList = new n.FLOAT_ARRAY_TYPE(16 * i);
  30241. for (var l = 0; l < i; l++) {
  30242. var h = this._spacesData[l];
  30243. h.trs = new n.FLOAT_ARRAY_TYPE(this.trsList.buffer, l * r, 10), h.localMat = new n.FLOAT_ARRAY_TYPE(this.localMatList.buffer, l * s, 16), h.worldMat = new n.FLOAT_ARRAY_TYPE(this.worldMatList.buffer, l * o, 16)
  30244. }
  30245. };
  30246. (function() {
  30247. var t = function() {};
  30248. t.prototype = a.prototype, l.prototype = new t
  30249. })(), e.exports = l
  30250. }), {
  30251. "../../vmath/utils": 333,
  30252. "./unit-base": 313
  30253. }],
  30254. 313: [(function(t, e, i) {
  30255. "use strict";
  30256. var n = function(t, e, i) {
  30257. i = i || 128, this.unitID = t, this._memPool = e, this._data = new Uint16Array(2), this._data[0] = 0, this._data[1] = 0, this._contentNum = i, this._signData = new Uint16Array(2 * this._contentNum), this._spacesData = [];
  30258. for (var n = 0; n < i; n++) {
  30259. var r = 2 * n;
  30260. this._signData[r + 0] = n + 1, this._signData[r + 1] = 0, this._spacesData[n] = {
  30261. index: n,
  30262. unitID: t
  30263. }
  30264. }
  30265. this._signData[2 * (i - 1)] = 65535
  30266. },
  30267. r = n.prototype;
  30268. r.hasSpace = function() {
  30269. return 65535 !== this._data[0]
  30270. }, r.isAllFree = function() {
  30271. return 0 == this._data[1]
  30272. }, r.pop = function() {
  30273. var t = this._data[0];
  30274. if (65535 === t) return null;
  30275. var e = t,
  30276. i = 2 * e,
  30277. n = this._spacesData[e];
  30278. return this._signData[i + 1] = 1, this._data[0] = this._signData[i + 0], this._data[1]++, n
  30279. }, r.push = function(t) {
  30280. var e = 2 * t;
  30281. this._signData[e + 1] = 0, this._signData[e + 0] = this._data[0], this._data[0] = t, this._data[1]--
  30282. }, r.dump = function() {
  30283. for (var t = 0, e = this._data[0], i = ""; 65535 != e;) t++, i += e + "->", e = this._signData[2 * e + 0];
  30284. for (var n = 0, r = "", s = this._contentNum, o = 0; o < s; o++) {
  30285. 1 == this._signData[2 * o + 1] && (n++, r += o + "->")
  30286. }
  30287. var a = t + n;
  30288. console.log("unitID:", this.unitID, "spaceNum:", t, "calc using num:", n, "store using num:", this._data[1], "calc total num:", a, "actually total num:", this._contentNum), console.log("free info:", i), console.log("using info:", r), n != this._data[1] && cc.error("using num error", "calc using num:", n, "store using num:", this._data[1]), t + n != this._contentNum && cc.error("total num error", "calc total num:", a, "actually total num:", this._contentNum)
  30289. }, e.exports = n
  30290. }), {}],
  30291. 314: [(function(t, e, i) {
  30292. "use strict";
  30293. var n = t("../vmath"),
  30294. r = t("./value-type"),
  30295. s = t("../platform/js"),
  30296. o = (function() {
  30297. function e(t, e, i, n) {
  30298. "object" == typeof t && (e = t.g, i = t.b, n = t.a, t = t.r), t = t || 0, e = e || 0, i = i || 0, n = "number" == typeof n ? n : 255, this._val = (n << 24 >>> 0) + (i << 16) + (e << 8) + t
  30299. }
  30300. s.extend(e, r), t("../platform/CCClass").fastDefine("cc.Color", e, {
  30301. r: 0,
  30302. g: 0,
  30303. b: 0,
  30304. a: 255
  30305. });
  30306. var i = {
  30307. WHITE: [255, 255, 255, 255],
  30308. BLACK: [0, 0, 0, 255],
  30309. TRANSPARENT: [0, 0, 0, 0],
  30310. GRAY: [127.5, 127.5, 127.5],
  30311. RED: [255, 0, 0],
  30312. GREEN: [0, 255, 0],
  30313. BLUE: [0, 0, 255],
  30314. YELLOW: [255, 235, 4],
  30315. ORANGE: [255, 127, 0],
  30316. CYAN: [0, 255, 255],
  30317. MAGENTA: [255, 0, 255]
  30318. };
  30319. for (var o in i) s.get(e, o, (function(t) {
  30320. return function() {
  30321. return new e(t[0], t[1], t[2], t[3])
  30322. }
  30323. })(i[o]));
  30324. var a = e.prototype;
  30325. return a.clone = function() {
  30326. var t = new e;
  30327. return t._val = this._val, t
  30328. }, a.equals = function(t) {
  30329. return t && this._val === t._val
  30330. }, a.lerp = function(t, i, n) {
  30331. n = n || new e;
  30332. var r = this.r,
  30333. s = this.g,
  30334. o = this.b,
  30335. a = this.a;
  30336. return n.r = r + (t.r - r) * i, n.g = s + (t.g - s) * i, n.b = o + (t.b - o) * i, n.a = a + (t.a - a) * i, n
  30337. }, a.toString = function() {
  30338. return "rgba(" + this.r.toFixed() + ", " + this.g.toFixed() + ", " + this.b.toFixed() + ", " + this.a.toFixed() + ")"
  30339. }, a.getR = function() {
  30340. return 255 & this._val
  30341. }, a.setR = function(t) {
  30342. return t = ~~cc.misc.clampf(t, 0, 255), this._val = (4294967040 & this._val | t) >>> 0, this
  30343. }, a.getG = function() {
  30344. return (65280 & this._val) >> 8
  30345. }, a.setG = function(t) {
  30346. return t = ~~cc.misc.clampf(t, 0, 255), this._val = (4294902015 & this._val | t << 8) >>> 0, this
  30347. }, a.getB = function() {
  30348. return (16711680 & this._val) >> 16
  30349. }, a.setB = function(t) {
  30350. return t = ~~cc.misc.clampf(t, 0, 255), this._val = (4278255615 & this._val | t << 16) >>> 0, this
  30351. }, a.getA = function() {
  30352. return (4278190080 & this._val) >>> 24
  30353. }, a.setA = function(t) {
  30354. return t = ~~cc.misc.clampf(t, 0, 255), this._val = (16777215 & this._val | t << 24) >>> 0, this
  30355. }, a._fastSetA = function(t) {
  30356. this._val = (16777215 & this._val | t << 24) >>> 0
  30357. }, s.getset(a, "r", a.getR, a.setR, !0), s.getset(a, "g", a.getG, a.setG, !0), s.getset(a, "b", a.getB, a.setB, !0), s.getset(a, "a", a.getA, a.setA, !0), a.toCSS = function(t) {
  30358. return "rgba" === t ? "rgba(" + (0 | this.r) + "," + (0 | this.g) + "," + (0 | this.b) + "," + (this.a / 255).toFixed(2) + ")" : "rgb" === t ? "rgb(" + (0 | this.r) + "," + (0 | this.g) + "," + (0 | this.b) + ")" : "#" + this.toHEX(t)
  30359. }, a.fromHEX = function(t) {
  30360. t = 0 === t.indexOf("#") ? t.substring(1) : t;
  30361. var e = parseInt(t.substr(0, 2), 16) || 0,
  30362. i = parseInt(t.substr(2, 2), 16) || 0,
  30363. n = parseInt(t.substr(4, 2), 16) || 0,
  30364. r = parseInt(t.substr(6, 2), 16) || 255;
  30365. return this._val = (r << 24 >>> 0) + (n << 16) + (i << 8) + e, this
  30366. }, a.toHEX = function(t) {
  30367. var e = [(this.r < 16 ? "0" : "") + (0 | this.r).toString(16), (this.g < 16 ? "0" : "") + (0 | this.g).toString(16), (this.b < 16 ? "0" : "") + (0 | this.b).toString(16)],
  30368. i = -1;
  30369. if ("#rgb" === t)
  30370. for (i = 0; i < e.length; ++i) e[i].length > 1 && (e[i] = e[i][0]);
  30371. else if ("#rrggbb" === t)
  30372. for (i = 0; i < e.length; ++i) 1 === e[i].length && (e[i] = "0" + e[i]);
  30373. else "#rrggbbaa" === t && e.push((this.a < 16 ? "0" : "") + (0 | this.a).toString(16));
  30374. return e.join("")
  30375. }, a.toRGBValue = function() {
  30376. return 16777215 & this._val
  30377. }, a.fromHSV = function(t, e, i) {
  30378. var n, r, s;
  30379. if (0 === e) n = r = s = i;
  30380. else if (0 === i) n = r = s = 0;
  30381. else {
  30382. 1 === t && (t = 0), t *= 6, e = e, i = i;
  30383. var o = Math.floor(t),
  30384. a = t - o,
  30385. l = i * (1 - e),
  30386. h = i * (1 - e * a),
  30387. c = i * (1 - e * (1 - a));
  30388. switch (o) {
  30389. case 0:
  30390. n = i, r = c, s = l;
  30391. break;
  30392. case 1:
  30393. n = h, r = i, s = l;
  30394. break;
  30395. case 2:
  30396. n = l, r = i, s = c;
  30397. break;
  30398. case 3:
  30399. n = l, r = h, s = i;
  30400. break;
  30401. case 4:
  30402. n = c, r = l, s = i;
  30403. break;
  30404. case 5:
  30405. n = i, r = l, s = h
  30406. }
  30407. }
  30408. return n *= 255, r *= 255, s *= 255, this._val = (this.a << 24 >>> 0) + (s << 16) + (r << 8) + n, this
  30409. }, a.toHSV = function() {
  30410. var t = this.r / 255,
  30411. e = this.g / 255,
  30412. i = this.b / 255,
  30413. n = {
  30414. h: 0,
  30415. s: 0,
  30416. v: 0
  30417. },
  30418. r = Math.max(t, e, i),
  30419. s = Math.min(t, e, i),
  30420. o = 0;
  30421. return n.v = r, n.s = r ? (r - s) / r : 0, n.s ? (o = r - s, n.h = t === r ? (e - i) / o : e === r ? 2 + (i - t) / o : 4 + (t - e) / o, n.h /= 6, n.h < 0 && (n.h += 1)) : n.h = 0, n
  30422. }, a.set = function(t) {
  30423. t._val ? this._val = t._val : (this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a)
  30424. }, a.array = function(t) {
  30425. n.color4.array(t, this)
  30426. }, e
  30427. })();
  30428. cc.Color = o, cc.color = function(t, e, i, n) {
  30429. return "string" == typeof t ? (new cc.Color).fromHEX(t) : "object" == typeof t ? new cc.Color(t.r, t.g, t.b, t.a) : new cc.Color(t, e, i, n)
  30430. }, e.exports = cc.Color
  30431. }), {
  30432. "../platform/CCClass": 198,
  30433. "../platform/js": 218,
  30434. "../vmath": 326,
  30435. "./value-type": 320
  30436. }],
  30437. 315: [(function(t, e, i) {
  30438. "use strict";
  30439. t("./value-type"), cc.vmath = t("../vmath").default, e.exports = {
  30440. Vec2: t("./vec2"),
  30441. Vec3: t("./vec3"),
  30442. Vec4: t("./vec4"),
  30443. Quat: t("./quat"),
  30444. Mat4: t("./mat4"),
  30445. Size: t("./size"),
  30446. Rect: t("./rect"),
  30447. Color: t("./color")
  30448. }
  30449. }), {
  30450. "../vmath": 326,
  30451. "./color": 314,
  30452. "./mat4": 316,
  30453. "./quat": 317,
  30454. "./rect": 318,
  30455. "./size": 319,
  30456. "./value-type": 320,
  30457. "./vec2": 321,
  30458. "./vec3": 322,
  30459. "./vec4": 323
  30460. }],
  30461. 316: [(function(t, e, i) {
  30462. "use strict";
  30463. var n = t("../vmath"),
  30464. r = t("../vmath/utils"),
  30465. s = t("./value-type"),
  30466. o = t("../platform/js"),
  30467. a = t("../platform/CCClass");
  30468. function l(t, e, i, n, s, o, a, l, h, c, u, _, f, d, p, m) {
  30469. this.m = new r.FLOAT_ARRAY_TYPE(16);
  30470. var y = this.m;
  30471. y[0] = t, y[1] = e, y[2] = i, y[3] = n, y[4] = s, y[5] = o, y[6] = a, y[7] = l, y[8] = h, y[9] = c, y[10] = u, y[11] = _, y[12] = f, y[13] = d, y[14] = p, y[15] = m
  30472. }
  30473. o.extend(l, s), a.fastDefine("cc.Mat4", l, {
  30474. m00: 1,
  30475. m01: 0,
  30476. m02: 0,
  30477. m03: 0,
  30478. m04: 0,
  30479. m05: 1,
  30480. m06: 0,
  30481. m07: 0,
  30482. m08: 0,
  30483. m09: 0,
  30484. m10: 1,
  30485. m11: 0,
  30486. m12: 0,
  30487. m13: 0,
  30488. m14: 0,
  30489. m15: 1
  30490. });
  30491. for (var h = function(t) {
  30492. Object.defineProperty(l.prototype, "m" + t, {
  30493. get: function() {
  30494. return this.m[t]
  30495. },
  30496. set: function(e) {
  30497. this.m[t] = e
  30498. }
  30499. })
  30500. }, c = 0; c < 16; c++) h(c);
  30501. o.mixin(l.prototype, {
  30502. clone: function() {
  30503. var t = this.m;
  30504. return new l(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15])
  30505. },
  30506. set: function(t) {
  30507. var e = this.m,
  30508. i = t.m;
  30509. return e[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[3], e[4] = i[4], e[5] = i[5], e[6] = i[6], e[7] = i[7], e[8] = i[8], e[9] = i[9], e[10] = i[10], e[11] = i[11], e[12] = i[12], e[13] = i[13], e[14] = i[14], e[15] = i[15], this
  30510. },
  30511. equals: function(t) {
  30512. return n.mat4.exactEquals(this, t)
  30513. },
  30514. fuzzyEquals: function(t) {
  30515. return n.mat4.equals(this, t)
  30516. },
  30517. toString: function() {
  30518. var t = this.m;
  30519. return t ? "[\n" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ",\n" + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ",\n" + t[8] + ", " + t[9] + ", " + t[10] + ", " + t[11] + ",\n" + t[12] + ", " + t[13] + ", " + t[14] + ", " + t[15] + "\n]" : "[\n1, 0, 0, 0\n0, 1, 0, 0\n0, 0, 1, 0\n0, 0, 0, 1\n]"
  30520. },
  30521. identity: function() {
  30522. return n.mat4.identity(this)
  30523. },
  30524. transpose: function(t) {
  30525. return t = t || new cc.Mat4, n.mat4.transpose(t, this)
  30526. },
  30527. invert: function(t) {
  30528. return t = t || new cc.Mat4, n.mat4.invert(t, this)
  30529. },
  30530. adjoint: function(t) {
  30531. return t = t || new cc.Mat4, n.mat4.adjoint(t, this)
  30532. },
  30533. determinant: function() {
  30534. return n.mat4.determinant(this)
  30535. },
  30536. add: function(t, e) {
  30537. return e = e || new cc.Mat4, n.mat4.add(e, this, t)
  30538. },
  30539. sub: function(t, e) {
  30540. return e = e || new cc.Mat4, n.mat4.subtract(e, this, t)
  30541. },
  30542. mul: function(t, e) {
  30543. return e = e || new cc.Mat4, n.mat4.multiply(e, this, t)
  30544. },
  30545. mulScalar: function(t, e) {
  30546. return e = e || new cc.Mat4, n.mat4.mulScalar(e, this, t)
  30547. },
  30548. translate: function(t, e) {
  30549. return e = e || new cc.Mat4, n.mat4.translate(e, this, t)
  30550. },
  30551. scale: function(t, e) {
  30552. return e = e || new cc.Mat4, n.mat4.scale(e, this, t)
  30553. },
  30554. rotate: function(t, e, i) {
  30555. return i = i || new cc.Mat4, n.mat4.rotate(i, this, t, e)
  30556. },
  30557. getTranslation: function(t) {
  30558. return t = t || new cc.Vec3, n.mat4.getTranslation(t, this)
  30559. },
  30560. getScale: function(t) {
  30561. return t = t || new cc.Vec3, n.mat4.getScaling(t, this)
  30562. },
  30563. getRotation: function(t) {
  30564. return t = t || new cc.Quat, n.mat4.getRotation(t, this)
  30565. },
  30566. fromRTS: function(t, e, i) {
  30567. return n.mat4.fromRTS(this, t, e, i)
  30568. },
  30569. fromQuat: function(t) {
  30570. return n.mat4.fromQuat(this, t)
  30571. },
  30572. array: function(t) {
  30573. return n.mat4.array(t, this)
  30574. }
  30575. }), cc.mat4 = function(t, e, i, r, s, o, a, h, c, u, _, f, d, p, m, y) {
  30576. var v = new l(t, e, i, r, s, o, a, h, c, u, _, f, d, p, m, y);
  30577. return void 0 === t && n.mat4.identity(v), v
  30578. }, e.exports = cc.Mat4 = l
  30579. }), {
  30580. "../platform/CCClass": 198,
  30581. "../platform/js": 218,
  30582. "../vmath": 326,
  30583. "../vmath/utils": 333,
  30584. "./value-type": 320
  30585. }],
  30586. 317: [(function(t, e, i) {
  30587. "use strict";
  30588. var n = t("./value-type"),
  30589. r = t("../platform/js"),
  30590. s = t("../platform/CCClass"),
  30591. o = t("../vmath/quat");
  30592. function a(t, e, i, n) {
  30593. t && "object" == typeof t && (i = t.z, e = t.y, n = t.w, t = t.x), this.x = t || 0, this.y = e || 0, this.z = i || 0, this.w = n || 1
  30594. }
  30595. r.extend(a, n), s.fastDefine("cc.Quat", a, {
  30596. x: 0,
  30597. y: 0,
  30598. z: 0,
  30599. w: 1
  30600. });
  30601. var l = a.prototype;
  30602. l.clone = function() {
  30603. return new a(this.x, this.y, this.z, this.w)
  30604. }, l.set = function(t) {
  30605. return this.x = t.x, this.y = t.y, this.z = t.z, this.w = t.w, this
  30606. }, l.equals = function(t) {
  30607. return t && this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w
  30608. }, l.toEuler = function(t) {
  30609. return o.toEuler(t, this), t
  30610. }, l.fromEuler = function(t) {
  30611. return o.fromEuler(this, t.x, t.y, t.z), this
  30612. }, l.lerp = function(t, e, i) {
  30613. return i = i || new cc.Quat, o.slerp(i, this, t, e), i
  30614. }, l.mul = function(t, e) {
  30615. return e = e || new cc.Quat, o.mul(e, this, t), e
  30616. }, l.array = function(t) {
  30617. o.array(t, this)
  30618. }, l.rotateAround = function(t, e, i, n) {
  30619. return n = n || new cc.Quat, o.rotateAround(n, t, e, i)
  30620. }, cc.quat = function(t, e, i, n) {
  30621. return new a(t, e, i, n)
  30622. }, e.exports = cc.Quat = a
  30623. }), {
  30624. "../platform/CCClass": 198,
  30625. "../platform/js": 218,
  30626. "../vmath/quat": 331,
  30627. "./value-type": 320
  30628. }],
  30629. 318: [(function(t, e, i) {
  30630. "use strict";
  30631. var n = t("./value-type"),
  30632. r = t("../platform/js");
  30633. function s(t, e, i, n) {
  30634. t && "object" == typeof t && (e = t.y, i = t.width, n = t.height, t = t.x), this.x = t || 0, this.y = e || 0, this.width = i || 0, this.height = n || 0
  30635. }
  30636. r.extend(s, n), t("../platform/CCClass").fastDefine("cc.Rect", s, {
  30637. x: 0,
  30638. y: 0,
  30639. width: 0,
  30640. height: 0
  30641. }), s.fromMinMax = function(t, e) {
  30642. var i = Math.min(t.x, e.x),
  30643. n = Math.min(t.y, e.y);
  30644. return new s(i, n, Math.max(t.x, e.x) - i, Math.max(t.y, e.y) - n)
  30645. };
  30646. var o = s.prototype;
  30647. o.clone = function() {
  30648. return new s(this.x, this.y, this.width, this.height)
  30649. }, o.equals = function(t) {
  30650. return t && this.x === t.x && this.y === t.y && this.width === t.width && this.height === t.height
  30651. }, o.lerp = function(t, e, i) {
  30652. i = i || new s;
  30653. var n = this.x,
  30654. r = this.y,
  30655. o = this.width,
  30656. a = this.height;
  30657. return i.x = n + (t.x - n) * e, i.y = r + (t.y - r) * e, i.width = o + (t.width - o) * e, i.height = a + (t.height - a) * e, i
  30658. }, o.set = function(t) {
  30659. this.x = t.x, this.y = t.y, this.width = t.width, this.height = t.height
  30660. }, o.intersects = function(t) {
  30661. var e = this.x + this.width,
  30662. i = this.y + this.height,
  30663. n = t.x + t.width,
  30664. r = t.y + t.height;
  30665. return !(e < t.x || n < this.x || i < t.y || r < this.y)
  30666. }, o.intersection = function(t, e) {
  30667. var i = this.x,
  30668. n = this.y,
  30669. r = this.x + this.width,
  30670. s = this.y + this.height,
  30671. o = e.x,
  30672. a = e.y,
  30673. l = e.x + e.width,
  30674. h = e.y + e.height;
  30675. return t.x = Math.max(i, o), t.y = Math.max(n, a), t.width = Math.min(r, l) - t.x, t.height = Math.min(s, h) - t.y, t
  30676. }, o.contains = function(t) {
  30677. return this.x <= t.x && this.x + this.width >= t.x && this.y <= t.y && this.y + this.height >= t.y
  30678. }, o.containsRect = function(t) {
  30679. return this.x <= t.x && this.x + this.width >= t.x + t.width && this.y <= t.y && this.y + this.height >= t.y + t.height
  30680. }, o.union = function(t, e) {
  30681. var i = this.x,
  30682. n = this.y,
  30683. r = this.width,
  30684. s = this.height,
  30685. o = e.x,
  30686. a = e.y,
  30687. l = e.width,
  30688. h = e.height;
  30689. return t.x = Math.min(i, o), t.y = Math.min(n, a), t.width = Math.max(i + r, o + l) - t.x, t.height = Math.max(n + s, a + h) - t.y, t
  30690. }, o.transformMat4 = function(t, e) {
  30691. var i = this.x,
  30692. n = this.y,
  30693. r = i + this.width,
  30694. s = n + this.height,
  30695. o = e.m,
  30696. a = o[0] * i + o[4] * n + o[12],
  30697. l = o[1] * i + o[5] * n + o[13],
  30698. h = o[0] * r + o[4] * n + o[12],
  30699. c = o[1] * r + o[5] * n + o[13],
  30700. u = o[0] * i + o[4] * s + o[12],
  30701. _ = o[1] * i + o[5] * s + o[13],
  30702. f = o[0] * r + o[4] * s + o[12],
  30703. d = o[1] * r + o[5] * s + o[13],
  30704. p = Math.min(a, h, u, f),
  30705. m = Math.max(a, h, u, f),
  30706. y = Math.min(l, c, _, d),
  30707. v = Math.max(l, c, _, d);
  30708. return t.x = p, t.y = y, t.width = m - p, t.height = v - y, t
  30709. }, o.toString = function() {
  30710. return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")"
  30711. }, r.getset(o, "xMin", (function() {
  30712. return this.x
  30713. }), (function(t) {
  30714. this.width += this.x - t, this.x = t
  30715. })), r.getset(o, "yMin", (function() {
  30716. return this.y
  30717. }), (function(t) {
  30718. this.height += this.y - t, this.y = t
  30719. })), r.getset(o, "xMax", (function() {
  30720. return this.x + this.width
  30721. }), (function(t) {
  30722. this.width = t - this.x
  30723. })), r.getset(o, "yMax", (function() {
  30724. return this.y + this.height
  30725. }), (function(t) {
  30726. this.height = t - this.y
  30727. })), r.getset(o, "center", (function() {
  30728. return new cc.Vec2(this.x + .5 * this.width, this.y + .5 * this.height)
  30729. }), (function(t) {
  30730. this.x = t.x - .5 * this.width, this.y = t.y - .5 * this.height
  30731. })), r.getset(o, "origin", (function() {
  30732. return new cc.Vec2(this.x, this.y)
  30733. }), (function(t) {
  30734. this.x = t.x, this.y = t.y
  30735. })), r.getset(o, "size", (function() {
  30736. return new cc.Size(this.width, this.height)
  30737. }), (function(t) {
  30738. this.width = t.width, this.height = t.height
  30739. })), cc.Rect = s, cc.rect = function(t, e, i, n) {
  30740. return new s(t, e, i, n)
  30741. }, e.exports = cc.Rect
  30742. }), {
  30743. "../platform/CCClass": 198,
  30744. "../platform/js": 218,
  30745. "./value-type": 320
  30746. }],
  30747. 319: [(function(t, e, i) {
  30748. "use strict";
  30749. var n = t("./value-type"),
  30750. r = t("../platform/js");
  30751. function s(t, e) {
  30752. t && "object" == typeof t && (e = t.height, t = t.width), this.width = t || 0, this.height = e || 0
  30753. }
  30754. r.extend(s, n), t("../platform/CCClass").fastDefine("cc.Size", s, {
  30755. width: 0,
  30756. height: 0
  30757. }), r.get(s, "ZERO", (function() {
  30758. return new s(0, 0)
  30759. }));
  30760. var o = s.prototype;
  30761. o.clone = function() {
  30762. return new s(this.width, this.height)
  30763. }, o.equals = function(t) {
  30764. return t && this.width === t.width && this.height === t.height
  30765. }, o.lerp = function(t, e, i) {
  30766. i = i || new s;
  30767. var n = this.width,
  30768. r = this.height;
  30769. return i.width = n + (t.width - n) * e, i.height = r + (t.height - r) * e, i
  30770. }, o.set = function(t) {
  30771. this.width = t.width, this.height = t.height
  30772. }, o.toString = function() {
  30773. return "(" + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")"
  30774. }, cc.size = function(t, e) {
  30775. return new s(t, e)
  30776. }, cc.Size = e.exports = s
  30777. }), {
  30778. "../platform/CCClass": 198,
  30779. "../platform/js": 218,
  30780. "./value-type": 320
  30781. }],
  30782. 320: [(function(t, e, i) {
  30783. "use strict";
  30784. var n = t("../platform/js");
  30785. function r() {}
  30786. n.setClassName("cc.ValueType", r);
  30787. var s = r.prototype;
  30788. s.toString = function() {
  30789. return "" + {}
  30790. }, cc.ValueType = e.exports = r
  30791. }), {
  30792. "../platform/js": 218
  30793. }],
  30794. 321: [(function(t, e, i) {
  30795. "use strict";
  30796. var n = t("../vmath"),
  30797. r = t("./value-type"),
  30798. s = t("../platform/js"),
  30799. o = t("../platform/CCClass"),
  30800. a = t("../utils/misc");
  30801. function l(t, e) {
  30802. t && "object" == typeof t && (e = t.y, t = t.x), this.x = t || 0, this.y = e || 0
  30803. }
  30804. s.extend(l, r), o.fastDefine("cc.Vec2", l, {
  30805. x: 0,
  30806. y: 0
  30807. });
  30808. var h = l.prototype;
  30809. s.value(h, "z", 0, !0), h.clone = function() {
  30810. return new l(this.x, this.y)
  30811. }, h.set = function(t) {
  30812. return this.x = t.x, this.y = t.y, this
  30813. }, h.equals = function(t) {
  30814. return t && this.x === t.x && this.y === t.y
  30815. }, h.fuzzyEquals = function(t, e) {
  30816. return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e
  30817. }, h.toString = function() {
  30818. return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ")"
  30819. }, h.lerp = function(t, e, i) {
  30820. i = i || new l;
  30821. var n = this.x,
  30822. r = this.y;
  30823. return i.x = n + (t.x - n) * e, i.y = r + (t.y - r) * e, i
  30824. }, h.clampf = function(t, e) {
  30825. return this.x = a.clampf(this.x, t.x, e.x), this.y = a.clampf(this.y, t.y, e.y), this
  30826. }, h.addSelf = function(t) {
  30827. return this.x += t.x, this.y += t.y, this
  30828. }, h.add = function(t, e) {
  30829. return (e = e || new l).x = this.x + t.x, e.y = this.y + t.y, e
  30830. }, h.subSelf = function(t) {
  30831. return this.x -= t.x, this.y -= t.y, this
  30832. }, h.sub = function(t, e) {
  30833. return (e = e || new l).x = this.x - t.x, e.y = this.y - t.y, e
  30834. }, h.mulSelf = function(t) {
  30835. return this.x *= t, this.y *= t, this
  30836. }, h.mul = function(t, e) {
  30837. return (e = e || new l).x = this.x * t, e.y = this.y * t, e
  30838. }, h.scaleSelf = function(t) {
  30839. return this.x *= t.x, this.y *= t.y, this
  30840. }, h.scale = function(t, e) {
  30841. return (e = e || new l).x = this.x * t.x, e.y = this.y * t.y, e
  30842. }, h.divSelf = function(t) {
  30843. return this.x /= t, this.y /= t, this
  30844. }, h.div = function(t, e) {
  30845. return (e = e || new l).x = this.x / t, e.y = this.y / t, e
  30846. }, h.negSelf = function() {
  30847. return this.x = -this.x, this.y = -this.y, this
  30848. }, h.neg = function(t) {
  30849. return (t = t || new l).x = -this.x, t.y = -this.y, t
  30850. }, h.dot = function(t) {
  30851. return this.x * t.x + this.y * t.y
  30852. }, h.cross = function(t) {
  30853. return this.x * t.y - this.y * t.x
  30854. }, h.mag = function() {
  30855. return Math.sqrt(this.x * this.x + this.y * this.y)
  30856. }, h.magSqr = function() {
  30857. return this.x * this.x + this.y * this.y
  30858. }, h.normalizeSelf = function() {
  30859. var t = this.x * this.x + this.y * this.y;
  30860. if (1 === t) return this;
  30861. if (0 === t) return this;
  30862. var e = 1 / Math.sqrt(t);
  30863. return this.x *= e, this.y *= e, this
  30864. }, h.normalize = function(t) {
  30865. return (t = t || new l).x = this.x, t.y = this.y, t.normalizeSelf(), t
  30866. }, h.angle = function(t) {
  30867. var e = this.magSqr(),
  30868. i = t.magSqr();
  30869. if (0 === e || 0 === i) return console.warn("Can't get angle between zero vector"), 0;
  30870. var n = this.dot(t) / Math.sqrt(e * i);
  30871. return n = a.clampf(n, -1, 1), Math.acos(n)
  30872. }, h.signAngle = function(t) {
  30873. var e = this.angle(t);
  30874. return this.cross(t) < 0 ? -e : e
  30875. }, h.rotate = function(t, e) {
  30876. return (e = e || new l).x = this.x, e.y = this.y, e.rotateSelf(t)
  30877. }, h.rotateSelf = function(t) {
  30878. var e = Math.sin(t),
  30879. i = Math.cos(t),
  30880. n = this.x;
  30881. return this.x = i * n - e * this.y, this.y = e * n + i * this.y, this
  30882. }, h.project = function(t) {
  30883. return t.mul(this.dot(t) / t.dot(t))
  30884. }, h.transformMat4 = function(t, e) {
  30885. e = e || new l, n.vec2.transformMat4(e, this, t)
  30886. }, h.fromTranslation = function(t) {
  30887. return this.x = t[0], this.y = t[1], this
  30888. }, h.toTranslation = function(t) {
  30889. t[0] = this.x, t[1] = this.y
  30890. }, h.fromScale = function(t) {
  30891. return this.x = t[7], this.y = t[8], this
  30892. }, h.toScale = function(t) {
  30893. t[7] = this.x, t[8] = this.y
  30894. }, h.array = function(t) {
  30895. n.vec2.array(t, this)
  30896. }, s.get(l, "ONE", (function() {
  30897. return new l(1, 1)
  30898. })), s.get(l, "ZERO", (function() {
  30899. return new l(0, 0)
  30900. })), s.get(l, "UP", (function() {
  30901. return new l(0, 1)
  30902. })), s.get(l, "RIGHT", (function() {
  30903. return new l(1, 0)
  30904. })), cc.Vec2 = l, cc.v2 = function(t, e) {
  30905. return new l(t, e)
  30906. }, cc.p = cc.v2, e.exports = cc.Vec2
  30907. }), {
  30908. "../platform/CCClass": 198,
  30909. "../platform/js": 218,
  30910. "../utils/misc": 300,
  30911. "../vmath": 326,
  30912. "./value-type": 320
  30913. }],
  30914. 322: [(function(t, e, i) {
  30915. "use strict";
  30916. var n = t("../vmath"),
  30917. r = t("./value-type"),
  30918. s = t("../platform/js"),
  30919. o = t("../platform/CCClass"),
  30920. a = t("../utils/misc"),
  30921. l = t("./vec2").prototype;
  30922. function h(t, e, i) {
  30923. t && "object" == typeof t && (i = t.z, e = t.y, t = t.x), this.x = t || 0, this.y = e || 0, this.z = i || 0
  30924. }
  30925. s.extend(h, r), o.fastDefine("cc.Vec3", h, {
  30926. x: 0,
  30927. y: 0,
  30928. z: 0
  30929. });
  30930. var c = h.prototype;
  30931. c.clone = function() {
  30932. return new h(this.x, this.y, this.z)
  30933. }, c.set = function(t) {
  30934. return this.x = t.x, this.y = t.y, this.z = t.z, this
  30935. }, c.equals = function(t) {
  30936. return t && this.x === t.x && this.y === t.y && this.z === t.z
  30937. }, c.fuzzyEquals = function(t, e) {
  30938. return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e && this.z - e <= t.z && t.z <= this.z + e
  30939. }, c.toString = function() {
  30940. return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.z.toFixed(2) + ")"
  30941. }, c.lerp = function(t, e, i) {
  30942. return i = i || new h, n.vec3.lerp(i, this, t, e), i
  30943. }, c.clampf = function(t, e) {
  30944. return this.x = a.clampf(this.x, t.x, e.x), this.y = a.clampf(this.y, t.y, e.y), this.z = a.clampf(this.z, t.z, e.z), this
  30945. }, c.addSelf = function(t) {
  30946. return this.x += t.x, this.y += t.y, this.z += t.z, this
  30947. }, c.add = function(t, e) {
  30948. return (e = e || new h).x = this.x + t.x, e.y = this.y + t.y, e.z = this.z + t.z, e
  30949. }, c.subSelf = function(t) {
  30950. return this.x -= t.x, this.y -= t.y, this.z -= t.z, this
  30951. }, c.sub = function(t, e) {
  30952. return (e = e || new h).x = this.x - t.x, e.y = this.y - t.y, e.z = this.z - t.z, e
  30953. }, c.mulSelf = function(t) {
  30954. return this.x *= t, this.y *= t, this.z *= t, this
  30955. }, c.mul = function(t, e) {
  30956. return (e = e || new h).x = this.x * t, e.y = this.y * t, e.z = this.z * t, e
  30957. }, c.scaleSelf = function(t) {
  30958. return this.x *= t.x, this.y *= t.y, this.z *= t.z, this
  30959. }, c.scale = function(t, e) {
  30960. return (e = e || new h).x = this.x * t.x, e.y = this.y * t.y, e.z = this.z * t.z, e
  30961. }, c.divSelf = function(t) {
  30962. return this.x /= t, this.y /= t, this.z /= t, this
  30963. }, c.div = function(t, e) {
  30964. return (e = e || new h).x = this.x / t, e.y = this.y / t, e.z = this.z / t, e
  30965. }, c.negSelf = function() {
  30966. return this.x = -this.x, this.y = -this.y, this.z = -this.z, this
  30967. }, c.neg = function(t) {
  30968. return (t = t || new h).x = -this.x, t.y = -this.y, t.z = -this.z, t
  30969. }, c.dot = function(t) {
  30970. return this.x * t.x + this.y * t.y + this.z * t.z
  30971. }, c.cross = function(t, e) {
  30972. return e = e || new h, n.vec3.cross(e, this, t), e
  30973. }, c.mag = function() {
  30974. return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
  30975. }, c.magSqr = function() {
  30976. return this.x * this.x + this.y * this.y + this.z * this.z
  30977. }, c.normalizeSelf = function() {
  30978. return n.vec3.normalize(this, this), this
  30979. }, c.normalize = function(t) {
  30980. return t = t || new h, n.vec3.normalize(t, this), t
  30981. }, c.transformMat4 = function(t, e) {
  30982. e = e || new h, n.vec3.transformMat4(e, this, t)
  30983. }, c.angle = l.angle, c.project = l.project, c.signAngle = function(t) {
  30984. cc.warnID(1408, "vec3.signAngle", "v2.1", "cc.v2(selfVector).signAngle(vector)");
  30985. var e = new cc.Vec2(this.x, this.y),
  30986. i = new cc.Vec2(t.x, t.y);
  30987. return e.signAngle(i)
  30988. }, c.rotate = function(t, e) {
  30989. return cc.warnID(1408, "vec3.rotate", "v2.1", "cc.v2(selfVector).rotate(radians, out)"), l.rotate.call(this, t, e)
  30990. }, c.rotateSelf = function(t) {
  30991. return cc.warnID(1408, "vec3.rotateSelf", "v2.1", "cc.v2(selfVector).rotateSelf(radians)"), l.rotateSelf.call(this, t)
  30992. }, c.array = function(t) {
  30993. n.vec3.array(t, this)
  30994. }, s.get(h, "ONE", (function() {
  30995. return new h(1, 1, 1)
  30996. })), s.get(h, "ZERO", (function() {
  30997. return new h(0, 0, 0)
  30998. })), s.get(h, "UP", (function() {
  30999. return new h(0, 1, 0)
  31000. })), s.get(h, "RIGHT", (function() {
  31001. return new h(1, 0, 0)
  31002. })), s.get(h, "FRONT", (function() {
  31003. return new h(0, 0, 1)
  31004. })), cc.v3 = function(t, e, i) {
  31005. return new h(t, e, i)
  31006. }, e.exports = cc.Vec3 = h
  31007. }), {
  31008. "../platform/CCClass": 198,
  31009. "../platform/js": 218,
  31010. "../utils/misc": 300,
  31011. "../vmath": 326,
  31012. "./value-type": 320,
  31013. "./vec2": 321
  31014. }],
  31015. 323: [(function(t, e, i) {
  31016. "use strict";
  31017. var n = a(t("./value-type")),
  31018. r = a(t("../platform/CCClass")),
  31019. s = t("../vmath"),
  31020. o = t("../utils/misc");
  31021. function a(t) {
  31022. return t && t.__esModule ? t : {
  31023. default: t
  31024. }
  31025. }
  31026. function l(t, e) {
  31027. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31028. }
  31029. function h(t, e) {
  31030. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  31031. return !e || "object" != typeof e && "function" != typeof e ? t : e
  31032. }
  31033. function c(t, e) {
  31034. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  31035. t.prototype = Object.create(e && e.prototype, {
  31036. constructor: {
  31037. value: t,
  31038. enumerable: !1,
  31039. writable: !0,
  31040. configurable: !0
  31041. }
  31042. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  31043. }
  31044. var u = (function(t) {
  31045. function e(i, n, r, s) {
  31046. l(this, e);
  31047. var o = h(this, t.call(this));
  31048. return i && "object" == typeof i && (s = i.w, r = i.z, n = i.y, i = i.x), o.x = i || 0, o.y = n || 0, o.z = r || 0, o.w = s || 0, o
  31049. }
  31050. return c(e, t), e.prototype.clone = function() {
  31051. return new e(this.x, this.y, this.z, this.w)
  31052. }, e.prototype.set = function(t) {
  31053. return this.x = t.x, this.y = t.y, this.z = t.z, this.w = t.w, this
  31054. }, e.prototype.equals = function(t) {
  31055. return t && this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w
  31056. }, e.prototype.fuzzyEquals = function(t, e) {
  31057. return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e && this.z - e <= t.z && t.z <= this.z + e && this.w - e <= t.w && t.w <= this.w + e
  31058. }, e.prototype.toString = function() {
  31059. return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.z.toFixed(2) + ", " + this.w.toFixed(2) + ")"
  31060. }, e.prototype.lerp = function(t, i, n) {
  31061. return n = n || new e, s.vec4.lerp(n, this, t, i), n
  31062. }, e.prototype.clampf = function(t, e) {
  31063. return this.x = (0, o.clampf)(this.x, t.x, e.x), this.y = (0, o.clampf)(this.y, t.y, e.y), this.z = (0, o.clampf)(this.z, t.z, e.z), this.w = (0, o.clampf)(this.w, t.w, e.w), this
  31064. }, e.prototype.addSelf = function(t) {
  31065. return this.x += t.x, this.y += t.y, this.z += t.z, this.w += t.w, this
  31066. }, e.prototype.add = function(t, i) {
  31067. return (i = i || new e).x = this.x + t.x, i.y = this.y + t.y, i.z = this.z + t.z, i.w = this.w + t.w, i
  31068. }, e.prototype.subSelf = function(t) {
  31069. return this.x -= t.x, this.y -= t.y, this.z -= t.z, this.w -= t.w, this
  31070. }, e.prototype.sub = function(t, i) {
  31071. return (i = i || new e).x = this.x - t.x, i.y = this.y - t.y, i.z = this.z - t.z, i.w = this.w - t.w, i
  31072. }, e.prototype.mulSelf = function(t) {
  31073. return this.x *= t, this.y *= t, this.z *= t, this.w *= t, this
  31074. }, e.prototype.mul = function(t, i) {
  31075. return (i = i || new e).x = this.x * t, i.y = this.y * t, i.z = this.z * t, i.w = this.w * t, i
  31076. }, e.prototype.scaleSelf = function(t) {
  31077. return this.x *= t.x, this.y *= t.y, this.z *= t.z, this.w *= t.w, this
  31078. }, e.prototype.scale = function(t, i) {
  31079. return (i = i || new e).x = this.x * t.x, i.y = this.y * t.y, i.z = this.z * t.z, i.w = this.w * t.w, i
  31080. }, e.prototype.divSelf = function(t) {
  31081. return this.x /= t, this.y /= t, this.z /= t, this.w /= t, this
  31082. }, e.prototype.div = function(t, i) {
  31083. return (i = i || new e).x = this.x / t, i.y = this.y / t, i.z = this.z / t, i.w = this.w / t, i
  31084. }, e.prototype.negSelf = function() {
  31085. return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this
  31086. }, e.prototype.neg = function(t) {
  31087. return (t = t || new e).x = -this.x, t.y = -this.y, t.z = -this.z, t.w = -this.w, t
  31088. }, e.prototype.dot = function(t) {
  31089. return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w
  31090. }, e.prototype.cross = function(t, i) {
  31091. return i = i || new e, s.vec4.cross(i, this, t), i
  31092. }, e.prototype.mag = function() {
  31093. var t = this.x,
  31094. e = this.y,
  31095. i = this.z,
  31096. n = this.w;
  31097. return Math.sqrt(t * t + e * e + i * i + n * n)
  31098. }, e.prototype.magSqr = function() {
  31099. var t = this.x,
  31100. e = this.y,
  31101. i = this.z,
  31102. n = this.w;
  31103. return t * t + e * e + i * i + n * n
  31104. }, e.prototype.normalizeSelf = function() {
  31105. return s.vec4.normalize(this, this), this
  31106. }, e.prototype.normalize = function(t) {
  31107. return t = t || new e, s.vec4.normalize(t, this), t
  31108. }, e.prototype.transformMat4 = function(t, i) {
  31109. return i = i || new e, s.vec4.transformMat4(i, this, t), i
  31110. }, e.prototype.array = function(t) {
  31111. s.vec4.array(t, this)
  31112. }, e
  31113. })(n.default);
  31114. r.default.fastDefine("cc.Vec4", u, {
  31115. x: 0,
  31116. y: 0,
  31117. z: 0,
  31118. w: 0
  31119. }), cc.v4 = function(t, e, i, n) {
  31120. return new u(t, e, i, n)
  31121. }, e.exports = cc.Vec4 = u
  31122. }), {
  31123. "../platform/CCClass": 198,
  31124. "../utils/misc": 300,
  31125. "../vmath": 326,
  31126. "./value-type": 320
  31127. }],
  31128. 324: [(function(t, e, i) {
  31129. "use strict";
  31130. i.__esModule = !0;
  31131. var n = t("./utils");
  31132. function r(t, e) {
  31133. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31134. }
  31135. var s = (function() {
  31136. function t() {
  31137. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  31138. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
  31139. n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
  31140. r(this, t), this.r = e, this.g = i, this.b = n
  31141. }
  31142. return t.create = function() {
  31143. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1)
  31144. }, t.clone = function(e) {
  31145. return new t(e.r, e.g, e.b)
  31146. }, t.copy = function(t, e) {
  31147. return t.r = e.r, t.g = e.g, t.b = e.b, t
  31148. }, t.set = function(t, e, i, n) {
  31149. return t.r = e, t.g = i, t.b = n, t
  31150. }, t.fromHex = function(t, e) {
  31151. var i = (e >> 16) / 255,
  31152. n = (e >> 8 & 255) / 255,
  31153. r = (255 & e) / 255;
  31154. return t.r = i, t.g = n, t.b = r, t
  31155. }, t.add = function(t, e, i) {
  31156. return t.r = e.r + i.r, t.g = e.g + i.g, t.b = e.b + i.b, t
  31157. }, t.subtract = function(t, e, i) {
  31158. return t.r = e.r - i.r, t.g = e.g - i.g, t.b = e.b - i.b, t
  31159. }, t.sub = function(e, i, n) {
  31160. return t.subtract(e, i, n)
  31161. }, t.multiply = function(t, e, i) {
  31162. return t.r = e.r * i.r, t.g = e.g * i.g, t.b = e.b * i.b, t
  31163. }, t.mul = function(e, i, n) {
  31164. return t.multiply(e, i, n)
  31165. }, t.divide = function(t, e, i) {
  31166. return t.r = e.r / i.r, t.g = e.g / i.g, t.b = e.b / i.b, t
  31167. }, t.div = function(e, i, n) {
  31168. return t.divide(e, i, n)
  31169. }, t.scale = function(t, e, i) {
  31170. return t.r = e.r * i, t.g = e.g * i, t.b = e.b * i, t
  31171. }, t.lerp = function(t, e, i, n) {
  31172. var r = e.r,
  31173. s = e.g,
  31174. o = e.b;
  31175. return t.r = r + n * (i.r - r), t.g = s + n * (i.g - s), t.b = o + n * (i.b - o), t
  31176. }, t.str = function(t) {
  31177. return "color3(" + t.r + ", " + t.g + ", " + t.b + ")"
  31178. }, t.array = function(t, e) {
  31179. var i = e instanceof cc.Color ? 1 / 255 : 1;
  31180. return t[0] = e.r * i, t[1] = e.g * i, t[2] = e.b * i, t
  31181. }, t.exactEquals = function(t, e) {
  31182. return t.r === e.r && t.g === e.g && t.b === e.b
  31183. }, t.equals = function(t, e) {
  31184. var i = t.r,
  31185. r = t.g,
  31186. s = t.b,
  31187. o = e.r,
  31188. a = e.g,
  31189. l = e.b;
  31190. return Math.abs(i - o) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(r - a) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(a)) && Math.abs(s - l) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(l))
  31191. }, t.hex = function(t) {
  31192. return 255 * t.r << 16 | 255 * t.g << 8 | 255 * t.b
  31193. }, t
  31194. })();
  31195. i.default = s, e.exports = i.default
  31196. }), {
  31197. "./utils": 333
  31198. }],
  31199. 325: [(function(t, e, i) {
  31200. "use strict";
  31201. i.__esModule = !0;
  31202. var n = t("./utils");
  31203. function r(t, e) {
  31204. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31205. }
  31206. var s = (function() {
  31207. function t() {
  31208. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  31209. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
  31210. n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1,
  31211. s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
  31212. r(this, t), this.r = e, this.g = i, this.b = n, this.a = s
  31213. }
  31214. return t.create = function() {
  31215. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
  31216. }, t.clone = function(e) {
  31217. return new t(e.r, e.g, e.b, e.a)
  31218. }, t.copy = function(t, e) {
  31219. return t.r = e.r, t.g = e.g, t.b = e.b, t.a = e.a, t
  31220. }, t.set = function(t, e, i, n, r) {
  31221. return t.r = e, t.g = i, t.b = n, t.a = r, t
  31222. }, t.fromHex = function(t, e) {
  31223. var i = (e >> 24) / 255,
  31224. n = (e >> 16 & 255) / 255,
  31225. r = (e >> 8 & 255) / 255,
  31226. s = (255 & e) / 255;
  31227. return t.r = i, t.g = n, t.b = r, t.a = s, t
  31228. }, t.add = function(t, e, i) {
  31229. return t.r = e.r + i.r, t.g = e.g + i.g, t.b = e.b + i.b, t.a = e.a + i.a, t
  31230. }, t.subtract = function(t, e, i) {
  31231. return t.r = e.r - i.r, t.g = e.g - i.g, t.b = e.b - i.b, t.a = e.a - i.a, t
  31232. }, t.sub = function(e, i, n) {
  31233. return t.subtract(e, i, n)
  31234. }, t.multiply = function(t, e, i) {
  31235. return t.r = e.r * i.r, t.g = e.g * i.g, t.b = e.b * i.b, t.a = e.a * i.a, t
  31236. }, t.mul = function(e, i, n) {
  31237. return t.multiply(e, i, n)
  31238. }, t.divide = function(t, e, i) {
  31239. return t.r = e.r / i.r, t.g = e.g / i.g, t.b = e.b / i.b, t.a = e.a / i.a, t
  31240. }, t.div = function(e, i, n) {
  31241. return t.divide(e, i, n)
  31242. }, t.scale = function(t, e, i) {
  31243. return t.r = e.r * i, t.g = e.g * i, t.b = e.b * i, t.a = e.a * i, t
  31244. }, t.lerp = function(t, e, i, n) {
  31245. var r = e.r,
  31246. s = e.g,
  31247. o = e.b,
  31248. a = e.a;
  31249. return t.r = r + n * (i.r - r), t.g = s + n * (i.g - s), t.b = o + n * (i.b - o), t.a = a + n * (i.a - a), t
  31250. }, t.str = function(t) {
  31251. return "color4(" + t.r + ", " + t.g + ", " + t.b + ", " + t.a + ")"
  31252. }, t.array = function(t, e) {
  31253. var i = e instanceof cc.Color || e.a > 1 ? 1 / 255 : 1;
  31254. return t[0] = e.r * i, t[1] = e.g * i, t[2] = e.b * i, t[3] = e.a * i, t
  31255. }, t.exactEquals = function(t, e) {
  31256. return t.r === e.r && t.g === e.g && t.b === e.b && t.a === e.a
  31257. }, t.equals = function(t, e) {
  31258. var i = t.r,
  31259. r = t.g,
  31260. s = t.b,
  31261. o = t.a,
  31262. a = e.r,
  31263. l = e.g,
  31264. h = e.b,
  31265. c = e.a;
  31266. return Math.abs(i - a) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(a)) && Math.abs(r - l) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(s - h) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(o - c) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(c))
  31267. }, t.hex = function(t) {
  31268. return (255 * t.r << 24 | 255 * t.g << 16 | 255 * t.b << 8 | 255 * t.a) >>> 0
  31269. }, t
  31270. })();
  31271. i.default = s, e.exports = i.default
  31272. }), {
  31273. "./utils": 333
  31274. }],
  31275. 326: [(function(t, e, i) {
  31276. "use strict";
  31277. i.__esModule = !0, i.color4 = i.color3 = i.mat4 = i.mat3 = i.mat23 = i.mat2 = i.trs = i.quat = i.vec4 = i.vec3 = i.vec2 = void 0;
  31278. var n = t("./utils");
  31279. Object.keys(n).forEach((function(t) {
  31280. "default" !== t && "__esModule" !== t && Object.defineProperty(i, t, {
  31281. enumerable: !0,
  31282. get: function() {
  31283. return n[t]
  31284. }
  31285. })
  31286. }));
  31287. var r = p(t("./vec2")),
  31288. s = p(t("./vec3")),
  31289. o = p(t("./vec4")),
  31290. a = p(t("./quat")),
  31291. l = p(t("./trs")),
  31292. h = p(t("./mat2")),
  31293. c = p(t("./mat23")),
  31294. u = p(t("./mat3")),
  31295. _ = p(t("./mat4")),
  31296. f = p(t("./color3")),
  31297. d = p(t("./color4"));
  31298. function p(t) {
  31299. return t && t.__esModule ? t : {
  31300. default: t
  31301. }
  31302. }
  31303. i.vec2 = r.default, i.vec3 = s.default, i.vec4 = o.default, i.quat = a.default, i.trs = l.default, i.mat2 = h.default, i.mat23 = c.default, i.mat3 = u.default, i.mat4 = _.default, i.color3 = f.default, i.color4 = d.default, i.default = {
  31304. vec2: r.default,
  31305. vec3: s.default,
  31306. vec4: o.default,
  31307. quat: a.default,
  31308. trs: l.default,
  31309. mat2: h.default,
  31310. mat23: c.default,
  31311. mat3: u.default,
  31312. mat4: _.default,
  31313. color3: f.default,
  31314. color4: d.default
  31315. }
  31316. }), {
  31317. "./color3": 324,
  31318. "./color4": 325,
  31319. "./mat2": 327,
  31320. "./mat23": 328,
  31321. "./mat3": 329,
  31322. "./mat4": 330,
  31323. "./quat": 331,
  31324. "./trs": 332,
  31325. "./utils": 333,
  31326. "./vec2": 334,
  31327. "./vec3": 335,
  31328. "./vec4": 336
  31329. }],
  31330. 327: [(function(t, e, i) {
  31331. "use strict";
  31332. i.__esModule = !0;
  31333. var n = t("./utils");
  31334. function r(t, e) {
  31335. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31336. }
  31337. var s = (function() {
  31338. function t() {
  31339. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  31340. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  31341. s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  31342. o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
  31343. if (r(this, t), "object" == typeof e) i ? (this.m = new e.constructor(4), this.m.set(e)) : this.m = e;
  31344. else {
  31345. this.m = new n.FLOAT_ARRAY_TYPE(4);
  31346. var a = this.m;
  31347. a[0] = e, a[1] = i, a[2] = s, a[3] = o
  31348. }
  31349. }
  31350. return t.create = function() {
  31351. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
  31352. }, t.clone = function(e) {
  31353. var i = e.m;
  31354. return new t(i[0], i[1], i[2], i[3])
  31355. }, t.copy = function(t, e) {
  31356. return t.m.set(e.m), t
  31357. }, t.identity = function(t) {
  31358. var e = t.m;
  31359. return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, t
  31360. }, t.set = function(t, e, i, n, r) {
  31361. var s = t.m;
  31362. return s[0] = e, s[1] = i, s[2] = n, s[3] = r, t
  31363. }, t.transpose = function(t, e) {
  31364. var i = t.m,
  31365. n = e.m;
  31366. if (t === e) {
  31367. var r = n[1];
  31368. i[1] = n[2], i[2] = r
  31369. } else i[0] = n[0], i[1] = n[2], i[2] = n[1], i[3] = n[3];
  31370. return t
  31371. }, t.invert = function(t, e) {
  31372. var i = e.m,
  31373. n = t.m,
  31374. r = i[0],
  31375. s = i[1],
  31376. o = i[2],
  31377. a = i[3],
  31378. l = r * a - o * s;
  31379. return l ? (l = 1 / l, n[0] = a * l, n[1] = -s * l, n[2] = -o * l, n[3] = r * l, t) : null
  31380. }, t.adjoint = function(t, e) {
  31381. var i = t.m,
  31382. n = e.m,
  31383. r = n[0];
  31384. return i[0] = n[3], i[1] = -n[1], i[2] = -n[2], i[3] = r, t
  31385. }, t.determinant = function(t) {
  31386. var e = t.m;
  31387. return e[0] * e[3] - e[2] * e[1]
  31388. }, t.multiply = function(t, e, i) {
  31389. var n = e.m,
  31390. r = t.m,
  31391. s = n[0],
  31392. o = n[1],
  31393. a = n[2],
  31394. l = n[3],
  31395. h = bm[0],
  31396. c = bm[1],
  31397. u = bm[2],
  31398. _ = bm[3];
  31399. return r[0] = s * h + a * c, r[1] = o * h + l * c, r[2] = s * u + a * _, r[3] = o * u + l * _, t
  31400. }, t.mul = function(e, i, n) {
  31401. return t.multiply(e, i, n)
  31402. }, t.rotate = function(t, e, i) {
  31403. var n = e.m,
  31404. r = t.m,
  31405. s = n[0],
  31406. o = n[1],
  31407. a = n[2],
  31408. l = n[3],
  31409. h = Math.sin(i),
  31410. c = Math.cos(i);
  31411. return r[0] = s * c + a * h, r[1] = o * c + l * h, r[2] = s * -h + a * c, r[3] = o * -h + l * c, t
  31412. }, t.scale = function(t, e, i) {
  31413. var n = e.m,
  31414. r = t.m,
  31415. s = n[0],
  31416. o = n[1],
  31417. a = n[2],
  31418. l = n[3],
  31419. h = i.x,
  31420. c = i.y;
  31421. return r[0] = s * h, r[1] = o * h, r[2] = a * c, r[3] = l * c, t
  31422. }, t.fromRotation = function(t, e) {
  31423. var i = t.m,
  31424. n = Math.sin(e),
  31425. r = Math.cos(e);
  31426. return i[0] = r, i[1] = n, i[2] = -n, i[3] = r, t
  31427. }, t.fromScaling = function(t, e) {
  31428. var i = t.m;
  31429. return i[0] = e.x, i[1] = 0, i[2] = 0, i[3] = e.y, t
  31430. }, t.str = function(t) {
  31431. var e = t.m;
  31432. return "mat2(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ")"
  31433. }, t.array = function(t, e) {
  31434. var i = e.m;
  31435. return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t
  31436. }, t.frob = function(t) {
  31437. var e = t.m;
  31438. return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2))
  31439. }, t.LDU = function(t, e, i, n) {
  31440. var r = t.m,
  31441. s = i.m,
  31442. o = n.m;
  31443. r[2] = o[2] / o[0], s[0] = o[0], s[1] = o[1], s[3] = o[3] - r[2] * s[1]
  31444. }, t.add = function(t, e, i) {
  31445. var n = e.m,
  31446. r = i.m,
  31447. s = t.m;
  31448. return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], t
  31449. }, t.subtract = function(t, e, i) {
  31450. var n = e.m,
  31451. r = i.m,
  31452. s = t.m;
  31453. return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], t
  31454. }, t.sub = function(e, i, n) {
  31455. return t.subtract(e, i, n)
  31456. }, t.exactEquals = function(t, e) {
  31457. var i = t.m,
  31458. n = e.m;
  31459. return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3]
  31460. }, t.equals = function(t, e) {
  31461. var i = t.m,
  31462. r = e.m,
  31463. s = i[0],
  31464. o = i[1],
  31465. a = i[2],
  31466. l = i[3],
  31467. h = r[0],
  31468. c = r[1],
  31469. u = r[2],
  31470. _ = r[3];
  31471. return Math.abs(s - h) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(o - c) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(c)) && Math.abs(a - u) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(u)) && Math.abs(l - _) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(_))
  31472. }, t.multiplyScalar = function(t, e, i) {
  31473. var n = e.m,
  31474. r = t.m;
  31475. return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, t
  31476. }, t.multiplyScalarAndAdd = function(t, e, i, n) {
  31477. var r = e.m,
  31478. s = i.m,
  31479. o = t.m;
  31480. return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, t
  31481. }, t
  31482. })();
  31483. i.default = s, e.exports = i.default
  31484. }), {
  31485. "./utils": 333
  31486. }],
  31487. 328: [(function(t, e, i) {
  31488. "use strict";
  31489. i.__esModule = !0;
  31490. var n = t("./utils");
  31491. function r(t, e) {
  31492. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31493. }
  31494. var s = (function() {
  31495. function t() {
  31496. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  31497. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  31498. s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  31499. o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1,
  31500. a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0,
  31501. l = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0;
  31502. if (r(this, t), "object" == typeof e) i ? (this.m = new e.constructor(6), this.m.set(e)) : this.m = e;
  31503. else {
  31504. this.m = new n.FLOAT_ARRAY_TYPE(6);
  31505. var h = this.m;
  31506. h[0] = e, h[1] = i, h[2] = s, h[3] = o, h[4] = a, h[5] = l
  31507. }
  31508. }
  31509. return t.create = function() {
  31510. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0)
  31511. }, t.clone = function(e) {
  31512. var i = e.m;
  31513. return new t(i[0], i[1], i[2], i[3], i[4], i[5])
  31514. }, t.copy = function(t, e) {
  31515. return t.m.set(e.m), t
  31516. }, t.identity = function(t) {
  31517. var e = t.m;
  31518. return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = 0, e[5] = 0, t
  31519. }, t.set = function(t, e, i, n, r, s, o) {
  31520. var a = t.m;
  31521. return a[0] = e, a[1] = i, a[2] = n, a[3] = r, a[4] = s, a[5] = o, t
  31522. }, t.invert = function(t, e) {
  31523. var i = e.m,
  31524. n = t.m,
  31525. r = i[0],
  31526. s = i[1],
  31527. o = i[2],
  31528. a = i[3],
  31529. l = i[4],
  31530. h = i[5],
  31531. c = r * a - s * o;
  31532. return c ? (c = 1 / c, n[0] = a * c, n[1] = -s * c, n[2] = -o * c, n[3] = r * c, n[4] = (o * h - a * l) * c, n[5] = (s * l - r * h) * c, t) : null
  31533. }, t.determinant = function(t) {
  31534. var e = t.m;
  31535. return e[0] * e[3] - e[1] * e[2]
  31536. }, t.multiply = function(t, e, i) {
  31537. var n = e.m,
  31538. r = i.m,
  31539. s = t.m,
  31540. o = n[0],
  31541. a = n[1],
  31542. l = n[2],
  31543. h = n[3],
  31544. c = n[4],
  31545. u = n[5],
  31546. _ = r[0],
  31547. f = r[1],
  31548. d = r[2],
  31549. p = r[3],
  31550. m = r[4],
  31551. y = r[5];
  31552. return s[0] = o * _ + l * f, s[1] = a * _ + h * f, s[2] = o * d + l * p, s[3] = a * d + h * p, s[4] = o * m + l * y + c, s[5] = a * m + h * y + u, t
  31553. }, t.mul = function(e, i, n) {
  31554. return t.multiply(e, i, n)
  31555. }, t.rotate = function(t, e, i) {
  31556. var n = e.m,
  31557. r = t.m,
  31558. s = n[0],
  31559. o = n[1],
  31560. a = n[2],
  31561. l = n[3],
  31562. h = n[4],
  31563. c = n[5],
  31564. u = Math.sin(i),
  31565. _ = Math.cos(i);
  31566. return r[0] = s * _ + a * u, r[1] = o * _ + l * u, r[2] = s * -u + a * _, r[3] = o * -u + l * _, r[4] = h, r[5] = c, t
  31567. }, t.scale = function(t, e, i) {
  31568. var n = e.m,
  31569. r = t.m,
  31570. s = n[0],
  31571. o = n[1],
  31572. a = n[2],
  31573. l = n[3],
  31574. h = n[4],
  31575. c = n[5],
  31576. u = i.x,
  31577. _ = i.y;
  31578. return r[0] = s * u, r[1] = o * u, r[2] = a * _, r[3] = l * _, r[4] = h, r[5] = c, t
  31579. }, t.translate = function(t, e, i) {
  31580. var n = e.m,
  31581. r = t.m,
  31582. s = n[0],
  31583. o = n[1],
  31584. a = n[2],
  31585. l = n[3],
  31586. h = n[4],
  31587. c = n[5],
  31588. u = i.x,
  31589. _ = i.y;
  31590. return r[0] = s, r[1] = o, r[2] = a, r[3] = l, r[4] = s * u + a * _ + h, r[5] = o * u + l * _ + c, t
  31591. }, t.fromRotation = function(t, e) {
  31592. var i = t.m,
  31593. n = Math.sin(e),
  31594. r = Math.cos(e);
  31595. return i[0] = r, i[1] = n, i[2] = -n, i[3] = r, i[4] = 0, i[5] = 0, t
  31596. }, t.fromScaling = function(t, e) {
  31597. var i = e.m,
  31598. n = t.m;
  31599. return n[0] = i[0], n[1] = 0, n[2] = 0, n[3] = i[1], n[4] = 0, n[5] = 0, t
  31600. }, t.fromTranslation = function(t, e) {
  31601. var i = t.m;
  31602. return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 1, i[4] = e.x, i[5] = e.y, t
  31603. }, t.fromRTS = function(t, e, i, n) {
  31604. var r = t.m,
  31605. s = Math.sin(e),
  31606. o = Math.cos(e);
  31607. return r[0] = o * n.x, r[1] = s * n.x, r[2] = -s * n.y, r[3] = o * n.y, r[4] = i.x, r[5] = i.y, t
  31608. }, t.str = function(t) {
  31609. var e = t.m;
  31610. return "mat23(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ", " + e[4] + ", " + e[5] + ")"
  31611. }, t.array = function(t, e) {
  31612. var i = e.m;
  31613. return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t
  31614. }, t.array4x4 = function(t, e) {
  31615. var i = e.m;
  31616. return t[0] = i[0], t[1] = i[1], t[2] = 0, t[3] = 0, t[4] = i[2], t[5] = i[3], t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = i[4], t[13] = i[5], t[14] = 0, t[15] = 1, t
  31617. }, t.frob = function(t) {
  31618. var e = t.m;
  31619. return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + 1)
  31620. }, t.add = function(t, e, i) {
  31621. var n = e.m,
  31622. r = i.m,
  31623. s = t.m;
  31624. return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], s[4] = n[4] + r[4], s[5] = n[5] + r[5], t
  31625. }, t.subtract = function(t, e, i) {
  31626. var n = e.m,
  31627. r = i.m,
  31628. s = t.m;
  31629. return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], s[4] = n[4] - r[4], s[5] = n[5] - r[5], t
  31630. }, t.sub = function(e, i, n) {
  31631. return t.subtract(e, i, n)
  31632. }, t.multiplyScalar = function(t, e, i) {
  31633. var n = e.m,
  31634. r = t.m;
  31635. return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, r[4] = n[4] * i, r[5] = n[5] * i, t
  31636. }, t.multiplyScalarAndAdd = function(t, e, i, n) {
  31637. var r = e.m,
  31638. s = i.m,
  31639. o = t.m;
  31640. return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, o[4] = r[4] + s[4] * n, o[5] = r[5] + s[5] * n, t
  31641. }, t.exactEquals = function(t, e) {
  31642. var i = t.m,
  31643. n = e.m;
  31644. return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5]
  31645. }, t.equals = function(t, e) {
  31646. var i = t.m,
  31647. r = e.m,
  31648. s = i[0],
  31649. o = i[1],
  31650. a = i[2],
  31651. l = i[3],
  31652. h = i[4],
  31653. c = i[5],
  31654. u = r[0],
  31655. _ = r[1],
  31656. f = r[2],
  31657. d = r[3],
  31658. p = r[4],
  31659. m = r[5];
  31660. return Math.abs(s - u) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(u)) && Math.abs(o - _) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(_)) && Math.abs(a - f) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(f)) && Math.abs(l - d) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(d)) && Math.abs(h - p) <= n.EPSILON * Math.max(1, Math.abs(h), Math.abs(p)) && Math.abs(c - m) <= n.EPSILON * Math.max(1, Math.abs(c), Math.abs(m))
  31661. }, t
  31662. })();
  31663. i.default = s, e.exports = i.default
  31664. }), {
  31665. "./utils": 333
  31666. }],
  31667. 329: [(function(t, e, i) {
  31668. "use strict";
  31669. i.__esModule = !0;
  31670. var n = t("./utils"),
  31671. r = (function(t) {
  31672. return t && t.__esModule ? t : {
  31673. default: t
  31674. }
  31675. })(t("./vec3"));
  31676. function s(t, e) {
  31677. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31678. }
  31679. var o = (function() {
  31680. function t() {
  31681. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  31682. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  31683. r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  31684. o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
  31685. a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 1,
  31686. l = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0,
  31687. h = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0,
  31688. c = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0,
  31689. u = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 1;
  31690. if (s(this, t), "object" == typeof e) i ? (this.m = new e.constructor(9), this.m.set(e)) : this.m = e;
  31691. else {
  31692. this.m = new n.FLOAT_ARRAY_TYPE(9);
  31693. var _ = this.m;
  31694. _[0] = e, _[1] = i, _[2] = r, _[3] = o, _[4] = a, _[5] = l, _[6] = h, _[7] = c, _[8] = u
  31695. }
  31696. }
  31697. return t.create = function() {
  31698. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 1, arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0, arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0, arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0, arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 1)
  31699. }, t.clone = function(e) {
  31700. var i = e.m;
  31701. return new t(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8])
  31702. }, t.copy = function(t, e) {
  31703. return t.m.set(e.m), t
  31704. }, t.set = function(t, e, i, n, r, s, o, a, l, h) {
  31705. var c = t.m;
  31706. return c[0] = e, c[1] = i, c[2] = n, c[3] = r, c[4] = s, c[5] = o, c[6] = a, c[7] = l, c[8] = h, t
  31707. }, t.identity = function(t) {
  31708. var e = t.m;
  31709. return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, t
  31710. }, t.transpose = function(t, e) {
  31711. var i = e.m,
  31712. n = t.m;
  31713. if (t === e) {
  31714. var r = i[1],
  31715. s = i[2],
  31716. o = i[5];
  31717. n[1] = i[3], n[2] = i[6], n[3] = r, n[5] = i[7], n[6] = s, n[7] = o
  31718. } else n[0] = i[0], n[1] = i[3], n[2] = i[6], n[3] = i[1], n[4] = i[4], n[5] = i[7], n[6] = i[2], n[7] = i[5], n[8] = i[8];
  31719. return t
  31720. }, t.invert = function(t, e) {
  31721. var i = e.m,
  31722. n = t.m,
  31723. r = i[0],
  31724. s = i[1],
  31725. o = i[2],
  31726. a = i[3],
  31727. l = i[4],
  31728. h = i[5],
  31729. c = i[6],
  31730. u = i[7],
  31731. _ = i[8],
  31732. f = _ * l - h * u,
  31733. d = -_ * a + h * c,
  31734. p = u * a - l * c,
  31735. m = r * f + s * d + o * p;
  31736. return m ? (m = 1 / m, n[0] = f * m, n[1] = (-_ * s + o * u) * m, n[2] = (h * s - o * l) * m, n[3] = d * m, n[4] = (_ * r - o * c) * m, n[5] = (-h * r + o * a) * m, n[6] = p * m, n[7] = (-u * r + s * c) * m, n[8] = (l * r - s * a) * m, t) : null
  31737. }, t.adjoint = function(t, e) {
  31738. var i = e.m,
  31739. n = t.m,
  31740. r = i[0],
  31741. s = i[1],
  31742. o = i[2],
  31743. a = i[3],
  31744. l = i[4],
  31745. h = i[5],
  31746. c = i[6],
  31747. u = i[7],
  31748. _ = i[8];
  31749. return n[0] = l * _ - h * u, n[1] = o * u - s * _, n[2] = s * h - o * l, n[3] = h * c - a * _, n[4] = r * _ - o * c, n[5] = o * a - r * h, n[6] = a * u - l * c, n[7] = s * c - r * u, n[8] = r * l - s * a, t
  31750. }, t.determinant = function(t) {
  31751. var e = t.m,
  31752. i = e[0],
  31753. n = e[1],
  31754. r = e[2],
  31755. s = e[3],
  31756. o = e[4],
  31757. a = e[5],
  31758. l = e[6],
  31759. h = e[7],
  31760. c = e[8];
  31761. return i * (c * o - a * h) + n * (-c * s + a * l) + r * (h * s - o * l)
  31762. }, t.multiply = function(t, e, i) {
  31763. var n = e.m,
  31764. r = i.m,
  31765. s = t.m,
  31766. o = n[0],
  31767. a = n[1],
  31768. l = n[2],
  31769. h = n[3],
  31770. c = n[4],
  31771. u = n[5],
  31772. _ = n[6],
  31773. f = n[7],
  31774. d = n[8],
  31775. p = r[0],
  31776. m = r[1],
  31777. y = r[2],
  31778. v = r[3],
  31779. g = r[4],
  31780. x = r[5],
  31781. b = r[6],
  31782. A = r[7],
  31783. C = r[8];
  31784. return s[0] = p * o + m * h + y * _, s[1] = p * a + m * c + y * f, s[2] = p * l + m * u + y * d, s[3] = v * o + g * h + x * _, s[4] = v * a + g * c + x * f, s[5] = v * l + g * u + x * d, s[6] = b * o + A * h + C * _, s[7] = b * a + A * c + C * f, s[8] = b * l + A * u + C * d, t
  31785. }, t.mul = function(e, i, n) {
  31786. return t.multiply(e, i, n)
  31787. }, t.translate = function(t, e, i) {
  31788. var n = e.m,
  31789. r = t.m,
  31790. s = n[0],
  31791. o = n[1],
  31792. a = n[2],
  31793. l = n[3],
  31794. h = n[4],
  31795. c = n[5],
  31796. u = n[6],
  31797. _ = n[7],
  31798. f = n[8],
  31799. d = i.x,
  31800. p = i.y;
  31801. return r[0] = s, r[1] = o, r[2] = a, r[3] = l, r[4] = h, r[5] = c, r[6] = d * s + p * l + u, r[7] = d * o + p * h + _, r[8] = d * a + p * c + f, t
  31802. }, t.rotate = function(t, e, i) {
  31803. var n = e.m,
  31804. r = t.m,
  31805. s = n[0],
  31806. o = n[1],
  31807. a = n[2],
  31808. l = n[3],
  31809. h = n[4],
  31810. c = n[5],
  31811. u = n[6],
  31812. _ = n[7],
  31813. f = n[8],
  31814. d = Math.sin(i),
  31815. p = Math.cos(i);
  31816. return r[0] = p * s + d * l, r[1] = p * o + d * h, r[2] = p * a + d * c, r[3] = p * l - d * s, r[4] = p * h - d * o, r[5] = p * c - d * a, r[6] = u, r[7] = _, r[8] = f, t
  31817. }, t.scale = function(t, e, i) {
  31818. var n = i.x,
  31819. r = i.y,
  31820. s = e.m,
  31821. o = t.m;
  31822. return o[0] = n * s[0], o[1] = n * s[1], o[2] = n * s[2], o[3] = r * s[3], o[4] = r * s[4], o[5] = r * s[5], o[6] = s[6], o[7] = s[7], o[8] = s[8], t
  31823. }, t.fromMat4 = function(t, e) {
  31824. var i = e.m,
  31825. n = t.m;
  31826. return n[0] = i[0], n[1] = i[1], n[2] = i[2], n[3] = i[4], n[4] = i[5], n[5] = i[6], n[6] = i[8], n[7] = i[9], n[8] = i[10], t
  31827. }, t.fromTranslation = function(t, e) {
  31828. var i = t.m;
  31829. return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 1, i[5] = 0, i[6] = e.x, i[7] = e.y, i[8] = 1, t
  31830. }, t.fromRotation = function(t, e) {
  31831. var i = Math.sin(e),
  31832. n = Math.cos(e),
  31833. r = t.m;
  31834. return r[0] = n, r[1] = i, r[2] = 0, r[3] = -i, r[4] = n, r[5] = 0, r[6] = 0, r[7] = 0, r[8] = 1, t
  31835. }, t.fromScaling = function(t, e) {
  31836. var i = t.m;
  31837. return i[0] = e.x, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = e.y, i[5] = 0, i[6] = 0, i[7] = 0, i[8] = 1, t
  31838. }, t.fromMat2d = function(t, e) {
  31839. var i = e.m,
  31840. n = t.m;
  31841. return n[0] = i[0], n[1] = i[1], n[2] = 0, n[3] = i[2], n[4] = i[3], n[5] = 0, n[6] = i[4], n[7] = i[5], n[8] = 1, t
  31842. }, t.fromQuat = function(t, e) {
  31843. var i = t.m,
  31844. n = e.x,
  31845. r = e.y,
  31846. s = e.z,
  31847. o = e.w,
  31848. a = n + n,
  31849. l = r + r,
  31850. h = s + s,
  31851. c = n * a,
  31852. u = r * a,
  31853. _ = r * l,
  31854. f = s * a,
  31855. d = s * l,
  31856. p = s * h,
  31857. m = o * a,
  31858. y = o * l,
  31859. v = o * h;
  31860. return i[0] = 1 - _ - p, i[3] = u - v, i[6] = f + y, i[1] = u + v, i[4] = 1 - c - p, i[7] = d - m, i[2] = f - y, i[5] = d + m, i[8] = 1 - c - _, t
  31861. }, t.fromViewUp = function(e, i, s) {
  31862. return (function() {
  31863. var e = r.default.create(0, 1, 0),
  31864. i = r.default.create(0, 0, 0),
  31865. s = r.default.create(0, 0, 0);
  31866. return function(o, a, l) {
  31867. return r.default.sqrMag(a) < n.EPSILON * n.EPSILON ? (t.identity(o), o) : (l = l || e, r.default.normalize(i, r.default.cross(i, l, a)), r.default.sqrMag(i) < n.EPSILON * n.EPSILON ? (t.identity(o), o) : (r.default.cross(s, a, i), t.set(o, i.x, i.y, i.z, s.x, s.y, s.z, a.x, a.y, a.z), o))
  31868. }
  31869. })()(e, i, s)
  31870. }, t.normalFromMat4 = function(t, e) {
  31871. var i = e.m,
  31872. n = t.m,
  31873. r = i[0],
  31874. s = i[1],
  31875. o = i[2],
  31876. a = i[3],
  31877. l = i[4],
  31878. h = i[5],
  31879. c = i[6],
  31880. u = i[7],
  31881. _ = i[8],
  31882. f = i[9],
  31883. d = i[10],
  31884. p = i[11],
  31885. m = i[12],
  31886. y = i[13],
  31887. v = i[14],
  31888. g = i[15],
  31889. x = r * h - s * l,
  31890. b = r * c - o * l,
  31891. A = r * u - a * l,
  31892. C = s * c - o * h,
  31893. T = s * u - a * h,
  31894. S = o * u - a * c,
  31895. w = _ * y - f * m,
  31896. E = _ * v - d * m,
  31897. M = _ * g - p * m,
  31898. D = f * v - d * y,
  31899. B = f * g - p * y,
  31900. I = d * g - p * v,
  31901. P = x * I - b * B + A * D + C * M - T * E + S * w;
  31902. return P ? (P = 1 / P, n[0] = (h * I - c * B + u * D) * P, n[1] = (c * M - l * I - u * E) * P, n[2] = (l * B - h * M + u * w) * P, n[3] = (o * B - s * I - a * D) * P, n[4] = (r * I - o * M + a * E) * P, n[5] = (s * M - r * B - a * w) * P, n[6] = (y * S - v * T + g * C) * P, n[7] = (v * A - m * S - g * b) * P, n[8] = (m * T - y * A + g * x) * P, t) : null
  31903. }, t.str = function(t) {
  31904. var e = t.m;
  31905. return "mat3(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ", " + e[4] + ", " + e[5] + ", " + e[6] + ", " + e[7] + ", " + e[8] + ")"
  31906. }, t.array = function(t, e) {
  31907. var i = e.m;
  31908. return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t
  31909. }, t.frob = function(t) {
  31910. var e = t.m;
  31911. return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + Math.pow(e[6], 2) + Math.pow(e[7], 2) + Math.pow(e[8], 2))
  31912. }, t.add = function(t, e, i) {
  31913. var n = e.m,
  31914. r = i.m,
  31915. s = t.m;
  31916. return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], s[4] = n[4] + r[4], s[5] = n[5] + r[5], s[6] = n[6] + r[6], s[7] = n[7] + r[7], s[8] = n[8] + r[8], t
  31917. }, t.subtract = function(t, e, i) {
  31918. var n = e.m,
  31919. r = i.m,
  31920. s = t.m;
  31921. return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], s[4] = n[4] - r[4], s[5] = n[5] - r[5], s[6] = n[6] - r[6], s[7] = n[7] - r[7], s[8] = n[8] - r[8], t
  31922. }, t.sub = function(e, i, n) {
  31923. return t.subtract(e, i, n)
  31924. }, t.multiplyScalar = function(t, e, i) {
  31925. var n = e.m,
  31926. r = t.m;
  31927. return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, r[4] = n[4] * i, r[5] = n[5] * i, r[6] = n[6] * i, r[7] = n[7] * i, r[8] = n[8] * i, t
  31928. }, t.multiplyScalarAndAdd = function(t, e, i, n) {
  31929. var r = e.m,
  31930. s = i.m,
  31931. o = t.m;
  31932. return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, o[4] = r[4] + s[4] * n, o[5] = r[5] + s[5] * n, o[6] = r[6] + s[6] * n, o[7] = r[7] + s[7] * n, o[8] = r[8] + s[8] * n, t
  31933. }, t.exactEquals = function(t, e) {
  31934. var i = t.m,
  31935. n = e.m;
  31936. return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8]
  31937. }, t.equals = function(t, e) {
  31938. var i = t.m,
  31939. r = e.m,
  31940. s = i[0],
  31941. o = i[1],
  31942. a = i[2],
  31943. l = i[3],
  31944. h = i[4],
  31945. c = i[5],
  31946. u = i[6],
  31947. _ = i[7],
  31948. f = i[8],
  31949. d = r[0],
  31950. p = r[1],
  31951. m = r[2],
  31952. y = r[3],
  31953. v = r[4],
  31954. g = r[5],
  31955. x = r[6],
  31956. b = r[7],
  31957. A = r[8];
  31958. return Math.abs(s - d) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(o - p) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(p)) && Math.abs(a - m) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(m)) && Math.abs(l - y) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(y)) && Math.abs(h - v) <= n.EPSILON * Math.max(1, Math.abs(h), Math.abs(v)) && Math.abs(c - g) <= n.EPSILON * Math.max(1, Math.abs(c), Math.abs(g)) && Math.abs(u - x) <= n.EPSILON * Math.max(1, Math.abs(u), Math.abs(x)) && Math.abs(_ - b) <= n.EPSILON * Math.max(1, Math.abs(_), Math.abs(b)) && Math.abs(f - A) <= n.EPSILON * Math.max(1, Math.abs(f), Math.abs(A))
  31959. }, t
  31960. })();
  31961. i.default = o, e.exports = i.default
  31962. }), {
  31963. "./utils": 333,
  31964. "./vec3": 335
  31965. }],
  31966. 330: [(function(t, e, i) {
  31967. "use strict";
  31968. i.__esModule = !0;
  31969. var n = t("./utils");
  31970. function r(t, e) {
  31971. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  31972. }
  31973. var s = (function() {
  31974. function t() {
  31975. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
  31976. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  31977. s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  31978. o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
  31979. a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0,
  31980. l = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 1,
  31981. h = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0,
  31982. c = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0,
  31983. u = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 0,
  31984. _ = arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0,
  31985. f = arguments.length > 10 && void 0 !== arguments[10] ? arguments[10] : 1,
  31986. d = arguments.length > 11 && void 0 !== arguments[11] ? arguments[11] : 0,
  31987. p = arguments.length > 12 && void 0 !== arguments[12] ? arguments[12] : 0,
  31988. m = arguments.length > 13 && void 0 !== arguments[13] ? arguments[13] : 0,
  31989. y = arguments.length > 14 && void 0 !== arguments[14] ? arguments[14] : 0,
  31990. v = arguments.length > 15 && void 0 !== arguments[15] ? arguments[15] : 1;
  31991. if (r(this, t), "object" == typeof e) i ? (this.m = new e.constructor(16), this.m.set(e)) : this.m = e;
  31992. else {
  31993. this.m = new n.FLOAT_ARRAY_TYPE(16);
  31994. var g = this.m;
  31995. g[0] = e, g[1] = i, g[2] = s, g[3] = o, g[4] = a, g[5] = l, g[6] = h, g[7] = c, g[8] = u, g[9] = _, g[10] = f, g[11] = d, g[12] = p, g[13] = m, g[14] = y, g[15] = v
  31996. }
  31997. }
  31998. return t.create = function() {
  31999. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 1, arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 0, arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0, arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 0, arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0, arguments.length > 10 && void 0 !== arguments[10] ? arguments[10] : 1, arguments.length > 11 && void 0 !== arguments[11] ? arguments[11] : 0, arguments.length > 12 && void 0 !== arguments[12] ? arguments[12] : 0, arguments.length > 13 && void 0 !== arguments[13] ? arguments[13] : 0, arguments.length > 14 && void 0 !== arguments[14] ? arguments[14] : 0, arguments.length > 15 && void 0 !== arguments[15] ? arguments[15] : 1)
  32000. }, t.clone = function(e) {
  32001. var i = e.m;
  32002. return new t(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8], i[9], i[10], i[11], i[12], i[13], i[14], i[15])
  32003. }, t.copy = function(t, e) {
  32004. return t.m.set(e.m), t
  32005. }, t.set = function(t, e, i, n, r, s, o, a, l, h, c, u, _, f, d, p, m) {
  32006. var y = t.m;
  32007. return y[0] = e, y[1] = i, y[2] = n, y[3] = r, y[4] = s, y[5] = o, y[6] = a, y[7] = l, y[8] = h, y[9] = c, y[10] = u, y[11] = _, y[12] = f, y[13] = d, y[14] = p, y[15] = m, t
  32008. }, t.identity = function(t) {
  32009. var e = t.m;
  32010. return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, t
  32011. }, t.transpose = function(t, e) {
  32012. var i = e.m,
  32013. n = t.m;
  32014. if (t === e) {
  32015. var r = i[1],
  32016. s = i[2],
  32017. o = i[3],
  32018. a = i[6],
  32019. l = i[7],
  32020. h = i[11];
  32021. n[1] = i[4], n[2] = i[8], n[3] = i[12], n[4] = r, n[6] = i[9], n[7] = i[13], n[8] = s, n[9] = a, n[11] = i[14], n[12] = o, n[13] = l, n[14] = h
  32022. } else n[0] = i[0], n[1] = i[4], n[2] = i[8], n[3] = i[12], n[4] = i[1], n[5] = i[5], n[6] = i[9], n[7] = i[13], n[8] = i[2], n[9] = i[6], n[10] = i[10], n[11] = i[14], n[12] = i[3], n[13] = i[7], n[14] = i[11], n[15] = i[15];
  32023. return t
  32024. }, t.invert = function(t, e) {
  32025. var i = e.m,
  32026. n = t.m,
  32027. r = i[0],
  32028. s = i[1],
  32029. o = i[2],
  32030. a = i[3],
  32031. l = i[4],
  32032. h = i[5],
  32033. c = i[6],
  32034. u = i[7],
  32035. _ = i[8],
  32036. f = i[9],
  32037. d = i[10],
  32038. p = i[11],
  32039. m = i[12],
  32040. y = i[13],
  32041. v = i[14],
  32042. g = i[15],
  32043. x = r * h - s * l,
  32044. b = r * c - o * l,
  32045. A = r * u - a * l,
  32046. C = s * c - o * h,
  32047. T = s * u - a * h,
  32048. S = o * u - a * c,
  32049. w = _ * y - f * m,
  32050. E = _ * v - d * m,
  32051. M = _ * g - p * m,
  32052. D = f * v - d * y,
  32053. B = f * g - p * y,
  32054. I = d * g - p * v,
  32055. P = x * I - b * B + A * D + C * M - T * E + S * w;
  32056. return P ? (P = 1 / P, n[0] = (h * I - c * B + u * D) * P, n[1] = (o * B - s * I - a * D) * P, n[2] = (y * S - v * T + g * C) * P, n[3] = (d * T - f * S - p * C) * P, n[4] = (c * M - l * I - u * E) * P, n[5] = (r * I - o * M + a * E) * P, n[6] = (v * A - m * S - g * b) * P, n[7] = (_ * S - d * A + p * b) * P, n[8] = (l * B - h * M + u * w) * P, n[9] = (s * M - r * B - a * w) * P, n[10] = (m * T - y * A + g * x) * P, n[11] = (f * A - _ * T - p * x) * P, n[12] = (h * E - l * D - c * w) * P, n[13] = (r * D - s * E + o * w) * P, n[14] = (y * b - m * C - v * x) * P, n[15] = (_ * C - f * b + d * x) * P, t) : null
  32057. }, t.adjoint = function(t, e) {
  32058. var i = e.m,
  32059. n = t.m,
  32060. r = i[0],
  32061. s = i[1],
  32062. o = i[2],
  32063. a = i[3],
  32064. l = i[4],
  32065. h = i[5],
  32066. c = i[6],
  32067. u = i[7],
  32068. _ = i[8],
  32069. f = i[9],
  32070. d = i[10],
  32071. p = i[11],
  32072. m = i[12],
  32073. y = i[13],
  32074. v = i[14],
  32075. g = i[15];
  32076. return n[0] = h * (d * g - p * v) - f * (c * g - u * v) + y * (c * p - u * d), n[1] = -(s * (d * g - p * v) - f * (o * g - a * v) + y * (o * p - a * d)), n[2] = s * (c * g - u * v) - h * (o * g - a * v) + y * (o * u - a * c), n[3] = -(s * (c * p - u * d) - h * (o * p - a * d) + f * (o * u - a * c)), n[4] = -(l * (d * g - p * v) - _ * (c * g - u * v) + m * (c * p - u * d)), n[5] = r * (d * g - p * v) - _ * (o * g - a * v) + m * (o * p - a * d), n[6] = -(r * (c * g - u * v) - l * (o * g - a * v) + m * (o * u - a * c)), n[7] = r * (c * p - u * d) - l * (o * p - a * d) + _ * (o * u - a * c), n[8] = l * (f * g - p * y) - _ * (h * g - u * y) + m * (h * p - u * f), n[9] = -(r * (f * g - p * y) - _ * (s * g - a * y) + m * (s * p - a * f)), n[10] = r * (h * g - u * y) - l * (s * g - a * y) + m * (s * u - a * h), n[11] = -(r * (h * p - u * f) - l * (s * p - a * f) + _ * (s * u - a * h)), n[12] = -(l * (f * v - d * y) - _ * (h * v - c * y) + m * (h * d - c * f)), n[13] = r * (f * v - d * y) - _ * (s * v - o * y) + m * (s * d - o * f), n[14] = -(r * (h * v - c * y) - l * (s * v - o * y) + m * (s * c - o * h)), n[15] = r * (h * d - c * f) - l * (s * d - o * f) + _ * (s * c - o * h), t
  32077. }, t.determinant = function(t) {
  32078. var e = t.m,
  32079. i = e[0],
  32080. n = e[1],
  32081. r = e[2],
  32082. s = e[3],
  32083. o = e[4],
  32084. a = e[5],
  32085. l = e[6],
  32086. h = e[7],
  32087. c = e[8],
  32088. u = e[9],
  32089. _ = e[10],
  32090. f = e[11],
  32091. d = e[12],
  32092. p = e[13],
  32093. m = e[14],
  32094. y = e[15];
  32095. return (i * a - n * o) * (_ * y - f * m) - (i * l - r * o) * (u * y - f * p) + (i * h - s * o) * (u * m - _ * p) + (n * l - r * a) * (c * y - f * d) - (n * h - s * a) * (c * m - _ * d) + (r * h - s * l) * (c * p - u * d)
  32096. }, t.multiply = function(t, e, i) {
  32097. var n = e.m,
  32098. r = i.m,
  32099. s = t.m,
  32100. o = n[0],
  32101. a = n[1],
  32102. l = n[2],
  32103. h = n[3],
  32104. c = n[4],
  32105. u = n[5],
  32106. _ = n[6],
  32107. f = n[7],
  32108. d = n[8],
  32109. p = n[9],
  32110. m = n[10],
  32111. y = n[11],
  32112. v = n[12],
  32113. g = n[13],
  32114. x = n[14],
  32115. b = n[15],
  32116. A = r[0],
  32117. C = r[1],
  32118. T = r[2],
  32119. S = r[3];
  32120. return s[0] = A * o + C * c + T * d + S * v, s[1] = A * a + C * u + T * p + S * g, s[2] = A * l + C * _ + T * m + S * x, s[3] = A * h + C * f + T * y + S * b, A = r[4], C = r[5], T = r[6], S = r[7], s[4] = A * o + C * c + T * d + S * v, s[5] = A * a + C * u + T * p + S * g, s[6] = A * l + C * _ + T * m + S * x, s[7] = A * h + C * f + T * y + S * b, A = r[8], C = r[9], T = r[10], S = r[11], s[8] = A * o + C * c + T * d + S * v, s[9] = A * a + C * u + T * p + S * g, s[10] = A * l + C * _ + T * m + S * x, s[11] = A * h + C * f + T * y + S * b, A = r[12], C = r[13], T = r[14], S = r[15], s[12] = A * o + C * c + T * d + S * v, s[13] = A * a + C * u + T * p + S * g, s[14] = A * l + C * _ + T * m + S * x, s[15] = A * h + C * f + T * y + S * b, t
  32121. }, t.mul = function(e, i, n) {
  32122. return t.multiply(e, i, n)
  32123. }, t.translate = function(t, e, i) {
  32124. var n = e.m,
  32125. r = t.m,
  32126. s = i.x,
  32127. o = i.y,
  32128. a = i.z,
  32129. l = void 0,
  32130. h = void 0,
  32131. c = void 0,
  32132. u = void 0,
  32133. _ = void 0,
  32134. f = void 0,
  32135. d = void 0,
  32136. p = void 0,
  32137. m = void 0,
  32138. y = void 0,
  32139. v = void 0,
  32140. g = void 0;
  32141. return e === t ? (r[12] = n[0] * s + n[4] * o + n[8] * a + n[12], r[13] = n[1] * s + n[5] * o + n[9] * a + n[13], r[14] = n[2] * s + n[6] * o + n[10] * a + n[14], r[15] = n[3] * s + n[7] * o + n[11] * a + n[15]) : (l = n[0], h = n[1], c = n[2], u = n[3], _ = n[4], f = n[5], d = n[6], p = n[7], m = n[8], y = n[9], v = n[10], g = n[11], r[0] = l, r[1] = h, r[2] = c, r[3] = u, r[4] = _, r[5] = f, r[6] = d, r[7] = p, r[8] = m, r[9] = y, r[10] = v, r[11] = g, r[12] = l * s + _ * o + m * a + n[12], r[13] = h * s + f * o + y * a + n[13], r[14] = c * s + d * o + v * a + n[14], r[15] = u * s + p * o + g * a + n[15]), t
  32142. }, t.scale = function(t, e, i) {
  32143. var n = i.x,
  32144. r = i.y,
  32145. s = i.z,
  32146. o = e.m,
  32147. a = t.m;
  32148. return a[0] = o[0] * n, a[1] = o[1] * n, a[2] = o[2] * n, a[3] = o[3] * n, a[4] = o[4] * r, a[5] = o[5] * r, a[6] = o[6] * r, a[7] = o[7] * r, a[8] = o[8] * s, a[9] = o[9] * s, a[10] = o[10] * s, a[11] = o[11] * s, a[12] = o[12], a[13] = o[13], a[14] = o[14], a[15] = o[15], t
  32149. }, t.rotate = function(t, e, i, r) {
  32150. var s, o, a, l, h, c, u, _, f, d, p, m, y, v, g, x, b, A, C, T, S, w, E, M, D = e.m,
  32151. B = t.m,
  32152. I = r.x,
  32153. P = r.y,
  32154. R = r.z,
  32155. O = Math.sqrt(I * I + P * P + R * R);
  32156. return Math.abs(O) < n.EPSILON ? null : (I *= O = 1 / O, P *= O, R *= O, s = Math.sin(i), a = 1 - (o = Math.cos(i)), l = D[0], h = D[1], c = D[2], u = D[3], _ = D[4], f = D[5], d = D[6], p = D[7], m = D[8], y = D[9], v = D[10], g = D[11], x = I * I * a + o, b = P * I * a + R * s, A = R * I * a - P * s, C = I * P * a - R * s, T = P * P * a + o, S = R * P * a + I * s, w = I * R * a + P * s, E = P * R * a - I * s, M = R * R * a + o, B[0] = l * x + _ * b + m * A, B[1] = h * x + f * b + y * A, B[2] = c * x + d * b + v * A, B[3] = u * x + p * b + g * A, B[4] = l * C + _ * T + m * S, B[5] = h * C + f * T + y * S, B[6] = c * C + d * T + v * S, B[7] = u * C + p * T + g * S, B[8] = l * w + _ * E + m * M, B[9] = h * w + f * E + y * M, B[10] = c * w + d * E + v * M, B[11] = u * w + p * E + g * M, e !== t && (B[12] = D[12], B[13] = D[13], B[14] = D[14], B[15] = D[15]), t)
  32157. }, t.rotateX = function(t, e, i) {
  32158. var n = e.m,
  32159. r = t.m,
  32160. s = Math.sin(i),
  32161. o = Math.cos(i),
  32162. a = n[4],
  32163. l = n[5],
  32164. h = n[6],
  32165. c = n[7],
  32166. u = n[8],
  32167. _ = n[9],
  32168. f = n[10],
  32169. d = n[11];
  32170. return e !== t && (r[0] = n[0], r[1] = n[1], r[2] = n[2], r[3] = n[3], r[12] = n[12], r[13] = n[13], r[14] = n[14], r[15] = n[15]), r[4] = a * o + u * s, r[5] = l * o + _ * s, r[6] = h * o + f * s, r[7] = c * o + d * s, r[8] = u * o - a * s, r[9] = _ * o - l * s, r[10] = f * o - h * s, r[11] = d * o - c * s, t
  32171. }, t.rotateY = function(t, e, i) {
  32172. var n = e.m,
  32173. r = t.m,
  32174. s = Math.sin(i),
  32175. o = Math.cos(i),
  32176. a = n[0],
  32177. l = n[1],
  32178. h = n[2],
  32179. c = n[3],
  32180. u = n[8],
  32181. _ = n[9],
  32182. f = n[10],
  32183. d = n[11];
  32184. return e !== t && (r[4] = n[4], r[5] = n[5], r[6] = n[6], r[7] = n[7], r[12] = n[12], r[13] = n[13], r[14] = n[14], r[15] = n[15]), r[0] = a * o - u * s, r[1] = l * o - _ * s, r[2] = h * o - f * s, r[3] = c * o - d * s, r[8] = a * s + u * o, r[9] = l * s + _ * o, r[10] = h * s + f * o, r[11] = c * s + d * o, t
  32185. }, t.rotateZ = function(t, e, i) {
  32186. var n = e.m,
  32187. r = t.m,
  32188. s = Math.sin(i),
  32189. o = Math.cos(i),
  32190. a = n[0],
  32191. l = n[1],
  32192. h = n[2],
  32193. c = n[3],
  32194. u = n[4],
  32195. _ = n[5],
  32196. f = n[6],
  32197. d = n[7];
  32198. return e !== t && (r[8] = n[8], r[9] = n[9], r[10] = n[10], r[11] = n[11], r[12] = n[12], r[13] = n[13], r[14] = n[14], r[15] = n[15]), r[0] = a * o + u * s, r[1] = l * o + _ * s, r[2] = h * o + f * s, r[3] = c * o + d * s, r[4] = u * o - a * s, r[5] = _ * o - l * s, r[6] = f * o - h * s, r[7] = d * o - c * s, t
  32199. }, t.fromTranslation = function(t, e) {
  32200. var i = t.m;
  32201. return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = 1, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 1, i[11] = 0, i[12] = e.x, i[13] = e.y, i[14] = e.z, i[15] = 1, t
  32202. }, t.fromScaling = function(t, e) {
  32203. var i = t.m;
  32204. return i[0] = e.x, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = e.y, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = e.z, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
  32205. }, t.fromRotation = function(t, e, i) {
  32206. var r, s, o, a = t.m,
  32207. l = i.x,
  32208. h = i.y,
  32209. c = i.z,
  32210. u = Math.sqrt(l * l + h * h + c * c);
  32211. return Math.abs(u) < n.EPSILON ? null : (l *= u = 1 / u, h *= u, c *= u, r = Math.sin(e), o = 1 - (s = Math.cos(e)), a[0] = l * l * o + s, a[1] = h * l * o + c * r, a[2] = c * l * o - h * r, a[3] = 0, a[4] = l * h * o - c * r, a[5] = h * h * o + s, a[6] = c * h * o + l * r, a[7] = 0, a[8] = l * c * o + h * r, a[9] = h * c * o - l * r, a[10] = c * c * o + s, a[11] = 0, a[12] = 0, a[13] = 0, a[14] = 0, a[15] = 1, t)
  32212. }, t.fromXRotation = function(t, e) {
  32213. var i = t.m,
  32214. n = Math.sin(e),
  32215. r = Math.cos(e);
  32216. return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = r, i[6] = n, i[7] = 0, i[8] = 0, i[9] = -n, i[10] = r, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
  32217. }, t.fromYRotation = function(t, e) {
  32218. var i = t.m,
  32219. n = Math.sin(e),
  32220. r = Math.cos(e);
  32221. return i[0] = r, i[1] = 0, i[2] = -n, i[3] = 0, i[4] = 0, i[5] = 1, i[6] = 0, i[7] = 0, i[8] = n, i[9] = 0, i[10] = r, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
  32222. }, t.fromZRotation = function(t, e) {
  32223. var i = t.m,
  32224. n = Math.sin(e),
  32225. r = Math.cos(e);
  32226. return i[0] = r, i[1] = n, i[2] = 0, i[3] = 0, i[4] = -n, i[5] = r, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 1, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
  32227. }, t.fromRT = function(t, e, i) {
  32228. var n = t.m,
  32229. r = e.x,
  32230. s = e.y,
  32231. o = e.z,
  32232. a = e.w,
  32233. l = r + r,
  32234. h = s + s,
  32235. c = o + o,
  32236. u = r * l,
  32237. _ = r * h,
  32238. f = r * c,
  32239. d = s * h,
  32240. p = s * c,
  32241. m = o * c,
  32242. y = a * l,
  32243. v = a * h,
  32244. g = a * c;
  32245. return n[0] = 1 - (d + m), n[1] = _ + g, n[2] = f - v, n[3] = 0, n[4] = _ - g, n[5] = 1 - (u + m), n[6] = p + y, n[7] = 0, n[8] = f + v, n[9] = p - y, n[10] = 1 - (u + d), n[11] = 0, n[12] = i.x, n[13] = i.y, n[14] = i.z, n[15] = 1, t
  32246. }, t.fromTRSArray = function(t, e) {
  32247. var i = t.m,
  32248. n = e[3],
  32249. r = e[4],
  32250. s = e[5],
  32251. o = e[6],
  32252. a = n + n,
  32253. l = r + r,
  32254. h = s + s,
  32255. c = n * a,
  32256. u = n * l,
  32257. _ = n * h,
  32258. f = r * l,
  32259. d = r * h,
  32260. p = s * h,
  32261. m = o * a,
  32262. y = o * l,
  32263. v = o * h,
  32264. g = e[7],
  32265. x = e[8],
  32266. b = e[9];
  32267. return i[0] = (1 - (f + p)) * g, i[1] = (u + v) * g, i[2] = (_ - y) * g, i[3] = 0, i[4] = (u - v) * x, i[5] = (1 - (c + p)) * x, i[6] = (d + m) * x, i[7] = 0, i[8] = (_ + y) * b, i[9] = (d - m) * b, i[10] = (1 - (c + f)) * b, i[11] = 0, i[12] = e[0], i[13] = e[1], i[14] = e[2], i[15] = 1, t
  32268. }, t.getTranslation = function(t, e) {
  32269. var i = e.m;
  32270. return t.x = i[12], t.y = i[13], t.z = i[14], t
  32271. }, t.getScaling = function(t, e) {
  32272. var i = e.m,
  32273. n = i[0],
  32274. r = i[1],
  32275. s = i[2],
  32276. o = i[4],
  32277. a = i[5],
  32278. l = i[6],
  32279. h = i[8],
  32280. c = i[9],
  32281. u = i[10];
  32282. return t.x = Math.sqrt(n * n + r * r + s * s), t.y = Math.sqrt(o * o + a * a + l * l), t.z = Math.sqrt(h * h + c * c + u * u), t
  32283. }, t.getRotation = function(t, e) {
  32284. var i = e.m,
  32285. n = i[0] + i[5] + i[10],
  32286. r = 0;
  32287. return n > 0 ? (r = 2 * Math.sqrt(n + 1), t.w = .25 * r, t.x = (i[6] - i[9]) / r, t.y = (i[8] - i[2]) / r, t.z = (i[1] - i[4]) / r) : i[0] > i[5] & i[0] > i[10] ? (r = 2 * Math.sqrt(1 + i[0] - i[5] - i[10]), t.w = (i[6] - i[9]) / r, t.x = .25 * r, t.y = (i[1] + i[4]) / r, t.z = (i[8] + i[2]) / r) : i[5] > i[10] ? (r = 2 * Math.sqrt(1 + i[5] - i[0] - i[10]), t.w = (i[8] - i[2]) / r, t.x = (i[1] + i[4]) / r, t.y = .25 * r, t.z = (i[6] + i[9]) / r) : (r = 2 * Math.sqrt(1 + i[10] - i[0] - i[5]), t.w = (i[1] - i[4]) / r, t.x = (i[8] + i[2]) / r, t.y = (i[6] + i[9]) / r, t.z = .25 * r), t
  32288. }, t.fromRTS = function(t, e, i, n) {
  32289. var r = t.m,
  32290. s = e.x,
  32291. o = e.y,
  32292. a = e.z,
  32293. l = e.w,
  32294. h = s + s,
  32295. c = o + o,
  32296. u = a + a,
  32297. _ = s * h,
  32298. f = s * c,
  32299. d = s * u,
  32300. p = o * c,
  32301. m = o * u,
  32302. y = a * u,
  32303. v = l * h,
  32304. g = l * c,
  32305. x = l * u,
  32306. b = n.x,
  32307. A = n.y,
  32308. C = n.z;
  32309. return r[0] = (1 - (p + y)) * b, r[1] = (f + x) * b, r[2] = (d - g) * b, r[3] = 0, r[4] = (f - x) * A, r[5] = (1 - (_ + y)) * A, r[6] = (m + v) * A, r[7] = 0, r[8] = (d + g) * C, r[9] = (m - v) * C, r[10] = (1 - (_ + p)) * C, r[11] = 0, r[12] = i.x, r[13] = i.y, r[14] = i.z, r[15] = 1, t
  32310. }, t.fromRTSOrigin = function(t, e, i, n, r) {
  32311. var s = t.m,
  32312. o = e.x,
  32313. a = e.y,
  32314. l = e.z,
  32315. h = e.w,
  32316. c = o + o,
  32317. u = a + a,
  32318. _ = l + l,
  32319. f = o * c,
  32320. d = o * u,
  32321. p = o * _,
  32322. m = a * u,
  32323. y = a * _,
  32324. v = l * _,
  32325. g = h * c,
  32326. x = h * u,
  32327. b = h * _,
  32328. A = n.x,
  32329. C = n.y,
  32330. T = n.z,
  32331. S = r.x,
  32332. w = r.y,
  32333. E = r.z;
  32334. return s[0] = (1 - (m + v)) * A, s[1] = (d + b) * A, s[2] = (p - x) * A, s[3] = 0, s[4] = (d - b) * C, s[5] = (1 - (f + v)) * C, s[6] = (y + g) * C, s[7] = 0, s[8] = (p + x) * T, s[9] = (y - g) * T, s[10] = (1 - (f + m)) * T, s[11] = 0, s[12] = i.x + S - (s[0] * S + s[4] * w + s[8] * E), s[13] = i.y + w - (s[1] * S + s[5] * w + s[9] * E), s[14] = i.z + E - (s[2] * S + s[6] * w + s[10] * E), s[15] = 1, t
  32335. }, t.fromQuat = function(t, e) {
  32336. var i = t.m,
  32337. n = e.x,
  32338. r = e.y,
  32339. s = e.z,
  32340. o = e.w,
  32341. a = n + n,
  32342. l = r + r,
  32343. h = s + s,
  32344. c = n * a,
  32345. u = r * a,
  32346. _ = r * l,
  32347. f = s * a,
  32348. d = s * l,
  32349. p = s * h,
  32350. m = o * a,
  32351. y = o * l,
  32352. v = o * h;
  32353. return i[0] = 1 - _ - p, i[1] = u + v, i[2] = f - y, i[3] = 0, i[4] = u - v, i[5] = 1 - c - p, i[6] = d + m, i[7] = 0, i[8] = f + y, i[9] = d - m, i[10] = 1 - c - _, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, t
  32354. }, t.frustum = function(t, e, i, n, r, s, o) {
  32355. var a = t.m,
  32356. l = 1 / (i - e),
  32357. h = 1 / (r - n),
  32358. c = 1 / (s - o);
  32359. return a[0] = 2 * s * l, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = 2 * s * h, a[6] = 0, a[7] = 0, a[8] = (i + e) * l, a[9] = (r + n) * h, a[10] = (o + s) * c, a[11] = -1, a[12] = 0, a[13] = 0, a[14] = o * s * 2 * c, a[15] = 0, t
  32360. }, t.perspective = function(t, e, i, n, r) {
  32361. var s = t.m,
  32362. o = 1 / Math.tan(e / 2),
  32363. a = 1 / (n - r);
  32364. return s[0] = o / i, s[1] = 0, s[2] = 0, s[3] = 0, s[4] = 0, s[5] = o, s[6] = 0, s[7] = 0, s[8] = 0, s[9] = 0, s[10] = (r + n) * a, s[11] = -1, s[12] = 0, s[13] = 0, s[14] = 2 * r * n * a, s[15] = 0, t
  32365. }, t.perspectiveFromFieldOfView = function(t, e, i, n) {
  32366. var r = t.m,
  32367. s = Math.tan(e.upDegrees * Math.PI / 180),
  32368. o = Math.tan(e.downDegrees * Math.PI / 180),
  32369. a = Math.tan(e.leftDegrees * Math.PI / 180),
  32370. l = Math.tan(e.rightDegrees * Math.PI / 180),
  32371. h = 2 / (a + l),
  32372. c = 2 / (s + o);
  32373. return r[0] = h, r[1] = 0, r[2] = 0, r[3] = 0, r[4] = 0, r[5] = c, r[6] = 0, r[7] = 0, r[8] = -(a - l) * h * .5, r[9] = (s - o) * c * .5, r[10] = n / (i - n), r[11] = -1, r[12] = 0, r[13] = 0, r[14] = n * i / (i - n), r[15] = 0, t
  32374. }, t.ortho = function(t, e, i, n, r, s, o) {
  32375. var a = t.m,
  32376. l = 1 / (e - i),
  32377. h = 1 / (n - r),
  32378. c = 1 / (s - o);
  32379. return a[0] = -2 * l, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = -2 * h, a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = 2 * c, a[11] = 0, a[12] = (e + i) * l, a[13] = (r + n) * h, a[14] = (o + s) * c, a[15] = 1, t
  32380. }, t.lookAt = function(t, e, i, n) {
  32381. var r, s, o, a = t.m,
  32382. l = void 0,
  32383. h = void 0,
  32384. c = void 0,
  32385. u = void 0,
  32386. _ = void 0,
  32387. f = void 0,
  32388. d = void 0,
  32389. p = e.x,
  32390. m = e.y,
  32391. y = e.z,
  32392. v = n.x,
  32393. g = n.y,
  32394. x = n.z;
  32395. return u = p - i.x, _ = m - i.y, f = y - i.z, l = g * (f *= d = 1 / Math.sqrt(u * u + _ * _ + f * f)) - x * (_ *= d), h = x * (u *= d) - v * f, c = v * _ - g * u, r = _ * (c *= d = 1 / Math.sqrt(l * l + h * h + c * c)) - f * (h *= d), s = f * (l *= d) - u * c, o = u * h - _ * l, a[0] = l, a[1] = r, a[2] = u, a[3] = 0, a[4] = h, a[5] = s, a[6] = _, a[7] = 0, a[8] = c, a[9] = o, a[10] = f, a[11] = 0, a[12] = -(l * p + h * m + c * y), a[13] = -(r * p + s * m + o * y), a[14] = -(u * p + _ * m + f * y), a[15] = 1, t
  32396. }, t.str = function(t) {
  32397. var e = t.m;
  32398. return "mat4(" + e[0] + ", " + e[1] + ", " + e[2] + ", " + e[3] + ", " + e[4] + ", " + e[5] + ", " + e[6] + ", " + e[7] + ", " + e[8] + ", " + e[9] + ", " + e[10] + ", " + e[11] + ", " + e[12] + ", " + e[13] + ", " + e[14] + ", " + e[15] + ")"
  32399. }, t.array = function(t, e) {
  32400. var i = e.m;
  32401. return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t[9] = i[9], t[10] = i[10], t[11] = i[11], t[12] = i[12], t[13] = i[13], t[14] = i[14], t[15] = i[15], t
  32402. }, t.frob = function(t) {
  32403. var e = t.m;
  32404. return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + Math.pow(e[6], 2) + Math.pow(e[7], 2) + Math.pow(e[8], 2) + Math.pow(e[9], 2) + Math.pow(e[10], 2) + Math.pow(e[11], 2) + Math.pow(e[12], 2) + Math.pow(e[13], 2) + Math.pow(e[14], 2) + Math.pow(e[15], 2))
  32405. }, t.add = function(t, e, i) {
  32406. var n = e.m,
  32407. r = i.m,
  32408. s = t.m;
  32409. return s[0] = n[0] + r[0], s[1] = n[1] + r[1], s[2] = n[2] + r[2], s[3] = n[3] + r[3], s[4] = n[4] + r[4], s[5] = n[5] + r[5], s[6] = n[6] + r[6], s[7] = n[7] + r[7], s[8] = n[8] + r[8], s[9] = n[9] + r[9], s[10] = n[10] + r[10], s[11] = n[11] + r[11], s[12] = n[12] + r[12], s[13] = n[13] + r[13], s[14] = n[14] + r[14], s[15] = n[15] + r[15], t
  32410. }, t.subtract = function(t, e, i) {
  32411. var n = e.m,
  32412. r = i.m,
  32413. s = t.m;
  32414. return s[0] = n[0] - r[0], s[1] = n[1] - r[1], s[2] = n[2] - r[2], s[3] = n[3] - r[3], s[4] = n[4] - r[4], s[5] = n[5] - r[5], s[6] = n[6] - r[6], s[7] = n[7] - r[7], s[8] = n[8] - r[8], s[9] = n[9] - r[9], s[10] = n[10] - r[10], s[11] = n[11] - r[11], s[12] = n[12] - r[12], s[13] = n[13] - r[13], s[14] = n[14] - r[14], s[15] = n[15] - r[15], t
  32415. }, t.sub = function(e, i, n) {
  32416. return t.subtract(e, i, n)
  32417. }, t.multiplyScalar = function(t, e, i) {
  32418. var n = e.m,
  32419. r = t.m;
  32420. return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = n[3] * i, r[4] = n[4] * i, r[5] = n[5] * i, r[6] = n[6] * i, r[7] = n[7] * i, r[8] = n[8] * i, r[9] = n[9] * i, r[10] = n[10] * i, r[11] = n[11] * i, r[12] = n[12] * i, r[13] = n[13] * i, r[14] = n[14] * i, r[15] = n[15] * i, t
  32421. }, t.multiplyScalarAndAdd = function(t, e, i, n) {
  32422. var r = e.m,
  32423. s = i.m,
  32424. o = t.m;
  32425. return o[0] = r[0] + s[0] * n, o[1] = r[1] + s[1] * n, o[2] = r[2] + s[2] * n, o[3] = r[3] + s[3] * n, o[4] = r[4] + s[4] * n, o[5] = r[5] + s[5] * n, o[6] = r[6] + s[6] * n, o[7] = r[7] + s[7] * n, o[8] = r[8] + s[8] * n, o[9] = r[9] + s[9] * n, o[10] = r[10] + s[10] * n, o[11] = r[11] + s[11] * n, o[12] = r[12] + s[12] * n, o[13] = r[13] + s[13] * n, o[14] = r[14] + s[14] * n, o[15] = r[15] + s[15] * n, t
  32426. }, t.exactEquals = function(t, e) {
  32427. var i = t.m,
  32428. n = e.m;
  32429. return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8] && i[9] === n[9] && i[10] === n[10] && i[11] === n[11] && i[12] === n[12] && i[13] === n[13] && i[14] === n[14] && i[15] === n[15]
  32430. }, t.equals = function(t, e) {
  32431. var i = t.m,
  32432. r = e.m,
  32433. s = i[0],
  32434. o = i[1],
  32435. a = i[2],
  32436. l = i[3],
  32437. h = i[4],
  32438. c = i[5],
  32439. u = i[6],
  32440. _ = i[7],
  32441. f = i[8],
  32442. d = i[9],
  32443. p = i[10],
  32444. m = i[11],
  32445. y = i[12],
  32446. v = i[13],
  32447. g = i[14],
  32448. x = i[15],
  32449. b = r[0],
  32450. A = r[1],
  32451. C = r[2],
  32452. T = r[3],
  32453. S = r[4],
  32454. w = r[5],
  32455. E = r[6],
  32456. M = r[7],
  32457. D = r[8],
  32458. B = r[9],
  32459. I = r[10],
  32460. P = r[11],
  32461. R = r[12],
  32462. O = r[13],
  32463. L = r[14],
  32464. F = r[15];
  32465. return Math.abs(s - b) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(o - A) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(A)) && Math.abs(a - C) <= n.EPSILON * Math.max(1, Math.abs(a), Math.abs(C)) && Math.abs(l - T) <= n.EPSILON * Math.max(1, Math.abs(l), Math.abs(T)) && Math.abs(h - S) <= n.EPSILON * Math.max(1, Math.abs(h), Math.abs(S)) && Math.abs(c - w) <= n.EPSILON * Math.max(1, Math.abs(c), Math.abs(w)) && Math.abs(u - E) <= n.EPSILON * Math.max(1, Math.abs(u), Math.abs(E)) && Math.abs(_ - M) <= n.EPSILON * Math.max(1, Math.abs(_), Math.abs(M)) && Math.abs(f - D) <= n.EPSILON * Math.max(1, Math.abs(f), Math.abs(D)) && Math.abs(d - B) <= n.EPSILON * Math.max(1, Math.abs(d), Math.abs(B)) && Math.abs(p - I) <= n.EPSILON * Math.max(1, Math.abs(p), Math.abs(I)) && Math.abs(m - P) <= n.EPSILON * Math.max(1, Math.abs(m), Math.abs(P)) && Math.abs(y - R) <= n.EPSILON * Math.max(1, Math.abs(y), Math.abs(R)) && Math.abs(v - O) <= n.EPSILON * Math.max(1, Math.abs(v), Math.abs(O)) && Math.abs(g - L) <= n.EPSILON * Math.max(1, Math.abs(g), Math.abs(L)) && Math.abs(x - F) <= n.EPSILON * Math.max(1, Math.abs(x), Math.abs(F))
  32466. }, t
  32467. })();
  32468. i.default = s, e.exports = i.default
  32469. }), {
  32470. "./utils": 333
  32471. }],
  32472. 331: [(function(t, e, i) {
  32473. "use strict";
  32474. i.__esModule = !0;
  32475. var n = a(t("./vec3")),
  32476. r = a(t("./vec4")),
  32477. s = a(t("./mat3")),
  32478. o = t("./utils");
  32479. function a(t) {
  32480. return t && t.__esModule ? t : {
  32481. default: t
  32482. }
  32483. }
  32484. function l(t, e) {
  32485. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  32486. }
  32487. var h = .5 * Math.PI / 180,
  32488. c = (function() {
  32489. function t() {
  32490. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
  32491. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  32492. n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  32493. r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
  32494. l(this, t), this.x = e, this.y = i, this.z = n, this.w = r
  32495. }
  32496. return t.create = function() {
  32497. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
  32498. }, t.clone = function(e) {
  32499. return new t(e.x, e.y, e.z, e.w)
  32500. }, t.copy = function(t, e) {
  32501. return r.default.copy(t, e)
  32502. }, t.set = function(t, e, i, n, r) {
  32503. return t.x = e, t.y = i, t.z = n, t.w = r, t
  32504. }, t.identity = function(t) {
  32505. return t.x = 0, t.y = 0, t.z = 0, t.w = 1, t
  32506. }, t.rotationTo = function(e, i, r) {
  32507. return (function() {
  32508. var e = n.default.create(0, 0, 0),
  32509. i = n.default.create(1, 0, 0),
  32510. r = n.default.create(0, 1, 0);
  32511. return function(s, o, a) {
  32512. var l = n.default.dot(o, a);
  32513. return l < -.999999 ? (n.default.cross(e, i, o), n.default.magnitude(e) < 1e-6 && n.default.cross(e, r, o), n.default.normalize(e, e), t.fromAxisAngle(s, e, Math.PI), s) : l > .999999 ? (s.x = 0, s.y = 0, s.z = 0, s.w = 1, s) : (n.default.cross(e, o, a), s.x = e.x, s.y = e.y, s.z = e.z, s.w = 1 + l, t.normalize(s, s))
  32514. }
  32515. })()(e, i, r)
  32516. }, t.getAxisAngle = function(t, e) {
  32517. var i = 2 * Math.acos(e.w),
  32518. n = Math.sin(i / 2);
  32519. return 0 != n ? (t.x = e.x / n, t.y = e.y / n, t.z = e.z / n) : (t.x = 1, t.y = 0, t.z = 0), i
  32520. }, t.multiply = function(t, e, i) {
  32521. var n = e.x,
  32522. r = e.y,
  32523. s = e.z,
  32524. o = e.w,
  32525. a = i.x,
  32526. l = i.y,
  32527. h = i.z,
  32528. c = i.w;
  32529. return t.x = n * c + o * a + r * h - s * l, t.y = r * c + o * l + s * a - n * h, t.z = s * c + o * h + n * l - r * a, t.w = o * c - n * a - r * l - s * h, t
  32530. }, t.mul = function(e, i, n) {
  32531. return t.multiply(e, i, n)
  32532. }, t.scale = function(t, e, i) {
  32533. return t.x = e.x * i, t.y = e.y * i, t.z = e.z * i, t.w = e.w * i, t
  32534. }, t.rotateX = function(t, e, i) {
  32535. i *= .5;
  32536. var n = e.x,
  32537. r = e.y,
  32538. s = e.z,
  32539. o = e.w,
  32540. a = Math.sin(i),
  32541. l = Math.cos(i);
  32542. return t.x = n * l + o * a, t.y = r * l + s * a, t.z = s * l - r * a, t.w = o * l - n * a, t
  32543. }, t.rotateY = function(t, e, i) {
  32544. i *= .5;
  32545. var n = e.x,
  32546. r = e.y,
  32547. s = e.z,
  32548. o = e.w,
  32549. a = Math.sin(i),
  32550. l = Math.cos(i);
  32551. return t.x = n * l - s * a, t.y = r * l + o * a, t.z = s * l + n * a, t.w = o * l - r * a, t
  32552. }, t.rotateZ = function(t, e, i) {
  32553. i *= .5;
  32554. var n = e.x,
  32555. r = e.y,
  32556. s = e.z,
  32557. o = e.w,
  32558. a = Math.sin(i),
  32559. l = Math.cos(i);
  32560. return t.x = n * l + r * a, t.y = r * l - n * a, t.z = s * l + o * a, t.w = o * l - s * a, t
  32561. }, t.rotateAround = function(e, i, r, s) {
  32562. return (function() {
  32563. var e = n.default.create(0, 0, 0),
  32564. i = t.create();
  32565. return function(r, s, o, a) {
  32566. return t.invert(i, s), n.default.transformQuat(e, o, i), t.fromAxisAngle(i, e, a), t.mul(r, s, i), r
  32567. }
  32568. })()(e, i, r, s)
  32569. }, t.rotateAroundLocal = function(e, i, n, r) {
  32570. return (function() {
  32571. var e = t.create();
  32572. return function(i, n, r, s) {
  32573. return t.fromAxisAngle(e, r, s), t.mul(i, n, e), i
  32574. }
  32575. })()(e, i, n, r)
  32576. }, t.calculateW = function(t, e) {
  32577. var i = e.x,
  32578. n = e.y,
  32579. r = e.z;
  32580. return t.x = i, t.y = n, t.z = r, t.w = Math.sqrt(Math.abs(1 - i * i - n * n - r * r)), t
  32581. }, t.dot = function(t, e) {
  32582. return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w
  32583. }, t.lerp = function(t, e, i, n) {
  32584. var r = e.x,
  32585. s = e.y,
  32586. o = e.z,
  32587. a = e.w;
  32588. return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t.z = o + n * (i.z - o), t.w = a + n * (i.w - a), t
  32589. }, t.slerp = function(t, e, i, n) {
  32590. var r = e.x,
  32591. s = e.y,
  32592. o = e.z,
  32593. a = e.w,
  32594. l = i.x,
  32595. h = i.y,
  32596. c = i.z,
  32597. u = i.w,
  32598. _ = void 0,
  32599. f = void 0,
  32600. d = void 0,
  32601. p = void 0,
  32602. m = void 0;
  32603. return (f = r * l + s * h + o * c + a * u) < 0 && (f = -f, l = -l, h = -h, c = -c, u = -u), 1 - f > 1e-6 ? (_ = Math.acos(f), d = Math.sin(_), p = Math.sin((1 - n) * _) / d, m = Math.sin(n * _) / d) : (p = 1 - n, m = n), t.x = p * r + m * l, t.y = p * s + m * h, t.z = p * o + m * c, t.w = p * a + m * u, t
  32604. }, t.sqlerp = function(e, i, n, r, s, o) {
  32605. return (function() {
  32606. var e = t.create(),
  32607. i = t.create();
  32608. return function(n, r, s, o, a, l) {
  32609. return t.slerp(e, r, a, l), t.slerp(i, s, o, l), t.slerp(n, e, i, 2 * l * (1 - l)), n
  32610. }
  32611. })()(e, i, n, r, s, o)
  32612. }, t.invert = function(t, e) {
  32613. var i = e.x,
  32614. n = e.y,
  32615. r = e.z,
  32616. s = e.w,
  32617. o = i * i + n * n + r * r + s * s,
  32618. a = o ? 1 / o : 0;
  32619. return t.x = -i * a, t.y = -n * a, t.z = -r * a, t.w = s * a, t
  32620. }, t.conjugate = function(t, e) {
  32621. return t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = e.w, t
  32622. }, t.magnitude = function(t) {
  32623. var e = t.x,
  32624. i = t.y,
  32625. n = t.z,
  32626. r = t.w;
  32627. return Math.sqrt(e * e + i * i + n * n + r * r)
  32628. }, t.mag = function(e) {
  32629. return t.magnitude(e)
  32630. }, t.squaredMagnitude = function(t) {
  32631. var e = t.x,
  32632. i = t.y,
  32633. n = t.z,
  32634. r = t.w;
  32635. return e * e + i * i + n * n + r * r
  32636. }, t.sqrMag = function(e) {
  32637. return t.squaredMagnitude(e)
  32638. }, t.normalize = function(t, e) {
  32639. var i = e.x,
  32640. n = e.y,
  32641. r = e.z,
  32642. s = e.w,
  32643. o = i * i + n * n + r * r + s * s;
  32644. return o > 0 && (o = 1 / Math.sqrt(o), t.x = i * o, t.y = n * o, t.z = r * o, t.w = s * o), t
  32645. }, t.fromAxes = function(e, i, n, r) {
  32646. return (function() {
  32647. var e = s.default.create();
  32648. return function(i, n, r, o) {
  32649. return s.default.set(e, n.x, n.y, n.z, r.x, r.y, r.z, o.x, o.y, o.z), t.normalize(i, t.fromMat3(i, e))
  32650. }
  32651. })()(e, i, n, r)
  32652. }, t.fromViewUp = function(e, i, n) {
  32653. return (function() {
  32654. var e = s.default.create();
  32655. return function(i, n, r) {
  32656. return s.default.fromViewUp(e, n, r), e ? t.normalize(i, t.fromMat3(i, e)) : null
  32657. }
  32658. })()(e, i, n)
  32659. }, t.fromAxisAngle = function(t, e, i) {
  32660. i *= .5;
  32661. var n = Math.sin(i);
  32662. return t.x = n * e.x, t.y = n * e.y, t.z = n * e.z, t.w = Math.cos(i), t
  32663. }, t.fromMat3 = function(t, e) {
  32664. var i = e.m,
  32665. n = i[0],
  32666. r = i[3],
  32667. s = i[6],
  32668. o = i[1],
  32669. a = i[4],
  32670. l = i[7],
  32671. h = i[2],
  32672. c = i[5],
  32673. u = i[8],
  32674. _ = n + a + u;
  32675. if (_ > 0) {
  32676. var f = .5 / Math.sqrt(_ + 1);
  32677. t.w = .25 / f, t.x = (c - l) * f, t.y = (s - h) * f, t.z = (o - r) * f
  32678. } else if (n > a && n > u) {
  32679. var d = 2 * Math.sqrt(1 + n - a - u);
  32680. t.w = (c - l) / d, t.x = .25 * d, t.y = (r + o) / d, t.z = (s + h) / d
  32681. } else if (a > u) {
  32682. var p = 2 * Math.sqrt(1 + a - n - u);
  32683. t.w = (s - h) / p, t.x = (r + o) / p, t.y = .25 * p, t.z = (l + c) / p
  32684. } else {
  32685. var m = 2 * Math.sqrt(1 + u - n - a);
  32686. t.w = (o - r) / m, t.x = (s + h) / m, t.y = (l + c) / m, t.z = .25 * m
  32687. }
  32688. return t
  32689. }, t.fromEuler = function(t, e, i, n) {
  32690. e *= h, i *= h, n *= h;
  32691. var r = Math.sin(e),
  32692. s = Math.cos(e),
  32693. o = Math.sin(i),
  32694. a = Math.cos(i),
  32695. l = Math.sin(n),
  32696. c = Math.cos(n);
  32697. return t.x = r * a * c + s * o * l, t.y = s * o * c + r * a * l, t.z = s * a * l - r * o * c, t.w = s * a * c - r * o * l, t
  32698. }, t.fromAngleZ = function(t, e) {
  32699. e *= h, t.x = t.y = 0, t.z = Math.sin(e), t.w = Math.cos(e)
  32700. }, t.toEuler = function(t, e) {
  32701. var i = e.x,
  32702. n = e.y,
  32703. r = e.z,
  32704. s = e.w,
  32705. a = void 0,
  32706. l = void 0,
  32707. h = void 0,
  32708. c = i * n + r * s;
  32709. if (c > .499 && (a = 2 * Math.atan2(i, s), l = Math.PI / 2, h = 0), c < -.499 && (a = -2 * Math.atan2(i, s), l = -Math.PI / 2, h = 0), isNaN(a)) {
  32710. var u = i * i,
  32711. _ = n * n,
  32712. f = r * r;
  32713. a = Math.atan2(2 * n * s - 2 * i * r, 1 - 2 * _ - 2 * f), l = Math.asin(2 * c), h = Math.atan2(2 * i * s - 2 * n * r, 1 - 2 * u - 2 * f)
  32714. }
  32715. return t.y = (0, o.toDegree)(a), t.z = (0, o.toDegree)(l), t.x = (0, o.toDegree)(h), t
  32716. }, t.str = function(t) {
  32717. return "quat(" + t.x + ", " + t.y + ", " + t.z + ", " + t.w + ")"
  32718. }, t.array = function(t, e) {
  32719. return t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w, t
  32720. }, t.exactEquals = function(t, e) {
  32721. return r.default.exactEquals(t, e)
  32722. }, t.equals = function(t, e) {
  32723. return r.default.equals(t, e)
  32724. }, t
  32725. })();
  32726. i.default = c, e.exports = i.default
  32727. }), {
  32728. "./mat3": 329,
  32729. "./utils": 333,
  32730. "./vec3": 335,
  32731. "./vec4": 336
  32732. }],
  32733. 332: [(function(t, e, i) {
  32734. "use strict";
  32735. i.__esModule = !0, i.default = void 0;
  32736. var n = (function(t) {
  32737. return t && t.__esModule ? t : {
  32738. default: t
  32739. }
  32740. })(t("./quat"));
  32741. function r(t, e) {
  32742. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  32743. }
  32744. var s = n.default.create(),
  32745. o = (function() {
  32746. function t() {
  32747. r(this, t)
  32748. }
  32749. return t.toRotation = function(t, e) {
  32750. return t.x = e[3], t.y = e[4], t.z = e[5], t.w = e[6], t
  32751. }, t.fromRotation = function(t, e) {
  32752. return t[3] = e.x, t[4] = e.y, t[5] = e.z, t[6] = e.w, t
  32753. }, t.toEuler = function(e, i) {
  32754. return t.toRotation(s, i), n.default.toEuler(e, s), e
  32755. }, t.fromEuler = function(e, i) {
  32756. return n.default.fromEuler(s, i.x, i.y, i.z), t.fromRotation(e, s), e
  32757. }, t.fromEulerNumber = function(e, i, r, o) {
  32758. return n.default.fromEuler(s, i, r, o), t.fromRotation(e, s), e
  32759. }, t.toScale = function(t, e) {
  32760. return t.x = e[7], t.y = e[8], t.z = e[9], t
  32761. }, t.fromScale = function(t, e) {
  32762. return t[7] = e.x, t[8] = e.y, t[9] = e.z, t
  32763. }, t.toPosition = function(t, e) {
  32764. return t.x = e[0], t.y = e[1], t.z = e[2], t
  32765. }, t.fromPosition = function(t, e) {
  32766. return t[0] = e.x, t[1] = e.y, t[2] = e.z, t
  32767. }, t.fromAngleZ = function(e, i) {
  32768. return n.default.fromAngleZ(s, i), t.fromRotation(e, s), e
  32769. }, t
  32770. })();
  32771. i.default = o, e.exports = i.default
  32772. }), {
  32773. "./quat": 331
  32774. }],
  32775. 333: [(function(t, e, i) {
  32776. "use strict";
  32777. i.__esModule = !0, i.equals = function(t, e) {
  32778. return Math.abs(t - e) <= s * Math.max(1, Math.abs(t), Math.abs(e))
  32779. }, i.approx = function(t, e, i) {
  32780. return i = i || s, Math.abs(t - e) <= i
  32781. }, i.clamp = function(t, e, i) {
  32782. return t < e ? e : t > i ? i : t
  32783. }, i.clamp01 = function(t) {
  32784. return t < 0 ? 0 : t > 1 ? 1 : t
  32785. }, i.lerp = function(t, e, i) {
  32786. return t + (e - t) * i
  32787. }, i.toRadian = function(t) {
  32788. return t * n
  32789. }, i.toDegree = function(t) {
  32790. return t * r
  32791. }, i.randomRange = o, i.randomRangeInt = function(t, e) {
  32792. return Math.floor(o(t, e))
  32793. }, i.pseudoRandom = a, i.pseudoRandomRange = l, i.pseudoRandomRangeInt = function(t, e, i) {
  32794. return Math.floor(l(t, e, i))
  32795. }, i.nextPow2 = function(t) {
  32796. return --t, t |= t >> 1, t |= t >> 2, t |= t >> 4, t |= t >> 8, t |= t >> 16, ++t
  32797. }, i.repeat = h, i.pingPong = function(t, e) {
  32798. return t = h(t, 2 * e), t = e - Math.abs(t - e)
  32799. }, i.inverseLerp = function(t, e, i) {
  32800. return (i - t) / (e - t)
  32801. };
  32802. var n = Math.PI / 180,
  32803. r = 180 / Math.PI,
  32804. s = i.EPSILON = 1e-6;
  32805. i.FLOAT_ARRAY_TYPE = Float64Array, i.FLOAT_BYTES = 8;
  32806. i.random = Math.random;
  32807. function o(t, e) {
  32808. return Math.random() * (e - t) + t
  32809. }
  32810. function a(t) {
  32811. return (t = (9301 * t + 49297) % 233280) / 233280
  32812. }
  32813. function l(t, e, i) {
  32814. return a(t) * (i - e) + e
  32815. }
  32816. function h(t, e) {
  32817. return t - Math.floor(t / e) * e
  32818. }
  32819. }), {}],
  32820. 334: [(function(t, e, i) {
  32821. "use strict";
  32822. i.__esModule = !0;
  32823. var n = t("./utils");
  32824. function r(t, e) {
  32825. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  32826. }
  32827. var s = (function() {
  32828. function t() {
  32829. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
  32830. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
  32831. r(this, t), this.x = e, this.y = i
  32832. }
  32833. return t.create = function() {
  32834. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0)
  32835. }, t.zero = function(t) {
  32836. return t.x = 0, t.y = 0, t
  32837. }, t.clone = function(e) {
  32838. return new t(e.x, e.y)
  32839. }, t.copy = function(t, e) {
  32840. return t.x = e.x, t.y = e.y, t
  32841. }, t.set = function(t, e, i) {
  32842. return t.x = e, t.y = i, t
  32843. }, t.add = function(t, e, i) {
  32844. return t.x = e.x + i.x, t.y = e.y + i.y, t
  32845. }, t.subtract = function(t, e, i) {
  32846. return t.x = e.x - i.x, t.y = e.y - i.y, t
  32847. }, t.sub = function(e, i, n) {
  32848. return t.subtract(e, i, n)
  32849. }, t.multiply = function(t, e, i) {
  32850. return t.x = e.x * i.x, t.y = e.y * i.y, t
  32851. }, t.mul = function(e, i, n) {
  32852. return t.multiply(e, i, n)
  32853. }, t.divide = function(t, e, i) {
  32854. return t.x = e.x / i.x, t.y = e.y / i.y, t
  32855. }, t.div = function(e, i, n) {
  32856. return t.divide(e, i, n)
  32857. }, t.ceil = function(t, e) {
  32858. return t.x = Math.ceil(e.x), t.y = Math.ceil(e.y), t
  32859. }, t.floor = function(t, e) {
  32860. return t.x = Math.floor(e.x), t.y = Math.floor(e.y), t
  32861. }, t.min = function(t, e, i) {
  32862. return t.x = Math.min(e.x, i.x), t.y = Math.min(e.y, i.y), t
  32863. }, t.max = function(t, e, i) {
  32864. return t.x = Math.max(e.x, i.x), t.y = Math.max(e.y, i.y), t
  32865. }, t.round = function(t, e) {
  32866. return t.x = Math.round(e.x), t.y = Math.round(e.y), t
  32867. }, t.scale = function(t, e, i) {
  32868. return t.x = e.x * i, t.y = e.y * i, t
  32869. }, t.scaleAndAdd = function(t, e, i, n) {
  32870. return t.x = e.x + i.x * n, t.y = e.y + i.y * n, t
  32871. }, t.distance = function(t, e) {
  32872. var i = e.x - t.x,
  32873. n = e.y - t.y;
  32874. return Math.sqrt(i * i + n * n)
  32875. }, t.dist = function(e, i) {
  32876. return t.distance(e, i)
  32877. }, t.squaredDistance = function(t, e) {
  32878. var i = e.x - t.x,
  32879. n = e.y - t.y;
  32880. return i * i + n * n
  32881. }, t.sqrDist = function(e, i) {
  32882. return t.squaredDistance(e, i)
  32883. }, t.magnitude = function(t) {
  32884. var e = t.x,
  32885. i = t.y;
  32886. return Math.sqrt(e * e + i * i)
  32887. }, t.mag = function(e) {
  32888. return t.magnitude(e)
  32889. }, t.squaredMagnitude = function(t) {
  32890. var e = t.x,
  32891. i = t.y;
  32892. return e * e + i * i
  32893. }, t.sqrMag = function(e) {
  32894. return t.squaredMagnitude(e)
  32895. }, t.negate = function(t, e) {
  32896. return t.x = -e.x, t.y = -e.y, t
  32897. }, t.inverse = function(t, e) {
  32898. return t.x = 1 / e.x, t.y = 1 / e.y, t
  32899. }, t.inverseSafe = function(t, e) {
  32900. var i = e.x,
  32901. r = e.y;
  32902. return Math.abs(i) < n.EPSILON ? t.x = 0 : t.x = 1 / i, Math.abs(r) < n.EPSILON ? t.y = 0 : t.y = 1 / e.y, t
  32903. }, t.normalize = function(t, e) {
  32904. var i = e.x,
  32905. n = e.y,
  32906. r = i * i + n * n;
  32907. return r > 0 && (r = 1 / Math.sqrt(r), t.x = e.x * r, t.y = e.y * r), t
  32908. }, t.dot = function(t, e) {
  32909. return t.x * e.x + t.y * e.y
  32910. }, t.cross = function(t, e, i) {
  32911. var n = e.x * i.y - e.y * i.x;
  32912. return t.x = t.y = 0, t.z = n, t
  32913. }, t.lerp = function(t, e, i, n) {
  32914. var r = e.x,
  32915. s = e.y;
  32916. return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t
  32917. }, t.random = function(t, e) {
  32918. e = e || 1;
  32919. var i = 2 * (0, n.random)() * Math.PI;
  32920. return t.x = Math.cos(i) * e, t.y = Math.sin(i) * e, t
  32921. }, t.transformMat2 = function(t, e, i) {
  32922. var n = i.m,
  32923. r = e.x,
  32924. s = e.y;
  32925. return t.x = n[0] * r + n[2] * s, t.y = n[1] * r + n[3] * s, t
  32926. }, t.transformMat23 = function(t, e, i) {
  32927. var n = i.m,
  32928. r = e.x,
  32929. s = e.y;
  32930. return t.x = n[0] * r + n[2] * s + n[4], t.y = n[1] * r + n[3] * s + n[5], t
  32931. }, t.transformMat3 = function(t, e, i) {
  32932. var n = i.m,
  32933. r = e.x,
  32934. s = e.y;
  32935. return t.x = n[0] * r + n[3] * s + n[6], t.y = n[1] * r + n[4] * s + n[7], t
  32936. }, t.transformMat4 = function(t, e, i) {
  32937. var n = i.m,
  32938. r = e.x,
  32939. s = e.y;
  32940. return t.x = n[0] * r + n[4] * s + n[12], t.y = n[1] * r + n[5] * s + n[13], t
  32941. }, t.forEach = function(e, i, n, r, s, o) {
  32942. return t._forEach(e, i, n, r, s, o)
  32943. }, t.str = function(t) {
  32944. return "vec2(" + t.x + ", " + t.y + ")"
  32945. }, t.array = function(t, e) {
  32946. return t[0] = e.x, t[1] = e.y, t
  32947. }, t.exactEquals = function(t, e) {
  32948. return t.x === e.x && t.y === e.y
  32949. }, t.equals = function(t, e) {
  32950. var i = t.x,
  32951. r = t.y,
  32952. s = e.x,
  32953. o = e.y;
  32954. return Math.abs(i - s) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(s)) && Math.abs(r - o) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(o))
  32955. }, t.angle = function(e, i) {
  32956. return t._angle(e, i)
  32957. }, t
  32958. })();
  32959. s._forEach = (function() {
  32960. var t = s.create(0, 0);
  32961. return function(e, i, n, r, s, o) {
  32962. var a = void 0,
  32963. l = void 0;
  32964. for (i || (i = 2), n || (n = 0), l = r ? Math.min(r * i + n, e.length) : e.length, a = n; a < l; a += i) t.x = e[a], t.y = e[a + 1], s(t, t, o), e[a] = t.x, e[a + 1] = t.y;
  32965. return e
  32966. }
  32967. })(), s._angle = (function() {
  32968. var t = s.create(0, 0),
  32969. e = s.create(0, 0);
  32970. return function(i, n) {
  32971. s.normalize(t, i), s.normalize(e, n);
  32972. var r = s.dot(t, e);
  32973. return r > 1 ? 0 : r < -1 ? Math.PI : Math.acos(r)
  32974. }
  32975. })(), i.default = s, e.exports = i.default
  32976. }), {
  32977. "./utils": 333
  32978. }],
  32979. 335: [(function(t, e, i) {
  32980. "use strict";
  32981. i.__esModule = !0;
  32982. var n = t("./utils");
  32983. function r(t, e) {
  32984. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  32985. }
  32986. var s = (function() {
  32987. function t() {
  32988. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
  32989. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  32990. n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
  32991. r(this, t), this.x = e, this.y = i, this.z = n
  32992. }
  32993. return t.create = function() {
  32994. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0)
  32995. }, t.zero = function(t) {
  32996. return t.x = 0, t.y = 0, t.z = 0, t
  32997. }, t.clone = function(e) {
  32998. return new t(e.x, e.y, e.z)
  32999. }, t.copy = function(t, e) {
  33000. return t.x = e.x, t.y = e.y, t.z = e.z, t
  33001. }, t.set = function(t, e, i, n) {
  33002. return t.x = e, t.y = i, t.z = n, t
  33003. }, t.add = function(t, e, i) {
  33004. return t.x = e.x + i.x, t.y = e.y + i.y, t.z = e.z + i.z, t
  33005. }, t.subtract = function(t, e, i) {
  33006. return t.x = e.x - i.x, t.y = e.y - i.y, t.z = e.z - i.z, t
  33007. }, t.sub = function(e, i, n) {
  33008. return t.subtract(e, i, n)
  33009. }, t.multiply = function(t, e, i) {
  33010. return t.x = e.x * i.x, t.y = e.y * i.y, t.z = e.z * i.z, t
  33011. }, t.mul = function(e, i, n) {
  33012. return t.multiply(e, i, n)
  33013. }, t.divide = function(t, e, i) {
  33014. return t.x = e.x / i.x, t.y = e.y / i.y, t.z = e.z / i.z, t
  33015. }, t.div = function(e, i, n) {
  33016. return t.divide(e, i, n)
  33017. }, t.ceil = function(t, e) {
  33018. return t.x = Math.ceil(e.x), t.y = Math.ceil(e.y), t.z = Math.ceil(e.z), t
  33019. }, t.floor = function(t, e) {
  33020. return t.x = Math.floor(e.x), t.y = Math.floor(e.y), t.z = Math.floor(e.z), t
  33021. }, t.min = function(t, e, i) {
  33022. return t.x = Math.min(e.x, i.x), t.y = Math.min(e.y, i.y), t.z = Math.min(e.z, i.z), t
  33023. }, t.max = function(t, e, i) {
  33024. return t.x = Math.max(e.x, i.x), t.y = Math.max(e.y, i.y), t.z = Math.max(e.z, i.z), t
  33025. }, t.round = function(t, e) {
  33026. return t.x = Math.round(e.x), t.y = Math.round(e.y), t.z = Math.round(e.z), t
  33027. }, t.scale = function(t, e, i) {
  33028. return t.x = e.x * i, t.y = e.y * i, t.z = e.z * i, t
  33029. }, t.scaleAndAdd = function(t, e, i, n) {
  33030. return t.x = e.x + i.x * n, t.y = e.y + i.y * n, t.z = e.z + i.z * n, t
  33031. }, t.distance = function(t, e) {
  33032. var i = e.x - t.x,
  33033. n = e.y - t.y,
  33034. r = e.z - t.z;
  33035. return Math.sqrt(i * i + n * n + r * r)
  33036. }, t.dist = function(e, i) {
  33037. return t.distance(e, i)
  33038. }, t.squaredDistance = function(t, e) {
  33039. var i = e.x - t.x,
  33040. n = e.y - t.y,
  33041. r = e.z - t.z;
  33042. return i * i + n * n + r * r
  33043. }, t.sqrDist = function(e, i) {
  33044. return t.squaredDistance(e, i)
  33045. }, t.magnitude = function(t) {
  33046. var e = t.x,
  33047. i = t.y,
  33048. n = t.z;
  33049. return Math.sqrt(e * e + i * i + n * n)
  33050. }, t.mag = function(e) {
  33051. return t.magnitude(e)
  33052. }, t.squaredMagnitude = function(t) {
  33053. var e = t.x,
  33054. i = t.y,
  33055. n = t.z;
  33056. return e * e + i * i + n * n
  33057. }, t.sqrMag = function(e) {
  33058. return t.squaredMagnitude(e)
  33059. }, t.negate = function(t, e) {
  33060. return t.x = -e.x, t.y = -e.y, t.z = -e.z, t
  33061. }, t.inverse = function(t, e) {
  33062. return t.x = 1 / e.x, t.y = 1 / e.y, t.z = 1 / e.z, t
  33063. }, t.inverseSafe = function(t, e) {
  33064. var i = e.x,
  33065. r = e.y,
  33066. s = e.z;
  33067. return Math.abs(i) < n.EPSILON ? t.x = 0 : t.x = 1 / i, Math.abs(r) < n.EPSILON ? t.y = 0 : t.y = 1 / r, Math.abs(s) < n.EPSILON ? t.z = 0 : t.z = 1 / s, t
  33068. }, t.normalize = function(t, e) {
  33069. var i = e.x,
  33070. n = e.y,
  33071. r = e.z,
  33072. s = i * i + n * n + r * r;
  33073. return s > 0 && (s = 1 / Math.sqrt(s), t.x = i * s, t.y = n * s, t.z = r * s), t
  33074. }, t.dot = function(t, e) {
  33075. return t.x * e.x + t.y * e.y + t.z * e.z
  33076. }, t.cross = function(t, e, i) {
  33077. var n = e.x,
  33078. r = e.y,
  33079. s = e.z,
  33080. o = i.x,
  33081. a = i.y,
  33082. l = i.z;
  33083. return t.x = r * l - s * a, t.y = s * o - n * l, t.z = n * a - r * o, t
  33084. }, t.lerp = function(t, e, i, n) {
  33085. var r = e.x,
  33086. s = e.y,
  33087. o = e.z;
  33088. return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t.z = o + n * (i.z - o), t
  33089. }, t.hermite = function(t, e, i, n, r, s) {
  33090. var o = s * s,
  33091. a = o * (2 * s - 3) + 1,
  33092. l = o * (s - 2) + s,
  33093. h = o * (s - 1),
  33094. c = o * (3 - 2 * s);
  33095. return t.x = e.x * a + i.x * l + n.x * h + r.x * c, t.y = e.y * a + i.y * l + n.y * h + r.y * c, t.z = e.z * a + i.z * l + n.z * h + r.z * c, t
  33096. }, t.bezier = function(t, e, i, n, r, s) {
  33097. var o = 1 - s,
  33098. a = o * o,
  33099. l = s * s,
  33100. h = a * o,
  33101. c = 3 * s * a,
  33102. u = 3 * l * o,
  33103. _ = l * s;
  33104. return t.x = e.x * h + i.x * c + n.x * u + r.x * _, t.y = e.y * h + i.y * c + n.y * u + r.y * _, t.z = e.z * h + i.z * c + n.z * u + r.z * _, t
  33105. }, t.random = function(t, e) {
  33106. e = e || 1;
  33107. var i = 2 * (0, n.random)() * Math.PI,
  33108. r = Math.acos(2 * (0, n.random)() - 1);
  33109. return t.x = Math.sin(r) * Math.cos(i) * e, t.y = Math.sin(r) * Math.sin(i) * e, t.z = Math.cos(r) * e, t
  33110. }, t.transformMat4 = function(t, e, i) {
  33111. var n = i.m,
  33112. r = e.x,
  33113. s = e.y,
  33114. o = e.z,
  33115. a = n[3] * r + n[7] * s + n[11] * o + n[15];
  33116. return a = a ? 1 / a : 1, t.x = (n[0] * r + n[4] * s + n[8] * o + n[12]) * a, t.y = (n[1] * r + n[5] * s + n[9] * o + n[13]) * a, t.z = (n[2] * r + n[6] * s + n[10] * o + n[14]) * a, t
  33117. }, t.transformMat4Normal = function(t, e, i) {
  33118. var n = i.m,
  33119. r = e.x,
  33120. s = e.y,
  33121. o = e.z,
  33122. a = n[3] * r + n[7] * s + n[11] * o;
  33123. return a = a ? 1 / a : 1, t.x = (n[0] * r + n[4] * s + n[8] * o) * a, t.y = (n[1] * r + n[5] * s + n[9] * o) * a, t.z = (n[2] * r + n[6] * s + n[10] * o) * a, t
  33124. }, t.transformMat3 = function(t, e, i) {
  33125. var n = i.m,
  33126. r = e.x,
  33127. s = e.y,
  33128. o = e.z;
  33129. return t.x = r * n[0] + s * n[3] + o * n[6], t.y = r * n[1] + s * n[4] + o * n[7], t.z = r * n[2] + s * n[5] + o * n[8], t
  33130. }, t.transformQuat = function(t, e, i) {
  33131. var n = e.x,
  33132. r = e.y,
  33133. s = e.z,
  33134. o = i.x,
  33135. a = i.y,
  33136. l = i.z,
  33137. h = i.w,
  33138. c = h * n + a * s - l * r,
  33139. u = h * r + l * n - o * s,
  33140. _ = h * s + o * r - a * n,
  33141. f = -o * n - a * r - l * s;
  33142. return t.x = c * h + f * -o + u * -l - _ * -a, t.y = u * h + f * -a + _ * -o - c * -l, t.z = _ * h + f * -l + c * -a - u * -o, t
  33143. }, t.rotateX = function(t, e, i, n) {
  33144. var r = e.x - i.x,
  33145. s = e.y - i.y,
  33146. o = e.z - i.z,
  33147. a = r,
  33148. l = s * Math.cos(n) - o * Math.sin(n),
  33149. h = s * Math.sin(n) + o * Math.cos(n);
  33150. return t.x = a + i.x, t.y = l + i.y, t.z = h + i.z, t
  33151. }, t.rotateY = function(t, e, i, n) {
  33152. var r = e.x - i.x,
  33153. s = e.y - i.y,
  33154. o = e.z - i.z,
  33155. a = o * Math.sin(n) + r * Math.cos(n),
  33156. l = s,
  33157. h = o * Math.cos(n) - r * Math.sin(n);
  33158. return t.x = a + i.x, t.y = l + i.y, t.z = h + i.z, t
  33159. }, t.rotateZ = function(t, e, i, n) {
  33160. var r = e.x - i.x,
  33161. s = e.y - i.y,
  33162. o = e.z - i.z,
  33163. a = r * Math.cos(n) - s * Math.sin(n),
  33164. l = r * Math.sin(n) + s * Math.cos(n),
  33165. h = o;
  33166. return t.x = a + i.x, t.y = l + i.y, t.z = h + i.z, t
  33167. }, t.str = function(t) {
  33168. return "vec3(" + t.x + ", " + t.y + ", " + t.z + ")"
  33169. }, t.array = function(t, e) {
  33170. return t[0] = e.x, t[1] = e.y, t[2] = e.z, t
  33171. }, t.exactEquals = function(t, e) {
  33172. return t.x === e.x && t.y === e.y && t.z === e.z
  33173. }, t.equals = function(t, e) {
  33174. var i = t.x,
  33175. r = t.y,
  33176. s = t.z,
  33177. o = e.x,
  33178. a = e.y,
  33179. l = e.z;
  33180. return Math.abs(i - o) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(r - a) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(a)) && Math.abs(s - l) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(l))
  33181. }, t.forEach = function(e, i, n, r, s, o) {
  33182. return t._forEach(e, i, n, r, s, o)
  33183. }, t.angle = function(e, i) {
  33184. return t._angle(e, i)
  33185. }, t.projectOnPlane = function(e, i, n) {
  33186. return t.sub(e, i, t.project(e, i, n))
  33187. }, t.project = function(e, i, n) {
  33188. var r = t.squaredMagnitude(n);
  33189. return r < 1e-6 ? t.set(e, 0, 0, 0) : t.scale(e, n, t.dot(i, n) / r)
  33190. }, t
  33191. })();
  33192. s._forEach = (function() {
  33193. var t = s.create(0, 0, 0);
  33194. return function(e, i, n, r, s, o) {
  33195. var a = void 0,
  33196. l = void 0;
  33197. for (i || (i = 3), n || (n = 0), l = r ? Math.min(r * i + n, e.length) : e.length, a = n; a < l; a += i) t.x = e[a], t.y = e[a + 1], t.z = e[a + 2], s(t, t, o), e[a] = t.x, e[a + 1] = t.y, e[a + 2] = t.z;
  33198. return e
  33199. }
  33200. })(), s._angle = (function() {
  33201. var t = s.create(0, 0, 0),
  33202. e = s.create(0, 0, 0);
  33203. return function(i, n) {
  33204. s.copy(t, i), s.copy(e, n), s.normalize(t, t), s.normalize(e, e);
  33205. var r = s.dot(t, e);
  33206. return r > 1 ? 0 : r < -1 ? Math.PI : Math.acos(r)
  33207. }
  33208. })(), i.default = s, e.exports = i.default
  33209. }), {
  33210. "./utils": 333
  33211. }],
  33212. 336: [(function(t, e, i) {
  33213. "use strict";
  33214. i.__esModule = !0;
  33215. var n = t("./utils");
  33216. function r(t, e) {
  33217. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  33218. }
  33219. var s = (function() {
  33220. function t() {
  33221. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
  33222. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
  33223. n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  33224. s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
  33225. r(this, t), this.x = e, this.y = i, this.z = n, this.w = s
  33226. }
  33227. return t.create = function() {
  33228. return new t(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1)
  33229. }, t.zero = function(t) {
  33230. return t.x = 0, t.y = 0, t.z = 0, t.w = 0, t
  33231. }, t.clone = function(e) {
  33232. return new t(e.x, e.y, e.z, e.w)
  33233. }, t.copy = function(t, e) {
  33234. return t.x = e.x, t.y = e.y, t.z = e.z, t.w = e.w, t
  33235. }, t.set = function(t, e, i, n, r) {
  33236. return t.x = e, t.y = i, t.z = n, t.w = r, t
  33237. }, t.add = function(t, e, i) {
  33238. return t.x = e.x + i.x, t.y = e.y + i.y, t.z = e.z + i.z, t.w = e.w + i.w, t
  33239. }, t.subtract = function(t, e, i) {
  33240. return t.x = e.x - i.x, t.y = e.y - i.y, t.z = e.z - i.z, t.w = e.w - i.w, t
  33241. }, t.sub = function(e, i, n) {
  33242. return t.subtract(e, i, n)
  33243. }, t.multiply = function(t, e, i) {
  33244. return t.x = e.x * i.x, t.y = e.y * i.y, t.z = e.z * i.z, t.w = e.w * i.w, t
  33245. }, t.mul = function(e, i, n) {
  33246. return t.multiply(e, i, n)
  33247. }, t.divide = function(t, e, i) {
  33248. return t.x = e.x / i.x, t.y = e.y / i.y, t.z = e.z / i.z, t.w = e.w / i.w, t
  33249. }, t.div = function(e, i, n) {
  33250. return t.divide(e, i, n)
  33251. }, t.ceil = function(t, e) {
  33252. return t.x = Math.ceil(e.x), t.y = Math.ceil(e.y), t.z = Math.ceil(e.z), t.w = Math.ceil(e.w), t
  33253. }, t.floor = function(t, e) {
  33254. return t.x = Math.floor(e.x), t.y = Math.floor(e.y), t.z = Math.floor(e.z), t.w = Math.floor(e.w), t
  33255. }, t.min = function(t, e, i) {
  33256. return t.x = Math.min(e.x, i.x), t.y = Math.min(e.y, i.y), t.z = Math.min(e.z, i.z), t.w = Math.min(e.w, i.w), t
  33257. }, t.max = function(t, e, i) {
  33258. return t.x = Math.max(e.x, i.x), t.y = Math.max(e.y, i.y), t.z = Math.max(e.z, i.z), t.w = Math.max(e.w, i.w), t
  33259. }, t.round = function(t, e) {
  33260. return t.x = Math.round(e.x), t.y = Math.round(e.y), t.z = Math.round(e.z), t.w = Math.round(e.w), t
  33261. }, t.scale = function(t, e, i) {
  33262. return t.x = e.x * i, t.y = e.y * i, t.z = e.z * i, t.w = e.w * i, t
  33263. }, t.scaleAndAdd = function(t, e, i, n) {
  33264. return t.x = e.x + i.x * n, t.y = e.y + i.y * n, t.z = e.z + i.z * n, t.w = e.w + i.w * n, t
  33265. }, t.distance = function(t, e) {
  33266. var i = e.x - t.x,
  33267. n = e.y - t.y,
  33268. r = e.z - t.z,
  33269. s = e.w - t.w;
  33270. return Math.sqrt(i * i + n * n + r * r + s * s)
  33271. }, t.dist = function(e, i) {
  33272. return t.distance(e, i)
  33273. }, t.squaredDistance = function(t, e) {
  33274. var i = e.x - t.x,
  33275. n = e.y - t.y,
  33276. r = e.z - t.z,
  33277. s = e.w - t.w;
  33278. return i * i + n * n + r * r + s * s
  33279. }, t.sqrDist = function(e, i) {
  33280. return t.squaredDistance(e, i)
  33281. }, t.magnitude = function(t) {
  33282. var e = t.x,
  33283. i = t.y,
  33284. n = t.z,
  33285. r = t.w;
  33286. return Math.sqrt(e * e + i * i + n * n + r * r)
  33287. }, t.mag = function(e) {
  33288. return t.magnitude(e)
  33289. }, t.squaredMagnitude = function(t) {
  33290. var e = t.x,
  33291. i = t.y,
  33292. n = t.z,
  33293. r = t.w;
  33294. return e * e + i * i + n * n + r * r
  33295. }, t.sqrMag = function(e) {
  33296. return t.squaredMagnitude(e)
  33297. }, t.negate = function(t, e) {
  33298. return t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = -e.w, t
  33299. }, t.inverse = function(t, e) {
  33300. return t.x = 1 / e.x, t.y = 1 / e.y, t.z = 1 / e.z, t.w = 1 / e.w, t
  33301. }, t.inverseSafe = function(t, e) {
  33302. var i = e.x,
  33303. r = e.y,
  33304. s = e.z,
  33305. o = e.w;
  33306. return Math.abs(i) < n.EPSILON ? t.x = 0 : t.x = 1 / i, Math.abs(r) < n.EPSILON ? t.y = 0 : t.y = 1 / r, Math.abs(s) < n.EPSILON ? t.z = 0 : t.z = 1 / s, Math.abs(o) < n.EPSILON ? t.w = 0 : t.w = 1 / o, t
  33307. }, t.normalize = function(t, e) {
  33308. var i = e.x,
  33309. n = e.y,
  33310. r = e.z,
  33311. s = e.w,
  33312. o = i * i + n * n + r * r + s * s;
  33313. return o > 0 && (o = 1 / Math.sqrt(o), t.x = i * o, t.y = n * o, t.z = r * o, t.w = s * o), t
  33314. }, t.dot = function(t, e) {
  33315. return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w
  33316. }, t.lerp = function(t, e, i, n) {
  33317. var r = e.x,
  33318. s = e.y,
  33319. o = e.z,
  33320. a = e.w;
  33321. return t.x = r + n * (i.x - r), t.y = s + n * (i.y - s), t.z = o + n * (i.z - o), t.w = a + n * (i.w - a), t
  33322. }, t.random = function(t, e) {
  33323. e = e || 1;
  33324. var i = 2 * (0, n.random)() * Math.PI,
  33325. r = Math.acos(2 * (0, n.random)() - 1);
  33326. return t.x = Math.sin(r) * Math.cos(i) * e, t.y = Math.sin(r) * Math.sin(i) * e, t.z = Math.cos(r) * e, t.w = 0, t
  33327. }, t.transformMat4 = function(t, e, i) {
  33328. var n = i.m,
  33329. r = e.x,
  33330. s = e.y,
  33331. o = e.z,
  33332. a = e.w;
  33333. return t.x = n[0] * r + n[4] * s + n[8] * o + n[12] * a, t.y = n[1] * r + n[5] * s + n[9] * o + n[13] * a, t.z = n[2] * r + n[6] * s + n[10] * o + n[14] * a, t.w = n[3] * r + n[7] * s + n[11] * o + n[15] * a, t
  33334. }, t.transformQuat = function(t, e, i) {
  33335. var n = e.x,
  33336. r = e.y,
  33337. s = e.z,
  33338. o = i.x,
  33339. a = i.y,
  33340. l = i.z,
  33341. h = i.w,
  33342. c = h * n + a * s - l * r,
  33343. u = h * r + l * n - o * s,
  33344. _ = h * s + o * r - a * n,
  33345. f = -o * n - a * r - l * s;
  33346. return t.x = c * h + f * -o + u * -l - _ * -a, t.y = u * h + f * -a + _ * -o - c * -l, t.z = _ * h + f * -l + c * -a - u * -o, t.w = e.w, t
  33347. }, t.str = function(t) {
  33348. return "vec4(" + t.x + ", " + t.y + ", " + t.z + ", " + t.w + ")"
  33349. }, t.array = function(t, e) {
  33350. return t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w, t
  33351. }, t.exactEquals = function(t, e) {
  33352. return t.x === e.x && t.y === e.y && t.z === e.z && t.w === e.w
  33353. }, t.equals = function(t, e) {
  33354. var i = t.x,
  33355. r = t.y,
  33356. s = t.z,
  33357. o = t.w,
  33358. a = e.x,
  33359. l = e.y,
  33360. h = e.z,
  33361. c = e.w;
  33362. return Math.abs(i - a) <= n.EPSILON * Math.max(1, Math.abs(i), Math.abs(a)) && Math.abs(r - l) <= n.EPSILON * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(s - h) <= n.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(o - c) <= n.EPSILON * Math.max(1, Math.abs(o), Math.abs(c))
  33363. }, t.forEach = function(e, i, n, r, s, o) {
  33364. return t._forEach(e, i, n, r, s, o)
  33365. }, t
  33366. })();
  33367. s._forEach = (function() {
  33368. var t = s.create(0, 0, 0, 0);
  33369. return function(e, i, n, r, s, o) {
  33370. var a = void 0,
  33371. l = void 0;
  33372. for (i || (i = 4), n || (n = 0), l = r ? Math.min(r * i + n, e.length) : e.length, a = n; a < l; a += i) t.x = e[a], t.y = e[a + 1], t.z = e[a + 2], t.w = e[a + 3], s(t, t, o), e[a] = t.x, e[a + 1] = t.y, e[a + 2] = t.z, e[a + 3] = t.w;
  33373. return e
  33374. }
  33375. })(), i.default = s, e.exports = i.default
  33376. }), {
  33377. "./utils": 333
  33378. }],
  33379. 337: [(function(t, e, i) {
  33380. "use strict";
  33381. cc.js
  33382. }), {}],
  33383. 338: [(function(t, e, i) {
  33384. "use strict";
  33385. t("./core/CCGame"), t("./actions")
  33386. }), {
  33387. "./actions": 7,
  33388. "./core/CCGame": 51
  33389. }],
  33390. 339: [(function(t, e, i) {
  33391. "use strict";
  33392. var n = t("../compression/zlib.min"),
  33393. r = t("../core/CCDebug"),
  33394. s = function(t) {
  33395. var e, i, n, s, o, a, l, h, c, u, _, f, d;
  33396. for (this.data = t, this.pos = 8, this.palette = [], this.imgData = [], this.transparency = {}, this.animation = null, this.text = {}, o = null;;) {
  33397. switch (e = this.readUInt32(), h = function() {
  33398. var t, e;
  33399. for (e = [], t = 0; t < 4; ++t) e.push(String.fromCharCode(this.data[this.pos++]));
  33400. return e
  33401. }.call(this).join("")) {
  33402. case "IHDR":
  33403. this.width = this.readUInt32(), this.height = this.readUInt32(), this.bits = this.data[this.pos++], this.colorType = this.data[this.pos++], this.compressionMethod = this.data[this.pos++], this.filterMethod = this.data[this.pos++], this.interlaceMethod = this.data[this.pos++];
  33404. break;
  33405. case "acTL":
  33406. this.animation = {
  33407. numFrames: this.readUInt32(),
  33408. numPlays: this.readUInt32() || 1 / 0,
  33409. frames: []
  33410. };
  33411. break;
  33412. case "PLTE":
  33413. this.palette = this.read(e);
  33414. break;
  33415. case "fcTL":
  33416. o && this.animation.frames.push(o), this.pos += 4, o = {
  33417. width: this.readUInt32(),
  33418. height: this.readUInt32(),
  33419. xOffset: this.readUInt32(),
  33420. yOffset: this.readUInt32()
  33421. }, s = this.readUInt16(), n = this.readUInt16() || 100, o.delay = 1e3 * s / n, o.disposeOp = this.data[this.pos++], o.blendOp = this.data[this.pos++], o.data = [];
  33422. break;
  33423. case "IDAT":
  33424. case "fdAT":
  33425. for ("fdAT" === h && (this.pos += 4, e -= 4), t = (null != o ? o.data : void 0) || this.imgData, _ = 0; 0 <= e ? _ < e : _ > e; 0 <= e ? ++_ : --_) t.push(this.data[this.pos++]);
  33426. break;
  33427. case "tRNS":
  33428. switch (this.transparency = {}, this.colorType) {
  33429. case 3:
  33430. if (this.transparency.indexed = this.read(e), (c = 255 - this.transparency.indexed.length) > 0)
  33431. for (f = 0; 0 <= c ? f < c : f > c; 0 <= c ? ++f : --f) this.transparency.indexed.push(255);
  33432. break;
  33433. case 0:
  33434. this.transparency.grayscale = this.read(e)[0];
  33435. break;
  33436. case 2:
  33437. this.transparency.rgb = this.read(e)
  33438. }
  33439. break;
  33440. case "tEXt":
  33441. a = (u = this.read(e)).indexOf(0), l = String.fromCharCode.apply(String, u.slice(0, a)), this.text[l] = String.fromCharCode.apply(String, u.slice(a + 1));
  33442. break;
  33443. case "IEND":
  33444. return o && this.animation.frames.push(o), this.colors = function() {
  33445. switch (this.colorType) {
  33446. case 0:
  33447. case 3:
  33448. case 4:
  33449. return 1;
  33450. case 2:
  33451. case 6:
  33452. return 3
  33453. }
  33454. }.call(this), this.hasAlphaChannel = 4 === (d = this.colorType) || 6 === d, i = this.colors + (this.hasAlphaChannel ? 1 : 0), this.pixelBitlength = this.bits * i, this.colorSpace = function() {
  33455. switch (this.colors) {
  33456. case 1:
  33457. return "DeviceGray";
  33458. case 3:
  33459. return "DeviceRGB"
  33460. }
  33461. }.call(this), void(Uint8Array != Array && (this.imgData = new Uint8Array(this.imgData)));
  33462. default:
  33463. this.pos += e
  33464. }
  33465. if (this.pos += 4, this.pos > this.data.length) throw new Error(r.getError(6017))
  33466. }
  33467. };
  33468. s.prototype = {
  33469. constructor: s,
  33470. read: function(t) {
  33471. var e, i;
  33472. for (i = [], e = 0; 0 <= t ? e < t : e > t; 0 <= t ? ++e : --e) i.push(this.data[this.pos++]);
  33473. return i
  33474. },
  33475. readUInt32: function() {
  33476. return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]
  33477. },
  33478. readUInt16: function() {
  33479. return this.data[this.pos++] << 8 | this.data[this.pos++]
  33480. },
  33481. decodePixels: function(t) {
  33482. var e, i, s, o, a, l, h, c, u, _, f, d, p, m, y, v, g, x, b, A, C, T, S;
  33483. if (null == t && (t = this.imgData), 0 === t.length) return new Uint8Array(0);
  33484. for (t = new n.Inflate(t, {
  33485. index: 0,
  33486. verify: !1
  33487. }).decompress(), v = (d = this.pixelBitlength / 8) * this.width, p = new Uint8Array(v * this.height), l = t.length, y = 0, m = 0, i = 0; m < l;) {
  33488. switch (t[m++]) {
  33489. case 0:
  33490. for (o = b = 0; b < v; o = b += 1) p[i++] = t[m++];
  33491. break;
  33492. case 1:
  33493. for (o = A = 0; A < v; o = A += 1) e = t[m++], a = o < d ? 0 : p[i - d], p[i++] = (e + a) % 256;
  33494. break;
  33495. case 2:
  33496. for (o = C = 0; C < v; o = C += 1) e = t[m++], s = (o - o % d) / d, g = y && p[(y - 1) * v + s * d + o % d], p[i++] = (g + e) % 256;
  33497. break;
  33498. case 3:
  33499. for (o = T = 0; T < v; o = T += 1) e = t[m++], s = (o - o % d) / d, a = o < d ? 0 : p[i - d], g = y && p[(y - 1) * v + s * d + o % d], p[i++] = (e + Math.floor((a + g) / 2)) % 256;
  33500. break;
  33501. case 4:
  33502. for (o = S = 0; S < v; o = S += 1) e = t[m++], s = (o - o % d) / d, a = o < d ? 0 : p[i - d], 0 === y ? g = x = 0 : (g = p[(y - 1) * v + s * d + o % d], x = s && p[(y - 1) * v + (s - 1) * d + o % d]), h = a + g - x, c = Math.abs(h - a), _ = Math.abs(h - g), f = Math.abs(h - x), u = c <= _ && c <= f ? a : _ <= f ? g : x, p[i++] = (e + u) % 256;
  33503. break;
  33504. default:
  33505. throw new Error(r.getError(6018, t[m - 1]))
  33506. }
  33507. y++
  33508. }
  33509. return p
  33510. },
  33511. copyToImageData: function(t, e) {
  33512. var i, n, r, s, o, a, l, h, c, u, _;
  33513. if (n = this.colors, c = null, i = this.hasAlphaChannel, this.palette.length && (c = null != (_ = this._decodedPalette) ? _ : this._decodedPalette = this.decodePalette(), n = 4, i = !0), h = (r = t.data || t).length, o = c || e, s = a = 0, 1 === n)
  33514. for (; s < h;) l = c ? 4 * e[s / 4] : a, u = o[l++], r[s++] = u, r[s++] = u, r[s++] = u, r[s++] = i ? o[l++] : 255, a = l;
  33515. else
  33516. for (; s < h;) l = c ? 4 * e[s / 4] : a, r[s++] = o[l++], r[s++] = o[l++], r[s++] = o[l++], r[s++] = i ? o[l++] : 255, a = l
  33517. },
  33518. decodePalette: function() {
  33519. var t, e, i, n, r, s, o, a, l;
  33520. for (i = this.palette, s = this.transparency.indexed || [], r = new Uint8Array((s.length || 0) + i.length), n = 0, t = 0, e = o = 0, a = i.length; o < a; e = o += 3) r[n++] = i[e], r[n++] = i[e + 1], r[n++] = i[e + 2], r[n++] = null != (l = s[t++]) ? l : 255;
  33521. return r
  33522. },
  33523. render: function(t) {
  33524. var e, i;
  33525. return t.width = this.width, t.height = this.height, i = (e = t.getContext("2d")).createImageData(this.width, this.height), this.copyToImageData(i, this.decodePixels()), e.putImageData(i, 0, 0)
  33526. }
  33527. }, e.exports = s
  33528. }), {
  33529. "../compression/zlib.min": 25,
  33530. "../core/CCDebug": 49
  33531. }],
  33532. 340: [(function(t, e, i) {
  33533. "use strict";
  33534. var n = t("../core/assets/CCAsset"),
  33535. r = t("../core/assets/CCSpriteFrame"),
  33536. s = cc.Class({
  33537. name: "cc.ParticleAsset",
  33538. extends: n,
  33539. properties: {
  33540. spriteFrame: {
  33541. default: null,
  33542. type: r
  33543. }
  33544. }
  33545. });
  33546. cc.ParticleAsset = e.exports = s
  33547. }), {
  33548. "../core/assets/CCAsset": 56,
  33549. "../core/assets/CCSpriteFrame": 70
  33550. }],
  33551. 341: [(function(t, e, i) {
  33552. "use strict";
  33553. var n = t("../core/platform/CCMacro"),
  33554. r = t("./CCParticleAsset"),
  33555. s = t("../core/components/CCRenderComponent"),
  33556. o = t("../compression/ZipUtils"),
  33557. a = t("./CCPNGReader"),
  33558. l = t("./CCTIFFReader"),
  33559. h = t("../core/utils/texture-util"),
  33560. c = (t("../core/renderer/render-flow"), t("./particle-simulator")),
  33561. u = t("../core/assets/material/CCMaterial"),
  33562. _ = t("../core/utils/blend-func");
  33563. function f(t) {
  33564. return t.length > 8 && 137 === t[0] && 80 === t[1] && 78 === t[2] && 71 === t[3] && 13 === t[4] && 10 === t[5] && 26 === t[6] && 10 === t[7] ? n.ImageFormat.PNG : t.length > 2 && (73 === t[0] && 73 === t[1] || 77 === t[0] && 77 === t[1] || 255 === t[0] && 216 === t[1]) ? n.ImageFormat.TIFF : n.ImageFormat.UNKNOWN
  33565. }
  33566. var d = cc.Enum({
  33567. GRAVITY: 0,
  33568. RADIUS: 1
  33569. }),
  33570. p = cc.Enum({
  33571. FREE: 0,
  33572. RELATIVE: 1,
  33573. GROUPED: 2
  33574. }),
  33575. m = {
  33576. preview: {
  33577. default: !0,
  33578. editorOnly: !0,
  33579. notify: !1,
  33580. animatable: !1,
  33581. tooltip: !1
  33582. },
  33583. _custom: !1,
  33584. custom: {
  33585. get: function() {
  33586. return this._custom
  33587. },
  33588. set: function(t) {
  33589. this._custom !== t && (this._custom = t, this._applyFile())
  33590. },
  33591. animatable: !1,
  33592. tooltip: !1
  33593. },
  33594. _file: {
  33595. default: null,
  33596. type: r
  33597. },
  33598. file: {
  33599. get: function() {
  33600. return this._file
  33601. },
  33602. set: function(t, e) {
  33603. this._file !== t && (this._file = t, t ? this._applyFile() : this.custom = !0)
  33604. },
  33605. animatable: !1,
  33606. type: r,
  33607. tooltip: !1
  33608. },
  33609. _spriteFrame: {
  33610. default: null,
  33611. type: cc.SpriteFrame
  33612. },
  33613. spriteFrame: {
  33614. get: function() {
  33615. return this._spriteFrame
  33616. },
  33617. set: function(t, e) {
  33618. var i = this._renderSpriteFrame;
  33619. i !== t && (this._renderSpriteFrame = t, t && !t._uuid || (this._spriteFrame = t), (i && i.getTexture()) !== (t && t.getTexture()) && (this._texture = null, this._applySpriteFrame(i)))
  33620. },
  33621. type: cc.SpriteFrame,
  33622. tooltip: !1
  33623. },
  33624. _texture: {
  33625. default: null,
  33626. type: cc.Texture2D,
  33627. editorOnly: !0
  33628. },
  33629. texture: {
  33630. get: function() {
  33631. return this._texture
  33632. },
  33633. set: function(t) {
  33634. t && cc.warnID(6017)
  33635. },
  33636. type: cc.Texture2D,
  33637. tooltip: !1,
  33638. readonly: !0,
  33639. visible: !1,
  33640. animatable: !1
  33641. },
  33642. particleCount: {
  33643. visible: !1,
  33644. get: function() {
  33645. return this._simulator.particles.length
  33646. },
  33647. readonly: !0
  33648. },
  33649. _stopped: !0,
  33650. stopped: {
  33651. get: function() {
  33652. return this._stopped
  33653. },
  33654. animatable: !1,
  33655. visible: !1
  33656. },
  33657. playOnLoad: !0,
  33658. autoRemoveOnFinish: {
  33659. default: !1,
  33660. animatable: !1,
  33661. tooltip: !1
  33662. },
  33663. active: {
  33664. get: function() {
  33665. return this._simulator.active
  33666. },
  33667. visible: !1
  33668. },
  33669. totalParticles: 150,
  33670. duration: -1,
  33671. emissionRate: 10,
  33672. life: 1,
  33673. lifeVar: 0,
  33674. _startColor: null,
  33675. startColor: {
  33676. type: cc.Color,
  33677. get: function() {
  33678. return this._startColor
  33679. },
  33680. set: function(t) {
  33681. this._startColor.r = t.r, this._startColor.g = t.g, this._startColor.b = t.b, this._startColor.a = t.a
  33682. }
  33683. },
  33684. _startColorVar: null,
  33685. startColorVar: {
  33686. type: cc.Color,
  33687. get: function() {
  33688. return this._startColorVar
  33689. },
  33690. set: function(t) {
  33691. this._startColorVar.r = t.r, this._startColorVar.g = t.g, this._startColorVar.b = t.b, this._startColorVar.a = t.a
  33692. }
  33693. },
  33694. _endColor: null,
  33695. endColor: {
  33696. type: cc.Color,
  33697. get: function() {
  33698. return this._endColor
  33699. },
  33700. set: function(t) {
  33701. this._endColor.r = t.r, this._endColor.g = t.g, this._endColor.b = t.b, this._endColor.a = t.a
  33702. }
  33703. },
  33704. _endColorVar: null,
  33705. endColorVar: {
  33706. type: cc.Color,
  33707. get: function() {
  33708. return this._endColorVar
  33709. },
  33710. set: function(t) {
  33711. this._endColorVar.r = t.r, this._endColorVar.g = t.g, this._endColorVar.b = t.b, this._endColorVar.a = t.a
  33712. }
  33713. },
  33714. angle: 90,
  33715. angleVar: 20,
  33716. startSize: 50,
  33717. startSizeVar: 0,
  33718. endSize: 0,
  33719. endSizeVar: 0,
  33720. startSpin: 0,
  33721. startSpinVar: 0,
  33722. endSpin: 0,
  33723. endSpinVar: 0,
  33724. sourcePos: cc.Vec2.ZERO,
  33725. posVar: cc.Vec2.ZERO,
  33726. _positionType: {
  33727. default: p.FREE,
  33728. formerlySerializedAs: "positionType"
  33729. },
  33730. positionType: {
  33731. type: p,
  33732. get: function() {
  33733. return this._positionType
  33734. },
  33735. set: function(t) {
  33736. var e = this.getMaterial(0);
  33737. e && e.define("CC_USE_MODEL", t !== p.FREE), this._positionType = t
  33738. }
  33739. },
  33740. emitterMode: {
  33741. default: d.GRAVITY,
  33742. type: d
  33743. },
  33744. gravity: cc.Vec2.ZERO,
  33745. speed: 180,
  33746. speedVar: 50,
  33747. tangentialAccel: 80,
  33748. tangentialAccelVar: 0,
  33749. radialAccel: 0,
  33750. radialAccelVar: 0,
  33751. rotationIsDir: !1,
  33752. startRadius: 0,
  33753. startRadiusVar: 0,
  33754. endRadius: 0,
  33755. endRadiusVar: 0,
  33756. rotatePerS: 0,
  33757. rotatePerSVar: 0
  33758. },
  33759. y = cc.Class({
  33760. name: "cc.ParticleSystem",
  33761. extends: s,
  33762. mixins: [_],
  33763. editor: !1,
  33764. ctor: function() {
  33765. this.initProperties()
  33766. },
  33767. initProperties: function() {
  33768. this._previewTimer = null, this._focused = !1, this._simulator = new c(this), this._texture = null, this._startColor = cc.color(255, 255, 255, 255), this._startColorVar = cc.color(0, 0, 0, 0), this._endColor = cc.color(255, 255, 255, 0), this._endColorVar = cc.color(0, 0, 0, 0), this._renderSpriteFrame = null
  33769. },
  33770. properties: m,
  33771. statics: {
  33772. DURATION_INFINITY: -1,
  33773. START_SIZE_EQUAL_TO_END_SIZE: -1,
  33774. START_RADIUS_EQUAL_TO_END_RADIUS: -1,
  33775. EmitterMode: d,
  33776. PositionType: p,
  33777. _PNGReader: a,
  33778. _TIFFReader: l
  33779. },
  33780. onFocusInEditor: !1,
  33781. onLostFocusInEditor: !1,
  33782. _startPreview: !1,
  33783. _stopPreview: !1,
  33784. _convertTextureToSpriteFrame: !1,
  33785. __preload: function() {
  33786. if (this._super(), this._custom && this.spriteFrame && !this._renderSpriteFrame) this._applySpriteFrame(this.spriteFrame);
  33787. else if (this._file) {
  33788. if (this._custom) !this._texture && this._applyFile();
  33789. else this._applyFile()
  33790. }
  33791. this.playOnLoad && this.resetSystem()
  33792. },
  33793. onEnable: function() {
  33794. this._super(), this._activateMaterial()
  33795. },
  33796. onDestroy: function() {
  33797. this.autoRemoveOnFinish && (this.autoRemoveOnFinish = !1), this._buffer && (this._buffer.destroy(), this._buffer = null), this._simulator._uvFilled = 0, this._super()
  33798. },
  33799. lateUpdate: function(t) {
  33800. this._simulator.finished || this._simulator.step(t)
  33801. },
  33802. addParticle: function() {},
  33803. stopSystem: function() {
  33804. this._stopped = !0, this._simulator.stop()
  33805. },
  33806. resetSystem: function() {
  33807. this._stopped = !1, this._simulator.reset(), this._activateMaterial()
  33808. },
  33809. isFull: function() {
  33810. return this.particleCount >= this.totalParticles
  33811. },
  33812. setTextureWithRect: function(t, e) {
  33813. t instanceof cc.Texture2D && (this.spriteFrame = new cc.SpriteFrame(t, e))
  33814. },
  33815. _applyFile: function() {
  33816. var t = this._file;
  33817. if (t) {
  33818. var e = this;
  33819. cc.loader.load(t.nativeUrl, (function(i, n) {
  33820. !i && n ? e.isValid && (e._plistFile = t.nativeUrl, e._custom || e._initWithDictionary(n), e._spriteFrame ? !e._renderSpriteFrame && e._spriteFrame && e._applySpriteFrame(e.spriteFrame) : t.spriteFrame ? e.spriteFrame = t.spriteFrame : e._custom && e._initTextureWithDictionary(n)) : cc.errorID(6029)
  33821. }))
  33822. }
  33823. },
  33824. _initTextureWithDictionary: function(t) {
  33825. var e = cc.path.changeBasename(this._plistFile, t.textureFileName || "");
  33826. if (t.textureFileName) h.loadImage(e, (function(e, i) {
  33827. e ? (t.textureFileName = void 0, this._initTextureWithDictionary(t)) : this.spriteFrame = new cc.SpriteFrame(i)
  33828. }), this);
  33829. else if (t.textureImageData) {
  33830. var i = t.textureImageData;
  33831. if (!(i && i.length > 0)) return !1;
  33832. var r = cc.loader.getRes(e);
  33833. if (!r) {
  33834. var s = o.unzipBase64AsArray(i, 1);
  33835. if (!s) return cc.logID(6030), !1;
  33836. var c = f(s);
  33837. if (c !== n.ImageFormat.TIFF && c !== n.ImageFormat.PNG) return cc.logID(6031), !1;
  33838. var u = document.createElement("canvas");
  33839. if (c === n.ImageFormat.PNG) new a(s).render(u);
  33840. else l.parseTIFF(s, u);
  33841. r = h.cacheImage(e, u)
  33842. }
  33843. r || cc.logID(6032), this.spriteFrame = new cc.SpriteFrame(r)
  33844. }
  33845. return !0
  33846. },
  33847. _initWithDictionary: function(t) {
  33848. this.totalParticles = parseInt(t.maxParticles || 0), this.life = parseFloat(t.particleLifespan || 0), this.lifeVar = parseFloat(t.particleLifespanVariance || 0);
  33849. var e = t.emissionRate;
  33850. this.emissionRate = e || Math.min(this.totalParticles / this.life, Number.MAX_VALUE), this.duration = parseFloat(t.duration || 0), this.srcBlendFactor = parseInt(t.blendFuncSource || n.SRC_ALPHA), this.dstBlendFactor = parseInt(t.blendFuncDestination || n.ONE_MINUS_SRC_ALPHA);
  33851. var i = this._startColor;
  33852. i.r = 255 * parseFloat(t.startColorRed || 0), i.g = 255 * parseFloat(t.startColorGreen || 0), i.b = 255 * parseFloat(t.startColorBlue || 0), i.a = 255 * parseFloat(t.startColorAlpha || 0);
  33853. var r = this._startColorVar;
  33854. r.r = 255 * parseFloat(t.startColorVarianceRed || 0), r.g = 255 * parseFloat(t.startColorVarianceGreen || 0), r.b = 255 * parseFloat(t.startColorVarianceBlue || 0), r.a = 255 * parseFloat(t.startColorVarianceAlpha || 0);
  33855. var s = this._endColor;
  33856. s.r = 255 * parseFloat(t.finishColorRed || 0), s.g = 255 * parseFloat(t.finishColorGreen || 0), s.b = 255 * parseFloat(t.finishColorBlue || 0), s.a = 255 * parseFloat(t.finishColorAlpha || 0);
  33857. var o = this._endColorVar;
  33858. if (o.r = 255 * parseFloat(t.finishColorVarianceRed || 0), o.g = 255 * parseFloat(t.finishColorVarianceGreen || 0), o.b = 255 * parseFloat(t.finishColorVarianceBlue || 0), o.a = 255 * parseFloat(t.finishColorVarianceAlpha || 0), this.startSize = parseFloat(t.startParticleSize || 0), this.startSizeVar = parseFloat(t.startParticleSizeVariance || 0), this.endSize = parseFloat(t.finishParticleSize || 0), this.endSizeVar = parseFloat(t.finishParticleSizeVariance || 0), this.positionType = parseFloat(t.positionType || p.RELATIVE), this.sourcePos.x = 0, this.sourcePos.y = 0, this.posVar.x = parseFloat(t.sourcePositionVariancex || 0), this.posVar.y = parseFloat(t.sourcePositionVariancey || 0), this.angle = parseFloat(t.angle || 0), this.angleVar = parseFloat(t.angleVariance || 0), this.startSpin = parseFloat(t.rotationStart || 0), this.startSpinVar = parseFloat(t.rotationStartVariance || 0), this.endSpin = parseFloat(t.rotationEnd || 0), this.endSpinVar = parseFloat(t.rotationEndVariance || 0), this.emitterMode = parseInt(t.emitterType || d.GRAVITY), this.emitterMode === d.GRAVITY) {
  33859. this.gravity.x = parseFloat(t.gravityx || 0), this.gravity.y = parseFloat(t.gravityy || 0), this.speed = parseFloat(t.speed || 0), this.speedVar = parseFloat(t.speedVariance || 0), this.radialAccel = parseFloat(t.radialAcceleration || 0), this.radialAccelVar = parseFloat(t.radialAccelVariance || 0), this.tangentialAccel = parseFloat(t.tangentialAcceleration || 0), this.tangentialAccelVar = parseFloat(t.tangentialAccelVariance || 0);
  33860. var a = t.rotationIsDir || "";
  33861. null !== a ? (a = a.toString().toLowerCase(), this.rotationIsDir = "true" === a || "1" === a) : this.rotationIsDir = !1
  33862. } else {
  33863. if (this.emitterMode !== d.RADIUS) return cc.warnID(6009), !1;
  33864. this.startRadius = parseFloat(t.maxRadius || 0), this.startRadiusVar = parseFloat(t.maxRadiusVariance || 0), this.endRadius = parseFloat(t.minRadius || 0), this.endRadiusVar = parseFloat(t.minRadiusVariance || 0), this.rotatePerS = parseFloat(t.rotatePerSecond || 0), this.rotatePerSVar = parseFloat(t.rotatePerSecondVariance || 0)
  33865. }
  33866. return this._initTextureWithDictionary(t), !0
  33867. },
  33868. _onTextureLoaded: function() {
  33869. this._texture = this._renderSpriteFrame.getTexture(), this._simulator.updateUVs(!0), this._activateMaterial()
  33870. },
  33871. _applySpriteFrame: function(t) {
  33872. t && t.off && t.off("load", this._onTextureLoaded, this);
  33873. var e = this._renderSpriteFrame = this._renderSpriteFrame || this._spriteFrame;
  33874. e && (e.textureLoaded() ? this._onTextureLoaded(null) : (e.once("load", this._onTextureLoaded, this), e.ensureLoadTexture()))
  33875. },
  33876. _activateMaterial: function() {
  33877. if (!this._texture || !this._texture.loaded) return this.markForUpdateRenderData(!1), this.markForRender(!1), void(this._renderSpriteFrame && this._applySpriteFrame());
  33878. var t = this.sharedMaterials[0];
  33879. (t = t ? u.getInstantiatedMaterial(t, this) : u.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("CC_USE_MODEL", this._positionType !== p.FREE), t.setProperty("texture", this._texture), this.setMaterial(0, t), this.markForRender(!0)
  33880. },
  33881. _finishedSimulation: function() {
  33882. this.resetSystem(), this.stopSystem(), this.disableRender(), this.autoRemoveOnFinish && this._stopped && this.node.destroy()
  33883. }
  33884. });
  33885. cc.ParticleSystem = e.exports = y
  33886. }), {
  33887. "../compression/ZipUtils": 22,
  33888. "../core/assets/material/CCMaterial": 75,
  33889. "../core/components/CCRenderComponent": 106,
  33890. "../core/platform/CCMacro": 203,
  33891. "../core/renderer/render-flow": 248,
  33892. "../core/utils/blend-func": 293,
  33893. "../core/utils/texture-util": 308,
  33894. "./CCPNGReader": 339,
  33895. "./CCParticleAsset": 340,
  33896. "./CCTIFFReader": 342,
  33897. "./particle-simulator": 344,
  33898. "fire-url": void 0
  33899. }],
  33900. 342: [(function(t, e, i) {
  33901. "use strict";
  33902. var n = t("../core/CCDebug"),
  33903. r = {
  33904. _littleEndian: !1,
  33905. _tiffData: null,
  33906. _fileDirectories: [],
  33907. getUint8: function(t) {
  33908. return this._tiffData[t]
  33909. },
  33910. getUint16: function(t) {
  33911. return this._littleEndian ? this._tiffData[t + 1] << 8 | this._tiffData[t] : this._tiffData[t] << 8 | this._tiffData[t + 1]
  33912. },
  33913. getUint32: function(t) {
  33914. var e = this._tiffData;
  33915. return this._littleEndian ? e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t] : e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]
  33916. },
  33917. checkLittleEndian: function() {
  33918. var t = this.getUint16(0);
  33919. if (18761 === t) this.littleEndian = !0;
  33920. else {
  33921. if (19789 !== t) throw console.log(t), TypeError(n.getError(6019));
  33922. this.littleEndian = !1
  33923. }
  33924. return this.littleEndian
  33925. },
  33926. hasTowel: function() {
  33927. if (42 !== this.getUint16(2)) throw RangeError(n.getError(6020));
  33928. return !0
  33929. },
  33930. getFieldTypeName: function(t) {
  33931. var e = this.fieldTypeNames;
  33932. return t in e ? e[t] : null
  33933. },
  33934. getFieldTagName: function(t) {
  33935. var e = this.fieldTagNames;
  33936. return t in e ? e[t] : (cc.logID(6021, t), "Tag" + t)
  33937. },
  33938. getFieldTypeLength: function(t) {
  33939. return -1 !== ["BYTE", "ASCII", "SBYTE", "UNDEFINED"].indexOf(t) ? 1 : -1 !== ["SHORT", "SSHORT"].indexOf(t) ? 2 : -1 !== ["LONG", "SLONG", "FLOAT"].indexOf(t) ? 4 : -1 !== ["RATIONAL", "SRATIONAL", "DOUBLE"].indexOf(t) ? 8 : null
  33940. },
  33941. getFieldValues: function(t, e, i, n) {
  33942. var r = [],
  33943. s = this.getFieldTypeLength(e);
  33944. if (s * i <= 4) !1 === this.littleEndian ? r.push(n >>> 8 * (4 - s)) : r.push(n);
  33945. else
  33946. for (var o = 0; o < i; o++) {
  33947. var a = s * o;
  33948. s >= 8 ? -1 !== ["RATIONAL", "SRATIONAL"].indexOf(e) ? (r.push(this.getUint32(n + a)), r.push(this.getUint32(n + a + 4))) : cc.logID(8e3) : r.push(this.getBytes(s, n + a))
  33949. }
  33950. return "ASCII" === e && r.forEach((function(t, e, i) {
  33951. i[e] = String.fromCharCode(t)
  33952. })), r
  33953. },
  33954. getBytes: function(t, e) {
  33955. if (t <= 0) cc.logID(8001);
  33956. else {
  33957. if (t <= 1) return this.getUint8(e);
  33958. if (t <= 2) return this.getUint16(e);
  33959. if (t <= 3) return this.getUint32(e) >>> 8;
  33960. if (t <= 4) return this.getUint32(e);
  33961. cc.logID(8002)
  33962. }
  33963. },
  33964. getBits: function(t, e, i) {
  33965. i = i || 0;
  33966. var n, r, s = e + Math.floor(i / 8),
  33967. o = i + t,
  33968. a = 32 - t;
  33969. return o <= 0 ? cc.logID(6023) : o <= 8 ? (n = 24 + i, r = this.getUint8(s)) : o <= 16 ? (n = 16 + i, r = this.getUint16(s)) : o <= 32 ? (n = i, r = this.getUint32(s)) : cc.logID(6022), {
  33970. bits: r << n >>> a,
  33971. byteOffset: s + Math.floor(o / 8),
  33972. bitOffset: o % 8
  33973. }
  33974. },
  33975. parseFileDirectory: function(t) {
  33976. for (var e = this.getUint16(t), i = [], n = t + 2, r = 0; r < e; n += 12, r++) {
  33977. var s = this.getUint16(n),
  33978. o = this.getUint16(n + 2),
  33979. a = this.getUint32(n + 4),
  33980. l = this.getUint32(n + 8),
  33981. h = this.getFieldTagName(s),
  33982. c = this.getFieldTypeName(o),
  33983. u = this.getFieldValues(h, c, a, l);
  33984. i[h] = {
  33985. type: c,
  33986. values: u
  33987. }
  33988. }
  33989. this._fileDirectories.push(i);
  33990. var _ = this.getUint32(n);
  33991. 0 !== _ && this.parseFileDirectory(_)
  33992. },
  33993. clampColorSample: function(t, e) {
  33994. var i = Math.pow(2, 8 - e);
  33995. return Math.floor(t * i + (i - 1))
  33996. },
  33997. parseTIFF: function(t, e) {
  33998. if (e = e || document.createElement("canvas"), this._tiffData = t, this.canvas = e, this.checkLittleEndian(), this.hasTowel()) {
  33999. var i = this.getUint32(4);
  34000. this._fileDirectories.length = 0, this.parseFileDirectory(i);
  34001. var r = this._fileDirectories[0],
  34002. s = r.ImageWidth.values[0],
  34003. o = r.ImageLength.values[0];
  34004. this.canvas.width = s, this.canvas.height = o;
  34005. var a = [],
  34006. l = r.Compression ? r.Compression.values[0] : 1,
  34007. h = r.SamplesPerPixel.values[0],
  34008. c = [],
  34009. u = 0,
  34010. _ = !1;
  34011. if (r.BitsPerSample.values.forEach((function(t, e, i) {
  34012. c[e] = {
  34013. bitsPerSample: t,
  34014. hasBytesPerSample: !1,
  34015. bytesPerSample: void 0
  34016. }, t % 8 == 0 && (c[e].hasBytesPerSample = !0, c[e].bytesPerSample = t / 8), u += t
  34017. }), this), u % 8 == 0) {
  34018. _ = !0;
  34019. var f = u / 8
  34020. }
  34021. var d = r.StripOffsets.values,
  34022. p = d.length;
  34023. if (r.StripByteCounts) var m = r.StripByteCounts.values;
  34024. else {
  34025. if (cc.logID(8003), 1 !== p) throw Error(n.getError(6024));
  34026. m = [Math.ceil(s * o * u / 8)]
  34027. }
  34028. for (var y = 0; y < p; y++) {
  34029. var v = d[y];
  34030. a[y] = [];
  34031. for (var g = m[y], x = 0, b = 0, A = 1, C = !0, T = [], S = 0, w = 0, E = 0; x < g; x += A) switch (l) {
  34032. case 1:
  34033. var M = 0;
  34034. for (T = []; M < h; M++) {
  34035. if (!c[M].hasBytesPerSample) {
  34036. var D = this.getBits(c[M].bitsPerSample, v + x, b);
  34037. throw T.push(D.bits), x = D.byteOffset - v, b = D.bitOffset, RangeError(n.getError(6025))
  34038. }
  34039. var B = c[M].bytesPerSample * M;
  34040. T.push(this.getBytes(c[M].bytesPerSample, v + x + B))
  34041. }
  34042. if (a[y].push(T), !_) throw A = 0, RangeError(n.getError(6026));
  34043. A = f;
  34044. break;
  34045. case 2:
  34046. case 3:
  34047. case 4:
  34048. case 5:
  34049. case 6:
  34050. case 7:
  34051. break;
  34052. case 32773:
  34053. if (C) {
  34054. C = !1;
  34055. var I = 1,
  34056. P = 1,
  34057. R = this.getInt8(v + x);
  34058. R >= 0 && R <= 127 ? I = R + 1 : R >= -127 && R <= -1 ? P = 1 - R : C = !0
  34059. } else {
  34060. var O = this.getUint8(v + x);
  34061. for (M = 0; M < P; M++) {
  34062. if (!c[w].hasBytesPerSample) throw RangeError(n.getError(6025));
  34063. E = E << 8 * S | O, ++S === c[w].bytesPerSample && (T.push(E), E = S = 0, w++), w === h && (a[y].push(T), T = [], w = 0)
  34064. }
  34065. 0 === --I && (C = !0)
  34066. }
  34067. A = 1
  34068. }
  34069. }
  34070. if (e.getContext) {
  34071. var L = this.canvas.getContext("2d");
  34072. L.fillStyle = "rgba(255, 255, 255, 0)";
  34073. var F = r.RowsPerStrip ? r.RowsPerStrip.values[0] : o,
  34074. N = a.length,
  34075. V = o % F,
  34076. k = 0 === V ? F : V,
  34077. G = F,
  34078. U = 0,
  34079. z = r.PhotometricInterpretation.values[0],
  34080. j = [],
  34081. W = 0;
  34082. if (r.ExtraSamples && (W = (j = r.ExtraSamples.values).length), r.ColorMap) var H = r.ColorMap.values,
  34083. X = Math.pow(2, c[0].bitsPerSample);
  34084. for (y = 0; y < N; y++) {
  34085. y + 1 === N && (G = k);
  34086. for (var Y = a[y].length, q = U * y, J = 0, Z = 0; Z < Y; J++)
  34087. for (var K = 0; K < s; K++, Z++) {
  34088. var Q = a[y][Z],
  34089. $ = 0,
  34090. tt = 0,
  34091. et = 0,
  34092. it = 1;
  34093. if (W > 0)
  34094. for (var nt = 0; nt < W; nt++)
  34095. if (1 === j[nt] || 2 === j[nt]) {
  34096. it = Q[3 + nt] / 256;
  34097. break
  34098. }
  34099. switch (z) {
  34100. case 0:
  34101. if (c[0].hasBytesPerSample) var rt = Math.pow(16, 2 * c[0].bytesPerSample);
  34102. Q.forEach((function(t, e, i) {
  34103. i[e] = rt - t
  34104. }));
  34105. case 1:
  34106. $ = tt = et = this.clampColorSample(Q[0], c[0].bitsPerSample);
  34107. break;
  34108. case 2:
  34109. $ = this.clampColorSample(Q[0], c[0].bitsPerSample), tt = this.clampColorSample(Q[1], c[1].bitsPerSample), et = this.clampColorSample(Q[2], c[2].bitsPerSample);
  34110. break;
  34111. case 3:
  34112. if (void 0 === H) throw Error(n.getError(6027));
  34113. var st = Q[0];
  34114. $ = this.clampColorSample(H[st], 16), tt = this.clampColorSample(H[X + st], 16), et = this.clampColorSample(H[2 * X + st], 16);
  34115. break;
  34116. default:
  34117. throw RangeError(n.getError(6028, z))
  34118. }
  34119. L.fillStyle = "rgba(" + $ + ", " + tt + ", " + et + ", " + it + ")", L.fillRect(K, q + J, 1, 1)
  34120. }
  34121. U = G
  34122. }
  34123. }
  34124. return this.canvas
  34125. }
  34126. },
  34127. fieldTagNames: {
  34128. 315: "Artist",
  34129. 258: "BitsPerSample",
  34130. 265: "CellLength",
  34131. 264: "CellWidth",
  34132. 320: "ColorMap",
  34133. 259: "Compression",
  34134. 33432: "Copyright",
  34135. 306: "DateTime",
  34136. 338: "ExtraSamples",
  34137. 266: "FillOrder",
  34138. 289: "FreeByteCounts",
  34139. 288: "FreeOffsets",
  34140. 291: "GrayResponseCurve",
  34141. 290: "GrayResponseUnit",
  34142. 316: "HostComputer",
  34143. 270: "ImageDescription",
  34144. 257: "ImageLength",
  34145. 256: "ImageWidth",
  34146. 271: "Make",
  34147. 281: "MaxSampleValue",
  34148. 280: "MinSampleValue",
  34149. 272: "Model",
  34150. 254: "NewSubfileType",
  34151. 274: "Orientation",
  34152. 262: "PhotometricInterpretation",
  34153. 284: "PlanarConfiguration",
  34154. 296: "ResolutionUnit",
  34155. 278: "RowsPerStrip",
  34156. 277: "SamplesPerPixel",
  34157. 305: "Software",
  34158. 279: "StripByteCounts",
  34159. 273: "StripOffsets",
  34160. 255: "SubfileType",
  34161. 263: "Threshholding",
  34162. 282: "XResolution",
  34163. 283: "YResolution",
  34164. 326: "BadFaxLines",
  34165. 327: "CleanFaxData",
  34166. 343: "ClipPath",
  34167. 328: "ConsecutiveBadFaxLines",
  34168. 433: "Decode",
  34169. 434: "DefaultImageColor",
  34170. 269: "DocumentName",
  34171. 336: "DotRange",
  34172. 321: "HalftoneHints",
  34173. 346: "Indexed",
  34174. 347: "JPEGTables",
  34175. 285: "PageName",
  34176. 297: "PageNumber",
  34177. 317: "Predictor",
  34178. 319: "PrimaryChromaticities",
  34179. 532: "ReferenceBlackWhite",
  34180. 339: "SampleFormat",
  34181. 559: "StripRowCounts",
  34182. 330: "SubIFDs",
  34183. 292: "T4Options",
  34184. 293: "T6Options",
  34185. 325: "TileByteCounts",
  34186. 323: "TileLength",
  34187. 324: "TileOffsets",
  34188. 322: "TileWidth",
  34189. 301: "TransferFunction",
  34190. 318: "WhitePoint",
  34191. 344: "XClipPathUnits",
  34192. 286: "XPosition",
  34193. 529: "YCbCrCoefficients",
  34194. 531: "YCbCrPositioning",
  34195. 530: "YCbCrSubSampling",
  34196. 345: "YClipPathUnits",
  34197. 287: "YPosition",
  34198. 37378: "ApertureValue",
  34199. 40961: "ColorSpace",
  34200. 36868: "DateTimeDigitized",
  34201. 36867: "DateTimeOriginal",
  34202. 34665: "Exif IFD",
  34203. 36864: "ExifVersion",
  34204. 33434: "ExposureTime",
  34205. 41728: "FileSource",
  34206. 37385: "Flash",
  34207. 40960: "FlashpixVersion",
  34208. 33437: "FNumber",
  34209. 42016: "ImageUniqueID",
  34210. 37384: "LightSource",
  34211. 37500: "MakerNote",
  34212. 37377: "ShutterSpeedValue",
  34213. 37510: "UserComment",
  34214. 33723: "IPTC",
  34215. 34675: "ICC Profile",
  34216. 700: "XMP",
  34217. 42112: "GDAL_METADATA",
  34218. 42113: "GDAL_NODATA",
  34219. 34377: "Photoshop"
  34220. },
  34221. fieldTypeNames: {
  34222. 1: "BYTE",
  34223. 2: "ASCII",
  34224. 3: "SHORT",
  34225. 4: "LONG",
  34226. 5: "RATIONAL",
  34227. 6: "SBYTE",
  34228. 7: "UNDEFINED",
  34229. 8: "SSHORT",
  34230. 9: "SLONG",
  34231. 10: "SRATIONAL",
  34232. 11: "FLOAT",
  34233. 12: "DOUBLE"
  34234. }
  34235. };
  34236. e.exports = r
  34237. }), {
  34238. "../core/CCDebug": 49
  34239. }],
  34240. 343: [(function(t, e, i) {
  34241. "use strict";
  34242. t("./CCParticleAsset"), t("./CCParticleSystem"), t("./particle-simulator"), t("./particle-system-assembler")
  34243. }), {
  34244. "./CCParticleAsset": 340,
  34245. "./CCParticleSystem": 341,
  34246. "./particle-simulator": 344,
  34247. "./particle-system-assembler": 345
  34248. }],
  34249. 344: [(function(t, e, i) {
  34250. "use strict";
  34251. var n = t("../core/utils/affine-transform"),
  34252. r = t("../core/platform/js"),
  34253. s = t("../core/utils/misc"),
  34254. o = cc.v2(0, 0),
  34255. a = n.create(),
  34256. l = cc.v2(),
  34257. h = cc.v2(),
  34258. c = cc.v2(),
  34259. u = cc.v2(),
  34260. _ = function() {
  34261. this.pos = cc.v2(0, 0), this.startPos = cc.v2(0, 0), this.color = cc.color(0, 0, 0, 255), this.deltaColor = {
  34262. r: 0,
  34263. g: 0,
  34264. b: 0,
  34265. a: 255
  34266. }, this.size = 0, this.deltaSize = 0, this.rotation = 0, this.deltaRotation = 0, this.timeToLive = 0, this.drawPos = cc.v2(0, 0), this.dir = cc.v2(0, 0), this.radialAccel = 0, this.tangentialAccel = 0, this.angle = 0, this.degreesPerSecond = 0, this.radius = 0, this.deltaRadius = 0
  34267. },
  34268. f = new r.Pool(function(t) {
  34269. t.pos.set(o), t.startPos.set(o), t.color._val = 4278190080, t.deltaColor.r = t.deltaColor.g = t.deltaColor.b = 0, t.deltaColor.a = 255, t.size = 0, t.deltaSize = 0, t.rotation = 0, t.deltaRotation = 0, t.timeToLive = 0, t.drawPos.set(o), t.dir.set(o), t.radialAccel = 0, t.tangentialAccel = 0, t.angle = 0, t.degreesPerSecond = 0, t.radius = 0, t.deltaRadius = 0
  34270. }, 1024);
  34271. f.get = function() {
  34272. return this._get() || new _
  34273. };
  34274. var d = function(t) {
  34275. this.sys = t, this.particles = [], this.active = !1, this.readyToPlay = !0, this.finished = !1, this.elapsed = 0, this.emitCounter = 0, this._uvFilled = 0
  34276. };
  34277. function p(t) {
  34278. for (var e = 0, i = t; i;) e += i.angle, i = i.parent;
  34279. return e
  34280. }
  34281. d.prototype.stop = function() {
  34282. this.active = !1, this.readyToPlay = !1, this.elapsed = this.sys.duration, this.emitCounter = 0
  34283. }, d.prototype.reset = function() {
  34284. this.active = !0, this.readyToPlay = !0, this.elapsed = 0, this.emitCounter = 0, this.finished = !1;
  34285. for (var t = this.particles, e = 0; e < t.length; ++e) f.put(t[e]);
  34286. t.length = 0
  34287. }, d.prototype.emitParticle = function(t) {
  34288. var e = this.sys,
  34289. i = s.clampf,
  34290. n = f.get();
  34291. this.particles.push(n), n.timeToLive = e.life + e.lifeVar * (Math.random() - .5) * 2;
  34292. var r = n.timeToLive = Math.max(0, n.timeToLive);
  34293. n.pos.x = e.sourcePos.x + e.posVar.x * (Math.random() - .5) * 2, n.pos.y = e.sourcePos.y + e.posVar.y * (Math.random() - .5) * 2;
  34294. var o, a, l, h, c = e._startColor,
  34295. u = e._startColorVar,
  34296. _ = e._endColor,
  34297. d = e._endColorVar;
  34298. n.color.r = o = i(c.r + u.r * (Math.random() - .5) * 2, 0, 255), n.color.g = a = i(c.g + u.g * (Math.random() - .5) * 2, 0, 255), n.color.b = l = i(c.b + u.b * (Math.random() - .5) * 2, 0, 255), n.color.a = h = i(c.a + u.a * (Math.random() - .5) * 2, 0, 255), n.deltaColor.r = (i(_.r + d.r * (Math.random() - .5) * 2, 0, 255) - o) / r, n.deltaColor.g = (i(_.g + d.g * (Math.random() - .5) * 2, 0, 255) - a) / r, n.deltaColor.b = (i(_.b + d.b * (Math.random() - .5) * 2, 0, 255) - l) / r, n.deltaColor.a = (i(_.a + d.a * (Math.random() - .5) * 2, 0, 255) - h) / r;
  34299. var m = e.startSize + e.startSizeVar * (Math.random() - .5) * 2;
  34300. if (m = Math.max(0, m), n.size = m, e.endSize === cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE) n.deltaSize = 0;
  34301. else {
  34302. var y = e.endSize + e.endSizeVar * (Math.random() - .5) * 2;
  34303. y = Math.max(0, y), n.deltaSize = (y - m) / r
  34304. }
  34305. var v = e.startSpin + e.startSpinVar * (Math.random() - .5) * 2,
  34306. g = e.endSpin + e.endSpinVar * (Math.random() - .5) * 2;
  34307. n.rotation = v, n.deltaRotation = (g - v) / r, n.startPos.x = t.x, n.startPos.y = t.y;
  34308. var x = p(e.node),
  34309. b = e.positionType === cc.ParticleSystem.PositionType.FREE ? e.angle + x : e.angle,
  34310. A = s.degreesToRadians(b + e.angleVar * (Math.random() - .5) * 2);
  34311. if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) {
  34312. var C = e.speed + e.speedVar * (Math.random() - .5) * 2;
  34313. n.dir.x = Math.cos(A), n.dir.y = Math.sin(A), n.dir.mulSelf(C), n.radialAccel = e.radialAccel + e.radialAccelVar * (Math.random() - .5) * 2, n.tangentialAccel = e.tangentialAccel + e.tangentialAccelVar * (Math.random() - .5) * 2, e.rotationIsDir && (n.rotation = -s.radiansToDegrees(Math.atan2(n.dir.y, n.dir.x)))
  34314. } else {
  34315. var T = e.startRadius + e.startRadiusVar * (Math.random() - .5) * 2,
  34316. S = e.endRadius + e.endRadiusVar * (Math.random() - .5) * 2;
  34317. n.radius = T, n.deltaRadius = e.endRadius === cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS ? 0 : (S - T) / r, n.angle = A, n.degreesPerSecond = s.degreesToRadians(e.rotatePerS + e.rotatePerSVar * (Math.random() - .5) * 2)
  34318. }
  34319. }, d.prototype.updateUVs = function(t) {
  34320. var e = this.sys._assembler;
  34321. if (e) {
  34322. var i = e.getBuffer();
  34323. if (i && this.sys._renderSpriteFrame) {
  34324. for (var n = 4 * e._vfmt._bytes / 4, r = i._vData, s = this.sys._renderSpriteFrame.uv, o = t ? 0 : this._uvFilled, a = this.particles.length, l = o; l < a; l++) {
  34325. var h = l * n;
  34326. r[h + 2] = s[0], r[h + 3] = s[1], r[h + 7] = s[2], r[h + 8] = s[3], r[h + 12] = s[4], r[h + 13] = s[5], r[h + 17] = s[6], r[h + 18] = s[7]
  34327. }
  34328. this._uvFilled = a
  34329. }
  34330. }
  34331. }, d.prototype.updateParticleBuffer = function(t, e, i, n) {
  34332. var r = i._vData,
  34333. o = i._uintVData,
  34334. a = e.x,
  34335. l = e.y,
  34336. h = t.size / 2;
  34337. if (t.rotation) {
  34338. var c = -h,
  34339. u = -h,
  34340. _ = h,
  34341. f = h,
  34342. d = -s.degreesToRadians(t.rotation),
  34343. p = Math.cos(d),
  34344. m = Math.sin(d);
  34345. r[n] = c * p - u * m + a, r[n + 1] = c * m + u * p + l, r[n + 5] = _ * p - u * m + a, r[n + 6] = _ * m + u * p + l, r[n + 10] = c * p - f * m + a, r[n + 11] = c * m + f * p + l, r[n + 15] = _ * p - f * m + a, r[n + 16] = _ * m + f * p + l
  34346. } else r[n] = a - h, r[n + 1] = l - h, r[n + 5] = a + h, r[n + 6] = l - h, r[n + 10] = a - h, r[n + 11] = l + h, r[n + 15] = a + h, r[n + 16] = l + h;
  34347. o[n + 4] = t.color._val, o[n + 9] = t.color._val, o[n + 14] = t.color._val, o[n + 19] = t.color._val
  34348. }, d.prototype.step = function(t) {
  34349. var e = this.sys,
  34350. i = e.node,
  34351. r = this.particles,
  34352. _ = 4 * this.sys._assembler._vfmt._bytes / 4;
  34353. if (i._updateWorldMatrix(), a = n.identity(), e.positionType === cc.ParticleSystem.PositionType.FREE) {
  34354. var d = i._worldMatrix.m;
  34355. a.tx = d[12], a.ty = d[13], n.transformVec2(l, o, a)
  34356. } else if (e.positionType === cc.ParticleSystem.PositionType.RELATIVE) {
  34357. var p = s.degreesToRadians(-i.angle),
  34358. m = Math.cos(p),
  34359. y = Math.sin(p);
  34360. a = n.create(m, -y, y, m, 0, 0), l.x = i.x, l.y = i.y
  34361. }
  34362. n.invert(a, a);
  34363. var v = a;
  34364. if (this.active && e.emissionRate) {
  34365. var g = 1 / e.emissionRate;
  34366. for (r.length < e.totalParticles && (this.emitCounter += t); r.length < e.totalParticles && this.emitCounter > g;) this.emitParticle(l), this.emitCounter -= g;
  34367. this.elapsed += t, -1 !== e.duration && e.duration < this.elapsed && e.stopSystem()
  34368. }
  34369. var x = e._assembler.getBuffer(),
  34370. b = r.length;
  34371. x.reset(), x.request(4 * b, 6 * b), b > this._uvFilled && this.updateUVs();
  34372. for (var A = 0; A < r.length;) {
  34373. h.x = h.y = c.x = c.y = u.x = u.y = 0;
  34374. var C = r[A];
  34375. if (C.timeToLive -= t, C.timeToLive > 0) {
  34376. if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) {
  34377. var T = u,
  34378. S = h,
  34379. w = c;
  34380. (C.pos.x || C.pos.y) && (S.set(C.pos), S.normalizeSelf()), w.set(S), S.mulSelf(C.radialAccel);
  34381. var E = w.x;
  34382. w.x = -w.y, w.y = E, w.mulSelf(C.tangentialAccel), T.set(S), T.addSelf(w), T.addSelf(e.gravity), T.mulSelf(t), C.dir.addSelf(T), T.set(C.dir), T.mulSelf(t), C.pos.addSelf(T)
  34383. } else C.angle += C.degreesPerSecond * t, C.radius += C.deltaRadius * t, C.pos.x = -Math.cos(C.angle) * C.radius, C.pos.y = -Math.sin(C.angle) * C.radius;
  34384. C.color.r += C.deltaColor.r * t, C.color.g += C.deltaColor.g * t, C.color.b += C.deltaColor.b * t, C.color.a += C.deltaColor.a * t, C.size += C.deltaSize * t, C.size < 0 && (C.size = 0), C.rotation += C.deltaRotation * t;
  34385. var M = h,
  34386. D = c;
  34387. if (e.positionType === cc.ParticleSystem.PositionType.FREE) D.set(C.startPos), D.negSelf(), M.set(C.pos), M.subSelf(D);
  34388. else if (e.positionType === cc.ParticleSystem.PositionType.RELATIVE) {
  34389. var B = u;
  34390. n.transformVec2(D, l, v), n.transformVec2(B, C.startPos, v), D.subSelf(B), M.set(C.pos), M.subSelf(D)
  34391. } else M.set(C.pos);
  34392. var I = _ * A;
  34393. this.updateParticleBuffer(C, M, x, I), ++A
  34394. } else {
  34395. var P = r[A];
  34396. A !== r.length - 1 && (r[A] = r[r.length - 1]), f.put(P), r.length--
  34397. }
  34398. }
  34399. r.length > 0 ? (x.uploadData(), e._assembler._ia._count = 6 * r.length) : this.active || this.readyToPlay || (this.finished = !0, e._finishedSimulation())
  34400. }, e.exports = d
  34401. }), {
  34402. "../core/platform/js": 218,
  34403. "../core/utils/affine-transform": 290,
  34404. "../core/utils/misc": 300
  34405. }],
  34406. 345: [(function(t, e, i) {
  34407. "use strict";
  34408. var n = s(t("../core/renderer/assembler")),
  34409. r = s(t("../renderer/core/input-assembler"));
  34410. function s(t) {
  34411. return t && t.__esModule ? t : {
  34412. default: t
  34413. }
  34414. }
  34415. function o(t, e) {
  34416. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  34417. }
  34418. function a(t, e) {
  34419. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  34420. return !e || "object" != typeof e && "function" != typeof e ? t : e
  34421. }
  34422. function l(t, e) {
  34423. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  34424. t.prototype = Object.create(e && e.prototype, {
  34425. constructor: {
  34426. value: t,
  34427. enumerable: !1,
  34428. writable: !0,
  34429. configurable: !0
  34430. }
  34431. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  34432. }
  34433. var h = t("./CCParticleSystem"),
  34434. c = t("../core/renderer/"),
  34435. u = t("../core/renderer/webgl/quad-buffer"),
  34436. _ = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor,
  34437. f = (function(t) {
  34438. function e(i) {
  34439. o(this, e);
  34440. var n = a(this, t.call(this, i));
  34441. return n._buffer = null, n._ia = null, n._vfmt = _, n
  34442. }
  34443. return l(e, t), e.prototype.getBuffer = function() {
  34444. return this._buffer || (this._buffer = new u(c._handle, _), this._ia = new r.default, this._ia._vertexBuffer = this._buffer._vb, this._ia._indexBuffer = this._buffer._ib, this._ia._start = 0, this._ia._count = 0), this._buffer
  34445. }, e.prototype.fillBuffers = function(t, e) {
  34446. this._ia && (e.node = t.node, e.material = t.sharedMaterials[0], e._flushIA(this._ia))
  34447. }, e
  34448. })(n.default);
  34449. n.default.register(h, f), e.exports = f
  34450. }), {
  34451. "../core/renderer/": 247,
  34452. "../core/renderer/assembler": 227,
  34453. "../core/renderer/webgl/quad-buffer": 285,
  34454. "../core/renderer/webgl/vertex-format": 288,
  34455. "../renderer/core/input-assembler": 350,
  34456. "./CCParticleSystem": 341
  34457. }],
  34458. 346: [(function(t, e, i) {
  34459. "use strict";
  34460. var n, r, s, o = 512,
  34461. a = 513,
  34462. l = 514,
  34463. h = 515,
  34464. c = 516,
  34465. u = 517,
  34466. _ = 518,
  34467. f = 519,
  34468. d = 32774,
  34469. p = 32778,
  34470. m = 32779,
  34471. y = 0,
  34472. v = 1,
  34473. g = 768,
  34474. x = 769,
  34475. b = 774,
  34476. A = 775,
  34477. C = 770,
  34478. T = 771,
  34479. S = 772,
  34480. w = 773,
  34481. E = 32769,
  34482. M = 32770,
  34483. D = 32771,
  34484. B = 32772,
  34485. I = 776,
  34486. P = 7680,
  34487. R = 7681,
  34488. O = 7682,
  34489. L = 34055,
  34490. F = 7683,
  34491. N = 34056,
  34492. V = 5386,
  34493. k = 0,
  34494. G = 1028,
  34495. U = 1029;
  34496. (function(t) {
  34497. t[t.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", t[t.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL"
  34498. })(n || (n = {})), (function(t) {
  34499. t[t.UNKNOWN = 0] = "UNKNOWN", t[t.BUFFER = 1] = "BUFFER", t[t.TEXTURE = 2] = "TEXTURE", t[t.TEXTURE_VIEW = 3] = "TEXTURE_VIEW", t[t.RENDER_PASS = 4] = "RENDER_PASS", t[t.FRAMEBUFFER = 5] = "FRAMEBUFFER", t[t.SAMPLER = 6] = "SAMPLER", t[t.SHADER = 7] = "SHADER", t[t.PIPELINE_LAYOUT = 8] = "PIPELINE_LAYOUT", t[t.PIPELINE_STATE = 9] = "PIPELINE_STATE", t[t.BINDING_LAYOUT = 10] = "BINDING_LAYOUT", t[t.INPUT_ASSEMBLER = 11] = "INPUT_ASSEMBLER", t[t.COMMAND_ALLOCATOR = 12] = "COMMAND_ALLOCATOR", t[t.COMMAND_BUFFER = 13] = "COMMAND_BUFFER", t[t.QUEUE = 14] = "QUEUE", t[t.WINDOW = 15] = "WINDOW"
  34500. })(r || (r = {})), (function(t) {
  34501. t[t.UNREADY = 0] = "UNREADY", t[t.FAILED = 1] = "FAILED", t[t.SUCCESS = 2] = "SUCCESS"
  34502. })(s || (s = {}));
  34503. var z, j, W, H, X, Y, q, J, Z, K, Q, $, tt, et, it, nt, rt, st, ot, at, lt, ht, ct, ut, _t, ft, dt, pt, mt, yt, vt, gt, xt, bt, At;
  34504. (function() {
  34505. function t(t) {
  34506. this._gfxType = r.UNKNOWN, this._status = s.UNREADY, this._gfxType = t
  34507. }
  34508. Object.defineProperty(t.prototype, "gfxType", {
  34509. get: function() {
  34510. return this._gfxType
  34511. },
  34512. enumerable: !0,
  34513. configurable: !0
  34514. }), Object.defineProperty(t.prototype, "status", {
  34515. get: function() {
  34516. return this._status
  34517. },
  34518. enumerable: !0,
  34519. configurable: !0
  34520. })
  34521. })();
  34522. (function(t) {
  34523. t.ATTR_POSITION = "a_position", t.ATTR_NORMAL = "a_normal", t.ATTR_TANGENT = "a_tangent", t.ATTR_BITANGENT = "a_bitangent", t.ATTR_WEIGHTS = "a_weights", t.ATTR_JOINTS = "a_joints", t.ATTR_COLOR = "a_color", t.ATTR_COLOR1 = "a_color1", t.ATTR_COLOR2 = "a_color2", t.ATTR_TEX_COORD = "a_texCoord", t.ATTR_TEX_COORD1 = "a_texCoord1", t.ATTR_TEX_COORD2 = "a_texCoord2", t.ATTR_TEX_COORD3 = "a_texCoord3", t.ATTR_TEX_COORD4 = "a_texCoord4", t.ATTR_TEX_COORD5 = "a_texCoord5", t.ATTR_TEX_COORD6 = "a_texCoord6", t.ATTR_TEX_COORD7 = "a_texCoord7", t.ATTR_TEX_COORD8 = "a_texCoord8"
  34524. })(z || (z = {})), (function(t) {
  34525. t[t.UNKNOWN = 0] = "UNKNOWN", t[t.BOOL = 1] = "BOOL", t[t.BOOL2 = 2] = "BOOL2", t[t.BOOL3 = 3] = "BOOL3", t[t.BOOL4 = 4] = "BOOL4", t[t.INT = 5] = "INT", t[t.INT2 = 6] = "INT2", t[t.INT3 = 7] = "INT3", t[t.INT4 = 8] = "INT4", t[t.UINT = 9] = "UINT", t[t.UINT2 = 10] = "UINT2", t[t.UINT3 = 11] = "UINT3", t[t.UINT4 = 12] = "UINT4", t[t.FLOAT = 13] = "FLOAT", t[t.FLOAT2 = 14] = "FLOAT2", t[t.FLOAT3 = 15] = "FLOAT3", t[t.FLOAT4 = 16] = "FLOAT4", t[t.COLOR4 = 17] = "COLOR4", t[t.MAT2 = 18] = "MAT2", t[t.MAT2X3 = 19] = "MAT2X3", t[t.MAT2X4 = 20] = "MAT2X4", t[t.MAT3X2 = 21] = "MAT3X2", t[t.MAT3 = 22] = "MAT3", t[t.MAT3X4 = 23] = "MAT3X4", t[t.MAT4X2 = 24] = "MAT4X2", t[t.MAT4X3 = 25] = "MAT4X3", t[t.MAT4 = 26] = "MAT4", t[t.SAMPLER1D = 27] = "SAMPLER1D", t[t.SAMPLER1D_ARRAY = 28] = "SAMPLER1D_ARRAY", t[t.SAMPLER2D = 29] = "SAMPLER2D", t[t.SAMPLER2D_ARRAY = 30] = "SAMPLER2D_ARRAY", t[t.SAMPLER3D = 31] = "SAMPLER3D", t[t.SAMPLER_CUBE = 32] = "SAMPLER_CUBE", t[t.COUNT = 33] = "COUNT"
  34526. })(j || (j = {})), (function(t) {
  34527. t[t.UNKNOWN = 0] = "UNKNOWN", t[t.A8 = 1] = "A8", t[t.L8 = 2] = "L8", t[t.LA8 = 3] = "LA8", t[t.R8 = 4] = "R8", t[t.R8SN = 5] = "R8SN", t[t.R8UI = 6] = "R8UI", t[t.R8I = 7] = "R8I", t[t.R16F = 8] = "R16F", t[t.R16UI = 9] = "R16UI", t[t.R16I = 10] = "R16I", t[t.R32F = 11] = "R32F", t[t.R32UI = 12] = "R32UI", t[t.R32I = 13] = "R32I", t[t.RG8 = 14] = "RG8", t[t.RG8SN = 15] = "RG8SN", t[t.RG8UI = 16] = "RG8UI", t[t.RG8I = 17] = "RG8I", t[t.RG16F = 18] = "RG16F", t[t.RG16UI = 19] = "RG16UI", t[t.RG16I = 20] = "RG16I", t[t.RG32F = 21] = "RG32F", t[t.RG32UI = 22] = "RG32UI", t[t.RG32I = 23] = "RG32I", t[t.RGB8 = 24] = "RGB8", t[t.SRGB8 = 25] = "SRGB8", t[t.RGB8SN = 26] = "RGB8SN", t[t.RGB8UI = 27] = "RGB8UI", t[t.RGB8I = 28] = "RGB8I", t[t.RGB16F = 29] = "RGB16F", t[t.RGB16UI = 30] = "RGB16UI", t[t.RGB16I = 31] = "RGB16I", t[t.RGB32F = 32] = "RGB32F", t[t.RGB32UI = 33] = "RGB32UI", t[t.RGB32I = 34] = "RGB32I", t[t.RGBA8 = 35] = "RGBA8", t[t.SRGB8_A8 = 36] = "SRGB8_A8", t[t.RGBA8SN = 37] = "RGBA8SN", t[t.RGBA8UI = 38] = "RGBA8UI", t[t.RGBA8I = 39] = "RGBA8I", t[t.RGBA16F = 40] = "RGBA16F", t[t.RGBA16UI = 41] = "RGBA16UI", t[t.RGBA16I = 42] = "RGBA16I", t[t.RGBA32F = 43] = "RGBA32F", t[t.RGBA32UI = 44] = "RGBA32UI", t[t.RGBA32I = 45] = "RGBA32I", t[t.R5G6B5 = 46] = "R5G6B5", t[t.R11G11B10F = 47] = "R11G11B10F", t[t.RGB5A1 = 48] = "RGB5A1", t[t.RGBA4 = 49] = "RGBA4", t[t.RGB10A2 = 50] = "RGB10A2", t[t.RGB10A2UI = 51] = "RGB10A2UI", t[t.RGB9E5 = 52] = "RGB9E5", t[t.D16 = 53] = "D16", t[t.D16S8 = 54] = "D16S8", t[t.D24 = 55] = "D24", t[t.D24S8 = 56] = "D24S8", t[t.D32F = 57] = "D32F", t[t.D32F_S8 = 58] = "D32F_S8", t[t.BC1 = 59] = "BC1", t[t.BC1_ALPHA = 60] = "BC1_ALPHA", t[t.BC1_SRGB = 61] = "BC1_SRGB", t[t.BC1_SRGB_ALPHA = 62] = "BC1_SRGB_ALPHA", t[t.BC2 = 63] = "BC2", t[t.BC2_SRGB = 64] = "BC2_SRGB", t[t.BC3 = 65] = "BC3", t[t.BC3_SRGB = 66] = "BC3_SRGB", t[t.BC4 = 67] = "BC4", t[t.BC4_SNORM = 68] = "BC4_SNORM", t[t.BC5 = 69] = "BC5", t[t.BC5_SNORM = 70] = "BC5_SNORM", t[t.BC6H_UF16 = 71] = "BC6H_UF16", t[t.BC6H_SF16 = 72] = "BC6H_SF16", t[t.BC7 = 73] = "BC7", t[t.BC7_SRGB = 74] = "BC7_SRGB", t[t.ETC_RGB8 = 75] = "ETC_RGB8", t[t.ETC2_RGB8 = 76] = "ETC2_RGB8", t[t.ETC2_SRGB8 = 77] = "ETC2_SRGB8", t[t.ETC2_RGB8_A1 = 78] = "ETC2_RGB8_A1", t[t.ETC2_SRGB8_A1 = 79] = "ETC2_SRGB8_A1", t[t.ETC2_RGBA8 = 80] = "ETC2_RGBA8", t[t.ETC2_SRGB8_A8 = 81] = "ETC2_SRGB8_A8", t[t.EAC_R11 = 82] = "EAC_R11", t[t.EAC_R11SN = 83] = "EAC_R11SN", t[t.EAC_RG11 = 84] = "EAC_RG11", t[t.EAC_RG11SN = 85] = "EAC_RG11SN", t[t.PVRTC_RGB2 = 86] = "PVRTC_RGB2", t[t.PVRTC_RGBA2 = 87] = "PVRTC_RGBA2", t[t.PVRTC_RGB4 = 88] = "PVRTC_RGB4", t[t.PVRTC_RGBA4 = 89] = "PVRTC_RGBA4", t[t.PVRTC2_2BPP = 90] = "PVRTC2_2BPP", t[t.PVRTC2_4BPP = 91] = "PVRTC2_4BPP"
  34528. })(W || (W = {})), (function(t) {
  34529. t[t.NONE = 0] = "NONE", t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC", t[t.TRANSFER_DST = 2] = "TRANSFER_DST", t[t.INDEX = 4] = "INDEX", t[t.VERTEX = 8] = "VERTEX", t[t.UNIFORM = 16] = "UNIFORM", t[t.STORAGE = 32] = "STORAGE", t[t.INDIRECT = 64] = "INDIRECT"
  34530. })(H || (H = {})), (function(t) {
  34531. t[t.NONE = 0] = "NONE", t[t.DEVICE = 1] = "DEVICE", t[t.HOST = 2] = "HOST"
  34532. })(X || (X = {})), (function(t) {
  34533. t[t.NONE = 0] = "NONE", t[t.READ = 1] = "READ", t[t.WRITE = 2] = "WRITE"
  34534. })(Y || (Y = {})), (function(t) {
  34535. t[t.POINT_LIST = 0] = "POINT_LIST", t[t.LINE_LIST = 1] = "LINE_LIST", t[t.LINE_STRIP = 2] = "LINE_STRIP", t[t.LINE_LOOP = 3] = "LINE_LOOP", t[t.LINE_LIST_ADJACENCY = 4] = "LINE_LIST_ADJACENCY", t[t.LINE_STRIP_ADJACENCY = 5] = "LINE_STRIP_ADJACENCY", t[t.ISO_LINE_LIST = 6] = "ISO_LINE_LIST", t[t.TRIANGLE_LIST = 7] = "TRIANGLE_LIST", t[t.TRIANGLE_STRIP = 8] = "TRIANGLE_STRIP", t[t.TRIANGLE_FAN = 9] = "TRIANGLE_FAN", t[t.TRIANGLE_LIST_ADJACENCY = 10] = "TRIANGLE_LIST_ADJACENCY", t[t.TRIANGLE_STRIP_ADJACENCY = 11] = "TRIANGLE_STRIP_ADJACENCY", t[t.TRIANGLE_PATCH_ADJACENCY = 12] = "TRIANGLE_PATCH_ADJACENCY", t[t.QUAD_PATCH_LIST = 13] = "QUAD_PATCH_LIST"
  34536. })(q || (q = {})), (function(t) {
  34537. t[t.FILL = 0] = "FILL", t[t.POINT = 1] = "POINT", t[t.LINE = 2] = "LINE"
  34538. })(J || (J = {})), (function(t) {
  34539. t[t.GOURAND = 0] = "GOURAND", t[t.FLAT = 1] = "FLAT"
  34540. })(Z || (Z = {})), (function(t) {
  34541. t[t.NONE = 0] = "NONE", t[t.FRONT = 1] = "FRONT", t[t.BACK = 2] = "BACK"
  34542. })(K || (K = {})), (function(t) {
  34543. t[t.NEVER = 0] = "NEVER", t[t.LESS = 1] = "LESS", t[t.EQUAL = 2] = "EQUAL", t[t.LESS_EQUAL = 3] = "LESS_EQUAL", t[t.GREATER = 4] = "GREATER", t[t.NOT_EQUAL = 5] = "NOT_EQUAL", t[t.GREATER_EQUAL = 6] = "GREATER_EQUAL", t[t.ALWAYS = 7] = "ALWAYS"
  34544. })(Q || (Q = {})), (function(t) {
  34545. t[t.ZERO = 0] = "ZERO", t[t.KEEP = 1] = "KEEP", t[t.REPLACE = 2] = "REPLACE", t[t.INCR = 3] = "INCR", t[t.DECR = 4] = "DECR", t[t.INVERT = 5] = "INVERT", t[t.INCR_WRAP = 6] = "INCR_WRAP", t[t.DECR_WRAP = 7] = "DECR_WRAP"
  34546. })($ || ($ = {})), (function(t) {
  34547. t[t.ADD = 0] = "ADD", t[t.SUB = 1] = "SUB", t[t.REV_SUB = 2] = "REV_SUB", t[t.MIN = 3] = "MIN", t[t.MAX = 4] = "MAX"
  34548. })(tt || (tt = {})), (function(t) {
  34549. t[t.ZERO = 0] = "ZERO", t[t.ONE = 1] = "ONE", t[t.SRC_ALPHA = 2] = "SRC_ALPHA", t[t.DST_ALPHA = 3] = "DST_ALPHA", t[t.ONE_MINUS_SRC_ALPHA = 4] = "ONE_MINUS_SRC_ALPHA", t[t.ONE_MINUS_DST_ALPHA = 5] = "ONE_MINUS_DST_ALPHA", t[t.SRC_COLOR = 6] = "SRC_COLOR", t[t.DST_COLOR = 7] = "DST_COLOR", t[t.ONE_MINUS_SRC_COLOR = 8] = "ONE_MINUS_SRC_COLOR", t[t.ONE_MINUS_DST_COLOR = 9] = "ONE_MINUS_DST_COLOR", t[t.SRC_ALPHA_SATURATE = 10] = "SRC_ALPHA_SATURATE", t[t.CONSTANT_COLOR = 11] = "CONSTANT_COLOR", t[t.ONE_MINUS_CONSTANT_COLOR = 12] = "ONE_MINUS_CONSTANT_COLOR", t[t.CONSTANT_ALPHA = 13] = "CONSTANT_ALPHA", t[t.ONE_MINUS_CONSTANT_ALPHA = 14] = "ONE_MINUS_CONSTANT_ALPHA"
  34550. })(et || (et = {})), (function(t) {
  34551. t[t.NONE = 0] = "NONE", t[t.R = 1] = "R", t[t.G = 2] = "G", t[t.B = 4] = "B", t[t.A = 8] = "A", t[t.ALL = 15] = "ALL"
  34552. })(it || (it = {})), (function(t) {
  34553. t[t.NONE = 0] = "NONE", t[t.POINT = 1] = "POINT", t[t.LINEAR = 2] = "LINEAR", t[t.ANISOTROPIC = 3] = "ANISOTROPIC"
  34554. })(nt || (nt = {})), (function(t) {
  34555. t[t.WRAP = 0] = "WRAP", t[t.MIRROR = 1] = "MIRROR", t[t.CLAMP = 2] = "CLAMP", t[t.BORDER = 3] = "BORDER"
  34556. })(rt || (rt = {})), (function(t) {
  34557. t[t.TEX1D = 0] = "TEX1D", t[t.TEX2D = 1] = "TEX2D", t[t.TEX3D = 2] = "TEX3D"
  34558. })(st || (st = {})), (function(t) {
  34559. t[t.NONE = 0] = "NONE", t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC", t[t.TRANSFER_DST = 2] = "TRANSFER_DST", t[t.SAMPLED = 4] = "SAMPLED", t[t.STORAGE = 8] = "STORAGE", t[t.COLOR_ATTACHMENT = 16] = "COLOR_ATTACHMENT", t[t.DEPTH_STENCIL_ATTACHMENT = 32] = "DEPTH_STENCIL_ATTACHMENT", t[t.TRANSIENT_ATTACHMENT = 64] = "TRANSIENT_ATTACHMENT", t[t.INPUT_ATTACHMENT = 128] = "INPUT_ATTACHMENT"
  34560. })(ot || (ot = {})), (function(t) {
  34561. t[t.X1 = 0] = "X1", t[t.X2 = 1] = "X2", t[t.X4 = 2] = "X4", t[t.X8 = 3] = "X8", t[t.X16 = 4] = "X16", t[t.X32 = 5] = "X32", t[t.X64 = 6] = "X64"
  34562. })(at || (at = {})), (function(t) {
  34563. t[t.NONE = 0] = "NONE", t[t.GEN_MIPMAP = 1] = "GEN_MIPMAP", t[t.CUBEMAP = 2] = "CUBEMAP", t[t.BAKUP_BUFFER = 4] = "BAKUP_BUFFER"
  34564. })(lt || (lt = {})), (function(t) {
  34565. t[t.TV1D = 0] = "TV1D", t[t.TV2D = 1] = "TV2D", t[t.TV3D = 2] = "TV3D", t[t.CUBE = 3] = "CUBE", t[t.TV1D_ARRAY = 4] = "TV1D_ARRAY", t[t.TV2D_ARRAY = 5] = "TV2D_ARRAY"
  34566. })(ht || (ht = {})), (function(t) {
  34567. t[t.VERTEX = 0] = "VERTEX", t[t.HULL = 1] = "HULL", t[t.DOMAIN = 2] = "DOMAIN", t[t.GEOMETRY = 3] = "GEOMETRY", t[t.FRAGMENT = 4] = "FRAGMENT", t[t.COMPUTE = 5] = "COMPUTE", t[t.COUNT = 6] = "COUNT"
  34568. })(ct || (ct = {})), (function(t) {
  34569. t[t.UNKNOWN = 0] = "UNKNOWN", t[t.UNIFORM_BUFFER = 1] = "UNIFORM_BUFFER", t[t.SAMPLER = 2] = "SAMPLER", t[t.STORAGE_BUFFER = 3] = "STORAGE_BUFFER"
  34570. })(ut || (ut = {})), (function(t) {
  34571. t[t.PRIMARY = 0] = "PRIMARY", t[t.SECONDARY = 1] = "SECONDARY"
  34572. })(_t || (_t = {})), (function(t) {
  34573. t[t.LOAD = 0] = "LOAD", t[t.CLEAR = 1] = "CLEAR", t[t.DISCARD = 2] = "DISCARD"
  34574. })(ft || (ft = {})), (function(t) {
  34575. t[t.STORE = 0] = "STORE", t[t.DISCARD = 1] = "DISCARD"
  34576. })(dt || (dt = {})), (function(t) {
  34577. t[t.UNDEFINED = 0] = "UNDEFINED", t[t.GENERAL = 1] = "GENERAL", t[t.COLOR_ATTACHMENT_OPTIMAL = 2] = "COLOR_ATTACHMENT_OPTIMAL", t[t.DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3] = "DEPTH_STENCIL_ATTACHMENT_OPTIMAL", t[t.DEPTH_STENCIL_READONLY_OPTIMAL = 4] = "DEPTH_STENCIL_READONLY_OPTIMAL", t[t.SHADER_READONLY_OPTIMAL = 5] = "SHADER_READONLY_OPTIMAL", t[t.TRANSFER_SRC_OPTIMAL = 6] = "TRANSFER_SRC_OPTIMAL", t[t.TRANSFER_DST_OPTIMAL = 7] = "TRANSFER_DST_OPTIMAL", t[t.PREINITIALIZED = 8] = "PREINITIALIZED", t[t.PRESENT_SRC = 9] = "PRESENT_SRC"
  34578. })(pt || (pt = {})), (function(t) {
  34579. t[t.GRAPHICS = 0] = "GRAPHICS", t[t.COMPUTE = 1] = "COMPUTE", t[t.RAY_TRACING = 2] = "RAY_TRACING"
  34580. })(mt || (mt = {})), (function(t) {
  34581. t[t.VIEWPORT = 0] = "VIEWPORT", t[t.SCISSOR = 1] = "SCISSOR", t[t.LINE_WIDTH = 2] = "LINE_WIDTH", t[t.DEPTH_BIAS = 3] = "DEPTH_BIAS", t[t.BLEND_CONSTANTS = 4] = "BLEND_CONSTANTS", t[t.DEPTH_BOUNDS = 5] = "DEPTH_BOUNDS", t[t.STENCIL_WRITE_MASK = 6] = "STENCIL_WRITE_MASK", t[t.STENCIL_COMPARE_MASK = 7] = "STENCIL_COMPARE_MASK"
  34582. })(yt || (yt = {})), (function(t) {
  34583. t[t.FRONT = 0] = "FRONT", t[t.BACK = 1] = "BACK", t[t.ALL = 2] = "ALL"
  34584. })(vt || (vt = {})), (function(t) {
  34585. t[t.GRAPHICS = 0] = "GRAPHICS", t[t.COMPUTE = 1] = "COMPUTE", t[t.TRANSFER = 2] = "TRANSFER"
  34586. })(gt || (gt = {})), (function(t) {
  34587. t[t.NONE = 0] = "NONE", t[t.COLOR = 1] = "COLOR", t[t.DEPTH = 2] = "DEPTH", t[t.STENCIL = 4] = "STENCIL", t[t.DEPTH_STENCIL = 6] = "DEPTH_STENCIL", t[t.ALL = 7] = "ALL"
  34588. })(xt || (xt = {})), (function(t) {
  34589. t[t.DEFAULT = 100] = "DEFAULT"
  34590. })(bt || (bt = {})), (function(t) {
  34591. t[t.MIN = 0] = "MIN", t[t.MAX = 255] = "MAX", t[t.DEFAULT = 128] = "DEFAULT"
  34592. })(At || (At = {}));
  34593. var Ct, Tt, St, wt;
  34594. (function(t) {
  34595. t[t.UBO_GLOBAL = 23] = "UBO_GLOBAL", t[t.UBO_SHADOW = 22] = "UBO_SHADOW", t[t.UBO_LOCAL = 21] = "UBO_LOCAL", t[t.UBO_FORWARD_LIGHTS = 20] = "UBO_FORWARD_LIGHTS", t[t.UBO_SKINNING = 19] = "UBO_SKINNING", t[t.UBO_SKINNING_TEXTURE = 18] = "UBO_SKINNING_TEXTURE", t[t.UBO_UI = 17] = "UBO_UI", t[t.SAMPLER_JOINTS = 25] = "SAMPLER_JOINTS", t[t.SAMPLER_ENVIRONMENT = 26] = "SAMPLER_ENVIRONMENT", t[t.CUSTUM_UBO_BINDING_END_POINT = 17] = "CUSTUM_UBO_BINDING_END_POINT", t[t.CUSTOM_SAMPLER_BINDING_START_POINT = 30] = "CUSTOM_SAMPLER_BINDING_START_POINT"
  34596. })(Ct || (Ct = {})), (function(t) {
  34597. t[t.minFilter = 0] = "minFilter", t[t.magFilter = 1] = "magFilter", t[t.mipFilter = 2] = "mipFilter", t[t.addressU = 3] = "addressU", t[t.addressV = 4] = "addressV", t[t.addressW = 5] = "addressW", t[t.maxAnisotropy = 6] = "maxAnisotropy", t[t.cmpFunc = 7] = "cmpFunc", t[t.minLOD = 8] = "minLOD", t[t.maxLOD = 9] = "maxLOD", t[t.mipLODBias = 10] = "mipLODBias", t[t.borderColor = 11] = "borderColor", t[t.total = 15] = "total"
  34598. })(wt || (wt = {}));
  34599. var Et = {};
  34600. Et[Et.bool = j.BOOL] = "bool", Et[Et.int = j.INT] = "int", Et[Et.ivec2 = j.INT2] = "ivec2invTypeParams", Et[Et.ivec3 = j.INT3] = "ivec3", Et[Et.ivec4 = j.INT4] = "ivec4", Et[Et.float = j.FLOAT] = "float", Et[Et.vec2 = j.FLOAT2] = "vec2", Et[Et.vec3 = j.FLOAT3] = "vec3", Et[Et.vec4 = j.FLOAT4] = "vec4", Et[Et.mat2 = j.MAT2] = "mat2", Et[Et.mat3 = j.MAT3] = "mat3", Et[Et.mat4 = j.MAT4] = "mat4", Et[Et.sampler2D = j.SAMPLER2D] = "sampler2D", Et[Et.samplerCube = j.SAMPLER_CUBE] = "samplerCube";
  34601. var Mt = ((Tt = {})[j.BOOL] = 4, Tt[j.INT] = 4, Tt[j.INT2] = 8, Tt[j.INT3] = 12, Tt[j.INT4] = 16, Tt[j.FLOAT] = 4, Tt[j.FLOAT2] = 8, Tt[j.FLOAT3] = 12, Tt[j.FLOAT4] = 16, Tt[j.MAT2] = 16, Tt[j.MAT3] = 36, Tt[j.MAT4] = 64, Tt[j.SAMPLER2D] = 4, Tt[j.SAMPLER_CUBE] = 4, Tt),
  34602. Dt = ((St = {})[j.BOOL] = W.R32I, St[j.INT] = W.R32I, St[j.INT2] = W.RG32I, St[j.INT3] = W.RGB32I, St[j.INT4] = W.RGBA32I, St[j.FLOAT] = W.R32F, St[j.FLOAT2] = W.RG32F, St[j.FLOAT3] = W.RGB32F, St[j.FLOAT4] = W.RGBA32F, St),
  34603. Bt = {
  34604. BACK: U,
  34605. FRONT: G,
  34606. NONE: k,
  34607. ADD: d,
  34608. SUB: p,
  34609. REV_SUB: m,
  34610. ZERO: y,
  34611. ONE: v,
  34612. SRC_COLOR: g,
  34613. ONE_MINUS_SRC_COLOR: x,
  34614. DST_COLOR: b,
  34615. ONE_MINUS_DST_COLOR: A,
  34616. SRC_ALPHA: C,
  34617. ONE_MINUS_SRC_ALPHA: T,
  34618. DST_ALPHA: S,
  34619. ONE_MINUS_DST_ALPHA: w,
  34620. CONSTANT_COLOR: E,
  34621. ONE_MINUS_CONSTANT_COLOR: M,
  34622. CONSTANT_ALPHA: D,
  34623. ONE_MINUS_CONSTANT_ALPHA: B,
  34624. SRC_ALPHA_SATURATE: I,
  34625. NEVER: o,
  34626. LESS: a,
  34627. EQUAL: l,
  34628. LEQUAL: h,
  34629. GREATER: c,
  34630. NOTEQUAL: u,
  34631. GEQUAL: _,
  34632. ALWAYS: f,
  34633. KEEP: P,
  34634. REPLACE: R,
  34635. INCR: O,
  34636. INCR_WRAP: L,
  34637. DECR: F,
  34638. DECR_WRAP: N,
  34639. INVERT: V
  34640. };
  34641. Object.assign(Bt, bt);
  34642. var It = {
  34643. murmurhash2_32_gc: function(t, e) {
  34644. for (var i, n = t.length, r = e ^ n, s = 0; n >= 4;) i = 1540483477 * (65535 & (i = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16), r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)), n -= 4, ++s;
  34645. switch (n) {
  34646. case 3:
  34647. r ^= (255 & t.charCodeAt(s + 2)) << 16;
  34648. case 2:
  34649. r ^= (255 & t.charCodeAt(s + 1)) << 8;
  34650. case 1:
  34651. r = 1540483477 * (65535 & (r ^= 255 & t.charCodeAt(s))) + ((1540483477 * (r >>> 16) & 65535) << 16)
  34652. }
  34653. return r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16), (r ^= r >>> 15) >>> 0
  34654. },
  34655. SamplerInfoIndex: wt,
  34656. effectStructure: {
  34657. $techniques: [{
  34658. $passes: [{
  34659. depthStencilState: {},
  34660. rasterizerState: {},
  34661. blendState: {
  34662. targets: [{}]
  34663. },
  34664. properties: {
  34665. any: {
  34666. sampler: {},
  34667. inspector: {}
  34668. }
  34669. }
  34670. }]
  34671. }]
  34672. },
  34673. typeMap: Et,
  34674. sizeMap: Mt,
  34675. formatMap: Dt,
  34676. passParams: Bt,
  34677. RenderQueue: {
  34678. OPAQUE: 0,
  34679. TRANSPARENT: 1,
  34680. OVERLAY: 2
  34681. },
  34682. RenderPriority: At,
  34683. GFXGetTypeSize: function(t) {
  34684. switch (t) {
  34685. case j.BOOL:
  34686. case j.INT:
  34687. case j.UINT:
  34688. case j.FLOAT:
  34689. return 4;
  34690. case j.BOOL2:
  34691. case j.INT2:
  34692. case j.UINT2:
  34693. case j.FLOAT2:
  34694. return 8;
  34695. case j.BOOL3:
  34696. case j.INT3:
  34697. case j.UINT3:
  34698. case j.FLOAT3:
  34699. return 12;
  34700. case j.BOOL4:
  34701. case j.INT4:
  34702. case j.UINT4:
  34703. case j.FLOAT4:
  34704. case j.MAT2:
  34705. return 16;
  34706. case j.MAT2X3:
  34707. return 24;
  34708. case j.MAT2X4:
  34709. return 32;
  34710. case j.MAT3X2:
  34711. return 24;
  34712. case j.MAT3:
  34713. return 36;
  34714. case j.MAT3X4:
  34715. return 48;
  34716. case j.MAT4X2:
  34717. case j.MAT4X2:
  34718. return 32;
  34719. case j.MAT4:
  34720. return 64;
  34721. case j.SAMPLER1D:
  34722. case j.SAMPLER1D_ARRAY:
  34723. case j.SAMPLER2D:
  34724. case j.SAMPLER2D_ARRAY:
  34725. case j.SAMPLER3D:
  34726. case j.SAMPLER_CUBE:
  34727. return 4;
  34728. default:
  34729. return 0
  34730. }
  34731. },
  34732. UniformBinding: Ct
  34733. };
  34734. e.exports = It
  34735. }), {}],
  34736. 347: [(function(t, e, i) {
  34737. "use strict";
  34738. i.__esModule = !0;
  34739. var n = 0,
  34740. r = {};
  34741. i.default = {
  34742. addStage: function(t) {
  34743. if (void 0 === r[t]) {
  34744. var e = 1 << n;
  34745. r[t] = e, n += 1
  34746. }
  34747. },
  34748. stageID: function(t) {
  34749. var e = r[t];
  34750. return void 0 === e ? -1 : e
  34751. },
  34752. stageIDs: function(t) {
  34753. for (var e = 0, i = 0; i < t.length; ++i) {
  34754. var n = r[t[i]];
  34755. void 0 !== n && (e |= n)
  34756. }
  34757. return e
  34758. }
  34759. }, e.exports = i.default
  34760. }), {}],
  34761. 348: [(function(t, e, i) {
  34762. "use strict";
  34763. var n, r;
  34764. i.__esModule = !0, i.default = void 0;
  34765. var s = t("../memop"),
  34766. o = u(t("../enums")),
  34767. a = t("../../core/vmath"),
  34768. l = u(t("./program-lib")),
  34769. h = u(t("./view")),
  34770. c = u(t("../gfx"));
  34771. function u(t) {
  34772. return t && t.__esModule ? t : {
  34773. default: t
  34774. }
  34775. }
  34776. function _(t, e) {
  34777. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  34778. }
  34779. a.mat3.create();
  34780. var f = a.mat4.create(),
  34781. d = new s.RecyclePool(function() {
  34782. return {
  34783. stage: null,
  34784. items: null
  34785. }
  34786. }, 8),
  34787. p = new s.RecyclePool(function() {
  34788. return new Float32Array(2)
  34789. }, 8),
  34790. m = new s.RecyclePool(function() {
  34791. return new Float32Array(3)
  34792. }, 8),
  34793. y = new s.RecyclePool(function() {
  34794. return new Float32Array(4)
  34795. }, 8),
  34796. v = new s.RecyclePool(function() {
  34797. return new Float32Array(9)
  34798. }, 8),
  34799. g = new s.RecyclePool(function() {
  34800. return new Float32Array(16)
  34801. }, 8),
  34802. x = new s.RecyclePool(function() {
  34803. return new Float32Array(64)
  34804. }, 8),
  34805. b = new s.RecyclePool(function() {
  34806. return new Int32Array(2)
  34807. }, 8),
  34808. A = new s.RecyclePool(function() {
  34809. return new Int32Array(3)
  34810. }, 8),
  34811. C = new s.RecyclePool(function() {
  34812. return new Int32Array(4)
  34813. }, 8),
  34814. T = new s.RecyclePool(function() {
  34815. return new Int32Array(64)
  34816. }, 8),
  34817. S = ((n = {})[o.default.PARAM_INT] = function(t) {
  34818. return t
  34819. }, n[o.default.PARAM_INT2] = function(t) {
  34820. return a.vec2.array(b.add(), t)
  34821. }, n[o.default.PARAM_INT3] = function(t) {
  34822. return a.vec3.array(A.add(), t)
  34823. }, n[o.default.PARAM_INT4] = function(t) {
  34824. return a.vec4.array(C.add(), t)
  34825. }, n[o.default.PARAM_FLOAT] = function(t) {
  34826. return t
  34827. }, n[o.default.PARAM_FLOAT2] = function(t) {
  34828. return a.vec2.array(p.add(), t)
  34829. }, n[o.default.PARAM_FLOAT3] = function(t) {
  34830. return a.vec3.array(m.add(), t)
  34831. }, n[o.default.PARAM_FLOAT4] = function(t) {
  34832. return a.vec4.array(y.add(), t)
  34833. }, n[o.default.PARAM_COLOR3] = function(t) {
  34834. return a.color3.array(m.add(), t)
  34835. }, n[o.default.PARAM_COLOR4] = function(t) {
  34836. return a.color4.array(y.add(), t)
  34837. }, n[o.default.PARAM_MAT2] = function(t) {
  34838. return a.mat2.array(y.add(), t)
  34839. }, n[o.default.PARAM_MAT3] = function(t) {
  34840. return a.mat3.array(v.add(), t)
  34841. }, n[o.default.PARAM_MAT4] = function(t) {
  34842. return a.mat4.array(g.add(), t)
  34843. }, (r = {})[o.default.PARAM_INT] = {
  34844. func: function(t) {
  34845. for (var e = T.add(), i = 0; i < t.length; ++i) e[i] = t[i];
  34846. return e
  34847. },
  34848. size: 1
  34849. }, r[o.default.PARAM_INT2] = {
  34850. func: function(t) {
  34851. for (var e = T.add(), i = 0; i < t.length; ++i) e[2 * i] = t[i].x, e[2 * i + 1] = t[i].y;
  34852. return e
  34853. },
  34854. size: 2
  34855. }, r[o.default.PARAM_INT3] = {
  34856. func: void 0,
  34857. size: 3
  34858. }, r[o.default.PARAM_INT4] = {
  34859. func: function(t) {
  34860. for (var e = T.add(), i = 0; i < t.length; ++i) {
  34861. var n = t[i];
  34862. e[4 * i] = n.x, e[4 * i + 1] = n.y, e[4 * i + 2] = n.z, e[4 * i + 3] = n.w
  34863. }
  34864. return e
  34865. },
  34866. size: 4
  34867. }, r[o.default.PARAM_FLOAT] = {
  34868. func: function(t) {
  34869. for (var e = x.add(), i = 0; i < t.length; ++i) e[i] = t[i];
  34870. return e
  34871. },
  34872. size: 1
  34873. }, r[o.default.PARAM_FLOAT2] = {
  34874. func: function(t) {
  34875. for (var e = x.add(), i = 0; i < t.length; ++i) e[2 * i] = t[i].x, e[2 * i + 1] = t[i].y;
  34876. return e
  34877. },
  34878. size: 2
  34879. }, r[o.default.PARAM_FLOAT3] = {
  34880. func: void 0,
  34881. size: 3
  34882. }, r[o.default.PARAM_FLOAT4] = {
  34883. func: function(t) {
  34884. for (var e = x.add(), i = 0; i < t.length; ++i) {
  34885. var n = t[i];
  34886. e[4 * i] = n.x, e[4 * i + 1] = n.y, e[4 * i + 2] = n.z, e[4 * i + 3] = n.w
  34887. }
  34888. return e
  34889. },
  34890. size: 4
  34891. }, r[o.default.PARAM_COLOR3] = {
  34892. func: void 0,
  34893. size: 3
  34894. }, r[o.default.PARAM_COLOR4] = {
  34895. func: function(t) {
  34896. for (var e = x.add(), i = 0; i < t.length; ++i) {
  34897. var n = t[i];
  34898. e[4 * i] = n.r, e[4 * i + 1] = n.g, e[4 * i + 2] = n.b, e[4 * i + 3] = n.a
  34899. }
  34900. return e
  34901. },
  34902. size: 4
  34903. }, r[o.default.PARAM_MAT2] = {
  34904. func: function(t) {
  34905. for (var e = x.add(), i = 0; i < t.length; ++i) {
  34906. var n = t[i];
  34907. e.set(n.m, 4 * i)
  34908. }
  34909. return e
  34910. },
  34911. size: 4
  34912. }, r[o.default.PARAM_MAT3] = {
  34913. func: void 0,
  34914. size: 9
  34915. }, r[o.default.PARAM_MAT4] = {
  34916. func: function(t) {
  34917. for (var e = x.add(), i = 0; i < t.length; ++i) {
  34918. var n = t[i];
  34919. e.set(n.m, 16 * i)
  34920. }
  34921. return e
  34922. },
  34923. size: 16
  34924. }, (function() {
  34925. function t(e, i) {
  34926. var n;
  34927. _(this, t), this._device = e, this._programLib = new l.default(e), this._opts = i, this._type2defaultValue = ((n = {})[o.default.PARAM_INT] = 0, n[o.default.PARAM_INT2] = a.vec2.create(0, 0), n[o.default.PARAM_INT3] = a.vec3.create(0, 0, 0), n[o.default.PARAM_INT4] = a.vec4.create(0, 0, 0, 0), n[o.default.PARAM_FLOAT] = 0, n[o.default.PARAM_FLOAT2] = a.vec2.create(0, 0), n[o.default.PARAM_FLOAT3] = a.vec3.create(0, 0, 0), n[o.default.PARAM_FLOAT4] = a.vec4.create(0, 0, 0, 0), n[o.default.PARAM_COLOR3] = a.color3.create(0, 0, 0), n[o.default.PARAM_COLOR4] = a.color4.create(0, 0, 0, 1), n[o.default.PARAM_MAT2] = a.mat2.create(), n[o.default.PARAM_MAT3] = a.mat3.create(), n[o.default.PARAM_MAT4] = a.mat4.create(), n[o.default.PARAM_TEXTURE_2D] = i.defaultTexture, n[o.default.PARAM_TEXTURE_CUBE] = i.defaultTextureCube, n), this._stage2fn = {}, this._usedTextureUnits = 0, this._viewPools = new s.RecyclePool(function() {
  34928. return new h.default
  34929. }, 8), this._drawItemsPools = new s.RecyclePool(function() {
  34930. return {
  34931. model: null,
  34932. node: null,
  34933. ia: null,
  34934. effect: null,
  34935. defines: null,
  34936. uniforms: null
  34937. }
  34938. }, 100), this._stageItemsPools = new s.RecyclePool(function() {
  34939. return new s.RecyclePool(function() {
  34940. return {
  34941. model: null,
  34942. node: null,
  34943. ia: null,
  34944. effect: null,
  34945. defines: null,
  34946. technique: null,
  34947. sortKey: -1,
  34948. uniforms: null
  34949. }
  34950. }, 100)
  34951. }, 16)
  34952. }
  34953. return t.prototype._resetTextuerUnit = function() {
  34954. this._usedTextureUnits = 0
  34955. }, t.prototype._allocTextureUnit = function() {
  34956. var t = this._device,
  34957. e = this._usedTextureUnits;
  34958. return e >= t._caps.maxTextureUnits && console.warn("Trying to use " + e + " texture units while this GPU supports only " + t._caps.maxTextureUnits), this._usedTextureUnits += 1, e
  34959. }, t.prototype._registerStage = function(t, e) {
  34960. this._stage2fn[t] = e
  34961. }, t.prototype.clear = function() {
  34962. this._programLib.clear(), this.reset()
  34963. }, t.prototype.reset = function() {
  34964. this._viewPools.reset(), this._stageItemsPools.reset()
  34965. }, t.prototype._requestView = function() {
  34966. return this._viewPools.add()
  34967. }, t.prototype._render = function(t, e) {
  34968. var i = this._device;
  34969. i.setFrameBuffer(t._framebuffer), i.setViewport(t._rect.x, t._rect.y, t._rect.w, t._rect.h);
  34970. var n = {};
  34971. t._clearFlags & o.default.CLEAR_COLOR && (n.color = [t._color.r, t._color.g, t._color.b, t._color.a]), t._clearFlags & o.default.CLEAR_DEPTH && (n.depth = t._depth), t._clearFlags & o.default.CLEAR_STENCIL && (n.stencil = t._stencil), i.clear(n), this._drawItemsPools.reset();
  34972. for (var r = 0; r < e._models.length; ++r) {
  34973. var s = e._models.data[r];
  34974. if (0 != (s._cullingMask & t._cullingMask)) {
  34975. var a = this._drawItemsPools.add();
  34976. s.extractDrawItem(a)
  34977. }
  34978. }
  34979. d.reset();
  34980. for (var l = 0; l < t._stages.length; ++l) {
  34981. var h = t._stages[l],
  34982. c = this._stageItemsPools.add();
  34983. c.reset();
  34984. for (var u = 0; u < this._drawItemsPools.length; ++u) {
  34985. var _ = this._drawItemsPools.data[u],
  34986. f = _.effect.getTechnique(h);
  34987. if (f) {
  34988. var p = c.add();
  34989. p.model = _.model, p.node = _.node, p.ia = _.ia, p.effect = _.effect, p.defines = _.defines, p.technique = f, p.sortKey = -1, p.uniforms = _.uniforms
  34990. }
  34991. }
  34992. var m = d.add();
  34993. m.stage = h, m.items = c
  34994. }
  34995. for (var y = 0; y < d.length; ++y) {
  34996. var v = d.data[y];
  34997. (0, this._stage2fn[v.stage])(t, v.items)
  34998. }
  34999. }, t.prototype._setProperty = function(t) {
  35000. var e = this._device,
  35001. i = t.value;
  35002. if (void 0 === i && (i = t.val), void 0 === i && (i = this._type2defaultValue[t.type]), void 0 !== i)
  35003. if (t.type === o.default.PARAM_TEXTURE_2D || t.type === o.default.PARAM_TEXTURE_CUBE)
  35004. if (Array.isArray(i)) {
  35005. if (i.length > t.count) return void console.error("Failed to set property [" + t.name + "] : The length of texture array [" + i.length + "] is bigger than [" + t.count + "].");
  35006. for (var n = T.add(), r = 0; r < i.length; ++r) n[r] = this._allocTextureUnit();
  35007. e.setTextureArray(t.name, i, n)
  35008. } else e.setTexture(t.name, i, this._allocTextureUnit());
  35009. else t.directly ? e.setUniformDirectly(t.name, i) : e.setUniform(t.name, i);
  35010. else console.warn("Failed to set technique property " + t.name + ", value not found.")
  35011. }, t.prototype._draw = function(t) {
  35012. var e = this._device,
  35013. i = this._programLib,
  35014. n = t.node,
  35015. r = t.ia,
  35016. s = t.uniforms,
  35017. o = t.technique,
  35018. l = t.defines,
  35019. h = t.effect;
  35020. p.reset(), m.reset(), y.reset(), v.reset(), g.reset(), x.reset(), b.reset(), A.reset(), C.reset(), T.reset(), n.getWorldMatrix(f), e.setUniform("cc_matWorld", a.mat4.array(g.add(), f)), a.mat4.invert(f, f), a.mat4.transpose(f, f), e.setUniform("cc_matWorldIT", a.mat4.array(g.add(), f));
  35021. for (var u = 0; u < s.length; u++) {
  35022. var _ = s[u];
  35023. for (var d in _) this._setProperty(_[d])
  35024. }
  35025. for (var S = 0; S < o._passes.length; ++S) {
  35026. var w = o._passes[S],
  35027. E = r.count;
  35028. r._vertexBuffer && e.setVertexBuffer(0, r._vertexBuffer), r._indexBuffer && e.setIndexBuffer(r._indexBuffer), e.setPrimitiveType(r._primitiveType);
  35029. var M = i.getProgram(w._programName, l, h._name);
  35030. e.setProgram(M), e.setCullMode(w._cullMode), w._blend && (e.enableBlend(), e.setBlendFuncSep(w._blendSrc, w._blendDst, w._blendSrcAlpha, w._blendDstAlpha), e.setBlendEqSep(w._blendEq, w._blendAlphaEq), e.setBlendColor32(w._blendColor)), w._depthTest && (e.enableDepthTest(), e.setDepthFunc(w._depthFunc)), w._depthWrite && e.enableDepthWrite(), e.setStencilTest(w._stencilTest), w._stencilTest === c.default.STENCIL_ENABLE && (e.setStencilFuncFront(w._stencilFuncFront, w._stencilRefFront, w._stencilMaskFront), e.setStencilOpFront(w._stencilFailOpFront, w._stencilZFailOpFront, w._stencilZPassOpFront, w._stencilWriteMaskFront), e.setStencilFuncBack(w._stencilFuncBack, w._stencilRefBack, w._stencilMaskBack), e.setStencilOpBack(w._stencilFailOpBack, w._stencilZFailOpBack, w._stencilZPassOpBack, w._stencilWriteMaskBack)), e.draw(r._start, E), this._resetTextuerUnit()
  35031. }
  35032. }, t
  35033. })());
  35034. i.default = S, e.exports = i.default
  35035. }), {
  35036. "../../core/vmath": 326,
  35037. "../enums": 355,
  35038. "../gfx": 360,
  35039. "../memop": 372,
  35040. "./program-lib": 352,
  35041. "./view": 354
  35042. }],
  35043. 349: [(function(t, e, i) {
  35044. "use strict";
  35045. i.__esModule = !0;
  35046. var n = l(t("../config")),
  35047. r = l(t("../core/pass")),
  35048. s = l(t("../core/technique")),
  35049. o = t("../types"),
  35050. a = l(t("../enums"));
  35051. l(t("../gfx"));
  35052. function l(t) {
  35053. return t && t.__esModule ? t : {
  35054. default: t
  35055. }
  35056. }
  35057. function h(t, e) {
  35058. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35059. }
  35060. var c = (function() {
  35061. function t(e, i) {
  35062. var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
  35063. r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
  35064. s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : [];
  35065. h(this, t), this._name = e, this._techniques = i, this._properties = n, this._defines = r, this._dependencies = s
  35066. }
  35067. return t.prototype.clear = function() {
  35068. this._techniques.length = 0, this._properties = {}, this._defines = {}
  35069. }, t.prototype.setCullMode = function(t) {
  35070. for (var e = this._techniques[0].passes, i = 0; i < e.length; i++) e[i].setCullMode(t)
  35071. }, t.prototype.setDepth = function(t, e, i) {
  35072. for (var n = this._techniques[0].passes, r = 0; r < n.length; r++) n[r].setDepth(t, e, i)
  35073. }, t.prototype.setBlend = function(t, e, i, n, r, s, o, a) {
  35074. for (var l = this._techniques[0].passes, h = 0; h < l.length; h++) {
  35075. l[h].setBlend(t, e, i, n, r, s, o, a)
  35076. }
  35077. }, t.prototype.setStencilEnabled = function(t) {
  35078. for (var e = this._techniques[0].passes, i = 0; i < e.length; i++) e[i].setStencilEnabled(t)
  35079. }, t.prototype.setStencil = function(t, e, i, n, r, s, o, a) {
  35080. for (var l = this._techniques[0].passes, h = 0; h < l.length; ++h) {
  35081. var c = l[h];
  35082. c.setStencilFront(t, e, i, n, r, s, o, a), c.setStencilBack(t, e, i, n, r, s, o, a)
  35083. }
  35084. }, t.prototype.getTechnique = function(t) {
  35085. var e = n.default.stageID(t);
  35086. if (-1 === e) return null;
  35087. for (var i = 0; i < this._techniques.length; ++i) {
  35088. var r = this._techniques[i];
  35089. if (r.stageIDs & e) return r
  35090. }
  35091. return null
  35092. }, t.prototype.getProperty = function(t) {
  35093. return this._properties[t] ? this._properties[t].value : (cc.warn(this._name + " : Failed to get property " + t + ", property not found."), null)
  35094. }, t.prototype.setProperty = function(t, e) {
  35095. var i = this._properties[t];
  35096. if (i)
  35097. if (Array.isArray(e)) {
  35098. var n = i.value;
  35099. if (n.length !== e.length) return void cc.warn(this._name + " : Failed to set property " + t + ", property length not correct.");
  35100. for (var r = 0; r < e.length; r++) n[r] = e[r]
  35101. } else i.type === a.default.PARAM_TEXTURE_2D ? i.value = e ? e.getImpl() : null : e.array ? e.array(i.value) : (e && "object" == typeof e && cc.warn("Set effect property " + this._name + " warning : should transform object to ArrayBuffer"), i.value = e);
  35102. else cc.warn(this._name + " : Failed to set property " + t + ", property not found.")
  35103. }, t.prototype.updateHash = function(t) {}, t.prototype.getDefine = function(t) {
  35104. var e = this._defines[t];
  35105. return void 0 === e && cc.warn(this._name + " : Failed to get define " + t + ", define not found."), e
  35106. }, t.prototype.define = function(t, e) {
  35107. void 0 !== this._defines[t] ? this._defines[t] = e : cc.warn(this._name + " : Failed to set define " + t + ", define not found.")
  35108. }, t.prototype.extractProperties = function() {
  35109. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  35110. return Object.assign(t, this._properties), t
  35111. }, t.prototype.extractDefines = function() {
  35112. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  35113. return Object.assign(t, this._defines), t
  35114. }, t.prototype.extractDependencies = function() {
  35115. for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = 0; e < this._dependencies.length; ++e) {
  35116. var i = this._dependencies[e];
  35117. t[i.define] = i.extension
  35118. }
  35119. return t
  35120. }, t.prototype.clone = function() {
  35121. var t = this.extractDefines({}),
  35122. e = this.extractDependencies({}),
  35123. i = {},
  35124. n = this._properties;
  35125. for (var r in n) {
  35126. var s = n[r],
  35127. o = i[r] = {},
  35128. a = s.value;
  35129. for (var l in Array.isArray(a) ? o.value = a.concat() : ArrayBuffer.isView(a) ? o.value = new a.__proto__.constructor(a) : o.value = a, s) "value" !== l && (o[l] = s[l])
  35130. }
  35131. for (var h = [], c = 0; c < this._techniques.length; c++) h.push(this._techniques[c].clone());
  35132. return new cc.Effect(this._name, h, i, t, e)
  35133. }, t
  35134. })(),
  35135. u = function(t) {
  35136. var e = [],
  35137. i = cc.renderer._forward._programLib;
  35138. return t.techniques.forEach((function(t) {
  35139. t.passes.forEach((function(t) {
  35140. e.push(i.getTemplate(t.program))
  35141. }))
  35142. })), e
  35143. };
  35144. function _(t, e) {
  35145. var i = {},
  35146. n = {};
  35147. t.techniques.forEach((function(t) {
  35148. t.passes.forEach((function(t) {
  35149. Object.assign(n, t.properties)
  35150. }))
  35151. }));
  35152. var r = function(r) {
  35153. for (var s = n[r], o = void 0, l = 0; l < e.length && !(o = e[l].uniforms.find((function(t) {
  35154. return t.name === r
  35155. }))); l++);
  35156. if (!o) return cc.warn(t.name + " : illegal property: " + r + ", myabe defined a not used property"), "continue";
  35157. i[r] = Object.assign({}, s), i[r].value = s.type === a.default.PARAM_TEXTURE_2D ? null : new Float32Array(s.value)
  35158. };
  35159. for (var s in n) r(s);
  35160. return i
  35161. }
  35162. c.parseTechniques = function(t) {
  35163. for (var e = t.techniques.length, i = new Array(e), n = 0; n < e; ++n) {
  35164. var o = t.techniques[n];
  35165. o.stages || (o.stages = ["opaque"]);
  35166. for (var a = o.passes.length, l = new Array(a), h = 0; h < a; ++h) {
  35167. var c = o.passes[h];
  35168. l[h] = new r.default(c.program), c.rasterizerState && l[h].setCullMode(c.rasterizerState.cullMode);
  35169. var u = c.blendState && c.blendState.targets[0];
  35170. u && l[h].setBlend(u.blend, u.blendEq, u.blendSrc, u.blendDst, u.blendAlphaEq, u.blendSrcAlpha, u.blendDstAlpha, u.blendColor);
  35171. var _ = c.depthStencilState;
  35172. _ && (l[h].setDepth(_.depthTest, _.depthWrite, _.depthFunc), l[h].setStencilFront(_.stencilTest, _.stencilFuncFront, _.stencilRefFront, _.stencilMaskFront, _.stencilFailOpFront, _.stencilZFailOpFront, _.stencilZPassOpFront, _.stencilWriteMaskFront), l[h].setStencilBack(_.stencilTest, _.stencilFuncBack, _.stencilRefBack, _.stencilMaskBack, _.stencilFailOpBack, _.stencilZFailOpBack, _.stencilZPassOpBack, _.stencilWriteMaskBack))
  35173. }
  35174. i[n] = new s.default(o.stages, l, o.layer)
  35175. }
  35176. return i
  35177. }, c.parseEffect = function(t) {
  35178. var e = c.parseTechniques(t),
  35179. i = u(t),
  35180. n = _(t, i),
  35181. r = {},
  35182. s = {};
  35183. i.forEach((function(t) {
  35184. t.uniforms.forEach((function(t) {
  35185. var e = t.name,
  35186. i = r[e] = Object.assign({}, t);
  35187. n[e] ? i.value = n[e].value : i.value = o.enums2default[t.type]
  35188. })), t.defines.forEach((function(t) {
  35189. s[t.name] = o.enums2default[t.type]
  35190. }))
  35191. }));
  35192. var a = i.reduce((function(t, e) {
  35193. return t.concat(e.extensions)
  35194. }), []);
  35195. return a = a.map((function(t) {
  35196. return Object.assign({}, t)
  35197. })), new cc.Effect(t.name, e, r, s, a, t)
  35198. }, cc.Effect = c, i.default = c, e.exports = i.default
  35199. }), {
  35200. "../config": 347,
  35201. "../core/pass": 351,
  35202. "../core/technique": 353,
  35203. "../enums": 355,
  35204. "../gfx": 360,
  35205. "../types": 384
  35206. }],
  35207. 350: [(function(t, e, i) {
  35208. "use strict";
  35209. i.__esModule = !0, i.default = void 0;
  35210. var n = (function() {
  35211. function t(t, e) {
  35212. for (var i = 0; i < e.length; i++) {
  35213. var n = e[i];
  35214. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  35215. }
  35216. }
  35217. return function(e, i, n) {
  35218. return i && t(e.prototype, i), n && t(e, n), e
  35219. }
  35220. })(),
  35221. r = (function(t) {
  35222. return t && t.__esModule ? t : {
  35223. default: t
  35224. }
  35225. })(t("../gfx"));
  35226. function s(t, e) {
  35227. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35228. }
  35229. var o = (function() {
  35230. function t(e, i) {
  35231. var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : r.default.PT_TRIANGLES;
  35232. s(this, t), this._vertexBuffer = e, this._indexBuffer = i, this._primitiveType = n, this._start = 0, this._count = -1
  35233. }
  35234. return n(t, [{
  35235. key: "count",
  35236. get: function() {
  35237. return -1 !== this._count ? this._count : this._indexBuffer ? this._indexBuffer.count : this._vertexBuffer ? this._vertexBuffer.count : 0
  35238. }
  35239. }]), t
  35240. })();
  35241. i.default = o, e.exports = i.default
  35242. }), {
  35243. "../gfx": 360
  35244. }],
  35245. 351: [(function(t, e, i) {
  35246. "use strict";
  35247. i.__esModule = !0, i.default = void 0;
  35248. var n = (function(t) {
  35249. return t && t.__esModule ? t : {
  35250. default: t
  35251. }
  35252. })(t("../gfx"));
  35253. function r(t, e) {
  35254. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35255. }
  35256. var s = (function() {
  35257. function t(e) {
  35258. r(this, t), this._programName = e, this._cullMode = n.default.CULL_BACK, this._blend = !1, this._blendEq = n.default.BLEND_FUNC_ADD, this._blendAlphaEq = n.default.BLEND_FUNC_ADD, this._blendSrc = n.default.BLEND_SRC_ALPHA, this._blendDst = n.default.BLEND_ONE_MINUS_SRC_ALPHA, this._blendSrcAlpha = n.default.BLEND_SRC_ALPHA, this._blendDstAlpha = n.default.BLEND_ONE_MINUS_SRC_ALPHA, this._blendColor = 4294967295, this._depthTest = !1, this._depthWrite = !1, this._depthFunc = n.default.DS_FUNC_LESS, this._stencilTest = n.default.STENCIL_INHERIT, this._stencilFuncFront = n.default.DS_FUNC_ALWAYS, this._stencilRefFront = 0, this._stencilMaskFront = 255, this._stencilFailOpFront = n.default.STENCIL_OP_KEEP, this._stencilZFailOpFront = n.default.STENCIL_OP_KEEP, this._stencilZPassOpFront = n.default.STENCIL_OP_KEEP, this._stencilWriteMaskFront = 255, this._stencilFuncBack = n.default.DS_FUNC_ALWAYS, this._stencilRefBack = 0, this._stencilMaskBack = 255, this._stencilFailOpBack = n.default.STENCIL_OP_KEEP, this._stencilZFailOpBack = n.default.STENCIL_OP_KEEP, this._stencilZPassOpBack = n.default.STENCIL_OP_KEEP, this._stencilWriteMaskBack = 255
  35259. }
  35260. return t.prototype.setCullMode = function() {
  35261. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.CULL_BACK;
  35262. this._cullMode = t
  35263. }, t.prototype.setBlend = function() {
  35264. var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
  35265. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.default.BLEND_FUNC_ADD,
  35266. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : n.default.BLEND_SRC_ALPHA,
  35267. r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : n.default.BLEND_ONE_MINUS_SRC_ALPHA,
  35268. s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n.default.BLEND_FUNC_ADD,
  35269. o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : n.default.BLEND_SRC_ALPHA,
  35270. a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : n.default.BLEND_ONE_MINUS_SRC_ALPHA,
  35271. l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 4294967295;
  35272. this._blend = t, this._blendEq = e, this._blendSrc = i, this._blendDst = r, this._blendAlphaEq = s, this._blendSrcAlpha = o, this._blendDstAlpha = a, this._blendColor = l
  35273. }, t.prototype.setDepth = function() {
  35274. var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
  35275. e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
  35276. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : n.default.DS_FUNC_LESS;
  35277. this._depthTest = t, this._depthWrite = e, this._depthFunc = i
  35278. }, t.prototype.setStencilFront = function() {
  35279. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.STENCIL_INHERIT,
  35280. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.default.DS_FUNC_ALWAYS,
  35281. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  35282. r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 255,
  35283. s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n.default.STENCIL_OP_KEEP,
  35284. o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : n.default.STENCIL_OP_KEEP,
  35285. a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : n.default.STENCIL_OP_KEEP,
  35286. l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 255;
  35287. this._stencilTest = t, this._stencilFuncFront = e, this._stencilRefFront = i, this._stencilMaskFront = r, this._stencilFailOpFront = s, this._stencilZFailOpFront = o, this._stencilZPassOpFront = a, this._stencilWriteMaskFront = l
  35288. }, t.prototype.setStencilEnabled = function() {
  35289. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.STENCIL_INHERIT;
  35290. this._stencilTest = t
  35291. }, t.prototype.setStencilBack = function() {
  35292. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.default.STENCIL_INHERIT,
  35293. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.default.DS_FUNC_ALWAYS,
  35294. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  35295. r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 255,
  35296. s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n.default.STENCIL_OP_KEEP,
  35297. o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : n.default.STENCIL_OP_KEEP,
  35298. a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : n.default.STENCIL_OP_KEEP,
  35299. l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 255;
  35300. this._stencilTest = t, this._stencilFuncBack = e, this._stencilRefBack = i, this._stencilMaskBack = r, this._stencilFailOpBack = s, this._stencilZFailOpBack = o, this._stencilZPassOpBack = a, this._stencilWriteMaskBack = l
  35301. }, t.prototype.clone = function() {
  35302. var e = new t(this._programName);
  35303. return Object.assign(e, this), e
  35304. }, t
  35305. })();
  35306. i.default = s, e.exports = i.default
  35307. }), {
  35308. "../gfx": 360
  35309. }],
  35310. 352: [(function(t, e, i) {
  35311. "use strict";
  35312. i.__esModule = !0, i.default = void 0;
  35313. var n = (function(t) {
  35314. return t && t.__esModule ? t : {
  35315. default: t
  35316. }
  35317. })(t("../gfx"));
  35318. function r(t, e) {
  35319. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35320. }
  35321. var s = 0;
  35322. function o(t) {
  35323. for (var e = [], i = {}, n = t.length - 1; n >= 0; n--) {
  35324. var r = t[n];
  35325. for (var s in r) {
  35326. var o = r[s];
  35327. void 0 !== o && (void 0 === i[s] && ("number" != typeof o && (o = o ? 1 : 0), i[s] = o, e.push("#define " + s + " " + o)))
  35328. }
  35329. }
  35330. return e.join("\n") + "\n"
  35331. }
  35332. function a(t, e) {
  35333. for (var i = {}, n = t, r = e.length - 1; r >= 0; r--) {
  35334. var s = e[r];
  35335. for (var o in s) {
  35336. var a = s[o];
  35337. void 0 !== a && (void 0 === i[o] && Number.isInteger(a) && (i[o] = a))
  35338. }
  35339. }
  35340. for (var l in i) {
  35341. var h = new RegExp(l, "g");
  35342. n = n.replace(h, i[l])
  35343. }
  35344. return n
  35345. }
  35346. function l(t) {
  35347. return t.replace(/#pragma for (\w+) in range\(\s*(\d+)\s*,\s*(\d+)\s*\)([\s\S]+?)#pragma endFor/g, (function(t, e, i, n, r) {
  35348. var s = "",
  35349. o = parseInt(i),
  35350. a = parseInt(n);
  35351. (o.isNaN || a.isNaN) && console.error("Unroll For Loops Error: begin and end of range must be an int num.");
  35352. for (var l = o; l < a; ++l) s += r.replace(new RegExp("{" + e + "}", "g"), l);
  35353. return s
  35354. }))
  35355. }
  35356. function h(t) {
  35357. return t.replace(/\bhighp\b/g, "mediump")
  35358. }
  35359. var c = (function() {
  35360. function t(e) {
  35361. r(this, t), this._device = e, this._templates = {}, this._cache = {}, this._checkPrecision()
  35362. }
  35363. return t.prototype.clear = function() {
  35364. this._templates = {}, this._cache = {}
  35365. }, t.prototype.define = function(t) {
  35366. var e = t.name,
  35367. i = t.defines,
  35368. n = t.glsl1 || t,
  35369. r = n.vert,
  35370. o = n.frag;
  35371. if (!this._templates[e]) {
  35372. for (var a = ++s, l = 0, h = 0; h < i.length; ++h) {
  35373. var c = i[h],
  35374. u = 1;
  35375. if ("number" === c.type) {
  35376. var _ = c.range || [];
  35377. c.min = _[0] || 0, c.max = _[1] || 4, u = Math.ceil(Math.log2(c.max - c.min)), c._map = function(t) {
  35378. return t - this.min << this._offset
  35379. }.bind(c)
  35380. } else c._map = function(t) {
  35381. return t ? 1 << this._offset : 0
  35382. }.bind(c);
  35383. l += u, c._offset = l
  35384. }
  35385. var f = t.uniforms || [];
  35386. if (t.samplers)
  35387. for (var d = 0; d < t.samplers.length; d++) f.push(t.samplers[d]);
  35388. if (t.blocks)
  35389. for (var p = 0; p < t.blocks.length; p++)
  35390. for (var m = t.blocks[p].defines, y = t.blocks[p].members, v = 0; v < y.length; v++) f.push({
  35391. defines: m,
  35392. name: y[v].name,
  35393. type: y[v].type
  35394. });
  35395. this._templates[e] = {
  35396. id: a,
  35397. name: e,
  35398. vert: r,
  35399. frag: o,
  35400. defines: i,
  35401. attributes: t.attributes,
  35402. uniforms: f,
  35403. extensions: t.extensions
  35404. }
  35405. }
  35406. }, t.prototype.getTemplate = function(t) {
  35407. return this._templates[t]
  35408. }, t.prototype.hasProgram = function(t) {
  35409. return void 0 !== this._templates[t]
  35410. }, t.prototype.getKey = function(t, e) {
  35411. for (var i = this._templates[t], n = 0, r = 0; r < i.defines.length; ++r) {
  35412. var s = i.defines[r],
  35413. o = this._getValueFromDefineList(s.name, e);
  35414. void 0 !== o && (n |= s._map(o))
  35415. }
  35416. return i.id + ":" + n
  35417. }, t.prototype.getProgram = function(t, e, i) {
  35418. var r = this.getKey(t, e),
  35419. s = this._cache[r];
  35420. if (s) return s;
  35421. var c = this._templates[t],
  35422. u = o(e),
  35423. _ = a(c.vert, e);
  35424. _ = u + l(_), this._highpSupported || (_ = h(_));
  35425. var f = a(c.frag, e);
  35426. f = u + l(f), this._highpSupported || (f = h(f));
  35427. var d = (s = new n.default.Program(this._device, {
  35428. vert: _,
  35429. frag: f
  35430. })).link();
  35431. if (d) {
  35432. var p = _.split("\n"),
  35433. m = f.split("\n"),
  35434. y = Object.keys(e).length;
  35435. d.forEach((function(t) {
  35436. var e = t.line - 1,
  35437. n = t.line - y,
  35438. r = ("vs" === t.type ? p : m)[e],
  35439. s = t.info || "Failed to compile " + t.type + " " + t.fileID + " (ln " + n + "): \n " + t.message + ": \n " + r;
  35440. cc.error(i + " : " + s)
  35441. }))
  35442. }
  35443. return this._cache[r] = s, s
  35444. }, t.prototype._getValueFromDefineList = function(t, e) {
  35445. for (var i = void 0, n = e.length - 1; n >= 0; n--)
  35446. if (void 0 !== (i = e[n][t])) return i
  35447. }, t.prototype._checkPrecision = function() {
  35448. var t = this._device._gl,
  35449. e = !1;
  35450. if (t.getShaderPrecisionFormat) {
  35451. var i = t.getShaderPrecisionFormat(t.VERTEX_SHADER, t.HIGH_FLOAT),
  35452. n = t.getShaderPrecisionFormat(t.FRAGMENT_SHADER, t.HIGH_FLOAT);
  35453. e = i && i.precision > 0 && n && n.precision > 0
  35454. }
  35455. e || cc.warnID(9102), this._highpSupported = e
  35456. }, t
  35457. })();
  35458. i.default = c, e.exports = i.default
  35459. }), {
  35460. "../gfx": 360
  35461. }],
  35462. 353: [(function(t, e, i) {
  35463. "use strict";
  35464. i.__esModule = !0, i.default = void 0;
  35465. var n = (function() {
  35466. function t(t, e) {
  35467. for (var i = 0; i < e.length; i++) {
  35468. var n = e[i];
  35469. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  35470. }
  35471. }
  35472. return function(e, i, n) {
  35473. return i && t(e.prototype, i), n && t(e, n), e
  35474. }
  35475. })(),
  35476. r = (function(t) {
  35477. return t && t.__esModule ? t : {
  35478. default: t
  35479. }
  35480. })(t("../config"));
  35481. function s(t, e) {
  35482. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35483. }
  35484. var o = 0,
  35485. a = (function() {
  35486. function t(e, i) {
  35487. var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
  35488. s(this, t), this._id = o++, this._stages = e, this._stageIDs = r.default.stageIDs(e), this._passes = i, this._layer = n
  35489. }
  35490. return t.prototype.setStages = function(t) {
  35491. this._stageIDs = r.default.stageIDs(t)
  35492. }, t.prototype.clone = function() {
  35493. for (var e = [], i = 0; i < this._passes.length; i++) e.push(this._passes[i].clone());
  35494. return new t(this._stages, e, this._layer)
  35495. }, n(t, [{
  35496. key: "passes",
  35497. get: function() {
  35498. return this._passes
  35499. }
  35500. }, {
  35501. key: "stageIDs",
  35502. get: function() {
  35503. return this._stageIDs
  35504. }
  35505. }]), t
  35506. })();
  35507. i.default = a, e.exports = i.default
  35508. }), {
  35509. "../config": 347
  35510. }],
  35511. 354: [(function(t, e, i) {
  35512. "use strict";
  35513. i.__esModule = !0, i.default = void 0;
  35514. var n = t("../../core/vmath"),
  35515. r = (function(t) {
  35516. return t && t.__esModule ? t : {
  35517. default: t
  35518. }
  35519. })(t("../enums"));
  35520. function s(t, e) {
  35521. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35522. }
  35523. var o = n.mat4.create(),
  35524. a = 0,
  35525. l = (function() {
  35526. function t() {
  35527. s(this, t), this._id = a++, this._priority = 0, this._rect = {
  35528. x: 0,
  35529. y: 0,
  35530. w: 1,
  35531. h: 1
  35532. }, this._color = n.color4.create(.3, .3, .3, 1), this._depth = 1, this._stencil = 0, this._clearFlags = r.default.CLEAR_COLOR | r.default.CLEAR_DEPTH, this._clearModel = null, this._matView = n.mat4.create(), this._matProj = n.mat4.create(), this._matViewProj = n.mat4.create(), this._matInvViewProj = n.mat4.create(), this._stages = [], this._cullingByID = !1, this._framebuffer = null, this._shadowLight = null, this._cullingMask = 4294967295
  35533. }
  35534. return t.prototype.getForward = function(t) {
  35535. var e = this._matView.m;
  35536. return n.vec3.set(t, -e[2], -e[6], -e[10])
  35537. }, t.prototype.getPosition = function(t) {
  35538. return n.mat4.invert(o, this._matView), n.mat4.getTranslation(t, o)
  35539. }, t
  35540. })();
  35541. i.default = l, e.exports = i.default
  35542. }), {
  35543. "../../core/vmath": 326,
  35544. "../enums": 355
  35545. }],
  35546. 355: [(function(t, e, i) {
  35547. "use strict";
  35548. i.__esModule = !0;
  35549. var n = t("./build/mappings");
  35550. i.default = {
  35551. PROJ_PERSPECTIVE: 0,
  35552. PROJ_ORTHO: 1,
  35553. LIGHT_DIRECTIONAL: 0,
  35554. LIGHT_POINT: 1,
  35555. LIGHT_SPOT: 2,
  35556. LIGHT_AMBIENT: 3,
  35557. SHADOW_NONE: 0,
  35558. SHADOW_HARD: 1,
  35559. SHADOW_SOFT: 2,
  35560. PARAM_INT: n.typeMap.int,
  35561. PARAM_INT2: n.typeMap.ivec2,
  35562. PARAM_INT3: n.typeMap.ivec3,
  35563. PARAM_INT4: n.typeMap.ivec4,
  35564. PARAM_FLOAT: n.typeMap.float,
  35565. PARAM_FLOAT2: n.typeMap.vec2,
  35566. PARAM_FLOAT3: n.typeMap.vec3,
  35567. PARAM_FLOAT4: n.typeMap.vec4,
  35568. PARAM_MAT2: n.typeMap.mat2,
  35569. PARAM_MAT3: n.typeMap.mat3,
  35570. PARAM_MAT4: n.typeMap.mat4,
  35571. PARAM_TEXTURE_2D: n.typeMap.sampler2D,
  35572. PARAM_TEXTURE_CUBE: n.typeMap.samplerCube,
  35573. CLEAR_COLOR: 1,
  35574. CLEAR_DEPTH: 2,
  35575. CLEAR_STENCIL: 4,
  35576. CLEAR_SKYBOX: 8,
  35577. BUFFER_VIEW_INT8: 0,
  35578. BUFFER_VIEW_UINT8: 1,
  35579. BUFFER_VIEW_INT16: 2,
  35580. BUFFER_VIEW_UINT16: 3,
  35581. BUFFER_VIEW_INT32: 4,
  35582. BUFFER_VIEW_UINT32: 5,
  35583. BUFFER_VIEW_FLOAT32: 6
  35584. }, e.exports = i.default
  35585. }), {
  35586. "./build/mappings": 346
  35587. }],
  35588. 356: [(function(t, e, i) {
  35589. "use strict";
  35590. i.__esModule = !0, i.default = void 0;
  35591. var n, r, s = (function() {
  35592. function t(t, e) {
  35593. for (var i = 0; i < e.length; i++) {
  35594. var n = e[i];
  35595. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  35596. }
  35597. }
  35598. return function(e, i, n) {
  35599. return i && t(e.prototype, i), n && t(e, n), e
  35600. }
  35601. })(),
  35602. o = c(t("./state")),
  35603. a = t("./enums"),
  35604. l = c(t("./texture-2d")),
  35605. h = c(t("./texture-cube"));
  35606. function c(t) {
  35607. return t && t.__esModule ? t : {
  35608. default: t
  35609. }
  35610. }
  35611. function u(t, e) {
  35612. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  35613. }
  35614. var _ = ((n = {})[5124] = function(t, e, i) {
  35615. t.uniform1i(e, i)
  35616. }, n[5126] = function(t, e, i) {
  35617. t.uniform1f(e, i)
  35618. }, n[35664] = function(t, e, i) {
  35619. t.uniform2fv(e, i)
  35620. }, n[35665] = function(t, e, i) {
  35621. t.uniform3fv(e, i)
  35622. }, n[35666] = function(t, e, i) {
  35623. t.uniform4fv(e, i)
  35624. }, n[35667] = function(t, e, i) {
  35625. t.uniform2iv(e, i)
  35626. }, n[35668] = function(t, e, i) {
  35627. t.uniform3iv(e, i)
  35628. }, n[35669] = function(t, e, i) {
  35629. t.uniform4iv(e, i)
  35630. }, n[35670] = function(t, e, i) {
  35631. t.uniform1i(e, i)
  35632. }, n[35671] = function(t, e, i) {
  35633. t.uniform2iv(e, i)
  35634. }, n[35672] = function(t, e, i) {
  35635. t.uniform3iv(e, i)
  35636. }, n[35673] = function(t, e, i) {
  35637. t.uniform4iv(e, i)
  35638. }, n[35674] = function(t, e, i) {
  35639. t.uniformMatrix2fv(e, !1, i)
  35640. }, n[35675] = function(t, e, i) {
  35641. t.uniformMatrix3fv(e, !1, i)
  35642. }, n[35676] = function(t, e, i) {
  35643. t.uniformMatrix4fv(e, !1, i)
  35644. }, n[35678] = function(t, e, i) {
  35645. t.uniform1i(e, i)
  35646. }, n[35680] = function(t, e, i) {
  35647. t.uniform1i(e, i)
  35648. }, n),
  35649. f = ((r = {})[5124] = function(t, e, i) {
  35650. t.uniform1iv(e, i)
  35651. }, r[5126] = function(t, e, i) {
  35652. t.uniform1fv(e, i)
  35653. }, r[35664] = function(t, e, i) {
  35654. t.uniform2fv(e, i)
  35655. }, r[35665] = function(t, e, i) {
  35656. t.uniform3fv(e, i)
  35657. }, r[35666] = function(t, e, i) {
  35658. t.uniform4fv(e, i)
  35659. }, r[35667] = function(t, e, i) {
  35660. t.uniform2iv(e, i)
  35661. }, r[35668] = function(t, e, i) {
  35662. t.uniform3iv(e, i)
  35663. }, r[35669] = function(t, e, i) {
  35664. t.uniform4iv(e, i)
  35665. }, r[35670] = function(t, e, i) {
  35666. t.uniform1iv(e, i)
  35667. }, r[35671] = function(t, e, i) {
  35668. t.uniform2iv(e, i)
  35669. }, r[35672] = function(t, e, i) {
  35670. t.uniform3iv(e, i)
  35671. }, r[35673] = function(t, e, i) {
  35672. t.uniform4iv(e, i)
  35673. }, r[35674] = function(t, e, i) {
  35674. t.uniformMatrix2fv(e, !1, i)
  35675. }, r[35675] = function(t, e, i) {
  35676. t.uniformMatrix3fv(e, !1, i)
  35677. }, r[35676] = function(t, e, i) {
  35678. t.uniformMatrix4fv(e, !1, i)
  35679. }, r[35678] = function(t, e, i) {
  35680. t.uniform1iv(e, i)
  35681. }, r[35680] = function(t, e, i) {
  35682. t.uniform1iv(e, i)
  35683. }, r);
  35684. function d(t, e, i) {
  35685. if (e.blend !== i.blend) return i.blend ? (t.enable(t.BLEND), i.blendSrc !== a.enums.BLEND_CONSTANT_COLOR && i.blendSrc !== a.enums.BLEND_ONE_MINUS_CONSTANT_COLOR && i.blendDst !== a.enums.BLEND_CONSTANT_COLOR && i.blendDst !== a.enums.BLEND_ONE_MINUS_CONSTANT_COLOR || t.blendColor((i.blendColor >> 24) / 255, (i.blendColor >> 16 & 255) / 255, (i.blendColor >> 8 & 255) / 255, (255 & i.blendColor) / 255), void(i.blendSep ? (t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (t.blendFunc(i.blendSrc, i.blendDst), t.blendEquation(i.blendEq)))) : void t.disable(t.BLEND);
  35686. !1 !== i.blend && (e.blendColor !== i.blendColor && t.blendColor((i.blendColor >> 24) / 255, (i.blendColor >> 16 & 255) / 255, (i.blendColor >> 8 & 255) / 255, (255 & i.blendColor) / 255), e.blendSep === i.blendSep ? i.blendSep ? (e.blendSrc === i.blendSrc && e.blendDst === i.blendDst && e.blendSrcAlpha === i.blendSrcAlpha && e.blendDstAlpha === i.blendDstAlpha || t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), e.blendEq === i.blendEq && e.blendAlphaEq === i.blendAlphaEq || t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (e.blendSrc === i.blendSrc && e.blendDst === i.blendDst || t.blendFunc(i.blendSrc, i.blendDst), e.blendEq !== i.blendEq && t.blendEquation(i.blendEq)) : i.blendSep ? (t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (t.blendFunc(i.blendSrc, i.blendDst), t.blendEquation(i.blendEq)))
  35687. }
  35688. function p(t, e, i) {
  35689. if (e.depthTest !== i.depthTest) return i.depthTest ? (t.enable(t.DEPTH_TEST), t.depthFunc(i.depthFunc), void t.depthMask(i.depthWrite)) : void t.disable(t.DEPTH_TEST);
  35690. e.depthWrite !== i.depthWrite && t.depthMask(i.depthWrite), !1 !== i.depthTest ? e.depthFunc !== i.depthFunc && t.depthFunc(i.depthFunc) : i.depthWrite && (i.depthTest = !0, i.depthFunc = a.enums.DS_FUNC_ALWAYS, t.enable(t.DEPTH_TEST), t.depthFunc(i.depthFunc))
  35691. }
  35692. function m(t, e, i) {
  35693. if (i.stencilTest !== a.enums.STENCIL_INHERIT) return i.stencilTest !== e.stencilTest ? i.stencilTest === a.enums.STENCIL_DISABLE ? void t.disable(t.STENCIL_TEST) : (t.enable(t.STENCIL_TEST), void(i.stencilSep ? (t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMask(i.stencilWriteMaskFront), t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)))) : void(i.stencilTest !== a.enums.STENCIL_DISABLE && (e.stencilSep === i.stencilSep ? i.stencilSep ? (e.stencilFuncFront === i.stencilFuncFront && e.stencilRefFront === i.stencilRefFront && e.stencilMaskFront === i.stencilMaskFront || t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), e.stencilWriteMaskFront !== i.stencilWriteMaskFront && t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), e.stencilFailOpFront === i.stencilFailOpFront && e.stencilZFailOpFront === i.stencilZFailOpFront && e.stencilZPassOpFront === i.stencilZPassOpFront || t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), e.stencilFuncBack === i.stencilFuncBack && e.stencilRefBack === i.stencilRefBack && e.stencilMaskBack === i.stencilMaskBack || t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), e.stencilWriteMaskBack !== i.stencilWriteMaskBack && t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), e.stencilFailOpBack === i.stencilFailOpBack && e.stencilZFailOpBack === i.stencilZFailOpBack && e.stencilZPassOpBack === i.stencilZPassOpBack || t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (e.stencilFuncFront === i.stencilFuncFront && e.stencilRefFront === i.stencilRefFront && e.stencilMaskFront === i.stencilMaskFront || t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), e.stencilWriteMaskFront !== i.stencilWriteMaskFront && t.stencilMask(i.stencilWriteMaskFront), e.stencilFailOpFront === i.stencilFailOpFront && e.stencilZFailOpFront === i.stencilZFailOpFront && e.stencilZPassOpFront === i.stencilZPassOpFront || t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)) : i.stencilSep ? (t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), t.stencilMask(i.stencilWriteMaskFront), t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront))))
  35694. }
  35695. function y(t, e, i) {
  35696. e.cullMode !== i.cullMode && (i.cullMode !== a.enums.CULL_NONE ? (t.enable(t.CULL_FACE), t.cullFace(i.cullMode)) : t.disable(t.CULL_FACE))
  35697. }
  35698. function v(t, e, i, n) {
  35699. var r = !1;
  35700. if (-1 !== n.maxStream) {
  35701. if (i.maxStream !== n.maxStream) r = !0;
  35702. else if (i.program !== n.program) r = !0;
  35703. else
  35704. for (var s = 0; s < n.maxStream + 1; ++s)
  35705. if (i.vertexBuffers[s] !== n.vertexBuffers[s] || i.vertexBufferOffsets[s] !== n.vertexBufferOffsets[s]) {
  35706. r = !0;
  35707. break
  35708. } if (r) {
  35709. for (var o = 0; o < t._caps.maxVertexAttribs; ++o) t._newAttributes[o] = 0;
  35710. for (var a = 0; a < n.maxStream + 1; ++a) {
  35711. var l = n.vertexBuffers[a],
  35712. h = n.vertexBufferOffsets[a];
  35713. if (l && -1 !== l._glID) {
  35714. e.bindBuffer(e.ARRAY_BUFFER, l._glID);
  35715. for (var c = 0; c < n.program._attributes.length; ++c) {
  35716. var u = n.program._attributes[c],
  35717. _ = l._format.element(u.name);
  35718. _ ? (0 === t._enabledAttributes[u.location] && (e.enableVertexAttribArray(u.location), t._enabledAttributes[u.location] = 1), t._newAttributes[u.location] = 1, e.vertexAttribPointer(u.location, _.num, _.type, _.normalize, _.stride, _.offset + h * _.stride)) : console.warn("Can not find vertex attribute: " + u.name)
  35719. }
  35720. }
  35721. }
  35722. for (var f = 0; f < t._caps.maxVertexAttribs; ++f) t._enabledAttributes[f] !== t._newAttributes[f] && (e.disableVertexAttribArray(f), t._enabledAttributes[f] = 0)
  35723. }
  35724. }
  35725. }
  35726. function g(t, e, i) {
  35727. for (var n = 0; n < i.maxTextureSlot + 1; ++n)
  35728. if (e.textureUnits[n] !== i.textureUnits[n]) {
  35729. var r = i.textureUnits[n];
  35730. r && -1 !== r._glID && (t.activeTexture(t.TEXTURE0 + n), t.bindTexture(r._target, r._glID))
  35731. }
  35732. }
  35733. function x(t, e, i) {
  35734. var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
  35735. i instanceof l.default ? t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_2D, i._glID, 0) : i instanceof h.default ? t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_CUBE_MAP_POSITIVE_X + n, i._glID, 0) : t.framebufferRenderbuffer(t.FRAMEBUFFER, e, t.RENDERBUFFER, i._glID)
  35736. }
  35737. var b = (function() {
  35738. function t(e, i) {
  35739. u(this, t);
  35740. var n = void 0;
  35741. void 0 === (i = i || {}).alpha && (i.alpha = !1), void 0 === i.stencil && (i.stencil = !0), void 0 === i.depth && (i.depth = !0), void 0 === i.antialias && (i.antialias = !1), void 0 === i.preserveDrawingBuffer && (i.preserveDrawingBuffer = !1);
  35742. try {
  35743. n = e.getContext("webgl", i) || e.getContext("experimental-webgl", i) || e.getContext("webkit-3d", i) || e.getContext("moz-webgl", i)
  35744. } catch (t) {
  35745. return void console.error(t)
  35746. }
  35747. n || console.error("This device does not support webgl"), this._gl = n, this._extensions = {}, this._caps = {}, this._stats = {
  35748. texture: 0,
  35749. vb: 0,
  35750. ib: 0,
  35751. drawcalls: 0
  35752. }, this._initExtensions(["EXT_texture_filter_anisotropic", "EXT_shader_texture_lod", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_vertex_array_object", "WEBGL_compressed_texture_atc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_depth_texture", "WEBGL_draw_buffers"]), this._initCaps(), this._initStates(), o.default.initDefault(this), this._current = new o.default(this), this._next = new o.default(this), this._uniforms = {}, this._vx = this._vy = this._vw = this._vh = 0, this._sx = this._sy = this._sw = this._sh = 0, this._framebuffer = null, this._enabledAttributes = new Array(this._caps.maxVertexAttribs), this._newAttributes = new Array(this._caps.maxVertexAttribs);
  35753. for (var r = 0; r < this._caps.maxVertexAttribs; ++r) this._enabledAttributes[r] = 0, this._newAttributes[r] = 0
  35754. }
  35755. return s(t, [{
  35756. key: "caps",
  35757. get: function() {
  35758. return this._caps
  35759. }
  35760. }]), t.prototype._initExtensions = function(t) {
  35761. for (var e = this._gl, i = 0; i < t.length; ++i)
  35762. for (var n = t[i], r = ["", "WEBKIT_", "MOZ_"], s = 0; s < r.length; s++) try {
  35763. var o = e.getExtension(r[s] + n);
  35764. if (o) {
  35765. this._extensions[n] = o;
  35766. break
  35767. }
  35768. } catch (t) {
  35769. console.error(t)
  35770. }
  35771. }, t.prototype._initCaps = function() {
  35772. var t = this._gl,
  35773. e = this.ext("WEBGL_draw_buffers");
  35774. this._caps.maxVertexStreams = 4, this._caps.maxVertexTextures = t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS), this._caps.maxFragUniforms = t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS), this._caps.maxTextureUnits = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS), this._caps.maxVertexAttribs = t.getParameter(t.MAX_VERTEX_ATTRIBS), this._caps.maxTextureSize = t.getParameter(t.MAX_TEXTURE_SIZE), this._caps.maxDrawBuffers = e ? t.getParameter(e.MAX_DRAW_BUFFERS_WEBGL) : 1, this._caps.maxColorAttachments = e ? t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL) : 1
  35775. }, t.prototype._initStates = function() {
  35776. var t = this._gl;
  35777. t.disable(t.BLEND), t.blendFunc(t.ONE, t.ZERO), t.blendEquation(t.FUNC_ADD), t.blendColor(1, 1, 1, 1), t.colorMask(!0, !0, !0, !0), t.enable(t.CULL_FACE), t.cullFace(t.BACK), t.disable(t.DEPTH_TEST), t.depthFunc(t.LESS), t.depthMask(!1), t.disable(t.POLYGON_OFFSET_FILL), t.depthRange(0, 1), t.disable(t.STENCIL_TEST), t.stencilFunc(t.ALWAYS, 0, 255), t.stencilMask(255), t.stencilOp(t.KEEP, t.KEEP, t.KEEP), t.clearDepth(1), t.clearColor(0, 0, 0, 0), t.clearStencil(0), t.disable(t.SCISSOR_TEST)
  35778. }, t.prototype._restoreTexture = function(t) {
  35779. var e = this._gl,
  35780. i = this._current.textureUnits[t];
  35781. i && -1 !== i._glID ? e.bindTexture(i._target, i._glID) : e.bindTexture(e.TEXTURE_2D, null)
  35782. }, t.prototype._restoreIndexBuffer = function() {
  35783. var t = this._gl,
  35784. e = this._current.indexBuffer;
  35785. e && -1 !== e._glID ? t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e._glID) : t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null)
  35786. }, t.prototype.ext = function(t) {
  35787. return this._extensions[t]
  35788. }, t.prototype.allowFloatTexture = function() {
  35789. return null != this.ext("OES_texture_float")
  35790. }, t.prototype.setFrameBuffer = function(t) {
  35791. if (this._framebuffer !== t) {
  35792. this._framebuffer = t;
  35793. var e = this._gl;
  35794. if (null !== t) {
  35795. e.bindFramebuffer(e.FRAMEBUFFER, t._glID);
  35796. for (var i = t._colors.length, n = 0; n < i; ++n) {
  35797. var r = t._colors[n];
  35798. x(e, e.COLOR_ATTACHMENT0 + n, r)
  35799. }
  35800. for (var s = i; s < this._caps.maxColorAttachments; ++s) e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + s, e.TEXTURE_2D, null, 0);
  35801. t._depth && x(e, e.DEPTH_ATTACHMENT, t._depth), t._stencil && x(e, e.STENCIL_ATTACHMENT, t._stencil), t._depthStencil && x(e, e.DEPTH_STENCIL_ATTACHMENT, t._depthStencil)
  35802. } else e.bindFramebuffer(e.FRAMEBUFFER, null)
  35803. }
  35804. }, t.prototype.setViewport = function(t, e, i, n) {
  35805. this._vx === t && this._vy === e && this._vw === i && this._vh === n || (this._gl.viewport(t, e, i, n), this._vx = t, this._vy = e, this._vw = i, this._vh = n)
  35806. }, t.prototype.setScissor = function(t, e, i, n) {
  35807. this._sx === t && this._sy === e && this._sw === i && this._sh === n || (this._gl.scissor(t, e, i, n), this._sx = t, this._sy = e, this._sw = i, this._sh = n)
  35808. }, t.prototype.clear = function(t) {
  35809. if (void 0 !== t.color || void 0 !== t.depth || void 0 !== t.stencil) {
  35810. var e = this._gl,
  35811. i = 0;
  35812. void 0 !== t.color && (i |= e.COLOR_BUFFER_BIT, e.clearColor(t.color[0], t.color[1], t.color[2], t.color[3])), void 0 !== t.depth && (i |= e.DEPTH_BUFFER_BIT, e.clearDepth(t.depth), e.enable(e.DEPTH_TEST), e.depthMask(!0), e.depthFunc(e.ALWAYS)), void 0 !== t.stencil && (i |= e.STENCIL_BUFFER_BIT, e.clearStencil(t.stencil)), e.clear(i), void 0 !== t.depth && (!1 === this._current.depthTest ? e.disable(e.DEPTH_TEST) : (!1 === this._current.depthWrite && e.depthMask(!1), this._current.depthFunc !== a.enums.DS_FUNC_ALWAYS && e.depthFunc(this._current.depthFunc)))
  35813. }
  35814. }, t.prototype.enableBlend = function() {
  35815. this._next.blend = !0
  35816. }, t.prototype.enableDepthTest = function() {
  35817. this._next.depthTest = !0
  35818. }, t.prototype.enableDepthWrite = function() {
  35819. this._next.depthWrite = !0
  35820. }, t.prototype.setStencilTest = function(t) {
  35821. this._next.stencilTest = t
  35822. }, t.prototype.setStencilFunc = function(t, e, i) {
  35823. this._next.stencilSep = !1, this._next.stencilFuncFront = this._next.stencilFuncBack = t, this._next.stencilRefFront = this._next.stencilRefBack = e, this._next.stencilMaskFront = this._next.stencilMaskBack = i
  35824. }, t.prototype.setStencilFuncFront = function(t, e, i) {
  35825. this._next.stencilSep = !0, this._next.stencilFuncFront = t, this._next.stencilRefFront = e, this._next.stencilMaskFront = i
  35826. }, t.prototype.setStencilFuncBack = function(t, e, i) {
  35827. this._next.stencilSep = !0, this._next.stencilFuncBack = t, this._next.stencilRefBack = e, this._next.stencilMaskBack = i
  35828. }, t.prototype.setStencilOp = function(t, e, i, n) {
  35829. this._next.stencilFailOpFront = this._next.stencilFailOpBack = t, this._next.stencilZFailOpFront = this._next.stencilZFailOpBack = e, this._next.stencilZPassOpFront = this._next.stencilZPassOpBack = i, this._next.stencilWriteMaskFront = this._next.stencilWriteMaskBack = n
  35830. }, t.prototype.setStencilOpFront = function(t, e, i, n) {
  35831. this._next.stencilSep = !0, this._next.stencilFailOpFront = t, this._next.stencilZFailOpFront = e, this._next.stencilZPassOpFront = i, this._next.stencilWriteMaskFront = n
  35832. }, t.prototype.setStencilOpBack = function(t, e, i, n) {
  35833. this._next.stencilSep = !0, this._next.stencilFailOpBack = t, this._next.stencilZFailOpBack = e, this._next.stencilZPassOpBack = i, this._next.stencilWriteMaskBack = n
  35834. }, t.prototype.setDepthFunc = function(t) {
  35835. this._next.depthFunc = t
  35836. }, t.prototype.setBlendColor32 = function(t) {
  35837. this._next.blendColor = t
  35838. }, t.prototype.setBlendColor = function(t, e, i, n) {
  35839. this._next.blendColor = (255 * t << 24 | 255 * e << 16 | 255 * i << 8 | 255 * n) >>> 0
  35840. }, t.prototype.setBlendFunc = function(t, e) {
  35841. this._next.blendSep = !1, this._next.blendSrc = t, this._next.blendDst = e
  35842. }, t.prototype.setBlendFuncSep = function(t, e, i, n) {
  35843. this._next.blendSep = !0, this._next.blendSrc = t, this._next.blendDst = e, this._next.blendSrcAlpha = i, this._next.blendDstAlpha = n
  35844. }, t.prototype.setBlendEq = function(t) {
  35845. this._next.blendSep = !1, this._next.blendEq = t
  35846. }, t.prototype.setBlendEqSep = function(t, e) {
  35847. this._next.blendSep = !0, this._next.blendEq = t, this._next.blendAlphaEq = e
  35848. }, t.prototype.setCullMode = function(t) {
  35849. this._next.cullMode = t
  35850. }, t.prototype.setVertexBuffer = function(t, e) {
  35851. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
  35852. this._next.vertexBuffers[t] = e, this._next.vertexBufferOffsets[t] = i, this._next.maxStream < t && (this._next.maxStream = t)
  35853. }, t.prototype.setIndexBuffer = function(t) {
  35854. this._next.indexBuffer = t
  35855. }, t.prototype.setProgram = function(t) {
  35856. this._next.program = t
  35857. }, t.prototype.setTexture = function(t, e, i) {
  35858. i >= this._caps.maxTextureUnits ? console.warn("Can not set texture " + t + " at stage " + i + ", max texture exceed: " + this._caps.maxTextureUnits) : (this._next.textureUnits[i] = e, this.setUniform(t, i), this._next.maxTextureSlot < i && (this._next.maxTextureSlot = i))
  35859. }, t.prototype.setTextureArray = function(t, e, i) {
  35860. var n = e.length;
  35861. if (n >= this._caps.maxTextureUnits) console.warn("Can not set " + n + " textures for " + t + ", max texture exceed: " + this._caps.maxTextureUnits);
  35862. else {
  35863. for (var r = 0; r < n; ++r) {
  35864. var s = i[r];
  35865. this._next.textureUnits[s] = e[r]
  35866. }
  35867. this.setUniform(t, i)
  35868. }
  35869. }, t.prototype.setUniform = function(t, e) {
  35870. var i = this._uniforms[t],
  35871. n = !1,
  35872. r = !1,
  35873. s = !1,
  35874. o = !1;
  35875. do {
  35876. if (!i) break;
  35877. if (s = Array.isArray(e) || e instanceof Float32Array, o = e instanceof Int32Array, r = s || o, i.isArray !== r) break;
  35878. if (i.isArray && i.value.length !== e.length) break;
  35879. n = !0
  35880. } while (0);
  35881. if (n) {
  35882. var a = i.value,
  35883. l = !1;
  35884. if (i.isArray)
  35885. for (var h = 0, c = a.length; h < c; h++) a[h] !== e[h] && (l = !0, a[h] = e[h]);
  35886. else a !== e && (l = !0, i.value = e);
  35887. l && (i.dirty = !0)
  35888. } else {
  35889. var u = e;
  35890. s ? u = new Float32Array(e) : o && (u = new Int32Array(e)), i = {
  35891. dirty: !0,
  35892. value: u,
  35893. isArray: r
  35894. }
  35895. }
  35896. this._uniforms[t] = i
  35897. }, t.prototype.setUniformDirectly = function(t, e) {
  35898. var i = this._uniforms[t];
  35899. i || (this._uniforms[t] = i = {}), i.dirty = !0, i.value = e
  35900. }, t.prototype.setPrimitiveType = function(t) {
  35901. this._next.primitiveType = t
  35902. }, t.prototype.resetDrawCalls = function() {
  35903. this._stats.drawcalls = 0
  35904. }, t.prototype.getDrawCalls = function() {
  35905. return this._stats.drawcalls
  35906. }, t.prototype.draw = function(t, e) {
  35907. var i = this._gl,
  35908. n = this._current,
  35909. r = this._next;
  35910. d(i, n, r), p(i, n, r), m(i, n, r), y(i, n, r), v(this, i, n, r), n.indexBuffer !== r.indexBuffer && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, r.indexBuffer && -1 !== r.indexBuffer._glID ? r.indexBuffer._glID : null);
  35911. var s = !1;
  35912. n.program !== r.program && (r.program._linked ? i.useProgram(r.program._glID) : console.warn("Failed to use program: has not linked yet."), s = !0), g(i, n, r);
  35913. for (var o = 0; o < r.program._uniforms.length; ++o) {
  35914. var a = r.program._uniforms[o],
  35915. l = this._uniforms[a.name];
  35916. if (l && (s || l.dirty)) {
  35917. l.dirty = !1;
  35918. var h = void 0 === a.size ? _[a.type] : f[a.type];
  35919. h ? h(i, a.location, l.value) : console.warn("Can not find commit function for uniform " + a.name)
  35920. }
  35921. }
  35922. e && (r.indexBuffer ? i.drawElements(this._next.primitiveType, e, r.indexBuffer._format, t * r.indexBuffer._bytesPerIndex) : i.drawArrays(this._next.primitiveType, t, e)), this._stats.drawcalls++, n.set(r), r.reset()
  35923. }, t
  35924. })();
  35925. i.default = b, e.exports = i.default
  35926. }), {
  35927. "./enums": 357,
  35928. "./state": 364,
  35929. "./texture-2d": 365,
  35930. "./texture-cube": 366
  35931. }],
  35932. 357: [(function(t, e, i) {
  35933. "use strict";
  35934. i.__esModule = !0, i.attrTypeBytes = function(t) {
  35935. if (t === s.ATTR_TYPE_INT8) return 1;
  35936. if (t === s.ATTR_TYPE_UINT8) return 1;
  35937. if (t === s.ATTR_TYPE_INT16) return 2;
  35938. if (t === s.ATTR_TYPE_UINT16) return 2;
  35939. if (t === s.ATTR_TYPE_INT32) return 4;
  35940. if (t === s.ATTR_TYPE_UINT32) return 4;
  35941. if (t === s.ATTR_TYPE_FLOAT32) return 4;
  35942. return console.warn("Unknown ATTR_TYPE: " + t), 0
  35943. }, i.glFilter = function(t, e) {
  35944. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1,
  35945. r = n[e][i + 1];
  35946. if (void 0 === r) return console.warn("Unknown FILTER: " + e), -1 === i ? t.LINEAR : t.LINEAR_MIPMAP_LINEAR;
  35947. return r
  35948. }, i.glTextureFmt = function(t) {
  35949. var e = r[t];
  35950. if (void 0 === e) return console.warn("Unknown TEXTURE_FMT: " + t), r[s.TEXTURE_FMT_RGBA8];
  35951. return e
  35952. };
  35953. var n = [
  35954. [9728, 9984, 9986],
  35955. [9729, 9985, 9987]
  35956. ],
  35957. r = [{
  35958. format: 6407,
  35959. internalFormat: 33776,
  35960. pixelType: null
  35961. }, {
  35962. format: 6408,
  35963. internalFormat: 33777,
  35964. pixelType: null
  35965. }, {
  35966. format: 6408,
  35967. internalFormat: 33778,
  35968. pixelType: null
  35969. }, {
  35970. format: 6408,
  35971. internalFormat: 33779,
  35972. pixelType: null
  35973. }, {
  35974. format: 6407,
  35975. internalFormat: 36196,
  35976. pixelType: null
  35977. }, {
  35978. format: 6407,
  35979. internalFormat: 35841,
  35980. pixelType: null
  35981. }, {
  35982. format: 6408,
  35983. internalFormat: 35843,
  35984. pixelType: null
  35985. }, {
  35986. format: 6407,
  35987. internalFormat: 35840,
  35988. pixelType: null
  35989. }, {
  35990. format: 6408,
  35991. internalFormat: 35842,
  35992. pixelType: null
  35993. }, {
  35994. format: 6406,
  35995. internalFormat: 6406,
  35996. pixelType: 5121
  35997. }, {
  35998. format: 6409,
  35999. internalFormat: 6409,
  36000. pixelType: 5121
  36001. }, {
  36002. format: 6410,
  36003. internalFormat: 6410,
  36004. pixelType: 5121
  36005. }, {
  36006. format: 6407,
  36007. internalFormat: 6407,
  36008. pixelType: 33635
  36009. }, {
  36010. format: 6408,
  36011. internalFormat: 6408,
  36012. pixelType: 32820
  36013. }, {
  36014. format: 6408,
  36015. internalFormat: 6408,
  36016. pixelType: 32819
  36017. }, {
  36018. format: 6407,
  36019. internalFormat: 6407,
  36020. pixelType: 5121
  36021. }, {
  36022. format: 6408,
  36023. internalFormat: 6408,
  36024. pixelType: 5121
  36025. }, {
  36026. format: 6407,
  36027. internalFormat: 6407,
  36028. pixelType: 36193
  36029. }, {
  36030. format: 6408,
  36031. internalFormat: 6408,
  36032. pixelType: 36193
  36033. }, {
  36034. format: 6407,
  36035. internalFormat: 6407,
  36036. pixelType: 5126
  36037. }, {
  36038. format: 6408,
  36039. internalFormat: 6408,
  36040. pixelType: 5126
  36041. }, {
  36042. format: null,
  36043. internalFormat: null,
  36044. pixelType: null
  36045. }, {
  36046. format: null,
  36047. internalFormat: null,
  36048. pixelType: null
  36049. }, {
  36050. format: null,
  36051. internalFormat: null,
  36052. pixelType: null
  36053. }, {
  36054. format: null,
  36055. internalFormat: null,
  36056. pixelType: null
  36057. }, {
  36058. format: 6402,
  36059. internalFormat: 6402,
  36060. pixelType: 5123
  36061. }, {
  36062. format: 6402,
  36063. internalFormat: 6402,
  36064. pixelType: 5125
  36065. }, {
  36066. format: 6402,
  36067. internalFormat: 6402,
  36068. pixelType: 5125
  36069. }, {
  36070. format: 6407,
  36071. internalFormat: 37492,
  36072. pixelType: null
  36073. }, {
  36074. format: 6408,
  36075. internalFormat: 37496,
  36076. pixelType: null
  36077. }],
  36078. s = i.enums = {
  36079. USAGE_STATIC: 35044,
  36080. USAGE_DYNAMIC: 35048,
  36081. USAGE_STREAM: 35040,
  36082. INDEX_FMT_UINT8: 5121,
  36083. INDEX_FMT_UINT16: 5123,
  36084. INDEX_FMT_UINT32: 5125,
  36085. ATTR_POSITION: "a_position",
  36086. ATTR_NORMAL: "a_normal",
  36087. ATTR_TANGENT: "a_tangent",
  36088. ATTR_BITANGENT: "a_bitangent",
  36089. ATTR_WEIGHTS: "a_weights",
  36090. ATTR_JOINTS: "a_joints",
  36091. ATTR_COLOR: "a_color",
  36092. ATTR_COLOR0: "a_color0",
  36093. ATTR_COLOR1: "a_color1",
  36094. ATTR_UV: "a_uv",
  36095. ATTR_UV0: "a_uv0",
  36096. ATTR_UV1: "a_uv1",
  36097. ATTR_UV2: "a_uv2",
  36098. ATTR_UV3: "a_uv3",
  36099. ATTR_UV4: "a_uv4",
  36100. ATTR_UV5: "a_uv5",
  36101. ATTR_UV6: "a_uv6",
  36102. ATTR_UV7: "a_uv7",
  36103. ATTR_TYPE_INT8: 5120,
  36104. ATTR_TYPE_UINT8: 5121,
  36105. ATTR_TYPE_INT16: 5122,
  36106. ATTR_TYPE_UINT16: 5123,
  36107. ATTR_TYPE_INT32: 5124,
  36108. ATTR_TYPE_UINT32: 5125,
  36109. ATTR_TYPE_FLOAT32: 5126,
  36110. FILTER_NEAREST: 0,
  36111. FILTER_LINEAR: 1,
  36112. WRAP_REPEAT: 10497,
  36113. WRAP_CLAMP: 33071,
  36114. WRAP_MIRROR: 33648,
  36115. TEXTURE_FMT_RGB_DXT1: 0,
  36116. TEXTURE_FMT_RGBA_DXT1: 1,
  36117. TEXTURE_FMT_RGBA_DXT3: 2,
  36118. TEXTURE_FMT_RGBA_DXT5: 3,
  36119. TEXTURE_FMT_RGB_ETC1: 4,
  36120. TEXTURE_FMT_RGB_PVRTC_2BPPV1: 5,
  36121. TEXTURE_FMT_RGBA_PVRTC_2BPPV1: 6,
  36122. TEXTURE_FMT_RGB_PVRTC_4BPPV1: 7,
  36123. TEXTURE_FMT_RGBA_PVRTC_4BPPV1: 8,
  36124. TEXTURE_FMT_A8: 9,
  36125. TEXTURE_FMT_L8: 10,
  36126. TEXTURE_FMT_L8_A8: 11,
  36127. TEXTURE_FMT_R5_G6_B5: 12,
  36128. TEXTURE_FMT_R5_G5_B5_A1: 13,
  36129. TEXTURE_FMT_R4_G4_B4_A4: 14,
  36130. TEXTURE_FMT_RGB8: 15,
  36131. TEXTURE_FMT_RGBA8: 16,
  36132. TEXTURE_FMT_RGB16F: 17,
  36133. TEXTURE_FMT_RGBA16F: 18,
  36134. TEXTURE_FMT_RGB32F: 19,
  36135. TEXTURE_FMT_RGBA32F: 20,
  36136. TEXTURE_FMT_R32F: 21,
  36137. TEXTURE_FMT_111110F: 22,
  36138. TEXTURE_FMT_SRGB: 23,
  36139. TEXTURE_FMT_SRGBA: 24,
  36140. TEXTURE_FMT_D16: 25,
  36141. TEXTURE_FMT_D32: 26,
  36142. TEXTURE_FMT_D24S8: 27,
  36143. TEXTURE_FMT_RGB_ETC2: 28,
  36144. TEXTURE_FMT_RGBA_ETC2: 29,
  36145. DS_FUNC_NEVER: 512,
  36146. DS_FUNC_LESS: 513,
  36147. DS_FUNC_EQUAL: 514,
  36148. DS_FUNC_LEQUAL: 515,
  36149. DS_FUNC_GREATER: 516,
  36150. DS_FUNC_NOTEQUAL: 517,
  36151. DS_FUNC_GEQUAL: 518,
  36152. DS_FUNC_ALWAYS: 519,
  36153. RB_FMT_RGBA4: 32854,
  36154. RB_FMT_RGB5_A1: 32855,
  36155. RB_FMT_RGB565: 36194,
  36156. RB_FMT_D16: 33189,
  36157. RB_FMT_S8: 36168,
  36158. RB_FMT_D24S8: 34041,
  36159. BLEND_FUNC_ADD: 32774,
  36160. BLEND_FUNC_SUBTRACT: 32778,
  36161. BLEND_FUNC_REVERSE_SUBTRACT: 32779,
  36162. BLEND_ZERO: 0,
  36163. BLEND_ONE: 1,
  36164. BLEND_SRC_COLOR: 768,
  36165. BLEND_ONE_MINUS_SRC_COLOR: 769,
  36166. BLEND_DST_COLOR: 774,
  36167. BLEND_ONE_MINUS_DST_COLOR: 775,
  36168. BLEND_SRC_ALPHA: 770,
  36169. BLEND_ONE_MINUS_SRC_ALPHA: 771,
  36170. BLEND_DST_ALPHA: 772,
  36171. BLEND_ONE_MINUS_DST_ALPHA: 773,
  36172. BLEND_CONSTANT_COLOR: 32769,
  36173. BLEND_ONE_MINUS_CONSTANT_COLOR: 32770,
  36174. BLEND_CONSTANT_ALPHA: 32771,
  36175. BLEND_ONE_MINUS_CONSTANT_ALPHA: 32772,
  36176. BLEND_SRC_ALPHA_SATURATE: 776,
  36177. STENCIL_DISABLE: 0,
  36178. STENCIL_ENABLE: 1,
  36179. STENCIL_INHERIT: 2,
  36180. STENCIL_OP_KEEP: 7680,
  36181. STENCIL_OP_ZERO: 0,
  36182. STENCIL_OP_REPLACE: 7681,
  36183. STENCIL_OP_INCR: 7682,
  36184. STENCIL_OP_INCR_WRAP: 34055,
  36185. STENCIL_OP_DECR: 7683,
  36186. STENCIL_OP_DECR_WRAP: 34056,
  36187. STENCIL_OP_INVERT: 5386,
  36188. CULL_NONE: 0,
  36189. CULL_FRONT: 1028,
  36190. CULL_BACK: 1029,
  36191. CULL_FRONT_AND_BACK: 1032,
  36192. PT_POINTS: 0,
  36193. PT_LINES: 1,
  36194. PT_LINE_LOOP: 2,
  36195. PT_LINE_STRIP: 3,
  36196. PT_TRIANGLES: 4,
  36197. PT_TRIANGLE_STRIP: 5,
  36198. PT_TRIANGLE_FAN: 6
  36199. }
  36200. }), {}],
  36201. 358: [(function(t, e, i) {
  36202. "use strict";
  36203. function n(t, e) {
  36204. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36205. }
  36206. i.__esModule = !0;
  36207. var r = (function() {
  36208. function t(e, i, r, s) {
  36209. n(this, t), this._device = e, this._width = i, this._height = r, this._colors = s.colors || [], this._depth = s.depth || null, this._stencil = s.stencil || null, this._depthStencil = s.depthStencil || null, this._glID = e._gl.createFramebuffer()
  36210. }
  36211. return t.prototype.destroy = function() {
  36212. null !== this._glID ? (this._device._gl.deleteFramebuffer(this._glID), this._glID = null) : console.error("The frame-buffer already destroyed")
  36213. }, t.prototype.getHandle = function() {
  36214. return this._glID
  36215. }, t
  36216. })();
  36217. i.default = r, e.exports = i.default
  36218. }), {}],
  36219. 359: [(function(t, e, i) {
  36220. "use strict";
  36221. i.__esModule = !0;
  36222. var n, r = (function() {
  36223. function t(t, e) {
  36224. for (var i = 0; i < e.length; i++) {
  36225. var n = e[i];
  36226. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  36227. }
  36228. }
  36229. return function(e, i, n) {
  36230. return i && t(e.prototype, i), n && t(e, n), e
  36231. }
  36232. })(),
  36233. s = t("./enums");
  36234. function o(t, e) {
  36235. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36236. }
  36237. var a = ((n = {})[s.enums.INDEX_FMT_UINT8] = 1, n[s.enums.INDEX_FMT_UINT16] = 2, n[s.enums.INDEX_FMT_UINT32] = 4, n),
  36238. l = (function() {
  36239. function t(e, i, n, r) {
  36240. o(this, t), this._device = e, this._format = i, this._usage = n, this._bytesPerIndex = a[i], this._bytes = r.byteLength, this._numIndices = this._bytes / this._bytesPerIndex, this._needExpandDataStore = !0, this._glID = e._gl.createBuffer(), this.update(0, r), e._stats.ib += this._bytes
  36241. }
  36242. return t.prototype.destroy = function() {
  36243. -1 !== this._glID ? (this._device._gl.deleteBuffer(this._glID), this._device._stats.ib -= this.bytes, this._glID = -1) : console.error("The buffer already destroyed")
  36244. }, t.prototype.update = function(t, e) {
  36245. if (-1 !== this._glID) {
  36246. if (0 !== e.byteLength) {
  36247. if (t + e.byteLength > this._bytes) {
  36248. if (t) return void console.error("Failed to update data, bytes exceed.");
  36249. this._needExpandDataStore = !0, this._bytes = t + e.byteLength, this._numIndices = this._bytes / this._bytesPerIndex
  36250. }
  36251. var i = this._device._gl,
  36252. n = this._usage;
  36253. i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this._glID), this._needExpandDataStore ? (i.bufferData(i.ELEMENT_ARRAY_BUFFER, e, n), this._needExpandDataStore = !1) : i.bufferSubData(i.ELEMENT_ARRAY_BUFFER, t, e), this._device._restoreIndexBuffer()
  36254. }
  36255. } else console.error("The buffer is destroyed")
  36256. }, t.prototype.setUsage = function(t) {
  36257. this._usage = t
  36258. }, r(t, [{
  36259. key: "count",
  36260. get: function() {
  36261. return this._numIndices
  36262. }
  36263. }]), t
  36264. })();
  36265. l.BYTES_PER_INDEX = a, i.default = l, e.exports = i.default
  36266. }), {
  36267. "./enums": 357
  36268. }],
  36269. 360: [(function(t, e, i) {
  36270. "use strict";
  36271. i.__esModule = !0;
  36272. var n = t("./enums"),
  36273. r = null;
  36274. r = {
  36275. VertexFormat: t("./vertex-format"),
  36276. IndexBuffer: t("./index-buffer"),
  36277. VertexBuffer: t("./vertex-buffer"),
  36278. Program: t("./program"),
  36279. Texture: t("./texture"),
  36280. Texture2D: t("./texture-2d"),
  36281. TextureCube: t("./texture-cube"),
  36282. RenderBuffer: t("./render-buffer"),
  36283. FrameBuffer: t("./frame-buffer"),
  36284. Device: t("./device"),
  36285. attrTypeBytes: n.attrTypeBytes,
  36286. glFilter: n.glFilter,
  36287. glTextureFmt: n.glTextureFmt
  36288. }, Object.assign(r, n.enums), i.default = r, cc.gfx = r, e.exports = i.default
  36289. }), {
  36290. "./device": 356,
  36291. "./enums": 357,
  36292. "./frame-buffer": 358,
  36293. "./index-buffer": 359,
  36294. "./program": 362,
  36295. "./render-buffer": 363,
  36296. "./texture": 367,
  36297. "./texture-2d": 365,
  36298. "./texture-cube": 366,
  36299. "./vertex-buffer": 368,
  36300. "./vertex-format": 369
  36301. }],
  36302. 361: [(function(t, e, i) {
  36303. "use strict";
  36304. i.__esModule = !0, i.isPow2 = function(t) {
  36305. return !(t & t - 1 || !t)
  36306. }
  36307. }), {}],
  36308. 362: [(function(t, e, i) {
  36309. "use strict";
  36310. i.__esModule = !0;
  36311. var n = (function() {
  36312. function t(t, e) {
  36313. for (var i = 0; i < e.length; i++) {
  36314. var n = e[i];
  36315. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  36316. }
  36317. }
  36318. return function(e, i, n) {
  36319. return i && t(e.prototype, i), n && t(e, n), e
  36320. }
  36321. })();
  36322. function r(t, e) {
  36323. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36324. }
  36325. var s = 0;
  36326. function o(t, e, i) {
  36327. i.split("\n").forEach((function(i) {
  36328. if (!(i.length < 5)) {
  36329. var n = /^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(i);
  36330. n ? t.push({
  36331. type: e,
  36332. fileID: 0 | n[1],
  36333. line: 0 | n[2],
  36334. message: n[3].trim()
  36335. }) : i.length > 0 && t.push({
  36336. type: e,
  36337. fileID: -1,
  36338. line: 0,
  36339. message: i
  36340. })
  36341. }
  36342. }))
  36343. }
  36344. var a = (function() {
  36345. function t(e, i) {
  36346. r(this, t), this._device = e, this._attributes = [], this._uniforms = [], this._samplers = [], this._errors = [], this._linked = !1, this._vertSource = i.vert, this._fragSource = i.frag, this._glID = null, this._id = s++
  36347. }
  36348. return t.prototype.link = function() {
  36349. if (!this._linked) {
  36350. var t = this._device._gl,
  36351. e = l(t, t.VERTEX_SHADER, this._vertSource),
  36352. i = l(t, t.FRAGMENT_SHADER, this._fragSource),
  36353. n = t.createProgram();
  36354. t.attachShader(n, e), t.attachShader(n, i), t.linkProgram(n);
  36355. var r = !1,
  36356. s = this._errors;
  36357. if (t.getShaderParameter(e, t.COMPILE_STATUS) || (o(s, "vs", t.getShaderInfoLog(e)), r = !0), t.getShaderParameter(i, t.COMPILE_STATUS) || (o(s, "fs", t.getShaderInfoLog(i)), r = !0), t.deleteShader(e), t.deleteShader(i), r) return s;
  36358. if (!t.getProgramParameter(n, t.LINK_STATUS)) return s.push({
  36359. info: "Failed to link shader program: " + t.getProgramInfoLog(n)
  36360. }), s;
  36361. this._glID = n;
  36362. for (var a = t.getProgramParameter(n, t.ACTIVE_ATTRIBUTES), h = 0; h < a; ++h) {
  36363. var c = t.getActiveAttrib(n, h),
  36364. u = t.getAttribLocation(n, c.name);
  36365. this._attributes.push({
  36366. name: c.name,
  36367. location: u,
  36368. type: c.type
  36369. })
  36370. }
  36371. for (var _ = t.getProgramParameter(n, t.ACTIVE_UNIFORMS), f = 0; f < _; ++f) {
  36372. var d = t.getActiveUniform(n, f),
  36373. p = d.name,
  36374. m = t.getUniformLocation(n, p),
  36375. y = "[0]" === p.substr(p.length - 3);
  36376. y && (p = p.substr(0, p.length - 3));
  36377. var v = {
  36378. name: p,
  36379. location: m,
  36380. type: d.type,
  36381. size: y ? d.size : void 0
  36382. };
  36383. this._uniforms.push(v)
  36384. }
  36385. this._linked = !0
  36386. }
  36387. }, t.prototype.destroy = function() {
  36388. this._device._gl.deleteProgram(this._glID), this._linked = !1, this._glID = null, this._attributes = [], this._uniforms = [], this._samplers = []
  36389. }, n(t, [{
  36390. key: "id",
  36391. get: function() {
  36392. return this._id
  36393. }
  36394. }]), t
  36395. })();
  36396. function l(t, e, i) {
  36397. var n = t.createShader(e);
  36398. return t.shaderSource(n, i), t.compileShader(n), n
  36399. }
  36400. i.default = a, e.exports = i.default
  36401. }), {}],
  36402. 363: [(function(t, e, i) {
  36403. "use strict";
  36404. function n(t, e) {
  36405. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36406. }
  36407. i.__esModule = !0;
  36408. var r = (function() {
  36409. function t(e, i, r, s) {
  36410. n(this, t), this._device = e, this._format = i, this._glID = e._gl.createRenderbuffer(), this.update(r, s)
  36411. }
  36412. return t.prototype.update = function(t, e) {
  36413. this._width = t, this._height = e;
  36414. var i = this._device._gl;
  36415. i.bindRenderbuffer(i.RENDERBUFFER, this._glID), i.renderbufferStorage(i.RENDERBUFFER, this._format, t, e), i.bindRenderbuffer(i.RENDERBUFFER, null)
  36416. }, t.prototype.destroy = function() {
  36417. if (null !== this._glID) {
  36418. var t = this._device._gl;
  36419. t.bindRenderbuffer(t.RENDERBUFFER, null), t.deleteRenderbuffer(this._glID), this._glID = null
  36420. } else console.error("The render-buffer already destroyed")
  36421. }, t
  36422. })();
  36423. i.default = r, e.exports = i.default
  36424. }), {}],
  36425. 364: [(function(t, e, i) {
  36426. "use strict";
  36427. i.__esModule = !0, i.default = void 0;
  36428. var n = t("./enums");
  36429. function r(t, e) {
  36430. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36431. }
  36432. var s = {
  36433. blend: !1,
  36434. blendSep: !1,
  36435. blendColor: 4294967295,
  36436. blendEq: n.enums.BLEND_FUNC_ADD,
  36437. blendAlphaEq: n.enums.BLEND_FUNC_ADD,
  36438. blendSrc: n.enums.BLEND_ONE,
  36439. blendDst: n.enums.BLEND_ZERO,
  36440. blendSrcAlpha: n.enums.BLEND_ONE,
  36441. blendDstAlpha: n.enums.BLEND_ZERO,
  36442. depthTest: !1,
  36443. depthWrite: !1,
  36444. depthFunc: n.enums.DS_FUNC_LESS,
  36445. stencilTest: !1,
  36446. stencilSep: !1,
  36447. stencilFuncFront: n.enums.DS_FUNC_ALWAYS,
  36448. stencilRefFront: 0,
  36449. stencilMaskFront: 255,
  36450. stencilFailOpFront: n.enums.STENCIL_OP_KEEP,
  36451. stencilZFailOpFront: n.enums.STENCIL_OP_KEEP,
  36452. stencilZPassOpFront: n.enums.STENCIL_OP_KEEP,
  36453. stencilWriteMaskFront: 255,
  36454. stencilFuncBack: n.enums.DS_FUNC_ALWAYS,
  36455. stencilRefBack: 0,
  36456. stencilMaskBack: 255,
  36457. stencilFailOpBack: n.enums.STENCIL_OP_KEEP,
  36458. stencilZFailOpBack: n.enums.STENCIL_OP_KEEP,
  36459. stencilZPassOpBack: n.enums.STENCIL_OP_KEEP,
  36460. stencilWriteMaskBack: 255,
  36461. cullMode: n.enums.CULL_BACK,
  36462. primitiveType: n.enums.PT_TRIANGLES,
  36463. maxStream: -1,
  36464. vertexBuffers: [],
  36465. vertexBufferOffsets: [],
  36466. indexBuffer: null,
  36467. maxTextureSlot: -1,
  36468. textureUnits: [],
  36469. program: null
  36470. },
  36471. o = (function() {
  36472. function t(e) {
  36473. r(this, t), this.vertexBuffers = new Array(e._caps.maxVertexStreams), this.vertexBufferOffsets = new Array(e._caps.maxVertexStreams), this.textureUnits = new Array(e._caps.maxTextureUnits), this.set(s)
  36474. }
  36475. return t.initDefault = function(t) {
  36476. s.vertexBuffers = new Array(t._caps.maxVertexStreams), s.vertexBufferOffsets = new Array(t._caps.maxVertexStreams), s.textureUnits = new Array(t._caps.maxTextureUnits)
  36477. }, t.prototype.reset = function() {
  36478. this.set(s)
  36479. }, t.prototype.set = function(t) {
  36480. this.blend = t.blend, this.blendSep = t.blendSep, this.blendColor = t.blendColor, this.blendEq = t.blendEq, this.blendAlphaEq = t.blendAlphaEq, this.blendSrc = t.blendSrc, this.blendDst = t.blendDst, this.blendSrcAlpha = t.blendSrcAlpha, this.blendDstAlpha = t.blendDstAlpha, this.depthTest = t.depthTest, this.depthWrite = t.depthWrite, this.depthFunc = t.depthFunc, this.stencilTest = t.stencilTest, this.stencilSep = t.stencilSep, this.stencilFuncFront = t.stencilFuncFront, this.stencilRefFront = t.stencilRefFront, this.stencilMaskFront = t.stencilMaskFront, this.stencilFailOpFront = t.stencilFailOpFront, this.stencilZFailOpFront = t.stencilZFailOpFront, this.stencilZPassOpFront = t.stencilZPassOpFront, this.stencilWriteMaskFront = t.stencilWriteMaskFront, this.stencilFuncBack = t.stencilFuncBack, this.stencilRefBack = t.stencilRefBack, this.stencilMaskBack = t.stencilMaskBack, this.stencilFailOpBack = t.stencilFailOpBack, this.stencilZFailOpBack = t.stencilZFailOpBack, this.stencilZPassOpBack = t.stencilZPassOpBack, this.stencilWriteMaskBack = t.stencilWriteMaskBack, this.cullMode = t.cullMode, this.primitiveType = t.primitiveType, this.maxStream = t.maxStream;
  36481. for (var e = 0; e < t.vertexBuffers.length; ++e) this.vertexBuffers[e] = t.vertexBuffers[e];
  36482. for (var i = 0; i < t.vertexBufferOffsets.length; ++i) this.vertexBufferOffsets[i] = t.vertexBufferOffsets[i];
  36483. this.indexBuffer = t.indexBuffer, this.maxTextureSlot = t.maxTextureSlot;
  36484. for (var n = 0; n < t.textureUnits.length; ++n) this.textureUnits[n] = t.textureUnits[n];
  36485. this.program = t.program
  36486. }, t
  36487. })();
  36488. i.default = o, e.exports = i.default
  36489. }), {
  36490. "./enums": 357
  36491. }],
  36492. 365: [(function(t, e, i) {
  36493. "use strict";
  36494. i.__esModule = !0, i.default = void 0;
  36495. var n = (function(t) {
  36496. return t && t.__esModule ? t : {
  36497. default: t
  36498. }
  36499. })(t("./texture")),
  36500. r = t("./enums"),
  36501. s = t("./misc");
  36502. function o(t, e) {
  36503. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36504. }
  36505. function a(t, e) {
  36506. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  36507. return !e || "object" != typeof e && "function" != typeof e ? t : e
  36508. }
  36509. function l(t, e) {
  36510. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  36511. t.prototype = Object.create(e && e.prototype, {
  36512. constructor: {
  36513. value: t,
  36514. enumerable: !1,
  36515. writable: !0,
  36516. configurable: !0
  36517. }
  36518. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  36519. }
  36520. Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array)).constructor;
  36521. var h = (function(t) {
  36522. function e(i, n) {
  36523. o(this, e);
  36524. var r = a(this, t.call(this, i)),
  36525. s = r._device._gl;
  36526. return r._target = s.TEXTURE_2D, r._glID = s.createTexture(), n.images = n.images || [null], r.update(n), r
  36527. }
  36528. return l(e, t), e.prototype.update = function(t) {
  36529. var e = this._device._gl,
  36530. i = this._genMipmap;
  36531. if (t) {
  36532. void 0 !== t.width && (this._width = t.width), void 0 !== t.height && (this._height = t.height), void 0 !== t.anisotropy && (this._anisotropy = t.anisotropy), void 0 !== t.minFilter && (this._minFilter = t.minFilter), void 0 !== t.magFilter && (this._magFilter = t.magFilter), void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter), void 0 !== t.wrapS && (this._wrapS = t.wrapS), void 0 !== t.wrapT && (this._wrapT = t.wrapT), void 0 !== t.format && (this._format = t.format, this._compressed = this._format >= r.enums.TEXTURE_FMT_RGB_DXT1 && this._format <= r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1 || this._format >= r.enums.TEXTURE_FMT_RGB_ETC2 && this._format <= r.enums.TEXTURE_FMT_RGBA_ETC2), void 0 !== t.genMipmaps && (this._genMipmap = t.genMipmaps, i = t.genMipmaps);
  36533. var n = this._device.caps.maxTextureSize || Number.MAX_VALUE,
  36534. o = Math.max(t.width || 0, t.height || 0);
  36535. if (n < o && console.warn("The current texture size " + o + " exceeds the maximum size [" + n + "] supported on the device."), void 0 !== t.images)
  36536. if (t.images.length > 1) i = !1, (t.width > t.height ? t.width : t.height) >> t.images.length - 1 != 1 && console.error("texture-2d mipmap is invalid, should have a 1x1 mipmap.")
  36537. }(0, s.isPow2)(this._width) && (0, s.isPow2)(this._height) || (i = !1), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this._glID), void 0 !== t.images && t.images.length > 0 && (this._setMipmap(t.images, t.flipY, t.premultiplyAlpha), t.images.length > 1 && (this._genMipmap = !0)), i && (e.hint(e.GENERATE_MIPMAP_HINT, e.NICEST), e.generateMipmap(e.TEXTURE_2D), this._genMipmap = !0), this._setTexInfo(), this._device._restoreTexture(0)
  36538. }, e.prototype.updateSubImage = function(t) {
  36539. var e = this._device._gl,
  36540. i = (0, r.glTextureFmt)(this._format);
  36541. e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this._glID), this._setSubImage(i, t), this._device._restoreTexture(0)
  36542. }, e.prototype.updateImage = function(t) {
  36543. var e = this._device._gl,
  36544. i = (0, r.glTextureFmt)(this._format);
  36545. e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this._glID), this._setImage(i, t), this._device._restoreTexture(0)
  36546. }, e.prototype._setSubImage = function(t, e) {
  36547. var i = this._device._gl,
  36548. n = e.flipY,
  36549. r = e.premultiplyAlpha,
  36550. s = e.image;
  36551. !s || ArrayBuffer.isView(s) || s instanceof ArrayBuffer ? (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), this._compressed ? i.compressedTexSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, e.width, e.height, t.format, s) : i.texSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, e.width, e.height, t.format, t.pixelType, s)) : (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !0) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), i.texSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, t.format, t.pixelType, s))
  36552. }, e.prototype._setImage = function(t, e) {
  36553. var i = this._device._gl,
  36554. n = e.flipY,
  36555. r = e.premultiplyAlpha,
  36556. s = e.image;
  36557. !s || ArrayBuffer.isView(s) || s instanceof ArrayBuffer ? (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), this._compressed ? i.compressedTexImage2D(i.TEXTURE_2D, e.level, t.internalFormat, e.width, e.height, 0, s) : i.texImage2D(i.TEXTURE_2D, e.level, t.internalFormat, e.width, e.height, 0, t.format, t.pixelType, s)) : (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !0) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), i.texImage2D(i.TEXTURE_2D, e.level, t.internalFormat, t.format, t.pixelType, s))
  36558. }, e.prototype._setMipmap = function(t, e, i) {
  36559. for (var n = (0, r.glTextureFmt)(this._format), s = {
  36560. width: this._width,
  36561. height: this._height,
  36562. flipY: e,
  36563. premultiplyAlpha: i,
  36564. level: 0,
  36565. image: null
  36566. }, o = 0; o < t.length; ++o) s.level = o, s.width = this._width >> o, s.height = this._height >> o, s.image = t[o], this._setImage(n, s)
  36567. }, e.prototype._setTexInfo = function() {
  36568. var t = this._device._gl,
  36569. e = (0, s.isPow2)(this._width) && (0, s.isPow2)(this._height);
  36570. e || this._wrapS === r.enums.WRAP_CLAMP && this._wrapT === r.enums.WRAP_CLAMP || (console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"), this._wrapS = r.enums.WRAP_CLAMP, this._wrapT = r.enums.WRAP_CLAMP);
  36571. var i = this._genMipmap ? this._mipFilter : -1;
  36572. e || -1 === i || (console.warn("NPOT textures do not support mipmap filter"), i = -1), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, (0, r.glFilter)(t, this._minFilter, i)), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, (0, r.glFilter)(t, this._magFilter, -1)), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, this._wrapS), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, this._wrapT);
  36573. var n = this._device.ext("EXT_texture_filter_anisotropic");
  36574. n && t.texParameteri(t.TEXTURE_2D, n.TEXTURE_MAX_ANISOTROPY_EXT, this._anisotropy)
  36575. }, e
  36576. })(n.default);
  36577. i.default = h, e.exports = i.default
  36578. }), {
  36579. "./enums": 357,
  36580. "./misc": 361,
  36581. "./texture": 367
  36582. }],
  36583. 366: [(function(t, e, i) {
  36584. "use strict";
  36585. i.__esModule = !0, i.default = void 0;
  36586. var n = (function(t) {
  36587. return t && t.__esModule ? t : {
  36588. default: t
  36589. }
  36590. })(t("./texture")),
  36591. r = t("./enums"),
  36592. s = t("./misc");
  36593. function o(t, e) {
  36594. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36595. }
  36596. function a(t, e) {
  36597. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  36598. return !e || "object" != typeof e && "function" != typeof e ? t : e
  36599. }
  36600. function l(t, e) {
  36601. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  36602. t.prototype = Object.create(e && e.prototype, {
  36603. constructor: {
  36604. value: t,
  36605. enumerable: !1,
  36606. writable: !0,
  36607. configurable: !0
  36608. }
  36609. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  36610. }
  36611. var h = (function(t) {
  36612. function e(i, n) {
  36613. o(this, e);
  36614. var r = a(this, t.call(this, i)),
  36615. s = r._device._gl;
  36616. return r._target = s.TEXTURE_CUBE_MAP, r._glID = s.createTexture(), r.update(n), r
  36617. }
  36618. return l(e, t), e.prototype.update = function(t) {
  36619. var e = this._device._gl,
  36620. i = this._genMipmaps;
  36621. t && (void 0 !== t.width && (this._width = t.width), void 0 !== t.height && (this._height = t.height), void 0 !== t.anisotropy && (this._anisotropy = t.anisotropy), void 0 !== t.minFilter && (this._minFilter = t.minFilter), void 0 !== t.magFilter && (this._magFilter = t.magFilter), void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter), void 0 !== t.wrapS && (this._wrapS = t.wrapS), void 0 !== t.wrapT && (this._wrapT = t.wrapT), void 0 !== t.format && (this._format = t.format, this._compressed = this._format >= r.enums.TEXTURE_FMT_RGB_DXT1 && this._format <= r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1 || this._format >= r.enums.TEXTURE_FMT_RGB_ETC2 && this._format <= r.enums.TEXTURE_FMT_RGBA_ETC2), void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps, i = t.genMipmaps), void 0 !== t.images && t.images.length > 1 && (i = !1, t.width !== t.height && console.warn("texture-cube width and height should be identical."), t.width >> t.images.length - 1 != 1 && console.error("texture-cube mipmap is invalid. please set mipmap as 1x1, 2x2, 4x4 ... nxn"))), (0, s.isPow2)(this._width) && (0, s.isPow2)(this._height) || (i = !1), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), void 0 !== t.images && t.images.length > 0 && (this._setMipmap(t.images, t.flipY, t.premultiplyAlpha), t.images.length > 1 && (this._genMipmaps = !0)), i && (e.hint(e.GENERATE_MIPMAP_HINT, e.NICEST), e.generateMipmap(e.TEXTURE_CUBE_MAP), this._genMipmaps = !0), this._setTexInfo(), this._device._restoreTexture(0)
  36622. }, e.prototype.updateSubImage = function(t) {
  36623. var e = this._device._gl,
  36624. i = (0, r.glTextureFmt)(this._format);
  36625. e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), this._setSubImage(i, t), this._device._restoreTexture(0)
  36626. }, e.prototype.updateImage = function(t) {
  36627. var e = this._device._gl,
  36628. i = (0, r.glTextureFmt)(this._format);
  36629. e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), this._setImage(i, t), this._device._restoreTexture(0)
  36630. }, e.prototype._setSubImage = function(t, e) {
  36631. var i = this._device._gl,
  36632. n = e.flipY,
  36633. r = e.premultiplyAlpha,
  36634. s = e.faceIndex,
  36635. o = e.image;
  36636. void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), !o || ArrayBuffer.isView(o) || o instanceof ArrayBuffer ? this._compressed ? i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, e.width, e.height, t.format, o) : i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, e.width, e.height, t.format, t.pixelType, o) : i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, t.format, t.pixelType, o)
  36637. }, e.prototype._setImage = function(t, e) {
  36638. var i = this._device._gl,
  36639. n = e.flipY,
  36640. r = e.premultiplyAlpha,
  36641. s = e.faceIndex,
  36642. o = e.image;
  36643. void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), !o || ArrayBuffer.isView(o) || o instanceof ArrayBuffer ? this._compressed ? i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, e.width, e.height, 0, o) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, e.width, e.height, 0, t.format, t.pixelType, o) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, t.format, t.pixelType, o)
  36644. }, e.prototype._setMipmap = function(t, e, i) {
  36645. for (var n = (0, r.glTextureFmt)(this._format), s = {
  36646. width: this._width,
  36647. height: this._height,
  36648. faceIndex: 0,
  36649. flipY: e,
  36650. premultiplyAlpha: i,
  36651. level: 0,
  36652. image: null
  36653. }, o = 0; o < t.length; ++o) {
  36654. var a = t[o];
  36655. s.level = o, s.width = this._width >> o, s.height = this._height >> o;
  36656. for (var l = 0; l < 6; ++l) s.faceIndex = l, s.image = a[l], this._setImage(n, s)
  36657. }
  36658. }, e.prototype._setTexInfo = function() {
  36659. var t = this._device._gl,
  36660. e = (0, s.isPow2)(this._width) && (0, s.isPow2)(this._height);
  36661. e || this._wrapS === r.enums.WRAP_CLAMP && this._wrapT === r.enums.WRAP_CLAMP || (console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"), this._wrapS = r.enums.WRAP_CLAMP, this._wrapT = r.enums.WRAP_CLAMP);
  36662. var i = this._genMipmaps ? this._mipFilter : -1;
  36663. e || -1 === i || (console.warn("NPOT textures do not support mipmap filter"), i = -1), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MIN_FILTER, (0, r.glFilter)(t, this._minFilter, i)), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MAG_FILTER, (0, r.glFilter)(t, this._magFilter, -1)), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_S, this._wrapS), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_T, this._wrapT);
  36664. var n = this._device.ext("EXT_texture_filter_anisotropic");
  36665. n && t.texParameteri(t.TEXTURE_CUBE_MAP, n.TEXTURE_MAX_ANISOTROPY_EXT, this._anisotropy)
  36666. }, e
  36667. })(n.default);
  36668. i.default = h, e.exports = i.default
  36669. }), {
  36670. "./enums": 357,
  36671. "./misc": 361,
  36672. "./texture": 367
  36673. }],
  36674. 367: [(function(t, e, i) {
  36675. "use strict";
  36676. i.__esModule = !0, i.default = void 0;
  36677. var n = t("./enums");
  36678. function r(t, e) {
  36679. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36680. }
  36681. var s = 0,
  36682. o = (function() {
  36683. function t(e) {
  36684. r(this, t), this._device = e, this._width = 4, this._height = 4, this._genMipmaps = !1, this._compressed = !1, this._anisotropy = 1, this._minFilter = n.enums.FILTER_LINEAR, this._magFilter = n.enums.FILTER_LINEAR, this._mipFilter = n.enums.FILTER_LINEAR, this._wrapS = n.enums.WRAP_REPEAT, this._wrapT = n.enums.WRAP_REPEAT, this._format = n.enums.TEXTURE_FMT_RGBA8, this._target = -1, this._id = s++
  36685. }
  36686. return t.prototype.destroy = function() {
  36687. null !== this._glID ? (this._device._gl.deleteTexture(this._glID), this._device._stats.tex -= this.bytes, this._glID = null) : console.error("The texture already destroyed")
  36688. }, t
  36689. })();
  36690. i.default = o, e.exports = i.default
  36691. }), {
  36692. "./enums": 357
  36693. }],
  36694. 368: [(function(t, e, i) {
  36695. "use strict";
  36696. i.__esModule = !0;
  36697. var n = (function() {
  36698. function t(t, e) {
  36699. for (var i = 0; i < e.length; i++) {
  36700. var n = e[i];
  36701. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  36702. }
  36703. }
  36704. return function(e, i, n) {
  36705. return i && t(e.prototype, i), n && t(e, n), e
  36706. }
  36707. })();
  36708. t("./enums");
  36709. function r(t, e) {
  36710. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36711. }
  36712. var s = (function() {
  36713. function t(e, i, n, s) {
  36714. r(this, t), this._device = e, this._format = i, this._usage = n, this._bytesPerVertex = this._format._bytes, this._bytes = s.byteLength, this._numVertices = this._bytes / this._bytesPerVertex, this._needExpandDataStore = !0, this._glID = e._gl.createBuffer(), this.update(0, s), e._stats.vb += this._bytes
  36715. }
  36716. return t.prototype.destroy = function() {
  36717. -1 !== this._glID ? (this._device._gl.deleteBuffer(this._glID), this._device._stats.vb -= this.bytes, this._glID = -1) : console.error("The buffer already destroyed")
  36718. }, t.prototype.update = function(t, e) {
  36719. if (-1 !== this._glID) {
  36720. if (0 !== e.byteLength) {
  36721. if (t + e.byteLength > this._bytes) {
  36722. if (t) return void console.error("Failed to update data, bytes exceed.");
  36723. this._needExpandDataStore = !0, this._bytes = t + e.byteLength, this._numVertices = this._bytes / this._bytesPerVertex
  36724. }
  36725. var i = this._device._gl,
  36726. n = this._usage;
  36727. i.bindBuffer(i.ARRAY_BUFFER, this._glID), this._needExpandDataStore ? (i.bufferData(i.ARRAY_BUFFER, e, n), this._needExpandDataStore = !1) : i.bufferSubData(i.ARRAY_BUFFER, t, e), i.bindBuffer(i.ARRAY_BUFFER, null)
  36728. }
  36729. } else console.error("The buffer is destroyed")
  36730. }, t.prototype.getFormat = function(t) {
  36731. return this._format.element(t)
  36732. }, t.prototype.setUsage = function(t) {
  36733. this._usage = t
  36734. }, n(t, [{
  36735. key: "count",
  36736. get: function() {
  36737. return this._numVertices
  36738. }
  36739. }]), t
  36740. })();
  36741. i.default = s, e.exports = i.default
  36742. }), {
  36743. "./enums": 357
  36744. }],
  36745. 369: [(function(t, e, i) {
  36746. "use strict";
  36747. i.__esModule = !0, i.default = void 0;
  36748. var n = t("./enums"),
  36749. r = (function(t) {
  36750. return t && t.__esModule ? t : {
  36751. default: t
  36752. }
  36753. })(t("../murmurhash2_gc"));
  36754. function s(t, e) {
  36755. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36756. }
  36757. var o = (function() {
  36758. function t(e) {
  36759. s(this, t), this._attr2el = {}, this._elements = [], this._bytes = 0;
  36760. for (var i = "", o = 0, a = e.length; o < a; ++o) {
  36761. var l = e[o],
  36762. h = {
  36763. name: l.name,
  36764. offset: this._bytes,
  36765. stride: 0,
  36766. stream: -1,
  36767. type: l.type,
  36768. num: l.num,
  36769. normalize: void 0 !== l.normalize && l.normalize,
  36770. bytes: l.num * (0, n.attrTypeBytes)(l.type)
  36771. };
  36772. this._attr2el[h.name] = h, this._elements.push(h), this._bytes += h.bytes, i += h.name + ":" + h.num + ":" + h.type + ":" + h.normalize
  36773. }
  36774. for (var c = 0, u = this._elements.length; c < u; ++c) {
  36775. this._elements[c].stride = this._bytes
  36776. }
  36777. this._hash = (0, r.default)(i, 666)
  36778. }
  36779. return t.prototype.element = function(t) {
  36780. return this._attr2el[t]
  36781. }, t.prototype.getHash = function() {
  36782. return this._hash
  36783. }, t
  36784. })();
  36785. i.default = o, e.exports = i.default
  36786. }), {
  36787. "../murmurhash2_gc": 378,
  36788. "./enums": 357
  36789. }],
  36790. 370: [(function(t, e, i) {
  36791. "use strict";
  36792. function n(t, e) {
  36793. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36794. }
  36795. i.__esModule = !0;
  36796. var r = (function() {
  36797. function t(e, i) {
  36798. n(this, t), this._cursor = 0, this._data = new Array(i);
  36799. for (var r = 0; r < i; ++r) this._data[r] = e()
  36800. }
  36801. return t.prototype.request = function() {
  36802. var t = this._data[this._cursor];
  36803. return this._cursor = (this._cursor + 1) % this._data.length, t
  36804. }, t
  36805. })();
  36806. i.default = r, e.exports = i.default
  36807. }), {}],
  36808. 371: [(function(t, e, i) {
  36809. "use strict";
  36810. i.__esModule = !0, i.default = void 0;
  36811. var n = (function() {
  36812. function t(t, e) {
  36813. for (var i = 0; i < e.length; i++) {
  36814. var n = e[i];
  36815. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  36816. }
  36817. }
  36818. return function(e, i, n) {
  36819. return i && t(e.prototype, i), n && t(e, n), e
  36820. }
  36821. })(),
  36822. r = (function(t) {
  36823. return t && t.__esModule ? t : {
  36824. default: t
  36825. }
  36826. })(t("./timsort"));
  36827. function s(t, e) {
  36828. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36829. }
  36830. var o = (function() {
  36831. function t(e) {
  36832. s(this, t), this._count = 0, this._data = new Array(e)
  36833. }
  36834. return t.prototype._resize = function(t) {
  36835. if (t > this._data.length)
  36836. for (var e = this._data.length; e < t; ++e) this._data[e] = void 0
  36837. }, t.prototype.reset = function() {
  36838. for (var t = 0; t < this._count; ++t) this._data[t] = void 0;
  36839. this._count = 0
  36840. }, t.prototype.push = function(t) {
  36841. this._count >= this._data.length && this._resize(2 * this._data.length), this._data[this._count] = t, ++this._count
  36842. }, t.prototype.pop = function() {
  36843. --this._count, this._count < 0 && (this._count = 0);
  36844. var t = this._data[this._count];
  36845. return this._data[this._count] = void 0, t
  36846. }, t.prototype.fastRemove = function(t) {
  36847. if (!(t >= this._count || t < 0)) {
  36848. var e = this._count - 1;
  36849. this._data[t] = this._data[e], this._data[e] = void 0, this._count -= 1
  36850. }
  36851. }, t.prototype.indexOf = function(t) {
  36852. return this._data.indexOf(t)
  36853. }, t.prototype.sort = function(t) {
  36854. return (0, r.default)(this._data, 0, this._count, t)
  36855. }, n(t, [{
  36856. key: "length",
  36857. get: function() {
  36858. return this._count
  36859. }
  36860. }, {
  36861. key: "data",
  36862. get: function() {
  36863. return this._data
  36864. }
  36865. }]), t
  36866. })();
  36867. i.default = o, e.exports = i.default
  36868. }), {
  36869. "./timsort": 376
  36870. }],
  36871. 372: [(function(t, e, i) {
  36872. "use strict";
  36873. i.__esModule = !0;
  36874. var n = t("./circular-pool");
  36875. Object.defineProperty(i, "CircularPool", {
  36876. enumerable: !0,
  36877. get: function() {
  36878. return h(n).default
  36879. }
  36880. });
  36881. var r = t("./fixed-array");
  36882. Object.defineProperty(i, "FixedArray", {
  36883. enumerable: !0,
  36884. get: function() {
  36885. return h(r).default
  36886. }
  36887. });
  36888. var s = t("./linked-array");
  36889. Object.defineProperty(i, "LinkedArray", {
  36890. enumerable: !0,
  36891. get: function() {
  36892. return h(s).default
  36893. }
  36894. });
  36895. var o = t("./pool");
  36896. Object.defineProperty(i, "Pool", {
  36897. enumerable: !0,
  36898. get: function() {
  36899. return h(o).default
  36900. }
  36901. });
  36902. var a = t("./recycle-pool");
  36903. Object.defineProperty(i, "RecyclePool", {
  36904. enumerable: !0,
  36905. get: function() {
  36906. return h(a).default
  36907. }
  36908. });
  36909. var l = t("./typed-array-pool");
  36910. function h(t) {
  36911. return t && t.__esModule ? t : {
  36912. default: t
  36913. }
  36914. }
  36915. Object.defineProperty(i, "TypedArrayPool", {
  36916. enumerable: !0,
  36917. get: function() {
  36918. return h(l).default
  36919. }
  36920. })
  36921. }), {
  36922. "./circular-pool": 370,
  36923. "./fixed-array": 371,
  36924. "./linked-array": 373,
  36925. "./pool": 374,
  36926. "./recycle-pool": 375,
  36927. "./typed-array-pool": 377
  36928. }],
  36929. 373: [(function(t, e, i) {
  36930. "use strict";
  36931. i.__esModule = !0, i.default = void 0;
  36932. var n = (function() {
  36933. function t(t, e) {
  36934. for (var i = 0; i < e.length; i++) {
  36935. var n = e[i];
  36936. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  36937. }
  36938. }
  36939. return function(e, i, n) {
  36940. return i && t(e.prototype, i), n && t(e, n), e
  36941. }
  36942. })(),
  36943. r = (function(t) {
  36944. return t && t.__esModule ? t : {
  36945. default: t
  36946. }
  36947. })(t("./pool"));
  36948. function s(t, e) {
  36949. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36950. }
  36951. var o = (function() {
  36952. function t(e, i) {
  36953. s(this, t), this._fn = e, this._count = 0, this._head = null, this._tail = null, this._pool = new r.default(e, i)
  36954. }
  36955. return t.prototype.add = function() {
  36956. var t = this._pool.alloc();
  36957. return this._tail ? (this._tail._next = t, t._prev = this._tail) : this._head = t, this._tail = t, this._count += 1, t
  36958. }, t.prototype.remove = function(t) {
  36959. t._prev ? t._prev._next = t._next : this._head = t._next, t._next ? t._next._prev = t._prev : this._tail = t._prev, t._next = null, t._prev = null, this._pool.free(t), this._count -= 1
  36960. }, t.prototype.forEach = function(t, e) {
  36961. var i = this._head;
  36962. if (i) {
  36963. e && (t = t.bind(e));
  36964. for (var n = 0, r = i; i;) r = i._next, t(i, n, this), i = r, ++n
  36965. }
  36966. }, n(t, [{
  36967. key: "head",
  36968. get: function() {
  36969. return this._head
  36970. }
  36971. }, {
  36972. key: "tail",
  36973. get: function() {
  36974. return this._tail
  36975. }
  36976. }, {
  36977. key: "length",
  36978. get: function() {
  36979. return this._count
  36980. }
  36981. }]), t
  36982. })();
  36983. i.default = o, e.exports = i.default
  36984. }), {
  36985. "./pool": 374
  36986. }],
  36987. 374: [(function(t, e, i) {
  36988. "use strict";
  36989. function n(t, e) {
  36990. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  36991. }
  36992. i.__esModule = !0;
  36993. var r = (function() {
  36994. function t(e, i) {
  36995. n(this, t), this._fn = e, this._idx = i - 1, this._frees = new Array(i);
  36996. for (var r = 0; r < i; ++r) this._frees[r] = e()
  36997. }
  36998. return t.prototype._expand = function(t) {
  36999. var e = this._frees;
  37000. this._frees = new Array(t);
  37001. for (var i = t - e.length, n = 0; n < i; ++n) this._frees[n] = this._fn();
  37002. for (var r = i, s = 0; r < t; ++r, ++s) this._frees[r] = e[s];
  37003. this._idx += i
  37004. }, t.prototype.alloc = function() {
  37005. this._idx < 0 && this._expand(Math.round(1.2 * this._frees.length) + 1);
  37006. var t = this._frees[this._idx];
  37007. return this._frees[this._idx] = null, --this._idx, t
  37008. }, t.prototype.free = function(t) {
  37009. ++this._idx, this._frees[this._idx] = t
  37010. }, t
  37011. })();
  37012. i.default = r, e.exports = i.default
  37013. }), {}],
  37014. 375: [(function(t, e, i) {
  37015. "use strict";
  37016. i.__esModule = !0, i.default = void 0;
  37017. var n = (function() {
  37018. function t(t, e) {
  37019. for (var i = 0; i < e.length; i++) {
  37020. var n = e[i];
  37021. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  37022. }
  37023. }
  37024. return function(e, i, n) {
  37025. return i && t(e.prototype, i), n && t(e, n), e
  37026. }
  37027. })(),
  37028. r = (function(t) {
  37029. return t && t.__esModule ? t : {
  37030. default: t
  37031. }
  37032. })(t("./timsort"));
  37033. function s(t, e) {
  37034. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  37035. }
  37036. var o = (function() {
  37037. function t(e, i) {
  37038. s(this, t), this._fn = e, this._count = 0, this._data = new Array(i);
  37039. for (var n = 0; n < i; ++n) this._data[n] = e()
  37040. }
  37041. return t.prototype.reset = function() {
  37042. this._count = 0
  37043. }, t.prototype.resize = function(t) {
  37044. if (t > this._data.length)
  37045. for (var e = this._data.length; e < t; ++e) this._data[e] = this._fn()
  37046. }, t.prototype.add = function() {
  37047. return this._count >= this._data.length && this.resize(2 * this._data.length), this._data[this._count++]
  37048. }, t.prototype.remove = function(t) {
  37049. if (!(t >= this._count)) {
  37050. var e = this._count - 1,
  37051. i = this._data[t];
  37052. this._data[t] = this._data[e], this._data[e] = i, this._count -= 1
  37053. }
  37054. }, t.prototype.sort = function(t) {
  37055. return (0, r.default)(this._data, 0, this._count, t)
  37056. }, n(t, [{
  37057. key: "length",
  37058. get: function() {
  37059. return this._count
  37060. }
  37061. }, {
  37062. key: "data",
  37063. get: function() {
  37064. return this._data
  37065. }
  37066. }]), t
  37067. })();
  37068. i.default = o, e.exports = i.default
  37069. }), {
  37070. "./timsort": 376
  37071. }],
  37072. 376: [(function(t, e, i) {
  37073. "use strict";
  37074. function n(t, e) {
  37075. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  37076. }
  37077. i.__esModule = !0, i.default = function(t, e, i, n) {
  37078. if (!Array.isArray(t)) throw new TypeError("Can only sort arrays");
  37079. void 0 === e && (e = 0), void 0 === i && (i = t.length), void 0 === n && (n = h);
  37080. var s = i - e;
  37081. if (!(s < 2)) {
  37082. var o = 0;
  37083. if (s < r) f(t, e, i, e + (o = u(t, e, i, n)), n);
  37084. else {
  37085. var a = new m(t, n),
  37086. l = c(s);
  37087. do {
  37088. if ((o = u(t, e, i, n)) < l) {
  37089. var _ = s;
  37090. _ > l && (_ = l), f(t, e, e + _, e + o, n), o = _
  37091. }
  37092. a.pushRun(e, o), a.mergeRuns(), s -= o, e += o
  37093. } while (0 !== s);
  37094. a.forceMergeRuns()
  37095. }
  37096. }
  37097. };
  37098. var r = 32,
  37099. s = 7,
  37100. o = 256,
  37101. a = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
  37102. function l(t) {
  37103. return t < 1e5 ? t < 100 ? t < 10 ? 0 : 1 : t < 1e4 ? t < 1e3 ? 2 : 3 : 4 : t < 1e7 ? t < 1e6 ? 5 : 6 : t < 1e9 ? t < 1e8 ? 7 : 8 : 9
  37104. }
  37105. function h(t, e) {
  37106. if (t === e) return 0;
  37107. if (~~t === t && ~~e === e) {
  37108. if (0 === t || 0 === e) return t < e ? -1 : 1;
  37109. if (t < 0 || e < 0) {
  37110. if (e >= 0) return -1;
  37111. if (t >= 0) return 1;
  37112. t = -t, e = -e
  37113. }
  37114. var i = l(t),
  37115. n = l(e),
  37116. r = 0;
  37117. return i < n ? (t *= a[n - i - 1], e /= 10, r = -1) : i > n && (e *= a[i - n - 1], t /= 10, r = 1), t === e ? r : t < e ? -1 : 1
  37118. }
  37119. var s = String(t),
  37120. o = String(e);
  37121. return s === o ? 0 : s < o ? -1 : 1
  37122. }
  37123. function c(t) {
  37124. for (var e = 0; t >= r;) e |= 1 & t, t >>= 1;
  37125. return t + e
  37126. }
  37127. function u(t, e, i, n) {
  37128. var r = e + 1;
  37129. if (r === i) return 1;
  37130. if (n(t[r++], t[e]) < 0) {
  37131. for (; r < i && n(t[r], t[r - 1]) < 0;) r++;
  37132. _(t, e, r)
  37133. } else
  37134. for (; r < i && n(t[r], t[r - 1]) >= 0;) r++;
  37135. return r - e
  37136. }
  37137. function _(t, e, i) {
  37138. for (i--; e < i;) {
  37139. var n = t[e];
  37140. t[e++] = t[i], t[i--] = n
  37141. }
  37142. }
  37143. function f(t, e, i, n, r) {
  37144. for (n === e && n++; n < i; n++) {
  37145. for (var s = t[n], o = e, a = n; o < a;) {
  37146. var l = o + a >>> 1;
  37147. r(s, t[l]) < 0 ? a = l : o = l + 1
  37148. }
  37149. var h = n - o;
  37150. switch (h) {
  37151. case 3:
  37152. t[o + 3] = t[o + 2];
  37153. case 2:
  37154. t[o + 2] = t[o + 1];
  37155. case 1:
  37156. t[o + 1] = t[o];
  37157. break;
  37158. default:
  37159. for (; h > 0;) t[o + h] = t[o + h - 1], h--
  37160. }
  37161. t[o] = s
  37162. }
  37163. }
  37164. function d(t, e, i, n, r, s) {
  37165. var o = 0,
  37166. a = 0,
  37167. l = 1;
  37168. if (s(t, e[i + r]) > 0) {
  37169. for (a = n - r; l < a && s(t, e[i + r + l]) > 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
  37170. l > a && (l = a), o += r, l += r
  37171. } else {
  37172. for (a = r + 1; l < a && s(t, e[i + r - l]) <= 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
  37173. l > a && (l = a);
  37174. var h = o;
  37175. o = r - l, l = r - h
  37176. }
  37177. for (o++; o < l;) {
  37178. var c = o + (l - o >>> 1);
  37179. s(t, e[i + c]) > 0 ? o = c + 1 : l = c
  37180. }
  37181. return l
  37182. }
  37183. function p(t, e, i, n, r, s) {
  37184. var o = 0,
  37185. a = 0,
  37186. l = 1;
  37187. if (s(t, e[i + r]) < 0) {
  37188. for (a = r + 1; l < a && s(t, e[i + r - l]) < 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
  37189. l > a && (l = a);
  37190. var h = o;
  37191. o = r - l, l = r - h
  37192. } else {
  37193. for (a = n - r; l < a && s(t, e[i + r + l]) >= 0;) o = l, (l = 1 + (l << 1)) <= 0 && (l = a);
  37194. l > a && (l = a), o += r, l += r
  37195. }
  37196. for (o++; o < l;) {
  37197. var c = o + (l - o >>> 1);
  37198. s(t, e[i + c]) < 0 ? l = c : o = c + 1
  37199. }
  37200. return l
  37201. }
  37202. var m = (function() {
  37203. function t(e, i) {
  37204. n(this, t), this.array = e, this.compare = i, this.minGallop = s, this.length = e.length, this.tmpStorageLength = o, this.length < 2 * o && (this.tmpStorageLength = this.length >>> 1), this.tmp = new Array(this.tmpStorageLength), this.stackLength = this.length < 120 ? 5 : this.length < 1542 ? 10 : this.length < 119151 ? 19 : 40, this.runStart = new Array(this.stackLength), this.runLength = new Array(this.stackLength), this.stackSize = 0
  37205. }
  37206. return t.prototype.pushRun = function(t, e) {
  37207. this.runStart[this.stackSize] = t, this.runLength[this.stackSize] = e, this.stackSize += 1
  37208. }, t.prototype.mergeRuns = function() {
  37209. for (; this.stackSize > 1;) {
  37210. var t = this.stackSize - 2;
  37211. if (t >= 1 && this.runLength[t - 1] <= this.runLength[t] + this.runLength[t + 1] || t >= 2 && this.runLength[t - 2] <= this.runLength[t] + this.runLength[t - 1]) this.runLength[t - 1] < this.runLength[t + 1] && t--;
  37212. else if (this.runLength[t] > this.runLength[t + 1]) break;
  37213. this.mergeAt(t)
  37214. }
  37215. }, t.prototype.forceMergeRuns = function() {
  37216. for (; this.stackSize > 1;) {
  37217. var t = this.stackSize - 2;
  37218. t > 0 && this.runLength[t - 1] < this.runLength[t + 1] && t--, this.mergeAt(t)
  37219. }
  37220. }, t.prototype.mergeAt = function(t) {
  37221. var e = this.compare,
  37222. i = this.array,
  37223. n = this.runStart[t],
  37224. r = this.runLength[t],
  37225. s = this.runStart[t + 1],
  37226. o = this.runLength[t + 1];
  37227. this.runLength[t] = r + o, t === this.stackSize - 3 && (this.runStart[t + 1] = this.runStart[t + 2], this.runLength[t + 1] = this.runLength[t + 2]), this.stackSize--;
  37228. var a = p(i[s], i, n, r, 0, e);
  37229. n += a, 0 !== (r -= a) && 0 !== (o = d(i[n + r - 1], i, s, o, o - 1, e)) && (r <= o ? this.mergeLow(n, r, s, o) : this.mergeHigh(n, r, s, o))
  37230. }, t.prototype.mergeLow = function(t, e, i, n) {
  37231. var r = this.compare,
  37232. o = this.array,
  37233. a = this.tmp,
  37234. l = 0;
  37235. for (l = 0; l < e; l++) a[l] = o[t + l];
  37236. var h = 0,
  37237. c = i,
  37238. u = t;
  37239. if (o[u++] = o[c++], 0 != --n)
  37240. if (1 !== e) {
  37241. for (var _ = this.minGallop;;) {
  37242. var f = 0,
  37243. m = 0,
  37244. y = !1;
  37245. do {
  37246. if (r(o[c], a[h]) < 0) {
  37247. if (o[u++] = o[c++], m++, f = 0, 0 == --n) {
  37248. y = !0;
  37249. break
  37250. }
  37251. } else if (o[u++] = a[h++], f++, m = 0, 1 == --e) {
  37252. y = !0;
  37253. break
  37254. }
  37255. } while ((f | m) < _);
  37256. if (y) break;
  37257. do {
  37258. if (0 !== (f = p(o[c], a, h, e, 0, r))) {
  37259. for (l = 0; l < f; l++) o[u + l] = a[h + l];
  37260. if (u += f, h += f, (e -= f) <= 1) {
  37261. y = !0;
  37262. break
  37263. }
  37264. }
  37265. if (o[u++] = o[c++], 0 == --n) {
  37266. y = !0;
  37267. break
  37268. }
  37269. if (0 !== (m = d(a[h], o, c, n, 0, r))) {
  37270. for (l = 0; l < m; l++) o[u + l] = o[c + l];
  37271. if (u += m, c += m, 0 === (n -= m)) {
  37272. y = !0;
  37273. break
  37274. }
  37275. }
  37276. if (o[u++] = a[h++], 1 == --e) {
  37277. y = !0;
  37278. break
  37279. }
  37280. _--
  37281. } while (f >= s || m >= s);
  37282. if (y) break;
  37283. _ < 0 && (_ = 0), _ += 2
  37284. }
  37285. if (this.minGallop = _, _ < 1 && (this.minGallop = 1), 1 === e) {
  37286. for (l = 0; l < n; l++) o[u + l] = o[c + l];
  37287. o[u + n] = a[h]
  37288. } else {
  37289. if (0 === e) throw new Error("mergeLow preconditions were not respected");
  37290. for (l = 0; l < e; l++) o[u + l] = a[h + l]
  37291. }
  37292. } else {
  37293. for (l = 0; l < n; l++) o[u + l] = o[c + l];
  37294. o[u + n] = a[h]
  37295. }
  37296. else
  37297. for (l = 0; l < e; l++) o[u + l] = a[h + l]
  37298. }, t.prototype.mergeHigh = function(t, e, i, n) {
  37299. var r = this.compare,
  37300. o = this.array,
  37301. a = this.tmp,
  37302. l = 0;
  37303. for (l = 0; l < n; l++) a[l] = o[i + l];
  37304. var h = t + e - 1,
  37305. c = n - 1,
  37306. u = i + n - 1,
  37307. _ = 0,
  37308. f = 0;
  37309. if (o[u--] = o[h--], 0 != --e)
  37310. if (1 !== n) {
  37311. for (var m = this.minGallop;;) {
  37312. var y = 0,
  37313. v = 0,
  37314. g = !1;
  37315. do {
  37316. if (r(a[c], o[h]) < 0) {
  37317. if (o[u--] = o[h--], y++, v = 0, 0 == --e) {
  37318. g = !0;
  37319. break
  37320. }
  37321. } else if (o[u--] = a[c--], v++, y = 0, 1 == --n) {
  37322. g = !0;
  37323. break
  37324. }
  37325. } while ((y | v) < m);
  37326. if (g) break;
  37327. do {
  37328. if (0 !== (y = e - p(a[c], o, t, e, e - 1, r))) {
  37329. for (e -= y, f = (u -= y) + 1, _ = (h -= y) + 1, l = y - 1; l >= 0; l--) o[f + l] = o[_ + l];
  37330. if (0 === e) {
  37331. g = !0;
  37332. break
  37333. }
  37334. }
  37335. if (o[u--] = a[c--], 1 == --n) {
  37336. g = !0;
  37337. break
  37338. }
  37339. if (0 !== (v = n - d(o[h], a, 0, n, n - 1, r))) {
  37340. for (n -= v, f = (u -= v) + 1, _ = (c -= v) + 1, l = 0; l < v; l++) o[f + l] = a[_ + l];
  37341. if (n <= 1) {
  37342. g = !0;
  37343. break
  37344. }
  37345. }
  37346. if (o[u--] = o[h--], 0 == --e) {
  37347. g = !0;
  37348. break
  37349. }
  37350. m--
  37351. } while (y >= s || v >= s);
  37352. if (g) break;
  37353. m < 0 && (m = 0), m += 2
  37354. }
  37355. if (this.minGallop = m, m < 1 && (this.minGallop = 1), 1 === n) {
  37356. for (f = (u -= e) + 1, _ = (h -= e) + 1, l = e - 1; l >= 0; l--) o[f + l] = o[_ + l];
  37357. o[u] = a[c]
  37358. } else {
  37359. if (0 === n) throw new Error("mergeHigh preconditions were not respected");
  37360. for (_ = u - (n - 1), l = 0; l < n; l++) o[_ + l] = a[l]
  37361. }
  37362. } else {
  37363. for (f = (u -= e) + 1, _ = (h -= e) + 1, l = e - 1; l >= 0; l--) o[f + l] = o[_ + l];
  37364. o[u] = a[c]
  37365. }
  37366. else
  37367. for (_ = u - (n - 1), l = 0; l < n; l++) o[_ + l] = a[l]
  37368. }, t
  37369. })();
  37370. e.exports = i.default
  37371. }), {}],
  37372. 377: [(function(t, e, i) {
  37373. "use strict";
  37374. i.__esModule = !0;
  37375. for (var n = Array(8), r = 0; r < 8; ++r) n[r] = [];
  37376. function s(t) {
  37377. for (var e = 16; e <= 1 << 28; e *= 16)
  37378. if (t <= e) return e;
  37379. return 0
  37380. }
  37381. function o(t) {
  37382. var e = void 0,
  37383. i = void 0;
  37384. return e = (t > 65535) << 4, e |= i = ((t >>>= e) > 255) << 3, e |= i = ((t >>>= i) > 15) << 2, (e |= i = ((t >>>= i) > 3) << 1) | (t >>>= i) >> 1
  37385. }
  37386. function a(t) {
  37387. var e = s(t),
  37388. i = n[o(e) >> 2];
  37389. return i.length > 0 ? i.pop() : new ArrayBuffer(e)
  37390. }
  37391. function l(t) {
  37392. n[o(t.byteLength) >> 2].push(t)
  37393. }
  37394. i.default = {
  37395. alloc_int8: function(t) {
  37396. var e = new Int8Array(a(t), 0, t);
  37397. return e.length !== t ? e.subarray(0, t) : e
  37398. },
  37399. alloc_uint8: function(t) {
  37400. var e = new Uint8Array(a(t), 0, t);
  37401. return e.length !== t ? e.subarray(0, t) : e
  37402. },
  37403. alloc_int16: function(t) {
  37404. var e = new Int16Array(a(2 * t), 0, t);
  37405. return e.length !== t ? e.subarray(0, t) : e
  37406. },
  37407. alloc_uint16: function(t) {
  37408. var e = new Uint16Array(a(2 * t), 0, t);
  37409. return e.length !== t ? e.subarray(0, t) : e
  37410. },
  37411. alloc_int32: function(t) {
  37412. var e = new Int32Array(a(4 * t), 0, t);
  37413. return e.length !== t ? e.subarray(0, t) : e
  37414. },
  37415. alloc_uint32: function(t) {
  37416. var e = new Uint32Array(a(4 * t), 0, t);
  37417. return e.length !== t ? e.subarray(0, t) : e
  37418. },
  37419. alloc_float32: function(t) {
  37420. var e = new Float32Array(a(4 * t), 0, t);
  37421. return e.length !== t ? e.subarray(0, t) : e
  37422. },
  37423. alloc_float64: function(t) {
  37424. var e = new Float64Array(a(8 * t), 0, t);
  37425. return e.length !== t ? e.subarray(0, t) : e
  37426. },
  37427. alloc_dataview: function(t) {
  37428. var e = new DataView(a(t), 0, t);
  37429. return e.length !== t ? e.subarray(0, t) : e
  37430. },
  37431. free: function(t) {
  37432. l(t.buffer)
  37433. },
  37434. reset: function() {
  37435. for (var t = Array(8), e = 0; e < 8; ++e) t[e] = []
  37436. }
  37437. }, e.exports = i.default
  37438. }), {}],
  37439. 378: [(function(t, e, i) {
  37440. "use strict";
  37441. i.__esModule = !0, i.default = function(t, e) {
  37442. var i, n = t.length,
  37443. r = e ^ n,
  37444. s = 0;
  37445. for (; n >= 4;) i = 1540483477 * (65535 & (i = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16), r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)), n -= 4, ++s;
  37446. switch (n) {
  37447. case 3:
  37448. r ^= (255 & t.charCodeAt(s + 2)) << 16;
  37449. case 2:
  37450. r ^= (255 & t.charCodeAt(s + 1)) << 8;
  37451. case 1:
  37452. r = 1540483477 * (65535 & (r ^= 255 & t.charCodeAt(s))) + ((1540483477 * (r >>> 16) & 65535) << 16)
  37453. }
  37454. return r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16), (r ^= r >>> 15) >>> 0
  37455. }, e.exports = i.default
  37456. }), {}],
  37457. 379: [(function(t, e, i) {
  37458. "use strict";
  37459. i.__esModule = !0, i.default = void 0;
  37460. var n = t("../../core/vmath"),
  37461. r = a(t("../core/base-renderer")),
  37462. s = a(t("../enums")),
  37463. o = t("../memop");
  37464. function a(t) {
  37465. return t && t.__esModule ? t : {
  37466. default: t
  37467. }
  37468. }
  37469. function l(t, e) {
  37470. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  37471. }
  37472. function h(t, e) {
  37473. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  37474. return !e || "object" != typeof e && "function" != typeof e ? t : e
  37475. }
  37476. function c(t, e) {
  37477. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  37478. t.prototype = Object.create(e && e.prototype, {
  37479. constructor: {
  37480. value: t,
  37481. enumerable: !1,
  37482. writable: !0,
  37483. configurable: !0
  37484. }
  37485. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  37486. }
  37487. var u = new Float32Array(16),
  37488. _ = new Float32Array(16),
  37489. f = new Float32Array(16),
  37490. d = new Float32Array(4),
  37491. p = new Float32Array(64),
  37492. m = [],
  37493. y = new Float32Array(4),
  37494. v = cc.v4(0, 0, 0, 0),
  37495. g = cc.v3(0, 0, 0),
  37496. x = cc.v3(0, 0, 0),
  37497. b = new o.RecyclePool(function() {
  37498. return new Float32Array(16)
  37499. }, 8),
  37500. A = (function(t) {
  37501. function e(i, n) {
  37502. l(this, e);
  37503. var r = h(this, t.call(this, i, n));
  37504. return r._time = new Float32Array(4), r._directionalLights = [], r._pointLights = [], r._spotLights = [], r._shadowLights = [], r._ambientLights = [], r._shadowMaps = [], r._shadowMapSlots = new Int32Array(4), r._numLights = 0, r._defines = {}, r._registerStage("shadowcast", r._shadowStage.bind(r)), r._registerStage("opaque", r._opaqueStage.bind(r)), r._registerStage("transparent", r._transparentStage.bind(r)), r
  37505. }
  37506. return c(e, t), e.prototype.reset = function() {
  37507. b.reset(), t.prototype.reset.call(this)
  37508. }, e.prototype.render = function(t, e) {
  37509. this.reset(), this._time[0] += e, this._device.setUniform("cc_time", this._time), this._updateLights(t);
  37510. for (var i = this._device._gl.canvas, n = 0; n < t._cameras.length; ++n) {
  37511. var r = this._requestView(),
  37512. s = i.width,
  37513. o = i.height;
  37514. t._cameras.data[n].extractView(r, s, o)
  37515. }
  37516. this._viewPools.sort((function(t, e) {
  37517. return t._priority - e._priority
  37518. }));
  37519. for (var a = 0; a < this._viewPools.length; ++a) {
  37520. var l = this._viewPools.data[a];
  37521. this._render(l, t)
  37522. }
  37523. }, e.prototype.renderCamera = function(t, e) {
  37524. this.reset();
  37525. var i = this._device._gl.canvas,
  37526. n = i.width,
  37527. r = i.height,
  37528. s = this._requestView();
  37529. t.extractView(s, n, r), this._render(s, e)
  37530. }, e.prototype._updateLights = function(t) {
  37531. this._directionalLights.length = 0, this._pointLights.length = 0, this._spotLights.length = 0, this._shadowLights.length = 0, this._ambientLights.length = 0;
  37532. for (var e = t._lights, i = 0; i < e.length; ++i) {
  37533. var n = e.data[i];
  37534. if (n.update(this._device), n.shadowType !== s.default.SHADOW_NONE) {
  37535. this._shadowLights.push(n);
  37536. var r = this._requestView();
  37537. n.extractView(r, ["shadowcast"])
  37538. }
  37539. n._type === s.default.LIGHT_DIRECTIONAL ? this._directionalLights.push(n) : n._type === s.default.LIGHT_POINT ? this._pointLights.push(n) : n._type === s.default.LIGHT_SPOT ? this._spotLights.push(n) : this._ambientLights.push(n)
  37540. }
  37541. this._updateDefines(), this._numLights = e._count
  37542. }, e.prototype._updateDefines = function() {
  37543. var t = this._defines;
  37544. t.CC_NUM_DIR_LIGHTS = Math.min(4, this._directionalLights.length), t.CC_NUM_POINT_LIGHTS = Math.min(4, this._pointLights.length), t.CC_NUM_SPOT_LIGHTS = Math.min(4, this._spotLights.length), t.CC_NUM_AMBIENT_LIGHTS = Math.min(4, this._ambientLights.length), t.CC_NUM_SHADOW_LIGHTS = Math.min(4, this._shadowLights.length)
  37545. }, e.prototype._submitLightsUniforms = function() {
  37546. var t = this._device;
  37547. if (this._directionalLights.length > 0) {
  37548. for (var e = b.add(), i = b.add(), n = Math.min(4, this._directionalLights.length), r = 0; r < n; ++r) {
  37549. var s = this._directionalLights[r],
  37550. o = 4 * r;
  37551. e.set(s._directionUniform, o), i.set(s._colorUniform, o)
  37552. }
  37553. t.setUniform("cc_dirLightDirection", e), t.setUniform("cc_dirLightColor", i)
  37554. }
  37555. if (this._pointLights.length > 0) {
  37556. for (var a = b.add(), l = b.add(), h = Math.min(4, this._pointLights.length), c = 0; c < h; ++c) {
  37557. var u = this._pointLights[c],
  37558. _ = 4 * c;
  37559. a.set(u._positionUniform, _), a[_ + 3] = u._range, l.set(u._colorUniform, _)
  37560. }
  37561. t.setUniform("cc_pointLightPositionAndRange", a), t.setUniform("cc_pointLightColor", l)
  37562. }
  37563. if (this._spotLights.length > 0) {
  37564. for (var f = b.add(), d = b.add(), p = b.add(), m = Math.min(4, this._spotLights.length), y = 0; y < m; ++y) {
  37565. var v = this._spotLights[y],
  37566. g = 4 * y;
  37567. f.set(v._positionUniform, g), f[g + 3] = v._range, d.set(v._directionUniform, g), d[g + 3] = v._spotUniform[0], p.set(v._colorUniform, g), p[g + 3] = v._spotUniform[1]
  37568. }
  37569. t.setUniform("cc_spotLightPositionAndRange", f), t.setUniform("cc_spotLightDirection", d), t.setUniform("cc_spotLightColor", p)
  37570. }
  37571. if (this._ambientLights.length > 0) {
  37572. for (var x = b.add(), A = Math.min(4, this._ambientLights.length), C = 0; C < A; ++C) {
  37573. var T = this._ambientLights[C],
  37574. S = 4 * C;
  37575. x.set(T._colorUniform, S)
  37576. }
  37577. t.setUniform("cc_ambientColor", x)
  37578. }
  37579. }, e.prototype._submitShadowStageUniforms = function(t) {
  37580. var e = t._shadowLight,
  37581. i = y;
  37582. i[0] = e.shadowMinDepth, i[1] = e.shadowMaxDepth, i[2] = e.shadowDepthScale, i[3] = e.shadowDarkness, this._device.setUniform("cc_shadow_map_lightViewProjMatrix", n.mat4.array(f, t._matViewProj)), this._device.setUniform("cc_shadow_map_info", i), this._device.setUniform("cc_shadow_map_bias", e.shadowBias)
  37583. }, e.prototype._submitOtherStagesUniforms = function() {
  37584. for (var t = b.add(), e = 0; e < this._shadowLights.length; ++e) {
  37585. var i = this._shadowLights[e],
  37586. r = m[e];
  37587. r || (r = m[e] = new Float32Array(p.buffer, 16 * e, 16)), n.mat4.array(r, i.viewProjMatrix);
  37588. var s = 4 * e;
  37589. t[s] = i.shadowMinDepth, t[s + 1] = i.shadowMaxDepth, t[s + 2] = i.shadowDepthScale, t[s + 3] = i.shadowDarkness
  37590. }
  37591. this._device.setUniform("cc_shadow_lightViewProjMatrix", p), this._device.setUniform("cc_shadow_info", t)
  37592. }, e.prototype._updateShaderDefines = function(t) {
  37593. t.defines.push(this._defines)
  37594. }, e.prototype._sortItems = function(t) {
  37595. t.sort((function(t, e) {
  37596. var i = t.technique,
  37597. n = e.technique;
  37598. return i._layer !== n._layer ? i._layer - n._layer : i._passes.length !== n._passes.length ? i._passes.length - n._passes.length : t.sortKey - e.sortKey
  37599. }))
  37600. }, e.prototype._shadowStage = function(t, e) {
  37601. this._submitShadowStageUniforms(t);
  37602. for (var i = 0; i < e.length; ++i) {
  37603. var n = e.data[i];
  37604. this._programLib._getValueFromDefineList("CC_SHADOW_CASTING", n.defines) && (this._updateShaderDefines(n), this._draw(n))
  37605. }
  37606. }, e.prototype._drawItems = function(t, e) {
  37607. var i = this._shadowLights;
  37608. if (0 === i.length && 0 === this._numLights)
  37609. for (var n = 0; n < e.length; ++n) {
  37610. var r = e.data[n];
  37611. this._updateShaderDefines(r), this._draw(r)
  37612. } else
  37613. for (var s = 0; s < e.length; ++s) {
  37614. var o = e.data[s];
  37615. this._shadowMaps.length = i.length;
  37616. for (var a = 0; a < i.length; ++a) {
  37617. var l = i[a];
  37618. this._shadowMaps[a] = l.shadowMap, this._shadowMapSlots[a] = this._allocTextureUnit()
  37619. }
  37620. this._device.setTextureArray("cc_shadow_map", this._shadowMaps, this._shadowMapSlots), this._updateShaderDefines(o), this._draw(o)
  37621. }
  37622. }, e.prototype._opaqueStage = function(t, e) {
  37623. t.getPosition(v), this._device.setUniform("cc_matView", n.mat4.array(u, t._matView)), this._device.setUniform("cc_matpProj", n.mat4.array(_, t._matProj)), this._device.setUniform("cc_matViewProj", n.mat4.array(f, t._matViewProj)), this._device.setUniform("cc_cameraPos", n.vec4.array(d, v)), this._submitLightsUniforms(), this._submitOtherStagesUniforms(), this._drawItems(t, e)
  37624. }, e.prototype._transparentStage = function(t, e) {
  37625. t.getPosition(v), t.getForward(g), this._device.setUniform("cc_matView", n.mat4.array(u, t._matView)), this._device.setUniform("cc_matpProj", n.mat4.array(_, t._matProj)), this._device.setUniform("cc_matViewProj", n.mat4.array(f, t._matViewProj)), this._device.setUniform("cc_cameraPos", n.vec4.array(d, v)), this._submitLightsUniforms(), this._submitOtherStagesUniforms();
  37626. for (var i = 0; i < e.length; ++i) {
  37627. var r = e.data[i];
  37628. r.node.getWorldPosition(x), n.vec3.sub(x, x, v), r.sortKey = -n.vec3.dot(x, g)
  37629. }
  37630. this._sortItems(e), this._drawItems(t, e)
  37631. }, e
  37632. })(r.default);
  37633. i.default = A, e.exports = i.default
  37634. }), {
  37635. "../../core/vmath": 326,
  37636. "../core/base-renderer": 348,
  37637. "../enums": 355,
  37638. "../memop": 372
  37639. }],
  37640. 380: [(function(t, e, i) {
  37641. "use strict";
  37642. i.__esModule = !0, i.default = void 0;
  37643. var n = (function() {
  37644. function t(t, e) {
  37645. for (var i = 0; i < e.length; i++) {
  37646. var n = e[i];
  37647. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  37648. }
  37649. }
  37650. return function(e, i, n) {
  37651. return i && t(e.prototype, i), n && t(e, n), e
  37652. }
  37653. })(),
  37654. r = t("../../core/vmath"),
  37655. s = a(t("../../core/geom-utils")),
  37656. o = a(t("../enums"));
  37657. function a(t) {
  37658. return t && t.__esModule ? t : {
  37659. default: t
  37660. }
  37661. }
  37662. function l(t, e) {
  37663. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  37664. }
  37665. var h = r.mat4.create(),
  37666. c = r.mat4.create(),
  37667. u = r.mat4.create(),
  37668. _ = r.mat4.create(),
  37669. f = r.mat4.create(),
  37670. d = cc.v3(),
  37671. p = cc.v3(),
  37672. m = (function() {
  37673. function t() {
  37674. l(this, t), this._poolID = -1, this._node = null, this._projection = o.default.PROJ_PERSPECTIVE, this._priority = 0, this._color = r.color4.create(.2, .3, .47, 1), this._depth = 1, this._stencil = 0, this._clearFlags = o.default.CLEAR_COLOR | o.default.CLEAR_DEPTH, this._clearModel = null, this._stages = [], this._framebuffer = null, this._near = .01, this._far = 1e3, this._fov = Math.PI / 4, this._rect = {
  37675. x: 0,
  37676. y: 0,
  37677. w: 1,
  37678. h: 1
  37679. }, this._orthoHeight = 10, this._cullingMask = 4294967295
  37680. }
  37681. return t.prototype.setCullingMask = function(t) {
  37682. this._cullingMask = t
  37683. }, t.prototype.getNode = function() {
  37684. return this._node
  37685. }, t.prototype.setNode = function(t) {
  37686. this._node = t
  37687. }, t.prototype.getType = function() {
  37688. return this._projection
  37689. }, t.prototype.setType = function(t) {
  37690. this._projection = t
  37691. }, t.prototype.getPriority = function() {
  37692. return this._priority
  37693. }, t.prototype.setPriority = function(t) {
  37694. this._priority = t
  37695. }, t.prototype.getOrthoHeight = function() {
  37696. return this._orthoHeight
  37697. }, t.prototype.setOrthoHeight = function(t) {
  37698. this._orthoHeight = t
  37699. }, t.prototype.getFov = function() {
  37700. return this._fov
  37701. }, t.prototype.setFov = function(t) {
  37702. this._fov = t
  37703. }, t.prototype.getNear = function() {
  37704. return this._near
  37705. }, t.prototype.setNear = function(t) {
  37706. this._near = t
  37707. }, t.prototype.getFar = function() {
  37708. return this._far
  37709. }, t.prototype.setFar = function(t) {
  37710. this._far = t
  37711. }, t.prototype.getColor = function(t) {
  37712. return r.color4.copy(t, this._color)
  37713. }, t.prototype.setColor = function(t, e, i, n) {
  37714. r.color4.set(this._color, t, e, i, n)
  37715. }, t.prototype.getDepth = function() {
  37716. return this._depth
  37717. }, t.prototype.setDepth = function(t) {
  37718. this._depth = t
  37719. }, t.prototype.getStencil = function() {
  37720. return this._stencil
  37721. }, t.prototype.setStencil = function(t) {
  37722. this._stencil = t
  37723. }, t.prototype.getClearFlags = function() {
  37724. return this._clearFlags
  37725. }, t.prototype.setClearFlags = function(t) {
  37726. this._clearFlags = t
  37727. }, t.prototype.getRect = function(t) {
  37728. return t.x = this._rect.x, t.y = this._rect.y, t.w = this._rect.w, t.h = this._rect.h, t
  37729. }, t.prototype.setRect = function(t, e, i, n) {
  37730. this._rect.x = t, this._rect.y = e, this._rect.w = i, this._rect.h = n
  37731. }, t.prototype.getStages = function() {
  37732. return this._stages
  37733. }, t.prototype.setStages = function(t) {
  37734. this._stages = t
  37735. }, t.prototype.getFramebuffer = function() {
  37736. return this._framebuffer
  37737. }, t.prototype.setFrameBuffer = function(t) {
  37738. this._framebuffer = t
  37739. }, t.prototype._calcMatrices = function(t, e) {
  37740. this._node.getWorldRT(c), r.mat4.invert(c, c);
  37741. var i = t / e;
  37742. if (this._projection === o.default.PROJ_PERSPECTIVE) r.mat4.perspective(u, this._fov, i, this._near, this._far);
  37743. else {
  37744. var n = this._orthoHeight * i,
  37745. s = this._orthoHeight;
  37746. r.mat4.ortho(u, -n, n, -s, s, this._near, this._far)
  37747. }
  37748. r.mat4.mul(_, u, c), r.mat4.invert(f, _)
  37749. }, t.prototype.extractView = function(t, e, i) {
  37750. this._framebuffer && (e = this._framebuffer._width, i = this._framebuffer._height), t._priority = this._priority, t._rect.x = this._rect.x * e, t._rect.y = this._rect.y * i, t._rect.w = this._rect.w * e, t._rect.h = this._rect.h * i, this.getColor(t._color), t._depth = this._depth, t._stencil = this._stencil, t._clearFlags = this._clearFlags, t._clearModel = this._clearModel, t._stages = this._stages, t._framebuffer = this._framebuffer, this._calcMatrices(e, i), r.mat4.copy(t._matView, c), r.mat4.copy(t._matProj, u), r.mat4.copy(t._matViewProj, _), r.mat4.copy(t._matInvViewProj, f), t._cullingMask = this._cullingMask
  37751. }, t.prototype.screenPointToRay = function(t, e, i, n, a) {
  37752. if (!s.default) return a;
  37753. a = a || s.default.Ray.create(), this._calcMatrices(i, n);
  37754. var l = this._rect.x * i,
  37755. h = this._rect.y * n,
  37756. c = this._rect.w * i,
  37757. u = this._rect.h * n;
  37758. return r.vec3.set(p, (t - l) / c * 2 - 1, (e - h) / u * 2 - 1, 1), r.vec3.transformMat4(p, p, f), this._projection === o.default.PROJ_PERSPECTIVE ? this._node.getWorldPosition(d) : (r.vec3.set(d, (t - l) / c * 2 - 1, (e - h) / u * 2 - 1, -1), r.vec3.transformMat4(d, d, f)), s.default.Ray.fromPoints(a, d, p)
  37759. }, t.prototype.screenToWorld = function(t, e, i, n) {
  37760. this._calcMatrices(i, n);
  37761. var s = this._rect.x * i,
  37762. a = this._rect.y * n,
  37763. l = this._rect.w * i,
  37764. h = this._rect.h * n;
  37765. return this._projection === o.default.PROJ_PERSPECTIVE ? (r.vec3.set(t, (e.x - s) / l * 2 - 1, (e.y - a) / h * 2 - 1, .9999), r.vec3.transformMat4(t, t, f), this._node.getWorldPosition(d), r.vec3.lerp(t, d, t, (0, r.lerp)(this._near / this._far, 1, e.z))) : (r.vec3.set(t, (e.x - s) / l * 2 - 1, (e.y - a) / h * 2 - 1, 2 * e.z - 1), r.vec3.transformMat4(t, t, f)), t
  37766. }, t.prototype.worldToScreen = function(t, e, i, n) {
  37767. this._calcMatrices(i, n);
  37768. var s = this._rect.x * i,
  37769. o = this._rect.y * n,
  37770. a = this._rect.w * i,
  37771. l = this._rect.h * n;
  37772. return r.vec3.transformMat4(t, e, _), t.x = s + .5 * (t.x + 1) * a, t.y = o + .5 * (t.y + 1) * l, t.z = .5 * t.z + .5, t
  37773. }, t.prototype.worldMatrixToScreen = function(t, e, i, n) {
  37774. this._calcMatrices(i, n), r.mat4.mul(t, _, e);
  37775. var s = i / 2,
  37776. o = n / 2;
  37777. return r.mat4.identity(h), r.mat4.translate(h, h, r.vec3.set(d, s, o, 0)), r.mat4.scale(h, h, r.vec3.set(d, s, o, 1)), r.mat4.mul(t, h, t), t
  37778. }, n(t, [{
  37779. key: "cullingMask",
  37780. get: function() {
  37781. return this._cullingMask
  37782. },
  37783. set: function(t) {
  37784. this._cullingMask = t
  37785. }
  37786. }]), t
  37787. })();
  37788. i.default = m, e.exports = i.default
  37789. }), {
  37790. "../../core/geom-utils": 136,
  37791. "../../core/vmath": 326,
  37792. "../enums": 355
  37793. }],
  37794. 381: [(function(t, e, i) {
  37795. "use strict";
  37796. i.__esModule = !0, i.default = void 0;
  37797. var n = (function() {
  37798. function t(t, e) {
  37799. for (var i = 0; i < e.length; i++) {
  37800. var n = e[i];
  37801. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
  37802. }
  37803. }
  37804. return function(e, i, n) {
  37805. return i && t(e.prototype, i), n && t(e, n), e
  37806. }
  37807. })(),
  37808. r = t("../../core/vmath"),
  37809. s = a(t("../gfx")),
  37810. o = a(t("../enums"));
  37811. function a(t) {
  37812. return t && t.__esModule ? t : {
  37813. default: t
  37814. }
  37815. }
  37816. function l(t, e) {
  37817. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  37818. }
  37819. var h = r.vec3.create(0, 0, -1),
  37820. c = r.mat4.create(),
  37821. u = r.mat3.create(),
  37822. _ = r.vec3.create(0, 0, 0);
  37823. function f(t, e, i) {
  37824. t._node.getWorldRT(e), r.mat4.invert(e, e), r.mat4.perspective(i, t._spotAngle * t._spotAngleScale, 1, t._shadowMinDepth, t._shadowMaxDepth)
  37825. }
  37826. function d(t, e, i) {
  37827. t._node.getWorldRT(e), r.mat4.invert(e, e);
  37828. var n = t._shadowFrustumSize / 2;
  37829. r.mat4.ortho(i, -n, n, -n, n, t._shadowMinDepth, t._shadowMaxDepth)
  37830. }
  37831. function p(t, e, i) {
  37832. t._node.getWorldRT(e), r.mat4.invert(e, e), r.mat4.perspective(i, (0, r.toRadian)(179), 1, t._shadowMinDepth, t._shadowMaxDepth)
  37833. }
  37834. var m = (function() {
  37835. function t() {
  37836. l(this, t), this._poolID = -1, this._node = null, this._type = o.default.LIGHT_DIRECTIONAL, this._color = r.color3.create(1, 1, 1), this._intensity = 1, this._range = 1, this._spotAngle = (0, r.toRadian)(60), this._spotExp = 1, this._directionUniform = new Float32Array(3), this._positionUniform = new Float32Array(3), this._colorUniform = new Float32Array([this._color.r * this._intensity, this._color.g * this._intensity, this._color.b * this._intensity]), this._spotUniform = new Float32Array([Math.cos(.5 * this._spotAngle), this._spotExp]), this._shadowType = o.default.SHADOW_NONE, this._shadowFrameBuffer = null, this._shadowMap = null, this._shadowMapDirty = !1, this._shadowDepthBuffer = null, this._shadowResolution = 1024, this._shadowBias = 5e-4, this._shadowDarkness = 1, this._shadowMinDepth = 1, this._shadowMaxDepth = 1e3, this._shadowDepthScale = 50, this._frustumEdgeFalloff = 0, this._viewProjMatrix = r.mat4.create(), this._spotAngleScale = 1, this._shadowFrustumSize = 50
  37837. }
  37838. return t.prototype.getNode = function() {
  37839. return this._node
  37840. }, t.prototype.setNode = function(t) {
  37841. this._node = t
  37842. }, t.prototype.setColor = function(t, e, i) {
  37843. r.color3.set(this._color, t, e, i), this._colorUniform[0] = t * this._intensity, this._colorUniform[1] = e * this._intensity, this._colorUniform[2] = i * this._intensity
  37844. }, t.prototype.setIntensity = function(t) {
  37845. this._intensity = t, this._colorUniform[0] = t * this._color.r, this._colorUniform[1] = t * this._color.g, this._colorUniform[2] = t * this._color.b
  37846. }, t.prototype.setType = function(t) {
  37847. this._type = t
  37848. }, t.prototype.setSpotAngle = function(t) {
  37849. this._spotAngle = t, this._spotUniform[0] = Math.cos(.5 * this._spotAngle)
  37850. }, t.prototype.setSpotExp = function(t) {
  37851. this._spotExp = t, this._spotUniform[1] = t
  37852. }, t.prototype.setRange = function(t) {
  37853. this._range = t
  37854. }, t.prototype.setShadowType = function(t) {
  37855. this._shadowType === o.default.SHADOW_NONE && t !== o.default.SHADOW_NONE && (this._shadowMapDirty = !0), this._shadowType = t
  37856. }, t.prototype.setShadowResolution = function(t) {
  37857. this._shadowResolution !== t && (this._shadowMapDirty = !0), this._shadowResolution = t
  37858. }, t.prototype.setShadowBias = function(t) {
  37859. this._shadowBias = t
  37860. }, t.prototype.setShadowDarkness = function(t) {
  37861. this._shadowDarkness = t
  37862. }, t.prototype.setShadowMinDepth = function(t) {
  37863. this._shadowMinDepth = t
  37864. }, t.prototype.setShadowMaxDepth = function(t) {
  37865. this._shadowMaxDepth = t
  37866. }, t.prototype.setShadowDepthScale = function(t) {
  37867. this._shadowDepthScale = t
  37868. }, t.prototype.setFrustumEdgeFalloff = function(t) {
  37869. this._frustumEdgeFalloff = t
  37870. }, t.prototype.setShadowFrustumSize = function(t) {
  37871. this._shadowFrustumSize = t
  37872. }, t.prototype.extractView = function(t, e) {
  37873. switch (t._shadowLight = this, t._priority = -1, t._rect.x = 0, t._rect.y = 0, t._rect.w = this._shadowResolution, t._rect.h = this._shadowResolution, r.color4.set(t._color, 1, 1, 1, 1), t._depth = 1, t._stencil = 1, t._clearFlags = o.default.CLEAR_COLOR | o.default.CLEAR_DEPTH, t._stages = e, t._framebuffer = this._shadowFrameBuffer, this._type) {
  37874. case o.default.LIGHT_SPOT:
  37875. f(this, t._matView, t._matProj);
  37876. break;
  37877. case o.default.LIGHT_DIRECTIONAL:
  37878. d(this, t._matView, t._matProj);
  37879. break;
  37880. case o.default.LIGHT_POINT:
  37881. p(this, t._matView, t._matProj);
  37882. break;
  37883. case o.default.LIGHT_AMBIENT:
  37884. break;
  37885. default:
  37886. console.warn("shadow of this light type is not supported")
  37887. }
  37888. r.mat4.mul(t._matViewProj, t._matProj, t._matView), this._viewProjMatrix = t._matViewProj, r.mat4.invert(t._matInvViewProj, t._matViewProj), t._cullingMask = 4294967295
  37889. }, t.prototype._updateLightPositionAndDirection = function() {
  37890. this._node.getWorldMatrix(c), r.mat3.fromMat4(u, c), r.vec3.transformMat3(_, h, u), r.vec3.array(this._directionUniform, _);
  37891. var t = this._positionUniform,
  37892. e = c.m;
  37893. t[0] = e[12], t[1] = e[13], t[2] = e[14]
  37894. }, t.prototype._generateShadowMap = function(t) {
  37895. this._shadowMap = new s.default.Texture2D(t, {
  37896. width: this._shadowResolution,
  37897. height: this._shadowResolution,
  37898. format: s.default.TEXTURE_FMT_RGBA8,
  37899. wrapS: s.default.WRAP_CLAMP,
  37900. wrapT: s.default.WRAP_CLAMP
  37901. }), this._shadowDepthBuffer = new s.default.RenderBuffer(t, s.default.RB_FMT_D16, this._shadowResolution, this._shadowResolution), this._shadowFrameBuffer = new s.default.FrameBuffer(t, this._shadowResolution, this._shadowResolution, {
  37902. colors: [this._shadowMap],
  37903. depth: this._shadowDepthBuffer
  37904. })
  37905. }, t.prototype._destroyShadowMap = function() {
  37906. this._shadowMap && (this._shadowMap.destroy(), this._shadowDepthBuffer.destroy(), this._shadowFrameBuffer.destroy(), this._shadowMap = null, this._shadowDepthBuffer = null, this._shadowFrameBuffer = null)
  37907. }, t.prototype.update = function(t) {
  37908. this._updateLightPositionAndDirection(), this._shadowType === o.default.SHADOW_NONE ? this._destroyShadowMap() : this._shadowMapDirty && (this._destroyShadowMap(), this._generateShadowMap(t), this._shadowMapDirty = !1)
  37909. }, n(t, [{
  37910. key: "color",
  37911. get: function() {
  37912. return this._color
  37913. }
  37914. }, {
  37915. key: "intensity",
  37916. get: function() {
  37917. return this._intensity
  37918. }
  37919. }, {
  37920. key: "type",
  37921. get: function() {
  37922. return this._type
  37923. }
  37924. }, {
  37925. key: "spotAngle",
  37926. get: function() {
  37927. return this._spotAngle
  37928. }
  37929. }, {
  37930. key: "spotExp",
  37931. get: function() {
  37932. return this._spotExp
  37933. }
  37934. }, {
  37935. key: "range",
  37936. get: function() {
  37937. return this._range
  37938. }
  37939. }, {
  37940. key: "shadowType",
  37941. get: function() {
  37942. return this._shadowType
  37943. }
  37944. }, {
  37945. key: "shadowMap",
  37946. get: function() {
  37947. return this._shadowMap
  37948. }
  37949. }, {
  37950. key: "viewProjMatrix",
  37951. get: function() {
  37952. return this._viewProjMatrix
  37953. }
  37954. }, {
  37955. key: "shadowResolution",
  37956. get: function() {
  37957. return this._shadowResolution
  37958. }
  37959. }, {
  37960. key: "shadowBias",
  37961. get: function() {
  37962. return this._shadowBias
  37963. }
  37964. }, {
  37965. key: "shadowDarkness",
  37966. get: function() {
  37967. return this._shadowDarkness
  37968. }
  37969. }, {
  37970. key: "shadowMinDepth",
  37971. get: function() {
  37972. return this._type === o.default.LIGHT_DIRECTIONAL ? 1 : this._shadowMinDepth
  37973. }
  37974. }, {
  37975. key: "shadowMaxDepth",
  37976. get: function() {
  37977. return this._type === o.default.LIGHT_DIRECTIONAL ? 1 : this._shadowMaxDepth
  37978. }
  37979. }, {
  37980. key: "shadowDepthScale",
  37981. get: function() {
  37982. return this._shadowDepthScale
  37983. }
  37984. }, {
  37985. key: "frustumEdgeFalloff",
  37986. get: function() {
  37987. return this._frustumEdgeFalloff
  37988. }
  37989. }, {
  37990. key: "shadowFrustumSize",
  37991. get: function() {
  37992. return this._shadowFrustumSize
  37993. }
  37994. }]), t
  37995. })();
  37996. i.default = m, e.exports = i.default
  37997. }), {
  37998. "../../core/vmath": 326,
  37999. "../enums": 355,
  38000. "../gfx": 360
  38001. }],
  38002. 382: [(function(t, e, i) {
  38003. "use strict";
  38004. function n(t, e) {
  38005. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  38006. }
  38007. i.__esModule = !0;
  38008. var r = (function() {
  38009. function t() {
  38010. n(this, t), this._type = "default", this._poolID = -1, this._node = null, this._inputAssembler = null, this._effect = null, this._viewID = -1, this._cameraID = -1, this._userKey = -1, this._castShadow = !1, this._boundingShape = null, this._defines = [], this._uniforms = []
  38011. }
  38012. return t.prototype.setNode = function(t) {
  38013. this._node = t
  38014. }, t.prototype.setInputAssembler = function(t) {
  38015. this._inputAssembler = t
  38016. }, t.prototype.setEffect = function(t, e) {
  38017. this._effect = t;
  38018. var i = this._defines,
  38019. n = this._uniforms;
  38020. i.length = 0, n.length = 0, t && (i.push(t._defines), n.push(t._properties)), e && (i.push(e._defines), n.push(e._properties))
  38021. }, t.prototype.setUserKey = function(t) {
  38022. this._userKey = t
  38023. }, t.prototype.extractDrawItem = function(t) {
  38024. t.model = this, t.node = this._node, t.ia = this._inputAssembler, t.effect = this._effect, t.defines = this._defines, t.dependencies = this._dependencies, t.uniforms = this._uniforms
  38025. }, t
  38026. })();
  38027. i.default = r, e.exports = i.default
  38028. }), {}],
  38029. 383: [(function(t, e, i) {
  38030. "use strict";
  38031. i.__esModule = !0;
  38032. var n = t("../memop");
  38033. function r(t, e) {
  38034. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  38035. }
  38036. var s = (function() {
  38037. function t(e) {
  38038. r(this, t), this._lights = new n.FixedArray(16), this._models = new n.FixedArray(16), this._cameras = new n.FixedArray(16), this._debugCamera = null, this._app = e, this._views = []
  38039. }
  38040. return t.prototype._add = function(t, e) {
  38041. -1 === e._poolID && (t.push(e), e._poolID = t.length - 1)
  38042. }, t.prototype._remove = function(t, e) {
  38043. -1 !== e._poolID && (t.data[t.length - 1]._poolID = e._poolID, t.fastRemove(e._poolID), e._poolID = -1)
  38044. }, t.prototype.reset = function() {
  38045. for (var t = 0; t < this._models.length; ++t) {
  38046. this._models.data[t]._viewID = -1
  38047. }
  38048. }, t.prototype.setDebugCamera = function(t) {
  38049. this._debugCamera = t
  38050. }, t.prototype.getCameraCount = function() {
  38051. return this._cameras.length
  38052. }, t.prototype.getCamera = function(t) {
  38053. return this._cameras.data[t]
  38054. }, t.prototype.addCamera = function(t) {
  38055. this._add(this._cameras, t)
  38056. }, t.prototype.removeCamera = function(t) {
  38057. this._remove(this._cameras, t)
  38058. }, t.prototype.getModelCount = function() {
  38059. return this._models.length
  38060. }, t.prototype.getModel = function(t) {
  38061. return this._models.data[t]
  38062. }, t.prototype.addModel = function(t) {
  38063. this._add(this._models, t)
  38064. }, t.prototype.removeModel = function(t) {
  38065. this._remove(this._models, t)
  38066. }, t.prototype.getLightCount = function() {
  38067. return this._lights.length
  38068. }, t.prototype.getLight = function(t) {
  38069. return this._lights.data[t]
  38070. }, t.prototype.addLight = function(t) {
  38071. this._add(this._lights, t)
  38072. }, t.prototype.removeLight = function(t) {
  38073. this._remove(this._lights, t)
  38074. }, t.prototype.addView = function(t) {
  38075. -1 === this._views.indexOf(t) && this._views.push(t)
  38076. }, t.prototype.removeView = function(t) {
  38077. var e = this._views.indexOf(t); - 1 !== e && this._views.splice(e, 1)
  38078. }, t
  38079. })();
  38080. i.default = s, e.exports = i.default
  38081. }), {
  38082. "../memop": 372
  38083. }],
  38084. 384: [(function(t, e, i) {
  38085. "use strict";
  38086. var n, r, s, o;
  38087. i.__esModule = !0, i.getClassName = i.getInstanceCtor = i.getInstanceType = i.enums2default = i.ctor2enums = void 0, i.getInspectorProps = function(t) {
  38088. var e = {
  38089. type: t.type
  38090. };
  38091. Object.assign(e, t.inspector), e.defines = t.defines, e.value = m(e.type)(t.value);
  38092. var i = y(e.type);
  38093. e.typeName = v[i] || i, "cc.Texture2D" == e.typeName && (e.typeName = "cc.Asset", e.assetType = "cc.Texture2D");
  38094. return e
  38095. };
  38096. var a = c(t("./enums")),
  38097. l = t("../core/value-types"),
  38098. h = c(t("../core/assets/CCTexture2D"));
  38099. function c(t) {
  38100. return t && t.__esModule ? t : {
  38101. default: t
  38102. }
  38103. }
  38104. var u = null;
  38105. u = t("./gfx/texture-2d");
  38106. var _ = cc.Object,
  38107. f = ((n = {})[Boolean] = function(t) {
  38108. return t || !1
  38109. }, n[Number] = function(t) {
  38110. return t ? ArrayBuffer.isView(t) ? t[0] : t : 0
  38111. }, n[l.Vec2] = function(t) {
  38112. return t ? cc.v2(t[0], t[1]) : cc.v2()
  38113. }, n[l.Vec3] = function(t) {
  38114. return t ? cc.v3(t[0], t[1], t[2]) : cc.v3()
  38115. }, n[l.Vec4] = function(t) {
  38116. return t ? cc.v4(t[0], t[1], t[2], t[3]) : cc.v4()
  38117. }, n[l.Color] = function(t) {
  38118. return t ? cc.color(255 * t[0], 255 * t[1], 255 * t[2], 255 * (t[3] || 1)) : cc.color()
  38119. }, n[l.Mat4] = function(t) {
  38120. return t ? cc.mat4(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]) : cc.mat4()
  38121. }, n[h.default] = function() {
  38122. return null
  38123. }, n[_] = function() {
  38124. return null
  38125. }, n),
  38126. d = ((r = {})[a.default.PARAM_INT] = Number, r[a.default.PARAM_INT2] = l.Vec2, r[a.default.PARAM_INT3] = l.Vec3, r[a.default.PARAM_INT4] = l.Vec4, r[a.default.PARAM_FLOAT] = Number, r[a.default.PARAM_FLOAT2] = l.Vec2, r[a.default.PARAM_FLOAT3] = l.Vec3, r[a.default.PARAM_FLOAT4] = l.Vec4, r[a.default.PARAM_MAT4] = l.Mat4, r[a.default.PARAM_TEXTURE_2D] = h.default, r.color = l.Color, r.number = Number, r.boolean = Boolean, r.default = _, r),
  38127. p = (i.ctor2enums = ((s = {})[Number] = a.default.PARAM_FLOAT, s[l.Vec2] = a.default.PARAM_FLOAT2, s[l.Vec3] = a.default.PARAM_FLOAT3, s[l.Vec4] = a.default.PARAM_FLOAT4, s[l.Color] = a.default.PARAM_COLOR3, s[l.Color] = a.default.PARAM_COLOR4, s[l.Mat4] = a.default.PARAM_MAT4, s[h.default] = a.default.PARAM_TEXTURE_2D, s[u] = a.default.PARAM_TEXTURE_2D, s), i.enums2default = ((o = {})[a.default.PARAM_INT] = new Uint32Array([0]), o[a.default.PARAM_INT2] = new Uint32Array([0, 0]), o[a.default.PARAM_INT3] = new Uint32Array([0, 0, 0]), o[a.default.PARAM_INT4] = new Uint32Array([0, 0, 0, 0]), o[a.default.PARAM_FLOAT] = new Float32Array([0]), o[a.default.PARAM_FLOAT2] = new Float32Array([0, 0]), o[a.default.PARAM_FLOAT3] = new Float32Array([0, 0, 0]), o[a.default.PARAM_FLOAT4] = new Float32Array([0, 0, 0, 0]), o[a.default.PARAM_MAT4] = cc.mat4().m, o[a.default.PARAM_TEXTURE_2D] = null, o.number = 0, o.boolean = !1, o), i.getInstanceType = function(t) {
  38128. return d[t] || d.default
  38129. }),
  38130. m = i.getInstanceCtor = function(t) {
  38131. return f[p(t)]
  38132. },
  38133. y = i.getClassName = function(t) {
  38134. return cc.js.getClassName(p(t))
  38135. },
  38136. v = {
  38137. Number: "number",
  38138. Boolean: "boolean"
  38139. }
  38140. }), {
  38141. "../core/assets/CCTexture2D": 73,
  38142. "../core/value-types": 315,
  38143. "./enums": 355,
  38144. "./gfx/texture-2d": 365
  38145. }],
  38146. 385: [(function(t, e, i) {
  38147. "use strict";
  38148. var n = t("../compression/ZipUtils"),
  38149. r = t("../compression/zlib.min"),
  38150. s = t("../core/platform/js");
  38151. function o(t) {
  38152. if (t.length % 4 != 0) return null;
  38153. for (var e = t.length / 4, i = window.Uint32Array ? new Uint32Array(e) : [], n = 0; n < e; n++) {
  38154. var r = 4 * n;
  38155. i[n] = t[r] + 256 * t[r + 1] + 65536 * t[r + 2] + t[r + 3] * (1 << 24)
  38156. }
  38157. return i
  38158. }
  38159. function a(t) {
  38160. var e = cc.Label.HorizontalAlign;
  38161. switch (t) {
  38162. case "center":
  38163. return e.CENTER;
  38164. case "right":
  38165. return e.RIGHT;
  38166. default:
  38167. return e.LEFT
  38168. }
  38169. }
  38170. function l(t) {
  38171. var e = cc.Label.VerticalAlign;
  38172. switch (t) {
  38173. case "center":
  38174. return e.CENTER;
  38175. case "bottom":
  38176. return e.BOTTOM;
  38177. default:
  38178. return e.TOP
  38179. }
  38180. }
  38181. function h(t) {
  38182. if (!t) return cc.color(0, 0, 0, 255);
  38183. if (8 === (t = -1 !== t.indexOf("#") ? t.substring(1) : t).length) {
  38184. var e = parseInt(t.substr(0, 2), 16) || 255,
  38185. i = parseInt(t.substr(2, 2), 16) || 0,
  38186. n = parseInt(t.substr(4, 2), 16) || 0,
  38187. r = parseInt(t.substr(6, 2), 16) || 0;
  38188. return cc.color(i, n, r, e)
  38189. }
  38190. var s = parseInt(t.substr(0, 2), 16) || 0,
  38191. o = parseInt(t.substr(2, 2), 16) || 0,
  38192. a = parseInt(t.substr(4, 2), 16) || 0;
  38193. return cc.color(s, o, a, 255)
  38194. }
  38195. function c(t, e) {
  38196. for (var i = [], n = t.getElementsByTagName("properties"), r = 0; r < n.length; ++r)
  38197. for (var s = n[r].getElementsByTagName("property"), o = 0; o < s.length; ++o) i.push(s[o]);
  38198. e = e || {};
  38199. for (var a = 0; a < i.length; a++) {
  38200. var l = i[a],
  38201. c = l.getAttribute("name"),
  38202. u = l.getAttribute("type") || "string",
  38203. _ = l.getAttribute("value");
  38204. "int" === u ? _ = parseInt(_) : "float" === u ? _ = parseFloat(_) : "bool" === u ? _ = "true" === _ : "color" === u && (_ = h(_)), e[c] = _
  38205. }
  38206. return e
  38207. }
  38208. t("../core/platform/CCSAXParser"), cc.TMXLayerInfo = function() {
  38209. this.properties = {}, this.name = "", this._layerSize = null, this._tiles = [], this.visible = !0, this._opacity = 0, this.ownTiles = !0, this._minGID = 1e5, this._maxGID = 0, this.offset = cc.v2(0, 0)
  38210. }, cc.TMXLayerInfo.prototype = {
  38211. constructor: cc.TMXLayerInfo,
  38212. getProperties: function() {
  38213. return this.properties
  38214. },
  38215. setProperties: function(t) {
  38216. this.properties = t
  38217. }
  38218. }, cc.TMXImageLayerInfo = function() {
  38219. this.name = "", this.visible = !0, this.width = 0, this.height = 0, this.offset = cc.v2(0, 0), this._opacity = 0, this._trans = new cc.Color(255, 255, 255, 255), this.sourceImage = null
  38220. }, cc.TMXObjectGroupInfo = function() {
  38221. this.properties = {}, this.name = "", this._objects = [], this.visible = !0, this._opacity = 0, this._color = new cc.Color(255, 255, 255, 255), this.offset = cc.v2(0, 0), this._draworder = "topdown"
  38222. }, cc.TMXObjectGroupInfo.prototype = {
  38223. constructor: cc.TMXObjectGroupInfo,
  38224. getProperties: function() {
  38225. return this.properties
  38226. },
  38227. setProperties: function(t) {
  38228. this.properties = t
  38229. }
  38230. }, cc.TMXTilesetInfo = function() {
  38231. this.name = "", this.firstGid = 0, this.spacing = 0, this.margin = 0, this.sourceImage = null, this.imageSize = cc.size(0, 0), this.tileOffset = cc.v2(0, 0), this._tileSize = cc.size(0, 0)
  38232. }, cc.TMXTilesetInfo.prototype = {
  38233. constructor: cc.TMXTilesetInfo,
  38234. rectForGID: function(t, e) {
  38235. var i = e || cc.rect(0, 0, 0, 0);
  38236. i.width = this._tileSize.width, i.height = this._tileSize.height, t &= cc.TiledMap.TileFlag.FLIPPED_MASK, t -= parseInt(this.firstGid, 10);
  38237. var n = parseInt((this.imageSize.width - 2 * this.margin + this.spacing) / (this._tileSize.width + this.spacing), 10);
  38238. return i.x = parseInt(t % n * (this._tileSize.width + this.spacing) + this.margin, 10), i.y = parseInt(parseInt(t / n, 10) * (this._tileSize.height + this.spacing) + this.margin, 10), i
  38239. }
  38240. }, cc.TMXMapInfo = function(t, e, i, n) {
  38241. this.properties = [], this.orientation = null, this.parentElement = null, this.parentGID = null, this.layerAttrs = 0, this.storingCharacters = !1, this.currentString = null, this.renderOrder = cc.TiledMap.RenderOrder.RightDown, this._supportVersion = [1, 2, 0], this._parser = new cc.SAXParser, this._objectGroups = [], this._allChildren = [], this._mapSize = cc.size(0, 0), this._tileSize = cc.size(0, 0), this._layers = [], this._tilesets = [], this._imageLayers = [], this._tileProperties = {}, this._tileAnimations = {}, this._tsxMap = null, this._textures = null, this._staggerAxis = null, this._staggerIndex = null, this._hexSideLength = 0, this._imageLayerTextures = null, this.initWithXML(t, e, i, n)
  38242. }, cc.TMXMapInfo.prototype = {
  38243. constructor: cc.TMXMapInfo,
  38244. getOrientation: function() {
  38245. return this.orientation
  38246. },
  38247. setOrientation: function(t) {
  38248. this.orientation = t
  38249. },
  38250. getStaggerAxis: function() {
  38251. return this._staggerAxis
  38252. },
  38253. setStaggerAxis: function(t) {
  38254. this._staggerAxis = t
  38255. },
  38256. getStaggerIndex: function() {
  38257. return this._staggerIndex
  38258. },
  38259. setStaggerIndex: function(t) {
  38260. this._staggerIndex = t
  38261. },
  38262. getHexSideLength: function() {
  38263. return this._hexSideLength
  38264. },
  38265. setHexSideLength: function(t) {
  38266. this._hexSideLength = t
  38267. },
  38268. getMapSize: function() {
  38269. return cc.size(this._mapSize.width, this._mapSize.height)
  38270. },
  38271. setMapSize: function(t) {
  38272. this._mapSize.width = t.width, this._mapSize.height = t.height
  38273. },
  38274. _getMapWidth: function() {
  38275. return this._mapSize.width
  38276. },
  38277. _setMapWidth: function(t) {
  38278. this._mapSize.width = t
  38279. },
  38280. _getMapHeight: function() {
  38281. return this._mapSize.height
  38282. },
  38283. _setMapHeight: function(t) {
  38284. this._mapSize.height = t
  38285. },
  38286. getTileSize: function() {
  38287. return cc.size(this._tileSize.width, this._tileSize.height)
  38288. },
  38289. setTileSize: function(t) {
  38290. this._tileSize.width = t.width, this._tileSize.height = t.height
  38291. },
  38292. _getTileWidth: function() {
  38293. return this._tileSize.width
  38294. },
  38295. _setTileWidth: function(t) {
  38296. this._tileSize.width = t
  38297. },
  38298. _getTileHeight: function() {
  38299. return this._tileSize.height
  38300. },
  38301. _setTileHeight: function(t) {
  38302. this._tileSize.height = t
  38303. },
  38304. getLayers: function() {
  38305. return this._layers
  38306. },
  38307. setLayers: function(t) {
  38308. this._allChildren.push(t), this._layers.push(t)
  38309. },
  38310. getImageLayers: function() {
  38311. return this._imageLayers
  38312. },
  38313. setImageLayers: function(t) {
  38314. this._allChildren.push(t), this._imageLayers.push(t)
  38315. },
  38316. getTilesets: function() {
  38317. return this._tilesets
  38318. },
  38319. setTilesets: function(t) {
  38320. this._tilesets.push(t)
  38321. },
  38322. getObjectGroups: function() {
  38323. return this._objectGroups
  38324. },
  38325. setObjectGroups: function(t) {
  38326. this._allChildren.push(t), this._objectGroups.push(t)
  38327. },
  38328. getAllChildren: function() {
  38329. return this._allChildren
  38330. },
  38331. getParentElement: function() {
  38332. return this.parentElement
  38333. },
  38334. setParentElement: function(t) {
  38335. this.parentElement = t
  38336. },
  38337. getParentGID: function() {
  38338. return this.parentGID
  38339. },
  38340. setParentGID: function(t) {
  38341. this.parentGID = t
  38342. },
  38343. getLayerAttribs: function() {
  38344. return this.layerAttrs
  38345. },
  38346. setLayerAttribs: function(t) {
  38347. this.layerAttrs = t
  38348. },
  38349. getStoringCharacters: function() {
  38350. return this.storingCharacters
  38351. },
  38352. setStoringCharacters: function(t) {
  38353. this.storingCharacters = t
  38354. },
  38355. getProperties: function() {
  38356. return this.properties
  38357. },
  38358. setProperties: function(t) {
  38359. this.properties = t
  38360. },
  38361. initWithXML: function(t, e, i, n) {
  38362. return this._tilesets.length = 0, this._layers.length = 0, this._imageLayers.length = 0, this._tsxMap = e, this._textures = i, this._imageLayerTextures = n, this._objectGroups.length = 0, this._allChildren.length = 0, this.properties.length = 0, this._tileProperties = {}, this._tileAnimations = {}, this.currentString = "", this.storingCharacters = !1, this.layerAttrs = cc.TMXLayerInfo.ATTRIB_NONE, this.parentElement = cc.TiledMap.NONE, this.parseXMLString(t)
  38363. },
  38364. parseXMLString: function(t, e) {
  38365. var i = void 0,
  38366. n = this._parser._parseXML(t).documentElement,
  38367. r = n.getAttribute("orientation"),
  38368. s = n.getAttribute("staggeraxis"),
  38369. o = n.getAttribute("staggerindex"),
  38370. a = n.getAttribute("hexsidelength"),
  38371. l = n.getAttribute("renderorder"),
  38372. h = n.getAttribute("version") || "1.0.0";
  38373. if ("map" === n.nodeName) {
  38374. for (var u = h.split("."), _ = this._supportVersion, f = 0; f < _.length; f++) {
  38375. var d = parseInt(u[f]) || 0;
  38376. if (_[f] < d) {
  38377. cc.logID(7216, h);
  38378. break
  38379. }
  38380. }
  38381. "orthogonal" === r ? this.orientation = cc.TiledMap.Orientation.ORTHO : "isometric" === r ? this.orientation = cc.TiledMap.Orientation.ISO : "hexagonal" === r ? this.orientation = cc.TiledMap.Orientation.HEX : null !== r && cc.logID(7217, r), this.renderOrder = "right-up" === l ? cc.TiledMap.RenderOrder.RightUp : "left-up" === l ? cc.TiledMap.RenderOrder.LeftUp : "left-down" === l ? cc.TiledMap.RenderOrder.LeftDown : cc.TiledMap.RenderOrder.RightDown, "x" === s ? this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_X) : "y" === s && this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_Y), "odd" === o ? this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD) : "even" === o && this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_EVEN), a && this.setHexSideLength(parseFloat(a));
  38382. var p = cc.size(0, 0);
  38383. p.width = parseFloat(n.getAttribute("width")), p.height = parseFloat(n.getAttribute("height")), this.setMapSize(p), (p = cc.size(0, 0)).width = parseFloat(n.getAttribute("tilewidth")), p.height = parseFloat(n.getAttribute("tileheight")), this.setTileSize(p), this.properties = c(n)
  38384. }
  38385. var m = n.getElementsByTagName("tileset");
  38386. for ("map" !== n.nodeName && (m = []).push(n), i = 0; i < m.length; i++) {
  38387. var y = m[i],
  38388. v = y.getAttribute("source");
  38389. if (v) {
  38390. var g = parseInt(y.getAttribute("firstgid")),
  38391. x = this._tsxMap[v];
  38392. x && this.parseXMLString(x, g)
  38393. } else {
  38394. var b = y.getElementsByTagName("image"),
  38395. A = b.length > 1,
  38396. C = b[0],
  38397. T = C.getAttribute("source");
  38398. T.replace(/\\/g, "/");
  38399. var S = y.getElementsByTagName("tile"),
  38400. w = S && S.length || 1,
  38401. E = null,
  38402. M = y.getAttribute("name") || "",
  38403. D = parseInt(y.getAttribute("spacing")) || 0,
  38404. B = parseInt(y.getAttribute("margin")) || 0,
  38405. I = parseInt(e);
  38406. I || (I = parseInt(y.getAttribute("firstgid")) || 0);
  38407. var P = cc.size(0, 0);
  38408. P.width = parseFloat(y.getAttribute("tilewidth")), P.height = parseFloat(y.getAttribute("tileheight"));
  38409. var R = y.getElementsByTagName("tileoffset")[0],
  38410. O = cc.v2(0, 0);
  38411. R && (O.x = parseFloat(R.getAttribute("x")), O.y = parseFloat(R.getAttribute("y")));
  38412. for (var L = null, F = 0; F < w; F++)
  38413. if (L && !A || ((L = new cc.TMXTilesetInfo).name = M, L.firstGid = I, L.spacing = D, L.margin = B, L._tileSize = P, L.tileOffset = O, L.sourceImage = this._textures[T], L.sourceImage || cc.errorID(7221, T), this.setTilesets(L)), E = S && S[F]) {
  38414. this.parentGID = parseInt(I) + parseInt(E.getAttribute("id") || 0);
  38415. var N = E.getElementsByTagName("image");
  38416. if (N && N.length > 0) {
  38417. var V = (C = N[0]).getAttribute("source");
  38418. V.replace(/\\/g, "/"), L.sourceImage = this._textures[V], L.sourceImage || cc.errorID(7221, V);
  38419. var k = cc.size(0, 0);
  38420. k.width = parseFloat(C.getAttribute("width")), k.height = parseFloat(C.getAttribute("height")), L._tileSize = k, L.firstGid = this.parentGID
  38421. }
  38422. this._tileProperties[this.parentGID] = c(E);
  38423. var G = E.getElementsByTagName("animation");
  38424. if (G && G.length > 0) {
  38425. var U = G[0].getElementsByTagName("frame"),
  38426. z = {
  38427. frames: [],
  38428. dt: 0,
  38429. frameIdx: 0
  38430. };
  38431. this._tileAnimations[this.parentGID] = z;
  38432. for (var j = z.frames, W = 0; W < U.length; W++) {
  38433. var H = U[W],
  38434. X = parseInt(I) + parseInt(H.getAttribute("tileid")),
  38435. Y = parseFloat(H.getAttribute("duration"));
  38436. j.push({
  38437. tileid: X,
  38438. duration: Y / 1e3,
  38439. grid: null
  38440. })
  38441. }
  38442. }
  38443. }
  38444. }
  38445. }
  38446. var q = n.childNodes;
  38447. for (i = 0; i < q.length; i++) {
  38448. var J = q[i];
  38449. if (!this._shouldIgnoreNode(J)) {
  38450. if ("imagelayer" === J.nodeName) {
  38451. var Z = this._parseImageLayer(J);
  38452. Z && this.setImageLayers(Z)
  38453. }
  38454. if ("layer" === J.nodeName) {
  38455. var K = this._parseLayer(J);
  38456. this.setLayers(K)
  38457. }
  38458. if ("objectgroup" === J.nodeName) {
  38459. var Q = this._parseObjectGroup(J);
  38460. this.setObjectGroups(Q)
  38461. }
  38462. }
  38463. }
  38464. return n
  38465. },
  38466. _shouldIgnoreNode: function(t) {
  38467. return 3 === t.nodeType || 8 === t.nodeType || 4 === t.nodeType
  38468. },
  38469. _parseImageLayer: function(t) {
  38470. var e = t.getElementsByTagName("image");
  38471. if (!e || 0 == e.length) return null;
  38472. var i = new cc.TMXImageLayerInfo;
  38473. i.name = t.getAttribute("name"), i.offset.x = parseFloat(t.getAttribute("offsetx")) || 0, i.offset.y = parseFloat(t.getAttribute("offsety")) || 0;
  38474. var n = t.getAttribute("visible");
  38475. i.visible = !("0" === n);
  38476. var r = t.getAttribute("opacity") || 1;
  38477. i.opacity = parseInt(255 * parseFloat(r)) || 255;
  38478. var s = e[0],
  38479. o = s.getAttribute("source");
  38480. return i.sourceImage = this._imageLayerTextures[o], i.width = parseInt(s.getAttribute("width")) || 0, i.height = parseInt(s.getAttribute("height")) || 0, i.trans = h(s.getAttribute("trans")), i.sourceImage ? i : (cc.errorID(7221, o), null)
  38481. },
  38482. _parseLayer: function(t) {
  38483. var e = t.getElementsByTagName("data")[0],
  38484. i = new cc.TMXLayerInfo;
  38485. i.name = t.getAttribute("name");
  38486. var s = cc.size(0, 0);
  38487. s.width = parseFloat(t.getAttribute("width")), s.height = parseFloat(t.getAttribute("height")), i._layerSize = s;
  38488. var a = t.getAttribute("visible");
  38489. i.visible = !("0" === a);
  38490. var l = t.getAttribute("opacity") || 1;
  38491. i._opacity = l ? parseInt(255 * parseFloat(l)) : 255, i.offset = cc.v2(parseFloat(t.getAttribute("offsetx")) || 0, parseFloat(t.getAttribute("offsety")) || 0);
  38492. for (var h = "", u = 0; u < e.childNodes.length; u++) h += e.childNodes[u].nodeValue;
  38493. h = h.trim();
  38494. var _ = e.getAttribute("compression"),
  38495. f = e.getAttribute("encoding");
  38496. if (_ && "gzip" !== _ && "zlib" !== _) return cc.logID(7218), null;
  38497. var d = void 0;
  38498. switch (_) {
  38499. case "gzip":
  38500. d = n.unzipBase64AsArray(h, 4);
  38501. break;
  38502. case "zlib":
  38503. d = o(new r.Inflate(n.Base64.decodeAsArray(h, 1)).decompress());
  38504. break;
  38505. case null:
  38506. case "":
  38507. if ("base64" === f) d = n.Base64.decodeAsArray(h, 4);
  38508. else if ("csv" === f) {
  38509. d = [];
  38510. for (var p = h.split(","), m = 0; m < p.length; m++) d.push(parseInt(p[m]))
  38511. } else {
  38512. var y = e.getElementsByTagName("tile");
  38513. d = [];
  38514. for (var v = 0; v < y.length; v++) d.push(parseInt(y[v].getAttribute("gid")))
  38515. }
  38516. break;
  38517. default:
  38518. this.layerAttrs === cc.TMXLayerInfo.ATTRIB_NONE && cc.logID(7219)
  38519. }
  38520. return d && (i._tiles = new Uint32Array(d)), i.properties = c(t), i
  38521. },
  38522. _parseObjectGroup: function(t) {
  38523. var e = new cc.TMXObjectGroupInfo;
  38524. e.name = t.getAttribute("name") || "", e.offset = cc.v2(parseFloat(t.getAttribute("offsetx")), parseFloat(t.getAttribute("offsety")));
  38525. var i = t.getAttribute("opacity") || 1;
  38526. e._opacity = i ? parseInt(255 * parseFloat(i)) : 255;
  38527. var n = t.getAttribute("visible");
  38528. n && 0 === parseInt(n) && (e.visible = !1);
  38529. var r = t.getAttribute("color");
  38530. r && e._color.fromHEX(r);
  38531. var s = t.getAttribute("draworder");
  38532. s && (e._draworder = s), e.setProperties(c(t));
  38533. var o = t.getElementsByTagName("object");
  38534. if (o)
  38535. for (var u = 0; u < o.length; u++) {
  38536. var _ = o[u],
  38537. f = {};
  38538. f.id = _.getAttribute("id") || 0, f.name = _.getAttribute("name") || "", f.width = parseFloat(_.getAttribute("width")) || 0, f.height = parseFloat(_.getAttribute("height")) || 0, f.x = parseFloat(_.getAttribute("x")) || 0, f.y = parseFloat(_.getAttribute("y")) || 0, f.rotation = parseFloat(_.getAttribute("rotation")) || 0, c(_, f);
  38539. var d = _.getAttribute("visible");
  38540. f.visible = !(d && 0 === parseInt(d));
  38541. var p = _.getElementsByTagName("text");
  38542. if (p && p.length > 0) {
  38543. var m = p[0];
  38544. f.type = cc.TiledMap.TMXObjectType.TEXT, f.wrap = "1" == m.getAttribute("wrap"), f.color = h(m.getAttribute("color")), f.halign = a(m.getAttribute("halign")), f.valign = l(m.getAttribute("valign")), f.pixelsize = parseInt(m.getAttribute("pixelsize")) || 16, f.text = m.childNodes[0].nodeValue
  38545. }
  38546. var y = _.getAttribute("gid");
  38547. y && (f.gid = parseInt(y), f.type = cc.TiledMap.TMXObjectType.IMAGE);
  38548. var v = _.getElementsByTagName("ellipse");
  38549. v && v.length > 0 && (f.type = cc.TiledMap.TMXObjectType.ELLIPSE);
  38550. var g = _.getElementsByTagName("polygon");
  38551. if (g && g.length > 0) {
  38552. f.type = cc.TiledMap.TMXObjectType.POLYGON;
  38553. var x = g[0].getAttribute("points");
  38554. x && (f.points = this._parsePointsString(x))
  38555. }
  38556. var b = _.getElementsByTagName("polyline");
  38557. if (b && b.length > 0) {
  38558. f.type = cc.TiledMap.TMXObjectType.POLYLINE;
  38559. var A = b[0].getAttribute("points");
  38560. A && (f.polylinePoints = this._parsePointsString(A))
  38561. }
  38562. f.type || (f.type = cc.TiledMap.TMXObjectType.RECT), e._objects.push(f)
  38563. }
  38564. return e
  38565. },
  38566. _parsePointsString: function(t) {
  38567. if (!t) return null;
  38568. for (var e = [], i = t.split(" "), n = 0; n < i.length; n++) {
  38569. var r = i[n].split(",");
  38570. e.push({
  38571. x: parseFloat(r[0]),
  38572. y: parseFloat(r[1])
  38573. })
  38574. }
  38575. return e
  38576. },
  38577. setTileAnimations: function(t) {
  38578. this._tileAnimations = t
  38579. },
  38580. getTileAnimations: function() {
  38581. return this._tileAnimations
  38582. },
  38583. getTileProperties: function() {
  38584. return this._tileProperties
  38585. },
  38586. setTileProperties: function(t) {
  38587. this._tileProperties = t
  38588. },
  38589. getCurrentString: function() {
  38590. return this.currentString
  38591. },
  38592. setCurrentString: function(t) {
  38593. this.currentString = t
  38594. }
  38595. };
  38596. var u = cc.TMXMapInfo.prototype;
  38597. s.getset(u, "mapWidth", u._getMapWidth, u._setMapWidth), s.getset(u, "mapHeight", u._getMapHeight, u._setMapHeight), s.getset(u, "tileWidth", u._getTileWidth, u._setTileWidth), s.getset(u, "tileHeight", u._getTileHeight, u._setTileHeight), cc.TMXLayerInfo.ATTRIB_NONE = 1, cc.TMXLayerInfo.ATTRIB_BASE64 = 2, cc.TMXLayerInfo.ATTRIB_GZIP = 4, cc.TMXLayerInfo.ATTRIB_ZLIB = 8
  38598. }), {
  38599. "../compression/ZipUtils": 22,
  38600. "../compression/zlib.min": 25,
  38601. "../core/platform/CCSAXParser": 205,
  38602. "../core/platform/js": 218
  38603. }],
  38604. 386: [(function(t, e, i) {
  38605. "use strict";
  38606. var n = t("../core/vmath"),
  38607. r = t("../core/components/CCRenderComponent"),
  38608. s = t("../core/assets/material/CCMaterial"),
  38609. o = t("../core/renderer/render-flow"),
  38610. a = n.mat4.create(),
  38611. l = n.vec2.create(),
  38612. h = n.vec2.create(),
  38613. c = {
  38614. row: 0,
  38615. col: 0
  38616. },
  38617. u = cc.Class({
  38618. name: "cc.TiledUserNodeData",
  38619. extends: cc.Component,
  38620. ctor: function() {
  38621. this._index = -1, this._row = -1, this._col = -1, this._tiledLayer = null
  38622. }
  38623. }),
  38624. _ = cc.Class({
  38625. name: "cc.TiledLayer",
  38626. extends: r,
  38627. editor: {
  38628. inspector: "packages://inspector/inspectors/comps/tiled-layer.js"
  38629. },
  38630. ctor: function() {
  38631. this._userNodeGrid = {}, this._userNodeMap = {}, this._userNodeDirty = !1, this._tiledTiles = [], this._tilesetIndexArr = [], this._texIdToMatIndex = {}, this._viewPort = {
  38632. x: -1,
  38633. y: -1,
  38634. width: -1,
  38635. height: -1
  38636. }, this._cullingRect = {
  38637. leftDown: {
  38638. row: -1,
  38639. col: -1
  38640. },
  38641. rightTop: {
  38642. row: -1,
  38643. col: -1
  38644. }
  38645. }, this._cullingDirty = !0, this._rightTop = {
  38646. row: -1,
  38647. col: -1
  38648. }, this._layerInfo = null, this._mapInfo = null, this._topOffset = 0, this._downOffset = 0, this._leftOffset = 0, this._rightOffset = 0, this._tiles = [], this._vertices = [], this._verticesDirty = !0, this._layerName = "", this._layerOrientation = null, this._texGrids = null, this._textures = null, this._tilesets = null, this._leftDownToCenterX = 0, this._leftDownToCenterY = 0, this._hasTiledNodeGrid = !1, this._hasAniGrid = !1, this._animations = null, this._enableCulling = cc.macro.ENABLE_TILEDMAP_CULLING
  38649. },
  38650. _hasTiledNode: function() {
  38651. return this._hasTiledNodeGrid
  38652. },
  38653. _hasAnimation: function() {
  38654. return this._hasAniGrid
  38655. },
  38656. enableCulling: function(t) {
  38657. this._enableCulling != t && (this._enableCulling = t, this._cullingDirty = !0)
  38658. },
  38659. addUserNode: function(t) {
  38660. var e = t.getComponent(u);
  38661. return e ? (cc.warn("CCTiledLayer:addUserNode node has been added"), !1) : (e = t.addComponent(u), t.parent = this.node, t._renderFlag |= o.FLAG_BREAK_FLOW, this._userNodeMap[t._id] = e, e._row = -1, e._col = -1, e._tiledLayer = this, this._nodeLocalPosToLayerPos(t, l), this._positionToRowCol(l.x, l.y, c), this._addUserNodeToGrid(e, c), this._updateCullingOffsetByUserNode(t), t.on(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e), t.on(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e), !0)
  38662. },
  38663. removeUserNode: function(t) {
  38664. var e = t.getComponent(u);
  38665. return e ? (t.off(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e), t.off(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e), this._removeUserNodeFromGrid(e), delete this._userNodeMap[t._id], t._removeComponent(e), e.destroy(), t.removeFromParent(!0), t._renderFlag &= ~o.FLAG_BREAK_FLOW, !0) : (cc.warn("CCTiledLayer:removeUserNode node is not exist"), !1)
  38666. },
  38667. destroyUserNode: function(t) {
  38668. this.removeUserNode(t), t.destroy()
  38669. },
  38670. _nodeLocalPosToLayerPos: function(t, e) {
  38671. e.x = t.x + this._leftDownToCenterX, e.y = t.y + this._leftDownToCenterY
  38672. },
  38673. _getNodesByRowCol: function(t, e) {
  38674. var i = this._userNodeGrid[t];
  38675. return i ? i[e] : null
  38676. },
  38677. _getNodesCountByRow: function(t) {
  38678. var e = this._userNodeGrid[t];
  38679. return e ? e.count : 0
  38680. },
  38681. _updateAllUserNode: function() {
  38682. for (var t in this._userNodeGrid = {}, this._userNodeMap) {
  38683. var e = this._userNodeMap[t];
  38684. this._nodeLocalPosToLayerPos(e.node, l), this._positionToRowCol(l.x, l.y, c), this._addUserNodeToGrid(e, c), this._updateCullingOffsetByUserNode(e.node)
  38685. }
  38686. },
  38687. _updateCullingOffsetByUserNode: function(t) {
  38688. this._topOffset < t.height && (this._topOffset = t.height), this._downOffset < t.height && (this._downOffset = t.height), this._leftOffset < t.width && (this._leftOffset = t.width), this._rightOffset < t.width && (this._rightOffset = t.width)
  38689. },
  38690. _userNodeSizeChange: function() {
  38691. var t = this.node;
  38692. this._tiledLayer._updateCullingOffsetByUserNode(t)
  38693. },
  38694. _userNodePosChange: function() {
  38695. var t = this.node,
  38696. e = this._tiledLayer;
  38697. e._nodeLocalPosToLayerPos(t, l), e._positionToRowCol(l.x, l.y, c), c.row === this._row && c.col === this._col || (e._removeUserNodeFromGrid(this), e._addUserNodeToGrid(this, c))
  38698. },
  38699. _removeUserNodeFromGrid: function(t) {
  38700. var e = t._row,
  38701. i = t._col,
  38702. n = t._index,
  38703. r = this._userNodeGrid[e],
  38704. s = r && r[i];
  38705. s && (r.count--, s.count--, s.list[n] = null, s.count <= 0 && (s.list.length = 0, s.count = 0)), t._row = -1, t._col = -1, t._index = -1, this._userNodeDirty = !0
  38706. },
  38707. _isInLayer: function(t, e) {
  38708. return t >= 0 && e >= 0 && t <= this._rightTop.row && e <= this._rightTop.col
  38709. },
  38710. _addUserNodeToGrid: function(t, e) {
  38711. var i = e.row,
  38712. n = e.col;
  38713. if (this._isInLayer(i, n)) {
  38714. var r = this._userNodeGrid[i] = this._userNodeGrid[i] || {
  38715. count: 0
  38716. },
  38717. s = r[n] = r[n] || {
  38718. count: 0,
  38719. list: []
  38720. };
  38721. t._row = i, t._col = n, t._index = s.list.length, r.count++, s.count++, s.list.push(t)
  38722. } else t._row = -1, t._col = -1, t._index = -1;
  38723. this._userNodeDirty = !0
  38724. },
  38725. _isUserNodeDirty: function() {
  38726. return this._userNodeDirty
  38727. },
  38728. _setUserNodeDirty: function(t) {
  38729. this._userNodeDirty = t
  38730. },
  38731. onEnable: function() {
  38732. this._super(), this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this), this._activateMaterial()
  38733. },
  38734. onDisable: function() {
  38735. this._super(), this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this)
  38736. },
  38737. _syncAnchorPoint: function() {
  38738. var t = this.node;
  38739. this._leftDownToCenterX = t.width * t.anchorX * t.scaleX, this._leftDownToCenterY = t.height * t.anchorY * t.scaleY, this._cullingDirty = !0
  38740. },
  38741. onDestroy: function() {
  38742. this._super(), this._buffer && (this._buffer.destroy(), this._buffer = null), this._renderDataList = null
  38743. },
  38744. getLayerName: function() {
  38745. return this._layerName
  38746. },
  38747. setLayerName: function(t) {
  38748. this._layerName = t
  38749. },
  38750. getProperty: function(t) {
  38751. return this._properties[t]
  38752. },
  38753. getPositionAt: function(t, e) {
  38754. var i = void 0;
  38755. void 0 !== e ? (i = Math.floor(t), e = Math.floor(e)) : (i = Math.floor(t.x), e = Math.floor(t.y));
  38756. var n = void 0;
  38757. switch (this._layerOrientation) {
  38758. case cc.TiledMap.Orientation.ORTHO:
  38759. n = this._positionForOrthoAt(i, e);
  38760. break;
  38761. case cc.TiledMap.Orientation.ISO:
  38762. n = this._positionForIsoAt(i, e);
  38763. break;
  38764. case cc.TiledMap.Orientation.HEX:
  38765. n = this._positionForHexAt(i, e)
  38766. }
  38767. return n
  38768. },
  38769. _isInvalidPosition: function(t, e) {
  38770. if (t && "object" == typeof t) {
  38771. var i = t;
  38772. e = i.y, t = i.x
  38773. }
  38774. return t >= this._layerSize.width || e >= this._layerSize.height || t < 0 || e < 0
  38775. },
  38776. _positionForIsoAt: function(t, e) {
  38777. return cc.v2(this._mapTileSize.width / 2 * (this._layerSize.width + t - e - 1), this._mapTileSize.height / 2 * (2 * this._layerSize.height - t - e - 2))
  38778. },
  38779. _positionForOrthoAt: function(t, e) {
  38780. return cc.v2(t * this._mapTileSize.width, (this._layerSize.height - e - 1) * this._mapTileSize.height)
  38781. },
  38782. _positionForHexAt: function(t, e) {
  38783. var i = this._mapTileSize.width,
  38784. n = this._mapTileSize.height,
  38785. r = this._layerSize.height,
  38786. s = Math.floor(t) + Math.floor(e) * this._layerSize.width,
  38787. o = this._tiles[s],
  38788. a = this._texGrids[o].tileset.tileOffset,
  38789. l = this.node.width / 2,
  38790. h = this.node.height / 2,
  38791. c = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? 1 : -1,
  38792. u = 0,
  38793. _ = 0,
  38794. f = 0,
  38795. d = 0,
  38796. p = 0,
  38797. m = 0;
  38798. switch (this._staggerAxis) {
  38799. case cc.TiledMap.StaggerAxis.STAGGERAXIS_Y:
  38800. f = 0, d = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? 0 : i / 2, e % 2 == 1 && (f = i / 2 * c), u = t * i + f + d + a.x - l, _ = (r - e - 1) * (n - (n - this._hexSideLength) / 2) - a.y - h;
  38801. break;
  38802. case cc.TiledMap.StaggerAxis.STAGGERAXIS_X:
  38803. p = 0, m = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? n / 2 : 0, t % 2 == 1 && (p = n / 2 * -c), u = t * (i - (i - this._hexSideLength) / 2) + a.x - l, _ = (r - e - 1) * n + p + m - a.y - h
  38804. }
  38805. return cc.v2(u, _)
  38806. },
  38807. setTileGIDAt: function(t, e, i, n) {
  38808. if (void 0 === e) throw new Error("cc.TiledLayer.setTileGIDAt(): pos should be non-null");
  38809. var r = void 0;
  38810. if (void 0 === n && e instanceof cc.Vec2 ? (r = e, n = i) : r = cc.v2(e, i), r.x = Math.floor(r.x), r.y = Math.floor(r.y), this._isInvalidPosition(r)) throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");
  38811. if (this._tiles && this._tilesets && 0 != this._tilesets.length)
  38812. if (0 !== t && t < this._tilesets[0].firstGid) cc.logID(7239, t);
  38813. else {
  38814. n = n || 0;
  38815. var s = this.getTileFlagsAt(r);
  38816. if (this.getTileGIDAt(r) !== t || s !== n) {
  38817. var o = (t | n) >>> 0;
  38818. this._updateTileForGID(o, r)
  38819. }
  38820. }
  38821. else cc.logID(7238)
  38822. },
  38823. _updateTileForGID: function(t, e) {
  38824. if (0 === t || this._texGrids[t]) {
  38825. var i = 0 | e.x + e.y * this._layerSize.width;
  38826. i < this._tiles.length && (this._tiles[i] = t, this._cullingDirty = !0)
  38827. }
  38828. },
  38829. getTileGIDAt: function(t, e) {
  38830. if (void 0 === t) throw new Error("cc.TiledLayer.getTileGIDAt(): pos should be non-null");
  38831. var i = t;
  38832. if (void 0 === e && (i = t.x, e = t.y), this._isInvalidPosition(i, e)) throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");
  38833. if (!this._tiles) return cc.logID(7237), null;
  38834. var n = Math.floor(i) + Math.floor(e) * this._layerSize.width;
  38835. return (this._tiles[n] & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0
  38836. },
  38837. getTileFlagsAt: function(t, e) {
  38838. if (!t) throw new Error("TiledLayer.getTileFlagsAt: pos should be non-null");
  38839. if (void 0 !== e && (t = cc.v2(t, e)), this._isInvalidPosition(t)) throw new Error("TiledLayer.getTileFlagsAt: invalid position");
  38840. if (!this._tiles) return cc.logID(7240), null;
  38841. var i = Math.floor(t.x) + Math.floor(t.y) * this._layerSize.width;
  38842. return (this._tiles[i] & cc.TiledMap.TileFlag.FLIPPED_ALL) >>> 0
  38843. },
  38844. _setCullingDirty: function(t) {
  38845. this._cullingDirty = t
  38846. },
  38847. _isCullingDirty: function() {
  38848. return this._cullingDirty
  38849. },
  38850. _updateViewPort: function(t, e, i, n) {
  38851. if (this._viewPort.width !== i || this._viewPort.height !== n || this._viewPort.x !== t || this._viewPort.y !== e) {
  38852. this._viewPort.x = t, this._viewPort.y = e, this._viewPort.width = i, this._viewPort.height = n;
  38853. var r = 1;
  38854. this._layerOrientation === cc.TiledMap.Orientation.ISO && (r = 2);
  38855. var s = this._viewPort.x - this._offset.x + this._leftDownToCenterX,
  38856. o = this._viewPort.y - this._offset.y + this._leftDownToCenterY,
  38857. a = s - this._leftOffset,
  38858. l = o - this._downOffset,
  38859. h = s + i + this._rightOffset,
  38860. u = o + n + this._topOffset,
  38861. _ = this._cullingRect.leftDown,
  38862. f = this._cullingRect.rightTop;
  38863. a < 0 && (a = 0), l < 0 && (l = 0), this._positionToRowCol(a, l, c), c.row -= r, c.col -= r, c.row = c.row > 0 ? c.row : 0, c.col = c.col > 0 ? c.col : 0, c.row === _.row && c.col === _.col || (_.row = c.row, _.col = c.col, this._cullingDirty = !0), h < 0 || u < 0 ? (c.row = -1, c.col = -1) : (this._positionToRowCol(h, u, c), c.row++, c.col++), c.row > this._rightTop.row && (c.row = this._rightTop.row), c.col > this._rightTop.col && (c.col = this._rightTop.col), c.row === f.row && c.col === f.col || (f.row = c.row, f.col = c.col, this._cullingDirty = !0)
  38864. }
  38865. },
  38866. _positionToRowCol: function(t, e, i) {
  38867. var n = cc.TiledMap,
  38868. r = n.Orientation,
  38869. s = n.StaggerAxis,
  38870. o = this._mapTileSize.width,
  38871. a = this._mapTileSize.height,
  38872. l = .5 * o,
  38873. h = .5 * a,
  38874. c = 0,
  38875. u = 0,
  38876. _ = 0,
  38877. f = 0,
  38878. d = this._staggerAxis;
  38879. this._layerSize.width;
  38880. switch (this._layerOrientation) {
  38881. case r.ORTHO:
  38882. u = Math.floor(t / o), c = Math.floor(e / a);
  38883. break;
  38884. case r.ISO:
  38885. u = Math.floor(t / l), c = Math.floor(e / h);
  38886. break;
  38887. case r.HEX:
  38888. d === s.STAGGERAXIS_Y ? (_ = (c = Math.floor(e / (a - this._diffY1))) % 2 == 1 ? l * this._odd_even : 0, u = Math.floor((t - _) / o)) : (f = (u = Math.floor(t / (o - this._diffX1))) % 2 == 1 ? h * -this._odd_even : 0, c = Math.floor((e - f) / a))
  38889. }
  38890. return i.row = c, i.col = u, i
  38891. },
  38892. _updateCulling: function() {
  38893. if (this._enableCulling) {
  38894. this.node._updateWorldMatrix(), n.mat4.invert(a, this.node._worldMatrix);
  38895. var t = cc.visibleRect,
  38896. e = cc.Camera.findCamera(this.node);
  38897. e && (l.x = 0, l.y = 0, h.x = l.x + t.width, h.y = l.y + t.height, e.getScreenToWorldPoint(l, l), e.getScreenToWorldPoint(h, h), n.vec2.transformMat4(l, l, a), n.vec2.transformMat4(h, h, a), this._updateViewPort(l.x, l.y, h.x - l.x, h.y - l.y))
  38898. }
  38899. },
  38900. getLayerOrientation: function() {
  38901. return this._layerOrientation
  38902. },
  38903. getProperties: function() {
  38904. return this._properties
  38905. },
  38906. _updateVertices: function() {
  38907. var t = cc.TiledMap,
  38908. e = t.TileFlag.FLIPPED_MASK,
  38909. i = t.StaggerAxis,
  38910. n = t.Orientation,
  38911. r = this._vertices;
  38912. r.length = 0;
  38913. var s = this._layerOrientation,
  38914. o = this._tiles;
  38915. if (o) {
  38916. var a = this._rightTop;
  38917. a.row = -1, a.col = -1;
  38918. var l = this._mapTileSize.width,
  38919. h = this._mapTileSize.height,
  38920. c = .5 * l,
  38921. u = .5 * h,
  38922. _ = this._layerSize.height,
  38923. f = this._layerSize.width,
  38924. d = this._texGrids,
  38925. p = 0,
  38926. m = void 0,
  38927. y = void 0,
  38928. v = void 0,
  38929. g = void 0,
  38930. x = void 0,
  38931. b = void 0,
  38932. A = void 0;
  38933. s === n.HEX && (g = this._staggerAxis, x = this._diffX1, b = this._diffY1, A = this._odd_even);
  38934. var C = 0,
  38935. T = 0,
  38936. S = null,
  38937. w = 0;
  38938. this._topOffset = 0, this._downOffset = 0, this._leftOffset = 0, this._rightOffset = 0, this._hasAniGrid = !1;
  38939. for (var E = 0, M = 0, D = 0, B = 0, I = 0; I < _; ++I) {
  38940. for (var P = 0; P < f; ++P) {
  38941. var R = p + P;
  38942. if (m = d[w = (o[R] & e) >>> 0], this._animations[w] && (this._hasAniGrid = !0), m) {
  38943. switch (s) {
  38944. case n.ORTHO:
  38945. y = (C = P) * l, v = (T = _ - I - 1) * h;
  38946. break;
  38947. case n.ISO:
  38948. y = c * (C = _ + P - I - 1), v = u * (T = _ + f - P - I - 2);
  38949. break;
  38950. case n.HEX:
  38951. y = P * (l - x) + (g === i.STAGGERAXIS_Y && I % 2 == 1 ? c * A : 0), v = (_ - I - 1) * (h - b) + (g === i.STAGGERAXIS_X && P % 2 == 1 ? u * -A : 0), C = P, T = _ - I - 1
  38952. }
  38953. var O = r[T] = r[T] || {
  38954. minCol: 0,
  38955. maxCol: 0
  38956. },
  38957. L = O[C] = O[C] || {};
  38958. O.minCol > C && (O.minCol = C), O.maxCol < C && (O.maxCol = C), a.row < T && (a.row = T), a.col < C && (a.col = C), S = m.tileset.tileOffset, y += this._offset.x + S.x, v += this._offset.y - S.y, E = (E = -S.y + m.tileset._tileSize.height - h) < 0 ? 0 : E, M = S.y < 0 ? 0 : S.y, D = -S.x < 0 ? 0 : -S.x, B = (B = S.x + m.tileset._tileSize.width - l) < 0 ? 0 : B, this._rightOffset < D && (this._rightOffset = D), this._leftOffset < B && (this._leftOffset = B), this._topOffset < M && (this._topOffset = M), this._downOffset < E && (this._downOffset = E), L.left = y, L.bottom = v, L.index = R
  38959. }
  38960. }
  38961. p += f
  38962. }
  38963. this._verticesDirty = !1
  38964. }
  38965. },
  38966. getTiledTileAt: function(t, e, i) {
  38967. if (this._isInvalidPosition(t, e)) throw new Error("TiledLayer.getTiledTileAt: invalid position");
  38968. if (!this._tiles) return cc.logID(7236), null;
  38969. var n = Math.floor(t) + Math.floor(e) * this._layerSize.width,
  38970. r = this._tiledTiles[n];
  38971. if (!r && i) {
  38972. var s = new cc.Node;
  38973. return (r = s.addComponent(cc.TiledTile))._x = t, r._y = e, r._layer = this, r._updateInfo(), s.parent = this.node, r
  38974. }
  38975. return r
  38976. },
  38977. setTiledTileAt: function(t, e, i) {
  38978. if (this._isInvalidPosition(t, e)) throw new Error("TiledLayer.setTiledTileAt: invalid position");
  38979. if (!this._tiles) return cc.logID(7236), null;
  38980. var n = Math.floor(t) + Math.floor(e) * this._layerSize.width;
  38981. return this._tiledTiles[n] = i, this._cullingDirty = !0, this._hasTiledNodeGrid = !!i || this._tiledTiles.some((function(t, e) {
  38982. return !!t
  38983. })), i
  38984. },
  38985. getTexture: function(t) {
  38986. return t = t || 0, this._textures && t >= 0 && this._textures.length > t ? this._textures[t] : null
  38987. },
  38988. getTextures: function() {
  38989. return this._textures
  38990. },
  38991. setTexture: function(t) {
  38992. this.setTextures([t])
  38993. },
  38994. setTextures: function(t) {
  38995. this._textures = t, this._activateMaterial()
  38996. },
  38997. getLayerSize: function() {
  38998. return this._layerSize
  38999. },
  39000. getMapTileSize: function() {
  39001. return this._mapTileSize
  39002. },
  39003. getTileSet: function(t) {
  39004. return t = t || 0, this._tilesets && t >= 0 && this._tilesets.length > t ? this._tilesets[t] : null
  39005. },
  39006. getTileSets: function() {
  39007. return this._tilesets
  39008. },
  39009. setTileSet: function(t) {
  39010. this.setTileSets([t])
  39011. },
  39012. setTileSets: function(t) {
  39013. this._tilesets = t;
  39014. for (var e = this._textures = [], i = this._texGrids = [], n = 0; n < t.length; n++) {
  39015. var r = t[n];
  39016. r && (e[n] = r.sourceImage)
  39017. }
  39018. cc.TiledMap.loadAllTextures(e, function() {
  39019. for (var e = 0, n = t.length; e < n; ++e) {
  39020. var r = t[e];
  39021. r && cc.TiledMap.fillTextureGrids(r, i, e)
  39022. }
  39023. this._prepareToRender()
  39024. }.bind(this))
  39025. },
  39026. _traverseAllGrid: function() {
  39027. var t = this._tiles,
  39028. e = this._texGrids,
  39029. i = this._tilesetIndexArr,
  39030. n = {},
  39031. r = cc.TiledMap.TileFlag.FLIPPED_MASK;
  39032. i.length = 0;
  39033. for (var s = 0; s < t.length; s++) {
  39034. var o = t[s];
  39035. if (0 !== o) {
  39036. var a = e[o = (o & r) >>> 0];
  39037. if (a) {
  39038. var l = a.texId;
  39039. n[l] || (n[l] = !0, i.push(l))
  39040. } else cc.error("CCTiledLayer:_traverseAllGrid grid is null, gid is:", o)
  39041. }
  39042. }
  39043. },
  39044. _init: function(t, e, i, n, r) {
  39045. this._cullingDirty = !0, this._layerInfo = t, this._mapInfo = e;
  39046. var s = t._layerSize;
  39047. if (this._layerName = t.name, this._tiles = t._tiles, this._properties = t.properties, this._layerSize = s, this._minGID = t._minGID, this._maxGID = t._maxGID, this._opacity = t._opacity, this._renderOrder = e.renderOrder, this._staggerAxis = e.getStaggerAxis(), this._staggerIndex = e.getStaggerIndex(), this._hexSideLength = e.getHexSideLength(), this._animations = e.getTileAnimations(), this._tilesets = i, this._textures = n, this._texGrids = r, this._layerOrientation = e.orientation, this._mapTileSize = e.getTileSize(), this._layerOrientation === cc.TiledMap.Orientation.HEX) {
  39048. var o = cc.TiledMap,
  39049. a = o.StaggerAxis,
  39050. l = o.StaggerIndex,
  39051. h = this._mapTileSize.width,
  39052. c = this._mapTileSize.height,
  39053. u = 0,
  39054. _ = 0;
  39055. this._odd_even = this._staggerIndex === l.STAGGERINDEX_ODD ? 1 : -1, this._staggerAxis === a.STAGGERAXIS_X ? (this._diffX1 = (h - this._hexSideLength) / 2, this._diffY1 = 0, _ = c * (this._layerSize.height + .5), u = (h + this._hexSideLength) * Math.floor(this._layerSize.width / 2) + h * (this._layerSize.width % 2)) : (this._diffX1 = 0, this._diffY1 = (c - this._hexSideLength) / 2, u = h * (this._layerSize.width + .5), _ = (c + this._hexSideLength) * Math.floor(this._layerSize.height / 2) + c * (this._layerSize.height % 2)), this.node.setContentSize(u, _)
  39056. } else this.node.setContentSize(this._layerSize.width * this._mapTileSize.width, this._layerSize.height * this._mapTileSize.height);
  39057. this._offset = cc.v2(t.offset.x, -t.offset.y), this._useAutomaticVertexZ = !1, this._vertexZvalue = 0, this._syncAnchorPoint(), this._prepareToRender()
  39058. },
  39059. _prepareToRender: function() {
  39060. this._updateVertices(), this._traverseAllGrid(), this._updateAllUserNode(), this._activateMaterial()
  39061. },
  39062. _activateMaterial: function() {
  39063. var t = this._tilesetIndexArr;
  39064. if (0 !== t.length) {
  39065. for (var e = this._texIdToMatIndex = {}, i = this._textures, n = 0; n < t.length; n++) {
  39066. var r = t[n],
  39067. o = i[r],
  39068. a = this.sharedMaterials[n];
  39069. (a = a ? s.getInstantiatedMaterial(a, this) : s.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("USE_TEXTURE", !0), a.define("CC_USE_MODEL", !0), a.setProperty("texture", o), this.setMaterial(n, a), e[r] = n
  39070. }
  39071. this.markForUpdateRenderData(!0), this.markForRender(!0)
  39072. } else this.disableRender()
  39073. }
  39074. });
  39075. cc.TiledLayer = e.exports = _
  39076. }), {
  39077. "../core/assets/material/CCMaterial": 75,
  39078. "../core/components/CCRenderComponent": 106,
  39079. "../core/renderer/render-flow": 248,
  39080. "../core/vmath": 326
  39081. }],
  39082. 387: [(function(t, e, i) {
  39083. "use strict";
  39084. t("./CCTMXXMLParser"), t("./CCTiledMapAsset"), t("./CCTiledLayer"), t("./CCTiledTile"), t("./CCTiledObjectGroup");
  39085. var n = cc.Enum({
  39086. ORTHO: 0,
  39087. HEX: 1,
  39088. ISO: 2
  39089. }),
  39090. r = cc.Enum({
  39091. NONE: 0,
  39092. MAP: 1,
  39093. LAYER: 2,
  39094. OBJECTGROUP: 3,
  39095. OBJECT: 4,
  39096. TILE: 5
  39097. }),
  39098. s = cc.Enum({
  39099. HORIZONTAL: 2147483648,
  39100. VERTICAL: 1073741824,
  39101. DIAGONAL: 536870912,
  39102. FLIPPED_ALL: 4026531840,
  39103. FLIPPED_MASK: 268435455
  39104. }),
  39105. o = cc.Enum({
  39106. STAGGERAXIS_X: 0,
  39107. STAGGERAXIS_Y: 1
  39108. }),
  39109. a = cc.Enum({
  39110. STAGGERINDEX_ODD: 0,
  39111. STAGGERINDEX_EVEN: 1
  39112. }),
  39113. l = cc.Enum({
  39114. RightDown: 0,
  39115. RightUp: 1,
  39116. LeftDown: 2,
  39117. LeftUp: 3
  39118. }),
  39119. h = cc.Enum({
  39120. RECT: 0,
  39121. ELLIPSE: 1,
  39122. POLYGON: 2,
  39123. POLYLINE: 3,
  39124. IMAGE: 4,
  39125. TEXT: 5
  39126. }),
  39127. c = cc.Class({
  39128. name: "cc.TiledMap",
  39129. extends: cc.Component,
  39130. editor: !1,
  39131. ctor: function() {
  39132. this._texGrids = [], this._textures = [], this._tilesets = [], this._animations = [], this._imageLayers = [], this._layers = [], this._groups = [], this._images = [], this._properties = [], this._tileProperties = [], this._mapSize = cc.size(0, 0), this._tileSize = cc.size(0, 0)
  39133. },
  39134. statics: {
  39135. Orientation: n,
  39136. Property: r,
  39137. TileFlag: s,
  39138. StaggerAxis: o,
  39139. StaggerIndex: a,
  39140. TMXObjectType: h,
  39141. RenderOrder: l
  39142. },
  39143. properties: {
  39144. _tmxFile: {
  39145. default: null,
  39146. type: cc.TiledMapAsset
  39147. },
  39148. tmxAsset: {
  39149. get: function() {
  39150. return this._tmxFile
  39151. },
  39152. set: function(t, e) {
  39153. this._tmxFile !== t && (this._tmxFile = t, this._applyFile())
  39154. },
  39155. type: cc.TiledMapAsset
  39156. }
  39157. },
  39158. getMapSize: function() {
  39159. return this._mapSize
  39160. },
  39161. getTileSize: function() {
  39162. return this._tileSize
  39163. },
  39164. getMapOrientation: function() {
  39165. return this._mapOrientation
  39166. },
  39167. getObjectGroups: function() {
  39168. return this._groups
  39169. },
  39170. getObjectGroup: function(t) {
  39171. for (var e = this._groups, i = 0, n = e.length; i < n; i++) {
  39172. var r = e[i];
  39173. if (r && r.getGroupName() === t) return r
  39174. }
  39175. return null
  39176. },
  39177. enableCulling: function(t) {
  39178. for (var e = this._layers, i = 0; i < e.length; ++i) e[i].enableCulling(t)
  39179. },
  39180. getProperties: function() {
  39181. return this._properties
  39182. },
  39183. getLayers: function() {
  39184. return this._layers
  39185. },
  39186. getLayer: function(t) {
  39187. for (var e = this._layers, i = 0, n = e.length; i < n; i++) {
  39188. var r = e[i];
  39189. if (r && r.getLayerName() === t) return r
  39190. }
  39191. return null
  39192. },
  39193. _changeLayer: function(t, e) {
  39194. for (var i = this._layers, n = 0, r = i.length; n < r; n++) {
  39195. var s = i[n];
  39196. if (s && s.getLayerName() === t) return void(i[n] = e)
  39197. }
  39198. },
  39199. getProperty: function(t) {
  39200. return this._properties[t.toString()]
  39201. },
  39202. getPropertiesForGID: function(t) {
  39203. return this._tileProperties[t]
  39204. },
  39205. __preload: function() {
  39206. this._tmxFile && this._applyFile()
  39207. },
  39208. onEnable: function() {
  39209. this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this)
  39210. },
  39211. onDisable: function() {
  39212. this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this)
  39213. },
  39214. _applyFile: function() {
  39215. var t = this._tmxFile;
  39216. if (t) {
  39217. for (var e = t.textures, i = t.textureNames, n = {}, r = 0; r < e.length; ++r) n[i[r]] = e[r];
  39218. var s = {};
  39219. e = t.imageLayerTextures, i = t.imageLayerTextureNames;
  39220. for (var o = 0; o < e.length; ++o) s[i[o]] = e[o];
  39221. for (var a = t.tsxFileNames, l = t.tsxFiles, h = {}, c = 0; c < a.length; ++c) a[c].length > 0 && (h[a[c]] = l[c].text);
  39222. var u = new cc.TMXMapInfo(t.tmxXmlStr, h, n, s),
  39223. _ = u.getTilesets();
  39224. _ && 0 !== _.length || cc.logID(7241), this._buildWithMapInfo(u)
  39225. } else this._releaseMapInfo()
  39226. },
  39227. _releaseMapInfo: function() {
  39228. for (var t = this._layers, e = 0, i = t.length; e < i; e++) t[e].node.removeFromParent(!0), t[e].node.destroy();
  39229. t.length = 0;
  39230. for (var n = this._groups, r = 0, s = n.length; r < s; r++) n[r].node.removeFromParent(!0), n[r].node.destroy();
  39231. n.length = 0;
  39232. for (var o = this._images, a = 0, l = o.length; a < l; a++) o[a].removeFromParent(!0), o[a].destroy();
  39233. o.length = 0
  39234. },
  39235. _syncAnchorPoint: function() {
  39236. var t = this.node.getAnchorPoint(),
  39237. e = this.node.width * t.x,
  39238. i = this.node.height * (1 - t.y),
  39239. n = void 0,
  39240. r = void 0;
  39241. for (n = 0, r = this._layers.length; n < r; n++) {
  39242. this._layers[n].node.setAnchorPoint(t)
  39243. }
  39244. for (n = 0, r = this._groups.length; n < r; n++) {
  39245. var s = this._groups[n],
  39246. o = s.node;
  39247. o.anchorX = .5, o.anchorY = .5, o.x = s._offset.x - e + o.width * o.anchorX, o.y = s._offset.y + i - o.height * o.anchorY
  39248. }
  39249. for (n = 0, r = this._images.length; n < r; n++) {
  39250. var a = this._images[n];
  39251. a.anchorX = .5, a.anchorY = .5, a.x = a._offset.x - e + a.width * a.anchorX, a.y = a._offset.y + i - a.height * a.anchorY
  39252. }
  39253. },
  39254. _fillAniGrids: function(t, e) {
  39255. for (var i in e) {
  39256. var n = e[i];
  39257. if (n)
  39258. for (var r = n.frames, s = 0; s < r.length; s++) {
  39259. var o = r[s];
  39260. o.grid = t[o.tileid]
  39261. }
  39262. }
  39263. },
  39264. _buildLayerAndGroup: function() {
  39265. var t = this._tilesets,
  39266. e = this._texGrids,
  39267. i = this._animations;
  39268. e.length = 0;
  39269. for (var n = 0, r = t.length; n < r; ++n) {
  39270. var s = t[n];
  39271. s && cc.TiledMap.fillTextureGrids(s, e, n)
  39272. }
  39273. this._fillAniGrids(e, i);
  39274. for (var o = this._layers, a = this._groups, l = this._images, h = {}, c = 0, u = o.length; c < u; c++) h[o[c].node._name] = !0;
  39275. for (var _ = 0, f = a.length; _ < f; _++) h[a[_].node._name] = !0;
  39276. for (var d = 0, p = l.length; d < p; d++) h[l[d]._name] = !0;
  39277. o = this._layers = [], a = this._groups = [], l = this._images = [];
  39278. var m = this._mapInfo,
  39279. y = this.node,
  39280. v = m.getAllChildren(),
  39281. g = this._textures,
  39282. x = 0,
  39283. b = 0;
  39284. if (v && v.length > 0)
  39285. for (var A = 0, C = v.length; A < C; A++) {
  39286. var T = v[A],
  39287. S = T.name,
  39288. w = this.node.getChildByName(S);
  39289. if (h[S] = !1, w || ((w = new cc.Node).name = S, y.addChild(w)), w.setSiblingIndex(A), w.active = T.visible, T instanceof cc.TMXLayerInfo) {
  39290. var E = w.getComponent(cc.TiledLayer);
  39291. E || (E = w.addComponent(cc.TiledLayer)), E._init(T, m, t, g, e), T.ownTiles = !1, o.push(E)
  39292. } else if (T instanceof cc.TMXObjectGroupInfo) {
  39293. var M = w.getComponent(cc.TiledObjectGroup);
  39294. M || (M = w.addComponent(cc.TiledObjectGroup)), M._init(T, m, e), a.push(M)
  39295. } else if (T instanceof cc.TMXImageLayerInfo) {
  39296. var D = T.sourceImage;
  39297. w.opacity = T.opacity, w.layerInfo = T, w._offset = cc.v2(T.offset.x, -T.offset.y);
  39298. var B = w.getComponent(cc.Sprite);
  39299. B || (B = w.addComponent(cc.Sprite)), B.spriteFrame = new cc.SpriteFrame, B.spriteFrame.setTexture(D), w.width = D.width, w.height = D.height, l.push(w)
  39300. }
  39301. x = Math.max(x, w.width), b = Math.max(b, w.height)
  39302. }
  39303. for (var I = y.children, P = 0, R = I.length; P < R; P++) {
  39304. var O = I[P];
  39305. h[O._name] && O.destroy()
  39306. }
  39307. this.node.width = x, this.node.height = b, this._syncAnchorPoint()
  39308. },
  39309. _buildWithMapInfo: function(t) {
  39310. this._mapInfo = t, this._mapSize = t.getMapSize(), this._tileSize = t.getTileSize(), this._mapOrientation = t.orientation, this._properties = t.properties, this._tileProperties = t.getTileProperties(), this._imageLayers = t.getImageLayers(), this._animations = t.getTileAnimations(), this._tilesets = t.getTilesets();
  39311. var e = this._tilesets;
  39312. this._textures.length = 0;
  39313. for (var i = [], n = 0, r = e.length; n < r; ++n) {
  39314. var s = e[n];
  39315. s && s.sourceImage && (this._textures[n] = s.sourceImage, i.push(s.sourceImage))
  39316. }
  39317. for (var o = 0; o < this._imageLayers.length; o++) {
  39318. var a = this._imageLayers[o];
  39319. a && a.sourceImage && i.push(a.sourceImage)
  39320. }
  39321. cc.TiledMap.loadAllTextures(i, function() {
  39322. this._buildLayerAndGroup()
  39323. }.bind(this))
  39324. },
  39325. update: function(t) {
  39326. var e = this._animations,
  39327. i = this._texGrids;
  39328. for (var n in e) {
  39329. var r = e[n],
  39330. s = r.frames,
  39331. o = s[r.frameIdx];
  39332. r.dt += t, o.duration < r.dt && (r.dt = 0, r.frameIdx++, r.frameIdx >= s.length && (r.frameIdx = 0), o = s[r.frameIdx]), i[n] = o.grid
  39333. }
  39334. }
  39335. });
  39336. cc.TiledMap = e.exports = c, cc.TiledMap.loadAllTextures = function(t, e) {
  39337. var i = t.length;
  39338. if (0 !== i)
  39339. for (var n = 0, r = function() {
  39340. ++n >= i && e()
  39341. }, s = 0; s < i; s++) {
  39342. var o = t[s];
  39343. o.loaded ? r() : o.once("load", (function() {
  39344. r()
  39345. }))
  39346. } else e()
  39347. }, cc.TiledMap.fillTextureGrids = function(t, e, i) {
  39348. var n = t.sourceImage;
  39349. t.imageSize.width && t.imageSize.height || (t.imageSize.width = n.width, t.imageSize.height = n.height);
  39350. var r = t._tileSize.width,
  39351. s = t._tileSize.height,
  39352. o = n.width,
  39353. a = n.height,
  39354. l = t.spacing,
  39355. h = t.margin,
  39356. c = Math.floor((o - 2 * h + l) / (r + l)),
  39357. u = Math.floor((a - 2 * h + l) / (s + l)) * c,
  39358. _ = t.firstGid,
  39359. f = null,
  39360. d = !!e[_],
  39361. p = cc.macro.FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX ? .5 : 0;
  39362. u <= 0 && (u = 1);
  39363. for (var m = t.firstGid + u; _ < m && (d && !e[_] && (d = !1), d || !e[_]); ++_) f = {
  39364. texId: i,
  39365. tileset: t,
  39366. x: 0,
  39367. y: 0,
  39368. width: r,
  39369. height: s,
  39370. t: 0,
  39371. l: 0,
  39372. r: 0,
  39373. b: 0,
  39374. gid: _
  39375. }, t.rectForGID(_, f), f.x += p, f.y += p, f.width -= 2 * p, f.height -= 2 * p, f.t = f.y / a, f.l = f.x / o, f.r = (f.x + f.width) / o, f.b = (f.y + f.height) / a, e[_] = f
  39376. }, cc.js.obsolete(cc.TiledMap.prototype, "cc.TiledMap.tmxFile", "tmxAsset", !0), cc.js.get(cc.TiledMap.prototype, "mapLoaded", (function() {
  39377. return cc.errorID(7203), []
  39378. }), !1)
  39379. }), {
  39380. "./CCTMXXMLParser": 385,
  39381. "./CCTiledLayer": 386,
  39382. "./CCTiledMapAsset": 388,
  39383. "./CCTiledObjectGroup": 390,
  39384. "./CCTiledTile": 391
  39385. }],
  39386. 388: [(function(t, e, i) {
  39387. "use strict";
  39388. var n = cc.Class({
  39389. name: "cc.TiledMapAsset",
  39390. extends: cc.Asset,
  39391. properties: {
  39392. tmxXmlStr: "",
  39393. textures: {
  39394. default: [],
  39395. type: [cc.Texture2D]
  39396. },
  39397. textureNames: [cc.String],
  39398. imageLayerTextures: {
  39399. default: [],
  39400. type: [cc.Texture2D]
  39401. },
  39402. imageLayerTextureNames: [cc.String],
  39403. tsxFiles: [cc.TextAsset],
  39404. tsxFileNames: [cc.String]
  39405. },
  39406. statics: {
  39407. preventDeferredLoadDependents: !0
  39408. },
  39409. createNode: !1
  39410. });
  39411. cc.TiledMapAsset = n, e.exports = n
  39412. }), {}],
  39413. 389: [(function(t, e, i) {
  39414. "use strict";
  39415. var n = (function(t) {
  39416. return t && t.__esModule ? t : {
  39417. default: t
  39418. }
  39419. })(t("../renderer/core/input-assembler"));
  39420. var r = cc.Class({
  39421. name: "cc.TiledMapRenderDataList",
  39422. ctor: function() {
  39423. this._dataList = [], this._offset = 0
  39424. },
  39425. _pushRenderData: function() {
  39426. var t = {};
  39427. t.ia = new n.default, t.nodesRenderList = [], this._dataList.push(t)
  39428. },
  39429. popRenderData: function(t) {
  39430. this._offset >= this._dataList.length && this._pushRenderData();
  39431. var e = this._dataList[this._offset];
  39432. e.nodesRenderList.length = 0;
  39433. var i = e.ia;
  39434. return i._vertexBuffer = t._vb, i._indexBuffer = t._ib, i._start = t.indiceOffset, i._count = 0, this._offset++, e
  39435. },
  39436. pushNodesList: function(t, e) {
  39437. t.nodesRenderList.push(e)
  39438. },
  39439. reset: function() {
  39440. this._offset = 0
  39441. }
  39442. });
  39443. cc.TiledMapRenderDataList = e.exports = r
  39444. }), {
  39445. "../renderer/core/input-assembler": 350
  39446. }],
  39447. 390: [(function(t, e, i) {
  39448. "use strict";
  39449. var n = cc.Class({
  39450. name: "cc.TiledObjectGroup",
  39451. extends: cc.Component,
  39452. getPositionOffset: function() {
  39453. return this._positionOffset
  39454. },
  39455. getProperties: function() {
  39456. this._properties
  39457. },
  39458. getGroupName: function() {
  39459. return this._groupName
  39460. },
  39461. getProperty: function(t) {
  39462. return this._properties[t.toString()]
  39463. },
  39464. getObject: function(t) {
  39465. for (var e = 0, i = this._objects.length; e < i; e++) {
  39466. var n = this._objects[e];
  39467. if (n && n.name === t) return n
  39468. }
  39469. return null
  39470. },
  39471. getObjects: function() {
  39472. return this._objects
  39473. },
  39474. _init: function(t, e, i) {
  39475. var n = cc.TiledMap,
  39476. r = n.TMXObjectType,
  39477. s = n.Orientation,
  39478. o = n.StaggerAxis,
  39479. a = n.TileFlag.FLIPPED_MASK;
  39480. this._groupName = t.name, this._positionOffset = t.offset, this._mapInfo = e, this._properties = t.getProperties(), this._offset = cc.v2(t.offset.x, -t.offset.y), this._opacity = t._opacity;
  39481. var l = e._mapSize,
  39482. h = e._tileSize,
  39483. c = 0,
  39484. u = 0;
  39485. e.orientation === s.HEX ? e.getStaggerAxis() === o.STAGGERAXIS_X ? (u = h.height * (l.height + .5), c = (h.width + e.getHexSideLength()) * Math.floor(l.width / 2) + h.width * (l.width % 2)) : (c = h.width * (l.width + .5), u = (h.height + e.getHexSideLength()) * Math.floor(l.height / 2) + h.height * (l.height % 2)) : (c = l.width * h.width, u = l.height * h.height), this.node.setContentSize(c, u);
  39486. for (var _ = c * this.node.anchorX, f = u * (1 - this.node.anchorY), d = t._objects, p = {}, m = 0, y = d.length - 1, v = d.length; m < v; m++, y--) {
  39487. var g = d[m],
  39488. x = g.type;
  39489. g.offset = cc.v2(g.x, g.y);
  39490. var b = g.points || g.polylinePoints;
  39491. if (b)
  39492. for (var A = 0; A < b.length; A++) b[A].y *= -1;
  39493. if (s.ISO !== e.orientation) g.y = u - g.y;
  39494. else {
  39495. var C = g.x / h.width * 2,
  39496. T = g.y / h.height;
  39497. g.x = h.width / 2 * (l.width + C - T), g.y = h.height / 2 * (2 * l.height - C - T)
  39498. }
  39499. if (x === r.TEXT) {
  39500. var S = "text" + g.id;
  39501. p[S] = !0;
  39502. var w = this.node.getChildByName(S);
  39503. w || (w = new cc.Node), w.anchorX = 0, w.anchorY = 1, w.angle = -g.rotation, w.x = g.x - _, w.y = g.y - f, w.name = S, w.parent = this.node, w.color = g.color, w.opacity = this._opacity, w.setSiblingIndex(y);
  39504. var E = w.getComponent(cc.Label);
  39505. E || (E = w.addComponent(cc.Label)), E.overflow = cc.Label.Overflow.SHRINK, E.lineHeight = g.height, E.string = g.text, E.horizontalAlign = g.halign, E.verticalAlign = g.valign, E.fontSize = g.pixelsize, w.width = g.width, w.height = g.height
  39506. }
  39507. if (x === r.IMAGE) {
  39508. var M = i[(g.gid & a) >>> 0];
  39509. if (!M) continue;
  39510. var D = M.tileset,
  39511. B = "img" + g.id;
  39512. p[B] = !0;
  39513. var I = this.node.getChildByName(B);
  39514. I instanceof cc.PrivateNode && (I.removeFromParent(), I.destroy(), I = null), I || (I = new cc.Node), s.ISO == e.orientation ? (I.anchorX = .5, I.anchorY = 0) : (I.anchorX = 0, I.anchorY = 0), I.angle = -g.rotation, I.x = g.x - _ + D.tileOffset.x, I.y = g.y - f + D.tileOffset.y, I.name = B, I.parent = this.node, I.opacity = this._opacity, I.setSiblingIndex(y);
  39515. var P = I.getComponent(cc.Sprite);
  39516. P || (P = I.addComponent(cc.Sprite));
  39517. var R = new cc.SpriteFrame;
  39518. R.setTexture(M.tileset.sourceImage, cc.rect(M)), P.spriteFrame = R, I.width = g.width, I.height = g.height
  39519. }
  39520. }
  39521. this._objects = d;
  39522. for (var O = this.node.children, L = /^img\d+$/, F = /^text\d+$/, N = 0, V = O.length; N < V; N++) {
  39523. var k = O[N],
  39524. G = k._name,
  39525. U = L.test(G);
  39526. (U = U || F.test(G)) && !p[G] && k.destroy()
  39527. }
  39528. }
  39529. });
  39530. cc.TiledObjectGroup = e.exports = n
  39531. }), {}],
  39532. 391: [(function(t, e, i) {
  39533. "use strict";
  39534. var n = cc.Class({
  39535. name: "cc.TiledTile",
  39536. extends: cc.Component,
  39537. editor: !1,
  39538. ctor: function() {
  39539. this._layer = null
  39540. },
  39541. properties: {
  39542. _x: 0,
  39543. _y: 0,
  39544. x: {
  39545. get: function() {
  39546. return this._x
  39547. },
  39548. set: function(t) {
  39549. t !== this._x && (this._layer && this._layer._isInvalidPosition(t, this._y) ? cc.warn("Invalid x, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.width) : (this._resetTile(), this._x = t, this._updateInfo()))
  39550. },
  39551. type: cc.Integer
  39552. },
  39553. y: {
  39554. get: function() {
  39555. return this._y
  39556. },
  39557. set: function(t) {
  39558. t !== this._y && (this._layer && this._layer._isInvalidPosition(this._x, t) ? cc.warn("Invalid y, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.height) : (this._resetTile(), this._y = t, this._updateInfo()))
  39559. },
  39560. type: cc.Integer
  39561. },
  39562. gid: {
  39563. get: function() {
  39564. return this._layer ? this._layer.getTileGIDAt(this._x, this._y) : 0
  39565. },
  39566. set: function(t) {
  39567. this._layer && this._layer.setTileGIDAt(t, this._x, this._y)
  39568. },
  39569. type: cc.Integer
  39570. }
  39571. },
  39572. onEnable: function() {
  39573. var t = this.node.parent;
  39574. this._layer = t.getComponent(cc.TiledLayer), this._resetTile(), this._updateInfo()
  39575. },
  39576. onDisable: function() {
  39577. this._resetTile()
  39578. },
  39579. _resetTile: function() {
  39580. this._layer && this._layer.getTiledTileAt(this._x, this._y) === this && this._layer.setTiledTileAt(this._x, this._y, null)
  39581. },
  39582. _updateInfo: function() {
  39583. if (this._layer) {
  39584. var t = this._x,
  39585. e = this._y;
  39586. this._layer.getTiledTileAt(t, e) ? cc.warn("There is already a TiledTile at [%s, %s]", t, e) : (this.node.setPosition(this._layer.getPositionAt(t, e)), this._layer.setTiledTileAt(t, e, this))
  39587. }
  39588. }
  39589. });
  39590. cc.TiledTile = e.exports = n
  39591. }), {}],
  39592. 392: [(function(t, e, i) {
  39593. "use strict";
  39594. t("./CCTiledMap"), t("./CCTiledMapRenderDataList"), t("./tiledmap-buffer"), t("./tmx-layer-assembler")
  39595. }), {
  39596. "./CCTiledMap": 387,
  39597. "./CCTiledMapRenderDataList": 389,
  39598. "./tiledmap-buffer": 393,
  39599. "./tmx-layer-assembler": 394
  39600. }],
  39601. 393: [(function(t, e, i) {
  39602. "use strict";
  39603. var n = cc.Class({
  39604. name: "cc.TiledMapBuffer",
  39605. extends: t("../core/renderer/webgl/quad-buffer"),
  39606. _updateOffset: function() {
  39607. var t = this._offsetInfo;
  39608. t.vertexOffset = this.vertexOffset, t.indiceOffset = this.indiceOffset, t.byteOffset = this.byteOffset
  39609. },
  39610. adjust: function(t, e) {
  39611. this.vertexOffset += t, this.indiceOffset += e, this.indiceStart = this.indiceOffset, this.byteOffset = this.byteOffset + t * this._vertexBytes, this._dirty = !0
  39612. }
  39613. });
  39614. cc.TiledMapBuffer = e.exports = n
  39615. }), {
  39616. "../core/renderer/webgl/quad-buffer": 285
  39617. }],
  39618. 394: [(function(t, e, i) {
  39619. "use strict";
  39620. i.__esModule = !0, i.default = void 0;
  39621. var n = (function(t) {
  39622. return t && t.__esModule ? t : {
  39623. default: t
  39624. }
  39625. })(t("../core/renderer/assembler")),
  39626. r = t("../core/vmath");
  39627. function s(t, e) {
  39628. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  39629. }
  39630. function o(t, e) {
  39631. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  39632. return !e || "object" != typeof e && "function" != typeof e ? t : e
  39633. }
  39634. function a(t, e) {
  39635. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  39636. t.prototype = Object.create(e && e.prototype, {
  39637. constructor: {
  39638. value: t,
  39639. enumerable: !1,
  39640. writable: !0,
  39641. configurable: !0
  39642. }
  39643. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  39644. }
  39645. var l = t("./CCTiledLayer"),
  39646. h = t("./CCTiledMap"),
  39647. c = h.TileFlag,
  39648. u = c.FLIPPED_MASK,
  39649. _ = t("../core/renderer/"),
  39650. f = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor,
  39651. d = parseInt(10922.5),
  39652. p = h.RenderOrder,
  39653. m = t("../core/renderer/render-flow"),
  39654. y = r.mat4.create(),
  39655. v = r.vec3.create(),
  39656. g = {
  39657. row: 0,
  39658. col: 0
  39659. },
  39660. x = {
  39661. x: 0,
  39662. y: 0
  39663. },
  39664. b = {
  39665. x: 0,
  39666. y: 0
  39667. },
  39668. A = {
  39669. x: 0,
  39670. y: 0
  39671. },
  39672. C = {
  39673. x: 0,
  39674. y: 0
  39675. },
  39676. T = null,
  39677. S = null,
  39678. w = 0,
  39679. E = 0,
  39680. M = 0,
  39681. D = 0,
  39682. B = null,
  39683. I = null,
  39684. P = null,
  39685. R = null,
  39686. O = null,
  39687. L = null,
  39688. F = null,
  39689. N = null;
  39690. function V(t) {
  39691. t._updateLocalMatrix(), r.mat4.mul(t._worldMatrix, B, t._matrix), t._renderFlag &= ~(m.FLAG_TRANSFORM | m.FLAG_BREAK_FLOW), m.visitRootNode(t), t._renderFlag |= m.FLAG_BREAK_FLOW
  39692. }
  39693. function k() {
  39694. 0 !== S._count && (I.material = T.material, I.node = L.node, I._flushIA(T.ia), w >= d ? (R.uploadData(), R.switchBuffer(), F = R._vData, N = R._uintVData, T = P.popRenderData(R), S = T.ia, E = 0, w = 0) : (T = P.popRenderData(R), S = T.ia), T.material = O)
  39695. }
  39696. function G(t, e) {
  39697. var i = L._getNodesByRowCol(t, e);
  39698. if (i && 0 != i.count) {
  39699. var n = i.list,
  39700. r = 0,
  39701. s = 0;
  39702. for (k(), I.worldMatDirty++; r < i.count;) {
  39703. var o = n[s];
  39704. s++, o && (V(o.node), r !== s && (n[r] = o, o._index = r), r++)
  39705. }
  39706. n.length = r, I.worldMatDirty--, P.pushNodesList(T, n), I._flush(), I.node = L.node
  39707. }
  39708. }
  39709. function U(t, e) {
  39710. x.x = t.l, x.y = t.t, b.x = t.r, b.y = t.t, A.x = t.l, A.y = t.b, C.x = t.r, C.y = t.b;
  39711. var i = null;
  39712. (e & c.DIAGONAL) >>> 0 && (i = b, b = A, A = i), (e & c.HORIZONTAL) >>> 0 && (i = x, x = b, b = i, i = A, A = C, C = i), (e & c.VERTICAL) >>> 0 && (i = x, x = A, A = i, i = b, b = C, C = i)
  39713. }
  39714. var z = (function(t) {
  39715. function e() {
  39716. return s(this, e), o(this, t.apply(this, arguments))
  39717. }
  39718. return a(e, t), e.prototype.updateRenderData = function(t) {
  39719. t._renderDataList || (t._buffer = new cc.TiledMapBuffer(_._handle, f), t._renderDataList = new cc.TiledMapRenderDataList)
  39720. }, e.prototype.fillBuffers = function(t, e) {
  39721. if (0 !== t._vertices.length) {
  39722. t._updateCulling();
  39723. var i = t.node;
  39724. if (M = t._leftDownToCenterX, D = t._leftDownToCenterY, B = i._worldMatrix, I = e, L = t, P = t._renderDataList, R = t._buffer, t._isCullingDirty() || t._isUserNodeDirty() || t._hasAnimation() || t._hasTiledNode()) {
  39725. R.reset();
  39726. var n = void 0,
  39727. r = void 0;
  39728. if (t._enableCulling) {
  39729. var s = t._cullingRect;
  39730. n = s.leftDown, r = s.rightTop
  39731. } else n = g, r = t._rightTop;
  39732. var o = (r.row - n.row + 1) * (r.col - n.col + 1);
  39733. switch (o > d && (o = d), R.request(4 * o, 6 * o), t._renderOrder) {
  39734. case p.RightDown:
  39735. this.traverseGrids(n, r, -1, 1);
  39736. break;
  39737. case p.LeftDown:
  39738. this.traverseGrids(n, r, -1, -1);
  39739. break;
  39740. case p.RightUp:
  39741. this.traverseGrids(n, r, 1, 1);
  39742. break;
  39743. case p.LeftUp:
  39744. this.traverseGrids(n, r, 1, -1)
  39745. }
  39746. t._setCullingDirty(!1), t._setUserNodeDirty(!1)
  39747. } else {
  39748. for (var a = null, l = null, h = null, c = 0; c < P._offset; c++) {
  39749. if ((l = (a = P._dataList[c]).nodesRenderList).length > 0) {
  39750. e.worldMatDirty++;
  39751. for (var u = 0; u < l.length; u++)
  39752. if (h = l[u])
  39753. for (var _ = 0; _ < h.length; _++) {
  39754. var f = h[_];
  39755. f && V(f.node)
  39756. }
  39757. e.worldMatDirty--, e._flush()
  39758. }
  39759. a.ia._count > 0 && (e.material = a.material, e.node = i, e._flushIA(a.ia))
  39760. }
  39761. }
  39762. T = null, S = null, B = null, I = null, P = null, R = null, O = null, L = null, F = null, N = null
  39763. }
  39764. }, e.prototype.traverseGrids = function(t, e, i, n) {
  39765. if (P.reset(), !(e.row < 0 || e.col < 0)) {
  39766. T = P.popRenderData(R), S = T.ia, F = R._vData, N = R._uintVData, w = 0, E = 0, O = null;
  39767. var r = L.node._color._val,
  39768. s = L._tiledTiles,
  39769. o = L._texGrids,
  39770. a = L._tiles,
  39771. l = L._texIdToMatIndex,
  39772. h = L.sharedMaterials,
  39773. c = L._vertices,
  39774. _ = void 0,
  39775. f = void 0,
  39776. p = void 0,
  39777. m = void 0,
  39778. y = void 0,
  39779. v = void 0,
  39780. g = void 0,
  39781. B = null,
  39782. V = 0,
  39783. z = 0,
  39784. j = 0,
  39785. W = 0,
  39786. H = 0,
  39787. X = null,
  39788. Y = -1,
  39789. q = void 0,
  39790. J = 0,
  39791. Z = !0;
  39792. for (-1 == i ? (m = e.row, y = t.row) : (m = t.row, y = e.row);
  39793. (y - m) * i >= 0; m += i)
  39794. for (_ = c[m], Z = 0 == (J = L._getNodesCountByRow(m)) && void 0 != _, 1 == n ? (f = Z && t.col < _.minCol ? _.minCol : t.col, p = Z && e.col > _.maxCol ? _.maxCol : e.col) : (f = Z && e.col > _.maxCol ? _.maxCol : e.col, p = Z && t.col < _.minCol ? _.minCol : t.col);
  39795. (p - f) * n >= 0; f += n)(v = _ && _[f]) ? (B = o[((V = a[v.index]) & u) >>> 0]) && (Y !== B.texId && (-1 !== Y && k(), q = l[Y = B.texId], O = h[q], T.material = O), O && (z = v.left - M, j = v.bottom - D, W = z + (g = B.tileset._tileSize).width, H = j + g.height, (X = s[v.index]) ? this.fillByTiledNode(X.node, F, N, z, W, H, j) : (F[E] = z, F[E + 1] = H, N[E + 4] = r, F[E + 5] = z, F[E + 6] = j, N[E + 9] = r, F[E + 10] = W, F[E + 11] = H, N[E + 14] = r, F[E + 15] = W, F[E + 16] = j, N[E + 19] = r), U(B, V), F[E + 2] = x.x, F[E + 3] = x.y, F[E + 7] = A.x, F[E + 8] = A.y, F[E + 12] = b.x, F[E + 13] = b.y, F[E + 17] = C.x, F[E + 18] = C.y, E += 20, R.adjust(4, 6), S._count += 6, w++, J > 0 && G(m, f), w >= d && k())) : J > 0 && G(m, f);
  39796. R.uploadData(), S._count > 0 && (I.material = T.material, I.node = L.node, I._flushIA(T.ia))
  39797. }
  39798. }, e.prototype.fillByTiledNode = function(t, e, i, n, s, o, a) {
  39799. t._updateLocalMatrix(), r.mat4.copy(y, t._matrix), r.vec3.set(v, -(n + M), -(a + D), 0), r.mat4.translate(y, y, v);
  39800. var l = y.m,
  39801. h = l[0],
  39802. c = l[1],
  39803. u = l[4],
  39804. _ = l[5],
  39805. f = l[12],
  39806. d = l[13],
  39807. p = t._color._val;
  39808. e[E] = n * h + o * u + f, e[E + 1] = n * c + o * _ + d, i[E + 4] = p, e[E + 5] = n * h + a * u + f, e[E + 6] = n * c + a * _ + d, i[E + 9] = p, e[E + 10] = s * h + o * u + f, e[E + 11] = s * c + o * _ + d, i[E + 14] = p, e[E + 15] = s * h + a * u + f, e[E + 16] = s * c + a * _ + d, i[E + 19] = p
  39809. }, e
  39810. })(n.default);
  39811. i.default = z, n.default.register(l, z), e.exports = i.default
  39812. }), {
  39813. "../core/renderer/": 247,
  39814. "../core/renderer/assembler": 227,
  39815. "../core/renderer/render-flow": 248,
  39816. "../core/renderer/webgl/vertex-format": 288,
  39817. "../core/vmath": 326,
  39818. "./CCTiledLayer": 386,
  39819. "./CCTiledMap": 387
  39820. }],
  39821. 395: [(function(t, e, i) {
  39822. "use strict";
  39823. var n = t("./video-player-impl"),
  39824. r = n.EventType,
  39825. s = cc.Enum({
  39826. REMOTE: 0,
  39827. LOCAL: 1
  39828. }),
  39829. o = cc.Class({
  39830. name: "cc.VideoPlayer",
  39831. extends: cc.Component,
  39832. editor: !1,
  39833. properties: {
  39834. _resourceType: s.REMOTE,
  39835. resourceType: {
  39836. tooltip: !1,
  39837. type: s,
  39838. set: function(t) {
  39839. this._resourceType = t, this._updateVideoSource()
  39840. },
  39841. get: function() {
  39842. return this._resourceType
  39843. }
  39844. },
  39845. _remoteURL: "",
  39846. remoteURL: {
  39847. tooltip: !1,
  39848. type: cc.String,
  39849. set: function(t) {
  39850. this._remoteURL = t, this._updateVideoSource()
  39851. },
  39852. get: function() {
  39853. return this._remoteURL
  39854. }
  39855. },
  39856. _clip: {
  39857. default: null,
  39858. type: cc.Asset
  39859. },
  39860. clip: {
  39861. tooltip: !1,
  39862. get: function() {
  39863. return this._clip
  39864. },
  39865. set: function(t) {
  39866. this._clip = t, this._updateVideoSource()
  39867. },
  39868. type: cc.Asset
  39869. },
  39870. currentTime: {
  39871. tooltip: !1,
  39872. type: cc.Float,
  39873. set: function(t) {
  39874. this._impl && this._impl.seekTo(t)
  39875. },
  39876. get: function() {
  39877. return this._impl ? this._impl.currentTime() : -1
  39878. }
  39879. },
  39880. _volume: 1,
  39881. volume: {
  39882. get: function() {
  39883. return this._volume
  39884. },
  39885. set: function(t) {
  39886. this._volume = t, this.isPlaying() && !this._mute && this._syncVolume()
  39887. },
  39888. range: [0, 1],
  39889. type: cc.Float,
  39890. tooltip: !1
  39891. },
  39892. _mute: !1,
  39893. mute: {
  39894. get: function() {
  39895. return this._mute
  39896. },
  39897. set: function(t) {
  39898. this._mute = t, this._syncVolume()
  39899. },
  39900. tooltip: !1
  39901. },
  39902. keepAspectRatio: {
  39903. tooltip: !1,
  39904. default: !0,
  39905. type: cc.Boolean,
  39906. notify: function() {
  39907. this._impl && this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio)
  39908. }
  39909. },
  39910. _isFullscreen: {
  39911. default: !1,
  39912. formerlySerializedAs: "_N$isFullscreen"
  39913. },
  39914. isFullscreen: {
  39915. get: function() {
  39916. return this._isFullscreen = this._impl && this._impl.isFullScreenEnabled(), this._isFullscreen
  39917. },
  39918. set: function(t) {
  39919. this._isFullscreen = t, this._impl && this._impl.setFullScreenEnabled(t)
  39920. },
  39921. animatable: !1,
  39922. tooltip: !1
  39923. },
  39924. videoPlayerEvent: {
  39925. default: [],
  39926. type: cc.Component.EventHandler
  39927. }
  39928. },
  39929. statics: {
  39930. EventType: r,
  39931. ResourceType: s,
  39932. Impl: n
  39933. },
  39934. ctor: function() {
  39935. this._impl = new n
  39936. },
  39937. _syncVolume: function() {
  39938. var t = this._impl;
  39939. if (t) {
  39940. var e = this._mute ? 0 : this._volume;
  39941. t.setVolume(e)
  39942. }
  39943. },
  39944. _updateVideoSource: function() {
  39945. var t = "";
  39946. this.resourceType === s.REMOTE ? t = this.remoteURL : this._clip && (t = this._clip.nativeUrl || ""), t && cc.loader.md5Pipe && (t = cc.loader.md5Pipe.transformURL(t)), this._impl.setURL(t, this._mute || 0 === this._volume)
  39947. },
  39948. onLoad: function() {
  39949. var t = this._impl;
  39950. t && (t.createDomElementIfNeeded(this._mute || 0 === this._volume), this._updateVideoSource(), t.seekTo(this.currentTime), t.setKeepAspectRatioEnabled(this.keepAspectRatio), t.setFullScreenEnabled(this._isFullscreen), this.pause(), t.setEventListener(r.PLAYING, this.onPlaying.bind(this)), t.setEventListener(r.PAUSED, this.onPasued.bind(this)), t.setEventListener(r.STOPPED, this.onStopped.bind(this)), t.setEventListener(r.COMPLETED, this.onCompleted.bind(this)), t.setEventListener(r.META_LOADED, this.onMetaLoaded.bind(this)), t.setEventListener(r.CLICKED, this.onClicked.bind(this)), t.setEventListener(r.READY_TO_PLAY, this.onReadyToPlay.bind(this)))
  39951. },
  39952. onRestore: function() {
  39953. this._impl || (this._impl = new n)
  39954. },
  39955. onEnable: function() {
  39956. this._impl && this._impl.enable()
  39957. },
  39958. onDisable: function() {
  39959. this._impl && this._impl.disable()
  39960. },
  39961. onDestroy: function() {
  39962. this._impl && (this._impl.destroy(), this._impl = null)
  39963. },
  39964. update: function(t) {
  39965. this._impl && this._impl.updateMatrix(this.node)
  39966. },
  39967. onReadyToPlay: function() {
  39968. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.READY_TO_PLAY), this.node.emit("ready-to-play", this)
  39969. },
  39970. onMetaLoaded: function() {
  39971. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.META_LOADED), this.node.emit("meta-loaded", this)
  39972. },
  39973. onClicked: function() {
  39974. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.CLICKED), this.node.emit("clicked", this)
  39975. },
  39976. onPlaying: function() {
  39977. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.PLAYING), this.node.emit("playing", this)
  39978. },
  39979. onPasued: function() {
  39980. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.PAUSED), this.node.emit("paused", this)
  39981. },
  39982. onStopped: function() {
  39983. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.STOPPED), this.node.emit("stopped", this)
  39984. },
  39985. onCompleted: function() {
  39986. cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, r.COMPLETED), this.node.emit("completed", this)
  39987. },
  39988. play: function() {
  39989. this._impl && (this._syncVolume(), this._impl.play())
  39990. },
  39991. resume: function() {
  39992. this._impl && (this._syncVolume(), this._impl.resume())
  39993. },
  39994. pause: function() {
  39995. this._impl && this._impl.pause()
  39996. },
  39997. stop: function() {
  39998. this._impl && this._impl.stop()
  39999. },
  40000. getDuration: function() {
  40001. return this._impl ? this._impl.duration() : -1
  40002. },
  40003. isPlaying: function() {
  40004. return !!this._impl && this._impl.isPlaying()
  40005. }
  40006. });
  40007. cc.VideoPlayer = e.exports = o
  40008. }), {
  40009. "./video-player-impl": 396
  40010. }],
  40011. 396: [(function(t, e, i) {
  40012. "use strict";
  40013. var n = t("../core/vmath"),
  40014. r = t("../core/platform/utils"),
  40015. s = t("../core/platform/CCSys"),
  40016. o = {
  40017. HAVE_NOTHING: 0,
  40018. HAVE_METADATA: 1,
  40019. HAVE_CURRENT_DATA: 2,
  40020. HAVE_FUTURE_DATA: 3,
  40021. HAVE_ENOUGH_DATA: 4
  40022. },
  40023. a = n.mat4.create(),
  40024. l = cc.Class({
  40025. name: "VideoPlayerImpl",
  40026. ctor: function() {
  40027. this._EventList = {}, this._video = null, this._url = "", this._waitingFullscreen = !1, this._fullScreenEnabled = !1, this._loadedmeta = !1, this._loaded = !1, this._visible = !1, this._playing = !1, this._ignorePause = !1, this._forceUpdate = !1, this._m00 = 0, this._m01 = 0, this._m04 = 0, this._m05 = 0, this._m12 = 0, this._m13 = 0, this._w = 0, this._h = 0, this.__eventListeners = {}
  40028. },
  40029. _bindEvent: function() {
  40030. var t = this._video,
  40031. e = this,
  40032. i = this.__eventListeners;
  40033. i.loadedmetadata = function() {
  40034. e._loadedmeta = !0, e._forceUpdate = !0, e._waitingFullscreen && (e._waitingFullscreen = !1, e._toggleFullscreen(!0)), e._dispatchEvent(l.EventType.META_LOADED)
  40035. }, i.ended = function() {
  40036. e._video === t && (e._playing = !1, e._dispatchEvent(l.EventType.COMPLETED))
  40037. }, i.play = function() {
  40038. e._video === t && (e._playing = !0, e._updateVisibility(), e._dispatchEvent(l.EventType.PLAYING))
  40039. }, i.pause = function() {
  40040. e._video === t && (e._playing = !1, e._ignorePause || e._dispatchEvent(l.EventType.PAUSED))
  40041. }, i.click = function() {
  40042. e._dispatchEvent(l.EventType.CLICKED)
  40043. }, t.addEventListener("loadedmetadata", i.loadedmetadata), t.addEventListener("ended", i.ended), t.addEventListener("play", i.play), t.addEventListener("pause", i.pause), t.addEventListener("click", i.click), i.onCanPlay = function() {
  40044. if (!e._loaded && !e._playing) {
  40045. var t = e._video;
  40046. t.readyState !== o.HAVE_ENOUGH_DATA && t.readyState !== o.HAVE_METADATA || (t.currentTime = 0, e._loaded = !0, e._forceUpdate = !0, e._dispatchEvent(l.EventType.READY_TO_PLAY), e._updateVisibility())
  40047. }
  40048. }, t.addEventListener("canplay", i.onCanPlay), t.addEventListener("canplaythrough", i.onCanPlay), t.addEventListener("suspend", i.onCanPlay)
  40049. },
  40050. _updateVisibility: function() {
  40051. var t = this._video;
  40052. t && (this._visible ? t.style.visibility = "visible" : (t.style.visibility = "hidden", t.pause(), this._playing = !1))
  40053. },
  40054. _updateSize: function(t, e) {
  40055. var i = this._video;
  40056. i && (i.style.width = t + "px", i.style.height = e + "px")
  40057. },
  40058. _createDom: function(t) {
  40059. var e = document.createElement("video");
  40060. e.style.position = "absolute", e.style.bottom = "0px", e.style.left = "0px", e.className = "cocosVideo", e.setAttribute("preload", "auto"), e.setAttribute("webkit-playsinline", ""), e.setAttribute("x5-playsinline", ""), e.setAttribute("playsinline", ""), t && e.setAttribute("muted", ""), this._video = e, cc.game.container.appendChild(e)
  40061. },
  40062. createDomElementIfNeeded: function(t) {
  40063. this._video || this._createDom(t)
  40064. },
  40065. removeDom: function() {
  40066. var t = this._video;
  40067. if (t) {
  40068. r.contains(cc.game.container, t) && cc.game.container.removeChild(t);
  40069. var e = this.__eventListeners;
  40070. t.removeEventListener("loadedmetadata", e.loadedmetadata), t.removeEventListener("ended", e.ended), t.removeEventListener("play", e.play), t.removeEventListener("pause", e.pause), t.removeEventListener("click", e.click), t.removeEventListener("canplay", e.onCanPlay), t.removeEventListener("canplaythrough", e.onCanPlay), t.removeEventListener("suspend", e.onCanPlay), e.loadedmetadata = null, e.ended = null, e.play = null, e.pause = null, e.click = null, e.onCanPlay = null
  40071. }
  40072. this._video = null, this._url = ""
  40073. },
  40074. setURL: function(t, e) {
  40075. var i, n = void 0;
  40076. if (this._url !== t) {
  40077. this._url = t, this.removeDom(), this.createDomElementIfNeeded(e), this._bindEvent();
  40078. var r = this._video;
  40079. r.style.visibility = "hidden", this._loaded = !1, this._playing = !1, this._loadedmeta = !1, (n = document.createElement("source")).src = t, r.appendChild(n), i = cc.path.extname(t);
  40080. for (var s = l._polyfill, o = 0; o < s.canPlayType.length; o++) i !== s.canPlayType[o] && ((n = document.createElement("source")).src = t.replace(i, s.canPlayType[o]), r.appendChild(n))
  40081. }
  40082. },
  40083. getURL: function() {
  40084. return this._url
  40085. },
  40086. play: function() {
  40087. var t = this._video;
  40088. if (t && this._visible && !this._playing)
  40089. if (l._polyfill.autoplayAfterOperation) {
  40090. setTimeout((function() {
  40091. t.play()
  40092. }), 20)
  40093. } else t.play()
  40094. },
  40095. pause: function() {
  40096. var t = this._video;
  40097. this._playing && t && t.pause()
  40098. },
  40099. resume: function() {
  40100. this.play()
  40101. },
  40102. stop: function() {
  40103. var t = this._video;
  40104. t && this._visible && (this._ignorePause = !0, t.currentTime = 0, t.pause(), setTimeout(function() {
  40105. this._dispatchEvent(l.EventType.STOPPED), this._ignorePause = !1
  40106. }.bind(this), 0))
  40107. },
  40108. setVolume: function(t) {
  40109. var e = this._video;
  40110. e && (e.volume = t)
  40111. },
  40112. seekTo: function(t) {
  40113. var e = this._video;
  40114. if (e) {
  40115. if (this._loaded) e.currentTime = t;
  40116. else {
  40117. e.addEventListener(l._polyfill.event, (function i() {
  40118. e.currentTime = t, e.removeEventListener(l._polyfill.event, i)
  40119. }))
  40120. }
  40121. l._polyfill.autoplayAfterOperation && this.isPlaying() && setTimeout((function() {
  40122. e.play()
  40123. }), 20)
  40124. }
  40125. },
  40126. isPlaying: function() {
  40127. var t = this._video;
  40128. return l._polyfill.autoplayAfterOperation && this._playing && setTimeout((function() {
  40129. t.play()
  40130. }), 20), this._playing
  40131. },
  40132. duration: function() {
  40133. var t = this._video,
  40134. e = -1;
  40135. return t ? (e = t.duration, e <= 0 && cc.logID(7702), e) : e
  40136. },
  40137. currentTime: function() {
  40138. var t = this._video;
  40139. return t ? t.currentTime : -1
  40140. },
  40141. setKeepAspectRatioEnabled: function() {
  40142. cc.logID(7700)
  40143. },
  40144. isKeepAspectRatioEnabled: function() {
  40145. return !0
  40146. },
  40147. _toggleFullscreen: function(t) {
  40148. var e = this,
  40149. i = this._video;
  40150. i && (t ? (s.browserType === s.BROWSER_TYPE_IE && (i.style.transform = ""), cc.screen.requestFullScreen(i, (function(t) {
  40151. var n = s.browserType === s.BROWSER_TYPE_IE ? document.msFullscreenElement : document.fullscreenElement;
  40152. e._fullScreenEnabled = n === i
  40153. }), (function(t) {
  40154. e._fullScreenEnabled = !1
  40155. }))) : cc.screen.fullScreen() && cc.screen.exitFullScreen(i))
  40156. },
  40157. setFullScreenEnabled: function(t) {
  40158. !this._loadedmeta && t ? this._waitingFullscreen = !0 : this._toggleFullscreen(t)
  40159. },
  40160. isFullScreenEnabled: function() {
  40161. return this._fullScreenEnabled
  40162. },
  40163. setEventListener: function(t, e) {
  40164. this._EventList[t] = e
  40165. },
  40166. removeEventListener: function(t) {
  40167. this._EventList[t] = null
  40168. },
  40169. _dispatchEvent: function(t) {
  40170. var e = this._EventList[t];
  40171. e && e.call(this, this, this._video.src)
  40172. },
  40173. onPlayEvent: function() {
  40174. this._EventList[l.EventType.PLAYING].call(this, this, this._video.src)
  40175. },
  40176. enable: function() {
  40177. var t = l.elements; - 1 === t.indexOf(this) && t.push(this), this.setVisible(!0)
  40178. },
  40179. disable: function() {
  40180. var t = l.elements,
  40181. e = t.indexOf(this); - 1 !== e && t.splice(e, 1), this.setVisible(!1)
  40182. },
  40183. destroy: function() {
  40184. this.disable(), this.removeDom()
  40185. },
  40186. setVisible: function(t) {
  40187. this._visible !== t && (this._visible = !!t, this._updateVisibility())
  40188. },
  40189. updateMatrix: function(t) {
  40190. if (this._video && this._visible && !this._fullScreenEnabled) {
  40191. t.getWorldMatrix(a);
  40192. var e = cc.Camera._findRendererCamera(t);
  40193. e && e.worldMatrixToScreen(a, a, cc.game.canvas.width, cc.game.canvas.height);
  40194. var i = a.m;
  40195. if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
  40196. this._m00 = i[0], this._m01 = i[1], this._m04 = i[4], this._m05 = i[5], this._m12 = i[12], this._m13 = i[13], this._w = t._contentSize.width, this._h = t._contentSize.height;
  40197. var n = cc.view._devicePixelRatio,
  40198. r = 1 / n,
  40199. s = 1 / n,
  40200. o = cc.game.container,
  40201. h = i[0] * r,
  40202. c = i[1],
  40203. u = i[4],
  40204. _ = i[5] * s,
  40205. f = o && o.style.paddingLeft ? parseInt(o.style.paddingLeft) : 0,
  40206. d = o && o.style.paddingBottom ? parseInt(o.style.paddingBottom) : 0,
  40207. p = void 0,
  40208. m = void 0;
  40209. l._polyfill.zoomInvalid ? (this._updateSize(this._w * h, this._h * _), h = 1, _ = 1, p = this._w * r, m = this._h * s) : (p = this._w * r, m = this._h * s, this._updateSize(this._w, this._h));
  40210. var y = p * i[0] * t._anchorPoint.x,
  40211. v = m * i[5] * t._anchorPoint.y,
  40212. g = "matrix(" + h + "," + -c + "," + -u + "," + _ + "," + (i[12] * r - y + f) + "," + -(i[13] * s - v + d) + ")";
  40213. this._video.style.transform = g, this._video.style["-webkit-transform"] = g, this._video.style["transform-origin"] = "0px 100% 0px", this._video.style["-webkit-transform-origin"] = "0px 100% 0px", this._forceUpdate = !1
  40214. }
  40215. }
  40216. }
  40217. });
  40218. l.EventType = {
  40219. PLAYING: 0,
  40220. PAUSED: 1,
  40221. STOPPED: 2,
  40222. COMPLETED: 3,
  40223. META_LOADED: 4,
  40224. CLICKED: 5,
  40225. READY_TO_PLAY: 6
  40226. }, l.elements = [], l.pauseElements = [], cc.game.on(cc.game.EVENT_HIDE, (function() {
  40227. for (var t, e = l.elements, i = 0; i < e.length; i++)(t = e[i]).isPlaying() && (t.pause(), l.pauseElements.push(t))
  40228. })), cc.game.on(cc.game.EVENT_SHOW, (function() {
  40229. for (var t = l.pauseElements, e = t.pop(); e;) e.play(), e = t.pop()
  40230. })), l._polyfill = {
  40231. devicePixelRatio: !1,
  40232. event: "canplay",
  40233. canPlayType: []
  40234. };
  40235. var h = document.createElement("video");
  40236. h.canPlayType && (h.canPlayType("video/ogg") && (l._polyfill.canPlayType.push(".ogg"), l._polyfill.canPlayType.push(".ogv")), h.canPlayType("video/mp4") && l._polyfill.canPlayType.push(".mp4"), h.canPlayType("video/webm") && l._polyfill.canPlayType.push(".webm")), s.browserType === s.BROWSER_TYPE_FIREFOX && (l._polyfill.autoplayAfterOperation = !0), s.OS_ANDROID !== s.os || s.browserType !== s.BROWSER_TYPE_SOUGOU && s.browserType !== s.BROWSER_TYPE_360 || (l._polyfill.zoomInvalid = !0);
  40237. var c = document.createElement("style");
  40238. c.innerHTML = ".cocosVideo:-moz-full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:-webkit-full-screen{transform:matrix(1,0,0,1,0,0) !important;}", document.head.appendChild(c), e.exports = l
  40239. }), {
  40240. "../core/platform/CCSys": 207,
  40241. "../core/platform/utils": 222,
  40242. "../core/vmath": 326
  40243. }],
  40244. 397: [(function(t, e, i) {
  40245. "use strict";
  40246. var n = t("./webview-impl"),
  40247. r = n.EventType;
  40248. function s() {}
  40249. var o = cc.Class({
  40250. name: "cc.WebView",
  40251. extends: cc.Component,
  40252. editor: !1,
  40253. properties: {
  40254. _useOriginalSize: !0,
  40255. _url: "",
  40256. url: {
  40257. type: cc.String,
  40258. tooltip: !1,
  40259. get: function() {
  40260. return this._url
  40261. },
  40262. set: function(t) {
  40263. this._url = t;
  40264. var e = this._impl;
  40265. e && e.loadURL(t)
  40266. }
  40267. },
  40268. webviewEvents: {
  40269. default: [],
  40270. type: cc.Component.EventHandler
  40271. }
  40272. },
  40273. statics: {
  40274. EventType: r,
  40275. Impl: n
  40276. },
  40277. ctor: function() {
  40278. this._impl = new o.Impl
  40279. },
  40280. onRestore: function() {
  40281. this._impl || (this._impl = new o.Impl)
  40282. },
  40283. onEnable: function() {
  40284. var t = this._impl;
  40285. t.createDomElementIfNeeded(this.node.width, this.node.height), t.setEventListener(r.LOADED, this._onWebViewLoaded.bind(this)), t.setEventListener(r.LOADING, this._onWebViewLoading.bind(this)), t.setEventListener(r.ERROR, this._onWebViewLoadError.bind(this)), t.loadURL(this._url), t.setVisible(!0)
  40286. },
  40287. onDisable: function() {
  40288. var t = this._impl;
  40289. t.setVisible(!1), t.setEventListener(r.LOADED, s), t.setEventListener(r.LOADING, s), t.setEventListener(r.ERROR, s)
  40290. },
  40291. onDestroy: function() {
  40292. this._impl && (this._impl.destroy(), this._impl = null)
  40293. },
  40294. update: function(t) {
  40295. this._impl && this._impl.updateMatrix(this.node)
  40296. },
  40297. _onWebViewLoaded: function() {
  40298. cc.Component.EventHandler.emitEvents(this.webviewEvents, this, r.LOADED), this.node.emit("loaded", this)
  40299. },
  40300. _onWebViewLoading: function() {
  40301. return cc.Component.EventHandler.emitEvents(this.webviewEvents, this, r.LOADING), this.node.emit("loading", this), !0
  40302. },
  40303. _onWebViewLoadError: function() {
  40304. cc.Component.EventHandler.emitEvents(this.webviewEvents, this, r.ERROR), this.node.emit("error", this)
  40305. },
  40306. setJavascriptInterfaceScheme: function(t) {
  40307. this._impl && this._impl.setJavascriptInterfaceScheme(t)
  40308. },
  40309. setOnJSCallback: function(t) {
  40310. this._impl && this._impl.setOnJSCallback(t)
  40311. },
  40312. evaluateJS: function(t) {
  40313. this._impl && this._impl.evaluateJS(t)
  40314. }
  40315. });
  40316. cc.WebView = e.exports = o
  40317. }), {
  40318. "./webview-impl": 398
  40319. }],
  40320. 398: [(function(t, e, i) {
  40321. "use strict";
  40322. var n = t("../core/vmath"),
  40323. r = t("../core/platform/utils"),
  40324. s = t("../core/platform/CCSys"),
  40325. o = n.mat4.create(),
  40326. a = cc.Class({
  40327. name: "WebViewImpl",
  40328. ctor: function() {
  40329. this._EventList = {}, this._visible = !1, this._parent = null, this._div = null, this._iframe = null, this._listener = null, this._forceUpdate = !1, this._m00 = 0, this._m01 = 0, this._m04 = 0, this._m05 = 0, this._m12 = 0, this._m13 = 0, this._w = 0, this._h = 0, this.__eventListeners = {}
  40330. },
  40331. _updateVisibility: function() {
  40332. if (this._div) {
  40333. var t = this._div;
  40334. this._visible ? t.style.visibility = "visible" : t.style.visibility = "hidden"
  40335. }
  40336. },
  40337. _updateSize: function(t, e) {
  40338. var i = this._div;
  40339. i && (i.style.width = t + "px", i.style.height = e + "px")
  40340. },
  40341. _initEvent: function() {
  40342. var t = this._iframe;
  40343. if (t) {
  40344. var e = this.__eventListeners,
  40345. i = this;
  40346. e.load = function() {
  40347. i._forceUpdate = !0, i._dispatchEvent(a.EventType.LOADED)
  40348. }, e.error = function() {
  40349. i._dispatchEvent(a.EventType.ERROR)
  40350. }, t.addEventListener("load", e.load), t.addEventListener("error", e.error)
  40351. }
  40352. },
  40353. _initStyle: function() {
  40354. if (this._div) {
  40355. var t = this._div;
  40356. t.style.position = "absolute", t.style.bottom = "0px", t.style.left = "0px"
  40357. }
  40358. },
  40359. _setOpacity: function(t) {
  40360. var e = this._iframe;
  40361. e && e.style && (e.style.opacity = t / 255)
  40362. },
  40363. _createDom: function(t, e) {
  40364. a._polyfill.enableDiv ? (this._div = document.createElement("div"), this._div.style["-webkit-overflow"] = "auto", this._div.style["-webkit-overflow-scrolling"] = "touch", this._iframe = document.createElement("iframe"), this._div.appendChild(this._iframe), this._iframe.style.width = "100%", this._iframe.style.height = "100%") : this._div = this._iframe = document.createElement("iframe"), a._polyfill.enableBG && (this._div.style.background = "#FFF"), this._div.style.background = "#FFF", this._div.style.height = e + "px", this._div.style.width = t + "px", this._div.style.overflow = "scroll", this._iframe.style.border = "none", cc.game.container.appendChild(this._div), this._updateVisibility()
  40365. },
  40366. _createNativeControl: function(t, e) {
  40367. this._createDom(t, e), this._initStyle(), this._initEvent()
  40368. },
  40369. createDomElementIfNeeded: function(t, e) {
  40370. this._div ? this._updateSize(t, e) : this._createNativeControl(t, e)
  40371. },
  40372. removeDom: function() {
  40373. var t = this._div;
  40374. t && (r.contains(cc.game.container, t) && cc.game.container.removeChild(t), this._div = null);
  40375. var e = this._iframe;
  40376. if (e) {
  40377. var i = this.__eventListeners;
  40378. e.removeEventListener("load", i.load), e.removeEventListener("error", i.error), i.load = null, i.error = null, this._iframe = null
  40379. }
  40380. },
  40381. setOnJSCallback: function(t) {},
  40382. setJavascriptInterfaceScheme: function(t) {},
  40383. loadData: function(t, e, i, n) {},
  40384. loadHTMLString: function(t, e) {},
  40385. loadURL: function(t) {
  40386. var e = this._iframe;
  40387. if (e) {
  40388. e.src = t;
  40389. var i = this;
  40390. e.addEventListener("load", (function t() {
  40391. i._loaded = !0, i._updateVisibility(), e.removeEventListener("load", t)
  40392. })), this._dispatchEvent(a.EventType.LOADING)
  40393. }
  40394. },
  40395. stopLoading: function() {
  40396. cc.logID(7800)
  40397. },
  40398. reload: function() {
  40399. var t = this._iframe;
  40400. if (t) {
  40401. var e = t.contentWindow;
  40402. e && e.location && e.location.reload()
  40403. }
  40404. },
  40405. canGoBack: function() {
  40406. return cc.logID(7801), !0
  40407. },
  40408. canGoForward: function() {
  40409. return cc.logID(7802), !0
  40410. },
  40411. goBack: function() {
  40412. try {
  40413. if (a._polyfill.closeHistory) return cc.logID(7803);
  40414. var t = this._iframe;
  40415. if (t) {
  40416. var e = t.contentWindow;
  40417. e && e.location && e.history.back.call(e)
  40418. }
  40419. } catch (t) {
  40420. cc.log(t)
  40421. }
  40422. },
  40423. goForward: function() {
  40424. try {
  40425. if (a._polyfill.closeHistory) return cc.logID(7804);
  40426. var t = this._iframe;
  40427. if (t) {
  40428. var e = t.contentWindow;
  40429. e && e.location && e.history.forward.call(e)
  40430. }
  40431. } catch (t) {
  40432. cc.log(t)
  40433. }
  40434. },
  40435. evaluateJS: function(t) {
  40436. var e = this._iframe;
  40437. if (e) {
  40438. var i = e.contentWindow;
  40439. try {
  40440. i.eval(t), this._dispatchEvent(a.EventType.JS_EVALUATED)
  40441. } catch (t) {
  40442. console.error(t)
  40443. }
  40444. }
  40445. },
  40446. setScalesPageToFit: function() {
  40447. cc.logID(7805)
  40448. },
  40449. setEventListener: function(t, e) {
  40450. this._EventList[t] = e
  40451. },
  40452. removeEventListener: function(t) {
  40453. this._EventList[t] = null
  40454. },
  40455. _dispatchEvent: function(t) {
  40456. var e = this._EventList[t];
  40457. e && e.call(this, this, this._iframe.src)
  40458. },
  40459. _createRenderCmd: function() {
  40460. return new a.RenderCmd(this)
  40461. },
  40462. destroy: function() {
  40463. this.removeDom()
  40464. },
  40465. setVisible: function(t) {
  40466. this._visible !== t && (this._visible = !!t, this._updateVisibility())
  40467. },
  40468. updateMatrix: function(t) {
  40469. if (this._div && this._visible) {
  40470. t.getWorldMatrix(o);
  40471. var e = cc.Camera._findRendererCamera(t);
  40472. e && e.worldMatrixToScreen(o, o, cc.game.canvas.width, cc.game.canvas.height);
  40473. var i = o.m;
  40474. if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) {
  40475. this._m00 = i[0], this._m01 = i[1], this._m04 = i[4], this._m05 = i[5], this._m12 = i[12], this._m13 = i[13], this._w = t._contentSize.width, this._h = t._contentSize.height;
  40476. var n = cc.view._devicePixelRatio,
  40477. r = 1 / n,
  40478. s = 1 / n,
  40479. a = cc.game.container,
  40480. l = i[0] * r,
  40481. h = i[1],
  40482. c = i[4],
  40483. u = i[5] * s,
  40484. _ = a && a.style.paddingLeft ? parseInt(a.style.paddingLeft) : 0,
  40485. f = a && a.style.paddingBottom ? parseInt(a.style.paddingBottom) : 0;
  40486. this._updateSize(this._w, this._h);
  40487. var d = this._w * r,
  40488. p = this._h * s,
  40489. m = d * i[0] * t._anchorPoint.x,
  40490. y = p * i[5] * t._anchorPoint.y,
  40491. v = "matrix(" + l + "," + -h + "," + -c + "," + u + "," + (i[12] * r - m + _) + "," + -(i[13] * s - y + f) + ")";
  40492. this._div.style.transform = v, this._div.style["-webkit-transform"] = v, this._div.style["transform-origin"] = "0px 100% 0px", this._div.style["-webkit-transform-origin"] = "0px 100% 0px", this._setOpacity(t.opacity), this._forceUpdate = !1
  40493. }
  40494. }
  40495. }
  40496. });
  40497. a.EventType = {
  40498. LOADING: 0,
  40499. LOADED: 1,
  40500. ERROR: 2,
  40501. JS_EVALUATED: 3
  40502. };
  40503. var l = a._polyfill = {
  40504. devicePixelRatio: !1,
  40505. enableDiv: !1
  40506. };
  40507. s.os === s.OS_IOS && (l.enableDiv = !0), s.isMobile ? s.browserType === s.BROWSER_TYPE_FIREFOX && (l.enableBG = !0) : s.browserType === s.BROWSER_TYPE_IE && (l.closeHistory = !0), e.exports = a
  40508. }), {
  40509. "../core/platform/CCSys": 207,
  40510. "../core/platform/utils": 222,
  40511. "../core/vmath": 326
  40512. }],
  40513. 399: [(function(t, e, i) {
  40514. "use strict";
  40515. t("./cocos2d/core"), t("./cocos2d/animation"), t("./cocos2d/particle"), t("./cocos2d/tilemap"), t("./cocos2d/videoplayer/CCVideoPlayer"), t("./cocos2d/webview/CCWebView"), t("./cocos2d/core/components/CCStudioComponent"), t("./extensions/ccpool/CCNodePool"), t("./cocos2d/actions"), t("./extensions/spine"), t("./extensions/dragonbones"), t("./cocos2d/deprecated")
  40516. }), {
  40517. "./cocos2d/actions": 7,
  40518. "./cocos2d/animation": 16,
  40519. "./cocos2d/core": 144,
  40520. "./cocos2d/core/components/CCStudioComponent": 112,
  40521. "./cocos2d/deprecated": 337,
  40522. "./cocos2d/particle": 343,
  40523. "./cocos2d/particle/CCParticleAsset": 340,
  40524. "./cocos2d/tilemap": 392,
  40525. "./cocos2d/tilemap/CCTiledMapAsset": 388,
  40526. "./cocos2d/videoplayer/CCVideoPlayer": 395,
  40527. "./cocos2d/webview/CCWebView": 397,
  40528. "./extensions/ccpool/CCNodePool": 400,
  40529. "./extensions/dragonbones": 409,
  40530. "./extensions/spine": 413
  40531. }],
  40532. 400: [(function(t, e, i) {
  40533. "use strict";
  40534. cc.NodePool = function(t) {
  40535. this.poolHandlerComp = t, this._pool = []
  40536. }, cc.NodePool.prototype = {
  40537. constructor: cc.NodePool,
  40538. size: function() {
  40539. return this._pool.length
  40540. },
  40541. clear: function() {
  40542. for (var t = this._pool.length, e = 0; e < t; ++e) this._pool[e].destroy();
  40543. this._pool.length = 0
  40544. },
  40545. put: function(t) {
  40546. if (t && -1 === this._pool.indexOf(t)) {
  40547. t.removeFromParent(!1);
  40548. var e = this.poolHandlerComp ? t.getComponent(this.poolHandlerComp) : null;
  40549. e && e.unuse && e.unuse(), this._pool.push(t)
  40550. }
  40551. },
  40552. get: function() {
  40553. var t = this._pool.length - 1;
  40554. if (t < 0) return null;
  40555. var e = this._pool[t];
  40556. this._pool.length = t;
  40557. var i = this.poolHandlerComp ? e.getComponent(this.poolHandlerComp) : null;
  40558. return i && i.reuse && i.reuse.apply(i, arguments), e
  40559. }
  40560. }, e.exports = cc.NodePool
  40561. }), {}],
  40562. 401: [(function(t, e, i) {
  40563. "use strict";
  40564. var n = [],
  40565. r = [],
  40566. s = 0,
  40567. o = 0,
  40568. a = null,
  40569. l = null,
  40570. h = 0,
  40571. c = 0,
  40572. u = 0,
  40573. _ = 0,
  40574. f = null,
  40575. d = void 0,
  40576. p = void 0,
  40577. m = cc.Class({
  40578. ctor: function() {
  40579. this._inited = !1, this._invalid = !0, this.frames = [], this.totalTime = 0, this.isCompleted = !1, this._frameIdx = -1, this._armatureInfo = null, this._animationName = null, this._tempSegments = null, this._tempColors = null
  40580. },
  40581. init: function(t, e) {
  40582. this._inited = !0, this._armatureInfo = t, this._animationName = e
  40583. },
  40584. clear: function() {
  40585. this._inited = !1;
  40586. for (var t = 0, e = this.frames.length; t < e; t++) {
  40587. this.frames[t].segments.length = 0
  40588. }
  40589. this.invalidAllFrame()
  40590. },
  40591. begin: function() {
  40592. if (this._invalid) {
  40593. var t = this._armatureInfo,
  40594. e = t.curAnimationCache;
  40595. e && e != this && e.updateToFrame(), t.armature.animation.play(this._animationName, 1), t.curAnimationCache = this, this._invalid = !1, this._frameIdx = -1, this.totalTime = 0, this.isCompleted = !1
  40596. }
  40597. },
  40598. end: function() {
  40599. this._needToUpdate() || (this._armatureInfo.curAnimationCache = null, this.frames.length = this._frameIdx + 1, this.isCompleted = !0)
  40600. },
  40601. _needToUpdate: function(t) {
  40602. return !this._armatureInfo.armature.animation.isCompleted && this.totalTime < 30 && (void 0 == t || this._frameIdx < t)
  40603. },
  40604. updateToFrame: function(t) {
  40605. if (this._inited && (this.begin(), this._needToUpdate(t))) {
  40606. var e = this._armatureInfo.armature;
  40607. do {
  40608. e.advanceTime(1 / 60), this._frameIdx++, this._updateFrame(e, this._frameIdx), this.totalTime += 1 / 60
  40609. } while (this._needToUpdate(t));
  40610. this.end()
  40611. }
  40612. },
  40613. isInited: function() {
  40614. return this._inited
  40615. },
  40616. isInvalid: function() {
  40617. return this._invalid
  40618. },
  40619. invalidAllFrame: function() {
  40620. this.isCompleted = !1, this._invalid = !0
  40621. },
  40622. updateAllFrame: function() {
  40623. this.invalidAllFrame(), this.updateToFrame()
  40624. },
  40625. _updateFrame: function(t, e) {
  40626. o = 0, s = 0, 0, a = null, l = null, h = 0, c = 0, u = 0, _ = 0, f = null, this.frames[e] = this.frames[e] || {
  40627. segments: [],
  40628. colors: [],
  40629. vertices: null,
  40630. uintVert: null,
  40631. indices: null
  40632. };
  40633. var i = this.frames[e],
  40634. d = this._tempSegments = i.segments,
  40635. p = this._tempColors = i.colors;
  40636. this._traverseArmature(t, 1), _ > 0 && (p[_ - 1].vfOffset = o), p.length = _;
  40637. var m = u - 1;
  40638. if (m >= 0)
  40639. if (c > 0) {
  40640. var y = d[m];
  40641. y.indexCount = c, y.vfCount = 5 * h, y.vertexCount = h, d.length = u
  40642. } else d.length = u - 1;
  40643. if (0 !== d.length) {
  40644. var v = i.vertices,
  40645. g = i.uintVert;
  40646. (!v || v.length < o) && (v = i.vertices = new Float32Array(o), g = i.uintVert = new Uint32Array(v.buffer));
  40647. for (var x = 0, b = 0; x < o;) v[x++] = n[b++], v[x++] = n[b++], v[x++] = n[b++], v[x++] = n[b++], g[x++] = n[b++];
  40648. var A = i.indices;
  40649. (!A || A.length < s) && (A = i.indices = new Uint16Array(s));
  40650. for (var C = 0; C < s; C++) A[C] = r[C];
  40651. i.vertices = v, i.uintVert = g, i.indices = A
  40652. }
  40653. },
  40654. _traverseArmature: function(t, e) {
  40655. for (var i = this._tempColors, m = this._tempSegments, y = n, v = r, g = void 0, x = void 0, b = t._slots, A = void 0, C = void 0, T = void 0, S = void 0, w = void 0, E = void 0, M = void 0, D = 0, B = b.length; D < B; D++)
  40656. if ((A = b[D])._visible && A._displayData)
  40657. if (A.updateWorldMatrix(), T = A._color, A.childArmature) this._traverseArmature(A.childArmature, e * T.a / 255);
  40658. else if (w = A.getTexture()) {
  40659. a === w.url && l === A._blendMode || (a = w.url, l = A._blendMode, (E = u - 1) >= 0 && (c > 0 ? ((M = m[E]).indexCount = c, M.vertexCount = h, M.vfCount = 5 * h) : u--), m[u] = {
  40660. tex: w,
  40661. blendMode: A._blendMode,
  40662. indexCount: 0,
  40663. vertexCount: 0,
  40664. vfCount: 0
  40665. }, u++, c = 0, h = 0), S = (T.a * e << 24 >>> 0) + (T.b << 16) + (T.g << 8) + T.r, f !== S && (f = S, _ > 0 && (i[_ - 1].vfOffset = o), i[_++] = {
  40666. r: T.r,
  40667. g: T.g,
  40668. b: T.b,
  40669. a: T.a * e,
  40670. vfOffset: 0
  40671. }), g = A._localVertices, x = A._indices, C = A._worldMatrix.m;
  40672. for (var I = 0, P = g.length; I < P;) d = g[I++], p = g[I++], y[o++] = d * C[0] + p * C[4] + C[12], y[o++] = d * C[1] + p * C[5] + C[13], y[o++] = g[I++], y[o++] = g[I++], y[o++] = S;
  40673. for (var R = 0, O = x.length; R < O; R++) v[s++] = h + x[R];
  40674. o / 5, c += x.length, h += g.length / 4
  40675. }
  40676. }
  40677. }),
  40678. y = cc.Class({
  40679. ctor: function() {
  40680. this._animationPool = {}, this._armatureCache = {}
  40681. },
  40682. dispose: function() {
  40683. for (var t in this._armatureCache) {
  40684. var e = this._armatureCache[t];
  40685. if (e) {
  40686. var i = e.armature;
  40687. i && i.dispose()
  40688. }
  40689. }
  40690. this._armatureCache = null, this._animationPool = null
  40691. },
  40692. _removeArmature: function(t) {
  40693. var e = this._armatureCache[t],
  40694. i = e.animationsCache;
  40695. for (var n in i) {
  40696. var r = i[n];
  40697. r && (this._animationPool[t + "#" + n] = r, r.clear())
  40698. }
  40699. var s = e.armature;
  40700. s && s.dispose(), delete this._armatureCache[t]
  40701. },
  40702. resetArmature: function(t) {
  40703. for (var e in this._armatureCache) - 1 != e.indexOf(t) && this._removeArmature(e)
  40704. },
  40705. getArmatureCache: function(t, e, i) {
  40706. var n = this._armatureCache[e],
  40707. r = void 0;
  40708. if (n) r = n.armature;
  40709. else {
  40710. var s = dragonBones.CCFactory.getInstance().buildArmatureDisplay(t, e, "", i);
  40711. if (!s || !s._armature) return;
  40712. if (r = s._armature, !y.canCache(r)) return void r.dispose();
  40713. this._armatureCache[e] = {
  40714. armature: r,
  40715. animationsCache: {},
  40716. curAnimationCache: null
  40717. }
  40718. }
  40719. return r
  40720. },
  40721. getAnimationCache: function(t, e) {
  40722. var i = this._armatureCache[t];
  40723. return i ? i.animationsCache[e] : null
  40724. },
  40725. initAnimationCache: function(t, e) {
  40726. if (!e) return null;
  40727. var i = this._armatureCache[t],
  40728. n = i && i.armature;
  40729. if (!n) return null;
  40730. if (!n.animation.hasAnimation(e)) return null;
  40731. var r = i.animationsCache,
  40732. s = r[e];
  40733. if (!s) {
  40734. var o = t + "#" + e;
  40735. (s = this._animationPool[o]) ? delete this._animationPool[o]: s = new m, s.init(i, e), r[e] = s
  40736. }
  40737. return s
  40738. },
  40739. invalidAnimationCache: function(t) {
  40740. var e = this._armatureCache[t];
  40741. if (!(e && e.armature)) return null;
  40742. var i = e.animationsCache;
  40743. for (var n in i) {
  40744. i[n].invalidAllFrame()
  40745. }
  40746. },
  40747. updateAnimationCache: function(t, e) {
  40748. if (e) {
  40749. var i = this.initAnimationCache(t, e);
  40750. if (!i) return;
  40751. i.updateAllFrame()
  40752. } else {
  40753. var n = this._armatureCache[t];
  40754. if (!(n && n.armature)) return null;
  40755. var r = n.animationsCache;
  40756. for (var s in r) {
  40757. r[s].updateAllFrame()
  40758. }
  40759. }
  40760. }
  40761. });
  40762. y.FrameTime = 1 / 60, y.sharedCache = new y, y.canCache = function(t) {
  40763. for (var e = t._slots, i = 0, n = e.length; i < n; i++) {
  40764. if (e[i].childArmature) return !1
  40765. }
  40766. return !0
  40767. }, e.exports = y
  40768. }), {}],
  40769. 402: [(function(t, e, i) {
  40770. "use strict";
  40771. var n = t("../../cocos2d/core/components/CCRenderComponent"),
  40772. r = t("../../cocos2d/core/assets/material/CCMaterial"),
  40773. s = t("../../cocos2d/core/event/event-target"),
  40774. o = (t("../../cocos2d/core/CCNode"), t("../../cocos2d/core/graphics/graphics")),
  40775. a = t("./ArmatureCache"),
  40776. l = cc.Enum({
  40777. default: -1
  40778. }),
  40779. h = cc.Enum({
  40780. "<None>": 0
  40781. }),
  40782. c = (cc.Enum({
  40783. REALTIME: 0
  40784. }), cc.Enum({
  40785. REALTIME: 0,
  40786. SHARED_CACHE: 1,
  40787. PRIVATE_CACHE: 2
  40788. }));
  40789. var u = cc.Class({
  40790. name: "dragonBones.ArmatureDisplay",
  40791. extends: n,
  40792. editor: !1,
  40793. statics: {
  40794. AnimationCacheMode: c
  40795. },
  40796. properties: {
  40797. _factory: {
  40798. default: null,
  40799. type: dragonBones.CCFactory,
  40800. serializable: !1
  40801. },
  40802. dragonAsset: {
  40803. default: null,
  40804. type: dragonBones.DragonBonesAsset,
  40805. notify: function() {
  40806. this._refresh()
  40807. },
  40808. tooltip: !1
  40809. },
  40810. dragonAtlasAsset: {
  40811. default: null,
  40812. type: dragonBones.DragonBonesAtlasAsset,
  40813. notify: function() {
  40814. this._parseDragonAtlasAsset(), this._refresh(), this._activateMaterial()
  40815. },
  40816. tooltip: !1
  40817. },
  40818. _armatureName: "",
  40819. armatureName: {
  40820. get: function() {
  40821. return this._armatureName
  40822. },
  40823. set: function(t) {
  40824. this._armatureName = t;
  40825. var e = this.getAnimationNames(this._armatureName);
  40826. (!this.animationName || e.indexOf(this.animationName) < 0) && (this.animationName = ""), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature), this._refresh(), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature)
  40827. },
  40828. visible: !1
  40829. },
  40830. _animationName: "",
  40831. animationName: {
  40832. get: function() {
  40833. return this._animationName
  40834. },
  40835. set: function(t) {
  40836. this._animationName = t
  40837. },
  40838. visible: !1
  40839. },
  40840. _defaultArmatureIndex: {
  40841. default: 0,
  40842. notify: function() {
  40843. var t = "";
  40844. if (this.dragonAsset) {
  40845. var e = void 0;
  40846. if (this.dragonAsset && (e = this.dragonAsset.getArmatureEnum()), !e) return cc.errorID(7400, this.name);
  40847. t = e[this._defaultArmatureIndex]
  40848. }
  40849. void 0 !== t ? this.armatureName = t : cc.errorID(7401, this.name)
  40850. },
  40851. type: l,
  40852. visible: !0,
  40853. editorOnly: !0,
  40854. animatable: !1,
  40855. displayName: "Armature",
  40856. tooltip: !1
  40857. },
  40858. _animationIndex: {
  40859. default: 0,
  40860. notify: function() {
  40861. if (0 !== this._animationIndex) {
  40862. var t = void 0;
  40863. if (this.dragonAsset && (t = this.dragonAsset.getAnimsEnum(this.armatureName)), t) {
  40864. var e = t[this._animationIndex];
  40865. void 0 !== e ? this.playAnimation(e, this.playTimes) : cc.errorID(7402, this.name)
  40866. }
  40867. } else this.animationName = ""
  40868. },
  40869. type: h,
  40870. visible: !0,
  40871. editorOnly: !0,
  40872. displayName: "Animation",
  40873. tooltip: !1
  40874. },
  40875. _preCacheMode: -1,
  40876. _cacheMode: c.REALTIME,
  40877. _defaultCacheMode: {
  40878. default: 0,
  40879. type: c,
  40880. notify: function() {
  40881. this.setAnimationCacheMode(this._defaultCacheMode)
  40882. },
  40883. editorOnly: !0,
  40884. visible: !0,
  40885. animatable: !1,
  40886. displayName: "Animation Cache Mode",
  40887. tooltip: !1
  40888. },
  40889. timeScale: {
  40890. default: 1,
  40891. notify: function() {
  40892. this._armature && !this.isAnimationCached() && (this._armature.animation.timeScale = this.timeScale)
  40893. },
  40894. tooltip: !1
  40895. },
  40896. playTimes: {
  40897. default: -1,
  40898. tooltip: !1
  40899. },
  40900. premultipliedAlpha: {
  40901. default: !1,
  40902. tooltip: !1
  40903. },
  40904. debugBones: {
  40905. default: !1,
  40906. notify: function() {
  40907. this._updateDebugDraw()
  40908. },
  40909. tooltip: !1
  40910. },
  40911. enableBatch: {
  40912. default: !1,
  40913. notify: function() {
  40914. this._updateBatch()
  40915. },
  40916. tooltip: !1
  40917. },
  40918. _armatureKey: "",
  40919. _accTime: 0,
  40920. _playCount: 0,
  40921. _frameCache: null,
  40922. _curFrame: null,
  40923. _playing: !1,
  40924. _armatureCache: null
  40925. },
  40926. ctor: function() {
  40927. this._eventTarget = new s, this._materialCache = {}, this._inited = !1, this._factory = dragonBones.CCFactory.getInstance()
  40928. },
  40929. onLoad: function() {
  40930. for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
  40931. var n = t[e];
  40932. 0 === (n._name && n._name.search("CHILD_ARMATURE-")) && n.destroy()
  40933. }
  40934. },
  40935. _updateBatch: function() {
  40936. var t = this.getMaterial(0);
  40937. t && t.define("CC_USE_MODEL", !this.enableBatch);
  40938. var e = this._materialCache;
  40939. for (var i in e) {
  40940. var n = e[i];
  40941. n && n.define("CC_USE_MODEL", !this.enableBatch)
  40942. }
  40943. },
  40944. setMaterial: function(t, e) {
  40945. this._super(t, e), this._materialCache = {}
  40946. },
  40947. __preload: function() {
  40948. this._resetAssembler(), this._init()
  40949. },
  40950. _init: function() {
  40951. if (!this._inited) {
  40952. this._inited = !0, this._parseDragonAtlasAsset(), this._refresh(), this._activateMaterial();
  40953. for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
  40954. var n = t[e];
  40955. n && "DEBUG_DRAW_NODE" === n._name && n.destroy()
  40956. }
  40957. this._updateDebugDraw()
  40958. }
  40959. },
  40960. getArmatureKey: function() {
  40961. return this._armatureKey
  40962. },
  40963. setAnimationCacheMode: function(t) {
  40964. this._preCacheMode !== t && (this._cacheMode = t, this._buildArmature())
  40965. },
  40966. isAnimationCached: function() {
  40967. return this._cacheMode !== c.REALTIME
  40968. },
  40969. onEnable: function() {
  40970. this._super(), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature), this._activateMaterial()
  40971. },
  40972. onDisable: function() {
  40973. this._super(), this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature)
  40974. },
  40975. _emitCacheCompleteEvent: function() {
  40976. this._eventTarget.emit(dragonBones.EventObject.LOOP_COMPLETE), this._eventTarget.emit(dragonBones.EventObject.COMPLETE)
  40977. },
  40978. update: function(t) {
  40979. if (this.isAnimationCached() && this._frameCache) {
  40980. var e = this._frameCache;
  40981. if (e.isInited()) {
  40982. var i = e.frames;
  40983. if (this._playing) {
  40984. var n = a.FrameTime;
  40985. 0 == this._accTime && 0 == this._playCount && this._eventTarget.emit(dragonBones.EventObject.START);
  40986. var r = dragonBones.timeScale;
  40987. this._accTime += t * this.timeScale * r;
  40988. var s = Math.floor(this._accTime / n);
  40989. if (e.isCompleted || e.updateToFrame(s), e.isCompleted && s >= i.length) {
  40990. if (this._playCount++, this.playTimes > 0 && this._playCount >= this.playTimes) return this._curFrame = i[i.length - 1], this._accTime = 0, this._playing = !1, this._playCount = 0, void this._emitCacheCompleteEvent();
  40991. this._accTime = 0, s = 0, this._emitCacheCompleteEvent()
  40992. }
  40993. this._curFrame = i[s]
  40994. } else e.isInvalid() && (e.updateToFrame(), this._curFrame = i[i.length - 1])
  40995. }
  40996. }
  40997. },
  40998. onDestroy: function() {
  40999. this._super(), this._inited = !1, this._cacheMode === c.PRIVATE_CACHE ? (this._armatureCache.dispose(), this._armatureCache = null, this._armature = null) : this._cacheMode === c.SHARED_CACHE ? (this._armatureCache = null, this._armature = null) : this._armature && (this._armature.dispose(), this._armature = null)
  41000. },
  41001. _updateDebugDraw: function() {
  41002. if (this.debugBones) {
  41003. if (!this._debugDraw) {
  41004. var t = new cc.PrivateNode;
  41005. t.name = "DEBUG_DRAW_NODE";
  41006. var e = t.addComponent(o);
  41007. e.lineWidth = 1, e.strokeColor = cc.color(255, 0, 0, 255), this._debugDraw = e
  41008. }
  41009. this._debugDraw.node.parent = this.node
  41010. } else this._debugDraw && (this._debugDraw.node.parent = null)
  41011. },
  41012. _activateMaterial: function() {
  41013. var t = this.dragonAtlasAsset && this.dragonAtlasAsset.texture;
  41014. if (t) {
  41015. if (!t.loaded) return this.disableRender(), void t.once("load", this._activateMaterial, this);
  41016. var e = this.sharedMaterials[0];
  41017. (e = e ? r.getInstantiatedMaterial(e, this) : r.getInstantiatedBuiltinMaterial("2d-sprite", this)).define("CC_USE_MODEL", !0), e.define("USE_TEXTURE", !0), e.setProperty("texture", t), this.setMaterial(0, e), this._prepareToRender()
  41018. } else this.disableRender()
  41019. },
  41020. _prepareToRender: function() {
  41021. this.node && this.node._renderComponent == this && this.markForRender(!0)
  41022. },
  41023. _buildArmature: function() {
  41024. if (this.dragonAsset && this.dragonAtlasAsset && this.armatureName) {
  41025. this._armature && (this._preCacheMode === c.PRIVATE_CACHE ? this._armatureCache.dispose() : this._preCacheMode === c.REALTIME && this._armature.dispose(), this._armatureCache = null, this._armature = null, this._displayProxy = null, this._frameCache = null, this._curFrame = null, this._playing = !1, this._preCacheMode = null), this._cacheMode === c.SHARED_CACHE ? this._armatureCache = a.sharedCache : this._cacheMode === c.PRIVATE_CACHE && (this._armatureCache = new a);
  41026. var t = this.dragonAtlasAsset._uuid;
  41027. if (this._armatureKey = this.dragonAsset.init(this._factory, t), this.isAnimationCached() && (this._armature = this._armatureCache.getArmatureCache(this.armatureName, this._armatureKey, t), this._armature || (this._cacheMode = c.REALTIME)), this._preCacheMode = this._cacheMode, this._cacheMode === c.REALTIME) {
  41028. if (this._displayProxy = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", t), !this._displayProxy) return;
  41029. this._displayProxy._ccNode = this.node, this._displayProxy.setEventTarget(this._eventTarget), this._armature = this._displayProxy._armature, this._armature.animation.timeScale = this.timeScale
  41030. }
  41031. this._cacheMode !== c.REALTIME && this.debugBones && cc.warn("Debug bones is invalid in cached mode"), this._updateBatch(), this.animationName && this.playAnimation(this.animationName, this.playTimes)
  41032. }
  41033. },
  41034. _parseDragonAtlasAsset: function() {
  41035. this.dragonAtlasAsset && this.dragonAtlasAsset.init(this._factory)
  41036. },
  41037. _refresh: function() {
  41038. this._buildArmature()
  41039. },
  41040. _updateCacheModeEnum: !1,
  41041. _updateAnimEnum: !1,
  41042. _updateArmatureEnum: !1,
  41043. playAnimation: function(t, e) {
  41044. if (this.playTimes = void 0 === e ? -1 : e, this.animationName = t, this.isAnimationCached()) {
  41045. var i = this._armatureCache.getAnimationCache(this._armatureKey, t);
  41046. i || (i = this._armatureCache.initAnimationCache(this._armatureKey, t)), i && (this._accTime = 0, this._playCount = 0, this._frameCache = i, this._frameCache.updateToFrame(0), this._playing = !0, this._curFrame = this._frameCache.frames[0])
  41047. } else if (this._armature) return this._armature.animation.play(t, this.playTimes)
  41048. },
  41049. updateAnimationCache: function(t) {
  41050. this.isAnimationCached() && this._armatureCache.updateAnimationCache(this._armatureKey, t)
  41051. },
  41052. invalidAnimationCache: function() {
  41053. this.isAnimationCached() && this._armatureCache.invalidAnimationCache(this._armatureKey)
  41054. },
  41055. getArmatureNames: function() {
  41056. var t = this._factory.getDragonBonesData(this._armatureKey);
  41057. return t && t.armatureNames || []
  41058. },
  41059. getAnimationNames: function(t) {
  41060. var e = [],
  41061. i = this._factory.getDragonBonesData(this._armatureKey);
  41062. if (i) {
  41063. var n = i.getArmature(t);
  41064. if (n)
  41065. for (var r in n.animations) n.animations.hasOwnProperty(r) && e.push(r)
  41066. }
  41067. return e
  41068. },
  41069. on: function(t, e, i) {
  41070. this.addEventListener(t, e, i)
  41071. },
  41072. off: function(t, e, i) {
  41073. this.removeEventListener(t, e, i)
  41074. },
  41075. once: function(t, e, i) {
  41076. this._eventTarget.once(t, e, i)
  41077. },
  41078. addEventListener: function(t, e, i) {
  41079. this._eventTarget.on(t, e, i)
  41080. },
  41081. removeEventListener: function(t, e, i) {
  41082. this._eventTarget.off(t, e, i)
  41083. },
  41084. buildArmature: function(t, e) {
  41085. return this._factory.createArmatureNode(this, t, e)
  41086. },
  41087. armature: function() {
  41088. return this._armature
  41089. }
  41090. });
  41091. e.exports = dragonBones.ArmatureDisplay = u
  41092. }), {
  41093. "../../cocos2d/core/CCNode": 52,
  41094. "../../cocos2d/core/assets/material/CCMaterial": 75,
  41095. "../../cocos2d/core/components/CCRenderComponent": 106,
  41096. "../../cocos2d/core/event/event-target": 131,
  41097. "../../cocos2d/core/graphics/graphics": 140,
  41098. "./ArmatureCache": 401
  41099. }],
  41100. 403: [(function(t, e, i) {
  41101. "use strict";
  41102. var n = t("../../cocos2d/core/event/event-target");
  41103. dragonBones.CCArmatureDisplay = cc.Class({
  41104. name: "dragonBones.CCArmatureDisplay",
  41105. properties: {
  41106. node: {
  41107. get: function() {
  41108. return this
  41109. }
  41110. }
  41111. },
  41112. ctor: function() {
  41113. this._eventTarget = new n
  41114. },
  41115. setEventTarget: function(t) {
  41116. this._eventTarget = t
  41117. },
  41118. getRootDisplay: function() {
  41119. var t, e = this._armature._parent;
  41120. if (!e) return this;
  41121. for (; e;) t = e, e = e._armature._parent;
  41122. return t._armature.getDisplay()
  41123. },
  41124. convertToRootSpace: function(t) {
  41125. var e = this._armature._parent;
  41126. if (!e) return t;
  41127. e.updateWorldMatrix();
  41128. var i = e._worldMatrix.m,
  41129. n = cc.v2(0, 0);
  41130. return n.x = t.x * i[0] + t.y * i[4] + i[12], n.y = t.x * i[1] + t.y * i[5] + i[13], n
  41131. },
  41132. convertToWorldSpace: function(t) {
  41133. var e = this.convertToRootSpace(t);
  41134. return this.getRootNode().convertToWorldSpace(e)
  41135. },
  41136. getRootNode: function() {
  41137. var t = this.getRootDisplay();
  41138. return t && t._ccNode
  41139. },
  41140. dbInit: function(t) {
  41141. this._armature = t
  41142. },
  41143. dbClear: function() {
  41144. this._armature = null
  41145. },
  41146. dbUpdate: function() {},
  41147. advanceTimeBySelf: function(t) {
  41148. this.shouldAdvanced = !!t
  41149. },
  41150. hasDBEventListener: function(t) {
  41151. return this._eventTarget.hasEventListener(t)
  41152. },
  41153. addDBEventListener: function(t, e, i) {
  41154. this._eventTarget.on(t, e, i)
  41155. },
  41156. removeDBEventListener: function(t, e, i) {
  41157. this._eventTarget.off(t, e, i)
  41158. },
  41159. dispatchDBEvent: function(t, e) {
  41160. this._eventTarget.emit(t, e)
  41161. }
  41162. })
  41163. }), {
  41164. "../../cocos2d/core/event/event-target": 131
  41165. }],
  41166. 404: [(function(t, e, i) {
  41167. "use strict";
  41168. var n = dragonBones.BaseObject,
  41169. r = dragonBones.BaseFactory,
  41170. s = dragonBones.CCFactory = cc.Class({
  41171. name: "dragonBones.CCFactory",
  41172. extends: r,
  41173. statics: {
  41174. _factory: null,
  41175. getInstance: function() {
  41176. return s._factory || (s._factory = new s), s._factory
  41177. }
  41178. },
  41179. ctor: function() {
  41180. var t = new dragonBones.CCArmatureDisplay;
  41181. this._dragonBones = new dragonBones.DragonBones(t), cc.director._scheduler && (cc.game.on(cc.game.EVENT_RESTART, this.initUpdate, this), this.initUpdate())
  41182. },
  41183. initUpdate: function(t) {
  41184. cc.director._scheduler.enableForTarget(this), cc.director._scheduler.scheduleUpdate(this, cc.Scheduler.PRIORITY_SYSTEM, !1)
  41185. },
  41186. update: function(t) {
  41187. this._dragonBones.advanceTime(t)
  41188. },
  41189. getDragonBonesDataByRawData: function(t) {
  41190. return (t instanceof ArrayBuffer ? r._binaryParser : this._dataParser).parseDragonBonesData(t, 1)
  41191. },
  41192. buildArmatureDisplay: function(t, e, i, n) {
  41193. var r = this.buildArmature(t, e, i, n);
  41194. return r && r._display
  41195. },
  41196. createArmatureNode: function(t, e, i) {
  41197. var n = (i = i || new cc.Node).getComponent(dragonBones.ArmatureDisplay);
  41198. return n || (n = i.addComponent(dragonBones.ArmatureDisplay)), i.name = e, n._armatureName = e, n._N$dragonAsset = t.dragonAsset, n._N$dragonAtlasAsset = t.dragonAtlasAsset, n._init(), n
  41199. },
  41200. _buildTextureAtlasData: function(t, e) {
  41201. return t ? t.renderTexture = e : t = n.borrowObject(dragonBones.CCTextureAtlasData), t
  41202. },
  41203. _sortSlots: function() {
  41204. for (var t = this._slots, e = [], i = 0, n = t.length; i < n; i++) {
  41205. for (var r = t[i], s = r._zOrder, o = !1, a = e.length - 1; a >= 0; a--)
  41206. if (s >= e[a]._zOrder) {
  41207. e.splice(a + 1, 0, r), o = !0;
  41208. break
  41209. }
  41210. o || e.splice(0, 0, r)
  41211. }
  41212. this._slots = e
  41213. },
  41214. _buildArmature: function(t) {
  41215. var e = n.borrowObject(dragonBones.Armature);
  41216. e._skinData = t.skin, e._animation = n.borrowObject(dragonBones.Animation), e._animation._armature = e, e._animation.animations = t.armature.animations, e._isChildArmature = !1;
  41217. var i = new dragonBones.CCArmatureDisplay;
  41218. return e.init(t.armature, i, i, this._dragonBones), e
  41219. },
  41220. _buildSlot: function(t, e, i) {
  41221. var r = n.borrowObject(dragonBones.CCSlot),
  41222. s = r;
  41223. return r.init(e, i, s, s), r
  41224. },
  41225. getDragonBonesDataByUUID: function(t) {
  41226. for (var e in this._dragonBonesDataMap)
  41227. if (-1 != e.indexOf(t)) return this._dragonBonesDataMap[e];
  41228. return null
  41229. },
  41230. removeDragonBonesDataByUUID: function(t, e) {
  41231. for (var i in void 0 === e && (e = !0), this._dragonBonesDataMap) - 1 !== i.indexOf(t) && (e && this._dragonBones.bufferObject(this._dragonBonesDataMap[i]), delete this._dragonBonesDataMap[i])
  41232. }
  41233. })
  41234. }), {}],
  41235. 405: [(function(t, e, i) {
  41236. "use strict";
  41237. var n = t("../../cocos2d/core/vmath"),
  41238. r = dragonBones.BinaryOffset,
  41239. s = dragonBones.BoneType;
  41240. dragonBones.CCSlot = cc.Class({
  41241. name: "dragonBones.CCSlot",
  41242. extends: dragonBones.Slot,
  41243. ctor: function() {
  41244. this._localVertices = [], this._indices = [], this._matrix = n.mat4.create(), this._worldMatrix = n.mat4.create(), this._worldMatrixDirty = !0, this._visible = !1, this._color = cc.color()
  41245. },
  41246. _onClear: function() {
  41247. this._super(), this._localVertices.length = 0, this._indices.length = 0, n.mat4.identity(this._matrix), n.mat4.identity(this._worldMatrix), this._worldMatrixDirty = !0, this._color = cc.color(), this._visible = !1
  41248. },
  41249. statics: {
  41250. toString: function() {
  41251. return "[class dragonBones.CCSlot]"
  41252. }
  41253. },
  41254. _onUpdateDisplay: function() {},
  41255. _initDisplay: function(t) {},
  41256. _addDisplay: function() {
  41257. this._visible = !0
  41258. },
  41259. _replaceDisplay: function(t) {},
  41260. _removeDisplay: function() {
  41261. this._visible = !1
  41262. },
  41263. _disposeDisplay: function(t) {},
  41264. _updateVisible: function() {
  41265. this._visible = this.parent._visible
  41266. },
  41267. _updateZOrder: function() {},
  41268. _updateBlendMode: function() {
  41269. if (this._childArmature)
  41270. for (var t = this._childArmature.getSlots(), e = 0, i = t.length; e < i; e++) {
  41271. var n = t[e];
  41272. n._blendMode = this._blendMode, n._updateBlendMode()
  41273. }
  41274. },
  41275. _updateColor: function() {
  41276. var t = this._color;
  41277. t.r = 255 * this._colorTransform.redMultiplier, t.g = 255 * this._colorTransform.greenMultiplier, t.b = 255 * this._colorTransform.blueMultiplier, t.a = 255 * this._colorTransform.alphaMultiplier
  41278. },
  41279. getTexture: function() {
  41280. return this._textureData && this._textureData.spriteFrame && this._textureData.spriteFrame.getTexture()
  41281. },
  41282. _updateFrame: function() {
  41283. this._indices.length = 0;
  41284. var t = this._indices,
  41285. e = this._localVertices,
  41286. i = 0,
  41287. n = 0,
  41288. s = this._textureData;
  41289. if (this._display && !(this._displayIndex < 0) && s && s.spriteFrame) {
  41290. var o = s.spriteFrame.getTexture(),
  41291. a = o.width,
  41292. l = o.height,
  41293. h = s.region,
  41294. c = null !== this._deformVertices && this._display === this._meshDisplay ? this._deformVertices.verticesData : null;
  41295. if (c) {
  41296. var u = c.data,
  41297. _ = u.intArray,
  41298. f = u.floatArray,
  41299. d = _[c.offset + r.MeshVertexCount],
  41300. p = _[c.offset + r.MeshTriangleCount],
  41301. m = _[c.offset + r.MeshFloatOffset];
  41302. m < 0 && (m += 65536);
  41303. for (var y = m + 2 * d, v = this._armature._armatureData.scale, g = 0, x = 2 * d; g < x; g += 2) e[n++] = f[m + g] * v, e[n++] = -f[m + g + 1] * v, c.rotated ? (e[n++] = (h.x + (1 - f[y + g]) * h.width) / a, e[n++] = (h.y + f[y + g + 1] * h.height) / l) : (e[n++] = (h.x + f[y + g] * h.width) / a, e[n++] = (h.y + f[y + g + 1] * h.height) / l);
  41304. for (var b = 0; b < 3 * p; ++b) t[i++] = _[c.offset + r.MeshVertexIndices + b];
  41305. e.length = n, t.length = i, !!c.weight && this._identityTransform()
  41306. } else {
  41307. var A = h.x / a,
  41308. C = (h.y + h.height) / l,
  41309. T = (h.x + h.width) / a,
  41310. S = h.y / l;
  41311. e[n++] = 0, e[n++] = 0, e[n++] = A, e[n++] = C, e[n++] = h.width, e[n++] = 0, e[n++] = T, e[n++] = C, e[n++] = 0, e[n++] = h.height, e[n++] = A, e[n++] = S, e[n++] = h.width, e[n++] = h.height, e[n++] = T, e[n++] = S, t[0] = 0, t[1] = 1, t[2] = 2, t[3] = 1, t[4] = 3, t[5] = 2, e.length = n, t.length = 6
  41312. }
  41313. this._visibleDirty = !0, this._blendModeDirty = !0, this._colorDirty = !0
  41314. }
  41315. },
  41316. _updateMesh: function() {
  41317. var t = this._armature._armatureData.scale,
  41318. e = this._deformVertices.vertices,
  41319. i = this._deformVertices.bones,
  41320. n = this._deformVertices.verticesData,
  41321. o = n.weight,
  41322. a = e.length > 0 && n.inheritDeform,
  41323. l = this._localVertices;
  41324. if (o) {
  41325. var h = n.data,
  41326. c = h.intArray,
  41327. u = h.floatArray,
  41328. _ = c[n.offset + r.MeshVertexCount],
  41329. f = c[o.offset + r.WeigthFloatOffset];
  41330. f < 0 && (f += 65536);
  41331. for (var d = 0, p = o.offset + r.WeigthBoneIndices + i.length, m = f, y = 0, v = 0; d < _; d++, v += 4) {
  41332. for (var g = c[p++], x = 0, b = 0, A = 0; A < g; ++A) {
  41333. var C = i[c[p++]];
  41334. if (null !== C) {
  41335. var T = C.globalTransformMatrix,
  41336. S = u[m++],
  41337. w = u[m++] * t,
  41338. E = u[m++] * t;
  41339. a && (w += e[y++], E += e[y++]), x += (T.a * w + T.c * E + T.tx) * S, b += (T.b * w + T.d * E + T.ty) * S
  41340. }
  41341. }
  41342. l[v] = x, l[v + 1] = -b
  41343. }
  41344. } else if (a) {
  41345. var M = this._parent._boneData.type !== s.Bone,
  41346. D = n.data,
  41347. B = D.intArray,
  41348. I = D.floatArray,
  41349. P = B[n.offset + r.MeshVertexCount],
  41350. R = B[n.offset + r.MeshFloatOffset];
  41351. R < 0 && (R += 65536);
  41352. for (var O = 0, L = P, F = 0; O < L; O++, F += 4) {
  41353. var N = I[R + 2 * O] * t + e[2 * O],
  41354. V = I[R + 2 * O + 1] * t + e[2 * O + 1];
  41355. if (M) {
  41356. var k = this._parent._getGlobalTransformMatrix(N, V);
  41357. l[F] = k.a * N + k.c * V + k.tx, l[F + 1] = -k.b * N + k.d * V + k.ty
  41358. } else l[F] = N, l[F + 1] = -V
  41359. }
  41360. }
  41361. o && this._identityTransform()
  41362. },
  41363. _identityTransform: function() {
  41364. var t = this._matrix.m;
  41365. t[0] = 1, t[1] = 0, t[4] = -0, t[5] = -1, t[12] = 0, t[13] = 0, this._worldMatrixDirty = !0
  41366. },
  41367. _updateTransform: function() {
  41368. var t = this._matrix.m;
  41369. t[0] = this.globalTransformMatrix.a, t[1] = this.globalTransformMatrix.b, t[4] = -this.globalTransformMatrix.c, t[5] = -this.globalTransformMatrix.d, this._childArmature ? (t[12] = this.globalTransformMatrix.tx, t[13] = this.globalTransformMatrix.ty) : (t[12] = this.globalTransformMatrix.tx - (this.globalTransformMatrix.a * this._pivotX - this.globalTransformMatrix.c * this._pivotY), t[13] = this.globalTransformMatrix.ty - (this.globalTransformMatrix.b * this._pivotX - this.globalTransformMatrix.d * this._pivotY)), this._worldMatrixDirty = !0
  41370. },
  41371. updateWorldMatrix: function() {
  41372. if (this._armature) {
  41373. var t = this._armature._parent;
  41374. if (t && t.updateWorldMatrix(), this._worldMatrixDirty) {
  41375. this.calculWorldMatrix();
  41376. var e = this.childArmature;
  41377. if (!e) return;
  41378. for (var i = e.getSlots(), n = 0, r = i.length; n < r; n++) {
  41379. var s = i[n];
  41380. s && (s._worldMatrixDirty = !0)
  41381. }
  41382. }
  41383. }
  41384. },
  41385. _mulMat: function(t, e, i) {
  41386. var n = e.m,
  41387. r = i.m,
  41388. s = t.m,
  41389. o = n[0],
  41390. a = n[1],
  41391. l = n[4],
  41392. h = n[5],
  41393. c = n[12],
  41394. u = n[13],
  41395. _ = r[0],
  41396. f = r[1],
  41397. d = r[4],
  41398. p = r[5],
  41399. m = r[12],
  41400. y = r[13];
  41401. 0 !== a || 0 !== l ? (s[0] = _ * o + f * l, s[1] = _ * a + f * h, s[4] = d * o + p * l, s[5] = d * a + p * h, s[12] = o * m + l * y + c, s[13] = a * m + h * y + u) : (s[0] = _ * o, s[1] = f * h, s[4] = d * o, s[5] = p * h, s[12] = o * m + c, s[13] = h * y + u)
  41402. },
  41403. calculWorldMatrix: function() {
  41404. var t = this._armature._parent;
  41405. t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : n.mat4.copy(this._worldMatrix, this._matrix), this._worldMatrixDirty = !1
  41406. }
  41407. })
  41408. }), {
  41409. "../../cocos2d/core/vmath": 326
  41410. }],
  41411. 406: [(function(t, e, i) {
  41412. "use strict";
  41413. dragonBones.CCTextureAtlasData = cc.Class({
  41414. extends: dragonBones.TextureAtlasData,
  41415. name: "dragonBones.CCTextureAtlasData",
  41416. properties: {
  41417. _renderTexture: {
  41418. default: null,
  41419. serializable: !1
  41420. },
  41421. renderTexture: {
  41422. get: function() {
  41423. return this._renderTexture
  41424. },
  41425. set: function(t) {
  41426. if (this._renderTexture = t, t)
  41427. for (var e in this.textures) {
  41428. var i = this.textures[e];
  41429. if (!i.spriteFrame) {
  41430. var n = null;
  41431. n = i.rotated ? cc.rect(i.region.x, i.region.y, i.region.height, i.region.width) : cc.rect(i.region.x, i.region.y, i.region.width, i.region.height);
  41432. var r = cc.v2(0, 0),
  41433. s = cc.size(n.width, n.height);
  41434. i.spriteFrame = new cc.SpriteFrame, i.spriteFrame.setTexture(t, n, !1, r, s)
  41435. }
  41436. } else
  41437. for (var o in this.textures) {
  41438. this.textures[o].spriteFrame = null
  41439. }
  41440. }
  41441. }
  41442. },
  41443. statics: {
  41444. toString: function() {
  41445. return "[class dragonBones.CCTextureAtlasData]"
  41446. }
  41447. },
  41448. _onClear: function() {
  41449. dragonBones.TextureAtlasData.prototype._onClear.call(this), this.renderTexture = null
  41450. },
  41451. createTexture: function() {
  41452. return dragonBones.BaseObject.borrowObject(dragonBones.CCTextureData)
  41453. }
  41454. }), dragonBones.CCTextureData = cc.Class({
  41455. extends: dragonBones.TextureData,
  41456. name: "dragonBones.CCTextureData",
  41457. properties: {
  41458. spriteFrame: {
  41459. default: null,
  41460. serializable: !1
  41461. }
  41462. },
  41463. statics: {
  41464. toString: function() {
  41465. return "[class dragonBones.CCTextureData]"
  41466. }
  41467. },
  41468. _onClear: function() {
  41469. dragonBones.TextureData.prototype._onClear.call(this), this.spriteFrame = null
  41470. }
  41471. })
  41472. }), {}],
  41473. 407: [(function(t, e, i) {
  41474. "use strict";
  41475. var n = t("./ArmatureCache").sharedCache,
  41476. r = cc.Class({
  41477. name: "dragonBones.DragonBonesAsset",
  41478. extends: cc.Asset,
  41479. ctor: function() {
  41480. this.reset()
  41481. },
  41482. properties: {
  41483. _dragonBonesJson: "",
  41484. dragonBonesJson: {
  41485. get: function() {
  41486. return this._dragonBonesJson
  41487. },
  41488. set: function(t) {
  41489. this._dragonBonesJson = t, this._dragonBonesJsonData = JSON.parse(t), this.reset()
  41490. }
  41491. },
  41492. _nativeAsset: {
  41493. get: function() {
  41494. return this._buffer
  41495. },
  41496. set: function(t) {
  41497. this._buffer = t.buffer || t, this.reset()
  41498. },
  41499. override: !0
  41500. }
  41501. },
  41502. statics: {
  41503. preventDeferredLoadDependents: !0
  41504. },
  41505. createNode: !1,
  41506. reset: function() {
  41507. this._clear()
  41508. },
  41509. init: function(t, e) {
  41510. this._factory = t, !this._dragonBonesJsonData && this.dragonBonesJson && (this._dragonBonesJsonData = JSON.parse(this.dragonBonesJson));
  41511. var i = null;
  41512. if (i = this._dragonBonesJsonData ? this._dragonBonesJsonData : this._nativeAsset, !this._uuid) {
  41513. var n = this._factory.getDragonBonesDataByRawData(i);
  41514. n ? this._uuid = n.name : cc.warn("dragonbones name is empty")
  41515. }
  41516. var r = this._uuid + "#" + e;
  41517. return this._factory.getDragonBonesData(r) ? r : (this._factory.parseDragonBonesData(i, r), r)
  41518. },
  41519. getArmatureEnum: !1,
  41520. getAnimsEnum: !1,
  41521. _clear: function() {
  41522. this._factory && (n.resetArmature(this._uuid), this._factory.removeDragonBonesDataByUUID(this._uuid, !0))
  41523. },
  41524. destroy: function() {
  41525. this._clear(), this._super()
  41526. }
  41527. });
  41528. dragonBones.DragonBonesAsset = e.exports = r
  41529. }), {
  41530. "./ArmatureCache": 401
  41531. }],
  41532. 408: [(function(t, e, i) {
  41533. "use strict";
  41534. var n = t("./ArmatureCache").sharedCache,
  41535. r = cc.Class({
  41536. name: "dragonBones.DragonBonesAtlasAsset",
  41537. extends: cc.Asset,
  41538. ctor: function() {
  41539. this._clear()
  41540. },
  41541. properties: {
  41542. _atlasJson: "",
  41543. atlasJson: {
  41544. get: function() {
  41545. return this._atlasJson
  41546. },
  41547. set: function(t) {
  41548. this._atlasJson = t, this._atlasJsonData = JSON.parse(this.atlasJson), this._clear()
  41549. }
  41550. },
  41551. _texture: {
  41552. default: null,
  41553. type: cc.Texture2D,
  41554. formerlySerializedAs: "texture"
  41555. },
  41556. texture: {
  41557. get: function() {
  41558. return this._texture
  41559. },
  41560. set: function(t) {
  41561. this._texture = t, this._clear()
  41562. }
  41563. },
  41564. _textureAtlasData: null
  41565. },
  41566. statics: {
  41567. preventDeferredLoadDependents: !0
  41568. },
  41569. createNode: !1,
  41570. init: function(t) {
  41571. this._factory = t, this._atlasJsonData || (this._atlasJsonData = JSON.parse(this.atlasJson));
  41572. var e = this._atlasJsonData;
  41573. this._uuid = this._uuid || e.name, this._textureAtlasData ? t.addTextureAtlasData(this._textureAtlasData, this._uuid) : this._textureAtlasData = t.parseTextureAtlasData(e, this.texture, this._uuid)
  41574. },
  41575. _clear: function() {
  41576. this._factory && (n.resetArmature(this._uuid), this._factory.removeTextureAtlasData(this._uuid, !0), this._factory.removeDragonBonesDataByUUID(this._uuid, !0)), this._textureAtlasData = null
  41577. },
  41578. destroy: function() {
  41579. this._clear(), this._super()
  41580. }
  41581. });
  41582. dragonBones.DragonBonesAtlasAsset = e.exports = r
  41583. }), {
  41584. "./ArmatureCache": 401
  41585. }],
  41586. 409: [(function(t, e, i) {
  41587. "use strict";
  41588. var n = "undefined" == typeof window ? global : window;
  41589. n.dragonBones = t("./lib/dragonBones"), void 0 !== n.dragonBones && (dragonBones._timeScale = 1, Object.defineProperty(dragonBones, "timeScale", {
  41590. get: function() {
  41591. return this._timeScale
  41592. },
  41593. set: function(t) {
  41594. this._timeScale = t, this.CCFactory.getInstance()._dragonBones.clock.timeScale = t
  41595. },
  41596. configurable: !0
  41597. }), dragonBones.DisplayType = {
  41598. Image: 0,
  41599. Armature: 1,
  41600. Mesh: 2
  41601. }, dragonBones.ArmatureType = {
  41602. Armature: 0,
  41603. MovieClip: 1,
  41604. Stage: 2
  41605. }, dragonBones.ExtensionType = {
  41606. FFD: 0,
  41607. AdjustColor: 10,
  41608. BevelFilter: 11,
  41609. BlurFilter: 12,
  41610. DropShadowFilter: 13,
  41611. GlowFilter: 14,
  41612. GradientBevelFilter: 15,
  41613. GradientGlowFilter: 16
  41614. }, dragonBones.EventType = {
  41615. Frame: 0,
  41616. Sound: 1
  41617. }, dragonBones.ActionType = {
  41618. Play: 0,
  41619. Stop: 1,
  41620. GotoAndPlay: 2,
  41621. GotoAndStop: 3,
  41622. FadeIn: 4,
  41623. FadeOut: 5
  41624. }, dragonBones.AnimationFadeOutMode = {
  41625. None: 0,
  41626. SameLayer: 1,
  41627. SameGroup: 2,
  41628. SameLayerAndGroup: 3,
  41629. All: 4
  41630. }, dragonBones.BinaryOffset = {
  41631. WeigthBoneCount: 0,
  41632. WeigthFloatOffset: 1,
  41633. WeigthBoneIndices: 2,
  41634. MeshVertexCount: 0,
  41635. MeshTriangleCount: 1,
  41636. MeshFloatOffset: 2,
  41637. MeshWeightOffset: 3,
  41638. MeshVertexIndices: 4,
  41639. TimelineScale: 0,
  41640. TimelineOffset: 1,
  41641. TimelineKeyFrameCount: 2,
  41642. TimelineFrameValueCount: 3,
  41643. TimelineFrameValueOffset: 4,
  41644. TimelineFrameOffset: 5,
  41645. FramePosition: 0,
  41646. FrameTweenType: 1,
  41647. FrameTweenEasingOrCurveSampleCount: 2,
  41648. FrameCurveSamples: 3,
  41649. DeformMeshOffset: 0,
  41650. DeformCount: 1,
  41651. DeformValueCount: 2,
  41652. DeformValueOffset: 3,
  41653. DeformFloatOffset: 4
  41654. }, dragonBones.BoneType = {
  41655. Bone: 0,
  41656. Surface: 1
  41657. }, t("./CCFactory"), t("./CCSlot"), t("./CCTextureData"), t("./CCArmatureDisplay"), t("./ArmatureCache"), t("./DragonBonesAsset"), t("./DragonBonesAtlasAsset"), t("./ArmatureDisplay"), t("./webgl-assembler"))
  41658. }), {
  41659. "./ArmatureCache": 401,
  41660. "./ArmatureDisplay": 402,
  41661. "./CCArmatureDisplay": 403,
  41662. "./CCFactory": 404,
  41663. "./CCSlot": 405,
  41664. "./CCTextureData": 406,
  41665. "./DragonBonesAsset": 407,
  41666. "./DragonBonesAtlasAsset": 408,
  41667. "./lib/dragonBones": 410,
  41668. "./webgl-assembler": 411
  41669. }],
  41670. 410: [(function(t, e, i) {
  41671. "use strict";
  41672. var n = (function() {
  41673. var t = Object.setPrototypeOf || {
  41674. __proto__: []
  41675. }
  41676. instanceof Array && function(t, e) {
  41677. t.__proto__ = e
  41678. } || function(t, e) {
  41679. for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
  41680. }
  41681. })();
  41682. r || (r = {}), (function(t) {
  41683. var e = (function() {
  41684. function e(i) {
  41685. this._clock = new t.WorldClock, this._events = [], this._objects = [], this._eventManager = null, this._eventManager = i, console.info("DragonBones: " + e.VERSION + "\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")
  41686. }
  41687. return e.prototype.advanceTime = function(e) {
  41688. if (this._objects.length > 0) {
  41689. for (var i = 0, n = this._objects; i < n.length; i++) {
  41690. n[i].returnToPool()
  41691. }
  41692. this._objects.length = 0
  41693. }
  41694. if (this._clock.advanceTime(e), this._events.length > 0) {
  41695. for (var r = 0; r < this._events.length; ++r) {
  41696. var s = this._events[r],
  41697. o = s.armature;
  41698. null !== o._armatureData && (o.eventDispatcher.dispatchDBEvent(s.type, s), s.type === t.EventObject.SOUND_EVENT && this._eventManager.dispatchDBEvent(s.type, s)), this.bufferObject(s)
  41699. }
  41700. this._events.length = 0
  41701. }
  41702. }, e.prototype.bufferEvent = function(t) {
  41703. this._events.indexOf(t) < 0 && this._events.push(t)
  41704. }, e.prototype.bufferObject = function(t) {
  41705. this._objects.indexOf(t) < 0 && this._objects.push(t)
  41706. }, Object.defineProperty(e.prototype, "clock", {
  41707. get: function() {
  41708. return this._clock
  41709. },
  41710. enumerable: !0,
  41711. configurable: !0
  41712. }), Object.defineProperty(e.prototype, "eventManager", {
  41713. get: function() {
  41714. return this._eventManager
  41715. },
  41716. enumerable: !0,
  41717. configurable: !0
  41718. }), e.VERSION = "5.6.300", e.yDown = !1, e.debug = !1, e.debugDraw = !1, e.webAssembly = !1, e
  41719. })();
  41720. t.DragonBones = e
  41721. })(r || (r = {})), console.warn || (console.warn = function() {}), console.assert || (console.assert = function() {}), Date.now || (Date.now = function() {
  41722. return (new Date).getTime()
  41723. });
  41724. var r;
  41725. n = function(t, e) {
  41726. function i() {
  41727. this.constructor = t
  41728. }
  41729. for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
  41730. i.prototype = e.prototype, t.prototype = new i
  41731. };
  41732. (function(t) {
  41733. var e = (function() {
  41734. function t() {
  41735. this.hashCode = t._hashCode++, this._isInPool = !1
  41736. }
  41737. return t._returnObject = function(e) {
  41738. var i = String(e.constructor),
  41739. n = i in t._maxCountMap ? t._maxCountMap[i] : t._defaultMaxCount,
  41740. r = t._poolsMap[i] = t._poolsMap[i] || [];
  41741. r.length < n && (e._isInPool ? console.warn("The object is already in the pool.") : (e._isInPool = !0, r.push(e)))
  41742. }, t.toString = function() {
  41743. throw new Error
  41744. }, t.setMaxCount = function(e, i) {
  41745. if ((i < 0 || i != i) && (i = 0), null !== e) null !== (r = (n = String(e)) in t._poolsMap ? t._poolsMap[n] : null) && r.length > i && (r.length = i), t._maxCountMap[n] = i;
  41746. else
  41747. for (var n in t._defaultMaxCount = i, t._poolsMap) {
  41748. var r;
  41749. (r = t._poolsMap[n]).length > i && (r.length = i), n in t._maxCountMap && (t._maxCountMap[n] = i)
  41750. }
  41751. }, t.clearPool = function(e) {
  41752. if (void 0 === e && (e = null), null !== e) {
  41753. var i = String(e);
  41754. null !== (r = i in t._poolsMap ? t._poolsMap[i] : null) && r.length > 0 && (r.length = 0)
  41755. } else
  41756. for (var n in t._poolsMap) {
  41757. var r;
  41758. (r = t._poolsMap[n]).length = 0
  41759. }
  41760. }, t.borrowObject = function(e) {
  41761. var i = String(e),
  41762. n = i in t._poolsMap ? t._poolsMap[i] : null;
  41763. if (null !== n && n.length > 0) {
  41764. var r = n.pop();
  41765. return r._isInPool = !1, r
  41766. }
  41767. var s = new e;
  41768. return s._onClear(), s
  41769. }, t.prototype.returnToPool = function() {
  41770. this._onClear(), t._returnObject(this)
  41771. }, t._hashCode = 0, t._defaultMaxCount = 3e3, t._maxCountMap = {}, t._poolsMap = {}, t
  41772. })();
  41773. t.BaseObject = e
  41774. })(r || (r = {})), (function(t) {
  41775. var e = (function() {
  41776. function t(t, e, i, n, r, s) {
  41777. void 0 === t && (t = 1), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 1), void 0 === r && (r = 0), void 0 === s && (s = 0), this.a = t, this.b = e, this.c = i, this.d = n, this.tx = r, this.ty = s
  41778. }
  41779. return t.prototype.toString = function() {
  41780. return "[object dragonBones.Matrix] a:" + this.a + " b:" + this.b + " c:" + this.c + " d:" + this.d + " tx:" + this.tx + " ty:" + this.ty
  41781. }, t.prototype.copyFrom = function(t) {
  41782. return this.a = t.a, this.b = t.b, this.c = t.c, this.d = t.d, this.tx = t.tx, this.ty = t.ty, this
  41783. }, t.prototype.copyFromArray = function(t, e) {
  41784. return void 0 === e && (e = 0), this.a = t[e], this.b = t[e + 1], this.c = t[e + 2], this.d = t[e + 3], this.tx = t[e + 4], this.ty = t[e + 5], this
  41785. }, t.prototype.identity = function() {
  41786. return this.a = this.d = 1, this.b = this.c = 0, this.tx = this.ty = 0, this
  41787. }, t.prototype.concat = function(t) {
  41788. var e = this.a * t.a,
  41789. i = 0,
  41790. n = 0,
  41791. r = this.d * t.d,
  41792. s = this.tx * t.a + t.tx,
  41793. o = this.ty * t.d + t.ty;
  41794. return 0 === this.b && 0 === this.c || (e += this.b * t.c, i += this.b * t.d, n += this.c * t.a, r += this.c * t.b), 0 === t.b && 0 === t.c || (i += this.a * t.b, n += this.d * t.c, s += this.ty * t.c, o += this.tx * t.b), this.a = e, this.b = i, this.c = n, this.d = r, this.tx = s, this.ty = o, this
  41795. }, t.prototype.invert = function() {
  41796. var t = this.a,
  41797. e = this.b,
  41798. i = this.c,
  41799. n = this.d,
  41800. r = this.tx,
  41801. s = this.ty;
  41802. if (0 === e && 0 === i) return this.b = this.c = 0, 0 === t || 0 === n ? this.a = this.b = this.tx = this.ty = 0 : (t = this.a = 1 / t, n = this.d = 1 / n, this.tx = -t * r, this.ty = -n * s), this;
  41803. var o = t * n - e * i;
  41804. if (0 === o) return this.a = this.d = 1, this.b = this.c = 0, this.tx = this.ty = 0, this;
  41805. o = 1 / o;
  41806. var a = this.a = n * o;
  41807. return e = this.b = -e * o, i = this.c = -i * o, n = this.d = t * o, this.tx = -(a * r + i * s), this.ty = -(e * r + n * s), this
  41808. }, t.prototype.transformPoint = function(t, e, i, n) {
  41809. void 0 === n && (n = !1), i.x = this.a * t + this.c * e, i.y = this.b * t + this.d * e, n || (i.x += this.tx, i.y += this.ty)
  41810. }, t.prototype.transformRectangle = function(t, e) {
  41811. void 0 === e && (e = !1);
  41812. var i = this.a,
  41813. n = this.b,
  41814. r = this.c,
  41815. s = this.d,
  41816. o = e ? 0 : this.tx,
  41817. a = e ? 0 : this.ty,
  41818. l = t.x,
  41819. h = t.y,
  41820. c = l + t.width,
  41821. u = h + t.height,
  41822. _ = i * l + r * h + o,
  41823. f = n * l + s * h + a,
  41824. d = i * c + r * h + o,
  41825. p = n * c + s * h + a,
  41826. m = i * c + r * u + o,
  41827. y = n * c + s * u + a,
  41828. v = i * l + r * u + o,
  41829. g = n * l + s * u + a,
  41830. x = 0;
  41831. _ > d && (x = _, _ = d, d = x), m > v && (x = m, m = v, v = x), t.x = Math.floor(_ < m ? _ : m), t.width = Math.ceil((d > v ? d : v) - t.x), f > p && (x = f, f = p, p = x), y > g && (x = y, y = g, g = x), t.y = Math.floor(f < y ? f : y), t.height = Math.ceil((p > g ? p : g) - t.y)
  41832. }, t
  41833. })();
  41834. t.Matrix = e
  41835. })(r || (r = {})), (function(t) {
  41836. var e = (function() {
  41837. function t(t, e, i, n, r, s) {
  41838. void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), void 0 === r && (r = 1), void 0 === s && (s = 1), this.x = t, this.y = e, this.skew = i, this.rotation = n, this.scaleX = r, this.scaleY = s
  41839. }
  41840. return t.normalizeRadian = function(t) {
  41841. return t = (t + Math.PI) % (2 * Math.PI), t += t > 0 ? -Math.PI : Math.PI
  41842. }, t.prototype.toString = function() {
  41843. return "[object dragonBones.Transform] x:" + this.x + " y:" + this.y + " skewX:" + 180 * this.skew / Math.PI + " skewY:" + 180 * this.rotation / Math.PI + " scaleX:" + this.scaleX + " scaleY:" + this.scaleY
  41844. }, t.prototype.copyFrom = function(t) {
  41845. return this.x = t.x, this.y = t.y, this.skew = t.skew, this.rotation = t.rotation, this.scaleX = t.scaleX, this.scaleY = t.scaleY, this
  41846. }, t.prototype.identity = function() {
  41847. return this.x = this.y = 0, this.skew = this.rotation = 0, this.scaleX = this.scaleY = 1, this
  41848. }, t.prototype.add = function(t) {
  41849. return this.x += t.x, this.y += t.y, this.skew += t.skew, this.rotation += t.rotation, this.scaleX *= t.scaleX, this.scaleY *= t.scaleY, this
  41850. }, t.prototype.minus = function(t) {
  41851. return this.x -= t.x, this.y -= t.y, this.skew -= t.skew, this.rotation -= t.rotation, this.scaleX /= t.scaleX, this.scaleY /= t.scaleY, this
  41852. }, t.prototype.fromMatrix = function(e) {
  41853. var i = this.scaleX,
  41854. n = this.scaleY,
  41855. r = t.PI_Q;
  41856. this.x = e.tx, this.y = e.ty, this.rotation = Math.atan(e.b / e.a);
  41857. var s = Math.atan(-e.c / e.d);
  41858. return this.scaleX = this.rotation > -r && this.rotation < r ? e.a / Math.cos(this.rotation) : e.b / Math.sin(this.rotation), this.scaleY = s > -r && s < r ? e.d / Math.cos(s) : -e.c / Math.sin(s), i >= 0 && this.scaleX < 0 && (this.scaleX = -this.scaleX, this.rotation = this.rotation - Math.PI), n >= 0 && this.scaleY < 0 && (this.scaleY = -this.scaleY, s -= Math.PI), this.skew = s - this.rotation, this
  41859. }, t.prototype.toMatrix = function(t) {
  41860. return 0 === this.rotation ? (t.a = 1, t.b = 0) : (t.a = Math.cos(this.rotation), t.b = Math.sin(this.rotation)), 0 === this.skew ? (t.c = -t.b, t.d = t.a) : (t.c = -Math.sin(this.skew + this.rotation), t.d = Math.cos(this.skew + this.rotation)), 1 !== this.scaleX && (t.a *= this.scaleX, t.b *= this.scaleX), 1 !== this.scaleY && (t.c *= this.scaleY, t.d *= this.scaleY), t.tx = this.x, t.ty = this.y, this
  41861. }, t.PI = Math.PI, t.PI_D = 2 * Math.PI, t.PI_H = Math.PI / 2, t.PI_Q = Math.PI / 4, t.RAD_DEG = 180 / Math.PI, t.DEG_RAD = Math.PI / 180, t
  41862. })();
  41863. t.Transform = e
  41864. })(r || (r = {})), (function(t) {
  41865. var e = (function() {
  41866. function t(t, e, i, n, r, s, o, a) {
  41867. void 0 === t && (t = 1), void 0 === e && (e = 1), void 0 === i && (i = 1), void 0 === n && (n = 1), void 0 === r && (r = 0), void 0 === s && (s = 0), void 0 === o && (o = 0), void 0 === a && (a = 0), this.alphaMultiplier = t, this.redMultiplier = e, this.greenMultiplier = i, this.blueMultiplier = n, this.alphaOffset = r, this.redOffset = s, this.greenOffset = o, this.blueOffset = a
  41868. }
  41869. return t.prototype.copyFrom = function(t) {
  41870. this.alphaMultiplier = t.alphaMultiplier, this.redMultiplier = t.redMultiplier, this.greenMultiplier = t.greenMultiplier, this.blueMultiplier = t.blueMultiplier, this.alphaOffset = t.alphaOffset, this.redOffset = t.redOffset, this.greenOffset = t.greenOffset, this.blueOffset = t.blueOffset
  41871. }, t.prototype.identity = function() {
  41872. this.alphaMultiplier = this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 1, this.alphaOffset = this.redOffset = this.greenOffset = this.blueOffset = 0
  41873. }, t
  41874. })();
  41875. t.ColorTransform = e
  41876. })(r || (r = {})), (function(t) {
  41877. var e = (function() {
  41878. function t(t, e) {
  41879. void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e
  41880. }
  41881. return t.prototype.copyFrom = function(t) {
  41882. this.x = t.x, this.y = t.y
  41883. }, t.prototype.clear = function() {
  41884. this.x = this.y = 0
  41885. }, t
  41886. })();
  41887. t.Point = e
  41888. })(r || (r = {})), (function(t) {
  41889. var e = (function() {
  41890. function t(t, e, i, n) {
  41891. void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), this.x = t, this.y = e, this.width = i, this.height = n
  41892. }
  41893. return t.prototype.copyFrom = function(t) {
  41894. this.x = t.x, this.y = t.y, this.width = t.width, this.height = t.height
  41895. }, t.prototype.clear = function() {
  41896. this.x = this.y = 0, this.width = this.height = 0
  41897. }, t
  41898. })();
  41899. t.Rectangle = e
  41900. })(r || (r = {})), (function(t) {
  41901. var e = (function(t) {
  41902. function e() {
  41903. var e = null !== t && t.apply(this, arguments) || this;
  41904. return e.ints = [], e.floats = [], e.strings = [], e
  41905. }
  41906. return n(e, t), e.toString = function() {
  41907. return "[class dragonBones.UserData]"
  41908. }, e.prototype._onClear = function() {
  41909. this.ints.length = 0, this.floats.length = 0, this.strings.length = 0
  41910. }, e.prototype.addInt = function(t) {
  41911. this.ints.push(t)
  41912. }, e.prototype.addFloat = function(t) {
  41913. this.floats.push(t)
  41914. }, e.prototype.addString = function(t) {
  41915. this.strings.push(t)
  41916. }, e.prototype.getInt = function(t) {
  41917. return void 0 === t && (t = 0), t >= 0 && t < this.ints.length ? this.ints[t] : 0
  41918. }, e.prototype.getFloat = function(t) {
  41919. return void 0 === t && (t = 0), t >= 0 && t < this.floats.length ? this.floats[t] : 0
  41920. }, e.prototype.getString = function(t) {
  41921. return void 0 === t && (t = 0), t >= 0 && t < this.strings.length ? this.strings[t] : ""
  41922. }, e
  41923. })(t.BaseObject);
  41924. t.UserData = e;
  41925. var i = (function(t) {
  41926. function e() {
  41927. var e = null !== t && t.apply(this, arguments) || this;
  41928. return e.data = null, e
  41929. }
  41930. return n(e, t), e.toString = function() {
  41931. return "[class dragonBones.ActionData]"
  41932. }, e.prototype._onClear = function() {
  41933. null !== this.data && this.data.returnToPool(), this.type = 0, this.name = "", this.bone = null, this.slot = null, this.data = null
  41934. }, e
  41935. })(t.BaseObject);
  41936. t.ActionData = i
  41937. })(r || (r = {})), (function(t) {
  41938. var e = (function(t) {
  41939. function e() {
  41940. var e = null !== t && t.apply(this, arguments) || this;
  41941. return e.frameIndices = [], e.cachedFrames = [], e.armatureNames = [], e.armatures = {}, e.userData = null, e
  41942. }
  41943. return n(e, t), e.toString = function() {
  41944. return "[class dragonBones.DragonBonesData]"
  41945. }, e.prototype._onClear = function() {
  41946. for (var t in this.armatures) this.armatures[t].returnToPool(), delete this.armatures[t];
  41947. null !== this.userData && this.userData.returnToPool(), this.autoSearch = !1, this.frameRate = 0, this.version = "", this.name = "", this.stage = null, this.frameIndices.length = 0, this.cachedFrames.length = 0, this.armatureNames.length = 0, this.binary = null, this.intArray = null, this.floatArray = null, this.frameIntArray = null, this.frameFloatArray = null, this.frameArray = null, this.timelineArray = null, this.userData = null
  41948. }, e.prototype.addArmature = function(t) {
  41949. t.name in this.armatures ? console.warn("Same armature: " + t.name) : (t.parent = this, this.armatures[t.name] = t, this.armatureNames.push(t.name))
  41950. }, e.prototype.getArmature = function(t) {
  41951. return t in this.armatures ? this.armatures[t] : null
  41952. }, e.prototype.dispose = function() {
  41953. console.warn("\u5df2\u5e9f\u5f03"), this.returnToPool()
  41954. }, e
  41955. })(t.BaseObject);
  41956. t.DragonBonesData = e
  41957. })(r || (r = {})), (function(t) {
  41958. var e = (function(e) {
  41959. function i() {
  41960. var i = null !== e && e.apply(this, arguments) || this;
  41961. return i.aabb = new t.Rectangle, i.animationNames = [], i.sortedBones = [], i.sortedSlots = [], i.defaultActions = [], i.actions = [], i.bones = {}, i.slots = {}, i.constraints = {}, i.skins = {}, i.animations = {}, i.canvas = null, i.userData = null, i
  41962. }
  41963. return n(i, e), i.toString = function() {
  41964. return "[class dragonBones.ArmatureData]"
  41965. }, i.prototype._onClear = function() {
  41966. for (var t = 0, e = this.defaultActions; t < e.length; t++) {
  41967. e[t].returnToPool()
  41968. }
  41969. for (var i = 0, n = this.actions; i < n.length; i++) {
  41970. n[i].returnToPool()
  41971. }
  41972. for (var r in this.bones) this.bones[r].returnToPool(), delete this.bones[r];
  41973. for (var r in this.slots) this.slots[r].returnToPool(), delete this.slots[r];
  41974. for (var r in this.constraints) this.constraints[r].returnToPool(), delete this.constraints[r];
  41975. for (var r in this.skins) this.skins[r].returnToPool(), delete this.skins[r];
  41976. for (var r in this.animations) this.animations[r].returnToPool(), delete this.animations[r];
  41977. null !== this.canvas && this.canvas.returnToPool(), null !== this.userData && this.userData.returnToPool(), this.type = 0, this.frameRate = 0, this.cacheFrameRate = 0, this.scale = 1, this.name = "", this.aabb.clear(), this.animationNames.length = 0, this.sortedBones.length = 0, this.sortedSlots.length = 0, this.defaultActions.length = 0, this.actions.length = 0, this.defaultSkin = null, this.defaultAnimation = null, this.canvas = null, this.userData = null, this.parent = null
  41978. }, i.prototype.sortBones = function() {
  41979. var t = this.sortedBones.length;
  41980. if (!(t <= 0)) {
  41981. var e = this.sortedBones.concat(),
  41982. i = 0,
  41983. n = 0;
  41984. for (this.sortedBones.length = 0; n < t;) {
  41985. var r = e[i++];
  41986. if (i >= t && (i = 0), !(this.sortedBones.indexOf(r) >= 0)) {
  41987. var s = !1;
  41988. for (var o in this.constraints) {
  41989. var a = this.constraints[o];
  41990. if (a.root === r && this.sortedBones.indexOf(a.target) < 0) {
  41991. s = !0;
  41992. break
  41993. }
  41994. }
  41995. s || null !== r.parent && this.sortedBones.indexOf(r.parent) < 0 || (this.sortedBones.push(r), n++)
  41996. }
  41997. }
  41998. }
  41999. }, i.prototype.cacheFrames = function(t) {
  42000. if (!(this.cacheFrameRate > 0))
  42001. for (var e in this.cacheFrameRate = t, this.animations) this.animations[e].cacheFrames(this.cacheFrameRate)
  42002. }, i.prototype.setCacheFrame = function(t, e) {
  42003. var i = this.parent.cachedFrames,
  42004. n = i.length;
  42005. return i.length += 10, i[n] = t.a, i[n + 1] = t.b, i[n + 2] = t.c, i[n + 3] = t.d, i[n + 4] = t.tx, i[n + 5] = t.ty, i[n + 6] = e.rotation, i[n + 7] = e.skew, i[n + 8] = e.scaleX, i[n + 9] = e.scaleY, n
  42006. }, i.prototype.getCacheFrame = function(t, e, i) {
  42007. var n = this.parent.cachedFrames;
  42008. t.a = n[i], t.b = n[i + 1], t.c = n[i + 2], t.d = n[i + 3], t.tx = n[i + 4], t.ty = n[i + 5], e.rotation = n[i + 6], e.skew = n[i + 7], e.scaleX = n[i + 8], e.scaleY = n[i + 9], e.x = t.tx, e.y = t.ty
  42009. }, i.prototype.addBone = function(t) {
  42010. t.name in this.bones ? console.warn("Same bone: " + t.name) : (this.bones[t.name] = t, this.sortedBones.push(t))
  42011. }, i.prototype.addSlot = function(t) {
  42012. t.name in this.slots ? console.warn("Same slot: " + t.name) : (this.slots[t.name] = t, this.sortedSlots.push(t))
  42013. }, i.prototype.addConstraint = function(t) {
  42014. t.name in this.constraints ? console.warn("Same constraint: " + t.name) : this.constraints[t.name] = t
  42015. }, i.prototype.addSkin = function(t) {
  42016. t.name in this.skins ? console.warn("Same skin: " + t.name) : (t.parent = this, this.skins[t.name] = t, null === this.defaultSkin && (this.defaultSkin = t), "default" === t.name && (this.defaultSkin = t))
  42017. }, i.prototype.addAnimation = function(t) {
  42018. t.name in this.animations ? console.warn("Same animation: " + t.name) : (t.parent = this, this.animations[t.name] = t, this.animationNames.push(t.name), null === this.defaultAnimation && (this.defaultAnimation = t))
  42019. }, i.prototype.addAction = function(t, e) {
  42020. e ? this.defaultActions.push(t) : this.actions.push(t)
  42021. }, i.prototype.getBone = function(t) {
  42022. return t in this.bones ? this.bones[t] : null
  42023. }, i.prototype.getSlot = function(t) {
  42024. return t in this.slots ? this.slots[t] : null
  42025. }, i.prototype.getConstraint = function(t) {
  42026. return t in this.constraints ? this.constraints[t] : null
  42027. }, i.prototype.getSkin = function(t) {
  42028. return t in this.skins ? this.skins[t] : null
  42029. }, i.prototype.getMesh = function(t, e, i) {
  42030. var n = this.getSkin(t);
  42031. return null === n ? null : n.getDisplay(e, i)
  42032. }, i.prototype.getAnimation = function(t) {
  42033. return t in this.animations ? this.animations[t] : null
  42034. }, i
  42035. })(t.BaseObject);
  42036. t.ArmatureData = e;
  42037. var i = (function(e) {
  42038. function i() {
  42039. var i = null !== e && e.apply(this, arguments) || this;
  42040. return i.transform = new t.Transform, i.userData = null, i
  42041. }
  42042. return n(i, e), i.toString = function() {
  42043. return "[class dragonBones.BoneData]"
  42044. }, i.prototype._onClear = function() {
  42045. null !== this.userData && this.userData.returnToPool(), this.inheritTranslation = !1, this.inheritRotation = !1, this.inheritScale = !1, this.inheritReflection = !1, this.type = 0, this.length = 0, this.name = "", this.transform.identity(), this.userData = null, this.parent = null
  42046. }, i
  42047. })(t.BaseObject);
  42048. t.BoneData = i;
  42049. var r = (function(t) {
  42050. function e() {
  42051. var e = null !== t && t.apply(this, arguments) || this;
  42052. return e.vertices = [], e
  42053. }
  42054. return n(e, t), e.toString = function() {
  42055. return "[class dragonBones.SurfaceData]"
  42056. }, e.prototype._onClear = function() {
  42057. t.prototype._onClear.call(this), this.type = 1, this.segmentX = 0, this.segmentY = 0, this.vertices.length = 0
  42058. }, e
  42059. })(i);
  42060. t.SurfaceData = r;
  42061. var s = (function(e) {
  42062. function i() {
  42063. var t = null !== e && e.apply(this, arguments) || this;
  42064. return t.color = null, t.userData = null, t
  42065. }
  42066. return n(i, e), i.createColor = function() {
  42067. return new t.ColorTransform
  42068. }, i.toString = function() {
  42069. return "[class dragonBones.SlotData]"
  42070. }, i.prototype._onClear = function() {
  42071. null !== this.userData && this.userData.returnToPool(), this.blendMode = 0, this.displayIndex = 0, this.zOrder = 0, this.name = "", this.color = null, this.userData = null, this.parent = null
  42072. }, i.DEFAULT_COLOR = new t.ColorTransform, i
  42073. })(t.BaseObject);
  42074. t.SlotData = s
  42075. })(r || (r = {})), (function(t) {
  42076. var e = (function(t) {
  42077. function e() {
  42078. return null !== t && t.apply(this, arguments) || this
  42079. }
  42080. return n(e, t), e.prototype._onClear = function() {
  42081. this.order = 0, this.name = "", this.type = 0, this.target = null, this.root = null, this.bone = null
  42082. }, e
  42083. })(t.BaseObject);
  42084. t.ConstraintData = e;
  42085. var i = (function(t) {
  42086. function e() {
  42087. return null !== t && t.apply(this, arguments) || this
  42088. }
  42089. return n(e, t), e.toString = function() {
  42090. return "[class dragonBones.IKConstraintData]"
  42091. }, e.prototype._onClear = function() {
  42092. t.prototype._onClear.call(this), this.scaleEnabled = !1, this.bendPositive = !1, this.weight = 1
  42093. }, e
  42094. })(e);
  42095. t.IKConstraintData = i;
  42096. var r = (function(t) {
  42097. function e() {
  42098. var e = null !== t && t.apply(this, arguments) || this;
  42099. return e.bones = [], e
  42100. }
  42101. return n(e, t), e.toString = function() {
  42102. return "[class dragonBones.PathConstraintData]"
  42103. }, e.prototype._onClear = function() {
  42104. t.prototype._onClear.call(this), this.pathSlot = null, this.pathDisplayData = null, this.bones.length = 0, this.positionMode = 0, this.spacingMode = 1, this.rotateMode = 1, this.position = 0, this.spacing = 0, this.rotateOffset = 0, this.rotateMix = 0, this.translateMix = 0
  42105. }, e.prototype.AddBone = function(t) {
  42106. this.bones.push(t)
  42107. }, e
  42108. })(e);
  42109. t.PathConstraintData = r
  42110. })(r || (r = {})), (function(t) {
  42111. var e = (function(t) {
  42112. function e() {
  42113. return null !== t && t.apply(this, arguments) || this
  42114. }
  42115. return n(e, t), e.toString = function() {
  42116. return "[class dragonBones.CanvasData]"
  42117. }, e.prototype._onClear = function() {
  42118. this.hasBackground = !1, this.color = 0, this.x = 0, this.y = 0, this.width = 0, this.height = 0
  42119. }, e
  42120. })(t.BaseObject);
  42121. t.CanvasData = e
  42122. })(r || (r = {})), (function(t) {
  42123. var e = (function(t) {
  42124. function e() {
  42125. var e = null !== t && t.apply(this, arguments) || this;
  42126. return e.displays = {}, e
  42127. }
  42128. return n(e, t), e.toString = function() {
  42129. return "[class dragonBones.SkinData]"
  42130. }, e.prototype._onClear = function() {
  42131. for (var t in this.displays) {
  42132. for (var e = 0, i = this.displays[t]; e < i.length; e++) {
  42133. var n = i[e];
  42134. null !== n && n.returnToPool()
  42135. }
  42136. delete this.displays[t]
  42137. }
  42138. this.name = "", this.parent = null
  42139. }, e.prototype.addDisplay = function(t, e) {
  42140. t in this.displays || (this.displays[t] = []), null !== e && (e.parent = this), this.displays[t].push(e)
  42141. }, e.prototype.getDisplay = function(t, e) {
  42142. var i = this.getDisplays(t);
  42143. if (null !== i)
  42144. for (var n = 0, r = i; n < r.length; n++) {
  42145. var s = r[n];
  42146. if (null !== s && s.name === e) return s
  42147. }
  42148. return null
  42149. }, e.prototype.getDisplays = function(t) {
  42150. return t in this.displays ? this.displays[t] : null
  42151. }, e
  42152. })(t.BaseObject);
  42153. t.SkinData = e
  42154. })(r || (r = {})), (function(t) {
  42155. var e = (function() {
  42156. function t() {
  42157. this.weight = null
  42158. }
  42159. return t.prototype.clear = function() {
  42160. this.isShared || null === this.weight || this.weight.returnToPool(), this.isShared = !1, this.inheritDeform = !1, this.offset = 0, this.data = null, this.weight = null
  42161. }, t.prototype.shareFrom = function(t) {
  42162. this.isShared = !0, this.offset = t.offset, this.weight = t.weight
  42163. }, t
  42164. })();
  42165. t.VerticesData = e;
  42166. var i = (function(e) {
  42167. function i() {
  42168. var i = null !== e && e.apply(this, arguments) || this;
  42169. return i.transform = new t.Transform, i
  42170. }
  42171. return n(i, e), i.prototype._onClear = function() {
  42172. this.name = "", this.path = "", this.transform.identity(), this.parent = null
  42173. }, i
  42174. })(t.BaseObject);
  42175. t.DisplayData = i;
  42176. var r = (function(e) {
  42177. function i() {
  42178. var i = null !== e && e.apply(this, arguments) || this;
  42179. return i.pivot = new t.Point, i
  42180. }
  42181. return n(i, e), i.toString = function() {
  42182. return "[class dragonBones.ImageDisplayData]"
  42183. }, i.prototype._onClear = function() {
  42184. e.prototype._onClear.call(this), this.type = 0, this.pivot.clear(), this.texture = null
  42185. }, i
  42186. })(i);
  42187. t.ImageDisplayData = r;
  42188. var s = (function(t) {
  42189. function e() {
  42190. var e = null !== t && t.apply(this, arguments) || this;
  42191. return e.actions = [], e
  42192. }
  42193. return n(e, t), e.toString = function() {
  42194. return "[class dragonBones.ArmatureDisplayData]"
  42195. }, e.prototype._onClear = function() {
  42196. t.prototype._onClear.call(this);
  42197. for (var e = 0, i = this.actions; e < i.length; e++) {
  42198. i[e].returnToPool()
  42199. }
  42200. this.type = 1, this.inheritAnimation = !1, this.actions.length = 0, this.armature = null
  42201. }, e.prototype.addAction = function(t) {
  42202. this.actions.push(t)
  42203. }, e
  42204. })(i);
  42205. t.ArmatureDisplayData = s;
  42206. var o = (function(t) {
  42207. function i() {
  42208. var i = null !== t && t.apply(this, arguments) || this;
  42209. return i.vertices = new e, i
  42210. }
  42211. return n(i, t), i.toString = function() {
  42212. return "[class dragonBones.MeshDisplayData]"
  42213. }, i.prototype._onClear = function() {
  42214. t.prototype._onClear.call(this), this.type = 2, this.vertices.clear(), this.texture = null
  42215. }, i
  42216. })(i);
  42217. t.MeshDisplayData = o;
  42218. var a = (function(t) {
  42219. function e() {
  42220. var e = null !== t && t.apply(this, arguments) || this;
  42221. return e.boundingBox = null, e
  42222. }
  42223. return n(e, t), e.toString = function() {
  42224. return "[class dragonBones.BoundingBoxDisplayData]"
  42225. }, e.prototype._onClear = function() {
  42226. t.prototype._onClear.call(this), null !== this.boundingBox && this.boundingBox.returnToPool(), this.type = 3, this.boundingBox = null
  42227. }, e
  42228. })(i);
  42229. t.BoundingBoxDisplayData = a;
  42230. var l = (function(t) {
  42231. function i() {
  42232. var i = null !== t && t.apply(this, arguments) || this;
  42233. return i.vertices = new e, i.curveLengths = [], i
  42234. }
  42235. return n(i, t), i.toString = function() {
  42236. return "[class dragonBones.PathDisplayData]"
  42237. }, i.prototype._onClear = function() {
  42238. t.prototype._onClear.call(this), this.type = 4, this.closed = !1, this.constantSpeed = !1, this.vertices.clear(), this.curveLengths.length = 0
  42239. }, i
  42240. })(i);
  42241. t.PathDisplayData = l;
  42242. var h = (function(t) {
  42243. function e() {
  42244. var e = null !== t && t.apply(this, arguments) || this;
  42245. return e.bones = [], e
  42246. }
  42247. return n(e, t), e.toString = function() {
  42248. return "[class dragonBones.WeightData]"
  42249. }, e.prototype._onClear = function() {
  42250. this.count = 0, this.offset = 0, this.bones.length = 0
  42251. }, e.prototype.addBone = function(t) {
  42252. this.bones.push(t)
  42253. }, e
  42254. })(t.BaseObject);
  42255. t.WeightData = h
  42256. })(r || (r = {})), (function(t) {
  42257. var e = (function(t) {
  42258. function e() {
  42259. return null !== t && t.apply(this, arguments) || this
  42260. }
  42261. return n(e, t), e.prototype._onClear = function() {
  42262. this.color = 0, this.width = 0, this.height = 0
  42263. }, e
  42264. })(t.BaseObject);
  42265. t.BoundingBoxData = e;
  42266. var i = (function(t) {
  42267. function e() {
  42268. return null !== t && t.apply(this, arguments) || this
  42269. }
  42270. return n(e, t), e.toString = function() {
  42271. return "[class dragonBones.RectangleBoundingBoxData]"
  42272. }, e._computeOutCode = function(t, e, i, n, r, s) {
  42273. var o = 0;
  42274. return t < i ? o |= 1 : t > r && (o |= 2), e < n ? o |= 4 : e > s && (o |= 8), o
  42275. }, e.rectangleIntersectsSegment = function(t, i, n, r, s, o, a, l, h, c, u) {
  42276. void 0 === h && (h = null), void 0 === c && (c = null), void 0 === u && (u = null);
  42277. var _ = t > s && t < a && i > o && i < l,
  42278. f = n > s && n < a && r > o && r < l;
  42279. if (_ && f) return -1;
  42280. for (var d = 0, p = e._computeOutCode(t, i, s, o, a, l), m = e._computeOutCode(n, r, s, o, a, l);;) {
  42281. if (0 == (p | m)) {
  42282. d = 2;
  42283. break
  42284. }
  42285. if (0 != (p & m)) break;
  42286. var y = 0,
  42287. v = 0,
  42288. g = 0,
  42289. x = 0 !== p ? p : m;
  42290. 0 != (4 & x) ? (y = t + (n - t) * (o - i) / (r - i), v = o, null !== u && (g = .5 * -Math.PI)) : 0 != (8 & x) ? (y = t + (n - t) * (l - i) / (r - i), v = l, null !== u && (g = .5 * Math.PI)) : 0 != (2 & x) ? (v = i + (r - i) * (a - t) / (n - t), y = a, null !== u && (g = 0)) : 0 != (1 & x) && (v = i + (r - i) * (s - t) / (n - t), y = s, null !== u && (g = Math.PI)), x === p ? (t = y, i = v, p = e._computeOutCode(t, i, s, o, a, l), null !== u && (u.x = g)) : (n = y, r = v, m = e._computeOutCode(n, r, s, o, a, l), null !== u && (u.y = g))
  42291. }
  42292. return d && (_ ? (d = 2, null !== h && (h.x = n, h.y = r), null !== c && (c.x = n, c.y = n), null !== u && (u.x = u.y + Math.PI)) : f ? (d = 1, null !== h && (h.x = t, h.y = i), null !== c && (c.x = t, c.y = i), null !== u && (u.y = u.x + Math.PI)) : (d = 3, null !== h && (h.x = t, h.y = i), null !== c && (c.x = n, c.y = r))), d
  42293. }, e.prototype._onClear = function() {
  42294. t.prototype._onClear.call(this), this.type = 0
  42295. }, e.prototype.containsPoint = function(t, e) {
  42296. var i = .5 * this.width;
  42297. if (t >= -i && t <= i) {
  42298. var n = .5 * this.height;
  42299. if (e >= -n && e <= n) return !0
  42300. }
  42301. return !1
  42302. }, e.prototype.intersectsSegment = function(t, i, n, r, s, o, a) {
  42303. void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null);
  42304. var l = .5 * this.width,
  42305. h = .5 * this.height;
  42306. return e.rectangleIntersectsSegment(t, i, n, r, -l, -h, l, h, s, o, a)
  42307. }, e
  42308. })(e);
  42309. t.RectangleBoundingBoxData = i;
  42310. var r = (function(t) {
  42311. function e() {
  42312. return null !== t && t.apply(this, arguments) || this
  42313. }
  42314. return n(e, t), e.toString = function() {
  42315. return "[class dragonBones.EllipseData]"
  42316. }, e.ellipseIntersectsSegment = function(t, e, i, n, r, s, o, a, l, h, c) {
  42317. void 0 === l && (l = null), void 0 === h && (h = null), void 0 === c && (c = null);
  42318. var u = o / a,
  42319. _ = u * u,
  42320. f = i - t,
  42321. d = (n *= u) - (e *= u),
  42322. p = Math.sqrt(f * f + d * d),
  42323. m = f / p,
  42324. y = d / p,
  42325. v = (r - t) * m + (s - e) * y,
  42326. g = o * o,
  42327. x = g - (t * t + e * e) + v * v,
  42328. b = 0;
  42329. if (x >= 0) {
  42330. var A = Math.sqrt(x),
  42331. C = v - A,
  42332. T = v + A,
  42333. S = C < 0 ? -1 : C <= p ? 0 : 1,
  42334. w = T < 0 ? -1 : T <= p ? 0 : 1,
  42335. E = S * w;
  42336. if (E < 0) return -1;
  42337. 0 === E && (-1 === S ? (b = 2, i = t + T * m, n = (e + T * y) / u, null !== l && (l.x = i, l.y = n), null !== h && (h.x = i, h.y = n), null !== c && (c.x = Math.atan2(n / g * _, i / g), c.y = c.x + Math.PI)) : 1 === w ? (b = 1, t += C * m, e = (e + C * y) / u, null !== l && (l.x = t, l.y = e), null !== h && (h.x = t, h.y = e), null !== c && (c.x = Math.atan2(e / g * _, t / g), c.y = c.x + Math.PI)) : (b = 3, null !== l && (l.x = t + C * m, l.y = (e + C * y) / u, null !== c && (c.x = Math.atan2(l.y / g * _, l.x / g))), null !== h && (h.x = t + T * m, h.y = (e + T * y) / u, null !== c && (c.y = Math.atan2(h.y / g * _, h.x / g)))))
  42338. }
  42339. return b
  42340. }, e.prototype._onClear = function() {
  42341. t.prototype._onClear.call(this), this.type = 1
  42342. }, e.prototype.containsPoint = function(t, e) {
  42343. var i = .5 * this.width;
  42344. if (t >= -i && t <= i) {
  42345. var n = .5 * this.height;
  42346. if (e >= -n && e <= n) return e *= i / n, Math.sqrt(t * t + e * e) <= i
  42347. }
  42348. return !1
  42349. }, e.prototype.intersectsSegment = function(t, i, n, r, s, o, a) {
  42350. return void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null), e.ellipseIntersectsSegment(t, i, n, r, 0, 0, .5 * this.width, .5 * this.height, s, o, a)
  42351. }, e
  42352. })(e);
  42353. t.EllipseBoundingBoxData = r;
  42354. var s = (function(t) {
  42355. function e() {
  42356. var e = null !== t && t.apply(this, arguments) || this;
  42357. return e.vertices = [], e
  42358. }
  42359. return n(e, t), e.toString = function() {
  42360. return "[class dragonBones.PolygonBoundingBoxData]"
  42361. }, e.polygonIntersectsSegment = function(t, e, i, n, r, s, o, a) {
  42362. void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null), t === i && (t = i + 1e-6), e === n && (e = n + 1e-6);
  42363. for (var l = r.length, h = t - i, c = e - n, u = t * n - e * i, _ = 0, f = r[l - 2], d = r[l - 1], p = 0, m = 0, y = 0, v = 0, g = 0, x = 0, b = 0; b < l; b += 2) {
  42364. var A = r[b],
  42365. C = r[b + 1];
  42366. f === A && (f = A + 1e-4), d === C && (d = C + 1e-4);
  42367. var T = f - A,
  42368. S = d - C,
  42369. w = f * C - d * A,
  42370. E = h * S - c * T,
  42371. M = (u * T - h * w) / E;
  42372. if ((M >= f && M <= A || M >= A && M <= f) && (0 === h || M >= t && M <= i || M >= i && M <= t)) {
  42373. var D = (u * S - c * w) / E;
  42374. if ((D >= d && D <= C || D >= C && D <= d) && (0 === c || D >= e && D <= n || D >= n && D <= e)) {
  42375. if (null === o) {
  42376. y = M, v = D, g = M, x = D, _++, null !== a && (a.x = Math.atan2(C - d, A - f) - .5 * Math.PI, a.y = a.x);
  42377. break
  42378. }
  42379. var B = M - t;
  42380. B < 0 && (B = -B), 0 === _ ? (p = B, m = B, y = M, v = D, g = M, x = D, null !== a && (a.x = Math.atan2(C - d, A - f) - .5 * Math.PI, a.y = a.x)) : (B < p && (p = B, y = M, v = D, null !== a && (a.x = Math.atan2(C - d, A - f) - .5 * Math.PI)), B > m && (m = B, g = M, x = D, null !== a && (a.y = Math.atan2(C - d, A - f) - .5 * Math.PI))), _++
  42381. }
  42382. }
  42383. f = A, d = C
  42384. }
  42385. return 1 === _ ? (null !== s && (s.x = y, s.y = v), null !== o && (o.x = y, o.y = v), null !== a && (a.y = a.x + Math.PI)) : _ > 1 && (_++, null !== s && (s.x = y, s.y = v), null !== o && (o.x = g, o.y = x)), _
  42386. }, e.prototype._onClear = function() {
  42387. t.prototype._onClear.call(this), this.type = 2, this.x = 0, this.y = 0, this.vertices.length = 0
  42388. }, e.prototype.containsPoint = function(t, e) {
  42389. var i = !1;
  42390. if (t >= this.x && t <= this.width && e >= this.y && e <= this.height)
  42391. for (var n = 0, r = this.vertices.length, s = r - 2; n < r; n += 2) {
  42392. var o = this.vertices[s + 1],
  42393. a = this.vertices[n + 1];
  42394. if (a < e && o >= e || o < e && a >= e) {
  42395. var l = this.vertices[s],
  42396. h = this.vertices[n];
  42397. (e - a) * (l - h) / (o - a) + h < t && (i = !i)
  42398. }
  42399. s = n
  42400. }
  42401. return i
  42402. }, e.prototype.intersectsSegment = function(t, n, r, s, o, a, l) {
  42403. void 0 === o && (o = null), void 0 === a && (a = null), void 0 === l && (l = null);
  42404. var h = 0;
  42405. return 0 !== i.rectangleIntersectsSegment(t, n, r, s, this.x, this.y, this.x + this.width, this.y + this.height, null, null, null) && (h = e.polygonIntersectsSegment(t, n, r, s, this.vertices, o, a, l)), h
  42406. }, e
  42407. })(e);
  42408. t.PolygonBoundingBoxData = s
  42409. })(r || (r = {})), (function(t) {
  42410. var e = (function(t) {
  42411. function e() {
  42412. var e = null !== t && t.apply(this, arguments) || this;
  42413. return e.cachedFrames = [], e.boneTimelines = {}, e.surfaceTimelines = {}, e.slotTimelines = {}, e.constraintTimelines = {}, e.animationTimelines = {}, e.boneCachedFrameIndices = {}, e.slotCachedFrameIndices = {}, e.actionTimeline = null, e.zOrderTimeline = null, e
  42414. }
  42415. return n(e, t), e.toString = function() {
  42416. return "[class dragonBones.AnimationData]"
  42417. }, e.prototype._onClear = function() {
  42418. for (var t in this.boneTimelines) {
  42419. for (var e = 0, i = this.boneTimelines[t]; e < i.length; e++) {
  42420. i[e].returnToPool()
  42421. }
  42422. delete this.boneTimelines[t]
  42423. }
  42424. for (var t in this.surfaceTimelines) {
  42425. for (var n = 0, r = this.surfaceTimelines[t]; n < r.length; n++) {
  42426. r[n].returnToPool()
  42427. }
  42428. delete this.surfaceTimelines[t]
  42429. }
  42430. for (var t in this.slotTimelines) {
  42431. for (var s = 0, o = this.slotTimelines[t]; s < o.length; s++) {
  42432. o[s].returnToPool()
  42433. }
  42434. delete this.slotTimelines[t]
  42435. }
  42436. for (var t in this.constraintTimelines) {
  42437. for (var a = 0, l = this.constraintTimelines[t]; a < l.length; a++) {
  42438. l[a].returnToPool()
  42439. }
  42440. delete this.constraintTimelines[t]
  42441. }
  42442. for (var t in this.animationTimelines) {
  42443. for (var h = 0, c = this.animationTimelines[t]; h < c.length; h++) {
  42444. c[h].returnToPool()
  42445. }
  42446. delete this.animationTimelines[t]
  42447. }
  42448. for (var t in this.boneCachedFrameIndices) delete this.boneCachedFrameIndices[t];
  42449. for (var t in this.slotCachedFrameIndices) delete this.slotCachedFrameIndices[t];
  42450. null !== this.actionTimeline && this.actionTimeline.returnToPool(), null !== this.zOrderTimeline && this.zOrderTimeline.returnToPool(), this.frameIntOffset = 0, this.frameFloatOffset = 0, this.frameOffset = 0, this.frameCount = 0, this.playTimes = 0, this.duration = 0, this.scale = 1, this.fadeInTime = 0, this.cacheFrameRate = 0, this.name = "", this.cachedFrames.length = 0, this.actionTimeline = null, this.zOrderTimeline = null, this.parent = null
  42451. }, e.prototype.cacheFrames = function(t) {
  42452. if (!(this.cacheFrameRate > 0)) {
  42453. this.cacheFrameRate = Math.max(Math.ceil(t * this.scale), 1);
  42454. var e = Math.ceil(this.cacheFrameRate * this.duration) + 1;
  42455. this.cachedFrames.length = e;
  42456. for (var i = 0, n = this.cacheFrames.length; i < n; ++i) this.cachedFrames[i] = !1;
  42457. for (var r = 0, s = this.parent.sortedBones; r < s.length; r++) {
  42458. var o = s[r];
  42459. for (i = 0, n = (h = new Array(e)).length; i < n; ++i) h[i] = -1;
  42460. this.boneCachedFrameIndices[o.name] = h
  42461. }
  42462. for (var a = 0, l = this.parent.sortedSlots; a < l.length; a++) {
  42463. var h, c = l[a];
  42464. for (i = 0, n = (h = new Array(e)).length; i < n; ++i) h[i] = -1;
  42465. this.slotCachedFrameIndices[c.name] = h
  42466. }
  42467. }
  42468. }, e.prototype.addBoneTimeline = function(t, e) {
  42469. var i = t.name in this.boneTimelines ? this.boneTimelines[t.name] : this.boneTimelines[t.name] = [];
  42470. i.indexOf(e) < 0 && i.push(e)
  42471. }, e.prototype.addSurfaceTimeline = function(t, e) {
  42472. var i = t.name in this.surfaceTimelines ? this.surfaceTimelines[t.name] : this.surfaceTimelines[t.name] = [];
  42473. i.indexOf(e) < 0 && i.push(e)
  42474. }, e.prototype.addSlotTimeline = function(t, e) {
  42475. var i = t.name in this.slotTimelines ? this.slotTimelines[t.name] : this.slotTimelines[t.name] = [];
  42476. i.indexOf(e) < 0 && i.push(e)
  42477. }, e.prototype.addConstraintTimeline = function(t, e) {
  42478. var i = t.name in this.constraintTimelines ? this.constraintTimelines[t.name] : this.constraintTimelines[t.name] = [];
  42479. i.indexOf(e) < 0 && i.push(e)
  42480. }, e.prototype.addAnimationTimeline = function(t, e) {
  42481. var i = t in this.animationTimelines ? this.animationTimelines[t] : this.animationTimelines[t] = [];
  42482. i.indexOf(e) < 0 && i.push(e)
  42483. }, e.prototype.getBoneTimelines = function(t) {
  42484. return t in this.boneTimelines ? this.boneTimelines[t] : null
  42485. }, e.prototype.getSurfaceTimelines = function(t) {
  42486. return t in this.surfaceTimelines ? this.surfaceTimelines[t] : null
  42487. }, e.prototype.getSlotTimelines = function(t) {
  42488. return t in this.slotTimelines ? this.slotTimelines[t] : null
  42489. }, e.prototype.getConstraintTimelines = function(t) {
  42490. return t in this.constraintTimelines ? this.constraintTimelines[t] : null
  42491. }, e.prototype.getAnimationTimelines = function(t) {
  42492. return t in this.animationTimelines ? this.animationTimelines[t] : null
  42493. }, e.prototype.getBoneCachedFrameIndices = function(t) {
  42494. return t in this.boneCachedFrameIndices ? this.boneCachedFrameIndices[t] : null
  42495. }, e.prototype.getSlotCachedFrameIndices = function(t) {
  42496. return t in this.slotCachedFrameIndices ? this.slotCachedFrameIndices[t] : null
  42497. }, e
  42498. })(t.BaseObject);
  42499. t.AnimationData = e;
  42500. var i = (function(t) {
  42501. function e() {
  42502. return null !== t && t.apply(this, arguments) || this
  42503. }
  42504. return n(e, t), e.toString = function() {
  42505. return "[class dragonBones.TimelineData]"
  42506. }, e.prototype._onClear = function() {
  42507. this.type = 10, this.offset = 0, this.frameIndicesOffset = -1
  42508. }, e
  42509. })(t.BaseObject);
  42510. t.TimelineData = i
  42511. })(r || (r = {})), (function(t) {
  42512. var e = (function(t) {
  42513. function e() {
  42514. var e = null !== t && t.apply(this, arguments) || this;
  42515. return e.boneMask = [], e
  42516. }
  42517. return n(e, t), e.toString = function() {
  42518. return "[class dragonBones.AnimationConfig]"
  42519. }, e.prototype._onClear = function() {
  42520. this.pauseFadeOut = !0, this.fadeOutMode = 4, this.fadeOutTweenType = 1, this.fadeOutTime = -1, this.actionEnabled = !0, this.additiveBlending = !1, this.displayControl = !0, this.pauseFadeIn = !0, this.resetToPose = !0, this.fadeInTweenType = 1, this.playTimes = -1, this.layer = 0, this.position = 0, this.duration = -1, this.timeScale = -100, this.weight = 1, this.fadeInTime = -1, this.autoFadeOutTime = -1, this.name = "", this.animation = "", this.group = "", this.boneMask.length = 0
  42521. }, e.prototype.clear = function() {
  42522. this._onClear()
  42523. }, e.prototype.copyFrom = function(t) {
  42524. this.pauseFadeOut = t.pauseFadeOut, this.fadeOutMode = t.fadeOutMode, this.autoFadeOutTime = t.autoFadeOutTime, this.fadeOutTweenType = t.fadeOutTweenType, this.actionEnabled = t.actionEnabled, this.additiveBlending = t.additiveBlending, this.displayControl = t.displayControl, this.pauseFadeIn = t.pauseFadeIn, this.resetToPose = t.resetToPose, this.playTimes = t.playTimes, this.layer = t.layer, this.position = t.position, this.duration = t.duration, this.timeScale = t.timeScale, this.fadeInTime = t.fadeInTime, this.fadeOutTime = t.fadeOutTime, this.fadeInTweenType = t.fadeInTweenType, this.weight = t.weight, this.name = t.name, this.animation = t.animation, this.group = t.group, this.boneMask.length = t.boneMask.length;
  42525. for (var e = 0, i = this.boneMask.length; e < i; ++e) this.boneMask[e] = t.boneMask[e]
  42526. }, e.prototype.containsBoneMask = function(t) {
  42527. return 0 === this.boneMask.length || this.boneMask.indexOf(t) >= 0
  42528. }, e.prototype.addBoneMask = function(t, e, i) {
  42529. void 0 === i && (i = !0);
  42530. var n = t.getBone(e);
  42531. if (null !== n && (this.boneMask.indexOf(e) < 0 && this.boneMask.push(e), i))
  42532. for (var r = 0, s = t.getBones(); r < s.length; r++) {
  42533. var o = s[r];
  42534. this.boneMask.indexOf(o.name) < 0 && n.contains(o) && this.boneMask.push(o.name)
  42535. }
  42536. }, e.prototype.removeBoneMask = function(t, e, i) {
  42537. void 0 === i && (i = !0);
  42538. var n = this.boneMask.indexOf(e);
  42539. if (n >= 0 && this.boneMask.splice(n, 1), i) {
  42540. var r = t.getBone(e);
  42541. if (null !== r)
  42542. if (this.boneMask.length > 0)
  42543. for (var s = 0, o = t.getBones(); s < o.length; s++) {
  42544. var a = o[s],
  42545. l = this.boneMask.indexOf(a.name);
  42546. l >= 0 && r.contains(a) && this.boneMask.splice(l, 1)
  42547. } else
  42548. for (var h = 0, c = t.getBones(); h < c.length; h++) {
  42549. (a = c[h]) !== r && (r.contains(a) || this.boneMask.push(a.name))
  42550. }
  42551. }
  42552. }, e
  42553. })(t.BaseObject);
  42554. t.AnimationConfig = e
  42555. })(r || (r = {})), (function(t) {
  42556. var e = (function(t) {
  42557. function e() {
  42558. var e = null !== t && t.apply(this, arguments) || this;
  42559. return e.textures = {}, e
  42560. }
  42561. return n(e, t), e.prototype._onClear = function() {
  42562. for (var t in this.textures) this.textures[t].returnToPool(), delete this.textures[t];
  42563. this.autoSearch = !1, this.width = 0, this.height = 0, this.scale = 1, this.name = "", this.imagePath = ""
  42564. }, e.prototype.copyFrom = function(t) {
  42565. for (var e in this.autoSearch = t.autoSearch, this.scale = t.scale, this.width = t.width, this.height = t.height, this.name = t.name, this.imagePath = t.imagePath, this.textures) this.textures[e].returnToPool(), delete this.textures[e];
  42566. for (var e in t.textures) {
  42567. var i = this.createTexture();
  42568. i.copyFrom(t.textures[e]), this.textures[e] = i
  42569. }
  42570. }, e.prototype.addTexture = function(t) {
  42571. t.name in this.textures ? console.warn("Same texture: " + t.name) : (t.parent = this, this.textures[t.name] = t)
  42572. }, e.prototype.getTexture = function(t) {
  42573. return t in this.textures ? this.textures[t] : null
  42574. }, e
  42575. })(t.BaseObject);
  42576. t.TextureAtlasData = e;
  42577. var i = (function(e) {
  42578. function i() {
  42579. var i = null !== e && e.apply(this, arguments) || this;
  42580. return i.region = new t.Rectangle, i.frame = null, i
  42581. }
  42582. return n(i, e), i.createRectangle = function() {
  42583. return new t.Rectangle
  42584. }, i.prototype._onClear = function() {
  42585. this.rotated = !1, this.name = "", this.region.clear(), this.parent = null, this.frame = null
  42586. }, i.prototype.copyFrom = function(t) {
  42587. this.rotated = t.rotated, this.name = t.name, this.region.copyFrom(t.region), this.parent = t.parent, null === this.frame && null !== t.frame ? this.frame = i.createRectangle() : null !== this.frame && null === t.frame && (this.frame = null), null !== this.frame && null !== t.frame && this.frame.copyFrom(t.frame)
  42588. }, i
  42589. })(t.BaseObject);
  42590. t.TextureData = i
  42591. })(r || (r = {})), (function(t) {
  42592. var e = (function(t) {
  42593. function e() {
  42594. var e = null !== t && t.apply(this, arguments) || this;
  42595. return e.vertices = [], e.bones = [], e
  42596. }
  42597. return n(e, t), e.toString = function() {
  42598. return "[class dragonBones.DeformVertices]"
  42599. }, e.prototype._onClear = function() {
  42600. this.verticesDirty = !1, this.vertices.length = 0, this.bones.length = 0, this.verticesData = null
  42601. }, e.prototype.init = function(t, e) {
  42602. if (this.verticesData = t, null !== this.verticesData) {
  42603. var i = 0;
  42604. i = null !== this.verticesData.weight ? 2 * this.verticesData.weight.count : 2 * this.verticesData.data.intArray[this.verticesData.offset + 0], this.verticesDirty = !0, this.vertices.length = i, this.bones.length = 0;
  42605. for (var n = 0, r = this.vertices.length; n < r; ++n) this.vertices[n] = 0;
  42606. if (null !== this.verticesData.weight)
  42607. for (n = 0, r = this.verticesData.weight.bones.length; n < r; ++n) {
  42608. var s = e.getBone(this.verticesData.weight.bones[n].name);
  42609. this.bones.push(s)
  42610. }
  42611. } else this.verticesDirty = !1, this.vertices.length = 0, this.bones.length = 0, this.verticesData = null
  42612. }, e.prototype.isBonesUpdate = function() {
  42613. for (var t = 0, e = this.bones; t < e.length; t++) {
  42614. var i = e[t];
  42615. if (null !== i && i._childrenTransformDirty) return !0
  42616. }
  42617. return !1
  42618. }, e
  42619. })(t.BaseObject);
  42620. t.DeformVertices = e
  42621. })(r || (r = {})), (function(t) {
  42622. var e = (function(e) {
  42623. function i() {
  42624. var t = null !== e && e.apply(this, arguments) || this;
  42625. return t._bones = [], t._slots = [], t._constraints = [], t._actions = [], t._animation = null, t._proxy = null, t._replaceTextureAtlasData = null, t._clock = null, t
  42626. }
  42627. return n(i, e), i.toString = function() {
  42628. return "[class dragonBones.Armature]"
  42629. }, i._onSortSlots = function(t, e) {
  42630. return t._zOrder > e._zOrder ? 1 : -1
  42631. }, i.prototype._onClear = function() {
  42632. null !== this._clock && this._clock.remove(this);
  42633. for (var t = 0, e = this._bones; t < e.length; t++) {
  42634. e[t].returnToPool()
  42635. }
  42636. for (var i = 0, n = this._slots; i < n.length; i++) {
  42637. n[i].returnToPool()
  42638. }
  42639. for (var r = 0, s = this._constraints; r < s.length; r++) {
  42640. s[r].returnToPool()
  42641. }
  42642. for (var o = 0, a = this._actions; o < a.length; o++) {
  42643. a[o].returnToPool()
  42644. }
  42645. null !== this._animation && this._animation.returnToPool(), null !== this._proxy && this._proxy.dbClear(), null !== this._replaceTextureAtlasData && this._replaceTextureAtlasData.returnToPool(), this.inheritAnimation = !0, this.userData = null, this._lockUpdate = !1, this._slotsDirty = !0, this._zOrderDirty = !1, this._flipX = !1, this._flipY = !1, this._cacheFrameIndex = -1, this._bones.length = 0, this._slots.length = 0, this._constraints.length = 0, this._actions.length = 0, this._armatureData = null, this._animation = null, this._proxy = null, this._display = null, this._replaceTextureAtlasData = null, this._replacedTexture = null, this._dragonBones = null, this._clock = null, this._parent = null
  42646. }, i.prototype._sortZOrder = function(t, e) {
  42647. var i = this._armatureData.sortedSlots,
  42648. n = null === t;
  42649. if (this._zOrderDirty || !n) {
  42650. for (var r = 0, s = i.length; r < s; ++r) {
  42651. var o = n ? r : t[e + r];
  42652. if (!(o < 0 || o >= s)) {
  42653. var a = i[o],
  42654. l = this.getSlot(a.name);
  42655. null !== l && l._setZorder(r)
  42656. }
  42657. }
  42658. this._slotsDirty = !0, this._zOrderDirty = !n
  42659. }
  42660. }, i.prototype._addBone = function(t) {
  42661. this._bones.indexOf(t) < 0 && this._bones.push(t)
  42662. }, i.prototype._addSlot = function(t) {
  42663. this._slots.indexOf(t) < 0 && this._slots.push(t)
  42664. }, i.prototype._addConstraint = function(t) {
  42665. this._constraints.indexOf(t) < 0 && this._constraints.push(t)
  42666. }, i.prototype._bufferAction = function(t, e) {
  42667. this._actions.indexOf(t) < 0 && (e ? this._actions.push(t) : this._actions.unshift(t))
  42668. }, i.prototype.dispose = function() {
  42669. null !== this._armatureData && (this._lockUpdate = !0, this._dragonBones.bufferObject(this))
  42670. }, i.prototype.init = function(e, i, n, r) {
  42671. null === this._armatureData && (this._armatureData = e, this._animation = t.BaseObject.borrowObject(t.Animation), this._proxy = i, this._display = n, this._dragonBones = r, this._proxy.dbInit(this), this._animation.init(this), this._animation.animations = this._armatureData.animations)
  42672. }, i.prototype.advanceTime = function(t) {
  42673. if (!this._lockUpdate)
  42674. if (null !== this._armatureData)
  42675. if (null !== this._armatureData.parent) {
  42676. var e = this._cacheFrameIndex;
  42677. if (this._animation.advanceTime(t), this._slotsDirty && (this._slotsDirty = !1, this._slots.sort(i._onSortSlots)), this._cacheFrameIndex < 0 || this._cacheFrameIndex !== e) {
  42678. var n = 0,
  42679. r = 0;
  42680. for (n = 0, r = this._bones.length; n < r; ++n) this._bones[n].update(this._cacheFrameIndex);
  42681. for (n = 0, r = this._slots.length; n < r; ++n) this._slots[n].update(this._cacheFrameIndex)
  42682. }
  42683. if (this._actions.length > 0) {
  42684. this._lockUpdate = !0;
  42685. for (var s = 0, o = this._actions; s < o.length; s++) {
  42686. var a = o[s],
  42687. l = a.actionData;
  42688. if (null !== l)
  42689. if (0 === l.type)
  42690. if (null !== a.slot) null !== (u = a.slot.childArmature) && u.animation.fadeIn(l.name);
  42691. else if (null !== a.bone)
  42692. for (var h = 0, c = this.getSlots(); h < c.length; h++) {
  42693. var u, _ = c[h];
  42694. if (_.parent === a.bone) null !== (u = _.childArmature) && u.animation.fadeIn(l.name)
  42695. } else this._animation.fadeIn(l.name);
  42696. a.returnToPool()
  42697. }
  42698. this._actions.length = 0, this._lockUpdate = !1
  42699. }
  42700. this._proxy.dbUpdate()
  42701. } else console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().");
  42702. else console.warn("The armature has been disposed.")
  42703. }, i.prototype.invalidUpdate = function(t, e) {
  42704. if (void 0 === t && (t = null), void 0 === e && (e = !1), null !== t && t.length > 0) {
  42705. if (null !== (o = this.getBone(t)) && (o.invalidUpdate(), e))
  42706. for (var i = 0, n = this._slots; i < n.length; i++) {
  42707. (h = n[i]).parent === o && h.invalidUpdate()
  42708. }
  42709. } else {
  42710. for (var r = 0, s = this._bones; r < s.length; r++) {
  42711. var o;
  42712. (o = s[r]).invalidUpdate()
  42713. }
  42714. if (e)
  42715. for (var a = 0, l = this._slots; a < l.length; a++) {
  42716. var h;
  42717. (h = l[a]).invalidUpdate()
  42718. }
  42719. }
  42720. }, i.prototype.containsPoint = function(t, e) {
  42721. for (var i = 0, n = this._slots; i < n.length; i++) {
  42722. var r = n[i];
  42723. if (r.containsPoint(t, e)) return r
  42724. }
  42725. return null
  42726. }, i.prototype.intersectsSegment = function(t, e, i, n, r, s, o) {
  42727. void 0 === r && (r = null), void 0 === s && (s = null), void 0 === o && (o = null);
  42728. for (var a = t === i, l = 0, h = 0, c = 0, u = 0, _ = 0, f = 0, d = 0, p = 0, m = null, y = null, v = 0, g = this._slots; v < g.length; v++) {
  42729. var x = g[v];
  42730. if (x.intersectsSegment(t, e, i, n, r, s, o) > 0) {
  42731. if (null === r && null === s) {
  42732. m = x;
  42733. break
  42734. }
  42735. var b;
  42736. null !== r && ((b = a ? r.y - e : r.x - t) < 0 && (b = -b), (null === m || b < l) && (l = b, c = r.x, u = r.y, m = x, o && (d = o.x))), null !== s && ((b = s.x - t) < 0 && (b = -b), (null === y || b > h) && (h = b, _ = s.x, f = s.y, y = x, null !== o && (p = o.y)))
  42737. }
  42738. }
  42739. return null !== m && null !== r && (r.x = c, r.y = u, null !== o && (o.x = d)), null !== y && null !== s && (s.x = _, s.y = f, null !== o && (o.y = p)), m
  42740. }, i.prototype.getBone = function(t) {
  42741. for (var e = 0, i = this._bones; e < i.length; e++) {
  42742. var n = i[e];
  42743. if (n.name === t) return n
  42744. }
  42745. return null
  42746. }, i.prototype.getBoneByDisplay = function(t) {
  42747. var e = this.getSlotByDisplay(t);
  42748. return null !== e ? e.parent : null
  42749. }, i.prototype.getSlot = function(t) {
  42750. for (var e = 0, i = this._slots; e < i.length; e++) {
  42751. var n = i[e];
  42752. if (n.name === t) return n
  42753. }
  42754. return null
  42755. }, i.prototype.getSlotByDisplay = function(t) {
  42756. if (null !== t)
  42757. for (var e = 0, i = this._slots; e < i.length; e++) {
  42758. var n = i[e];
  42759. if (n.display === t) return n
  42760. }
  42761. return null
  42762. }, i.prototype.getBones = function() {
  42763. return this._bones
  42764. }, i.prototype.getSlots = function() {
  42765. return this._slots
  42766. }, Object.defineProperty(i.prototype, "flipX", {
  42767. get: function() {
  42768. return this._flipX
  42769. },
  42770. set: function(t) {
  42771. this._flipX !== t && (this._flipX = t, this.invalidUpdate())
  42772. },
  42773. enumerable: !0,
  42774. configurable: !0
  42775. }), Object.defineProperty(i.prototype, "flipY", {
  42776. get: function() {
  42777. return this._flipY
  42778. },
  42779. set: function(t) {
  42780. this._flipY !== t && (this._flipY = t, this.invalidUpdate())
  42781. },
  42782. enumerable: !0,
  42783. configurable: !0
  42784. }), Object.defineProperty(i.prototype, "cacheFrameRate", {
  42785. get: function() {
  42786. return this._armatureData.cacheFrameRate
  42787. },
  42788. set: function(t) {
  42789. if (this._armatureData.cacheFrameRate !== t) {
  42790. this._armatureData.cacheFrames(t);
  42791. for (var e = 0, i = this._slots; e < i.length; e++) {
  42792. var n = i[e].childArmature;
  42793. null !== n && (n.cacheFrameRate = t)
  42794. }
  42795. }
  42796. },
  42797. enumerable: !0,
  42798. configurable: !0
  42799. }), Object.defineProperty(i.prototype, "name", {
  42800. get: function() {
  42801. return this._armatureData.name
  42802. },
  42803. enumerable: !0,
  42804. configurable: !0
  42805. }), Object.defineProperty(i.prototype, "armatureData", {
  42806. get: function() {
  42807. return this._armatureData
  42808. },
  42809. enumerable: !0,
  42810. configurable: !0
  42811. }), Object.defineProperty(i.prototype, "animation", {
  42812. get: function() {
  42813. return this._animation
  42814. },
  42815. enumerable: !0,
  42816. configurable: !0
  42817. }), Object.defineProperty(i.prototype, "proxy", {
  42818. get: function() {
  42819. return this._proxy
  42820. },
  42821. enumerable: !0,
  42822. configurable: !0
  42823. }), Object.defineProperty(i.prototype, "eventDispatcher", {
  42824. get: function() {
  42825. return this._proxy
  42826. },
  42827. enumerable: !0,
  42828. configurable: !0
  42829. }), Object.defineProperty(i.prototype, "display", {
  42830. get: function() {
  42831. return this._display
  42832. },
  42833. enumerable: !0,
  42834. configurable: !0
  42835. }), Object.defineProperty(i.prototype, "replacedTexture", {
  42836. get: function() {
  42837. return this._replacedTexture
  42838. },
  42839. set: function(t) {
  42840. if (this._replacedTexture !== t) {
  42841. null !== this._replaceTextureAtlasData && (this._replaceTextureAtlasData.returnToPool(), this._replaceTextureAtlasData = null), this._replacedTexture = t;
  42842. for (var e = 0, i = this._slots; e < i.length; e++) {
  42843. var n = i[e];
  42844. n.invalidUpdate(), n.update(-1)
  42845. }
  42846. }
  42847. },
  42848. enumerable: !0,
  42849. configurable: !0
  42850. }), Object.defineProperty(i.prototype, "clock", {
  42851. get: function() {
  42852. return this._clock
  42853. },
  42854. set: function(t) {
  42855. if (this._clock !== t) {
  42856. null !== this._clock && this._clock.remove(this), this._clock = t, this._clock && this._clock.add(this);
  42857. for (var e = 0, i = this._slots; e < i.length; e++) {
  42858. var n = i[e].childArmature;
  42859. null !== n && (n.clock = this._clock)
  42860. }
  42861. }
  42862. },
  42863. enumerable: !0,
  42864. configurable: !0
  42865. }), Object.defineProperty(i.prototype, "parent", {
  42866. get: function() {
  42867. return this._parent
  42868. },
  42869. enumerable: !0,
  42870. configurable: !0
  42871. }), i.prototype.replaceTexture = function(t) {
  42872. this.replacedTexture = t
  42873. }, i.prototype.hasEventListener = function(t) {
  42874. return this._proxy.hasDBEventListener(t)
  42875. }, i.prototype.addEventListener = function(t, e, i) {
  42876. this._proxy.addDBEventListener(t, e, i)
  42877. }, i.prototype.removeEventListener = function(t, e, i) {
  42878. this._proxy.removeDBEventListener(t, e, i)
  42879. }, i.prototype.enableAnimationCache = function(t) {
  42880. console.warn("Deprecated."), this.cacheFrameRate = t
  42881. }, i.prototype.getDisplay = function() {
  42882. return this._display
  42883. }, i
  42884. })(t.BaseObject);
  42885. t.Armature = e
  42886. })(r || (r = {})), (function(t) {
  42887. var e = (function(e) {
  42888. function i() {
  42889. var i = null !== e && e.apply(this, arguments) || this;
  42890. return i.globalTransformMatrix = new t.Matrix, i.global = new t.Transform, i.offset = new t.Transform, i
  42891. }
  42892. return n(i, e), i.prototype._onClear = function() {
  42893. this.globalTransformMatrix.identity(), this.global.identity(), this.offset.identity(), this.origin = null, this.userData = null, this._globalDirty = !1, this._armature = null
  42894. }, i.prototype.updateGlobalTransform = function() {
  42895. this._globalDirty && (this._globalDirty = !1, this.global.fromMatrix(this.globalTransformMatrix))
  42896. }, Object.defineProperty(i.prototype, "armature", {
  42897. get: function() {
  42898. return this._armature
  42899. },
  42900. enumerable: !0,
  42901. configurable: !0
  42902. }), i._helpMatrix = new t.Matrix, i._helpTransform = new t.Transform, i._helpPoint = new t.Point, i
  42903. })(t.BaseObject);
  42904. t.TransformObject = e
  42905. })(r || (r = {})), (function(t) {
  42906. var e = (function(e) {
  42907. function i() {
  42908. var i = null !== e && e.apply(this, arguments) || this;
  42909. return i.animationPose = new t.Transform, i._blendState = new t.BlendState, i
  42910. }
  42911. return n(i, e), i.toString = function() {
  42912. return "[class dragonBones.Bone]"
  42913. }, i.prototype._onClear = function() {
  42914. e.prototype._onClear.call(this), this.offsetMode = 1, this.animationPose.identity(), this._transformDirty = !1, this._childrenTransformDirty = !1, this._localDirty = !0, this._hasConstraint = !1, this._visible = !0, this._cachedFrameIndex = -1, this._blendState.clear(), this._boneData = null, this._parent = null, this._cachedFrameIndices = null
  42915. }, i.prototype._updateGlobalTransformMatrix = function(e) {
  42916. var i = this._boneData,
  42917. n = this.global,
  42918. r = this.globalTransformMatrix,
  42919. s = this.origin,
  42920. o = this.offset,
  42921. a = this.animationPose,
  42922. l = this._parent,
  42923. h = this._armature.flipX,
  42924. c = this._armature.flipY === t.DragonBones.yDown,
  42925. u = null !== l,
  42926. _ = 0;
  42927. if (1 === this.offsetMode ? null !== s ? (n.x = s.x + o.x + a.x, n.scaleX = s.scaleX * o.scaleX * a.scaleX, n.scaleY = s.scaleY * o.scaleY * a.scaleY, t.DragonBones.yDown ? (n.y = s.y + o.y + a.y, n.skew = s.skew + o.skew + a.skew, n.rotation = s.rotation + o.rotation + a.rotation) : (n.y = s.y - o.y + a.y, n.skew = s.skew - o.skew + a.skew, n.rotation = s.rotation - o.rotation + a.rotation)) : (n.copyFrom(o), t.DragonBones.yDown || (n.y = -n.y, n.skew = -n.skew, n.rotation = -n.rotation), n.add(a)) : 0 === this.offsetMode ? null !== s ? n.copyFrom(s).add(a) : n.copyFrom(a) : (u = !1, n.copyFrom(o), t.DragonBones.yDown || (n.y = -n.y, n.skew = -n.skew, n.rotation = -n.rotation)), u) {
  42928. var f = 0 === l._boneData.type ? l.globalTransformMatrix : l._getGlobalTransformMatrix(n.x, n.y);
  42929. if (i.inheritScale) i.inheritRotation || (l.updateGlobalTransform(), _ = h && c ? n.rotation - (l.global.rotation + Math.PI) : h ? n.rotation + l.global.rotation + Math.PI : c ? n.rotation + l.global.rotation : n.rotation - l.global.rotation, n.rotation = _), n.toMatrix(r), r.concat(f), i.inheritTranslation ? (n.x = r.tx, n.y = r.ty) : (r.tx = n.x, r.ty = n.y), e ? n.fromMatrix(r) : this._globalDirty = !0;
  42930. else {
  42931. if (i.inheritTranslation) {
  42932. var d = n.x,
  42933. p = n.y;
  42934. n.x = f.a * d + f.c * p + f.tx, n.y = f.b * d + f.d * p + f.ty
  42935. } else h && (n.x = -n.x), c && (n.y = -n.y);
  42936. i.inheritRotation ? (l.updateGlobalTransform(), _ = l.global.scaleX < 0 ? n.rotation + l.global.rotation + Math.PI : n.rotation + l.global.rotation, f.a * f.d - f.b * f.c < 0 && (_ -= 2 * n.rotation, (h !== c || i.inheritReflection) && (n.skew += Math.PI), t.DragonBones.yDown || (n.skew = -n.skew)), n.rotation = _) : (h || c) && (h && c ? _ = n.rotation + Math.PI : (_ = h ? Math.PI - n.rotation : -n.rotation, n.skew += Math.PI), n.rotation = _), n.toMatrix(r)
  42937. }
  42938. } else(h || c) && (h && (n.x = -n.x), c && (n.y = -n.y), h && c ? _ = n.rotation + Math.PI : (_ = h ? Math.PI - n.rotation : -n.rotation, n.skew += Math.PI), n.rotation = _), n.toMatrix(r)
  42939. }, i.prototype.init = function(t, e) {
  42940. null === this._boneData && (this._boneData = t, this._armature = e, null !== this._boneData.parent && (this._parent = this._armature.getBone(this._boneData.parent.name)), this._armature._addBone(this), this.origin = this._boneData.transform)
  42941. }, i.prototype.update = function(t) {
  42942. if (this._blendState.dirty = !1, t >= 0 && null !== this._cachedFrameIndices) {
  42943. var e = this._cachedFrameIndices[t];
  42944. if (e >= 0 && this._cachedFrameIndex === e) this._transformDirty = !1;
  42945. else if (e >= 0) this._transformDirty = !0, this._cachedFrameIndex = e;
  42946. else {
  42947. if (this._hasConstraint)
  42948. for (var i = 0, n = this._armature._constraints; i < n.length; i++) {
  42949. (o = n[i])._root === this && o.update()
  42950. }
  42951. this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty ? (this._transformDirty = !0, this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, this._cachedFrameIndex = -1)
  42952. }
  42953. } else {
  42954. if (this._hasConstraint)
  42955. for (var r = 0, s = this._armature._constraints; r < s.length; r++) {
  42956. var o;
  42957. (o = s[r])._root === this && o.update()
  42958. }(this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && (t = -1, this._transformDirty = !0, this._cachedFrameIndex = -1)
  42959. }
  42960. if (this._transformDirty)
  42961. if (this._transformDirty = !1, this._childrenTransformDirty = !0, this._cachedFrameIndex < 0) {
  42962. var a = t >= 0;
  42963. this._localDirty && this._updateGlobalTransformMatrix(a), a && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global))
  42964. } else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
  42965. else this._childrenTransformDirty && (this._childrenTransformDirty = !1);
  42966. this._localDirty = !0
  42967. }, i.prototype.updateByConstraint = function() {
  42968. this._localDirty && (this._localDirty = !1, (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && this._updateGlobalTransformMatrix(!0), this._transformDirty = !0)
  42969. }, i.prototype.invalidUpdate = function() {
  42970. this._transformDirty = !0
  42971. }, i.prototype.contains = function(t) {
  42972. if (t === this) return !1;
  42973. for (var e = t; e !== this && null !== e;) e = e.parent;
  42974. return e === this
  42975. }, Object.defineProperty(i.prototype, "boneData", {
  42976. get: function() {
  42977. return this._boneData
  42978. },
  42979. enumerable: !0,
  42980. configurable: !0
  42981. }), Object.defineProperty(i.prototype, "visible", {
  42982. get: function() {
  42983. return this._visible
  42984. },
  42985. set: function(t) {
  42986. if (this._visible !== t) {
  42987. this._visible = t;
  42988. for (var e = 0, i = this._armature.getSlots(); e < i.length; e++) {
  42989. var n = i[e];
  42990. n.parent === this && n._updateVisible()
  42991. }
  42992. }
  42993. },
  42994. enumerable: !0,
  42995. configurable: !0
  42996. }), Object.defineProperty(i.prototype, "name", {
  42997. get: function() {
  42998. return this._boneData.name
  42999. },
  43000. enumerable: !0,
  43001. configurable: !0
  43002. }), Object.defineProperty(i.prototype, "parent", {
  43003. get: function() {
  43004. return this._parent
  43005. },
  43006. enumerable: !0,
  43007. configurable: !0
  43008. }), i.prototype.getBones = function() {
  43009. console.warn("Deprecated.");
  43010. for (var t = new Array, e = 0, i = this._armature.getBones(); e < i.length; e++) {
  43011. var n = i[e];
  43012. n.parent === this && t.push(n)
  43013. }
  43014. return t
  43015. }, i.prototype.getSlots = function() {
  43016. console.warn("Deprecated.");
  43017. for (var t = new Array, e = 0, i = this._armature.getSlots(); e < i.length; e++) {
  43018. var n = i[e];
  43019. n.parent === this && t.push(n)
  43020. }
  43021. return t
  43022. }, Object.defineProperty(i.prototype, "slot", {
  43023. get: function() {
  43024. console.warn("Deprecated.");
  43025. for (var t = 0, e = this._armature.getSlots(); t < e.length; t++) {
  43026. var i = e[t];
  43027. if (i.parent === this) return i
  43028. }
  43029. return null
  43030. },
  43031. enumerable: !0,
  43032. configurable: !0
  43033. }), i
  43034. })(t.TransformObject);
  43035. t.Bone = e
  43036. })(r || (r = {})), (function(t) {
  43037. var e = (function(t) {
  43038. function e() {
  43039. var e = null !== t && t.apply(this, arguments) || this;
  43040. return e._vertices = [], e._deformVertices = [], e._hullCache = [], e._matrixCahce = [], e
  43041. }
  43042. return n(e, t), e.toString = function() {
  43043. return "[class dragonBones.Surface]"
  43044. }, e.prototype._onClear = function() {
  43045. t.prototype._onClear.call(this), this._dX = 0, this._dY = 0, this._k = 0, this._kX = 0, this._kY = 0, this._vertices.length = 0, this._deformVertices.length = 0, this._matrixCahce.length = 0, this._hullCache.length = 0
  43046. }, e.prototype._getAffineTransform = function(t, e, i, n, r, s, o, a, l, h, c, u, _) {
  43047. var f = o - r,
  43048. d = a - s,
  43049. p = l - r,
  43050. m = h - s;
  43051. c.rotation = Math.atan2(d, f), c.skew = Math.atan2(m, p) - .5 * Math.PI - c.rotation, _ && (c.rotation += Math.PI), c.scaleX = Math.sqrt(f * f + d * d) / i, c.scaleY = Math.sqrt(p * p + m * m) / n, c.toMatrix(u), c.x = u.tx = r - (u.a * t + u.c * e), c.y = u.ty = s - (u.b * t + u.d * e)
  43052. }, e.prototype._updateVertices = function() {
  43053. var t = this._boneData.vertices,
  43054. e = this._vertices,
  43055. i = this._deformVertices;
  43056. if (null !== this._parent)
  43057. if (1 === this._parent._boneData.type)
  43058. for (var n = 0, r = t.length; n < r; n += 2) {
  43059. var s = t[n] + i[n],
  43060. o = t[n + 1] + i[n],
  43061. a = this._parent._getGlobalTransformMatrix(s, o);
  43062. e[n] = a.a * s + a.c * o + a.tx, e[n + 1] = a.b * s + a.d * o + a.ty
  43063. } else {
  43064. var l = this._parent.globalTransformMatrix;
  43065. for (n = 0, r = t.length; n < r; n += 2) {
  43066. s = t[n] + i[n], o = t[n + 1] + i[n + 1];
  43067. e[n] = l.a * s + l.c * o + l.tx, e[n + 1] = l.b * s + l.d * o + l.ty
  43068. }
  43069. } else
  43070. for (n = 0, r = t.length; n < r; n += 2) e[n] = t[n] + i[n], e[n + 1] = t[n + 1] + i[n + 1]
  43071. }, e.prototype._updateGlobalTransformMatrix = function(t) {
  43072. var e = 2 * this._boneData.segmentX,
  43073. i = this._vertices.length - 2,
  43074. n = this._vertices[0],
  43075. r = this._vertices[1],
  43076. s = this._vertices[e],
  43077. o = this._vertices[e + 1],
  43078. a = this._vertices[i],
  43079. l = this._vertices[i + 1],
  43080. h = this._vertices[i - e],
  43081. c = this._vertices[i - e + 1],
  43082. u = n + .5 * (a - n),
  43083. _ = r + .5 * (l - r),
  43084. f = u + .5 * (s + .5 * (h - s) - u),
  43085. d = _ + .5 * (o + .5 * (c - o) - _),
  43086. p = s + .5 * (a - s),
  43087. m = o + .5 * (l - o),
  43088. y = h + .5 * (a - h),
  43089. v = c + .5 * (l - c);
  43090. this._globalDirty = !1, this._getAffineTransform(0, 0, 200, 200, f, d, p, m, y, v, this.global, this.globalTransformMatrix, !1)
  43091. }, e.prototype._getGlobalTransformMatrix = function(t, i) {
  43092. var n = 1e3;
  43093. if (t < -n || n < t || i < -n || n < i) return this.globalTransformMatrix;
  43094. var r = !1,
  43095. s = 200,
  43096. o = this._boneData,
  43097. a = o.segmentX,
  43098. l = o.segmentY,
  43099. h = 2 * o.segmentX,
  43100. c = this._dX,
  43101. u = this._dY,
  43102. _ = Math.floor((t + s) / c),
  43103. f = Math.floor((i + s) / u),
  43104. d = 0,
  43105. p = _ * c - s,
  43106. m = f * u - s,
  43107. y = this._matrixCahce,
  43108. v = e._helpMatrix;
  43109. if (t < -s) {
  43110. if (i < -s || i >= s) return this.globalTransformMatrix;
  43111. if (d = 7 * (2 * (a * (l + 1) + 2 * a + l + f) + ((r = i > this._kX * (t + s) + m) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
  43112. else {
  43113. var g = f * (h + 2),
  43114. x = this._hullCache[4],
  43115. b = this._hullCache[5],
  43116. A = this._hullCache[2] - (l - f) * x,
  43117. C = this._hullCache[3] - (l - f) * b,
  43118. T = this._vertices;
  43119. r ? this._getAffineTransform(-s, m + u, 800, u, T[g + h + 2], T[g + h + 3], A + x, C + b, T[g], T[g + 1], e._helpTransform, v, !0) : this._getAffineTransform(-n, m, 800, u, A, C, T[g], T[g + 1], A + x, C + b, e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
  43120. }
  43121. } else if (t >= s) {
  43122. if (i < -s || i >= s) return this.globalTransformMatrix;
  43123. if (d = 7 * (2 * (a * (l + 1) + a + f) + ((r = i > this._kX * (t - n) + m) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
  43124. else {
  43125. g = (f + 1) * (h + 2) - 2, x = this._hullCache[4], b = this._hullCache[5], A = this._hullCache[0] + f * x, C = this._hullCache[1] + f * b, T = this._vertices;
  43126. r ? this._getAffineTransform(n, m + u, 800, u, A + x, C + b, T[g + h + 2], T[g + h + 3], A, C, e._helpTransform, v, !0) : this._getAffineTransform(s, m, 800, u, T[g], T[g + 1], A, C, T[g + h + 2], T[g + h + 3], e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
  43127. }
  43128. } else if (i < -s) {
  43129. if (t < -s || t >= s) return this.globalTransformMatrix;
  43130. if (d = 7 * (a * (l + 1) + 2 * _ + ((r = i > this._kY * (t - p - c) - n) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
  43131. else {
  43132. g = 2 * _, x = this._hullCache[10], b = this._hullCache[11], A = this._hullCache[8] + _ * x, C = this._hullCache[9] + _ * b, T = this._vertices;
  43133. r ? this._getAffineTransform(p + c, -s, c, 800, T[g + 2], T[g + 3], T[g], T[g + 1], A + x, C + b, e._helpTransform, v, !0) : this._getAffineTransform(p, -n, c, 800, A, C, A + x, C + b, T[g], T[g + 1], e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
  43134. }
  43135. } else if (i >= s) {
  43136. if (t < -s || t >= s) return this.globalTransformMatrix;
  43137. if (d = 7 * (2 * (a * (l + 1) + a + l + f) + ((r = i > this._kY * (t - p - c) + s) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
  43138. else {
  43139. g = l * (h + 2) + 2 * _, x = this._hullCache[10], b = this._hullCache[11], A = this._hullCache[6] - (a - _) * x, C = this._hullCache[7] - (a - _) * b, T = this._vertices;
  43140. r ? this._getAffineTransform(p + c, n, c, 800, A + x, C + b, A, C, T[g + 2], T[g + 3], e._helpTransform, v, !0) : this._getAffineTransform(p, s, c, 800, T[g], T[g + 1], T[g + 2], T[g + 3], A, C, e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
  43141. }
  43142. } else if (d = 7 * (2 * (a * f + _) + ((r = i > this._k * (t - p - c) + m) ? 1 : 0)), this._matrixCahce[d] > 0) v.copyFromArray(y, d + 1);
  43143. else {
  43144. g = 2 * _ + f * (h + 2), T = this._vertices;
  43145. r ? this._getAffineTransform(p + c, m + u, c, u, T[g + h + 4], T[g + h + 5], T[g + h + 2], T[g + h + 3], T[g + 2], T[g + 3], e._helpTransform, v, !0) : this._getAffineTransform(p, m, c, u, T[g], T[g + 1], T[g + 2], T[g + 3], T[g + h + 2], T[g + h + 3], e._helpTransform, v, !1), y[d] = 1, y[d + 1] = v.a, y[d + 2] = v.b, y[d + 3] = v.c, y[d + 4] = v.d, y[d + 5] = v.tx, y[d + 6] = v.ty
  43146. }
  43147. return v
  43148. }, e.prototype.init = function(e, i) {
  43149. if (null === this._boneData) {
  43150. t.prototype.init.call(this, e, i);
  43151. var n = e.segmentX,
  43152. r = e.segmentY,
  43153. s = e.vertices.length;
  43154. this._dX = 400 / n, this._dY = 400 / r, this._k = -this._dY / this._dX, this._kX = -this._dY / 800, this._kY = -800 / this._dX, this._vertices.length = s, this._deformVertices.length = s, this._matrixCahce.length = 2 * (n * r + 2 * n + 2 * r) * 7, this._hullCache.length = 10;
  43155. for (var o = 0; o < s; ++o) this._deformVertices[o] = 0
  43156. }
  43157. }, e.prototype.update = function(t) {
  43158. if (this._blendState.dirty = !1, t >= 0 && null !== this._cachedFrameIndices) {
  43159. var i = this._cachedFrameIndices[t];
  43160. if (i >= 0 && this._cachedFrameIndex === i) this._transformDirty = !1;
  43161. else if (i >= 0) this._transformDirty = !0, this._cachedFrameIndex = i;
  43162. else {
  43163. if (this._hasConstraint)
  43164. for (var n = 0, r = this._armature._constraints; n < r.length; n++) {
  43165. (a = r[n])._root === this && a.update()
  43166. }
  43167. this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty ? (this._transformDirty = !0, this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, this._cachedFrameIndex = -1)
  43168. }
  43169. } else {
  43170. if (this._hasConstraint)
  43171. for (var s = 0, o = this._armature._constraints; s < o.length; s++) {
  43172. var a;
  43173. (a = o[s])._root === this && a.update()
  43174. }(this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && (t = -1, this._transformDirty = !0, this._cachedFrameIndex = -1)
  43175. }
  43176. if (this._transformDirty) {
  43177. this._transformDirty = !1, this._childrenTransformDirty = !0;
  43178. for (var l = 0, h = this._matrixCahce.length; l < h; l += 7) this._matrixCahce[l] = -1;
  43179. if (this._updateVertices(), this._cachedFrameIndex < 0) {
  43180. var c = t >= 0;
  43181. this._localDirty && this._updateGlobalTransformMatrix(c), c && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global))
  43182. } else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
  43183. var u = 2 * this.global.x,
  43184. _ = 2 * this.global.y,
  43185. f = e._helpPoint;
  43186. this.globalTransformMatrix.transformPoint(1e3, -200, f), this._hullCache[0] = f.x, this._hullCache[1] = f.y, this._hullCache[2] = u - f.x, this._hullCache[3] = _ - f.y, this.globalTransformMatrix.transformPoint(0, this._dY, f, !0), this._hullCache[4] = f.x, this._hullCache[5] = f.y, this.globalTransformMatrix.transformPoint(200, 1e3, f), this._hullCache[6] = f.x, this._hullCache[7] = f.y, this._hullCache[8] = u - f.x, this._hullCache[9] = _ - f.y, this.globalTransformMatrix.transformPoint(this._dX, 0, f, !0), this._hullCache[10] = f.x, this._hullCache[11] = f.y
  43187. } else this._childrenTransformDirty && (this._childrenTransformDirty = !1);
  43188. this._localDirty = !0
  43189. }, e
  43190. })(t.Bone);
  43191. t.Surface = e
  43192. })(r || (r = {})), (function(t) {
  43193. var e = (function(e) {
  43194. function i() {
  43195. var i = null !== e && e.apply(this, arguments) || this;
  43196. return i._localMatrix = new t.Matrix, i._colorTransform = new t.ColorTransform, i._displayDatas = [], i._displayList = [], i._deformVertices = null, i._rawDisplay = null, i._meshDisplay = null, i
  43197. }
  43198. return n(i, e), i.prototype._onClear = function() {
  43199. e.prototype._onClear.call(this);
  43200. for (var i = [], n = 0, r = this._displayList; n < r.length; n++) {
  43201. null !== (a = r[n]) && a !== this._rawDisplay && a !== this._meshDisplay && i.indexOf(a) < 0 && i.push(a)
  43202. }
  43203. for (var s = 0, o = i; s < o.length; s++) {
  43204. var a;
  43205. (a = o[s]) instanceof t.Armature ? a.dispose() : this._disposeDisplay(a, !0)
  43206. }
  43207. null !== this._deformVertices && this._deformVertices.returnToPool(), null !== this._meshDisplay && this._meshDisplay !== this._rawDisplay && this._disposeDisplay(this._meshDisplay, !1), null !== this._rawDisplay && this._disposeDisplay(this._rawDisplay, !1), this.displayController = null, this._displayDirty = !1, this._zOrderDirty = !1, this._blendModeDirty = !1, this._colorDirty = !1, this._transformDirty = !1, this._visible = !0, this._blendMode = 0, this._displayIndex = -1, this._animationDisplayIndex = -1, this._zOrder = 0, this._cachedFrameIndex = -1, this._pivotX = 0, this._pivotY = 0, this._localMatrix.identity(), this._colorTransform.identity(), this._displayList.length = 0, this._displayDatas.length = 0, this._slotData = null, this._rawDisplayDatas = null, this._displayData = null, this._boundingBoxData = null, this._textureData = null, this._deformVertices = null, this._rawDisplay = null, this._meshDisplay = null, this._display = null, this._childArmature = null, this._parent = null, this._cachedFrameIndices = null
  43208. }, i.prototype._getDefaultRawDisplayData = function(t) {
  43209. var e = this._armature._armatureData.defaultSkin;
  43210. if (null !== e) {
  43211. var i = e.getDisplays(this._slotData.name);
  43212. if (null !== i) return t < i.length ? i[t] : null
  43213. }
  43214. return null
  43215. }, i.prototype._updateDisplayData = function() {
  43216. var e = this._displayData,
  43217. n = null !== this._deformVertices ? this._deformVertices.verticesData : null,
  43218. r = this._textureData,
  43219. s = null,
  43220. o = null;
  43221. if (this._displayData = null, this._boundingBoxData = null, this._textureData = null, this._displayIndex >= 0 && (null !== this._rawDisplayDatas && (s = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null), null === s && (s = this._getDefaultRawDisplayData(this._displayIndex)), this._displayIndex < this._displayDatas.length && (this._displayData = this._displayDatas[this._displayIndex])), null !== this._displayData && (2 === this._displayData.type ? o = this._displayData.vertices : 4 === this._displayData.type ? o = this._displayData.vertices : null !== s && (2 === s.type ? o = s.vertices : 4 === s.type && (o = s.vertices)), 3 === this._displayData.type ? this._boundingBoxData = this._displayData.boundingBox : null !== s && 3 === s.type && (this._boundingBoxData = s.boundingBox), 0 === this._displayData.type ? this._textureData = this._displayData.texture : 2 === this._displayData.type && (this._textureData = this._displayData.texture)), this._displayData !== e || o !== n || this._textureData !== r) {
  43222. if (null === o && null !== this._textureData) {
  43223. var a = this._displayData,
  43224. l = this._textureData.parent.scale * this._armature._armatureData.scale,
  43225. h = this._textureData.frame;
  43226. this._pivotX = a.pivot.x, this._pivotY = a.pivot.y;
  43227. var c = null !== h ? h : this._textureData.region,
  43228. u = c.width,
  43229. _ = c.height;
  43230. this._textureData.rotated && null === h && (u = c.height, _ = c.width), this._pivotX *= u * l, this._pivotY *= _ * l, null !== h && (this._pivotX += h.x * l, this._pivotY += h.y * l), null !== this._displayData && null !== s && this._displayData !== s && (s.transform.toMatrix(i._helpMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(0, 0, i._helpPoint), this._pivotX -= i._helpPoint.x, this._pivotY -= i._helpPoint.y, this._displayData.transform.toMatrix(i._helpMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(0, 0, i._helpPoint), this._pivotX += i._helpPoint.x, this._pivotY += i._helpPoint.y), t.DragonBones.yDown || (this._pivotY = (this._textureData.rotated ? this._textureData.region.width : this._textureData.region.height) * l - this._pivotY)
  43231. } else this._pivotX = 0, this._pivotY = 0;
  43232. null !== s ? this.origin = s.transform : null !== this._displayData ? this.origin = this._displayData.transform : this.origin = null, o !== n ? (null === this._deformVertices && (this._deformVertices = t.BaseObject.borrowObject(t.DeformVertices)), this._deformVertices.init(o, this._armature)) : null !== this._deformVertices && this._textureData !== r && (this._deformVertices.verticesDirty = !0), this._displayDirty = !0, this._transformDirty = !0
  43233. }
  43234. }, i.prototype._updateDisplay = function() {
  43235. var e = null !== this._display ? this._display : this._rawDisplay,
  43236. i = this._childArmature;
  43237. this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? (this._display = this._displayList[this._displayIndex], null !== this._display && this._display instanceof t.Armature ? (this._childArmature = this._display, this._display = this._childArmature.display) : this._childArmature = null) : (this._display = null, this._childArmature = null);
  43238. var n = null !== this._display ? this._display : this._rawDisplay;
  43239. if (n !== e && (this._onUpdateDisplay(), this._replaceDisplay(e), this._transformDirty = !0, this._visibleDirty = !0, this._blendModeDirty = !0, this._colorDirty = !0), n !== this._rawDisplay && n !== this._meshDisplay || this._updateFrame(), this._childArmature !== i && (null !== i && (i._parent = null, i.clock = null, i.inheritAnimation && i.animation.reset()), null !== this._childArmature && (this._childArmature._parent = this, this._childArmature.clock = this._armature.clock, this._childArmature.inheritAnimation))) {
  43240. if (0 === this._childArmature.cacheFrameRate) {
  43241. var r = this._armature.cacheFrameRate;
  43242. 0 !== r && (this._childArmature.cacheFrameRate = r)
  43243. }
  43244. var s = null;
  43245. if (null !== this._displayData && 1 === this._displayData.type) s = this._displayData.actions;
  43246. else if (this._displayIndex >= 0 && null !== this._rawDisplayDatas) {
  43247. var o = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null;
  43248. null === o && (o = this._getDefaultRawDisplayData(this._displayIndex)), null !== o && 1 === o.type && (s = o.actions)
  43249. }
  43250. if (null !== s && s.length > 0)
  43251. for (var a = 0, l = s; a < l.length; a++) {
  43252. var h = l[a],
  43253. c = t.BaseObject.borrowObject(t.EventObject);
  43254. t.EventObject.actionDataToInstance(h, c, this._armature), c.slot = this, this._armature._bufferAction(c, !1)
  43255. } else this._childArmature.animation.play()
  43256. }
  43257. }, i.prototype._updateGlobalTransformMatrix = function(t) {
  43258. var e = 0 === this._parent._boneData.type ? this._parent.globalTransformMatrix : this._parent._getGlobalTransformMatrix(this.global.x, this.global.y);
  43259. this.globalTransformMatrix.copyFrom(this._localMatrix), this.globalTransformMatrix.concat(e), t ? this.global.fromMatrix(this.globalTransformMatrix) : this._globalDirty = !0
  43260. }, i.prototype._setDisplayIndex = function(t, e) {
  43261. if (void 0 === e && (e = !1), e) {
  43262. if (this._animationDisplayIndex === t) return !1;
  43263. this._animationDisplayIndex = t
  43264. }
  43265. return this._displayIndex !== t && (this._displayIndex = t, this._displayDirty = !0, this._updateDisplayData(), this._displayDirty)
  43266. }, i.prototype._setZorder = function(t) {
  43267. return this._zOrder, this._zOrder = t, this._zOrderDirty = !0, this._zOrderDirty
  43268. }, i.prototype._setColor = function(t) {
  43269. return this._colorTransform.copyFrom(t), this._colorDirty = !0, this._colorDirty
  43270. }, i.prototype._setDisplayList = function(e) {
  43271. if (null !== e && e.length > 0) {
  43272. this._displayList.length !== e.length && (this._displayList.length = e.length);
  43273. for (var i = 0, n = e.length; i < n; ++i) {
  43274. var r = e[i];
  43275. null !== r && r !== this._rawDisplay && r !== this._meshDisplay && !(r instanceof t.Armature) && this._displayList.indexOf(r) < 0 && this._initDisplay(r, !0), this._displayList[i] = r
  43276. }
  43277. } else this._displayList.length > 0 && (this._displayList.length = 0);
  43278. return this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? this._displayDirty = this._display !== this._displayList[this._displayIndex] : this._displayDirty = null !== this._display, this._updateDisplayData(), this._displayDirty
  43279. }, i.prototype.init = function(t, e, i, n) {
  43280. if (null === this._slotData) {
  43281. this._slotData = t, this._isFromCache = !1, this._visibleDirty = !0, this._blendModeDirty = !0, this._colorDirty = !0, this._blendMode = this._slotData.blendMode, this._zOrder = this._slotData.zOrder, this._colorTransform.copyFrom(this._slotData.color), this._rawDisplay = i, this._meshDisplay = n, this._armature = e;
  43282. var r = this._armature.getBone(this._slotData.parent.name);
  43283. null !== r && (this._parent = r), this._armature._addSlot(this), this._initDisplay(this._rawDisplay, !1), this._rawDisplay !== this._meshDisplay && this._initDisplay(this._meshDisplay, !1), this._onUpdateDisplay(), this._addDisplay()
  43284. }
  43285. }, i.prototype.update = function(t) {
  43286. if (this._isFromCache = !1, this._displayDirty && (this._displayDirty = !1, this._updateDisplay(), this._transformDirty && (null !== this.origin ? this.global.copyFrom(this.origin).add(this.offset).toMatrix(this._localMatrix) : this.global.copyFrom(this.offset).toMatrix(this._localMatrix))), this._zOrderDirty && (this._zOrderDirty = !1, this._updateZOrder()), t >= 0 && null !== this._cachedFrameIndices) {
  43287. var e = this._cachedFrameIndices[t];
  43288. e >= 0 && this._cachedFrameIndex === e ? this._transformDirty = !1 : e >= 0 ? (this._transformDirty = !0, this._cachedFrameIndex = e) : this._transformDirty || this._parent._childrenTransformDirty ? (this._transformDirty = !0, this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, this._cachedFrameIndex = -1)
  43289. } else(this._transformDirty || this._parent._childrenTransformDirty) && (t = -1, this._transformDirty = !0, this._cachedFrameIndex = -1);
  43290. if (null !== this._display) {
  43291. if (this._visibleDirty && (this._visibleDirty = !1, this._updateVisible()), this._blendModeDirty && (this._blendModeDirty = !1, this._updateBlendMode()), this._colorDirty && (this._colorDirty = !1, this._updateColor()), null !== this._deformVertices && null !== this._deformVertices.verticesData && this._display === this._meshDisplay) {
  43292. var i = null !== this._deformVertices.verticesData.weight,
  43293. n = 0 !== this._parent._boneData.type;
  43294. if ((this._deformVertices.verticesDirty || i && this._deformVertices.isBonesUpdate() || n && this._parent._childrenTransformDirty) && (this._deformVertices.verticesDirty = !1, this._updateMesh()), i || n) return
  43295. }
  43296. if (this._transformDirty) {
  43297. if (this._transformDirty = !1, this._cachedFrameIndex < 0) {
  43298. var r = t >= 0;
  43299. this._updateGlobalTransformMatrix(r), r && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global))
  43300. } else this._isFromCache = !0, this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
  43301. this._updateTransform()
  43302. }
  43303. }
  43304. }, i.prototype.updateTransformAndMatrix = function() {
  43305. this._transformDirty && (this._transformDirty = !1, this._updateGlobalTransformMatrix(!1))
  43306. }, i.prototype.replaceDisplayData = function(t, e) {
  43307. if (void 0 === e && (e = -1), e < 0 && (e = this._displayIndex < 0 ? 0 : this._displayIndex), this._displayDatas.length <= e) {
  43308. this._displayDatas.length = e + 1;
  43309. for (var i = 0, n = this._displayDatas.length; i < n; ++i) this._displayDatas[i] || (this._displayDatas[i] = null)
  43310. }
  43311. this._displayDatas[e] = t
  43312. }, i.prototype.containsPoint = function(t, e) {
  43313. return null !== this._boundingBoxData && (this.updateTransformAndMatrix(), i._helpMatrix.copyFrom(this.globalTransformMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(t, e, i._helpPoint), this._boundingBoxData.containsPoint(i._helpPoint.x, i._helpPoint.y))
  43314. }, i.prototype.intersectsSegment = function(t, e, n, r, s, o, a) {
  43315. if (void 0 === s && (s = null), void 0 === o && (o = null), void 0 === a && (a = null), null === this._boundingBoxData) return 0;
  43316. this.updateTransformAndMatrix(), i._helpMatrix.copyFrom(this.globalTransformMatrix), i._helpMatrix.invert(), i._helpMatrix.transformPoint(t, e, i._helpPoint), t = i._helpPoint.x, e = i._helpPoint.y, i._helpMatrix.transformPoint(n, r, i._helpPoint), n = i._helpPoint.x, r = i._helpPoint.y;
  43317. var l = this._boundingBoxData.intersectsSegment(t, e, n, r, s, o, a);
  43318. return l > 0 && (1 === l || 2 === l ? null !== s ? (this.globalTransformMatrix.transformPoint(s.x, s.y, s), null !== o && (o.x = s.x, o.y = s.y)) : null !== o && this.globalTransformMatrix.transformPoint(o.x, o.y, o) : (null !== s && this.globalTransformMatrix.transformPoint(s.x, s.y, s), null !== o && this.globalTransformMatrix.transformPoint(o.x, o.y, o)), null !== a && (this.globalTransformMatrix.transformPoint(Math.cos(a.x), Math.sin(a.x), i._helpPoint, !0), a.x = Math.atan2(i._helpPoint.y, i._helpPoint.x), this.globalTransformMatrix.transformPoint(Math.cos(a.y), Math.sin(a.y), i._helpPoint, !0), a.y = Math.atan2(i._helpPoint.y, i._helpPoint.x))), l
  43319. }, i.prototype.invalidUpdate = function() {
  43320. this._displayDirty = !0, this._transformDirty = !0
  43321. }, Object.defineProperty(i.prototype, "visible", {
  43322. get: function() {
  43323. return this._visible
  43324. },
  43325. set: function(t) {
  43326. this._visible !== t && (this._visible = t, this._updateVisible())
  43327. },
  43328. enumerable: !0,
  43329. configurable: !0
  43330. }), Object.defineProperty(i.prototype, "displayIndex", {
  43331. get: function() {
  43332. return this._displayIndex
  43333. },
  43334. set: function(t) {
  43335. this._setDisplayIndex(t) && this.update(-1)
  43336. },
  43337. enumerable: !0,
  43338. configurable: !0
  43339. }), Object.defineProperty(i.prototype, "name", {
  43340. get: function() {
  43341. return this._slotData.name
  43342. },
  43343. enumerable: !0,
  43344. configurable: !0
  43345. }), Object.defineProperty(i.prototype, "displayList", {
  43346. get: function() {
  43347. return this._displayList.concat()
  43348. },
  43349. set: function(e) {
  43350. var i = this._displayList.concat(),
  43351. n = new Array;
  43352. this._setDisplayList(e) && this.update(-1);
  43353. for (var r = 0, s = i; r < s.length; r++) {
  43354. null !== (l = s[r]) && l !== this._rawDisplay && l !== this._meshDisplay && this._displayList.indexOf(l) < 0 && n.indexOf(l) < 0 && n.push(l)
  43355. }
  43356. for (var o = 0, a = n; o < a.length; o++) {
  43357. var l;
  43358. (l = a[o]) instanceof t.Armature || this._disposeDisplay(l, !0)
  43359. }
  43360. },
  43361. enumerable: !0,
  43362. configurable: !0
  43363. }), Object.defineProperty(i.prototype, "slotData", {
  43364. get: function() {
  43365. return this._slotData
  43366. },
  43367. enumerable: !0,
  43368. configurable: !0
  43369. }), Object.defineProperty(i.prototype, "rawDisplayDatas", {
  43370. get: function() {
  43371. return this._rawDisplayDatas
  43372. },
  43373. set: function(t) {
  43374. if (this._rawDisplayDatas !== t)
  43375. if (this._displayDirty = !0, this._rawDisplayDatas = t, null !== this._rawDisplayDatas) {
  43376. this._displayDatas.length = this._rawDisplayDatas.length;
  43377. for (var e = 0, i = this._displayDatas.length; e < i; ++e) {
  43378. var n = this._rawDisplayDatas[e];
  43379. null === n && (n = this._getDefaultRawDisplayData(e)), this._displayDatas[e] = n
  43380. }
  43381. } else this._displayDatas.length = 0
  43382. },
  43383. enumerable: !0,
  43384. configurable: !0
  43385. }), Object.defineProperty(i.prototype, "displayData", {
  43386. get: function() {
  43387. return this._displayData
  43388. },
  43389. enumerable: !0,
  43390. configurable: !0
  43391. }), Object.defineProperty(i.prototype, "boundingBoxData", {
  43392. get: function() {
  43393. return this._boundingBoxData
  43394. },
  43395. enumerable: !0,
  43396. configurable: !0
  43397. }), Object.defineProperty(i.prototype, "rawDisplay", {
  43398. get: function() {
  43399. return this._rawDisplay
  43400. },
  43401. enumerable: !0,
  43402. configurable: !0
  43403. }), Object.defineProperty(i.prototype, "meshDisplay", {
  43404. get: function() {
  43405. return this._meshDisplay
  43406. },
  43407. enumerable: !0,
  43408. configurable: !0
  43409. }), Object.defineProperty(i.prototype, "display", {
  43410. get: function() {
  43411. return this._display
  43412. },
  43413. set: function(t) {
  43414. if (this._display !== t) {
  43415. var e = this._displayList.length;
  43416. if (this._displayIndex < 0 && 0 === e && (this._displayIndex = 0), !(this._displayIndex < 0)) {
  43417. var i = this.displayList;
  43418. e <= this._displayIndex && (i.length = this._displayIndex + 1), i[this._displayIndex] = t, this.displayList = i
  43419. }
  43420. }
  43421. },
  43422. enumerable: !0,
  43423. configurable: !0
  43424. }), Object.defineProperty(i.prototype, "childArmature", {
  43425. get: function() {
  43426. return this._childArmature
  43427. },
  43428. set: function(t) {
  43429. this._childArmature !== t && (this.display = t)
  43430. },
  43431. enumerable: !0,
  43432. configurable: !0
  43433. }), Object.defineProperty(i.prototype, "parent", {
  43434. get: function() {
  43435. return this._parent
  43436. },
  43437. enumerable: !0,
  43438. configurable: !0
  43439. }), i.prototype.getDisplay = function() {
  43440. return this._display
  43441. }, i.prototype.setDisplay = function(t) {
  43442. this.display = t
  43443. }, i
  43444. })(t.TransformObject);
  43445. t.Slot = e
  43446. })(r || (r = {})), (function(t) {
  43447. var e = (function(e) {
  43448. function i() {
  43449. return null !== e && e.apply(this, arguments) || this
  43450. }
  43451. return n(i, e), i.prototype._onClear = function() {
  43452. this._armature = null, this._target = null, this._root = null, this._bone = null
  43453. }, Object.defineProperty(i.prototype, "name", {
  43454. get: function() {
  43455. return this._constraintData.name
  43456. },
  43457. enumerable: !0,
  43458. configurable: !0
  43459. }), i._helpMatrix = new t.Matrix, i._helpTransform = new t.Transform, i._helpPoint = new t.Point, i
  43460. })(t.BaseObject);
  43461. t.Constraint = e;
  43462. var i = (function(e) {
  43463. function i() {
  43464. return null !== e && e.apply(this, arguments) || this
  43465. }
  43466. return n(i, e), i.toString = function() {
  43467. return "[class dragonBones.IKConstraint]"
  43468. }, i.prototype._onClear = function() {
  43469. e.prototype._onClear.call(this), this._scaleEnabled = !1, this._bendPositive = !1, this._weight = 1, this._constraintData = null
  43470. }, i.prototype._computeA = function() {
  43471. var e = this._target.global,
  43472. i = this._root.global,
  43473. n = this._root.globalTransformMatrix,
  43474. r = Math.atan2(e.y - i.y, e.x - i.x);
  43475. i.scaleX < 0 && (r += Math.PI), i.rotation += t.Transform.normalizeRadian(r - i.rotation) * this._weight, i.toMatrix(n)
  43476. }, i.prototype._computeB = function() {
  43477. var e = this._bone._boneData.length,
  43478. i = this._root,
  43479. n = this._target.global,
  43480. r = i.global,
  43481. s = this._bone.global,
  43482. o = this._bone.globalTransformMatrix,
  43483. a = o.a * e,
  43484. l = o.b * e,
  43485. h = a * a + l * l,
  43486. c = Math.sqrt(h),
  43487. u = s.x - r.x,
  43488. _ = s.y - r.y,
  43489. f = u * u + _ * _,
  43490. d = Math.sqrt(f),
  43491. p = s.rotation,
  43492. m = r.rotation,
  43493. y = Math.atan2(_, u),
  43494. v = (u = n.x - r.x) * u + (_ = n.y - r.y) * _,
  43495. g = Math.sqrt(v),
  43496. x = 0;
  43497. if (c + d <= g || g + c <= d || g + d <= c) x = Math.atan2(n.y - r.y, n.x - r.x), c + d <= g || d < c && (x += Math.PI);
  43498. else {
  43499. var b = (f - h + v) / (2 * v),
  43500. A = Math.sqrt(f - b * b * v) / g,
  43501. C = r.x + u * b,
  43502. T = r.y + _ * b,
  43503. S = -_ * A,
  43504. w = u * A,
  43505. E = !1,
  43506. M = i.parent;
  43507. if (null !== M) {
  43508. var D = M.globalTransformMatrix;
  43509. E = D.a * D.d - D.b * D.c < 0
  43510. }
  43511. E !== this._bendPositive ? (s.x = C - S, s.y = T - w) : (s.x = C + S, s.y = T + w), x = Math.atan2(s.y - r.y, s.x - r.x)
  43512. }
  43513. var B = t.Transform.normalizeRadian(x - y);
  43514. r.rotation = m + B * this._weight, r.toMatrix(i.globalTransformMatrix);
  43515. var I = y + B * this._weight;
  43516. s.x = r.x + Math.cos(I) * d, s.y = r.y + Math.sin(I) * d;
  43517. var P = Math.atan2(n.y - s.y, n.x - s.x);
  43518. s.scaleX < 0 && (P += Math.PI), s.rotation = r.rotation + p - m + t.Transform.normalizeRadian(P - B - p) * this._weight, s.toMatrix(o)
  43519. }, i.prototype.init = function(t, e) {
  43520. if (null === this._constraintData) {
  43521. this._constraintData = t, this._armature = e, this._target = this._armature.getBone(this._constraintData.target.name), this._root = this._armature.getBone(this._constraintData.root.name), this._bone = null !== this._constraintData.bone ? this._armature.getBone(this._constraintData.bone.name) : null;
  43522. var i = this._constraintData;
  43523. this._scaleEnabled = i.scaleEnabled, this._bendPositive = i.bendPositive, this._weight = i.weight, this._root._hasConstraint = !0
  43524. }
  43525. }, i.prototype.update = function() {
  43526. this._root.updateByConstraint(), null !== this._bone ? (this._bone.updateByConstraint(), this._computeB()) : this._computeA()
  43527. }, i.prototype.invalidUpdate = function() {
  43528. this._root.invalidUpdate(), null !== this._bone && this._bone.invalidUpdate()
  43529. }, i
  43530. })(e);
  43531. t.IKConstraint = i;
  43532. var r = (function(e) {
  43533. function i() {
  43534. var t = null !== e && e.apply(this, arguments) || this;
  43535. return t._bones = [], t._spaces = [], t._positions = [], t._curves = [], t._boneLengths = [], t._pathGlobalVertices = [], t._segments = [10], t
  43536. }
  43537. return n(i, e), i.toString = function() {
  43538. return "[class dragonBones.PathConstraint]"
  43539. }, i.prototype._onClear = function() {
  43540. e.prototype._onClear.call(this), this.dirty = !1, this.pathOffset = 0, this.position = 0, this.spacing = 0, this.rotateOffset = 0, this.rotateMix = 1, this.translateMix = 1, this._pathSlot = null, this._bones.length = 0, this._spaces.length = 0, this._positions.length = 0, this._curves.length = 0, this._boneLengths.length = 0, this._pathGlobalVertices.length = 0
  43541. }, i.prototype._updatePathVertices = function(t) {
  43542. var e = this._armature,
  43543. i = e.armatureData.parent,
  43544. n = e.armatureData.scale,
  43545. r = i.intArray,
  43546. s = i.floatArray,
  43547. o = t.offset,
  43548. a = r[o + 0],
  43549. l = r[o + 2];
  43550. this._pathGlobalVertices.length = 2 * a;
  43551. var h = t.weight;
  43552. if (null !== h)
  43553. for (var c = this._pathSlot._deformVertices.bones, u = h.bones.length, _ = h.offset, f = r[_ + 1], d = _ + 2 + u, p = (T = 0, 0); T < a; T++) {
  43554. for (var m = 0, y = 0, v = 0, g = r[d++]; v < g; v++) {
  43555. var x = c[r[d++]];
  43556. if (null !== x) {
  43557. x.updateByConstraint();
  43558. C = x.globalTransformMatrix;
  43559. var b = s[f++];
  43560. w = s[f++] * n, E = s[f++] * n;
  43561. m += (C.a * w + C.c * E + C.tx) * b, y += (C.b * w + C.d * E + C.ty) * b
  43562. }
  43563. }
  43564. this._pathGlobalVertices[p++] = m, this._pathGlobalVertices[p++] = y
  43565. } else {
  43566. var A = this._pathSlot.parent;
  43567. A.updateByConstraint();
  43568. for (var C = A.globalTransformMatrix, T = 0, S = l; T < a; T += 2) {
  43569. var w = s[S++] * n,
  43570. E = s[S++] * n,
  43571. M = C.a * w + C.c * E + C.tx,
  43572. D = C.b * w + C.d * E + C.ty;
  43573. this._pathGlobalVertices[T] = M, this._pathGlobalVertices[T + 1] = D
  43574. }
  43575. }
  43576. }, i.prototype._computeVertices = function(t, e, i, n) {
  43577. for (var r = i, s = t; r < e; r += 2) n[r] = this._pathGlobalVertices[s++], n[r + 1] = this._pathGlobalVertices[s++]
  43578. }, i.prototype._computeBezierCurve = function(t, e, i, n, r) {
  43579. var s = this._armature.armatureData.parent.intArray[t.vertices.offset + 0],
  43580. o = this._positions,
  43581. a = this._spaces,
  43582. l = t.closed,
  43583. h = Array(),
  43584. c = 2 * s,
  43585. u = c / 6,
  43586. _ = -1,
  43587. f = this.position;
  43588. o.length = 3 * e + 2;
  43589. var d = 0;
  43590. if (t.constantSpeed) {
  43591. l ? (c += 2, h.length = s, this._computeVertices(2, c - 4, 0, h), this._computeVertices(0, 2, c - 4, h), h[c - 2] = h[0], h[c - 1] = h[1]) : (u--, c -= 4, h.length = c, this._computeVertices(2, c, 0, h));
  43592. var p = new Array(u);
  43593. d = 0;
  43594. for (var m, y, v, g, x, b, A, C, T = h[0], S = h[1], w = 0, E = 0, M = 0, D = 0, B = 0, I = 0, P = (z = 0, 2); z < u; z++, P += 6) w = h[P], E = h[P + 1], M = h[P + 2], D = h[P + 3], B = h[P + 4], I = h[P + 5], x = 2 * (m = .1875 * (T - 2 * w + M)) + (v = .09375 * (3 * (w - M) - T + B)), b = 2 * (y = .1875 * (S - 2 * E + D)) + (g = .09375 * (3 * (E - D) - S + I)), A = .75 * (w - T) + m + .16666667 * v, C = .75 * (E - S) + y + .16666667 * g, d += Math.sqrt(A * A + C * C), A += x, C += b, x += v, b += g, d += Math.sqrt(A * A + C * C), A += x, C += b, d += Math.sqrt(A * A + C * C), A += x + v, C += b + g, d += Math.sqrt(A * A + C * C), p[z] = d, T = B, S = I;
  43595. if (n && (f *= d), r)
  43596. for (z = 0; z < e; z++) a[z] *= d;
  43597. for (var R = this._segments, O = 0, L = (z = 0, j = 0, W = 0, 0); z < e; z++, j += 3) {
  43598. var F = f += a[z];
  43599. if (l)(F %= d) < 0 && (F += d), W = 0;
  43600. else {
  43601. if (F < 0) continue;
  43602. if (F > d) continue
  43603. }
  43604. for (;; W++) {
  43605. var N = p[W];
  43606. if (!(F > N)) {
  43607. if (0 === W) F /= N;
  43608. else F = (F - (G = p[W - 1])) / (N - G);
  43609. break
  43610. }
  43611. }
  43612. if (W !== _) {
  43613. _ = W;
  43614. var V = 6 * W;
  43615. for (T = h[V], S = h[V + 1], w = h[V + 2], E = h[V + 3], M = h[V + 4], D = h[V + 5], B = h[V + 6], I = h[V + 7], x = 2 * (m = .03 * (T - 2 * w + M)) + (v = .006 * (3 * (w - M) - T + B)), b = 2 * (y = .03 * (S - 2 * E + D)) + (g = .006 * (3 * (E - D) - S + I)), A = .3 * (w - T) + m + .16666667 * v, C = .3 * (E - S) + y + .16666667 * g, O = Math.sqrt(A * A + C * C), R[0] = O, V = 1; V < 8; V++) A += x, C += b, x += v, b += g, O += Math.sqrt(A * A + C * C), R[V] = O;
  43616. A += x, C += b, O += Math.sqrt(A * A + C * C), R[8] = O, A += x + v, C += b + g, O += Math.sqrt(A * A + C * C), R[9] = O, L = 0
  43617. }
  43618. for (F *= O;; L++) {
  43619. var k = R[L];
  43620. if (!(F > k)) {
  43621. var G;
  43622. if (0 === L) F /= k;
  43623. else F = L + (F - (G = R[L - 1])) / (k - G);
  43624. break
  43625. }
  43626. }
  43627. this.addCurvePosition(.1 * F, T, S, w, E, M, D, B, I, o, j, i)
  43628. }
  43629. } else {
  43630. var U = t.curveLengths;
  43631. if (d = U[u -= l ? 1 : 2], n && (f *= d), r)
  43632. for (var z = 0; z < e; z++) a[z] *= d;
  43633. h.length = 8;
  43634. for (var z = 0, j = 0, W = 0; z < e; z++, j += 3) {
  43635. if (f += a[z], l)(f %= d) < 0 && (f += d), W = 0;
  43636. else {
  43637. if (f < 0) continue;
  43638. if (f > d) continue
  43639. }
  43640. for (var H = 0;; W++) {
  43641. var X = U[W];
  43642. if (!(f > X)) {
  43643. if (0 === W) H = f / X;
  43644. else {
  43645. var Y = U[W - 1];
  43646. H = (f - Y) / (X - Y)
  43647. }
  43648. break
  43649. }
  43650. }
  43651. W !== _ && (_ = W, l && W === u ? (this._computeVertices(c - 4, 4, 0, h), this._computeVertices(0, 4, 4, h)) : this._computeVertices(6 * W + 2, 8, 0, h)), this.addCurvePosition(H, h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7], o, j, i)
  43652. }
  43653. }
  43654. }, i.prototype.addCurvePosition = function(t, e, i, n, r, s, o, a, l, h, c, u) {
  43655. if (0 === t) return h[c] = e, h[c + 1] = i, void(h[c + 2] = 0);
  43656. if (1 === t) return h[c] = a, h[c + 1] = l, void(h[c + 2] = 0);
  43657. var _ = 1 - t,
  43658. f = _ * _,
  43659. d = t * t,
  43660. p = f * _,
  43661. m = f * t * 3,
  43662. y = _ * d * 3,
  43663. v = t * d,
  43664. g = p * e + m * n + y * s + v * a,
  43665. x = p * i + m * r + y * o + v * l;
  43666. h[c] = g, h[c + 1] = x, h[c + 2] = u ? Math.atan2(x - (p * i + m * r + y * o), g - (p * e + m * n + y * s)) : 0
  43667. }, i.prototype.init = function(t, e) {
  43668. this._constraintData = t, this._armature = e;
  43669. var i = t;
  43670. this.pathOffset = i.pathDisplayData.vertices.offset, this.position = i.position, this.spacing = i.spacing, this.rotateOffset = i.rotateOffset, this.rotateMix = i.rotateMix, this.translateMix = i.translateMix, this._root = this._armature.getBone(i.root.name), this._target = this._armature.getBone(i.target.name), this._pathSlot = this._armature.getSlot(i.pathSlot.name);
  43671. for (var n = 0, r = i.bones.length; n < r; n++) {
  43672. var s = this._armature.getBone(i.bones[n].name);
  43673. null !== s && this._bones.push(s)
  43674. }
  43675. 2 === i.rotateMode && (this._boneLengths.length = this._bones.length), this._root._hasConstraint = !0
  43676. }, i.prototype.update = function() {
  43677. var e = this._pathSlot;
  43678. if (null !== e._deformVertices && null !== e._deformVertices.verticesData && e._deformVertices.verticesData.offset === this.pathOffset) {
  43679. var i = this._constraintData,
  43680. n = e._displayData,
  43681. r = !1,
  43682. s = e._deformVertices;
  43683. if (this._root._childrenTransformDirty ? (this._updatePathVertices(n.vertices), r = !0) : null !== s && (s.verticesDirty || s.isBonesUpdate()) && (this._updatePathVertices(n.vertices), s.verticesDirty = !1, r = !0), r || this.dirty) {
  43684. var o = i.positionMode,
  43685. a = i.spacingMode,
  43686. l = i.rotateMode,
  43687. h = this._bones,
  43688. c = 0 === a,
  43689. u = 2 === l,
  43690. _ = 0 === l,
  43691. f = h.length,
  43692. d = _ ? f : f + 1,
  43693. p = this.spacing,
  43694. m = this._spaces;
  43695. if (m.length = d, u || c) {
  43696. m[0] = 0;
  43697. for (var y = 0, v = d - 1; y < v; y++) {
  43698. (I = h[y]).updateByConstraint();
  43699. var g = I._boneData.length,
  43700. x = g * (P = I.globalTransformMatrix).a,
  43701. b = g * P.b,
  43702. A = Math.sqrt(x * x + b * b);
  43703. u && (this._boneLengths[y] = A), m[y + 1] = (g + p) * A / g
  43704. }
  43705. } else
  43706. for (y = 0; y < d; y++) m[y] = p;
  43707. this._computeBezierCurve(n, d, _, 1 === o, 2 === a);
  43708. var C, T = this._positions,
  43709. S = this.rotateOffset,
  43710. w = T[0],
  43711. E = T[1];
  43712. if (0 === S) C = 1 === l;
  43713. else if (C = !1, null !== (I = e.parent)) S *= (P = I.globalTransformMatrix).a * P.d - P.b * P.c > 0 ? t.Transform.DEG_RAD : -t.Transform.DEG_RAD;
  43714. for (var M = this.rotateMix, D = this.translateMix, B = (y = 0, 3); y < f; y++, B += 3) {
  43715. var I, P;
  43716. (I = h[y]).updateByConstraint(), (P = I.globalTransformMatrix).tx += (w - P.tx) * D, P.ty += (E - P.ty) * D;
  43717. var R = (x = T[B]) - w,
  43718. O = (b = T[B + 1]) - E;
  43719. if (u) {
  43720. var L = this._boneLengths[y],
  43721. F = (Math.sqrt(R * R + O * O) / L - 1) * M + 1;
  43722. P.a *= F, P.b *= F
  43723. }
  43724. if (w = x, E = b, M > 0) {
  43725. var N = P.a,
  43726. V = P.b,
  43727. k = P.c,
  43728. G = P.d,
  43729. U = void 0,
  43730. z = void 0,
  43731. j = void 0;
  43732. if (U = _ ? T[B - 1] : Math.atan2(O, R), U -= Math.atan2(V, N), C) {
  43733. z = Math.cos(U), j = Math.sin(U);
  43734. var W = I._boneData.length;
  43735. w += (W * (z * N - j * V) - R) * M, E += (W * (j * N + z * V) - O) * M
  43736. } else U += S;
  43737. U > t.Transform.PI ? U -= t.Transform.PI_D : U < -t.Transform.PI && (U += t.Transform.PI_D), U *= M, z = Math.cos(U), j = Math.sin(U), P.a = z * N - j * V, P.b = j * N + z * V, P.c = z * k - j * G, P.d = j * k + z * G
  43738. }
  43739. I.global.fromMatrix(P)
  43740. }
  43741. this.dirty = !1
  43742. }
  43743. }
  43744. }, i.prototype.invalidUpdate = function() {}, i
  43745. })(e);
  43746. t.PathConstraint = r
  43747. })(r || (r = {})), (function(t) {
  43748. var e = (function() {
  43749. function t(t) {
  43750. void 0 === t && (t = 0), this.time = 0, this.timeScale = 1, this._systemTime = 0, this._animatebles = [], this._clock = null, this.time = t, this._systemTime = .001 * (new Date).getTime()
  43751. }
  43752. return t.prototype.advanceTime = function(t) {
  43753. t != t && (t = 0);
  43754. var e = .001 * Date.now();
  43755. if (t < 0 && (t = e - this._systemTime), this._systemTime = e, 1 !== this.timeScale && (t *= this.timeScale), 0 !== t) {
  43756. t < 0 ? this.time -= t : this.time += t;
  43757. for (var i = 0, n = 0, r = this._animatebles.length; i < r; ++i) {
  43758. var s = this._animatebles[i];
  43759. null !== s ? (n > 0 && (this._animatebles[i - n] = s, this._animatebles[i] = null), s.advanceTime(t)) : n++
  43760. }
  43761. if (n > 0) {
  43762. for (r = this._animatebles.length; i < r; ++i) {
  43763. var o = this._animatebles[i];
  43764. null !== o ? this._animatebles[i - n] = o : n++
  43765. }
  43766. this._animatebles.length -= n
  43767. }
  43768. }
  43769. }, t.prototype.contains = function(t) {
  43770. if (t === this) return !1;
  43771. for (var e = t; e !== this && null !== e;) e = e.clock;
  43772. return e === this
  43773. }, t.prototype.add = function(t) {
  43774. this._animatebles.indexOf(t) < 0 && (this._animatebles.push(t), t.clock = this)
  43775. }, t.prototype.remove = function(t) {
  43776. var e = this._animatebles.indexOf(t);
  43777. e >= 0 && (this._animatebles[e] = null, t.clock = null)
  43778. }, t.prototype.clear = function() {
  43779. for (var t = 0, e = this._animatebles; t < e.length; t++) {
  43780. var i = e[t];
  43781. null !== i && (i.clock = null)
  43782. }
  43783. }, Object.defineProperty(t.prototype, "clock", {
  43784. get: function() {
  43785. return this._clock
  43786. },
  43787. set: function(t) {
  43788. this._clock !== t && (null !== this._clock && this._clock.remove(this), this._clock = t, null !== this._clock && this._clock.add(this))
  43789. },
  43790. enumerable: !0,
  43791. configurable: !0
  43792. }), t.clock = new t, t
  43793. })();
  43794. t.WorldClock = e
  43795. })(r || (r = {})), (function(t) {
  43796. var e = (function(e) {
  43797. function i() {
  43798. var t = null !== e && e.apply(this, arguments) || this;
  43799. return t._animationNames = [], t._animationStates = [], t._animations = {}, t._animationConfig = null, t
  43800. }
  43801. return n(i, e), i.toString = function() {
  43802. return "[class dragonBones.Animation]"
  43803. }, i.prototype._onClear = function() {
  43804. for (var t = 0, e = this._animationStates; t < e.length; t++) {
  43805. e[t].returnToPool()
  43806. }
  43807. for (var i in this._animations) delete this._animations[i];
  43808. null !== this._animationConfig && this._animationConfig.returnToPool(), this.timeScale = 1, this._lockUpdate = !1, this._animationDirty = !1, this._inheritTimeScale = 1, this._animationNames.length = 0, this._animationStates.length = 0, this._armature = null, this._animationConfig = null, this._lastAnimationState = null
  43809. }, i.prototype._fadeOut = function(t) {
  43810. switch (t.fadeOutMode) {
  43811. case 1:
  43812. for (var e = 0, i = this._animationStates; e < i.length; e++) {
  43813. null === (h = i[e])._parent && (h.layer === t.layer && h.fadeOut(t.fadeOutTime, t.pauseFadeOut))
  43814. }
  43815. break;
  43816. case 2:
  43817. for (var n = 0, r = this._animationStates; n < r.length; n++) {
  43818. null === (h = r[n])._parent && (h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut))
  43819. }
  43820. break;
  43821. case 3:
  43822. for (var s = 0, o = this._animationStates; s < o.length; s++) {
  43823. null === (h = o[s])._parent && (h.layer === t.layer && h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut))
  43824. }
  43825. break;
  43826. case 4:
  43827. for (var a = 0, l = this._animationStates; a < l.length; a++) {
  43828. var h;
  43829. null === (h = l[a])._parent && h.fadeOut(t.fadeOutTime, t.pauseFadeOut)
  43830. }
  43831. }
  43832. }, i.prototype.init = function(e) {
  43833. null === this._armature && (this._armature = e, this._animationConfig = t.BaseObject.borrowObject(t.AnimationConfig))
  43834. }, i.prototype.advanceTime = function(t) {
  43835. t < 0 && (t = -t), this._armature.inheritAnimation && null !== this._armature._parent ? this._inheritTimeScale = this._armature._parent._armature.animation._inheritTimeScale * this.timeScale : this._inheritTimeScale = this.timeScale, 1 !== this._inheritTimeScale && (t *= this._inheritTimeScale);
  43836. var e = this._animationStates.length;
  43837. if (1 === e)
  43838. if ((d = this._animationStates[0])._fadeState > 0 && d._subFadeState > 0) this._armature._dragonBones.bufferObject(d), this._animationStates.length = 0, this._lastAnimationState = null;
  43839. else {
  43840. var i = d._animationData,
  43841. n = i.cacheFrameRate;
  43842. if (this._animationDirty && n > 0) {
  43843. this._animationDirty = !1;
  43844. for (var r = 0, s = this._armature.getBones(); r < s.length; r++) {
  43845. var o = s[r];
  43846. o._cachedFrameIndices = i.getBoneCachedFrameIndices(o.name)
  43847. }
  43848. for (var a = 0, l = this._armature.getSlots(); a < l.length; a++) {
  43849. var h = l[a],
  43850. c = h.rawDisplayDatas;
  43851. if (null !== c && c.length > 0) {
  43852. var u = c[0];
  43853. if (null !== u && u.parent === this._armature.armatureData.defaultSkin) {
  43854. h._cachedFrameIndices = i.getSlotCachedFrameIndices(h.name);
  43855. continue
  43856. }
  43857. }
  43858. h._cachedFrameIndices = null
  43859. }
  43860. }
  43861. d.advanceTime(t, n)
  43862. }
  43863. else if (e > 1) {
  43864. for (var _ = 0, f = 0; _ < e; ++_) {
  43865. var d;
  43866. (d = this._animationStates[_])._fadeState > 0 && d._subFadeState > 0 ? (f++, this._armature._dragonBones.bufferObject(d), this._animationDirty = !0, this._lastAnimationState === d && (this._lastAnimationState = null)) : (f > 0 && (this._animationStates[_ - f] = d), d.advanceTime(t, 0)), _ === e - 1 && f > 0 && (this._animationStates.length -= f, null === this._lastAnimationState && this._animationStates.length > 0 && (this._lastAnimationState = this._animationStates[this._animationStates.length - 1]))
  43867. }
  43868. this._armature._cacheFrameIndex = -1
  43869. } else this._armature._cacheFrameIndex = -1
  43870. }, i.prototype.reset = function() {
  43871. for (var t = 0, e = this._animationStates; t < e.length; t++) {
  43872. e[t].returnToPool()
  43873. }
  43874. this._animationDirty = !1, this._animationConfig.clear(), this._animationStates.length = 0, this._lastAnimationState = null
  43875. }, i.prototype.stop = function(t) {
  43876. if (void 0 === t && (t = null), null !== t) null !== (n = this.getState(t)) && n.stop();
  43877. else
  43878. for (var e = 0, i = this._animationStates; e < i.length; e++) {
  43879. var n;
  43880. (n = i[e]).stop()
  43881. }
  43882. }, i.prototype.playConfig = function(e) {
  43883. var i = e.animation;
  43884. if (!(i in this._animations)) return console.warn("Non-existent animation.\n", "DragonBones name: " + this._armature.armatureData.parent.name, "Armature name: " + this._armature.name, "Animation name: " + i), null;
  43885. var n = this._animations[i];
  43886. if (5 === e.fadeOutMode)
  43887. for (var r = 0, s = this._animationStates; r < s.length; r++) {
  43888. var o = s[r];
  43889. if (o._animationData === n) return o
  43890. }
  43891. 0 === this._animationStates.length ? e.fadeInTime = 0 : e.fadeInTime < 0 && (e.fadeInTime = n.fadeInTime), e.fadeOutTime < 0 && (e.fadeOutTime = e.fadeInTime), e.timeScale <= -100 && (e.timeScale = 1 / n.scale), n.frameCount > 1 ? (e.position < 0 ? (e.position %= n.duration, e.position = n.duration - e.position) : e.position === n.duration ? e.position -= 1e-6 : e.position > n.duration && (e.position %= n.duration), e.duration > 0 && e.position + e.duration > n.duration && (e.duration = n.duration - e.position), e.playTimes < 0 && (e.playTimes = n.playTimes)) : (e.playTimes = 1, e.position = 0, e.duration > 0 && (e.duration = 0)), 0 === e.duration && (e.duration = -1), this._fadeOut(e);
  43892. var a = t.BaseObject.borrowObject(t.AnimationState);
  43893. if (a.init(this._armature, n, e), this._animationDirty = !0, this._armature._cacheFrameIndex = -1, this._animationStates.length > 0) {
  43894. for (var l = !1, h = 0, c = this._animationStates.length; h < c; ++h) {
  43895. if (a.layer > this._animationStates[h].layer) {
  43896. l = !0, this._animationStates.splice(h, 0, a);
  43897. break
  43898. }
  43899. if (h !== c - 1 && a.layer > this._animationStates[h + 1].layer) {
  43900. l = !0, this._animationStates.splice(h + 1, 0, a);
  43901. break
  43902. }
  43903. }
  43904. l || this._animationStates.push(a)
  43905. } else this._animationStates.push(a);
  43906. for (var u = 0, _ = this._armature.getSlots(); u < _.length; u++) {
  43907. var f = _[u].childArmature;
  43908. null !== f && f.inheritAnimation && f.animation.hasAnimation(i) && null === f.animation.getState(i) && f.animation.fadeIn(i)
  43909. }
  43910. var d = !1;
  43911. for (var p in n.animationTimelines) {
  43912. this._lockUpdate || (d = !0, this._lockUpdate = !0);
  43913. var m = this.fadeIn(p, e.fadeInTime, 1, a.layer, null, 0);
  43914. null !== m && (m.resetToPose = !1, m._parent = a, m.stop())
  43915. }
  43916. return d && (this._lockUpdate = !1), this._lockUpdate || (e.fadeInTime <= 0 && this._armature.advanceTime(0), this._lastAnimationState = a), a
  43917. }, i.prototype.play = function(t, e) {
  43918. if (void 0 === t && (t = null), void 0 === e && (e = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = e, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = null !== t ? t : "", null !== t && t.length > 0) this.playConfig(this._animationConfig);
  43919. else if (null === this._lastAnimationState) {
  43920. var i = this._armature.armatureData.defaultAnimation;
  43921. null !== i && (this._animationConfig.animation = i.name, this.playConfig(this._animationConfig))
  43922. } else this._lastAnimationState.isPlaying || this._lastAnimationState.isCompleted ? (this._animationConfig.animation = this._lastAnimationState.name, this.playConfig(this._animationConfig)) : this._lastAnimationState.play();
  43923. return this._lastAnimationState
  43924. }, i.prototype.fadeIn = function(t, e, i, n, r, s) {
  43925. return void 0 === e && (e = -1), void 0 === i && (i = -1), void 0 === n && (n = 0), void 0 === r && (r = null), void 0 === s && (s = 3), this._animationConfig.clear(), this._animationConfig.fadeOutMode = s, this._animationConfig.playTimes = i, this._animationConfig.layer = n, this._animationConfig.fadeInTime = e, this._animationConfig.animation = t, this._animationConfig.group = null !== r ? r : "", this.playConfig(this._animationConfig)
  43926. }, i.prototype.gotoAndPlayByTime = function(t, e, i) {
  43927. return void 0 === e && (e = 0), void 0 === i && (i = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = i, this._animationConfig.position = e, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = t, this.playConfig(this._animationConfig)
  43928. }, i.prototype.gotoAndPlayByFrame = function(t, e, i) {
  43929. void 0 === e && (e = 0), void 0 === i && (i = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = i, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = t;
  43930. var n = t in this._animations ? this._animations[t] : null;
  43931. return null !== n && (this._animationConfig.position = n.duration * e / n.frameCount), this.playConfig(this._animationConfig)
  43932. }, i.prototype.gotoAndPlayByProgress = function(t, e, i) {
  43933. void 0 === e && (e = 0), void 0 === i && (i = -1), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.playTimes = i, this._animationConfig.fadeInTime = 0, this._animationConfig.animation = t;
  43934. var n = t in this._animations ? this._animations[t] : null;
  43935. return null !== n && (this._animationConfig.position = n.duration * (e > 0 ? e : 0)), this.playConfig(this._animationConfig)
  43936. }, i.prototype.gotoAndStopByTime = function(t, e) {
  43937. void 0 === e && (e = 0);
  43938. var i = this.gotoAndPlayByTime(t, e, 1);
  43939. return null !== i && i.stop(), i
  43940. }, i.prototype.gotoAndStopByFrame = function(t, e) {
  43941. void 0 === e && (e = 0);
  43942. var i = this.gotoAndPlayByFrame(t, e, 1);
  43943. return null !== i && i.stop(), i
  43944. }, i.prototype.gotoAndStopByProgress = function(t, e) {
  43945. void 0 === e && (e = 0);
  43946. var i = this.gotoAndPlayByProgress(t, e, 1);
  43947. return null !== i && i.stop(), i
  43948. }, i.prototype.getState = function(t) {
  43949. for (var e = this._animationStates.length; e--;) {
  43950. var i = this._animationStates[e];
  43951. if (i.name === t) return i
  43952. }
  43953. return null
  43954. }, i.prototype.hasAnimation = function(t) {
  43955. return t in this._animations
  43956. }, i.prototype.getStates = function() {
  43957. return this._animationStates
  43958. }, Object.defineProperty(i.prototype, "isPlaying", {
  43959. get: function() {
  43960. for (var t = 0, e = this._animationStates; t < e.length; t++) {
  43961. if (e[t].isPlaying) return !0
  43962. }
  43963. return !1
  43964. },
  43965. enumerable: !0,
  43966. configurable: !0
  43967. }), Object.defineProperty(i.prototype, "isCompleted", {
  43968. get: function() {
  43969. for (var t = 0, e = this._animationStates; t < e.length; t++) {
  43970. if (!e[t].isCompleted) return !1
  43971. }
  43972. return this._animationStates.length > 0
  43973. },
  43974. enumerable: !0,
  43975. configurable: !0
  43976. }), Object.defineProperty(i.prototype, "lastAnimationName", {
  43977. get: function() {
  43978. return null !== this._lastAnimationState ? this._lastAnimationState.name : ""
  43979. },
  43980. enumerable: !0,
  43981. configurable: !0
  43982. }), Object.defineProperty(i.prototype, "animationNames", {
  43983. get: function() {
  43984. return this._animationNames
  43985. },
  43986. enumerable: !0,
  43987. configurable: !0
  43988. }), Object.defineProperty(i.prototype, "animations", {
  43989. get: function() {
  43990. return this._animations
  43991. },
  43992. set: function(t) {
  43993. if (this._animations !== t) {
  43994. for (var e in this._animationNames.length = 0, this._animations) delete this._animations[e];
  43995. for (var e in t) this._animationNames.push(e), this._animations[e] = t[e]
  43996. }
  43997. },
  43998. enumerable: !0,
  43999. configurable: !0
  44000. }), Object.defineProperty(i.prototype, "animationConfig", {
  44001. get: function() {
  44002. return this._animationConfig.clear(), this._animationConfig
  44003. },
  44004. enumerable: !0,
  44005. configurable: !0
  44006. }), Object.defineProperty(i.prototype, "lastAnimationState", {
  44007. get: function() {
  44008. return this._lastAnimationState
  44009. },
  44010. enumerable: !0,
  44011. configurable: !0
  44012. }), i.prototype.gotoAndPlay = function(t, e, i, n, r, s, o, a, l) {
  44013. void 0 === e && (e = -1), void 0 === i && (i = -1), void 0 === n && (n = -1), void 0 === r && (r = 0), void 0 === s && (s = null), void 0 === o && (o = 3), void 0 === a && (a = !0), void 0 === l && (l = !0), console.warn("Deprecated."), this._animationConfig.clear(), this._animationConfig.resetToPose = !0, this._animationConfig.fadeOutMode = o, this._animationConfig.playTimes = n, this._animationConfig.layer = r, this._animationConfig.fadeInTime = e, this._animationConfig.animation = t, this._animationConfig.group = null !== s ? s : "";
  44014. var h = this._animations[t];
  44015. return h && i > 0 && (this._animationConfig.timeScale = h.duration / i), this.playConfig(this._animationConfig)
  44016. }, i.prototype.gotoAndStop = function(t, e) {
  44017. return void 0 === e && (e = 0), console.warn("Deprecated."), this.gotoAndStopByTime(t, e)
  44018. }, Object.defineProperty(i.prototype, "animationList", {
  44019. get: function() {
  44020. return console.warn("Deprecated."), this._animationNames
  44021. },
  44022. enumerable: !0,
  44023. configurable: !0
  44024. }), Object.defineProperty(i.prototype, "animationDataList", {
  44025. get: function() {
  44026. console.warn("Deprecated.");
  44027. for (var t = [], e = 0, i = this._animationNames.length; e < i; ++e) t.push(this._animations[this._animationNames[e]]);
  44028. return t
  44029. },
  44030. enumerable: !0,
  44031. configurable: !0
  44032. }), i
  44033. })(t.BaseObject);
  44034. t.Animation = e
  44035. })(r || (r = {})), (function(t) {
  44036. var e = (function(e) {
  44037. function s() {
  44038. var t = null !== e && e.apply(this, arguments) || this;
  44039. return t._blendState = new r, t._boneMask = [], t._boneTimelines = [], t._surfaceTimelines = [], t._slotTimelines = [], t._constraintTimelines = [], t._animationTimelines = [], t._poseTimelines = [], t._bonePoses = {}, t._actionTimeline = null, t._zOrderTimeline = null, t._parent = null, t
  44040. }
  44041. return n(s, e), s.toString = function() {
  44042. return "[class dragonBones.AnimationState]"
  44043. }, s.prototype._onClear = function() {
  44044. for (var t = 0, e = this._boneTimelines; t < e.length; t++) {
  44045. e[t].returnToPool()
  44046. }
  44047. for (var i = 0, n = this._surfaceTimelines; i < n.length; i++) {
  44048. n[i].returnToPool()
  44049. }
  44050. for (var r = 0, s = this._slotTimelines; r < s.length; r++) {
  44051. s[r].returnToPool()
  44052. }
  44053. for (var o = 0, a = this._constraintTimelines; o < a.length; o++) {
  44054. a[o].returnToPool()
  44055. }
  44056. for (var l = 0, h = this._animationTimelines; l < h.length; l++) {
  44057. h[l].returnToPool()
  44058. }
  44059. for (var c in this._bonePoses) this._bonePoses[c].returnToPool(), delete this._bonePoses[c];
  44060. null !== this._actionTimeline && this._actionTimeline.returnToPool(), null !== this._zOrderTimeline && this._zOrderTimeline.returnToPool(), this.actionEnabled = !1, this.additiveBlending = !1, this.displayControl = !1, this.resetToPose = !1, this.playTimes = 1, this.layer = 0, this.timeScale = 1, this.weight = 1, this.autoFadeOutTime = 0, this.fadeTotalTime = 0, this.name = "", this.group = "", this._timelineDirty = 2, this._playheadState = 0, this._fadeState = -1, this._subFadeState = -1, this._position = 0, this._duration = 0, this._fadeTime = 0, this._time = 0, this._fadeProgress = 0, this._weightResult = 0, this._blendState.clear(), this._boneMask.length = 0, this._boneTimelines.length = 0, this._surfaceTimelines.length = 0, this._slotTimelines.length = 0, this._constraintTimelines.length = 0, this._animationTimelines.length = 0, this._poseTimelines.length = 0, this._animationData = null, this._armature = null, this._actionTimeline = null, this._zOrderTimeline = null, this._parent = null
  44061. }, s.prototype._updateTimelines = function() {
  44062. for (var e = 0, i = this._armature._constraints; e < i.length; e++) {
  44063. var n = i[e];
  44064. if (null !== (l = this._animationData.getConstraintTimelines(n.name)))
  44065. for (var r = 0, s = l; r < s.length; r++) {
  44066. switch ((_ = s[r]).type) {
  44067. case 30:
  44068. (f = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = n, f.init(this._armature, this, _), this._constraintTimelines.push(f)
  44069. }
  44070. } else if (this.resetToPose) {
  44071. (f = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = n, f.init(this._armature, this, null), this._constraintTimelines.push(f), this._poseTimelines.push(f)
  44072. }
  44073. }
  44074. for (var o = 0, a = this._armature.animation.getStates(); o < a.length; o++) {
  44075. var l, h = a[o];
  44076. if (h._parent === this)
  44077. if (null !== (l = this._animationData.getAnimationTimelines(h.name)))
  44078. for (var c = 0, u = l; c < u.length; c++) {
  44079. var _;
  44080. switch ((_ = u[c]).type) {
  44081. case 40:
  44082. var f;
  44083. (f = t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState = h, f.init(this._armature, this, _), this._animationTimelines.push(f)
  44084. }
  44085. }
  44086. }
  44087. }, s.prototype._updateBoneAndSlotTimelines = function() {
  44088. for (var e = {}, n = 0, r = this._boneTimelines; n < r.length; n++) {
  44089. (l = (v = r[n]).bone.name) in e || (e[l] = []), e[l].push(v)
  44090. }
  44091. for (var s = 0, o = this._armature.getBones(); s < o.length; s++) {
  44092. var a = o[s],
  44093. l = a.name;
  44094. if (this.containsBoneMask(l))
  44095. if (l in e) delete e[l];
  44096. else if (0 === a._boneData.type) {
  44097. var h = this._animationData.getBoneTimelines(l),
  44098. c = l in this._bonePoses ? this._bonePoses[l] : this._bonePoses[l] = t.BaseObject.borrowObject(i);
  44099. if (null !== h)
  44100. for (var u = 0, _ = h; u < _.length; u++) {
  44101. switch ((I = _[u]).type) {
  44102. case 10:
  44103. (v = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v);
  44104. break;
  44105. case 11:
  44106. (v = t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v);
  44107. break;
  44108. case 12:
  44109. (v = t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v);
  44110. break;
  44111. case 13:
  44112. (v = t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, I), this._boneTimelines.push(v)
  44113. }
  44114. } else if (this.resetToPose) {
  44115. (v = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = a, v.bonePose = c, v.init(this._armature, this, null), this._boneTimelines.push(v), this._poseTimelines.push(v)
  44116. }
  44117. } else if (1 === a._boneData.type) {
  44118. if (null !== (h = this._animationData.getSurfaceTimelines(l)))
  44119. for (var f = 0, d = h; f < d.length; f++) {
  44120. switch ((I = d[f]).type) {
  44121. case 50:
  44122. (v = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = a, v.init(this._armature, this, I), this._surfaceTimelines.push(v)
  44123. }
  44124. } else if (this.resetToPose) {
  44125. (v = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = a, v.init(this._armature, this, null), this._surfaceTimelines.push(v), this._poseTimelines.push(v)
  44126. }
  44127. }
  44128. }
  44129. for (var p in e)
  44130. for (var m = 0, y = e[p]; m < y.length; m++) {
  44131. var v = y[m];
  44132. this._boneTimelines.splice(this._boneTimelines.indexOf(v), 1), v.returnToPool()
  44133. }
  44134. for (var g = {}, x = [], b = 0, A = this._slotTimelines; b < A.length; b++) {
  44135. (l = (v = A[b]).slot.name) in g || (g[l] = []), g[l].push(v)
  44136. }
  44137. for (var C = 0, T = this._armature.getSlots(); C < T.length; C++) {
  44138. var S = T[C],
  44139. w = S.parent.name;
  44140. if (this.containsBoneMask(w)) {
  44141. l = S.name, h = this._animationData.getSlotTimelines(l);
  44142. if (l in g) delete g[l];
  44143. else {
  44144. var E = !1,
  44145. M = !1;
  44146. if (x.length = 0, null !== h)
  44147. for (var D = 0, B = h; D < B.length; D++) {
  44148. var I;
  44149. switch ((I = B[D]).type) {
  44150. case 20:
  44151. (v = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = S, v.init(this._armature, this, I), this._slotTimelines.push(v), E = !0;
  44152. break;
  44153. case 21:
  44154. (v = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = S, v.init(this._armature, this, I), this._slotTimelines.push(v), M = !0;
  44155. break;
  44156. case 22:
  44157. (v = t.BaseObject.borrowObject(t.DeformTimelineState)).slot = S, v.init(this._armature, this, I), this._slotTimelines.push(v), x.push(v.vertexOffset)
  44158. }
  44159. }
  44160. if (this.resetToPose) {
  44161. if (!E)(v = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = S, v.init(this._armature, this, null), this._slotTimelines.push(v), this._poseTimelines.push(v);
  44162. if (!M)(v = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = S, v.init(this._armature, this, null), this._slotTimelines.push(v), this._poseTimelines.push(v);
  44163. if (null !== S.rawDisplayDatas)
  44164. for (var P = 0, R = S.rawDisplayDatas; P < R.length; P++) {
  44165. var O = R[P];
  44166. if (null !== O && 2 === O.type) {
  44167. var L = O.vertices.offset;
  44168. if (x.indexOf(L) < 0)(v = t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset = L, v.slot = S, v.init(this._armature, this, null), this._slotTimelines.push(v), this._poseTimelines.push(v)
  44169. }
  44170. }
  44171. }
  44172. }
  44173. }
  44174. }
  44175. for (var p in g)
  44176. for (var F = 0, N = g[p]; F < N.length; F++) {
  44177. v = N[F];
  44178. this._slotTimelines.splice(this._slotTimelines.indexOf(v), 1), v.returnToPool()
  44179. }
  44180. }, s.prototype._advanceFadeTime = function(e) {
  44181. var i = this._fadeState > 0;
  44182. if (this._subFadeState < 0) {
  44183. this._subFadeState = 0;
  44184. var n = i ? t.EventObject.FADE_OUT : t.EventObject.FADE_IN;
  44185. if (this._armature.eventDispatcher.hasDBEventListener(n))(r = t.BaseObject.borrowObject(t.EventObject)).type = n, r.armature = this._armature, r.animationState = this, this._armature._dragonBones.bufferEvent(r)
  44186. }
  44187. if (e < 0 && (e = -e), this._fadeTime += e, this._fadeTime >= this.fadeTotalTime ? (this._subFadeState = 1, this._fadeProgress = i ? 0 : 1) : this._fadeTime > 0 ? this._fadeProgress = i ? 1 - this._fadeTime / this.fadeTotalTime : this._fadeTime / this.fadeTotalTime : this._fadeProgress = i ? 1 : 0, this._subFadeState > 0) {
  44188. i || (this._playheadState |= 1, this._fadeState = 0);
  44189. var r;
  44190. n = i ? t.EventObject.FADE_OUT_COMPLETE : t.EventObject.FADE_IN_COMPLETE;
  44191. if (this._armature.eventDispatcher.hasDBEventListener(n))(r = t.BaseObject.borrowObject(t.EventObject)).type = n, r.armature = this._armature, r.animationState = this, this._armature._dragonBones.bufferEvent(r)
  44192. }
  44193. }, s.prototype.init = function(e, i, n) {
  44194. if (null === this._armature) {
  44195. if (this._armature = e, this._animationData = i, this.resetToPose = n.resetToPose, this.additiveBlending = n.additiveBlending, this.displayControl = n.displayControl, this.actionEnabled = n.actionEnabled, this.layer = n.layer, this.playTimes = n.playTimes, this.timeScale = n.timeScale, this.fadeTotalTime = n.fadeInTime, this.autoFadeOutTime = n.autoFadeOutTime, this.weight = n.weight, this.name = n.name.length > 0 ? n.name : n.animation, this.group = n.group, n.pauseFadeIn ? this._playheadState = 2 : this._playheadState = 3, n.duration < 0 ? (this._position = 0, this._duration = this._animationData.duration, 0 !== n.position ? this.timeScale >= 0 ? this._time = n.position : this._time = n.position - this._duration : this._time = 0) : (this._position = n.position, this._duration = n.duration, this._time = 0), this.timeScale < 0 && 0 === this._time && (this._time = -1e-6), this.fadeTotalTime <= 0 && (this._fadeProgress = .999999), n.boneMask.length > 0) {
  44196. this._boneMask.length = n.boneMask.length;
  44197. for (var r = 0, s = this._boneMask.length; r < s; ++r) this._boneMask[r] = n.boneMask[r]
  44198. }
  44199. this._actionTimeline = t.BaseObject.borrowObject(t.ActionTimelineState), this._actionTimeline.init(this._armature, this, this._animationData.actionTimeline), this._actionTimeline.currentTime = this._time, this._actionTimeline.currentTime < 0 && (this._actionTimeline.currentTime = this._duration - this._actionTimeline.currentTime), null !== this._animationData.zOrderTimeline && (this._zOrderTimeline = t.BaseObject.borrowObject(t.ZOrderTimelineState), this._zOrderTimeline.init(this._armature, this, this._animationData.zOrderTimeline))
  44200. }
  44201. }, s.prototype.advanceTime = function(e, i) {
  44202. if (this._blendState.dirty = !1, 0 === this._fadeState && 0 === this._subFadeState || this._advanceFadeTime(e), 3 === this._playheadState && (1 !== this.timeScale && (e *= this.timeScale), this._time += e), 0 !== this._timelineDirty && (2 === this._timelineDirty && this._updateTimelines(), this._timelineDirty = 0, this._updateBoneAndSlotTimelines()), 0 !== this.weight) {
  44203. var n = 0 === this._fadeState && i > 0,
  44204. r = !0,
  44205. s = !0,
  44206. o = this._time;
  44207. if (this._weightResult = this.weight * this._fadeProgress, null !== this._parent && (this._weightResult *= this._parent._weightResult / this._parent._fadeProgress), this._actionTimeline.playState <= 0 && this._actionTimeline.update(o), n) {
  44208. var a = 2 * i;
  44209. this._actionTimeline.currentTime = Math.floor(this._actionTimeline.currentTime * a) / a
  44210. }
  44211. if (null !== this._zOrderTimeline && this._zOrderTimeline.playState <= 0 && this._zOrderTimeline.update(o), n) {
  44212. var l = Math.floor(this._actionTimeline.currentTime * i);
  44213. this._armature._cacheFrameIndex === l ? (r = !1, s = !1) : (this._armature._cacheFrameIndex = l, this._animationData.cachedFrames[l] ? s = !1 : this._animationData.cachedFrames[l] = !0)
  44214. }
  44215. if (r) {
  44216. if (s)
  44217. for (var h = 0, c = this._boneTimelines.length; h < c; ++h) {
  44218. if ((p = this._boneTimelines[h]).playState <= 0 && p.update(o), h === c - 1 || p.bone !== this._boneTimelines[h + 1].bone) 0 !== (u = p.bone._blendState.update(this._weightResult, this.layer)) && p.blend(u)
  44219. }
  44220. for (h = 0, c = this._surfaceTimelines.length; h < c; ++h) {
  44221. var u = (p = this._surfaceTimelines[h]).surface._blendState.update(this._weightResult, this.layer);
  44222. p.playState <= 0 && p.update(o), 0 !== u && p.blend(u)
  44223. }
  44224. if (this.displayControl)
  44225. for (h = 0, c = this._slotTimelines.length; h < c; ++h) {
  44226. var _ = (p = this._slotTimelines[h]).slot.displayController;
  44227. null !== _ && _ !== this.name && _ !== this.group || p.playState <= 0 && p.update(o)
  44228. }
  44229. for (h = 0, c = this._constraintTimelines.length; h < c; ++h) {
  44230. (p = this._constraintTimelines[h]).playState <= 0 && p.update(o)
  44231. }
  44232. for (h = 0, c = this._animationTimelines.length; h < c; ++h) {
  44233. u = (p = this._animationTimelines[h]).animationState._blendState.update(this._weightResult, this.layer);
  44234. p.playState <= 0 && p.update(o), 0 !== u && p.blend(u)
  44235. }
  44236. }
  44237. if (0 === this._fadeState) {
  44238. if (this._subFadeState > 0 && (this._subFadeState = 0, this._poseTimelines.length > 0)) {
  44239. for (var f = 0, d = this._poseTimelines; f < d.length; f++) {
  44240. var p;
  44241. (p = d[f]) instanceof t.BoneTimelineState ? this._boneTimelines.splice(this._boneTimelines.indexOf(p), 1) : p instanceof t.SurfaceTimelineState ? this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(p), 1) : p instanceof t.SlotTimelineState ? this._slotTimelines.splice(this._slotTimelines.indexOf(p), 1) : p instanceof t.ConstraintTimelineState && this._constraintTimelines.splice(this._constraintTimelines.indexOf(p), 1), p.returnToPool()
  44242. }
  44243. this._poseTimelines.length = 0
  44244. }
  44245. this._actionTimeline.playState > 0 && this.autoFadeOutTime >= 0 && this.fadeOut(this.autoFadeOutTime)
  44246. }
  44247. }
  44248. }, s.prototype.play = function() {
  44249. this._playheadState = 3
  44250. }, s.prototype.stop = function() {
  44251. this._playheadState &= 1
  44252. }, s.prototype.fadeOut = function(t, e) {
  44253. if (void 0 === e && (e = !0), t < 0 && (t = 0), e && (this._playheadState &= 2), this._fadeState > 0) {
  44254. if (t > this.fadeTotalTime - this._fadeTime) return
  44255. } else {
  44256. this._fadeState = 1, this._subFadeState = -1, (t <= 0 || this._fadeProgress <= 0) && (this._fadeProgress = 1e-6);
  44257. for (var i = 0, n = this._boneTimelines; i < n.length; i++) {
  44258. (_ = n[i]).fadeOut()
  44259. }
  44260. for (var r = 0, s = this._surfaceTimelines; r < s.length; r++) {
  44261. (_ = s[r]).fadeOut()
  44262. }
  44263. for (var o = 0, a = this._slotTimelines; o < a.length; o++) {
  44264. (_ = a[o]).fadeOut()
  44265. }
  44266. for (var l = 0, h = this._constraintTimelines; l < h.length; l++) {
  44267. (_ = h[l]).fadeOut()
  44268. }
  44269. for (var c = 0, u = this._animationTimelines; c < u.length; c++) {
  44270. var _;
  44271. (_ = u[c]).animationState.fadeOut(t, e), _.fadeOut()
  44272. }
  44273. }
  44274. this.displayControl = !1, this.fadeTotalTime = this._fadeProgress > 1e-6 ? t / this._fadeProgress : 0, this._fadeTime = this.fadeTotalTime * (1 - this._fadeProgress)
  44275. }, s.prototype.containsBoneMask = function(t) {
  44276. return 0 === this._boneMask.length || this._boneMask.indexOf(t) >= 0
  44277. }, s.prototype.addBoneMask = function(t, e) {
  44278. void 0 === e && (e = !0);
  44279. var i = this._armature.getBone(t);
  44280. if (null !== i) {
  44281. if (this._boneMask.indexOf(t) < 0 && this._boneMask.push(t), e)
  44282. for (var n = 0, r = this._armature.getBones(); n < r.length; n++) {
  44283. var s = r[n];
  44284. this._boneMask.indexOf(s.name) < 0 && i.contains(s) && this._boneMask.push(s.name)
  44285. }
  44286. this._timelineDirty = 1
  44287. }
  44288. }, s.prototype.removeBoneMask = function(t, e) {
  44289. void 0 === e && (e = !0);
  44290. var i = this._boneMask.indexOf(t);
  44291. if (i >= 0 && this._boneMask.splice(i, 1), e) {
  44292. var n = this._armature.getBone(t);
  44293. if (null !== n) {
  44294. var r = this._armature.getBones();
  44295. if (this._boneMask.length > 0)
  44296. for (var s = 0, o = r; s < o.length; s++) {
  44297. var a = o[s],
  44298. l = this._boneMask.indexOf(a.name);
  44299. l >= 0 && n.contains(a) && this._boneMask.splice(l, 1)
  44300. } else
  44301. for (var h = 0, c = r; h < c.length; h++) {
  44302. (a = c[h]) !== n && (n.contains(a) || this._boneMask.push(a.name))
  44303. }
  44304. }
  44305. }
  44306. this._timelineDirty = 1
  44307. }, s.prototype.removeAllBoneMask = function() {
  44308. this._boneMask.length = 0, this._timelineDirty = 1
  44309. }, Object.defineProperty(s.prototype, "isFadeIn", {
  44310. get: function() {
  44311. return this._fadeState < 0
  44312. },
  44313. enumerable: !0,
  44314. configurable: !0
  44315. }), Object.defineProperty(s.prototype, "isFadeOut", {
  44316. get: function() {
  44317. return this._fadeState > 0
  44318. },
  44319. enumerable: !0,
  44320. configurable: !0
  44321. }), Object.defineProperty(s.prototype, "isFadeComplete", {
  44322. get: function() {
  44323. return 0 === this._fadeState
  44324. },
  44325. enumerable: !0,
  44326. configurable: !0
  44327. }), Object.defineProperty(s.prototype, "isPlaying", {
  44328. get: function() {
  44329. return 0 != (2 & this._playheadState) && this._actionTimeline.playState <= 0
  44330. },
  44331. enumerable: !0,
  44332. configurable: !0
  44333. }), Object.defineProperty(s.prototype, "isCompleted", {
  44334. get: function() {
  44335. return this._actionTimeline.playState > 0
  44336. },
  44337. enumerable: !0,
  44338. configurable: !0
  44339. }), Object.defineProperty(s.prototype, "currentPlayTimes", {
  44340. get: function() {
  44341. return this._actionTimeline.currentPlayTimes
  44342. },
  44343. enumerable: !0,
  44344. configurable: !0
  44345. }), Object.defineProperty(s.prototype, "totalTime", {
  44346. get: function() {
  44347. return this._duration
  44348. },
  44349. enumerable: !0,
  44350. configurable: !0
  44351. }), Object.defineProperty(s.prototype, "currentTime", {
  44352. get: function() {
  44353. return this._actionTimeline.currentTime
  44354. },
  44355. set: function(t) {
  44356. var e = this._actionTimeline.currentPlayTimes - (this._actionTimeline.playState > 0 ? 1 : 0);
  44357. if ((t < 0 || this._duration < t) && (t = t % this._duration + e * this._duration) < 0 && (t += this._duration), this.playTimes > 0 && e === this.playTimes - 1 && t === this._duration && (t = this._duration - 1e-6), this._time !== t) {
  44358. this._time = t, this._actionTimeline.setCurrentTime(this._time), null !== this._zOrderTimeline && (this._zOrderTimeline.playState = -1);
  44359. for (var i = 0, n = this._boneTimelines; i < n.length; i++) {
  44360. n[i].playState = -1
  44361. }
  44362. for (var r = 0, s = this._slotTimelines; r < s.length; r++) {
  44363. s[r].playState = -1
  44364. }
  44365. }
  44366. },
  44367. enumerable: !0,
  44368. configurable: !0
  44369. }), Object.defineProperty(s.prototype, "animationData", {
  44370. get: function() {
  44371. return this._animationData
  44372. },
  44373. enumerable: !0,
  44374. configurable: !0
  44375. }), s
  44376. })(t.BaseObject);
  44377. t.AnimationState = e;
  44378. var i = (function(e) {
  44379. function i() {
  44380. var i = null !== e && e.apply(this, arguments) || this;
  44381. return i.current = new t.Transform, i.delta = new t.Transform, i.result = new t.Transform, i
  44382. }
  44383. return n(i, e), i.toString = function() {
  44384. return "[class dragonBones.BonePose]"
  44385. }, i.prototype._onClear = function() {
  44386. this.current.identity(), this.delta.identity(), this.result.identity()
  44387. }, i
  44388. })(t.BaseObject);
  44389. t.BonePose = i;
  44390. var r = (function() {
  44391. function t() {}
  44392. return t.prototype.update = function(t, e) {
  44393. if (this.dirty) {
  44394. if (!(this.leftWeight > 0)) return 0;
  44395. if (this.layer !== e) {
  44396. if (this.layerWeight >= this.leftWeight) return this.leftWeight = 0, 0;
  44397. this.layer = e, this.leftWeight -= this.layerWeight, this.layerWeight = 0
  44398. }
  44399. return t *= this.leftWeight, this.layerWeight += t, this.blendWeight = t, 2
  44400. }
  44401. return this.dirty = !0, this.layer = e, this.layerWeight = t, this.leftWeight = 1, this.blendWeight = t, 1
  44402. }, t.prototype.clear = function() {
  44403. this.dirty = !1, this.layer = 0, this.leftWeight = 0, this.layerWeight = 0, this.blendWeight = 0
  44404. }, t
  44405. })();
  44406. t.BlendState = r
  44407. })(r || (r = {})), (function(t) {
  44408. var e = (function(t) {
  44409. function e() {
  44410. return null !== t && t.apply(this, arguments) || this
  44411. }
  44412. return n(e, t), e.prototype._onClear = function() {
  44413. this.playState = -1, this.currentPlayTimes = -1, this.currentTime = -1, this._tweenState = 0, this._frameRate = 0, this._frameValueOffset = 0, this._frameCount = 0, this._frameOffset = 0, this._frameIndex = -1, this._frameRateR = 0, this._position = 0, this._duration = 0, this._timeScale = 1, this._timeOffset = 0, this._dragonBonesData = null, this._animationData = null, this._timelineData = null, this._armature = null, this._animationState = null, this._actionTimeline = null, this._frameArray = null, this._frameIntArray = null, this._frameFloatArray = null, this._timelineArray = null, this._frameIndices = null
  44414. }, e.prototype._setCurrentTime = function(t) {
  44415. var e = this.playState,
  44416. i = this.currentPlayTimes,
  44417. n = this.currentTime;
  44418. if (null !== this._actionTimeline && this._frameCount <= 1) this.playState = this._actionTimeline.playState >= 0 ? 1 : -1, this.currentPlayTimes = 1, this.currentTime = this._actionTimeline.currentTime;
  44419. else if (null === this._actionTimeline || 1 !== this._timeScale || 0 !== this._timeOffset) {
  44420. var r = this._animationState.playTimes,
  44421. s = r * this._duration;
  44422. t *= this._timeScale, 0 !== this._timeOffset && (t += this._timeOffset * this._animationData.duration), r > 0 && (t >= s || t <= -s) ? (this.playState <= 0 && 3 === this._animationState._playheadState && (this.playState = 1), this.currentPlayTimes = r, this.currentTime = t < 0 ? 0 : this._duration + 1e-6) : (0 !== this.playState && 3 === this._animationState._playheadState && (this.playState = 0), t < 0 ? (t = -t, this.currentPlayTimes = Math.floor(t / this._duration), this.currentTime = this._duration - t % this._duration) : (this.currentPlayTimes = Math.floor(t / this._duration), this.currentTime = t % this._duration)), this.currentTime += this._position
  44423. } else this.playState = this._actionTimeline.playState, this.currentPlayTimes = this._actionTimeline.currentPlayTimes, this.currentTime = this._actionTimeline.currentTime;
  44424. return (this.currentPlayTimes !== i || this.currentTime !== n) && ((e < 0 && this.playState !== e || this.playState <= 0 && this.currentPlayTimes !== i) && (this._frameIndex = -1), !0)
  44425. }, e.prototype.init = function(t, e, i) {
  44426. this._armature = t, this._animationState = e, this._timelineData = i, this._actionTimeline = this._animationState._actionTimeline, this === this._actionTimeline && (this._actionTimeline = null), this._animationData = this._animationState._animationData, this._frameRate = this._animationData.parent.frameRate, this._frameRateR = 1 / this._frameRate, this._position = this._animationState._position, this._duration = this._animationState._duration, this._dragonBonesData = this._animationData.parent.parent, null !== this._timelineData && (this._frameIntArray = this._dragonBonesData.frameIntArray, this._frameFloatArray = this._dragonBonesData.frameFloatArray, this._frameArray = this._dragonBonesData.frameArray, this._timelineArray = this._dragonBonesData.timelineArray, this._frameIndices = this._dragonBonesData.frameIndices, this._frameCount = this._timelineArray[this._timelineData.offset + 2], this._frameValueOffset = this._timelineArray[this._timelineData.offset + 4], this._timeScale = 100 / this._timelineArray[this._timelineData.offset + 0], this._timeOffset = .01 * this._timelineArray[this._timelineData.offset + 1])
  44427. }, e.prototype.fadeOut = function() {}, e.prototype.update = function(t) {
  44428. if (this._setCurrentTime(t)) {
  44429. if (this._frameCount > 1) {
  44430. var e = Math.floor(this.currentTime * this._frameRate),
  44431. i = this._frameIndices[this._timelineData.frameIndicesOffset + e];
  44432. this._frameIndex !== i && (this._frameIndex = i, this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex], this._onArriveAtFrame())
  44433. } else this._frameIndex < 0 && (this._frameIndex = 0, null !== this._timelineData && (this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5]), this._onArriveAtFrame());
  44434. 0 !== this._tweenState && this._onUpdateFrame()
  44435. }
  44436. }, e
  44437. })(t.BaseObject);
  44438. t.TimelineState = e;
  44439. var i = (function(t) {
  44440. function e() {
  44441. return null !== t && t.apply(this, arguments) || this
  44442. }
  44443. return n(e, t), e._getEasingValue = function(t, e, i) {
  44444. var n = e;
  44445. switch (t) {
  44446. case 3:
  44447. n = Math.pow(e, 2);
  44448. break;
  44449. case 4:
  44450. n = 1 - Math.pow(1 - e, 2);
  44451. break;
  44452. case 5:
  44453. n = .5 * (1 - Math.cos(e * Math.PI))
  44454. }
  44455. return (n - e) * i + e
  44456. }, e._getEasingCurveValue = function(t, e, i, n) {
  44457. if (t <= 0) return 0;
  44458. if (t >= 1) return 1;
  44459. var r = i + 1,
  44460. s = Math.floor(t * r),
  44461. o = 0 === s ? 0 : e[n + s - 1];
  44462. return 1e-4 * (o + ((s === r - 1 ? 1e4 : e[n + s]) - o) * (t * r - s))
  44463. }, e.prototype._onClear = function() {
  44464. t.prototype._onClear.call(this), this._tweenType = 0, this._curveCount = 0, this._framePosition = 0, this._frameDurationR = 0, this._tweenProgress = 0, this._tweenEasing = 0
  44465. }, e.prototype._onArriveAtFrame = function() {
  44466. if (this._frameCount > 1 && (this._frameIndex !== this._frameCount - 1 || 0 === this._animationState.playTimes || this._animationState.currentPlayTimes < this._animationState.playTimes - 1))
  44467. if (this._tweenType = this._frameArray[this._frameOffset + 1], this._tweenState = 0 === this._tweenType ? 1 : 2, 2 === this._tweenType ? this._curveCount = this._frameArray[this._frameOffset + 2] : 0 !== this._tweenType && 1 !== this._tweenType && (this._tweenEasing = .01 * this._frameArray[this._frameOffset + 2]), this._framePosition = this._frameArray[this._frameOffset] * this._frameRateR, this._frameIndex === this._frameCount - 1) this._frameDurationR = 1 / (this._animationData.duration - this._framePosition);
  44468. else {
  44469. var t = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex + 1],
  44470. e = this._frameArray[t] * this._frameRateR - this._framePosition;
  44471. this._frameDurationR = e > 0 ? 1 / e : 0
  44472. }
  44473. else this._tweenState = 1
  44474. }, e.prototype._onUpdateFrame = function() {
  44475. 2 === this._tweenState ? (this._tweenProgress = (this.currentTime - this._framePosition) * this._frameDurationR, 2 === this._tweenType ? this._tweenProgress = e._getEasingCurveValue(this._tweenProgress, this._frameArray, this._curveCount, this._frameOffset + 3) : 1 !== this._tweenType && (this._tweenProgress = e._getEasingValue(this._tweenType, this._tweenProgress, this._tweenEasing))) : this._tweenProgress = 0
  44476. }, e
  44477. })(e);
  44478. t.TweenTimelineState = i;
  44479. var r = (function(t) {
  44480. function e() {
  44481. return null !== t && t.apply(this, arguments) || this
  44482. }
  44483. return n(e, t), e.prototype._onClear = function() {
  44484. t.prototype._onClear.call(this), this.bone = null, this.bonePose = null
  44485. }, e.prototype.blend = function(t) {
  44486. var e = this.bone._blendState.blendWeight,
  44487. i = this.bone.animationPose,
  44488. n = this.bonePose.result;
  44489. 2 === t ? (i.x += n.x * e, i.y += n.y * e, i.rotation += n.rotation * e, i.skew += n.skew * e, i.scaleX += (n.scaleX - 1) * e, i.scaleY += (n.scaleY - 1) * e) : 1 !== e ? (i.x = n.x * e, i.y = n.y * e, i.rotation = n.rotation * e, i.skew = n.skew * e, i.scaleX = (n.scaleX - 1) * e + 1, i.scaleY = (n.scaleY - 1) * e + 1) : (i.x = n.x, i.y = n.y, i.rotation = n.rotation, i.skew = n.skew, i.scaleX = n.scaleX, i.scaleY = n.scaleY), 0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.bone._transformDirty = !0)
  44490. }, e
  44491. })(i);
  44492. t.BoneTimelineState = r;
  44493. var s = (function(t) {
  44494. function e() {
  44495. return null !== t && t.apply(this, arguments) || this
  44496. }
  44497. return n(e, t), e.prototype._onClear = function() {
  44498. t.prototype._onClear.call(this), this.slot = null
  44499. }, e
  44500. })(i);
  44501. t.SlotTimelineState = s;
  44502. var o = (function(t) {
  44503. function e() {
  44504. return null !== t && t.apply(this, arguments) || this
  44505. }
  44506. return n(e, t), e.prototype._onClear = function() {
  44507. t.prototype._onClear.call(this), this.constraint = null
  44508. }, e
  44509. })(i);
  44510. t.ConstraintTimelineState = o
  44511. })(r || (r = {})), (function(t) {
  44512. var e = (function(e) {
  44513. function i() {
  44514. return null !== e && e.apply(this, arguments) || this
  44515. }
  44516. return n(i, e), i.toString = function() {
  44517. return "[class dragonBones.ActionTimelineState]"
  44518. }, i.prototype._onCrossFrame = function(e) {
  44519. var i = this._armature.eventDispatcher;
  44520. if (this._animationState.actionEnabled)
  44521. for (var n = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + e], r = this._frameArray[n + 1], s = this._animationData.parent.actions, o = 0; o < r; ++o) {
  44522. var a = s[this._frameArray[n + 2 + o]];
  44523. if (0 === a.type) {
  44524. (l = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[n] / this._frameRate, l.animationState = this._animationState, t.EventObject.actionDataToInstance(a, l, this._armature), this._armature._bufferAction(l, !0)
  44525. } else {
  44526. var l, h = 10 === a.type ? t.EventObject.FRAME_EVENT : t.EventObject.SOUND_EVENT;
  44527. if (11 === a.type || i.hasDBEventListener(h))(l = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[n] / this._frameRate, l.animationState = this._animationState, t.EventObject.actionDataToInstance(a, l, this._armature), this._armature._dragonBones.bufferEvent(l)
  44528. }
  44529. }
  44530. }, i.prototype._onArriveAtFrame = function() {}, i.prototype._onUpdateFrame = function() {}, i.prototype.update = function(e) {
  44531. var i = this.playState,
  44532. n = this.currentPlayTimes,
  44533. r = this.currentTime;
  44534. if (this._setCurrentTime(e)) {
  44535. var s = this._armature.eventDispatcher;
  44536. if (i < 0) {
  44537. if (this.playState === i) return;
  44538. if (this._animationState.displayControl && this._animationState.resetToPose && this._armature._sortZOrder(null, 0), n = this.currentPlayTimes, s.hasDBEventListener(t.EventObject.START)) {
  44539. var o = t.BaseObject.borrowObject(t.EventObject);
  44540. o.type = t.EventObject.START, o.armature = this._armature, o.animationState = this._animationState, this._armature._dragonBones.bufferEvent(o)
  44541. }
  44542. }
  44543. var a = this._animationState.timeScale < 0,
  44544. l = null,
  44545. h = null;
  44546. if (this.currentPlayTimes !== n && (s.hasDBEventListener(t.EventObject.LOOP_COMPLETE) && ((l = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.LOOP_COMPLETE, l.armature = this._armature, l.animationState = this._animationState), this.playState > 0 && s.hasDBEventListener(t.EventObject.COMPLETE) && ((h = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.COMPLETE, h.armature = this._armature, h.animationState = this._animationState)), this._frameCount > 1) {
  44547. var c = this._timelineData,
  44548. u = Math.floor(this.currentTime * this._frameRate),
  44549. _ = this._frameIndices[c.frameIndicesOffset + u];
  44550. if (this._frameIndex !== _) {
  44551. var f = this._frameIndex;
  44552. if (this._frameIndex = _, null !== this._timelineArray)
  44553. if (this._frameOffset = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + this._frameIndex], a) {
  44554. if (f < 0) {
  44555. var d = Math.floor(r * this._frameRate);
  44556. f = this._frameIndices[c.frameIndicesOffset + d], this.currentPlayTimes === n && f === _ && (f = -1)
  44557. }
  44558. for (; f >= 0;) {
  44559. var p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f],
  44560. m = this._frameArray[p] / this._frameRate;
  44561. if (this._position <= m && m <= this._position + this._duration && this._onCrossFrame(f), null !== l && 0 === f && (this._armature._dragonBones.bufferEvent(l), l = null), f > 0 ? f-- : f = this._frameCount - 1, f === _) break
  44562. }
  44563. } else {
  44564. if (f < 0) {
  44565. d = Math.floor(r * this._frameRate);
  44566. f = this._frameIndices[c.frameIndicesOffset + d];
  44567. p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f], m = this._frameArray[p] / this._frameRate;
  44568. this.currentPlayTimes === n && (r <= m ? f > 0 ? f-- : f = this._frameCount - 1 : f === _ && (f = -1))
  44569. }
  44570. for (; f >= 0;) {
  44571. f < this._frameCount - 1 ? f++ : f = 0;
  44572. p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f], m = this._frameArray[p] / this._frameRate;
  44573. if (this._position <= m && m <= this._position + this._duration && this._onCrossFrame(f), null !== l && 0 === f && (this._armature._dragonBones.bufferEvent(l), l = null), f === _) break
  44574. }
  44575. }
  44576. }
  44577. } else if (this._frameIndex < 0 && (this._frameIndex = 0, null !== this._timelineData)) {
  44578. this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5];
  44579. m = this._frameArray[this._frameOffset] / this._frameRate;
  44580. this.currentPlayTimes === n ? r <= m && this._onCrossFrame(this._frameIndex) : this._position <= m && (a || null === l || (this._armature._dragonBones.bufferEvent(l), l = null), this._onCrossFrame(this._frameIndex))
  44581. }
  44582. null !== l && this._armature._dragonBones.bufferEvent(l), null !== h && this._armature._dragonBones.bufferEvent(h)
  44583. }
  44584. }, i.prototype.setCurrentTime = function(t) {
  44585. this._setCurrentTime(t), this._frameIndex = -1
  44586. }, i
  44587. })(t.TimelineState);
  44588. t.ActionTimelineState = e;
  44589. var i = (function(t) {
  44590. function e() {
  44591. return null !== t && t.apply(this, arguments) || this
  44592. }
  44593. return n(e, t), e.toString = function() {
  44594. return "[class dragonBones.ZOrderTimelineState]"
  44595. }, e.prototype._onArriveAtFrame = function() {
  44596. this.playState >= 0 && (this._frameArray[this._frameOffset + 1] > 0 ? this._armature._sortZOrder(this._frameArray, this._frameOffset + 2) : this._armature._sortZOrder(null, 0))
  44597. }, e.prototype._onUpdateFrame = function() {}, e
  44598. })(t.TimelineState);
  44599. t.ZOrderTimelineState = i;
  44600. var r = (function(e) {
  44601. function i() {
  44602. return null !== e && e.apply(this, arguments) || this
  44603. }
  44604. return n(i, e), i.toString = function() {
  44605. return "[class dragonBones.BoneAllTimelineState]"
  44606. }, i.prototype._onArriveAtFrame = function() {
  44607. if (e.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44608. var t = this._animationData.frameFloatOffset + this._frameValueOffset + 6 * this._frameIndex,
  44609. i = this._armature._armatureData.scale,
  44610. n = this._frameFloatArray,
  44611. r = this.bonePose.current,
  44612. s = this.bonePose.delta;
  44613. r.x = n[t++] * i, r.y = n[t++] * i, r.rotation = n[t++], r.skew = n[t++], r.scaleX = n[t++], r.scaleY = n[t++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (t = this._animationData.frameFloatOffset + this._frameValueOffset), s.x = n[t++] * i - r.x, s.y = n[t++] * i - r.y, s.rotation = n[t++] - r.rotation, s.skew = n[t++] - r.skew, s.scaleX = n[t++] - r.scaleX, s.scaleY = n[t++] - r.scaleY) : (s.x = 0, s.y = 0, s.rotation = 0, s.skew = 0, s.scaleX = 0, s.scaleY = 0)
  44614. } else {
  44615. r = this.bonePose.current, s = this.bonePose.delta;
  44616. r.x = 0, r.y = 0, r.rotation = 0, r.skew = 0, r.scaleX = 1, r.scaleY = 1, s.x = 0, s.y = 0, s.rotation = 0, s.skew = 0, s.scaleX = 0, s.scaleY = 0
  44617. }
  44618. }, i.prototype._onUpdateFrame = function() {
  44619. e.prototype._onUpdateFrame.call(this);
  44620. var t = this.bonePose.current,
  44621. i = this.bonePose.delta,
  44622. n = this.bonePose.result;
  44623. this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.x = t.x + i.x * this._tweenProgress, n.y = t.y + i.y * this._tweenProgress, n.rotation = t.rotation + i.rotation * this._tweenProgress, n.skew = t.skew + i.skew * this._tweenProgress, n.scaleX = t.scaleX + i.scaleX * this._tweenProgress, n.scaleY = t.scaleY + i.scaleY * this._tweenProgress
  44624. }, i.prototype.fadeOut = function() {
  44625. var e = this.bonePose.result;
  44626. e.rotation = t.Transform.normalizeRadian(e.rotation), e.skew = t.Transform.normalizeRadian(e.skew)
  44627. }, i
  44628. })(t.BoneTimelineState);
  44629. t.BoneAllTimelineState = r;
  44630. var s = (function(t) {
  44631. function e() {
  44632. return null !== t && t.apply(this, arguments) || this
  44633. }
  44634. return n(e, t), e.toString = function() {
  44635. return "[class dragonBones.BoneTranslateTimelineState]"
  44636. }, e.prototype._onArriveAtFrame = function() {
  44637. if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44638. var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex,
  44639. i = this._armature._armatureData.scale,
  44640. n = this._frameFloatArray,
  44641. r = this.bonePose.current,
  44642. s = this.bonePose.delta;
  44643. r.x = n[e++] * i, r.y = n[e++] * i, 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset), s.x = n[e++] * i - r.x, s.y = n[e++] * i - r.y) : (s.x = 0, s.y = 0)
  44644. } else {
  44645. r = this.bonePose.current, s = this.bonePose.delta;
  44646. r.x = 0, r.y = 0, s.x = 0, s.y = 0
  44647. }
  44648. }, e.prototype._onUpdateFrame = function() {
  44649. t.prototype._onUpdateFrame.call(this);
  44650. var e = this.bonePose.current,
  44651. i = this.bonePose.delta,
  44652. n = this.bonePose.result;
  44653. this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.x = e.x + i.x * this._tweenProgress, n.y = e.y + i.y * this._tweenProgress
  44654. }, e
  44655. })(t.BoneTimelineState);
  44656. t.BoneTranslateTimelineState = s;
  44657. var o = (function(e) {
  44658. function i() {
  44659. return null !== e && e.apply(this, arguments) || this
  44660. }
  44661. return n(i, e), i.toString = function() {
  44662. return "[class dragonBones.BoneRotateTimelineState]"
  44663. }, i.prototype._onArriveAtFrame = function() {
  44664. if (e.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44665. var i = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex,
  44666. n = this._frameFloatArray,
  44667. r = this.bonePose.current,
  44668. s = this.bonePose.delta;
  44669. r.rotation = n[i++], r.skew = n[i++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 ? (i = this._animationData.frameFloatOffset + this._frameValueOffset, s.rotation = t.Transform.normalizeRadian(n[i++] - r.rotation)) : s.rotation = n[i++] - r.rotation, s.skew = n[i++] - r.skew) : (s.rotation = 0, s.skew = 0)
  44670. } else {
  44671. r = this.bonePose.current, s = this.bonePose.delta;
  44672. r.rotation = 0, r.skew = 0, s.rotation = 0, s.skew = 0
  44673. }
  44674. }, i.prototype._onUpdateFrame = function() {
  44675. e.prototype._onUpdateFrame.call(this);
  44676. var t = this.bonePose.current,
  44677. i = this.bonePose.delta,
  44678. n = this.bonePose.result;
  44679. this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.rotation = t.rotation + i.rotation * this._tweenProgress, n.skew = t.skew + i.skew * this._tweenProgress
  44680. }, i.prototype.fadeOut = function() {
  44681. var e = this.bonePose.result;
  44682. e.rotation = t.Transform.normalizeRadian(e.rotation), e.skew = t.Transform.normalizeRadian(e.skew)
  44683. }, i
  44684. })(t.BoneTimelineState);
  44685. t.BoneRotateTimelineState = o;
  44686. var a = (function(t) {
  44687. function e() {
  44688. return null !== t && t.apply(this, arguments) || this
  44689. }
  44690. return n(e, t), e.toString = function() {
  44691. return "[class dragonBones.BoneScaleTimelineState]"
  44692. }, e.prototype._onArriveAtFrame = function() {
  44693. if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44694. var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex,
  44695. i = this._frameFloatArray,
  44696. n = this.bonePose.current,
  44697. r = this.bonePose.delta;
  44698. n.scaleX = i[e++], n.scaleY = i[e++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset), r.scaleX = i[e++] - n.scaleX, r.scaleY = i[e++] - n.scaleY) : (r.scaleX = 0, r.scaleY = 0)
  44699. } else {
  44700. n = this.bonePose.current, r = this.bonePose.delta;
  44701. n.scaleX = 1, n.scaleY = 1, r.scaleX = 0, r.scaleY = 0
  44702. }
  44703. }, e.prototype._onUpdateFrame = function() {
  44704. t.prototype._onUpdateFrame.call(this);
  44705. var e = this.bonePose.current,
  44706. i = this.bonePose.delta,
  44707. n = this.bonePose.result;
  44708. this.bone._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0), n.scaleX = e.scaleX + i.scaleX * this._tweenProgress, n.scaleY = e.scaleY + i.scaleY * this._tweenProgress
  44709. }, e
  44710. })(t.BoneTimelineState);
  44711. t.BoneScaleTimelineState = a;
  44712. var l = (function(t) {
  44713. function e() {
  44714. var e = null !== t && t.apply(this, arguments) || this;
  44715. return e._current = [], e._delta = [], e._result = [], e
  44716. }
  44717. return n(e, t), e.toString = function() {
  44718. return "[class dragonBones.SurfaceTimelineState]"
  44719. }, e.prototype._onClear = function() {
  44720. t.prototype._onClear.call(this), this.surface = null, this._frameFloatOffset = 0, this._valueCount = 0, this._deformCount = 0, this._valueOffset = 0, this._current.length = 0, this._delta.length = 0, this._result.length = 0
  44721. }, e.prototype._onArriveAtFrame = function() {
  44722. if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44723. var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount,
  44724. i = this._armature._armatureData.scale,
  44725. n = this._frameFloatArray;
  44726. if (2 === this._tweenState) {
  44727. var r = e + this._valueCount;
  44728. this._frameIndex === this._frameCount - 1 && (r = this._animationData.frameFloatOffset + this._frameValueOffset);
  44729. for (var s = 0; s < this._valueCount; ++s) this._delta[s] = n[r + s] * i - (this._current[s] = n[e + s] * i)
  44730. } else
  44731. for (s = 0; s < this._valueCount; ++s) this._current[s] = n[e + s] * i
  44732. } else
  44733. for (s = 0; s < this._valueCount; ++s) this._current[s] = 0
  44734. }, e.prototype._onUpdateFrame = function() {
  44735. t.prototype._onUpdateFrame.call(this), this.surface._transformDirty = !0, 2 !== this._tweenState && (this._tweenState = 0);
  44736. for (var e = 0; e < this._valueCount; ++e) this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress
  44737. }, e.prototype.init = function(e, i, n) {
  44738. if (t.prototype.init.call(this, e, i, n), null !== this._timelineData) {
  44739. var r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3];
  44740. this._deformCount = this._frameIntArray[r + 1], this._valueCount = this._frameIntArray[r + 2], this._valueOffset = this._frameIntArray[r + 3], this._frameFloatOffset = this._frameIntArray[r + 4] + this._animationData.frameFloatOffset
  44741. } else this._deformCount = this.surface._deformVertices.length, this._valueCount = this._deformCount, this._valueOffset = 0, this._frameFloatOffset = 0;
  44742. this._current.length = this._valueCount, this._delta.length = this._valueCount, this._result.length = this._valueCount;
  44743. for (var s = 0; s < this._valueCount; ++s) this._delta[s] = 0
  44744. }, e.prototype.blend = function(t) {
  44745. for (var e = this.surface._blendState.blendWeight, i = this.surface._deformVertices, n = 0; n < this._deformCount; ++n) {
  44746. var r = 0;
  44747. r = n < this._valueOffset ? this._frameFloatArray[this._frameFloatOffset + n] : n < this._valueOffset + this._valueCount ? this._result[n - this._valueOffset] : this._frameFloatArray[this._frameFloatOffset + n - this._valueCount], 2 === t ? i[n] += r * e : i[n] = 1 !== e ? r * e : r
  44748. }
  44749. 0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.surface._transformDirty = !0)
  44750. }, e
  44751. })(t.TweenTimelineState);
  44752. t.SurfaceTimelineState = l;
  44753. var h = (function(t) {
  44754. function e() {
  44755. return null !== t && t.apply(this, arguments) || this
  44756. }
  44757. return n(e, t), e.toString = function() {
  44758. return "[class dragonBones.SlotDislayTimelineState]"
  44759. }, e.prototype._onArriveAtFrame = function() {
  44760. if (this.playState >= 0) {
  44761. var t = null !== this._timelineData ? this._frameArray[this._frameOffset + 1] : this.slot._slotData.displayIndex;
  44762. this.slot.displayIndex !== t && this.slot._setDisplayIndex(t, !0)
  44763. }
  44764. }, e
  44765. })(t.SlotTimelineState);
  44766. t.SlotDislayTimelineState = h;
  44767. var c = (function(t) {
  44768. function e() {
  44769. var e = null !== t && t.apply(this, arguments) || this;
  44770. return e._current = [0, 0, 0, 0, 0, 0, 0, 0], e._delta = [0, 0, 0, 0, 0, 0, 0, 0], e._result = [0, 0, 0, 0, 0, 0, 0, 0], e
  44771. }
  44772. return n(e, t), e.toString = function() {
  44773. return "[class dragonBones.SlotColorTimelineState]"
  44774. }, e.prototype._onClear = function() {
  44775. t.prototype._onClear.call(this), this._dirty = !1
  44776. }, e.prototype._onArriveAtFrame = function() {
  44777. if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44778. var e = this._dragonBonesData.intArray,
  44779. i = this._frameIntArray,
  44780. n = this._animationData.frameIntOffset + this._frameValueOffset + 1 * this._frameIndex,
  44781. r = i[n];
  44782. r < 0 && (r += 65536), this._current[0] = e[r++], this._current[1] = e[r++], this._current[2] = e[r++], this._current[3] = e[r++], this._current[4] = e[r++], this._current[5] = e[r++], this._current[6] = e[r++], this._current[7] = e[r++], 2 === this._tweenState && ((r = this._frameIndex === this._frameCount - 1 ? i[this._animationData.frameIntOffset + this._frameValueOffset] : i[n + 1]) < 0 && (r += 65536), this._delta[0] = e[r++] - this._current[0], this._delta[1] = e[r++] - this._current[1], this._delta[2] = e[r++] - this._current[2], this._delta[3] = e[r++] - this._current[3], this._delta[4] = e[r++] - this._current[4], this._delta[5] = e[r++] - this._current[5], this._delta[6] = e[r++] - this._current[6], this._delta[7] = e[r++] - this._current[7])
  44783. } else {
  44784. var s = this.slot._slotData.color;
  44785. this._current[0] = 100 * s.alphaMultiplier, this._current[1] = 100 * s.redMultiplier, this._current[2] = 100 * s.greenMultiplier, this._current[3] = 100 * s.blueMultiplier, this._current[4] = s.alphaOffset, this._current[5] = s.redOffset, this._current[6] = s.greenOffset, this._current[7] = s.blueOffset
  44786. }
  44787. }, e.prototype._onUpdateFrame = function() {
  44788. t.prototype._onUpdateFrame.call(this), this._dirty = !0, 2 !== this._tweenState && (this._tweenState = 0), this._result[0] = .01 * (this._current[0] + this._delta[0] * this._tweenProgress), this._result[1] = .01 * (this._current[1] + this._delta[1] * this._tweenProgress), this._result[2] = .01 * (this._current[2] + this._delta[2] * this._tweenProgress), this._result[3] = .01 * (this._current[3] + this._delta[3] * this._tweenProgress), this._result[4] = this._current[4] + this._delta[4] * this._tweenProgress, this._result[5] = this._current[5] + this._delta[5] * this._tweenProgress, this._result[6] = this._current[6] + this._delta[6] * this._tweenProgress, this._result[7] = this._current[7] + this._delta[7] * this._tweenProgress
  44789. }, e.prototype.fadeOut = function() {
  44790. this._tweenState = 0, this._dirty = !1
  44791. }, e.prototype.update = function(e) {
  44792. if (t.prototype.update.call(this, e), 0 !== this._tweenState || this._dirty) {
  44793. var i = this.slot._colorTransform;
  44794. if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) {
  44795. if (i.alphaMultiplier !== this._result[0] || i.redMultiplier !== this._result[1] || i.greenMultiplier !== this._result[2] || i.blueMultiplier !== this._result[3] || i.alphaOffset !== this._result[4] || i.redOffset !== this._result[5] || i.greenOffset !== this._result[6] || i.blueOffset !== this._result[7]) {
  44796. var n = Math.pow(this._animationState._fadeProgress, 4);
  44797. i.alphaMultiplier += (this._result[0] - i.alphaMultiplier) * n, i.redMultiplier += (this._result[1] - i.redMultiplier) * n, i.greenMultiplier += (this._result[2] - i.greenMultiplier) * n, i.blueMultiplier += (this._result[3] - i.blueMultiplier) * n, i.alphaOffset += (this._result[4] - i.alphaOffset) * n, i.redOffset += (this._result[5] - i.redOffset) * n, i.greenOffset += (this._result[6] - i.greenOffset) * n, i.blueOffset += (this._result[7] - i.blueOffset) * n, this.slot._colorDirty = !0
  44798. }
  44799. } else this._dirty && (this._dirty = !1, i.alphaMultiplier === this._result[0] && i.redMultiplier === this._result[1] && i.greenMultiplier === this._result[2] && i.blueMultiplier === this._result[3] && i.alphaOffset === this._result[4] && i.redOffset === this._result[5] && i.greenOffset === this._result[6] && i.blueOffset === this._result[7] || (i.alphaMultiplier = this._result[0], i.redMultiplier = this._result[1], i.greenMultiplier = this._result[2], i.blueMultiplier = this._result[3], i.alphaOffset = this._result[4], i.redOffset = this._result[5], i.greenOffset = this._result[6], i.blueOffset = this._result[7], this.slot._colorDirty = !0))
  44800. }
  44801. }, e
  44802. })(t.SlotTimelineState);
  44803. t.SlotColorTimelineState = c;
  44804. var u = (function(t) {
  44805. function e() {
  44806. var e = null !== t && t.apply(this, arguments) || this;
  44807. return e._current = [], e._delta = [], e._result = [], e
  44808. }
  44809. return n(e, t), e.toString = function() {
  44810. return "[class dragonBones.DeformTimelineState]"
  44811. }, e.prototype._onClear = function() {
  44812. t.prototype._onClear.call(this), this.vertexOffset = 0, this._dirty = !1, this._frameFloatOffset = 0, this._valueCount = 0, this._deformCount = 0, this._valueOffset = 0, this._current.length = 0, this._delta.length = 0, this._result.length = 0
  44813. }, e.prototype._onArriveAtFrame = function() {
  44814. if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44815. var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount,
  44816. i = this._armature._armatureData.scale,
  44817. n = this._frameFloatArray;
  44818. if (2 === this._tweenState) {
  44819. var r = e + this._valueCount;
  44820. this._frameIndex === this._frameCount - 1 && (r = this._animationData.frameFloatOffset + this._frameValueOffset);
  44821. for (var s = 0; s < this._valueCount; ++s) this._delta[s] = n[r + s] * i - (this._current[s] = n[e + s] * i)
  44822. } else
  44823. for (s = 0; s < this._valueCount; ++s) this._current[s] = n[e + s] * i
  44824. } else
  44825. for (s = 0; s < this._valueCount; ++s) this._current[s] = 0
  44826. }, e.prototype._onUpdateFrame = function() {
  44827. t.prototype._onUpdateFrame.call(this), this._dirty = !0, 2 !== this._tweenState && (this._tweenState = 0);
  44828. for (var e = 0; e < this._valueCount; ++e) this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress
  44829. }, e.prototype.init = function(e, i, n) {
  44830. if (t.prototype.init.call(this, e, i, n), null !== this._timelineData) {
  44831. var r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3];
  44832. this.vertexOffset = this._frameIntArray[r + 0], this.vertexOffset < 0 && (this.vertexOffset += 65536), this._deformCount = this._frameIntArray[r + 1], this._valueCount = this._frameIntArray[r + 2], this._valueOffset = this._frameIntArray[r + 3], this._frameFloatOffset = this._frameIntArray[r + 4] + this._animationData.frameFloatOffset
  44833. } else {
  44834. var s = this.slot._deformVertices;
  44835. this._deformCount = null !== s ? s.vertices.length : 0, this._valueCount = this._deformCount, this._valueOffset = 0, this._frameFloatOffset = 0
  44836. }
  44837. this._current.length = this._valueCount, this._delta.length = this._valueCount, this._result.length = this._valueCount;
  44838. for (var o = 0; o < this._valueCount; ++o) this._delta[o] = 0
  44839. }, e.prototype.fadeOut = function() {
  44840. this._tweenState = 0, this._dirty = !1
  44841. }, e.prototype.update = function(e) {
  44842. var i = this.slot._deformVertices;
  44843. if (null !== i && null !== i.verticesData && i.verticesData.offset === this.vertexOffset && (t.prototype.update.call(this, e), 0 !== this._tweenState || this._dirty)) {
  44844. var n = i.vertices;
  44845. if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) {
  44846. for (var r = Math.pow(this._animationState._fadeProgress, 2), s = 0; s < this._deformCount; ++s) s < this._valueOffset ? n[s] += (this._frameFloatArray[this._frameFloatOffset + s] - n[s]) * r : s < this._valueOffset + this._valueCount ? n[s] += (this._result[s - this._valueOffset] - n[s]) * r : n[s] += (this._frameFloatArray[this._frameFloatOffset + s - this._valueCount] - n[s]) * r;
  44847. i.verticesDirty = !0
  44848. } else if (this._dirty) {
  44849. this._dirty = !1;
  44850. for (s = 0; s < this._deformCount; ++s) s < this._valueOffset ? n[s] = this._frameFloatArray[this._frameFloatOffset + s] : s < this._valueOffset + this._valueCount ? n[s] = this._result[s - this._valueOffset] : n[s] = this._frameFloatArray[this._frameFloatOffset + s - this._valueCount];
  44851. i.verticesDirty = !0
  44852. }
  44853. }
  44854. }, e
  44855. })(t.SlotTimelineState);
  44856. t.DeformTimelineState = u;
  44857. var _ = (function(t) {
  44858. function e() {
  44859. return null !== t && t.apply(this, arguments) || this
  44860. }
  44861. return n(e, t), e.toString = function() {
  44862. return "[class dragonBones.IKConstraintTimelineState]"
  44863. }, e.prototype._onClear = function() {
  44864. t.prototype._onClear.call(this), this._current = 0, this._delta = 0
  44865. }, e.prototype._onArriveAtFrame = function() {
  44866. t.prototype._onArriveAtFrame.call(this);
  44867. var e = this.constraint;
  44868. if (null !== this._timelineData) {
  44869. var i = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex,
  44870. n = this._frameIntArray,
  44871. r = 0 !== n[i++];
  44872. this._current = .01 * n[i++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (i = this._animationData.frameIntOffset + this._frameValueOffset), this._delta = .01 * n[i + 1] - this._current) : this._delta = 0, e._bendPositive = r
  44873. } else {
  44874. var s = e._constraintData;
  44875. this._current = s.weight, this._delta = 0, e._bendPositive = s.bendPositive
  44876. }
  44877. e.invalidUpdate()
  44878. }, e.prototype._onUpdateFrame = function() {
  44879. t.prototype._onUpdateFrame.call(this), 2 !== this._tweenState && (this._tweenState = 0);
  44880. var e = this.constraint;
  44881. e._weight = this._current + this._delta * this._tweenProgress, e.invalidUpdate()
  44882. }, e
  44883. })(t.ConstraintTimelineState);
  44884. t.IKConstraintTimelineState = _;
  44885. var f = (function(t) {
  44886. function e() {
  44887. var e = null !== t && t.apply(this, arguments) || this;
  44888. return e._floats = [0, 0, 0, 0, 0, 0], e
  44889. }
  44890. return n(e, t), e.toString = function() {
  44891. return "[class dragonBones.AnimationTimelineState]"
  44892. }, e.prototype._onClear = function() {
  44893. t.prototype._onClear.call(this), this.animationState = null
  44894. }, e.prototype._onArriveAtFrame = function() {
  44895. if (t.prototype._onArriveAtFrame.call(this), null !== this._timelineData) {
  44896. var e = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex,
  44897. i = 1 / this.animationState._animationData.parent.frameRate,
  44898. n = this._frameIntArray;
  44899. this._floats[0] = n[e++] * i, this._floats[3] = .01 * n[e++], 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameIntOffset + this._frameValueOffset), this._floats[1] = n[e++] * i - this._floats[0], this._floats[4] = .01 * n[e++] - this._floats[3]) : (this._floats[1] = 0, this._floats[4] = 0)
  44900. }
  44901. }, e.prototype._onUpdateFrame = function() {
  44902. t.prototype._onUpdateFrame.call(this), 2 !== this._tweenState && (this._tweenState = 0), this._floats[0] >= 0 && (this._floats[2] = this._floats[0] + this._floats[1] * this._tweenProgress), this._floats[5] = this._floats[3] + this._floats[4] * this._tweenProgress
  44903. }, e.prototype.blend = function(t) {
  44904. var e = this.animationState,
  44905. i = e._blendState.blendWeight;
  44906. 2 === t ? (e.weight += this._floats[5] * i, e.currentTime += this._floats[2] * i) : (e.weight = this._floats[5] * i, e.currentTime = this._floats[2] * i)
  44907. }, e
  44908. })(t.TweenTimelineState);
  44909. t.AnimationTimelineState = f
  44910. })(r || (r = {})), (function(t) {
  44911. var e = (function(t) {
  44912. function e() {
  44913. return null !== t && t.apply(this, arguments) || this
  44914. }
  44915. return n(e, t), e.actionDataToInstance = function(t, i, n) {
  44916. 0 === t.type ? i.type = e.FRAME_EVENT : i.type = 10 === t.type ? e.FRAME_EVENT : e.SOUND_EVENT, i.name = t.name, i.armature = n, i.actionData = t, i.data = t.data, null !== t.bone && (i.bone = n.getBone(t.bone.name)), null !== t.slot && (i.slot = n.getSlot(t.slot.name))
  44917. }, e.toString = function() {
  44918. return "[class dragonBones.EventObject]"
  44919. }, e.prototype._onClear = function() {
  44920. this.time = 0, this.type = "", this.name = "", this.armature = null, this.bone = null, this.slot = null, this.animationState = null, this.actionData = null, this.data = null
  44921. }, e.START = "start", e.LOOP_COMPLETE = "loopComplete", e.COMPLETE = "complete", e.FADE_IN = "fadeIn", e.FADE_IN_COMPLETE = "fadeInComplete", e.FADE_OUT = "fadeOut", e.FADE_OUT_COMPLETE = "fadeOutComplete", e.FRAME_EVENT = "frameEvent", e.SOUND_EVENT = "soundEvent", e
  44922. })(t.BaseObject);
  44923. t.EventObject = e
  44924. })(r || (r = {})), (function(t) {
  44925. var e = (function() {
  44926. function e() {}
  44927. return e._getArmatureType = function(t) {
  44928. switch (t.toLowerCase()) {
  44929. case "stage":
  44930. return 2;
  44931. case "armature":
  44932. return 0;
  44933. case "movieclip":
  44934. return 1;
  44935. default:
  44936. return 0
  44937. }
  44938. }, e._getBoneType = function(t) {
  44939. switch (t.toLowerCase()) {
  44940. case "bone":
  44941. return 0;
  44942. case "surface":
  44943. return 1;
  44944. default:
  44945. return 0
  44946. }
  44947. }, e._getDisplayType = function(t) {
  44948. switch (t.toLowerCase()) {
  44949. case "image":
  44950. return 0;
  44951. case "mesh":
  44952. return 2;
  44953. case "armature":
  44954. return 1;
  44955. case "boundingbox":
  44956. return 3;
  44957. case "path":
  44958. return 4;
  44959. default:
  44960. return 0
  44961. }
  44962. }, e._getBoundingBoxType = function(t) {
  44963. switch (t.toLowerCase()) {
  44964. case "rectangle":
  44965. return 0;
  44966. case "ellipse":
  44967. return 1;
  44968. case "polygon":
  44969. return 2;
  44970. default:
  44971. return 0
  44972. }
  44973. }, e._getActionType = function(t) {
  44974. switch (t.toLowerCase()) {
  44975. case "play":
  44976. return 0;
  44977. case "frame":
  44978. return 10;
  44979. case "sound":
  44980. return 11;
  44981. default:
  44982. return 0
  44983. }
  44984. }, e._getBlendMode = function(t) {
  44985. switch (t.toLowerCase()) {
  44986. case "normal":
  44987. return 0;
  44988. case "add":
  44989. return 1;
  44990. case "alpha":
  44991. return 2;
  44992. case "darken":
  44993. return 3;
  44994. case "difference":
  44995. return 4;
  44996. case "erase":
  44997. return 5;
  44998. case "hardlight":
  44999. return 6;
  45000. case "invert":
  45001. return 7;
  45002. case "layer":
  45003. return 8;
  45004. case "lighten":
  45005. return 9;
  45006. case "multiply":
  45007. return 10;
  45008. case "overlay":
  45009. return 11;
  45010. case "screen":
  45011. return 12;
  45012. case "subtract":
  45013. return 13;
  45014. default:
  45015. return 0
  45016. }
  45017. }, e._getPositionMode = function(t) {
  45018. switch (t.toLocaleLowerCase()) {
  45019. case "percent":
  45020. return 1;
  45021. case "fixed":
  45022. return 0;
  45023. default:
  45024. return 1
  45025. }
  45026. }, e._getSpacingMode = function(t) {
  45027. switch (t.toLocaleLowerCase()) {
  45028. case "length":
  45029. return 0;
  45030. case "percent":
  45031. return 2;
  45032. case "fixed":
  45033. return 1;
  45034. default:
  45035. return 0
  45036. }
  45037. }, e._getRotateMode = function(t) {
  45038. switch (t.toLocaleLowerCase()) {
  45039. case "tangent":
  45040. return 0;
  45041. case "chain":
  45042. return 1;
  45043. case "chainscale":
  45044. return 2;
  45045. default:
  45046. return 0
  45047. }
  45048. }, e.parseDragonBonesData = function(e) {
  45049. return console.warn("Deprecated."), e instanceof ArrayBuffer ? t.BinaryDataParser.getInstance().parseDragonBonesData(e) : t.ObjectDataParser.getInstance().parseDragonBonesData(e)
  45050. }, e.parseTextureAtlasData = function(i, n) {
  45051. void 0 === n && (n = 1), console.warn("\u5df2\u5e9f\u5f03");
  45052. for (var r = {}, s = i[e.SUB_TEXTURE], o = 0, a = s.length; o < a; o++) {
  45053. var l = s[o],
  45054. h = l[e.NAME],
  45055. c = new t.Rectangle,
  45056. u = null;
  45057. c.x = l[e.X] / n, c.y = l[e.Y] / n, c.width = l[e.WIDTH] / n, c.height = l[e.HEIGHT] / n, e.FRAME_WIDTH in l && ((u = new t.Rectangle).x = l[e.FRAME_X] / n, u.y = l[e.FRAME_Y] / n, u.width = l[e.FRAME_WIDTH] / n, u.height = l[e.FRAME_HEIGHT] / n), r[h] = {
  45058. region: c,
  45059. frame: u,
  45060. rotated: !1
  45061. }
  45062. }
  45063. return r
  45064. }, e.DATA_VERSION_2_3 = "2.3", e.DATA_VERSION_3_0 = "3.0", e.DATA_VERSION_4_0 = "4.0", e.DATA_VERSION_4_5 = "4.5", e.DATA_VERSION_5_0 = "5.0", e.DATA_VERSION_5_5 = "5.5", e.DATA_VERSION = e.DATA_VERSION_5_5, e.DATA_VERSIONS = [e.DATA_VERSION_4_0, e.DATA_VERSION_4_5, e.DATA_VERSION_5_0, e.DATA_VERSION_5_5], e.TEXTURE_ATLAS = "textureAtlas", e.SUB_TEXTURE = "SubTexture", e.FORMAT = "format", e.IMAGE_PATH = "imagePath", e.WIDTH = "width", e.HEIGHT = "height", e.ROTATED = "rotated", e.FRAME_X = "frameX", e.FRAME_Y = "frameY", e.FRAME_WIDTH = "frameWidth", e.FRAME_HEIGHT = "frameHeight", e.DRADON_BONES = "dragonBones", e.USER_DATA = "userData", e.ARMATURE = "armature", e.BONE = "bone", e.SURFACE = "surface", e.SLOT = "slot", e.CONSTRAINT = "constraint", e.IK = "ik", e.PATH_CONSTRAINT = "path", e.SKIN = "skin", e.DISPLAY = "display", e.ANIMATION = "animation", e.Z_ORDER = "zOrder", e.FFD = "ffd", e.FRAME = "frame", e.TRANSLATE_FRAME = "translateFrame", e.ROTATE_FRAME = "rotateFrame", e.SCALE_FRAME = "scaleFrame", e.DISPLAY_FRAME = "displayFrame", e.COLOR_FRAME = "colorFrame", e.DEFAULT_ACTIONS = "defaultActions", e.ACTIONS = "actions", e.EVENTS = "events", e.INTS = "ints", e.FLOATS = "floats", e.STRINGS = "strings", e.CANVAS = "canvas", e.TRANSFORM = "transform", e.PIVOT = "pivot", e.AABB = "aabb", e.COLOR = "color", e.VERSION = "version", e.COMPATIBLE_VERSION = "compatibleVersion", e.FRAME_RATE = "frameRate", e.TYPE = "type", e.SUB_TYPE = "subType", e.NAME = "name", e.PARENT = "parent", e.TARGET = "target", e.STAGE = "stage", e.SHARE = "share", e.PATH = "path", e.LENGTH = "length", e.DISPLAY_INDEX = "displayIndex", e.BLEND_MODE = "blendMode", e.INHERIT_TRANSLATION = "inheritTranslation", e.INHERIT_ROTATION = "inheritRotation", e.INHERIT_SCALE = "inheritScale", e.INHERIT_REFLECTION = "inheritReflection", e.INHERIT_ANIMATION = "inheritAnimation", e.INHERIT_DEFORM = "inheritDeform", e.SEGMENT_X = "segmentX", e.SEGMENT_Y = "segmentY", e.BEND_POSITIVE = "bendPositive", e.CHAIN = "chain", e.WEIGHT = "weight", e.FADE_IN_TIME = "fadeInTime", e.PLAY_TIMES = "playTimes", e.SCALE = "scale", e.OFFSET = "offset", e.POSITION = "position", e.DURATION = "duration", e.TWEEN_EASING = "tweenEasing", e.TWEEN_ROTATE = "tweenRotate", e.TWEEN_SCALE = "tweenScale", e.CLOCK_WISE = "clockwise", e.CURVE = "curve", e.SOUND = "sound", e.EVENT = "event", e.ACTION = "action", e.X = "x", e.Y = "y", e.SKEW_X = "skX", e.SKEW_Y = "skY", e.SCALE_X = "scX", e.SCALE_Y = "scY", e.VALUE = "value", e.ROTATE = "rotate", e.SKEW = "skew", e.ALPHA_OFFSET = "aO", e.RED_OFFSET = "rO", e.GREEN_OFFSET = "gO", e.BLUE_OFFSET = "bO", e.ALPHA_MULTIPLIER = "aM", e.RED_MULTIPLIER = "rM", e.GREEN_MULTIPLIER = "gM", e.BLUE_MULTIPLIER = "bM", e.UVS = "uvs", e.VERTICES = "vertices", e.TRIANGLES = "triangles", e.WEIGHTS = "weights", e.SLOT_POSE = "slotPose", e.BONE_POSE = "bonePose", e.GLUE_WEIGHTS = "glueWeights", e.GLUE_MESHES = "glueMeshes", e.BONES = "bones", e.POSITION_MODE = "positionMode", e.SPACING_MODE = "spacingMode", e.ROTATE_MODE = "rotateMode", e.SPACING = "spacing", e.ROTATE_OFFSET = "rotateOffset", e.ROTATE_MIX = "rotateMix", e.TRANSLATE_MIX = "translateMix", e.TARGET_DISPLAY = "targetDisplay", e.CLOSED = "closed", e.CONSTANT_SPEED = "constantSpeed", e.VERTEX_COUNT = "vertexCount", e.LENGTHS = "lengths", e.GOTO_AND_PLAY = "gotoAndPlay", e.DEFAULT_NAME = "default", e
  45065. })();
  45066. t.DataParser = e
  45067. })(r || (r = {})), (function(t) {
  45068. var e = (function(e) {
  45069. function r() {
  45070. var i = null !== e && e.apply(this, arguments) || this;
  45071. return i._rawTextureAtlasIndex = 0, i._rawBones = [], i._data = null, i._armature = null, i._bone = null, i._surface = null, i._slot = null, i._skin = null, i._mesh = null, i._animation = null, i._timeline = null, i._rawTextureAtlases = null, i._defaultColorOffset = -1, i._prevClockwise = 0, i._prevRotation = 0, i._helpMatrixA = new t.Matrix, i._helpMatrixB = new t.Matrix, i._helpTransform = new t.Transform, i._helpColorTransform = new t.ColorTransform, i._helpPoint = new t.Point, i._helpArray = [], i._intArray = [], i._floatArray = [], i._frameIntArray = [], i._frameFloatArray = [], i._frameArray = [], i._timelineArray = [], i._cacheRawMeshes = [], i._cacheMeshes = [], i._actionFrames = [], i._weightSlotPose = {}, i._weightBonePoses = {}, i._cacheBones = {}, i._slotChildActions = {}, i
  45072. }
  45073. return n(r, e), r._getBoolean = function(t, e, i) {
  45074. if (e in t) {
  45075. var n = t[e],
  45076. r = typeof n;
  45077. if ("boolean" === r) return n;
  45078. if ("string" !== r) return !!n;
  45079. switch (n) {
  45080. case "0":
  45081. case "NaN":
  45082. case "":
  45083. case "false":
  45084. case "null":
  45085. case "undefined":
  45086. return !1;
  45087. default:
  45088. return !0
  45089. }
  45090. }
  45091. return i
  45092. }, r._getNumber = function(t, e, i) {
  45093. if (e in t) {
  45094. var n = t[e];
  45095. return null === n || "NaN" === n ? i : +n || 0
  45096. }
  45097. return i
  45098. }, r._getString = function(e, i, n) {
  45099. if (i in e) {
  45100. var r = e[i];
  45101. if ("string" === typeof r) {
  45102. if (t.DragonBones.webAssembly)
  45103. for (var s = 0, o = r.length; s < o; ++s)
  45104. if (r.charCodeAt(s) > 255) return encodeURI(r);
  45105. return r
  45106. }
  45107. return String(r)
  45108. }
  45109. return n
  45110. }, r.prototype._getCurvePoint = function(t, e, i, n, r, s, o, a, l, h) {
  45111. var c = 1 - l,
  45112. u = c * c,
  45113. _ = l * l,
  45114. f = c * u,
  45115. d = 3 * l * u,
  45116. p = 3 * c * _,
  45117. m = l * _;
  45118. h.x = f * t + d * i + p * r + m * o, h.y = f * e + d * n + p * s + m * a
  45119. }, r.prototype._samplingEasingCurve = function(t, e) {
  45120. for (var i = t.length, n = -2, r = 0, s = e.length; r < s; ++r) {
  45121. for (var o = (r + 1) / (s + 1);
  45122. (n + 6 < i ? t[n + 6] : 1) < o;) n += 6;
  45123. for (var a = n >= 0 && n + 6 < i, l = a ? t[n] : 0, h = a ? t[n + 1] : 0, c = t[n + 2], u = t[n + 3], _ = t[n + 4], f = t[n + 5], d = a ? t[n + 6] : 1, p = a ? t[n + 7] : 1, m = 0, y = 1; y - m > 1e-4;) {
  45124. var v = .5 * (y + m);
  45125. this._getCurvePoint(l, h, c, u, _, f, d, p, v, this._helpPoint), o - this._helpPoint.x > 0 ? m = v : y = v
  45126. }
  45127. e[r] = this._helpPoint.y
  45128. }
  45129. }, r.prototype._parseActionDataInFrame = function(e, i, n, r) {
  45130. t.DataParser.EVENT in e && this._mergeActionFrame(e[t.DataParser.EVENT], i, 10, n, r), t.DataParser.SOUND in e && this._mergeActionFrame(e[t.DataParser.SOUND], i, 11, n, r), t.DataParser.ACTION in e && this._mergeActionFrame(e[t.DataParser.ACTION], i, 0, n, r), t.DataParser.EVENTS in e && this._mergeActionFrame(e[t.DataParser.EVENTS], i, 10, n, r), t.DataParser.ACTIONS in e && this._mergeActionFrame(e[t.DataParser.ACTIONS], i, 0, n, r)
  45131. }, r.prototype._mergeActionFrame = function(e, n, r, s, o) {
  45132. for (var a = t.DragonBones.webAssembly ? this._armature.actions.size() : this._armature.actions.length, l = this._parseActionData(e, r, s, o), h = 0, c = null, u = 0, _ = l; u < _.length; u++) {
  45133. var f = _[u];
  45134. this._armature.addAction(f, !1)
  45135. }
  45136. 0 === this._actionFrames.length && ((c = new i).frameStart = 0, this._actionFrames.push(c), c = null);
  45137. for (var d = 0, p = this._actionFrames; d < p.length; d++) {
  45138. var m = p[d];
  45139. if (m.frameStart === n) {
  45140. c = m;
  45141. break
  45142. }
  45143. if (m.frameStart > n) break;
  45144. h++
  45145. }
  45146. null === c && ((c = new i).frameStart = n, this._actionFrames.splice(h + 1, 0, c));
  45147. for (var y = 0; y < l.length; ++y) c.actions.push(a + y)
  45148. }, r.prototype._parseArmature = function(e, i) {
  45149. var n = t.BaseObject.borrowObject(t.ArmatureData);
  45150. if (n.name = r._getString(e, t.DataParser.NAME, ""), n.frameRate = r._getNumber(e, t.DataParser.FRAME_RATE, this._data.frameRate), n.scale = i, t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? n.type = t.DataParser._getArmatureType(e[t.DataParser.TYPE]) : n.type = r._getNumber(e, t.DataParser.TYPE, 0), 0 === n.frameRate && (n.frameRate = 24), this._armature = n, t.DataParser.CANVAS in e) {
  45151. var s = e[t.DataParser.CANVAS],
  45152. o = t.BaseObject.borrowObject(t.CanvasData);
  45153. t.DataParser.COLOR in s ? o.hasBackground = !0 : o.hasBackground = !1, o.color = r._getNumber(s, t.DataParser.COLOR, 0), o.x = r._getNumber(s, t.DataParser.X, 0) * n.scale, o.y = r._getNumber(s, t.DataParser.Y, 0) * n.scale, o.width = r._getNumber(s, t.DataParser.WIDTH, 0) * n.scale, o.height = r._getNumber(s, t.DataParser.HEIGHT, 0) * n.scale, n.canvas = o
  45154. }
  45155. if (t.DataParser.AABB in e) {
  45156. var a = e[t.DataParser.AABB];
  45157. n.aabb.x = r._getNumber(a, t.DataParser.X, 0) * n.scale, n.aabb.y = r._getNumber(a, t.DataParser.Y, 0) * n.scale, n.aabb.width = r._getNumber(a, t.DataParser.WIDTH, 0) * n.scale, n.aabb.height = r._getNumber(a, t.DataParser.HEIGHT, 0) * n.scale
  45158. }
  45159. if (t.DataParser.BONE in e)
  45160. for (var l = 0, h = e[t.DataParser.BONE]; l < h.length; l++) {
  45161. var c = h[l],
  45162. u = r._getString(c, t.DataParser.PARENT, ""),
  45163. _ = this._parseBone(c);
  45164. if (u.length > 0) {
  45165. var f = n.getBone(u);
  45166. null !== f ? _.parent = f : (u in this._cacheBones || (this._cacheBones[u] = []), this._cacheBones[u].push(_))
  45167. }
  45168. if (_.name in this._cacheBones) {
  45169. for (var d = 0, p = this._cacheBones[_.name]; d < p.length; d++) {
  45170. p[d].parent = _
  45171. }
  45172. delete this._cacheBones[_.name]
  45173. }
  45174. n.addBone(_), this._rawBones.push(_)
  45175. }
  45176. if (t.DataParser.IK in e)
  45177. for (var m = 0, y = e[t.DataParser.IK]; m < y.length; m++) {
  45178. var v = y[m];
  45179. (M = this._parseIKConstraint(v)) && n.addConstraint(M)
  45180. }
  45181. if (n.sortBones(), t.DataParser.SLOT in e)
  45182. for (var g = 0, x = 0, b = e[t.DataParser.SLOT]; x < b.length; x++) {
  45183. var A = b[x];
  45184. n.addSlot(this._parseSlot(A, g++))
  45185. }
  45186. if (t.DataParser.SKIN in e)
  45187. for (var C = 0, T = e[t.DataParser.SKIN]; C < T.length; C++) {
  45188. var S = T[C];
  45189. n.addSkin(this._parseSkin(S))
  45190. }
  45191. if (t.DataParser.PATH_CONSTRAINT in e)
  45192. for (var w = 0, E = e[t.DataParser.PATH_CONSTRAINT]; w < E.length; w++) {
  45193. var M, D = E[w];
  45194. (M = this._parsePathConstraint(D)) && n.addConstraint(M)
  45195. }
  45196. for (var B = 0, I = this._cacheRawMeshes.length; B < I; ++B) {
  45197. var P = this._cacheRawMeshes[B];
  45198. t.DataParser.GLUE_WEIGHTS in P && t.DataParser.GLUE_MESHES in P && this._parseMeshGlue(P, this._cacheMeshes[B])
  45199. }
  45200. for (B = 0, I = this._cacheRawMeshes.length; B < I; ++B) {
  45201. var R = this._cacheRawMeshes[B],
  45202. O = r._getString(R, t.DataParser.SHARE, "");
  45203. if (0 !== O.length) {
  45204. var L = r._getString(R, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME);
  45205. 0 === L.length && (L = t.DataParser.DEFAULT_NAME);
  45206. var F = n.getMesh(L, "", O);
  45207. if (null !== F) this._cacheMeshes[B].vertices.shareFrom(F.vertices)
  45208. }
  45209. }
  45210. if (t.DataParser.ANIMATION in e)
  45211. for (var N = 0, V = e[t.DataParser.ANIMATION]; N < V.length; N++) {
  45212. var k = V[N],
  45213. G = this._parseAnimation(k);
  45214. n.addAnimation(G)
  45215. }
  45216. if (t.DataParser.DEFAULT_ACTIONS in e)
  45217. for (var U = 0, z = this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS], 0, null, null); U < z.length; U++) {
  45218. var j = z[U];
  45219. if (n.addAction(j, !0), 0 === j.type) null !== (G = n.getAnimation(j.name)) && (n.defaultAnimation = G)
  45220. }
  45221. if (t.DataParser.ACTIONS in e)
  45222. for (var W = 0, H = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); W < H.length; W++) {
  45223. j = H[W];
  45224. n.addAction(j, !1)
  45225. }
  45226. for (var X in this._rawBones.length = 0, this._cacheRawMeshes.length = 0, this._cacheMeshes.length = 0, this._armature = null, this._weightSlotPose) delete this._weightSlotPose[X];
  45227. for (var X in this._weightBonePoses) delete this._weightBonePoses[X];
  45228. for (var X in this._cacheBones) delete this._cacheBones[X];
  45229. for (var X in this._slotChildActions) delete this._slotChildActions[X];
  45230. return n
  45231. }, r.prototype._parseBone = function(e) {
  45232. var i = this._armature.scale;
  45233. if (0 === (t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getBoneType(e[t.DataParser.TYPE]) : r._getNumber(e, t.DataParser.TYPE, 0))) {
  45234. var n = t.BaseObject.borrowObject(t.BoneData);
  45235. return n.inheritTranslation = r._getBoolean(e, t.DataParser.INHERIT_TRANSLATION, !0), n.inheritRotation = r._getBoolean(e, t.DataParser.INHERIT_ROTATION, !0), n.inheritScale = r._getBoolean(e, t.DataParser.INHERIT_SCALE, !0), n.inheritReflection = r._getBoolean(e, t.DataParser.INHERIT_REFLECTION, !0), n.length = r._getNumber(e, t.DataParser.LENGTH, 0) * i, n.name = r._getString(e, t.DataParser.NAME, ""), t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], n.transform, i), n
  45236. }
  45237. var s = t.BaseObject.borrowObject(t.SurfaceData);
  45238. if (s.name = r._getString(e, t.DataParser.NAME, ""), s.segmentX = r._getNumber(e, t.DataParser.SEGMENT_X, 0), s.segmentY = r._getNumber(e, t.DataParser.SEGMENT_Y, 0), s.vertices.length = (s.segmentX + 1) * (s.segmentY + 1) * 2, t.DataParser.VERTICES in e)
  45239. for (var o = e[t.DataParser.VERTICES], a = 0, l = s.vertices.length; a < l; ++a) a < o.length ? s.vertices[a] = o[a] * i : s.vertices[a] = 0;
  45240. return s
  45241. }, r.prototype._parseIKConstraint = function(e) {
  45242. var i = this._armature.getBone(r._getString(e, t.DataParser.BONE, ""));
  45243. if (null === i) return null;
  45244. var n = this._armature.getBone(r._getString(e, t.DataParser.TARGET, ""));
  45245. if (null === n) return null;
  45246. var s = t.BaseObject.borrowObject(t.IKConstraintData);
  45247. return s.scaleEnabled = r._getBoolean(e, t.DataParser.SCALE, !1), s.bendPositive = r._getBoolean(e, t.DataParser.BEND_POSITIVE, !0), s.weight = r._getNumber(e, t.DataParser.WEIGHT, 1), s.name = r._getString(e, t.DataParser.NAME, ""), s.type = 0, s.target = n, r._getNumber(e, t.DataParser.CHAIN, 0) > 0 && null !== i.parent ? (s.root = i.parent, s.bone = i) : (s.root = i, s.bone = null), s
  45248. }, r.prototype._parsePathConstraint = function(e) {
  45249. var i = this._armature.getSlot(r._getString(e, t.DataParser.TARGET, ""));
  45250. if (null === i) return null;
  45251. var n = this._armature.defaultSkin;
  45252. if (null === n) return null;
  45253. var s = n.getDisplay(i.name, r._getString(e, t.DataParser.TARGET_DISPLAY, i.name));
  45254. if (null === s || !(s instanceof t.PathDisplayData)) return null;
  45255. var o = e[t.DataParser.BONES];
  45256. if (null === o || 0 === o.length) return null;
  45257. var a = t.BaseObject.borrowObject(t.PathConstraintData);
  45258. a.name = r._getString(e, t.DataParser.NAME, ""), a.type = 1, a.pathSlot = i, a.pathDisplayData = s, a.target = i.parent, a.positionMode = t.DataParser._getPositionMode(r._getString(e, t.DataParser.POSITION_MODE, "")), a.spacingMode = t.DataParser._getSpacingMode(r._getString(e, t.DataParser.SPACING_MODE, "")), a.rotateMode = t.DataParser._getRotateMode(r._getString(e, t.DataParser.ROTATE_MODE, "")), a.position = r._getNumber(e, t.DataParser.POSITION, 0), a.spacing = r._getNumber(e, t.DataParser.SPACING, 0), a.rotateOffset = r._getNumber(e, t.DataParser.ROTATE_OFFSET, 0), a.rotateMix = r._getNumber(e, t.DataParser.ROTATE_MIX, 1), a.translateMix = r._getNumber(e, t.DataParser.TRANSLATE_MIX, 1);
  45259. for (var l = 0, h = o; l < h.length; l++) {
  45260. var c = h[l],
  45261. u = this._armature.getBone(c);
  45262. null !== u && (a.AddBone(u), null === a.root && (a.root = u))
  45263. }
  45264. return a
  45265. }, r.prototype._parseSlot = function(e, i) {
  45266. var n = t.BaseObject.borrowObject(t.SlotData);
  45267. return n.displayIndex = r._getNumber(e, t.DataParser.DISPLAY_INDEX, 0), n.zOrder = i, n.name = r._getString(e, t.DataParser.NAME, ""), n.parent = this._armature.getBone(r._getString(e, t.DataParser.PARENT, "")), t.DataParser.BLEND_MODE in e && "string" == typeof e[t.DataParser.BLEND_MODE] ? n.blendMode = t.DataParser._getBlendMode(e[t.DataParser.BLEND_MODE]) : n.blendMode = r._getNumber(e, t.DataParser.BLEND_MODE, 0), t.DataParser.COLOR in e ? (n.color = t.SlotData.createColor(), this._parseColorTransform(e[t.DataParser.COLOR], n.color)) : n.color = t.SlotData.DEFAULT_COLOR, t.DataParser.ACTIONS in e && (this._slotChildActions[n.name] = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null)), n
  45268. }, r.prototype._parseSkin = function(e) {
  45269. var i = t.BaseObject.borrowObject(t.SkinData);
  45270. if (i.name = r._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME), t.DataParser.SLOT in e) {
  45271. var n = e[t.DataParser.SLOT];
  45272. this._skin = i;
  45273. for (var s = 0, o = n; s < o.length; s++) {
  45274. var a = o[s],
  45275. l = r._getString(a, t.DataParser.NAME, ""),
  45276. h = this._armature.getSlot(l);
  45277. if (null !== h) {
  45278. if (this._slot = h, t.DataParser.DISPLAY in a)
  45279. for (var c = 0, u = a[t.DataParser.DISPLAY]; c < u.length; c++) {
  45280. var _ = u[c];
  45281. _ ? i.addDisplay(l, this._parseDisplay(_)) : i.addDisplay(l, null)
  45282. }
  45283. this._slot = null
  45284. }
  45285. }
  45286. this._skin = null
  45287. }
  45288. return i
  45289. }, r.prototype._parseDisplay = function(e) {
  45290. var i = r._getString(e, t.DataParser.NAME, ""),
  45291. n = r._getString(e, t.DataParser.PATH, ""),
  45292. s = 0,
  45293. o = null;
  45294. switch (s = t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getDisplayType(e[t.DataParser.TYPE]) : r._getNumber(e, t.DataParser.TYPE, s)) {
  45295. case 0:
  45296. var a = o = t.BaseObject.borrowObject(t.ImageDisplayData);
  45297. a.name = i, a.path = n.length > 0 ? n : i, this._parsePivot(e, a);
  45298. break;
  45299. case 1:
  45300. var l = o = t.BaseObject.borrowObject(t.ArmatureDisplayData);
  45301. if (l.name = i, l.path = n.length > 0 ? n : i, l.inheritAnimation = !0, t.DataParser.ACTIONS in e)
  45302. for (var h = 0, c = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); h < c.length; h++) {
  45303. var u = c[h];
  45304. l.addAction(u)
  45305. } else if (this._slot.name in this._slotChildActions) {
  45306. var _ = this._skin.getDisplays(this._slot.name);
  45307. if (null === _ ? 0 === this._slot.displayIndex : this._slot.displayIndex === _.length) {
  45308. for (var f = 0, d = this._slotChildActions[this._slot.name]; f < d.length; f++) {
  45309. u = d[f];
  45310. l.addAction(u)
  45311. }
  45312. delete this._slotChildActions[this._slot.name]
  45313. }
  45314. }
  45315. break;
  45316. case 2:
  45317. var p = o = t.BaseObject.borrowObject(t.MeshDisplayData);
  45318. p.vertices.inheritDeform = r._getBoolean(e, t.DataParser.INHERIT_DEFORM, !0), p.name = i, p.path = n.length > 0 ? n : i, p.vertices.data = this._data, t.DataParser.SHARE in e ? (this._cacheRawMeshes.push(e), this._cacheMeshes.push(p)) : this._parseMesh(e, p), t.DataParser.GLUE_WEIGHTS in e && t.DataParser.GLUE_MESHES in e && (this._cacheRawMeshes.push(e), this._cacheMeshes.push(p));
  45319. break;
  45320. case 3:
  45321. var m = this._parseBoundingBox(e);
  45322. if (null !== m) {
  45323. var y = o = t.BaseObject.borrowObject(t.BoundingBoxDisplayData);
  45324. y.name = i, y.path = n.length > 0 ? n : i, y.boundingBox = m
  45325. }
  45326. break;
  45327. case 4:
  45328. var v = e[t.DataParser.LENGTHS],
  45329. g = o = t.BaseObject.borrowObject(t.PathDisplayData);
  45330. g.closed = r._getBoolean(e, t.DataParser.CLOSED, !1), g.constantSpeed = r._getBoolean(e, t.DataParser.CONSTANT_SPEED, !1), g.name = i, g.path = n.length > 0 ? n : i, g.vertices.data = this._data, g.curveLengths.length = v.length;
  45331. for (var x = 0, b = v.length; x < b; ++x) g.curveLengths[x] = v[x];
  45332. this._parsePath(e, g)
  45333. }
  45334. return null !== o && t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], o.transform, this._armature.scale), o
  45335. }, r.prototype._parsePath = function(e, i) {
  45336. var n = e[t.DataParser.VERTICES],
  45337. s = r._getNumber(e, t.DataParser.VERTEX_COUNT, 0),
  45338. o = this._floatArray.length,
  45339. a = this._intArray.length;
  45340. if (i.vertices.offset = a, this._intArray.length += 2, this._intArray[a + 0] = s, this._intArray[a + 2] = o, t.DataParser.WEIGHTS in e) {
  45341. var l = e[t.DataParser.WEIGHTS],
  45342. h = e[t.DataParser.BONES],
  45343. c = h.length,
  45344. u = Math.floor(l.length - s) / 2,
  45345. _ = this._intArray.length,
  45346. f = this._floatArray.length,
  45347. d = this._armature.sortedBones,
  45348. p = t.BaseObject.borrowObject(t.WeightData);
  45349. p.count = u, p.offset = _, this._intArray.length += 2 + c + s + u, this._intArray[_ + 0] = c, this._intArray[_ + 1] = f;
  45350. for (M = 0; M < c; M++) {
  45351. var m = h[M],
  45352. y = this._rawBones[m];
  45353. p.addBone(y), this._intArray[_ + 2 + M] = d.indexOf(y)
  45354. }
  45355. this._floatArray.length += 3 * u;
  45356. M = 0;
  45357. for (var v = 0, g = 0, x = _ + 2 + c, b = f; M < u; M++) {
  45358. var A = l[v++];
  45359. this._intArray[x++] = A;
  45360. for (var C = 0; C < A; C++) {
  45361. var T = l[v++],
  45362. S = l[v++],
  45363. w = n[g++],
  45364. E = n[g++];
  45365. this._intArray[x++] = h.indexOf(T), this._floatArray[b++] = S, this._floatArray[b++] = w, this._floatArray[b++] = E
  45366. }
  45367. }
  45368. i.vertices.weight = p
  45369. } else {
  45370. this._floatArray.length += n.length;
  45371. for (var M = 0, D = n.length; M < D; ++M) this._floatArray[o + M] = n[M]
  45372. }
  45373. }, r.prototype._parsePivot = function(e, i) {
  45374. if (t.DataParser.PIVOT in e) {
  45375. var n = e[t.DataParser.PIVOT];
  45376. i.pivot.x = r._getNumber(n, t.DataParser.X, 0), i.pivot.y = r._getNumber(n, t.DataParser.Y, 0)
  45377. } else i.pivot.x = .5, i.pivot.y = .5
  45378. }, r.prototype._parseMesh = function(e, i) {
  45379. var n = e[t.DataParser.VERTICES],
  45380. r = e[t.DataParser.UVS],
  45381. s = e[t.DataParser.TRIANGLES],
  45382. o = Math.floor(n.length / 2),
  45383. a = Math.floor(s.length / 3),
  45384. l = this._floatArray.length,
  45385. h = l + 2 * o,
  45386. c = this._intArray.length,
  45387. u = this._skin.name + "_" + this._slot.name + "_" + i.name;
  45388. i.vertices.offset = c, this._intArray.length += 4 + 3 * a, this._intArray[c + 0] = o, this._intArray[c + 1] = a, this._intArray[c + 2] = l;
  45389. for (var _ = 0, f = 3 * a; _ < f; ++_) this._intArray[c + 4 + _] = s[_];
  45390. this._floatArray.length += 2 * o + 2 * o;
  45391. for (_ = 0, f = 2 * o; _ < f; ++_) this._floatArray[l + _] = n[_], this._floatArray[h + _] = r[_];
  45392. if (t.DataParser.WEIGHTS in e) {
  45393. var d = e[t.DataParser.WEIGHTS],
  45394. p = e[t.DataParser.SLOT_POSE],
  45395. m = e[t.DataParser.BONE_POSE],
  45396. y = this._armature.sortedBones,
  45397. v = new Array,
  45398. g = Math.floor(m.length / 7),
  45399. x = this._floatArray.length,
  45400. b = Math.floor(d.length - o) / 2,
  45401. A = this._intArray.length,
  45402. C = t.BaseObject.borrowObject(t.WeightData);
  45403. C.count = b, C.offset = A, v.length = g, this._intArray.length += 2 + g + o + b, this._intArray[A + 1] = x;
  45404. for (_ = 0; _ < g; ++_) {
  45405. var T = m[7 * _],
  45406. S = this._rawBones[T];
  45407. C.addBone(S), v[_] = T, this._intArray[A + 2 + _] = y.indexOf(S)
  45408. }
  45409. this._floatArray.length += 3 * b, this._helpMatrixA.copyFromArray(p, 0);
  45410. _ = 0;
  45411. for (var w = 0, E = A + 2 + g, M = x; _ < o; ++_) {
  45412. var D = 2 * _,
  45413. B = this._intArray[E++] = d[w++],
  45414. I = this._floatArray[l + D],
  45415. P = this._floatArray[l + D + 1];
  45416. this._helpMatrixA.transformPoint(I, P, this._helpPoint), I = this._helpPoint.x, P = this._helpPoint.y;
  45417. for (var R = 0; R < B; ++R) {
  45418. T = d[w++];
  45419. var O = v.indexOf(T);
  45420. this._helpMatrixB.copyFromArray(m, 7 * O + 1), this._helpMatrixB.invert(), this._helpMatrixB.transformPoint(I, P, this._helpPoint), this._intArray[E++] = O, this._floatArray[M++] = d[w++], this._floatArray[M++] = this._helpPoint.x, this._floatArray[M++] = this._helpPoint.y
  45421. }
  45422. }
  45423. i.vertices.weight = C, this._weightSlotPose[u] = p, this._weightBonePoses[u] = m
  45424. }
  45425. }, r.prototype._parseMeshGlue = function(t, e) {}, r.prototype._parseBoundingBox = function(e) {
  45426. var i = null,
  45427. n = 0;
  45428. switch (n = t.DataParser.SUB_TYPE in e && "string" == typeof e[t.DataParser.SUB_TYPE] ? t.DataParser._getBoundingBoxType(e[t.DataParser.SUB_TYPE]) : r._getNumber(e, t.DataParser.SUB_TYPE, n)) {
  45429. case 0:
  45430. i = t.BaseObject.borrowObject(t.RectangleBoundingBoxData);
  45431. break;
  45432. case 1:
  45433. i = t.BaseObject.borrowObject(t.EllipseBoundingBoxData);
  45434. break;
  45435. case 2:
  45436. i = this._parsePolygonBoundingBox(e)
  45437. }
  45438. return null !== i && (i.color = r._getNumber(e, t.DataParser.COLOR, 0), 0 !== i.type && 1 !== i.type || (i.width = r._getNumber(e, t.DataParser.WIDTH, 0), i.height = r._getNumber(e, t.DataParser.HEIGHT, 0))), i
  45439. }, r.prototype._parsePolygonBoundingBox = function(e) {
  45440. var i = t.BaseObject.borrowObject(t.PolygonBoundingBoxData);
  45441. if (t.DataParser.VERTICES in e) {
  45442. var n = this._armature.scale,
  45443. r = e[t.DataParser.VERTICES],
  45444. s = i.vertices;
  45445. t.DragonBones.webAssembly ? s.resize(r.length, 0) : s.length = r.length;
  45446. for (var o = 0, a = r.length; o < a; o += 2) {
  45447. var l = r[o] * n,
  45448. h = r[o + 1] * n;
  45449. t.DragonBones.webAssembly ? (s.set(o, l), s.set(o + 1, h)) : (s[o] = l, s[o + 1] = h), 0 === o ? (i.x = l, i.y = h, i.width = l, i.height = h) : (l < i.x ? i.x = l : l > i.width && (i.width = l), h < i.y ? i.y = h : h > i.height && (i.height = h))
  45450. }
  45451. i.width -= i.x, i.height -= i.y
  45452. } else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");
  45453. return i
  45454. }, r.prototype._parseAnimation = function(e) {
  45455. var i = t.BaseObject.borrowObject(t.AnimationData);
  45456. if (i.frameCount = Math.max(r._getNumber(e, t.DataParser.DURATION, 1), 1), i.playTimes = r._getNumber(e, t.DataParser.PLAY_TIMES, 1), i.duration = i.frameCount / this._armature.frameRate, i.fadeInTime = r._getNumber(e, t.DataParser.FADE_IN_TIME, 0), i.scale = r._getNumber(e, t.DataParser.SCALE, 1), i.name = r._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME), i.frameIntOffset = this._frameIntArray.length, i.frameFloatOffset = this._frameFloatArray.length, i.frameOffset = this._frameArray.length, this._animation = i, t.DataParser.FRAME in e) {
  45457. var n = e[t.DataParser.FRAME],
  45458. s = n.length;
  45459. if (s > 0)
  45460. for (var o = 0, a = 0; o < s; ++o) {
  45461. var l = n[o];
  45462. this._parseActionDataInFrame(l, a, null, null), a += r._getNumber(l, t.DataParser.DURATION, 1)
  45463. }
  45464. }
  45465. if (t.DataParser.Z_ORDER in e && (this._animation.zOrderTimeline = this._parseTimeline(e[t.DataParser.Z_ORDER], null, t.DataParser.FRAME, 1, !1, !1, 0, this._parseZOrderFrame)), t.DataParser.BONE in e)
  45466. for (var h = 0, c = e[t.DataParser.BONE]; h < c.length; h++) {
  45467. var u = c[h];
  45468. this._parseBoneTimeline(u)
  45469. }
  45470. if (t.DataParser.SURFACE in e)
  45471. for (var _ = 0, f = e[t.DataParser.SURFACE]; _ < f.length; _++) {
  45472. u = f[_];
  45473. var d = r._getString(u, t.DataParser.NAME, "");
  45474. if (this._surface = this._armature.getBone(d), null !== this._surface) null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 50, !1, !0, 0, this._parseSurfaceFrame)) && this._animation.addSurfaceTimeline(this._surface, M), this._surface = null
  45475. }
  45476. if (t.DataParser.SLOT in e)
  45477. for (var p = 0, m = e[t.DataParser.SLOT]; p < m.length; p++) {
  45478. u = m[p];
  45479. this._parseSlotTimeline(u)
  45480. }
  45481. if (t.DataParser.FFD in e)
  45482. for (var y = 0, v = e[t.DataParser.FFD]; y < v.length; y++) {
  45483. u = v[y];
  45484. var g = r._getString(u, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME),
  45485. x = r._getString(u, t.DataParser.SLOT, ""),
  45486. b = r._getString(u, t.DataParser.NAME, "");
  45487. if (0 === g.length && (g = t.DataParser.DEFAULT_NAME), this._slot = this._armature.getSlot(x), this._mesh = this._armature.getMesh(g, x, b), null !== this._slot && null !== this._mesh) null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 22, !1, !0, 0, this._parseSlotFFDFrame)) && this._animation.addSlotTimeline(this._slot, M), this._slot = null, this._mesh = null
  45488. }
  45489. if (t.DataParser.IK in e)
  45490. for (var A = 0, C = e[t.DataParser.IK]; A < C.length; A++) {
  45491. u = C[A];
  45492. var T = r._getString(u, t.DataParser.NAME, ""),
  45493. S = this._armature.getConstraint(T);
  45494. if (null !== S) null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 30, !0, !1, 2, this._parseIKConstraintFrame)) && this._animation.addConstraintTimeline(S, M)
  45495. }
  45496. if (t.DataParser.ANIMATION in e)
  45497. for (var w = 0, E = e[t.DataParser.ANIMATION]; w < E.length; w++) {
  45498. u = E[w];
  45499. var M, D = r._getString(u, t.DataParser.NAME, "");
  45500. null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 40, !0, !1, 2, this._parseAnimationFrame)) && this._animation.addAnimationTimeline(D, M)
  45501. }
  45502. return this._actionFrames.length > 0 && (this._animation.actionTimeline = this._parseTimeline(null, this._actionFrames, "", 0, !1, !1, 0, this._parseActionFrame), this._actionFrames.length = 0), this._animation = null, i
  45503. }, r.prototype._parseTimeline = function(e, n, s, o, a, l, h, c) {
  45504. if (null !== e && s.length > 0 && s in e && (n = e[s]), null === n) return null;
  45505. var u = n.length;
  45506. if (0 === u) return null;
  45507. var _ = this._frameIntArray.length,
  45508. f = this._frameFloatArray.length,
  45509. d = t.BaseObject.borrowObject(t.TimelineData),
  45510. p = this._timelineArray.length;
  45511. if (this._timelineArray.length += 5 + u, null !== e ? (this._timelineArray[p + 0] = Math.round(100 * r._getNumber(e, t.DataParser.SCALE, 1)), this._timelineArray[p + 1] = Math.round(100 * r._getNumber(e, t.DataParser.OFFSET, 0))) : (this._timelineArray[p + 0] = 100, this._timelineArray[p + 1] = 0), this._timelineArray[p + 2] = u, this._timelineArray[p + 3] = h, this._timelineArray[p + 4] = a ? _ - this._animation.frameIntOffset : l ? f - this._animation.frameFloatOffset : 0, this._timeline = d, d.type = o, d.offset = p, 1 === u) d.frameIndicesOffset = -1, this._timelineArray[p + 5 + 0] = c.call(this, n[0], 0, 0) - this._animation.frameOffset;
  45512. else {
  45513. var m = this._animation.frameCount + 1,
  45514. y = this._data.frameIndices,
  45515. v = 0;
  45516. t.DragonBones.webAssembly ? (v = y.size(), y.resize(v + m, 0)) : (v = y.length, y.length += m), d.frameIndicesOffset = v;
  45517. for (var g = 0, x = 0, b = 0, A = 0; g < m; ++g) {
  45518. if (b + A <= g && x < u) {
  45519. var C = n[x];
  45520. b = g, A = x === u - 1 ? this._animation.frameCount - b : C instanceof i ? this._actionFrames[x + 1].frameStart - b : r._getNumber(C, t.DataParser.DURATION, 1), this._timelineArray[p + 5 + x] = c.call(this, C, b, A) - this._animation.frameOffset, x++
  45521. }
  45522. t.DragonBones.webAssembly ? y.set(v + g, x - 1) : y[v + g] = x - 1
  45523. }
  45524. }
  45525. return this._timeline = null, d
  45526. }, r.prototype._parseBoneTimeline = function(e) {
  45527. var i = this._armature.getBone(r._getString(e, t.DataParser.NAME, ""));
  45528. if (null !== i) {
  45529. var n;
  45530. if (this._bone = i, this._slot = this._armature.getSlot(this._bone.name), t.DataParser.TRANSLATE_FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.TRANSLATE_FRAME, 11, !1, !0, 2, this._parseBoneTranslateFrame)) && this._animation.addBoneTimeline(i, n);
  45531. if (t.DataParser.ROTATE_FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.ROTATE_FRAME, 12, !1, !0, 2, this._parseBoneRotateFrame)) && this._animation.addBoneTimeline(i, n);
  45532. if (t.DataParser.SCALE_FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.SCALE_FRAME, 13, !1, !0, 2, this._parseBoneScaleFrame)) && this._animation.addBoneTimeline(i, n);
  45533. if (t.DataParser.FRAME in e) null !== (n = this._parseTimeline(e, null, t.DataParser.FRAME, 10, !1, !0, 6, this._parseBoneAllFrame)) && this._animation.addBoneTimeline(i, n);
  45534. this._bone = null, this._slot = null
  45535. }
  45536. }, r.prototype._parseSlotTimeline = function(e) {
  45537. var i = this._armature.getSlot(r._getString(e, t.DataParser.NAME, ""));
  45538. if (null !== i) {
  45539. this._slot = i;
  45540. var n = null;
  45541. null !== (n = t.DataParser.DISPLAY_FRAME in e ? this._parseTimeline(e, null, t.DataParser.DISPLAY_FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame)) && this._animation.addSlotTimeline(i, n);
  45542. var s = null;
  45543. null !== (s = t.DataParser.COLOR_FRAME in e ? this._parseTimeline(e, null, t.DataParser.COLOR_FRAME, 21, !0, !1, 1, this._parseSlotColorFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 21, !0, !1, 1, this._parseSlotColorFrame)) && this._animation.addSlotTimeline(i, s), this._slot = null
  45544. }
  45545. }, r.prototype._parseFrame = function(t, e, i) {
  45546. var n = this._frameArray.length;
  45547. return this._frameArray.length += 1, this._frameArray[n + 0] = e, n
  45548. }, r.prototype._parseTweenFrame = function(e, i, n) {
  45549. var s = this._parseFrame(e, i, n);
  45550. if (n > 0)
  45551. if (t.DataParser.CURVE in e) {
  45552. var o = n + 1;
  45553. this._helpArray.length = o, this._samplingEasingCurve(e[t.DataParser.CURVE], this._helpArray), this._frameArray.length += 2 + this._helpArray.length, this._frameArray[s + 1] = 2, this._frameArray[s + 2] = o;
  45554. for (var a = 0; a < o; ++a) this._frameArray[s + 3 + a] = Math.round(1e4 * this._helpArray[a])
  45555. } else {
  45556. var l = -2;
  45557. t.DataParser.TWEEN_EASING in e && (l = r._getNumber(e, t.DataParser.TWEEN_EASING, -2)), -2 === l ? (this._frameArray.length += 1, this._frameArray[s + 1] = 0) : 0 === l ? (this._frameArray.length += 1, this._frameArray[s + 1] = 1) : l < 0 ? (this._frameArray.length += 2, this._frameArray[s + 1] = 3, this._frameArray[s + 2] = Math.round(100 * -l)) : l <= 1 ? (this._frameArray.length += 2, this._frameArray[s + 1] = 4, this._frameArray[s + 2] = Math.round(100 * l)) : (this._frameArray.length += 2, this._frameArray[s + 1] = 5, this._frameArray[s + 2] = Math.round(100 * l - 100))
  45558. }
  45559. else this._frameArray.length += 1, this._frameArray[s + 1] = 0;
  45560. return s
  45561. }, r.prototype._parseActionFrame = function(t, e, i) {
  45562. var n = this._frameArray.length,
  45563. r = t.actions.length;
  45564. this._frameArray.length += 2 + r, this._frameArray[n + 0] = e, this._frameArray[n + 0 + 1] = r;
  45565. for (var s = 0; s < r; ++s) this._frameArray[n + 0 + 2 + s] = t.actions[s];
  45566. return n
  45567. }, r.prototype._parseZOrderFrame = function(e, i, n) {
  45568. var r = this._parseFrame(e, i, n);
  45569. if (t.DataParser.Z_ORDER in e) {
  45570. var s = e[t.DataParser.Z_ORDER];
  45571. if (s.length > 0) {
  45572. for (var o = this._armature.sortedSlots.length, a = new Array(o - s.length / 2), l = new Array(o), h = 0; h < a.length; ++h) a[h] = 0;
  45573. for (var c = 0; c < o; ++c) l[c] = -1;
  45574. for (var u = 0, _ = 0, f = 0, d = s.length; f < d; f += 2) {
  45575. for (var p = s[f], m = s[f + 1]; u !== p;) a[_++] = u++;
  45576. l[u + m] = u++
  45577. }
  45578. for (; u < o;) a[_++] = u++;
  45579. this._frameArray.length += 1 + o, this._frameArray[r + 1] = o;
  45580. for (var y = o; y--;) - 1 === l[y] ? this._frameArray[r + 2 + y] = a[--_] || 0 : this._frameArray[r + 2 + y] = l[y] || 0;
  45581. return r
  45582. }
  45583. }
  45584. return this._frameArray.length += 1, this._frameArray[r + 1] = 0, r
  45585. }, r.prototype._parseBoneAllFrame = function(e, i, n) {
  45586. this._helpTransform.identity(), t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], this._helpTransform, 1);
  45587. var s = this._helpTransform.rotation;
  45588. 0 !== i && (0 === this._prevClockwise ? s = this._prevRotation + t.Transform.normalizeRadian(s - this._prevRotation) : ((this._prevClockwise > 0 ? s >= this._prevRotation : s <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1), s = this._prevRotation + s - this._prevRotation + t.Transform.PI_D * this._prevClockwise)), this._prevClockwise = r._getNumber(e, t.DataParser.TWEEN_ROTATE, 0), this._prevRotation = s;
  45589. var o = this._parseTweenFrame(e, i, n),
  45590. a = this._frameFloatArray.length;
  45591. return this._frameFloatArray.length += 6, this._frameFloatArray[a++] = this._helpTransform.x, this._frameFloatArray[a++] = this._helpTransform.y, this._frameFloatArray[a++] = s, this._frameFloatArray[a++] = this._helpTransform.skew, this._frameFloatArray[a++] = this._helpTransform.scaleX, this._frameFloatArray[a++] = this._helpTransform.scaleY, this._parseActionDataInFrame(e, i, this._bone, this._slot), o
  45592. }, r.prototype._parseBoneTranslateFrame = function(e, i, n) {
  45593. var s = this._parseTweenFrame(e, i, n),
  45594. o = this._frameFloatArray.length;
  45595. return this._frameFloatArray.length += 2, this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.X, 0), this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.Y, 0), s
  45596. }, r.prototype._parseBoneRotateFrame = function(e, i, n) {
  45597. var s = r._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD;
  45598. 0 !== i && (0 === this._prevClockwise ? s = this._prevRotation + t.Transform.normalizeRadian(s - this._prevRotation) : ((this._prevClockwise > 0 ? s >= this._prevRotation : s <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1), s = this._prevRotation + s - this._prevRotation + t.Transform.PI_D * this._prevClockwise)), this._prevClockwise = r._getNumber(e, t.DataParser.CLOCK_WISE, 0), this._prevRotation = s;
  45599. var o = this._parseTweenFrame(e, i, n),
  45600. a = this._frameFloatArray.length;
  45601. return this._frameFloatArray.length += 2, this._frameFloatArray[a++] = s, this._frameFloatArray[a++] = r._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD, o
  45602. }, r.prototype._parseBoneScaleFrame = function(e, i, n) {
  45603. var s = this._parseTweenFrame(e, i, n),
  45604. o = this._frameFloatArray.length;
  45605. return this._frameFloatArray.length += 2, this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.X, 1), this._frameFloatArray[o++] = r._getNumber(e, t.DataParser.Y, 1), s
  45606. }, r.prototype._parseSurfaceFrame = function(e, i, n) {
  45607. var s = this._frameFloatArray.length,
  45608. o = this._parseTweenFrame(e, i, n),
  45609. a = e[t.DataParser.VERTICES],
  45610. l = r._getNumber(e, t.DataParser.OFFSET, 0),
  45611. h = this._surface.vertices.length / 2,
  45612. c = 0,
  45613. u = 0;
  45614. this._frameFloatArray.length += 2 * h;
  45615. for (var _ = 0; _ < 2 * h; _ += 2) c = _ < l || _ - l >= a.length ? 0 : a[_ - l], u = _ + 1 < l || _ + 1 - l >= a.length ? 0 : a[_ + 1 - l], this._frameFloatArray[s + _] = c, this._frameFloatArray[s + _ + 1] = u;
  45616. if (0 === i) {
  45617. var f = this._frameIntArray.length;
  45618. this._frameIntArray.length += 5, this._frameIntArray[f + 0] = 0, this._frameIntArray[f + 1] = this._frameFloatArray.length - s, this._frameIntArray[f + 2] = this._frameFloatArray.length - s, this._frameIntArray[f + 3] = 0, this._frameIntArray[f + 4] = s - this._animation.frameFloatOffset, this._timelineArray[this._timeline.offset + 3] = f - this._animation.frameIntOffset
  45619. }
  45620. return o
  45621. }, r.prototype._parseSlotDisplayFrame = function(e, i, n) {
  45622. var s = this._parseFrame(e, i, n);
  45623. return this._frameArray.length += 1, t.DataParser.VALUE in e ? this._frameArray[s + 1] = r._getNumber(e, t.DataParser.VALUE, 0) : this._frameArray[s + 1] = r._getNumber(e, t.DataParser.DISPLAY_INDEX, 0), this._parseActionDataInFrame(e, i, this._slot.parent, this._slot), s
  45624. }, r.prototype._parseSlotColorFrame = function(e, i, n) {
  45625. var r = this._parseTweenFrame(e, i, n),
  45626. s = -1;
  45627. if (t.DataParser.VALUE in e || t.DataParser.COLOR in e) {
  45628. var o = t.DataParser.VALUE in e ? e[t.DataParser.VALUE] : e[t.DataParser.COLOR];
  45629. for (var a in o) {
  45630. this._parseColorTransform(o, this._helpColorTransform), s = this._intArray.length, this._intArray.length += 8, this._intArray[s++] = Math.round(100 * this._helpColorTransform.alphaMultiplier), this._intArray[s++] = Math.round(100 * this._helpColorTransform.redMultiplier), this._intArray[s++] = Math.round(100 * this._helpColorTransform.greenMultiplier), this._intArray[s++] = Math.round(100 * this._helpColorTransform.blueMultiplier), this._intArray[s++] = Math.round(this._helpColorTransform.alphaOffset), this._intArray[s++] = Math.round(this._helpColorTransform.redOffset), this._intArray[s++] = Math.round(this._helpColorTransform.greenOffset), this._intArray[s++] = Math.round(this._helpColorTransform.blueOffset), s -= 8;
  45631. break
  45632. }
  45633. }
  45634. s < 0 && (this._defaultColorOffset < 0 && (this._defaultColorOffset = s = this._intArray.length, this._intArray.length += 8, this._intArray[s++] = 100, this._intArray[s++] = 100, this._intArray[s++] = 100, this._intArray[s++] = 100, this._intArray[s++] = 0, this._intArray[s++] = 0, this._intArray[s++] = 0, this._intArray[s++] = 0), s = this._defaultColorOffset);
  45635. var l = this._frameIntArray.length;
  45636. return this._frameIntArray.length += 1, this._frameIntArray[l] = s, r
  45637. }, r.prototype._parseSlotFFDFrame = function(e, i, n) {
  45638. var s = this._frameFloatArray.length,
  45639. o = this._parseTweenFrame(e, i, n),
  45640. a = t.DataParser.VERTICES in e ? e[t.DataParser.VERTICES] : null,
  45641. l = r._getNumber(e, t.DataParser.OFFSET, 0),
  45642. h = this._intArray[this._mesh.vertices.offset + 0],
  45643. c = this._mesh.parent.name + "_" + this._slot.name + "_" + this._mesh.name,
  45644. u = this._mesh.vertices.weight,
  45645. _ = 0,
  45646. f = 0,
  45647. d = 0,
  45648. p = 0;
  45649. if (null !== u) {
  45650. var m = this._weightSlotPose[c];
  45651. this._helpMatrixA.copyFromArray(m, 0), this._frameFloatArray.length += 2 * u.count, d = u.offset + 2 + u.bones.length
  45652. } else this._frameFloatArray.length += 2 * h;
  45653. for (var y = 0; y < 2 * h; y += 2)
  45654. if (null === a ? (_ = 0, f = 0) : (_ = y < l || y - l >= a.length ? 0 : a[y - l], f = y + 1 < l || y + 1 - l >= a.length ? 0 : a[y + 1 - l]), null !== u) {
  45655. var v = this._weightBonePoses[c],
  45656. g = this._intArray[d++];
  45657. this._helpMatrixA.transformPoint(_, f, this._helpPoint, !0), _ = this._helpPoint.x, f = this._helpPoint.y;
  45658. for (var x = 0; x < g; ++x) {
  45659. var b = this._intArray[d++];
  45660. this._helpMatrixB.copyFromArray(v, 7 * b + 1), this._helpMatrixB.invert(), this._helpMatrixB.transformPoint(_, f, this._helpPoint, !0), this._frameFloatArray[s + p++] = this._helpPoint.x, this._frameFloatArray[s + p++] = this._helpPoint.y
  45661. }
  45662. } else this._frameFloatArray[s + y] = _, this._frameFloatArray[s + y + 1] = f;
  45663. if (0 === i) {
  45664. var A = this._frameIntArray.length;
  45665. this._frameIntArray.length += 5, this._frameIntArray[A + 0] = this._mesh.vertices.offset, this._frameIntArray[A + 1] = this._frameFloatArray.length - s, this._frameIntArray[A + 2] = this._frameFloatArray.length - s, this._frameIntArray[A + 3] = 0, this._frameIntArray[A + 4] = s - this._animation.frameFloatOffset, this._timelineArray[this._timeline.offset + 3] = A - this._animation.frameIntOffset
  45666. }
  45667. return o
  45668. }, r.prototype._parseIKConstraintFrame = function(e, i, n) {
  45669. var s = this._parseTweenFrame(e, i, n),
  45670. o = this._frameIntArray.length;
  45671. return this._frameIntArray.length += 2, this._frameIntArray[o++] = r._getBoolean(e, t.DataParser.BEND_POSITIVE, !0) ? 1 : 0, this._frameIntArray[o++] = Math.round(100 * r._getNumber(e, t.DataParser.WEIGHT, 1)), s
  45672. }, r.prototype._parseAnimationFrame = function(e, i, n) {
  45673. var s = this._parseTweenFrame(e, i, n),
  45674. o = this._frameIntArray.length;
  45675. return this._frameIntArray.length += 2, this._frameIntArray[o++] = r._getNumber(e, t.DataParser.VALUE, 0), this._frameIntArray[o++] = Math.round(100 * r._getNumber(e, t.DataParser.WEIGHT, 1)), s
  45676. }, r.prototype._parseActionData = function(e, i, n, s) {
  45677. var o = new Array;
  45678. if ("string" == typeof e)(c = t.BaseObject.borrowObject(t.ActionData)).type = i, c.name = e, c.bone = n, c.slot = s, o.push(c);
  45679. else if (e instanceof Array)
  45680. for (var a = 0, l = e; a < l.length; a++) {
  45681. var h = l[a],
  45682. c = t.BaseObject.borrowObject(t.ActionData);
  45683. if (t.DataParser.GOTO_AND_PLAY in h ? (c.type = 0, c.name = r._getString(h, t.DataParser.GOTO_AND_PLAY, "")) : (t.DataParser.TYPE in h && "string" == typeof h[t.DataParser.TYPE] ? c.type = t.DataParser._getActionType(h[t.DataParser.TYPE]) : c.type = r._getNumber(h, t.DataParser.TYPE, i), c.name = r._getString(h, t.DataParser.NAME, "")), t.DataParser.BONE in h) {
  45684. var u = r._getString(h, t.DataParser.BONE, "");
  45685. c.bone = this._armature.getBone(u)
  45686. } else c.bone = n;
  45687. if (t.DataParser.SLOT in h) {
  45688. var _ = r._getString(h, t.DataParser.SLOT, "");
  45689. c.slot = this._armature.getSlot(_)
  45690. } else c.slot = s;
  45691. var f = null;
  45692. if (t.DataParser.INTS in h) {
  45693. null === f && (f = t.BaseObject.borrowObject(t.UserData));
  45694. for (var d = 0, p = h[t.DataParser.INTS]; d < p.length; d++) {
  45695. var m = p[d];
  45696. f.addInt(m)
  45697. }
  45698. }
  45699. if (t.DataParser.FLOATS in h) {
  45700. null === f && (f = t.BaseObject.borrowObject(t.UserData));
  45701. for (var y = 0, v = h[t.DataParser.FLOATS]; y < v.length; y++) {
  45702. m = v[y];
  45703. f.addFloat(m)
  45704. }
  45705. }
  45706. if (t.DataParser.STRINGS in h) {
  45707. null === f && (f = t.BaseObject.borrowObject(t.UserData));
  45708. for (var g = 0, x = h[t.DataParser.STRINGS]; g < x.length; g++) {
  45709. m = x[g];
  45710. f.addString(m)
  45711. }
  45712. }
  45713. c.data = f, o.push(c)
  45714. }
  45715. return o
  45716. }, r.prototype._parseTransform = function(e, i, n) {
  45717. i.x = r._getNumber(e, t.DataParser.X, 0) * n, i.y = r._getNumber(e, t.DataParser.Y, 0) * n, t.DataParser.ROTATE in e || t.DataParser.SKEW in e ? (i.rotation = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD), i.skew = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD)) : (t.DataParser.SKEW_X in e || t.DataParser.SKEW_Y in e) && (i.rotation = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.SKEW_Y, 0) * t.Transform.DEG_RAD), i.skew = t.Transform.normalizeRadian(r._getNumber(e, t.DataParser.SKEW_X, 0) * t.Transform.DEG_RAD) - i.rotation), i.scaleX = r._getNumber(e, t.DataParser.SCALE_X, 1), i.scaleY = r._getNumber(e, t.DataParser.SCALE_Y, 1)
  45718. }, r.prototype._parseColorTransform = function(e, i) {
  45719. i.alphaMultiplier = .01 * r._getNumber(e, t.DataParser.ALPHA_MULTIPLIER, 100), i.redMultiplier = .01 * r._getNumber(e, t.DataParser.RED_MULTIPLIER, 100), i.greenMultiplier = .01 * r._getNumber(e, t.DataParser.GREEN_MULTIPLIER, 100), i.blueMultiplier = .01 * r._getNumber(e, t.DataParser.BLUE_MULTIPLIER, 100), i.alphaOffset = r._getNumber(e, t.DataParser.ALPHA_OFFSET, 0), i.redOffset = r._getNumber(e, t.DataParser.RED_OFFSET, 0), i.greenOffset = r._getNumber(e, t.DataParser.GREEN_OFFSET, 0), i.blueOffset = r._getNumber(e, t.DataParser.BLUE_OFFSET, 0)
  45720. }, r.prototype._parseArray = function(t) {
  45721. this._intArray.length = 0, this._floatArray.length = 0, this._frameIntArray.length = 0, this._frameFloatArray.length = 0, this._frameArray.length = 0, this._timelineArray.length = 0
  45722. }, r.prototype._modifyArray = function() {
  45723. this._intArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._intArray.push(0), this._frameIntArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameIntArray.push(0), this._frameArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameArray.push(0), this._timelineArray.length % Uint16Array.BYTES_PER_ELEMENT != 0 && this._timelineArray.push(0);
  45724. var e = this._intArray.length * Int16Array.BYTES_PER_ELEMENT,
  45725. i = this._floatArray.length * Float32Array.BYTES_PER_ELEMENT,
  45726. n = this._frameIntArray.length * Int16Array.BYTES_PER_ELEMENT,
  45727. r = this._frameFloatArray.length * Float32Array.BYTES_PER_ELEMENT,
  45728. s = this._frameArray.length * Int16Array.BYTES_PER_ELEMENT,
  45729. o = this._timelineArray.length * Uint16Array.BYTES_PER_ELEMENT,
  45730. a = e + i + n + r + s + o;
  45731. if (t.DragonBones.webAssembly) {
  45732. for (var l = t.webAssemblyModule.HEAP16.buffer, h = t.webAssemblyModule._malloc(a), c = new Int16Array(l, h, this._intArray.length), u = new Float32Array(l, h + e, this._floatArray.length), _ = new Int16Array(l, h + e + i, this._frameIntArray.length), f = new Float32Array(l, h + e + i + n, this._frameFloatArray.length), d = new Int16Array(l, h + e + i + n + r, this._frameArray.length), p = new Uint16Array(l, h + e + i + n + r + s, this._timelineArray.length), m = 0, y = this._intArray.length; m < y; ++m) c[m] = this._intArray[m];
  45733. for (m = 0, y = this._floatArray.length; m < y; ++m) u[m] = this._floatArray[m];
  45734. for (m = 0, y = this._frameIntArray.length; m < y; ++m) _[m] = this._frameIntArray[m];
  45735. for (m = 0, y = this._frameFloatArray.length; m < y; ++m) f[m] = this._frameFloatArray[m];
  45736. for (m = 0, y = this._frameArray.length; m < y; ++m) d[m] = this._frameArray[m];
  45737. for (m = 0, y = this._timelineArray.length; m < y; ++m) p[m] = this._timelineArray[m];
  45738. t.webAssemblyModule.setDataBinary(this._data, h, e, i, n, r, s, o)
  45739. } else {
  45740. var v = new ArrayBuffer(a);
  45741. for (c = new Int16Array(v, 0, this._intArray.length), u = new Float32Array(v, e, this._floatArray.length), _ = new Int16Array(v, e + i, this._frameIntArray.length), f = new Float32Array(v, e + i + n, this._frameFloatArray.length), d = new Int16Array(v, e + i + n + r, this._frameArray.length), p = new Uint16Array(v, e + i + n + r + s, this._timelineArray.length), m = 0, y = this._intArray.length; m < y; ++m) c[m] = this._intArray[m];
  45742. for (m = 0, y = this._floatArray.length; m < y; ++m) u[m] = this._floatArray[m];
  45743. for (m = 0, y = this._frameIntArray.length; m < y; ++m) _[m] = this._frameIntArray[m];
  45744. for (m = 0, y = this._frameFloatArray.length; m < y; ++m) f[m] = this._frameFloatArray[m];
  45745. for (m = 0, y = this._frameArray.length; m < y; ++m) d[m] = this._frameArray[m];
  45746. for (m = 0, y = this._timelineArray.length; m < y; ++m) p[m] = this._timelineArray[m];
  45747. this._data.binary = v, this._data.intArray = c, this._data.floatArray = u, this._data.frameIntArray = _, this._data.frameFloatArray = f, this._data.frameArray = d, this._data.timelineArray = p
  45748. }
  45749. this._defaultColorOffset = -1
  45750. }, r.prototype.parseDragonBonesData = function(e, i) {
  45751. void 0 === i && (i = 1), console.assert(null !== e && void 0 !== e, "Data error.");
  45752. var n = r._getString(e, t.DataParser.VERSION, ""),
  45753. s = r._getString(e, t.DataParser.COMPATIBLE_VERSION, "");
  45754. if (t.DataParser.DATA_VERSIONS.indexOf(n) >= 0 || t.DataParser.DATA_VERSIONS.indexOf(s) >= 0) {
  45755. var o = t.BaseObject.borrowObject(t.DragonBonesData);
  45756. if (o.version = n, o.name = r._getString(e, t.DataParser.NAME, ""), o.frameRate = r._getNumber(e, t.DataParser.FRAME_RATE, 24), 0 === o.frameRate && (o.frameRate = 24), t.DataParser.ARMATURE in e) {
  45757. this._data = o, this._parseArray(e);
  45758. for (var a = 0, l = e[t.DataParser.ARMATURE]; a < l.length; a++) {
  45759. var h = l[a];
  45760. o.addArmature(this._parseArmature(h, i))
  45761. }
  45762. this._data.binary || this._modifyArray(), t.DataParser.STAGE in e ? o.stage = o.getArmature(r._getString(e, t.DataParser.STAGE, "")) : o.armatureNames.length > 0 && (o.stage = o.getArmature(o.armatureNames[0])), this._data = null
  45763. }
  45764. return t.DataParser.TEXTURE_ATLAS in e && (this._rawTextureAtlases = e[t.DataParser.TEXTURE_ATLAS]), o
  45765. }
  45766. return console.assert(!1, "Nonsupport data version: " + n + "\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"), null
  45767. }, r.prototype.parseTextureAtlasData = function(e, i, n) {
  45768. if (void 0 === n && (n = 1), console.assert(void 0 !== e), null === e) {
  45769. if (null === this._rawTextureAtlases || 0 === this._rawTextureAtlases.length) return !1;
  45770. var s = this._rawTextureAtlases[this._rawTextureAtlasIndex++];
  45771. return this.parseTextureAtlasData(s, i, n), this._rawTextureAtlasIndex >= this._rawTextureAtlases.length && (this._rawTextureAtlasIndex = 0, this._rawTextureAtlases = null), !0
  45772. }
  45773. if (i.width = r._getNumber(e, t.DataParser.WIDTH, 0), i.height = r._getNumber(e, t.DataParser.HEIGHT, 0), i.scale = 1 === n ? 1 / r._getNumber(e, t.DataParser.SCALE, 1) : n, i.name = r._getString(e, t.DataParser.NAME, ""), i.imagePath = r._getString(e, t.DataParser.IMAGE_PATH, ""), t.DataParser.SUB_TEXTURE in e)
  45774. for (var o = e[t.DataParser.SUB_TEXTURE], a = 0, l = o.length; a < l; ++a) {
  45775. var h = o[a],
  45776. c = i.createTexture();
  45777. c.rotated = r._getBoolean(h, t.DataParser.ROTATED, !1), c.name = r._getString(h, t.DataParser.NAME, ""), c.region.x = r._getNumber(h, t.DataParser.X, 0), c.region.y = r._getNumber(h, t.DataParser.Y, 0), c.region.width = r._getNumber(h, t.DataParser.WIDTH, 0), c.region.height = r._getNumber(h, t.DataParser.HEIGHT, 0);
  45778. var u = r._getNumber(h, t.DataParser.FRAME_WIDTH, -1),
  45779. _ = r._getNumber(h, t.DataParser.FRAME_HEIGHT, -1);
  45780. u > 0 && _ > 0 && (c.frame = t.TextureData.createRectangle(), c.frame.x = r._getNumber(h, t.DataParser.FRAME_X, 0), c.frame.y = r._getNumber(h, t.DataParser.FRAME_Y, 0), c.frame.width = u, c.frame.height = _), i.addTexture(c)
  45781. }
  45782. return !0
  45783. }, r.getInstance = function() {
  45784. return null === r._objectDataParserInstance && (r._objectDataParserInstance = new r), r._objectDataParserInstance
  45785. }, r._objectDataParserInstance = null, r
  45786. })(t.DataParser);
  45787. t.ObjectDataParser = e;
  45788. var i = (function() {
  45789. return function() {
  45790. this.frameStart = 0, this.actions = []
  45791. }
  45792. })();
  45793. t.ActionFrame = i
  45794. })(r || (r = {})), (function(t) {
  45795. var e = (function(e) {
  45796. function i() {
  45797. return null !== e && e.apply(this, arguments) || this
  45798. }
  45799. return n(i, e), i.prototype._inRange = function(t, e, i) {
  45800. return e <= t && t <= i
  45801. }, i.prototype._decodeUTF8 = function(t) {
  45802. for (var e, i = 0, n = "", r = 0, s = 0, o = 0, a = 0; t.length > i;) {
  45803. var l = t[i++];
  45804. if (-1 === l) e = 0 !== s ? 65533 : -1;
  45805. else if (0 === s) this._inRange(l, 0, 127) ? e = l : (this._inRange(l, 194, 223) ? (s = 1, a = 128, r = l - 192) : this._inRange(l, 224, 239) ? (s = 2, a = 2048, r = l - 224) : this._inRange(l, 240, 244) && (s = 3, a = 65536, r = l - 240), r *= Math.pow(64, s), e = null);
  45806. else if (this._inRange(l, 128, 191))
  45807. if (o += 1, r += (l - 128) * Math.pow(64, s - o), o !== s) e = null;
  45808. else {
  45809. var h = r,
  45810. c = a;
  45811. r = 0, s = 0, o = 0, a = 0, e = this._inRange(h, c, 1114111) && !this._inRange(h, 55296, 57343) ? h : l
  45812. }
  45813. else r = 0, s = 0, o = 0, a = 0, i--, e = l;
  45814. null !== e && -1 !== e && (e <= 65535 ? e > 0 && (n += String.fromCharCode(e)) : (e -= 65536, n += String.fromCharCode(55296 + (e >> 10 & 1023)), n += String.fromCharCode(56320 + (1023 & e))))
  45815. }
  45816. return n
  45817. }, i.prototype._getUTF16Key = function(t) {
  45818. for (var e = 0, i = t.length; e < i; ++e)
  45819. if (t.charCodeAt(e) > 255) return encodeURI(t);
  45820. return t
  45821. }, i.prototype._parseBinaryTimeline = function(e, i, n) {
  45822. void 0 === n && (n = null);
  45823. var r = null !== n ? n : t.BaseObject.borrowObject(t.TimelineData);
  45824. r.type = e, r.offset = i, this._timeline = r;
  45825. var s = this._timelineArrayBuffer[r.offset + 2];
  45826. if (1 === s) r.frameIndicesOffset = -1;
  45827. else {
  45828. var o = 0,
  45829. a = this._animation.frameCount + 1,
  45830. l = this._data.frameIndices;
  45831. t.DragonBones.webAssembly ? (o = l.size(), l.resize(o + a, 0)) : (o = l.length, l.length += a), r.frameIndicesOffset = o;
  45832. for (var h = 0, c = 0, u = 0, _ = 0; h < a; ++h) u + _ <= h && c < s && (u = this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[r.offset + 5 + c]], _ = c === s - 1 ? this._animation.frameCount - u : this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[r.offset + 5 + c + 1]] - u, c++), t.DragonBones.webAssembly ? l.set(o + h, c - 1) : l[o + h] = c - 1
  45833. }
  45834. return this._timeline = null, r
  45835. }, i.prototype._parseVertices = function(e, i) {
  45836. i.offset = e[t.DataParser.OFFSET];
  45837. var n = this._intArrayBuffer[i.offset + 3];
  45838. if (n >= 0) {
  45839. var r = t.BaseObject.borrowObject(t.WeightData),
  45840. s = this._intArrayBuffer[i.offset + 0],
  45841. o = this._intArrayBuffer[n + 0];
  45842. r.offset = n;
  45843. for (var a = 0; a < o; ++a) {
  45844. var l = this._intArrayBuffer[n + 2 + a];
  45845. r.addBone(this._rawBones[l])
  45846. }
  45847. for (var h = n + 2 + o, c = 0, u = (a = 0, s); a < u; ++a) {
  45848. var _ = this._intArrayBuffer[h++];
  45849. c += _, h += _
  45850. }
  45851. r.count = c, i.weight = r
  45852. }
  45853. }, i.prototype._parseMesh = function(t, e) {
  45854. this._parseVertices(t, e.vertices)
  45855. }, i.prototype._parsePath = function(t, e) {
  45856. this._parseVertices(t, e.vertices)
  45857. }, i.prototype._parseAnimation = function(e) {
  45858. var i = t.BaseObject.borrowObject(t.AnimationData);
  45859. i.frameCount = Math.max(t.ObjectDataParser._getNumber(e, t.DataParser.DURATION, 1), 1), i.playTimes = t.ObjectDataParser._getNumber(e, t.DataParser.PLAY_TIMES, 1), i.duration = i.frameCount / this._armature.frameRate, i.fadeInTime = t.ObjectDataParser._getNumber(e, t.DataParser.FADE_IN_TIME, 0), i.scale = t.ObjectDataParser._getNumber(e, t.DataParser.SCALE, 1), i.name = t.ObjectDataParser._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME);
  45860. var n = e[t.DataParser.OFFSET];
  45861. if (i.frameIntOffset = n[0], i.frameFloatOffset = n[1], i.frameOffset = n[2], this._animation = i, t.DataParser.ACTION in e && (i.actionTimeline = this._parseBinaryTimeline(0, e[t.DataParser.ACTION])), t.DataParser.Z_ORDER in e && (i.zOrderTimeline = this._parseBinaryTimeline(1, e[t.DataParser.Z_ORDER])), t.DataParser.BONE in e) {
  45862. var r = e[t.DataParser.BONE];
  45863. for (var s in r) {
  45864. var o = r[s];
  45865. t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
  45866. var a = this._armature.getBone(s);
  45867. if (null !== a)
  45868. for (var l = 0, h = o.length; l < h; l += 2) {
  45869. var c = o[l],
  45870. u = o[l + 1],
  45871. _ = this._parseBinaryTimeline(c, u);
  45872. this._animation.addBoneTimeline(a, _)
  45873. }
  45874. }
  45875. }
  45876. if (t.DataParser.SURFACE in e) {
  45877. r = e[t.DataParser.SURFACE];
  45878. for (var s in r) {
  45879. o = r[s];
  45880. t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
  45881. var f = this._armature.getBone(s);
  45882. if (null !== f)
  45883. for (l = 0, h = o.length; l < h; l += 2) {
  45884. c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
  45885. this._animation.addSurfaceTimeline(f, _)
  45886. }
  45887. }
  45888. }
  45889. if (t.DataParser.SLOT in e) {
  45890. r = e[t.DataParser.SLOT];
  45891. for (var s in r) {
  45892. o = r[s];
  45893. t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
  45894. var d = this._armature.getSlot(s);
  45895. if (null !== d)
  45896. for (l = 0, h = o.length; l < h; l += 2) {
  45897. c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
  45898. this._animation.addSlotTimeline(d, _)
  45899. }
  45900. }
  45901. }
  45902. if (t.DataParser.CONSTRAINT in e) {
  45903. r = e[t.DataParser.CONSTRAINT];
  45904. for (var s in r) {
  45905. o = r[s];
  45906. t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
  45907. var p = this._armature.getConstraint(s);
  45908. if (null !== p)
  45909. for (l = 0, h = o.length; l < h; l += 2) {
  45910. c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
  45911. this._animation.addConstraintTimeline(p, _)
  45912. }
  45913. }
  45914. }
  45915. if (t.DataParser.ANIMATION in e) {
  45916. r = e[t.DataParser.ANIMATION];
  45917. for (var s in r) {
  45918. o = r[s];
  45919. t.DragonBones.webAssembly && (s = this._getUTF16Key(s));
  45920. for (l = 0, h = o.length; l < h; l += 2) {
  45921. c = o[l], u = o[l + 1], _ = this._parseBinaryTimeline(c, u);
  45922. this._animation.addAnimationTimeline(s, _)
  45923. }
  45924. }
  45925. }
  45926. return this._animation = null, i
  45927. }, i.prototype._parseArray = function(e) {
  45928. var i = e[t.DataParser.OFFSET],
  45929. n = i[1],
  45930. r = i[3],
  45931. s = i[5],
  45932. o = i[7],
  45933. a = i[9],
  45934. l = i[11],
  45935. h = new Int16Array(this._binary, this._binaryOffset + i[0], n / Int16Array.BYTES_PER_ELEMENT),
  45936. c = new Float32Array(this._binary, this._binaryOffset + i[2], r / Float32Array.BYTES_PER_ELEMENT),
  45937. u = new Int16Array(this._binary, this._binaryOffset + i[4], s / Int16Array.BYTES_PER_ELEMENT),
  45938. _ = new Float32Array(this._binary, this._binaryOffset + i[6], o / Float32Array.BYTES_PER_ELEMENT),
  45939. f = new Int16Array(this._binary, this._binaryOffset + i[8], a / Int16Array.BYTES_PER_ELEMENT),
  45940. d = new Uint16Array(this._binary, this._binaryOffset + i[10], l / Uint16Array.BYTES_PER_ELEMENT);
  45941. if (t.DragonBones.webAssembly) {
  45942. for (var p = n + r + s + o + a + l, m = t.webAssemblyModule._malloc(p), y = new Uint8Array(this._binary, this._binaryOffset, p / Uint8Array.BYTES_PER_ELEMENT), v = new Uint8Array(t.webAssemblyModule.HEAP16.buffer, m, y.length), g = 0, x = y.length; g < x; ++g) v[g] = y[g];
  45943. t.webAssemblyModule.setDataBinary(this._data, m, n, r, s, o, a, l), this._intArrayBuffer = h, this._floatArrayBuffer = c, this._frameIntArrayBuffer = u, this._frameFloatArrayBuffer = _, this._frameArrayBuffer = f, this._timelineArrayBuffer = d
  45944. } else this._data.binary = this._binary, this._data.intArray = this._intArrayBuffer = h, this._data.floatArray = this._floatArrayBuffer = c, this._data.frameIntArray = this._frameIntArrayBuffer = u, this._data.frameFloatArray = this._frameFloatArrayBuffer = _, this._data.frameArray = this._frameArrayBuffer = f, this._data.timelineArray = this._timelineArrayBuffer = d
  45945. }, i.prototype.parseDragonBonesData = function(t, i) {
  45946. void 0 === i && (i = 1), console.assert(null !== t && void 0 !== t && t instanceof ArrayBuffer, "Data error.");
  45947. var n = new Uint8Array(t, 0, 8);
  45948. if (n[0] !== "D".charCodeAt(0) || n[1] !== "B".charCodeAt(0) || n[2] !== "D".charCodeAt(0) || n[3] !== "T".charCodeAt(0)) return console.assert(!1, "Nonsupport data."), null;
  45949. var r = new Uint32Array(t, 8, 1)[0],
  45950. s = new Uint8Array(t, 12, r),
  45951. o = this._decodeUTF8(s),
  45952. a = JSON.parse(o);
  45953. return this._binaryOffset = 12 + r, this._binary = t, e.prototype.parseDragonBonesData.call(this, a, i)
  45954. }, i.getInstance = function() {
  45955. return null === i._binaryDataParserInstance && (i._binaryDataParserInstance = new i), i._binaryDataParserInstance
  45956. }, i._binaryDataParserInstance = null, i
  45957. })(t.ObjectDataParser);
  45958. t.BinaryDataParser = e
  45959. })(r || (r = {})), (function(t) {
  45960. var e = (function() {
  45961. function e(i) {
  45962. void 0 === i && (i = null), this.autoSearch = !1, this._dragonBonesDataMap = {}, this._textureAtlasDataMap = {}, this._dragonBones = null, this._dataParser = null, null === e._objectParser && (e._objectParser = new t.ObjectDataParser), null === e._binaryParser && (e._binaryParser = new t.BinaryDataParser), this._dataParser = null !== i ? i : e._objectParser
  45963. }
  45964. return e.prototype._isSupportMesh = function() {
  45965. return !0
  45966. }, e.prototype._getTextureData = function(t, e) {
  45967. if (t in this._textureAtlasDataMap)
  45968. for (var i = 0, n = this._textureAtlasDataMap[t]; i < n.length; i++) {
  45969. if (null !== (l = (a = n[i]).getTexture(e))) return l
  45970. }
  45971. if (this.autoSearch)
  45972. for (var r in this._textureAtlasDataMap)
  45973. for (var s = 0, o = this._textureAtlasDataMap[r]; s < o.length; s++) {
  45974. var a, l;
  45975. if ((a = o[s]).autoSearch)
  45976. if (null !== (l = a.getTexture(e))) return l
  45977. }
  45978. return null
  45979. }, e.prototype._fillBuildArmaturePackage = function(t, e, i, n, r) {
  45980. var s = null,
  45981. o = null;
  45982. if (e.length > 0 && e in this._dragonBonesDataMap && (o = (s = this._dragonBonesDataMap[e]).getArmature(i)), null === o && (0 === e.length || this.autoSearch))
  45983. for (var a in this._dragonBonesDataMap)
  45984. if (s = this._dragonBonesDataMap[a], (0 === e.length || s.autoSearch) && null !== (o = s.getArmature(i))) {
  45985. e = a;
  45986. break
  45987. }
  45988. if (null !== o) {
  45989. if (t.dataName = e, t.textureAtlasName = r, t.data = s, t.armature = o, t.skin = null, n.length > 0 && (t.skin = o.getSkin(n), null === t.skin && this.autoSearch))
  45990. for (var a in this._dragonBonesDataMap) {
  45991. var l = this._dragonBonesDataMap[a].getArmature(n);
  45992. if (null !== l) {
  45993. t.skin = l.defaultSkin;
  45994. break
  45995. }
  45996. }
  45997. return null === t.skin && (t.skin = o.defaultSkin), !0
  45998. }
  45999. return !1
  46000. }, e.prototype._buildBones = function(e, i) {
  46001. for (var n = 0, r = e.armature.sortedBones; n < r.length; n++) {
  46002. var s = r[n];
  46003. t.BaseObject.borrowObject(0 === s.type ? t.Bone : t.Surface).init(s, i)
  46004. }
  46005. }, e.prototype._buildSlots = function(e, i) {
  46006. var n = e.skin,
  46007. r = e.armature.defaultSkin;
  46008. if (null !== n && null !== r) {
  46009. var s = {};
  46010. for (var o in r.displays) {
  46011. var a = r.getDisplays(o);
  46012. s[o] = a
  46013. }
  46014. if (n !== r)
  46015. for (var o in n.displays) {
  46016. a = n.getDisplays(o);
  46017. s[o] = a
  46018. }
  46019. for (var l = 0, h = e.armature.sortedSlots; l < h.length; l++) {
  46020. var c = h[l],
  46021. u = c.name in s ? s[c.name] : null,
  46022. _ = this._buildSlot(e, c, i);
  46023. if (_.rawDisplayDatas = u, null !== u) {
  46024. for (var f = new Array, d = 0, p = t.DragonBones.webAssembly ? u.size() : u.length; d < p; ++d) {
  46025. var m = t.DragonBones.webAssembly ? u.get(d) : u[d];
  46026. null !== m ? f.push(this._getSlotDisplay(e, m, null, _)) : f.push(null)
  46027. }
  46028. _._setDisplayList(f)
  46029. }
  46030. _._setDisplayIndex(c.displayIndex, !0)
  46031. }
  46032. }
  46033. }, e.prototype._buildConstraints = function(e, i) {
  46034. var n = e.armature.constraints;
  46035. for (var r in n) {
  46036. var s = n[r];
  46037. switch (s.type) {
  46038. case 0:
  46039. var o = t.BaseObject.borrowObject(t.IKConstraint);
  46040. o.init(s, i), i._addConstraint(o);
  46041. break;
  46042. case 1:
  46043. var a = t.BaseObject.borrowObject(t.PathConstraint);
  46044. a.init(s, i), i._addConstraint(a);
  46045. break;
  46046. default:
  46047. var l = t.BaseObject.borrowObject(t.IKConstraint);
  46048. l.init(s, i), i._addConstraint(l)
  46049. }
  46050. }
  46051. }, e.prototype._buildChildArmature = function(t, e, i) {
  46052. return this.buildArmature(i.path, null !== t ? t.dataName : "", "", null !== t ? t.textureAtlasName : "")
  46053. }, e.prototype._getSlotDisplay = function(e, i, n, r) {
  46054. var s = null !== e ? e.dataName : i.parent.parent.parent.name,
  46055. o = null;
  46056. switch (i.type) {
  46057. case 0:
  46058. var a = i;
  46059. null !== e && e.textureAtlasName.length > 0 && (a.texture = this._getTextureData(e.textureAtlasName, i.path)), null === a.texture && (a.texture = this._getTextureData(s, i.path)), o = null !== n && 2 === n.type && this._isSupportMesh() ? r.meshDisplay : r.rawDisplay;
  46060. break;
  46061. case 2:
  46062. var l = i;
  46063. null !== e && e.textureAtlasName.length > 0 && (l.texture = this._getTextureData(e.textureAtlasName, l.path)), null === l.texture && (l.texture = this._getTextureData(s, l.path)), o = this._isSupportMesh() ? r.meshDisplay : r.rawDisplay;
  46064. break;
  46065. case 1:
  46066. var h = i,
  46067. c = this._buildChildArmature(e, r, i);
  46068. if (null !== c) {
  46069. if (c.inheritAnimation = h.inheritAnimation, !c.inheritAnimation) {
  46070. var u = h.actions.length > 0 ? h.actions : c.armatureData.defaultActions;
  46071. if (u.length > 0)
  46072. for (var _ = 0, f = u; _ < f.length; _++) {
  46073. var d = f[_],
  46074. p = t.BaseObject.borrowObject(t.EventObject);
  46075. t.EventObject.actionDataToInstance(d, p, r.armature), p.slot = r, r.armature._bufferAction(p, !1)
  46076. } else c.animation.play()
  46077. }
  46078. h.armature = c.armatureData
  46079. }
  46080. o = c
  46081. }
  46082. return o
  46083. }, e.prototype.parseDragonBonesData = function(t, i, n) {
  46084. void 0 === i && (i = null), void 0 === n && (n = 1);
  46085. for (var r = t instanceof ArrayBuffer ? e._binaryParser : this._dataParser, s = r.parseDragonBonesData(t, n);;) {
  46086. var o = this._buildTextureAtlasData(null, null);
  46087. if (!r.parseTextureAtlasData(null, o, n)) {
  46088. o.returnToPool();
  46089. break
  46090. }
  46091. this.addTextureAtlasData(o, i)
  46092. }
  46093. return null !== s && this.addDragonBonesData(s, i), s
  46094. }, e.prototype.parseTextureAtlasData = function(t, e, i, n) {
  46095. void 0 === i && (i = null), void 0 === n && (n = 1);
  46096. var r = this._buildTextureAtlasData(null, null);
  46097. return this._dataParser.parseTextureAtlasData(t, r, n), this._buildTextureAtlasData(r, e || null), this.addTextureAtlasData(r, i), r
  46098. }, e.prototype.updateTextureAtlasData = function(t, e) {
  46099. var i = this.getTextureAtlasData(t);
  46100. if (null !== i)
  46101. for (var n = 0, r = i.length; n < r; ++n) n < e.length && this._buildTextureAtlasData(i[n], e[n])
  46102. }, e.prototype.getDragonBonesData = function(t) {
  46103. return t in this._dragonBonesDataMap ? this._dragonBonesDataMap[t] : null
  46104. }, e.prototype.addDragonBonesData = function(t, e) {
  46105. if (void 0 === e && (e = null), (e = null !== e ? e : t.name) in this._dragonBonesDataMap) {
  46106. if (this._dragonBonesDataMap[e] === t) return;
  46107. console.warn("Can not add same name data: " + e)
  46108. } else this._dragonBonesDataMap[e] = t
  46109. }, e.prototype.removeDragonBonesData = function(t, e) {
  46110. void 0 === e && (e = !0), t in this._dragonBonesDataMap && (e && this._dragonBones.bufferObject(this._dragonBonesDataMap[t]), delete this._dragonBonesDataMap[t])
  46111. }, e.prototype.getTextureAtlasData = function(t) {
  46112. return t in this._textureAtlasDataMap ? this._textureAtlasDataMap[t] : null
  46113. }, e.prototype.addTextureAtlasData = function(t, e) {
  46114. void 0 === e && (e = null);
  46115. var i = (e = null !== e ? e : t.name) in this._textureAtlasDataMap ? this._textureAtlasDataMap[e] : this._textureAtlasDataMap[e] = [];
  46116. i.indexOf(t) < 0 && i.push(t)
  46117. }, e.prototype.removeTextureAtlasData = function(t, e) {
  46118. if (void 0 === e && (e = !0), t in this._textureAtlasDataMap) {
  46119. var i = this._textureAtlasDataMap[t];
  46120. if (e)
  46121. for (var n = 0, r = i; n < r.length; n++) {
  46122. var s = r[n];
  46123. this._dragonBones.bufferObject(s)
  46124. }
  46125. delete this._textureAtlasDataMap[t]
  46126. }
  46127. }, e.prototype.getArmatureData = function(t, e) {
  46128. void 0 === e && (e = "");
  46129. var n = new i;
  46130. return this._fillBuildArmaturePackage(n, e, t, "", "") ? n.armature : null
  46131. }, e.prototype.clear = function(t) {
  46132. for (var e in void 0 === t && (t = !0), this._dragonBonesDataMap) t && this._dragonBones.bufferObject(this._dragonBonesDataMap[e]), delete this._dragonBonesDataMap[e];
  46133. for (var e in this._textureAtlasDataMap) {
  46134. if (t)
  46135. for (var i = 0, n = this._textureAtlasDataMap[e]; i < n.length; i++) {
  46136. var r = n[i];
  46137. this._dragonBones.bufferObject(r)
  46138. }
  46139. delete this._textureAtlasDataMap[e]
  46140. }
  46141. }, e.prototype.buildArmature = function(t, e, n, r) {
  46142. void 0 === e && (e = ""), void 0 === n && (n = ""), void 0 === r && (r = "");
  46143. var s = new i;
  46144. if (!this._fillBuildArmaturePackage(s, e || "", t, n || "", r || "")) return console.warn("No armature data: " + t + ", " + (null !== e ? e : "")), null;
  46145. var o = this._buildArmature(s);
  46146. return this._buildBones(s, o), this._buildSlots(s, o), this._buildConstraints(s, o), o.invalidUpdate(null, !0), o.advanceTime(0), o
  46147. }, e.prototype.replaceDisplay = function(e, i, n) {
  46148. void 0 === n && (n = -1), n < 0 && (n = e.displayIndex), n < 0 && (n = 0), e.replaceDisplayData(i, n);
  46149. var r = e.displayList;
  46150. if (r.length <= n) {
  46151. r.length = n + 1;
  46152. for (var s = 0, o = r.length; s < o; ++s) r[s] || (r[s] = null)
  46153. }
  46154. if (null !== i) {
  46155. var a = e.rawDisplayDatas,
  46156. l = null;
  46157. a && (t.DragonBones.webAssembly ? n < a.size() && (l = a.get(n)) : n < a.length && (l = a[n])), r[n] = this._getSlotDisplay(null, i, l, e)
  46158. } else r[n] = null;
  46159. e.displayList = r
  46160. }, e.prototype.replaceSlotDisplay = function(t, e, i, n, r, s) {
  46161. void 0 === s && (s = -1);
  46162. var o = this.getArmatureData(e, t || "");
  46163. if (!o || !o.defaultSkin) return !1;
  46164. var a = o.defaultSkin.getDisplay(i, n);
  46165. return !!a && (this.replaceDisplay(r, a, s), !0)
  46166. }, e.prototype.replaceSlotDisplayList = function(e, i, n, r) {
  46167. var s = this.getArmatureData(i, e || "");
  46168. if (!s || !s.defaultSkin) return !1;
  46169. var o = s.defaultSkin.getDisplays(n);
  46170. if (!o) return !1;
  46171. for (var a = 0, l = 0, h = t.DragonBones.webAssembly ? o.size() : o.length; l < h; ++l) {
  46172. var c = t.DragonBones.webAssembly ? o.get(l) : o[l];
  46173. this.replaceDisplay(r, c, a++)
  46174. }
  46175. return !0
  46176. }, e.prototype.replaceSkin = function(e, i, n, r) {
  46177. void 0 === n && (n = !1), void 0 === r && (r = null);
  46178. for (var s = !1, o = i.parent.defaultSkin, a = 0, l = e.getSlots(); a < l.length; a++) {
  46179. var h = l[a];
  46180. if (!(null !== r && r.indexOf(h.name) >= 0)) {
  46181. var c = i.getDisplays(h.name);
  46182. if (c || (null !== o && i !== o && (c = o.getDisplays(h.name)), c)) {
  46183. var u = t.DragonBones.webAssembly ? c.size() : c.length,
  46184. _ = h.displayList;
  46185. _.length = u;
  46186. for (var f = 0, d = u; f < d; ++f) {
  46187. var p = t.DragonBones.webAssembly ? c.get(f) : c[f];
  46188. _[f] = null !== p ? this._getSlotDisplay(null, p, null, h) : null
  46189. }
  46190. s = !0, h.rawDisplayDatas = c, h.displayList = _
  46191. } else n && (h.rawDisplayDatas = null, h.displayList = [])
  46192. }
  46193. }
  46194. return s
  46195. }, e.prototype.replaceAnimation = function(e, i, n) {
  46196. void 0 === n && (n = !0);
  46197. var r = i.defaultSkin;
  46198. if (null === r) return !1;
  46199. if (n) e.animation.animations = i.animations;
  46200. else {
  46201. var s = e.animation.animations,
  46202. o = {};
  46203. for (var a in s) o[a] = s[a];
  46204. for (var a in i.animations) o[a] = i.animations[a];
  46205. e.animation.animations = o
  46206. }
  46207. for (var l = 0, h = e.getSlots(); l < h.length; l++)
  46208. for (var c = h[l], u = 0, _ = 0, f = c.displayList; _ < f.length; _++) {
  46209. var d = f[_];
  46210. if (d instanceof t.Armature) {
  46211. var p = r.getDisplays(c.name);
  46212. if (null !== p && u < (t.DragonBones.webAssembly ? p.size() : p.length)) {
  46213. var m = t.DragonBones.webAssembly ? p.get(u) : p[u];
  46214. if (null !== m && 1 === m.type) {
  46215. var y = this.getArmatureData(m.path, m.parent.parent.parent.name);
  46216. y && this.replaceAnimation(d, y, n)
  46217. }
  46218. }
  46219. }
  46220. u++
  46221. }
  46222. return !0
  46223. }, e.prototype.getAllDragonBonesData = function() {
  46224. return this._dragonBonesDataMap
  46225. }, e.prototype.getAllTextureAtlasData = function() {
  46226. return this._textureAtlasDataMap
  46227. }, Object.defineProperty(e.prototype, "clock", {
  46228. get: function() {
  46229. return this._dragonBones.clock
  46230. },
  46231. enumerable: !0,
  46232. configurable: !0
  46233. }), Object.defineProperty(e.prototype, "dragonBones", {
  46234. get: function() {
  46235. return this._dragonBones
  46236. },
  46237. enumerable: !0,
  46238. configurable: !0
  46239. }), e.prototype.changeSkin = function(t, e, i) {
  46240. return void 0 === i && (i = null), this.replaceSkin(t, e, !1, i)
  46241. }, e.prototype.copyAnimationsToArmature = function(t, e, i, n, r) {
  46242. void 0 === i && (i = ""), void 0 === n && (n = ""), void 0 === r && (r = !0);
  46243. var s = this.getArmatureData(e, n);
  46244. return !!s && this.replaceAnimation(t, s, r)
  46245. }, e._objectParser = null, e._binaryParser = null, e
  46246. })();
  46247. t.BaseFactory = e;
  46248. var i = (function() {
  46249. return function() {
  46250. this.dataName = "", this.textureAtlasName = "", this.skin = null
  46251. }
  46252. })();
  46253. t.BuildArmaturePackage = i
  46254. })(r || (r = {})), e.exports = r
  46255. }), {}],
  46256. 411: [(function(t, e, i) {
  46257. "use strict";
  46258. i.__esModule = !0, i.default = void 0;
  46259. var n = (function(t) {
  46260. return t && t.__esModule ? t : {
  46261. default: t
  46262. }
  46263. })(t("../../cocos2d/core/renderer/assembler"));
  46264. function r(t, e) {
  46265. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  46266. }
  46267. function s(t, e) {
  46268. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  46269. return !e || "object" != typeof e && "function" != typeof e ? t : e
  46270. }
  46271. function o(t, e) {
  46272. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  46273. t.prototype = Object.create(e && e.prototype, {
  46274. constructor: {
  46275. value: t,
  46276. enumerable: !1,
  46277. writable: !0,
  46278. configurable: !0
  46279. }
  46280. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  46281. }
  46282. var a = t("./ArmatureDisplay"),
  46283. l = t("../../cocos2d/core/renderer/render-flow"),
  46284. h = cc.gfx,
  46285. c = cc.vmath.mat4,
  46286. u = cc.color(255, 0, 0, 255),
  46287. _ = cc.color(0, 0, 255, 255),
  46288. f = void 0,
  46289. d = void 0,
  46290. p = void 0,
  46291. m = void 0,
  46292. y = void 0,
  46293. v = void 0,
  46294. g = void 0,
  46295. x = void 0,
  46296. b = void 0,
  46297. A = void 0,
  46298. C = void 0,
  46299. T = void 0,
  46300. S = void 0,
  46301. w = void 0,
  46302. E = void 0,
  46303. M = void 0,
  46304. D = void 0,
  46305. B = void 0,
  46306. I = void 0,
  46307. P = void 0,
  46308. R = void 0,
  46309. O = void 0,
  46310. L = void 0,
  46311. F = void 0,
  46312. N = void 0,
  46313. V = void 0,
  46314. k = void 0,
  46315. G = void 0,
  46316. U = void 0,
  46317. z = void 0;
  46318. function j(t, e) {
  46319. if (!t) return null;
  46320. var i = void 0,
  46321. n = void 0;
  46322. switch (e) {
  46323. case 1:
  46324. i = y ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE;
  46325. break;
  46326. case 10:
  46327. i = cc.macro.DST_COLOR, n = cc.macro.ONE_MINUS_SRC_ALPHA;
  46328. break;
  46329. case 12:
  46330. i = cc.macro.ONE, n = cc.macro.ONE_MINUS_SRC_COLOR;
  46331. break;
  46332. case 0:
  46333. default:
  46334. i = y ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE_MINUS_SRC_ALPHA
  46335. }
  46336. var r = !C.enableBatch,
  46337. s = t.getId() + i + n + r,
  46338. o = C.sharedMaterials[0];
  46339. if (!o) return null;
  46340. var a = C._materialCache,
  46341. l = a[s];
  46342. l ? l.texture !== t && (l.setProperty("texture", t), l.updateHash(s)) : (a[o._hash] ? (l = new cc.Material).copy(o) : l = o, l.define("CC_USE_MODEL", r), l.setProperty("texture", t), l.effect.setBlend(!0, h.BLEND_FUNC_ADD, i, n, h.BLEND_FUNC_ADD, i, n), a[s] = l, l.updateHash(s));
  46343. return l
  46344. }
  46345. function W(t, e) {
  46346. L = t.a * e * m, v = y ? L / 255 : 1, P = t.r * f * v, R = t.g * d * v, O = t.b * p * v, I = (L << 24 >>> 0) + (O << 16) + (R << 8) + P
  46347. }
  46348. var H = (function(t) {
  46349. function e() {
  46350. return r(this, e), s(this, t.apply(this, arguments))
  46351. }
  46352. return o(e, t), e.prototype.updateRenderData = function(t, e) {}, e.prototype.realTimeTraverse = function(t, e, i) {
  46353. for (var n = t._slots, r = void 0, s = void 0, o = void 0, a = void 0, l = void 0, h = void 0, u = void 0, _ = void 0, f = void 0, d = void 0, p = 0, m = n.length; p < m; p++)
  46354. if (u = (_ = n[p])._color, _._visible && _._displayData)
  46355. if (e ? _._mulMat(_._worldMatrix, e, _._matrix) : c.copy(_._worldMatrix, _._matrix), _.childArmature) this.realTimeTraverse(_.childArmature, _._worldMatrix, i * u.a / 255);
  46356. else if (a = j(_.getTexture(), _._blendMode)) {
  46357. (g || a._hash !== A.material._hash) && (g = !1, A._flush(), A.node = b, A.material = a), W(u, i), f = _._worldMatrix.m, l = _._localVertices, E = l.length >> 2, h = _._indices, M = h.length, d = x.request(E, M), S = d.indiceOffset, T = d.byteOffset >> 2, w = d.vertexOffset, r = x._vData, s = x._iData, o = x._uintVData, N = f[0], V = f[4], k = f[12], G = f[1], U = f[5], z = f[13];
  46358. for (var y = 0, v = l.length; y < v;) D = l[y++], B = l[y++], r[T++] = D * N + B * V + k, r[T++] = D * G + B * U + z, r[T++] = l[y++], r[T++] = l[y++], o[T++] = I;
  46359. for (var C = 0, P = h.length; C < P; C++) s[S++] = w + h[C]
  46360. }
  46361. }, e.prototype.cacheTraverse = function(t, e) {
  46362. if (t) {
  46363. var i = t.segments;
  46364. if (0 != i.length) {
  46365. var n = void 0,
  46366. r = void 0,
  46367. s = void 0,
  46368. o = void 0,
  46369. a = void 0,
  46370. l = t.vertices,
  46371. h = t.indices,
  46372. c = 0,
  46373. u = 0,
  46374. _ = 0;
  46375. if (e) {
  46376. var f = e.m;
  46377. N = f[0], G = f[1], V = f[4], U = f[5], k = f[12], z = f[13]
  46378. }
  46379. var d = 16 & F,
  46380. p = d && (1 === N && 0 === G && 0 === V && 1 === U),
  46381. m = 0,
  46382. y = t.colors,
  46383. v = y[m++],
  46384. C = v.vfOffset;
  46385. W(v, 1);
  46386. for (var P = 0, R = i.length; P < R; P++) {
  46387. var O = i[P];
  46388. o = j(O.tex, O.blendMode), (g || o._hash !== A.material._hash) && (g = !1, A._flush(), A.node = b, A.material = o), E = O.vertexCount, M = O.indexCount, a = x.request(E, M), S = a.indiceOffset, w = a.vertexOffset, T = a.byteOffset >> 2, n = x._vData, r = x._iData, s = x._uintVData;
  46389. for (var L = S, H = S + M; L < H; L++) r[L] = w + h[u++];
  46390. if (_ = O.vfCount, n.set(l.subarray(c, c + _), T), c += _, p)
  46391. for (var X = T, Y = T + _; X < Y; X += 5) n[X] += k, n[X + 1] += z;
  46392. else if (d)
  46393. for (var q = T, J = T + _; q < J; q += 5) D = n[q], B = n[q + 1], n[q] = D * N + B * V + k, n[q + 1] = D * G + B * U + z;
  46394. if (1 & F)
  46395. for (var Z = c - _, K = T + 4, Q = T + 4 + _; K < Q; K += 5, Z += 5) Z >= C && (W(v = y[m++], 1), C = v.vfOffset), s[K] = I
  46396. }
  46397. }
  46398. }
  46399. }, e.prototype.fillBuffers = function(t, e) {
  46400. t.node._renderFlag |= l.FLAG_UPDATE_RENDER_DATA;
  46401. var i = t._armature;
  46402. if (i) {
  46403. g = !0, y = t.premultipliedAlpha, b = t.node, x = e._meshBuffer, A = e, C = t, F = 0;
  46404. var n = b._color;
  46405. f = n.r / 255, d = n.g / 255, p = n.b / 255, m = n.a / 255, 4294967295 !== n._val && (F |= 1);
  46406. var r = void 0;
  46407. if (C.enableBatch && (r = b._worldMatrix, g = !1, F |= 16), t.isAnimationCached()) this.cacheTraverse(t._curFrame, r);
  46408. else {
  46409. this.realTimeTraverse(i, r, 1);
  46410. var s = t._debugDraw;
  46411. if (t.debugBones && s) {
  46412. s.clear(), s.lineWidth = 5, s.strokeColor = u, s.fillColor = _;
  46413. for (var o = i.getBones(), a = 0, h = o.length; a < h; a++) {
  46414. var c = o[a],
  46415. v = Math.max(c.boneData.length, 5),
  46416. T = c.globalTransformMatrix.tx,
  46417. S = -c.globalTransformMatrix.ty,
  46418. w = T + c.globalTransformMatrix.a * v,
  46419. E = S - c.globalTransformMatrix.b * v;
  46420. s.moveTo(T, S), s.lineTo(w, E), s.stroke()
  46421. }
  46422. }
  46423. }
  46424. b = void 0, x = void 0, A = void 0, C = void 0
  46425. }
  46426. }, e
  46427. })(n.default);
  46428. i.default = H, n.default.register(a, H), e.exports = i.default
  46429. }), {
  46430. "../../cocos2d/core/renderer/assembler": 227,
  46431. "../../cocos2d/core/renderer/render-flow": 248,
  46432. "./ArmatureDisplay": 402
  46433. }],
  46434. 412: [(function(t, e, i) {
  46435. "use strict";
  46436. var n = t("./track-entry-listeners"),
  46437. r = t("../../cocos2d/core/components/CCRenderComponent"),
  46438. s = t("./lib/spine"),
  46439. o = t("../../cocos2d/core/assets/material/CCMaterial"),
  46440. a = t("../../cocos2d/core/graphics/graphics"),
  46441. l = t("./skeleton-cache"),
  46442. h = cc.Enum({
  46443. default: -1
  46444. }),
  46445. c = cc.Enum({
  46446. "<None>": 0
  46447. }),
  46448. u = cc.Enum({
  46449. REALTIME: 0,
  46450. SHARED_CACHE: 1,
  46451. PRIVATE_CACHE: 2
  46452. });
  46453. sp.Skeleton = cc.Class({
  46454. name: "sp.Skeleton",
  46455. extends: r,
  46456. editor: !1,
  46457. statics: {
  46458. AnimationCacheMode: u
  46459. },
  46460. properties: {
  46461. paused: {
  46462. default: !1,
  46463. visible: !1
  46464. },
  46465. skeletonData: {
  46466. default: null,
  46467. type: sp.SkeletonData,
  46468. notify: function() {
  46469. this.defaultSkin = "", this.defaultAnimation = "", this._updateSkeletonData()
  46470. },
  46471. tooltip: !1
  46472. },
  46473. defaultSkin: {
  46474. default: "",
  46475. visible: !1
  46476. },
  46477. defaultAnimation: {
  46478. default: "",
  46479. visible: !1
  46480. },
  46481. animation: {
  46482. get: function() {
  46483. if (this.isAnimationCached()) return this._animationName;
  46484. var t = this.getCurrent(0);
  46485. return t && t.animation.name || ""
  46486. },
  46487. set: function(t) {
  46488. this.defaultAnimation = t, t ? this.setAnimation(0, t, this.loop) : this.isAnimationCached() || (this.clearTrack(0), this.setToSetupPose())
  46489. },
  46490. visible: !1
  46491. },
  46492. _defaultSkinIndex: {
  46493. get: function() {
  46494. if (this.skeletonData && this.defaultSkin) {
  46495. var t = this.skeletonData.getSkinsEnum();
  46496. if (t) {
  46497. var e = t[this.defaultSkin];
  46498. if (void 0 !== e) return e
  46499. }
  46500. }
  46501. return 0
  46502. },
  46503. set: function(t) {
  46504. var e;
  46505. if (this.skeletonData && (e = this.skeletonData.getSkinsEnum()), !e) return cc.errorID("", this.name);
  46506. var i = e[t];
  46507. void 0 !== i ? (this.defaultSkin = i, this.setSkin(this.defaultSkin)) : cc.errorID(7501, this.name)
  46508. },
  46509. type: h,
  46510. visible: !0,
  46511. displayName: "Default Skin",
  46512. tooltip: !1
  46513. },
  46514. _animationIndex: {
  46515. get: function() {
  46516. var t = this.animation;
  46517. if (this.skeletonData && t) {
  46518. var e = this.skeletonData.getAnimsEnum();
  46519. if (e) {
  46520. var i = e[t];
  46521. if (void 0 !== i) return i
  46522. }
  46523. }
  46524. return 0
  46525. },
  46526. set: function(t) {
  46527. if (0 !== t) {
  46528. var e;
  46529. if (this.skeletonData && (e = this.skeletonData.getAnimsEnum()), !e) return cc.errorID(7502, this.name);
  46530. var i = e[t];
  46531. void 0 !== i ? this.animation = i : cc.errorID(7503, this.name)
  46532. } else this.animation = ""
  46533. },
  46534. type: c,
  46535. visible: !0,
  46536. displayName: "Animation",
  46537. tooltip: !1
  46538. },
  46539. _preCacheMode: -1,
  46540. _cacheMode: u.REALTIME,
  46541. _defaultCacheMode: {
  46542. default: 0,
  46543. type: u,
  46544. notify: function() {
  46545. this.setAnimationCacheMode(this._defaultCacheMode)
  46546. },
  46547. editorOnly: !0,
  46548. visible: !0,
  46549. animatable: !1,
  46550. displayName: "Animation Cache Mode",
  46551. tooltip: !1
  46552. },
  46553. loop: {
  46554. default: !0,
  46555. tooltip: !1
  46556. },
  46557. premultipliedAlpha: {
  46558. default: !0,
  46559. tooltip: !1
  46560. },
  46561. timeScale: {
  46562. default: 1,
  46563. tooltip: !1
  46564. },
  46565. debugSlots: {
  46566. default: !1,
  46567. editorOnly: !0,
  46568. tooltip: !1,
  46569. notify: function() {
  46570. this._updateDebugDraw()
  46571. }
  46572. },
  46573. debugBones: {
  46574. default: !1,
  46575. editorOnly: !0,
  46576. tooltip: !1,
  46577. notify: function() {
  46578. this._updateDebugDraw()
  46579. }
  46580. },
  46581. debugMesh: {
  46582. default: !1,
  46583. editorOnly: !0,
  46584. tooltip: !1,
  46585. notify: function() {
  46586. this._updateDebugDraw()
  46587. }
  46588. },
  46589. useTint: {
  46590. default: !1,
  46591. tooltip: !1,
  46592. notify: function() {
  46593. this._updateUseTint()
  46594. }
  46595. },
  46596. enableBatch: {
  46597. default: !1,
  46598. notify: function() {
  46599. this._updateBatch()
  46600. },
  46601. tooltip: !1
  46602. },
  46603. _accTime: 0,
  46604. _playCount: 0,
  46605. _frameCache: null,
  46606. _curFrame: null,
  46607. _skeletonCache: null,
  46608. _animationName: "",
  46609. _animationQueue: [],
  46610. _headAniInfo: null,
  46611. _playTimes: 0,
  46612. _isAniComplete: !0
  46613. },
  46614. ctor: function() {
  46615. this._effectDelegate = null, this._skeleton = null, this._rootBone = null, this._listener = null, this._boundingBox = cc.rect(), this._materialCache = {}, this._debugRenderer = null, this._startSlotIndex = -1, this._endSlotIndex = -1, this._startEntry = {
  46616. animation: {
  46617. name: ""
  46618. },
  46619. trackIndex: 0
  46620. }, this._endEntry = {
  46621. animation: {
  46622. name: ""
  46623. },
  46624. trackIndex: 0
  46625. }
  46626. },
  46627. setMaterial: function(t, e) {
  46628. this._super(t, e), this._materialCache = {}
  46629. },
  46630. _updateUseTint: function() {
  46631. var t = this.getMaterial(0),
  46632. e = this.useTint || this.isAnimationCached();
  46633. t && t.define("USE_TINT", e);
  46634. var i = this._materialCache;
  46635. for (var n in i) {
  46636. var r = i[n];
  46637. r && r.define("USE_TINT", e)
  46638. }
  46639. },
  46640. _updateBatch: function() {
  46641. var t = this.getMaterial(0);
  46642. t && t.define("CC_USE_MODEL", !this.enableBatch);
  46643. var e = this._materialCache;
  46644. for (var i in e) {
  46645. var n = e[i];
  46646. n && n.define("CC_USE_MODEL", !this.enableBatch)
  46647. }
  46648. },
  46649. setSkeletonData: function(t) {
  46650. if (null != t.width && null != t.height && this.node.setContentSize(t.width, t.height), this._cacheMode === u.SHARED_CACHE ? this._skeletonCache = l.sharedCache : this._cacheMode === u.PRIVATE_CACHE && (this._skeletonCache = new l), this.isAnimationCached()) {
  46651. (this.debugBones || this.debugSlots) && cc.warn("Debug bones or slots is invalid in cached mode");
  46652. var e = this._skeletonCache.getSkeletonCache(this.skeletonData._uuid, t);
  46653. this._skeleton = e.skeleton, this._clipper = e.clipper, this._rootBone = this._skeleton.getRootBone()
  46654. } else this._skeleton = new s.Skeleton(t), this._clipper = new s.SkeletonClipping, this._rootBone = this._skeleton.getRootBone();
  46655. this._activateMaterial()
  46656. },
  46657. setSlotsRange: function(t, e) {
  46658. this.isAnimationCached() ? cc.warn("Slots visible range can not be modified in cached mode.") : (this._startSlotIndex = t, this._endSlotIndex = e)
  46659. },
  46660. setAnimationStateData: function(t) {
  46661. if (this.isAnimationCached()) cc.warn("'setAnimationStateData' interface can not be invoked in cached mode.");
  46662. else {
  46663. var e = new s.AnimationState(t);
  46664. this._listener && (this._state && this._state.removeListener(this._listener), e.addListener(this._listener)), this._state = e
  46665. }
  46666. },
  46667. __preload: function() {
  46668. for (var t = this.node.children, e = 0, i = t.length; e < i; e++) {
  46669. var n = t[e];
  46670. n && "DEBUG_DRAW_NODE" === n._name && n.destroy()
  46671. }
  46672. this._resetAssembler(), this._updateSkeletonData(), this._updateDebugDraw(), this._updateUseTint(), this._updateBatch()
  46673. },
  46674. setAnimationCacheMode: function(t) {
  46675. this._preCacheMode !== t && (this._cacheMode = t, this._updateSkeletonData(), this._updateUseTint())
  46676. },
  46677. isAnimationCached: function() {
  46678. return this._cacheMode !== u.REALTIME
  46679. },
  46680. update: function(t) {
  46681. if (!this.paused)
  46682. if (t *= this.timeScale * sp.timeScale, this.isAnimationCached()) {
  46683. if (this._isAniComplete) {
  46684. if (0 === this._animationQueue.length && !this._headAniInfo) {
  46685. var e = this._frameCache;
  46686. if (e && e.isInvalid()) {
  46687. e.updateToFrame();
  46688. var i = e.frames;
  46689. this._curFrame = i[i.length - 1]
  46690. }
  46691. return
  46692. }
  46693. if (this._headAniInfo || (this._headAniInfo = this._animationQueue.shift()), this._accTime += t, this._accTime > this._headAniInfo.delay) {
  46694. var n = this._headAniInfo;
  46695. this._headAniInfo = null, this.setAnimation(0, n.animationName, n.loop)
  46696. }
  46697. return
  46698. }
  46699. this._updateCache(t)
  46700. } else this._updateRealtime(t)
  46701. },
  46702. _emitCacheCompleteEvent: function() {
  46703. this._listener && (this._endEntry.animation.name = this._animationName, this._listener.complete && this._listener.complete(this._endEntry), this._listener.end && this._listener.end(this._endEntry))
  46704. },
  46705. _updateCache: function(t) {
  46706. var e = this._frameCache;
  46707. if (e.isInited()) {
  46708. var i = e.frames,
  46709. n = l.FrameTime;
  46710. 0 == this._accTime && 0 == this._playCount && (this._startEntry.animation.name = this._animationName, this._listener && this._listener.start && this._listener.start(this._startEntry)), this._accTime += t;
  46711. var r = Math.floor(this._accTime / n);
  46712. if (e.isCompleted || e.updateToFrame(r), e.isCompleted && r >= i.length) {
  46713. if (this._playCount++, this._playTimes > 0 && this._playCount >= this._playTimes) return this._curFrame = i[i.length - 1], this._accTime = 0, this._playCount = 0, this._isAniComplete = !0, void this._emitCacheCompleteEvent();
  46714. this._accTime = 0, r = 0, this._emitCacheCompleteEvent()
  46715. }
  46716. this._curFrame = i[r]
  46717. }
  46718. },
  46719. _updateRealtime: function(t) {
  46720. var e = this._skeleton,
  46721. i = this._state;
  46722. e && (e.update(t), i && (i.update(t), i.apply(e)))
  46723. },
  46724. _activateMaterial: function() {
  46725. this.skeletonData ? this.skeletonData.ensureTexturesLoaded((function(t) {
  46726. if (t) {
  46727. var e = this.sharedMaterials[0];
  46728. (e = e ? o.getInstantiatedMaterial(e, this) : o.getInstantiatedBuiltinMaterial("2d-spine", this)).define("CC_USE_MODEL", !0), this._prepareToRender(e)
  46729. } else this.disableRender()
  46730. }), this) : this.disableRender()
  46731. },
  46732. _prepareToRender: function(t) {
  46733. this.setMaterial(0, t), this.node && this.node._renderComponent == this && this.markForRender(!0)
  46734. },
  46735. onEnable: function() {
  46736. this._super(), this._activateMaterial()
  46737. },
  46738. onRestore: function() {
  46739. this._boundingBox = cc.rect()
  46740. },
  46741. setVertexEffectDelegate: function(t) {
  46742. this._effectDelegate = t
  46743. },
  46744. updateWorldTransform: function() {
  46745. this.isAnimationCached() && this._skeleton && this._skeleton.updateWorldTransform()
  46746. },
  46747. setToSetupPose: function() {
  46748. this._skeleton && this._skeleton.setToSetupPose()
  46749. },
  46750. setBonesToSetupPose: function() {
  46751. this._skeleton && this._skeleton.setBonesToSetupPose()
  46752. },
  46753. setSlotsToSetupPose: function() {
  46754. this._skeleton && this._skeleton.setSlotsToSetupPose()
  46755. },
  46756. updateAnimationCache: function(t) {
  46757. if (this.isAnimationCached()) {
  46758. var e = this.skeletonData._uuid;
  46759. this._skeletonCache && this._skeletonCache.updateAnimationCache(e, t)
  46760. }
  46761. },
  46762. invalidAnimationCache: function() {
  46763. this.isAnimationCached() && this._skeletonCache && this._skeletonCache.invalidAnimationCache(this.skeletonData._uuid)
  46764. },
  46765. findBone: function(t) {
  46766. return this._skeleton ? this._skeleton.findBone(t) : null
  46767. },
  46768. findSlot: function(t) {
  46769. return this._skeleton ? this._skeleton.findSlot(t) : null
  46770. },
  46771. setSkin: function(t) {
  46772. this._skeleton && (this._skeleton.setSkinByName(t), this._skeleton.setSlotsToSetupPose()), this.invalidAnimationCache()
  46773. },
  46774. getAttachment: function(t, e) {
  46775. return this._skeleton ? this._skeleton.getAttachmentByName(t, e) : null
  46776. },
  46777. setAttachment: function(t, e) {
  46778. this._skeleton && this._skeleton.setAttachment(t, e), this.invalidAnimationCache()
  46779. },
  46780. getTextureAtlas: function(t) {
  46781. return t.region
  46782. },
  46783. setMix: function(t, e, i) {
  46784. this._state && this._state.data.setMix(t, e, i)
  46785. },
  46786. setAnimation: function(t, e, i) {
  46787. if (this._playTimes = i ? 0 : 1, this._animationName = e, this.isAnimationCached()) {
  46788. if (0 !== t && cc.warn("Track index can not greater than 0 in cached mode."), !this._skeletonCache) return null;
  46789. var n = this._skeletonCache.getAnimationCache(this.skeletonData._uuid, e);
  46790. n || (n = this._skeletonCache.initAnimationCache(this.skeletonData._uuid, e)), n && (this._isAniComplete = !1, this._accTime = 0, this._playCount = 0, this._frameCache = n, this._frameCache.updateToFrame(0), this._curFrame = this._frameCache.frames[0])
  46791. } else if (this._skeleton) {
  46792. var r = this._skeleton.data.findAnimation(e);
  46793. if (!r) return cc.logID(7509, e), null;
  46794. var s = this._state.setAnimationWith(t, r, i);
  46795. return this._state.apply(this._skeleton), s
  46796. }
  46797. return null
  46798. },
  46799. addAnimation: function(t, e, i, n) {
  46800. if (n = n || 0, this.isAnimationCached()) 0 !== t && cc.warn("Track index can not greater than 0 in cached mode."), this._animationQueue.push({
  46801. animationName: e,
  46802. loop: i,
  46803. delay: n
  46804. });
  46805. else if (this._skeleton) {
  46806. var r = this._skeleton.data.findAnimation(e);
  46807. return r ? this._state.addAnimationWith(t, r, i, n) : (cc.logID(7510, e), null)
  46808. }
  46809. return null
  46810. },
  46811. findAnimation: function(t) {
  46812. return this._skeleton ? this._skeleton.data.findAnimation(t) : null
  46813. },
  46814. getCurrent: function(t) {
  46815. if (this.isAnimationCached()) cc.warn("'getCurrent' interface can not be invoked in cached mode.");
  46816. else if (this._state) return this._state.getCurrent(t);
  46817. return null
  46818. },
  46819. clearTracks: function() {
  46820. this.isAnimationCached() ? cc.warn("'clearTracks' interface can not be invoked in cached mode.") : this._state && this._state.clearTracks()
  46821. },
  46822. clearTrack: function(t) {
  46823. this.isAnimationCached() ? cc.warn("'clearTrack' interface can not be invoked in cached mode.") : this._state && this._state.clearTrack(t)
  46824. },
  46825. setStartListener: function(t) {
  46826. this._ensureListener(), this._listener.start = t
  46827. },
  46828. setInterruptListener: function(t) {
  46829. this._ensureListener(), this._listener.interrupt = t
  46830. },
  46831. setEndListener: function(t) {
  46832. this._ensureListener(), this._listener.end = t
  46833. },
  46834. setDisposeListener: function(t) {
  46835. this._ensureListener(), this._listener.dispose = t
  46836. },
  46837. setCompleteListener: function(t) {
  46838. this._ensureListener(), this._listener.complete = t
  46839. },
  46840. setEventListener: function(t) {
  46841. this._ensureListener(), this._listener.event = t
  46842. },
  46843. setTrackStartListener: function(t, e) {
  46844. n.getListeners(t).start = e
  46845. },
  46846. setTrackInterruptListener: function(t, e) {
  46847. n.getListeners(t).interrupt = e
  46848. },
  46849. setTrackEndListener: function(t, e) {
  46850. n.getListeners(t).end = e
  46851. },
  46852. setTrackDisposeListener: function(t, e) {
  46853. n.getListeners(t).dispose = e
  46854. },
  46855. setTrackCompleteListener: function(t, e) {
  46856. n.getListeners(t).complete = function(t) {
  46857. var i = Math.floor(t.trackTime / t.animationEnd);
  46858. e(t, i)
  46859. }
  46860. },
  46861. setTrackEventListener: function(t, e) {
  46862. n.getListeners(t).event = e
  46863. },
  46864. getState: function() {
  46865. return this._state
  46866. },
  46867. _updateAnimEnum: !1,
  46868. _updateSkinEnum: !1,
  46869. _ensureListener: function() {
  46870. this._listener || (this._listener = new n, this._state && this._state.addListener(this._listener))
  46871. },
  46872. _updateSkeletonData: function() {
  46873. if (this.skeletonData) {
  46874. var t = this.skeletonData.getRuntimeData();
  46875. if (t) {
  46876. try {
  46877. this.setSkeletonData(t), this.isAnimationCached() || this.setAnimationStateData(new s.AnimationStateData(this._skeleton.data)), this.defaultSkin && this.setSkin(this.defaultSkin)
  46878. } catch (t) {
  46879. cc.warn(t)
  46880. }
  46881. this._preCacheMode = this._cacheMode, this.animation = this.defaultAnimation
  46882. }
  46883. }
  46884. },
  46885. _refreshInspector: function() {
  46886. this._updateAnimEnum(), this._updateSkinEnum(), Editor.Utils.refreshSelectedInspector("node", this.node.uuid)
  46887. },
  46888. _updateDebugDraw: function() {
  46889. if (this.debugBones || this.debugSlots) {
  46890. if (!this._debugRenderer) {
  46891. var t = new cc.PrivateNode;
  46892. t.name = "DEBUG_DRAW_NODE";
  46893. var e = t.addComponent(a);
  46894. e.lineWidth = 1, e.strokeColor = cc.color(255, 0, 0, 255), this._debugRenderer = e
  46895. }
  46896. this._debugRenderer.node.parent = this.node, this.isAnimationCached() && cc.warn("Debug bones or slots is invalid in cached mode")
  46897. } else this._debugRenderer && (this._debugRenderer.node.parent = null)
  46898. }
  46899. }), e.exports = sp.Skeleton
  46900. }), {
  46901. "../../cocos2d/core/assets/material/CCMaterial": 75,
  46902. "../../cocos2d/core/components/CCRenderComponent": 106,
  46903. "../../cocos2d/core/graphics/graphics": 140,
  46904. "./lib/spine": 414,
  46905. "./skeleton-cache": 415,
  46906. "./track-entry-listeners": 419
  46907. }],
  46908. 413: [(function(t, e, i) {
  46909. "use strict";
  46910. var n = "undefined" == typeof window ? global : window,
  46911. r = !0;
  46912. r && (n.sp = {}, sp._timeScale = 1, Object.defineProperty(sp, "timeScale", {
  46913. get: function() {
  46914. return this._timeScale
  46915. },
  46916. set: function(t) {
  46917. this._timeScale = t
  46918. },
  46919. configurable: !0
  46920. }), sp.ATTACHMENT_TYPE = {
  46921. REGION: 0,
  46922. BOUNDING_BOX: 1,
  46923. MESH: 2,
  46924. SKINNED_MESH: 3
  46925. }, sp.AnimationEventType = cc.Enum({
  46926. START: 0,
  46927. INTERRUPT: 1,
  46928. END: 2,
  46929. DISPOSE: 3,
  46930. COMPLETE: 4,
  46931. EVENT: 5
  46932. }), sp.spine = t("./lib/spine"), t("./skeleton-texture"), t("./skeleton-data"), t("./vertex-effect-delegate"), t("./Skeleton"), t("./spine-assembler"))
  46933. }), {
  46934. "./Skeleton": 412,
  46935. "./lib/spine": 414,
  46936. "./skeleton-data": 416,
  46937. "./skeleton-texture": 417,
  46938. "./spine-assembler": 418,
  46939. "./vertex-effect-delegate": 420
  46940. }],
  46941. 414: [(function(t, e, i) {
  46942. "use strict";
  46943. var n, r = (function() {
  46944. var t = function(e, i) {
  46945. return (t = Object.setPrototypeOf || {
  46946. __proto__: []
  46947. }
  46948. instanceof Array && function(t, e) {
  46949. t.__proto__ = e
  46950. } || function(t, e) {
  46951. for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
  46952. })(e, i)
  46953. };
  46954. return function(e, i) {
  46955. function n() {
  46956. this.constructor = e
  46957. }
  46958. t(e, i), e.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n)
  46959. }
  46960. })();
  46961. (function(t) {
  46962. var e, i, n, s = (function() {
  46963. function t(t, e, i) {
  46964. if (null == t) throw new Error("name cannot be null.");
  46965. if (null == e) throw new Error("timelines cannot be null.");
  46966. this.name = t, this.timelines = e, this.duration = i
  46967. }
  46968. return t.prototype.apply = function(t, e, i, n, r, s, o, a) {
  46969. if (null == t) throw new Error("skeleton cannot be null.");
  46970. n && 0 != this.duration && (i %= this.duration, e > 0 && (e %= this.duration));
  46971. for (var l = this.timelines, h = 0, c = l.length; h < c; h++) l[h].apply(t, e, i, r, s, o, a)
  46972. }, t.binarySearch = function(t, e, i) {
  46973. void 0 === i && (i = 1);
  46974. var n = 0,
  46975. r = t.length / i - 2;
  46976. if (0 == r) return i;
  46977. for (var s = r >>> 1;;) {
  46978. if (t[(s + 1) * i] <= e ? n = s + 1 : r = s, n == r) return (n + 1) * i;
  46979. s = n + r >>> 1
  46980. }
  46981. }, t.linearSearch = function(t, e, i) {
  46982. for (var n = 0, r = t.length - i; n <= r; n += i)
  46983. if (t[n] > e) return n;
  46984. return -1
  46985. }, t
  46986. })();
  46987. t.Animation = s, (function(t) {
  46988. t[t.setup = 0] = "setup", t[t.current = 1] = "current", t[t.currentLayered = 2] = "currentLayered"
  46989. })(e = t.MixPose || (t.MixPose = {})), (function(t) {
  46990. t[t.in = 0] = "in", t[t.out = 1] = "out"
  46991. })(i = t.MixDirection || (t.MixDirection = {})), (function(t) {
  46992. t[t.rotate = 0] = "rotate", t[t.translate = 1] = "translate", t[t.scale = 2] = "scale", t[t.shear = 3] = "shear", t[t.attachment = 4] = "attachment", t[t.color = 5] = "color", t[t.deform = 6] = "deform", t[t.event = 7] = "event", t[t.drawOrder = 8] = "drawOrder", t[t.ikConstraint = 9] = "ikConstraint", t[t.transformConstraint = 10] = "transformConstraint", t[t.pathConstraintPosition = 11] = "pathConstraintPosition", t[t.pathConstraintSpacing = 12] = "pathConstraintSpacing", t[t.pathConstraintMix = 13] = "pathConstraintMix", t[t.twoColor = 14] = "twoColor"
  46993. })(n = t.TimelineType || (t.TimelineType = {}));
  46994. var o = (function() {
  46995. function e(i) {
  46996. if (i <= 0) throw new Error("frameCount must be > 0: " + i);
  46997. this.curves = t.Utils.newFloatArray((i - 1) * e.BEZIER_SIZE)
  46998. }
  46999. return e.prototype.getFrameCount = function() {
  47000. return this.curves.length / e.BEZIER_SIZE + 1
  47001. }, e.prototype.setLinear = function(t) {
  47002. this.curves[t * e.BEZIER_SIZE] = e.LINEAR
  47003. }, e.prototype.setStepped = function(t) {
  47004. this.curves[t * e.BEZIER_SIZE] = e.STEPPED
  47005. }, e.prototype.getCurveType = function(t) {
  47006. var i = t * e.BEZIER_SIZE;
  47007. if (i == this.curves.length) return e.LINEAR;
  47008. var n = this.curves[i];
  47009. return n == e.LINEAR ? e.LINEAR : n == e.STEPPED ? e.STEPPED : e.BEZIER
  47010. }, e.prototype.setCurve = function(t, i, n, r, s) {
  47011. var o = .03 * (2 * -i + r),
  47012. a = .03 * (2 * -n + s),
  47013. l = .006 * (3 * (i - r) + 1),
  47014. h = .006 * (3 * (n - s) + 1),
  47015. c = 2 * o + l,
  47016. u = 2 * a + h,
  47017. _ = .3 * i + o + .16666667 * l,
  47018. f = .3 * n + a + .16666667 * h,
  47019. d = t * e.BEZIER_SIZE,
  47020. p = this.curves;
  47021. p[d++] = e.BEZIER;
  47022. for (var m = _, y = f, v = d + e.BEZIER_SIZE - 1; d < v; d += 2) p[d] = m, p[d + 1] = y, _ += c, f += u, c += l, u += h, m += _, y += f
  47023. }, e.prototype.getCurvePercent = function(i, n) {
  47024. n = t.MathUtils.clamp(n, 0, 1);
  47025. var r = this.curves,
  47026. s = i * e.BEZIER_SIZE,
  47027. o = r[s];
  47028. if (o == e.LINEAR) return n;
  47029. if (o == e.STEPPED) return 0;
  47030. for (var a = 0, l = ++s, h = s + e.BEZIER_SIZE - 1; s < h; s += 2)
  47031. if ((a = r[s]) >= n) {
  47032. var c = void 0,
  47033. u = void 0;
  47034. return s == l ? (c = 0, u = 0) : (c = r[s - 2], u = r[s - 1]), u + (r[s + 1] - u) * (n - c) / (a - c)
  47035. }
  47036. var _ = r[s - 1];
  47037. return _ + (1 - _) * (n - a) / (1 - a)
  47038. }, e.LINEAR = 0, e.STEPPED = 1, e.BEZIER = 2, e.BEZIER_SIZE = 19, e
  47039. })();
  47040. t.CurveTimeline = o;
  47041. var a = (function(i) {
  47042. function o(e) {
  47043. var n = i.call(this, e) || this;
  47044. return n.frames = t.Utils.newFloatArray(e << 1), n
  47045. }
  47046. return r(o, i), o.prototype.getPropertyId = function() {
  47047. return (n.rotate << 24) + this.boneIndex
  47048. }, o.prototype.setFrame = function(t, e, i) {
  47049. t <<= 1, this.frames[t] = e, this.frames[t + o.ROTATION] = i
  47050. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47051. var c = this.frames,
  47052. u = t.bones[this.boneIndex];
  47053. if (n < c[0]) switch (l) {
  47054. case e.setup:
  47055. return void(u.rotation = u.data.rotation);
  47056. case e.current:
  47057. var _ = u.data.rotation - u.rotation;
  47058. _ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0)), u.rotation += _ * a
  47059. } else if (n >= c[c.length - o.ENTRIES])
  47060. if (l == e.setup) u.rotation = u.data.rotation + c[c.length + o.PREV_ROTATION] * a;
  47061. else {
  47062. var f = u.data.rotation + c[c.length + o.PREV_ROTATION] - u.rotation;
  47063. f -= 360 * (16384 - (16384.499999999996 - f / 360 | 0)), u.rotation += f * a
  47064. }
  47065. else {
  47066. var d = s.binarySearch(c, n, o.ENTRIES),
  47067. p = c[d + o.PREV_ROTATION],
  47068. m = c[d],
  47069. y = this.getCurvePercent((d >> 1) - 1, 1 - (n - m) / (c[d + o.PREV_TIME] - m)),
  47070. v = c[d + o.ROTATION] - p;
  47071. v = p + (v -= 360 * (16384 - (16384.499999999996 - v / 360 | 0))) * y, l == e.setup ? (v -= 360 * (16384 - (16384.499999999996 - v / 360 | 0)), u.rotation = u.data.rotation + v * a) : (v = u.data.rotation + v - u.rotation, v -= 360 * (16384 - (16384.499999999996 - v / 360 | 0)), u.rotation += v * a)
  47072. }
  47073. }, o.ENTRIES = 2, o.PREV_TIME = -2, o.PREV_ROTATION = -1, o.ROTATION = 1, o
  47074. })(o);
  47075. t.RotateTimeline = a;
  47076. var l = (function(i) {
  47077. function o(e) {
  47078. var n = i.call(this, e) || this;
  47079. return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
  47080. }
  47081. return r(o, i), o.prototype.getPropertyId = function() {
  47082. return (n.translate << 24) + this.boneIndex
  47083. }, o.prototype.setFrame = function(t, e, i, n) {
  47084. t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.X] = i, this.frames[t + o.Y] = n
  47085. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47086. var c = this.frames,
  47087. u = t.bones[this.boneIndex];
  47088. if (n < c[0]) switch (l) {
  47089. case e.setup:
  47090. return u.x = u.data.x, void(u.y = u.data.y);
  47091. case e.current:
  47092. u.x += (u.data.x - u.x) * a, u.y += (u.data.y - u.y) * a
  47093. } else {
  47094. var _ = 0,
  47095. f = 0;
  47096. if (n >= c[c.length - o.ENTRIES]) _ = c[c.length + o.PREV_X], f = c[c.length + o.PREV_Y];
  47097. else {
  47098. var d = s.binarySearch(c, n, o.ENTRIES);
  47099. _ = c[d + o.PREV_X], f = c[d + o.PREV_Y];
  47100. var p = c[d],
  47101. m = this.getCurvePercent(d / o.ENTRIES - 1, 1 - (n - p) / (c[d + o.PREV_TIME] - p));
  47102. _ += (c[d + o.X] - _) * m, f += (c[d + o.Y] - f) * m
  47103. }
  47104. l == e.setup ? (u.x = u.data.x + _ * a, u.y = u.data.y + f * a) : (u.x += (u.data.x + _ - u.x) * a, u.y += (u.data.y + f - u.y) * a)
  47105. }
  47106. }, o.ENTRIES = 3, o.PREV_TIME = -3, o.PREV_X = -2, o.PREV_Y = -1, o.X = 1, o.Y = 2, o
  47107. })(o);
  47108. t.TranslateTimeline = l;
  47109. var h = (function(o) {
  47110. function a(t) {
  47111. return o.call(this, t) || this
  47112. }
  47113. return r(a, o), a.prototype.getPropertyId = function() {
  47114. return (n.scale << 24) + this.boneIndex
  47115. }, a.prototype.apply = function(n, r, o, l, h, c, u) {
  47116. var _ = this.frames,
  47117. f = n.bones[this.boneIndex];
  47118. if (o < _[0]) switch (c) {
  47119. case e.setup:
  47120. return f.scaleX = f.data.scaleX, void(f.scaleY = f.data.scaleY);
  47121. case e.current:
  47122. f.scaleX += (f.data.scaleX - f.scaleX) * h, f.scaleY += (f.data.scaleY - f.scaleY) * h
  47123. } else {
  47124. var d = 0,
  47125. p = 0;
  47126. if (o >= _[_.length - a.ENTRIES]) d = _[_.length + a.PREV_X] * f.data.scaleX, p = _[_.length + a.PREV_Y] * f.data.scaleY;
  47127. else {
  47128. var m = s.binarySearch(_, o, a.ENTRIES);
  47129. d = _[m + a.PREV_X], p = _[m + a.PREV_Y];
  47130. var y = _[m],
  47131. v = this.getCurvePercent(m / a.ENTRIES - 1, 1 - (o - y) / (_[m + a.PREV_TIME] - y));
  47132. d = (d + (_[m + a.X] - d) * v) * f.data.scaleX, p = (p + (_[m + a.Y] - p) * v) * f.data.scaleY
  47133. }
  47134. if (1 == h) f.scaleX = d, f.scaleY = p;
  47135. else {
  47136. var g = 0,
  47137. x = 0;
  47138. c == e.setup ? (g = f.data.scaleX, x = f.data.scaleY) : (g = f.scaleX, x = f.scaleY), u == i.out ? (d = Math.abs(d) * t.MathUtils.signum(g), p = Math.abs(p) * t.MathUtils.signum(x)) : (g = Math.abs(g) * t.MathUtils.signum(d), x = Math.abs(x) * t.MathUtils.signum(p)), f.scaleX = g + (d - g) * h, f.scaleY = x + (p - x) * h
  47139. }
  47140. }
  47141. }, a
  47142. })(l);
  47143. t.ScaleTimeline = h;
  47144. var c = (function(t) {
  47145. function i(e) {
  47146. return t.call(this, e) || this
  47147. }
  47148. return r(i, t), i.prototype.getPropertyId = function() {
  47149. return (n.shear << 24) + this.boneIndex
  47150. }, i.prototype.apply = function(t, n, r, o, a, l, h) {
  47151. var c = this.frames,
  47152. u = t.bones[this.boneIndex];
  47153. if (r < c[0]) switch (l) {
  47154. case e.setup:
  47155. return u.shearX = u.data.shearX, void(u.shearY = u.data.shearY);
  47156. case e.current:
  47157. u.shearX += (u.data.shearX - u.shearX) * a, u.shearY += (u.data.shearY - u.shearY) * a
  47158. } else {
  47159. var _ = 0,
  47160. f = 0;
  47161. if (r >= c[c.length - i.ENTRIES]) _ = c[c.length + i.PREV_X], f = c[c.length + i.PREV_Y];
  47162. else {
  47163. var d = s.binarySearch(c, r, i.ENTRIES);
  47164. _ = c[d + i.PREV_X], f = c[d + i.PREV_Y];
  47165. var p = c[d],
  47166. m = this.getCurvePercent(d / i.ENTRIES - 1, 1 - (r - p) / (c[d + i.PREV_TIME] - p));
  47167. _ += (c[d + i.X] - _) * m, f += (c[d + i.Y] - f) * m
  47168. }
  47169. l == e.setup ? (u.shearX = u.data.shearX + _ * a, u.shearY = u.data.shearY + f * a) : (u.shearX += (u.data.shearX + _ - u.shearX) * a, u.shearY += (u.data.shearY + f - u.shearY) * a)
  47170. }
  47171. }, i
  47172. })(l);
  47173. t.ShearTimeline = c;
  47174. var u = (function(i) {
  47175. function o(e) {
  47176. var n = i.call(this, e) || this;
  47177. return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
  47178. }
  47179. return r(o, i), o.prototype.getPropertyId = function() {
  47180. return (n.color << 24) + this.slotIndex
  47181. }, o.prototype.setFrame = function(t, e, i, n, r, s) {
  47182. t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.R] = i, this.frames[t + o.G] = n, this.frames[t + o.B] = r, this.frames[t + o.A] = s
  47183. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47184. var c = t.slots[this.slotIndex],
  47185. u = this.frames;
  47186. if (n < u[0]) switch (l) {
  47187. case e.setup:
  47188. return void c.color.setFromColor(c.data.color);
  47189. case e.current:
  47190. var _ = c.color,
  47191. f = c.data.color;
  47192. _.add((f.r - _.r) * a, (f.g - _.g) * a, (f.b - _.b) * a, (f.a - _.a) * a)
  47193. } else {
  47194. var d = 0,
  47195. p = 0,
  47196. m = 0,
  47197. y = 0;
  47198. if (n >= u[u.length - o.ENTRIES]) {
  47199. var v = u.length;
  47200. d = u[v + o.PREV_R], p = u[v + o.PREV_G], m = u[v + o.PREV_B], y = u[v + o.PREV_A]
  47201. } else {
  47202. var g = s.binarySearch(u, n, o.ENTRIES);
  47203. d = u[g + o.PREV_R], p = u[g + o.PREV_G], m = u[g + o.PREV_B], y = u[g + o.PREV_A];
  47204. var x = u[g],
  47205. b = this.getCurvePercent(g / o.ENTRIES - 1, 1 - (n - x) / (u[g + o.PREV_TIME] - x));
  47206. d += (u[g + o.R] - d) * b, p += (u[g + o.G] - p) * b, m += (u[g + o.B] - m) * b, y += (u[g + o.A] - y) * b
  47207. }
  47208. if (1 == a) c.color.set(d, p, m, y);
  47209. else {
  47210. _ = c.color;
  47211. l == e.setup && _.setFromColor(c.data.color), _.add((d - _.r) * a, (p - _.g) * a, (m - _.b) * a, (y - _.a) * a)
  47212. }
  47213. }
  47214. }, o.ENTRIES = 5, o.PREV_TIME = -5, o.PREV_R = -4, o.PREV_G = -3, o.PREV_B = -2, o.PREV_A = -1, o.R = 1, o.G = 2, o.B = 3, o.A = 4, o
  47215. })(o);
  47216. t.ColorTimeline = u;
  47217. var _ = (function(i) {
  47218. function o(e) {
  47219. var n = i.call(this, e) || this;
  47220. return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
  47221. }
  47222. return r(o, i), o.prototype.getPropertyId = function() {
  47223. return (n.twoColor << 24) + this.slotIndex
  47224. }, o.prototype.setFrame = function(t, e, i, n, r, s, a, l, h) {
  47225. t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.R] = i, this.frames[t + o.G] = n, this.frames[t + o.B] = r, this.frames[t + o.A] = s, this.frames[t + o.R2] = a, this.frames[t + o.G2] = l, this.frames[t + o.B2] = h
  47226. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47227. var c = t.slots[this.slotIndex],
  47228. u = this.frames;
  47229. if (n < u[0]) switch (l) {
  47230. case e.setup:
  47231. return c.color.setFromColor(c.data.color), void c.darkColor.setFromColor(c.data.darkColor);
  47232. case e.current:
  47233. var _ = c.color,
  47234. f = c.darkColor,
  47235. d = c.data.color,
  47236. p = c.data.darkColor;
  47237. _.add((d.r - _.r) * a, (d.g - _.g) * a, (d.b - _.b) * a, (d.a - _.a) * a), f.add((p.r - f.r) * a, (p.g - f.g) * a, (p.b - f.b) * a, 0)
  47238. } else {
  47239. var m = 0,
  47240. y = 0,
  47241. v = 0,
  47242. g = 0,
  47243. x = 0,
  47244. b = 0,
  47245. A = 0;
  47246. if (n >= u[u.length - o.ENTRIES]) {
  47247. var C = u.length;
  47248. m = u[C + o.PREV_R], y = u[C + o.PREV_G], v = u[C + o.PREV_B], g = u[C + o.PREV_A], x = u[C + o.PREV_R2], b = u[C + o.PREV_G2], A = u[C + o.PREV_B2]
  47249. } else {
  47250. var T = s.binarySearch(u, n, o.ENTRIES);
  47251. m = u[T + o.PREV_R], y = u[T + o.PREV_G], v = u[T + o.PREV_B], g = u[T + o.PREV_A], x = u[T + o.PREV_R2], b = u[T + o.PREV_G2], A = u[T + o.PREV_B2];
  47252. var S = u[T],
  47253. w = this.getCurvePercent(T / o.ENTRIES - 1, 1 - (n - S) / (u[T + o.PREV_TIME] - S));
  47254. m += (u[T + o.R] - m) * w, y += (u[T + o.G] - y) * w, v += (u[T + o.B] - v) * w, g += (u[T + o.A] - g) * w, x += (u[T + o.R2] - x) * w, b += (u[T + o.G2] - b) * w, A += (u[T + o.B2] - A) * w
  47255. }
  47256. if (1 == a) c.color.set(m, y, v, g), c.darkColor.set(x, b, A, 1);
  47257. else {
  47258. _ = c.color, f = c.darkColor;
  47259. l == e.setup && (_.setFromColor(c.data.color), f.setFromColor(c.data.darkColor)), _.add((m - _.r) * a, (y - _.g) * a, (v - _.b) * a, (g - _.a) * a), f.add((x - f.r) * a, (b - f.g) * a, (A - f.b) * a, 0)
  47260. }
  47261. }
  47262. }, o.ENTRIES = 8, o.PREV_TIME = -8, o.PREV_R = -7, o.PREV_G = -6, o.PREV_B = -5, o.PREV_A = -4, o.PREV_R2 = -3, o.PREV_G2 = -2, o.PREV_B2 = -1, o.R = 1, o.G = 2, o.B = 3, o.A = 4, o.R2 = 5, o.G2 = 6, o.B2 = 7, o
  47263. })(o);
  47264. t.TwoColorTimeline = _;
  47265. var f = (function() {
  47266. function r(e) {
  47267. this.frames = t.Utils.newFloatArray(e), this.attachmentNames = new Array(e)
  47268. }
  47269. return r.prototype.getPropertyId = function() {
  47270. return (n.attachment << 24) + this.slotIndex
  47271. }, r.prototype.getFrameCount = function() {
  47272. return this.frames.length
  47273. }, r.prototype.setFrame = function(t, e, i) {
  47274. this.frames[t] = e, this.attachmentNames[t] = i
  47275. }, r.prototype.apply = function(t, n, r, o, a, l, h) {
  47276. var c = t.slots[this.slotIndex];
  47277. if (h != i.out || l != e.setup) {
  47278. var u = this.frames;
  47279. if (r < u[0]) {
  47280. if (l == e.setup) {
  47281. var _ = c.data.attachmentName;
  47282. c.setAttachment(null == _ ? null : t.getAttachment(this.slotIndex, _))
  47283. }
  47284. } else {
  47285. var f = 0;
  47286. f = r >= u[u.length - 1] ? u.length - 1 : s.binarySearch(u, r, 1) - 1;
  47287. var d = this.attachmentNames[f];
  47288. t.slots[this.slotIndex].setAttachment(null == d ? null : t.getAttachment(this.slotIndex, d))
  47289. }
  47290. } else {
  47291. var p = c.data.attachmentName;
  47292. c.setAttachment(null == p ? null : t.getAttachment(this.slotIndex, p))
  47293. }
  47294. }, r
  47295. })();
  47296. t.AttachmentTimeline = f;
  47297. var d = null,
  47298. p = (function(i) {
  47299. function o(e) {
  47300. var n = i.call(this, e) || this;
  47301. return n.frames = t.Utils.newFloatArray(e), n.frameVertices = new Array(e), null == d && (d = t.Utils.newFloatArray(64)), n
  47302. }
  47303. return r(o, i), o.prototype.getPropertyId = function() {
  47304. return (n.deform << 27) + +this.attachment.id + this.slotIndex
  47305. }, o.prototype.setFrame = function(t, e, i) {
  47306. this.frames[t] = e, this.frameVertices[t] = i
  47307. }, o.prototype.apply = function(i, n, r, o, a, l, h) {
  47308. var c = i.slots[this.slotIndex],
  47309. u = c.getAttachment();
  47310. if (u instanceof t.VertexAttachment && u.applyDeform(this.attachment)) {
  47311. var _ = c.attachmentVertices;
  47312. 0 == _.length && (a = 1);
  47313. var f = this.frameVertices,
  47314. d = f[0].length,
  47315. p = this.frames;
  47316. if (r < p[0]) {
  47317. var m = u;
  47318. switch (l) {
  47319. case e.setup:
  47320. return void(_.length = 0);
  47321. case e.current:
  47322. if (1 == a) {
  47323. _.length = 0;
  47324. break
  47325. }
  47326. var y = t.Utils.setArraySize(_, d);
  47327. if (null == m.bones)
  47328. for (var v = m.vertices, g = 0; g < d; g++) y[g] += (v[g] - y[g]) * a;
  47329. else {
  47330. a = 1 - a;
  47331. for (g = 0; g < d; g++) y[g] *= a
  47332. }
  47333. }
  47334. } else {
  47335. var x = t.Utils.setArraySize(_, d);
  47336. if (r >= p[p.length - 1]) {
  47337. var b = f[p.length - 1];
  47338. if (1 == a) t.Utils.arrayCopy(b, 0, x, 0, d);
  47339. else if (l == e.setup) {
  47340. if (null == (m = u).bones)
  47341. for (var A = m.vertices, C = 0; C < d; C++) {
  47342. var T = A[C];
  47343. x[C] = T + (b[C] - T) * a
  47344. } else
  47345. for (var S = 0; S < d; S++) x[S] = b[S] * a
  47346. } else
  47347. for (var w = 0; w < d; w++) x[w] += (b[w] - x[w]) * a
  47348. } else {
  47349. var E = s.binarySearch(p, r),
  47350. M = f[E - 1],
  47351. D = f[E],
  47352. B = p[E],
  47353. I = this.getCurvePercent(E - 1, 1 - (r - B) / (p[E - 1] - B));
  47354. if (1 == a)
  47355. for (var P = 0; P < d; P++) {
  47356. var R = M[P];
  47357. x[P] = R + (D[P] - R) * I
  47358. } else if (l == e.setup) {
  47359. if (null == (m = u).bones)
  47360. for (var O = m.vertices, L = 0; L < d; L++) {
  47361. R = M[L], T = O[L];
  47362. x[L] = T + (R + (D[L] - R) * I - T) * a
  47363. } else
  47364. for (var F = 0; F < d; F++) {
  47365. R = M[F];
  47366. x[F] = (R + (D[F] - R) * I) * a
  47367. }
  47368. } else
  47369. for (var N = 0; N < d; N++) {
  47370. R = M[N];
  47371. x[N] += (R + (D[N] - R) * I - x[N]) * a
  47372. }
  47373. }
  47374. }
  47375. }
  47376. }, o
  47377. })(o);
  47378. t.DeformTimeline = p;
  47379. var m = (function() {
  47380. function e(e) {
  47381. this.frames = t.Utils.newFloatArray(e), this.events = new Array(e)
  47382. }
  47383. return e.prototype.getPropertyId = function() {
  47384. return n.event << 24
  47385. }, e.prototype.getFrameCount = function() {
  47386. return this.frames.length
  47387. }, e.prototype.setFrame = function(t, e) {
  47388. this.frames[t] = e.time, this.events[t] = e
  47389. }, e.prototype.apply = function(t, e, i, n, r, o, a) {
  47390. if (null != n) {
  47391. var l = this.frames,
  47392. h = this.frames.length;
  47393. if (e > i) this.apply(t, e, Number.MAX_VALUE, n, r, o, a), e = -1;
  47394. else if (e >= l[h - 1]) return;
  47395. if (!(i < l[0])) {
  47396. var c = 0;
  47397. if (e < l[0]) c = 0;
  47398. else
  47399. for (var u = l[c = s.binarySearch(l, e)]; c > 0 && l[c - 1] == u;) c--;
  47400. for (; c < h && i >= l[c]; c++) n.push(this.events[c])
  47401. }
  47402. }
  47403. }, e
  47404. })();
  47405. t.EventTimeline = m;
  47406. var y = (function() {
  47407. function r(e) {
  47408. this.frames = t.Utils.newFloatArray(e), this.drawOrders = new Array(e)
  47409. }
  47410. return r.prototype.getPropertyId = function() {
  47411. return n.drawOrder << 24
  47412. }, r.prototype.getFrameCount = function() {
  47413. return this.frames.length
  47414. }, r.prototype.setFrame = function(t, e, i) {
  47415. this.frames[t] = e, this.drawOrders[t] = i
  47416. }, r.prototype.apply = function(n, r, o, a, l, h, c) {
  47417. var u = n.drawOrder,
  47418. _ = n.slots;
  47419. if (c != i.out || h != e.setup) {
  47420. var f = this.frames;
  47421. if (o < f[0]) h == e.setup && t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length);
  47422. else {
  47423. var d = 0;
  47424. d = o >= f[f.length - 1] ? f.length - 1 : s.binarySearch(f, o) - 1;
  47425. var p = this.drawOrders[d];
  47426. if (null == p) t.Utils.arrayCopy(_, 0, u, 0, _.length);
  47427. else
  47428. for (var m = 0, y = p.length; m < y; m++) u[m] = _[p[m]]
  47429. }
  47430. } else t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length)
  47431. }, r
  47432. })();
  47433. t.DrawOrderTimeline = y;
  47434. var v = (function(o) {
  47435. function a(e) {
  47436. var i = o.call(this, e) || this;
  47437. return i.frames = t.Utils.newFloatArray(e * a.ENTRIES), i
  47438. }
  47439. return r(a, o), a.prototype.getPropertyId = function() {
  47440. return (n.ikConstraint << 24) + this.ikConstraintIndex
  47441. }, a.prototype.setFrame = function(t, e, i, n) {
  47442. t *= a.ENTRIES, this.frames[t] = e, this.frames[t + a.MIX] = i, this.frames[t + a.BEND_DIRECTION] = n
  47443. }, a.prototype.apply = function(t, n, r, o, l, h, c) {
  47444. var u = this.frames,
  47445. _ = t.ikConstraints[this.ikConstraintIndex];
  47446. if (r < u[0]) switch (h) {
  47447. case e.setup:
  47448. return _.mix = _.data.mix, void(_.bendDirection = _.data.bendDirection);
  47449. case e.current:
  47450. _.mix += (_.data.mix - _.mix) * l, _.bendDirection = _.data.bendDirection
  47451. } else if (r >= u[u.length - a.ENTRIES]) h == e.setup ? (_.mix = _.data.mix + (u[u.length + a.PREV_MIX] - _.data.mix) * l, _.bendDirection = c == i.out ? _.data.bendDirection : u[u.length + a.PREV_BEND_DIRECTION]) : (_.mix += (u[u.length + a.PREV_MIX] - _.mix) * l, c == i.in && (_.bendDirection = u[u.length + a.PREV_BEND_DIRECTION]));
  47452. else {
  47453. var f = s.binarySearch(u, r, a.ENTRIES),
  47454. d = u[f + a.PREV_MIX],
  47455. p = u[f],
  47456. m = this.getCurvePercent(f / a.ENTRIES - 1, 1 - (r - p) / (u[f + a.PREV_TIME] - p));
  47457. h == e.setup ? (_.mix = _.data.mix + (d + (u[f + a.MIX] - d) * m - _.data.mix) * l, _.bendDirection = c == i.out ? _.data.bendDirection : u[f + a.PREV_BEND_DIRECTION]) : (_.mix += (d + (u[f + a.MIX] - d) * m - _.mix) * l, c == i.in && (_.bendDirection = u[f + a.PREV_BEND_DIRECTION]))
  47458. }
  47459. }, a.ENTRIES = 3, a.PREV_TIME = -3, a.PREV_MIX = -2, a.PREV_BEND_DIRECTION = -1, a.MIX = 1, a.BEND_DIRECTION = 2, a
  47460. })(o);
  47461. t.IkConstraintTimeline = v;
  47462. var g = (function(i) {
  47463. function o(e) {
  47464. var n = i.call(this, e) || this;
  47465. return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
  47466. }
  47467. return r(o, i), o.prototype.getPropertyId = function() {
  47468. return (n.transformConstraint << 24) + this.transformConstraintIndex
  47469. }, o.prototype.setFrame = function(t, e, i, n, r, s) {
  47470. t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.ROTATE] = i, this.frames[t + o.TRANSLATE] = n, this.frames[t + o.SCALE] = r, this.frames[t + o.SHEAR] = s
  47471. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47472. var c = this.frames,
  47473. u = t.transformConstraints[this.transformConstraintIndex];
  47474. if (n < c[0]) {
  47475. var _ = u.data;
  47476. switch (l) {
  47477. case e.setup:
  47478. return u.rotateMix = _.rotateMix, u.translateMix = _.translateMix, u.scaleMix = _.scaleMix, void(u.shearMix = _.shearMix);
  47479. case e.current:
  47480. u.rotateMix += (_.rotateMix - u.rotateMix) * a, u.translateMix += (_.translateMix - u.translateMix) * a, u.scaleMix += (_.scaleMix - u.scaleMix) * a, u.shearMix += (_.shearMix - u.shearMix) * a
  47481. }
  47482. } else {
  47483. var f = 0,
  47484. d = 0,
  47485. p = 0,
  47486. m = 0;
  47487. if (n >= c[c.length - o.ENTRIES]) {
  47488. var y = c.length;
  47489. f = c[y + o.PREV_ROTATE], d = c[y + o.PREV_TRANSLATE], p = c[y + o.PREV_SCALE], m = c[y + o.PREV_SHEAR]
  47490. } else {
  47491. var v = s.binarySearch(c, n, o.ENTRIES);
  47492. f = c[v + o.PREV_ROTATE], d = c[v + o.PREV_TRANSLATE], p = c[v + o.PREV_SCALE], m = c[v + o.PREV_SHEAR];
  47493. var g = c[v],
  47494. x = this.getCurvePercent(v / o.ENTRIES - 1, 1 - (n - g) / (c[v + o.PREV_TIME] - g));
  47495. f += (c[v + o.ROTATE] - f) * x, d += (c[v + o.TRANSLATE] - d) * x, p += (c[v + o.SCALE] - p) * x, m += (c[v + o.SHEAR] - m) * x
  47496. }
  47497. if (l == e.setup) {
  47498. _ = u.data;
  47499. u.rotateMix = _.rotateMix + (f - _.rotateMix) * a, u.translateMix = _.translateMix + (d - _.translateMix) * a, u.scaleMix = _.scaleMix + (p - _.scaleMix) * a, u.shearMix = _.shearMix + (m - _.shearMix) * a
  47500. } else u.rotateMix += (f - u.rotateMix) * a, u.translateMix += (d - u.translateMix) * a, u.scaleMix += (p - u.scaleMix) * a, u.shearMix += (m - u.shearMix) * a
  47501. }
  47502. }, o.ENTRIES = 5, o.PREV_TIME = -5, o.PREV_ROTATE = -4, o.PREV_TRANSLATE = -3, o.PREV_SCALE = -2, o.PREV_SHEAR = -1, o.ROTATE = 1, o.TRANSLATE = 2, o.SCALE = 3, o.SHEAR = 4, o
  47503. })(o);
  47504. t.TransformConstraintTimeline = g;
  47505. var x = (function(i) {
  47506. function o(e) {
  47507. var n = i.call(this, e) || this;
  47508. return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
  47509. }
  47510. return r(o, i), o.prototype.getPropertyId = function() {
  47511. return (n.pathConstraintPosition << 24) + this.pathConstraintIndex
  47512. }, o.prototype.setFrame = function(t, e, i) {
  47513. t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.VALUE] = i
  47514. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47515. var c = this.frames,
  47516. u = t.pathConstraints[this.pathConstraintIndex];
  47517. if (n < c[0]) switch (l) {
  47518. case e.setup:
  47519. return void(u.position = u.data.position);
  47520. case e.current:
  47521. u.position += (u.data.position - u.position) * a
  47522. } else {
  47523. var _ = 0;
  47524. if (n >= c[c.length - o.ENTRIES]) _ = c[c.length + o.PREV_VALUE];
  47525. else {
  47526. var f = s.binarySearch(c, n, o.ENTRIES);
  47527. _ = c[f + o.PREV_VALUE];
  47528. var d = c[f],
  47529. p = this.getCurvePercent(f / o.ENTRIES - 1, 1 - (n - d) / (c[f + o.PREV_TIME] - d));
  47530. _ += (c[f + o.VALUE] - _) * p
  47531. }
  47532. l == e.setup ? u.position = u.data.position + (_ - u.data.position) * a : u.position += (_ - u.position) * a
  47533. }
  47534. }, o.ENTRIES = 2, o.PREV_TIME = -2, o.PREV_VALUE = -1, o.VALUE = 1, o
  47535. })(o);
  47536. t.PathConstraintPositionTimeline = x;
  47537. var b = (function(t) {
  47538. function i(e) {
  47539. return t.call(this, e) || this
  47540. }
  47541. return r(i, t), i.prototype.getPropertyId = function() {
  47542. return (n.pathConstraintSpacing << 24) + this.pathConstraintIndex
  47543. }, i.prototype.apply = function(t, n, r, o, a, l, h) {
  47544. var c = this.frames,
  47545. u = t.pathConstraints[this.pathConstraintIndex];
  47546. if (r < c[0]) switch (l) {
  47547. case e.setup:
  47548. return void(u.spacing = u.data.spacing);
  47549. case e.current:
  47550. u.spacing += (u.data.spacing - u.spacing) * a
  47551. } else {
  47552. var _ = 0;
  47553. if (r >= c[c.length - i.ENTRIES]) _ = c[c.length + i.PREV_VALUE];
  47554. else {
  47555. var f = s.binarySearch(c, r, i.ENTRIES);
  47556. _ = c[f + i.PREV_VALUE];
  47557. var d = c[f],
  47558. p = this.getCurvePercent(f / i.ENTRIES - 1, 1 - (r - d) / (c[f + i.PREV_TIME] - d));
  47559. _ += (c[f + i.VALUE] - _) * p
  47560. }
  47561. l == e.setup ? u.spacing = u.data.spacing + (_ - u.data.spacing) * a : u.spacing += (_ - u.spacing) * a
  47562. }
  47563. }, i
  47564. })(x);
  47565. t.PathConstraintSpacingTimeline = b;
  47566. var A = (function(i) {
  47567. function o(e) {
  47568. var n = i.call(this, e) || this;
  47569. return n.frames = t.Utils.newFloatArray(e * o.ENTRIES), n
  47570. }
  47571. return r(o, i), o.prototype.getPropertyId = function() {
  47572. return (n.pathConstraintMix << 24) + this.pathConstraintIndex
  47573. }, o.prototype.setFrame = function(t, e, i, n) {
  47574. t *= o.ENTRIES, this.frames[t] = e, this.frames[t + o.ROTATE] = i, this.frames[t + o.TRANSLATE] = n
  47575. }, o.prototype.apply = function(t, i, n, r, a, l, h) {
  47576. var c = this.frames,
  47577. u = t.pathConstraints[this.pathConstraintIndex];
  47578. if (n < c[0]) switch (l) {
  47579. case e.setup:
  47580. return u.rotateMix = u.data.rotateMix, void(u.translateMix = u.data.translateMix);
  47581. case e.current:
  47582. u.rotateMix += (u.data.rotateMix - u.rotateMix) * a, u.translateMix += (u.data.translateMix - u.translateMix) * a
  47583. } else {
  47584. var _ = 0,
  47585. f = 0;
  47586. if (n >= c[c.length - o.ENTRIES]) _ = c[c.length + o.PREV_ROTATE], f = c[c.length + o.PREV_TRANSLATE];
  47587. else {
  47588. var d = s.binarySearch(c, n, o.ENTRIES);
  47589. _ = c[d + o.PREV_ROTATE], f = c[d + o.PREV_TRANSLATE];
  47590. var p = c[d],
  47591. m = this.getCurvePercent(d / o.ENTRIES - 1, 1 - (n - p) / (c[d + o.PREV_TIME] - p));
  47592. _ += (c[d + o.ROTATE] - _) * m, f += (c[d + o.TRANSLATE] - f) * m
  47593. }
  47594. l == e.setup ? (u.rotateMix = u.data.rotateMix + (_ - u.data.rotateMix) * a, u.translateMix = u.data.translateMix + (f - u.data.translateMix) * a) : (u.rotateMix += (_ - u.rotateMix) * a, u.translateMix += (f - u.translateMix) * a)
  47595. }
  47596. }, o.ENTRIES = 3, o.PREV_TIME = -3, o.PREV_ROTATE = -2, o.PREV_TRANSLATE = -1, o.ROTATE = 1, o.TRANSLATE = 2, o
  47597. })(o);
  47598. t.PathConstraintMixTimeline = A
  47599. })(n || (n = {})), (function(t) {
  47600. var e = (function() {
  47601. function e(e) {
  47602. this.tracks = new Array, this.events = new Array, this.listeners = new Array, this.queue = new r(this), this.propertyIDs = new t.IntSet, this.mixingTo = new Array, this.animationsChanged = !1, this.timeScale = 1, this.trackEntryPool = new t.Pool(function() {
  47603. return new i
  47604. }), this.data = e
  47605. }
  47606. return e.prototype.update = function(t) {
  47607. t *= this.timeScale;
  47608. for (var e = this.tracks, i = 0, n = e.length; i < n; i++) {
  47609. var r = e[i];
  47610. if (null != r) {
  47611. r.animationLast = r.nextAnimationLast, r.trackLast = r.nextTrackLast;
  47612. var s = t * r.timeScale;
  47613. if (r.delay > 0) {
  47614. if (r.delay -= s, r.delay > 0) continue;
  47615. s = -r.delay, r.delay = 0
  47616. }
  47617. var o = r.next;
  47618. if (null != o) {
  47619. var a = r.trackLast - o.delay;
  47620. if (a >= 0) {
  47621. for (o.delay = 0, o.trackTime = a + t * o.timeScale, r.trackTime += s, this.setCurrent(i, o, !0); null != o.mixingFrom;) o.mixTime += s, o = o.mixingFrom;
  47622. continue
  47623. }
  47624. } else if (r.trackLast >= r.trackEnd && null == r.mixingFrom) {
  47625. e[i] = null, this.queue.end(r), this.disposeNext(r);
  47626. continue
  47627. }
  47628. if (null != r.mixingFrom && this.updateMixingFrom(r, t)) {
  47629. var l = r.mixingFrom;
  47630. for (r.mixingFrom = null; null != l;) this.queue.end(l), l = l.mixingFrom
  47631. }
  47632. r.trackTime += s
  47633. }
  47634. }
  47635. this.queue.drain()
  47636. }, e.prototype.updateMixingFrom = function(t, e) {
  47637. var i = t.mixingFrom;
  47638. if (null == i) return !0;
  47639. var n = this.updateMixingFrom(i, e);
  47640. return i.animationLast = i.nextAnimationLast, i.trackLast = i.nextTrackLast, t.mixTime > 0 && (t.mixTime >= t.mixDuration || 0 == t.timeScale) ? (0 != i.totalAlpha && 0 != t.mixDuration || (t.mixingFrom = i.mixingFrom, t.interruptAlpha = i.interruptAlpha, this.queue.end(i)), n) : (i.trackTime += e * i.timeScale, t.mixTime += e * t.timeScale, !1)
  47641. }, e.prototype.apply = function(i) {
  47642. if (null == i) throw new Error("skeleton cannot be null.");
  47643. this.animationsChanged && this._animationsChanged();
  47644. for (var n = this.events, r = this.tracks, s = !1, o = 0, a = r.length; o < a; o++) {
  47645. var l = r[o];
  47646. if (!(null == l || l.delay > 0)) {
  47647. s = !0;
  47648. var h = 0 == o ? t.MixPose.current : t.MixPose.currentLayered,
  47649. c = l.alpha;
  47650. null != l.mixingFrom ? c *= this.applyMixingFrom(l, i, h) : l.trackTime >= l.trackEnd && null == l.next && (c = 0);
  47651. var u = l.animationLast,
  47652. _ = l.getAnimationTime(),
  47653. f = l.animation.timelines.length,
  47654. d = l.animation.timelines;
  47655. if (1 == c)
  47656. for (var p = 0; p < f; p++) d[p].apply(i, u, _, n, 1, t.MixPose.setup, t.MixDirection.in);
  47657. else {
  47658. var m = l.timelineData,
  47659. y = 0 == l.timelinesRotation.length;
  47660. y && t.Utils.setArraySize(l.timelinesRotation, f << 1, null);
  47661. var v = l.timelinesRotation;
  47662. for (p = 0; p < f; p++) {
  47663. var g = d[p],
  47664. x = m[p] >= e.FIRST ? t.MixPose.setup : h;
  47665. g instanceof t.RotateTimeline ? this.applyRotateTimeline(g, i, _, c, x, v, p << 1, y) : (t.Utils.webkit602BugfixHelper(c, x), g.apply(i, u, _, n, c, x, t.MixDirection.in))
  47666. }
  47667. }
  47668. this.queueEvents(l, _), n.length = 0, l.nextAnimationLast = _, l.nextTrackLast = l.trackTime
  47669. }
  47670. }
  47671. return this.queue.drain(), s
  47672. }, e.prototype.applyMixingFrom = function(i, n, r) {
  47673. var s = i.mixingFrom;
  47674. null != s.mixingFrom && this.applyMixingFrom(s, n, r);
  47675. var o = 0;
  47676. 0 == i.mixDuration ? (o = 1, r = t.MixPose.setup) : (o = i.mixTime / i.mixDuration) > 1 && (o = 1);
  47677. var a = o < s.eventThreshold ? this.events : null,
  47678. l = o < s.attachmentThreshold,
  47679. h = o < s.drawOrderThreshold,
  47680. c = s.animationLast,
  47681. u = s.getAnimationTime(),
  47682. _ = s.animation.timelines.length,
  47683. f = s.animation.timelines,
  47684. d = s.timelineData,
  47685. p = s.timelineDipMix,
  47686. m = 0 == s.timelinesRotation.length;
  47687. m && t.Utils.setArraySize(s.timelinesRotation, _ << 1, null);
  47688. var y, v = s.timelinesRotation,
  47689. g = s.alpha * i.interruptAlpha,
  47690. x = g * (1 - o),
  47691. b = 0;
  47692. s.totalAlpha = 0;
  47693. for (var A = 0; A < _; A++) {
  47694. var C = f[A];
  47695. switch (d[A]) {
  47696. case e.SUBSEQUENT:
  47697. if (!l && C instanceof t.AttachmentTimeline) continue;
  47698. if (!h && C instanceof t.DrawOrderTimeline) continue;
  47699. y = r, b = x;
  47700. break;
  47701. case e.FIRST:
  47702. y = t.MixPose.setup, b = x;
  47703. break;
  47704. case e.DIP:
  47705. y = t.MixPose.setup, b = g;
  47706. break;
  47707. default:
  47708. y = t.MixPose.setup, b = g;
  47709. var T = p[A];
  47710. b *= Math.max(0, 1 - T.mixTime / T.mixDuration)
  47711. }
  47712. s.totalAlpha += b, C instanceof t.RotateTimeline ? this.applyRotateTimeline(C, n, u, b, y, v, A << 1, m) : (t.Utils.webkit602BugfixHelper(b, y), C.apply(n, c, u, a, b, y, t.MixDirection.out))
  47713. }
  47714. return i.mixDuration > 0 && this.queueEvents(s, u), this.events.length = 0, s.nextAnimationLast = u, s.nextTrackLast = s.trackTime, o
  47715. }, e.prototype.applyRotateTimeline = function(e, i, n, r, s, o, a, l) {
  47716. if (l && (o[a] = 0), 1 != r) {
  47717. var h = e,
  47718. c = h.frames,
  47719. u = i.bones[h.boneIndex];
  47720. if (n < c[0]) s == t.MixPose.setup && (u.rotation = u.data.rotation);
  47721. else {
  47722. var _ = 0;
  47723. if (n >= c[c.length - t.RotateTimeline.ENTRIES]) _ = u.data.rotation + c[c.length + t.RotateTimeline.PREV_ROTATION];
  47724. else {
  47725. var f = t.Animation.binarySearch(c, n, t.RotateTimeline.ENTRIES),
  47726. d = c[f + t.RotateTimeline.PREV_ROTATION],
  47727. p = c[f],
  47728. m = h.getCurvePercent((f >> 1) - 1, 1 - (n - p) / (c[f + t.RotateTimeline.PREV_TIME] - p));
  47729. _ = c[f + t.RotateTimeline.ROTATION] - d, _ = d + (_ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0))) * m + u.data.rotation, _ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0))
  47730. }
  47731. var y = s == t.MixPose.setup ? u.data.rotation : u.rotation,
  47732. v = 0,
  47733. g = _ - y;
  47734. if (0 == g) v = o[a];
  47735. else {
  47736. g -= 360 * (16384 - (16384.499999999996 - g / 360 | 0));
  47737. var x = 0,
  47738. b = 0;
  47739. l ? (x = 0, b = g) : (x = o[a], b = o[a + 1]);
  47740. var A = g > 0,
  47741. C = x >= 0;
  47742. t.MathUtils.signum(b) != t.MathUtils.signum(g) && Math.abs(b) <= 90 && (Math.abs(x) > 180 && (x += 360 * t.MathUtils.signum(x)), C = A), v = g + x - x % 360, C != A && (v += 360 * t.MathUtils.signum(x)), o[a] = v
  47743. }
  47744. o[a + 1] = g, y += v * r, u.rotation = y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))
  47745. }
  47746. } else e.apply(i, 0, n, null, 1, s, t.MixDirection.in)
  47747. }, e.prototype.queueEvents = function(t, e) {
  47748. for (var i = t.animationStart, n = t.animationEnd, r = n - i, s = t.trackLast % r, o = this.events, a = 0, l = o.length; a < l; a++) {
  47749. var h = o[a];
  47750. if (h.time < s) break;
  47751. h.time > n || this.queue.event(t, h)
  47752. }
  47753. for ((t.loop ? 0 == r || s > t.trackTime % r : e >= n && t.animationLast < n) && this.queue.complete(t); a < l; a++) {
  47754. o[a].time < i || this.queue.event(t, o[a])
  47755. }
  47756. }, e.prototype.clearTracks = function() {
  47757. var t = this.queue.drainDisabled;
  47758. this.queue.drainDisabled = !0;
  47759. for (var e = 0, i = this.tracks.length; e < i; e++) this.clearTrack(e);
  47760. this.tracks.length = 0, this.queue.drainDisabled = t, this.queue.drain()
  47761. }, e.prototype.clearTrack = function(t) {
  47762. if (!(t >= this.tracks.length)) {
  47763. var e = this.tracks[t];
  47764. if (null != e) {
  47765. this.queue.end(e), this.disposeNext(e);
  47766. for (var i = e;;) {
  47767. var n = i.mixingFrom;
  47768. if (null == n) break;
  47769. this.queue.end(n), i.mixingFrom = null, i = n
  47770. }
  47771. this.tracks[e.trackIndex] = null, this.queue.drain()
  47772. }
  47773. }
  47774. }, e.prototype.setCurrent = function(t, e, i) {
  47775. var n = this.expandToIndex(t);
  47776. this.tracks[t] = e, null != n && (i && this.queue.interrupt(n), e.mixingFrom = n, e.mixTime = 0, null != n.mixingFrom && n.mixDuration > 0 && (e.interruptAlpha *= Math.min(1, n.mixTime / n.mixDuration)), n.timelinesRotation.length = 0), this.queue.start(e)
  47777. }, e.prototype.setAnimation = function(t, e, i) {
  47778. var n = this.data.skeletonData.findAnimation(e);
  47779. if (null == n) throw new Error("Animation not found: " + e);
  47780. return this.setAnimationWith(t, n, i)
  47781. }, e.prototype.setAnimationWith = function(t, e, i) {
  47782. if (null == e) throw new Error("animation cannot be null.");
  47783. var n = !0,
  47784. r = this.expandToIndex(t);
  47785. null != r && (-1 == r.nextTrackLast ? (this.tracks[t] = r.mixingFrom, this.queue.interrupt(r), this.queue.end(r), this.disposeNext(r), r = r.mixingFrom, n = !1) : this.disposeNext(r));
  47786. var s = this.trackEntry(t, e, i, r);
  47787. return this.setCurrent(t, s, n), this.queue.drain(), s
  47788. }, e.prototype.addAnimation = function(t, e, i, n) {
  47789. var r = this.data.skeletonData.findAnimation(e);
  47790. if (null == r) throw new Error("Animation not found: " + e);
  47791. return this.addAnimationWith(t, r, i, n)
  47792. }, e.prototype.addAnimationWith = function(t, e, i, n) {
  47793. if (null == e) throw new Error("animation cannot be null.");
  47794. var r = this.expandToIndex(t);
  47795. if (null != r)
  47796. for (; null != r.next;) r = r.next;
  47797. var s = this.trackEntry(t, e, i, r);
  47798. if (null == r) this.setCurrent(t, s, !0), this.queue.drain();
  47799. else if (r.next = s, n <= 0) {
  47800. var o = r.animationEnd - r.animationStart;
  47801. 0 != o ? (r.loop ? n += o * (1 + (r.trackTime / o | 0)) : n += o, n -= this.data.getMix(r.animation, e)) : n = 0
  47802. }
  47803. return s.delay = n, s
  47804. }, e.prototype.setEmptyAnimation = function(t, i) {
  47805. var n = this.setAnimationWith(t, e.emptyAnimation, !1);
  47806. return n.mixDuration = i, n.trackEnd = i, n
  47807. }, e.prototype.addEmptyAnimation = function(t, i, n) {
  47808. n <= 0 && (n -= i);
  47809. var r = this.addAnimationWith(t, e.emptyAnimation, !1, n);
  47810. return r.mixDuration = i, r.trackEnd = i, r
  47811. }, e.prototype.setEmptyAnimations = function(t) {
  47812. var e = this.queue.drainDisabled;
  47813. this.queue.drainDisabled = !0;
  47814. for (var i = 0, n = this.tracks.length; i < n; i++) {
  47815. var r = this.tracks[i];
  47816. null != r && this.setEmptyAnimation(r.trackIndex, t)
  47817. }
  47818. this.queue.drainDisabled = e, this.queue.drain()
  47819. }, e.prototype.expandToIndex = function(e) {
  47820. return e < this.tracks.length ? this.tracks[e] : (t.Utils.ensureArrayCapacity(this.tracks, e - this.tracks.length + 1, null), this.tracks.length = e + 1, null)
  47821. }, e.prototype.trackEntry = function(t, e, i, n) {
  47822. var r = this.trackEntryPool.obtain();
  47823. return r.trackIndex = t, r.animation = e, r.loop = i, r.eventThreshold = 0, r.attachmentThreshold = 0, r.drawOrderThreshold = 0, r.animationStart = 0, r.animationEnd = e.duration, r.animationLast = -1, r.nextAnimationLast = -1, r.delay = 0, r.trackTime = 0, r.trackLast = -1, r.nextTrackLast = -1, r.trackEnd = Number.MAX_VALUE, r.timeScale = 1, r.alpha = 1, r.interruptAlpha = 1, r.mixTime = 0, r.mixDuration = null == n ? 0 : this.data.getMix(n.animation, e), r
  47824. }, e.prototype.disposeNext = function(t) {
  47825. for (var e = t.next; null != e;) this.queue.dispose(e), e = e.next;
  47826. t.next = null
  47827. }, e.prototype._animationsChanged = function() {
  47828. this.animationsChanged = !1;
  47829. var t = this.propertyIDs;
  47830. t.clear();
  47831. for (var e = this.mixingTo, i = 0, n = this.tracks.length; i < n; i++) {
  47832. var r = this.tracks[i];
  47833. null != r && r.setTimelineData(null, e, t)
  47834. }
  47835. }, e.prototype.getCurrent = function(t) {
  47836. return t >= this.tracks.length ? null : this.tracks[t]
  47837. }, e.prototype.addListener = function(t) {
  47838. if (null == t) throw new Error("listener cannot be null.");
  47839. this.listeners.push(t)
  47840. }, e.prototype.removeListener = function(t) {
  47841. var e = this.listeners.indexOf(t);
  47842. e >= 0 && this.listeners.splice(e, 1)
  47843. }, e.prototype.clearListeners = function() {
  47844. this.listeners.length = 0
  47845. }, e.prototype.clearListenerNotifications = function() {
  47846. this.queue.clear()
  47847. }, e.emptyAnimation = new t.Animation("<empty>", [], 0), e.SUBSEQUENT = 0, e.FIRST = 1, e.DIP = 2, e.DIP_MIX = 3, e
  47848. })();
  47849. t.AnimationState = e;
  47850. var i = (function() {
  47851. function i() {
  47852. this.timelineData = new Array, this.timelineDipMix = new Array, this.timelinesRotation = new Array
  47853. }
  47854. return i.prototype.reset = function() {
  47855. this.next = null, this.mixingFrom = null, this.animation = null, this.listener = null, this.timelineData.length = 0, this.timelineDipMix.length = 0, this.timelinesRotation.length = 0
  47856. }, i.prototype.setTimelineData = function(i, n, r) {
  47857. null != i && n.push(i);
  47858. var s = null != this.mixingFrom ? this.mixingFrom.setTimelineData(this, n, r) : this;
  47859. null != i && n.pop();
  47860. var o = n,
  47861. a = n.length - 1,
  47862. l = this.animation.timelines,
  47863. h = this.animation.timelines.length,
  47864. c = t.Utils.setArraySize(this.timelineData, h);
  47865. this.timelineDipMix.length = 0;
  47866. var u = t.Utils.setArraySize(this.timelineDipMix, h);
  47867. t: for (var _ = 0; _ < h; _++) {
  47868. var f = l[_].getPropertyId();
  47869. if (r.add(f))
  47870. if (null != i && i.hasTimeline(f)) {
  47871. for (var d = a; d >= 0; d--) {
  47872. var p = o[d];
  47873. if (!p.hasTimeline(f) && p.mixDuration > 0) {
  47874. c[_] = e.DIP_MIX, u[_] = p;
  47875. continue t
  47876. }
  47877. }
  47878. c[_] = e.DIP
  47879. } else c[_] = e.FIRST;
  47880. else c[_] = e.SUBSEQUENT
  47881. }
  47882. return s
  47883. }, i.prototype.hasTimeline = function(t) {
  47884. for (var e = this.animation.timelines, i = 0, n = e.length; i < n; i++)
  47885. if (e[i].getPropertyId() == t) return !0;
  47886. return !1
  47887. }, i.prototype.getAnimationTime = function() {
  47888. if (this.loop) {
  47889. var t = this.animationEnd - this.animationStart;
  47890. return 0 == t ? this.animationStart : this.trackTime % t + this.animationStart
  47891. }
  47892. return Math.min(this.trackTime + this.animationStart, this.animationEnd)
  47893. }, i.prototype.setAnimationLast = function(t) {
  47894. this.animationLast = t, this.nextAnimationLast = t
  47895. }, i.prototype.isComplete = function() {
  47896. return this.trackTime >= this.animationEnd - this.animationStart
  47897. }, i.prototype.resetRotationDirections = function() {
  47898. this.timelinesRotation.length = 0
  47899. }, i
  47900. })();
  47901. t.TrackEntry = i;
  47902. var n, r = (function() {
  47903. function t(t) {
  47904. this.objects = [], this.drainDisabled = !1, this.animState = t
  47905. }
  47906. return t.prototype.start = function(t) {
  47907. this.objects.push(n.start), this.objects.push(t), this.animState.animationsChanged = !0
  47908. }, t.prototype.interrupt = function(t) {
  47909. this.objects.push(n.interrupt), this.objects.push(t)
  47910. }, t.prototype.end = function(t) {
  47911. this.objects.push(n.end), this.objects.push(t), this.animState.animationsChanged = !0
  47912. }, t.prototype.dispose = function(t) {
  47913. this.objects.push(n.dispose), this.objects.push(t)
  47914. }, t.prototype.complete = function(t) {
  47915. this.objects.push(n.complete), this.objects.push(t)
  47916. }, t.prototype.event = function(t, e) {
  47917. this.objects.push(n.event), this.objects.push(t), this.objects.push(e)
  47918. }, t.prototype.drain = function() {
  47919. if (!this.drainDisabled) {
  47920. this.drainDisabled = !0;
  47921. for (var t = this.objects, e = this.animState.listeners, i = 0; i < t.length; i += 2) {
  47922. var r = t[i],
  47923. s = t[i + 1];
  47924. switch (r) {
  47925. case n.start:
  47926. null != s.listener && s.listener.start && s.listener.start(s);
  47927. for (var o = 0; o < e.length; o++) e[o].start && e[o].start(s);
  47928. break;
  47929. case n.interrupt:
  47930. null != s.listener && s.listener.interrupt && s.listener.interrupt(s);
  47931. for (o = 0; o < e.length; o++) e[o].interrupt && e[o].interrupt(s);
  47932. break;
  47933. case n.end:
  47934. null != s.listener && s.listener.end && s.listener.end(s);
  47935. for (o = 0; o < e.length; o++) e[o].end && e[o].end(s);
  47936. case n.dispose:
  47937. null != s.listener && s.listener.dispose && s.listener.dispose(s);
  47938. for (o = 0; o < e.length; o++) e[o].dispose && e[o].dispose(s);
  47939. this.animState.trackEntryPool.free(s);
  47940. break;
  47941. case n.complete:
  47942. null != s.listener && s.listener.complete && s.listener.complete(s);
  47943. for (o = 0; o < e.length; o++) e[o].complete && e[o].complete(s);
  47944. break;
  47945. case n.event:
  47946. var a = t[2 + i++];
  47947. null != s.listener && s.listener.event && s.listener.event(s, a);
  47948. for (o = 0; o < e.length; o++) e[o].event && e[o].event(s, a)
  47949. }
  47950. }
  47951. this.clear(), this.drainDisabled = !1
  47952. }
  47953. }, t.prototype.clear = function() {
  47954. this.objects.length = 0
  47955. }, t
  47956. })();
  47957. t.EventQueue = r, (function(t) {
  47958. t[t.start = 0] = "start", t[t.interrupt = 1] = "interrupt", t[t.end = 2] = "end", t[t.dispose = 3] = "dispose", t[t.complete = 4] = "complete", t[t.event = 5] = "event"
  47959. })(n = t.EventType || (t.EventType = {}));
  47960. var s = (function() {
  47961. function t() {}
  47962. return t.prototype.start = function(t) {}, t.prototype.interrupt = function(t) {}, t.prototype.end = function(t) {}, t.prototype.dispose = function(t) {}, t.prototype.complete = function(t) {}, t.prototype.event = function(t, e) {}, t
  47963. })();
  47964. t.AnimationStateAdapter2 = s
  47965. })(n || (n = {})), (function(t) {
  47966. var e = (function() {
  47967. function t(t) {
  47968. if (this.animationToMixTime = {}, this.defaultMix = 0, null == t) throw new Error("skeletonData cannot be null.");
  47969. this.skeletonData = t
  47970. }
  47971. return t.prototype.setMix = function(t, e, i) {
  47972. var n = this.skeletonData.findAnimation(t);
  47973. if (null == n) throw new Error("Animation not found: " + t);
  47974. var r = this.skeletonData.findAnimation(e);
  47975. if (null == r) throw new Error("Animation not found: " + e);
  47976. this.setMixWith(n, r, i)
  47977. }, t.prototype.setMixWith = function(t, e, i) {
  47978. if (null == t) throw new Error("from cannot be null.");
  47979. if (null == e) throw new Error("to cannot be null.");
  47980. var n = t.name + "." + e.name;
  47981. this.animationToMixTime[n] = i
  47982. }, t.prototype.getMix = function(t, e) {
  47983. var i = t.name + "." + e.name,
  47984. n = this.animationToMixTime[i];
  47985. return void 0 === n ? this.defaultMix : n
  47986. }, t
  47987. })();
  47988. t.AnimationStateData = e
  47989. })(n || (n = {})), (function(t) {
  47990. var e = (function() {
  47991. function e(t, e) {
  47992. void 0 === e && (e = ""), this.assets = {}, this.errors = {}, this.toLoad = 0, this.loaded = 0, this.textureLoader = t, this.pathPrefix = e
  47993. }
  47994. return e.downloadText = function(t, e, i) {
  47995. var n = new XMLHttpRequest;
  47996. n.open("GET", t, !0), n.onload = function() {
  47997. 200 == n.status ? e(n.responseText) : i(n.status, n.responseText)
  47998. }, n.onerror = function() {
  47999. i(n.status, n.responseText)
  48000. }, n.send()
  48001. }, e.downloadBinary = function(t, e, i) {
  48002. var n = new XMLHttpRequest;
  48003. n.open("GET", t, !0), n.responseType = "arraybuffer", n.onload = function() {
  48004. 200 == n.status ? e(new Uint8Array(n.response)) : i(n.status, n.responseText)
  48005. }, n.onerror = function() {
  48006. i(n.status, n.responseText)
  48007. }, n.send()
  48008. }, e.prototype.loadText = function(t, i, n) {
  48009. var r = this;
  48010. void 0 === i && (i = null), void 0 === n && (n = null), t = this.pathPrefix + t, this.toLoad++, e.downloadText(t, (function(e) {
  48011. r.assets[t] = e, i && i(t, e), r.toLoad--, r.loaded++
  48012. }), (function(e, i) {
  48013. r.errors[t] = "Couldn't load text " + t + ": status " + status + ", " + i, n && n(t, "Couldn't load text " + t + ": status " + status + ", " + i), r.toLoad--, r.loaded++
  48014. }))
  48015. }, e.prototype.loadTexture = function(t, e, i) {
  48016. var n = this;
  48017. void 0 === e && (e = null), void 0 === i && (i = null), t = this.pathPrefix + t, this.toLoad++;
  48018. var r = new Image;
  48019. r.crossOrigin = "anonymous", r.onload = function(i) {
  48020. var s = n.textureLoader(r);
  48021. n.assets[t] = s, n.toLoad--, n.loaded++, e && e(t, r)
  48022. }, r.onerror = function(e) {
  48023. n.errors[t] = "Couldn't load image " + t, n.toLoad--, n.loaded++, i && i(t, "Couldn't load image " + t)
  48024. }, r.src = t
  48025. }, e.prototype.loadTextureData = function(t, e, i, n) {
  48026. var r = this;
  48027. void 0 === i && (i = null), void 0 === n && (n = null), t = this.pathPrefix + t, this.toLoad++;
  48028. var s = new Image;
  48029. s.onload = function(e) {
  48030. var n = r.textureLoader(s);
  48031. r.assets[t] = n, r.toLoad--, r.loaded++, i && i(t, s)
  48032. }, s.onerror = function(e) {
  48033. r.errors[t] = "Couldn't load image " + t, r.toLoad--, r.loaded++, n && n(t, "Couldn't load image " + t)
  48034. }, s.src = e
  48035. }, e.prototype.loadTextureAtlas = function(i, n, r) {
  48036. var s = this;
  48037. void 0 === n && (n = null), void 0 === r && (r = null);
  48038. var o = i.lastIndexOf("/") >= 0 ? i.substring(0, i.lastIndexOf("/")) : "";
  48039. i = this.pathPrefix + i, this.toLoad++, e.downloadText(i, (function(e) {
  48040. var a = {
  48041. count: 0
  48042. },
  48043. l = new Array;
  48044. try {
  48045. new t.TextureAtlas(e, function(e) {
  48046. l.push(o + "/" + e);
  48047. var i = document.createElement("img");
  48048. return i.width = 16, i.height = 16, new t.FakeTexture(i)
  48049. })
  48050. } catch (t) {
  48051. var h = t;
  48052. return s.errors[i] = "Couldn't load texture atlas " + i + ": " + h.message, r && r(i, "Couldn't load texture atlas " + i + ": " + h.message), s.toLoad--, void s.loaded++
  48053. }
  48054. for (var c = function(h) {
  48055. var c = !1;
  48056. s.loadTexture(h, (function(h, u) {
  48057. if (a.count++, a.count == l.length)
  48058. if (c) s.errors[i] = "Couldn't load texture atlas page " + h + "} of atlas " + i, r && r(i, "Couldn't load texture atlas page " + h + " of atlas " + i), s.toLoad--, s.loaded++;
  48059. else try {
  48060. var _ = new t.TextureAtlas(e, function(t) {
  48061. return s.get(o + "/" + t)
  48062. });
  48063. s.assets[i] = _, n && n(i, _), s.toLoad--, s.loaded++
  48064. } catch (t) {
  48065. var f = t;
  48066. s.errors[i] = "Couldn't load texture atlas " + i + ": " + f.message, r && r(i, "Couldn't load texture atlas " + i + ": " + f.message), s.toLoad--, s.loaded++
  48067. }
  48068. }), (function(t, e) {
  48069. c = !0, a.count++, a.count == l.length && (s.errors[i] = "Couldn't load texture atlas page " + t + "} of atlas " + i, r && r(i, "Couldn't load texture atlas page " + t + " of atlas " + i), s.toLoad--, s.loaded++)
  48070. }))
  48071. }, u = 0, _ = l; u < _.length; u++) {
  48072. c(_[u])
  48073. }
  48074. }), (function(t, e) {
  48075. s.errors[i] = "Couldn't load texture atlas " + i + ": status " + status + ", " + e, r && r(i, "Couldn't load texture atlas " + i + ": status " + status + ", " + e), s.toLoad--, s.loaded++
  48076. }))
  48077. }, e.prototype.get = function(t) {
  48078. return t = this.pathPrefix + t, this.assets[t]
  48079. }, e.prototype.remove = function(t) {
  48080. t = this.pathPrefix + t;
  48081. var e = this.assets[t];
  48082. e.dispose && e.dispose(), this.assets[t] = null
  48083. }, e.prototype.removeAll = function() {
  48084. for (var t in this.assets) {
  48085. var e = this.assets[t];
  48086. e.dispose && e.dispose()
  48087. }
  48088. this.assets = {}
  48089. }, e.prototype.isLoadingComplete = function() {
  48090. return 0 == this.toLoad
  48091. }, e.prototype.getToLoad = function() {
  48092. return this.toLoad
  48093. }, e.prototype.getLoaded = function() {
  48094. return this.loaded
  48095. }, e.prototype.dispose = function() {
  48096. this.removeAll()
  48097. }, e.prototype.hasErrors = function() {
  48098. return Object.keys(this.errors).length > 0
  48099. }, e.prototype.getErrors = function() {
  48100. return this.errors
  48101. }, e
  48102. })();
  48103. t.AssetManager = e
  48104. })(n || (n = {})), (function(t) {
  48105. var e = (function() {
  48106. function e(t) {
  48107. this.atlas = t
  48108. }
  48109. return e.prototype.newRegionAttachment = function(e, i, n) {
  48110. var r = this.atlas.findRegion(n);
  48111. if (null == r) throw new Error("Region not found in atlas: " + n + " (region attachment: " + i + ")");
  48112. r.renderObject = r;
  48113. var s = new t.RegionAttachment(i);
  48114. return s.setRegion(r), s
  48115. }, e.prototype.newMeshAttachment = function(e, i, n) {
  48116. var r = this.atlas.findRegion(n);
  48117. if (null == r) throw new Error("Region not found in atlas: " + n + " (mesh attachment: " + i + ")");
  48118. r.renderObject = r;
  48119. var s = new t.MeshAttachment(i);
  48120. return s.region = r, s
  48121. }, e.prototype.newBoundingBoxAttachment = function(e, i) {
  48122. return new t.BoundingBoxAttachment(i)
  48123. }, e.prototype.newPathAttachment = function(e, i) {
  48124. return new t.PathAttachment(i)
  48125. }, e.prototype.newPointAttachment = function(e, i) {
  48126. return new t.PointAttachment(i)
  48127. }, e.prototype.newClippingAttachment = function(e, i) {
  48128. return new t.ClippingAttachment(i)
  48129. }, e
  48130. })();
  48131. t.AtlasAttachmentLoader = e
  48132. })(n || (n = {})), (function(t) {
  48133. (function(t) {
  48134. t[t.Normal = 0] = "Normal", t[t.Additive = 1] = "Additive", t[t.Multiply = 2] = "Multiply", t[t.Screen = 3] = "Screen"
  48135. })(t.BlendMode || (t.BlendMode = {}))
  48136. })(n || (n = {})), (function(t) {
  48137. var e = (function() {
  48138. function e(t, e, i) {
  48139. if (this.children = new Array, this.x = 0, this.y = 0, this.rotation = 0, this.scaleX = 0, this.scaleY = 0, this.shearX = 0, this.shearY = 0, this.ax = 0, this.ay = 0, this.arotation = 0, this.ascaleX = 0, this.ascaleY = 0, this.ashearX = 0, this.ashearY = 0, this.appliedValid = !1, this.a = 0, this.b = 0, this.worldX = 0, this.c = 0, this.d = 0, this.worldY = 0, this.sorted = !1, null == t) throw new Error("data cannot be null.");
  48140. if (null == e) throw new Error("skeleton cannot be null.");
  48141. this.data = t, this.skeleton = e, this.parent = i, this.setToSetupPose()
  48142. }
  48143. return e.prototype.update = function() {
  48144. this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY)
  48145. }, e.prototype.updateWorldTransform = function() {
  48146. this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY)
  48147. }, e.prototype.updateWorldTransformWith = function(e, i, n, r, s, o, a) {
  48148. this.ax = e, this.ay = i, this.arotation = n, this.ascaleX = r, this.ascaleY = s, this.ashearX = o, this.ashearY = a, this.appliedValid = !0;
  48149. var l = this.parent;
  48150. if (null == l) {
  48151. var h = n + 90 + a,
  48152. c = t.MathUtils.cosDeg(n + o) * r,
  48153. u = t.MathUtils.cosDeg(h) * s,
  48154. _ = t.MathUtils.sinDeg(n + o) * r,
  48155. f = t.MathUtils.sinDeg(h) * s,
  48156. d = this.skeleton;
  48157. return d.flipX && (e = -e, c = -c, u = -u), d.flipY && (i = -i, _ = -_, f = -f), this.a = c, this.b = u, this.c = _, this.d = f, this.worldX = e + d.x, void(this.worldY = i + d.y)
  48158. }
  48159. var p = l.a,
  48160. m = l.b,
  48161. y = l.c,
  48162. v = l.d;
  48163. switch (this.worldX = p * e + m * i + l.worldX, this.worldY = y * e + v * i + l.worldY, this.data.transformMode) {
  48164. case t.TransformMode.Normal:
  48165. h = n + 90 + a, c = t.MathUtils.cosDeg(n + o) * r, u = t.MathUtils.cosDeg(h) * s, _ = t.MathUtils.sinDeg(n + o) * r, f = t.MathUtils.sinDeg(h) * s;
  48166. return this.a = p * c + m * _, this.b = p * u + m * f, this.c = y * c + v * _, void(this.d = y * u + v * f);
  48167. case t.TransformMode.OnlyTranslation:
  48168. h = n + 90 + a;
  48169. this.a = t.MathUtils.cosDeg(n + o) * r, this.b = t.MathUtils.cosDeg(h) * s, this.c = t.MathUtils.sinDeg(n + o) * r, this.d = t.MathUtils.sinDeg(h) * s;
  48170. break;
  48171. case t.TransformMode.NoRotationOrReflection:
  48172. var g = 0;
  48173. (A = p * p + y * y) > 1e-4 ? (m = y * (A = Math.abs(p * v - m * y) / A), v = p * A, g = Math.atan2(y, p) * t.MathUtils.radDeg) : (p = 0, y = 0, g = 90 - Math.atan2(v, m) * t.MathUtils.radDeg);
  48174. var x = n + o - g,
  48175. b = n + a - g + 90;
  48176. c = t.MathUtils.cosDeg(x) * r, u = t.MathUtils.cosDeg(b) * s, _ = t.MathUtils.sinDeg(x) * r, f = t.MathUtils.sinDeg(b) * s;
  48177. this.a = p * c - m * _, this.b = p * u - m * f, this.c = y * c + v * _, this.d = y * u + v * f;
  48178. break;
  48179. case t.TransformMode.NoScale:
  48180. case t.TransformMode.NoScaleOrReflection:
  48181. var A, C = t.MathUtils.cosDeg(n),
  48182. T = t.MathUtils.sinDeg(n),
  48183. S = p * C + m * T,
  48184. w = y * C + v * T;
  48185. (A = Math.sqrt(S * S + w * w)) > 1e-5 && (A = 1 / A), S *= A, w *= A, A = Math.sqrt(S * S + w * w);
  48186. var E = Math.PI / 2 + Math.atan2(w, S),
  48187. M = Math.cos(E) * A,
  48188. D = Math.sin(E) * A;
  48189. c = t.MathUtils.cosDeg(o) * r, u = t.MathUtils.cosDeg(90 + a) * s, _ = t.MathUtils.sinDeg(o) * r, f = t.MathUtils.sinDeg(90 + a) * s;
  48190. return (this.data.transformMode != t.TransformMode.NoScaleOrReflection ? p * v - m * y < 0 : this.skeleton.flipX != this.skeleton.flipY) && (M = -M, D = -D), this.a = S * c + M * _, this.b = S * u + M * f, this.c = w * c + D * _, void(this.d = w * u + D * f)
  48191. }
  48192. this.skeleton.flipX && (this.a = -this.a, this.b = -this.b), this.skeleton.flipY && (this.c = -this.c, this.d = -this.d)
  48193. }, e.prototype.setToSetupPose = function() {
  48194. var t = this.data;
  48195. this.x = t.x, this.y = t.y, this.rotation = t.rotation, this.scaleX = t.scaleX, this.scaleY = t.scaleY, this.shearX = t.shearX, this.shearY = t.shearY
  48196. }, e.prototype.getWorldRotationX = function() {
  48197. return Math.atan2(this.c, this.a) * t.MathUtils.radDeg
  48198. }, e.prototype.getWorldRotationY = function() {
  48199. return Math.atan2(this.d, this.b) * t.MathUtils.radDeg
  48200. }, e.prototype.getWorldScaleX = function() {
  48201. return Math.sqrt(this.a * this.a + this.c * this.c)
  48202. }, e.prototype.getWorldScaleY = function() {
  48203. return Math.sqrt(this.b * this.b + this.d * this.d)
  48204. }, e.prototype.updateAppliedTransform = function() {
  48205. this.appliedValid = !0;
  48206. var e = this.parent;
  48207. if (null == e) return this.ax = this.worldX, this.ay = this.worldY, this.arotation = Math.atan2(this.c, this.a) * t.MathUtils.radDeg, this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c), this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d), this.ashearX = 0, void(this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * t.MathUtils.radDeg);
  48208. var i = e.a,
  48209. n = e.b,
  48210. r = e.c,
  48211. s = e.d,
  48212. o = 1 / (i * s - n * r),
  48213. a = this.worldX - e.worldX,
  48214. l = this.worldY - e.worldY;
  48215. this.ax = a * s * o - l * n * o, this.ay = l * i * o - a * r * o;
  48216. var h = o * s,
  48217. c = o * i,
  48218. u = o * n,
  48219. _ = o * r,
  48220. f = h * this.a - u * this.c,
  48221. d = h * this.b - u * this.d,
  48222. p = c * this.c - _ * this.a,
  48223. m = c * this.d - _ * this.b;
  48224. if (this.ashearX = 0, this.ascaleX = Math.sqrt(f * f + p * p), this.ascaleX > 1e-4) {
  48225. var y = f * m - d * p;
  48226. this.ascaleY = y / this.ascaleX, this.ashearY = Math.atan2(f * d + p * m, y) * t.MathUtils.radDeg, this.arotation = Math.atan2(p, f) * t.MathUtils.radDeg
  48227. } else this.ascaleX = 0, this.ascaleY = Math.sqrt(d * d + m * m), this.ashearY = 0, this.arotation = 90 - Math.atan2(m, d) * t.MathUtils.radDeg
  48228. }, e.prototype.worldToLocal = function(t) {
  48229. var e = this.a,
  48230. i = this.b,
  48231. n = this.c,
  48232. r = this.d,
  48233. s = 1 / (e * r - i * n),
  48234. o = t.x - this.worldX,
  48235. a = t.y - this.worldY;
  48236. return t.x = o * r * s - a * i * s, t.y = a * e * s - o * n * s, t
  48237. }, e.prototype.localToWorld = function(t) {
  48238. var e = t.x,
  48239. i = t.y;
  48240. return t.x = e * this.a + i * this.b + this.worldX, t.y = e * this.c + i * this.d + this.worldY, t
  48241. }, e.prototype.worldToLocalRotation = function(e) {
  48242. var i = t.MathUtils.sinDeg(e),
  48243. n = t.MathUtils.cosDeg(e);
  48244. return Math.atan2(this.a * i - this.c * n, this.d * n - this.b * i) * t.MathUtils.radDeg
  48245. }, e.prototype.localToWorldRotation = function(e) {
  48246. var i = t.MathUtils.sinDeg(e),
  48247. n = t.MathUtils.cosDeg(e);
  48248. return Math.atan2(n * this.c + i * this.d, n * this.a + i * this.b) * t.MathUtils.radDeg
  48249. }, e.prototype.rotateWorld = function(e) {
  48250. var i = this.a,
  48251. n = this.b,
  48252. r = this.c,
  48253. s = this.d,
  48254. o = t.MathUtils.cosDeg(e),
  48255. a = t.MathUtils.sinDeg(e);
  48256. this.a = o * i - a * r, this.b = o * n - a * s, this.c = a * i + o * r, this.d = a * n + o * s, this.appliedValid = !1
  48257. }, e
  48258. })();
  48259. t.Bone = e
  48260. })(n || (n = {})), (function(t) {
  48261. var e, i = (function() {
  48262. return function(t, i, n) {
  48263. if (this.x = 0, this.y = 0, this.rotation = 0, this.scaleX = 1, this.scaleY = 1, this.shearX = 0, this.shearY = 0, this.transformMode = e.Normal, t < 0) throw new Error("index must be >= 0.");
  48264. if (null == i) throw new Error("name cannot be null.");
  48265. this.index = t, this.name = i, this.parent = n
  48266. }
  48267. })();
  48268. t.BoneData = i, (function(t) {
  48269. t[t.Normal = 0] = "Normal", t[t.OnlyTranslation = 1] = "OnlyTranslation", t[t.NoRotationOrReflection = 2] = "NoRotationOrReflection", t[t.NoScale = 3] = "NoScale", t[t.NoScaleOrReflection = 4] = "NoScaleOrReflection"
  48270. })(e = t.TransformMode || (t.TransformMode = {}))
  48271. })(n || (n = {})), (function(t) {
  48272. var e = (function() {
  48273. return function(t, e) {
  48274. if (null == e) throw new Error("data cannot be null.");
  48275. this.time = t, this.data = e
  48276. }
  48277. })();
  48278. t.Event = e
  48279. })(n || (n = {})), (function(t) {
  48280. var e = (function() {
  48281. return function(t) {
  48282. this.name = t
  48283. }
  48284. })();
  48285. t.EventData = e
  48286. })(n || (n = {})), (function(t) {
  48287. var e = (function() {
  48288. function e(t, e) {
  48289. if (this.mix = 1, this.bendDirection = 0, null == t) throw new Error("data cannot be null.");
  48290. if (null == e) throw new Error("skeleton cannot be null.");
  48291. this.data = t, this.mix = t.mix, this.bendDirection = t.bendDirection, this.bones = new Array;
  48292. for (var i = 0; i < t.bones.length; i++) this.bones.push(e.findBone(t.bones[i].name));
  48293. this.target = e.findBone(t.target.name)
  48294. }
  48295. return e.prototype.getOrder = function() {
  48296. return this.data.order
  48297. }, e.prototype.apply = function() {
  48298. this.update()
  48299. }, e.prototype.update = function() {
  48300. var t = this.target,
  48301. e = this.bones;
  48302. switch (e.length) {
  48303. case 1:
  48304. this.apply1(e[0], t.worldX, t.worldY, this.mix);
  48305. break;
  48306. case 2:
  48307. this.apply2(e[0], e[1], t.worldX, t.worldY, this.bendDirection, this.mix)
  48308. }
  48309. }, e.prototype.apply1 = function(e, i, n, r) {
  48310. e.appliedValid || e.updateAppliedTransform();
  48311. var s = e.parent,
  48312. o = 1 / (s.a * s.d - s.b * s.c),
  48313. a = i - s.worldX,
  48314. l = n - s.worldY,
  48315. h = (a * s.d - l * s.b) * o - e.ax,
  48316. c = (l * s.a - a * s.c) * o - e.ay,
  48317. u = Math.atan2(c, h) * t.MathUtils.radDeg - e.ashearX - e.arotation;
  48318. e.ascaleX < 0 && (u += 180), u > 180 ? u -= 360 : u < -180 && (u += 360), e.updateWorldTransformWith(e.ax, e.ay, e.arotation + u * r, e.ascaleX, e.ascaleY, e.ashearX, e.ashearY)
  48319. }, e.prototype.apply2 = function(e, i, n, r, s, o) {
  48320. if (0 != o) {
  48321. e.appliedValid || e.updateAppliedTransform(), i.appliedValid || i.updateAppliedTransform();
  48322. var a = e.ax,
  48323. l = e.ay,
  48324. h = e.ascaleX,
  48325. c = e.ascaleY,
  48326. u = i.ascaleX,
  48327. _ = 0,
  48328. f = 0,
  48329. d = 0;
  48330. h < 0 ? (h = -h, _ = 180, d = -1) : (_ = 0, d = 1), c < 0 && (c = -c, d = -d), u < 0 ? (u = -u, f = 180) : f = 0;
  48331. var p = i.ax,
  48332. m = 0,
  48333. y = 0,
  48334. v = 0,
  48335. g = e.a,
  48336. x = e.b,
  48337. b = e.c,
  48338. A = e.d,
  48339. C = Math.abs(h - c) <= 1e-4;
  48340. C ? (y = g * p + x * (m = i.ay) + e.worldX, v = b * p + A * m + e.worldY) : (m = 0, y = g * p + e.worldX, v = b * p + e.worldY);
  48341. var T = e.parent;
  48342. g = T.a, x = T.b, b = T.c;
  48343. var S = 1 / (g * (A = T.d) - x * b),
  48344. w = n - T.worldX,
  48345. E = r - T.worldY,
  48346. M = (w * A - E * x) * S - a,
  48347. D = (E * g - w * b) * S - l,
  48348. B = ((w = y - T.worldX) * A - (E = v - T.worldY) * x) * S - a,
  48349. I = (E * g - w * b) * S - l,
  48350. P = Math.sqrt(B * B + I * I),
  48351. R = i.data.length * u,
  48352. O = 0,
  48353. L = 0;
  48354. t: if (C) {
  48355. var F = (M * M + D * D - P * P - (R *= h) * R) / (2 * P * R);
  48356. F < -1 ? F = -1 : F > 1 && (F = 1), L = Math.acos(F) * s, g = P + R * F, x = R * Math.sin(L), O = Math.atan2(D * g - M * x, M * g + D * x)
  48357. } else {
  48358. var N = (g = h * R) * g,
  48359. V = (x = c * R) * x,
  48360. k = M * M + D * D,
  48361. G = Math.atan2(D, M),
  48362. U = -2 * V * P,
  48363. z = V - N;
  48364. if ((A = U * U - 4 * z * (b = V * P * P + N * k - N * V)) >= 0) {
  48365. var j = Math.sqrt(A);
  48366. U < 0 && (j = -j);
  48367. var W = (j = -(U + j) / 2) / z,
  48368. H = b / j,
  48369. X = Math.abs(W) < Math.abs(H) ? W : H;
  48370. if (X * X <= k) {
  48371. E = Math.sqrt(k - X * X) * s, O = G - Math.atan2(E, X), L = Math.atan2(E / c, (X - P) / h);
  48372. break t
  48373. }
  48374. }
  48375. var Y = t.MathUtils.PI,
  48376. q = P - g,
  48377. J = q * q,
  48378. Z = 0,
  48379. K = 0,
  48380. Q = P + g,
  48381. $ = Q * Q,
  48382. tt = 0;
  48383. (b = -g * P / (N - V)) >= -1 && b <= 1 && (b = Math.acos(b), (A = (w = g * Math.cos(b) + P) * w + (E = x * Math.sin(b)) * E) < J && (Y = b, J = A, q = w, Z = E), A > $ && (K = b, $ = A, Q = w, tt = E)), k <= (J + $) / 2 ? (O = G - Math.atan2(Z * s, q), L = Y * s) : (O = G - Math.atan2(tt * s, Q), L = K * s)
  48384. }
  48385. var et = Math.atan2(m, p) * d,
  48386. it = e.arotation;
  48387. (O = (O - et) * t.MathUtils.radDeg + _ - it) > 180 ? O -= 360 : O < -180 && (O += 360), e.updateWorldTransformWith(a, l, it + O * o, e.ascaleX, e.ascaleY, 0, 0), it = i.arotation, (L = ((L + et) * t.MathUtils.radDeg - i.ashearX) * d + f - it) > 180 ? L -= 360 : L < -180 && (L += 360), i.updateWorldTransformWith(p, m, it + L * o, i.ascaleX, i.ascaleY, i.ashearX, i.ashearY)
  48388. } else i.updateWorldTransform()
  48389. }, e
  48390. })();
  48391. t.IkConstraint = e
  48392. })(n || (n = {})), (function(t) {
  48393. var e = (function() {
  48394. return function(t) {
  48395. this.order = 0, this.bones = new Array, this.bendDirection = 1, this.mix = 1, this.name = t
  48396. }
  48397. })();
  48398. t.IkConstraintData = e
  48399. })(n || (n = {})), (function(t) {
  48400. var e = (function() {
  48401. function e(t, e) {
  48402. if (this.position = 0, this.spacing = 0, this.rotateMix = 0, this.translateMix = 0, this.spaces = new Array, this.positions = new Array, this.world = new Array, this.curves = new Array, this.lengths = new Array, this.segments = new Array, null == t) throw new Error("data cannot be null.");
  48403. if (null == e) throw new Error("skeleton cannot be null.");
  48404. this.data = t, this.bones = new Array;
  48405. for (var i = 0, n = t.bones.length; i < n; i++) this.bones.push(e.findBone(t.bones[i].name));
  48406. this.target = e.findSlot(t.target.name), this.position = t.position, this.spacing = t.spacing, this.rotateMix = t.rotateMix, this.translateMix = t.translateMix
  48407. }
  48408. return e.prototype.apply = function() {
  48409. this.update()
  48410. }, e.prototype.update = function() {
  48411. var i = this.target.getAttachment();
  48412. if (i instanceof t.PathAttachment) {
  48413. var n = this.rotateMix,
  48414. r = this.translateMix,
  48415. s = n > 0;
  48416. if (r > 0 || s) {
  48417. var o = this.data,
  48418. a = o.spacingMode,
  48419. l = a == t.SpacingMode.Length,
  48420. h = o.rotateMode,
  48421. c = h == t.RotateMode.Tangent,
  48422. u = h == t.RotateMode.ChainScale,
  48423. _ = this.bones.length,
  48424. f = c ? _ : _ + 1,
  48425. d = this.bones,
  48426. p = t.Utils.setArraySize(this.spaces, f),
  48427. m = null,
  48428. y = this.spacing;
  48429. if (u || l) {
  48430. u && (m = t.Utils.setArraySize(this.lengths, _));
  48431. for (var v = 0, g = f - 1; v < g;) {
  48432. var x = (B = d[v]).data.length;
  48433. if (x < e.epsilon) u && (m[v] = 0), p[++v] = 0;
  48434. else {
  48435. var b = x * B.a,
  48436. A = x * B.c,
  48437. C = Math.sqrt(b * b + A * A);
  48438. u && (m[v] = C), p[++v] = (l ? x + y : y) * C / x
  48439. }
  48440. }
  48441. } else
  48442. for (v = 1; v < f; v++) p[v] = y;
  48443. var T = this.computeWorldPositions(i, f, c, o.positionMode == t.PositionMode.Percent, a == t.SpacingMode.Percent),
  48444. S = T[0],
  48445. w = T[1],
  48446. E = o.offsetRotation,
  48447. M = !1;
  48448. if (0 == E) M = h == t.RotateMode.Chain;
  48449. else M = !1, E *= (D = this.target.bone).a * D.d - D.b * D.c > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad;
  48450. v = 0;
  48451. for (var D = 3; v < _; v++, D += 3) {
  48452. var B;
  48453. (B = d[v]).worldX += (S - B.worldX) * r, B.worldY += (w - B.worldY) * r;
  48454. var I = (b = T[D]) - S,
  48455. P = (A = T[D + 1]) - w;
  48456. if (u) {
  48457. var R = m[v];
  48458. if (0 != R) {
  48459. var O = (Math.sqrt(I * I + P * P) / R - 1) * n + 1;
  48460. B.a *= O, B.c *= O
  48461. }
  48462. }
  48463. if (S = b, w = A, s) {
  48464. var L = B.a,
  48465. F = B.b,
  48466. N = B.c,
  48467. V = B.d,
  48468. k = 0,
  48469. G = 0,
  48470. U = 0;
  48471. if (k = c ? T[D - 1] : 0 == p[v + 1] ? T[D + 2] : Math.atan2(P, I), k -= Math.atan2(N, L), M) {
  48472. G = Math.cos(k), U = Math.sin(k);
  48473. var z = B.data.length;
  48474. S += (z * (G * L - U * N) - I) * n, w += (z * (U * L + G * N) - P) * n
  48475. } else k += E;
  48476. k > t.MathUtils.PI ? k -= t.MathUtils.PI2 : k < -t.MathUtils.PI && (k += t.MathUtils.PI2), k *= n, G = Math.cos(k), U = Math.sin(k), B.a = G * L - U * N, B.b = G * F - U * V, B.c = U * L + G * N, B.d = U * F + G * V
  48477. }
  48478. B.appliedValid = !1
  48479. }
  48480. }
  48481. }
  48482. }, e.prototype.computeWorldPositions = function(i, n, r, s, o) {
  48483. var a = this.target,
  48484. l = this.position,
  48485. h = this.spaces,
  48486. c = t.Utils.setArraySize(this.positions, 3 * n + 2),
  48487. u = null,
  48488. _ = i.closed,
  48489. f = i.worldVerticesLength,
  48490. d = f / 6,
  48491. p = e.NONE;
  48492. if (!i.constantSpeed) {
  48493. var m = i.lengths,
  48494. y = m[d -= _ ? 1 : 2];
  48495. if (s && (l *= y), o)
  48496. for (var v = 0; v < n; v++) h[v] *= y;
  48497. u = t.Utils.setArraySize(this.world, 8);
  48498. v = 0;
  48499. for (var g = 0, x = 0; v < n; v++, g += 3) {
  48500. var b = l += H = h[v];
  48501. if (_)(b %= y) < 0 && (b += y), x = 0;
  48502. else {
  48503. if (b < 0) {
  48504. p != e.BEFORE && (p = e.BEFORE, i.computeWorldVertices(a, 2, 4, u, 0, 2)), this.addBeforePosition(b, u, 0, c, g);
  48505. continue
  48506. }
  48507. if (b > y) {
  48508. p != e.AFTER && (p = e.AFTER, i.computeWorldVertices(a, f - 6, 4, u, 0, 2)), this.addAfterPosition(b - y, u, 0, c, g);
  48509. continue
  48510. }
  48511. }
  48512. for (;; x++) {
  48513. var A = m[x];
  48514. if (!(b > A)) {
  48515. if (0 == x) b /= A;
  48516. else b = (b - (J = m[x - 1])) / (A - J);
  48517. break
  48518. }
  48519. }
  48520. x != p && (p = x, _ && x == d ? (i.computeWorldVertices(a, f - 4, 4, u, 0, 2), i.computeWorldVertices(a, 0, 4, u, 4, 2)) : i.computeWorldVertices(a, 6 * x + 2, 8, u, 0, 2)), this.addCurvePosition(b, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], c, g, r || v > 0 && 0 == H)
  48521. }
  48522. return c
  48523. }
  48524. _ ? (f += 2, u = t.Utils.setArraySize(this.world, f), i.computeWorldVertices(a, 2, f - 4, u, 0, 2), i.computeWorldVertices(a, 0, 2, u, f - 4, 2), u[f - 2] = u[0], u[f - 1] = u[1]) : (d--, f -= 4, u = t.Utils.setArraySize(this.world, f), i.computeWorldVertices(a, 2, f, u, 0, 2));
  48525. for (var C = t.Utils.setArraySize(this.curves, d), T = 0, S = u[0], w = u[1], E = 0, M = 0, D = 0, B = 0, I = 0, P = 0, R = 0, O = 0, L = 0, F = 0, N = 0, V = 0, k = 0, G = 0, U = (v = 0, 2); v < d; v++, U += 6) E = u[U], M = u[U + 1], D = u[U + 2], B = u[U + 3], I = u[U + 4], P = u[U + 5], N = 2 * (R = .1875 * (S - 2 * E + D)) + (L = .09375 * (3 * (E - D) - S + I)), V = 2 * (O = .1875 * (w - 2 * M + B)) + (F = .09375 * (3 * (M - B) - w + P)), k = .75 * (E - S) + R + .16666667 * L, G = .75 * (M - w) + O + .16666667 * F, T += Math.sqrt(k * k + G * G), k += N, G += V, N += L, V += F, T += Math.sqrt(k * k + G * G), k += N, G += V, T += Math.sqrt(k * k + G * G), k += N + L, G += V + F, T += Math.sqrt(k * k + G * G), C[v] = T, S = I, w = P;
  48526. if (s && (l *= T), o)
  48527. for (v = 0; v < n; v++) h[v] *= T;
  48528. for (var z = this.segments, j = 0, W = (v = 0, g = 0, x = 0, 0); v < n; v++, g += 3) {
  48529. var H;
  48530. b = l += H = h[v];
  48531. if (_)(b %= T) < 0 && (b += T), x = 0;
  48532. else {
  48533. if (b < 0) {
  48534. this.addBeforePosition(b, u, 0, c, g);
  48535. continue
  48536. }
  48537. if (b > T) {
  48538. this.addAfterPosition(b - T, u, f - 4, c, g);
  48539. continue
  48540. }
  48541. }
  48542. for (;; x++) {
  48543. var X = C[x];
  48544. if (!(b > X)) {
  48545. if (0 == x) b /= X;
  48546. else b = (b - (J = C[x - 1])) / (X - J);
  48547. break
  48548. }
  48549. }
  48550. if (x != p) {
  48551. p = x;
  48552. var Y = 6 * x;
  48553. for (S = u[Y], w = u[Y + 1], E = u[Y + 2], M = u[Y + 3], D = u[Y + 4], B = u[Y + 5], I = u[Y + 6], P = u[Y + 7], N = 2 * (R = .03 * (S - 2 * E + D)) + (L = .006 * (3 * (E - D) - S + I)), V = 2 * (O = .03 * (w - 2 * M + B)) + (F = .006 * (3 * (M - B) - w + P)), k = .3 * (E - S) + R + .16666667 * L, G = .3 * (M - w) + O + .16666667 * F, j = Math.sqrt(k * k + G * G), z[0] = j, Y = 1; Y < 8; Y++) k += N, G += V, N += L, V += F, j += Math.sqrt(k * k + G * G), z[Y] = j;
  48554. k += N, G += V, j += Math.sqrt(k * k + G * G), z[8] = j, k += N + L, G += V + F, j += Math.sqrt(k * k + G * G), z[9] = j, W = 0
  48555. }
  48556. for (b *= j;; W++) {
  48557. var q = z[W];
  48558. if (!(b > q)) {
  48559. var J;
  48560. if (0 == W) b /= q;
  48561. else b = W + (b - (J = z[W - 1])) / (q - J);
  48562. break
  48563. }
  48564. }
  48565. this.addCurvePosition(.1 * b, S, w, E, M, D, B, I, P, c, g, r || v > 0 && 0 == H)
  48566. }
  48567. return c
  48568. }, e.prototype.addBeforePosition = function(t, e, i, n, r) {
  48569. var s = e[i],
  48570. o = e[i + 1],
  48571. a = e[i + 2] - s,
  48572. l = e[i + 3] - o,
  48573. h = Math.atan2(l, a);
  48574. n[r] = s + t * Math.cos(h), n[r + 1] = o + t * Math.sin(h), n[r + 2] = h
  48575. }, e.prototype.addAfterPosition = function(t, e, i, n, r) {
  48576. var s = e[i + 2],
  48577. o = e[i + 3],
  48578. a = s - e[i],
  48579. l = o - e[i + 1],
  48580. h = Math.atan2(l, a);
  48581. n[r] = s + t * Math.cos(h), n[r + 1] = o + t * Math.sin(h), n[r + 2] = h
  48582. }, e.prototype.addCurvePosition = function(t, e, i, n, r, s, o, a, l, h, c, u) {
  48583. (0 == t || isNaN(t)) && (t = 1e-4);
  48584. var _ = t * t,
  48585. f = _ * t,
  48586. d = 1 - t,
  48587. p = d * d,
  48588. m = p * d,
  48589. y = d * t,
  48590. v = 3 * y,
  48591. g = d * v,
  48592. x = v * t,
  48593. b = e * m + n * g + s * x + a * f,
  48594. A = i * m + r * g + o * x + l * f;
  48595. h[c] = b, h[c + 1] = A, u && (h[c + 2] = Math.atan2(A - (i * p + r * y * 2 + o * _), b - (e * p + n * y * 2 + s * _)))
  48596. }, e.prototype.getOrder = function() {
  48597. return this.data.order
  48598. }, e.NONE = -1, e.BEFORE = -2, e.AFTER = -3, e.epsilon = 1e-5, e
  48599. })();
  48600. t.PathConstraint = e
  48601. })(n || (n = {})), (function(t) {
  48602. var e = (function() {
  48603. return function(t) {
  48604. this.order = 0, this.bones = new Array, this.name = t
  48605. }
  48606. })();
  48607. t.PathConstraintData = e, (function(t) {
  48608. t[t.Fixed = 0] = "Fixed", t[t.Percent = 1] = "Percent"
  48609. })(t.PositionMode || (t.PositionMode = {})), (function(t) {
  48610. t[t.Length = 0] = "Length", t[t.Fixed = 1] = "Fixed", t[t.Percent = 2] = "Percent"
  48611. })(t.SpacingMode || (t.SpacingMode = {})), (function(t) {
  48612. t[t.Tangent = 0] = "Tangent", t[t.Chain = 1] = "Chain", t[t.ChainScale = 2] = "ChainScale"
  48613. })(t.RotateMode || (t.RotateMode = {}))
  48614. })(n || (n = {})), (function(t) {
  48615. var e = (function() {
  48616. function t(t) {
  48617. this.toLoad = new Array, this.assets = {}, this.clientId = t
  48618. }
  48619. return t.prototype.loaded = function() {
  48620. var t = 0;
  48621. for (var e in this.assets) t++;
  48622. return t
  48623. }, t
  48624. })(),
  48625. i = (function() {
  48626. function t(t) {
  48627. void 0 === t && (t = ""), this.clientAssets = {}, this.queuedAssets = {}, this.rawAssets = {}, this.errors = {}, this.pathPrefix = t
  48628. }
  48629. return t.prototype.queueAsset = function(t, i, n) {
  48630. var r = this.clientAssets[t];
  48631. return null !== r && void 0 !== r || (r = new e(t), this.clientAssets[t] = r), null !== i && (r.textureLoader = i), r.toLoad.push(n), this.queuedAssets[n] !== n && (this.queuedAssets[n] = n, !0)
  48632. }, t.prototype.loadText = function(t, e) {
  48633. var i = this;
  48634. if (e = this.pathPrefix + e, this.queueAsset(t, null, e)) {
  48635. var n = new XMLHttpRequest;
  48636. n.onreadystatechange = function() {
  48637. n.readyState == XMLHttpRequest.DONE && (n.status >= 200 && n.status < 300 ? i.rawAssets[e] = n.responseText : i.errors[e] = "Couldn't load text " + e + ": status " + n.status + ", " + n.responseText)
  48638. }, n.open("GET", e, !0), n.send()
  48639. }
  48640. }, t.prototype.loadJson = function(t, e) {
  48641. var i = this;
  48642. if (e = this.pathPrefix + e, this.queueAsset(t, null, e)) {
  48643. var n = new XMLHttpRequest;
  48644. n.onreadystatechange = function() {
  48645. n.readyState == XMLHttpRequest.DONE && (n.status >= 200 && n.status < 300 ? i.rawAssets[e] = JSON.parse(n.responseText) : i.errors[e] = "Couldn't load text " + e + ": status " + n.status + ", " + n.responseText)
  48646. }, n.open("GET", e, !0), n.send()
  48647. }
  48648. }, t.prototype.loadTexture = function(t, e, i) {
  48649. var n = this;
  48650. if (i = this.pathPrefix + i, this.queueAsset(t, e, i)) {
  48651. var r = new Image;
  48652. r.src = i, r.crossOrigin = "anonymous", r.onload = function(t) {
  48653. n.rawAssets[i] = r
  48654. }, r.onerror = function(t) {
  48655. n.errors[i] = "Couldn't load image " + i
  48656. }
  48657. }
  48658. }, t.prototype.get = function(t, e) {
  48659. e = this.pathPrefix + e;
  48660. var i = this.clientAssets[t];
  48661. return null === i || void 0 === i || i.assets[e]
  48662. }, t.prototype.updateClientAssets = function(t) {
  48663. for (var e = 0; e < t.toLoad.length; e++) {
  48664. var i = t.toLoad[e],
  48665. n = t.assets[i];
  48666. if (null === n || void 0 === n) {
  48667. var r = this.rawAssets[i];
  48668. if (null === r || void 0 === r) continue;
  48669. r instanceof HTMLImageElement ? t.assets[i] = t.textureLoader(r) : t.assets[i] = r
  48670. }
  48671. }
  48672. }, t.prototype.isLoadingComplete = function(t) {
  48673. var e = this.clientAssets[t];
  48674. return null === e || void 0 === e || (this.updateClientAssets(e), e.toLoad.length == e.loaded())
  48675. }, t.prototype.dispose = function() {}, t.prototype.hasErrors = function() {
  48676. return Object.keys(this.errors).length > 0
  48677. }, t.prototype.getErrors = function() {
  48678. return this.errors
  48679. }, t
  48680. })();
  48681. t.SharedAssetManager = i
  48682. })(n || (n = {})), (function(t) {
  48683. var e = (function() {
  48684. function e(e) {
  48685. if (this._updateCache = new Array, this.updateCacheReset = new Array, this.time = 0, this.flipX = !1, this.flipY = !1, this.x = 0, this.y = 0, null == e) throw new Error("data cannot be null.");
  48686. this.data = e, this.bones = new Array;
  48687. for (var i = 0; i < e.bones.length; i++) {
  48688. var n = e.bones[i],
  48689. r = void 0;
  48690. if (null == n.parent) r = new t.Bone(n, this, null);
  48691. else {
  48692. var s = this.bones[n.parent.index];
  48693. r = new t.Bone(n, this, s), s.children.push(r)
  48694. }
  48695. this.bones.push(r)
  48696. }
  48697. this.slots = new Array, this.drawOrder = new Array;
  48698. for (i = 0; i < e.slots.length; i++) {
  48699. var o = e.slots[i],
  48700. a = (r = this.bones[o.boneData.index], new t.Slot(o, r));
  48701. this.slots.push(a), this.drawOrder.push(a)
  48702. }
  48703. this.ikConstraints = new Array;
  48704. for (i = 0; i < e.ikConstraints.length; i++) {
  48705. var l = e.ikConstraints[i];
  48706. this.ikConstraints.push(new t.IkConstraint(l, this))
  48707. }
  48708. this.transformConstraints = new Array;
  48709. for (i = 0; i < e.transformConstraints.length; i++) {
  48710. var h = e.transformConstraints[i];
  48711. this.transformConstraints.push(new t.TransformConstraint(h, this))
  48712. }
  48713. this.pathConstraints = new Array;
  48714. for (i = 0; i < e.pathConstraints.length; i++) {
  48715. var c = e.pathConstraints[i];
  48716. this.pathConstraints.push(new t.PathConstraint(c, this))
  48717. }
  48718. this.color = new t.Color(1, 1, 1, 1), this.updateCache()
  48719. }
  48720. return e.prototype.updateCache = function() {
  48721. this._updateCache.length = 0, this.updateCacheReset.length = 0;
  48722. for (var t = this.bones, e = 0, i = t.length; e < i; e++) t[e].sorted = !1;
  48723. var n = this.ikConstraints,
  48724. r = this.transformConstraints,
  48725. s = this.pathConstraints,
  48726. o = n.length,
  48727. a = r.length,
  48728. l = s.length,
  48729. h = o + a + l;
  48730. t: for (e = 0; e < h; e++) {
  48731. for (var c = 0; c < o; c++) {
  48732. if ((u = n[c]).data.order == e) {
  48733. this.sortIkConstraint(u);
  48734. continue t
  48735. }
  48736. }
  48737. for (c = 0; c < a; c++) {
  48738. if ((u = r[c]).data.order == e) {
  48739. this.sortTransformConstraint(u);
  48740. continue t
  48741. }
  48742. }
  48743. for (c = 0; c < l; c++) {
  48744. var u;
  48745. if ((u = s[c]).data.order == e) {
  48746. this.sortPathConstraint(u);
  48747. continue t
  48748. }
  48749. }
  48750. }
  48751. for (e = 0, i = t.length; e < i; e++) this.sortBone(t[e])
  48752. }, e.prototype.sortIkConstraint = function(t) {
  48753. var e = t.target;
  48754. this.sortBone(e);
  48755. var i = t.bones,
  48756. n = i[0];
  48757. if (this.sortBone(n), i.length > 1) {
  48758. var r = i[i.length - 1];
  48759. this._updateCache.indexOf(r) > -1 || this.updateCacheReset.push(r)
  48760. }
  48761. this._updateCache.push(t), this.sortReset(n.children), i[i.length - 1].sorted = !0
  48762. }, e.prototype.sortPathConstraint = function(e) {
  48763. var i = e.target,
  48764. n = i.data.index,
  48765. r = i.bone;
  48766. null != this.skin && this.sortPathConstraintAttachment(this.skin, n, r), null != this.data.defaultSkin && this.data.defaultSkin != this.skin && this.sortPathConstraintAttachment(this.data.defaultSkin, n, r);
  48767. for (var s = 0, o = this.data.skins.length; s < o; s++) this.sortPathConstraintAttachment(this.data.skins[s], n, r);
  48768. var a = i.getAttachment();
  48769. a instanceof t.PathAttachment && this.sortPathConstraintAttachmentWith(a, r);
  48770. var l = e.bones,
  48771. h = l.length;
  48772. for (s = 0; s < h; s++) this.sortBone(l[s]);
  48773. this._updateCache.push(e);
  48774. for (s = 0; s < h; s++) this.sortReset(l[s].children);
  48775. for (s = 0; s < h; s++) l[s].sorted = !0
  48776. }, e.prototype.sortTransformConstraint = function(t) {
  48777. this.sortBone(t.target);
  48778. var e = t.bones,
  48779. i = e.length;
  48780. if (t.data.local)
  48781. for (var n = 0; n < i; n++) {
  48782. var r = e[n];
  48783. this.sortBone(r.parent), this._updateCache.indexOf(r) > -1 || this.updateCacheReset.push(r)
  48784. } else
  48785. for (n = 0; n < i; n++) this.sortBone(e[n]);
  48786. this._updateCache.push(t);
  48787. for (var s = 0; s < i; s++) this.sortReset(e[s].children);
  48788. for (s = 0; s < i; s++) e[s].sorted = !0
  48789. }, e.prototype.sortPathConstraintAttachment = function(t, e, i) {
  48790. var n = t.attachments[e];
  48791. if (n)
  48792. for (var r in n) this.sortPathConstraintAttachmentWith(n[r], i)
  48793. }, e.prototype.sortPathConstraintAttachmentWith = function(e, i) {
  48794. if (e instanceof t.PathAttachment) {
  48795. var n = e.bones;
  48796. if (null == n) this.sortBone(i);
  48797. else
  48798. for (var r = this.bones, s = 0; s < n.length;)
  48799. for (var o = n[s++], a = s + o; s < a; s++) {
  48800. var l = n[s];
  48801. this.sortBone(r[l])
  48802. }
  48803. }
  48804. }, e.prototype.sortBone = function(t) {
  48805. if (!t.sorted) {
  48806. var e = t.parent;
  48807. null != e && this.sortBone(e), t.sorted = !0, this._updateCache.push(t)
  48808. }
  48809. }, e.prototype.sortReset = function(t) {
  48810. for (var e = 0, i = t.length; e < i; e++) {
  48811. var n = t[e];
  48812. n.sorted && this.sortReset(n.children), n.sorted = !1
  48813. }
  48814. }, e.prototype.updateWorldTransform = function() {
  48815. for (var t = this.updateCacheReset, e = 0, i = t.length; e < i; e++) {
  48816. var n = t[e];
  48817. n.ax = n.x, n.ay = n.y, n.arotation = n.rotation, n.ascaleX = n.scaleX, n.ascaleY = n.scaleY, n.ashearX = n.shearX, n.ashearY = n.shearY, n.appliedValid = !0
  48818. }
  48819. var r = this._updateCache;
  48820. for (e = 0, i = r.length; e < i; e++) r[e].update()
  48821. }, e.prototype.setToSetupPose = function() {
  48822. this.setBonesToSetupPose(), this.setSlotsToSetupPose()
  48823. }, e.prototype.setBonesToSetupPose = function() {
  48824. for (var t = this.bones, e = 0, i = t.length; e < i; e++) t[e].setToSetupPose();
  48825. var n = this.ikConstraints;
  48826. for (e = 0, i = n.length; e < i; e++) {
  48827. (a = n[e]).bendDirection = a.data.bendDirection, a.mix = a.data.mix
  48828. }
  48829. var r = this.transformConstraints;
  48830. for (e = 0, i = r.length; e < i; e++) {
  48831. var s = (a = r[e]).data;
  48832. a.rotateMix = s.rotateMix, a.translateMix = s.translateMix, a.scaleMix = s.scaleMix, a.shearMix = s.shearMix
  48833. }
  48834. var o = this.pathConstraints;
  48835. for (e = 0, i = o.length; e < i; e++) {
  48836. var a;
  48837. s = (a = o[e]).data;
  48838. a.position = s.position, a.spacing = s.spacing, a.rotateMix = s.rotateMix, a.translateMix = s.translateMix
  48839. }
  48840. }, e.prototype.setSlotsToSetupPose = function() {
  48841. var e = this.slots;
  48842. t.Utils.arrayCopy(e, 0, this.drawOrder, 0, e.length);
  48843. for (var i = 0, n = e.length; i < n; i++) e[i].setToSetupPose()
  48844. }, e.prototype.getRootBone = function() {
  48845. return 0 == this.bones.length ? null : this.bones[0]
  48846. }, e.prototype.findBone = function(t) {
  48847. if (null == t) throw new Error("boneName cannot be null.");
  48848. for (var e = this.bones, i = 0, n = e.length; i < n; i++) {
  48849. var r = e[i];
  48850. if (r.data.name == t) return r
  48851. }
  48852. return null
  48853. }, e.prototype.findBoneIndex = function(t) {
  48854. if (null == t) throw new Error("boneName cannot be null.");
  48855. for (var e = this.bones, i = 0, n = e.length; i < n; i++)
  48856. if (e[i].data.name == t) return i;
  48857. return -1
  48858. }, e.prototype.findSlot = function(t) {
  48859. if (null == t) throw new Error("slotName cannot be null.");
  48860. for (var e = this.slots, i = 0, n = e.length; i < n; i++) {
  48861. var r = e[i];
  48862. if (r.data.name == t) return r
  48863. }
  48864. return null
  48865. }, e.prototype.findSlotIndex = function(t) {
  48866. if (null == t) throw new Error("slotName cannot be null.");
  48867. for (var e = this.slots, i = 0, n = e.length; i < n; i++)
  48868. if (e[i].data.name == t) return i;
  48869. return -1
  48870. }, e.prototype.setSkinByName = function(t) {
  48871. var e = this.data.findSkin(t);
  48872. if (null == e) throw new Error("Skin not found: " + t);
  48873. this.setSkin(e)
  48874. }, e.prototype.setSkin = function(t) {
  48875. if (null != t)
  48876. if (null != this.skin) t.attachAll(this, this.skin);
  48877. else
  48878. for (var e = this.slots, i = 0, n = e.length; i < n; i++) {
  48879. var r = e[i],
  48880. s = r.data.attachmentName;
  48881. if (null != s) {
  48882. var o = t.getAttachment(i, s);
  48883. null != o && r.setAttachment(o)
  48884. }
  48885. }
  48886. this.skin = t
  48887. }, e.prototype.getAttachmentByName = function(t, e) {
  48888. return this.getAttachment(this.data.findSlotIndex(t), e)
  48889. }, e.prototype.getAttachment = function(t, e) {
  48890. if (null == e) throw new Error("attachmentName cannot be null.");
  48891. if (null != this.skin) {
  48892. var i = this.skin.getAttachment(t, e);
  48893. if (null != i) return i
  48894. }
  48895. return null != this.data.defaultSkin ? this.data.defaultSkin.getAttachment(t, e) : null
  48896. }, e.prototype.setAttachment = function(t, e) {
  48897. if (null == t) throw new Error("slotName cannot be null.");
  48898. for (var i = this.slots, n = 0, r = i.length; n < r; n++) {
  48899. var s = i[n];
  48900. if (s.data.name == t) {
  48901. var o = null;
  48902. if (null != e && null == (o = this.getAttachment(n, e))) throw new Error("Attachment not found: " + e + ", for slot: " + t);
  48903. return void s.setAttachment(o)
  48904. }
  48905. }
  48906. throw new Error("Slot not found: " + t)
  48907. }, e.prototype.findIkConstraint = function(t) {
  48908. if (null == t) throw new Error("constraintName cannot be null.");
  48909. for (var e = this.ikConstraints, i = 0, n = e.length; i < n; i++) {
  48910. var r = e[i];
  48911. if (r.data.name == t) return r
  48912. }
  48913. return null
  48914. }, e.prototype.findTransformConstraint = function(t) {
  48915. if (null == t) throw new Error("constraintName cannot be null.");
  48916. for (var e = this.transformConstraints, i = 0, n = e.length; i < n; i++) {
  48917. var r = e[i];
  48918. if (r.data.name == t) return r
  48919. }
  48920. return null
  48921. }, e.prototype.findPathConstraint = function(t) {
  48922. if (null == t) throw new Error("constraintName cannot be null.");
  48923. for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) {
  48924. var r = e[i];
  48925. if (r.data.name == t) return r
  48926. }
  48927. return null
  48928. }, e.prototype.getBounds = function(e, i, n) {
  48929. if (null == e) throw new Error("offset cannot be null.");
  48930. if (null == i) throw new Error("size cannot be null.");
  48931. for (var r = this.drawOrder, s = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY, a = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, h = 0, c = r.length; h < c; h++) {
  48932. var u = r[h],
  48933. _ = 0,
  48934. f = null,
  48935. d = u.getAttachment();
  48936. if (d instanceof t.RegionAttachment) _ = 8, f = t.Utils.setArraySize(n, _, 0), d.computeWorldVertices(u.bone, f, 0, 2);
  48937. else if (d instanceof t.MeshAttachment) {
  48938. var p = d;
  48939. _ = p.worldVerticesLength, f = t.Utils.setArraySize(n, _, 0), p.computeWorldVertices(u, 0, _, f, 0, 2)
  48940. }
  48941. if (null != f)
  48942. for (var m = 0, y = f.length; m < y; m += 2) {
  48943. var v = f[m],
  48944. g = f[m + 1];
  48945. s = Math.min(s, v), o = Math.min(o, g), a = Math.max(a, v), l = Math.max(l, g)
  48946. }
  48947. }
  48948. e.set(s, o), i.set(a - s, l - o)
  48949. }, e.prototype.update = function(t) {
  48950. this.time += t
  48951. }, e
  48952. })();
  48953. t.Skeleton = e
  48954. })(n || (n = {})), (function(t) {
  48955. var e = (function() {
  48956. function e() {
  48957. this.minX = 0, this.minY = 0, this.maxX = 0, this.maxY = 0, this.boundingBoxes = new Array, this.polygons = new Array, this.polygonPool = new t.Pool(function() {
  48958. return t.Utils.newFloatArray(16)
  48959. })
  48960. }
  48961. return e.prototype.update = function(e, i) {
  48962. if (null == e) throw new Error("skeleton cannot be null.");
  48963. var n = this.boundingBoxes,
  48964. r = this.polygons,
  48965. s = this.polygonPool,
  48966. o = e.slots,
  48967. a = o.length;
  48968. n.length = 0, s.freeAll(r), r.length = 0;
  48969. for (var l = 0; l < a; l++) {
  48970. var h = o[l],
  48971. c = h.getAttachment();
  48972. if (c instanceof t.BoundingBoxAttachment) {
  48973. var u = c;
  48974. n.push(u);
  48975. var _ = s.obtain();
  48976. _.length != u.worldVerticesLength && (_ = t.Utils.newFloatArray(u.worldVerticesLength)), r.push(_), u.computeWorldVertices(h, 0, u.worldVerticesLength, _, 0, 2)
  48977. }
  48978. }
  48979. i ? this.aabbCompute() : (this.minX = Number.POSITIVE_INFINITY, this.minY = Number.POSITIVE_INFINITY, this.maxX = Number.NEGATIVE_INFINITY, this.maxY = Number.NEGATIVE_INFINITY)
  48980. }, e.prototype.aabbCompute = function() {
  48981. for (var t = Number.POSITIVE_INFINITY, e = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY, n = Number.NEGATIVE_INFINITY, r = this.polygons, s = 0, o = r.length; s < o; s++)
  48982. for (var a = r[s], l = a, h = 0, c = a.length; h < c; h += 2) {
  48983. var u = l[h],
  48984. _ = l[h + 1];
  48985. t = Math.min(t, u), e = Math.min(e, _), i = Math.max(i, u), n = Math.max(n, _)
  48986. }
  48987. this.minX = t, this.minY = e, this.maxX = i, this.maxY = n
  48988. }, e.prototype.aabbContainsPoint = function(t, e) {
  48989. return t >= this.minX && t <= this.maxX && e >= this.minY && e <= this.maxY
  48990. }, e.prototype.aabbIntersectsSegment = function(t, e, i, n) {
  48991. var r = this.minX,
  48992. s = this.minY,
  48993. o = this.maxX,
  48994. a = this.maxY;
  48995. if (t <= r && i <= r || e <= s && n <= s || t >= o && i >= o || e >= a && n >= a) return !1;
  48996. var l = (n - e) / (i - t),
  48997. h = l * (r - t) + e;
  48998. if (h > s && h < a) return !0;
  48999. if ((h = l * (o - t) + e) > s && h < a) return !0;
  49000. var c = (s - e) / l + t;
  49001. return c > r && c < o || (c = (a - e) / l + t) > r && c < o
  49002. }, e.prototype.aabbIntersectsSkeleton = function(t) {
  49003. return this.minX < t.maxX && this.maxX > t.minX && this.minY < t.maxY && this.maxY > t.minY
  49004. }, e.prototype.containsPoint = function(t, e) {
  49005. for (var i = this.polygons, n = 0, r = i.length; n < r; n++)
  49006. if (this.containsPointPolygon(i[n], t, e)) return this.boundingBoxes[n];
  49007. return null
  49008. }, e.prototype.containsPointPolygon = function(t, e, i) {
  49009. for (var n = t, r = t.length, s = r - 2, o = !1, a = 0; a < r; a += 2) {
  49010. var l = n[a + 1],
  49011. h = n[s + 1];
  49012. if (l < i && h >= i || h < i && l >= i) {
  49013. var c = n[a];
  49014. c + (i - l) / (h - l) * (n[s] - c) < e && (o = !o)
  49015. }
  49016. s = a
  49017. }
  49018. return o
  49019. }, e.prototype.intersectsSegment = function(t, e, i, n) {
  49020. for (var r = this.polygons, s = 0, o = r.length; s < o; s++)
  49021. if (this.intersectsSegmentPolygon(r[s], t, e, i, n)) return this.boundingBoxes[s];
  49022. return null
  49023. }, e.prototype.intersectsSegmentPolygon = function(t, e, i, n, r) {
  49024. for (var s = t, o = t.length, a = e - n, l = i - r, h = e * r - i * n, c = s[o - 2], u = s[o - 1], _ = 0; _ < o; _ += 2) {
  49025. var f = s[_],
  49026. d = s[_ + 1],
  49027. p = c * d - u * f,
  49028. m = c - f,
  49029. y = u - d,
  49030. v = a * y - l * m,
  49031. g = (h * m - a * p) / v;
  49032. if ((g >= c && g <= f || g >= f && g <= c) && (g >= e && g <= n || g >= n && g <= e)) {
  49033. var x = (h * y - l * p) / v;
  49034. if ((x >= u && x <= d || x >= d && x <= u) && (x >= i && x <= r || x >= r && x <= i)) return !0
  49035. }
  49036. c = f, u = d
  49037. }
  49038. return !1
  49039. }, e.prototype.getPolygon = function(t) {
  49040. if (null == t) throw new Error("boundingBox cannot be null.");
  49041. var e = this.boundingBoxes.indexOf(t);
  49042. return -1 == e ? null : this.polygons[e]
  49043. }, e.prototype.getWidth = function() {
  49044. return this.maxX - this.minX
  49045. }, e.prototype.getHeight = function() {
  49046. return this.maxY - this.minY
  49047. }, e
  49048. })();
  49049. t.SkeletonBounds = e
  49050. })(n || (n = {})), (function(t) {
  49051. var e = (function() {
  49052. function e() {
  49053. this.triangulator = new t.Triangulator, this.clippingPolygon = new Array, this.clipOutput = new Array, this.clippedVertices = new Array, this.clippedTriangles = new Array, this.scratch = new Array
  49054. }
  49055. return e.prototype.clipStart = function(i, n) {
  49056. if (null != this.clipAttachment) return 0;
  49057. this.clipAttachment = n;
  49058. var r = n.worldVerticesLength,
  49059. s = t.Utils.setArraySize(this.clippingPolygon, r);
  49060. n.computeWorldVertices(i, 0, r, s, 0, 2);
  49061. var o = this.clippingPolygon;
  49062. e.makeClockwise(o);
  49063. for (var a = this.clippingPolygons = this.triangulator.decompose(o, this.triangulator.triangulate(o)), l = 0, h = a.length; l < h; l++) {
  49064. var c = a[l];
  49065. e.makeClockwise(c), c.push(c[0]), c.push(c[1])
  49066. }
  49067. return a.length
  49068. }, e.prototype.clipEndWithSlot = function(t) {
  49069. null != this.clipAttachment && this.clipAttachment.endSlot == t.data && this.clipEnd()
  49070. }, e.prototype.clipEnd = function() {
  49071. null != this.clipAttachment && (this.clipAttachment = null, this.clippingPolygons = null, this.clippedVertices.length = 0, this.clippedTriangles.length = 0, this.clippingPolygon.length = 0)
  49072. }, e.prototype.isClipping = function() {
  49073. return null != this.clipAttachment
  49074. }, e.prototype.clipTriangles = function(e, i, n, r, s, o, a, l, h, c, u, _) {
  49075. var f = this.clipOutput,
  49076. d = this.clippedVertices,
  49077. p = this.clippedTriangles,
  49078. m = this.clippingPolygons,
  49079. y = this.clippingPolygons.length,
  49080. v = l ? 12 : 8,
  49081. g = 0;
  49082. c = c || 0, u = u || 0, _ = _ || 0, d.length = 0, p.length = 0;
  49083. t: for (var x = c, b = c + r; x < b; x += 3) {
  49084. var A = n[x] * h,
  49085. C = A + u,
  49086. T = A + _,
  49087. S = e[C],
  49088. w = e[C + 1],
  49089. E = s[T],
  49090. M = s[T + 1];
  49091. T = (A = n[x + 1] * h) + _;
  49092. var D = e[C = A + u],
  49093. B = e[C + 1],
  49094. I = s[T],
  49095. P = s[T + 1];
  49096. T = (A = n[x + 2] * h) + _;
  49097. for (var R = e[C = A + u], O = e[C + 1], L = s[T], F = s[T + 1], N = 0; N < y; N++) {
  49098. var V = d.length;
  49099. if (!this.clip(S, w, D, B, R, O, m[N], f)) {
  49100. (Y = t.Utils.setArraySize(d, V + 3 * v))[V] = S, Y[V + 1] = w, Y[V + 2] = o.r, Y[V + 3] = o.g, Y[V + 4] = o.b, Y[V + 5] = o.a, l ? (Y[V + 6] = E, Y[V + 7] = M, Y[V + 8] = a.r, Y[V + 9] = a.g, Y[V + 10] = a.b, Y[V + 11] = a.a, Y[V + 12] = D, Y[V + 13] = B, Y[V + 14] = o.r, Y[V + 15] = o.g, Y[V + 16] = o.b, Y[V + 17] = o.a, Y[V + 18] = I, Y[V + 19] = P, Y[V + 20] = a.r, Y[V + 21] = a.g, Y[V + 22] = a.b, Y[V + 23] = a.a, Y[V + 24] = R, Y[V + 25] = O, Y[V + 26] = o.r, Y[V + 27] = o.g, Y[V + 28] = o.b, Y[V + 29] = o.a, Y[V + 30] = L, Y[V + 31] = F, Y[V + 32] = a.r, Y[V + 33] = a.g, Y[V + 34] = a.b, Y[V + 35] = a.a) : (Y[V + 6] = E, Y[V + 7] = M, Y[V + 8] = D, Y[V + 9] = B, Y[V + 10] = o.r, Y[V + 11] = o.g, Y[V + 12] = o.b, Y[V + 13] = o.a, Y[V + 14] = I, Y[V + 15] = P, Y[V + 16] = R, Y[V + 17] = O, Y[V + 18] = o.r, Y[V + 19] = o.g, Y[V + 20] = o.b, Y[V + 21] = o.a, Y[V + 22] = L, Y[V + 23] = F), V = p.length, (it = t.Utils.setArraySize(p, V + 3))[V] = g, it[V + 1] = g + 1, it[V + 2] = g + 2, g += 3;
  49101. continue t
  49102. }
  49103. var k = f.length;
  49104. if (0 != k) {
  49105. for (var G = B - O, U = R - D, z = S - R, j = O - w, W = 1 / (G * z + U * (w - O)), H = k >> 1, X = this.clipOutput, Y = t.Utils.setArraySize(d, V + H * v), q = 0; q < k; q += 2) {
  49106. var J = X[q],
  49107. Z = X[q + 1];
  49108. Y[V] = J, Y[V + 1] = Z, Y[V + 2] = o.r, Y[V + 3] = o.g, Y[V + 4] = o.b, Y[V + 5] = o.a;
  49109. var K = J - R,
  49110. Q = Z - O,
  49111. $ = (G * K + U * Q) * W,
  49112. tt = (j * K + z * Q) * W,
  49113. et = 1 - $ - tt;
  49114. Y[V + 6] = E * $ + I * tt + L * et, Y[V + 7] = M * $ + P * tt + F * et, l && (Y[V + 8] = a.r, Y[V + 9] = a.g, Y[V + 10] = a.b, Y[V + 11] = a.a), V += v
  49115. }
  49116. V = p.length;
  49117. var it = t.Utils.setArraySize(p, V + 3 * (H - 2));
  49118. H--;
  49119. for (q = 1; q < H; q++) it[V] = g, it[V + 1] = g + q, it[V + 2] = g + q + 1, V += 3;
  49120. g += H + 1
  49121. }
  49122. }
  49123. }
  49124. }, e.prototype.clip = function(t, e, i, n, r, s, o, a) {
  49125. var l = a,
  49126. h = !1,
  49127. c = null;
  49128. o.length % 4 >= 2 ? (c = a, a = this.scratch) : c = this.scratch, c.length = 0, c.push(t), c.push(e), c.push(i), c.push(n), c.push(r), c.push(s), c.push(t), c.push(e), a.length = 0;
  49129. for (var u = o, _ = o.length - 4, f = 0;; f += 2) {
  49130. for (var d = u[f], p = u[f + 1], m = u[f + 2], y = u[f + 3], v = d - m, g = p - y, x = c, b = c.length - 2, A = a.length, C = 0; C < b; C += 2) {
  49131. var T = x[C],
  49132. S = x[C + 1],
  49133. w = x[C + 2],
  49134. E = x[C + 3],
  49135. M = v * (E - y) - g * (w - m) > 0;
  49136. if (v * (S - y) - g * (T - m) > 0) {
  49137. if (M) {
  49138. a.push(w), a.push(E);
  49139. continue
  49140. }
  49141. var D = ((I = w - T) * (p - S) - (B = E - S) * (d - T)) / (B * (m - d) - I * (y - p));
  49142. a.push(d + (m - d) * D), a.push(p + (y - p) * D)
  49143. } else if (M) {
  49144. var B, I;
  49145. D = ((I = w - T) * (p - S) - (B = E - S) * (d - T)) / (B * (m - d) - I * (y - p));
  49146. a.push(d + (m - d) * D), a.push(p + (y - p) * D), a.push(w), a.push(E)
  49147. }
  49148. h = !0
  49149. }
  49150. if (A == a.length) return l.length = 0, !0;
  49151. if (a.push(a[0]), a.push(a[1]), f == _) break;
  49152. var P = a;
  49153. (a = c).length = 0, c = P
  49154. }
  49155. if (l != a) {
  49156. l.length = 0;
  49157. f = 0;
  49158. for (var R = a.length - 2; f < R; f++) l[f] = a[f]
  49159. } else l.length = l.length - 2;
  49160. return h
  49161. }, e.makeClockwise = function(t) {
  49162. for (var e = t, i = t.length, n = e[i - 2] * e[1] - e[0] * e[i - 1], r = 0, s = 0, o = 0, a = 0, l = i - 3; a < l; a += 2) r = e[a], s = e[a + 1], o = e[a + 2], n += r * e[a + 3] - o * s;
  49163. if (!(n < 0)) {
  49164. a = 0;
  49165. var h = i - 2;
  49166. for (l = i >> 1; a < l; a += 2) {
  49167. var c = e[a],
  49168. u = e[a + 1],
  49169. _ = h - a;
  49170. e[a] = e[_], e[a + 1] = e[_ + 1], e[_] = c, e[_ + 1] = u
  49171. }
  49172. }
  49173. }, e
  49174. })();
  49175. t.SkeletonClipping = e
  49176. })(n || (n = {})), (function(t) {
  49177. var e = (function() {
  49178. function t() {
  49179. this.bones = new Array, this.slots = new Array, this.skins = new Array, this.events = new Array, this.animations = new Array, this.ikConstraints = new Array, this.transformConstraints = new Array, this.pathConstraints = new Array, this.fps = 0
  49180. }
  49181. return t.prototype.findBone = function(t) {
  49182. if (null == t) throw new Error("boneName cannot be null.");
  49183. for (var e = this.bones, i = 0, n = e.length; i < n; i++) {
  49184. var r = e[i];
  49185. if (r.name == t) return r
  49186. }
  49187. return null
  49188. }, t.prototype.findBoneIndex = function(t) {
  49189. if (null == t) throw new Error("boneName cannot be null.");
  49190. for (var e = this.bones, i = 0, n = e.length; i < n; i++)
  49191. if (e[i].name == t) return i;
  49192. return -1
  49193. }, t.prototype.findSlot = function(t) {
  49194. if (null == t) throw new Error("slotName cannot be null.");
  49195. for (var e = this.slots, i = 0, n = e.length; i < n; i++) {
  49196. var r = e[i];
  49197. if (r.name == t) return r
  49198. }
  49199. return null
  49200. }, t.prototype.findSlotIndex = function(t) {
  49201. if (null == t) throw new Error("slotName cannot be null.");
  49202. for (var e = this.slots, i = 0, n = e.length; i < n; i++)
  49203. if (e[i].name == t) return i;
  49204. return -1
  49205. }, t.prototype.findSkin = function(t) {
  49206. if (null == t) throw new Error("skinName cannot be null.");
  49207. for (var e = this.skins, i = 0, n = e.length; i < n; i++) {
  49208. var r = e[i];
  49209. if (r.name == t) return r
  49210. }
  49211. return null
  49212. }, t.prototype.findEvent = function(t) {
  49213. if (null == t) throw new Error("eventDataName cannot be null.");
  49214. for (var e = this.events, i = 0, n = e.length; i < n; i++) {
  49215. var r = e[i];
  49216. if (r.name == t) return r
  49217. }
  49218. return null
  49219. }, t.prototype.findAnimation = function(t) {
  49220. if (null == t) throw new Error("animationName cannot be null.");
  49221. for (var e = this.animations, i = 0, n = e.length; i < n; i++) {
  49222. var r = e[i];
  49223. if (r.name == t) return r
  49224. }
  49225. return null
  49226. }, t.prototype.findIkConstraint = function(t) {
  49227. if (null == t) throw new Error("constraintName cannot be null.");
  49228. for (var e = this.ikConstraints, i = 0, n = e.length; i < n; i++) {
  49229. var r = e[i];
  49230. if (r.name == t) return r
  49231. }
  49232. return null
  49233. }, t.prototype.findTransformConstraint = function(t) {
  49234. if (null == t) throw new Error("constraintName cannot be null.");
  49235. for (var e = this.transformConstraints, i = 0, n = e.length; i < n; i++) {
  49236. var r = e[i];
  49237. if (r.name == t) return r
  49238. }
  49239. return null
  49240. }, t.prototype.findPathConstraint = function(t) {
  49241. if (null == t) throw new Error("constraintName cannot be null.");
  49242. for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) {
  49243. var r = e[i];
  49244. if (r.name == t) return r
  49245. }
  49246. return null
  49247. }, t.prototype.findPathConstraintIndex = function(t) {
  49248. if (null == t) throw new Error("pathConstraintName cannot be null.");
  49249. for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++)
  49250. if (e[i].name == t) return i;
  49251. return -1
  49252. }, t
  49253. })();
  49254. t.SkeletonData = e
  49255. })(n || (n = {})), (function(t) {
  49256. var e = (function() {
  49257. function e(t) {
  49258. this.scale = 1, this.linkedMeshes = new Array, this.attachmentLoader = t
  49259. }
  49260. return e.prototype.readSkeletonData = function(i) {
  49261. var n = this.scale,
  49262. r = new t.SkeletonData,
  49263. s = "string" == typeof i ? JSON.parse(i) : i,
  49264. o = s.skeleton;
  49265. if (null != o && (r.hash = o.hash, r.version = o.spine, r.width = o.width, r.height = o.height, r.fps = o.fps, r.imagesPath = o.images), s.bones)
  49266. for (var a = 0; a < s.bones.length; a++) {
  49267. var l = s.bones[a],
  49268. h = null,
  49269. c = this.getValue(l, "parent", null);
  49270. if (null != c && null == (h = r.findBone(c))) throw new Error("Parent bone not found: " + c);
  49271. (d = new t.BoneData(r.bones.length, l.name, h)).length = this.getValue(l, "length", 0) * n, d.x = this.getValue(l, "x", 0) * n, d.y = this.getValue(l, "y", 0) * n, d.rotation = this.getValue(l, "rotation", 0), d.scaleX = this.getValue(l, "scaleX", 1), d.scaleY = this.getValue(l, "scaleY", 1), d.shearX = this.getValue(l, "shearX", 0), d.shearY = this.getValue(l, "shearY", 0), d.transformMode = e.transformModeFromString(this.getValue(l, "transform", "normal")), r.bones.push(d)
  49272. }
  49273. if (s.slots)
  49274. for (a = 0; a < s.slots.length; a++) {
  49275. var u = (S = s.slots[a]).name,
  49276. _ = S.bone,
  49277. f = r.findBone(_);
  49278. if (null == f) throw new Error("Slot bone not found: " + _);
  49279. var d = new t.SlotData(r.slots.length, u, f),
  49280. p = this.getValue(S, "color", null);
  49281. null != p && d.color.setFromString(p);
  49282. var m = this.getValue(S, "dark", null);
  49283. null != m && (d.darkColor = new t.Color(1, 1, 1, 1), d.darkColor.setFromString(m)), d.attachmentName = this.getValue(S, "attachment", null), d.blendMode = e.blendModeFromString(this.getValue(S, "blend", "normal")), r.slots.push(d)
  49284. }
  49285. if (s.ik)
  49286. for (a = 0; a < s.ik.length; a++) {
  49287. var y = s.ik[a];
  49288. (d = new t.IkConstraintData(y.name)).order = this.getValue(y, "order", 0);
  49289. for (var v = 0; v < y.bones.length; v++) {
  49290. _ = y.bones[v];
  49291. if (null == (x = r.findBone(_))) throw new Error("IK bone not found: " + _);
  49292. d.bones.push(x)
  49293. }
  49294. var g = y.target;
  49295. if (d.target = r.findBone(g), null == d.target) throw new Error("IK target bone not found: " + g);
  49296. d.bendDirection = this.getValue(y, "bendPositive", !0) ? 1 : -1, d.mix = this.getValue(y, "mix", 1), r.ikConstraints.push(d)
  49297. }
  49298. if (s.transform)
  49299. for (a = 0; a < s.transform.length; a++) {
  49300. y = s.transform[a];
  49301. (d = new t.TransformConstraintData(y.name)).order = this.getValue(y, "order", 0);
  49302. for (v = 0; v < y.bones.length; v++) {
  49303. _ = y.bones[v];
  49304. if (null == (x = r.findBone(_))) throw new Error("Transform constraint bone not found: " + _);
  49305. d.bones.push(x)
  49306. }
  49307. g = y.target;
  49308. if (d.target = r.findBone(g), null == d.target) throw new Error("Transform constraint target bone not found: " + g);
  49309. d.local = this.getValue(y, "local", !1), d.relative = this.getValue(y, "relative", !1), d.offsetRotation = this.getValue(y, "rotation", 0), d.offsetX = this.getValue(y, "x", 0) * n, d.offsetY = this.getValue(y, "y", 0) * n, d.offsetScaleX = this.getValue(y, "scaleX", 0), d.offsetScaleY = this.getValue(y, "scaleY", 0), d.offsetShearY = this.getValue(y, "shearY", 0), d.rotateMix = this.getValue(y, "rotateMix", 1), d.translateMix = this.getValue(y, "translateMix", 1), d.scaleMix = this.getValue(y, "scaleMix", 1), d.shearMix = this.getValue(y, "shearMix", 1), r.transformConstraints.push(d)
  49310. }
  49311. if (s.path)
  49312. for (a = 0; a < s.path.length; a++) {
  49313. y = s.path[a];
  49314. (d = new t.PathConstraintData(y.name)).order = this.getValue(y, "order", 0);
  49315. for (v = 0; v < y.bones.length; v++) {
  49316. var x;
  49317. _ = y.bones[v];
  49318. if (null == (x = r.findBone(_))) throw new Error("Transform constraint bone not found: " + _);
  49319. d.bones.push(x)
  49320. }
  49321. g = y.target;
  49322. if (d.target = r.findSlot(g), null == d.target) throw new Error("Path target slot not found: " + g);
  49323. d.positionMode = e.positionModeFromString(this.getValue(y, "positionMode", "percent")), d.spacingMode = e.spacingModeFromString(this.getValue(y, "spacingMode", "length")), d.rotateMode = e.rotateModeFromString(this.getValue(y, "rotateMode", "tangent")), d.offsetRotation = this.getValue(y, "rotation", 0), d.position = this.getValue(y, "position", 0), d.positionMode == t.PositionMode.Fixed && (d.position *= n), d.spacing = this.getValue(y, "spacing", 0), d.spacingMode != t.SpacingMode.Length && d.spacingMode != t.SpacingMode.Fixed || (d.spacing *= n), d.rotateMix = this.getValue(y, "rotateMix", 1), d.translateMix = this.getValue(y, "translateMix", 1), r.pathConstraints.push(d)
  49324. }
  49325. if (s.skins)
  49326. for (var b in s.skins) {
  49327. var A = s.skins[b],
  49328. C = new t.Skin(b);
  49329. for (var u in A) {
  49330. var T = r.findSlotIndex(u);
  49331. if (-1 == T) throw new Error("Slot not found: " + u);
  49332. var S = A[u];
  49333. for (var w in S) {
  49334. var E = this.readAttachment(S[w], C, T, w, r);
  49335. null != E && C.addAttachment(T, w, E)
  49336. }
  49337. }
  49338. r.skins.push(C), "default" == C.name && (r.defaultSkin = C)
  49339. }
  49340. a = 0;
  49341. for (var M = this.linkedMeshes.length; a < M; a++) {
  49342. var D = this.linkedMeshes[a];
  49343. if (null == (C = null == D.skin ? r.defaultSkin : r.findSkin(D.skin))) throw new Error("Skin not found: " + D.skin);
  49344. var B = C.getAttachment(D.slotIndex, D.parent);
  49345. if (null == B) throw new Error("Parent mesh not found: " + D.parent);
  49346. D.mesh.setParentMesh(B), D.mesh.updateUVs()
  49347. }
  49348. if (this.linkedMeshes.length = 0, s.events)
  49349. for (var I in s.events) {
  49350. var P = s.events[I];
  49351. (d = new t.EventData(I)).intValue = this.getValue(P, "int", 0), d.floatValue = this.getValue(P, "float", 0), d.stringValue = this.getValue(P, "string", ""), r.events.push(d)
  49352. }
  49353. if (s.animations)
  49354. for (var R in s.animations) {
  49355. var O = s.animations[R];
  49356. this.readAnimation(O, R, r)
  49357. }
  49358. return r
  49359. }, e.prototype.readAttachment = function(e, n, r, s, o) {
  49360. var a = this.scale;
  49361. switch (s = this.getValue(e, "name", s), this.getValue(e, "type", "region")) {
  49362. case "region":
  49363. var l = this.getValue(e, "path", s),
  49364. h = this.attachmentLoader.newRegionAttachment(n, s, l);
  49365. return null == h ? null : (h.path = l, h.x = this.getValue(e, "x", 0) * a, h.y = this.getValue(e, "y", 0) * a, h.scaleX = this.getValue(e, "scaleX", 1), h.scaleY = this.getValue(e, "scaleY", 1), h.rotation = this.getValue(e, "rotation", 0), h.width = e.width * a, h.height = e.height * a, null != (b = this.getValue(e, "color", null)) && h.color.setFromString(b), h.updateOffset(), h);
  49366. case "boundingbox":
  49367. var c = this.attachmentLoader.newBoundingBoxAttachment(n, s);
  49368. return null == c ? null : (this.readVertices(e, c, e.vertexCount << 1), null != (b = this.getValue(e, "color", null)) && c.color.setFromString(b), c);
  49369. case "mesh":
  49370. case "linkedmesh":
  49371. l = this.getValue(e, "path", s);
  49372. var u = this.attachmentLoader.newMeshAttachment(n, s, l);
  49373. if (null == u) return null;
  49374. u.path = l, null != (b = this.getValue(e, "color", null)) && u.color.setFromString(b);
  49375. var _ = this.getValue(e, "parent", null);
  49376. if (null != _) return u.inheritDeform = this.getValue(e, "deform", !0), this.linkedMeshes.push(new i(u, this.getValue(e, "skin", null), r, _)), u;
  49377. var f = e.uvs;
  49378. return this.readVertices(e, u, f.length), u.triangles = e.triangles, u.regionUVs = f, u.updateUVs(), u.hullLength = 2 * this.getValue(e, "hull", 0), u;
  49379. case "path":
  49380. if (null == (l = this.attachmentLoader.newPathAttachment(n, s))) return null;
  49381. l.closed = this.getValue(e, "closed", !1), l.constantSpeed = this.getValue(e, "constantSpeed", !0);
  49382. var d = e.vertexCount;
  49383. this.readVertices(e, l, d << 1);
  49384. for (var p = t.Utils.newArray(d / 3, 0), m = 0; m < e.lengths.length; m++) p[m] = e.lengths[m] * a;
  49385. return l.lengths = p, null != (b = this.getValue(e, "color", null)) && l.color.setFromString(b), l;
  49386. case "point":
  49387. var y = this.attachmentLoader.newPointAttachment(n, s);
  49388. return null == y ? null : (y.x = this.getValue(e, "x", 0) * a, y.y = this.getValue(e, "y", 0) * a, y.rotation = this.getValue(e, "rotation", 0), null != (b = this.getValue(e, "color", null)) && y.color.setFromString(b), y);
  49389. case "clipping":
  49390. var v = this.attachmentLoader.newClippingAttachment(n, s);
  49391. if (null == v) return null;
  49392. var g = this.getValue(e, "end", null);
  49393. if (null != g) {
  49394. var x = o.findSlot(g);
  49395. if (null == x) throw new Error("Clipping end slot not found: " + g);
  49396. v.endSlot = x
  49397. }
  49398. var b;
  49399. d = e.vertexCount;
  49400. return this.readVertices(e, v, d << 1), null != (b = this.getValue(e, "color", null)) && v.color.setFromString(b), v
  49401. }
  49402. return null
  49403. }, e.prototype.readVertices = function(e, i, n) {
  49404. var r = this.scale;
  49405. i.worldVerticesLength = n;
  49406. var s = e.vertices;
  49407. if (n != s.length) {
  49408. var o = new Array,
  49409. a = new Array;
  49410. for (u = 0, _ = s.length; u < _;) {
  49411. var l = s[u++];
  49412. a.push(l);
  49413. for (var h = u + 4 * l; u < h; u += 4) a.push(s[u]), o.push(s[u + 1] * r), o.push(s[u + 2] * r), o.push(s[u + 3])
  49414. }
  49415. i.bones = a, i.vertices = t.Utils.toFloatArray(o)
  49416. } else {
  49417. var c = t.Utils.toFloatArray(s);
  49418. if (1 != r)
  49419. for (var u = 0, _ = s.length; u < _; u++) c[u] *= r;
  49420. i.vertices = c
  49421. }
  49422. }, e.prototype.readAnimation = function(e, i, n) {
  49423. var r = this.scale,
  49424. s = new Array,
  49425. o = 0;
  49426. if (e.slots)
  49427. for (var a in e.slots) {
  49428. var l = e.slots[a];
  49429. if (-1 == (J = n.findSlotIndex(a))) throw new Error("Slot not found: " + a);
  49430. for (var h in l) {
  49431. var c = l[h];
  49432. if ("attachment" == h) {
  49433. (x = new t.AttachmentTimeline(c.length)).slotIndex = J;
  49434. for (var u = 0, _ = 0; _ < c.length; _++) {
  49435. var f = c[_];
  49436. x.setFrame(u++, f.time, f.name)
  49437. }
  49438. s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
  49439. } else if ("color" == h) {
  49440. (x = new t.ColorTimeline(c.length)).slotIndex = J;
  49441. for (u = 0, _ = 0; _ < c.length; _++) {
  49442. f = c[_];
  49443. var d = new t.Color;
  49444. d.setFromString(f.color), x.setFrame(u, f.time, d.r, d.g, d.b, d.a), this.readCurve(f, x, u), u++
  49445. }
  49446. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.ColorTimeline.ENTRIES])
  49447. } else {
  49448. if ("twoColor" != h) throw new Error("Invalid timeline type for a slot: " + h + " (" + a + ")");
  49449. (x = new t.TwoColorTimeline(c.length)).slotIndex = J;
  49450. for (u = 0, _ = 0; _ < c.length; _++) {
  49451. f = c[_];
  49452. var p = new t.Color,
  49453. m = new t.Color;
  49454. p.setFromString(f.light), m.setFromString(f.dark), x.setFrame(u, f.time, p.r, p.g, p.b, p.a, m.r, m.g, m.b), this.readCurve(f, x, u), u++
  49455. }
  49456. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.TwoColorTimeline.ENTRIES])
  49457. }
  49458. }
  49459. }
  49460. if (e.bones)
  49461. for (var y in e.bones) {
  49462. var v = e.bones[y],
  49463. g = n.findBoneIndex(y);
  49464. if (-1 == g) throw new Error("Bone not found: " + y);
  49465. for (var h in v) {
  49466. c = v[h];
  49467. if ("rotate" === h) {
  49468. (x = new t.RotateTimeline(c.length)).boneIndex = g;
  49469. for (u = 0, _ = 0; _ < c.length; _++) {
  49470. f = c[_];
  49471. x.setFrame(u, f.time, f.angle), this.readCurve(f, x, u), u++
  49472. }
  49473. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.RotateTimeline.ENTRIES])
  49474. } else {
  49475. if ("translate" !== h && "scale" !== h && "shear" !== h) throw new Error("Invalid timeline type for a bone: " + h + " (" + y + ")");
  49476. var x = null,
  49477. b = 1;
  49478. "scale" === h ? x = new t.ScaleTimeline(c.length) : "shear" === h ? x = new t.ShearTimeline(c.length) : (x = new t.TranslateTimeline(c.length), b = r), x.boneIndex = g;
  49479. for (u = 0, _ = 0; _ < c.length; _++) {
  49480. f = c[_];
  49481. var A = this.getValue(f, "x", 0),
  49482. C = this.getValue(f, "y", 0);
  49483. x.setFrame(u, f.time, A * b, C * b), this.readCurve(f, x, u), u++
  49484. }
  49485. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.TranslateTimeline.ENTRIES])
  49486. }
  49487. }
  49488. }
  49489. if (e.ik)
  49490. for (var T in e.ik) {
  49491. var S = e.ik[T],
  49492. w = n.findIkConstraint(T);
  49493. (x = new t.IkConstraintTimeline(S.length)).ikConstraintIndex = n.ikConstraints.indexOf(w);
  49494. for (u = 0, _ = 0; _ < S.length; _++) {
  49495. f = S[_];
  49496. x.setFrame(u, f.time, this.getValue(f, "mix", 1), this.getValue(f, "bendPositive", !0) ? 1 : -1), this.readCurve(f, x, u), u++
  49497. }
  49498. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.IkConstraintTimeline.ENTRIES])
  49499. }
  49500. if (e.transform)
  49501. for (var T in e.transform) {
  49502. S = e.transform[T], w = n.findTransformConstraint(T);
  49503. (x = new t.TransformConstraintTimeline(S.length)).transformConstraintIndex = n.transformConstraints.indexOf(w);
  49504. for (u = 0, _ = 0; _ < S.length; _++) {
  49505. f = S[_];
  49506. x.setFrame(u, f.time, this.getValue(f, "rotateMix", 1), this.getValue(f, "translateMix", 1), this.getValue(f, "scaleMix", 1), this.getValue(f, "shearMix", 1)), this.readCurve(f, x, u), u++
  49507. }
  49508. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.TransformConstraintTimeline.ENTRIES])
  49509. }
  49510. if (e.paths)
  49511. for (var T in e.paths) {
  49512. S = e.paths[T];
  49513. var E = n.findPathConstraintIndex(T);
  49514. if (-1 == E) throw new Error("Path constraint not found: " + T);
  49515. var M = n.pathConstraints[E];
  49516. for (var h in S) {
  49517. c = S[h];
  49518. if ("position" === h || "spacing" === h) {
  49519. x = null, b = 1;
  49520. "spacing" === h ? (x = new t.PathConstraintSpacingTimeline(c.length), M.spacingMode != t.SpacingMode.Length && M.spacingMode != t.SpacingMode.Fixed || (b = r)) : (x = new t.PathConstraintPositionTimeline(c.length), M.positionMode == t.PositionMode.Fixed && (b = r)), x.pathConstraintIndex = E;
  49521. for (u = 0, _ = 0; _ < c.length; _++) {
  49522. f = c[_];
  49523. x.setFrame(u, f.time, this.getValue(f, h, 0) * b), this.readCurve(f, x, u), u++
  49524. }
  49525. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.PathConstraintPositionTimeline.ENTRIES])
  49526. } else if ("mix" === h) {
  49527. (x = new t.PathConstraintMixTimeline(c.length)).pathConstraintIndex = E;
  49528. for (u = 0, _ = 0; _ < c.length; _++) {
  49529. f = c[_];
  49530. x.setFrame(u, f.time, this.getValue(f, "rotateMix", 1), this.getValue(f, "translateMix", 1)), this.readCurve(f, x, u), u++
  49531. }
  49532. s.push(x), o = Math.max(o, x.frames[(x.getFrameCount() - 1) * t.PathConstraintMixTimeline.ENTRIES])
  49533. }
  49534. }
  49535. }
  49536. if (e.deform)
  49537. for (var D in e.deform) {
  49538. var B = e.deform[D],
  49539. I = n.findSkin(D);
  49540. if (null == I) throw new Error("Skin not found: " + D);
  49541. for (var a in B) {
  49542. l = B[a];
  49543. if (-1 == (J = n.findSlotIndex(a))) throw new Error("Slot not found: " + l.name);
  49544. for (var h in l) {
  49545. c = l[h];
  49546. var P = I.getAttachment(J, h);
  49547. if (null == P) throw new Error("Deform attachment not found: " + c.name);
  49548. var R = null != P.bones,
  49549. O = P.vertices,
  49550. L = R ? O.length / 3 * 2 : O.length;
  49551. (x = new t.DeformTimeline(c.length)).slotIndex = J, x.attachment = P;
  49552. u = 0;
  49553. for (var F = 0; F < c.length; F++) {
  49554. f = c[F];
  49555. var N = void 0,
  49556. V = this.getValue(f, "vertices", null);
  49557. if (null == V) N = R ? t.Utils.newFloatArray(L) : O;
  49558. else {
  49559. N = t.Utils.newFloatArray(L);
  49560. var k = this.getValue(f, "offset", 0);
  49561. if (t.Utils.arrayCopy(V, 0, N, k, V.length), 1 != r)
  49562. for (var G = (_ = k) + V.length; _ < G; _++) N[_] *= r;
  49563. if (!R)
  49564. for (_ = 0; _ < L; _++) N[_] += O[_]
  49565. }
  49566. x.setFrame(u, f.time, N), this.readCurve(f, x, u), u++
  49567. }
  49568. s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
  49569. }
  49570. }
  49571. }
  49572. var U = e.drawOrder;
  49573. if (null == U && (U = e.draworder), null != U) {
  49574. x = new t.DrawOrderTimeline(U.length);
  49575. var z = n.slots.length;
  49576. for (u = 0, F = 0; F < U.length; F++) {
  49577. var j = U[F],
  49578. W = null,
  49579. H = this.getValue(j, "offsets", null);
  49580. if (null != H) {
  49581. W = t.Utils.newArray(z, -1);
  49582. var X = t.Utils.newArray(z - H.length, 0),
  49583. Y = 0,
  49584. q = 0;
  49585. for (_ = 0; _ < H.length; _++) {
  49586. var J, Z = H[_];
  49587. if (-1 == (J = n.findSlotIndex(Z.slot))) throw new Error("Slot not found: " + Z.slot);
  49588. for (; Y != J;) X[q++] = Y++;
  49589. W[Y + Z.offset] = Y++
  49590. }
  49591. for (; Y < z;) X[q++] = Y++;
  49592. for (_ = z - 1; _ >= 0; _--) - 1 == W[_] && (W[_] = X[--q])
  49593. }
  49594. x.setFrame(u++, j.time, W)
  49595. }
  49596. s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
  49597. }
  49598. if (e.events) {
  49599. for (x = new t.EventTimeline(e.events.length), u = 0, _ = 0; _ < e.events.length; _++) {
  49600. var K = e.events[_],
  49601. Q = n.findEvent(K.name);
  49602. if (null == Q) throw new Error("Event not found: " + K.name);
  49603. var $ = new t.Event(t.Utils.toSinglePrecision(K.time), Q);
  49604. $.intValue = this.getValue(K, "int", Q.intValue), $.floatValue = this.getValue(K, "float", Q.floatValue), $.stringValue = this.getValue(K, "string", Q.stringValue), x.setFrame(u++, $)
  49605. }
  49606. s.push(x), o = Math.max(o, x.frames[x.getFrameCount() - 1])
  49607. }
  49608. if (isNaN(o)) throw new Error("Error while parsing animation, duration is NaN");
  49609. n.animations.push(new t.Animation(i, s, o))
  49610. }, e.prototype.readCurve = function(t, e, i) {
  49611. if (t.curve)
  49612. if ("stepped" === t.curve) e.setStepped(i);
  49613. else if ("[object Array]" === Object.prototype.toString.call(t.curve)) {
  49614. var n = t.curve;
  49615. e.setCurve(i, n[0], n[1], n[2], n[3])
  49616. }
  49617. }, e.prototype.getValue = function(t, e, i) {
  49618. return void 0 !== t[e] ? t[e] : i
  49619. }, e.blendModeFromString = function(e) {
  49620. if ("normal" == (e = e.toLowerCase())) return t.BlendMode.Normal;
  49621. if ("additive" == e) return t.BlendMode.Additive;
  49622. if ("multiply" == e) return t.BlendMode.Multiply;
  49623. if ("screen" == e) return t.BlendMode.Screen;
  49624. throw new Error("Unknown blend mode: " + e)
  49625. }, e.positionModeFromString = function(e) {
  49626. if ("fixed" == (e = e.toLowerCase())) return t.PositionMode.Fixed;
  49627. if ("percent" == e) return t.PositionMode.Percent;
  49628. throw new Error("Unknown position mode: " + e)
  49629. }, e.spacingModeFromString = function(e) {
  49630. if ("length" == (e = e.toLowerCase())) return t.SpacingMode.Length;
  49631. if ("fixed" == e) return t.SpacingMode.Fixed;
  49632. if ("percent" == e) return t.SpacingMode.Percent;
  49633. throw new Error("Unknown position mode: " + e)
  49634. }, e.rotateModeFromString = function(e) {
  49635. if ("tangent" == (e = e.toLowerCase())) return t.RotateMode.Tangent;
  49636. if ("chain" == e) return t.RotateMode.Chain;
  49637. if ("chainscale" == e) return t.RotateMode.ChainScale;
  49638. throw new Error("Unknown rotate mode: " + e)
  49639. }, e.transformModeFromString = function(e) {
  49640. if ("normal" == (e = e.toLowerCase())) return t.TransformMode.Normal;
  49641. if ("onlytranslation" == e) return t.TransformMode.OnlyTranslation;
  49642. if ("norotationorreflection" == e) return t.TransformMode.NoRotationOrReflection;
  49643. if ("noscale" == e) return t.TransformMode.NoScale;
  49644. if ("noscaleorreflection" == e) return t.TransformMode.NoScaleOrReflection;
  49645. throw new Error("Unknown transform mode: " + e)
  49646. }, e
  49647. })();
  49648. t.SkeletonJson = e;
  49649. var i = (function() {
  49650. return function(t, e, i, n) {
  49651. this.mesh = t, this.skin = e, this.slotIndex = i, this.parent = n
  49652. }
  49653. })()
  49654. })(n || (n = {})), (function(t) {
  49655. var e = (function() {
  49656. function t(t) {
  49657. if (this.attachments = new Array, null == t) throw new Error("name cannot be null.");
  49658. this.name = t
  49659. }
  49660. return t.prototype.addAttachment = function(t, e, i) {
  49661. if (null == i) throw new Error("attachment cannot be null.");
  49662. var n = this.attachments;
  49663. t >= n.length && (n.length = t + 1), n[t] || (n[t] = {}), n[t][e] = i
  49664. }, t.prototype.getAttachment = function(t, e) {
  49665. var i = this.attachments[t];
  49666. return i ? i[e] : null
  49667. }, t.prototype.attachAll = function(t, e) {
  49668. for (var i = 0, n = 0; n < t.slots.length; n++) {
  49669. var r = t.slots[n],
  49670. s = r.getAttachment();
  49671. if (s && i < e.attachments.length) {
  49672. var o = e.attachments[i];
  49673. for (var a in o) {
  49674. if (s == o[a]) {
  49675. var l = this.getAttachment(i, a);
  49676. null != l && r.setAttachment(l);
  49677. break
  49678. }
  49679. }
  49680. }
  49681. i++
  49682. }
  49683. }, t
  49684. })();
  49685. t.Skin = e
  49686. })(n || (n = {})), (function(t) {
  49687. var e = (function() {
  49688. function e(e, i) {
  49689. if (this.attachmentVertices = new Array, null == e) throw new Error("data cannot be null.");
  49690. if (null == i) throw new Error("bone cannot be null.");
  49691. this.data = e, this.bone = i, this.color = new t.Color, this.darkColor = null == e.darkColor ? null : new t.Color, this.setToSetupPose()
  49692. }
  49693. return e.prototype.getAttachment = function() {
  49694. return this.attachment
  49695. }, e.prototype.setAttachment = function(t) {
  49696. this.attachment != t && (this.attachment = t, this.attachmentTime = this.bone.skeleton.time, this.attachmentVertices.length = 0)
  49697. }, e.prototype.setAttachmentTime = function(t) {
  49698. this.attachmentTime = this.bone.skeleton.time - t
  49699. }, e.prototype.getAttachmentTime = function() {
  49700. return this.bone.skeleton.time - this.attachmentTime
  49701. }, e.prototype.setToSetupPose = function() {
  49702. this.color.setFromColor(this.data.color), null != this.darkColor && this.darkColor.setFromColor(this.data.darkColor), null == this.data.attachmentName ? this.attachment = null : (this.attachment = null, this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName)))
  49703. }, e
  49704. })();
  49705. t.Slot = e
  49706. })(n || (n = {})), (function(t) {
  49707. var e = (function() {
  49708. return function(e, i, n) {
  49709. if (this.color = new t.Color(1, 1, 1, 1), e < 0) throw new Error("index must be >= 0.");
  49710. if (null == i) throw new Error("name cannot be null.");
  49711. if (null == n) throw new Error("boneData cannot be null.");
  49712. this.index = e, this.name = i, this.boneData = n
  49713. }
  49714. })();
  49715. t.SlotData = e
  49716. })(n || (n = {})), (function(t) {
  49717. var e, i, n = (function() {
  49718. function t(t) {
  49719. this._image = t
  49720. }
  49721. return t.prototype.getImage = function() {
  49722. return this._image
  49723. }, t.filterFromString = function(t) {
  49724. switch (t.toLowerCase()) {
  49725. case "nearest":
  49726. return e.Nearest;
  49727. case "linear":
  49728. return e.Linear;
  49729. case "mipmap":
  49730. return e.MipMap;
  49731. case "mipmapnearestnearest":
  49732. return e.MipMapNearestNearest;
  49733. case "mipmaplinearnearest":
  49734. return e.MipMapLinearNearest;
  49735. case "mipmapnearestlinear":
  49736. return e.MipMapNearestLinear;
  49737. case "mipmaplinearlinear":
  49738. return e.MipMapLinearLinear;
  49739. default:
  49740. throw new Error("Unknown texture filter " + t)
  49741. }
  49742. }, t.wrapFromString = function(t) {
  49743. switch (t.toLowerCase()) {
  49744. case "mirroredtepeat":
  49745. return i.MirroredRepeat;
  49746. case "clamptoedge":
  49747. return i.ClampToEdge;
  49748. case "repeat":
  49749. return i.Repeat;
  49750. default:
  49751. throw new Error("Unknown texture wrap " + t)
  49752. }
  49753. }, t
  49754. })();
  49755. t.Texture = n, (function(t) {
  49756. t[t.Nearest = 9728] = "Nearest", t[t.Linear = 9729] = "Linear", t[t.MipMap = 9987] = "MipMap", t[t.MipMapNearestNearest = 9984] = "MipMapNearestNearest", t[t.MipMapLinearNearest = 9985] = "MipMapLinearNearest", t[t.MipMapNearestLinear = 9986] = "MipMapNearestLinear", t[t.MipMapLinearLinear = 9987] = "MipMapLinearLinear"
  49757. })(e = t.TextureFilter || (t.TextureFilter = {})), (function(t) {
  49758. t[t.MirroredRepeat = 33648] = "MirroredRepeat", t[t.ClampToEdge = 33071] = "ClampToEdge", t[t.Repeat = 10497] = "Repeat"
  49759. })(i = t.TextureWrap || (t.TextureWrap = {}));
  49760. var s = (function() {
  49761. return function() {
  49762. this.u = 0, this.v = 0, this.u2 = 0, this.v2 = 0, this.width = 0, this.height = 0, this.rotate = !1, this.offsetX = 0, this.offsetY = 0, this.originalWidth = 0, this.originalHeight = 0
  49763. }
  49764. })();
  49765. t.TextureRegion = s;
  49766. var o = (function(t) {
  49767. function e() {
  49768. return null !== t && t.apply(this, arguments) || this
  49769. }
  49770. return r(e, t), e.prototype.setFilters = function(t, e) {}, e.prototype.setWraps = function(t, e) {}, e.prototype.dispose = function() {}, e
  49771. })(t.Texture);
  49772. t.FakeTexture = o
  49773. })(n || (n = {})), (function(t) {
  49774. var e = (function() {
  49775. function e(t, e) {
  49776. this.pages = new Array, this.regions = new Array, this.load(t, e)
  49777. }
  49778. return e.prototype.load = function(e, r) {
  49779. if (null == r) throw new Error("textureLoader cannot be null.");
  49780. for (var o = new i(e), a = new Array(4), l = null;;) {
  49781. var h = o.readLine();
  49782. if (null == h) break;
  49783. if (0 == (h = h.trim()).length) l = null;
  49784. else if (l) {
  49785. var c = new s;
  49786. c.name = h, c.page = l, c.rotate = "true" == o.readValue(), o.readTuple(a);
  49787. var u = parseInt(a[0]),
  49788. _ = parseInt(a[1]);
  49789. o.readTuple(a);
  49790. var f = parseInt(a[0]),
  49791. d = parseInt(a[1]);
  49792. c.u = u / l.width, c.v = _ / l.height, c.rotate ? (c.u2 = (u + d) / l.width, c.v2 = (_ + f) / l.height) : (c.u2 = (u + f) / l.width, c.v2 = (_ + d) / l.height), c.x = u, c.y = _, c.width = Math.abs(f), c.height = Math.abs(d), 4 == o.readTuple(a) && 4 == o.readTuple(a) && o.readTuple(a), c.originalWidth = parseInt(a[0]), c.originalHeight = parseInt(a[1]), o.readTuple(a), c.offsetX = parseInt(a[0]), c.offsetY = parseInt(a[1]), c.index = parseInt(o.readValue()), c.texture = l.texture, this.regions.push(c)
  49793. } else {
  49794. (l = new n).name = h, 2 == o.readTuple(a) && (l.width = parseInt(a[0]), l.height = parseInt(a[1]), o.readTuple(a)), o.readTuple(a), l.minFilter = t.Texture.filterFromString(a[0]), l.magFilter = t.Texture.filterFromString(a[1]);
  49795. var p = o.readValue();
  49796. l.uWrap = t.TextureWrap.ClampToEdge, l.vWrap = t.TextureWrap.ClampToEdge, "x" == p ? l.uWrap = t.TextureWrap.Repeat : "y" == p ? l.vWrap = t.TextureWrap.Repeat : "xy" == p && (l.uWrap = l.vWrap = t.TextureWrap.Repeat), l.texture = r(h), l.texture.setFilters(l.minFilter, l.magFilter), l.texture.setWraps(l.uWrap, l.vWrap), l.width = l.texture.getImage().width, l.height = l.texture.getImage().height, this.pages.push(l)
  49797. }
  49798. }
  49799. }, e.prototype.findRegion = function(t) {
  49800. for (var e = 0; e < this.regions.length; e++)
  49801. if (this.regions[e].name == t) return this.regions[e];
  49802. return null
  49803. }, e.prototype.dispose = function() {
  49804. for (var t = 0; t < this.pages.length; t++) this.pages[t].texture.dispose()
  49805. }, e
  49806. })();
  49807. t.TextureAtlas = e;
  49808. var i = (function() {
  49809. function t(t) {
  49810. this.index = 0, this.lines = t.split(/\r\n|\r|\n/)
  49811. }
  49812. return t.prototype.readLine = function() {
  49813. return this.index >= this.lines.length ? null : this.lines[this.index++]
  49814. }, t.prototype.readValue = function() {
  49815. var t = this.readLine(),
  49816. e = t.indexOf(":");
  49817. if (-1 == e) throw new Error("Invalid line: " + t);
  49818. return t.substring(e + 1).trim()
  49819. }, t.prototype.readTuple = function(t) {
  49820. var e = this.readLine(),
  49821. i = e.indexOf(":");
  49822. if (-1 == i) throw new Error("Invalid line: " + e);
  49823. for (var n = 0, r = i + 1; n < 3; n++) {
  49824. var s = e.indexOf(",", r);
  49825. if (-1 == s) break;
  49826. t[n] = e.substr(r, s - r).trim(), r = s + 1
  49827. }
  49828. return t[n] = e.substring(r).trim(), n + 1
  49829. }, t
  49830. })(),
  49831. n = (function() {
  49832. return function() {}
  49833. })();
  49834. t.TextureAtlasPage = n;
  49835. var s = (function(t) {
  49836. function e() {
  49837. return null !== t && t.apply(this, arguments) || this
  49838. }
  49839. return r(e, t), e
  49840. })(t.TextureRegion);
  49841. t.TextureAtlasRegion = s
  49842. })(n || (n = {})), (function(t) {
  49843. var e = (function() {
  49844. function e(e, i) {
  49845. if (this.rotateMix = 0, this.translateMix = 0, this.scaleMix = 0, this.shearMix = 0, this.temp = new t.Vector2, null == e) throw new Error("data cannot be null.");
  49846. if (null == i) throw new Error("skeleton cannot be null.");
  49847. this.data = e, this.rotateMix = e.rotateMix, this.translateMix = e.translateMix, this.scaleMix = e.scaleMix, this.shearMix = e.shearMix, this.bones = new Array;
  49848. for (var n = 0; n < e.bones.length; n++) this.bones.push(i.findBone(e.bones[n].name));
  49849. this.target = i.findBone(e.target.name)
  49850. }
  49851. return e.prototype.apply = function() {
  49852. this.update()
  49853. }, e.prototype.update = function() {
  49854. this.data.local ? this.data.relative ? this.applyRelativeLocal() : this.applyAbsoluteLocal() : this.data.relative ? this.applyRelativeWorld() : this.applyAbsoluteWorld()
  49855. }, e.prototype.applyAbsoluteWorld = function() {
  49856. for (var e = this.rotateMix, i = this.translateMix, n = this.scaleMix, r = this.shearMix, s = this.target, o = s.a, a = s.b, l = s.c, h = s.d, c = o * h - a * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad, u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c, f = this.bones, d = 0, p = f.length; d < p; d++) {
  49857. var m = f[d],
  49858. y = !1;
  49859. if (0 != e) {
  49860. var v = m.a,
  49861. g = m.b,
  49862. x = m.c,
  49863. b = m.d;
  49864. (E = Math.atan2(l, o) - Math.atan2(x, v) + u) > t.MathUtils.PI ? E -= t.MathUtils.PI2 : E < -t.MathUtils.PI && (E += t.MathUtils.PI2), E *= e;
  49865. var A = Math.cos(E),
  49866. C = Math.sin(E);
  49867. m.a = A * v - C * x, m.b = A * g - C * b, m.c = C * v + A * x, m.d = C * g + A * b, y = !0
  49868. }
  49869. if (0 != i) {
  49870. var T = this.temp;
  49871. s.localToWorld(T.set(this.data.offsetX, this.data.offsetY)), m.worldX += (T.x - m.worldX) * i, m.worldY += (T.y - m.worldY) * i, y = !0
  49872. }
  49873. if (n > 0) {
  49874. var S = Math.sqrt(m.a * m.a + m.c * m.c),
  49875. w = Math.sqrt(o * o + l * l);
  49876. S > 1e-5 && (S = (S + (w - S + this.data.offsetScaleX) * n) / S), m.a *= S, m.c *= S, S = Math.sqrt(m.b * m.b + m.d * m.d), w = Math.sqrt(a * a + h * h), S > 1e-5 && (S = (S + (w - S + this.data.offsetScaleY) * n) / S), m.b *= S, m.d *= S, y = !0
  49877. }
  49878. if (r > 0) {
  49879. g = m.b, b = m.d;
  49880. var E, M = Math.atan2(b, g);
  49881. (E = Math.atan2(h, a) - Math.atan2(l, o) - (M - Math.atan2(m.c, m.a))) > t.MathUtils.PI ? E -= t.MathUtils.PI2 : E < -t.MathUtils.PI && (E += t.MathUtils.PI2), E = M + (E + _) * r;
  49882. S = Math.sqrt(g * g + b * b);
  49883. m.b = Math.cos(E) * S, m.d = Math.sin(E) * S, y = !0
  49884. }
  49885. y && (m.appliedValid = !1)
  49886. }
  49887. }, e.prototype.applyRelativeWorld = function() {
  49888. for (var e = this.rotateMix, i = this.translateMix, n = this.scaleMix, r = this.shearMix, s = this.target, o = s.a, a = s.b, l = s.c, h = s.d, c = o * h - a * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad, u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c, f = this.bones, d = 0, p = f.length; d < p; d++) {
  49889. var m = f[d],
  49890. y = !1;
  49891. if (0 != e) {
  49892. var v = m.a,
  49893. g = m.b,
  49894. x = m.c,
  49895. b = m.d;
  49896. (w = Math.atan2(l, o) + u) > t.MathUtils.PI ? w -= t.MathUtils.PI2 : w < -t.MathUtils.PI && (w += t.MathUtils.PI2), w *= e;
  49897. var A = Math.cos(w),
  49898. C = Math.sin(w);
  49899. m.a = A * v - C * x, m.b = A * g - C * b, m.c = C * v + A * x, m.d = C * g + A * b, y = !0
  49900. }
  49901. if (0 != i) {
  49902. var T = this.temp;
  49903. s.localToWorld(T.set(this.data.offsetX, this.data.offsetY)), m.worldX += T.x * i, m.worldY += T.y * i, y = !0
  49904. }
  49905. if (n > 0) {
  49906. var S = (Math.sqrt(o * o + l * l) - 1 + this.data.offsetScaleX) * n + 1;
  49907. m.a *= S, m.c *= S, S = (Math.sqrt(a * a + h * h) - 1 + this.data.offsetScaleY) * n + 1, m.b *= S, m.d *= S, y = !0
  49908. }
  49909. if (r > 0) {
  49910. var w;
  49911. (w = Math.atan2(h, a) - Math.atan2(l, o)) > t.MathUtils.PI ? w -= t.MathUtils.PI2 : w < -t.MathUtils.PI && (w += t.MathUtils.PI2);
  49912. g = m.b, b = m.d;
  49913. w = Math.atan2(b, g) + (w - t.MathUtils.PI / 2 + _) * r;
  49914. S = Math.sqrt(g * g + b * b);
  49915. m.b = Math.cos(w) * S, m.d = Math.sin(w) * S, y = !0
  49916. }
  49917. y && (m.appliedValid = !1)
  49918. }
  49919. }, e.prototype.applyAbsoluteLocal = function() {
  49920. var t = this.rotateMix,
  49921. e = this.translateMix,
  49922. i = this.scaleMix,
  49923. n = this.shearMix,
  49924. r = this.target;
  49925. r.appliedValid || r.updateAppliedTransform();
  49926. for (var s = this.bones, o = 0, a = s.length; o < a; o++) {
  49927. var l = s[o];
  49928. l.appliedValid || l.updateAppliedTransform();
  49929. var h = l.arotation;
  49930. if (0 != t) {
  49931. var c = r.arotation - h + this.data.offsetRotation;
  49932. h += (c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0))) * t
  49933. }
  49934. var u = l.ax,
  49935. _ = l.ay;
  49936. 0 != e && (u += (r.ax - u + this.data.offsetX) * e, _ += (r.ay - _ + this.data.offsetY) * e);
  49937. var f = l.ascaleX,
  49938. d = l.ascaleY;
  49939. i > 0 && (f > 1e-5 && (f = (f + (r.ascaleX - f + this.data.offsetScaleX) * i) / f), d > 1e-5 && (d = (d + (r.ascaleY - d + this.data.offsetScaleY) * i) / d));
  49940. var p = l.ashearY;
  49941. if (n > 0) {
  49942. c = r.ashearY - p + this.data.offsetShearY;
  49943. c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0)), l.shearY += c * n
  49944. }
  49945. l.updateWorldTransformWith(u, _, h, f, d, l.ashearX, p)
  49946. }
  49947. }, e.prototype.applyRelativeLocal = function() {
  49948. var t = this.rotateMix,
  49949. e = this.translateMix,
  49950. i = this.scaleMix,
  49951. n = this.shearMix,
  49952. r = this.target;
  49953. r.appliedValid || r.updateAppliedTransform();
  49954. for (var s = this.bones, o = 0, a = s.length; o < a; o++) {
  49955. var l = s[o];
  49956. l.appliedValid || l.updateAppliedTransform();
  49957. var h = l.arotation;
  49958. 0 != t && (h += (r.arotation + this.data.offsetRotation) * t);
  49959. var c = l.ax,
  49960. u = l.ay;
  49961. 0 != e && (c += (r.ax + this.data.offsetX) * e, u += (r.ay + this.data.offsetY) * e);
  49962. var _ = l.ascaleX,
  49963. f = l.ascaleY;
  49964. i > 0 && (_ > 1e-5 && (_ *= (r.ascaleX - 1 + this.data.offsetScaleX) * i + 1), f > 1e-5 && (f *= (r.ascaleY - 1 + this.data.offsetScaleY) * i + 1));
  49965. var d = l.ashearY;
  49966. n > 0 && (d += (r.ashearY + this.data.offsetShearY) * n), l.updateWorldTransformWith(c, u, h, _, f, l.ashearX, d)
  49967. }
  49968. }, e.prototype.getOrder = function() {
  49969. return this.data.order
  49970. }, e
  49971. })();
  49972. t.TransformConstraint = e
  49973. })(n || (n = {})), (function(t) {
  49974. var e = (function() {
  49975. return function(t) {
  49976. if (this.order = 0, this.bones = new Array, this.rotateMix = 0, this.translateMix = 0, this.scaleMix = 0, this.shearMix = 0, this.offsetRotation = 0, this.offsetX = 0, this.offsetY = 0, this.offsetScaleX = 0, this.offsetScaleY = 0, this.offsetShearY = 0, this.relative = !1, this.local = !1, null == t) throw new Error("name cannot be null.");
  49977. this.name = t
  49978. }
  49979. })();
  49980. t.TransformConstraintData = e
  49981. })(n || (n = {})), (function(t) {
  49982. var e = (function() {
  49983. function e() {
  49984. this.convexPolygons = new Array, this.convexPolygonsIndices = new Array, this.indicesArray = new Array, this.isConcaveArray = new Array, this.triangles = new Array, this.polygonPool = new t.Pool(function() {
  49985. return new Array
  49986. }), this.polygonIndicesPool = new t.Pool(function() {
  49987. return new Array
  49988. })
  49989. }
  49990. return e.prototype.triangulate = function(t) {
  49991. var i = t,
  49992. n = t.length >> 1,
  49993. r = this.indicesArray;
  49994. r.length = 0;
  49995. for (var s = 0; s < n; s++) r[s] = s;
  49996. var o = this.isConcaveArray;
  49997. o.length = 0;
  49998. s = 0;
  49999. for (var a = n; s < a; ++s) o[s] = e.isConcave(s, n, i, r);
  50000. var l = this.triangles;
  50001. for (l.length = 0; n > 3;) {
  50002. for (var h = n - 1, c = (s = 0, 1);;) {
  50003. t: if (!o[s]) {
  50004. for (var u = r[h] << 1, _ = r[s] << 1, f = r[c] << 1, d = i[u], p = i[u + 1], m = i[_], y = i[_ + 1], v = i[f], g = i[f + 1], x = (c + 1) % n; x != h; x = (x + 1) % n)
  50005. if (o[x]) {
  50006. var b = r[x] << 1,
  50007. A = i[b],
  50008. C = i[b + 1];
  50009. if (e.positiveArea(v, g, d, p, A, C) && e.positiveArea(d, p, m, y, A, C) && e.positiveArea(m, y, v, g, A, C)) break t
  50010. }
  50011. break
  50012. }if (0 == c) {
  50013. do {
  50014. if (!o[s]) break;
  50015. s--
  50016. } while (s > 0);
  50017. break
  50018. }
  50019. h = s,
  50020. s = c,
  50021. c = (c + 1) % n
  50022. }
  50023. l.push(r[(n + s - 1) % n]), l.push(r[s]), l.push(r[(s + 1) % n]), r.splice(s, 1), o.splice(s, 1);
  50024. var T = (--n + s - 1) % n,
  50025. S = s == n ? 0 : s;
  50026. o[T] = e.isConcave(T, n, i, r), o[S] = e.isConcave(S, n, i, r)
  50027. }
  50028. return 3 == n && (l.push(r[2]), l.push(r[0]), l.push(r[1])), l
  50029. }, e.prototype.decompose = function(t, i) {
  50030. var n = t,
  50031. r = this.convexPolygons;
  50032. this.polygonPool.freeAll(r), r.length = 0;
  50033. var s = this.convexPolygonsIndices;
  50034. this.polygonIndicesPool.freeAll(s), s.length = 0;
  50035. var o = this.polygonIndicesPool.obtain();
  50036. o.length = 0;
  50037. var a = this.polygonPool.obtain();
  50038. a.length = 0;
  50039. for (var l = -1, h = 0, c = 0, u = i.length; c < u; c += 3) {
  50040. var _ = i[c] << 1,
  50041. f = i[c + 1] << 1,
  50042. d = i[c + 2] << 1,
  50043. p = n[_],
  50044. m = n[_ + 1],
  50045. y = n[f],
  50046. v = n[f + 1],
  50047. g = n[d],
  50048. x = n[d + 1],
  50049. b = !1;
  50050. if (l == _) {
  50051. var A = a.length - 4,
  50052. C = e.winding(a[A], a[A + 1], a[A + 2], a[A + 3], g, x),
  50053. T = e.winding(g, x, a[0], a[1], a[2], a[3]);
  50054. C == h && T == h && (a.push(g), a.push(x), o.push(d), b = !0)
  50055. }
  50056. b || (a.length > 0 ? (r.push(a), s.push(o)) : (this.polygonPool.free(a), this.polygonIndicesPool.free(o)), (a = this.polygonPool.obtain()).length = 0, a.push(p), a.push(m), a.push(y), a.push(v), a.push(g), a.push(x), (o = this.polygonIndicesPool.obtain()).length = 0, o.push(_), o.push(f), o.push(d), h = e.winding(p, m, y, v, g, x), l = _)
  50057. }
  50058. a.length > 0 && (r.push(a), s.push(o));
  50059. for (c = 0, u = r.length; c < u; c++)
  50060. if (0 != (o = s[c]).length)
  50061. for (var S = o[0], w = o[o.length - 1], E = (a = r[c])[A = a.length - 4], M = a[A + 1], D = a[A + 2], B = a[A + 3], I = a[0], P = a[1], R = a[2], O = a[3], L = e.winding(E, M, D, B, I, P), F = 0; F < u; F++)
  50062. if (F != c) {
  50063. var N = s[F];
  50064. if (3 == N.length) {
  50065. var V = N[0],
  50066. k = N[1],
  50067. G = N[2],
  50068. U = r[F];
  50069. g = U[U.length - 2], x = U[U.length - 1];
  50070. if (V == S && k == w) {
  50071. C = e.winding(E, M, D, B, g, x), T = e.winding(g, x, I, P, R, O);
  50072. C == L && T == L && (U.length = 0, N.length = 0, a.push(g), a.push(x), o.push(G), E = D, M = B, D = g, B = x, F = 0)
  50073. }
  50074. }
  50075. }
  50076. for (c = r.length - 1; c >= 0; c--) 0 == (a = r[c]).length && (r.splice(c, 1), this.polygonPool.free(a), o = s[c], s.splice(c, 1), this.polygonIndicesPool.free(o));
  50077. return r
  50078. }, e.isConcave = function(t, e, i, n) {
  50079. var r = n[(e + t - 1) % e] << 1,
  50080. s = n[t] << 1,
  50081. o = n[(t + 1) % e] << 1;
  50082. return !this.positiveArea(i[r], i[r + 1], i[s], i[s + 1], i[o], i[o + 1])
  50083. }, e.positiveArea = function(t, e, i, n, r, s) {
  50084. return t * (s - n) + i * (e - s) + r * (n - e) >= 0
  50085. }, e.winding = function(t, e, i, n, r, s) {
  50086. var o = i - t,
  50087. a = n - e;
  50088. return r * a - s * o + o * e - t * a >= 0 ? 1 : -1
  50089. }, e
  50090. })();
  50091. t.Triangulator = e
  50092. })(n || (n = {})), (function(t) {
  50093. var e = (function() {
  50094. function t() {
  50095. this.array = new Array
  50096. }
  50097. return t.prototype.add = function(t) {
  50098. var e = this.contains(t);
  50099. return this.array[0 | t] = 0 | t, !e
  50100. }, t.prototype.contains = function(t) {
  50101. return void 0 != this.array[0 | t]
  50102. }, t.prototype.remove = function(t) {
  50103. this.array[0 | t] = void 0
  50104. }, t.prototype.clear = function() {
  50105. this.array.length = 0
  50106. }, t
  50107. })();
  50108. t.IntSet = e;
  50109. var i = (function() {
  50110. function t(t, e, i, n) {
  50111. void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), this.r = t, this.g = e, this.b = i, this.a = n
  50112. }
  50113. return t.prototype.set = function(t, e, i, n) {
  50114. return this.r = t, this.g = e, this.b = i, this.a = n, this.clamp(), this
  50115. }, t.prototype.setFromColor = function(t) {
  50116. return this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this
  50117. }, t.prototype.setFromString = function(t) {
  50118. return t = "#" == t.charAt(0) ? t.substr(1) : t, this.r = parseInt(t.substr(0, 2), 16) / 255, this.g = parseInt(t.substr(2, 2), 16) / 255, this.b = parseInt(t.substr(4, 2), 16) / 255, this.a = (8 != t.length ? 255 : parseInt(t.substr(6, 2), 16)) / 255, this
  50119. }, t.prototype.add = function(t, e, i, n) {
  50120. return this.r += t, this.g += e, this.b += i, this.a += n, this.clamp(), this
  50121. }, t.prototype.clamp = function() {
  50122. return this.r < 0 ? this.r = 0 : this.r > 1 && (this.r = 1), this.g < 0 ? this.g = 0 : this.g > 1 && (this.g = 1), this.b < 0 ? this.b = 0 : this.b > 1 && (this.b = 1), this.a < 0 ? this.a = 0 : this.a > 1 && (this.a = 1), this
  50123. }, t.WHITE = new t(1, 1, 1, 1), t.RED = new t(1, 0, 0, 1), t.GREEN = new t(0, 1, 0, 1), t.BLUE = new t(0, 0, 1, 1), t.MAGENTA = new t(1, 0, 1, 1), t
  50124. })();
  50125. t.Color = i;
  50126. var n = (function() {
  50127. function t() {}
  50128. return t.clamp = function(t, e, i) {
  50129. return t < e ? e : t > i ? i : t
  50130. }, t.cosDeg = function(e) {
  50131. return Math.cos(e * t.degRad)
  50132. }, t.sinDeg = function(e) {
  50133. return Math.sin(e * t.degRad)
  50134. }, t.signum = function(t) {
  50135. return t > 0 ? 1 : t < 0 ? -1 : 0
  50136. }, t.toInt = function(t) {
  50137. return t > 0 ? Math.floor(t) : Math.ceil(t)
  50138. }, t.cbrt = function(t) {
  50139. var e = Math.pow(Math.abs(t), 1 / 3);
  50140. return t < 0 ? -e : e
  50141. }, t.randomTriangular = function(e, i) {
  50142. return t.randomTriangularWith(e, i, .5 * (e + i))
  50143. }, t.randomTriangularWith = function(t, e, i) {
  50144. var n = Math.random(),
  50145. r = e - t;
  50146. return n <= (i - t) / r ? t + Math.sqrt(n * r * (i - t)) : e - Math.sqrt((1 - n) * r * (e - i))
  50147. }, t.PI = 3.1415927, t.PI2 = 2 * t.PI, t.radiansToDegrees = 180 / t.PI, t.radDeg = t.radiansToDegrees, t.degreesToRadians = t.PI / 180, t.degRad = t.degreesToRadians, t
  50148. })();
  50149. t.MathUtils = n;
  50150. var s = (function() {
  50151. function t() {}
  50152. return t.prototype.apply = function(t, e, i) {
  50153. return t + (e - t) * this.applyInternal(i)
  50154. }, t
  50155. })();
  50156. t.Interpolation = s;
  50157. var o = (function(t) {
  50158. function e(e) {
  50159. var i = t.call(this) || this;
  50160. return i.power = 2, i.power = e, i
  50161. }
  50162. return r(e, t), e.prototype.applyInternal = function(t) {
  50163. return t <= .5 ? Math.pow(2 * t, this.power) / 2 : Math.pow(2 * (t - 1), this.power) / (this.power % 2 == 0 ? -2 : 2) + 1
  50164. }, e
  50165. })(s);
  50166. t.Pow = o;
  50167. var a = (function(t) {
  50168. function e(e) {
  50169. return t.call(this, e) || this
  50170. }
  50171. return r(e, t), e.prototype.applyInternal = function(t) {
  50172. return Math.pow(t - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1
  50173. }, e
  50174. })(o);
  50175. t.PowOut = a;
  50176. var l = (function() {
  50177. function t() {}
  50178. return t.arrayCopy = function(t, e, i, n, r) {
  50179. for (var s = e, o = n; s < e + r; s++, o++) i[o] = t[s]
  50180. }, t.setArraySize = function(t, e, i) {
  50181. void 0 === i && (i = 0);
  50182. var n = t.length;
  50183. if (n == e) return t;
  50184. if (t.length = e, n < e)
  50185. for (var r = n; r < e; r++) t[r] = i;
  50186. return t
  50187. }, t.ensureArrayCapacity = function(e, i, n) {
  50188. return void 0 === n && (n = 0), e.length >= i ? e : t.setArraySize(e, i, n)
  50189. }, t.newArray = function(t, e) {
  50190. for (var i = new Array(t), n = 0; n < t; n++) i[n] = e;
  50191. return i
  50192. }, t.newFloatArray = function(e) {
  50193. if (t.SUPPORTS_TYPED_ARRAYS) return new Float32Array(e);
  50194. for (var i = new Array(e), n = 0; n < i.length; n++) i[n] = 0;
  50195. return i
  50196. }, t.newShortArray = function(e) {
  50197. if (t.SUPPORTS_TYPED_ARRAYS) return new Int16Array(e);
  50198. for (var i = new Array(e), n = 0; n < i.length; n++) i[n] = 0;
  50199. return i
  50200. }, t.toFloatArray = function(e) {
  50201. return t.SUPPORTS_TYPED_ARRAYS ? new Float32Array(e) : e
  50202. }, t.toSinglePrecision = function(e) {
  50203. return t.SUPPORTS_TYPED_ARRAYS ? Math.fround(e) : e
  50204. }, t.webkit602BugfixHelper = function(t, e) {}, t.SUPPORTS_TYPED_ARRAYS = "undefined" != typeof Float32Array, t
  50205. })();
  50206. t.Utils = l;
  50207. var h = (function() {
  50208. function t() {}
  50209. return t.logBones = function(t) {
  50210. for (var e = 0; e < t.bones.length; e++) {
  50211. var i = t.bones[e];
  50212. console.log(i.data.name + ", " + i.a + ", " + i.b + ", " + i.c + ", " + i.d + ", " + i.worldX + ", " + i.worldY)
  50213. }
  50214. }, t
  50215. })();
  50216. t.DebugUtils = h;
  50217. var c = (function() {
  50218. function t(t) {
  50219. this.items = new Array, this.instantiator = t
  50220. }
  50221. return t.prototype.obtain = function() {
  50222. return this.items.length > 0 ? this.items.pop() : this.instantiator()
  50223. }, t.prototype.free = function(t) {
  50224. t.reset && t.reset(), this.items.push(t)
  50225. }, t.prototype.freeAll = function(t) {
  50226. for (var e = 0; e < t.length; e++) t[e].reset && t[e].reset(), this.items[e] = t[e]
  50227. }, t.prototype.clear = function() {
  50228. this.items.length = 0
  50229. }, t
  50230. })();
  50231. t.Pool = c;
  50232. var u = (function() {
  50233. function t(t, e) {
  50234. void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e
  50235. }
  50236. return t.prototype.set = function(t, e) {
  50237. return this.x = t, this.y = e, this
  50238. }, t.prototype.length = function() {
  50239. var t = this.x,
  50240. e = this.y;
  50241. return Math.sqrt(t * t + e * e)
  50242. }, t.prototype.normalize = function() {
  50243. var t = this.length();
  50244. return 0 != t && (this.x /= t, this.y /= t), this
  50245. }, t
  50246. })();
  50247. t.Vector2 = u;
  50248. var _ = (function() {
  50249. function t() {
  50250. this.maxDelta = .064, this.framesPerSecond = 0, this.delta = 0, this.totalTime = 0, this.lastTime = Date.now() / 1e3, this.frameCount = 0, this.frameTime = 0
  50251. }
  50252. return t.prototype.update = function() {
  50253. var t = Date.now() / 1e3;
  50254. this.delta = t - this.lastTime, this.frameTime += this.delta, this.totalTime += this.delta, this.delta > this.maxDelta && (this.delta = this.maxDelta), this.lastTime = t, this.frameCount++, this.frameTime > 1 && (this.framesPerSecond = this.frameCount / this.frameTime, this.frameTime = 0, this.frameCount = 0)
  50255. }, t
  50256. })();
  50257. t.TimeKeeper = _;
  50258. var f = (function() {
  50259. function t(t) {
  50260. void 0 === t && (t = 32), this.addedValues = 0, this.lastValue = 0, this.mean = 0, this.dirty = !0, this.values = new Array(t)
  50261. }
  50262. return t.prototype.hasEnoughData = function() {
  50263. return this.addedValues >= this.values.length
  50264. }, t.prototype.addValue = function(t) {
  50265. this.addedValues < this.values.length && this.addedValues++, this.values[this.lastValue++] = t, this.lastValue > this.values.length - 1 && (this.lastValue = 0), this.dirty = !0
  50266. }, t.prototype.getMean = function() {
  50267. if (this.hasEnoughData()) {
  50268. if (this.dirty) {
  50269. for (var t = 0, e = 0; e < this.values.length; e++) t += this.values[e];
  50270. this.mean = t / this.values.length, this.dirty = !1
  50271. }
  50272. return this.mean
  50273. }
  50274. return 0
  50275. }, t
  50276. })();
  50277. t.WindowedMean = f
  50278. })(n || (n = {})), Math.fround || (Math.fround = (function(t) {
  50279. return function(e) {
  50280. return t[0] = e, t[0]
  50281. }
  50282. })(new Float32Array(1))), (function(t) {
  50283. var e = (function() {
  50284. return function(t) {
  50285. if (null == t) throw new Error("name cannot be null.");
  50286. this.name = t
  50287. }
  50288. })();
  50289. t.Attachment = e;
  50290. var i = (function(t) {
  50291. function e(i) {
  50292. var n = t.call(this, i) || this;
  50293. return n.id = (65535 & e.nextID++) << 11, n.worldVerticesLength = 0, n
  50294. }
  50295. return r(e, t), e.prototype.computeWorldVertices = function(t, e, i, n, r, s) {
  50296. i = r + (i >> 1) * s;
  50297. var o = t.bone.skeleton,
  50298. a = t.attachmentVertices,
  50299. l = this.vertices,
  50300. h = this.bones;
  50301. if (null != h) {
  50302. for (var c = 0, u = 0, _ = 0; _ < e; _ += 2) {
  50303. c += (m = h[c]) + 1, u += m
  50304. }
  50305. var f = o.bones;
  50306. if (0 == a.length)
  50307. for (M = r, T = 3 * u; M < i; M += s) {
  50308. var d = 0,
  50309. p = 0,
  50310. m = h[c++];
  50311. for (m += c; c < m; c++, T += 3) {
  50312. x = f[h[c]], D = l[T], B = l[T + 1];
  50313. var y = l[T + 2];
  50314. d += (D * x.a + B * x.b + x.worldX) * y, p += (D * x.c + B * x.d + x.worldY) * y
  50315. }
  50316. n[M] = d, n[M + 1] = p
  50317. } else
  50318. for (var v = a, g = (M = r, T = 3 * u, u << 1); M < i; M += s) {
  50319. d = 0, p = 0, m = h[c++];
  50320. for (m += c; c < m; c++, T += 3, g += 2) {
  50321. x = f[h[c]], D = l[T] + v[g], B = l[T + 1] + v[g + 1], y = l[T + 2];
  50322. d += (D * x.a + B * x.b + x.worldX) * y, p += (D * x.c + B * x.d + x.worldY) * y
  50323. }
  50324. n[M] = d, n[M + 1] = p
  50325. }
  50326. } else {
  50327. a.length > 0 && (l = a);
  50328. for (var x, b = (x = t.bone).worldX, A = x.worldY, C = x.a, T = x.b, S = x.c, w = x.d, E = e, M = r; M < i; E += 2, M += s) {
  50329. var D = l[E],
  50330. B = l[E + 1];
  50331. n[M] = D * C + B * T + b, n[M + 1] = D * S + B * w + A
  50332. }
  50333. }
  50334. }, e.prototype.applyDeform = function(t) {
  50335. return this == t
  50336. }, e.nextID = 0, e
  50337. })(e);
  50338. t.VertexAttachment = i
  50339. })(n || (n = {})), (function(t) {
  50340. (function(t) {
  50341. t[t.Region = 0] = "Region", t[t.BoundingBox = 1] = "BoundingBox", t[t.Mesh = 2] = "Mesh", t[t.LinkedMesh = 3] = "LinkedMesh", t[t.Path = 4] = "Path", t[t.Point = 5] = "Point"
  50342. })(t.AttachmentType || (t.AttachmentType = {}))
  50343. })(n || (n = {})), (function(t) {
  50344. var e = (function(e) {
  50345. function i(i) {
  50346. var n = e.call(this, i) || this;
  50347. return n.color = new t.Color(1, 1, 1, 1), n
  50348. }
  50349. return r(i, e), i
  50350. })(t.VertexAttachment);
  50351. t.BoundingBoxAttachment = e
  50352. })(n || (n = {})), (function(t) {
  50353. var e = (function(e) {
  50354. function i(i) {
  50355. var n = e.call(this, i) || this;
  50356. return n.color = new t.Color(.2275, .2275, .8078, 1), n
  50357. }
  50358. return r(i, e), i
  50359. })(t.VertexAttachment);
  50360. t.ClippingAttachment = e
  50361. })(n || (n = {})), (function(t) {
  50362. var e = (function(e) {
  50363. function i(i) {
  50364. var n = e.call(this, i) || this;
  50365. return n.color = new t.Color(1, 1, 1, 1), n.inheritDeform = !1, n.tempColor = new t.Color(0, 0, 0, 0), n
  50366. }
  50367. return r(i, e), i.prototype.updateUVs = function() {
  50368. var e = 0,
  50369. i = 0,
  50370. n = 0,
  50371. r = 0;
  50372. null == this.region ? (e = i = 0, n = r = 1) : (e = this.region.u, i = this.region.v, n = this.region.u2 - e, r = this.region.v2 - i);
  50373. var s = this.regionUVs;
  50374. null != this.uvs && this.uvs.length == s.length || (this.uvs = t.Utils.newFloatArray(s.length));
  50375. var o = this.uvs;
  50376. if (this.region.rotate)
  50377. for (var a = 0, l = o.length; a < l; a += 2) o[a] = e + s[a + 1] * n, o[a + 1] = i + r - s[a] * r;
  50378. else
  50379. for (a = 0, l = o.length; a < l; a += 2) o[a] = e + s[a] * n, o[a + 1] = i + s[a + 1] * r
  50380. }, i.prototype.applyDeform = function(t) {
  50381. return this == t || this.inheritDeform && this.parentMesh == t
  50382. }, i.prototype.getParentMesh = function() {
  50383. return this.parentMesh
  50384. }, i.prototype.setParentMesh = function(t) {
  50385. this.parentMesh = t, null != t && (this.bones = t.bones, this.vertices = t.vertices, this.worldVerticesLength = t.worldVerticesLength, this.regionUVs = t.regionUVs, this.triangles = t.triangles, this.hullLength = t.hullLength, this.worldVerticesLength = t.worldVerticesLength)
  50386. }, i
  50387. })(t.VertexAttachment);
  50388. t.MeshAttachment = e
  50389. })(n || (n = {})), (function(t) {
  50390. var e = (function(e) {
  50391. function i(i) {
  50392. var n = e.call(this, i) || this;
  50393. return n.closed = !1, n.constantSpeed = !1, n.color = new t.Color(1, 1, 1, 1), n
  50394. }
  50395. return r(i, e), i
  50396. })(t.VertexAttachment);
  50397. t.PathAttachment = e
  50398. })(n || (n = {})), (function(t) {
  50399. var e = (function(e) {
  50400. function i(i) {
  50401. var n = e.call(this, i) || this;
  50402. return n.color = new t.Color(.38, .94, 0, 1), n
  50403. }
  50404. return r(i, e), i.prototype.computeWorldPosition = function(t, e) {
  50405. return e.x = this.x * t.a + this.y * t.b + t.worldX, e.y = this.x * t.c + this.y * t.d + t.worldY, e
  50406. }, i.prototype.computeWorldRotation = function(e) {
  50407. var i = t.MathUtils.cosDeg(this.rotation),
  50408. n = t.MathUtils.sinDeg(this.rotation),
  50409. r = i * e.a + n * e.b,
  50410. s = i * e.c + n * e.d;
  50411. return Math.atan2(s, r) * t.MathUtils.radDeg
  50412. }, i
  50413. })(t.VertexAttachment);
  50414. t.PointAttachment = e
  50415. })(n || (n = {})), (function(t) {
  50416. var e = (function(e) {
  50417. function i(i) {
  50418. var n = e.call(this, i) || this;
  50419. return n.x = 0, n.y = 0, n.scaleX = 1, n.scaleY = 1, n.rotation = 0, n.width = 0, n.height = 0, n.color = new t.Color(1, 1, 1, 1), n.offset = t.Utils.newFloatArray(8), n.uvs = t.Utils.newFloatArray(8), n.tempColor = new t.Color(1, 1, 1, 1), n
  50420. }
  50421. return r(i, e), i.prototype.updateOffset = function() {
  50422. var t = this.width / this.region.originalWidth * this.scaleX,
  50423. e = this.height / this.region.originalHeight * this.scaleY,
  50424. n = -this.width / 2 * this.scaleX + this.region.offsetX * t,
  50425. r = -this.height / 2 * this.scaleY + this.region.offsetY * e,
  50426. s = n + this.region.width * t,
  50427. o = r + this.region.height * e,
  50428. a = this.rotation * Math.PI / 180,
  50429. l = Math.cos(a),
  50430. h = Math.sin(a),
  50431. c = n * l + this.x,
  50432. u = n * h,
  50433. _ = r * l + this.y,
  50434. f = r * h,
  50435. d = s * l + this.x,
  50436. p = s * h,
  50437. m = o * l + this.y,
  50438. y = o * h,
  50439. v = this.offset;
  50440. v[i.OX1] = c - f, v[i.OY1] = _ + u, v[i.OX2] = c - y, v[i.OY2] = m + u, v[i.OX3] = d - y, v[i.OY3] = m + p, v[i.OX4] = d - f, v[i.OY4] = _ + p
  50441. }, i.prototype.setRegion = function(t) {
  50442. this.region = t;
  50443. var e = this.uvs;
  50444. t.rotate ? (e[2] = t.u, e[3] = t.v2, e[4] = t.u, e[5] = t.v, e[6] = t.u2, e[7] = t.v, e[0] = t.u2, e[1] = t.v2) : (e[0] = t.u, e[1] = t.v2, e[2] = t.u, e[3] = t.v, e[4] = t.u2, e[5] = t.v, e[6] = t.u2, e[7] = t.v2)
  50445. }, i.prototype.computeWorldVertices = function(t, e, n, r) {
  50446. var s = this.offset,
  50447. o = t.worldX,
  50448. a = t.worldY,
  50449. l = t.a,
  50450. h = t.b,
  50451. c = t.c,
  50452. u = t.d,
  50453. _ = 0,
  50454. f = 0;
  50455. _ = s[i.OX1], f = s[i.OY1], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a, n += r, _ = s[i.OX2], f = s[i.OY2], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a, n += r, _ = s[i.OX3], f = s[i.OY3], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a, n += r, _ = s[i.OX4], f = s[i.OY4], e[n] = _ * l + f * h + o, e[n + 1] = _ * c + f * u + a
  50456. }, i.OX1 = 0, i.OY1 = 1, i.OX2 = 2, i.OY2 = 3, i.OX3 = 4, i.OY3 = 5, i.OX4 = 6, i.OY4 = 7, i.X1 = 0, i.Y1 = 1, i.C1R = 2, i.C1G = 3, i.C1B = 4, i.C1A = 5, i.U1 = 6, i.V1 = 7, i.X2 = 8, i.Y2 = 9, i.C2R = 10, i.C2G = 11, i.C2B = 12, i.C2A = 13, i.U2 = 14, i.V2 = 15, i.X3 = 16, i.Y3 = 17, i.C3R = 18, i.C3G = 19, i.C3B = 20, i.C3A = 21, i.U3 = 22, i.V3 = 23, i.X4 = 24, i.Y4 = 25, i.C4R = 26, i.C4G = 27, i.C4B = 28, i.C4A = 29, i.U4 = 30, i.V4 = 31, i
  50457. })(t.Attachment);
  50458. t.RegionAttachment = e
  50459. })(n || (n = {})), (function(t) {
  50460. var e = (function() {
  50461. function e(t, e) {
  50462. this.jitterX = 0, this.jitterY = 0, this.jitterX = t, this.jitterY = e
  50463. }
  50464. return e.prototype.begin = function(t) {}, e.prototype.transform = function(e, i, n, r) {
  50465. e.x += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY), e.y += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY)
  50466. }, e.prototype.end = function() {}, e
  50467. })();
  50468. t.JitterEffect = e
  50469. })(n || (n = {})), (function(t) {
  50470. var e = (function() {
  50471. function e(t, e) {
  50472. this.centerX = 0, this.centerY = 0, this.radius = 0, this.angle = 0, this.worldX = 0, this.worldY = 0, this.radius = t, this.interpolation = e
  50473. }
  50474. return e.prototype.begin = function(t) {
  50475. this.worldX = t.x + this.centerX, this.worldY = t.y + this.centerY
  50476. }, e.prototype.transform = function(e, i, n, r) {
  50477. var s = this.angle * t.MathUtils.degreesToRadians,
  50478. o = e.x - this.worldX,
  50479. a = e.y - this.worldY,
  50480. l = Math.sqrt(o * o + a * a);
  50481. if (l < this.radius) {
  50482. var h = this.interpolation.apply(0, s, (this.radius - l) / this.radius),
  50483. c = Math.cos(h),
  50484. u = Math.sin(h);
  50485. e.x = c * o - u * a + this.worldX, e.y = u * o + c * a + this.worldY
  50486. }
  50487. }, e.prototype.end = function() {}, e.interpolation = new t.PowOut(2), e
  50488. })();
  50489. t.SwirlEffect = e
  50490. })(n || (n = {})), e.exports = n
  50491. }), {}],
  50492. 415: [(function(t, e, i) {
  50493. "use strict";
  50494. var n = t("./track-entry-listeners"),
  50495. r = t("./lib/spine"),
  50496. s = [],
  50497. o = [],
  50498. a = 0,
  50499. l = 0,
  50500. h = null,
  50501. c = null,
  50502. u = 0,
  50503. _ = 0,
  50504. f = 0,
  50505. d = 0,
  50506. p = null,
  50507. m = null,
  50508. y = 0,
  50509. v = 0,
  50510. g = void 0,
  50511. x = void 0,
  50512. b = void 0,
  50513. A = void 0,
  50514. C = void 0,
  50515. T = void 0,
  50516. S = new r.Color(1, 1, 1, 1),
  50517. w = new r.Color(1, 1, 1, 1),
  50518. E = [0, 1, 2, 2, 3, 0],
  50519. M = cc.Class({
  50520. ctor: function() {
  50521. this._inited = !1, this._invalid = !0, this.frames = [], this.totalTime = 0, this._frameIdx = -1, this.isCompleted = !1, this._skeletonInfo = null, this._animationName = null, this._tempSegments = null, this._tempColors = null
  50522. },
  50523. init: function(t, e) {
  50524. this._inited = !0, this._animationName = e, this._skeletonInfo = t
  50525. },
  50526. clear: function() {
  50527. this._inited = !1;
  50528. for (var t = 0, e = this.frames.length; t < e; t++) {
  50529. this.frames[t].segments.length = 0
  50530. }
  50531. this.invalidAllFrame()
  50532. },
  50533. bind: function(t) {
  50534. var e = function(t) {
  50535. t && t.animation.name === this._animationName && (this.isCompleted = !0)
  50536. }.bind(this);
  50537. t.complete = e
  50538. },
  50539. unbind: function(t) {
  50540. t.complete = null
  50541. },
  50542. begin: function() {
  50543. if (this._invalid) {
  50544. var t = this._skeletonInfo,
  50545. e = t.curAnimationCache;
  50546. e && e !== this && e.updateToFrame();
  50547. var i = t.skeleton,
  50548. n = t.listener,
  50549. r = t.state,
  50550. s = i.data.findAnimation(this._animationName);
  50551. r.setAnimationWith(0, s, !1), this.bind(n), t.curAnimationCache = this, this._frameIdx = -1, this.isCompleted = !1, this.totalTime = 0, this._invalid = !1
  50552. }
  50553. },
  50554. end: function() {
  50555. this._needToUpdate() || (this._skeletonInfo.curAnimationCache = null, this.frames.length = this._frameIdx + 1, this.isCompleted = !0, this.unbind(this._skeletonInfo.listener))
  50556. },
  50557. _needToUpdate: function(t) {
  50558. return !this.isCompleted && this.totalTime < 30 && (void 0 == t || this._frameIdx < t)
  50559. },
  50560. updateToFrame: function(t) {
  50561. if (this._inited && (this.begin(), this._needToUpdate(t))) {
  50562. var e = this._skeletonInfo,
  50563. i = e.skeleton,
  50564. n = e.clipper,
  50565. r = e.state;
  50566. do {
  50567. i.update(1 / 60), r.update(1 / 60), r.apply(i), i.updateWorldTransform(), this._frameIdx++, this._updateFrame(i, n, this._frameIdx), this.totalTime += 1 / 60
  50568. } while (this._needToUpdate(t));
  50569. this.end()
  50570. }
  50571. },
  50572. isInited: function() {
  50573. return this._inited
  50574. },
  50575. isInvalid: function() {
  50576. return this._invalid
  50577. },
  50578. invalidAllFrame: function() {
  50579. this.isCompleted = !1, this._invalid = !0
  50580. },
  50581. updateAllFrame: function() {
  50582. this.invalidAllFrame(), this.updateToFrame()
  50583. },
  50584. _updateFrame: function(t, e, i) {
  50585. l = 0, a = 0, 0, h = null, c = null, u = 0, _ = 0, f = 0, d = 0, p = null, m = null, this.frames[i] = this.frames[i] || {
  50586. segments: [],
  50587. colors: [],
  50588. vertices: null,
  50589. uintVert: null,
  50590. indices: null
  50591. };
  50592. var n = this.frames[i],
  50593. r = this._tempSegments = n.segments,
  50594. y = this._tempColors = n.colors;
  50595. this._traverseSkeleton(t, e), d > 0 && (y[d - 1].vfOffset = l), y.length = d;
  50596. var v = f - 1;
  50597. if (v >= 0)
  50598. if (_ > 0) {
  50599. var g = r[v];
  50600. g.indexCount = _, g.vfCount = 6 * u, g.vertexCount = u, r.length = f
  50601. } else r.length = f - 1;
  50602. if (0 != r.length) {
  50603. var x = n.vertices,
  50604. b = n.uintVert;
  50605. (!x || x.length < l) && (x = n.vertices = new Float32Array(l), b = n.uintVert = new Uint32Array(x.buffer));
  50606. for (var A = 0, C = 0; A < l;) x[A++] = s[C++], x[A++] = s[C++], x[A++] = s[C++], x[A++] = s[C++], b[A++] = s[C++], b[A++] = s[C++];
  50607. var T = n.indices;
  50608. (!T || T.length < a) && (T = n.indices = new Uint16Array(a));
  50609. for (var S = 0; S < a; S++) T[S] = o[S];
  50610. n.vertices = x, n.uintVert = b, n.indices = T
  50611. }
  50612. },
  50613. fillVertices: function(t, e, i, n, r) {
  50614. if (A = i.a * e.a * t.a * 255, g = e.r * t.r * 255, x = e.g * t.g * 255, b = e.b * t.b * 255, S.r = g * i.r, S.g = x * i.g, S.b = b * i.b, S.a = A, null == r.darkColor ? w.set(0, 0, 0, 1) : (w.r = r.darkColor.r * g, w.g = r.darkColor.g * x, w.b = r.darkColor.b * b), w.a = 0, C = (S.a << 24 >>> 0) + (S.b << 16) + (S.g << 8) + S.r, T = (w.a << 24 >>> 0) + (w.b << 16) + (w.g << 8) + w.r, p !== C || m !== T) {
  50615. var h = this._tempColors;
  50616. p = C, m = T, d > 0 && (h[d - 1].vfOffset = l), h[d++] = {
  50617. fr: S.r,
  50618. fg: S.g,
  50619. fb: S.b,
  50620. fa: S.a,
  50621. dr: w.r,
  50622. dg: w.g,
  50623. db: w.b,
  50624. da: w.a,
  50625. vfOffset: 0
  50626. }
  50627. }
  50628. if (n.isClipping()) {
  50629. n.clipTriangles(s, y, o, v, s, S, w, !0, 6, a, l, l + 2);
  50630. var c = n.clippedVertices,
  50631. u = n.clippedTriangles;
  50632. v = u.length, y = c.length / 12 * 6;
  50633. for (var _ = 0, f = a, E = u.length; _ < E;) o[f++] = u[_++];
  50634. for (var M = 0, D = c.length, B = l; M < D; M += 12, B += 6) s[B] = c[M], s[B + 1] = c[M + 1], s[B + 2] = c[M + 6], s[B + 3] = c[M + 7], s[B + 4] = C, s[B + 5] = T
  50635. } else
  50636. for (var I = l, P = l + y; I < P; I += 6) s[I + 4] = C, s[I + 5] = T
  50637. },
  50638. _traverseSkeleton: function(t, e) {
  50639. for (var i = this._tempSegments, n = t.color, d = void 0, p = void 0, m = void 0, g = void 0, x = void 0, b = void 0, A = void 0, C = void 0, T = void 0, S = void 0, w = void 0, M = void 0, D = 0, B = t.drawOrder.length; D < B; D++)
  50640. if (M = t.drawOrder[D], y = 0, v = 0, d = M.getAttachment())
  50641. if (b = d instanceof r.RegionAttachment, A = d instanceof r.MeshAttachment, d instanceof r.ClippingAttachment) e.clipStart(M, d);
  50642. else if (b || A)
  50643. if (C = d.region.texture._texture)
  50644. if (w = M.data.blendMode, h === C.url && c === w || (h = C.url, c = w, (T = f - 1) >= 0 && (_ > 0 ? ((S = i[T]).indexCount = _, S.vertexCount = u, S.vfCount = 6 * u) : f--), i[f] = {
  50645. tex: C,
  50646. blendMode: w,
  50647. indexCount: 0,
  50648. vertexCount: 0,
  50649. vfCount: 0
  50650. }, f++, _ = 0, u = 0), b ? (x = E, y = 24, v = 6, d.computeWorldVertices(M.bone, s, l, 6)) : A && (x = d.triangles, y = 6 * (d.worldVerticesLength >> 1), v = x.length, d.computeWorldVertices(M, 0, d.worldVerticesLength, s, l, 6)), 0 != y && 0 != v) {
  50651. for (var I = 0, P = a, R = x.length; I < R;) o[P++] = x[I++];
  50652. g = d.uvs;
  50653. for (var O = l, L = l + y, F = 0; O < L; O += 6, F += 2) s[O + 2] = g[F], s[O + 3] = g[F + 1];
  50654. if (p = d.color, m = M.color, this.fillVertices(n, p, m, e, M), v > 0) {
  50655. for (var N = a, V = a + v; N < V; N++) o[N] += u;
  50656. a += v, (l += y) / 6, _ += v, u += y / 6
  50657. }
  50658. e.clipEndWithSlot(M)
  50659. } else e.clipEndWithSlot(M);
  50660. else e.clipEndWithSlot(M);
  50661. else e.clipEndWithSlot(M);
  50662. else e.clipEndWithSlot(M);
  50663. e.clipEnd()
  50664. }
  50665. }),
  50666. D = cc.Class({
  50667. ctor: function() {
  50668. this._animationPool = {}, this._skeletonCache = {}
  50669. },
  50670. clear: function() {
  50671. this._animationPool = {}, this._skeletonCache = {}
  50672. },
  50673. removeSkeleton: function(t) {
  50674. var e = this._skeletonCache[t];
  50675. if (e) {
  50676. var i = e.animationsCache;
  50677. for (var n in i) {
  50678. var r = i[n];
  50679. r && (this._animationPool[t + "#" + n] = r, r.clear())
  50680. }
  50681. delete this._skeletonCache[t]
  50682. }
  50683. },
  50684. getSkeletonCache: function(t, e) {
  50685. var i = this._skeletonCache[t];
  50686. if (!i) {
  50687. var s = new r.Skeleton(e),
  50688. o = new r.SkeletonClipping,
  50689. a = new r.AnimationStateData(s.data),
  50690. l = new r.AnimationState(a),
  50691. h = new n;
  50692. l.addListener(h), this._skeletonCache[t] = i = {
  50693. skeleton: s,
  50694. clipper: o,
  50695. state: l,
  50696. listener: h,
  50697. animationsCache: {},
  50698. curAnimationCache: null
  50699. }
  50700. }
  50701. return i
  50702. },
  50703. getAnimationCache: function(t, e) {
  50704. var i = this._skeletonCache[t];
  50705. return i ? i.animationsCache[e] : null
  50706. },
  50707. invalidAnimationCache: function(t) {
  50708. var e = this._skeletonCache[t];
  50709. if (e && e.skeleton) {
  50710. var i = e.animationsCache;
  50711. for (var n in i) {
  50712. i[n].invalidAllFrame()
  50713. }
  50714. }
  50715. },
  50716. initAnimationCache: function(t, e) {
  50717. if (!e) return null;
  50718. var i = this._skeletonCache[t],
  50719. n = i && i.skeleton;
  50720. if (!n) return null;
  50721. if (!n.data.findAnimation(e)) return null;
  50722. var r = i.animationsCache,
  50723. s = r[e];
  50724. if (!s) {
  50725. var o = t + "#" + e;
  50726. (s = this._animationPool[o]) ? delete this._animationPool[o]: s = new M, s.init(i, e), r[e] = s
  50727. }
  50728. return s
  50729. },
  50730. updateAnimationCache: function(t, e) {
  50731. if (e) {
  50732. var i = this.initAnimationCache(t, e);
  50733. if (!i) return null;
  50734. i.updateAllFrame()
  50735. } else {
  50736. var n = this._skeletonCache[t];
  50737. if (!(n && n.skeleton)) return;
  50738. var r = n.animationsCache;
  50739. for (var s in r) {
  50740. r[s].updateAllFrame()
  50741. }
  50742. }
  50743. }
  50744. });
  50745. D.FrameTime = 1 / 60, D.sharedCache = new D, e.exports = D
  50746. }), {
  50747. "./lib/spine": 414,
  50748. "./track-entry-listeners": 419
  50749. }],
  50750. 416: [(function(t, e, i) {
  50751. "use strict";
  50752. var n = t("./skeleton-cache").sharedCache,
  50753. r = cc.Class({
  50754. name: "sp.SkeletonData",
  50755. extends: cc.Asset,
  50756. ctor: function() {
  50757. this.reset()
  50758. },
  50759. properties: {
  50760. _skeletonJson: null,
  50761. skeletonJsonStr: {
  50762. get: function() {
  50763. return this._skeletonJson ? JSON.stringify(this._skeletonJson) : ""
  50764. }
  50765. },
  50766. skeletonJson: {
  50767. get: function() {
  50768. return this._skeletonJson
  50769. },
  50770. set: function(t) {
  50771. this._skeletonJson = "string" == typeof t ? JSON.parse(t) : t, !this._uuid && t.skeleton && (this._uuid = t.skeleton.hash), this.reset()
  50772. }
  50773. },
  50774. _atlasText: "",
  50775. atlasText: {
  50776. get: function() {
  50777. return this._atlasText
  50778. },
  50779. set: function(t) {
  50780. this._atlasText = t, this.reset()
  50781. }
  50782. },
  50783. textures: {
  50784. default: [],
  50785. type: [cc.Texture2D]
  50786. },
  50787. textureNames: {
  50788. default: [],
  50789. type: [cc.String]
  50790. },
  50791. scale: 1
  50792. },
  50793. statics: {
  50794. preventDeferredLoadDependents: !0,
  50795. preventPreloadNativeObject: !0
  50796. },
  50797. createNode: !1,
  50798. reset: function() {
  50799. this._skeletonCache = null, this._atlasCache = null
  50800. },
  50801. ensureTexturesLoaded: function(t, e) {
  50802. var i = this.textures,
  50803. n = i.length;
  50804. if (0 != n)
  50805. for (var r = 0, s = function() {
  50806. ++r >= n && (t && t.call(e, !0), t = null)
  50807. }, o = 0; o < n; o++) {
  50808. var a = i[o];
  50809. a.loaded ? s() : a.once("load", s)
  50810. } else t.call(e, !1)
  50811. },
  50812. getRuntimeData: function(t) {
  50813. if (this._skeletonCache) return this._skeletonCache;
  50814. if (!(this.textures && this.textures.length > 0) && this.textureNames && this.textureNames.length > 0) return t || cc.errorID(7507, this.name), null;
  50815. var e = this._getAtlas(t);
  50816. if (!e) return null;
  50817. var i = new sp.spine.AtlasAttachmentLoader(e),
  50818. n = new sp.spine.SkeletonJson(i);
  50819. n.scale = this.scale;
  50820. var r = this.skeletonJson;
  50821. return this._skeletonCache = n.readSkeletonData(r), e.dispose(n), this._skeletonCache
  50822. },
  50823. getSkinsEnum: !1,
  50824. getAnimsEnum: !1,
  50825. _getTexture: function(t) {
  50826. for (var e = this.textureNames, i = 0; i < e.length; i++)
  50827. if (e[i] === t) {
  50828. var n = this.textures[i],
  50829. r = new sp.SkeletonTexture({
  50830. width: n.width,
  50831. height: n.height
  50832. });
  50833. return r.setRealTexture(n), r
  50834. }
  50835. return cc.errorID(7506, t), null
  50836. },
  50837. _getAtlas: function(t) {
  50838. return this._atlasCache ? this._atlasCache : this.atlasText ? this._atlasCache = new sp.spine.TextureAtlas(this.atlasText, this._getTexture.bind(this)) : (t || cc.errorID(7508, this.name), null)
  50839. },
  50840. destroy: function() {
  50841. n.removeSkeleton(this._uuid), this._super()
  50842. }
  50843. });
  50844. sp.SkeletonData = e.exports = r
  50845. }), {
  50846. "./skeleton-cache": 415
  50847. }],
  50848. 417: [(function(t, e, i) {
  50849. "use strict";
  50850. sp.SkeletonTexture = cc.Class({
  50851. name: "sp.SkeletonTexture",
  50852. extends: sp.spine.Texture,
  50853. _texture: null,
  50854. _material: null,
  50855. setRealTexture: function(t) {
  50856. this._texture = t
  50857. },
  50858. getRealTexture: function() {
  50859. return this._texture
  50860. },
  50861. setFilters: function(t, e) {
  50862. this._texture && this._texture.setFilters(t, e)
  50863. },
  50864. setWraps: function(t, e) {
  50865. this._texture && this._texture.setWrapMode(t, e)
  50866. },
  50867. dispose: function() {}
  50868. })
  50869. }), {}],
  50870. 418: [(function(t, e, i) {
  50871. "use strict";
  50872. i.__esModule = !0, i.default = void 0;
  50873. var n = (function(t) {
  50874. return t && t.__esModule ? t : {
  50875. default: t
  50876. }
  50877. })(t("../../cocos2d/core/renderer/assembler"));
  50878. function r(t, e) {
  50879. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  50880. }
  50881. function s(t, e) {
  50882. if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  50883. return !e || "object" != typeof e && "function" != typeof e ? t : e
  50884. }
  50885. function o(t, e) {
  50886. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
  50887. t.prototype = Object.create(e && e.prototype, {
  50888. constructor: {
  50889. value: t,
  50890. enumerable: !1,
  50891. writable: !0,
  50892. configurable: !0
  50893. }
  50894. }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
  50895. }
  50896. var a = t("./Skeleton"),
  50897. l = t("./lib/spine"),
  50898. h = t("../../cocos2d/core/renderer/render-flow"),
  50899. c = t("../../cocos2d/core/renderer/webgl/vertex-format"),
  50900. u = c.vfmtPosUvColor,
  50901. _ = c.vfmtPosUvTwoColor,
  50902. f = cc.gfx,
  50903. d = 0,
  50904. p = [0, 1, 2, 2, 3, 0],
  50905. m = cc.color(0, 0, 255, 255),
  50906. y = cc.color(255, 0, 0, 255),
  50907. v = cc.color(0, 255, 0, 255),
  50908. g = cc.color(255, 255, 0, 255),
  50909. x = null,
  50910. b = null,
  50911. A = null,
  50912. C = null;
  50913. x = new l.Color(1, 1, 1, 1), b = new l.Color(1, 1, 1, 1), A = new l.Vector2, C = new l.Vector2;
  50914. var T = void 0,
  50915. S = void 0,
  50916. w = void 0,
  50917. E = void 0,
  50918. M = void 0,
  50919. D = void 0,
  50920. B = void 0,
  50921. I = void 0,
  50922. P = void 0,
  50923. R = void 0,
  50924. O = void 0,
  50925. L = void 0,
  50926. F = void 0,
  50927. N = void 0,
  50928. V = void 0,
  50929. k = void 0,
  50930. G = void 0,
  50931. U = 0,
  50932. z = 0,
  50933. j = 0,
  50934. W = 0,
  50935. H = 0,
  50936. X = 0,
  50937. Y = 0,
  50938. q = void 0,
  50939. J = void 0,
  50940. Z = void 0,
  50941. K = void 0,
  50942. Q = void 0,
  50943. $ = void 0,
  50944. tt = void 0,
  50945. et = void 0,
  50946. it = void 0,
  50947. nt = void 0,
  50948. rt = void 0,
  50949. st = void 0,
  50950. ot = void 0,
  50951. at = void 0,
  50952. lt = void 0,
  50953. ht = void 0,
  50954. ct = void 0,
  50955. ut = void 0,
  50956. _t = void 0,
  50957. ft = void 0,
  50958. dt = void 0,
  50959. pt = void 0,
  50960. mt = void 0,
  50961. yt = void 0,
  50962. vt = void 0,
  50963. gt = void 0,
  50964. xt = void 0,
  50965. bt = void 0,
  50966. At = void 0;
  50967. function Ct(t, e) {
  50968. var i = void 0,
  50969. n = void 0;
  50970. switch (e) {
  50971. case l.BlendMode.Additive:
  50972. i = T ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE;
  50973. break;
  50974. case l.BlendMode.Multiply:
  50975. i = cc.macro.DST_COLOR, n = cc.macro.ONE_MINUS_SRC_ALPHA;
  50976. break;
  50977. case l.BlendMode.Screen:
  50978. i = cc.macro.ONE, n = cc.macro.ONE_MINUS_SRC_COLOR;
  50979. break;
  50980. case l.BlendMode.Normal:
  50981. default:
  50982. i = T ? cc.macro.ONE : cc.macro.SRC_ALPHA, n = cc.macro.ONE_MINUS_SRC_ALPHA
  50983. }
  50984. var r = !yt.enableBatch,
  50985. s = t.getId() + i + n + M + r,
  50986. o = yt.sharedMaterials[0];
  50987. if (!o) return null;
  50988. var a = yt._materialCache,
  50989. h = a[s];
  50990. h ? h.getProperty("texture") !== t && (h.setProperty("texture", t), h.updateHash(s)) : (a[o._hash] ? (h = new cc.Material).copy(o) : h = o, h.define("CC_USE_MODEL", r), h.define("USE_TINT", M), h.setProperty("texture", t), h.effect.setBlend(!0, f.BLEND_FUNC_ADD, i, n, f.BLEND_FUNC_ADD, i, n), h.updateHash(s), a[s] = h);
  50991. return h
  50992. }
  50993. function Tt(t) {
  50994. ft = t.fa * L, at = P * (S = T ? ft / 255 : 1), lt = R * S, ht = O * S, ct = t.fr * at, ut = t.fg * lt, _t = t.fb * ht, F = (ft << 24 >>> 0) + (_t << 16) + (ut << 8) + ct, dt = t.dr * at, pt = t.dg * lt, mt = t.db * ht, N = ((T ? 255 : 0) << 24 >>> 0) + (mt << 16) + (pt << 8) + dt
  50995. }
  50996. function St(t) {
  50997. return (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r
  50998. }
  50999. var wt = (function(t) {
  51000. function e() {
  51001. return r(this, e), s(this, t.apply(this, arguments))
  51002. }
  51003. return o(e, t), e.prototype.updateRenderData = function(t) {
  51004. if (!t.isAnimationCached()) {
  51005. var e = t._skeleton;
  51006. e && e.updateWorldTransform()
  51007. }
  51008. }, e.prototype.fillVertices = function(t, e, i, n, r) {
  51009. var s = vt._vData,
  51010. o = vt._iData,
  51011. a = vt._uintVData,
  51012. l = void 0;
  51013. if (x.a = i.a * e.a * t.a * L * 255, S = T ? x.a : 255, q = P * e.r * t.r * S, J = R * e.g * t.g * S, Z = O * e.b * t.b * S, x.r = q * i.r, x.g = J * i.g, x.b = Z * i.b, null == r.darkColor ? b.set(0, 0, 0, 1) : (b.r = r.darkColor.r * q, b.g = r.darkColor.g * J, b.b = r.darkColor.b * Z), b.a = T ? 255 : 0, n.isClipping()) {
  51014. var h = s.subarray(j + 2);
  51015. n.clipTriangles(s.subarray(j), U, o.subarray(X), H, h, x, b, M, k);
  51016. var c = new Float32Array(n.clippedVertices),
  51017. u = n.clippedTriangles;
  51018. if (H = u.length, U = c.length / G * k, l = vt.request(U / k, H), X = l.indiceOffset, W = l.vertexOffset, j = l.byteOffset >> 2, s = vt._vData, o = vt._iData, a = vt._uintVData, o.set(u, X), At)
  51019. for (var _ = 0, f = c.length, d = j; _ < f; _ += G, d += k) A.x = c[_], A.y = c[_ + 1], x.set(c[_ + 2], c[_ + 3], c[_ + 4], c[_ + 5]), C.x = c[_ + 6], C.y = c[_ + 7], M ? b.set(c[_ + 8], c[_ + 9], c[_ + 10], c[_ + 11]) : b.set(0, 0, 0, 0), At.transform(A, C, x, b), s[d] = A.x, s[d + 1] = A.y, s[d + 2] = C.x, s[d + 3] = C.y, a[d + 4] = St(x), M && (a[d + 5] = St(b));
  51020. else
  51021. for (var p = 0, m = c.length, y = j; p < m; p += G, y += k) s[y] = c[p], s[y + 1] = c[p + 1], s[y + 2] = c[p + 6], s[y + 3] = c[p + 7], F = (c[p + 5] << 24 >>> 0) + (c[p + 4] << 16) + (c[p + 3] << 8) + c[p + 2], a[y + 4] = F, M && (N = (c[p + 11] << 24 >>> 0) + (c[p + 10] << 16) + (c[p + 9] << 8) + c[p + 8], a[y + 5] = N)
  51022. } else if (At)
  51023. for (var v = j, g = j + U; v < g; v += k) A.x = s[v], A.y = s[v + 1], C.x = s[v + 2], C.y = s[v + 3], At.transform(A, C, x, b), s[v] = A.x, s[v + 1] = A.y, s[v + 2] = C.x, s[v + 3] = C.y, a[v + 4] = St(x), M && (a[v + 5] = St(b));
  51024. else {
  51025. F = St(x), N = St(b);
  51026. for (var w = j, E = j + U; w < E; w += k) a[w + 4] = F, M && (a[w + 5] = N)
  51027. }
  51028. }, e.prototype.realTimeTraverse = function(t) {
  51029. var e = void 0,
  51030. i = void 0,
  51031. n = yt._skeleton,
  51032. r = n.color,
  51033. s = yt._debugRenderer,
  51034. o = yt._clipper,
  51035. a = null,
  51036. h = void 0,
  51037. c = void 0,
  51038. u = void 0,
  51039. _ = void 0,
  51040. f = void 0,
  51041. d = void 0,
  51042. x = void 0,
  51043. b = void 0,
  51044. A = void 0,
  51045. C = void 0;
  51046. w = yt._startSlotIndex, E = yt._endSlotIndex, K = !1, -1 == w && (K = !0), D = yt.debugSlots, B = yt.debugBones, I = yt.debugMesh, s && (B || D || I) && (s.clear(), s.lineWidth = 2), G = M ? 12 : 8, U = 0, j = 0, W = 0, H = 0, X = 0;
  51047. for (var T = 0, S = n.drawOrder.length; T < S; T++)
  51048. if (A = n.drawOrder[T], w >= 0 && w == A.data.index && (K = !0), K)
  51049. if (E >= 0 && E == A.data.index && (K = !1), U = 0, H = 0, h = A.getAttachment())
  51050. if (d = h instanceof l.RegionAttachment, x = h instanceof l.MeshAttachment, h instanceof l.ClippingAttachment) o.clipStart(A, h);
  51051. else if (d || x)
  51052. if (a = Ct(h.region.texture._texture, A.data.blendMode)) {
  51053. if ((Q || a._hash !== gt.material._hash) && (Q = !1, gt._flush(), gt.node = xt, gt.material = a), d) {
  51054. if (f = p, U = 4 * k, H = 6, b = vt.request(4, 6), X = b.indiceOffset, W = b.vertexOffset, j = b.byteOffset >> 2, e = vt._vData, i = vt._iData, h.computeWorldVertices(A.bone, e, j, k), s && D) {
  51055. s.strokeColor = m, s.moveTo(e[j], e[j + 1]);
  51056. for (var P = j + k, R = j + U; P < R; P += k) s.lineTo(e[P], e[P + 1]);
  51057. s.close(), s.stroke()
  51058. }
  51059. } else if (x && (f = h.triangles, U = (h.worldVerticesLength >> 1) * k, H = f.length, b = vt.request(U / k, H), X = b.indiceOffset, W = b.vertexOffset, j = b.byteOffset >> 2, e = vt._vData, i = vt._iData, h.computeWorldVertices(A, 0, h.worldVerticesLength, e, j, k), s && I)) {
  51060. s.strokeColor = g;
  51061. for (var O = 0, L = f.length; O < L; O += 3) {
  51062. var F = f[O] * k + j,
  51063. N = f[O + 1] * k + j,
  51064. V = f[O + 2] * k + j;
  51065. s.moveTo(e[F], e[F + 1]), s.lineTo(e[N], e[N + 1]), s.lineTo(e[V], e[V + 1]), s.close(), s.stroke()
  51066. }
  51067. }
  51068. if (0 != U && 0 != H) {
  51069. i.set(f, X), _ = h.uvs;
  51070. for (var z = j, Y = j + U, q = 0; z < Y; z += k, q += 2) e[z + 2] = _[q], e[z + 3] = _[q + 1];
  51071. if (c = h.color, u = A.color, this.fillVertices(r, c, u, o, A), H > 0) {
  51072. for (var J = X, Z = X + H; J < Z; J++) i[J] += W;
  51073. if (t) {
  51074. C = t.m, et = C[0], it = C[4], nt = C[12], rt = C[1], st = C[5], ot = C[13];
  51075. for (var at = j, lt = j + U; at < lt; at += k) $ = e[at], tt = e[at + 1], e[at] = $ * et + tt * it + nt, e[at + 1] = $ * rt + tt * st + ot
  51076. }
  51077. vt.adjust(U / k, H)
  51078. }
  51079. o.clipEndWithSlot(A)
  51080. } else o.clipEndWithSlot(A)
  51081. } else o.clipEndWithSlot(A);
  51082. else o.clipEndWithSlot(A);
  51083. else o.clipEndWithSlot(A);
  51084. else o.clipEndWithSlot(A);
  51085. if (o.clipEnd(), s && B) {
  51086. var ht = void 0;
  51087. s.strokeColor = y, s.fillColor = m;
  51088. for (var ct = 0, ut = n.bones.length; ct < ut; ct++) {
  51089. var _t = (ht = n.bones[ct]).data.length * ht.a + ht.worldX,
  51090. ft = ht.data.length * ht.c + ht.worldY;
  51091. s.moveTo(ht.worldX, ht.worldY), s.lineTo(_t, ft), s.stroke(), s.circle(ht.worldX, ht.worldY, 1.5 * Math.PI), s.fill(), 0 === ct && (s.fillColor = v)
  51092. }
  51093. }
  51094. }, e.prototype.cacheTraverse = function(t) {
  51095. var e = yt._curFrame;
  51096. if (e) {
  51097. var i = e.segments;
  51098. if (0 != i.length) {
  51099. var n = void 0,
  51100. r = void 0,
  51101. s = void 0,
  51102. o = void 0,
  51103. a = void 0,
  51104. l = e.vertices,
  51105. h = e.indices,
  51106. c = void 0,
  51107. u = 0,
  51108. _ = 0,
  51109. f = 0;
  51110. t && (c = t.m, et = c[0], rt = c[1], it = c[4], st = c[5], nt = c[12], ot = c[13]);
  51111. var p = 16 & d,
  51112. m = p && (1 === et && 0 === rt && 0 === it && 1 === st),
  51113. y = 0,
  51114. v = e.colors,
  51115. g = v[y++],
  51116. x = g.vfOffset;
  51117. Tt(g);
  51118. for (var b = 0, A = i.length; b < A; b++) {
  51119. var C = i[b];
  51120. if (o = Ct(C.tex, C.blendMode)) {
  51121. (Q || o._hash !== gt.material._hash) && (Q = !1, gt._flush(), gt.node = xt, gt.material = o), z = C.vertexCount, H = C.indexCount, a = vt.request(z, H), X = a.indiceOffset, W = a.vertexOffset, Y = a.byteOffset >> 2, n = vt._vData, r = vt._iData, s = vt._uintVData;
  51122. for (var T = X, S = X + H; T < S; T++) r[T] = W + h[_++];
  51123. if (f = C.vfCount, n.set(l.subarray(u, u + f), Y), u += f, m)
  51124. for (var w = Y, E = Y + f; w < E; w += 6) n[w] += nt, n[w + 1] += ot;
  51125. else if (p)
  51126. for (var M = Y, D = Y + f; M < D; M += 6) $ = n[M], tt = n[M + 1], n[M] = $ * et + tt * it + nt, n[M + 1] = $ * rt + tt * st + ot;
  51127. if (vt.adjust(z, H), bt)
  51128. for (var B = u - f, I = Y + 4, P = Y + 4 + f; I < P; I += 6, B += 6) B >= x && (Tt(g = v[y++]), x = g.vfOffset), s[I] = F, s[I + 1] = N
  51129. }
  51130. }
  51131. }
  51132. }
  51133. }, e.prototype.fillBuffers = function(t, e) {
  51134. var i = t.node;
  51135. if (i._renderFlag |= h.FLAG_UPDATE_RENDER_DATA, t._skeleton) {
  51136. var n = i._color;
  51137. P = n.r / 255, R = n.g / 255, O = n.b / 255, L = n.a / 255, M = t.useTint || t.isAnimationCached(), V = M ? _ : u, k = M ? 6 : 5, xt = t.node, vt = e.getBuffer("spine", V), gt = e, yt = t, Q = !0, T = t.premultipliedAlpha, S = 1, d = 0, bt = !1, At = t._effectDelegate && t._effectDelegate._vertexEffect, (4294967295 !== n._val || T) && (bt = !0), M && (d |= 1);
  51138. var r = void 0;
  51139. yt.enableBatch && (r = xt._worldMatrix, Q = !1, d |= 16), t.isAnimationCached() ? this.cacheTraverse(r) : (At && At.begin(t._skeleton), this.realTimeTraverse(r), At && At.end()), xt = void 0, vt = void 0, gt = void 0, yt = void 0, At = null
  51140. }
  51141. }, e
  51142. })(n.default);
  51143. i.default = wt, n.default.register(a, wt), e.exports = i.default
  51144. }), {
  51145. "../../cocos2d/core/renderer/assembler": 227,
  51146. "../../cocos2d/core/renderer/render-flow": 248,
  51147. "../../cocos2d/core/renderer/webgl/vertex-format": 288,
  51148. "./Skeleton": 412,
  51149. "./lib/spine": 414
  51150. }],
  51151. 419: [(function(t, e, i) {
  51152. "use strict";
  51153. var n = function() {
  51154. this.start = null, this.end = null, this.complete = null, this.event = null, this.interrupt = null, this.dispose = null
  51155. };
  51156. n.getListeners = function(t) {
  51157. return t.listener || (t.listener = new n), t.listener
  51158. }, e.exports = n
  51159. }), {}],
  51160. 420: [(function(t, e, i) {
  51161. "use strict";
  51162. var n = t("./lib/spine");
  51163. sp.VertexEffectDelegate = cc.Class({
  51164. name: "sp.VertexEffectDelegate",
  51165. ctor: function() {
  51166. this._vertexEffect = null, this._interpolation = null, this._effectType = "none"
  51167. },
  51168. clear: function() {
  51169. this._vertexEffect = null, this._interpolation = null, this._effectType = "none"
  51170. },
  51171. initJitter: function(t, e) {
  51172. return this._effectType = "jitter", this._vertexEffect = new n.JitterEffect(t, e), this._vertexEffect
  51173. },
  51174. initSwirlWithPow: function(t, e) {
  51175. return this._interpolation = new n.Pow(e), this._vertexEffect = new n.SwirlEffect(t, this._interpolation), this._vertexEffect
  51176. },
  51177. initSwirlWithPowOut: function(t, e) {
  51178. return this._interpolation = new n.PowOut(e), this._vertexEffect = new n.SwirlEffect(t, this._interpolation), this._vertexEffect
  51179. },
  51180. getJitterVertexEffect: function() {
  51181. return this._vertexEffect
  51182. },
  51183. getSwirlVertexEffect: function() {
  51184. return this._vertexEffect
  51185. },
  51186. getVertexEffect: function() {
  51187. return this._vertexEffect
  51188. },
  51189. getEffectType: function() {
  51190. return this._effectType
  51191. }
  51192. }), e.exports = sp.VertexEffectDelegate
  51193. }), {
  51194. "./lib/spine": 414
  51195. }],
  51196. 421: [(function(t, e, i) {
  51197. "use strict";
  51198. (function(t, n) {
  51199. "object" == typeof i && void 0 !== e ? n(i) : "function" == typeof define && define.amd ? define(["exports"], n) : n(t.box2d = {})
  51200. })(void 0, (function(t) {
  51201. function e(t, e) {
  51202. return void 0 !== t ? t : e
  51203. }
  51204. var i = 1e37,
  51205. n = 1e-5,
  51206. r = n * n,
  51207. s = 3.14159265359,
  51208. o = 2,
  51209. a = 8,
  51210. l = .008,
  51211. h = 2 / 180 * s,
  51212. c = 2 * l,
  51213. u = -1;
  51214. var _ = (function() {
  51215. function t(t, e, i) {
  51216. void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), this.major = 0, this.minor = 0, this.revision = 0, this.major = t, this.minor = e, this.revision = i
  51217. }
  51218. return t.prototype.toString = function() {
  51219. return this.major + "." + this.minor + "." + this.revision
  51220. }, t
  51221. })(),
  51222. f = new _(2, 3, 2);
  51223. function d(t, e) {
  51224. for (var i = [], n = 0; n < t; ++n) i.push(e(n));
  51225. return i
  51226. }
  51227. function p(t, e) {
  51228. void 0 === e && (e = 0);
  51229. for (var i = [], n = 0; n < t; ++n) i.push(e);
  51230. return i
  51231. }
  51232. var m = s / 180,
  51233. y = 180 / s,
  51234. v = Math.abs,
  51235. g = Math.min,
  51236. x = Math.max;
  51237. function b(t, e, i) {
  51238. return t < e ? e : t > i ? i : t
  51239. }
  51240. var A = isFinite;
  51241. function C(t) {
  51242. return t * t
  51243. }
  51244. function T(t) {
  51245. return 1 / Math.sqrt(t)
  51246. }
  51247. var S = Math.sqrt,
  51248. w = Math.pow;
  51249. var E = Math.cos,
  51250. M = Math.sin,
  51251. D = Math.acos,
  51252. B = Math.asin,
  51253. I = Math.atan2;
  51254. var P = (function() {
  51255. function t(t, e) {
  51256. void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e
  51257. }
  51258. return t.prototype.Clone = function() {
  51259. return new t(this.x, this.y)
  51260. }, t.prototype.SetZero = function() {
  51261. return this.x = 0, this.y = 0, this
  51262. }, t.prototype.Set = function(t, e) {
  51263. return this.x = t, this.y = e, this
  51264. }, t.prototype.Copy = function(t) {
  51265. return this.x = t.x, this.y = t.y, this
  51266. }, t.prototype.SelfAdd = function(t) {
  51267. return this.x += t.x, this.y += t.y, this
  51268. }, t.prototype.SelfAddXY = function(t, e) {
  51269. return this.x += t, this.y += e, this
  51270. }, t.prototype.SelfSub = function(t) {
  51271. return this.x -= t.x, this.y -= t.y, this
  51272. }, t.prototype.SelfSubXY = function(t, e) {
  51273. return this.x -= t, this.y -= e, this
  51274. }, t.prototype.SelfMul = function(t) {
  51275. return this.x *= t, this.y *= t, this
  51276. }, t.prototype.SelfMulAdd = function(t, e) {
  51277. return this.x += t * e.x, this.y += t * e.y, this
  51278. }, t.prototype.SelfMulSub = function(t, e) {
  51279. return this.x -= t * e.x, this.y -= t * e.y, this
  51280. }, t.prototype.Dot = function(t) {
  51281. return this.x * t.x + this.y * t.y
  51282. }, t.prototype.Cross = function(t) {
  51283. return this.x * t.y - this.y * t.x
  51284. }, t.prototype.Length = function() {
  51285. var t = this.x,
  51286. e = this.y;
  51287. return Math.sqrt(t * t + e * e)
  51288. }, t.prototype.LengthSquared = function() {
  51289. var t = this.x,
  51290. e = this.y;
  51291. return t * t + e * e
  51292. }, t.prototype.Normalize = function() {
  51293. var t = this.Length();
  51294. if (t >= n) {
  51295. var e = 1 / t;
  51296. this.x *= e, this.y *= e
  51297. }
  51298. return t
  51299. }, t.prototype.SelfNormalize = function() {
  51300. var t = this.Length();
  51301. if (t >= n) {
  51302. var e = 1 / t;
  51303. this.x *= e, this.y *= e
  51304. }
  51305. return this
  51306. }, t.prototype.SelfRotate = function(t) {
  51307. var e = Math.cos(t),
  51308. i = Math.sin(t),
  51309. n = this.x;
  51310. return this.x = e * n - i * this.y, this.y = i * n + e * this.y, this
  51311. }, t.prototype.IsValid = function() {
  51312. return isFinite(this.x) && isFinite(this.y)
  51313. }, t.prototype.SelfCrossVS = function(t) {
  51314. var e = this.x;
  51315. return this.x = t * this.y, this.y = -t * e, this
  51316. }, t.prototype.SelfCrossSV = function(t) {
  51317. var e = this.x;
  51318. return this.x = -t * this.y, this.y = t * e, this
  51319. }, t.prototype.SelfMinV = function(t) {
  51320. return this.x = g(this.x, t.x), this.y = g(this.y, t.y), this
  51321. }, t.prototype.SelfMaxV = function(t) {
  51322. return this.x = x(this.x, t.x), this.y = x(this.y, t.y), this
  51323. }, t.prototype.SelfAbs = function() {
  51324. return this.x = v(this.x), this.y = v(this.y), this
  51325. }, t.prototype.SelfNeg = function() {
  51326. return this.x = -this.x, this.y = -this.y, this
  51327. }, t.prototype.SelfSkew = function() {
  51328. var t = this.x;
  51329. return this.x = -this.y, this.y = t, this
  51330. }, t.MakeArray = function(e) {
  51331. return d(e, (function(e) {
  51332. return new t
  51333. }))
  51334. }, t.AbsV = function(t, e) {
  51335. return e.x = v(t.x), e.y = v(t.y), e
  51336. }, t.MinV = function(t, e, i) {
  51337. return i.x = g(t.x, e.x), i.y = g(t.y, e.y), i
  51338. }, t.MaxV = function(t, e, i) {
  51339. return i.x = x(t.x, e.x), i.y = x(t.y, e.y), i
  51340. }, t.ClampV = function(t, e, i, n) {
  51341. return n.x = b(t.x, e.x, i.x), n.y = b(t.y, e.y, i.y), n
  51342. }, t.RotateV = function(t, e, i) {
  51343. var n = t.x,
  51344. r = t.y,
  51345. s = Math.cos(e),
  51346. o = Math.sin(e);
  51347. return i.x = s * n - o * r, i.y = o * n + s * r, i
  51348. }, t.DotVV = function(t, e) {
  51349. return t.x * e.x + t.y * e.y
  51350. }, t.CrossVV = function(t, e) {
  51351. return t.x * e.y - t.y * e.x
  51352. }, t.CrossVS = function(t, e, i) {
  51353. var n = t.x;
  51354. return i.x = e * t.y, i.y = -e * n, i
  51355. }, t.CrossVOne = function(t, e) {
  51356. var i = t.x;
  51357. return e.x = t.y, e.y = -i, e
  51358. }, t.CrossSV = function(t, e, i) {
  51359. var n = e.x;
  51360. return i.x = -t * e.y, i.y = t * n, i
  51361. }, t.CrossOneV = function(t, e) {
  51362. var i = t.x;
  51363. return e.x = -t.y, e.y = i, e
  51364. }, t.AddVV = function(t, e, i) {
  51365. return i.x = t.x + e.x, i.y = t.y + e.y, i
  51366. }, t.SubVV = function(t, e, i) {
  51367. return i.x = t.x - e.x, i.y = t.y - e.y, i
  51368. }, t.MulSV = function(t, e, i) {
  51369. return i.x = e.x * t, i.y = e.y * t, i
  51370. }, t.MulVS = function(t, e, i) {
  51371. return i.x = t.x * e, i.y = t.y * e, i
  51372. }, t.AddVMulSV = function(t, e, i, n) {
  51373. return n.x = t.x + e * i.x, n.y = t.y + e * i.y, n
  51374. }, t.SubVMulSV = function(t, e, i, n) {
  51375. return n.x = t.x - e * i.x, n.y = t.y - e * i.y, n
  51376. }, t.AddVCrossSV = function(t, e, i, n) {
  51377. var r = i.x;
  51378. return n.x = t.x - e * i.y, n.y = t.y + e * r, n
  51379. }, t.MidVV = function(t, e, i) {
  51380. return i.x = .5 * (t.x + e.x), i.y = .5 * (t.y + e.y), i
  51381. }, t.ExtVV = function(t, e, i) {
  51382. return i.x = .5 * (e.x - t.x), i.y = .5 * (e.y - t.y), i
  51383. }, t.IsEqualToV = function(t, e) {
  51384. return t.x === e.x && t.y === e.y
  51385. }, t.DistanceVV = function(t, e) {
  51386. var i = t.x - e.x,
  51387. n = t.y - e.y;
  51388. return Math.sqrt(i * i + n * n)
  51389. }, t.DistanceSquaredVV = function(t, e) {
  51390. var i = t.x - e.x,
  51391. n = t.y - e.y;
  51392. return i * i + n * n
  51393. }, t.NegV = function(t, e) {
  51394. return e.x = -t.x, e.y = -t.y, e
  51395. }, t.ZERO = new t(0, 0), t.UNITX = new t(1, 0), t.UNITY = new t(0, 1), t.s_t0 = new t, t.s_t1 = new t, t.s_t2 = new t, t.s_t3 = new t, t
  51396. })(),
  51397. R = new P(0, 0),
  51398. O = (function() {
  51399. function t(t, e, i) {
  51400. void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), this.x = t, this.y = e, this.z = i
  51401. }
  51402. return t.prototype.Clone = function() {
  51403. return new t(this.x, this.y, this.z)
  51404. }, t.prototype.SetZero = function() {
  51405. return this.x = 0, this.y = 0, this.z = 0, this
  51406. }, t.prototype.SetXYZ = function(t, e, i) {
  51407. return this.x = t, this.y = e, this.z = i, this
  51408. }, t.prototype.Copy = function(t) {
  51409. return this.x = t.x, this.y = t.y, this.z = t.z, this
  51410. }, t.prototype.SelfNeg = function() {
  51411. return this.x = -this.x, this.y = -this.y, this.z = -this.z, this
  51412. }, t.prototype.SelfAdd = function(t) {
  51413. return this.x += t.x, this.y += t.y, this.z += t.z, this
  51414. }, t.prototype.SelfAddXYZ = function(t, e, i) {
  51415. return this.x += t, this.y += e, this.z += i, this
  51416. }, t.prototype.SelfSub = function(t) {
  51417. return this.x -= t.x, this.y -= t.y, this.z -= t.z, this
  51418. }, t.prototype.SelfSubXYZ = function(t, e, i) {
  51419. return this.x -= t, this.y -= e, this.z -= i, this
  51420. }, t.prototype.SelfMul = function(t) {
  51421. return this.x *= t, this.y *= t, this.z *= t, this
  51422. }, t.DotV3V3 = function(t, e) {
  51423. return t.x * e.x + t.y * e.y + t.z * e.z
  51424. }, t.CrossV3V3 = function(t, e, i) {
  51425. var n = t.x,
  51426. r = t.y,
  51427. s = t.z,
  51428. o = e.x,
  51429. a = e.y,
  51430. l = e.z;
  51431. return i.x = r * l - s * a, i.y = s * o - n * l, i.z = n * a - r * o, i
  51432. }, t.ZERO = new t(0, 0, 0), t.s_t0 = new t, t
  51433. })(),
  51434. L = (function() {
  51435. function t() {
  51436. this.ex = new P(1, 0), this.ey = new P(0, 1)
  51437. }
  51438. return t.prototype.Clone = function() {
  51439. return (new t).Copy(this)
  51440. }, t.FromVV = function(e, i) {
  51441. return (new t).SetVV(e, i)
  51442. }, t.FromSSSS = function(e, i, n, r) {
  51443. return (new t).SetSSSS(e, i, n, r)
  51444. }, t.FromAngle = function(e) {
  51445. return (new t).SetAngle(e)
  51446. }, t.prototype.SetSSSS = function(t, e, i, n) {
  51447. return this.ex.Set(t, i), this.ey.Set(e, n), this
  51448. }, t.prototype.SetVV = function(t, e) {
  51449. return this.ex.Copy(t), this.ey.Copy(e), this
  51450. }, t.prototype.SetAngle = function(t) {
  51451. var e = Math.cos(t),
  51452. i = Math.sin(t);
  51453. return this.ex.Set(e, i), this.ey.Set(-i, e), this
  51454. }, t.prototype.Copy = function(t) {
  51455. return this.ex.Copy(t.ex), this.ey.Copy(t.ey), this
  51456. }, t.prototype.SetIdentity = function() {
  51457. return this.ex.Set(1, 0), this.ey.Set(0, 1), this
  51458. }, t.prototype.SetZero = function() {
  51459. return this.ex.SetZero(), this.ey.SetZero(), this
  51460. }, t.prototype.GetAngle = function() {
  51461. return Math.atan2(this.ex.y, this.ex.x)
  51462. }, t.prototype.GetInverse = function(t) {
  51463. var e = this.ex.x,
  51464. i = this.ey.x,
  51465. n = this.ex.y,
  51466. r = this.ey.y,
  51467. s = e * r - i * n;
  51468. return 0 !== s && (s = 1 / s), t.ex.x = s * r, t.ey.x = -s * i, t.ex.y = -s * n, t.ey.y = s * e, t
  51469. }, t.prototype.Solve = function(t, e, i) {
  51470. var n = this.ex.x,
  51471. r = this.ey.x,
  51472. s = this.ex.y,
  51473. o = this.ey.y,
  51474. a = n * o - r * s;
  51475. return 0 !== a && (a = 1 / a), i.x = a * (o * t - r * e), i.y = a * (n * e - s * t), i
  51476. }, t.prototype.SelfAbs = function() {
  51477. return this.ex.SelfAbs(), this.ey.SelfAbs(), this
  51478. }, t.prototype.SelfInv = function() {
  51479. return this.GetInverse(this), this
  51480. }, t.prototype.SelfAddM = function(t) {
  51481. return this.ex.SelfAdd(t.ex), this.ey.SelfAdd(t.ey), this
  51482. }, t.prototype.SelfSubM = function(t) {
  51483. return this.ex.SelfSub(t.ex), this.ey.SelfSub(t.ey), this
  51484. }, t.AbsM = function(t, e) {
  51485. var i = t.ex,
  51486. n = t.ey;
  51487. return e.ex.x = v(i.x), e.ex.y = v(i.y), e.ey.x = v(n.x), e.ey.y = v(n.y), e
  51488. }, t.MulMV = function(t, e, i) {
  51489. var n = t.ex,
  51490. r = t.ey,
  51491. s = e.x,
  51492. o = e.y;
  51493. return i.x = n.x * s + r.x * o, i.y = n.y * s + r.y * o, i
  51494. }, t.MulTMV = function(t, e, i) {
  51495. var n = t.ex,
  51496. r = t.ey,
  51497. s = e.x,
  51498. o = e.y;
  51499. return i.x = n.x * s + n.y * o, i.y = r.x * s + r.y * o, i
  51500. }, t.AddMM = function(t, e, i) {
  51501. var n = t.ex,
  51502. r = t.ey,
  51503. s = e.ex,
  51504. o = e.ey;
  51505. return i.ex.x = n.x + s.x, i.ex.y = n.y + s.y, i.ey.x = r.x + o.x, i.ey.y = r.y + o.y, i
  51506. }, t.MulMM = function(t, e, i) {
  51507. var n = t.ex.x,
  51508. r = t.ex.y,
  51509. s = t.ey.x,
  51510. o = t.ey.y,
  51511. a = e.ex.x,
  51512. l = e.ex.y,
  51513. h = e.ey.x,
  51514. c = e.ey.y;
  51515. return i.ex.x = n * a + s * l, i.ex.y = r * a + o * l, i.ey.x = n * h + s * c, i.ey.y = r * h + o * c, i
  51516. }, t.MulTMM = function(t, e, i) {
  51517. var n = t.ex.x,
  51518. r = t.ex.y,
  51519. s = t.ey.x,
  51520. o = t.ey.y,
  51521. a = e.ex.x,
  51522. l = e.ex.y,
  51523. h = e.ey.x,
  51524. c = e.ey.y;
  51525. return i.ex.x = n * a + r * l, i.ex.y = s * a + o * l, i.ey.x = n * h + r * c, i.ey.y = s * h + o * c, i
  51526. }, t.IDENTITY = new t, t
  51527. })(),
  51528. F = (function() {
  51529. function t() {
  51530. this.ex = new O(1, 0, 0), this.ey = new O(0, 1, 0), this.ez = new O(0, 0, 1)
  51531. }
  51532. return t.prototype.Clone = function() {
  51533. return (new t).Copy(this)
  51534. }, t.prototype.SetVVV = function(t, e, i) {
  51535. return this.ex.Copy(t), this.ey.Copy(e), this.ez.Copy(i), this
  51536. }, t.prototype.Copy = function(t) {
  51537. return this.ex.Copy(t.ex), this.ey.Copy(t.ey), this.ez.Copy(t.ez), this
  51538. }, t.prototype.SetIdentity = function() {
  51539. return this.ex.SetXYZ(1, 0, 0), this.ey.SetXYZ(0, 1, 0), this.ez.SetXYZ(0, 0, 1), this
  51540. }, t.prototype.SetZero = function() {
  51541. return this.ex.SetZero(), this.ey.SetZero(), this.ez.SetZero(), this
  51542. }, t.prototype.SelfAddM = function(t) {
  51543. return this.ex.SelfAdd(t.ex), this.ey.SelfAdd(t.ey), this.ez.SelfAdd(t.ez), this
  51544. }, t.prototype.Solve33 = function(t, e, i, n) {
  51545. var r = this.ex.x,
  51546. s = this.ex.y,
  51547. o = this.ex.z,
  51548. a = this.ey.x,
  51549. l = this.ey.y,
  51550. h = this.ey.z,
  51551. c = this.ez.x,
  51552. u = this.ez.y,
  51553. _ = this.ez.z,
  51554. f = r * (l * _ - h * u) + s * (h * c - a * _) + o * (a * u - l * c);
  51555. return 0 !== f && (f = 1 / f), n.x = f * (t * (l * _ - h * u) + e * (h * c - a * _) + i * (a * u - l * c)), n.y = f * (r * (e * _ - i * u) + s * (i * c - t * _) + o * (t * u - e * c)), n.z = f * (r * (l * i - h * e) + s * (h * t - a * i) + o * (a * e - l * t)), n
  51556. }, t.prototype.Solve22 = function(t, e, i) {
  51557. var n = this.ex.x,
  51558. r = this.ey.x,
  51559. s = this.ex.y,
  51560. o = this.ey.y,
  51561. a = n * o - r * s;
  51562. return 0 !== a && (a = 1 / a), i.x = a * (o * t - r * e), i.y = a * (n * e - s * t), i
  51563. }, t.prototype.GetInverse22 = function(t) {
  51564. var e = this.ex.x,
  51565. i = this.ey.x,
  51566. n = this.ex.y,
  51567. r = this.ey.y,
  51568. s = e * r - i * n;
  51569. 0 !== s && (s = 1 / s), t.ex.x = s * r, t.ey.x = -s * i, t.ex.z = 0, t.ex.y = -s * n, t.ey.y = s * e, t.ey.z = 0, t.ez.x = 0, t.ez.y = 0, t.ez.z = 0
  51570. }, t.prototype.GetSymInverse33 = function(t) {
  51571. var e = O.DotV3V3(this.ex, O.CrossV3V3(this.ey, this.ez, O.s_t0));
  51572. 0 !== e && (e = 1 / e);
  51573. var i = this.ex.x,
  51574. n = this.ey.x,
  51575. r = this.ez.x,
  51576. s = this.ey.y,
  51577. o = this.ez.y,
  51578. a = this.ez.z;
  51579. t.ex.x = e * (s * a - o * o), t.ex.y = e * (r * o - n * a), t.ex.z = e * (n * o - r * s), t.ey.x = t.ex.y, t.ey.y = e * (i * a - r * r), t.ey.z = e * (r * n - i * o), t.ez.x = t.ex.z, t.ez.y = t.ey.z, t.ez.z = e * (i * s - n * n)
  51580. }, t.MulM33V3 = function(t, e, i) {
  51581. var n = e.x,
  51582. r = e.y,
  51583. s = e.z;
  51584. return i.x = t.ex.x * n + t.ey.x * r + t.ez.x * s, i.y = t.ex.y * n + t.ey.y * r + t.ez.y * s, i.z = t.ex.z * n + t.ey.z * r + t.ez.z * s, i
  51585. }, t.MulM33XYZ = function(t, e, i, n, r) {
  51586. return r.x = t.ex.x * e + t.ey.x * i + t.ez.x * n, r.y = t.ex.y * e + t.ey.y * i + t.ez.y * n, r.z = t.ex.z * e + t.ey.z * i + t.ez.z * n, r
  51587. }, t.MulM33V2 = function(t, e, i) {
  51588. var n = e.x,
  51589. r = e.y;
  51590. return i.x = t.ex.x * n + t.ey.x * r, i.y = t.ex.y * n + t.ey.y * r, i
  51591. }, t.MulM33XY = function(t, e, i, n) {
  51592. return n.x = t.ex.x * e + t.ey.x * i, n.y = t.ex.y * e + t.ey.y * i, n
  51593. }, t.IDENTITY = new t, t
  51594. })(),
  51595. N = (function() {
  51596. function t(t) {
  51597. void 0 === t && (t = 0), this.s = 0, this.c = 1, t && (this.s = Math.sin(t), this.c = Math.cos(t))
  51598. }
  51599. return t.prototype.Clone = function() {
  51600. return (new t).Copy(this)
  51601. }, t.prototype.Copy = function(t) {
  51602. return this.s = t.s, this.c = t.c, this
  51603. }, t.prototype.SetAngle = function(t) {
  51604. return this.s = Math.sin(t), this.c = Math.cos(t), this
  51605. }, t.prototype.SetIdentity = function() {
  51606. return this.s = 0, this.c = 1, this
  51607. }, t.prototype.GetAngle = function() {
  51608. return Math.atan2(this.s, this.c)
  51609. }, t.prototype.GetXAxis = function(t) {
  51610. return t.x = this.c, t.y = this.s, t
  51611. }, t.prototype.GetYAxis = function(t) {
  51612. return t.x = -this.s, t.y = this.c, t
  51613. }, t.MulRR = function(t, e, i) {
  51614. var n = t.c,
  51615. r = t.s,
  51616. s = e.c,
  51617. o = e.s;
  51618. return i.s = r * s + n * o, i.c = n * s - r * o, i
  51619. }, t.MulTRR = function(t, e, i) {
  51620. var n = t.c,
  51621. r = t.s,
  51622. s = e.c,
  51623. o = e.s;
  51624. return i.s = n * o - r * s, i.c = n * s + r * o, i
  51625. }, t.MulRV = function(t, e, i) {
  51626. var n = t.c,
  51627. r = t.s,
  51628. s = e.x,
  51629. o = e.y;
  51630. return i.x = n * s - r * o, i.y = r * s + n * o, i
  51631. }, t.MulTRV = function(t, e, i) {
  51632. var n = t.c,
  51633. r = t.s,
  51634. s = e.x,
  51635. o = e.y;
  51636. return i.x = n * s + r * o, i.y = -r * s + n * o, i
  51637. }, t.IDENTITY = new t, t
  51638. })(),
  51639. V = (function() {
  51640. function t() {
  51641. this.p = new P, this.q = new N
  51642. }
  51643. return t.prototype.Clone = function() {
  51644. return (new t).Copy(this)
  51645. }, t.prototype.Copy = function(t) {
  51646. return this.p.Copy(t.p), this.q.Copy(t.q), this
  51647. }, t.prototype.SetIdentity = function() {
  51648. return this.p.SetZero(), this.q.SetIdentity(), this
  51649. }, t.prototype.SetPositionRotation = function(t, e) {
  51650. return this.p.Copy(t), this.q.Copy(e), this
  51651. }, t.prototype.SetPositionAngle = function(t, e) {
  51652. return this.p.Copy(t), this.q.SetAngle(e), this
  51653. }, t.prototype.SetPosition = function(t) {
  51654. return this.p.Copy(t), this
  51655. }, t.prototype.SetPositionXY = function(t, e) {
  51656. return this.p.Set(t, e), this
  51657. }, t.prototype.SetRotation = function(t) {
  51658. return this.q.Copy(t), this
  51659. }, t.prototype.SetRotationAngle = function(t) {
  51660. return this.q.SetAngle(t), this
  51661. }, t.prototype.GetPosition = function() {
  51662. return this.p
  51663. }, t.prototype.GetRotation = function() {
  51664. return this.q
  51665. }, t.prototype.GetRotationAngle = function() {
  51666. return this.q.GetAngle()
  51667. }, t.prototype.GetAngle = function() {
  51668. return this.q.GetAngle()
  51669. }, t.MulXV = function(t, e, i) {
  51670. var n = t.q.c,
  51671. r = t.q.s,
  51672. s = e.x,
  51673. o = e.y;
  51674. return i.x = n * s - r * o + t.p.x, i.y = r * s + n * o + t.p.y, i
  51675. }, t.MulTXV = function(t, e, i) {
  51676. var n = t.q.c,
  51677. r = t.q.s,
  51678. s = e.x - t.p.x,
  51679. o = e.y - t.p.y;
  51680. return i.x = n * s + r * o, i.y = -r * s + n * o, i
  51681. }, t.MulXX = function(t, e, i) {
  51682. return N.MulRR(t.q, e.q, i.q), P.AddVV(N.MulRV(t.q, e.p, i.p), t.p, i.p), i
  51683. }, t.MulTXX = function(t, e, i) {
  51684. return N.MulTRR(t.q, e.q, i.q), N.MulTRV(t.q, P.SubVV(e.p, t.p, i.p), i.p), i
  51685. }, t.IDENTITY = new t, t
  51686. })(),
  51687. k = (function() {
  51688. function t() {
  51689. this.localCenter = new P, this.c0 = new P, this.c = new P, this.a0 = 0, this.a = 0, this.alpha0 = 0
  51690. }
  51691. return t.prototype.Clone = function() {
  51692. return (new t).Copy(this)
  51693. }, t.prototype.Copy = function(t) {
  51694. return this.localCenter.Copy(t.localCenter), this.c0.Copy(t.c0), this.c.Copy(t.c), this.a0 = t.a0, this.a = t.a, this.alpha0 = t.alpha0, this
  51695. }, t.prototype.GetTransform = function(t, e) {
  51696. var i = 1 - e;
  51697. t.p.x = i * this.c0.x + e * this.c.x, t.p.y = i * this.c0.y + e * this.c.y;
  51698. var n = i * this.a0 + e * this.a;
  51699. return t.q.SetAngle(n), t.p.SelfSub(N.MulRV(t.q, this.localCenter, P.s_t0)), t
  51700. }, t.prototype.Advance = function(t) {
  51701. var e = (t - this.alpha0) / (1 - this.alpha0),
  51702. i = 1 - e;
  51703. this.c0.x = i * this.c0.x + e * this.c.x, this.c0.y = i * this.c0.y + e * this.c.y, this.a0 = i * this.a0 + e * this.a, this.alpha0 = t
  51704. }, t.prototype.Normalize = function() {
  51705. var t = 6.28318530718 * Math.floor(this.a0 / 6.28318530718);
  51706. this.a0 -= t, this.a -= t
  51707. }, t
  51708. })(),
  51709. G = (function() {
  51710. function t(t, e, i, n) {
  51711. void 0 === t && (t = .5), void 0 === e && (e = .5), void 0 === i && (i = .5), void 0 === n && (n = 1), this.r = t, this.g = e, this.b = i, this.a = n
  51712. }
  51713. return t.prototype.Clone = function() {
  51714. return (new t).Copy(this)
  51715. }, t.prototype.Copy = function(t) {
  51716. return this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this
  51717. }, t.prototype.IsEqual = function(t) {
  51718. return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a
  51719. }, t.prototype.IsZero = function() {
  51720. return 0 === this.r && 0 === this.g && 0 === this.b && 0 === this.a
  51721. }, t.prototype.Set = function(t, e, i, n) {
  51722. void 0 === n && (n = this.a), this.SetRGBA(t, e, i, n)
  51723. }, t.prototype.SetByteRGB = function(t, e, i) {
  51724. return this.r = t / 255, this.g = e / 255, this.b = i / 255, this
  51725. }, t.prototype.SetByteRGBA = function(t, e, i, n) {
  51726. return this.r = t / 255, this.g = e / 255, this.b = i / 255, this.a = n / 255, this
  51727. }, t.prototype.SetRGB = function(t, e, i) {
  51728. return this.r = t, this.g = e, this.b = i, this
  51729. }, t.prototype.SetRGBA = function(t, e, i, n) {
  51730. return this.r = t, this.g = e, this.b = i, this.a = n, this
  51731. }, t.prototype.SelfAdd = function(t) {
  51732. return this.r += t.r, this.g += t.g, this.b += t.b, this.a += t.a, this
  51733. }, t.prototype.Add = function(t, e) {
  51734. return e.r = this.r + t.r, e.g = this.g + t.g, e.b = this.b + t.b, e.a = this.a + t.a, e
  51735. }, t.prototype.SelfSub = function(t) {
  51736. return this.r -= t.r, this.g -= t.g, this.b -= t.b, this.a -= t.a, this
  51737. }, t.prototype.Sub = function(t, e) {
  51738. return e.r = this.r - t.r, e.g = this.g - t.g, e.b = this.b - t.b, e.a = this.a - t.a, e
  51739. }, t.prototype.SelfMul = function(t) {
  51740. return this.r *= t, this.g *= t, this.b *= t, this.a *= t, this
  51741. }, t.prototype.Mul = function(t, e) {
  51742. return e.r = this.r * t, e.g = this.g * t, e.b = this.b * t, e.a = this.a * t, e
  51743. }, t.prototype.Mix = function(e, i) {
  51744. t.MixColors(this, e, i)
  51745. }, t.MixColors = function(t, e, i) {
  51746. var n = i * (e.r - t.r),
  51747. r = i * (e.g - t.g),
  51748. s = i * (e.b - t.b),
  51749. o = i * (e.a - t.a);
  51750. t.r += n, t.g += r, t.b += s, t.a += o, e.r -= n, e.g -= r, e.b -= s, e.a -= o
  51751. }, t.prototype.MakeStyleString = function(e) {
  51752. return void 0 === e && (e = this.a), t.MakeStyleString(this.r, this.g, this.b, e)
  51753. }, t.MakeStyleString = function(t, e, i, n) {
  51754. return void 0 === n && (n = 1), t *= 255, e *= 255, i *= 255, n < 1 ? "rgba(" + t + "," + e + "," + i + "," + n + ")" : "rgb(" + t + "," + e + "," + i + ")"
  51755. }, t.ZERO = new t(0, 0, 0, 0), t.RED = new t(1, 0, 0), t.GREEN = new t(0, 1, 0), t.BLUE = new t(0, 0, 1), t
  51756. })();
  51757. (function(t) {
  51758. t[t.e_none = 0] = "e_none", t[t.e_shapeBit = 1] = "e_shapeBit", t[t.e_jointBit = 2] = "e_jointBit", t[t.e_aabbBit = 4] = "e_aabbBit", t[t.e_pairBit = 8] = "e_pairBit", t[t.e_centerOfMassBit = 16] = "e_centerOfMassBit", t[t.e_particleBit = 32] = "e_particleBit", t[t.e_controllerBit = 64] = "e_controllerBit", t[t.e_all = 63] = "e_all"
  51759. })(t.b2DrawFlags || (t.b2DrawFlags = {}));
  51760. var U = (function() {
  51761. function t() {
  51762. this.m_drawFlags = 0
  51763. }
  51764. return t.prototype.SetFlags = function(t) {
  51765. this.m_drawFlags = t
  51766. }, t.prototype.GetFlags = function() {
  51767. return this.m_drawFlags
  51768. }, t.prototype.AppendFlags = function(t) {
  51769. this.m_drawFlags |= t
  51770. }, t.prototype.ClearFlags = function(t) {
  51771. this.m_drawFlags &= ~t
  51772. }, t
  51773. })(),
  51774. z = (function() {
  51775. function t() {
  51776. this.m_start = Date.now()
  51777. }
  51778. return t.prototype.Reset = function() {
  51779. return this.m_start = Date.now(), this
  51780. }, t.prototype.GetMilliseconds = function() {
  51781. return Date.now() - this.m_start
  51782. }, t
  51783. })(),
  51784. j = (function() {
  51785. function t() {
  51786. this.m_count = 0, this.m_min_count = 0, this.m_max_count = 0
  51787. }
  51788. return t.prototype.GetCount = function() {
  51789. return this.m_count
  51790. }, t.prototype.GetMinCount = function() {
  51791. return this.m_min_count
  51792. }, t.prototype.GetMaxCount = function() {
  51793. return this.m_max_count
  51794. }, t.prototype.ResetCount = function() {
  51795. var t = this.m_count;
  51796. return this.m_count = 0, t
  51797. }, t.prototype.ResetMinCount = function() {
  51798. this.m_min_count = 0
  51799. }, t.prototype.ResetMaxCount = function() {
  51800. this.m_max_count = 0
  51801. }, t.prototype.Increment = function() {
  51802. this.m_count++, this.m_max_count < this.m_count && (this.m_max_count = this.m_count)
  51803. }, t.prototype.Decrement = function() {
  51804. this.m_count--, this.m_min_count > this.m_count && (this.m_min_count = this.m_count)
  51805. }, t
  51806. })(),
  51807. W = (function() {
  51808. function t(t) {
  51809. this.m_stack = [], this.m_count = 0, this.m_stack = d(t, (function(t) {
  51810. return null
  51811. })), this.m_count = 0
  51812. }
  51813. return t.prototype.Reset = function() {
  51814. return this.m_count = 0, this
  51815. }, t.prototype.Push = function(t) {
  51816. this.m_stack[this.m_count] = t, this.m_count++
  51817. }, t.prototype.Pop = function() {
  51818. this.m_count--;
  51819. var t = this.m_stack[this.m_count];
  51820. if (this.m_stack[this.m_count] = null, null === t) throw new Error;
  51821. return t
  51822. }, t.prototype.GetCount = function() {
  51823. return this.m_count
  51824. }, t
  51825. })(),
  51826. H = (function() {
  51827. return function() {}
  51828. })(),
  51829. X = (function() {
  51830. return function() {}
  51831. })(),
  51832. Y = (function() {
  51833. function t() {
  51834. this.m_buffer = P.MakeArray(2), this.m_vertices = this.m_buffer, this.m_count = 0, this.m_radius = 0
  51835. }
  51836. return t.prototype.Copy = function(t) {
  51837. return t.m_vertices === t.m_buffer ? (this.m_vertices = this.m_buffer, this.m_buffer[0].Copy(t.m_buffer[0]), this.m_buffer[1].Copy(t.m_buffer[1])) : this.m_vertices = t.m_vertices, this.m_count = t.m_count, this.m_radius = t.m_radius, this
  51838. }, t.prototype.Reset = function() {
  51839. return this.m_vertices = this.m_buffer, this.m_count = 0, this.m_radius = 0, this
  51840. }, t.prototype.SetShape = function(t, e) {
  51841. t.SetupDistanceProxy(this, e)
  51842. }, t.prototype.SetVerticesRadius = function(t, e, i) {
  51843. this.m_vertices = t, this.m_count = e, this.m_radius = i
  51844. }, t.prototype.GetSupport = function(t) {
  51845. for (var e = 0, i = P.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) {
  51846. var r = P.DotVV(this.m_vertices[n], t);
  51847. r > i && (e = n, i = r)
  51848. }
  51849. return e
  51850. }, t.prototype.GetSupportVertex = function(t) {
  51851. for (var e = 0, i = P.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) {
  51852. var r = P.DotVV(this.m_vertices[n], t);
  51853. r > i && (e = n, i = r)
  51854. }
  51855. return this.m_vertices[e]
  51856. }, t.prototype.GetVertexCount = function() {
  51857. return this.m_count
  51858. }, t.prototype.GetVertex = function(t) {
  51859. return this.m_vertices[t]
  51860. }, t
  51861. })(),
  51862. q = (function() {
  51863. function t() {
  51864. this.metric = 0, this.count = 0, this.indexA = [0, 0, 0], this.indexB = [0, 0, 0]
  51865. }
  51866. return t.prototype.Reset = function() {
  51867. return this.metric = 0, this.count = 0, this
  51868. }, t
  51869. })(),
  51870. J = (function() {
  51871. function t() {
  51872. this.proxyA = new Y, this.proxyB = new Y, this.transformA = new V, this.transformB = new V, this.useRadii = !1
  51873. }
  51874. return t.prototype.Reset = function() {
  51875. return this.proxyA.Reset(), this.proxyB.Reset(), this.transformA.SetIdentity(), this.transformB.SetIdentity(), this.useRadii = !1, this
  51876. }, t
  51877. })(),
  51878. Z = (function() {
  51879. function t() {
  51880. this.pointA = new P, this.pointB = new P, this.distance = 0, this.iterations = 0
  51881. }
  51882. return t.prototype.Reset = function() {
  51883. return this.pointA.SetZero(), this.pointB.SetZero(), this.distance = 0, this.iterations = 0, this
  51884. }, t
  51885. })(),
  51886. K = (function() {
  51887. return function() {
  51888. this.proxyA = new Y, this.proxyB = new Y, this.transformA = new V, this.transformB = new V, this.translationB = new P
  51889. }
  51890. })(),
  51891. Q = (function() {
  51892. return function() {
  51893. this.point = new P, this.normal = new P, this.lambda = 0, this.iterations = 0
  51894. }
  51895. })();
  51896. t.b2_gjkCalls = 0, t.b2_gjkIters = 0, t.b2_gjkMaxIters = 0;
  51897. var $ = (function() {
  51898. function t() {
  51899. this.wA = new P, this.wB = new P, this.w = new P, this.a = 0, this.indexA = 0, this.indexB = 0
  51900. }
  51901. return t.prototype.Copy = function(t) {
  51902. return this.wA.Copy(t.wA), this.wB.Copy(t.wB), this.w.Copy(t.w), this.a = t.a, this.indexA = t.indexA, this.indexB = t.indexB, this
  51903. }, t
  51904. })(),
  51905. tt = (function() {
  51906. function t() {
  51907. this.m_v1 = new $, this.m_v2 = new $, this.m_v3 = new $, this.m_vertices = [], this.m_count = 0, this.m_vertices[0] = this.m_v1, this.m_vertices[1] = this.m_v2, this.m_vertices[2] = this.m_v3
  51908. }
  51909. return t.prototype.ReadCache = function(t, e, i, r, s) {
  51910. this.m_count = t.count;
  51911. for (var o = this.m_vertices, a = 0; a < this.m_count; ++a) {
  51912. (_ = o[a]).indexA = t.indexA[a], _.indexB = t.indexB[a];
  51913. var l = e.GetVertex(_.indexA),
  51914. h = r.GetVertex(_.indexB);
  51915. V.MulXV(i, l, _.wA), V.MulXV(s, h, _.wB), P.SubVV(_.wB, _.wA, _.w), _.a = 0
  51916. }
  51917. if (this.m_count > 1) {
  51918. var c = t.metric,
  51919. u = this.GetMetric();
  51920. (u < .5 * c || 2 * c < u || u < n) && (this.m_count = 0)
  51921. }
  51922. if (0 === this.m_count) {
  51923. var _;
  51924. (_ = o[0]).indexA = 0, _.indexB = 0;
  51925. l = e.GetVertex(0), h = r.GetVertex(0);
  51926. V.MulXV(i, l, _.wA), V.MulXV(s, h, _.wB), P.SubVV(_.wB, _.wA, _.w), _.a = 1, this.m_count = 1
  51927. }
  51928. }, t.prototype.WriteCache = function(t) {
  51929. t.metric = this.GetMetric(), t.count = this.m_count;
  51930. for (var e = this.m_vertices, i = 0; i < this.m_count; ++i) t.indexA[i] = e[i].indexA, t.indexB[i] = e[i].indexB
  51931. }, t.prototype.GetSearchDirection = function(t) {
  51932. switch (this.m_count) {
  51933. case 1:
  51934. return P.NegV(this.m_v1.w, t);
  51935. case 2:
  51936. var e = P.SubVV(this.m_v2.w, this.m_v1.w, t);
  51937. return P.CrossVV(e, P.NegV(this.m_v1.w, P.s_t0)) > 0 ? P.CrossOneV(e, t) : P.CrossVOne(e, t);
  51938. default:
  51939. return t.SetZero()
  51940. }
  51941. }, t.prototype.GetClosestPoint = function(t) {
  51942. switch (this.m_count) {
  51943. case 0:
  51944. return t.SetZero();
  51945. case 1:
  51946. return t.Copy(this.m_v1.w);
  51947. case 2:
  51948. return t.Set(this.m_v1.a * this.m_v1.w.x + this.m_v2.a * this.m_v2.w.x, this.m_v1.a * this.m_v1.w.y + this.m_v2.a * this.m_v2.w.y);
  51949. case 3:
  51950. default:
  51951. return t.SetZero()
  51952. }
  51953. }, t.prototype.GetWitnessPoints = function(t, e) {
  51954. switch (this.m_count) {
  51955. case 0:
  51956. break;
  51957. case 1:
  51958. t.Copy(this.m_v1.wA), e.Copy(this.m_v1.wB);
  51959. break;
  51960. case 2:
  51961. t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x, t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y, e.x = this.m_v1.a * this.m_v1.wB.x + this.m_v2.a * this.m_v2.wB.x, e.y = this.m_v1.a * this.m_v1.wB.y + this.m_v2.a * this.m_v2.wB.y;
  51962. break;
  51963. case 3:
  51964. e.x = t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x + this.m_v3.a * this.m_v3.wA.x, e.y = t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y + this.m_v3.a * this.m_v3.wA.y
  51965. }
  51966. }, t.prototype.GetMetric = function() {
  51967. switch (this.m_count) {
  51968. case 0:
  51969. case 1:
  51970. return 0;
  51971. case 2:
  51972. return P.DistanceVV(this.m_v1.w, this.m_v2.w);
  51973. case 3:
  51974. return P.CrossVV(P.SubVV(this.m_v2.w, this.m_v1.w, P.s_t0), P.SubVV(this.m_v3.w, this.m_v1.w, P.s_t1));
  51975. default:
  51976. return 0
  51977. }
  51978. }, t.prototype.Solve2 = function() {
  51979. var e = this.m_v1.w,
  51980. i = this.m_v2.w,
  51981. n = P.SubVV(i, e, t.s_e12),
  51982. r = -P.DotVV(e, n);
  51983. if (r <= 0) return this.m_v1.a = 1, void(this.m_count = 1);
  51984. var s = P.DotVV(i, n);
  51985. if (s <= 0) return this.m_v2.a = 1, this.m_count = 1, void this.m_v1.Copy(this.m_v2);
  51986. var o = 1 / (s + r);
  51987. this.m_v1.a = s * o, this.m_v2.a = r * o, this.m_count = 2
  51988. }, t.prototype.Solve3 = function() {
  51989. var e = this.m_v1.w,
  51990. i = this.m_v2.w,
  51991. n = this.m_v3.w,
  51992. r = P.SubVV(i, e, t.s_e12),
  51993. s = P.DotVV(e, r),
  51994. o = P.DotVV(i, r),
  51995. a = -s,
  51996. l = P.SubVV(n, e, t.s_e13),
  51997. h = P.DotVV(e, l),
  51998. c = P.DotVV(n, l),
  51999. u = -h,
  52000. _ = P.SubVV(n, i, t.s_e23),
  52001. f = P.DotVV(i, _),
  52002. d = P.DotVV(n, _),
  52003. p = -f,
  52004. m = P.CrossVV(r, l),
  52005. y = m * P.CrossVV(i, n),
  52006. v = m * P.CrossVV(n, e),
  52007. g = m * P.CrossVV(e, i);
  52008. if (a <= 0 && u <= 0) return this.m_v1.a = 1, void(this.m_count = 1);
  52009. if (o > 0 && a > 0 && g <= 0) {
  52010. var x = 1 / (o + a);
  52011. return this.m_v1.a = o * x, this.m_v2.a = a * x, void(this.m_count = 2)
  52012. }
  52013. if (c > 0 && u > 0 && v <= 0) {
  52014. var b = 1 / (c + u);
  52015. return this.m_v1.a = c * b, this.m_v3.a = u * b, this.m_count = 2, void this.m_v2.Copy(this.m_v3)
  52016. }
  52017. if (o <= 0 && p <= 0) return this.m_v2.a = 1, this.m_count = 1, void this.m_v1.Copy(this.m_v2);
  52018. if (c <= 0 && d <= 0) return this.m_v3.a = 1, this.m_count = 1, void this.m_v1.Copy(this.m_v3);
  52019. if (d > 0 && p > 0 && y <= 0) {
  52020. var A = 1 / (d + p);
  52021. return this.m_v2.a = d * A, this.m_v3.a = p * A, this.m_count = 2, void this.m_v1.Copy(this.m_v3)
  52022. }
  52023. var C = 1 / (y + v + g);
  52024. this.m_v1.a = y * C, this.m_v2.a = v * C, this.m_v3.a = g * C, this.m_count = 3
  52025. }, t.s_e12 = new P, t.s_e13 = new P, t.s_e23 = new P, t
  52026. })(),
  52027. et = new tt,
  52028. it = [0, 0, 0],
  52029. nt = [0, 0, 0],
  52030. rt = new P,
  52031. st = new P,
  52032. ot = new P,
  52033. at = new P,
  52034. lt = new P;
  52035. function ht(e, i, s) {
  52036. ++t.b2_gjkCalls;
  52037. var o = s.proxyA,
  52038. a = s.proxyB,
  52039. l = s.transformA,
  52040. h = s.transformB,
  52041. c = et;
  52042. c.ReadCache(i, o, l, a, h);
  52043. for (var u = c.m_vertices, _ = it, f = nt, d = 0, p = 0; p < 20;) {
  52044. d = c.m_count;
  52045. for (var m = 0; m < d; ++m) _[m] = u[m].indexA, f[m] = u[m].indexB;
  52046. switch (c.m_count) {
  52047. case 1:
  52048. break;
  52049. case 2:
  52050. c.Solve2();
  52051. break;
  52052. case 3:
  52053. c.Solve3()
  52054. }
  52055. if (3 === c.m_count) break;
  52056. var y = c.GetSearchDirection(st);
  52057. if (y.LengthSquared() < r) break;
  52058. var v = u[c.m_count];
  52059. v.indexA = o.GetSupport(N.MulTRV(l.q, P.NegV(y, P.s_t0), at)), V.MulXV(l, o.GetVertex(v.indexA), v.wA), v.indexB = a.GetSupport(N.MulTRV(h.q, y, lt)), V.MulXV(h, a.GetVertex(v.indexB), v.wB), P.SubVV(v.wB, v.wA, v.w), ++p, ++t.b2_gjkIters;
  52060. var g = !1;
  52061. for (m = 0; m < d; ++m)
  52062. if (v.indexA === _[m] && v.indexB === f[m]) {
  52063. g = !0;
  52064. break
  52065. }
  52066. if (g) break;
  52067. ++c.m_count
  52068. }
  52069. if (t.b2_gjkMaxIters = x(t.b2_gjkMaxIters, p), c.GetWitnessPoints(e.pointA, e.pointB), e.distance = P.DistanceVV(e.pointA, e.pointB), e.iterations = p, c.WriteCache(i), s.useRadii) {
  52070. var b = o.m_radius,
  52071. A = a.m_radius;
  52072. if (e.distance > b + A && e.distance > n) {
  52073. e.distance -= b + A;
  52074. var C = P.SubVV(e.pointB, e.pointA, ot);
  52075. C.Normalize(), e.pointA.SelfMulAdd(b, C), e.pointB.SelfMulSub(A, C)
  52076. } else {
  52077. var T = P.MidVV(e.pointA, e.pointB, rt);
  52078. e.pointA.Copy(T), e.pointB.Copy(T), e.distance = 0
  52079. }
  52080. }
  52081. }
  52082. var ct = new P,
  52083. ut = new tt,
  52084. _t = new P,
  52085. ft = new P,
  52086. dt = new P,
  52087. pt = new P,
  52088. mt = new P,
  52089. yt = new P;
  52090. (function(t) {
  52091. t[t.e_vertex = 0] = "e_vertex", t[t.e_face = 1] = "e_face"
  52092. })(t.b2ContactFeatureType || (t.b2ContactFeatureType = {}));
  52093. var vt = (function() {
  52094. function t() {
  52095. this._key = 0, this._key_invalid = !1, this._indexA = 0, this._indexB = 0, this._typeA = 0, this._typeB = 0
  52096. }
  52097. return Object.defineProperty(t.prototype, "key", {
  52098. get: function() {
  52099. return this._key_invalid && (this._key_invalid = !1, this._key = this._indexA | this._indexB << 8 | this._typeA << 16 | this._typeB << 24), this._key
  52100. },
  52101. set: function(t) {
  52102. this._key = t, this._key_invalid = !1, this._indexA = 255 & this._key, this._indexB = this._key >> 8 & 255, this._typeA = this._key >> 16 & 255, this._typeB = this._key >> 24 & 255
  52103. },
  52104. enumerable: !0,
  52105. configurable: !0
  52106. }), Object.defineProperty(t.prototype, "indexA", {
  52107. get: function() {
  52108. return this._indexA
  52109. },
  52110. set: function(t) {
  52111. this._indexA = t, this._key_invalid = !0
  52112. },
  52113. enumerable: !0,
  52114. configurable: !0
  52115. }), Object.defineProperty(t.prototype, "indexB", {
  52116. get: function() {
  52117. return this._indexB
  52118. },
  52119. set: function(t) {
  52120. this._indexB = t, this._key_invalid = !0
  52121. },
  52122. enumerable: !0,
  52123. configurable: !0
  52124. }), Object.defineProperty(t.prototype, "typeA", {
  52125. get: function() {
  52126. return this._typeA
  52127. },
  52128. set: function(t) {
  52129. this._typeA = t, this._key_invalid = !0
  52130. },
  52131. enumerable: !0,
  52132. configurable: !0
  52133. }), Object.defineProperty(t.prototype, "typeB", {
  52134. get: function() {
  52135. return this._typeB
  52136. },
  52137. set: function(t) {
  52138. this._typeB = t, this._key_invalid = !0
  52139. },
  52140. enumerable: !0,
  52141. configurable: !0
  52142. }), t
  52143. })(),
  52144. gt = (function() {
  52145. function t() {
  52146. this.cf = new vt
  52147. }
  52148. return t.prototype.Copy = function(t) {
  52149. return this.key = t.key, this
  52150. }, t.prototype.Clone = function() {
  52151. return (new t).Copy(this)
  52152. }, Object.defineProperty(t.prototype, "key", {
  52153. get: function() {
  52154. return this.cf.key
  52155. },
  52156. set: function(t) {
  52157. this.cf.key = t
  52158. },
  52159. enumerable: !0,
  52160. configurable: !0
  52161. }), t
  52162. })(),
  52163. xt = (function() {
  52164. function t() {
  52165. this.localPoint = new P, this.normalImpulse = 0, this.tangentImpulse = 0, this.id = new gt
  52166. }
  52167. return t.MakeArray = function(e) {
  52168. return d(e, (function(e) {
  52169. return new t
  52170. }))
  52171. }, t.prototype.Reset = function() {
  52172. this.localPoint.SetZero(), this.normalImpulse = 0, this.tangentImpulse = 0, this.id.key = 0
  52173. }, t.prototype.Copy = function(t) {
  52174. return this.localPoint.Copy(t.localPoint), this.normalImpulse = t.normalImpulse, this.tangentImpulse = t.tangentImpulse, this.id.Copy(t.id), this
  52175. }, t
  52176. })();
  52177. (function(t) {
  52178. t[t.e_unknown = -1] = "e_unknown", t[t.e_circles = 0] = "e_circles", t[t.e_faceA = 1] = "e_faceA", t[t.e_faceB = 2] = "e_faceB"
  52179. })(t.b2ManifoldType || (t.b2ManifoldType = {}));
  52180. var bt = (function() {
  52181. function e() {
  52182. this.points = xt.MakeArray(o), this.localNormal = new P, this.localPoint = new P, this.type = t.b2ManifoldType.e_unknown, this.pointCount = 0
  52183. }
  52184. return e.prototype.Reset = function() {
  52185. for (var e = 0; e < o; ++e) this.points[e].Reset();
  52186. this.localNormal.SetZero(), this.localPoint.SetZero(), this.type = t.b2ManifoldType.e_unknown, this.pointCount = 0
  52187. }, e.prototype.Copy = function(t) {
  52188. this.pointCount = t.pointCount;
  52189. for (var e = 0; e < o; ++e) this.points[e].Copy(t.points[e]);
  52190. return this.localNormal.Copy(t.localNormal), this.localPoint.Copy(t.localPoint), this.type = t.type, this
  52191. }, e.prototype.Clone = function() {
  52192. return (new e).Copy(this)
  52193. }, e
  52194. })(),
  52195. At = (function() {
  52196. function e() {
  52197. this.normal = new P, this.points = P.MakeArray(o), this.separations = p(o)
  52198. }
  52199. return e.prototype.Initialize = function(i, n, s, o, a) {
  52200. if (0 !== i.pointCount) switch (i.type) {
  52201. case t.b2ManifoldType.e_circles:
  52202. this.normal.Set(1, 0);
  52203. var l = V.MulXV(n, i.localPoint, e.Initialize_s_pointA),
  52204. h = V.MulXV(o, i.points[0].localPoint, e.Initialize_s_pointB);
  52205. P.DistanceSquaredVV(l, h) > r && P.SubVV(h, l, this.normal).SelfNormalize();
  52206. var c = P.AddVMulSV(l, s, this.normal, e.Initialize_s_cA),
  52207. u = P.SubVMulSV(h, a, this.normal, e.Initialize_s_cB);
  52208. P.MidVV(c, u, this.points[0]), this.separations[0] = P.DotVV(P.SubVV(u, c, P.s_t0), this.normal);
  52209. break;
  52210. case t.b2ManifoldType.e_faceA:
  52211. N.MulRV(n.q, i.localNormal, this.normal);
  52212. for (var _ = V.MulXV(n, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) {
  52213. var d = V.MulXV(o, i.points[f].localPoint, e.Initialize_s_clipPoint),
  52214. p = s - P.DotVV(P.SubVV(d, _, P.s_t0), this.normal);
  52215. c = P.AddVMulSV(d, p, this.normal, e.Initialize_s_cA), u = P.SubVMulSV(d, a, this.normal, e.Initialize_s_cB);
  52216. P.MidVV(c, u, this.points[f]), this.separations[f] = P.DotVV(P.SubVV(u, c, P.s_t0), this.normal)
  52217. }
  52218. break;
  52219. case t.b2ManifoldType.e_faceB:
  52220. N.MulRV(o.q, i.localNormal, this.normal);
  52221. for (_ = V.MulXV(o, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) {
  52222. d = V.MulXV(n, i.points[f].localPoint, e.Initialize_s_clipPoint), p = a - P.DotVV(P.SubVV(d, _, P.s_t0), this.normal), u = P.AddVMulSV(d, p, this.normal, e.Initialize_s_cB), c = P.SubVMulSV(d, s, this.normal, e.Initialize_s_cA);
  52223. P.MidVV(c, u, this.points[f]), this.separations[f] = P.DotVV(P.SubVV(c, u, P.s_t0), this.normal)
  52224. }
  52225. this.normal.SelfNeg()
  52226. }
  52227. }, e.Initialize_s_pointA = new P, e.Initialize_s_pointB = new P, e.Initialize_s_cA = new P, e.Initialize_s_cB = new P, e.Initialize_s_planePoint = new P, e.Initialize_s_clipPoint = new P, e
  52228. })();
  52229. (function(t) {
  52230. t[t.b2_nullState = 0] = "b2_nullState", t[t.b2_addState = 1] = "b2_addState", t[t.b2_persistState = 2] = "b2_persistState", t[t.b2_removeState = 3] = "b2_removeState"
  52231. })(t.b2PointState || (t.b2PointState = {}));
  52232. var Ct = (function() {
  52233. function t() {
  52234. this.v = new P, this.id = new gt
  52235. }
  52236. return t.MakeArray = function(e) {
  52237. return d(e, (function(e) {
  52238. return new t
  52239. }))
  52240. }, t.prototype.Copy = function(t) {
  52241. return this.v.Copy(t.v), this.id.Copy(t.id), this
  52242. }, t
  52243. })(),
  52244. Tt = (function() {
  52245. function t() {
  52246. this.p1 = new P, this.p2 = new P, this.maxFraction = 1
  52247. }
  52248. return t.prototype.Copy = function(t) {
  52249. return this.p1.Copy(t.p1), this.p2.Copy(t.p2), this.maxFraction = t.maxFraction, this
  52250. }, t
  52251. })(),
  52252. St = (function() {
  52253. function t() {
  52254. this.normal = new P, this.fraction = 0
  52255. }
  52256. return t.prototype.Copy = function(t) {
  52257. return this.normal.Copy(t.normal), this.fraction = t.fraction, this
  52258. }, t
  52259. })(),
  52260. wt = (function() {
  52261. function t() {
  52262. this.lowerBound = new P, this.upperBound = new P, this.m_cache_center = new P, this.m_cache_extent = new P
  52263. }
  52264. return t.prototype.Copy = function(t) {
  52265. return this.lowerBound.Copy(t.lowerBound), this.upperBound.Copy(t.upperBound), this
  52266. }, t.prototype.IsValid = function() {
  52267. var t = this.upperBound.x - this.lowerBound.x,
  52268. e = this.upperBound.y - this.lowerBound.y,
  52269. i = t >= 0 && e >= 0;
  52270. return i = i && this.lowerBound.IsValid() && this.upperBound.IsValid()
  52271. }, t.prototype.GetCenter = function() {
  52272. return P.MidVV(this.lowerBound, this.upperBound, this.m_cache_center)
  52273. }, t.prototype.GetExtents = function() {
  52274. return P.ExtVV(this.lowerBound, this.upperBound, this.m_cache_extent)
  52275. }, t.prototype.GetPerimeter = function() {
  52276. return 2 * (this.upperBound.x - this.lowerBound.x + (this.upperBound.y - this.lowerBound.y))
  52277. }, t.prototype.Combine1 = function(t) {
  52278. return this.lowerBound.x = g(this.lowerBound.x, t.lowerBound.x), this.lowerBound.y = g(this.lowerBound.y, t.lowerBound.y), this.upperBound.x = x(this.upperBound.x, t.upperBound.x), this.upperBound.y = x(this.upperBound.y, t.upperBound.y), this
  52279. }, t.prototype.Combine2 = function(t, e) {
  52280. return this.lowerBound.x = g(t.lowerBound.x, e.lowerBound.x), this.lowerBound.y = g(t.lowerBound.y, e.lowerBound.y), this.upperBound.x = x(t.upperBound.x, e.upperBound.x), this.upperBound.y = x(t.upperBound.y, e.upperBound.y), this
  52281. }, t.Combine = function(t, e, i) {
  52282. return i.Combine2(t, e), i
  52283. }, t.prototype.Contains = function(t) {
  52284. var e = !0;
  52285. return e = (e = (e = (e = e && this.lowerBound.x <= t.lowerBound.x) && this.lowerBound.y <= t.lowerBound.y) && t.upperBound.x <= this.upperBound.x) && t.upperBound.y <= this.upperBound.y
  52286. }, t.prototype.RayCast = function(t, e) {
  52287. var r = -i,
  52288. s = i,
  52289. o = e.p1.x,
  52290. a = e.p1.y,
  52291. l = e.p2.x - e.p1.x,
  52292. h = e.p2.y - e.p1.y,
  52293. c = v(l),
  52294. u = v(h),
  52295. _ = t.normal;
  52296. if (c < n) {
  52297. if (o < this.lowerBound.x || this.upperBound.x < o) return !1
  52298. } else {
  52299. var f = 1 / l,
  52300. d = -1;
  52301. if ((m = (this.lowerBound.x - o) * f) > (y = (this.upperBound.x - o) * f)) {
  52302. var p = m;
  52303. m = y, y = p, d = 1
  52304. }
  52305. if (m > r && (_.x = d, _.y = 0, r = m), r > (s = g(s, y))) return !1
  52306. }
  52307. if (u < n) {
  52308. if (a < this.lowerBound.y || this.upperBound.y < a) return !1
  52309. } else {
  52310. var m, y;
  52311. f = 1 / h, d = -1;
  52312. if ((m = (this.lowerBound.y - a) * f) > (y = (this.upperBound.y - a) * f)) {
  52313. p = m;
  52314. m = y, y = p, d = 1
  52315. }
  52316. if (m > r && (_.x = 0, _.y = d, r = m), r > (s = g(s, y))) return !1
  52317. }
  52318. return !(r < 0 || e.maxFraction < r) && (t.fraction = r, !0)
  52319. }, t.prototype.TestContain = function(t) {
  52320. return !(t.x < this.lowerBound.x || this.upperBound.x < t.x) && !(t.y < this.lowerBound.y || this.upperBound.y < t.y)
  52321. }, t.prototype.TestOverlap = function(t) {
  52322. var e = t.lowerBound.x - this.upperBound.x,
  52323. i = t.lowerBound.y - this.upperBound.y,
  52324. n = this.lowerBound.x - t.upperBound.x,
  52325. r = this.lowerBound.y - t.upperBound.y;
  52326. return !(e > 0 || i > 0) && !(n > 0 || r > 0)
  52327. }, t
  52328. })();
  52329. function Et(t, e) {
  52330. var i = e.lowerBound.x - t.upperBound.x,
  52331. n = e.lowerBound.y - t.upperBound.y,
  52332. r = t.lowerBound.x - e.upperBound.x,
  52333. s = t.lowerBound.y - e.upperBound.y;
  52334. return !(i > 0 || n > 0) && !(r > 0 || s > 0)
  52335. }
  52336. function Mt(e, i, n, r, s) {
  52337. var o = 0,
  52338. a = i[0],
  52339. l = i[1],
  52340. h = P.DotVV(n, a.v) - r,
  52341. c = P.DotVV(n, l.v) - r;
  52342. if (h <= 0 && e[o++].Copy(a), c <= 0 && e[o++].Copy(l), h * c < 0) {
  52343. var u = h / (h - c),
  52344. _ = e[o].v;
  52345. _.x = a.v.x + u * (l.v.x - a.v.x), _.y = a.v.y + u * (l.v.y - a.v.y);
  52346. var f = e[o].id;
  52347. f.cf.indexA = s, f.cf.indexB = a.id.cf.indexB, f.cf.typeA = t.b2ContactFeatureType.e_vertex, f.cf.typeB = t.b2ContactFeatureType.e_face, ++o
  52348. }
  52349. return o
  52350. }
  52351. var Dt = new J,
  52352. Bt = new q,
  52353. It = new Z;
  52354. function Pt(t, e, i, r, s, o) {
  52355. var a = Dt.Reset();
  52356. a.proxyA.SetShape(t, e), a.proxyB.SetShape(i, r), a.transformA.Copy(s), a.transformB.Copy(o), a.useRadii = !0;
  52357. var l = Bt.Reset();
  52358. l.count = 0;
  52359. var h = It.Reset();
  52360. return ht(h, l, a), h.distance < 10 * n
  52361. }
  52362. function Rt(t) {
  52363. if (null === t) throw new Error;
  52364. return t
  52365. }
  52366. var Ot = (function() {
  52367. function t(t) {
  52368. void 0 === t && (t = 0), this.m_id = 0, this.aabb = new wt, this.parent = null, this.child1 = null, this.child2 = null, this.height = 0, this.m_id = t
  52369. }
  52370. return t.prototype.IsLeaf = function() {
  52371. return null === this.child1
  52372. }, t
  52373. })(),
  52374. Lt = (function() {
  52375. function t() {
  52376. this.m_root = null, this.m_freeList = null, this.m_path = 0, this.m_insertionCount = 0, this.m_stack = new W(256)
  52377. }
  52378. return t.prototype.Query = function(t, e) {
  52379. if (null !== this.m_root) {
  52380. var i = this.m_stack.Reset();
  52381. for (i.Push(this.m_root); i.GetCount() > 0;) {
  52382. var n = i.Pop();
  52383. if (n.aabb.TestOverlap(t))
  52384. if (n.IsLeaf()) {
  52385. if (!e(n)) return
  52386. } else i.Push(Rt(n.child1)), i.Push(Rt(n.child2))
  52387. }
  52388. }
  52389. }, t.prototype.QueryPoint = function(t, e) {
  52390. if (null !== this.m_root) {
  52391. var i = this.m_stack.Reset();
  52392. for (i.Push(this.m_root); i.GetCount() > 0;) {
  52393. var n = i.Pop();
  52394. if (n.aabb.TestContain(t))
  52395. if (n.IsLeaf()) {
  52396. if (!e(n)) return
  52397. } else i.Push(Rt(n.child1)), i.Push(Rt(n.child2))
  52398. }
  52399. }
  52400. }, t.prototype.RayCast = function(e, i) {
  52401. if (null !== this.m_root) {
  52402. var n = e.p1,
  52403. r = e.p2,
  52404. s = P.SubVV(r, n, t.s_r);
  52405. s.Normalize();
  52406. var o = P.CrossOneV(s, t.s_v),
  52407. a = P.AbsV(o, t.s_abs_v),
  52408. l = e.maxFraction,
  52409. h = t.s_segmentAABB,
  52410. c = n.x + l * (r.x - n.x),
  52411. u = n.y + l * (r.y - n.y);
  52412. h.lowerBound.x = g(n.x, c), h.lowerBound.y = g(n.y, u), h.upperBound.x = x(n.x, c), h.upperBound.y = x(n.y, u);
  52413. var _ = this.m_stack.Reset();
  52414. for (_.Push(this.m_root); _.GetCount() > 0;) {
  52415. var f = _.Pop();
  52416. if (Et(f.aabb, h)) {
  52417. var d = f.aabb.GetCenter(),
  52418. p = f.aabb.GetExtents();
  52419. if (!(v(P.DotVV(o, P.SubVV(n, d, P.s_t0))) - P.DotVV(a, p) > 0))
  52420. if (f.IsLeaf()) {
  52421. var m = t.s_subInput;
  52422. m.p1.Copy(e.p1), m.p2.Copy(e.p2), m.maxFraction = l;
  52423. var y = i(m, f);
  52424. if (0 === y) return;
  52425. y > 0 && (l = y, c = n.x + l * (r.x - n.x), u = n.y + l * (r.y - n.y), h.lowerBound.x = g(n.x, c), h.lowerBound.y = g(n.y, u), h.upperBound.x = x(n.x, c), h.upperBound.y = x(n.y, u))
  52426. } else _.Push(Rt(f.child1)), _.Push(Rt(f.child2))
  52427. }
  52428. }
  52429. }
  52430. }, t.prototype.AllocateNode = function() {
  52431. if (this.m_freeList) {
  52432. var e = this.m_freeList;
  52433. return this.m_freeList = e.parent, e.parent = null, e.child1 = null, e.child2 = null, e.height = 0, delete e.userData, e
  52434. }
  52435. return new Ot(t.s_node_id++)
  52436. }, t.prototype.FreeNode = function(t) {
  52437. t.parent = this.m_freeList, t.child1 = null, t.child2 = null, t.height = -1, delete t.userData, this.m_freeList = t
  52438. }, t.prototype.CreateProxy = function(t, e) {
  52439. var i = this.AllocateNode();
  52440. return i.aabb.lowerBound.x = t.lowerBound.x - .1, i.aabb.lowerBound.y = t.lowerBound.y - .1, i.aabb.upperBound.x = t.upperBound.x + .1, i.aabb.upperBound.y = t.upperBound.y + .1, i.userData = e, i.height = 0, this.InsertLeaf(i), i
  52441. }, t.prototype.DestroyProxy = function(t) {
  52442. this.RemoveLeaf(t), this.FreeNode(t)
  52443. }, t.prototype.MoveProxy = function(t, e, i) {
  52444. if (t.aabb.Contains(e)) return !1;
  52445. this.RemoveLeaf(t);
  52446. var n = .1 + 2 * (i.x > 0 ? i.x : -i.x),
  52447. r = .1 + 2 * (i.y > 0 ? i.y : -i.y);
  52448. return t.aabb.lowerBound.x = e.lowerBound.x - n, t.aabb.lowerBound.y = e.lowerBound.y - r, t.aabb.upperBound.x = e.upperBound.x + n, t.aabb.upperBound.y = e.upperBound.y + r, this.InsertLeaf(t), !0
  52449. }, t.prototype.InsertLeaf = function(e) {
  52450. if (++this.m_insertionCount, null === this.m_root) return this.m_root = e, void(this.m_root.parent = null);
  52451. for (var i = e.aabb, n = this.m_root; !n.IsLeaf();) {
  52452. var r = Rt(n.child1),
  52453. s = Rt(n.child2),
  52454. o = n.aabb.GetPerimeter(),
  52455. a = t.s_combinedAABB;
  52456. a.Combine2(n.aabb, i);
  52457. var l = a.GetPerimeter(),
  52458. h = 2 * l,
  52459. c = 2 * (l - o),
  52460. u = void 0,
  52461. _ = t.s_aabb,
  52462. f = void 0;
  52463. r.IsLeaf() ? (_.Combine2(i, r.aabb), u = _.GetPerimeter() + c) : (_.Combine2(i, r.aabb), f = r.aabb.GetPerimeter(), u = _.GetPerimeter() - f + c);
  52464. var d = void 0;
  52465. if (s.IsLeaf() ? (_.Combine2(i, s.aabb), d = _.GetPerimeter() + c) : (_.Combine2(i, s.aabb), f = s.aabb.GetPerimeter(), d = _.GetPerimeter() - f + c), h < u && h < d) break;
  52466. n = u < d ? r : s
  52467. }
  52468. var p = n,
  52469. m = p.parent,
  52470. y = this.AllocateNode();
  52471. y.parent = m, delete y.userData, y.aabb.Combine2(i, p.aabb), y.height = p.height + 1, m ? (m.child1 === p ? m.child1 = y : m.child2 = y, y.child1 = p, y.child2 = e, p.parent = y, e.parent = y) : (y.child1 = p, y.child2 = e, p.parent = y, e.parent = y, this.m_root = y);
  52472. for (var v = e.parent; null !== v;) {
  52473. r = Rt((v = this.Balance(v)).child1), s = Rt(v.child2);
  52474. v.height = 1 + x(r.height, s.height), v.aabb.Combine2(r.aabb, s.aabb), v = v.parent
  52475. }
  52476. }, t.prototype.RemoveLeaf = function(t) {
  52477. if (t !== this.m_root) {
  52478. var e, i = Rt(t.parent),
  52479. n = i && i.parent;
  52480. if (e = i.child1 === t ? Rt(i.child2) : Rt(i.child1), n) {
  52481. n.child1 === i ? n.child1 = e : n.child2 = e, e.parent = n, this.FreeNode(i);
  52482. for (var r = n; r;) {
  52483. var s = Rt((r = this.Balance(r)).child1),
  52484. o = Rt(r.child2);
  52485. r.aabb.Combine2(s.aabb, o.aabb), r.height = 1 + x(s.height, o.height), r = r.parent
  52486. }
  52487. } else this.m_root = e, e.parent = null, this.FreeNode(i)
  52488. } else this.m_root = null
  52489. }, t.prototype.Balance = function(t) {
  52490. if (t.IsLeaf() || t.height < 2) return t;
  52491. var e = Rt(t.child1),
  52492. i = Rt(t.child2),
  52493. n = i.height - e.height;
  52494. if (n > 1) {
  52495. var r = Rt(i.child1),
  52496. s = Rt(i.child2);
  52497. return i.child1 = t, i.parent = t.parent, t.parent = i, null !== i.parent ? i.parent.child1 === t ? i.parent.child1 = i : i.parent.child2 = i : this.m_root = i, r.height > s.height ? (i.child2 = r, t.child2 = s, s.parent = t, t.aabb.Combine2(e.aabb, s.aabb), i.aabb.Combine2(t.aabb, r.aabb), t.height = 1 + x(e.height, s.height), i.height = 1 + x(t.height, r.height)) : (i.child2 = s, t.child2 = r, r.parent = t, t.aabb.Combine2(e.aabb, r.aabb), i.aabb.Combine2(t.aabb, s.aabb), t.height = 1 + x(e.height, r.height), i.height = 1 + x(t.height, s.height)), i
  52498. }
  52499. if (n < -1) {
  52500. var o = Rt(e.child1),
  52501. a = Rt(e.child2);
  52502. return e.child1 = t, e.parent = t.parent, t.parent = e, null !== e.parent ? e.parent.child1 === t ? e.parent.child1 = e : e.parent.child2 = e : this.m_root = e, o.height > a.height ? (e.child2 = o, t.child1 = a, a.parent = t, t.aabb.Combine2(i.aabb, a.aabb), e.aabb.Combine2(t.aabb, o.aabb), t.height = 1 + x(i.height, a.height), e.height = 1 + x(t.height, o.height)) : (e.child2 = a, t.child1 = o, o.parent = t, t.aabb.Combine2(i.aabb, o.aabb), e.aabb.Combine2(t.aabb, a.aabb), t.height = 1 + x(i.height, o.height), e.height = 1 + x(t.height, a.height)), e
  52503. }
  52504. return t
  52505. }, t.prototype.GetHeight = function() {
  52506. return null === this.m_root ? 0 : this.m_root.height
  52507. }, t.GetAreaNode = function(e) {
  52508. if (null === e) return 0;
  52509. if (e.IsLeaf()) return 0;
  52510. var i = e.aabb.GetPerimeter();
  52511. return i += t.GetAreaNode(e.child1), i += t.GetAreaNode(e.child2)
  52512. }, t.prototype.GetAreaRatio = function() {
  52513. if (null === this.m_root) return 0;
  52514. var e = this.m_root.aabb.GetPerimeter();
  52515. return t.GetAreaNode(this.m_root) / e
  52516. }, t.prototype.ComputeHeightNode = function(t) {
  52517. if (!t || t.IsLeaf()) return 0;
  52518. var e = this.ComputeHeightNode(t.child1),
  52519. i = this.ComputeHeightNode(t.child2);
  52520. return 1 + x(e, i)
  52521. }, t.prototype.ComputeHeight = function() {
  52522. return this.ComputeHeightNode(this.m_root)
  52523. }, t.prototype.ValidateStructure = function(t) {
  52524. if (null !== t) {
  52525. this.m_root;
  52526. var e = t;
  52527. if (!e.IsLeaf()) {
  52528. var i = Rt(e.child1),
  52529. n = Rt(e.child2);
  52530. this.ValidateStructure(i), this.ValidateStructure(n)
  52531. }
  52532. }
  52533. }, t.prototype.ValidateMetrics = function(e) {
  52534. if (null !== e) {
  52535. var i = e;
  52536. if (!i.IsLeaf()) {
  52537. var n = Rt(i.child1),
  52538. r = Rt(i.child2);
  52539. t.s_aabb.Combine2(n.aabb, r.aabb), this.ValidateMetrics(n), this.ValidateMetrics(r)
  52540. }
  52541. }
  52542. }, t.prototype.Validate = function() {}, t.GetMaxBalanceNode = function(t, e) {
  52543. if (null === t) return e;
  52544. if (t.height <= 1) return e;
  52545. var i = Rt(t.child1),
  52546. n = Rt(t.child2),
  52547. r = v(n.height - i.height);
  52548. return x(e, r)
  52549. }, t.prototype.GetMaxBalance = function() {
  52550. return t.GetMaxBalanceNode(this.m_root, 0)
  52551. }, t.prototype.RebuildBottomUp = function() {
  52552. this.Validate()
  52553. }, t.ShiftOriginNode = function(e, i) {
  52554. if (null !== e && !(e.height <= 1)) {
  52555. var n = e.child1,
  52556. r = e.child2;
  52557. t.ShiftOriginNode(n, i), t.ShiftOriginNode(r, i), e.aabb.lowerBound.SelfSub(i), e.aabb.upperBound.SelfSub(i)
  52558. }
  52559. }, t.prototype.ShiftOrigin = function(e) {
  52560. t.ShiftOriginNode(this.m_root, e)
  52561. }, t.s_r = new P, t.s_v = new P, t.s_abs_v = new P, t.s_segmentAABB = new wt, t.s_subInput = new Tt, t.s_combinedAABB = new wt, t.s_aabb = new wt, t.s_node_id = 0, t
  52562. })(),
  52563. Ft = (function() {
  52564. return function(t, e) {
  52565. this.proxyA = t, this.proxyB = e
  52566. }
  52567. })(),
  52568. Nt = (function() {
  52569. function t() {
  52570. this.m_tree = new Lt, this.m_proxyCount = 0, this.m_moveCount = 0, this.m_moveBuffer = [], this.m_pairCount = 0, this.m_pairBuffer = []
  52571. }
  52572. return t.prototype.CreateProxy = function(t, e) {
  52573. var i = this.m_tree.CreateProxy(t, e);
  52574. return ++this.m_proxyCount, this.BufferMove(i), i
  52575. }, t.prototype.DestroyProxy = function(t) {
  52576. this.UnBufferMove(t), --this.m_proxyCount, this.m_tree.DestroyProxy(t)
  52577. }, t.prototype.MoveProxy = function(t, e, i) {
  52578. this.m_tree.MoveProxy(t, e, i) && this.BufferMove(t)
  52579. }, t.prototype.TouchProxy = function(t) {
  52580. this.BufferMove(t)
  52581. }, t.prototype.GetProxyCount = function() {
  52582. return this.m_proxyCount
  52583. }, t.prototype.UpdatePairs = function(t) {
  52584. var e = this;
  52585. this.m_pairCount = 0;
  52586. for (var i = function(t) {
  52587. var i = n.m_moveBuffer[t];
  52588. if (null === i) return "continue";
  52589. var r = i.aabb;
  52590. n.m_tree.Query(r, (function(t) {
  52591. if (t.m_id === i.m_id) return !0;
  52592. var n, r;
  52593. if (t.m_id < i.m_id ? (n = t, r = i) : (n = i, r = t), e.m_pairCount === e.m_pairBuffer.length) e.m_pairBuffer[e.m_pairCount] = new Ft(n, r);
  52594. else {
  52595. var s = e.m_pairBuffer[e.m_pairCount];
  52596. s.proxyA = n, s.proxyB = r
  52597. }
  52598. return ++e.m_pairCount, !0
  52599. }))
  52600. }, n = this, r = 0; r < this.m_moveCount; ++r) i(r);
  52601. this.m_moveCount = 0, this.m_pairBuffer.length = this.m_pairCount, this.m_pairBuffer.sort(Vt);
  52602. for (var s = 0; s < this.m_pairCount;) {
  52603. var o = this.m_pairBuffer[s],
  52604. a = o.proxyA.userData,
  52605. l = o.proxyB.userData;
  52606. for (a && l && t(a, l), ++s; s < this.m_pairCount;) {
  52607. var h = this.m_pairBuffer[s];
  52608. if (h.proxyA.m_id !== o.proxyA.m_id || h.proxyB.m_id !== o.proxyB.m_id) break;
  52609. ++s
  52610. }
  52611. }
  52612. }, t.prototype.Query = function(t, e) {
  52613. this.m_tree.Query(t, e)
  52614. }, t.prototype.QueryPoint = function(t, e) {
  52615. this.m_tree.QueryPoint(t, e)
  52616. }, t.prototype.RayCast = function(t, e) {
  52617. this.m_tree.RayCast(t, e)
  52618. }, t.prototype.GetTreeHeight = function() {
  52619. return this.m_tree.GetHeight()
  52620. }, t.prototype.GetTreeBalance = function() {
  52621. return this.m_tree.GetMaxBalance()
  52622. }, t.prototype.GetTreeQuality = function() {
  52623. return this.m_tree.GetAreaRatio()
  52624. }, t.prototype.ShiftOrigin = function(t) {
  52625. this.m_tree.ShiftOrigin(t)
  52626. }, t.prototype.BufferMove = function(t) {
  52627. this.m_moveBuffer[this.m_moveCount] = t, ++this.m_moveCount
  52628. }, t.prototype.UnBufferMove = function(t) {
  52629. var e = this.m_moveBuffer.indexOf(t);
  52630. this.m_moveBuffer[e] = null
  52631. }, t
  52632. })();
  52633. function Vt(t, e) {
  52634. return t.proxyA.m_id === e.proxyA.m_id ? t.proxyB.m_id - e.proxyB.m_id : t.proxyA.m_id - e.proxyA.m_id
  52635. }
  52636. t.b2_toiTime = 0, t.b2_toiMaxTime = 0, t.b2_toiCalls = 0, t.b2_toiIters = 0, t.b2_toiMaxIters = 0, t.b2_toiRootIters = 0, t.b2_toiMaxRootIters = 0;
  52637. var kt = new V,
  52638. Gt = new V,
  52639. Ut = new P,
  52640. zt = new P,
  52641. jt = new P,
  52642. Wt = new P,
  52643. Ht = new P,
  52644. Xt = (function() {
  52645. return function() {
  52646. this.proxyA = new Y, this.proxyB = new Y, this.sweepA = new k, this.sweepB = new k, this.tMax = 0
  52647. }
  52648. })();
  52649. (function(t) {
  52650. t[t.e_unknown = 0] = "e_unknown", t[t.e_failed = 1] = "e_failed", t[t.e_overlapped = 2] = "e_overlapped", t[t.e_touching = 3] = "e_touching", t[t.e_separated = 4] = "e_separated"
  52651. })(t.b2TOIOutputState || (t.b2TOIOutputState = {}));
  52652. var Yt = (function() {
  52653. return function() {
  52654. this.state = t.b2TOIOutputState.e_unknown, this.t = 0
  52655. }
  52656. })();
  52657. (function(t) {
  52658. t[t.e_unknown = -1] = "e_unknown", t[t.e_points = 0] = "e_points", t[t.e_faceA = 1] = "e_faceA", t[t.e_faceB = 2] = "e_faceB"
  52659. })(t.b2SeparationFunctionType || (t.b2SeparationFunctionType = {}));
  52660. var qt = (function() {
  52661. function e() {
  52662. this.m_sweepA = new k, this.m_sweepB = new k, this.m_type = t.b2SeparationFunctionType.e_unknown, this.m_localPoint = new P, this.m_axis = new P
  52663. }
  52664. return e.prototype.Initialize = function(e, i, n, r, s, o) {
  52665. this.m_proxyA = i, this.m_proxyB = r;
  52666. var a = e.count;
  52667. this.m_sweepA.Copy(n), this.m_sweepB.Copy(s);
  52668. var l = kt,
  52669. h = Gt;
  52670. if (this.m_sweepA.GetTransform(l, o), this.m_sweepB.GetTransform(h, o), 1 === a) {
  52671. this.m_type = t.b2SeparationFunctionType.e_points;
  52672. var c = this.m_proxyA.GetVertex(e.indexA[0]),
  52673. u = this.m_proxyB.GetVertex(e.indexB[0]),
  52674. _ = V.MulXV(l, c, Ut),
  52675. f = V.MulXV(h, u, zt);
  52676. P.SubVV(f, _, this.m_axis);
  52677. var d = this.m_axis.Normalize();
  52678. return this.m_localPoint.SetZero(), d
  52679. }
  52680. if (e.indexA[0] === e.indexA[1]) {
  52681. this.m_type = t.b2SeparationFunctionType.e_faceB;
  52682. var p = this.m_proxyB.GetVertex(e.indexB[0]),
  52683. m = this.m_proxyB.GetVertex(e.indexB[1]);
  52684. P.CrossVOne(P.SubVV(m, p, P.s_t0), this.m_axis).SelfNormalize();
  52685. var y = N.MulRV(h.q, this.m_axis, jt);
  52686. P.MidVV(p, m, this.m_localPoint);
  52687. f = V.MulXV(h, this.m_localPoint, zt), c = this.m_proxyA.GetVertex(e.indexA[0]), _ = V.MulXV(l, c, Ut);
  52688. return (d = P.DotVV(P.SubVV(_, f, P.s_t0), y)) < 0 && (this.m_axis.SelfNeg(), d = -d), d
  52689. }
  52690. this.m_type = t.b2SeparationFunctionType.e_faceA;
  52691. var v = this.m_proxyA.GetVertex(e.indexA[0]),
  52692. g = this.m_proxyA.GetVertex(e.indexA[1]);
  52693. P.CrossVOne(P.SubVV(g, v, P.s_t0), this.m_axis).SelfNormalize();
  52694. y = N.MulRV(l.q, this.m_axis, jt);
  52695. P.MidVV(v, g, this.m_localPoint);
  52696. _ = V.MulXV(l, this.m_localPoint, Ut), u = this.m_proxyB.GetVertex(e.indexB[0]), f = V.MulXV(h, u, zt);
  52697. return (d = P.DotVV(P.SubVV(f, _, P.s_t0), y)) < 0 && (this.m_axis.SelfNeg(), d = -d), d
  52698. }, e.prototype.FindMinSeparation = function(e, i, n) {
  52699. var r = kt,
  52700. s = Gt;
  52701. switch (this.m_sweepA.GetTransform(r, n), this.m_sweepB.GetTransform(s, n), this.m_type) {
  52702. case t.b2SeparationFunctionType.e_points:
  52703. var o = N.MulTRV(r.q, this.m_axis, Wt),
  52704. a = N.MulTRV(s.q, P.NegV(this.m_axis, P.s_t0), Ht);
  52705. e[0] = this.m_proxyA.GetSupport(o), i[0] = this.m_proxyB.GetSupport(a);
  52706. var l = this.m_proxyA.GetVertex(e[0]),
  52707. h = this.m_proxyB.GetVertex(i[0]),
  52708. c = V.MulXV(r, l, Ut),
  52709. u = V.MulXV(s, h, zt);
  52710. return P.DotVV(P.SubVV(u, c, P.s_t0), this.m_axis);
  52711. case t.b2SeparationFunctionType.e_faceA:
  52712. var _ = N.MulRV(r.q, this.m_axis, jt);
  52713. c = V.MulXV(r, this.m_localPoint, Ut), a = N.MulTRV(s.q, P.NegV(_, P.s_t0), Ht);
  52714. e[0] = -1, i[0] = this.m_proxyB.GetSupport(a);
  52715. h = this.m_proxyB.GetVertex(i[0]), u = V.MulXV(s, h, zt);
  52716. return P.DotVV(P.SubVV(u, c, P.s_t0), _);
  52717. case t.b2SeparationFunctionType.e_faceB:
  52718. _ = N.MulRV(s.q, this.m_axis, jt), u = V.MulXV(s, this.m_localPoint, zt), o = N.MulTRV(r.q, P.NegV(_, P.s_t0), Wt);
  52719. i[0] = -1, e[0] = this.m_proxyA.GetSupport(o);
  52720. l = this.m_proxyA.GetVertex(e[0]), c = V.MulXV(r, l, Ut);
  52721. return P.DotVV(P.SubVV(c, u, P.s_t0), _);
  52722. default:
  52723. return e[0] = -1, i[0] = -1, 0
  52724. }
  52725. }, e.prototype.Evaluate = function(e, i, n) {
  52726. var r = kt,
  52727. s = Gt;
  52728. switch (this.m_sweepA.GetTransform(r, n), this.m_sweepB.GetTransform(s, n), this.m_type) {
  52729. case t.b2SeparationFunctionType.e_points:
  52730. var o = this.m_proxyA.GetVertex(e),
  52731. a = this.m_proxyB.GetVertex(i),
  52732. l = V.MulXV(r, o, Ut),
  52733. h = V.MulXV(s, a, zt);
  52734. return P.DotVV(P.SubVV(h, l, P.s_t0), this.m_axis);
  52735. case t.b2SeparationFunctionType.e_faceA:
  52736. var c = N.MulRV(r.q, this.m_axis, jt);
  52737. l = V.MulXV(r, this.m_localPoint, Ut), a = this.m_proxyB.GetVertex(i), h = V.MulXV(s, a, zt);
  52738. return P.DotVV(P.SubVV(h, l, P.s_t0), c);
  52739. case t.b2SeparationFunctionType.e_faceB:
  52740. c = N.MulRV(s.q, this.m_axis, jt), h = V.MulXV(s, this.m_localPoint, zt), o = this.m_proxyA.GetVertex(e), l = V.MulXV(r, o, Ut);
  52741. return P.DotVV(P.SubVV(l, h, P.s_t0), c);
  52742. default:
  52743. return 0
  52744. }
  52745. }, e
  52746. })(),
  52747. Jt = new z,
  52748. Zt = new q,
  52749. Kt = new J,
  52750. Qt = new Z,
  52751. $t = new qt,
  52752. te = [0],
  52753. ee = [0],
  52754. ie = new k,
  52755. ne = new k;
  52756. function re(e, i) {
  52757. var n = Jt.Reset();
  52758. ++t.b2_toiCalls, e.state = t.b2TOIOutputState.e_unknown, e.t = i.tMax;
  52759. var r = i.proxyA,
  52760. s = i.proxyB,
  52761. o = ie.Copy(i.sweepA),
  52762. h = ne.Copy(i.sweepB);
  52763. o.Normalize(), h.Normalize();
  52764. var c = i.tMax,
  52765. u = r.m_radius + s.m_radius,
  52766. _ = x(l, u - 3 * l),
  52767. f = .25 * l,
  52768. d = 0,
  52769. p = 0,
  52770. m = Zt;
  52771. m.count = 0;
  52772. var y = Kt;
  52773. for (y.proxyA.Copy(i.proxyA), y.proxyB.Copy(i.proxyB), y.useRadii = !1;;) {
  52774. var g = kt,
  52775. b = Gt;
  52776. o.GetTransform(g, d), h.GetTransform(b, d), y.transformA.Copy(g), y.transformB.Copy(b);
  52777. var A = Qt;
  52778. if (ht(A, m, y), A.distance <= 0) {
  52779. e.state = t.b2TOIOutputState.e_overlapped, e.t = 0;
  52780. break
  52781. }
  52782. if (A.distance < _ + f) {
  52783. e.state = t.b2TOIOutputState.e_touching, e.t = d;
  52784. break
  52785. }
  52786. var C = $t;
  52787. C.Initialize(m, r, o, s, h, d);
  52788. for (var T = !1, S = c, w = 0;;) {
  52789. var E = te,
  52790. M = ee,
  52791. D = C.FindMinSeparation(E, M, S);
  52792. if (D > _ + f) {
  52793. e.state = t.b2TOIOutputState.e_separated, e.t = c, T = !0;
  52794. break
  52795. }
  52796. if (D > _ - f) {
  52797. d = S;
  52798. break
  52799. }
  52800. var B = C.Evaluate(E[0], M[0], d);
  52801. if (B < _ - f) {
  52802. e.state = t.b2TOIOutputState.e_failed, e.t = d, T = !0;
  52803. break
  52804. }
  52805. if (B <= _ + f) {
  52806. e.state = t.b2TOIOutputState.e_touching, e.t = d, T = !0;
  52807. break
  52808. }
  52809. for (var I = 0, P = d, R = S;;) {
  52810. var O = 0;
  52811. O = 1 & I ? P + (_ - B) * (R - P) / (D - B) : .5 * (P + R), ++I, ++t.b2_toiRootIters;
  52812. var L = C.Evaluate(E[0], M[0], O);
  52813. if (v(L - _) < f) {
  52814. S = O;
  52815. break
  52816. }
  52817. if (L > _ ? (P = O, B = L) : (R = O, D = L), 50 === I) break
  52818. }
  52819. if (t.b2_toiMaxRootIters = x(t.b2_toiMaxRootIters, I), ++w === a) break
  52820. }
  52821. if (++p, ++t.b2_toiIters, T) break;
  52822. if (20 === p) {
  52823. e.state = t.b2TOIOutputState.e_failed, e.t = d;
  52824. break
  52825. }
  52826. }
  52827. t.b2_toiMaxIters = x(t.b2_toiMaxIters, p);
  52828. var F = n.GetMilliseconds();
  52829. t.b2_toiMaxTime = x(t.b2_toiMaxTime, F), t.b2_toiTime += F
  52830. }
  52831. var se = new P,
  52832. oe = new P;
  52833. function ae(e, i, n, r, s) {
  52834. e.pointCount = 0;
  52835. var o = V.MulXV(n, i.m_p, se),
  52836. a = V.MulXV(s, r.m_p, oe),
  52837. l = P.DistanceSquaredVV(o, a),
  52838. h = i.m_radius + r.m_radius;
  52839. l > h * h || (e.type = t.b2ManifoldType.e_circles, e.localPoint.Copy(i.m_p), e.localNormal.SetZero(), e.pointCount = 1, e.points[0].localPoint.Copy(r.m_p), e.points[0].id.key = 0)
  52840. }
  52841. var le = new P,
  52842. he = new P,
  52843. ce = new P;
  52844. function ue(e, r, s, o, a) {
  52845. e.pointCount = 0;
  52846. for (var l = V.MulXV(a, o.m_p, le), h = V.MulTXV(s, l, he), c = 0, u = -i, _ = r.m_radius + o.m_radius, f = r.m_count, d = r.m_vertices, p = r.m_normals, m = 0; m < f; ++m) {
  52847. var y = P.DotVV(p[m], P.SubVV(h, d[m], P.s_t0));
  52848. if (y > _) return;
  52849. y > u && (u = y, c = m)
  52850. }
  52851. var v = c,
  52852. g = (v + 1) % f,
  52853. x = d[v],
  52854. b = d[g];
  52855. if (u < n) return e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, e.localNormal.Copy(p[c]), P.MidVV(x, b, e.localPoint), e.points[0].localPoint.Copy(o.m_p), void(e.points[0].id.key = 0);
  52856. var A = P.DotVV(P.SubVV(h, x, P.s_t0), P.SubVV(b, x, P.s_t1)),
  52857. C = P.DotVV(P.SubVV(h, b, P.s_t0), P.SubVV(x, b, P.s_t1));
  52858. if (A <= 0) {
  52859. if (P.DistanceSquaredVV(h, x) > _ * _) return;
  52860. e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, P.SubVV(h, x, e.localNormal).SelfNormalize(), e.localPoint.Copy(x), e.points[0].localPoint.Copy(o.m_p), e.points[0].id.key = 0
  52861. } else if (C <= 0) {
  52862. if (P.DistanceSquaredVV(h, b) > _ * _) return;
  52863. e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, P.SubVV(h, b, e.localNormal).SelfNormalize(), e.localPoint.Copy(b), e.points[0].localPoint.Copy(o.m_p), e.points[0].id.key = 0
  52864. } else {
  52865. var T = P.MidVV(x, b, ce);
  52866. if (P.DotVV(P.SubVV(h, T, P.s_t1), p[v]) > _) return;
  52867. e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, e.localNormal.Copy(p[v]).SelfNormalize(), e.localPoint.Copy(T), e.points[0].localPoint.Copy(o.m_p), e.points[0].id.key = 0
  52868. }
  52869. }
  52870. var _e = new P,
  52871. fe = new P,
  52872. de = new P,
  52873. pe = new P;
  52874. function me(t, e, n, r, s) {
  52875. for (var o = t.m_vertices, a = t.m_normals, l = r.m_count, h = r.m_vertices, c = N.MulRV(e.q, a[n], _e), u = N.MulTRV(s.q, c, fe), _ = 0, f = i, d = 0; d < l; ++d) {
  52876. var p = P.DotVV(h[d], u);
  52877. p < f && (f = p, _ = d)
  52878. }
  52879. var m = V.MulXV(e, o[n], de),
  52880. y = V.MulXV(s, h[_], pe);
  52881. return P.DotVV(P.SubVV(y, m, P.s_t0), c)
  52882. }
  52883. var ye = new P,
  52884. ve = new P;
  52885. function ge(t, e, n, r, s) {
  52886. for (var o = e.m_count, a = e.m_normals, l = P.SubVV(V.MulXV(s, r.m_centroid, P.s_t0), V.MulXV(n, e.m_centroid, P.s_t1), ye), h = N.MulTRV(n.q, l, ve), c = 0, u = -i, _ = 0; _ < o; ++_) {
  52887. var f = P.DotVV(a[_], h);
  52888. f > u && (u = f, c = _)
  52889. }
  52890. var d = me(e, n, c, r, s),
  52891. p = (c + o - 1) % o,
  52892. m = me(e, n, p, r, s),
  52893. y = (c + 1) % o,
  52894. v = me(e, n, y, r, s),
  52895. g = 0,
  52896. x = 0,
  52897. b = 0;
  52898. if (m > d && m > v) b = -1, g = p, x = m;
  52899. else {
  52900. if (!(v > d)) return t[0] = c, d;
  52901. b = 1, g = y, x = v
  52902. }
  52903. for (;
  52904. (d = me(e, n, c = -1 === b ? (g + o - 1) % o : (g + 1) % o, r, s)) > x;) g = c, x = d;
  52905. return t[0] = g, x
  52906. }
  52907. var xe = new P;
  52908. function be(e, n, r, s, o, a) {
  52909. for (var l = n.m_normals, h = o.m_count, c = o.m_vertices, u = o.m_normals, _ = N.MulTRV(a.q, N.MulRV(r.q, l[s], P.s_t0), xe), f = 0, d = i, p = 0; p < h; ++p) {
  52910. var m = P.DotVV(_, u[p]);
  52911. m < d && (d = m, f = p)
  52912. }
  52913. var y = f,
  52914. v = (y + 1) % h,
  52915. g = e[0];
  52916. V.MulXV(a, c[y], g.v);
  52917. var x = g.id.cf;
  52918. x.indexA = s, x.indexB = y, x.typeA = t.b2ContactFeatureType.e_face, x.typeB = t.b2ContactFeatureType.e_vertex;
  52919. var b = e[1];
  52920. V.MulXV(a, c[v], b.v);
  52921. var A = b.id.cf;
  52922. A.indexA = s, A.indexB = v, A.typeA = t.b2ContactFeatureType.e_face, A.typeB = t.b2ContactFeatureType.e_vertex
  52923. }
  52924. var Ae = Ct.MakeArray(2),
  52925. Ce = Ct.MakeArray(2),
  52926. Te = Ct.MakeArray(2),
  52927. Se = [0],
  52928. we = [0],
  52929. Ee = new P,
  52930. Me = new P,
  52931. De = new P,
  52932. Be = new P,
  52933. Ie = new P,
  52934. Pe = new P,
  52935. Re = new P,
  52936. Oe = new P;
  52937. function Le(e, i, n, r, s) {
  52938. e.pointCount = 0;
  52939. var a = i.m_radius + r.m_radius,
  52940. l = Se;
  52941. l[0] = 0;
  52942. var h = ge(l, i, n, r, s);
  52943. if (!(h > a)) {
  52944. var c = we;
  52945. c[0] = 0;
  52946. var u = ge(c, r, s, i, n);
  52947. if (!(u > a)) {
  52948. var _, f, d, p, m = 0,
  52949. y = 0;
  52950. u > .98 * h + .001 ? (_ = r, f = i, d = s, p = n, m = c[0], e.type = t.b2ManifoldType.e_faceB, y = 1) : (_ = i, f = r, d = n, p = s, m = l[0], e.type = t.b2ManifoldType.e_faceA, y = 0);
  52951. var v = Ae;
  52952. be(v, _, d, m, f, p);
  52953. var g = _.m_count,
  52954. x = _.m_vertices,
  52955. b = m,
  52956. A = (m + 1) % g,
  52957. C = x[b],
  52958. T = x[A],
  52959. S = P.SubVV(T, C, Ee);
  52960. S.Normalize();
  52961. var w = P.CrossVOne(S, Me),
  52962. E = P.MidVV(C, T, De),
  52963. M = N.MulRV(d.q, S, Ie),
  52964. D = P.CrossVOne(M, Be),
  52965. B = V.MulXV(d, C, Re),
  52966. I = V.MulXV(d, T, Oe),
  52967. R = P.DotVV(D, B),
  52968. O = -P.DotVV(M, B) + a,
  52969. L = P.DotVV(M, I) + a,
  52970. F = Ce,
  52971. k = Te;
  52972. if (!(Mt(F, v, P.NegV(M, Pe), O, b) < 2 || Mt(k, F, M, L, A) < 2)) {
  52973. e.localNormal.Copy(w), e.localPoint.Copy(E);
  52974. for (var G = 0, U = 0; U < o; ++U) {
  52975. var z = k[U];
  52976. if (P.DotVV(D, z.v) - R <= a) {
  52977. var j = e.points[G];
  52978. if (V.MulTXV(p, z.v, j.localPoint), j.id.Copy(z.id), y) {
  52979. var W = j.id.cf;
  52980. j.id.cf.indexA = W.indexB, j.id.cf.indexB = W.indexA, j.id.cf.typeA = W.typeB, j.id.cf.typeB = W.typeA
  52981. }++G
  52982. }
  52983. }
  52984. e.pointCount = G
  52985. }
  52986. }
  52987. }
  52988. }
  52989. var Fe = new P,
  52990. Ne = new P,
  52991. Ve = new P,
  52992. ke = new P,
  52993. Ge = new P,
  52994. Ue = new P,
  52995. ze = new P,
  52996. je = new gt;
  52997. function We(e, i, n, r, s) {
  52998. e.pointCount = 0;
  52999. var o = V.MulTXV(n, V.MulXV(s, r.m_p, P.s_t0), Fe),
  53000. a = i.m_vertex1,
  53001. l = i.m_vertex2,
  53002. h = P.SubVV(l, a, Ne),
  53003. c = P.DotVV(h, P.SubVV(l, o, P.s_t0)),
  53004. u = P.DotVV(h, P.SubVV(o, a, P.s_t0)),
  53005. _ = i.m_radius + r.m_radius,
  53006. f = je;
  53007. if (f.cf.indexB = 0, f.cf.typeB = t.b2ContactFeatureType.e_vertex, u <= 0) {
  53008. var d = a,
  53009. p = P.SubVV(o, d, Ve);
  53010. if (P.DotVV(p, p) > _ * _) return;
  53011. if (i.m_hasVertex0) {
  53012. var m = i.m_vertex0,
  53013. y = a,
  53014. v = P.SubVV(y, m, ke);
  53015. if (P.DotVV(v, P.SubVV(y, o, P.s_t0)) > 0) return
  53016. }
  53017. return f.cf.indexA = 0, f.cf.typeA = t.b2ContactFeatureType.e_vertex, e.pointCount = 1, e.type = t.b2ManifoldType.e_circles, e.localNormal.SetZero(), e.localPoint.Copy(d), e.points[0].id.Copy(f), void e.points[0].localPoint.Copy(r.m_p)
  53018. }
  53019. if (c <= 0) {
  53020. var g = l,
  53021. x = P.SubVV(o, g, Ve);
  53022. if (P.DotVV(x, x) > _ * _) return;
  53023. if (i.m_hasVertex3) {
  53024. var b = i.m_vertex3,
  53025. A = l,
  53026. C = P.SubVV(b, A, Ge);
  53027. if (P.DotVV(C, P.SubVV(o, A, P.s_t0)) > 0) return
  53028. }
  53029. return f.cf.indexA = 1, f.cf.typeA = t.b2ContactFeatureType.e_vertex, e.pointCount = 1, e.type = t.b2ManifoldType.e_circles, e.localNormal.SetZero(), e.localPoint.Copy(g), e.points[0].id.Copy(f), void e.points[0].localPoint.Copy(r.m_p)
  53030. }
  53031. var T = P.DotVV(h, h),
  53032. S = Ue;
  53033. S.x = 1 / T * (c * a.x + u * l.x), S.y = 1 / T * (c * a.y + u * l.y);
  53034. var w = P.SubVV(o, S, Ve);
  53035. if (!(P.DotVV(w, w) > _ * _)) {
  53036. var E = ze.Set(-h.y, h.x);
  53037. P.DotVV(E, P.SubVV(o, a, P.s_t0)) < 0 && E.Set(-E.x, -E.y), E.Normalize(), f.cf.indexA = 0, f.cf.typeA = t.b2ContactFeatureType.e_face, e.pointCount = 1, e.type = t.b2ManifoldType.e_faceA, e.localNormal.Copy(E), e.localPoint.Copy(a), e.points[0].id.Copy(f), e.points[0].localPoint.Copy(r.m_p)
  53038. }
  53039. }
  53040. var He = (function() {
  53041. return function() {
  53042. this.type = 0, this.index = 0, this.separation = 0
  53043. }
  53044. })(),
  53045. Xe = (function() {
  53046. return function() {
  53047. this.vertices = P.MakeArray(a), this.normals = P.MakeArray(a), this.count = 0
  53048. }
  53049. })(),
  53050. Ye = (function() {
  53051. return function() {
  53052. this.i1 = 0, this.i2 = 0, this.v1 = new P, this.v2 = new P, this.normal = new P, this.sideNormal1 = new P, this.sideOffset1 = 0, this.sideNormal2 = new P, this.sideOffset2 = 0
  53053. }
  53054. })(),
  53055. qe = new(function() {
  53056. function e() {
  53057. this.m_polygonB = new Xe, this.m_xf = new V, this.m_centroidB = new P, this.m_v0 = new P, this.m_v1 = new P, this.m_v2 = new P, this.m_v3 = new P, this.m_normal0 = new P, this.m_normal1 = new P, this.m_normal2 = new P, this.m_normal = new P, this.m_type1 = 0, this.m_type2 = 0, this.m_lowerLimit = new P, this.m_upperLimit = new P, this.m_radius = 0, this.m_front = !1
  53058. }
  53059. return e.prototype.Collide = function(i, n, r, s, a) {
  53060. V.MulTXX(r, a, this.m_xf), V.MulXV(this.m_xf, s.m_centroid, this.m_centroidB), this.m_v0.Copy(n.m_vertex0), this.m_v1.Copy(n.m_vertex1), this.m_v2.Copy(n.m_vertex2), this.m_v3.Copy(n.m_vertex3);
  53061. var l = n.m_hasVertex0,
  53062. h = n.m_hasVertex3,
  53063. c = P.SubVV(this.m_v2, this.m_v1, e.s_edge1);
  53064. c.Normalize(), this.m_normal1.Set(c.y, -c.x);
  53065. var u = P.DotVV(this.m_normal1, P.SubVV(this.m_centroidB, this.m_v1, P.s_t0)),
  53066. _ = 0,
  53067. f = 0,
  53068. d = !1,
  53069. p = !1;
  53070. if (l) {
  53071. var m = P.SubVV(this.m_v1, this.m_v0, e.s_edge0);
  53072. m.Normalize(), this.m_normal0.Set(m.y, -m.x), d = P.CrossVV(m, c) >= 0, _ = P.DotVV(this.m_normal0, P.SubVV(this.m_centroidB, this.m_v0, P.s_t0))
  53073. }
  53074. if (h) {
  53075. var y = P.SubVV(this.m_v3, this.m_v2, e.s_edge2);
  53076. y.Normalize(), this.m_normal2.Set(y.y, -y.x), p = P.CrossVV(c, y) > 0, f = P.DotVV(this.m_normal2, P.SubVV(this.m_centroidB, this.m_v2, P.s_t0))
  53077. }
  53078. l && h ? d && p ? (this.m_front = _ >= 0 || u >= 0 || f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal0), this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : d ? (this.m_front = _ >= 0 || u >= 0 && f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal0), this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : p ? (this.m_front = f >= 0 || _ >= 0 && u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : (this.m_front = _ >= 0 && u >= 0 && f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : l ? d ? (this.m_front = _ >= 0 || u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal0), this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : (this.m_front = _ >= 0 && u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : h ? p ? (this.m_front = u >= 0 || f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1))) : (this.m_front = u >= 0 && f >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1))) : (this.m_front = u >= 0, this.m_front ? (this.m_normal.Copy(this.m_normal1), this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), this.m_lowerLimit.Copy(this.m_normal1), this.m_upperLimit.Copy(this.m_normal1))), this.m_polygonB.count = s.m_count;
  53079. for (var v = 0; v < s.m_count; ++v) V.MulXV(this.m_xf, s.m_vertices[v], this.m_polygonB.vertices[v]), N.MulRV(this.m_xf.q, s.m_normals[v], this.m_polygonB.normals[v]);
  53080. this.m_radius = s.m_radius + n.m_radius, i.pointCount = 0;
  53081. var g = this.ComputeEdgeSeparation(e.s_edgeAxis);
  53082. if (0 !== g.type && !(g.separation > this.m_radius)) {
  53083. var x = this.ComputePolygonSeparation(e.s_polygonAxis);
  53084. if (!(0 !== x.type && x.separation > this.m_radius)) {
  53085. var b;
  53086. b = 0 === x.type ? g : x.separation > .98 * g.separation + .001 ? x : g;
  53087. var A = e.s_ie,
  53088. C = e.s_rf;
  53089. if (1 === b.type) {
  53090. i.type = t.b2ManifoldType.e_faceA;
  53091. var T = 0,
  53092. S = P.DotVV(this.m_normal, this.m_polygonB.normals[0]);
  53093. for (v = 1; v < this.m_polygonB.count; ++v) {
  53094. var w = P.DotVV(this.m_normal, this.m_polygonB.normals[v]);
  53095. w < S && (S = w, T = v)
  53096. }
  53097. var E = T,
  53098. M = (E + 1) % this.m_polygonB.count;
  53099. (D = A[0]).v.Copy(this.m_polygonB.vertices[E]), D.id.cf.indexA = 0, D.id.cf.indexB = E, D.id.cf.typeA = t.b2ContactFeatureType.e_face, D.id.cf.typeB = t.b2ContactFeatureType.e_vertex, (B = A[1]).v.Copy(this.m_polygonB.vertices[M]), B.id.cf.indexA = 0, B.id.cf.indexB = M, B.id.cf.typeA = t.b2ContactFeatureType.e_face, B.id.cf.typeB = t.b2ContactFeatureType.e_vertex, this.m_front ? (C.i1 = 0, C.i2 = 1, C.v1.Copy(this.m_v1), C.v2.Copy(this.m_v2), C.normal.Copy(this.m_normal1)) : (C.i1 = 1, C.i2 = 0, C.v1.Copy(this.m_v2), C.v2.Copy(this.m_v1), C.normal.Copy(this.m_normal1).SelfNeg())
  53100. } else {
  53101. var D, B;
  53102. i.type = t.b2ManifoldType.e_faceB, (D = A[0]).v.Copy(this.m_v1), D.id.cf.indexA = 0, D.id.cf.indexB = b.index, D.id.cf.typeA = t.b2ContactFeatureType.e_vertex, D.id.cf.typeB = t.b2ContactFeatureType.e_face, (B = A[1]).v.Copy(this.m_v2), B.id.cf.indexA = 0, B.id.cf.indexB = b.index, B.id.cf.typeA = t.b2ContactFeatureType.e_vertex, B.id.cf.typeB = t.b2ContactFeatureType.e_face, C.i1 = b.index, C.i2 = (C.i1 + 1) % this.m_polygonB.count, C.v1.Copy(this.m_polygonB.vertices[C.i1]), C.v2.Copy(this.m_polygonB.vertices[C.i2]), C.normal.Copy(this.m_polygonB.normals[C.i1])
  53103. }
  53104. C.sideNormal1.Set(C.normal.y, -C.normal.x), C.sideNormal2.Copy(C.sideNormal1).SelfNeg(), C.sideOffset1 = P.DotVV(C.sideNormal1, C.v1), C.sideOffset2 = P.DotVV(C.sideNormal2, C.v2);
  53105. var I = e.s_clipPoints1,
  53106. R = e.s_clipPoints2;
  53107. if (!(Mt(I, A, C.sideNormal1, C.sideOffset1, C.i1) < o || Mt(R, I, C.sideNormal2, C.sideOffset2, C.i2) < o)) {
  53108. 1 === b.type ? (i.localNormal.Copy(C.normal), i.localPoint.Copy(C.v1)) : (i.localNormal.Copy(s.m_normals[C.i1]), i.localPoint.Copy(s.m_vertices[C.i1]));
  53109. var O = 0;
  53110. for (v = 0; v < o; ++v) {
  53111. if (P.DotVV(C.normal, P.SubVV(R[v].v, C.v1, P.s_t0)) <= this.m_radius) {
  53112. var L = i.points[O];
  53113. 1 === b.type ? (V.MulTXV(this.m_xf, R[v].v, L.localPoint), L.id = R[v].id) : (L.localPoint.Copy(R[v].v), L.id.cf.typeA = R[v].id.cf.typeB, L.id.cf.typeB = R[v].id.cf.typeA, L.id.cf.indexA = R[v].id.cf.indexB, L.id.cf.indexB = R[v].id.cf.indexA), ++O
  53114. }
  53115. }
  53116. i.pointCount = O
  53117. }
  53118. }
  53119. }
  53120. }, e.prototype.ComputeEdgeSeparation = function(t) {
  53121. var e = t;
  53122. e.type = 1, e.index = this.m_front ? 0 : 1, e.separation = i;
  53123. for (var n = 0; n < this.m_polygonB.count; ++n) {
  53124. var r = P.DotVV(this.m_normal, P.SubVV(this.m_polygonB.vertices[n], this.m_v1, P.s_t0));
  53125. r < e.separation && (e.separation = r)
  53126. }
  53127. return e
  53128. }, e.prototype.ComputePolygonSeparation = function(t) {
  53129. var n = t;
  53130. n.type = 0, n.index = -1, n.separation = -i;
  53131. for (var r = e.s_perp.Set(-this.m_normal.y, this.m_normal.x), s = 0; s < this.m_polygonB.count; ++s) {
  53132. var o = P.NegV(this.m_polygonB.normals[s], e.s_n),
  53133. a = P.DotVV(o, P.SubVV(this.m_polygonB.vertices[s], this.m_v1, P.s_t0)),
  53134. l = P.DotVV(o, P.SubVV(this.m_polygonB.vertices[s], this.m_v2, P.s_t0)),
  53135. c = g(a, l);
  53136. if (c > this.m_radius) return n.type = 2, n.index = s, n.separation = c, n;
  53137. if (P.DotVV(o, r) >= 0) {
  53138. if (P.DotVV(P.SubVV(o, this.m_upperLimit, P.s_t0), this.m_normal) < -h) continue
  53139. } else if (P.DotVV(P.SubVV(o, this.m_lowerLimit, P.s_t0), this.m_normal) < -h) continue;
  53140. c > n.separation && (n.type = 2, n.index = s, n.separation = c)
  53141. }
  53142. return n
  53143. }, e.s_edge1 = new P, e.s_edge0 = new P, e.s_edge2 = new P, e.s_ie = Ct.MakeArray(2), e.s_rf = new Ye, e.s_clipPoints1 = Ct.MakeArray(2), e.s_clipPoints2 = Ct.MakeArray(2), e.s_edgeAxis = new He, e.s_polygonAxis = new He, e.s_n = new P, e.s_perp = new P, e
  53144. }());
  53145. function Je(t, e, i, n, r) {
  53146. qe.Collide(t, e, i, n, r)
  53147. }
  53148. var Ze = (function() {
  53149. return function() {
  53150. this.mass = 0, this.center = new P(0, 0), this.I = 0
  53151. }
  53152. })();
  53153. (function(t) {
  53154. t[t.e_unknown = -1] = "e_unknown", t[t.e_circleShape = 0] = "e_circleShape", t[t.e_edgeShape = 1] = "e_edgeShape", t[t.e_polygonShape = 2] = "e_polygonShape", t[t.e_chainShape = 3] = "e_chainShape", t[t.e_shapeTypeCount = 4] = "e_shapeTypeCount"
  53155. })(t.b2ShapeType || (t.b2ShapeType = {}));
  53156. var Ke = (function() {
  53157. function e(e, i) {
  53158. this.m_type = t.b2ShapeType.e_unknown, this.m_radius = 0, this.m_type = e, this.m_radius = i
  53159. }
  53160. return e.prototype.Copy = function(t) {
  53161. return this.m_radius = t.m_radius, this
  53162. }, e.prototype.GetType = function() {
  53163. return this.m_type
  53164. }, e
  53165. })(),
  53166. Qe = Object.setPrototypeOf || {
  53167. __proto__: []
  53168. }
  53169. instanceof Array && function(t, e) {
  53170. t.__proto__ = e
  53171. } || function(t, e) {
  53172. for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
  53173. };
  53174. function $e(t, e) {
  53175. function i() {
  53176. this.constructor = t
  53177. }
  53178. Qe(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i)
  53179. }
  53180. var ti = (function(e) {
  53181. function i(i) {
  53182. void 0 === i && (i = 0);
  53183. var n = e.call(this, t.b2ShapeType.e_circleShape, i) || this;
  53184. return n.m_p = new P, n
  53185. }
  53186. return $e(i, e), i.prototype.Set = function(t, e) {
  53187. return void 0 === e && (e = this.m_radius), this.m_p.Copy(t), this.m_radius = e, this
  53188. }, i.prototype.Clone = function() {
  53189. return (new i).Copy(this)
  53190. }, i.prototype.Copy = function(t) {
  53191. return e.prototype.Copy.call(this, t), this.m_p.Copy(t.m_p), this
  53192. }, i.prototype.GetChildCount = function() {
  53193. return 1
  53194. }, i.prototype.TestPoint = function(t, e) {
  53195. var n = V.MulXV(t, this.m_p, i.TestPoint_s_center),
  53196. r = P.SubVV(e, n, i.TestPoint_s_d);
  53197. return P.DotVV(r, r) <= C(this.m_radius)
  53198. }, i.prototype.ComputeDistance = function(t, e, n, r) {
  53199. var s = V.MulXV(t, this.m_p, i.ComputeDistance_s_center);
  53200. return P.SubVV(e, s, n), n.Normalize() - this.m_radius
  53201. }, i.prototype.RayCast = function(t, e, r, s) {
  53202. var o = V.MulXV(r, this.m_p, i.RayCast_s_position),
  53203. a = P.SubVV(e.p1, o, i.RayCast_s_s),
  53204. l = P.DotVV(a, a) - C(this.m_radius),
  53205. h = P.SubVV(e.p2, e.p1, i.RayCast_s_r),
  53206. c = P.DotVV(a, h),
  53207. u = P.DotVV(h, h),
  53208. _ = c * c - u * l;
  53209. if (_ < 0 || u < n) return !1;
  53210. var f = -(c + S(_));
  53211. return 0 <= f && f <= e.maxFraction * u && (f /= u, t.fraction = f, P.AddVMulSV(a, f, h, t.normal).SelfNormalize(), !0)
  53212. }, i.prototype.ComputeAABB = function(t, e, n) {
  53213. var r = V.MulXV(e, this.m_p, i.ComputeAABB_s_p);
  53214. t.lowerBound.Set(r.x - this.m_radius, r.y - this.m_radius), t.upperBound.Set(r.x + this.m_radius, r.y + this.m_radius)
  53215. }, i.prototype.ComputeMass = function(t, e) {
  53216. var i = C(this.m_radius);
  53217. t.mass = e * s * i, t.center.Copy(this.m_p), t.I = t.mass * (.5 * i + P.DotVV(this.m_p, this.m_p))
  53218. }, i.prototype.SetupDistanceProxy = function(t, e) {
  53219. t.m_vertices = t.m_buffer, t.m_vertices[0].Copy(this.m_p), t.m_count = 1, t.m_radius = this.m_radius
  53220. }, i.prototype.ComputeSubmergedArea = function(t, e, i, r) {
  53221. var o = V.MulXV(i, this.m_p, new P),
  53222. a = -(P.DotVV(t, o) - e);
  53223. if (a < -this.m_radius + n) return 0;
  53224. if (a > this.m_radius) return r.Copy(o), s * this.m_radius * this.m_radius;
  53225. var l = this.m_radius * this.m_radius,
  53226. h = a * a,
  53227. c = l * (B(a / this.m_radius) + s / 2) + a * S(l - h),
  53228. u = -2 / 3 * w(l - h, 1.5) / c;
  53229. return r.x = o.x + t.x * u, r.y = o.y + t.y * u, c
  53230. }, i.prototype.Dump = function(t) {
  53231. t(" const shape: b2CircleShape = new b2CircleShape();\n"), t(" shape.m_radius = %.15f;\n", this.m_radius), t(" shape.m_p.Set(%.15f, %.15f);\n", this.m_p.x, this.m_p.y)
  53232. }, i.TestPoint_s_center = new P, i.TestPoint_s_d = new P, i.ComputeDistance_s_center = new P, i.RayCast_s_position = new P, i.RayCast_s_s = new P, i.RayCast_s_r = new P, i.ComputeAABB_s_p = new P, i
  53233. })(Ke),
  53234. ei = (function(e) {
  53235. function r() {
  53236. var i = e.call(this, t.b2ShapeType.e_polygonShape, c) || this;
  53237. return i.m_centroid = new P(0, 0), i.m_vertices = [], i.m_normals = [], i.m_count = 0, i
  53238. }
  53239. return $e(r, e), r.prototype.Clone = function() {
  53240. return (new r).Copy(this)
  53241. }, r.prototype.Copy = function(t) {
  53242. e.prototype.Copy.call(this, t), this.m_centroid.Copy(t.m_centroid), this.m_count = t.m_count, this.m_vertices = P.MakeArray(this.m_count), this.m_normals = P.MakeArray(this.m_count);
  53243. for (var i = 0; i < this.m_count; ++i) this.m_vertices[i].Copy(t.m_vertices[i]), this.m_normals[i].Copy(t.m_normals[i]);
  53244. return this
  53245. }, r.prototype.GetChildCount = function() {
  53246. return 1
  53247. }, r.prototype.Set = function(t, e, i) {
  53248. if (void 0 === e && (e = t.length), void 0 === i && (i = 0), e < 3) return this.SetAsBox(1, 1);
  53249. for (var n = g(e, a), s = r.Set_s_ps, o = 0, h = 0; h < n; ++h) {
  53250. for (var c = t[i + h], u = !0, _ = 0; _ < o; ++_)
  53251. if (P.DistanceSquaredVV(c, s[_]) < .5 * l * (.5 * l)) {
  53252. u = !1;
  53253. break
  53254. }
  53255. u && s[o++].Copy(c)
  53256. }
  53257. if ((n = o) < 3) return this.SetAsBox(1, 1);
  53258. var f = 0,
  53259. d = s[0].x;
  53260. for (h = 1; h < n; ++h) {
  53261. var p = s[h].x;
  53262. (p > d || p === d && s[h].y < s[f].y) && (f = h, d = p)
  53263. }
  53264. for (var m = r.Set_s_hull, y = 0, v = f;;) {
  53265. m[y] = v;
  53266. var x = 0;
  53267. for (_ = 1; _ < n; ++_)
  53268. if (x !== v) {
  53269. var b = P.SubVV(s[x], s[m[y]], r.Set_s_r),
  53270. A = (c = P.SubVV(s[_], s[m[y]], r.Set_s_v), P.CrossVV(b, c));
  53271. A < 0 && (x = _), 0 === A && c.LengthSquared() > b.LengthSquared() && (x = _)
  53272. } else x = _;
  53273. if (++y, v = x, x === f) break
  53274. }
  53275. this.m_count = y, this.m_vertices = P.MakeArray(this.m_count), this.m_normals = P.MakeArray(this.m_count);
  53276. for (h = 0; h < y; ++h) this.m_vertices[h].Copy(s[m[h]]);
  53277. for (h = 0; h < y; ++h) {
  53278. var C = this.m_vertices[h],
  53279. T = this.m_vertices[(h + 1) % y],
  53280. S = P.SubVV(T, C, P.s_t0);
  53281. P.CrossVOne(S, this.m_normals[h]).SelfNormalize()
  53282. }
  53283. return r.ComputeCentroid(this.m_vertices, y, this.m_centroid), this
  53284. }, r.prototype.SetAsArray = function(t, e) {
  53285. return void 0 === e && (e = t.length), this.Set(t, e)
  53286. }, r.prototype.SetAsBox = function(t, e, i, n) {
  53287. if (void 0 === n && (n = 0), this.m_count = 4, this.m_vertices = P.MakeArray(this.m_count), this.m_normals = P.MakeArray(this.m_count), this.m_vertices[0].Set(-t, -e), this.m_vertices[1].Set(t, -e), this.m_vertices[2].Set(t, e), this.m_vertices[3].Set(-t, e), this.m_normals[0].Set(0, -1), this.m_normals[1].Set(1, 0), this.m_normals[2].Set(0, 1), this.m_normals[3].Set(-1, 0), this.m_centroid.SetZero(), i) {
  53288. this.m_centroid.Copy(i);
  53289. var r = new V;
  53290. r.SetPosition(i), r.SetRotationAngle(n);
  53291. for (var s = 0; s < this.m_count; ++s) V.MulXV(r, this.m_vertices[s], this.m_vertices[s]), N.MulRV(r.q, this.m_normals[s], this.m_normals[s])
  53292. }
  53293. return this
  53294. }, r.prototype.TestPoint = function(t, e) {
  53295. for (var i = V.MulTXV(t, e, r.TestPoint_s_pLocal), n = 0; n < this.m_count; ++n) {
  53296. if (P.DotVV(this.m_normals[n], P.SubVV(i, this.m_vertices[n], P.s_t0)) > 0) return !1
  53297. }
  53298. return !0
  53299. }, r.prototype.ComputeDistance = function(t, e, n, s) {
  53300. for (var o = V.MulTXV(t, e, r.ComputeDistance_s_pLocal), a = -i, l = r.ComputeDistance_s_normalForMaxDistance.Copy(o), h = 0; h < this.m_count; ++h) {
  53301. var c = P.DotVV(this.m_normals[h], P.SubVV(o, this.m_vertices[h], P.s_t0));
  53302. c > a && (a = c, l.Copy(this.m_normals[h]))
  53303. }
  53304. if (a > 0) {
  53305. var u = r.ComputeDistance_s_minDistance.Copy(l),
  53306. _ = a * a;
  53307. for (h = 0; h < this.m_count; ++h) {
  53308. var f = P.SubVV(o, this.m_vertices[h], r.ComputeDistance_s_distance),
  53309. d = f.LengthSquared();
  53310. _ > d && (u.Copy(f), _ = d)
  53311. }
  53312. return N.MulRV(t.q, u, n), n.Normalize(), Math.sqrt(_)
  53313. }
  53314. return N.MulRV(t.q, l, n), a
  53315. }, r.prototype.RayCast = function(t, e, i, n) {
  53316. for (var s = V.MulTXV(i, e.p1, r.RayCast_s_p1), o = V.MulTXV(i, e.p2, r.RayCast_s_p2), a = P.SubVV(o, s, r.RayCast_s_d), l = 0, h = e.maxFraction, c = -1, u = 0; u < this.m_count; ++u) {
  53317. var _ = P.DotVV(this.m_normals[u], P.SubVV(this.m_vertices[u], s, P.s_t0)),
  53318. f = P.DotVV(this.m_normals[u], a);
  53319. if (0 === f) {
  53320. if (_ < 0) return !1
  53321. } else f < 0 && _ < l * f ? (l = _ / f, c = u) : f > 0 && _ < h * f && (h = _ / f);
  53322. if (h < l) return !1
  53323. }
  53324. return c >= 0 && (t.fraction = l, N.MulRV(i.q, this.m_normals[c], t.normal), !0)
  53325. }, r.prototype.ComputeAABB = function(t, e, i) {
  53326. for (var n = V.MulXV(e, this.m_vertices[0], t.lowerBound), s = t.upperBound.Copy(n), o = 0; o < this.m_count; ++o) {
  53327. var a = V.MulXV(e, this.m_vertices[o], r.ComputeAABB_s_v);
  53328. P.MinV(a, n, n), P.MaxV(a, s, s)
  53329. }
  53330. var l = this.m_radius;
  53331. n.SelfSubXY(l, l), s.SelfAddXY(l, l)
  53332. }, r.prototype.ComputeMass = function(t, e) {
  53333. for (var i = r.ComputeMass_s_center.SetZero(), n = 0, s = 0, o = r.ComputeMass_s_s.SetZero(), a = 0; a < this.m_count; ++a) o.SelfAdd(this.m_vertices[a]);
  53334. o.SelfMul(1 / this.m_count);
  53335. for (a = 0; a < this.m_count; ++a) {
  53336. var l = P.SubVV(this.m_vertices[a], o, r.ComputeMass_s_e1),
  53337. h = P.SubVV(this.m_vertices[(a + 1) % this.m_count], o, r.ComputeMass_s_e2),
  53338. c = P.CrossVV(l, h),
  53339. u = .5 * c;
  53340. n += u, i.SelfAdd(P.MulSV(u * (1 / 3), P.AddVV(l, h, P.s_t0), P.s_t1));
  53341. var _ = l.x,
  53342. f = l.y,
  53343. d = h.x,
  53344. p = h.y;
  53345. s += 1 / 3 * .25 * c * (_ * _ + d * _ + d * d + (f * f + p * f + p * p))
  53346. }
  53347. t.mass = e * n, i.SelfMul(1 / n), P.AddVV(i, o, t.center), t.I = e * s, t.I += t.mass * (P.DotVV(t.center, t.center) - P.DotVV(i, i))
  53348. }, r.prototype.Validate = function() {
  53349. for (var t = 0; t < this.m_count; ++t)
  53350. for (var e = t, i = (t + 1) % this.m_count, n = this.m_vertices[e], s = P.SubVV(this.m_vertices[i], n, r.Validate_s_e), o = 0; o < this.m_count; ++o)
  53351. if (o !== e && o !== i) {
  53352. var a = P.SubVV(this.m_vertices[o], n, r.Validate_s_v);
  53353. if (P.CrossVV(s, a) < 0) return !1
  53354. }
  53355. return !0
  53356. }, r.prototype.SetupDistanceProxy = function(t, e) {
  53357. t.m_vertices = this.m_vertices, t.m_count = this.m_count, t.m_radius = this.m_radius
  53358. }, r.prototype.ComputeSubmergedArea = function(t, e, i, s) {
  53359. for (var o = N.MulTRV(i.q, t, r.ComputeSubmergedArea_s_normalL), a = e - P.DotVV(t, i.p), l = r.ComputeSubmergedArea_s_depths, h = 0, c = -1, u = -1, _ = !1, f = 0; f < this.m_count; ++f) {
  53360. l[f] = P.DotVV(o, this.m_vertices[f]) - a;
  53361. var d = l[f] < -n;
  53362. f > 0 && (d ? _ || (c = f - 1, h++) : _ && (u = f - 1, h++)), _ = d
  53363. }
  53364. switch (h) {
  53365. case 0:
  53366. if (_) {
  53367. var p = r.ComputeSubmergedArea_s_md;
  53368. return this.ComputeMass(p, 1), V.MulXV(i, p.center, s), p.mass
  53369. }
  53370. return 0;
  53371. case 1:
  53372. -1 === c ? c = this.m_count - 1 : u = this.m_count - 1
  53373. }
  53374. for (var m, y = (c + 1) % this.m_count, v = (u + 1) % this.m_count, g = (0 - l[c]) / (l[y] - l[c]), x = (0 - l[u]) / (l[v] - l[u]), b = r.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[c].x * (1 - g) + this.m_vertices[y].x * g, this.m_vertices[c].y * (1 - g) + this.m_vertices[y].y * g), A = r.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[u].x * (1 - x) + this.m_vertices[v].x * x, this.m_vertices[u].y * (1 - x) + this.m_vertices[v].y * x), C = 0, T = r.ComputeSubmergedArea_s_center.SetZero(), S = this.m_vertices[y], w = y; w !== v;) {
  53375. m = (w = (w + 1) % this.m_count) === v ? A : this.m_vertices[w];
  53376. var E = .5 * ((S.x - b.x) * (m.y - b.y) - (S.y - b.y) * (m.x - b.x));
  53377. C += E, T.x += E * (b.x + S.x + m.x) / 3, T.y += E * (b.y + S.y + m.y) / 3, S = m
  53378. }
  53379. return T.SelfMul(1 / C), V.MulXV(i, T, s), C
  53380. }, r.prototype.Dump = function(t) {
  53381. t(" const shape: b2PolygonShape = new b2PolygonShape();\n"), t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", a);
  53382. for (var e = 0; e < this.m_count; ++e) t(" vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
  53383. t(" shape.Set(vs, %d);\n", this.m_count)
  53384. }, r.ComputeCentroid = function(t, e, i) {
  53385. var n = i;
  53386. n.SetZero();
  53387. for (var s = 0, o = r.ComputeCentroid_s_pRef.SetZero(), a = 0; a < e; ++a) {
  53388. var l = o,
  53389. h = t[a],
  53390. c = t[(a + 1) % e],
  53391. u = P.SubVV(h, l, r.ComputeCentroid_s_e1),
  53392. _ = P.SubVV(c, l, r.ComputeCentroid_s_e2),
  53393. f = .5 * P.CrossVV(u, _);
  53394. s += f, n.x += f * (1 / 3) * (l.x + h.x + c.x), n.y += f * (1 / 3) * (l.y + h.y + c.y)
  53395. }
  53396. return n.SelfMul(1 / s), n
  53397. }, r.Set_s_ps = P.MakeArray(a), r.Set_s_hull = p(a), r.Set_s_r = new P, r.Set_s_v = new P, r.TestPoint_s_pLocal = new P, r.ComputeDistance_s_pLocal = new P, r.ComputeDistance_s_normalForMaxDistance = new P, r.ComputeDistance_s_minDistance = new P, r.ComputeDistance_s_distance = new P, r.RayCast_s_p1 = new P, r.RayCast_s_p2 = new P, r.RayCast_s_d = new P, r.ComputeAABB_s_v = new P, r.ComputeMass_s_center = new P, r.ComputeMass_s_s = new P, r.ComputeMass_s_e1 = new P, r.ComputeMass_s_e2 = new P, r.Validate_s_e = new P, r.Validate_s_v = new P, r.ComputeSubmergedArea_s_normalL = new P, r.ComputeSubmergedArea_s_depths = p(a), r.ComputeSubmergedArea_s_md = new Ze, r.ComputeSubmergedArea_s_intoVec = new P, r.ComputeSubmergedArea_s_outoVec = new P, r.ComputeSubmergedArea_s_center = new P, r.ComputeCentroid_s_pRef = new P, r.ComputeCentroid_s_e1 = new P, r.ComputeCentroid_s_e2 = new P, r
  53398. })(Ke),
  53399. ii = (function(e) {
  53400. function i() {
  53401. var i = e.call(this, t.b2ShapeType.e_edgeShape, c) || this;
  53402. return i.m_vertex1 = new P, i.m_vertex2 = new P, i.m_vertex0 = new P, i.m_vertex3 = new P, i.m_hasVertex0 = !1, i.m_hasVertex3 = !1, i
  53403. }
  53404. return $e(i, e), i.prototype.Set = function(t, e) {
  53405. return this.m_vertex1.Copy(t), this.m_vertex2.Copy(e), this.m_hasVertex0 = !1, this.m_hasVertex3 = !1, this
  53406. }, i.prototype.Clone = function() {
  53407. return (new i).Copy(this)
  53408. }, i.prototype.Copy = function(t) {
  53409. return e.prototype.Copy.call(this, t), this.m_vertex1.Copy(t.m_vertex1), this.m_vertex2.Copy(t.m_vertex2), this.m_vertex0.Copy(t.m_vertex0), this.m_vertex3.Copy(t.m_vertex3), this.m_hasVertex0 = t.m_hasVertex0, this.m_hasVertex3 = t.m_hasVertex3, this
  53410. }, i.prototype.GetChildCount = function() {
  53411. return 1
  53412. }, i.prototype.TestPoint = function(t, e) {
  53413. return !1
  53414. }, i.prototype.ComputeDistance = function(t, e, n, r) {
  53415. var s = V.MulXV(t, this.m_vertex1, i.ComputeDistance_s_v1),
  53416. o = V.MulXV(t, this.m_vertex2, i.ComputeDistance_s_v2),
  53417. a = P.SubVV(e, s, i.ComputeDistance_s_d),
  53418. l = P.SubVV(o, s, i.ComputeDistance_s_s),
  53419. h = P.DotVV(a, l);
  53420. if (h > 0) {
  53421. var c = P.DotVV(l, l);
  53422. h > c ? P.SubVV(e, o, a) : a.SelfMulSub(h / c, l)
  53423. }
  53424. return n.Copy(a), n.Normalize()
  53425. }, i.prototype.RayCast = function(t, e, n, r) {
  53426. var s = V.MulTXV(n, e.p1, i.RayCast_s_p1),
  53427. o = V.MulTXV(n, e.p2, i.RayCast_s_p2),
  53428. a = P.SubVV(o, s, i.RayCast_s_d),
  53429. l = this.m_vertex1,
  53430. h = this.m_vertex2,
  53431. c = P.SubVV(h, l, i.RayCast_s_e),
  53432. u = t.normal.Set(c.y, -c.x).SelfNormalize(),
  53433. _ = P.DotVV(u, P.SubVV(l, s, P.s_t0)),
  53434. f = P.DotVV(u, a);
  53435. if (0 === f) return !1;
  53436. var d = _ / f;
  53437. if (d < 0 || e.maxFraction < d) return !1;
  53438. var p = P.AddVMulSV(s, d, a, i.RayCast_s_q),
  53439. m = P.SubVV(h, l, i.RayCast_s_r),
  53440. y = P.DotVV(m, m);
  53441. if (0 === y) return !1;
  53442. var v = P.DotVV(P.SubVV(p, l, P.s_t0), m) / y;
  53443. return !(v < 0 || 1 < v) && (t.fraction = d, N.MulRV(n.q, t.normal, t.normal), _ > 0 && t.normal.SelfNeg(), !0)
  53444. }, i.prototype.ComputeAABB = function(t, e, n) {
  53445. var r = V.MulXV(e, this.m_vertex1, i.ComputeAABB_s_v1),
  53446. s = V.MulXV(e, this.m_vertex2, i.ComputeAABB_s_v2);
  53447. P.MinV(r, s, t.lowerBound), P.MaxV(r, s, t.upperBound);
  53448. var o = this.m_radius;
  53449. t.lowerBound.SelfSubXY(o, o), t.upperBound.SelfAddXY(o, o)
  53450. }, i.prototype.ComputeMass = function(t, e) {
  53451. t.mass = 0, P.MidVV(this.m_vertex1, this.m_vertex2, t.center), t.I = 0
  53452. }, i.prototype.SetupDistanceProxy = function(t, e) {
  53453. t.m_vertices = t.m_buffer, t.m_vertices[0].Copy(this.m_vertex1), t.m_vertices[1].Copy(this.m_vertex2), t.m_count = 2, t.m_radius = this.m_radius
  53454. }, i.prototype.ComputeSubmergedArea = function(t, e, i, n) {
  53455. return n.SetZero(), 0
  53456. }, i.prototype.Dump = function(t) {
  53457. t(" const shape: b2EdgeShape = new b2EdgeShape();\n"), t(" shape.m_radius = %.15f;\n", this.m_radius), t(" shape.m_vertex0.Set(%.15f, %.15f);\n", this.m_vertex0.x, this.m_vertex0.y), t(" shape.m_vertex1.Set(%.15f, %.15f);\n", this.m_vertex1.x, this.m_vertex1.y), t(" shape.m_vertex2.Set(%.15f, %.15f);\n", this.m_vertex2.x, this.m_vertex2.y), t(" shape.m_vertex3.Set(%.15f, %.15f);\n", this.m_vertex3.x, this.m_vertex3.y), t(" shape.m_hasVertex0 = %s;\n", this.m_hasVertex0), t(" shape.m_hasVertex3 = %s;\n", this.m_hasVertex3)
  53458. }, i.ComputeDistance_s_v1 = new P, i.ComputeDistance_s_v2 = new P, i.ComputeDistance_s_d = new P, i.ComputeDistance_s_s = new P, i.RayCast_s_p1 = new P, i.RayCast_s_p2 = new P, i.RayCast_s_d = new P, i.RayCast_s_e = new P, i.RayCast_s_q = new P, i.RayCast_s_r = new P, i.ComputeAABB_s_v1 = new P, i.ComputeAABB_s_v2 = new P, i
  53459. })(Ke),
  53460. ni = (function(e) {
  53461. function i() {
  53462. var i = e.call(this, t.b2ShapeType.e_chainShape, c) || this;
  53463. return i.m_vertices = [], i.m_count = 0, i.m_prevVertex = new P, i.m_nextVertex = new P, i.m_hasPrevVertex = !1, i.m_hasNextVertex = !1, i
  53464. }
  53465. return $e(i, e), i.prototype.CreateLoop = function(t, e, i) {
  53466. if (void 0 === e && (e = t.length), void 0 === i && (i = 0), e < 3) return this;
  53467. this.m_count = e + 1, this.m_vertices = P.MakeArray(this.m_count);
  53468. for (var n = 0; n < e; ++n) this.m_vertices[n].Copy(t[i + n]);
  53469. return this.m_vertices[e].Copy(this.m_vertices[0]), this.m_prevVertex.Copy(this.m_vertices[this.m_count - 2]), this.m_nextVertex.Copy(this.m_vertices[1]), this.m_hasPrevVertex = !0, this.m_hasNextVertex = !0, this
  53470. }, i.prototype.CreateChain = function(t, e, i) {
  53471. void 0 === e && (e = t.length), void 0 === i && (i = 0), this.m_count = e, this.m_vertices = P.MakeArray(e);
  53472. for (var n = 0; n < e; ++n) this.m_vertices[n].Copy(t[i + n]);
  53473. return this.m_hasPrevVertex = !1, this.m_hasNextVertex = !1, this.m_prevVertex.SetZero(), this.m_nextVertex.SetZero(), this
  53474. }, i.prototype.SetPrevVertex = function(t) {
  53475. return this.m_prevVertex.Copy(t), this.m_hasPrevVertex = !0, this
  53476. }, i.prototype.SetNextVertex = function(t) {
  53477. return this.m_nextVertex.Copy(t), this.m_hasNextVertex = !0, this
  53478. }, i.prototype.Clone = function() {
  53479. return (new i).Copy(this)
  53480. }, i.prototype.Copy = function(t) {
  53481. return e.prototype.Copy.call(this, t), this.CreateChain(t.m_vertices, t.m_count), this.m_prevVertex.Copy(t.m_prevVertex), this.m_nextVertex.Copy(t.m_nextVertex), this.m_hasPrevVertex = t.m_hasPrevVertex, this.m_hasNextVertex = t.m_hasNextVertex, this
  53482. }, i.prototype.GetChildCount = function() {
  53483. return this.m_count - 1
  53484. }, i.prototype.GetChildEdge = function(e, i) {
  53485. e.m_type = t.b2ShapeType.e_edgeShape, e.m_radius = this.m_radius, e.m_vertex1.Copy(this.m_vertices[i]), e.m_vertex2.Copy(this.m_vertices[i + 1]), i > 0 ? (e.m_vertex0.Copy(this.m_vertices[i - 1]), e.m_hasVertex0 = !0) : (e.m_vertex0.Copy(this.m_prevVertex), e.m_hasVertex0 = this.m_hasPrevVertex), i < this.m_count - 2 ? (e.m_vertex3.Copy(this.m_vertices[i + 2]), e.m_hasVertex3 = !0) : (e.m_vertex3.Copy(this.m_nextVertex), e.m_hasVertex3 = this.m_hasNextVertex)
  53486. }, i.prototype.TestPoint = function(t, e) {
  53487. return !1
  53488. }, i.prototype.ComputeDistance = function(t, e, n, r) {
  53489. var s = i.ComputeDistance_s_edgeShape;
  53490. return this.GetChildEdge(s, r), s.ComputeDistance(t, e, n, 0)
  53491. }, i.prototype.RayCast = function(t, e, n, r) {
  53492. var s = i.RayCast_s_edgeShape;
  53493. return s.m_vertex1.Copy(this.m_vertices[r]), s.m_vertex2.Copy(this.m_vertices[(r + 1) % this.m_count]), s.RayCast(t, e, n, 0)
  53494. }, i.prototype.ComputeAABB = function(t, e, n) {
  53495. var r = this.m_vertices[n],
  53496. s = this.m_vertices[(n + 1) % this.m_count],
  53497. o = V.MulXV(e, r, i.ComputeAABB_s_v1),
  53498. a = V.MulXV(e, s, i.ComputeAABB_s_v2);
  53499. P.MinV(o, a, t.lowerBound), P.MaxV(o, a, t.upperBound)
  53500. }, i.prototype.ComputeMass = function(t, e) {
  53501. t.mass = 0, t.center.SetZero(), t.I = 0
  53502. }, i.prototype.SetupDistanceProxy = function(t, e) {
  53503. t.m_vertices = t.m_buffer, t.m_vertices[0].Copy(this.m_vertices[e]), e + 1 < this.m_count ? t.m_vertices[1].Copy(this.m_vertices[e + 1]) : t.m_vertices[1].Copy(this.m_vertices[0]), t.m_count = 2, t.m_radius = this.m_radius
  53504. }, i.prototype.ComputeSubmergedArea = function(t, e, i, n) {
  53505. return n.SetZero(), 0
  53506. }, i.prototype.Dump = function(t) {
  53507. t(" const shape: b2ChainShape = new b2ChainShape();\n"), t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", a);
  53508. for (var e = 0; e < this.m_count; ++e) t(" vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
  53509. t(" shape.CreateChain(vs, %d);\n", this.m_count), t(" shape.m_prevVertex.Set(%.15f, %.15f);\n", this.m_prevVertex.x, this.m_prevVertex.y), t(" shape.m_nextVertex.Set(%.15f, %.15f);\n", this.m_nextVertex.x, this.m_nextVertex.y), t(" shape.m_hasPrevVertex = %s;\n", this.m_hasPrevVertex ? "true" : "false"), t(" shape.m_hasNextVertex = %s;\n", this.m_hasNextVertex ? "true" : "false")
  53510. }, i.ComputeDistance_s_edgeShape = new ii, i.RayCast_s_edgeShape = new ii, i.ComputeAABB_s_v1 = new P, i.ComputeAABB_s_v2 = new P, i
  53511. })(Ke),
  53512. ri = (function() {
  53513. function t() {
  53514. this.categoryBits = 1, this.maskBits = 65535, this.groupIndex = 0
  53515. }
  53516. return t.prototype.Clone = function() {
  53517. return (new t).Copy(this)
  53518. }, t.prototype.Copy = function(t) {
  53519. return this.categoryBits = t.categoryBits, this.maskBits = t.maskBits, this.groupIndex = t.groupIndex || 0, this
  53520. }, t.DEFAULT = new t, t
  53521. })(),
  53522. si = (function() {
  53523. return function() {
  53524. this.userData = null, this.friction = .2, this.restitution = 0, this.density = 0, this.isSensor = !1, this.filter = new ri
  53525. }
  53526. })(),
  53527. oi = (function() {
  53528. return function(t) {
  53529. this.aabb = new wt, this.childIndex = 0, this.fixture = t
  53530. }
  53531. })(),
  53532. ai = (function() {
  53533. function t(t, e) {
  53534. this.m_density = 0, this.m_next = null, this.m_friction = 0, this.m_restitution = 0, this.m_proxies = [], this.m_proxyCount = 0, this.m_filter = new ri, this.m_isSensor = !1, this.m_userData = null, this.m_body = e, this.m_shape = t.shape.Clone()
  53535. }
  53536. return t.prototype.GetType = function() {
  53537. return this.m_shape.GetType()
  53538. }, t.prototype.GetShape = function() {
  53539. return this.m_shape
  53540. }, t.prototype.SetSensor = function(t) {
  53541. t !== this.m_isSensor && (this.m_body.SetAwake(!0), this.m_isSensor = t)
  53542. }, t.prototype.IsSensor = function() {
  53543. return this.m_isSensor
  53544. }, t.prototype.SetFilterData = function(t) {
  53545. this.m_filter.Copy(t), this.Refilter()
  53546. }, t.prototype.GetFilterData = function() {
  53547. return this.m_filter
  53548. }, t.prototype.Refilter = function() {
  53549. for (var t = this.m_body.GetContactList(); t;) {
  53550. var e = t.contact,
  53551. i = e.GetFixtureA(),
  53552. n = e.GetFixtureB();
  53553. i !== this && n !== this || e.FlagForFiltering(), t = t.next
  53554. }
  53555. var r = this.m_body.GetWorld();
  53556. if (null !== r)
  53557. for (var s = r.m_contactManager.m_broadPhase, o = 0; o < this.m_proxyCount; ++o) s.TouchProxy(this.m_proxies[o].treeNode)
  53558. }, t.prototype.GetBody = function() {
  53559. return this.m_body
  53560. }, t.prototype.GetNext = function() {
  53561. return this.m_next
  53562. }, t.prototype.GetUserData = function() {
  53563. return this.m_userData
  53564. }, t.prototype.SetUserData = function(t) {
  53565. this.m_userData = t
  53566. }, t.prototype.TestPoint = function(t) {
  53567. return this.m_shape.TestPoint(this.m_body.GetTransform(), t)
  53568. }, t.prototype.ComputeDistance = function(t, e, i) {
  53569. return this.m_shape.ComputeDistance(this.m_body.GetTransform(), t, e, i)
  53570. }, t.prototype.RayCast = function(t, e, i) {
  53571. return this.m_shape.RayCast(t, e, this.m_body.GetTransform(), i)
  53572. }, t.prototype.GetMassData = function(t) {
  53573. return void 0 === t && (t = new Ze), this.m_shape.ComputeMass(t, this.m_density), t
  53574. }, t.prototype.SetDensity = function(t) {
  53575. this.m_density = t
  53576. }, t.prototype.GetDensity = function() {
  53577. return this.m_density
  53578. }, t.prototype.GetFriction = function() {
  53579. return this.m_friction
  53580. }, t.prototype.SetFriction = function(t) {
  53581. this.m_friction = t
  53582. }, t.prototype.GetRestitution = function() {
  53583. return this.m_restitution
  53584. }, t.prototype.SetRestitution = function(t) {
  53585. this.m_restitution = t
  53586. }, t.prototype.GetAABB = function(t) {
  53587. return this.m_proxies[t].aabb
  53588. }, t.prototype.Dump = function(t, e) {
  53589. t(" const fd: b2FixtureDef = new b2FixtureDef();\n"), t(" fd.friction = %.15f;\n", this.m_friction), t(" fd.restitution = %.15f;\n", this.m_restitution), t(" fd.density = %.15f;\n", this.m_density), t(" fd.isSensor = %s;\n", this.m_isSensor ? "true" : "false"), t(" fd.filter.categoryBits = %d;\n", this.m_filter.categoryBits), t(" fd.filter.maskBits = %d;\n", this.m_filter.maskBits), t(" fd.filter.groupIndex = %d;\n", this.m_filter.groupIndex), this.m_shape.Dump(t), t("\n"), t(" fd.shape = shape;\n"), t("\n"), t(" bodies[%d].CreateFixture(fd);\n", e)
  53590. }, t.prototype.Create = function(t) {
  53591. var i = this;
  53592. this.m_userData = t.userData, this.m_friction = e(t.friction, .2), this.m_restitution = e(t.restitution, 0), this.m_next = null, this.m_filter.Copy(e(t.filter, ri.DEFAULT)), this.m_isSensor = e(t.isSensor, !1), this.m_proxies = d(this.m_shape.GetChildCount(), (function(t) {
  53593. return new oi(i)
  53594. })), this.m_proxyCount = 0, this.m_density = e(t.density, 0)
  53595. }, t.prototype.Destroy = function() {}, t.prototype.CreateProxies = function(t) {
  53596. var e = this.m_body.m_world.m_contactManager.m_broadPhase;
  53597. this.m_proxyCount = this.m_shape.GetChildCount();
  53598. for (var i = 0; i < this.m_proxyCount; ++i) {
  53599. var n = this.m_proxies[i] = new oi(this);
  53600. this.m_shape.ComputeAABB(n.aabb, t, i), n.treeNode = e.CreateProxy(n.aabb, n), n.childIndex = i
  53601. }
  53602. }, t.prototype.DestroyProxies = function() {
  53603. for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = 0; e < this.m_proxyCount; ++e) {
  53604. var i = this.m_proxies[e];
  53605. delete i.treeNode.userData, t.DestroyProxy(i.treeNode), delete i.treeNode
  53606. }
  53607. this.m_proxyCount = 0
  53608. }, t.prototype.TouchProxies = function() {
  53609. for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = this.m_proxyCount, i = 0; i < e; ++i) t.TouchProxy(this.m_proxies[i].treeNode)
  53610. }, t.prototype.Synchronize = function(e, i) {
  53611. if (0 !== this.m_proxyCount)
  53612. for (var n = this.m_body.m_world.m_contactManager.m_broadPhase, r = 0; r < this.m_proxyCount; ++r) {
  53613. var s = this.m_proxies[r],
  53614. o = t.Synchronize_s_aabb1,
  53615. a = t.Synchronize_s_aabb2;
  53616. this.m_shape.ComputeAABB(o, e, r), this.m_shape.ComputeAABB(a, i, r), s.aabb.Combine2(o, a);
  53617. var l = P.SubVV(i.p, e.p, t.Synchronize_s_displacement);
  53618. n.MoveProxy(s.treeNode, s.aabb, l)
  53619. }
  53620. }, t.Synchronize_s_aabb1 = new wt, t.Synchronize_s_aabb2 = new wt, t.Synchronize_s_displacement = new P, t
  53621. })();
  53622. (function(t) {
  53623. t[t.b2_unknown = -1] = "b2_unknown", t[t.b2_staticBody = 0] = "b2_staticBody", t[t.b2_kinematicBody = 1] = "b2_kinematicBody", t[t.b2_dynamicBody = 2] = "b2_dynamicBody"
  53624. })(t.b2BodyType || (t.b2BodyType = {}));
  53625. var li = (function() {
  53626. return function() {
  53627. this.type = t.b2BodyType.b2_staticBody, this.position = new P(0, 0), this.angle = 0, this.linearVelocity = new P(0, 0), this.angularVelocity = 0, this.linearDamping = 0, this.angularDamping = 0, this.allowSleep = !0, this.awake = !0, this.fixedRotation = !1, this.bullet = !1, this.active = !0, this.userData = null, this.gravityScale = 1
  53628. }
  53629. })(),
  53630. hi = (function() {
  53631. function i(i, n) {
  53632. this.m_type = t.b2BodyType.b2_staticBody, this.m_islandFlag = !1, this.m_awakeFlag = !1, this.m_autoSleepFlag = !1, this.m_bulletFlag = !1, this.m_fixedRotationFlag = !1, this.m_activeFlag = !1, this.m_toiFlag = !1, this.m_islandIndex = 0, this.m_xf = new V, this.m_xf0 = new V, this.m_sweep = new k, this.m_linearVelocity = new P, this.m_angularVelocity = 0, this.m_force = new P, this.m_torque = 0, this.m_prev = null, this.m_next = null, this.m_fixtureList = null, this.m_fixtureCount = 0, this.m_jointList = null, this.m_contactList = null, this.m_mass = 1, this.m_invMass = 1, this.m_I = 0, this.m_invI = 0, this.m_linearDamping = 0, this.m_angularDamping = 0, this.m_gravityScale = 1, this.m_sleepTime = 0, this.m_userData = null, this.m_controllerList = null, this.m_controllerCount = 0, this.m_bulletFlag = e(i.bullet, !1), this.m_fixedRotationFlag = e(i.fixedRotation, !1), this.m_autoSleepFlag = e(i.allowSleep, !0), this.m_awakeFlag = e(i.awake, !0), this.m_activeFlag = e(i.active, !0), this.m_world = n, this.m_xf.p.Copy(e(i.position, P.ZERO)), this.m_xf.q.SetAngle(e(i.angle, 0)), this.m_xf0.Copy(this.m_xf), this.m_sweep.localCenter.SetZero(), this.m_sweep.c0.Copy(this.m_xf.p), this.m_sweep.c.Copy(this.m_xf.p), this.m_sweep.a0 = this.m_sweep.a = this.m_xf.q.GetAngle(), this.m_sweep.alpha0 = 0, this.m_linearVelocity.Copy(e(i.linearVelocity, P.ZERO)), this.m_angularVelocity = e(i.angularVelocity, 0), this.m_linearDamping = e(i.linearDamping, 0), this.m_angularDamping = e(i.angularDamping, 0), this.m_gravityScale = e(i.gravityScale, 1), this.m_force.SetZero(), this.m_torque = 0, this.m_sleepTime = 0, this.m_type = e(i.type, t.b2BodyType.b2_staticBody), i.type === t.b2BodyType.b2_dynamicBody ? (this.m_mass = 1, this.m_invMass = 1) : (this.m_mass = 0, this.m_invMass = 0), this.m_I = 0, this.m_invI = 0, this.m_userData = i.userData, this.m_fixtureList = null, this.m_fixtureCount = 0, this.m_controllerList = null, this.m_controllerCount = 0
  53633. }
  53634. return i.prototype.CreateFixture = function(t, e) {
  53635. return void 0 === e && (e = 0), t instanceof Ke ? this.CreateFixtureShapeDensity(t, e) : this.CreateFixtureDef(t)
  53636. }, i.prototype.CreateFixtureDef = function(t) {
  53637. if (this.m_world.IsLocked()) throw new Error;
  53638. var e = new ai(t, this);
  53639. return e.Create(t), this.m_activeFlag && e.CreateProxies(this.m_xf), e.m_next = this.m_fixtureList, this.m_fixtureList = e, ++this.m_fixtureCount, e.m_density > 0 && this.ResetMassData(), this.m_world.m_newFixture = !0, e
  53640. }, i.prototype.CreateFixtureShapeDensity = function(t, e) {
  53641. void 0 === e && (e = 0);
  53642. var n = i.CreateFixtureShapeDensity_s_def;
  53643. return n.shape = t, n.density = e, this.CreateFixtureDef(n)
  53644. }, i.prototype.DestroyFixture = function(t) {
  53645. if (this.m_world.IsLocked()) throw new Error;
  53646. for (var e = this.m_fixtureList, i = null; null !== e;) {
  53647. if (e === t) {
  53648. i ? i.m_next = t.m_next : this.m_fixtureList = t.m_next;
  53649. break
  53650. }
  53651. i = e, e = e.m_next
  53652. }
  53653. for (var n = this.m_contactList; n;) {
  53654. var r = n.contact;
  53655. n = n.next;
  53656. var s = r.GetFixtureA(),
  53657. o = r.GetFixtureB();
  53658. t !== s && t !== o || this.m_world.m_contactManager.Destroy(r)
  53659. }
  53660. this.m_activeFlag && t.DestroyProxies(), t.m_next = null, t.Destroy(), --this.m_fixtureCount, this.ResetMassData()
  53661. }, i.prototype.SetTransformVec = function(t, e) {
  53662. this.SetTransformXY(t.x, t.y, e)
  53663. }, i.prototype.SetTransformXY = function(t, e, i) {
  53664. if (this.m_world.IsLocked()) throw new Error;
  53665. this.m_xf.q.SetAngle(i), this.m_xf.p.Set(t, e), this.m_xf0.Copy(this.m_xf), V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), this.m_sweep.a = i, this.m_sweep.c0.Copy(this.m_sweep.c), this.m_sweep.a0 = i;
  53666. for (var n = this.m_fixtureList; n; n = n.m_next) n.Synchronize(this.m_xf, this.m_xf);
  53667. this.m_world.m_contactManager.FindNewContacts()
  53668. }, i.prototype.SetTransform = function(t) {
  53669. this.SetTransformVec(t.p, t.GetAngle())
  53670. }, i.prototype.GetTransform = function() {
  53671. return this.m_xf
  53672. }, i.prototype.GetPosition = function() {
  53673. return this.m_xf.p
  53674. }, i.prototype.SetPosition = function(t) {
  53675. this.SetTransformVec(t, this.GetAngle())
  53676. }, i.prototype.SetPositionXY = function(t, e) {
  53677. this.SetTransformXY(t, e, this.GetAngle())
  53678. }, i.prototype.GetAngle = function() {
  53679. return this.m_sweep.a
  53680. }, i.prototype.SetAngle = function(t) {
  53681. this.SetTransformVec(this.GetPosition(), t)
  53682. }, i.prototype.GetWorldCenter = function() {
  53683. return this.m_sweep.c
  53684. }, i.prototype.GetLocalCenter = function() {
  53685. return this.m_sweep.localCenter
  53686. }, i.prototype.SetLinearVelocity = function(e) {
  53687. this.m_type !== t.b2BodyType.b2_staticBody && (P.DotVV(e, e) > 0 && this.SetAwake(!0), this.m_linearVelocity.Copy(e))
  53688. }, i.prototype.GetLinearVelocity = function() {
  53689. return this.m_linearVelocity
  53690. }, i.prototype.SetAngularVelocity = function(e) {
  53691. this.m_type !== t.b2BodyType.b2_staticBody && (e * e > 0 && this.SetAwake(!0), this.m_angularVelocity = e)
  53692. }, i.prototype.GetAngularVelocity = function() {
  53693. return this.m_angularVelocity
  53694. }, i.prototype.GetDefinition = function(t) {
  53695. return t.type = this.GetType(), t.allowSleep = this.m_autoSleepFlag, t.angle = this.GetAngle(), t.angularDamping = this.m_angularDamping, t.gravityScale = this.m_gravityScale, t.angularVelocity = this.m_angularVelocity, t.fixedRotation = this.m_fixedRotationFlag, t.bullet = this.m_bulletFlag, t.awake = this.m_awakeFlag, t.linearDamping = this.m_linearDamping, t.linearVelocity.Copy(this.GetLinearVelocity()), t.position.Copy(this.GetPosition()), t.userData = this.GetUserData(), t
  53696. }, i.prototype.ApplyForce = function(e, i, n) {
  53697. void 0 === n && (n = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (n && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_force.x += e.x, this.m_force.y += e.y, this.m_torque += (i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x))
  53698. }, i.prototype.ApplyForceToCenter = function(e, i) {
  53699. void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_force.x += e.x, this.m_force.y += e.y))
  53700. }, i.prototype.ApplyTorque = function(e, i) {
  53701. void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_torque += e))
  53702. }, i.prototype.ApplyLinearImpulse = function(e, i, n) {
  53703. void 0 === n && (n = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (n && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_linearVelocity.x += this.m_invMass * e.x, this.m_linearVelocity.y += this.m_invMass * e.y, this.m_angularVelocity += this.m_invI * ((i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x)))
  53704. }, i.prototype.ApplyLinearImpulseToCenter = function(e, i) {
  53705. void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_linearVelocity.x += this.m_invMass * e.x, this.m_linearVelocity.y += this.m_invMass * e.y))
  53706. }, i.prototype.ApplyAngularImpulse = function(e, i) {
  53707. void 0 === i && (i = !0), this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), this.m_awakeFlag && (this.m_angularVelocity += this.m_invI * e))
  53708. }, i.prototype.GetMass = function() {
  53709. return this.m_mass
  53710. }, i.prototype.GetInertia = function() {
  53711. return this.m_I + this.m_mass * P.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter)
  53712. }, i.prototype.GetMassData = function(t) {
  53713. return t.mass = this.m_mass, t.I = this.m_I + this.m_mass * P.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter), t.center.Copy(this.m_sweep.localCenter), t
  53714. }, i.prototype.SetMassData = function(e) {
  53715. if (this.m_world.IsLocked()) throw new Error;
  53716. if (this.m_type === t.b2BodyType.b2_dynamicBody) {
  53717. this.m_invMass = 0, this.m_I = 0, this.m_invI = 0, this.m_mass = e.mass, this.m_mass <= 0 && (this.m_mass = 1), this.m_invMass = 1 / this.m_mass, e.I > 0 && !this.m_fixedRotationFlag && (this.m_I = e.I - this.m_mass * P.DotVV(e.center, e.center), this.m_invI = 1 / this.m_I);
  53718. var n = i.SetMassData_s_oldCenter.Copy(this.m_sweep.c);
  53719. this.m_sweep.localCenter.Copy(e.center), V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), this.m_sweep.c0.Copy(this.m_sweep.c), P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(this.m_sweep.c, n, P.s_t0), this.m_linearVelocity)
  53720. }
  53721. }, i.prototype.ResetMassData = function() {
  53722. if (this.m_mass = 0, this.m_invMass = 0, this.m_I = 0, this.m_invI = 0, this.m_sweep.localCenter.SetZero(), this.m_type === t.b2BodyType.b2_staticBody || this.m_type === t.b2BodyType.b2_kinematicBody) return this.m_sweep.c0.Copy(this.m_xf.p), this.m_sweep.c.Copy(this.m_xf.p), void(this.m_sweep.a0 = this.m_sweep.a);
  53723. for (var e = i.ResetMassData_s_localCenter.SetZero(), n = this.m_fixtureList; n; n = n.m_next)
  53724. if (0 !== n.m_density) {
  53725. var r = n.GetMassData(i.ResetMassData_s_massData);
  53726. this.m_mass += r.mass, e.x += r.center.x * r.mass, e.y += r.center.y * r.mass, this.m_I += r.I
  53727. }
  53728. this.m_mass > 0 ? (this.m_invMass = 1 / this.m_mass, e.x *= this.m_invMass, e.y *= this.m_invMass) : (this.m_mass = 1, this.m_invMass = 1), this.m_I > 0 && !this.m_fixedRotationFlag ? (this.m_I -= this.m_mass * P.DotVV(e, e), this.m_invI = 1 / this.m_I) : (this.m_I = 0, this.m_invI = 0);
  53729. var s = i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);
  53730. this.m_sweep.localCenter.Copy(e), V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), this.m_sweep.c0.Copy(this.m_sweep.c), P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(this.m_sweep.c, s, P.s_t0), this.m_linearVelocity)
  53731. }, i.prototype.GetWorldPoint = function(t, e) {
  53732. return V.MulXV(this.m_xf, t, e)
  53733. }, i.prototype.GetWorldVector = function(t, e) {
  53734. return N.MulRV(this.m_xf.q, t, e)
  53735. }, i.prototype.GetLocalPoint = function(t, e) {
  53736. return V.MulTXV(this.m_xf, t, e)
  53737. }, i.prototype.GetLocalVector = function(t, e) {
  53738. return N.MulTRV(this.m_xf.q, t, e)
  53739. }, i.prototype.GetLinearVelocityFromWorldPoint = function(t, e) {
  53740. return P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(t, this.m_sweep.c, P.s_t0), e)
  53741. }, i.prototype.GetLinearVelocityFromLocalPoint = function(t, e) {
  53742. return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t, e), e)
  53743. }, i.prototype.GetLinearDamping = function() {
  53744. return this.m_linearDamping
  53745. }, i.prototype.SetLinearDamping = function(t) {
  53746. this.m_linearDamping = t
  53747. }, i.prototype.GetAngularDamping = function() {
  53748. return this.m_angularDamping
  53749. }, i.prototype.SetAngularDamping = function(t) {
  53750. this.m_angularDamping = t
  53751. }, i.prototype.GetGravityScale = function() {
  53752. return this.m_gravityScale
  53753. }, i.prototype.SetGravityScale = function(t) {
  53754. this.m_gravityScale = t
  53755. }, i.prototype.SetType = function(e) {
  53756. if (this.m_world.IsLocked()) throw new Error;
  53757. if (this.m_type !== e) {
  53758. this.m_type = e, this.ResetMassData(), this.m_type === t.b2BodyType.b2_staticBody && (this.m_linearVelocity.SetZero(), this.m_angularVelocity = 0, this.m_sweep.a0 = this.m_sweep.a, this.m_sweep.c0.Copy(this.m_sweep.c), this.SynchronizeFixtures()), this.SetAwake(!0), this.m_force.SetZero(), this.m_torque = 0;
  53759. for (var i = this.m_contactList; i;) {
  53760. var n = i;
  53761. i = i.next, this.m_world.m_contactManager.Destroy(n.contact)
  53762. }
  53763. this.m_contactList = null;
  53764. for (var r = this.m_fixtureList; r; r = r.m_next) r.TouchProxies()
  53765. }
  53766. }, i.prototype.GetType = function() {
  53767. return this.m_type
  53768. }, i.prototype.SetBullet = function(t) {
  53769. this.m_bulletFlag = t
  53770. }, i.prototype.IsBullet = function() {
  53771. return this.m_bulletFlag
  53772. }, i.prototype.SetSleepingAllowed = function(t) {
  53773. this.m_autoSleepFlag = t, t || this.SetAwake(!0)
  53774. }, i.prototype.IsSleepingAllowed = function() {
  53775. return this.m_autoSleepFlag
  53776. }, i.prototype.SetAwake = function(t) {
  53777. t ? (this.m_awakeFlag = !0, this.m_sleepTime = 0) : (this.m_awakeFlag = !1, this.m_sleepTime = 0, this.m_linearVelocity.SetZero(), this.m_angularVelocity = 0, this.m_force.SetZero(), this.m_torque = 0)
  53778. }, i.prototype.IsAwake = function() {
  53779. return this.m_awakeFlag
  53780. }, i.prototype.SetActive = function(t) {
  53781. if (this.m_world.IsLocked()) throw new Error;
  53782. if (t !== this.IsActive())
  53783. if (this.m_activeFlag = t, t)
  53784. for (var e = this.m_fixtureList; e; e = e.m_next) e.CreateProxies(this.m_xf);
  53785. else {
  53786. for (e = this.m_fixtureList; e; e = e.m_next) e.DestroyProxies();
  53787. for (var i = this.m_contactList; i;) {
  53788. var n = i;
  53789. i = i.next, this.m_world.m_contactManager.Destroy(n.contact)
  53790. }
  53791. this.m_contactList = null
  53792. }
  53793. }, i.prototype.IsActive = function() {
  53794. return this.m_activeFlag
  53795. }, i.prototype.SetFixedRotation = function(t) {
  53796. this.m_fixedRotationFlag !== t && (this.m_fixedRotationFlag = t, this.m_angularVelocity = 0, this.ResetMassData())
  53797. }, i.prototype.IsFixedRotation = function() {
  53798. return this.m_fixedRotationFlag
  53799. }, i.prototype.GetFixtureList = function() {
  53800. return this.m_fixtureList
  53801. }, i.prototype.GetJointList = function() {
  53802. return this.m_jointList
  53803. }, i.prototype.GetContactList = function() {
  53804. return this.m_contactList
  53805. }, i.prototype.GetNext = function() {
  53806. return this.m_next
  53807. }, i.prototype.GetUserData = function() {
  53808. return this.m_userData
  53809. }, i.prototype.SetUserData = function(t) {
  53810. this.m_userData = t
  53811. }, i.prototype.GetWorld = function() {
  53812. return this.m_world
  53813. }, i.prototype.Dump = function(e) {
  53814. var i = this.m_islandIndex;
  53815. e("{\n"), e(" const bd: b2BodyDef = new b2BodyDef();\n");
  53816. var n = "";
  53817. switch (this.m_type) {
  53818. case t.b2BodyType.b2_staticBody:
  53819. n = "b2BodyType.b2_staticBody";
  53820. break;
  53821. case t.b2BodyType.b2_kinematicBody:
  53822. n = "b2BodyType.b2_kinematicBody";
  53823. break;
  53824. case t.b2BodyType.b2_dynamicBody:
  53825. n = "b2BodyType.b2_dynamicBody"
  53826. }
  53827. e(" bd.type = %s;\n", n), e(" bd.position.Set(%.15f, %.15f);\n", this.m_xf.p.x, this.m_xf.p.y), e(" bd.angle = %.15f;\n", this.m_sweep.a), e(" bd.linearVelocity.Set(%.15f, %.15f);\n", this.m_linearVelocity.x, this.m_linearVelocity.y), e(" bd.angularVelocity = %.15f;\n", this.m_angularVelocity), e(" bd.linearDamping = %.15f;\n", this.m_linearDamping), e(" bd.angularDamping = %.15f;\n", this.m_angularDamping), e(" bd.allowSleep = %s;\n", this.m_autoSleepFlag ? "true" : "false"), e(" bd.awake = %s;\n", this.m_awakeFlag ? "true" : "false"), e(" bd.fixedRotation = %s;\n", this.m_fixedRotationFlag ? "true" : "false"), e(" bd.bullet = %s;\n", this.m_bulletFlag ? "true" : "false"), e(" bd.active = %s;\n", this.m_activeFlag ? "true" : "false"), e(" bd.gravityScale = %.15f;\n", this.m_gravityScale), e("\n"), e(" bodies[%d] = this.m_world.CreateBody(bd);\n", this.m_islandIndex), e("\n");
  53828. for (var r = this.m_fixtureList; r; r = r.m_next) e(" {\n"), r.Dump(e, i), e(" }\n");
  53829. e("}\n")
  53830. }, i.prototype.SynchronizeFixtures = function() {
  53831. var t = i.SynchronizeFixtures_s_xf1;
  53832. t.q.SetAngle(this.m_sweep.a0), N.MulRV(t.q, this.m_sweep.localCenter, t.p), P.SubVV(this.m_sweep.c0, t.p, t.p);
  53833. for (var e = this.m_fixtureList; e; e = e.m_next) e.Synchronize(t, this.m_xf)
  53834. }, i.prototype.SynchronizeTransform = function() {
  53835. this.m_xf.q.SetAngle(this.m_sweep.a), N.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p), P.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p)
  53836. }, i.prototype.ShouldCollide = function(e) {
  53837. return (this.m_type !== t.b2BodyType.b2_staticBody || e.m_type !== t.b2BodyType.b2_staticBody) && this.ShouldCollideConnected(e)
  53838. }, i.prototype.ShouldCollideConnected = function(t) {
  53839. for (var e = this.m_jointList; e; e = e.next)
  53840. if (e.other === t && !e.joint.m_collideConnected) return !1;
  53841. return !0
  53842. }, i.prototype.Advance = function(t) {
  53843. this.m_sweep.Advance(t), this.m_sweep.c.Copy(this.m_sweep.c0), this.m_sweep.a = this.m_sweep.a0, this.m_xf.q.SetAngle(this.m_sweep.a), N.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p), P.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p)
  53844. }, i.prototype.GetControllerList = function() {
  53845. return this.m_controllerList
  53846. }, i.prototype.GetControllerCount = function() {
  53847. return this.m_controllerCount
  53848. }, i.CreateFixtureShapeDensity_s_def = new si, i.SetMassData_s_oldCenter = new P, i.ResetMassData_s_localCenter = new P, i.ResetMassData_s_oldCenter = new P, i.ResetMassData_s_massData = new Ze, i.SynchronizeFixtures_s_xf1 = new V, i
  53849. })();
  53850. (function(t) {
  53851. t[t.e_unknownJoint = 0] = "e_unknownJoint", t[t.e_revoluteJoint = 1] = "e_revoluteJoint", t[t.e_prismaticJoint = 2] = "e_prismaticJoint", t[t.e_distanceJoint = 3] = "e_distanceJoint", t[t.e_pulleyJoint = 4] = "e_pulleyJoint", t[t.e_mouseJoint = 5] = "e_mouseJoint", t[t.e_gearJoint = 6] = "e_gearJoint", t[t.e_wheelJoint = 7] = "e_wheelJoint", t[t.e_weldJoint = 8] = "e_weldJoint", t[t.e_frictionJoint = 9] = "e_frictionJoint", t[t.e_ropeJoint = 10] = "e_ropeJoint", t[t.e_motorJoint = 11] = "e_motorJoint", t[t.e_areaJoint = 12] = "e_areaJoint"
  53852. })(t.b2JointType || (t.b2JointType = {})), (function(t) {
  53853. t[t.e_inactiveLimit = 0] = "e_inactiveLimit", t[t.e_atLowerLimit = 1] = "e_atLowerLimit", t[t.e_atUpperLimit = 2] = "e_atUpperLimit", t[t.e_equalLimits = 3] = "e_equalLimits"
  53854. })(t.b2LimitState || (t.b2LimitState = {}));
  53855. var ci = (function() {
  53856. function t() {
  53857. this.linear = new P, this.angularA = 0, this.angularB = 0
  53858. }
  53859. return t.prototype.SetZero = function() {
  53860. return this.linear.SetZero(), this.angularA = 0, this.angularB = 0, this
  53861. }, t.prototype.Set = function(t, e, i) {
  53862. return this.linear.Copy(t), this.angularA = e, this.angularB = i, this
  53863. }, t
  53864. })(),
  53865. ui = (function() {
  53866. return function(t, e) {
  53867. this.prev = null, this.next = null, this.joint = t, this.other = e
  53868. }
  53869. })(),
  53870. _i = (function() {
  53871. return function(e) {
  53872. this.type = t.b2JointType.e_unknownJoint, this.userData = null, this.collideConnected = !1, this.type = e
  53873. }
  53874. })(),
  53875. fi = (function() {
  53876. function i(i) {
  53877. this.m_type = t.b2JointType.e_unknownJoint, this.m_prev = null, this.m_next = null, this.m_index = 0, this.m_islandFlag = !1, this.m_collideConnected = !1, this.m_userData = null, this.m_type = i.type, this.m_edgeA = new ui(this, i.bodyB), this.m_edgeB = new ui(this, i.bodyA), this.m_bodyA = i.bodyA, this.m_bodyB = i.bodyB, this.m_collideConnected = e(i.collideConnected, !1), this.m_userData = i.userData
  53878. }
  53879. return i.prototype.GetType = function() {
  53880. return this.m_type
  53881. }, i.prototype.GetBodyA = function() {
  53882. return this.m_bodyA
  53883. }, i.prototype.GetBodyB = function() {
  53884. return this.m_bodyB
  53885. }, i.prototype.GetNext = function() {
  53886. return this.m_next
  53887. }, i.prototype.GetUserData = function() {
  53888. return this.m_userData
  53889. }, i.prototype.SetUserData = function(t) {
  53890. this.m_userData = t
  53891. }, i.prototype.IsActive = function() {
  53892. return this.m_bodyA.IsActive() && this.m_bodyB.IsActive()
  53893. }, i.prototype.GetCollideConnected = function() {
  53894. return this.m_collideConnected
  53895. }, i.prototype.Dump = function(t) {
  53896. t("// Dump is not supported for this joint type.\n")
  53897. }, i.prototype.ShiftOrigin = function(t) {}, i
  53898. })(),
  53899. di = (function(e) {
  53900. function i() {
  53901. var i = e.call(this, t.b2JointType.e_distanceJoint) || this;
  53902. return i.localAnchorA = new P, i.localAnchorB = new P, i.length = 1, i.frequencyHz = 0, i.dampingRatio = 0, i
  53903. }
  53904. return $e(i, e), i.prototype.Initialize = function(t, e, i, n) {
  53905. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(n, this.localAnchorB), this.length = P.DistanceVV(i, n), this.frequencyHz = 0, this.dampingRatio = 0
  53906. }, i
  53907. })(_i),
  53908. pi = (function(t) {
  53909. function i(i) {
  53910. var n = t.call(this, i) || this;
  53911. return n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_bias = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_gamma = 0, n.m_impulse = 0, n.m_length = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_u = new P, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_mass = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_localAnchorA.Copy(i.localAnchorA), n.m_localAnchorB.Copy(i.localAnchorB), n.m_length = i.length, n
  53912. }
  53913. return $e(i, t), i.prototype.GetAnchorA = function(t) {
  53914. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  53915. }, i.prototype.GetAnchorB = function(t) {
  53916. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  53917. }, i.prototype.GetReactionForce = function(t, e) {
  53918. return e.x = t * this.m_impulse * this.m_u.x, e.y = t * this.m_impulse * this.m_u.y, e
  53919. }, i.prototype.GetReactionTorque = function(t) {
  53920. return 0
  53921. }, i.prototype.GetLocalAnchorA = function() {
  53922. return this.m_localAnchorA
  53923. }, i.prototype.GetLocalAnchorB = function() {
  53924. return this.m_localAnchorB
  53925. }, i.prototype.SetLength = function(t) {
  53926. this.m_length = t
  53927. }, i.prototype.Length = function() {
  53928. return this.m_length
  53929. }, i.prototype.SetFrequency = function(t) {
  53930. this.m_frequencyHz = t
  53931. }, i.prototype.GetFrequency = function() {
  53932. return this.m_frequencyHz
  53933. }, i.prototype.SetDampingRatio = function(t) {
  53934. this.m_dampingRatio = t
  53935. }, i.prototype.GetDampingRatio = function() {
  53936. return this.m_dampingRatio
  53937. }, i.prototype.Dump = function(t) {
  53938. var e = this.m_bodyA.m_islandIndex,
  53939. i = this.m_bodyB.m_islandIndex;
  53940. t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.length = %.15f;\n", this.m_length), t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  53941. }, i.prototype.InitVelocityConstraints = function(t) {
  53942. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  53943. var e = t.positions[this.m_indexA].c,
  53944. n = t.positions[this.m_indexA].a,
  53945. r = t.velocities[this.m_indexA].v,
  53946. o = t.velocities[this.m_indexA].w,
  53947. a = t.positions[this.m_indexB].c,
  53948. h = t.positions[this.m_indexB].a,
  53949. c = t.velocities[this.m_indexB].v,
  53950. u = t.velocities[this.m_indexB].w,
  53951. _ = this.m_qA.SetAngle(n),
  53952. f = this.m_qB.SetAngle(h);
  53953. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(_, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(f, this.m_lalcB, this.m_rB), this.m_u.x = a.x + this.m_rB.x - e.x - this.m_rA.x, this.m_u.y = a.y + this.m_rB.y - e.y - this.m_rA.y;
  53954. var d = this.m_u.Length();
  53955. d > l ? this.m_u.SelfMul(1 / d) : this.m_u.SetZero();
  53956. var p = P.CrossVV(this.m_rA, this.m_u),
  53957. m = P.CrossVV(this.m_rB, this.m_u),
  53958. y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
  53959. if (this.m_mass = 0 !== y ? 1 / y : 0, this.m_frequencyHz > 0) {
  53960. var v = d - this.m_length,
  53961. g = 2 * s * this.m_frequencyHz,
  53962. x = 2 * this.m_mass * this.m_dampingRatio * g,
  53963. b = this.m_mass * g * g,
  53964. A = t.step.dt;
  53965. this.m_gamma = A * (x + A * b), this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0, this.m_bias = v * A * b * this.m_gamma, y += this.m_gamma, this.m_mass = 0 !== y ? 1 / y : 0
  53966. } else this.m_gamma = 0, this.m_bias = 0;
  53967. if (t.step.warmStarting) {
  53968. this.m_impulse *= t.step.dtRatio;
  53969. var C = P.MulSV(this.m_impulse, this.m_u, i.InitVelocityConstraints_s_P);
  53970. r.SelfMulSub(this.m_invMassA, C), o -= this.m_invIA * P.CrossVV(this.m_rA, C), c.SelfMulAdd(this.m_invMassB, C), u += this.m_invIB * P.CrossVV(this.m_rB, C)
  53971. } else this.m_impulse = 0;
  53972. t.velocities[this.m_indexA].w = o, t.velocities[this.m_indexB].w = u
  53973. }, i.prototype.SolveVelocityConstraints = function(t) {
  53974. var e = t.velocities[this.m_indexA].v,
  53975. n = t.velocities[this.m_indexA].w,
  53976. r = t.velocities[this.m_indexB].v,
  53977. s = t.velocities[this.m_indexB].w,
  53978. o = P.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA),
  53979. a = P.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB),
  53980. l = P.DotVV(this.m_u, P.SubVV(a, o, P.s_t0)),
  53981. h = -this.m_mass * (l + this.m_bias + this.m_gamma * this.m_impulse);
  53982. this.m_impulse += h;
  53983. var c = P.MulSV(h, this.m_u, i.SolveVelocityConstraints_s_P);
  53984. e.SelfMulSub(this.m_invMassA, c), n -= this.m_invIA * P.CrossVV(this.m_rA, c), r.SelfMulAdd(this.m_invMassB, c), s += this.m_invIB * P.CrossVV(this.m_rB, c), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
  53985. }, i.prototype.SolvePositionConstraints = function(t) {
  53986. if (this.m_frequencyHz > 0) return !0;
  53987. var e = t.positions[this.m_indexA].c,
  53988. n = t.positions[this.m_indexA].a,
  53989. r = t.positions[this.m_indexB].c,
  53990. s = t.positions[this.m_indexB].a,
  53991. o = this.m_qA.SetAngle(n),
  53992. a = this.m_qB.SetAngle(s),
  53993. h = N.MulRV(o, this.m_lalcA, this.m_rA),
  53994. c = N.MulRV(a, this.m_lalcB, this.m_rB),
  53995. u = this.m_u;
  53996. u.x = r.x + c.x - e.x - h.x, u.y = r.y + c.y - e.y - h.y;
  53997. var _ = this.m_u.Normalize() - this.m_length;
  53998. _ = b(_, -.2, .2);
  53999. var f = -this.m_mass * _,
  54000. d = P.MulSV(f, u, i.SolvePositionConstraints_s_P);
  54001. return e.SelfMulSub(this.m_invMassA, d), n -= this.m_invIA * P.CrossVV(h, d), r.SelfMulAdd(this.m_invMassB, d), s += this.m_invIB * P.CrossVV(c, d), t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, v(_) < l
  54002. }, i.InitVelocityConstraints_s_P = new P, i.SolveVelocityConstraints_s_vpA = new P, i.SolveVelocityConstraints_s_vpB = new P, i.SolveVelocityConstraints_s_P = new P, i.SolvePositionConstraints_s_P = new P, i
  54003. })(fi),
  54004. mi = (function(e) {
  54005. function i() {
  54006. var i = e.call(this, t.b2JointType.e_areaJoint) || this;
  54007. return i.bodies = [], i.frequencyHz = 0, i.dampingRatio = 0, i
  54008. }
  54009. return $e(i, e), i.prototype.AddBody = function(t) {
  54010. this.bodies.push(t), 1 === this.bodies.length ? this.bodyA = t : 2 === this.bodies.length && (this.bodyB = t)
  54011. }, i
  54012. })(_i),
  54013. yi = (function(t) {
  54014. function i(i) {
  54015. var n = t.call(this, i) || this;
  54016. n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_impulse = 0, n.m_targetArea = 0, n.m_bodies = i.bodies, n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_targetLengths = p(i.bodies.length), n.m_normals = P.MakeArray(i.bodies.length), n.m_joints = [], n.m_deltas = P.MakeArray(i.bodies.length), n.m_delta = new P;
  54017. var r = new di;
  54018. r.frequencyHz = n.m_frequencyHz, r.dampingRatio = n.m_dampingRatio, n.m_targetArea = 0;
  54019. for (var s = 0; s < n.m_bodies.length; ++s) {
  54020. var o = n.m_bodies[s],
  54021. a = n.m_bodies[(s + 1) % n.m_bodies.length],
  54022. l = o.GetWorldCenter(),
  54023. h = a.GetWorldCenter();
  54024. n.m_targetLengths[s] = P.DistanceVV(l, h), n.m_targetArea += P.CrossVV(l, h), r.Initialize(o, a, l, h), n.m_joints[s] = o.GetWorld().CreateJoint(r)
  54025. }
  54026. return n.m_targetArea *= .5, n
  54027. }
  54028. return $e(i, t), i.prototype.GetAnchorA = function(t) {
  54029. return t
  54030. }, i.prototype.GetAnchorB = function(t) {
  54031. return t
  54032. }, i.prototype.GetReactionForce = function(t, e) {
  54033. return e
  54034. }, i.prototype.GetReactionTorque = function(t) {
  54035. return 0
  54036. }, i.prototype.SetFrequency = function(t) {
  54037. this.m_frequencyHz = t;
  54038. for (var e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetFrequency(t)
  54039. }, i.prototype.GetFrequency = function() {
  54040. return this.m_frequencyHz
  54041. }, i.prototype.SetDampingRatio = function(t) {
  54042. this.m_dampingRatio = t;
  54043. for (var e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetDampingRatio(t)
  54044. }, i.prototype.GetDampingRatio = function() {
  54045. return this.m_dampingRatio
  54046. }, i.prototype.Dump = function(t) {
  54047. t("Area joint dumping is not supported.\n")
  54048. }, i.prototype.InitVelocityConstraints = function(t) {
  54049. for (var e = 0; e < this.m_bodies.length; ++e) {
  54050. var i = this.m_bodies[(e + this.m_bodies.length - 1) % this.m_bodies.length],
  54051. n = this.m_bodies[(e + 1) % this.m_bodies.length],
  54052. r = t.positions[i.m_islandIndex].c,
  54053. s = t.positions[n.m_islandIndex].c,
  54054. o = this.m_deltas[e];
  54055. P.SubVV(s, r, o)
  54056. }
  54057. if (t.step.warmStarting) {
  54058. this.m_impulse *= t.step.dtRatio;
  54059. for (e = 0; e < this.m_bodies.length; ++e) {
  54060. var a = this.m_bodies[e],
  54061. l = t.velocities[a.m_islandIndex].v;
  54062. o = this.m_deltas[e];
  54063. l.x += a.m_invMass * o.y * .5 * this.m_impulse, l.y += a.m_invMass * -o.x * .5 * this.m_impulse
  54064. }
  54065. } else this.m_impulse = 0
  54066. }, i.prototype.SolveVelocityConstraints = function(t) {
  54067. for (var e = 0, i = 0, n = 0; n < this.m_bodies.length; ++n) {
  54068. var r = this.m_bodies[n],
  54069. s = t.velocities[r.m_islandIndex].v;
  54070. e += (a = this.m_deltas[n]).LengthSquared() / r.GetMass(), i += P.CrossVV(s, a)
  54071. }
  54072. var o = -2 * i / e;
  54073. this.m_impulse += o;
  54074. for (n = 0; n < this.m_bodies.length; ++n) {
  54075. r = this.m_bodies[n], s = t.velocities[r.m_islandIndex].v;
  54076. var a = this.m_deltas[n];
  54077. s.x += r.m_invMass * a.y * .5 * o, s.y += r.m_invMass * -a.x * .5 * o
  54078. }
  54079. }, i.prototype.SolvePositionConstraints = function(t) {
  54080. for (var e = 0, i = 0, r = 0; r < this.m_bodies.length; ++r) {
  54081. var s = this.m_bodies[r],
  54082. o = this.m_bodies[(r + 1) % this.m_bodies.length],
  54083. a = t.positions[s.m_islandIndex].c,
  54084. h = t.positions[o.m_islandIndex].c,
  54085. c = (f = P.SubVV(h, a, this.m_delta)).Length();
  54086. c < n && (c = 1), this.m_normals[r].x = f.y / c, this.m_normals[r].y = -f.x / c, e += c, i += P.CrossVV(a, h)
  54087. }
  54088. i *= .5;
  54089. var u = .5 * (this.m_targetArea - i) / e,
  54090. _ = !0;
  54091. for (r = 0; r < this.m_bodies.length; ++r) {
  54092. s = this.m_bodies[r], a = t.positions[s.m_islandIndex].c;
  54093. var f, d = (r + 1) % this.m_bodies.length;
  54094. (f = P.AddVV(this.m_normals[r], this.m_normals[d], this.m_delta)).SelfMul(u);
  54095. var p = f.LengthSquared();
  54096. p > C(.2) && f.SelfMul(.2 / S(p)), p > C(l) && (_ = !1), a.x += f.x, a.y += f.y
  54097. }
  54098. return _
  54099. }, i
  54100. })(fi),
  54101. vi = (function(e) {
  54102. function i() {
  54103. var i = e.call(this, t.b2JointType.e_frictionJoint) || this;
  54104. return i.localAnchorA = new P, i.localAnchorB = new P, i.maxForce = 0, i.maxTorque = 0, i
  54105. }
  54106. return $e(i, e), i.prototype.Initialize = function(t, e, i) {
  54107. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB)
  54108. }, i
  54109. })(_i),
  54110. gi = (function(t) {
  54111. function i(i) {
  54112. var n = t.call(this, i) || this;
  54113. return n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_linearImpulse = new P, n.m_angularImpulse = 0, n.m_maxForce = 0, n.m_maxTorque = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_linearMass = new L, n.m_angularMass = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_K = new L, n.m_localAnchorA.Copy(i.localAnchorA), n.m_localAnchorB.Copy(i.localAnchorB), n.m_linearImpulse.SetZero(), n.m_maxForce = e(i.maxForce, 0), n.m_maxTorque = e(i.maxTorque, 0), n.m_linearMass.SetZero(), n
  54114. }
  54115. return $e(i, t), i.prototype.InitVelocityConstraints = function(t) {
  54116. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  54117. var e = t.positions[this.m_indexA].a,
  54118. i = t.velocities[this.m_indexA].v,
  54119. n = t.velocities[this.m_indexA].w,
  54120. r = t.positions[this.m_indexB].a,
  54121. s = t.velocities[this.m_indexB].v,
  54122. o = t.velocities[this.m_indexB].w,
  54123. a = this.m_qA.SetAngle(e),
  54124. l = this.m_qB.SetAngle(r);
  54125. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  54126. var h = N.MulRV(a, this.m_lalcA, this.m_rA);
  54127. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  54128. var c = N.MulRV(l, this.m_lalcB, this.m_rB),
  54129. u = this.m_invMassA,
  54130. _ = this.m_invMassB,
  54131. f = this.m_invIA,
  54132. d = this.m_invIB,
  54133. p = this.m_K;
  54134. if (p.ex.x = u + _ + f * h.y * h.y + d * c.y * c.y, p.ex.y = -f * h.x * h.y - d * c.x * c.y, p.ey.x = p.ex.y, p.ey.y = u + _ + f * h.x * h.x + d * c.x * c.x, p.GetInverse(this.m_linearMass), this.m_angularMass = f + d, this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass), t.step.warmStarting) {
  54135. this.m_linearImpulse.SelfMul(t.step.dtRatio), this.m_angularImpulse *= t.step.dtRatio;
  54136. var m = this.m_linearImpulse;
  54137. i.SelfMulSub(u, m), n -= f * (P.CrossVV(this.m_rA, m) + this.m_angularImpulse), s.SelfMulAdd(_, m), o += d * (P.CrossVV(this.m_rB, m) + this.m_angularImpulse)
  54138. } else this.m_linearImpulse.SetZero(), this.m_angularImpulse = 0;
  54139. t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = o
  54140. }, i.prototype.SolveVelocityConstraints = function(t) {
  54141. var e = t.velocities[this.m_indexA].v,
  54142. n = t.velocities[this.m_indexA].w,
  54143. r = t.velocities[this.m_indexB].v,
  54144. s = t.velocities[this.m_indexB].w,
  54145. o = this.m_invMassA,
  54146. a = this.m_invMassB,
  54147. l = this.m_invIA,
  54148. h = this.m_invIB,
  54149. c = t.step.dt,
  54150. u = s - n,
  54151. _ = -this.m_angularMass * u,
  54152. f = this.m_angularImpulse,
  54153. d = c * this.m_maxTorque;
  54154. this.m_angularImpulse = b(this.m_angularImpulse + _, -d, d), n -= l * (_ = this.m_angularImpulse - f), s += h * _;
  54155. var p = P.SubVV(P.AddVCrossSV(r, s, this.m_rB, P.s_t0), P.AddVCrossSV(e, n, this.m_rA, P.s_t1), i.SolveVelocityConstraints_s_Cdot_v2),
  54156. m = L.MulMV(this.m_linearMass, p, i.SolveVelocityConstraints_s_impulseV).SelfNeg(),
  54157. y = i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);
  54158. this.m_linearImpulse.SelfAdd(m);
  54159. d = c * this.m_maxForce;
  54160. this.m_linearImpulse.LengthSquared() > d * d && (this.m_linearImpulse.Normalize(), this.m_linearImpulse.SelfMul(d)), P.SubVV(this.m_linearImpulse, y, m), e.SelfMulSub(o, m), n -= l * P.CrossVV(this.m_rA, m), r.SelfMulAdd(a, m), s += h * P.CrossVV(this.m_rB, m), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
  54161. }, i.prototype.SolvePositionConstraints = function(t) {
  54162. return !0
  54163. }, i.prototype.GetAnchorA = function(t) {
  54164. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  54165. }, i.prototype.GetAnchorB = function(t) {
  54166. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  54167. }, i.prototype.GetReactionForce = function(t, e) {
  54168. return e.x = t * this.m_linearImpulse.x, e.y = t * this.m_linearImpulse.y, e
  54169. }, i.prototype.GetReactionTorque = function(t) {
  54170. return t * this.m_angularImpulse
  54171. }, i.prototype.GetLocalAnchorA = function() {
  54172. return this.m_localAnchorA
  54173. }, i.prototype.GetLocalAnchorB = function() {
  54174. return this.m_localAnchorB
  54175. }, i.prototype.SetMaxForce = function(t) {
  54176. this.m_maxForce = t
  54177. }, i.prototype.GetMaxForce = function() {
  54178. return this.m_maxForce
  54179. }, i.prototype.SetMaxTorque = function(t) {
  54180. this.m_maxTorque = t
  54181. }, i.prototype.GetMaxTorque = function() {
  54182. return this.m_maxTorque
  54183. }, i.prototype.Dump = function(t) {
  54184. var e = this.m_bodyA.m_islandIndex,
  54185. i = this.m_bodyB.m_islandIndex;
  54186. t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.maxForce = %.15f;\n", this.m_maxForce), t(" jd.maxTorque = %.15f;\n", this.m_maxTorque), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  54187. }, i.SolveVelocityConstraints_s_Cdot_v2 = new P, i.SolveVelocityConstraints_s_impulseV = new P, i.SolveVelocityConstraints_s_oldImpulseV = new P, i
  54188. })(fi),
  54189. xi = (function(e) {
  54190. function i() {
  54191. var i = e.call(this, t.b2JointType.e_gearJoint) || this;
  54192. return i.ratio = 1, i
  54193. }
  54194. return $e(i, e), i
  54195. })(_i),
  54196. bi = (function(i) {
  54197. function n(n) {
  54198. var r, s, o = i.call(this, n) || this;
  54199. o.m_typeA = t.b2JointType.e_unknownJoint, o.m_typeB = t.b2JointType.e_unknownJoint, o.m_localAnchorA = new P, o.m_localAnchorB = new P, o.m_localAnchorC = new P, o.m_localAnchorD = new P, o.m_localAxisC = new P, o.m_localAxisD = new P, o.m_referenceAngleA = 0, o.m_referenceAngleB = 0, o.m_constant = 0, o.m_ratio = 0, o.m_impulse = 0, o.m_indexA = 0, o.m_indexB = 0, o.m_indexC = 0, o.m_indexD = 0, o.m_lcA = new P, o.m_lcB = new P, o.m_lcC = new P, o.m_lcD = new P, o.m_mA = 0, o.m_mB = 0, o.m_mC = 0, o.m_mD = 0, o.m_iA = 0, o.m_iB = 0, o.m_iC = 0, o.m_iD = 0, o.m_JvAC = new P, o.m_JvBD = new P, o.m_JwA = 0, o.m_JwB = 0, o.m_JwC = 0, o.m_JwD = 0, o.m_mass = 0, o.m_qA = new N, o.m_qB = new N, o.m_qC = new N, o.m_qD = new N, o.m_lalcA = new P, o.m_lalcB = new P, o.m_lalcC = new P, o.m_lalcD = new P, o.m_joint1 = n.joint1, o.m_joint2 = n.joint2, o.m_typeA = o.m_joint1.GetType(), o.m_typeB = o.m_joint2.GetType(), o.m_bodyC = o.m_joint1.GetBodyA(), o.m_bodyA = o.m_joint1.GetBodyB();
  54200. var a = o.m_bodyA.m_xf,
  54201. l = o.m_bodyA.m_sweep.a,
  54202. h = o.m_bodyC.m_xf,
  54203. c = o.m_bodyC.m_sweep.a;
  54204. if (o.m_typeA === t.b2JointType.e_revoluteJoint) {
  54205. var u = n.joint1;
  54206. o.m_localAnchorC.Copy(u.m_localAnchorA), o.m_localAnchorA.Copy(u.m_localAnchorB), o.m_referenceAngleA = u.m_referenceAngle, o.m_localAxisC.SetZero(), r = l - c - o.m_referenceAngleA
  54207. } else {
  54208. var _ = n.joint1;
  54209. o.m_localAnchorC.Copy(_.m_localAnchorA), o.m_localAnchorA.Copy(_.m_localAnchorB), o.m_referenceAngleA = _.m_referenceAngle, o.m_localAxisC.Copy(_.m_localXAxisA);
  54210. var f = o.m_localAnchorC,
  54211. d = N.MulTRV(h.q, P.AddVV(N.MulRV(a.q, o.m_localAnchorA, P.s_t0), P.SubVV(a.p, h.p, P.s_t1), P.s_t0), P.s_t0);
  54212. r = P.DotVV(P.SubVV(d, f, P.s_t0), o.m_localAxisC)
  54213. }
  54214. o.m_bodyD = o.m_joint2.GetBodyA(), o.m_bodyB = o.m_joint2.GetBodyB();
  54215. var p = o.m_bodyB.m_xf,
  54216. m = o.m_bodyB.m_sweep.a,
  54217. y = o.m_bodyD.m_xf,
  54218. v = o.m_bodyD.m_sweep.a;
  54219. if (o.m_typeB === t.b2JointType.e_revoluteJoint) {
  54220. u = n.joint2;
  54221. o.m_localAnchorD.Copy(u.m_localAnchorA), o.m_localAnchorB.Copy(u.m_localAnchorB), o.m_referenceAngleB = u.m_referenceAngle, o.m_localAxisD.SetZero(), s = m - v - o.m_referenceAngleB
  54222. } else {
  54223. _ = n.joint2;
  54224. o.m_localAnchorD.Copy(_.m_localAnchorA), o.m_localAnchorB.Copy(_.m_localAnchorB), o.m_referenceAngleB = _.m_referenceAngle, o.m_localAxisD.Copy(_.m_localXAxisA);
  54225. var g = o.m_localAnchorD,
  54226. x = N.MulTRV(y.q, P.AddVV(N.MulRV(p.q, o.m_localAnchorB, P.s_t0), P.SubVV(p.p, y.p, P.s_t1), P.s_t0), P.s_t0);
  54227. s = P.DotVV(P.SubVV(x, g, P.s_t0), o.m_localAxisD)
  54228. }
  54229. return o.m_ratio = e(n.ratio, 1), o.m_constant = r + o.m_ratio * s, o.m_impulse = 0, o
  54230. }
  54231. return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
  54232. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_indexC = this.m_bodyC.m_islandIndex, this.m_indexD = this.m_bodyD.m_islandIndex, this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter), this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter), this.m_mA = this.m_bodyA.m_invMass, this.m_mB = this.m_bodyB.m_invMass, this.m_mC = this.m_bodyC.m_invMass, this.m_mD = this.m_bodyD.m_invMass, this.m_iA = this.m_bodyA.m_invI, this.m_iB = this.m_bodyB.m_invI, this.m_iC = this.m_bodyC.m_invI, this.m_iD = this.m_bodyD.m_invI;
  54233. var i = e.positions[this.m_indexA].a,
  54234. r = e.velocities[this.m_indexA].v,
  54235. s = e.velocities[this.m_indexA].w,
  54236. o = e.positions[this.m_indexB].a,
  54237. a = e.velocities[this.m_indexB].v,
  54238. l = e.velocities[this.m_indexB].w,
  54239. h = e.positions[this.m_indexC].a,
  54240. c = e.velocities[this.m_indexC].v,
  54241. u = e.velocities[this.m_indexC].w,
  54242. _ = e.positions[this.m_indexD].a,
  54243. f = e.velocities[this.m_indexD].v,
  54244. d = e.velocities[this.m_indexD].w,
  54245. p = this.m_qA.SetAngle(i),
  54246. m = this.m_qB.SetAngle(o),
  54247. y = this.m_qC.SetAngle(h),
  54248. v = this.m_qD.SetAngle(_);
  54249. if (this.m_mass = 0, this.m_typeA === t.b2JointType.e_revoluteJoint) this.m_JvAC.SetZero(), this.m_JwA = 1, this.m_JwC = 1, this.m_mass += this.m_iA + this.m_iC;
  54250. else {
  54251. var g = N.MulRV(y, this.m_localAxisC, n.InitVelocityConstraints_s_u);
  54252. P.SubVV(this.m_localAnchorC, this.m_lcC, this.m_lalcC);
  54253. var x = N.MulRV(y, this.m_lalcC, n.InitVelocityConstraints_s_rC);
  54254. P.SubVV(this.m_localAnchorA, this.m_lcA, this.m_lalcA);
  54255. var b = N.MulRV(p, this.m_lalcA, n.InitVelocityConstraints_s_rA);
  54256. this.m_JvAC.Copy(g), this.m_JwC = P.CrossVV(x, g), this.m_JwA = P.CrossVV(b, g), this.m_mass += this.m_mC + this.m_mA + this.m_iC * this.m_JwC * this.m_JwC + this.m_iA * this.m_JwA * this.m_JwA
  54257. }
  54258. if (this.m_typeB === t.b2JointType.e_revoluteJoint) this.m_JvBD.SetZero(), this.m_JwB = this.m_ratio, this.m_JwD = this.m_ratio, this.m_mass += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD);
  54259. else {
  54260. g = N.MulRV(v, this.m_localAxisD, n.InitVelocityConstraints_s_u);
  54261. P.SubVV(this.m_localAnchorD, this.m_lcD, this.m_lalcD);
  54262. var A = N.MulRV(v, this.m_lalcD, n.InitVelocityConstraints_s_rD);
  54263. P.SubVV(this.m_localAnchorB, this.m_lcB, this.m_lalcB);
  54264. var C = N.MulRV(m, this.m_lalcB, n.InitVelocityConstraints_s_rB);
  54265. P.MulSV(this.m_ratio, g, this.m_JvBD), this.m_JwD = this.m_ratio * P.CrossVV(A, g), this.m_JwB = this.m_ratio * P.CrossVV(C, g), this.m_mass += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * this.m_JwD * this.m_JwD + this.m_iB * this.m_JwB * this.m_JwB
  54266. }
  54267. this.m_mass = this.m_mass > 0 ? 1 / this.m_mass : 0, e.step.warmStarting ? (r.SelfMulAdd(this.m_mA * this.m_impulse, this.m_JvAC), s += this.m_iA * this.m_impulse * this.m_JwA, a.SelfMulAdd(this.m_mB * this.m_impulse, this.m_JvBD), l += this.m_iB * this.m_impulse * this.m_JwB, c.SelfMulSub(this.m_mC * this.m_impulse, this.m_JvAC), u -= this.m_iC * this.m_impulse * this.m_JwC, f.SelfMulSub(this.m_mD * this.m_impulse, this.m_JvBD), d -= this.m_iD * this.m_impulse * this.m_JwD) : this.m_impulse = 0, e.velocities[this.m_indexA].w = s, e.velocities[this.m_indexB].w = l, e.velocities[this.m_indexC].w = u, e.velocities[this.m_indexD].w = d
  54268. }, n.prototype.SolveVelocityConstraints = function(t) {
  54269. var e = t.velocities[this.m_indexA].v,
  54270. i = t.velocities[this.m_indexA].w,
  54271. n = t.velocities[this.m_indexB].v,
  54272. r = t.velocities[this.m_indexB].w,
  54273. s = t.velocities[this.m_indexC].v,
  54274. o = t.velocities[this.m_indexC].w,
  54275. a = t.velocities[this.m_indexD].v,
  54276. l = t.velocities[this.m_indexD].w,
  54277. h = P.DotVV(this.m_JvAC, P.SubVV(e, s, P.s_t0)) + P.DotVV(this.m_JvBD, P.SubVV(n, a, P.s_t0));
  54278. h += this.m_JwA * i - this.m_JwC * o + (this.m_JwB * r - this.m_JwD * l);
  54279. var c = -this.m_mass * h;
  54280. this.m_impulse += c, e.SelfMulAdd(this.m_mA * c, this.m_JvAC), i += this.m_iA * c * this.m_JwA, n.SelfMulAdd(this.m_mB * c, this.m_JvBD), r += this.m_iB * c * this.m_JwB, s.SelfMulSub(this.m_mC * c, this.m_JvAC), o -= this.m_iC * c * this.m_JwC, a.SelfMulSub(this.m_mD * c, this.m_JvBD), l -= this.m_iD * c * this.m_JwD, t.velocities[this.m_indexA].w = i, t.velocities[this.m_indexB].w = r, t.velocities[this.m_indexC].w = o, t.velocities[this.m_indexD].w = l
  54281. }, n.prototype.SolvePositionConstraints = function(e) {
  54282. var i, r, s, o, a, h, c = e.positions[this.m_indexA].c,
  54283. u = e.positions[this.m_indexA].a,
  54284. _ = e.positions[this.m_indexB].c,
  54285. f = e.positions[this.m_indexB].a,
  54286. d = e.positions[this.m_indexC].c,
  54287. p = e.positions[this.m_indexC].a,
  54288. m = e.positions[this.m_indexD].c,
  54289. y = e.positions[this.m_indexD].a,
  54290. v = this.m_qA.SetAngle(u),
  54291. g = this.m_qB.SetAngle(f),
  54292. x = this.m_qC.SetAngle(p),
  54293. b = this.m_qD.SetAngle(y),
  54294. A = this.m_JvAC,
  54295. C = this.m_JvBD,
  54296. T = 0;
  54297. if (this.m_typeA === t.b2JointType.e_revoluteJoint) A.SetZero(), s = 1, a = 1, T += this.m_iA + this.m_iC, i = u - p - this.m_referenceAngleA;
  54298. else {
  54299. var S = N.MulRV(x, this.m_localAxisC, n.SolvePositionConstraints_s_u),
  54300. w = N.MulRV(x, this.m_lalcC, n.SolvePositionConstraints_s_rC),
  54301. E = N.MulRV(v, this.m_lalcA, n.SolvePositionConstraints_s_rA);
  54302. A.Copy(S), a = P.CrossVV(w, S), s = P.CrossVV(E, S), T += this.m_mC + this.m_mA + this.m_iC * a * a + this.m_iA * s * s;
  54303. var M = this.m_lalcC,
  54304. D = N.MulTRV(x, P.AddVV(E, P.SubVV(c, d, P.s_t0), P.s_t0), P.s_t0);
  54305. i = P.DotVV(P.SubVV(D, M, P.s_t0), this.m_localAxisC)
  54306. }
  54307. if (this.m_typeB === t.b2JointType.e_revoluteJoint) C.SetZero(), o = this.m_ratio, h = this.m_ratio, T += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD), r = f - y - this.m_referenceAngleB;
  54308. else {
  54309. S = N.MulRV(b, this.m_localAxisD, n.SolvePositionConstraints_s_u);
  54310. var B = N.MulRV(b, this.m_lalcD, n.SolvePositionConstraints_s_rD),
  54311. I = N.MulRV(g, this.m_lalcB, n.SolvePositionConstraints_s_rB);
  54312. P.MulSV(this.m_ratio, S, C), h = this.m_ratio * P.CrossVV(B, S), o = this.m_ratio * P.CrossVV(I, S), T += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * h * h + this.m_iB * o * o;
  54313. var R = this.m_lalcD,
  54314. O = N.MulTRV(b, P.AddVV(I, P.SubVV(_, m, P.s_t0), P.s_t0), P.s_t0);
  54315. r = P.DotVV(P.SubVV(O, R, P.s_t0), this.m_localAxisD)
  54316. }
  54317. var L = i + this.m_ratio * r - this.m_constant,
  54318. F = 0;
  54319. return T > 0 && (F = -L / T), c.SelfMulAdd(this.m_mA * F, A), u += this.m_iA * F * s, _.SelfMulAdd(this.m_mB * F, C), f += this.m_iB * F * o, d.SelfMulSub(this.m_mC * F, A), p -= this.m_iC * F * a, m.SelfMulSub(this.m_mD * F, C), y -= this.m_iD * F * h, e.positions[this.m_indexA].a = u, e.positions[this.m_indexB].a = f, e.positions[this.m_indexC].a = p, e.positions[this.m_indexD].a = y, 0 < l
  54320. }, n.prototype.GetAnchorA = function(t) {
  54321. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  54322. }, n.prototype.GetAnchorB = function(t) {
  54323. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  54324. }, n.prototype.GetReactionForce = function(t, e) {
  54325. return P.MulSV(t * this.m_impulse, this.m_JvAC, e)
  54326. }, n.prototype.GetReactionTorque = function(t) {
  54327. return t * this.m_impulse * this.m_JwA
  54328. }, n.prototype.GetJoint1 = function() {
  54329. return this.m_joint1
  54330. }, n.prototype.GetJoint2 = function() {
  54331. return this.m_joint2
  54332. }, n.prototype.GetRatio = function() {
  54333. return this.m_ratio
  54334. }, n.prototype.SetRatio = function(t) {
  54335. this.m_ratio = t
  54336. }, n.prototype.Dump = function(t) {
  54337. var e = this.m_bodyA.m_islandIndex,
  54338. i = this.m_bodyB.m_islandIndex,
  54339. n = this.m_joint1.m_index,
  54340. r = this.m_joint2.m_index;
  54341. t(" const jd: b2GearJointDef = new b2GearJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.joint1 = joints[%d];\n", n), t(" jd.joint2 = joints[%d];\n", r), t(" jd.ratio = %.15f;\n", this.m_ratio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  54342. }, n.InitVelocityConstraints_s_u = new P, n.InitVelocityConstraints_s_rA = new P, n.InitVelocityConstraints_s_rB = new P, n.InitVelocityConstraints_s_rC = new P, n.InitVelocityConstraints_s_rD = new P, n.SolvePositionConstraints_s_u = new P, n.SolvePositionConstraints_s_rA = new P, n.SolvePositionConstraints_s_rB = new P, n.SolvePositionConstraints_s_rC = new P, n.SolvePositionConstraints_s_rD = new P, n
  54343. })(fi),
  54344. Ai = (function(e) {
  54345. function i() {
  54346. var i = e.call(this, t.b2JointType.e_motorJoint) || this;
  54347. return i.linearOffset = new P(0, 0), i.angularOffset = 0, i.maxForce = 1, i.maxTorque = 1, i.correctionFactor = .3, i
  54348. }
  54349. return $e(i, e), i.prototype.Initialize = function(t, e) {
  54350. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(this.bodyB.GetPosition(), this.linearOffset);
  54351. var i = this.bodyA.GetAngle(),
  54352. n = this.bodyB.GetAngle();
  54353. this.angularOffset = n - i
  54354. }, i
  54355. })(_i),
  54356. Ci = (function(t) {
  54357. function i(i) {
  54358. var n = t.call(this, i) || this;
  54359. return n.m_linearOffset = new P, n.m_angularOffset = 0, n.m_linearImpulse = new P, n.m_angularImpulse = 0, n.m_maxForce = 0, n.m_maxTorque = 0, n.m_correctionFactor = .3, n.m_indexA = 0, n.m_indexB = 0, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_linearError = new P, n.m_angularError = 0, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_linearMass = new L, n.m_angularMass = 0, n.m_qA = new N, n.m_qB = new N, n.m_K = new L, n.m_linearOffset.Copy(e(i.linearOffset, P.ZERO)), n.m_linearImpulse.SetZero(), n.m_maxForce = e(i.maxForce, 0), n.m_maxTorque = e(i.maxTorque, 0), n.m_correctionFactor = e(i.correctionFactor, .3), n
  54360. }
  54361. return $e(i, t), i.prototype.GetAnchorA = function(t) {
  54362. var e = this.m_bodyA.GetPosition();
  54363. return t.x = e.x, t.y = e.y, t
  54364. }, i.prototype.GetAnchorB = function(t) {
  54365. var e = this.m_bodyB.GetPosition();
  54366. return t.x = e.x, t.y = e.y, t
  54367. }, i.prototype.GetReactionForce = function(t, e) {
  54368. return P.MulSV(t, this.m_linearImpulse, e)
  54369. }, i.prototype.GetReactionTorque = function(t) {
  54370. return t * this.m_angularImpulse
  54371. }, i.prototype.SetLinearOffset = function(t) {
  54372. P.IsEqualToV(t, this.m_linearOffset) || (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_linearOffset.Copy(t))
  54373. }, i.prototype.GetLinearOffset = function() {
  54374. return this.m_linearOffset
  54375. }, i.prototype.SetAngularOffset = function(t) {
  54376. t !== this.m_angularOffset && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_angularOffset = t)
  54377. }, i.prototype.GetAngularOffset = function() {
  54378. return this.m_angularOffset
  54379. }, i.prototype.SetMaxForce = function(t) {
  54380. this.m_maxForce = t
  54381. }, i.prototype.GetMaxForce = function() {
  54382. return this.m_maxForce
  54383. }, i.prototype.SetMaxTorque = function(t) {
  54384. this.m_maxTorque = t
  54385. }, i.prototype.GetMaxTorque = function() {
  54386. return this.m_maxTorque
  54387. }, i.prototype.InitVelocityConstraints = function(t) {
  54388. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  54389. var e = t.positions[this.m_indexA].c,
  54390. i = t.positions[this.m_indexA].a,
  54391. n = t.velocities[this.m_indexA].v,
  54392. r = t.velocities[this.m_indexA].w,
  54393. s = t.positions[this.m_indexB].c,
  54394. o = t.positions[this.m_indexB].a,
  54395. a = t.velocities[this.m_indexB].v,
  54396. l = t.velocities[this.m_indexB].w,
  54397. h = this.m_qA.SetAngle(i),
  54398. c = this.m_qB.SetAngle(o),
  54399. u = N.MulRV(h, P.SubVV(this.m_linearOffset, this.m_localCenterA, P.s_t0), this.m_rA),
  54400. _ = N.MulRV(c, P.NegV(this.m_localCenterB, P.s_t0), this.m_rB),
  54401. f = this.m_invMassA,
  54402. d = this.m_invMassB,
  54403. p = this.m_invIA,
  54404. m = this.m_invIB,
  54405. y = this.m_K;
  54406. if (y.ex.x = f + d + p * u.y * u.y + m * _.y * _.y, y.ex.y = -p * u.x * u.y - m * _.x * _.y, y.ey.x = y.ex.y, y.ey.y = f + d + p * u.x * u.x + m * _.x * _.x, y.GetInverse(this.m_linearMass), this.m_angularMass = p + m, this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass), P.SubVV(P.AddVV(s, _, P.s_t0), P.AddVV(e, u, P.s_t1), this.m_linearError), this.m_angularError = o - i - this.m_angularOffset, t.step.warmStarting) {
  54407. this.m_linearImpulse.SelfMul(t.step.dtRatio), this.m_angularImpulse *= t.step.dtRatio;
  54408. var v = this.m_linearImpulse;
  54409. n.SelfMulSub(f, v), r -= p * (P.CrossVV(u, v) + this.m_angularImpulse), a.SelfMulAdd(d, v), l += m * (P.CrossVV(_, v) + this.m_angularImpulse)
  54410. } else this.m_linearImpulse.SetZero(), this.m_angularImpulse = 0;
  54411. t.velocities[this.m_indexA].w = r, t.velocities[this.m_indexB].w = l
  54412. }, i.prototype.SolveVelocityConstraints = function(t) {
  54413. var e = t.velocities[this.m_indexA].v,
  54414. n = t.velocities[this.m_indexA].w,
  54415. r = t.velocities[this.m_indexB].v,
  54416. s = t.velocities[this.m_indexB].w,
  54417. o = this.m_invMassA,
  54418. a = this.m_invMassB,
  54419. l = this.m_invIA,
  54420. h = this.m_invIB,
  54421. c = t.step.dt,
  54422. u = t.step.inv_dt,
  54423. _ = s - n + u * this.m_correctionFactor * this.m_angularError,
  54424. f = -this.m_angularMass * _,
  54425. d = this.m_angularImpulse,
  54426. p = c * this.m_maxTorque;
  54427. this.m_angularImpulse = b(this.m_angularImpulse + f, -p, p), n -= l * (f = this.m_angularImpulse - d), s += h * f;
  54428. var m = this.m_rA,
  54429. y = this.m_rB,
  54430. v = P.AddVV(P.SubVV(P.AddVV(r, P.CrossSV(s, y, P.s_t0), P.s_t0), P.AddVV(e, P.CrossSV(n, m, P.s_t1), P.s_t1), P.s_t2), P.MulSV(u * this.m_correctionFactor, this.m_linearError, P.s_t3), i.SolveVelocityConstraints_s_Cdot_v2),
  54431. g = L.MulMV(this.m_linearMass, v, i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),
  54432. x = i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);
  54433. this.m_linearImpulse.SelfAdd(g);
  54434. p = c * this.m_maxForce;
  54435. this.m_linearImpulse.LengthSquared() > p * p && (this.m_linearImpulse.Normalize(), this.m_linearImpulse.SelfMul(p)), P.SubVV(this.m_linearImpulse, x, g), e.SelfMulSub(o, g), n -= l * P.CrossVV(m, g), r.SelfMulAdd(a, g), s += h * P.CrossVV(y, g), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
  54436. }, i.prototype.SolvePositionConstraints = function(t) {
  54437. return !0
  54438. }, i.prototype.Dump = function(t) {
  54439. var e = this.m_bodyA.m_islandIndex,
  54440. i = this.m_bodyB.m_islandIndex;
  54441. t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.linearOffset.Set(%.15f, %.15f);\n", this.m_linearOffset.x, this.m_linearOffset.y), t(" jd.angularOffset = %.15f;\n", this.m_angularOffset), t(" jd.maxForce = %.15f;\n", this.m_maxForce), t(" jd.maxTorque = %.15f;\n", this.m_maxTorque), t(" jd.correctionFactor = %.15f;\n", this.m_correctionFactor), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  54442. }, i.SolveVelocityConstraints_s_Cdot_v2 = new P, i.SolveVelocityConstraints_s_impulse_v2 = new P, i.SolveVelocityConstraints_s_oldImpulse_v2 = new P, i
  54443. })(fi),
  54444. Ti = (function(e) {
  54445. function i() {
  54446. var i = e.call(this, t.b2JointType.e_mouseJoint) || this;
  54447. return i.target = new P, i.maxForce = 0, i.frequencyHz = 5, i.dampingRatio = .7, i
  54448. }
  54449. return $e(i, e), i
  54450. })(_i),
  54451. Si = (function(t) {
  54452. function i(i) {
  54453. var n = t.call(this, i) || this;
  54454. return n.m_localAnchorB = new P, n.m_targetA = new P, n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_beta = 0, n.m_impulse = new P, n.m_maxForce = 0, n.m_gamma = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_rB = new P, n.m_localCenterB = new P, n.m_invMassB = 0, n.m_invIB = 0, n.m_mass = new L, n.m_C = new P, n.m_qB = new N, n.m_lalcB = new P, n.m_K = new L, n.m_targetA.Copy(e(i.target, P.ZERO)), V.MulTXV(n.m_bodyB.GetTransform(), n.m_targetA, n.m_localAnchorB), n.m_maxForce = e(i.maxForce, 0), n.m_impulse.SetZero(), n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_beta = 0, n.m_gamma = 0, n
  54455. }
  54456. return $e(i, t), i.prototype.SetTarget = function(t) {
  54457. this.m_bodyB.IsAwake() || this.m_bodyB.SetAwake(!0), this.m_targetA.Copy(t)
  54458. }, i.prototype.GetTarget = function() {
  54459. return this.m_targetA
  54460. }, i.prototype.SetMaxForce = function(t) {
  54461. this.m_maxForce = t
  54462. }, i.prototype.GetMaxForce = function() {
  54463. return this.m_maxForce
  54464. }, i.prototype.SetFrequency = function(t) {
  54465. this.m_frequencyHz = t
  54466. }, i.prototype.GetFrequency = function() {
  54467. return this.m_frequencyHz
  54468. }, i.prototype.SetDampingRatio = function(t) {
  54469. this.m_dampingRatio = t
  54470. }, i.prototype.GetDampingRatio = function() {
  54471. return this.m_dampingRatio
  54472. }, i.prototype.InitVelocityConstraints = function(t) {
  54473. this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIB = this.m_bodyB.m_invI;
  54474. var e = t.positions[this.m_indexB].c,
  54475. i = t.positions[this.m_indexB].a,
  54476. n = t.velocities[this.m_indexB].v,
  54477. r = t.velocities[this.m_indexB].w,
  54478. o = this.m_qB.SetAngle(i),
  54479. a = this.m_bodyB.GetMass(),
  54480. l = 2 * s * this.m_frequencyHz,
  54481. h = 2 * a * this.m_dampingRatio * l,
  54482. c = a * (l * l),
  54483. u = t.step.dt;
  54484. this.m_gamma = u * (h + u * c), 0 !== this.m_gamma && (this.m_gamma = 1 / this.m_gamma), this.m_beta = u * c * this.m_gamma, P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(o, this.m_lalcB, this.m_rB);
  54485. var _ = this.m_K;
  54486. _.ex.x = this.m_invMassB + this.m_invIB * this.m_rB.y * this.m_rB.y + this.m_gamma, _.ex.y = -this.m_invIB * this.m_rB.x * this.m_rB.y, _.ey.x = _.ex.y, _.ey.y = this.m_invMassB + this.m_invIB * this.m_rB.x * this.m_rB.x + this.m_gamma, _.GetInverse(this.m_mass), this.m_C.x = e.x + this.m_rB.x - this.m_targetA.x, this.m_C.y = e.y + this.m_rB.y - this.m_targetA.y, this.m_C.SelfMul(this.m_beta), r *= .98, t.step.warmStarting ? (this.m_impulse.SelfMul(t.step.dtRatio), n.x += this.m_invMassB * this.m_impulse.x, n.y += this.m_invMassB * this.m_impulse.y, r += this.m_invIB * P.CrossVV(this.m_rB, this.m_impulse)) : this.m_impulse.SetZero(), t.velocities[this.m_indexB].w = r
  54487. }, i.prototype.SolveVelocityConstraints = function(t) {
  54488. var e = t.velocities[this.m_indexB].v,
  54489. n = t.velocities[this.m_indexB].w,
  54490. r = P.AddVCrossSV(e, n, this.m_rB, i.SolveVelocityConstraints_s_Cdot),
  54491. s = L.MulMV(this.m_mass, P.AddVV(r, P.AddVV(this.m_C, P.MulSV(this.m_gamma, this.m_impulse, P.s_t0), P.s_t0), P.s_t0).SelfNeg(), i.SolveVelocityConstraints_s_impulse),
  54492. o = i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);
  54493. this.m_impulse.SelfAdd(s);
  54494. var a = t.step.dt * this.m_maxForce;
  54495. this.m_impulse.LengthSquared() > a * a && this.m_impulse.SelfMul(a / this.m_impulse.Length()), P.SubVV(this.m_impulse, o, s), e.SelfMulAdd(this.m_invMassB, s), n += this.m_invIB * P.CrossVV(this.m_rB, s), t.velocities[this.m_indexB].w = n
  54496. }, i.prototype.SolvePositionConstraints = function(t) {
  54497. return !0
  54498. }, i.prototype.GetAnchorA = function(t) {
  54499. return t.x = this.m_targetA.x, t.y = this.m_targetA.y, t
  54500. }, i.prototype.GetAnchorB = function(t) {
  54501. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  54502. }, i.prototype.GetReactionForce = function(t, e) {
  54503. return P.MulSV(t, this.m_impulse, e)
  54504. }, i.prototype.GetReactionTorque = function(t) {
  54505. return 0
  54506. }, i.prototype.Dump = function(t) {
  54507. t("Mouse joint dumping is not supported.\n")
  54508. }, i.prototype.ShiftOrigin = function(t) {
  54509. this.m_targetA.SelfSub(t)
  54510. }, i.SolveVelocityConstraints_s_Cdot = new P, i.SolveVelocityConstraints_s_impulse = new P, i.SolveVelocityConstraints_s_oldImpulse = new P, i
  54511. })(fi),
  54512. wi = (function(e) {
  54513. function i() {
  54514. var i = e.call(this, t.b2JointType.e_prismaticJoint) || this;
  54515. return i.localAnchorA = new P, i.localAnchorB = new P, i.localAxisA = new P(1, 0), i.referenceAngle = 0, i.enableLimit = !1, i.lowerTranslation = 0, i.upperTranslation = 0, i.enableMotor = !1, i.maxMotorForce = 0, i.motorSpeed = 0, i
  54516. }
  54517. return $e(i, e), i.prototype.Initialize = function(t, e, i, n) {
  54518. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.bodyA.GetLocalVector(n, this.localAxisA), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle()
  54519. }, i
  54520. })(_i),
  54521. Ei = (function(i) {
  54522. function n(n) {
  54523. var r = i.call(this, n) || this;
  54524. return r.m_localAnchorA = new P, r.m_localAnchorB = new P, r.m_localXAxisA = new P, r.m_localYAxisA = new P, r.m_referenceAngle = 0, r.m_impulse = new O(0, 0, 0), r.m_motorImpulse = 0, r.m_lowerTranslation = 0, r.m_upperTranslation = 0, r.m_maxMotorForce = 0, r.m_motorSpeed = 0, r.m_enableLimit = !1, r.m_enableMotor = !1, r.m_limitState = t.b2LimitState.e_inactiveLimit, r.m_indexA = 0, r.m_indexB = 0, r.m_localCenterA = new P, r.m_localCenterB = new P, r.m_invMassA = 0, r.m_invMassB = 0, r.m_invIA = 0, r.m_invIB = 0, r.m_axis = new P(0, 0), r.m_perp = new P(0, 0), r.m_s1 = 0, r.m_s2 = 0, r.m_a1 = 0, r.m_a2 = 0, r.m_K = new F, r.m_K3 = new F, r.m_K2 = new L, r.m_motorMass = 0, r.m_qA = new N, r.m_qB = new N, r.m_lalcA = new P, r.m_lalcB = new P, r.m_rA = new P, r.m_rB = new P, r.m_localAnchorA.Copy(e(n.localAnchorA, P.ZERO)), r.m_localAnchorB.Copy(e(n.localAnchorB, P.ZERO)), r.m_localXAxisA.Copy(e(n.localAxisA, new P(1, 0))).SelfNormalize(), P.CrossOneV(r.m_localXAxisA, r.m_localYAxisA), r.m_referenceAngle = e(n.referenceAngle, 0), r.m_lowerTranslation = e(n.lowerTranslation, 0), r.m_upperTranslation = e(n.upperTranslation, 0), r.m_maxMotorForce = e(n.maxMotorForce, 0), r.m_motorSpeed = e(n.motorSpeed, 0), r.m_enableLimit = e(n.enableLimit, !1), r.m_enableMotor = e(n.enableMotor, !1), r
  54525. }
  54526. return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
  54527. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  54528. var i = e.positions[this.m_indexA].c,
  54529. r = e.positions[this.m_indexA].a,
  54530. s = e.velocities[this.m_indexA].v,
  54531. o = e.velocities[this.m_indexA].w,
  54532. a = e.positions[this.m_indexB].c,
  54533. h = e.positions[this.m_indexB].a,
  54534. c = e.velocities[this.m_indexB].v,
  54535. u = e.velocities[this.m_indexB].w,
  54536. _ = this.m_qA.SetAngle(r),
  54537. f = this.m_qB.SetAngle(h);
  54538. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  54539. var d = N.MulRV(_, this.m_lalcA, this.m_rA);
  54540. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  54541. var p = N.MulRV(f, this.m_lalcB, this.m_rB),
  54542. m = P.AddVV(P.SubVV(a, i, P.s_t0), P.SubVV(p, d, P.s_t1), n.InitVelocityConstraints_s_d),
  54543. y = this.m_invMassA,
  54544. g = this.m_invMassB,
  54545. x = this.m_invIA,
  54546. b = this.m_invIB;
  54547. if (N.MulRV(_, this.m_localXAxisA, this.m_axis), this.m_a1 = P.CrossVV(P.AddVV(m, d, P.s_t0), this.m_axis), this.m_a2 = P.CrossVV(p, this.m_axis), this.m_motorMass = y + g + x * this.m_a1 * this.m_a1 + b * this.m_a2 * this.m_a2, this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass), N.MulRV(_, this.m_localYAxisA, this.m_perp), this.m_s1 = P.CrossVV(P.AddVV(m, d, P.s_t0), this.m_perp), this.m_s2 = P.CrossVV(p, this.m_perp), this.m_K.ex.x = y + g + x * this.m_s1 * this.m_s1 + b * this.m_s2 * this.m_s2, this.m_K.ex.y = x * this.m_s1 + b * this.m_s2, this.m_K.ex.z = x * this.m_s1 * this.m_a1 + b * this.m_s2 * this.m_a2, this.m_K.ey.x = this.m_K.ex.y, this.m_K.ey.y = x + b, 0 === this.m_K.ey.y && (this.m_K.ey.y = 1), this.m_K.ey.z = x * this.m_a1 + b * this.m_a2, this.m_K.ez.x = this.m_K.ex.z, this.m_K.ez.y = this.m_K.ey.z, this.m_K.ez.z = y + g + x * this.m_a1 * this.m_a1 + b * this.m_a2 * this.m_a2, this.m_enableLimit) {
  54548. var A = P.DotVV(this.m_axis, m);
  54549. v(this.m_upperTranslation - this.m_lowerTranslation) < 2 * l ? this.m_limitState = t.b2LimitState.e_equalLimits : A <= this.m_lowerTranslation ? this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_limitState = t.b2LimitState.e_atLowerLimit, this.m_impulse.z = 0) : A >= this.m_upperTranslation ? this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_limitState = t.b2LimitState.e_atUpperLimit, this.m_impulse.z = 0) : (this.m_limitState = t.b2LimitState.e_inactiveLimit, this.m_impulse.z = 0)
  54550. } else this.m_limitState = t.b2LimitState.e_inactiveLimit, this.m_impulse.z = 0;
  54551. if (this.m_enableMotor || (this.m_motorImpulse = 0), e.step.warmStarting) {
  54552. this.m_impulse.SelfMul(e.step.dtRatio), this.m_motorImpulse *= e.step.dtRatio;
  54553. var C = P.AddVV(P.MulSV(this.m_impulse.x, this.m_perp, P.s_t0), P.MulSV(this.m_motorImpulse + this.m_impulse.z, this.m_axis, P.s_t1), n.InitVelocityConstraints_s_P),
  54554. T = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1,
  54555. S = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2;
  54556. s.SelfMulSub(y, C), o -= x * T, c.SelfMulAdd(g, C), u += b * S
  54557. } else this.m_impulse.SetZero(), this.m_motorImpulse = 0;
  54558. e.velocities[this.m_indexA].w = o, e.velocities[this.m_indexB].w = u
  54559. }, n.prototype.SolveVelocityConstraints = function(e) {
  54560. var i = e.velocities[this.m_indexA].v,
  54561. r = e.velocities[this.m_indexA].w,
  54562. s = e.velocities[this.m_indexB].v,
  54563. o = e.velocities[this.m_indexB].w,
  54564. a = this.m_invMassA,
  54565. l = this.m_invMassB,
  54566. h = this.m_invIA,
  54567. c = this.m_invIB;
  54568. if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits) {
  54569. var u = P.DotVV(this.m_axis, P.SubVV(s, i, P.s_t0)) + this.m_a2 * o - this.m_a1 * r,
  54570. _ = this.m_motorMass * (this.m_motorSpeed - u),
  54571. f = this.m_motorImpulse,
  54572. d = e.step.dt * this.m_maxMotorForce;
  54573. this.m_motorImpulse = b(this.m_motorImpulse + _, -d, d), _ = this.m_motorImpulse - f;
  54574. var p = P.MulSV(_, this.m_axis, n.SolveVelocityConstraints_s_P),
  54575. m = _ * this.m_a1,
  54576. y = _ * this.m_a2;
  54577. i.SelfMulSub(a, p), r -= h * m, s.SelfMulAdd(l, p), o += c * y
  54578. }
  54579. var v = P.DotVV(this.m_perp, P.SubVV(s, i, P.s_t0)) + this.m_s2 * o - this.m_s1 * r,
  54580. A = o - r;
  54581. if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit) {
  54582. var C = P.DotVV(this.m_axis, P.SubVV(s, i, P.s_t0)) + this.m_a2 * o - this.m_a1 * r,
  54583. T = n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),
  54584. S = this.m_K.Solve33(-v, -A, -C, n.SolveVelocityConstraints_s_df3);
  54585. this.m_impulse.SelfAdd(S), this.m_limitState === t.b2LimitState.e_atLowerLimit ? this.m_impulse.z = x(this.m_impulse.z, 0) : this.m_limitState === t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = g(this.m_impulse.z, 0));
  54586. var w = -v - (this.m_impulse.z - T.z) * this.m_K.ez.x,
  54587. E = -A - (this.m_impulse.z - T.z) * this.m_K.ez.y,
  54588. M = this.m_K.Solve22(w, E, n.SolveVelocityConstraints_s_f2r);
  54589. M.x += T.x, M.y += T.y, this.m_impulse.x = M.x, this.m_impulse.y = M.y, S.x = this.m_impulse.x - T.x, S.y = this.m_impulse.y - T.y, S.z = this.m_impulse.z - T.z;
  54590. p = P.AddVV(P.MulSV(S.x, this.m_perp, P.s_t0), P.MulSV(S.z, this.m_axis, P.s_t1), n.SolveVelocityConstraints_s_P), m = S.x * this.m_s1 + S.y + S.z * this.m_a1, y = S.x * this.m_s2 + S.y + S.z * this.m_a2;
  54591. i.SelfMulSub(a, p), r -= h * m, s.SelfMulAdd(l, p), o += c * y
  54592. } else {
  54593. var D = this.m_K.Solve22(-v, -A, n.SolveVelocityConstraints_s_df2);
  54594. this.m_impulse.x += D.x, this.m_impulse.y += D.y;
  54595. p = P.MulSV(D.x, this.m_perp, n.SolveVelocityConstraints_s_P), m = D.x * this.m_s1 + D.y, y = D.x * this.m_s2 + D.y;
  54596. i.SelfMulSub(a, p), r -= h * m, s.SelfMulAdd(l, p), o += c * y
  54597. }
  54598. e.velocities[this.m_indexA].w = r, e.velocities[this.m_indexB].w = o
  54599. }, n.prototype.SolvePositionConstraints = function(t) {
  54600. var e = t.positions[this.m_indexA].c,
  54601. i = t.positions[this.m_indexA].a,
  54602. r = t.positions[this.m_indexB].c,
  54603. s = t.positions[this.m_indexB].a,
  54604. o = this.m_qA.SetAngle(i),
  54605. a = this.m_qB.SetAngle(s),
  54606. c = this.m_invMassA,
  54607. u = this.m_invMassB,
  54608. _ = this.m_invIA,
  54609. f = this.m_invIB,
  54610. d = N.MulRV(o, this.m_lalcA, this.m_rA),
  54611. p = N.MulRV(a, this.m_lalcB, this.m_rB),
  54612. m = P.SubVV(P.AddVV(r, p, P.s_t0), P.AddVV(e, d, P.s_t1), n.SolvePositionConstraints_s_d),
  54613. y = N.MulRV(o, this.m_localXAxisA, this.m_axis),
  54614. g = P.CrossVV(P.AddVV(m, d, P.s_t0), y),
  54615. A = P.CrossVV(p, y),
  54616. C = N.MulRV(o, this.m_localYAxisA, this.m_perp),
  54617. T = P.CrossVV(P.AddVV(m, d, P.s_t0), C),
  54618. S = P.CrossVV(p, C),
  54619. w = n.SolvePositionConstraints_s_impulse,
  54620. E = P.DotVV(C, m),
  54621. M = s - i - this.m_referenceAngle,
  54622. D = v(E),
  54623. B = v(M),
  54624. I = !1,
  54625. R = 0;
  54626. if (this.m_enableLimit) {
  54627. var O = P.DotVV(y, m);
  54628. v(this.m_upperTranslation - this.m_lowerTranslation) < 2 * l ? (R = b(O, -.2, .2), D = x(D, v(O)), I = !0) : O <= this.m_lowerTranslation ? (R = b(O - this.m_lowerTranslation + l, -.2, 0), D = x(D, this.m_lowerTranslation - O), I = !0) : O >= this.m_upperTranslation && (R = b(O - this.m_upperTranslation - l, 0, .2), D = x(D, O - this.m_upperTranslation), I = !0)
  54629. }
  54630. if (I) {
  54631. var L = c + u + _ * T * T + f * S * S,
  54632. F = _ * T + f * S,
  54633. V = _ * T * g + f * S * A;
  54634. 0 === (z = _ + f) && (z = 1);
  54635. var k = _ * g + f * A,
  54636. G = c + u + _ * g * g + f * A * A,
  54637. U = this.m_K3;
  54638. U.ex.SetXYZ(L, F, V), U.ey.SetXYZ(F, z, k), U.ez.SetXYZ(V, k, G), w = U.Solve33(-E, -M, -R, w)
  54639. } else {
  54640. var z;
  54641. L = c + u + _ * T * T + f * S * S, F = _ * T + f * S;
  54642. 0 === (z = _ + f) && (z = 1);
  54643. var j = this.m_K2;
  54644. j.ex.Set(L, F), j.ey.Set(F, z);
  54645. var W = j.Solve(-E, -M, n.SolvePositionConstraints_s_impulse1);
  54646. w.x = W.x, w.y = W.y, w.z = 0
  54647. }
  54648. var H = P.AddVV(P.MulSV(w.x, C, P.s_t0), P.MulSV(w.z, y, P.s_t1), n.SolvePositionConstraints_s_P),
  54649. X = w.x * T + w.y + w.z * g,
  54650. Y = w.x * S + w.y + w.z * A;
  54651. return e.SelfMulSub(c, H), i -= _ * X, r.SelfMulAdd(u, H), s += f * Y, t.positions[this.m_indexA].a = i, t.positions[this.m_indexB].a = s, D <= l && B <= h
  54652. }, n.prototype.GetAnchorA = function(t) {
  54653. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  54654. }, n.prototype.GetAnchorB = function(t) {
  54655. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  54656. }, n.prototype.GetReactionForce = function(t, e) {
  54657. return e.x = t * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x), e.y = t * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y), e
  54658. }, n.prototype.GetReactionTorque = function(t) {
  54659. return t * this.m_impulse.y
  54660. }, n.prototype.GetLocalAnchorA = function() {
  54661. return this.m_localAnchorA
  54662. }, n.prototype.GetLocalAnchorB = function() {
  54663. return this.m_localAnchorB
  54664. }, n.prototype.GetLocalAxisA = function() {
  54665. return this.m_localXAxisA
  54666. }, n.prototype.GetReferenceAngle = function() {
  54667. return this.m_referenceAngle
  54668. }, n.prototype.GetJointTranslation = function() {
  54669. var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, n.GetJointTranslation_s_pA),
  54670. e = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, n.GetJointTranslation_s_pB),
  54671. i = P.SubVV(e, t, n.GetJointTranslation_s_d),
  54672. r = this.m_bodyA.GetWorldVector(this.m_localXAxisA, n.GetJointTranslation_s_axis);
  54673. return P.DotVV(i, r)
  54674. }, n.prototype.GetJointSpeed = function() {
  54675. var t = this.m_bodyA,
  54676. e = this.m_bodyB;
  54677. P.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
  54678. var i = N.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
  54679. P.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
  54680. var n = N.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB),
  54681. r = P.AddVV(t.m_sweep.c, i, P.s_t0),
  54682. s = P.AddVV(e.m_sweep.c, n, P.s_t1),
  54683. o = P.SubVV(s, r, P.s_t2),
  54684. a = t.GetWorldVector(this.m_localXAxisA, this.m_axis),
  54685. l = t.m_linearVelocity,
  54686. h = e.m_linearVelocity,
  54687. c = t.m_angularVelocity,
  54688. u = e.m_angularVelocity;
  54689. return P.DotVV(o, P.CrossSV(c, a, P.s_t0)) + P.DotVV(a, P.SubVV(P.AddVCrossSV(h, u, n, P.s_t0), P.AddVCrossSV(l, c, i, P.s_t1), P.s_t0))
  54690. }, n.prototype.IsLimitEnabled = function() {
  54691. return this.m_enableLimit
  54692. }, n.prototype.EnableLimit = function(t) {
  54693. t !== this.m_enableLimit && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableLimit = t, this.m_impulse.z = 0)
  54694. }, n.prototype.GetLowerLimit = function() {
  54695. return this.m_lowerTranslation
  54696. }, n.prototype.GetUpperLimit = function() {
  54697. return this.m_upperTranslation
  54698. }, n.prototype.SetLimits = function(t, e) {
  54699. t === this.m_lowerTranslation && e === this.m_upperTranslation || (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_lowerTranslation = t, this.m_upperTranslation = e, this.m_impulse.z = 0)
  54700. }, n.prototype.IsMotorEnabled = function() {
  54701. return this.m_enableMotor
  54702. }, n.prototype.EnableMotor = function(t) {
  54703. t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = t)
  54704. }, n.prototype.SetMotorSpeed = function(t) {
  54705. t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = t)
  54706. }, n.prototype.GetMotorSpeed = function() {
  54707. return this.m_motorSpeed
  54708. }, n.prototype.SetMaxMotorForce = function(t) {
  54709. t !== this.m_maxMotorForce && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorForce = t)
  54710. }, n.prototype.GetMaxMotorForce = function() {
  54711. return this.m_maxMotorForce
  54712. }, n.prototype.GetMotorForce = function(t) {
  54713. return t * this.m_motorImpulse
  54714. }, n.prototype.Dump = function(t) {
  54715. var e = this.m_bodyA.m_islandIndex,
  54716. i = this.m_bodyB.m_islandIndex;
  54717. t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y), t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), t(" jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false"), t(" jd.lowerTranslation = %.15f;\n", this.m_lowerTranslation), t(" jd.upperTranslation = %.15f;\n", this.m_upperTranslation), t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), t(" jd.maxMotorForce = %.15f;\n", this.m_maxMotorForce), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  54718. }, n.InitVelocityConstraints_s_d = new P, n.InitVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_f2r = new P, n.SolveVelocityConstraints_s_f1 = new O, n.SolveVelocityConstraints_s_df3 = new O, n.SolveVelocityConstraints_s_df2 = new P, n.SolvePositionConstraints_s_d = new P, n.SolvePositionConstraints_s_impulse = new O, n.SolvePositionConstraints_s_impulse1 = new P, n.SolvePositionConstraints_s_P = new P, n.GetJointTranslation_s_pA = new P, n.GetJointTranslation_s_pB = new P, n.GetJointTranslation_s_d = new P, n.GetJointTranslation_s_axis = new P, n
  54719. })(fi),
  54720. Mi = (function(e) {
  54721. function i() {
  54722. var i = e.call(this, t.b2JointType.e_pulleyJoint) || this;
  54723. return i.groundAnchorA = new P(-1, 1), i.groundAnchorB = new P(1, 1), i.localAnchorA = new P(-1, 0), i.localAnchorB = new P(1, 0), i.lengthA = 0, i.lengthB = 0, i.ratio = 1, i.collideConnected = !0, i
  54724. }
  54725. return $e(i, e), i.prototype.Initialize = function(t, e, i, n, r, s, o) {
  54726. this.bodyA = t, this.bodyB = e, this.groundAnchorA.Copy(i), this.groundAnchorB.Copy(n), this.bodyA.GetLocalPoint(r, this.localAnchorA), this.bodyB.GetLocalPoint(s, this.localAnchorB), this.lengthA = P.DistanceVV(r, i), this.lengthB = P.DistanceVV(s, n), this.ratio = o
  54727. }, i
  54728. })(_i),
  54729. Di = (function(t) {
  54730. function i(i) {
  54731. var n = t.call(this, i) || this;
  54732. return n.m_groundAnchorA = new P, n.m_groundAnchorB = new P, n.m_lengthA = 0, n.m_lengthB = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_constant = 0, n.m_ratio = 0, n.m_impulse = 0, n.m_indexA = 0, n.m_indexB = 0, n.m_uA = new P, n.m_uB = new P, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_mass = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_groundAnchorA.Copy(e(i.groundAnchorA, new P(-1, 1))), n.m_groundAnchorB.Copy(e(i.groundAnchorB, new P(1, 0))), n.m_localAnchorA.Copy(e(i.localAnchorA, new P(-1, 0))), n.m_localAnchorB.Copy(e(i.localAnchorB, new P(1, 0))), n.m_lengthA = e(i.lengthA, 0), n.m_lengthB = e(i.lengthB, 0), n.m_ratio = e(i.ratio, 1), n.m_constant = e(i.lengthA, 0) + n.m_ratio * e(i.lengthB, 0), n.m_impulse = 0, n
  54733. }
  54734. return $e(i, t), i.prototype.InitVelocityConstraints = function(t) {
  54735. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  54736. var e = t.positions[this.m_indexA].c,
  54737. n = t.positions[this.m_indexA].a,
  54738. r = t.velocities[this.m_indexA].v,
  54739. s = t.velocities[this.m_indexA].w,
  54740. o = t.positions[this.m_indexB].c,
  54741. a = t.positions[this.m_indexB].a,
  54742. h = t.velocities[this.m_indexB].v,
  54743. c = t.velocities[this.m_indexB].w,
  54744. u = this.m_qA.SetAngle(n),
  54745. _ = this.m_qB.SetAngle(a);
  54746. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(u, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(_, this.m_lalcB, this.m_rB), this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA), this.m_uB.Copy(o).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);
  54747. var f = this.m_uA.Length(),
  54748. d = this.m_uB.Length();
  54749. f > 10 * l ? this.m_uA.SelfMul(1 / f) : this.m_uA.SetZero(), d > 10 * l ? this.m_uB.SelfMul(1 / d) : this.m_uB.SetZero();
  54750. var p = P.CrossVV(this.m_rA, this.m_uA),
  54751. m = P.CrossVV(this.m_rB, this.m_uB),
  54752. y = this.m_invMassA + this.m_invIA * p * p,
  54753. v = this.m_invMassB + this.m_invIB * m * m;
  54754. if (this.m_mass = y + this.m_ratio * this.m_ratio * v, this.m_mass > 0 && (this.m_mass = 1 / this.m_mass), t.step.warmStarting) {
  54755. this.m_impulse *= t.step.dtRatio;
  54756. var g = P.MulSV(-this.m_impulse, this.m_uA, i.InitVelocityConstraints_s_PA),
  54757. x = P.MulSV(-this.m_ratio * this.m_impulse, this.m_uB, i.InitVelocityConstraints_s_PB);
  54758. r.SelfMulAdd(this.m_invMassA, g), s += this.m_invIA * P.CrossVV(this.m_rA, g), h.SelfMulAdd(this.m_invMassB, x), c += this.m_invIB * P.CrossVV(this.m_rB, x)
  54759. } else this.m_impulse = 0;
  54760. t.velocities[this.m_indexA].w = s, t.velocities[this.m_indexB].w = c
  54761. }, i.prototype.SolveVelocityConstraints = function(t) {
  54762. var e = t.velocities[this.m_indexA].v,
  54763. n = t.velocities[this.m_indexA].w,
  54764. r = t.velocities[this.m_indexB].v,
  54765. s = t.velocities[this.m_indexB].w,
  54766. o = P.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA),
  54767. a = P.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB),
  54768. l = -P.DotVV(this.m_uA, o) - this.m_ratio * P.DotVV(this.m_uB, a),
  54769. h = -this.m_mass * l;
  54770. this.m_impulse += h;
  54771. var c = P.MulSV(-h, this.m_uA, i.SolveVelocityConstraints_s_PA),
  54772. u = P.MulSV(-this.m_ratio * h, this.m_uB, i.SolveVelocityConstraints_s_PB);
  54773. e.SelfMulAdd(this.m_invMassA, c), n += this.m_invIA * P.CrossVV(this.m_rA, c), r.SelfMulAdd(this.m_invMassB, u), s += this.m_invIB * P.CrossVV(this.m_rB, u), t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
  54774. }, i.prototype.SolvePositionConstraints = function(t) {
  54775. var e = t.positions[this.m_indexA].c,
  54776. n = t.positions[this.m_indexA].a,
  54777. r = t.positions[this.m_indexB].c,
  54778. s = t.positions[this.m_indexB].a,
  54779. o = this.m_qA.SetAngle(n),
  54780. a = this.m_qB.SetAngle(s);
  54781. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  54782. var h = N.MulRV(o, this.m_lalcA, this.m_rA);
  54783. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  54784. var c = N.MulRV(a, this.m_lalcB, this.m_rB),
  54785. u = this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA),
  54786. _ = this.m_uB.Copy(r).SelfAdd(c).SelfSub(this.m_groundAnchorB),
  54787. f = u.Length(),
  54788. d = _.Length();
  54789. f > 10 * l ? u.SelfMul(1 / f) : u.SetZero(), d > 10 * l ? _.SelfMul(1 / d) : _.SetZero();
  54790. var p = P.CrossVV(h, u),
  54791. m = P.CrossVV(c, _),
  54792. y = this.m_invMassA + this.m_invIA * p * p,
  54793. g = this.m_invMassB + this.m_invIB * m * m,
  54794. x = y + this.m_ratio * this.m_ratio * g;
  54795. x > 0 && (x = 1 / x);
  54796. var b = this.m_constant - f - this.m_ratio * d,
  54797. A = v(b),
  54798. C = -x * b,
  54799. T = P.MulSV(-C, u, i.SolvePositionConstraints_s_PA),
  54800. S = P.MulSV(-this.m_ratio * C, _, i.SolvePositionConstraints_s_PB);
  54801. return e.SelfMulAdd(this.m_invMassA, T), n += this.m_invIA * P.CrossVV(h, T), r.SelfMulAdd(this.m_invMassB, S), s += this.m_invIB * P.CrossVV(c, S), t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, A < l
  54802. }, i.prototype.GetAnchorA = function(t) {
  54803. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  54804. }, i.prototype.GetAnchorB = function(t) {
  54805. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  54806. }, i.prototype.GetReactionForce = function(t, e) {
  54807. return e.x = t * this.m_impulse * this.m_uB.x, e.y = t * this.m_impulse * this.m_uB.y, e
  54808. }, i.prototype.GetReactionTorque = function(t) {
  54809. return 0
  54810. }, i.prototype.GetGroundAnchorA = function() {
  54811. return this.m_groundAnchorA
  54812. }, i.prototype.GetGroundAnchorB = function() {
  54813. return this.m_groundAnchorB
  54814. }, i.prototype.GetLengthA = function() {
  54815. return this.m_lengthA
  54816. }, i.prototype.GetLengthB = function() {
  54817. return this.m_lengthB
  54818. }, i.prototype.GetRatio = function() {
  54819. return this.m_ratio
  54820. }, i.prototype.GetCurrentLengthA = function() {
  54821. var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, i.GetCurrentLengthA_s_p),
  54822. e = this.m_groundAnchorA;
  54823. return P.DistanceVV(t, e)
  54824. }, i.prototype.GetCurrentLengthB = function() {
  54825. var t = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, i.GetCurrentLengthB_s_p),
  54826. e = this.m_groundAnchorB;
  54827. return P.DistanceVV(t, e)
  54828. }, i.prototype.Dump = function(t) {
  54829. var e = this.m_bodyA.m_islandIndex,
  54830. i = this.m_bodyB.m_islandIndex;
  54831. t(" const jd: b2PulleyJointDef = new b2PulleyJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.groundAnchorA.Set(%.15f, %.15f);\n", this.m_groundAnchorA.x, this.m_groundAnchorA.y), t(" jd.groundAnchorB.Set(%.15f, %.15f);\n", this.m_groundAnchorB.x, this.m_groundAnchorB.y), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.lengthA = %.15f;\n", this.m_lengthA), t(" jd.lengthB = %.15f;\n", this.m_lengthB), t(" jd.ratio = %.15f;\n", this.m_ratio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  54832. }, i.prototype.ShiftOrigin = function(t) {
  54833. this.m_groundAnchorA.SelfSub(t), this.m_groundAnchorB.SelfSub(t)
  54834. }, i.InitVelocityConstraints_s_PA = new P, i.InitVelocityConstraints_s_PB = new P, i.SolveVelocityConstraints_s_vpA = new P, i.SolveVelocityConstraints_s_vpB = new P, i.SolveVelocityConstraints_s_PA = new P, i.SolveVelocityConstraints_s_PB = new P, i.SolvePositionConstraints_s_PA = new P, i.SolvePositionConstraints_s_PB = new P, i.GetCurrentLengthA_s_p = new P, i.GetCurrentLengthB_s_p = new P, i
  54835. })(fi),
  54836. Bi = (function(e) {
  54837. function i() {
  54838. var i = e.call(this, t.b2JointType.e_revoluteJoint) || this;
  54839. return i.localAnchorA = new P(0, 0), i.localAnchorB = new P(0, 0), i.referenceAngle = 0, i.enableLimit = !1, i.lowerAngle = 0, i.upperAngle = 0, i.enableMotor = !1, i.motorSpeed = 0, i.maxMotorTorque = 0, i
  54840. }
  54841. return $e(i, e), i.prototype.Initialize = function(t, e, i) {
  54842. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle()
  54843. }, i
  54844. })(_i),
  54845. Ii = (function(i) {
  54846. function n(n) {
  54847. var r = i.call(this, n) || this;
  54848. return r.m_localAnchorA = new P, r.m_localAnchorB = new P, r.m_impulse = new O, r.m_motorImpulse = 0, r.m_enableMotor = !1, r.m_maxMotorTorque = 0, r.m_motorSpeed = 0, r.m_enableLimit = !1, r.m_referenceAngle = 0, r.m_lowerAngle = 0, r.m_upperAngle = 0, r.m_indexA = 0, r.m_indexB = 0, r.m_rA = new P, r.m_rB = new P, r.m_localCenterA = new P, r.m_localCenterB = new P, r.m_invMassA = 0, r.m_invMassB = 0, r.m_invIA = 0, r.m_invIB = 0, r.m_mass = new F, r.m_motorMass = 0, r.m_limitState = t.b2LimitState.e_inactiveLimit, r.m_qA = new N, r.m_qB = new N, r.m_lalcA = new P, r.m_lalcB = new P, r.m_K = new L, r.m_localAnchorA.Copy(e(n.localAnchorA, P.ZERO)), r.m_localAnchorB.Copy(e(n.localAnchorB, P.ZERO)), r.m_referenceAngle = e(n.referenceAngle, 0), r.m_impulse.SetZero(), r.m_motorImpulse = 0, r.m_lowerAngle = e(n.lowerAngle, 0), r.m_upperAngle = e(n.upperAngle, 0), r.m_maxMotorTorque = e(n.maxMotorTorque, 0), r.m_motorSpeed = e(n.motorSpeed, 0), r.m_enableLimit = e(n.enableLimit, !1), r.m_enableMotor = e(n.enableMotor, !1), r.m_limitState = t.b2LimitState.e_inactiveLimit, r
  54849. }
  54850. return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
  54851. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  54852. var i = e.positions[this.m_indexA].a,
  54853. r = e.velocities[this.m_indexA].v,
  54854. s = e.velocities[this.m_indexA].w,
  54855. o = e.positions[this.m_indexB].a,
  54856. a = e.velocities[this.m_indexB].v,
  54857. l = e.velocities[this.m_indexB].w,
  54858. c = this.m_qA.SetAngle(i),
  54859. u = this.m_qB.SetAngle(o);
  54860. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(c, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(u, this.m_lalcB, this.m_rB);
  54861. var _ = this.m_invMassA,
  54862. f = this.m_invMassB,
  54863. d = this.m_invIA,
  54864. p = this.m_invIB,
  54865. m = d + p === 0;
  54866. if (this.m_mass.ex.x = _ + f + this.m_rA.y * this.m_rA.y * d + this.m_rB.y * this.m_rB.y * p, this.m_mass.ey.x = -this.m_rA.y * this.m_rA.x * d - this.m_rB.y * this.m_rB.x * p, this.m_mass.ez.x = -this.m_rA.y * d - this.m_rB.y * p, this.m_mass.ex.y = this.m_mass.ey.x, this.m_mass.ey.y = _ + f + this.m_rA.x * this.m_rA.x * d + this.m_rB.x * this.m_rB.x * p, this.m_mass.ez.y = this.m_rA.x * d + this.m_rB.x * p, this.m_mass.ex.z = this.m_mass.ez.x, this.m_mass.ey.z = this.m_mass.ez.y, this.m_mass.ez.z = d + p, this.m_motorMass = d + p, this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass), this.m_enableMotor && !m || (this.m_motorImpulse = 0), this.m_enableLimit && !m) {
  54867. var y = o - i - this.m_referenceAngle;
  54868. v(this.m_upperAngle - this.m_lowerAngle) < 2 * h ? this.m_limitState = t.b2LimitState.e_equalLimits : y <= this.m_lowerAngle ? (this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_impulse.z = 0), this.m_limitState = t.b2LimitState.e_atLowerLimit) : y >= this.m_upperAngle ? (this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = 0), this.m_limitState = t.b2LimitState.e_atUpperLimit) : (this.m_limitState = t.b2LimitState.e_inactiveLimit, this.m_impulse.z = 0)
  54869. } else this.m_limitState = t.b2LimitState.e_inactiveLimit;
  54870. if (e.step.warmStarting) {
  54871. this.m_impulse.SelfMul(e.step.dtRatio), this.m_motorImpulse *= e.step.dtRatio;
  54872. var g = n.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
  54873. r.SelfMulSub(_, g), s -= d * (P.CrossVV(this.m_rA, g) + this.m_motorImpulse + this.m_impulse.z), a.SelfMulAdd(f, g), l += p * (P.CrossVV(this.m_rB, g) + this.m_motorImpulse + this.m_impulse.z)
  54874. } else this.m_impulse.SetZero(), this.m_motorImpulse = 0;
  54875. e.velocities[this.m_indexA].w = s, e.velocities[this.m_indexB].w = l
  54876. }, n.prototype.SolveVelocityConstraints = function(e) {
  54877. var i = e.velocities[this.m_indexA].v,
  54878. r = e.velocities[this.m_indexA].w,
  54879. s = e.velocities[this.m_indexB].v,
  54880. o = e.velocities[this.m_indexB].w,
  54881. a = this.m_invMassA,
  54882. l = this.m_invMassB,
  54883. h = this.m_invIA,
  54884. c = this.m_invIB,
  54885. u = h + c === 0;
  54886. if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits && !u) {
  54887. var _ = o - r - this.m_motorSpeed,
  54888. f = -this.m_motorMass * _,
  54889. d = this.m_motorImpulse,
  54890. p = e.step.dt * this.m_maxMotorTorque;
  54891. this.m_motorImpulse = b(this.m_motorImpulse + f, -p, p), r -= h * (f = this.m_motorImpulse - d), o += c * f
  54892. }
  54893. if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !u) {
  54894. var m = P.SubVV(P.AddVCrossSV(s, o, this.m_rB, P.s_t0), P.AddVCrossSV(i, r, this.m_rA, P.s_t1), n.SolveVelocityConstraints_s_Cdot1),
  54895. y = o - r,
  54896. v = this.m_mass.Solve33(m.x, m.y, y, n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();
  54897. if (this.m_limitState === t.b2LimitState.e_equalLimits) this.m_impulse.SelfAdd(v);
  54898. else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) {
  54899. if (this.m_impulse.z + v.z < 0) {
  54900. var g = -m.x + this.m_impulse.z * this.m_mass.ez.x,
  54901. x = -m.y + this.m_impulse.z * this.m_mass.ez.y,
  54902. A = this.m_mass.Solve22(g, x, n.SolveVelocityConstraints_s_reduced_v2);
  54903. v.x = A.x, v.y = A.y, v.z = -this.m_impulse.z, this.m_impulse.x += A.x, this.m_impulse.y += A.y, this.m_impulse.z = 0
  54904. } else this.m_impulse.SelfAdd(v)
  54905. } else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) {
  54906. if (this.m_impulse.z + v.z > 0) {
  54907. g = -m.x + this.m_impulse.z * this.m_mass.ez.x, x = -m.y + this.m_impulse.z * this.m_mass.ez.y, A = this.m_mass.Solve22(g, x, n.SolveVelocityConstraints_s_reduced_v2);
  54908. v.x = A.x, v.y = A.y, v.z = -this.m_impulse.z, this.m_impulse.x += A.x, this.m_impulse.y += A.y, this.m_impulse.z = 0
  54909. } else this.m_impulse.SelfAdd(v)
  54910. }
  54911. var C = n.SolveVelocityConstraints_s_P.Set(v.x, v.y);
  54912. i.SelfMulSub(a, C), r -= h * (P.CrossVV(this.m_rA, C) + v.z), s.SelfMulAdd(l, C), o += c * (P.CrossVV(this.m_rB, C) + v.z)
  54913. } else {
  54914. var T = P.SubVV(P.AddVCrossSV(s, o, this.m_rB, P.s_t0), P.AddVCrossSV(i, r, this.m_rA, P.s_t1), n.SolveVelocityConstraints_s_Cdot_v2),
  54915. S = this.m_mass.Solve22(-T.x, -T.y, n.SolveVelocityConstraints_s_impulse_v2);
  54916. this.m_impulse.x += S.x, this.m_impulse.y += S.y, i.SelfMulSub(a, S), r -= h * P.CrossVV(this.m_rA, S), s.SelfMulAdd(l, S), o += c * P.CrossVV(this.m_rB, S)
  54917. }
  54918. e.velocities[this.m_indexA].w = r, e.velocities[this.m_indexB].w = o
  54919. }, n.prototype.SolvePositionConstraints = function(e) {
  54920. var i, r = e.positions[this.m_indexA].c,
  54921. s = e.positions[this.m_indexA].a,
  54922. o = e.positions[this.m_indexB].c,
  54923. a = e.positions[this.m_indexB].a,
  54924. c = this.m_qA.SetAngle(s),
  54925. u = this.m_qB.SetAngle(a),
  54926. _ = 0,
  54927. f = this.m_invIA + this.m_invIB === 0;
  54928. if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !f) {
  54929. var d = a - s - this.m_referenceAngle,
  54930. p = 0;
  54931. if (this.m_limitState === t.b2LimitState.e_equalLimits) {
  54932. var m = b(d - this.m_lowerAngle, -.13962634015955555, .13962634015955555);
  54933. p = -this.m_motorMass * m, _ = v(m)
  54934. } else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) {
  54935. _ = -(m = d - this.m_lowerAngle), m = b(m + h, -.13962634015955555, 0), p = -this.m_motorMass * m
  54936. } else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) {
  54937. _ = m = d - this.m_upperAngle, m = b(m - h, 0, .13962634015955555), p = -this.m_motorMass * m
  54938. }
  54939. s -= this.m_invIA * p, a += this.m_invIB * p
  54940. }
  54941. c.SetAngle(s), u.SetAngle(a), P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  54942. var y = N.MulRV(c, this.m_lalcA, this.m_rA);
  54943. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  54944. var g = N.MulRV(u, this.m_lalcB, this.m_rB),
  54945. x = P.SubVV(P.AddVV(o, g, P.s_t0), P.AddVV(r, y, P.s_t1), n.SolvePositionConstraints_s_C_v2);
  54946. i = x.Length();
  54947. var A = this.m_invMassA,
  54948. C = this.m_invMassB,
  54949. T = this.m_invIA,
  54950. S = this.m_invIB,
  54951. w = this.m_K;
  54952. w.ex.x = A + C + T * y.y * y.y + S * g.y * g.y, w.ex.y = -T * y.x * y.y - S * g.x * g.y, w.ey.x = w.ex.y, w.ey.y = A + C + T * y.x * y.x + S * g.x * g.x;
  54953. var E = w.Solve(x.x, x.y, n.SolvePositionConstraints_s_impulse).SelfNeg();
  54954. return r.SelfMulSub(A, E), s -= T * P.CrossVV(y, E), o.SelfMulAdd(C, E), a += S * P.CrossVV(g, E), e.positions[this.m_indexA].a = s, e.positions[this.m_indexB].a = a, i <= l && _ <= h
  54955. }, n.prototype.GetAnchorA = function(t) {
  54956. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  54957. }, n.prototype.GetAnchorB = function(t) {
  54958. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  54959. }, n.prototype.GetReactionForce = function(t, e) {
  54960. return e.x = t * this.m_impulse.x, e.y = t * this.m_impulse.y, e
  54961. }, n.prototype.GetReactionTorque = function(t) {
  54962. return t * this.m_impulse.z
  54963. }, n.prototype.GetLocalAnchorA = function() {
  54964. return this.m_localAnchorA
  54965. }, n.prototype.GetLocalAnchorB = function() {
  54966. return this.m_localAnchorB
  54967. }, n.prototype.GetReferenceAngle = function() {
  54968. return this.m_referenceAngle
  54969. }, n.prototype.GetJointAngle = function() {
  54970. return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a - this.m_referenceAngle
  54971. }, n.prototype.GetJointSpeed = function() {
  54972. return this.m_bodyB.m_angularVelocity - this.m_bodyA.m_angularVelocity
  54973. }, n.prototype.IsMotorEnabled = function() {
  54974. return this.m_enableMotor
  54975. }, n.prototype.EnableMotor = function(t) {
  54976. t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = t)
  54977. }, n.prototype.GetMotorTorque = function(t) {
  54978. return t * this.m_motorImpulse
  54979. }, n.prototype.GetMotorSpeed = function() {
  54980. return this.m_motorSpeed
  54981. }, n.prototype.SetMaxMotorTorque = function(t) {
  54982. t !== this.m_maxMotorTorque && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorTorque = t)
  54983. }, n.prototype.GetMaxMotorTorque = function() {
  54984. return this.m_maxMotorTorque
  54985. }, n.prototype.IsLimitEnabled = function() {
  54986. return this.m_enableLimit
  54987. }, n.prototype.EnableLimit = function(t) {
  54988. t !== this.m_enableLimit && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableLimit = t, this.m_impulse.z = 0)
  54989. }, n.prototype.GetLowerLimit = function() {
  54990. return this.m_lowerAngle
  54991. }, n.prototype.GetUpperLimit = function() {
  54992. return this.m_upperAngle
  54993. }, n.prototype.SetLimits = function(t, e) {
  54994. t === this.m_lowerAngle && e === this.m_upperAngle || (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_impulse.z = 0, this.m_lowerAngle = t, this.m_upperAngle = e)
  54995. }, n.prototype.SetMotorSpeed = function(t) {
  54996. t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = t)
  54997. }, n.prototype.Dump = function(t) {
  54998. var e = this.m_bodyA.m_islandIndex,
  54999. i = this.m_bodyB.m_islandIndex;
  55000. t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), t(" jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false"), t(" jd.lowerAngle = %.15f;\n", this.m_lowerAngle), t(" jd.upperAngle = %.15f;\n", this.m_upperAngle), t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), t(" jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  55001. }, n.InitVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_Cdot_v2 = new P, n.SolveVelocityConstraints_s_Cdot1 = new P, n.SolveVelocityConstraints_s_impulse_v3 = new O, n.SolveVelocityConstraints_s_reduced_v2 = new P, n.SolveVelocityConstraints_s_impulse_v2 = new P, n.SolvePositionConstraints_s_C_v2 = new P, n.SolvePositionConstraints_s_impulse = new P, n
  55002. })(fi),
  55003. Pi = (function(e) {
  55004. function i() {
  55005. var i = e.call(this, t.b2JointType.e_ropeJoint) || this;
  55006. return i.localAnchorA = new P(-1, 0), i.localAnchorB = new P(1, 0), i.maxLength = 0, i
  55007. }
  55008. return $e(i, e), i
  55009. })(_i),
  55010. Ri = (function(i) {
  55011. function n(n) {
  55012. var r = i.call(this, n) || this;
  55013. return r.m_localAnchorA = new P, r.m_localAnchorB = new P, r.m_maxLength = 0, r.m_length = 0, r.m_impulse = 0, r.m_indexA = 0, r.m_indexB = 0, r.m_u = new P, r.m_rA = new P, r.m_rB = new P, r.m_localCenterA = new P, r.m_localCenterB = new P, r.m_invMassA = 0, r.m_invMassB = 0, r.m_invIA = 0, r.m_invIB = 0, r.m_mass = 0, r.m_state = t.b2LimitState.e_inactiveLimit, r.m_qA = new N, r.m_qB = new N, r.m_lalcA = new P, r.m_lalcB = new P, r.m_localAnchorA.Copy(e(n.localAnchorA, new P(-1, 0))), r.m_localAnchorB.Copy(e(n.localAnchorB, new P(1, 0))), r.m_maxLength = e(n.maxLength, 0), r
  55014. }
  55015. return $e(n, i), n.prototype.InitVelocityConstraints = function(e) {
  55016. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  55017. var i = e.positions[this.m_indexA].c,
  55018. r = e.positions[this.m_indexA].a,
  55019. s = e.velocities[this.m_indexA].v,
  55020. o = e.velocities[this.m_indexA].w,
  55021. a = e.positions[this.m_indexB].c,
  55022. h = e.positions[this.m_indexB].a,
  55023. c = e.velocities[this.m_indexB].v,
  55024. u = e.velocities[this.m_indexB].w,
  55025. _ = this.m_qA.SetAngle(r),
  55026. f = this.m_qB.SetAngle(h);
  55027. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(_, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(f, this.m_lalcB, this.m_rB), this.m_u.Copy(a).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA), this.m_length = this.m_u.Length();
  55028. var d = this.m_length - this.m_maxLength;
  55029. if (this.m_state = d > 0 ? t.b2LimitState.e_atUpperLimit : t.b2LimitState.e_inactiveLimit, !(this.m_length > l)) return this.m_u.SetZero(), this.m_mass = 0, void(this.m_impulse = 0);
  55030. this.m_u.SelfMul(1 / this.m_length);
  55031. var p = P.CrossVV(this.m_rA, this.m_u),
  55032. m = P.CrossVV(this.m_rB, this.m_u),
  55033. y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
  55034. if (this.m_mass = 0 !== y ? 1 / y : 0, e.step.warmStarting) {
  55035. this.m_impulse *= e.step.dtRatio;
  55036. var v = P.MulSV(this.m_impulse, this.m_u, n.InitVelocityConstraints_s_P);
  55037. s.SelfMulSub(this.m_invMassA, v), o -= this.m_invIA * P.CrossVV(this.m_rA, v), c.SelfMulAdd(this.m_invMassB, v), u += this.m_invIB * P.CrossVV(this.m_rB, v)
  55038. } else this.m_impulse = 0;
  55039. e.velocities[this.m_indexA].w = o, e.velocities[this.m_indexB].w = u
  55040. }, n.prototype.SolveVelocityConstraints = function(t) {
  55041. var e = t.velocities[this.m_indexA].v,
  55042. i = t.velocities[this.m_indexA].w,
  55043. r = t.velocities[this.m_indexB].v,
  55044. s = t.velocities[this.m_indexB].w,
  55045. o = P.AddVCrossSV(e, i, this.m_rA, n.SolveVelocityConstraints_s_vpA),
  55046. a = P.AddVCrossSV(r, s, this.m_rB, n.SolveVelocityConstraints_s_vpB),
  55047. l = this.m_length - this.m_maxLength,
  55048. h = P.DotVV(this.m_u, P.SubVV(a, o, P.s_t0));
  55049. l < 0 && (h += t.step.inv_dt * l);
  55050. var c = -this.m_mass * h,
  55051. u = this.m_impulse;
  55052. this.m_impulse = g(0, this.m_impulse + c), c = this.m_impulse - u;
  55053. var _ = P.MulSV(c, this.m_u, n.SolveVelocityConstraints_s_P);
  55054. e.SelfMulSub(this.m_invMassA, _), i -= this.m_invIA * P.CrossVV(this.m_rA, _), r.SelfMulAdd(this.m_invMassB, _), s += this.m_invIB * P.CrossVV(this.m_rB, _), t.velocities[this.m_indexA].w = i, t.velocities[this.m_indexB].w = s
  55055. }, n.prototype.SolvePositionConstraints = function(t) {
  55056. var e = t.positions[this.m_indexA].c,
  55057. i = t.positions[this.m_indexA].a,
  55058. r = t.positions[this.m_indexB].c,
  55059. s = t.positions[this.m_indexB].a,
  55060. o = this.m_qA.SetAngle(i),
  55061. a = this.m_qB.SetAngle(s);
  55062. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  55063. var h = N.MulRV(o, this.m_lalcA, this.m_rA);
  55064. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  55065. var c = N.MulRV(a, this.m_lalcB, this.m_rB),
  55066. u = this.m_u.Copy(r).SelfAdd(c).SelfSub(e).SelfSub(h),
  55067. _ = u.Normalize(),
  55068. f = _ - this.m_maxLength;
  55069. f = b(f, 0, .2);
  55070. var d = -this.m_mass * f,
  55071. p = P.MulSV(d, u, n.SolvePositionConstraints_s_P);
  55072. return e.SelfMulSub(this.m_invMassA, p), i -= this.m_invIA * P.CrossVV(h, p), r.SelfMulAdd(this.m_invMassB, p), s += this.m_invIB * P.CrossVV(c, p), t.positions[this.m_indexA].a = i, t.positions[this.m_indexB].a = s, _ - this.m_maxLength < l
  55073. }, n.prototype.GetAnchorA = function(t) {
  55074. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  55075. }, n.prototype.GetAnchorB = function(t) {
  55076. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  55077. }, n.prototype.GetReactionForce = function(t, e) {
  55078. return P.MulSV(t * this.m_impulse, this.m_u, e)
  55079. }, n.prototype.GetReactionTorque = function(t) {
  55080. return 0
  55081. }, n.prototype.GetLocalAnchorA = function() {
  55082. return this.m_localAnchorA
  55083. }, n.prototype.GetLocalAnchorB = function() {
  55084. return this.m_localAnchorB
  55085. }, n.prototype.SetMaxLength = function(t) {
  55086. this.m_maxLength = t
  55087. }, n.prototype.GetMaxLength = function() {
  55088. return this.m_maxLength
  55089. }, n.prototype.GetLimitState = function() {
  55090. return this.m_state
  55091. }, n.prototype.Dump = function(t) {
  55092. var e = this.m_bodyA.m_islandIndex,
  55093. i = this.m_bodyB.m_islandIndex;
  55094. t(" const jd: b2RopeJointDef = new b2RopeJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.maxLength = %.15f;\n", this.m_maxLength), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  55095. }, n.InitVelocityConstraints_s_P = new P, n.SolveVelocityConstraints_s_vpA = new P, n.SolveVelocityConstraints_s_vpB = new P, n.SolveVelocityConstraints_s_P = new P, n.SolvePositionConstraints_s_P = new P, n
  55096. })(fi),
  55097. Oi = (function(e) {
  55098. function i() {
  55099. var i = e.call(this, t.b2JointType.e_weldJoint) || this;
  55100. return i.localAnchorA = new P, i.localAnchorB = new P, i.referenceAngle = 0, i.frequencyHz = 0, i.dampingRatio = 0, i
  55101. }
  55102. return $e(i, e), i.prototype.Initialize = function(t, e, i) {
  55103. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle()
  55104. }, i
  55105. })(_i),
  55106. Li = (function(t) {
  55107. function i(i) {
  55108. var n = t.call(this, i) || this;
  55109. return n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_bias = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_referenceAngle = 0, n.m_gamma = 0, n.m_impulse = new O(0, 0, 0), n.m_indexA = 0, n.m_indexB = 0, n.m_rA = new P, n.m_rB = new P, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_mass = new F, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_K = new F, n.m_frequencyHz = e(i.frequencyHz, 0), n.m_dampingRatio = e(i.dampingRatio, 0), n.m_localAnchorA.Copy(e(i.localAnchorA, P.ZERO)), n.m_localAnchorB.Copy(e(i.localAnchorB, P.ZERO)), n.m_referenceAngle = e(i.referenceAngle, 0), n.m_impulse.SetZero(), n
  55110. }
  55111. return $e(i, t), i.prototype.InitVelocityConstraints = function(t) {
  55112. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  55113. var e = t.positions[this.m_indexA].a,
  55114. n = t.velocities[this.m_indexA].v,
  55115. r = t.velocities[this.m_indexA].w,
  55116. o = t.positions[this.m_indexB].a,
  55117. a = t.velocities[this.m_indexB].v,
  55118. l = t.velocities[this.m_indexB].w,
  55119. h = this.m_qA.SetAngle(e),
  55120. c = this.m_qB.SetAngle(o);
  55121. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), N.MulRV(h, this.m_lalcA, this.m_rA), P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), N.MulRV(c, this.m_lalcB, this.m_rB);
  55122. var u = this.m_invMassA,
  55123. _ = this.m_invMassB,
  55124. f = this.m_invIA,
  55125. d = this.m_invIB,
  55126. p = this.m_K;
  55127. if (p.ex.x = u + _ + this.m_rA.y * this.m_rA.y * f + this.m_rB.y * this.m_rB.y * d, p.ey.x = -this.m_rA.y * this.m_rA.x * f - this.m_rB.y * this.m_rB.x * d, p.ez.x = -this.m_rA.y * f - this.m_rB.y * d, p.ex.y = p.ey.x, p.ey.y = u + _ + this.m_rA.x * this.m_rA.x * f + this.m_rB.x * this.m_rB.x * d, p.ez.y = this.m_rA.x * f + this.m_rB.x * d, p.ex.z = p.ez.x, p.ey.z = p.ez.y, p.ez.z = f + d, this.m_frequencyHz > 0) {
  55128. p.GetInverse22(this.m_mass);
  55129. var m = f + d,
  55130. y = m > 0 ? 1 / m : 0,
  55131. v = o - e - this.m_referenceAngle,
  55132. g = 2 * s * this.m_frequencyHz,
  55133. x = 2 * y * this.m_dampingRatio * g,
  55134. b = y * g * g,
  55135. A = t.step.dt;
  55136. this.m_gamma = A * (x + A * b), this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0, this.m_bias = v * A * b * this.m_gamma, m += this.m_gamma, this.m_mass.ez.z = 0 !== m ? 1 / m : 0
  55137. } else p.GetSymInverse33(this.m_mass), this.m_gamma = 0, this.m_bias = 0;
  55138. if (t.step.warmStarting) {
  55139. this.m_impulse.SelfMul(t.step.dtRatio);
  55140. var C = i.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
  55141. n.SelfMulSub(u, C), r -= f * (P.CrossVV(this.m_rA, C) + this.m_impulse.z), a.SelfMulAdd(_, C), l += d * (P.CrossVV(this.m_rB, C) + this.m_impulse.z)
  55142. } else this.m_impulse.SetZero();
  55143. t.velocities[this.m_indexA].w = r, t.velocities[this.m_indexB].w = l
  55144. }, i.prototype.SolveVelocityConstraints = function(t) {
  55145. var e = t.velocities[this.m_indexA].v,
  55146. n = t.velocities[this.m_indexA].w,
  55147. r = t.velocities[this.m_indexB].v,
  55148. s = t.velocities[this.m_indexB].w,
  55149. o = this.m_invMassA,
  55150. a = this.m_invMassB,
  55151. l = this.m_invIA,
  55152. h = this.m_invIB;
  55153. if (this.m_frequencyHz > 0) {
  55154. var c = s - n,
  55155. u = -this.m_mass.ez.z * (c + this.m_bias + this.m_gamma * this.m_impulse.z);
  55156. this.m_impulse.z += u, n -= l * u, s += h * u;
  55157. var _ = P.SubVV(P.AddVCrossSV(r, s, this.m_rB, P.s_t0), P.AddVCrossSV(e, n, this.m_rA, P.s_t1), i.SolveVelocityConstraints_s_Cdot1),
  55158. f = F.MulM33XY(this.m_mass, _.x, _.y, i.SolveVelocityConstraints_s_impulse1).SelfNeg();
  55159. this.m_impulse.x += f.x, this.m_impulse.y += f.y;
  55160. var d = f;
  55161. e.SelfMulSub(o, d), n -= l * P.CrossVV(this.m_rA, d), r.SelfMulAdd(a, d), s += h * P.CrossVV(this.m_rB, d)
  55162. } else {
  55163. _ = P.SubVV(P.AddVCrossSV(r, s, this.m_rB, P.s_t0), P.AddVCrossSV(e, n, this.m_rA, P.s_t1), i.SolveVelocityConstraints_s_Cdot1), c = s - n;
  55164. var p = F.MulM33XYZ(this.m_mass, _.x, _.y, c, i.SolveVelocityConstraints_s_impulse).SelfNeg();
  55165. this.m_impulse.SelfAdd(p);
  55166. d = i.SolveVelocityConstraints_s_P.Set(p.x, p.y);
  55167. e.SelfMulSub(o, d), n -= l * (P.CrossVV(this.m_rA, d) + p.z), r.SelfMulAdd(a, d), s += h * (P.CrossVV(this.m_rB, d) + p.z)
  55168. }
  55169. t.velocities[this.m_indexA].w = n, t.velocities[this.m_indexB].w = s
  55170. }, i.prototype.SolvePositionConstraints = function(t) {
  55171. var e = t.positions[this.m_indexA].c,
  55172. n = t.positions[this.m_indexA].a,
  55173. r = t.positions[this.m_indexB].c,
  55174. s = t.positions[this.m_indexB].a,
  55175. o = this.m_qA.SetAngle(n),
  55176. a = this.m_qB.SetAngle(s),
  55177. c = this.m_invMassA,
  55178. u = this.m_invMassB,
  55179. _ = this.m_invIA,
  55180. f = this.m_invIB;
  55181. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  55182. var d = N.MulRV(o, this.m_lalcA, this.m_rA);
  55183. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  55184. var p, m, y = N.MulRV(a, this.m_lalcB, this.m_rB),
  55185. g = this.m_K;
  55186. if (g.ex.x = c + u + d.y * d.y * _ + y.y * y.y * f, g.ey.x = -d.y * d.x * _ - y.y * y.x * f, g.ez.x = -d.y * _ - y.y * f, g.ex.y = g.ey.x, g.ey.y = c + u + d.x * d.x * _ + y.x * y.x * f, g.ez.y = d.x * _ + y.x * f, g.ex.z = g.ez.x, g.ey.z = g.ez.y, g.ez.z = _ + f, this.m_frequencyHz > 0) {
  55187. p = (b = P.SubVV(P.AddVV(r, y, P.s_t0), P.AddVV(e, d, P.s_t1), i.SolvePositionConstraints_s_C1)).Length(), m = 0;
  55188. var x = g.Solve22(b.x, b.y, i.SolvePositionConstraints_s_P).SelfNeg();
  55189. e.SelfMulSub(c, x), n -= _ * P.CrossVV(d, x), r.SelfMulAdd(u, x), s += f * P.CrossVV(y, x)
  55190. } else {
  55191. var b = P.SubVV(P.AddVV(r, y, P.s_t0), P.AddVV(e, d, P.s_t1), i.SolvePositionConstraints_s_C1),
  55192. A = s - n - this.m_referenceAngle;
  55193. p = b.Length(), m = v(A);
  55194. var C = g.Solve33(b.x, b.y, A, i.SolvePositionConstraints_s_impulse).SelfNeg();
  55195. x = i.SolvePositionConstraints_s_P.Set(C.x, C.y);
  55196. e.SelfMulSub(c, x), n -= _ * (P.CrossVV(this.m_rA, x) + C.z), r.SelfMulAdd(u, x), s += f * (P.CrossVV(this.m_rB, x) + C.z)
  55197. }
  55198. return t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, p <= l && m <= h
  55199. }, i.prototype.GetAnchorA = function(t) {
  55200. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  55201. }, i.prototype.GetAnchorB = function(t) {
  55202. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  55203. }, i.prototype.GetReactionForce = function(t, e) {
  55204. return e.x = t * this.m_impulse.x, e.y = t * this.m_impulse.y, e
  55205. }, i.prototype.GetReactionTorque = function(t) {
  55206. return t * this.m_impulse.z
  55207. }, i.prototype.GetLocalAnchorA = function() {
  55208. return this.m_localAnchorA
  55209. }, i.prototype.GetLocalAnchorB = function() {
  55210. return this.m_localAnchorB
  55211. }, i.prototype.GetReferenceAngle = function() {
  55212. return this.m_referenceAngle
  55213. }, i.prototype.SetFrequency = function(t) {
  55214. this.m_frequencyHz = t
  55215. }, i.prototype.GetFrequency = function() {
  55216. return this.m_frequencyHz
  55217. }, i.prototype.SetDampingRatio = function(t) {
  55218. this.m_dampingRatio = t
  55219. }, i.prototype.GetDampingRatio = function() {
  55220. return this.m_dampingRatio
  55221. }, i.prototype.Dump = function(t) {
  55222. var e = this.m_bodyA.m_islandIndex,
  55223. i = this.m_bodyB.m_islandIndex;
  55224. t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  55225. }, i.InitVelocityConstraints_s_P = new P, i.SolveVelocityConstraints_s_Cdot1 = new P, i.SolveVelocityConstraints_s_impulse1 = new P, i.SolveVelocityConstraints_s_impulse = new O, i.SolveVelocityConstraints_s_P = new P, i.SolvePositionConstraints_s_C1 = new P, i.SolvePositionConstraints_s_P = new P, i.SolvePositionConstraints_s_impulse = new O, i
  55226. })(fi),
  55227. Fi = (function(e) {
  55228. function i() {
  55229. var i = e.call(this, t.b2JointType.e_wheelJoint) || this;
  55230. return i.localAnchorA = new P(0, 0), i.localAnchorB = new P(0, 0), i.localAxisA = new P(1, 0), i.enableMotor = !1, i.maxMotorTorque = 0, i.motorSpeed = 0, i.frequencyHz = 2, i.dampingRatio = .7, i
  55231. }
  55232. return $e(i, e), i.prototype.Initialize = function(t, e, i, n) {
  55233. this.bodyA = t, this.bodyB = e, this.bodyA.GetLocalPoint(i, this.localAnchorA), this.bodyB.GetLocalPoint(i, this.localAnchorB), this.bodyA.GetLocalVector(n, this.localAxisA)
  55234. }, i
  55235. })(_i),
  55236. Ni = (function(t) {
  55237. function i(i) {
  55238. var n = t.call(this, i) || this;
  55239. return n.m_frequencyHz = 0, n.m_dampingRatio = 0, n.m_localAnchorA = new P, n.m_localAnchorB = new P, n.m_localXAxisA = new P, n.m_localYAxisA = new P, n.m_impulse = 0, n.m_motorImpulse = 0, n.m_springImpulse = 0, n.m_maxMotorTorque = 0, n.m_motorSpeed = 0, n.m_enableMotor = !1, n.m_indexA = 0, n.m_indexB = 0, n.m_localCenterA = new P, n.m_localCenterB = new P, n.m_invMassA = 0, n.m_invMassB = 0, n.m_invIA = 0, n.m_invIB = 0, n.m_ax = new P, n.m_ay = new P, n.m_sAx = 0, n.m_sBx = 0, n.m_sAy = 0, n.m_sBy = 0, n.m_mass = 0, n.m_motorMass = 0, n.m_springMass = 0, n.m_bias = 0, n.m_gamma = 0, n.m_qA = new N, n.m_qB = new N, n.m_lalcA = new P, n.m_lalcB = new P, n.m_rA = new P, n.m_rB = new P, n.m_frequencyHz = e(i.frequencyHz, 2), n.m_dampingRatio = e(i.dampingRatio, .7), n.m_localAnchorA.Copy(e(i.localAnchorA, P.ZERO)), n.m_localAnchorB.Copy(e(i.localAnchorB, P.ZERO)), n.m_localXAxisA.Copy(e(i.localAxisA, P.UNITX)), P.CrossOneV(n.m_localXAxisA, n.m_localYAxisA), n.m_maxMotorTorque = e(i.maxMotorTorque, 0), n.m_motorSpeed = e(i.motorSpeed, 0), n.m_enableMotor = e(i.enableMotor, !1), n.m_ax.SetZero(), n.m_ay.SetZero(), n
  55240. }
  55241. return $e(i, t), i.prototype.GetMotorSpeed = function() {
  55242. return this.m_motorSpeed
  55243. }, i.prototype.GetMaxMotorTorque = function() {
  55244. return this.m_maxMotorTorque
  55245. }, i.prototype.SetSpringFrequencyHz = function(t) {
  55246. this.m_frequencyHz = t
  55247. }, i.prototype.GetSpringFrequencyHz = function() {
  55248. return this.m_frequencyHz
  55249. }, i.prototype.SetSpringDampingRatio = function(t) {
  55250. this.m_dampingRatio = t
  55251. }, i.prototype.GetSpringDampingRatio = function() {
  55252. return this.m_dampingRatio
  55253. }, i.prototype.InitVelocityConstraints = function(t) {
  55254. this.m_indexA = this.m_bodyA.m_islandIndex, this.m_indexB = this.m_bodyB.m_islandIndex, this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), this.m_invMassA = this.m_bodyA.m_invMass, this.m_invMassB = this.m_bodyB.m_invMass, this.m_invIA = this.m_bodyA.m_invI, this.m_invIB = this.m_bodyB.m_invI;
  55255. var e = this.m_invMassA,
  55256. n = this.m_invMassB,
  55257. r = this.m_invIA,
  55258. o = this.m_invIB,
  55259. a = t.positions[this.m_indexA].c,
  55260. l = t.positions[this.m_indexA].a,
  55261. h = t.velocities[this.m_indexA].v,
  55262. c = t.velocities[this.m_indexA].w,
  55263. u = t.positions[this.m_indexB].c,
  55264. _ = t.positions[this.m_indexB].a,
  55265. f = t.velocities[this.m_indexB].v,
  55266. d = t.velocities[this.m_indexB].w,
  55267. p = this.m_qA.SetAngle(l),
  55268. m = this.m_qB.SetAngle(_);
  55269. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  55270. var y = N.MulRV(p, this.m_lalcA, this.m_rA);
  55271. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  55272. var v = N.MulRV(m, this.m_lalcB, this.m_rB),
  55273. g = P.SubVV(P.AddVV(u, v, P.s_t0), P.AddVV(a, y, P.s_t1), i.InitVelocityConstraints_s_d);
  55274. if (N.MulRV(p, this.m_localYAxisA, this.m_ay), this.m_sAy = P.CrossVV(P.AddVV(g, y, P.s_t0), this.m_ay), this.m_sBy = P.CrossVV(v, this.m_ay), this.m_mass = e + n + r * this.m_sAy * this.m_sAy + o * this.m_sBy * this.m_sBy, this.m_mass > 0 && (this.m_mass = 1 / this.m_mass), this.m_springMass = 0, this.m_bias = 0, this.m_gamma = 0, this.m_frequencyHz > 0) {
  55275. N.MulRV(p, this.m_localXAxisA, this.m_ax), this.m_sAx = P.CrossVV(P.AddVV(g, y, P.s_t0), this.m_ax), this.m_sBx = P.CrossVV(v, this.m_ax);
  55276. var x = e + n + r * this.m_sAx * this.m_sAx + o * this.m_sBx * this.m_sBx;
  55277. if (x > 0) {
  55278. this.m_springMass = 1 / x;
  55279. var b = P.DotVV(g, this.m_ax),
  55280. A = 2 * s * this.m_frequencyHz,
  55281. C = 2 * this.m_springMass * this.m_dampingRatio * A,
  55282. T = this.m_springMass * A * A,
  55283. S = t.step.dt;
  55284. this.m_gamma = S * (C + S * T), this.m_gamma > 0 && (this.m_gamma = 1 / this.m_gamma), this.m_bias = b * S * T * this.m_gamma, this.m_springMass = x + this.m_gamma, this.m_springMass > 0 && (this.m_springMass = 1 / this.m_springMass)
  55285. }
  55286. } else this.m_springImpulse = 0;
  55287. if (this.m_enableMotor ? (this.m_motorMass = r + o, this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass)) : (this.m_motorMass = 0, this.m_motorImpulse = 0), t.step.warmStarting) {
  55288. this.m_impulse *= t.step.dtRatio, this.m_springImpulse *= t.step.dtRatio, this.m_motorImpulse *= t.step.dtRatio;
  55289. var w = P.AddVV(P.MulSV(this.m_impulse, this.m_ay, P.s_t0), P.MulSV(this.m_springImpulse, this.m_ax, P.s_t1), i.InitVelocityConstraints_s_P),
  55290. E = this.m_impulse * this.m_sAy + this.m_springImpulse * this.m_sAx + this.m_motorImpulse,
  55291. M = this.m_impulse * this.m_sBy + this.m_springImpulse * this.m_sBx + this.m_motorImpulse;
  55292. h.SelfMulSub(this.m_invMassA, w), c -= this.m_invIA * E, f.SelfMulAdd(this.m_invMassB, w), d += this.m_invIB * M
  55293. } else this.m_impulse = 0, this.m_springImpulse = 0, this.m_motorImpulse = 0;
  55294. t.velocities[this.m_indexA].w = c, t.velocities[this.m_indexB].w = d
  55295. }, i.prototype.SolveVelocityConstraints = function(t) {
  55296. var e = this.m_invMassA,
  55297. n = this.m_invMassB,
  55298. r = this.m_invIA,
  55299. s = this.m_invIB,
  55300. o = t.velocities[this.m_indexA].v,
  55301. a = t.velocities[this.m_indexA].w,
  55302. l = t.velocities[this.m_indexB].v,
  55303. h = t.velocities[this.m_indexB].w,
  55304. c = P.DotVV(this.m_ax, P.SubVV(l, o, P.s_t0)) + this.m_sBx * h - this.m_sAx * a,
  55305. u = -this.m_springMass * (c + this.m_bias + this.m_gamma * this.m_springImpulse);
  55306. this.m_springImpulse += u;
  55307. var _ = P.MulSV(u, this.m_ax, i.SolveVelocityConstraints_s_P),
  55308. f = u * this.m_sAx,
  55309. d = u * this.m_sBx;
  55310. o.SelfMulSub(e, _), a -= r * f, l.SelfMulAdd(n, _);
  55311. c = (h += s * d) - a - this.m_motorSpeed, u = -this.m_motorMass * c;
  55312. var p = this.m_motorImpulse,
  55313. m = t.step.dt * this.m_maxMotorTorque;
  55314. this.m_motorImpulse = b(this.m_motorImpulse + u, -m, m), a -= r * (u = this.m_motorImpulse - p), h += s * u;
  55315. c = P.DotVV(this.m_ay, P.SubVV(l, o, P.s_t0)) + this.m_sBy * h - this.m_sAy * a, u = -this.m_mass * c;
  55316. this.m_impulse += u;
  55317. _ = P.MulSV(u, this.m_ay, i.SolveVelocityConstraints_s_P), f = u * this.m_sAy, d = u * this.m_sBy;
  55318. o.SelfMulSub(e, _), a -= r * f, l.SelfMulAdd(n, _), h += s * d, t.velocities[this.m_indexA].w = a, t.velocities[this.m_indexB].w = h
  55319. }, i.prototype.SolvePositionConstraints = function(t) {
  55320. var e = t.positions[this.m_indexA].c,
  55321. n = t.positions[this.m_indexA].a,
  55322. r = t.positions[this.m_indexB].c,
  55323. s = t.positions[this.m_indexB].a,
  55324. o = this.m_qA.SetAngle(n),
  55325. a = this.m_qB.SetAngle(s);
  55326. P.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
  55327. var h = N.MulRV(o, this.m_lalcA, this.m_rA);
  55328. P.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
  55329. var c, u = N.MulRV(a, this.m_lalcB, this.m_rB),
  55330. _ = P.AddVV(P.SubVV(r, e, P.s_t0), P.SubVV(u, h, P.s_t1), i.SolvePositionConstraints_s_d),
  55331. f = N.MulRV(o, this.m_localYAxisA, this.m_ay),
  55332. d = P.CrossVV(P.AddVV(_, h, P.s_t0), f),
  55333. p = P.CrossVV(u, f),
  55334. m = P.DotVV(_, this.m_ay),
  55335. y = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_sAy * this.m_sAy + this.m_invIB * this.m_sBy * this.m_sBy;
  55336. c = 0 !== y ? -m / y : 0;
  55337. var g = P.MulSV(c, f, i.SolvePositionConstraints_s_P),
  55338. x = c * d,
  55339. b = c * p;
  55340. return e.SelfMulSub(this.m_invMassA, g), n -= this.m_invIA * x, r.SelfMulAdd(this.m_invMassB, g), s += this.m_invIB * b, t.positions[this.m_indexA].a = n, t.positions[this.m_indexB].a = s, v(m) <= l
  55341. }, i.prototype.GetDefinition = function(t) {
  55342. return t
  55343. }, i.prototype.GetAnchorA = function(t) {
  55344. return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t)
  55345. }, i.prototype.GetAnchorB = function(t) {
  55346. return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t)
  55347. }, i.prototype.GetReactionForce = function(t, e) {
  55348. return e.x = t * (this.m_impulse * this.m_ay.x + this.m_springImpulse * this.m_ax.x), e.y = t * (this.m_impulse * this.m_ay.y + this.m_springImpulse * this.m_ax.y), e
  55349. }, i.prototype.GetReactionTorque = function(t) {
  55350. return t * this.m_motorImpulse
  55351. }, i.prototype.GetLocalAnchorA = function() {
  55352. return this.m_localAnchorA
  55353. }, i.prototype.GetLocalAnchorB = function() {
  55354. return this.m_localAnchorB
  55355. }, i.prototype.GetLocalAxisA = function() {
  55356. return this.m_localXAxisA
  55357. }, i.prototype.GetJointTranslation = function() {
  55358. return this.GetPrismaticJointTranslation()
  55359. }, i.prototype.GetJointLinearSpeed = function() {
  55360. return this.GetPrismaticJointSpeed()
  55361. }, i.prototype.GetJointAngle = function() {
  55362. return this.GetRevoluteJointAngle()
  55363. }, i.prototype.GetJointAngularSpeed = function() {
  55364. return this.GetRevoluteJointSpeed()
  55365. }, i.prototype.GetPrismaticJointTranslation = function() {
  55366. var t = this.m_bodyA,
  55367. e = this.m_bodyB,
  55368. i = t.GetWorldPoint(this.m_localAnchorA, new P),
  55369. n = e.GetWorldPoint(this.m_localAnchorB, new P),
  55370. r = P.SubVV(n, i, new P),
  55371. s = t.GetWorldVector(this.m_localXAxisA, new P);
  55372. return P.DotVV(r, s)
  55373. }, i.prototype.GetPrismaticJointSpeed = function() {
  55374. var t = this.m_bodyA,
  55375. e = this.m_bodyB;
  55376. P.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
  55377. var i = N.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
  55378. P.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
  55379. var n = N.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB),
  55380. r = P.AddVV(t.m_sweep.c, i, P.s_t0),
  55381. s = P.AddVV(e.m_sweep.c, n, P.s_t1),
  55382. o = P.SubVV(s, r, P.s_t2),
  55383. a = t.GetWorldVector(this.m_localXAxisA, new P),
  55384. l = t.m_linearVelocity,
  55385. h = e.m_linearVelocity,
  55386. c = t.m_angularVelocity,
  55387. u = e.m_angularVelocity;
  55388. return P.DotVV(o, P.CrossSV(c, a, P.s_t0)) + P.DotVV(a, P.SubVV(P.AddVCrossSV(h, u, n, P.s_t0), P.AddVCrossSV(l, c, i, P.s_t1), P.s_t0))
  55389. }, i.prototype.GetRevoluteJointAngle = function() {
  55390. return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a
  55391. }, i.prototype.GetRevoluteJointSpeed = function() {
  55392. var t = this.m_bodyA.m_angularVelocity;
  55393. return this.m_bodyB.m_angularVelocity - t
  55394. }, i.prototype.IsMotorEnabled = function() {
  55395. return this.m_enableMotor
  55396. }, i.prototype.EnableMotor = function(t) {
  55397. t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = t)
  55398. }, i.prototype.SetMotorSpeed = function(t) {
  55399. t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = t)
  55400. }, i.prototype.SetMaxMotorTorque = function(t) {
  55401. t !== this.m_maxMotorTorque && (this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorTorque = t)
  55402. }, i.prototype.GetMotorTorque = function(t) {
  55403. return t * this.m_motorImpulse
  55404. }, i.prototype.Dump = function(t) {
  55405. var e = this.m_bodyA.m_islandIndex,
  55406. i = this.m_bodyB.m_islandIndex;
  55407. t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"), t(" jd.bodyA = bodies[%d];\n", e), t(" jd.bodyB = bodies[%d];\n", i), t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), t(" jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y), t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), t(" jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque), t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index)
  55408. }, i.InitVelocityConstraints_s_d = new P, i.InitVelocityConstraints_s_P = new P, i.SolveVelocityConstraints_s_P = new P, i.SolvePositionConstraints_s_d = new P, i.SolvePositionConstraints_s_P = new P, i
  55409. })(fi);
  55410. function Vi(t, e) {
  55411. return S(t * e)
  55412. }
  55413. function ki(t, e) {
  55414. return t > e ? t : e
  55415. }
  55416. var Gi = (function() {
  55417. return function(t) {
  55418. this.prev = null, this.next = null, this.contact = t
  55419. }
  55420. })(),
  55421. Ui = (function() {
  55422. function t() {
  55423. this.m_islandFlag = !1, this.m_touchingFlag = !1, this.m_enabledFlag = !1, this.m_filterFlag = !1, this.m_bulletHitFlag = !1, this.m_toiFlag = !1, this.m_prev = null, this.m_next = null, this.m_indexA = 0, this.m_indexB = 0, this.m_manifold = new bt, this.m_toiCount = 0, this.m_toi = 0, this.m_friction = 0, this.m_restitution = 0, this.m_tangentSpeed = 0, this.m_oldManifold = new bt, this.m_nodeA = new Gi(this), this.m_nodeB = new Gi(this)
  55424. }
  55425. return t.prototype.GetManifold = function() {
  55426. return this.m_manifold
  55427. }, t.prototype.GetWorldManifold = function(t) {
  55428. var e = this.m_fixtureA.GetBody(),
  55429. i = this.m_fixtureB.GetBody(),
  55430. n = this.m_fixtureA.GetShape(),
  55431. r = this.m_fixtureB.GetShape();
  55432. t.Initialize(this.m_manifold, e.GetTransform(), n.m_radius, i.GetTransform(), r.m_radius)
  55433. }, t.prototype.IsTouching = function() {
  55434. return this.m_touchingFlag
  55435. }, t.prototype.SetEnabled = function(t) {
  55436. this.m_enabledFlag = t
  55437. }, t.prototype.IsEnabled = function() {
  55438. return this.m_enabledFlag
  55439. }, t.prototype.GetNext = function() {
  55440. return this.m_next
  55441. }, t.prototype.GetFixtureA = function() {
  55442. return this.m_fixtureA
  55443. }, t.prototype.GetChildIndexA = function() {
  55444. return this.m_indexA
  55445. }, t.prototype.GetFixtureB = function() {
  55446. return this.m_fixtureB
  55447. }, t.prototype.GetChildIndexB = function() {
  55448. return this.m_indexB
  55449. }, t.prototype.FlagForFiltering = function() {
  55450. this.m_filterFlag = !0
  55451. }, t.prototype.SetFriction = function(t) {
  55452. this.m_friction = t
  55453. }, t.prototype.GetFriction = function() {
  55454. return this.m_friction
  55455. }, t.prototype.ResetFriction = function() {
  55456. this.m_friction = Vi(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction)
  55457. }, t.prototype.SetRestitution = function(t) {
  55458. this.m_restitution = t
  55459. }, t.prototype.GetRestitution = function() {
  55460. return this.m_restitution
  55461. }, t.prototype.ResetRestitution = function() {
  55462. this.m_restitution = ki(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution)
  55463. }, t.prototype.SetTangentSpeed = function(t) {
  55464. this.m_tangentSpeed = t
  55465. }, t.prototype.GetTangentSpeed = function() {
  55466. return this.m_tangentSpeed
  55467. }, t.prototype.Reset = function(t, e, i, n) {
  55468. this.m_islandFlag = !1, this.m_touchingFlag = !1, this.m_enabledFlag = !0, this.m_filterFlag = !1, this.m_bulletHitFlag = !1, this.m_toiFlag = !1, this.m_fixtureA = t, this.m_fixtureB = i, this.m_indexA = e, this.m_indexB = n, this.m_manifold.pointCount = 0, this.m_prev = null, this.m_next = null, delete this.m_nodeA.contact, this.m_nodeA.prev = null, this.m_nodeA.next = null, delete this.m_nodeA.other, delete this.m_nodeB.contact, this.m_nodeB.prev = null, this.m_nodeB.next = null, delete this.m_nodeB.other, this.m_toiCount = 0, this.m_friction = Vi(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction), this.m_restitution = ki(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution)
  55469. }, t.prototype.Update = function(t) {
  55470. var e = this.m_oldManifold;
  55471. this.m_oldManifold = this.m_manifold, this.m_manifold = e, this.m_enabledFlag = !0;
  55472. var i = !1,
  55473. n = this.m_touchingFlag,
  55474. r = this.m_fixtureA.IsSensor(),
  55475. s = this.m_fixtureB.IsSensor(),
  55476. o = r || s,
  55477. a = this.m_fixtureA.GetBody(),
  55478. l = this.m_fixtureB.GetBody(),
  55479. h = a.GetTransform(),
  55480. c = l.GetTransform();
  55481. if (o) {
  55482. var u = this.m_fixtureA.GetShape(),
  55483. _ = this.m_fixtureB.GetShape();
  55484. i = Pt(u, this.m_indexA, _, this.m_indexB, h, c), this.m_manifold.pointCount = 0
  55485. } else {
  55486. this.Evaluate(this.m_manifold, h, c), i = this.m_manifold.pointCount > 0;
  55487. for (var f = 0; f < this.m_manifold.pointCount; ++f) {
  55488. var d = this.m_manifold.points[f];
  55489. d.normalImpulse = 0, d.tangentImpulse = 0;
  55490. for (var p = d.id, m = 0; m < this.m_oldManifold.pointCount; ++m) {
  55491. var y = this.m_oldManifold.points[m];
  55492. if (y.id.key === p.key) {
  55493. d.normalImpulse = y.normalImpulse, d.tangentImpulse = y.tangentImpulse;
  55494. break
  55495. }
  55496. }
  55497. }
  55498. i !== n && (a.SetAwake(!0), l.SetAwake(!0))
  55499. }
  55500. this.m_touchingFlag = i, !n && i && t && t.BeginContact(this), n && !i && t && t.EndContact(this), !o && i && t && t.PreSolve(this, this.m_oldManifold)
  55501. }, t.prototype.ComputeTOI = function(e, i) {
  55502. var n = t.ComputeTOI_s_input;
  55503. n.proxyA.SetShape(this.m_fixtureA.GetShape(), this.m_indexA), n.proxyB.SetShape(this.m_fixtureB.GetShape(), this.m_indexB), n.sweepA.Copy(e), n.sweepB.Copy(i), n.tMax = l;
  55504. var r = t.ComputeTOI_s_output;
  55505. return re(r, n), r.t
  55506. }, t.ComputeTOI_s_input = new Xt, t.ComputeTOI_s_output = new Yt, t
  55507. })(),
  55508. zi = (function(t) {
  55509. function e() {
  55510. return t.call(this) || this
  55511. }
  55512. return $e(e, t), e.Create = function(t) {
  55513. return new e
  55514. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55515. t.prototype.Reset.call(this, e, i, n, r)
  55516. }, e.prototype.Evaluate = function(t, e, i) {
  55517. ae(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
  55518. }, e
  55519. })(Ui),
  55520. ji = (function(t) {
  55521. function e() {
  55522. return t.call(this) || this
  55523. }
  55524. return $e(e, t), e.Create = function(t) {
  55525. return new e
  55526. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55527. t.prototype.Reset.call(this, e, i, n, r)
  55528. }, e.prototype.Evaluate = function(t, e, i) {
  55529. Le(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
  55530. }, e
  55531. })(Ui),
  55532. Wi = (function(t) {
  55533. function e() {
  55534. return t.call(this) || this
  55535. }
  55536. return $e(e, t), e.Create = function(t) {
  55537. return new e
  55538. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55539. t.prototype.Reset.call(this, e, i, n, r)
  55540. }, e.prototype.Evaluate = function(t, e, i) {
  55541. ue(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
  55542. }, e
  55543. })(Ui),
  55544. Hi = (function(t) {
  55545. function e() {
  55546. return t.call(this) || this
  55547. }
  55548. return $e(e, t), e.Create = function(t) {
  55549. return new e
  55550. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55551. t.prototype.Reset.call(this, e, i, n, r)
  55552. }, e.prototype.Evaluate = function(t, e, i) {
  55553. We(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
  55554. }, e
  55555. })(Ui),
  55556. Xi = (function(t) {
  55557. function e() {
  55558. return t.call(this) || this
  55559. }
  55560. return $e(e, t), e.Create = function(t) {
  55561. return new e
  55562. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55563. t.prototype.Reset.call(this, e, i, n, r)
  55564. }, e.prototype.Evaluate = function(t, e, i) {
  55565. Je(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i)
  55566. }, e
  55567. })(Ui),
  55568. Yi = (function(t) {
  55569. function e() {
  55570. return t.call(this) || this
  55571. }
  55572. return $e(e, t), e.Create = function(t) {
  55573. return new e
  55574. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55575. t.prototype.Reset.call(this, e, i, n, r)
  55576. }, e.prototype.Evaluate = function(t, i, n) {
  55577. var r = this.m_fixtureA.GetShape(),
  55578. s = this.m_fixtureB.GetShape(),
  55579. o = r,
  55580. a = e.Evaluate_s_edge;
  55581. o.GetChildEdge(a, this.m_indexA), We(t, a, i, s, n)
  55582. }, e.Evaluate_s_edge = new ii, e
  55583. })(Ui),
  55584. qi = (function(t) {
  55585. function e() {
  55586. return t.call(this) || this
  55587. }
  55588. return $e(e, t), e.Create = function(t) {
  55589. return new e
  55590. }, e.Destroy = function(t, e) {}, e.prototype.Reset = function(e, i, n, r) {
  55591. t.prototype.Reset.call(this, e, i, n, r)
  55592. }, e.prototype.Evaluate = function(t, i, n) {
  55593. var r = this.m_fixtureA.GetShape(),
  55594. s = this.m_fixtureB.GetShape(),
  55595. o = r,
  55596. a = e.Evaluate_s_edge;
  55597. o.GetChildEdge(a, this.m_indexA), Je(t, a, i, s, n)
  55598. }, e.Evaluate_s_edge = new ii, e
  55599. })(Ui),
  55600. Ji = (function() {
  55601. return function() {
  55602. this.createFcn = null, this.destroyFcn = null, this.primary = !1
  55603. }
  55604. })(),
  55605. Zi = (function() {
  55606. function e(t) {
  55607. this.m_allocator = null, this.m_allocator = t, this.InitializeRegisters()
  55608. }
  55609. return e.prototype.AddType = function(t, e, i, n) {
  55610. var r = this,
  55611. s = d(256, (function(e) {
  55612. return t(r.m_allocator)
  55613. }));
  55614. function o(e) {
  55615. return s.pop() || t(e)
  55616. }
  55617. function a(t, e) {
  55618. s.push(t)
  55619. }
  55620. this.m_registers[i][n].createFcn = o, this.m_registers[i][n].destroyFcn = a, this.m_registers[i][n].primary = !0, i !== n && (this.m_registers[n][i].createFcn = o, this.m_registers[n][i].destroyFcn = a, this.m_registers[n][i].primary = !1)
  55621. }, e.prototype.InitializeRegisters = function() {
  55622. this.m_registers = [];
  55623. for (var e = 0; e < t.b2ShapeType.e_shapeTypeCount; e++) {
  55624. this.m_registers[e] = [];
  55625. for (var i = 0; i < t.b2ShapeType.e_shapeTypeCount; i++) this.m_registers[e][i] = new Ji
  55626. }
  55627. this.AddType(zi.Create, zi.Destroy, t.b2ShapeType.e_circleShape, t.b2ShapeType.e_circleShape), this.AddType(Wi.Create, Wi.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_circleShape), this.AddType(ji.Create, ji.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_polygonShape), this.AddType(Hi.Create, Hi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_circleShape), this.AddType(Xi.Create, Xi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_polygonShape), this.AddType(Yi.Create, Yi.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_circleShape), this.AddType(qi.Create, qi.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_polygonShape)
  55628. }, e.prototype.Create = function(t, e, i, n) {
  55629. var r = t.GetType(),
  55630. s = i.GetType(),
  55631. o = this.m_registers[r][s];
  55632. if (o.createFcn) {
  55633. var a = o.createFcn(this.m_allocator);
  55634. return o.primary ? a.Reset(t, e, i, n) : a.Reset(i, n, t, e), a
  55635. }
  55636. return null
  55637. }, e.prototype.Destroy = function(t) {
  55638. var e = t.m_fixtureA,
  55639. i = t.m_fixtureB;
  55640. t.m_manifold.pointCount > 0 && !e.IsSensor() && !i.IsSensor() && (e.GetBody().SetAwake(!0), i.GetBody().SetAwake(!0));
  55641. var n = e.GetType(),
  55642. r = i.GetType(),
  55643. s = this.m_registers[n][r];
  55644. s.destroyFcn && s.destroyFcn(t, this.m_allocator)
  55645. }, e
  55646. })(),
  55647. Ki = (function() {
  55648. function t() {}
  55649. return t.prototype.SayGoodbyeJoint = function(t) {}, t.prototype.SayGoodbyeFixture = function(t) {}, t.prototype.SayGoodbyeParticleGroup = function(t) {}, t.prototype.SayGoodbyeParticle = function(t, e) {}, t
  55650. })(),
  55651. Qi = (function() {
  55652. function e() {}
  55653. return e.prototype.ShouldCollide = function(e, i) {
  55654. var n = e.GetBody(),
  55655. r = i.GetBody();
  55656. if (r.GetType() === t.b2BodyType.b2_staticBody && n.GetType() === t.b2BodyType.b2_staticBody) return !1;
  55657. if (!r.ShouldCollideConnected(n)) return !1;
  55658. var s = e.GetFilterData(),
  55659. o = i.GetFilterData();
  55660. return s.groupIndex === o.groupIndex && 0 !== s.groupIndex ? s.groupIndex > 0 : 0 != (s.maskBits & o.categoryBits) && 0 != (s.categoryBits & o.maskBits)
  55661. }, e.prototype.ShouldCollideFixtureParticle = function(t, e, i) {
  55662. return !0
  55663. }, e.prototype.ShouldCollideParticleParticle = function(t, e, i) {
  55664. return !0
  55665. }, e.b2_defaultFilter = new e, e
  55666. })(),
  55667. $i = (function() {
  55668. return function() {
  55669. this.normalImpulses = p(o), this.tangentImpulses = p(o), this.count = 0
  55670. }
  55671. })(),
  55672. tn = (function() {
  55673. function t() {}
  55674. return t.prototype.BeginContact = function(t) {}, t.prototype.EndContact = function(t) {}, t.prototype.BeginContactFixtureParticle = function(t, e) {}, t.prototype.EndContactFixtureParticle = function(t, e) {}, t.prototype.BeginContactParticleParticle = function(t, e) {}, t.prototype.EndContactParticleParticle = function(t, e) {}, t.prototype.PreSolve = function(t, e) {}, t.prototype.PostSolve = function(t, e) {}, t.b2_defaultListener = new t, t
  55675. })(),
  55676. en = (function() {
  55677. function t() {}
  55678. return t.prototype.ReportFixture = function(t) {
  55679. return !0
  55680. }, t.prototype.ReportParticle = function(t, e) {
  55681. return !1
  55682. }, t.prototype.ShouldQueryParticleSystem = function(t) {
  55683. return !0
  55684. }, t
  55685. })(),
  55686. nn = (function() {
  55687. function t() {}
  55688. return t.prototype.ReportFixture = function(t, e, i, n) {
  55689. return n
  55690. }, t.prototype.ReportParticle = function(t, e, i, n, r) {
  55691. return 0
  55692. }, t.prototype.ShouldQueryParticleSystem = function(t) {
  55693. return !0
  55694. }, t
  55695. })(),
  55696. rn = (function() {
  55697. function e() {
  55698. this.m_broadPhase = new Nt, this.m_contactList = null, this.m_contactCount = 0, this.m_contactFilter = Qi.b2_defaultFilter, this.m_contactListener = tn.b2_defaultListener, this.m_allocator = null, this.m_contactFactory = new Zi(this.m_allocator)
  55699. }
  55700. return e.prototype.AddPair = function(t, e) {
  55701. var i = t.fixture,
  55702. n = e.fixture,
  55703. r = t.childIndex,
  55704. s = e.childIndex,
  55705. o = i.GetBody(),
  55706. a = n.GetBody();
  55707. if (o !== a) {
  55708. for (var l = a.GetContactList(); l;) {
  55709. if (l.other === o) {
  55710. var h = l.contact.GetFixtureA(),
  55711. c = l.contact.GetFixtureB(),
  55712. u = l.contact.GetChildIndexA(),
  55713. _ = l.contact.GetChildIndexB();
  55714. if (h === i && c === n && u === r && _ === s) return;
  55715. if (h === n && c === i && u === s && _ === r) return
  55716. }
  55717. l = l.next
  55718. }
  55719. if (!this.m_contactFilter || this.m_contactFilter.ShouldCollide(i, n)) {
  55720. var f = this.m_contactFactory.Create(i, r, n, s);
  55721. null !== f && (i = f.GetFixtureA(), n = f.GetFixtureB(), r = f.GetChildIndexA(), s = f.GetChildIndexB(), o = i.m_body, a = n.m_body, f.m_prev = null, f.m_next = this.m_contactList, null !== this.m_contactList && (this.m_contactList.m_prev = f), this.m_contactList = f, f.m_nodeA.contact = f, f.m_nodeA.other = a, f.m_nodeA.prev = null, f.m_nodeA.next = o.m_contactList, null !== o.m_contactList && (o.m_contactList.prev = f.m_nodeA), o.m_contactList = f.m_nodeA, f.m_nodeB.contact = f, f.m_nodeB.other = o, f.m_nodeB.prev = null, f.m_nodeB.next = a.m_contactList, null !== a.m_contactList && (a.m_contactList.prev = f.m_nodeB), a.m_contactList = f.m_nodeB, i.IsSensor() || n.IsSensor() || (o.SetAwake(!0), a.SetAwake(!0)), ++this.m_contactCount)
  55722. }
  55723. }
  55724. }, e.prototype.FindNewContacts = function() {
  55725. var t = this;
  55726. this.m_broadPhase.UpdatePairs((function(e, i) {
  55727. t.AddPair(e, i)
  55728. }))
  55729. }, e.prototype.Destroy = function(t) {
  55730. var e = t.GetFixtureA(),
  55731. i = t.GetFixtureB(),
  55732. n = e.GetBody(),
  55733. r = i.GetBody();
  55734. this.m_contactListener && t.IsTouching() && this.m_contactListener.EndContact(t), t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_contactList && (this.m_contactList = t.m_next), t.m_nodeA.prev && (t.m_nodeA.prev.next = t.m_nodeA.next), t.m_nodeA.next && (t.m_nodeA.next.prev = t.m_nodeA.prev), t.m_nodeA === n.m_contactList && (n.m_contactList = t.m_nodeA.next), t.m_nodeB.prev && (t.m_nodeB.prev.next = t.m_nodeB.next), t.m_nodeB.next && (t.m_nodeB.next.prev = t.m_nodeB.prev), t.m_nodeB === r.m_contactList && (r.m_contactList = t.m_nodeB.next), this.m_contactFactory.Destroy(t), --this.m_contactCount
  55735. }, e.prototype.Collide = function() {
  55736. for (var e = this.m_contactList; e;) {
  55737. var i = e.GetFixtureA(),
  55738. n = e.GetFixtureB(),
  55739. r = e.GetChildIndexA(),
  55740. s = e.GetChildIndexB(),
  55741. o = i.GetBody(),
  55742. a = n.GetBody();
  55743. if (e.m_filterFlag) {
  55744. if (this.m_contactFilter && !this.m_contactFilter.ShouldCollide(i, n)) {
  55745. e = (c = e).m_next, this.Destroy(c);
  55746. continue
  55747. }
  55748. e.m_filterFlag = !1
  55749. }
  55750. var l = o.IsAwake() && o.m_type !== t.b2BodyType.b2_staticBody,
  55751. h = a.IsAwake() && a.m_type !== t.b2BodyType.b2_staticBody;
  55752. if (l || h) {
  55753. var c, u = i.m_proxies[r].treeNode,
  55754. _ = n.m_proxies[s].treeNode;
  55755. if (Et(u.aabb, _.aabb)) e.Update(this.m_contactListener), e = e.m_next;
  55756. else e = (c = e).m_next, this.Destroy(c)
  55757. } else e = e.m_next
  55758. }
  55759. }, e
  55760. })(),
  55761. sn = (function() {
  55762. function t() {
  55763. this.step = 0, this.collide = 0, this.solve = 0, this.solveInit = 0, this.solveVelocity = 0, this.solvePosition = 0, this.broadphase = 0, this.solveTOI = 0
  55764. }
  55765. return t.prototype.Reset = function() {
  55766. return this.step = 0, this.collide = 0, this.solve = 0, this.solveInit = 0, this.solveVelocity = 0, this.solvePosition = 0, this.broadphase = 0, this.solveTOI = 0, this
  55767. }, t
  55768. })(),
  55769. on = (function() {
  55770. function t() {
  55771. this.dt = 0, this.inv_dt = 0, this.dtRatio = 0, this.velocityIterations = 0, this.positionIterations = 0, this.particleIterations = 0, this.warmStarting = !1
  55772. }
  55773. return t.prototype.Copy = function(t) {
  55774. return this.dt = t.dt, this.inv_dt = t.inv_dt, this.dtRatio = t.dtRatio, this.positionIterations = t.positionIterations, this.velocityIterations = t.velocityIterations, this.particleIterations = t.particleIterations, this.warmStarting = t.warmStarting, this
  55775. }, t
  55776. })(),
  55777. an = (function() {
  55778. function t() {
  55779. this.c = new P, this.a = 0
  55780. }
  55781. return t.MakeArray = function(e) {
  55782. return d(e, (function(e) {
  55783. return new t
  55784. }))
  55785. }, t
  55786. })(),
  55787. ln = (function() {
  55788. function t() {
  55789. this.v = new P, this.w = 0
  55790. }
  55791. return t.MakeArray = function(e) {
  55792. return d(e, (function(e) {
  55793. return new t
  55794. }))
  55795. }, t
  55796. })(),
  55797. hn = (function() {
  55798. return function() {
  55799. this.step = new on
  55800. }
  55801. })(),
  55802. cn = (function() {
  55803. function t() {
  55804. this.rA = new P, this.rB = new P, this.normalImpulse = 0, this.tangentImpulse = 0, this.normalMass = 0, this.tangentMass = 0, this.velocityBias = 0
  55805. }
  55806. return t.MakeArray = function(e) {
  55807. return d(e, (function(e) {
  55808. return new t
  55809. }))
  55810. }, t
  55811. })(),
  55812. un = (function() {
  55813. function t() {
  55814. this.points = cn.MakeArray(o), this.normal = new P, this.tangent = new P, this.normalMass = new L, this.K = new L, this.indexA = 0, this.indexB = 0, this.invMassA = 0, this.invMassB = 0, this.invIA = 0, this.invIB = 0, this.friction = 0, this.restitution = 0, this.tangentSpeed = 0, this.pointCount = 0, this.contactIndex = 0
  55815. }
  55816. return t.MakeArray = function(e) {
  55817. return d(e, (function(e) {
  55818. return new t
  55819. }))
  55820. }, t
  55821. })(),
  55822. _n = (function() {
  55823. function e() {
  55824. this.localPoints = P.MakeArray(o), this.localNormal = new P, this.localPoint = new P, this.indexA = 0, this.indexB = 0, this.invMassA = 0, this.invMassB = 0, this.localCenterA = new P, this.localCenterB = new P, this.invIA = 0, this.invIB = 0, this.type = t.b2ManifoldType.e_unknown, this.radiusA = 0, this.radiusB = 0, this.pointCount = 0
  55825. }
  55826. return e.MakeArray = function(t) {
  55827. return d(t, (function(t) {
  55828. return new e
  55829. }))
  55830. }, e
  55831. })(),
  55832. fn = (function() {
  55833. return function() {
  55834. this.step = new on, this.count = 0, this.allocator = null
  55835. }
  55836. })(),
  55837. dn = (function() {
  55838. function e() {
  55839. this.normal = new P, this.point = new P, this.separation = 0
  55840. }
  55841. return e.prototype.Initialize = function(i, n, r, s) {
  55842. var o = e.Initialize_s_pointA,
  55843. a = e.Initialize_s_pointB,
  55844. l = e.Initialize_s_planePoint,
  55845. h = e.Initialize_s_clipPoint;
  55846. switch (i.type) {
  55847. case t.b2ManifoldType.e_circles:
  55848. V.MulXV(n, i.localPoint, o), V.MulXV(r, i.localPoints[0], a), P.SubVV(a, o, this.normal).SelfNormalize(), P.MidVV(o, a, this.point), this.separation = P.DotVV(P.SubVV(a, o, P.s_t0), this.normal) - i.radiusA - i.radiusB;
  55849. break;
  55850. case t.b2ManifoldType.e_faceA:
  55851. N.MulRV(n.q, i.localNormal, this.normal), V.MulXV(n, i.localPoint, l), V.MulXV(r, i.localPoints[s], h), this.separation = P.DotVV(P.SubVV(h, l, P.s_t0), this.normal) - i.radiusA - i.radiusB, this.point.Copy(h);
  55852. break;
  55853. case t.b2ManifoldType.e_faceB:
  55854. N.MulRV(r.q, i.localNormal, this.normal), V.MulXV(r, i.localPoint, l), V.MulXV(n, i.localPoints[s], h), this.separation = P.DotVV(P.SubVV(h, l, P.s_t0), this.normal) - i.radiusA - i.radiusB, this.point.Copy(h), this.normal.SelfNeg()
  55855. }
  55856. }, e.Initialize_s_pointA = new P, e.Initialize_s_pointB = new P, e.Initialize_s_planePoint = new P, e.Initialize_s_clipPoint = new P, e
  55857. })(),
  55858. pn = (function() {
  55859. function t() {
  55860. this.m_step = new on, this.m_allocator = null, this.m_positionConstraints = _n.MakeArray(1024), this.m_velocityConstraints = un.MakeArray(1024), this.m_count = 0
  55861. }
  55862. return t.prototype.Initialize = function(t) {
  55863. if (this.m_step.Copy(t.step), this.m_allocator = t.allocator, this.m_count = t.count, this.m_positionConstraints.length < this.m_count)
  55864. for (var e = x(2 * this.m_positionConstraints.length, this.m_count); this.m_positionConstraints.length < e;) this.m_positionConstraints[this.m_positionConstraints.length] = new _n;
  55865. if (this.m_velocityConstraints.length < this.m_count)
  55866. for (e = x(2 * this.m_velocityConstraints.length, this.m_count); this.m_velocityConstraints.length < e;) this.m_velocityConstraints[this.m_velocityConstraints.length] = new un;
  55867. this.m_positions = t.positions, this.m_velocities = t.velocities, this.m_contacts = t.contacts;
  55868. for (var i = 0; i < this.m_count; ++i) {
  55869. var n = this.m_contacts[i],
  55870. r = n.m_fixtureA,
  55871. s = n.m_fixtureB,
  55872. o = r.GetShape(),
  55873. a = s.GetShape(),
  55874. l = o.m_radius,
  55875. h = a.m_radius,
  55876. c = r.GetBody(),
  55877. u = s.GetBody(),
  55878. _ = n.GetManifold(),
  55879. f = _.pointCount,
  55880. d = this.m_velocityConstraints[i];
  55881. d.friction = n.m_friction, d.restitution = n.m_restitution, d.tangentSpeed = n.m_tangentSpeed, d.indexA = c.m_islandIndex, d.indexB = u.m_islandIndex, d.invMassA = c.m_invMass, d.invMassB = u.m_invMass, d.invIA = c.m_invI, d.invIB = u.m_invI, d.contactIndex = i, d.pointCount = f, d.K.SetZero(), d.normalMass.SetZero();
  55882. var p = this.m_positionConstraints[i];
  55883. p.indexA = c.m_islandIndex, p.indexB = u.m_islandIndex, p.invMassA = c.m_invMass, p.invMassB = u.m_invMass, p.localCenterA.Copy(c.m_sweep.localCenter), p.localCenterB.Copy(u.m_sweep.localCenter), p.invIA = c.m_invI, p.invIB = u.m_invI, p.localNormal.Copy(_.localNormal), p.localPoint.Copy(_.localPoint), p.pointCount = f, p.radiusA = l, p.radiusB = h, p.type = _.type;
  55884. for (var m = 0; m < f; ++m) {
  55885. var y = _.points[m],
  55886. v = d.points[m];
  55887. this.m_step.warmStarting ? (v.normalImpulse = this.m_step.dtRatio * y.normalImpulse, v.tangentImpulse = this.m_step.dtRatio * y.tangentImpulse) : (v.normalImpulse = 0, v.tangentImpulse = 0), v.rA.SetZero(), v.rB.SetZero(), v.normalMass = 0, v.tangentMass = 0, v.velocityBias = 0, p.localPoints[m].Copy(y.localPoint)
  55888. }
  55889. }
  55890. return this
  55891. }, t.prototype.InitializeVelocityConstraints = function() {
  55892. for (var e = t.InitializeVelocityConstraints_s_xfA, i = t.InitializeVelocityConstraints_s_xfB, n = t.InitializeVelocityConstraints_s_worldManifold, r = 0; r < this.m_count; ++r) {
  55893. var s = this.m_velocityConstraints[r],
  55894. o = this.m_positionConstraints[r],
  55895. a = o.radiusA,
  55896. l = o.radiusB,
  55897. h = this.m_contacts[s.contactIndex].GetManifold(),
  55898. c = s.indexA,
  55899. u = s.indexB,
  55900. _ = s.invMassA,
  55901. f = s.invMassB,
  55902. d = s.invIA,
  55903. p = s.invIB,
  55904. m = o.localCenterA,
  55905. y = o.localCenterB,
  55906. v = this.m_positions[c].c,
  55907. g = this.m_positions[c].a,
  55908. x = this.m_velocities[c].v,
  55909. b = this.m_velocities[c].w,
  55910. A = this.m_positions[u].c,
  55911. C = this.m_positions[u].a,
  55912. T = this.m_velocities[u].v,
  55913. S = this.m_velocities[u].w;
  55914. e.q.SetAngle(g), i.q.SetAngle(C), P.SubVV(v, N.MulRV(e.q, m, P.s_t0), e.p), P.SubVV(A, N.MulRV(i.q, y, P.s_t0), i.p), n.Initialize(h, e, a, i, l), s.normal.Copy(n.normal), P.CrossVOne(s.normal, s.tangent);
  55915. for (var w = s.pointCount, E = 0; E < w; ++E) {
  55916. var M = s.points[E];
  55917. P.SubVV(n.points[E], v, M.rA), P.SubVV(n.points[E], A, M.rB);
  55918. var D = P.CrossVV(M.rA, s.normal),
  55919. B = P.CrossVV(M.rB, s.normal),
  55920. I = _ + f + d * D * D + p * B * B;
  55921. M.normalMass = I > 0 ? 1 / I : 0;
  55922. var R = s.tangent,
  55923. O = P.CrossVV(M.rA, R),
  55924. L = P.CrossVV(M.rB, R),
  55925. F = _ + f + d * O * O + p * L * L;
  55926. M.tangentMass = F > 0 ? 1 / F : 0, M.velocityBias = 0;
  55927. var V = P.DotVV(s.normal, P.SubVV(P.AddVCrossSV(T, S, M.rB, P.s_t0), P.AddVCrossSV(x, b, M.rA, P.s_t1), P.s_t0));
  55928. V < -1 && (M.velocityBias += -s.restitution * V)
  55929. }
  55930. s.pointCount
  55931. }
  55932. }, t.prototype.WarmStart = function() {
  55933. for (var e = t.WarmStart_s_P, i = 0; i < this.m_count; ++i) {
  55934. for (var n = this.m_velocityConstraints[i], r = n.indexA, s = n.indexB, o = n.invMassA, a = n.invIA, l = n.invMassB, h = n.invIB, c = n.pointCount, u = this.m_velocities[r].v, _ = this.m_velocities[r].w, f = this.m_velocities[s].v, d = this.m_velocities[s].w, p = n.normal, m = n.tangent, y = 0; y < c; ++y) {
  55935. var v = n.points[y];
  55936. P.AddVV(P.MulSV(v.normalImpulse, p, P.s_t0), P.MulSV(v.tangentImpulse, m, P.s_t1), e), _ -= a * P.CrossVV(v.rA, e), u.SelfMulSub(o, e), d += h * P.CrossVV(v.rB, e), f.SelfMulAdd(l, e)
  55937. }
  55938. this.m_velocities[r].w = _, this.m_velocities[s].w = d
  55939. }
  55940. }, t.prototype.SolveVelocityConstraints = function() {
  55941. for (var e = t.SolveVelocityConstraints_s_dv, i = (t.SolveVelocityConstraints_s_dv1, t.SolveVelocityConstraints_s_dv2, t.SolveVelocityConstraints_s_P), n = (t.SolveVelocityConstraints_s_a, t.SolveVelocityConstraints_s_b, t.SolveVelocityConstraints_s_x, t.SolveVelocityConstraints_s_d, t.SolveVelocityConstraints_s_P1, t.SolveVelocityConstraints_s_P2, t.SolveVelocityConstraints_s_P1P2, 0); n < this.m_count; ++n) {
  55942. for (var r = this.m_velocityConstraints[n], s = r.indexA, o = r.indexB, a = r.invMassA, l = r.invIA, h = r.invMassB, c = r.invIB, u = r.pointCount, _ = this.m_velocities[s].v, f = this.m_velocities[s].w, d = this.m_velocities[o].v, p = this.m_velocities[o].w, m = r.normal, y = r.tangent, v = r.friction, g = 0; g < u; ++g) {
  55943. var A = r.points[g];
  55944. P.SubVV(P.AddVCrossSV(d, p, A.rB, P.s_t0), P.AddVCrossSV(_, f, A.rA, P.s_t1), e);
  55945. var C = P.DotVV(e, y) - r.tangentSpeed,
  55946. T = A.tangentMass * -C,
  55947. S = v * A.normalImpulse;
  55948. T = (w = b(A.tangentImpulse + T, -S, S)) - A.tangentImpulse, A.tangentImpulse = w, P.MulSV(T, y, i), _.SelfMulSub(a, i), f -= l * P.CrossVV(A.rA, i), d.SelfMulAdd(h, i), p += c * P.CrossVV(A.rB, i)
  55949. }
  55950. r.pointCount;
  55951. for (g = 0; g < u; ++g) {
  55952. A = r.points[g];
  55953. P.SubVV(P.AddVCrossSV(d, p, A.rB, P.s_t0), P.AddVCrossSV(_, f, A.rA, P.s_t1), e);
  55954. var w, E = P.DotVV(e, m);
  55955. T = -A.normalMass * (E - A.velocityBias);
  55956. T = (w = x(A.normalImpulse + T, 0)) - A.normalImpulse, A.normalImpulse = w, P.MulSV(T, m, i), _.SelfMulSub(a, i), f -= l * P.CrossVV(A.rA, i), d.SelfMulAdd(h, i), p += c * P.CrossVV(A.rB, i)
  55957. }
  55958. this.m_velocities[s].w = f, this.m_velocities[o].w = p
  55959. }
  55960. }, t.prototype.StoreImpulses = function() {
  55961. for (var t = 0; t < this.m_count; ++t)
  55962. for (var e = this.m_velocityConstraints[t], i = this.m_contacts[e.contactIndex].GetManifold(), n = 0; n < e.pointCount; ++n) i.points[n].normalImpulse = e.points[n].normalImpulse, i.points[n].tangentImpulse = e.points[n].tangentImpulse
  55963. }, t.prototype.SolvePositionConstraints = function() {
  55964. for (var e = t.SolvePositionConstraints_s_xfA, i = t.SolvePositionConstraints_s_xfB, n = t.SolvePositionConstraints_s_psm, r = t.SolvePositionConstraints_s_rA, s = t.SolvePositionConstraints_s_rB, o = t.SolvePositionConstraints_s_P, a = 0, h = 0; h < this.m_count; ++h) {
  55965. for (var c = this.m_positionConstraints[h], u = c.indexA, _ = c.indexB, f = c.localCenterA, d = c.invMassA, p = c.invIA, m = c.localCenterB, y = c.invMassB, v = c.invIB, x = c.pointCount, A = this.m_positions[u].c, C = this.m_positions[u].a, T = this.m_positions[_].c, S = this.m_positions[_].a, w = 0; w < x; ++w) {
  55966. e.q.SetAngle(C), i.q.SetAngle(S), P.SubVV(A, N.MulRV(e.q, f, P.s_t0), e.p), P.SubVV(T, N.MulRV(i.q, m, P.s_t0), i.p), n.Initialize(c, e, i, w);
  55967. var E = n.normal,
  55968. M = n.point,
  55969. D = n.separation;
  55970. P.SubVV(M, A, r), P.SubVV(M, T, s), a = g(a, D);
  55971. var B = b(.2 * (D + l), -.2, 0),
  55972. I = P.CrossVV(r, E),
  55973. R = P.CrossVV(s, E),
  55974. O = d + y + p * I * I + v * R * R,
  55975. L = O > 0 ? -B / O : 0;
  55976. P.MulSV(L, E, o), A.SelfMulSub(d, o), C -= p * P.CrossVV(r, o), T.SelfMulAdd(y, o), S += v * P.CrossVV(s, o)
  55977. }
  55978. this.m_positions[u].a = C, this.m_positions[_].a = S
  55979. }
  55980. return a > -3 * l
  55981. }, t.prototype.SolveTOIPositionConstraints = function(e, i) {
  55982. for (var n = t.SolveTOIPositionConstraints_s_xfA, r = t.SolveTOIPositionConstraints_s_xfB, s = t.SolveTOIPositionConstraints_s_psm, o = t.SolveTOIPositionConstraints_s_rA, a = t.SolveTOIPositionConstraints_s_rB, h = t.SolveTOIPositionConstraints_s_P, c = 0, u = 0; u < this.m_count; ++u) {
  55983. var _ = this.m_positionConstraints[u],
  55984. f = _.indexA,
  55985. d = _.indexB,
  55986. p = _.localCenterA,
  55987. m = _.localCenterB,
  55988. y = _.pointCount,
  55989. v = 0,
  55990. x = 0;
  55991. f !== e && f !== i || (v = _.invMassA, x = _.invIA);
  55992. var A = 0,
  55993. C = 0;
  55994. d !== e && d !== i || (A = _.invMassB, C = _.invIB);
  55995. for (var T = this.m_positions[f].c, S = this.m_positions[f].a, w = this.m_positions[d].c, E = this.m_positions[d].a, M = 0; M < y; ++M) {
  55996. n.q.SetAngle(S), r.q.SetAngle(E), P.SubVV(T, N.MulRV(n.q, p, P.s_t0), n.p), P.SubVV(w, N.MulRV(r.q, m, P.s_t0), r.p), s.Initialize(_, n, r, M);
  55997. var D = s.normal,
  55998. B = s.point,
  55999. I = s.separation;
  56000. P.SubVV(B, T, o), P.SubVV(B, w, a), c = g(c, I);
  56001. var R = b(.75 * (I + l), -.2, 0),
  56002. O = P.CrossVV(o, D),
  56003. L = P.CrossVV(a, D),
  56004. F = v + A + x * O * O + C * L * L,
  56005. V = F > 0 ? -R / F : 0;
  56006. P.MulSV(V, D, h), T.SelfMulSub(v, h), S -= x * P.CrossVV(o, h), w.SelfMulAdd(A, h), E += C * P.CrossVV(a, h)
  56007. }
  56008. this.m_positions[f].a = S, this.m_positions[d].a = E
  56009. }
  56010. return c >= -1.5 * l
  56011. }, t.InitializeVelocityConstraints_s_xfA = new V, t.InitializeVelocityConstraints_s_xfB = new V, t.InitializeVelocityConstraints_s_worldManifold = new At, t.WarmStart_s_P = new P, t.SolveVelocityConstraints_s_dv = new P, t.SolveVelocityConstraints_s_dv1 = new P, t.SolveVelocityConstraints_s_dv2 = new P, t.SolveVelocityConstraints_s_P = new P, t.SolveVelocityConstraints_s_a = new P, t.SolveVelocityConstraints_s_b = new P, t.SolveVelocityConstraints_s_x = new P, t.SolveVelocityConstraints_s_d = new P, t.SolveVelocityConstraints_s_P1 = new P, t.SolveVelocityConstraints_s_P2 = new P, t.SolveVelocityConstraints_s_P1P2 = new P, t.SolvePositionConstraints_s_xfA = new V, t.SolvePositionConstraints_s_xfB = new V, t.SolvePositionConstraints_s_psm = new dn, t.SolvePositionConstraints_s_rA = new P, t.SolvePositionConstraints_s_rB = new P, t.SolvePositionConstraints_s_P = new P, t.SolveTOIPositionConstraints_s_xfA = new V, t.SolveTOIPositionConstraints_s_xfB = new V, t.SolveTOIPositionConstraints_s_psm = new dn, t.SolveTOIPositionConstraints_s_rA = new P, t.SolveTOIPositionConstraints_s_rB = new P, t.SolveTOIPositionConstraints_s_P = new P, t
  56012. })(),
  56013. mn = (function() {
  56014. function e() {
  56015. this.m_allocator = null, this.m_bodies = [], this.m_contacts = [], this.m_joints = [], this.m_positions = an.MakeArray(1024), this.m_velocities = ln.MakeArray(1024), this.m_bodyCount = 0, this.m_jointCount = 0, this.m_contactCount = 0, this.m_bodyCapacity = 0, this.m_contactCapacity = 0, this.m_jointCapacity = 0
  56016. }
  56017. return e.prototype.Initialize = function(t, e, i, n, r) {
  56018. if (this.m_bodyCapacity = t, this.m_contactCapacity = e, this.m_jointCapacity = i, this.m_bodyCount = 0, this.m_contactCount = 0, this.m_jointCount = 0, this.m_allocator = n, this.m_listener = r, this.m_positions.length < t)
  56019. for (var s = x(2 * this.m_positions.length, t); this.m_positions.length < s;) this.m_positions[this.m_positions.length] = new an;
  56020. if (this.m_velocities.length < t)
  56021. for (s = x(2 * this.m_velocities.length, t); this.m_velocities.length < s;) this.m_velocities[this.m_velocities.length] = new ln
  56022. }, e.prototype.Clear = function() {
  56023. this.m_bodyCount = 0, this.m_contactCount = 0, this.m_jointCount = 0
  56024. }, e.prototype.AddBody = function(t) {
  56025. t.m_islandIndex = this.m_bodyCount, this.m_bodies[this.m_bodyCount++] = t
  56026. }, e.prototype.AddContact = function(t) {
  56027. this.m_contacts[this.m_contactCount++] = t
  56028. }, e.prototype.AddJoint = function(t) {
  56029. this.m_joints[this.m_jointCount++] = t
  56030. }, e.prototype.Solve = function(n, r, s, o) {
  56031. for (var a = e.s_timer.Reset(), l = r.dt, h = 0; h < this.m_bodyCount; ++h) {
  56032. var c = this.m_bodies[h];
  56033. this.m_positions[h].c.Copy(c.m_sweep.c);
  56034. var u = c.m_sweep.a,
  56035. _ = this.m_velocities[h].v.Copy(c.m_linearVelocity),
  56036. f = c.m_angularVelocity;
  56037. c.m_sweep.c0.Copy(c.m_sweep.c), c.m_sweep.a0 = c.m_sweep.a, c.m_type === t.b2BodyType.b2_dynamicBody && (_.x += l * (c.m_gravityScale * s.x + c.m_invMass * c.m_force.x), _.y += l * (c.m_gravityScale * s.y + c.m_invMass * c.m_force.y), f += l * c.m_invI * c.m_torque, _.SelfMul(1 / (1 + l * c.m_linearDamping)), f *= 1 / (1 + l * c.m_angularDamping)), this.m_positions[h].a = u, this.m_velocities[h].w = f
  56038. }
  56039. a.Reset();
  56040. var d = e.s_solverData;
  56041. d.step.Copy(r), d.positions = this.m_positions, d.velocities = this.m_velocities;
  56042. var p = e.s_contactSolverDef;
  56043. p.step.Copy(r), p.contacts = this.m_contacts, p.count = this.m_contactCount, p.positions = this.m_positions, p.velocities = this.m_velocities, p.allocator = this.m_allocator;
  56044. var m = e.s_contactSolver.Initialize(p);
  56045. m.InitializeVelocityConstraints(), r.warmStarting && m.WarmStart();
  56046. for (h = 0; h < this.m_jointCount; ++h) this.m_joints[h].InitVelocityConstraints(d);
  56047. n.solveInit = a.GetMilliseconds(), a.Reset();
  56048. for (h = 0; h < r.velocityIterations; ++h) {
  56049. for (var y = 0; y < this.m_jointCount; ++y) this.m_joints[y].SolveVelocityConstraints(d);
  56050. m.SolveVelocityConstraints()
  56051. }
  56052. m.StoreImpulses(), n.solveVelocity = a.GetMilliseconds();
  56053. for (h = 0; h < this.m_bodyCount; ++h) {
  56054. var x = this.m_positions[h].c,
  56055. b = (u = this.m_positions[h].a, _ = this.m_velocities[h].v, f = this.m_velocities[h].w, P.MulSV(l, _, e.s_translation));
  56056. if (P.DotVV(b, b) > 4) {
  56057. var A = 2 / b.Length();
  56058. _.SelfMul(A)
  56059. }
  56060. var C = l * f;
  56061. if (C * C > 2.4674011002726646) f *= A = 1.570796326795 / v(C);
  56062. x.x += l * _.x, x.y += l * _.y, u += l * f, this.m_positions[h].a = u, this.m_velocities[h].w = f
  56063. }
  56064. a.Reset();
  56065. var T = !1;
  56066. for (h = 0; h < r.positionIterations; ++h) {
  56067. var S = m.SolvePositionConstraints(),
  56068. w = !0;
  56069. for (y = 0; y < this.m_jointCount; ++y) {
  56070. var E = this.m_joints[y].SolvePositionConstraints(d);
  56071. w = w && E
  56072. }
  56073. if (S && w) {
  56074. T = !0;
  56075. break
  56076. }
  56077. }
  56078. for (h = 0; h < this.m_bodyCount; ++h) {
  56079. var M = this.m_bodies[h];
  56080. M.m_sweep.c.Copy(this.m_positions[h].c), M.m_sweep.a = this.m_positions[h].a, M.m_linearVelocity.Copy(this.m_velocities[h].v), M.m_angularVelocity = this.m_velocities[h].w, M.SynchronizeTransform()
  56081. }
  56082. if (n.solvePosition = a.GetMilliseconds(), this.Report(m.m_velocityConstraints), o) {
  56083. var D = i;
  56084. for (h = 0; h < this.m_bodyCount; ++h) {
  56085. (c = this.m_bodies[h]).GetType() !== t.b2BodyType.b2_staticBody && (!c.m_autoSleepFlag || c.m_angularVelocity * c.m_angularVelocity > .0012184696791469947 || P.DotVV(c.m_linearVelocity, c.m_linearVelocity) > 1e-4 ? (c.m_sleepTime = 0, D = 0) : (c.m_sleepTime += l, D = g(D, c.m_sleepTime)))
  56086. }
  56087. if (D >= .5 && T)
  56088. for (h = 0; h < this.m_bodyCount; ++h) {
  56089. (c = this.m_bodies[h]).SetAwake(!1)
  56090. }
  56091. }
  56092. }, e.prototype.SolveTOI = function(t, i, n) {
  56093. for (var r = 0; r < this.m_bodyCount; ++r) {
  56094. var s = this.m_bodies[r];
  56095. this.m_positions[r].c.Copy(s.m_sweep.c), this.m_positions[r].a = s.m_sweep.a, this.m_velocities[r].v.Copy(s.m_linearVelocity), this.m_velocities[r].w = s.m_angularVelocity
  56096. }
  56097. var o = e.s_contactSolverDef;
  56098. o.contacts = this.m_contacts, o.count = this.m_contactCount, o.allocator = this.m_allocator, o.step.Copy(t), o.positions = this.m_positions, o.velocities = this.m_velocities;
  56099. var a = e.s_contactSolver.Initialize(o);
  56100. for (r = 0; r < t.positionIterations; ++r) {
  56101. if (a.SolveTOIPositionConstraints(i, n)) break
  56102. }
  56103. this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c), this.m_bodies[i].m_sweep.a0 = this.m_positions[i].a, this.m_bodies[n].m_sweep.c0.Copy(this.m_positions[n].c), this.m_bodies[n].m_sweep.a0 = this.m_positions[n].a, a.InitializeVelocityConstraints();
  56104. for (r = 0; r < t.velocityIterations; ++r) a.SolveVelocityConstraints();
  56105. var l = t.dt;
  56106. for (r = 0; r < this.m_bodyCount; ++r) {
  56107. var h = this.m_positions[r].c,
  56108. c = this.m_positions[r].a,
  56109. u = this.m_velocities[r].v,
  56110. _ = this.m_velocities[r].w,
  56111. f = P.MulSV(l, u, e.s_translation);
  56112. if (P.DotVV(f, f) > 4) {
  56113. var d = 2 / f.Length();
  56114. u.SelfMul(d)
  56115. }
  56116. var p = l * _;
  56117. if (p * p > 2.4674011002726646) _ *= d = 1.570796326795 / v(p);
  56118. h.SelfMulAdd(l, u), c += l * _, this.m_positions[r].a = c, this.m_velocities[r].w = _;
  56119. var m = this.m_bodies[r];
  56120. m.m_sweep.c.Copy(h), m.m_sweep.a = c, m.m_linearVelocity.Copy(u), m.m_angularVelocity = _, m.SynchronizeTransform()
  56121. }
  56122. this.Report(a.m_velocityConstraints)
  56123. }, e.prototype.Report = function(t) {
  56124. if (null !== this.m_listener)
  56125. for (var i = 0; i < this.m_contactCount; ++i) {
  56126. var n = this.m_contacts[i];
  56127. if (n) {
  56128. var r = t[i],
  56129. s = e.s_impulse;
  56130. s.count = r.pointCount;
  56131. for (var o = 0; o < r.pointCount; ++o) s.normalImpulses[o] = r.points[o].normalImpulse, s.tangentImpulses[o] = r.points[o].tangentImpulse;
  56132. this.m_listener.PostSolve(n, s)
  56133. }
  56134. }
  56135. }, e.s_timer = new z, e.s_solverData = new hn, e.s_contactSolverDef = new fn, e.s_contactSolver = new pn, e.s_translation = new P, e.s_impulse = new $i, e
  56136. })();
  56137. (function(t) {
  56138. t[t.b2_waterParticle = 0] = "b2_waterParticle", t[t.b2_zombieParticle = 2] = "b2_zombieParticle", t[t.b2_wallParticle = 4] = "b2_wallParticle", t[t.b2_springParticle = 8] = "b2_springParticle", t[t.b2_elasticParticle = 16] = "b2_elasticParticle", t[t.b2_viscousParticle = 32] = "b2_viscousParticle", t[t.b2_powderParticle = 64] = "b2_powderParticle", t[t.b2_tensileParticle = 128] = "b2_tensileParticle", t[t.b2_colorMixingParticle = 256] = "b2_colorMixingParticle", t[t.b2_destructionListenerParticle = 512] = "b2_destructionListenerParticle", t[t.b2_barrierParticle = 1024] = "b2_barrierParticle", t[t.b2_staticPressureParticle = 2048] = "b2_staticPressureParticle", t[t.b2_reactiveParticle = 4096] = "b2_reactiveParticle", t[t.b2_repulsiveParticle = 8192] = "b2_repulsiveParticle", t[t.b2_fixtureContactListenerParticle = 16384] = "b2_fixtureContactListenerParticle", t[t.b2_particleContactListenerParticle = 32768] = "b2_particleContactListenerParticle", t[t.b2_fixtureContactFilterParticle = 65536] = "b2_fixtureContactFilterParticle", t[t.b2_particleContactFilterParticle = 131072] = "b2_particleContactFilterParticle"
  56139. })(t.b2ParticleFlag || (t.b2ParticleFlag = {}));
  56140. var yn = (function() {
  56141. return function() {
  56142. this.flags = 0, this.position = new P, this.velocity = new P, this.color = new G(0, 0, 0, 0), this.lifetime = 0, this.userData = null, this.group = null
  56143. }
  56144. })();
  56145. function vn(t, e, i) {
  56146. return b(Math.ceil(Math.sqrt(t / (.01 * e)) * i), 1, 8)
  56147. }
  56148. var gn = (function() {
  56149. function t() {
  56150. this.m_index = u
  56151. }
  56152. return t.prototype.GetIndex = function() {
  56153. return this.m_index
  56154. }, t.prototype.SetIndex = function(t) {
  56155. this.m_index = t
  56156. }, t
  56157. })();
  56158. (function(t) {
  56159. t[t.b2_solidParticleGroup = 1] = "b2_solidParticleGroup", t[t.b2_rigidParticleGroup = 2] = "b2_rigidParticleGroup", t[t.b2_particleGroupCanBeEmpty = 4] = "b2_particleGroupCanBeEmpty", t[t.b2_particleGroupWillBeDestroyed = 8] = "b2_particleGroupWillBeDestroyed", t[t.b2_particleGroupNeedsUpdateDepth = 16] = "b2_particleGroupNeedsUpdateDepth", t[t.b2_particleGroupInternalMask = 24] = "b2_particleGroupInternalMask"
  56160. })(t.b2ParticleGroupFlag || (t.b2ParticleGroupFlag = {}));
  56161. var xn = (function() {
  56162. return function() {
  56163. this.flags = 0, this.groupFlags = 0, this.position = new P, this.angle = 0, this.linearVelocity = new P, this.angularVelocity = 0, this.color = new G, this.strength = 1, this.shapeCount = 0, this.stride = 0, this.particleCount = 0, this.lifetime = 0, this.userData = null, this.group = null
  56164. }
  56165. })(),
  56166. bn = (function() {
  56167. function e(t) {
  56168. this.m_firstIndex = 0, this.m_lastIndex = 0, this.m_groupFlags = 0, this.m_strength = 1, this.m_prev = null, this.m_next = null, this.m_timestamp = -1, this.m_mass = 0, this.m_inertia = 0, this.m_center = new P, this.m_linearVelocity = new P, this.m_angularVelocity = 0, this.m_transform = new V, this.m_userData = null, this.m_system = t
  56169. }
  56170. return e.prototype.GetNext = function() {
  56171. return this.m_next
  56172. }, e.prototype.GetParticleSystem = function() {
  56173. return this.m_system
  56174. }, e.prototype.GetParticleCount = function() {
  56175. return this.m_lastIndex - this.m_firstIndex
  56176. }, e.prototype.GetBufferIndex = function() {
  56177. return this.m_firstIndex
  56178. }, e.prototype.ContainsParticle = function(t) {
  56179. return this.m_firstIndex <= t && t < this.m_lastIndex
  56180. }, e.prototype.GetAllParticleFlags = function() {
  56181. if (!this.m_system.m_flagsBuffer.data) throw new Error;
  56182. for (var t = 0, e = this.m_firstIndex; e < this.m_lastIndex; e++) t |= this.m_system.m_flagsBuffer.data[e];
  56183. return t
  56184. }, e.prototype.GetGroupFlags = function() {
  56185. return this.m_groupFlags
  56186. }, e.prototype.SetGroupFlags = function(e) {
  56187. e |= this.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupInternalMask, this.m_system.SetGroupFlags(this, e)
  56188. }, e.prototype.GetMass = function() {
  56189. return this.UpdateStatistics(), this.m_mass
  56190. }, e.prototype.GetInertia = function() {
  56191. return this.UpdateStatistics(), this.m_inertia
  56192. }, e.prototype.GetCenter = function() {
  56193. return this.UpdateStatistics(), this.m_center
  56194. }, e.prototype.GetLinearVelocity = function() {
  56195. return this.UpdateStatistics(), this.m_linearVelocity
  56196. }, e.prototype.GetAngularVelocity = function() {
  56197. return this.UpdateStatistics(), this.m_angularVelocity
  56198. }, e.prototype.GetTransform = function() {
  56199. return this.m_transform
  56200. }, e.prototype.GetPosition = function() {
  56201. return this.m_transform.p
  56202. }, e.prototype.GetAngle = function() {
  56203. return this.m_transform.q.GetAngle()
  56204. }, e.prototype.GetLinearVelocityFromWorldPoint = function(t, i) {
  56205. var n = e.GetLinearVelocityFromWorldPoint_s_t0;
  56206. return this.UpdateStatistics(), P.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, P.SubVV(t, this.m_center, n), i)
  56207. }, e.prototype.GetUserData = function() {
  56208. return this.m_userData
  56209. }, e.prototype.SetUserData = function(t) {
  56210. this.m_userData = t
  56211. }, e.prototype.ApplyForce = function(t) {
  56212. this.m_system.ApplyForce(this.m_firstIndex, this.m_lastIndex, t)
  56213. }, e.prototype.ApplyLinearImpulse = function(t) {
  56214. this.m_system.ApplyLinearImpulse(this.m_firstIndex, this.m_lastIndex, t)
  56215. }, e.prototype.DestroyParticles = function(t) {
  56216. if (this.m_system.m_world.IsLocked()) throw new Error;
  56217. for (var e = this.m_firstIndex; e < this.m_lastIndex; e++) this.m_system.DestroyParticle(e, t)
  56218. }, e.prototype.UpdateStatistics = function() {
  56219. if (!this.m_system.m_positionBuffer.data) throw new Error;
  56220. if (!this.m_system.m_velocityBuffer.data) throw new Error;
  56221. var t = new P,
  56222. e = new P;
  56223. if (this.m_timestamp !== this.m_system.m_timestamp) {
  56224. var i = this.m_system.GetParticleMass();
  56225. this.m_mass = i * (this.m_lastIndex - this.m_firstIndex), this.m_center.SetZero(), this.m_linearVelocity.SetZero();
  56226. for (var n = this.m_firstIndex; n < this.m_lastIndex; n++) this.m_center.SelfMulAdd(i, this.m_system.m_positionBuffer.data[n]), this.m_linearVelocity.SelfMulAdd(i, this.m_system.m_velocityBuffer.data[n]);
  56227. if (this.m_mass > 0) {
  56228. var r = 1 / this.m_mass;
  56229. this.m_center.SelfMul(r), this.m_linearVelocity.SelfMul(r)
  56230. }
  56231. this.m_inertia = 0, this.m_angularVelocity = 0;
  56232. for (n = this.m_firstIndex; n < this.m_lastIndex; n++) P.SubVV(this.m_system.m_positionBuffer.data[n], this.m_center, t), P.SubVV(this.m_system.m_velocityBuffer.data[n], this.m_linearVelocity, e), this.m_inertia += i * P.DotVV(t, t), this.m_angularVelocity += i * P.CrossVV(t, e);
  56233. this.m_inertia > 0 && (this.m_angularVelocity *= 1 / this.m_inertia), this.m_timestamp = this.m_system.m_timestamp
  56234. }
  56235. }, e.GetLinearVelocityFromWorldPoint_s_t0 = new P, e
  56236. })(),
  56237. An = (function() {
  56238. function t(t) {
  56239. this.m_front = 0, this.m_back = 0, this.m_capacity = 0, this.m_buffer = d(t, (function(t) {
  56240. return null
  56241. })), this.m_capacity = t
  56242. }
  56243. return t.prototype.Push = function(t) {
  56244. if (this.m_back >= this.m_capacity) {
  56245. for (var e = this.m_front; e < this.m_back; e++) this.m_buffer[e - this.m_front] = this.m_buffer[e];
  56246. this.m_back -= this.m_front, this.m_front = 0, this.m_back >= this.m_capacity && (this.m_capacity > 0 ? (this.m_buffer.concat(d(this.m_capacity, (function(t) {
  56247. return null
  56248. }))), this.m_capacity *= 2) : (this.m_buffer.concat(d(1, (function(t) {
  56249. return null
  56250. }))), this.m_capacity = 1))
  56251. }
  56252. this.m_buffer[this.m_back] = t, this.m_back++
  56253. }, t.prototype.Pop = function() {
  56254. this.m_buffer[this.m_front] = null, this.m_front++
  56255. }, t.prototype.Empty = function() {
  56256. return this.m_front === this.m_back
  56257. }, t.prototype.Front = function() {
  56258. var t = this.m_buffer[this.m_front];
  56259. if (!t) throw new Error;
  56260. return t
  56261. }, t
  56262. })(),
  56263. Cn = (function() {
  56264. function t(e) {
  56265. this.m_generatorCapacity = 0, this.m_generatorCount = 0, this.m_countX = 0, this.m_countY = 0, this.m_diagram = [], this.m_generatorBuffer = d(e, (function(e) {
  56266. return new t.Generator
  56267. })), this.m_generatorCapacity = e
  56268. }
  56269. return t.prototype.AddGenerator = function(t, e, i) {
  56270. var n = this.m_generatorBuffer[this.m_generatorCount++];
  56271. n.center.Copy(t), n.tag = e, n.necessary = i
  56272. }, t.prototype.Generate = function(e, n) {
  56273. for (var r = 1 / e, s = new P(+i, +i), o = new P(-i, -i), a = 0, l = 0; l < this.m_generatorCount; l++) {
  56274. (f = this.m_generatorBuffer[l]).necessary && (P.MinV(s, f.center, s), P.MaxV(o, f.center, o), ++a)
  56275. }
  56276. if (0 === a) return this.m_countX = 0, void(this.m_countY = 0);
  56277. s.x -= n, s.y -= n, o.x += n, o.y += n, this.m_countX = 1 + Math.floor(r * (o.x - s.x)), this.m_countY = 1 + Math.floor(r * (o.y - s.y)), this.m_diagram = [];
  56278. var h = new An(4 * this.m_countX * this.m_countY);
  56279. for (l = 0; l < this.m_generatorCount; l++) {
  56280. (f = this.m_generatorBuffer[l]).center.SelfSub(s).SelfMul(r);
  56281. var c = Math.floor(f.center.x),
  56282. u = Math.floor(f.center.y);
  56283. c >= 0 && u >= 0 && c < this.m_countX && u < this.m_countY && h.Push(new t.Task(c, u, c + u * this.m_countX, f))
  56284. }
  56285. for (; !h.Empty();) {
  56286. c = (d = h.Front()).m_x, u = d.m_y;
  56287. var _ = d.m_i,
  56288. f = d.m_generator;
  56289. h.Pop(), this.m_diagram[_] || (this.m_diagram[_] = f, c > 0 && h.Push(new t.Task(c - 1, u, _ - 1, f)), u > 0 && h.Push(new t.Task(c, u - 1, _ - this.m_countX, f)), c < this.m_countX - 1 && h.Push(new t.Task(c + 1, u, _ + 1, f)), u < this.m_countY - 1 && h.Push(new t.Task(c, u + 1, _ + this.m_countX, f)))
  56290. }
  56291. for (u = 0; u < this.m_countY; u++)
  56292. for (c = 0; c < this.m_countX - 1; c++) {
  56293. _ = c + u * this.m_countX;
  56294. (p = this.m_diagram[_]) !== (m = this.m_diagram[_ + 1]) && (h.Push(new t.Task(c, u, _, m)), h.Push(new t.Task(c + 1, u, _ + 1, p)))
  56295. }
  56296. for (u = 0; u < this.m_countY - 1; u++)
  56297. for (c = 0; c < this.m_countX; c++) {
  56298. _ = c + u * this.m_countX;
  56299. (p = this.m_diagram[_]) !== (m = this.m_diagram[_ + this.m_countX]) && (h.Push(new t.Task(c, u, _, m)), h.Push(new t.Task(c, u + 1, _ + this.m_countX, p)))
  56300. }
  56301. for (; !h.Empty();) {
  56302. var d, p, m;
  56303. c = (d = h.Front()).m_x, u = d.m_y, _ = d.m_i, l = d.m_generator;
  56304. if (h.Pop(), (p = this.m_diagram[_]) !== (m = l)) {
  56305. var y = p.center.x - c,
  56306. v = p.center.y - u,
  56307. g = m.center.x - c,
  56308. x = m.center.y - u;
  56309. y * y + v * v > g * g + x * x && (this.m_diagram[_] = m, c > 0 && h.Push(new t.Task(c - 1, u, _ - 1, m)), u > 0 && h.Push(new t.Task(c, u - 1, _ - this.m_countX, m)), c < this.m_countX - 1 && h.Push(new t.Task(c + 1, u, _ + 1, m)), u < this.m_countY - 1 && h.Push(new t.Task(c, u + 1, _ + this.m_countX, m)))
  56310. }
  56311. }
  56312. }, t.prototype.GetNodes = function(t) {
  56313. for (var e = 0; e < this.m_countY - 1; e++)
  56314. for (var i = 0; i < this.m_countX - 1; i++) {
  56315. var n = i + e * this.m_countX,
  56316. r = this.m_diagram[n],
  56317. s = this.m_diagram[n + 1],
  56318. o = this.m_diagram[n + this.m_countX],
  56319. a = this.m_diagram[n + 1 + this.m_countX];
  56320. s !== o && (r !== s && r !== o && (r.necessary || s.necessary || o.necessary) && t(r.tag, s.tag, o.tag), a !== s && a !== o && (r.necessary || s.necessary || o.necessary) && t(s.tag, a.tag, o.tag))
  56321. }
  56322. }, t
  56323. })();
  56324. function Tn(t, e, i) {
  56325. var n = t[e];
  56326. t[e] = t[i], t[i] = n
  56327. }
  56328. function Sn(t, e) {
  56329. return t < e
  56330. }
  56331. function wn(t, e, i, n) {
  56332. void 0 === e && (e = 0), void 0 === i && (i = t.length - e), void 0 === n && (n = Sn);
  56333. for (var r = e, s = [], o = 0;;) {
  56334. for (; r + 1 < i; i++) {
  56335. var a = t[r + Math.floor(Math.random() * (i - r))];
  56336. s[o++] = i;
  56337. for (var l = r - 1;;) {
  56338. for (; n(t[++l], a););
  56339. for (; n(a, t[--i]););
  56340. if (l >= i) break;
  56341. Tn(t, l, i)
  56342. }
  56343. }
  56344. if (0 === o) break;
  56345. r = i, i = s[--o]
  56346. }
  56347. return t
  56348. }
  56349. function En(t, e, i, n) {
  56350. return void 0 === e && (e = 0), void 0 === i && (i = t.length - e), void 0 === n && (n = Sn), wn(t, e, i, n)
  56351. }
  56352. function Mn(t, e, i) {
  56353. void 0 === i && (i = t.length);
  56354. for (var n = 0, r = 0; r < i; ++r) e(t[r]) || (r !== n ? Tn(t, n++, r) : ++n);
  56355. return n
  56356. }
  56357. function Dn(t, e, i, n, r) {
  56358. void 0 === r && (r = Sn);
  56359. for (var s = i - e; s > 0;) {
  56360. var o = Math.floor(s / 2),
  56361. a = e + o;
  56362. r(t[a], n) ? (e = ++a, s -= o + 1) : s = o
  56363. }
  56364. return e
  56365. }
  56366. function Bn(t, e, i, n, r) {
  56367. void 0 === r && (r = Sn);
  56368. for (var s = i - e; s > 0;) {
  56369. var o = Math.floor(s / 2),
  56370. a = e + o;
  56371. r(n, t[a]) ? s = o : (e = ++a, s -= o + 1)
  56372. }
  56373. return e
  56374. }
  56375. function In(t, e, i, n) {
  56376. for (var r = i; e !== r;) Tn(t, e++, r++), r === n ? r = i : e === i && (i = r)
  56377. }
  56378. function Pn(t, e, i, n) {
  56379. if (e === i) return i;
  56380. for (var r = e; ++e !== i;) n(t[r], t[e]) || Tn(t, ++r, e);
  56381. return ++r
  56382. }(function(t) {
  56383. var e = (function() {
  56384. return function() {
  56385. this.center = new P, this.tag = 0, this.necessary = !1
  56386. }
  56387. })();
  56388. t.Generator = e;
  56389. var i = (function() {
  56390. return function(t, e, i, n) {
  56391. this.m_x = t, this.m_y = e, this.m_i = i, this.m_generator = n
  56392. }
  56393. })();
  56394. t.Task = i
  56395. })(Cn || (Cn = {}));
  56396. var Rn = (function() {
  56397. function t(t) {
  56398. this.data = [], this.count = 0, this.capacity = 0, this.allocator = t
  56399. }
  56400. return t.prototype.Append = function() {
  56401. return this.count >= this.capacity && this.Grow(), this.count++
  56402. }, t.prototype.Reserve = function(t) {
  56403. if (!(this.capacity >= t)) {
  56404. for (var e = this.capacity; e < t; ++e) this.data[e] = this.allocator();
  56405. this.capacity = t
  56406. }
  56407. }, t.prototype.Grow = function() {
  56408. var t = this.capacity ? 2 * this.capacity : 256;
  56409. this.Reserve(t)
  56410. }, t.prototype.Free = function() {
  56411. 0 !== this.data.length && (this.data = [], this.capacity = 0, this.count = 0)
  56412. }, t.prototype.Shorten = function(t) {}, t.prototype.Data = function() {
  56413. return this.data
  56414. }, t.prototype.GetCount = function() {
  56415. return this.count
  56416. }, t.prototype.SetCount = function(t) {
  56417. this.count = t
  56418. }, t.prototype.GetCapacity = function() {
  56419. return this.capacity
  56420. }, t.prototype.RemoveIf = function(t) {
  56421. this.count = Mn(this.data, t, this.count)
  56422. }, t.prototype.Unique = function(t) {
  56423. this.count = Pn(this.data, 0, this.count, t)
  56424. }, t
  56425. })(),
  56426. On = (function(t) {
  56427. function e(e) {
  56428. var i = t.call(this) || this;
  56429. return i.m_system = e, i
  56430. }
  56431. return $e(e, t), e.prototype.ShouldQueryParticleSystem = function(t) {
  56432. return !1
  56433. }, e.prototype.ReportFixture = function(t) {
  56434. if (t.IsSensor()) return !0;
  56435. for (var e = t.GetShape().GetChildCount(), i = 0; i < e; i++)
  56436. for (var n = t.GetAABB(i), r = this.m_system.GetInsideBoundsEnumerator(n), s = void 0;
  56437. (s = r.GetNext()) >= 0;) this.ReportFixtureAndParticle(t, i, s);
  56438. return !0
  56439. }, e.prototype.ReportParticle = function(t, e) {
  56440. return !1
  56441. }, e.prototype.ReportFixtureAndParticle = function(t, e, i) {}, e
  56442. })(en),
  56443. Ln = (function() {
  56444. function t() {
  56445. this.indexA = 0, this.indexB = 0, this.weight = 0, this.normal = new P, this.flags = 0
  56446. }
  56447. return t.prototype.SetIndices = function(t, e) {
  56448. this.indexA = t, this.indexB = e
  56449. }, t.prototype.SetWeight = function(t) {
  56450. this.weight = t
  56451. }, t.prototype.SetNormal = function(t) {
  56452. this.normal.Copy(t)
  56453. }, t.prototype.SetFlags = function(t) {
  56454. this.flags = t
  56455. }, t.prototype.GetIndexA = function() {
  56456. return this.indexA
  56457. }, t.prototype.GetIndexB = function() {
  56458. return this.indexB
  56459. }, t.prototype.GetWeight = function() {
  56460. return this.weight
  56461. }, t.prototype.GetNormal = function() {
  56462. return this.normal
  56463. }, t.prototype.GetFlags = function() {
  56464. return this.flags
  56465. }, t.prototype.IsEqual = function(t) {
  56466. return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && this.weight === t.weight && this.normal.x === t.normal.x && this.normal.y === t.normal.y
  56467. }, t.prototype.IsNotEqual = function(t) {
  56468. return !this.IsEqual(t)
  56469. }, t.prototype.ApproximatelyEqual = function(t) {
  56470. return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && v(this.weight - t.weight) < .01 && P.DistanceSquaredVV(this.normal, t.normal) < 1e-4
  56471. }, t
  56472. })(),
  56473. Fn = (function() {
  56474. return function() {
  56475. this.index = 0, this.weight = 0, this.normal = new P, this.mass = 0
  56476. }
  56477. })(),
  56478. Nn = (function() {
  56479. return function() {
  56480. this.indexA = 0, this.indexB = 0, this.flags = 0, this.strength = 0, this.distance = 0
  56481. }
  56482. })(),
  56483. Vn = (function() {
  56484. return function() {
  56485. this.indexA = 0, this.indexB = 0, this.indexC = 0, this.flags = 0, this.strength = 0, this.pa = new P(0, 0), this.pb = new P(0, 0), this.pc = new P(0, 0), this.ka = 0, this.kb = 0, this.kc = 0, this.s = 0
  56486. }
  56487. })(),
  56488. kn = (function() {
  56489. function t() {
  56490. this.strictContactCheck = !1, this.density = 1, this.gravityScale = 1, this.radius = 1, this.maxCount = 0, this.pressureStrength = .005, this.dampingStrength = 1, this.elasticStrength = .25, this.springStrength = .25, this.viscousStrength = .25, this.surfaceTensionPressureStrength = .2, this.surfaceTensionNormalStrength = .2, this.repulsiveStrength = 1, this.powderStrength = .5, this.ejectionStrength = .5, this.staticPressureStrength = .2, this.staticPressureRelaxation = .2, this.staticPressureIterations = 8, this.colorMixingStrength = .5, this.destroyByAge = !0, this.lifetimeGranularity = 1 / 60
  56491. }
  56492. return t.prototype.Copy = function(t) {
  56493. return this.strictContactCheck = t.strictContactCheck, this.density = t.density, this.gravityScale = t.gravityScale, this.radius = t.radius, this.maxCount = t.maxCount, this.pressureStrength = t.pressureStrength, this.dampingStrength = t.dampingStrength, this.elasticStrength = t.elasticStrength, this.springStrength = t.springStrength, this.viscousStrength = t.viscousStrength, this.surfaceTensionPressureStrength = t.surfaceTensionPressureStrength, this.surfaceTensionNormalStrength = t.surfaceTensionNormalStrength, this.repulsiveStrength = t.repulsiveStrength, this.powderStrength = t.powderStrength, this.ejectionStrength = t.ejectionStrength, this.staticPressureStrength = t.staticPressureStrength, this.staticPressureRelaxation = t.staticPressureRelaxation, this.staticPressureIterations = t.staticPressureIterations, this.colorMixingStrength = t.colorMixingStrength, this.destroyByAge = t.destroyByAge, this.lifetimeGranularity = t.lifetimeGranularity, this
  56494. }, t.prototype.Clone = function() {
  56495. return (new t).Copy(this)
  56496. }, t
  56497. })();
  56498. t.b2ParticleSystem = (function() {
  56499. function n(t, e) {
  56500. this.m_paused = !1, this.m_timestamp = 0, this.m_allParticleFlags = 0, this.m_needsUpdateAllParticleFlags = !1, this.m_allGroupFlags = 0, this.m_needsUpdateAllGroupFlags = !1, this.m_hasForce = !1, this.m_iterationIndex = 0, this.m_inverseDensity = 0, this.m_particleDiameter = 0, this.m_inverseDiameter = 0, this.m_squaredDiameter = 0, this.m_count = 0, this.m_internalAllocatedCapacity = 0, this.m_handleIndexBuffer = new n.UserOverridableBuffer, this.m_flagsBuffer = new n.UserOverridableBuffer, this.m_positionBuffer = new n.UserOverridableBuffer, this.m_velocityBuffer = new n.UserOverridableBuffer, this.m_forceBuffer = [], this.m_weightBuffer = [], this.m_staticPressureBuffer = [], this.m_accumulationBuffer = [], this.m_accumulation2Buffer = [], this.m_depthBuffer = [], this.m_colorBuffer = new n.UserOverridableBuffer, this.m_groupBuffer = [], this.m_userDataBuffer = new n.UserOverridableBuffer, this.m_stuckThreshold = 0, this.m_lastBodyContactStepBuffer = new n.UserOverridableBuffer, this.m_bodyContactCountBuffer = new n.UserOverridableBuffer, this.m_consecutiveContactStepsBuffer = new n.UserOverridableBuffer, this.m_stuckParticleBuffer = new Rn(function() {
  56501. return 0
  56502. }), this.m_proxyBuffer = new Rn(function() {
  56503. return new n.Proxy
  56504. }), this.m_contactBuffer = new Rn(function() {
  56505. return new Ln
  56506. }), this.m_bodyContactBuffer = new Rn(function() {
  56507. return new Fn
  56508. }), this.m_pairBuffer = new Rn(function() {
  56509. return new Nn
  56510. }), this.m_triadBuffer = new Rn(function() {
  56511. return new Vn
  56512. }), this.m_expirationTimeBuffer = new n.UserOverridableBuffer, this.m_indexByExpirationTimeBuffer = new n.UserOverridableBuffer, this.m_timeElapsed = 0, this.m_expirationTimeBufferRequiresSorting = !1, this.m_groupCount = 0, this.m_groupList = null, this.m_def = new kn, this.m_prev = null, this.m_next = null, this.SetStrictContactCheck(t.strictContactCheck), this.SetDensity(t.density), this.SetGravityScale(t.gravityScale), this.SetRadius(t.radius), this.SetMaxParticleCount(t.maxCount), this.m_def = t.Clone(), this.m_world = e, this.SetDestructionByAge(this.m_def.destroyByAge)
  56513. }
  56514. return n.computeTag = function(t, e) {
  56515. return (e + n.yOffset >>> 0 << n.yShift) + (n.xScale * t + n.xOffset >>> 0) >>> 0
  56516. }, n.computeRelativeTag = function(t, e, i) {
  56517. return t + (i << n.yShift) + (e << n.xShift) >>> 0
  56518. }, n.prototype.Drop = function() {
  56519. for (; this.m_groupList;) this.DestroyParticleGroup(this.m_groupList);
  56520. this.FreeUserOverridableBuffer(this.m_handleIndexBuffer), this.FreeUserOverridableBuffer(this.m_flagsBuffer), this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer), this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer), this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer), this.FreeUserOverridableBuffer(this.m_positionBuffer), this.FreeUserOverridableBuffer(this.m_velocityBuffer), this.FreeUserOverridableBuffer(this.m_colorBuffer), this.FreeUserOverridableBuffer(this.m_userDataBuffer), this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer), this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer), this.FreeBuffer(this.m_forceBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_weightBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_staticPressureBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_accumulationBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_accumulation2Buffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_depthBuffer, this.m_internalAllocatedCapacity), this.FreeBuffer(this.m_groupBuffer, this.m_internalAllocatedCapacity)
  56521. }, n.prototype.CreateParticle = function(t) {
  56522. if (this.m_world.IsLocked()) throw new Error;
  56523. if (this.m_count >= this.m_internalAllocatedCapacity) {
  56524. var i = this.m_count ? 2 * this.m_count : 256;
  56525. this.ReallocateInternalAllocatedBuffers(i)
  56526. }
  56527. if (this.m_count >= this.m_internalAllocatedCapacity) {
  56528. if (!this.m_def.destroyByAge) return u;
  56529. this.DestroyOldestParticle(0, !1), this.SolveZombie()
  56530. }
  56531. var n = this.m_count++;
  56532. if (!this.m_flagsBuffer.data) throw new Error;
  56533. if (this.m_flagsBuffer.data[n] = 0, this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = 0), this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = 0), this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = 0), !this.m_positionBuffer.data) throw new Error;
  56534. if (!this.m_velocityBuffer.data) throw new Error;
  56535. this.m_positionBuffer.data[n] = (this.m_positionBuffer.data[n] || new P).Copy(e(t.position, P.ZERO)), this.m_velocityBuffer.data[n] = (this.m_velocityBuffer.data[n] || new P).Copy(e(t.velocity, P.ZERO)), this.m_weightBuffer[n] = 0, this.m_forceBuffer[n] = (this.m_forceBuffer[n] || new P).SetZero(), this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = 0), this.m_depthBuffer && (this.m_depthBuffer[n] = 0);
  56536. var r = (new G).Copy(e(t.color, G.ZERO));
  56537. !this.m_colorBuffer.data && r.IsZero() || (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data), this.m_colorBuffer.data[n] = (this.m_colorBuffer.data[n] || new G).Copy(r)), (this.m_userDataBuffer.data || t.userData) && (this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data), this.m_userDataBuffer.data[n] = t.userData), this.m_handleIndexBuffer.data && (this.m_handleIndexBuffer.data[n] = null);
  56538. var s = this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],
  56539. o = e(t.lifetime, 0),
  56540. a = o > 0;
  56541. if (this.m_expirationTimeBuffer.data || a) {
  56542. if (this.SetParticleLifetime(n, a ? o : this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())), !this.m_indexByExpirationTimeBuffer.data) throw new Error;
  56543. this.m_indexByExpirationTimeBuffer.data[n] = n
  56544. }
  56545. s.index = n;
  56546. var l = e(t.group, null);
  56547. return this.m_groupBuffer[n] = l, l && (l.m_firstIndex < l.m_lastIndex ? (this.RotateBuffer(l.m_firstIndex, l.m_lastIndex, n), l.m_lastIndex = n + 1) : (l.m_firstIndex = n, l.m_lastIndex = n + 1)), this.SetParticleFlags(n, e(t.flags, 0)), n
  56548. }, n.prototype.GetParticleHandleFromIndex = function(t) {
  56549. this.m_handleIndexBuffer.data = this.RequestBuffer(this.m_handleIndexBuffer.data);
  56550. var e = this.m_handleIndexBuffer.data[t];
  56551. return e || ((e = new gn).SetIndex(t), this.m_handleIndexBuffer.data[t] = e, e)
  56552. }, n.prototype.DestroyParticle = function(e, i) {
  56553. if (void 0 === i && (i = !1), !this.m_flagsBuffer.data) throw new Error;
  56554. var n = t.b2ParticleFlag.b2_zombieParticle;
  56555. i && (n |= t.b2ParticleFlag.b2_destructionListenerParticle), this.SetParticleFlags(e, this.m_flagsBuffer.data[e] | n)
  56556. }, n.prototype.DestroyOldestParticle = function(t, e) {
  56557. void 0 === e && (e = !1);
  56558. var i = this.GetParticleCount();
  56559. if (!this.m_indexByExpirationTimeBuffer.data) throw new Error;
  56560. if (!this.m_expirationTimeBuffer.data) throw new Error;
  56561. var n = this.m_indexByExpirationTimeBuffer.data[i - (t + 1)],
  56562. r = this.m_indexByExpirationTimeBuffer.data[t];
  56563. this.DestroyParticle(this.m_expirationTimeBuffer.data[n] > 0 ? n : r, e)
  56564. }, n.prototype.DestroyParticlesInShape = function(t, e, i) {
  56565. void 0 === i && (i = !1);
  56566. var r = n.DestroyParticlesInShape_s_aabb;
  56567. if (this.m_world.IsLocked()) throw new Error;
  56568. var s = new n.DestroyParticlesInShapeCallback(this, t, e, i),
  56569. o = r;
  56570. return t.ComputeAABB(o, e, 0), this.m_world.QueryAABB(s, o), s.Destroyed()
  56571. }, n.prototype.CreateParticleGroup = function(t) {
  56572. var i = n.CreateParticleGroup_s_transform;
  56573. if (this.m_world.IsLocked()) throw new Error;
  56574. var r = i;
  56575. r.SetPositionAngle(e(t.position, P.ZERO), e(t.angle, 0));
  56576. var s = this.m_count;
  56577. if (t.shape && this.CreateParticlesWithShapeForGroup(t.shape, t, r), t.shapes && this.CreateParticlesWithShapesForGroup(t.shapes, e(t.shapeCount, t.shapes.length), t, r), t.positionData)
  56578. for (var o = e(t.particleCount, t.positionData.length), a = 0; a < o; a++) {
  56579. var l = t.positionData[a];
  56580. this.CreateParticleForGroup(t, r, l)
  56581. }
  56582. var h = this.m_count,
  56583. c = new bn(this);
  56584. c.m_firstIndex = s, c.m_lastIndex = h, c.m_strength = e(t.strength, 1), c.m_userData = t.userData, c.m_transform.Copy(r), c.m_prev = null, c.m_next = this.m_groupList, this.m_groupList && (this.m_groupList.m_prev = c), this.m_groupList = c, ++this.m_groupCount;
  56585. for (a = s; a < h; a++) this.m_groupBuffer[a] = c;
  56586. this.SetGroupFlags(c, e(t.groupFlags, 0));
  56587. var u = new n.ConnectionFilter;
  56588. return this.UpdateContacts(!0), this.UpdatePairsAndTriads(s, h, u), t.group && (this.JoinParticleGroups(t.group, c), c = t.group), c
  56589. }, n.prototype.JoinParticleGroups = function(t, e) {
  56590. if (this.m_world.IsLocked()) throw new Error;
  56591. this.RotateBuffer(e.m_firstIndex, e.m_lastIndex, this.m_count), this.RotateBuffer(t.m_firstIndex, t.m_lastIndex, e.m_firstIndex);
  56592. var i = new n.JoinParticleGroupsFilter(e.m_firstIndex);
  56593. this.UpdateContacts(!0), this.UpdatePairsAndTriads(t.m_firstIndex, e.m_lastIndex, i);
  56594. for (var r = e.m_firstIndex; r < e.m_lastIndex; r++) this.m_groupBuffer[r] = t;
  56595. var s = t.m_groupFlags | e.m_groupFlags;
  56596. this.SetGroupFlags(t, s), t.m_lastIndex = e.m_lastIndex, e.m_firstIndex = e.m_lastIndex, this.DestroyParticleGroup(e)
  56597. }, n.prototype.SplitParticleGroup = function(t) {
  56598. this.UpdateContacts(!0);
  56599. var e = d(t.GetParticleCount(), (function(t) {
  56600. return new n.ParticleListNode
  56601. }));
  56602. n.InitializeParticleLists(t, e), this.MergeParticleListsInContact(t, e);
  56603. var i = n.FindLongestParticleList(t, e);
  56604. this.MergeZombieParticleListNodes(t, e, i), this.CreateParticleGroupsFromParticleList(t, e, i), this.UpdatePairsAndTriadsWithParticleList(t, e)
  56605. }, n.prototype.GetParticleGroupList = function() {
  56606. return this.m_groupList
  56607. }, n.prototype.GetParticleGroupCount = function() {
  56608. return this.m_groupCount
  56609. }, n.prototype.GetParticleCount = function() {
  56610. return this.m_count
  56611. }, n.prototype.GetMaxParticleCount = function() {
  56612. return this.m_def.maxCount
  56613. }, n.prototype.SetMaxParticleCount = function(t) {
  56614. this.m_def.maxCount = t
  56615. }, n.prototype.GetAllParticleFlags = function() {
  56616. return this.m_allParticleFlags
  56617. }, n.prototype.GetAllGroupFlags = function() {
  56618. return this.m_allGroupFlags
  56619. }, n.prototype.SetPaused = function(t) {
  56620. this.m_paused = t
  56621. }, n.prototype.GetPaused = function() {
  56622. return this.m_paused
  56623. }, n.prototype.SetDensity = function(t) {
  56624. this.m_def.density = t, this.m_inverseDensity = 1 / this.m_def.density
  56625. }, n.prototype.GetDensity = function() {
  56626. return this.m_def.density
  56627. }, n.prototype.SetGravityScale = function(t) {
  56628. this.m_def.gravityScale = t
  56629. }, n.prototype.GetGravityScale = function() {
  56630. return this.m_def.gravityScale
  56631. }, n.prototype.SetDamping = function(t) {
  56632. this.m_def.dampingStrength = t
  56633. }, n.prototype.GetDamping = function() {
  56634. return this.m_def.dampingStrength
  56635. }, n.prototype.SetStaticPressureIterations = function(t) {
  56636. this.m_def.staticPressureIterations = t
  56637. }, n.prototype.GetStaticPressureIterations = function() {
  56638. return this.m_def.staticPressureIterations
  56639. }, n.prototype.SetRadius = function(t) {
  56640. this.m_particleDiameter = 2 * t, this.m_squaredDiameter = this.m_particleDiameter * this.m_particleDiameter, this.m_inverseDiameter = 1 / this.m_particleDiameter
  56641. }, n.prototype.GetRadius = function() {
  56642. return this.m_particleDiameter / 2
  56643. }, n.prototype.GetPositionBuffer = function() {
  56644. if (!this.m_positionBuffer.data) throw new Error;
  56645. return this.m_positionBuffer.data
  56646. }, n.prototype.GetVelocityBuffer = function() {
  56647. if (!this.m_velocityBuffer.data) throw new Error;
  56648. return this.m_velocityBuffer.data
  56649. }, n.prototype.GetColorBuffer = function() {
  56650. return this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data), this.m_colorBuffer.data
  56651. }, n.prototype.GetGroupBuffer = function() {
  56652. return this.m_groupBuffer
  56653. }, n.prototype.GetWeightBuffer = function() {
  56654. return this.m_weightBuffer
  56655. }, n.prototype.GetUserDataBuffer = function() {
  56656. return this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data), this.m_userDataBuffer.data
  56657. }, n.prototype.GetFlagsBuffer = function() {
  56658. if (!this.m_flagsBuffer.data) throw new Error;
  56659. return this.m_flagsBuffer.data
  56660. }, n.prototype.SetParticleFlags = function(e, i) {
  56661. if (!this.m_flagsBuffer.data) throw new Error;
  56662. this.m_flagsBuffer.data[e] & ~i && (this.m_needsUpdateAllParticleFlags = !0), ~this.m_allParticleFlags & i && (i & t.b2ParticleFlag.b2_tensileParticle && (this.m_accumulation2Buffer = this.RequestBuffer(this.m_accumulation2Buffer)), i & t.b2ParticleFlag.b2_colorMixingParticle && (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data)), this.m_allParticleFlags |= i), this.m_flagsBuffer.data[e] = i
  56663. }, n.prototype.GetParticleFlags = function(t) {
  56664. if (!this.m_flagsBuffer.data) throw new Error;
  56665. return this.m_flagsBuffer.data[t]
  56666. }, n.prototype.SetFlagsBuffer = function(t, e) {
  56667. this.SetUserOverridableBuffer(this.m_flagsBuffer, t, e)
  56668. }, n.prototype.SetPositionBuffer = function(t, e) {
  56669. this.SetUserOverridableBuffer(this.m_positionBuffer, t, e)
  56670. }, n.prototype.SetVelocityBuffer = function(t, e) {
  56671. this.SetUserOverridableBuffer(this.m_velocityBuffer, t, e)
  56672. }, n.prototype.SetColorBuffer = function(t, e) {
  56673. this.SetUserOverridableBuffer(this.m_colorBuffer, t, e)
  56674. }, n.prototype.SetUserDataBuffer = function(t, e) {
  56675. this.SetUserOverridableBuffer(this.m_userDataBuffer, t, e)
  56676. }, n.prototype.GetContacts = function() {
  56677. return this.m_contactBuffer.data
  56678. }, n.prototype.GetContactCount = function() {
  56679. return this.m_contactBuffer.count
  56680. }, n.prototype.GetBodyContacts = function() {
  56681. return this.m_bodyContactBuffer.data
  56682. }, n.prototype.GetBodyContactCount = function() {
  56683. return this.m_bodyContactBuffer.count
  56684. }, n.prototype.GetPairs = function() {
  56685. return this.m_pairBuffer.data
  56686. }, n.prototype.GetPairCount = function() {
  56687. return this.m_pairBuffer.count
  56688. }, n.prototype.GetTriads = function() {
  56689. return this.m_triadBuffer.data
  56690. }, n.prototype.GetTriadCount = function() {
  56691. return this.m_triadBuffer.count
  56692. }, n.prototype.SetStuckThreshold = function(t) {
  56693. this.m_stuckThreshold = t, t > 0 && (this.m_lastBodyContactStepBuffer.data = this.RequestBuffer(this.m_lastBodyContactStepBuffer.data), this.m_bodyContactCountBuffer.data = this.RequestBuffer(this.m_bodyContactCountBuffer.data), this.m_consecutiveContactStepsBuffer.data = this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))
  56694. }, n.prototype.GetStuckCandidates = function() {
  56695. return this.m_stuckParticleBuffer.Data()
  56696. }, n.prototype.GetStuckCandidateCount = function() {
  56697. return this.m_stuckParticleBuffer.GetCount()
  56698. }, n.prototype.ComputeCollisionEnergy = function() {
  56699. if (!this.m_velocityBuffer.data) throw new Error;
  56700. for (var t = n.ComputeCollisionEnergy_s_v, e = this.m_velocityBuffer.data, i = 0, r = 0; r < this.m_contactBuffer.count; r++) {
  56701. var s = this.m_contactBuffer.data[r],
  56702. o = s.indexA,
  56703. a = s.indexB,
  56704. l = s.normal,
  56705. h = P.SubVV(e[a], e[o], t),
  56706. c = P.DotVV(h, l);
  56707. c < 0 && (i += c * c)
  56708. }
  56709. return .5 * this.GetParticleMass() * i
  56710. }, n.prototype.SetStrictContactCheck = function(t) {
  56711. this.m_def.strictContactCheck = t
  56712. }, n.prototype.GetStrictContactCheck = function() {
  56713. return this.m_def.strictContactCheck
  56714. }, n.prototype.SetParticleLifetime = function(t, e) {
  56715. var i = null === this.m_indexByExpirationTimeBuffer.data;
  56716. if (this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data), this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data), i)
  56717. for (var n = this.GetParticleCount(), r = 0; r < n; ++r) this.m_indexByExpirationTimeBuffer.data[r] = r;
  56718. var s = e / this.m_def.lifetimeGranularity,
  56719. o = s > 0 ? this.GetQuantizedTimeElapsed() + s : s;
  56720. o !== this.m_expirationTimeBuffer.data[t] && (this.m_expirationTimeBuffer.data[t] = o, this.m_expirationTimeBufferRequiresSorting = !0)
  56721. }, n.prototype.GetParticleLifetime = function(t) {
  56722. return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])
  56723. }, n.prototype.SetDestructionByAge = function(t) {
  56724. t && this.GetExpirationTimeBuffer(), this.m_def.destroyByAge = t
  56725. }, n.prototype.GetDestructionByAge = function() {
  56726. return this.m_def.destroyByAge
  56727. }, n.prototype.GetExpirationTimeBuffer = function() {
  56728. return this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data), this.m_expirationTimeBuffer.data
  56729. }, n.prototype.ExpirationTimeToLifetime = function(t) {
  56730. return (t > 0 ? t - this.GetQuantizedTimeElapsed() : t) * this.m_def.lifetimeGranularity
  56731. }, n.prototype.GetIndexByExpirationTimeBuffer = function() {
  56732. if (this.GetParticleCount() ? this.SetParticleLifetime(0, this.GetParticleLifetime(0)) : this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data), !this.m_indexByExpirationTimeBuffer.data) throw new Error;
  56733. return this.m_indexByExpirationTimeBuffer.data
  56734. }, n.prototype.ParticleApplyLinearImpulse = function(t, e) {
  56735. this.ApplyLinearImpulse(t, t + 1, e)
  56736. }, n.prototype.ApplyLinearImpulse = function(t, e, i) {
  56737. if (!this.m_velocityBuffer.data) throw new Error;
  56738. for (var n = this.m_velocityBuffer.data, r = (e - t) * this.GetParticleMass(), s = (new P).Copy(i).SelfMul(1 / r), o = t; o < e; o++) n[o].SelfAdd(s)
  56739. }, n.IsSignificantForce = function(t) {
  56740. return 0 !== t.x || 0 !== t.y
  56741. }, n.prototype.ParticleApplyForce = function(t, e) {
  56742. if (!this.m_flagsBuffer.data) throw new Error;
  56743. n.IsSignificantForce(e) && this.ForceCanBeApplied(this.m_flagsBuffer.data[t]) && (this.PrepareForceBuffer(), this.m_forceBuffer[t].SelfAdd(e))
  56744. }, n.prototype.ApplyForce = function(t, e, i) {
  56745. var r = (new P).Copy(i).SelfMul(1 / (e - t));
  56746. if (n.IsSignificantForce(r)) {
  56747. this.PrepareForceBuffer();
  56748. for (var s = t; s < e; s++) this.m_forceBuffer[s].SelfAdd(r)
  56749. }
  56750. }, n.prototype.GetNext = function() {
  56751. return this.m_next
  56752. }, n.prototype.QueryAABB = function(t, e) {
  56753. if (0 !== this.m_proxyBuffer.count) {
  56754. var i = this.m_proxyBuffer.count,
  56755. r = Dn(this.m_proxyBuffer.data, 0, i, n.computeTag(this.m_inverseDiameter * e.lowerBound.x, this.m_inverseDiameter * e.lowerBound.y), n.Proxy.CompareProxyTag),
  56756. s = Bn(this.m_proxyBuffer.data, r, i, n.computeTag(this.m_inverseDiameter * e.upperBound.x, this.m_inverseDiameter * e.upperBound.y), n.Proxy.CompareTagProxy);
  56757. if (!this.m_positionBuffer.data) throw new Error;
  56758. for (var o = this.m_positionBuffer.data, a = r; a < s; ++a) {
  56759. var l = this.m_proxyBuffer.data[a].index,
  56760. h = o[l];
  56761. if (e.lowerBound.x < h.x && h.x < e.upperBound.x && e.lowerBound.y < h.y && h.y < e.upperBound.y && !t.ReportParticle(this, l)) break
  56762. }
  56763. }
  56764. }, n.prototype.QueryShapeAABB = function(t, e, i, r) {
  56765. void 0 === r && (r = 0);
  56766. var s = n.QueryShapeAABB_s_aabb;
  56767. e.ComputeAABB(s, i, r), this.QueryAABB(t, s)
  56768. }, n.prototype.QueryPointAABB = function(t, e, i) {
  56769. void 0 === i && (i = l);
  56770. var r = n.QueryPointAABB_s_aabb;
  56771. r.lowerBound.Set(e.x - i, e.y - i), r.upperBound.Set(e.x + i, e.y + i), this.QueryAABB(t, r)
  56772. }, n.prototype.RayCast = function(t, e, i) {
  56773. var r = n.RayCast_s_aabb,
  56774. s = n.RayCast_s_p,
  56775. o = n.RayCast_s_v,
  56776. a = n.RayCast_s_n,
  56777. l = n.RayCast_s_point;
  56778. if (0 !== this.m_proxyBuffer.count) {
  56779. if (!this.m_positionBuffer.data) throw new Error;
  56780. var h = this.m_positionBuffer.data,
  56781. c = r;
  56782. P.MinV(e, i, c.lowerBound), P.MaxV(e, i, c.upperBound);
  56783. for (var u, _ = 1, f = P.SubVV(i, e, o), d = P.DotVV(f, f), p = this.GetInsideBoundsEnumerator(c);
  56784. (u = p.GetNext()) >= 0;) {
  56785. var m = P.SubVV(e, h[u], s),
  56786. y = P.DotVV(m, f),
  56787. v = y * y - d * (P.DotVV(m, m) - this.m_squaredDiameter);
  56788. if (v >= 0) {
  56789. var x = S(v),
  56790. b = (-y - x) / d;
  56791. if (b > _) continue;
  56792. if (b < 0 && ((b = (-y + x) / d) < 0 || b > _)) continue;
  56793. var A = P.AddVMulSV(m, b, f, a);
  56794. A.Normalize();
  56795. var C = t.ReportParticle(this, u, P.AddVMulSV(e, b, f, l), A, b);
  56796. if ((_ = g(_, C)) <= 0) break
  56797. }
  56798. }
  56799. }
  56800. }, n.prototype.ComputeAABB = function(t) {
  56801. var e = this.GetParticleCount();
  56802. if (t.lowerBound.x = +i, t.lowerBound.y = +i, t.upperBound.x = -i, t.upperBound.y = -i, !this.m_positionBuffer.data) throw new Error;
  56803. for (var n = this.m_positionBuffer.data, r = 0; r < e; r++) {
  56804. var s = n[r];
  56805. P.MinV(t.lowerBound, s, t.lowerBound), P.MaxV(t.upperBound, s, t.upperBound)
  56806. }
  56807. t.lowerBound.x -= this.m_particleDiameter, t.lowerBound.y -= this.m_particleDiameter, t.upperBound.x += this.m_particleDiameter, t.upperBound.y += this.m_particleDiameter
  56808. }, n.prototype.FreeBuffer = function(t, e) {
  56809. null !== t && (t.length = 0)
  56810. }, n.prototype.FreeUserOverridableBuffer = function(t) {
  56811. 0 === t.userSuppliedCapacity && this.FreeBuffer(t.data, this.m_internalAllocatedCapacity)
  56812. }, n.prototype.ReallocateBuffer3 = function(t, e, i) {
  56813. if (i <= e) throw new Error;
  56814. var n = t ? t.slice() : [];
  56815. return n.length = i, n
  56816. }, n.prototype.ReallocateBuffer5 = function(t, e, i, n, r) {
  56817. if (n <= i) throw new Error;
  56818. if (e && !(n <= e)) throw new Error;
  56819. return r && !t || e || (t = this.ReallocateBuffer3(t, i, n)), t
  56820. }, n.prototype.ReallocateBuffer4 = function(t, e, i, n) {
  56821. return this.ReallocateBuffer5(t.data, t.userSuppliedCapacity, e, i, n)
  56822. }, n.prototype.RequestBuffer = function(t) {
  56823. return t || (0 === this.m_internalAllocatedCapacity && this.ReallocateInternalAllocatedBuffers(256), (t = []).length = this.m_internalAllocatedCapacity), t
  56824. }, n.prototype.ReallocateHandleBuffers = function(t) {
  56825. this.m_handleIndexBuffer.data = this.ReallocateBuffer4(this.m_handleIndexBuffer, this.m_internalAllocatedCapacity, t, !0)
  56826. }, n.prototype.ReallocateInternalAllocatedBuffers = function(t) {
  56827. function e(t, e) {
  56828. return e && t > e ? e : t
  56829. }
  56830. if (t = e(t = e(t = e(t = e(t = e(t = e(t, this.m_def.maxCount), this.m_flagsBuffer.userSuppliedCapacity), this.m_positionBuffer.userSuppliedCapacity), this.m_velocityBuffer.userSuppliedCapacity), this.m_colorBuffer.userSuppliedCapacity), this.m_userDataBuffer.userSuppliedCapacity), this.m_internalAllocatedCapacity < t) {
  56831. this.ReallocateHandleBuffers(t), this.m_flagsBuffer.data = this.ReallocateBuffer4(this.m_flagsBuffer, this.m_internalAllocatedCapacity, t, !1);
  56832. var i = this.m_stuckThreshold > 0;
  56833. this.m_lastBodyContactStepBuffer.data = this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer, this.m_internalAllocatedCapacity, t, i), this.m_bodyContactCountBuffer.data = this.ReallocateBuffer4(this.m_bodyContactCountBuffer, this.m_internalAllocatedCapacity, t, i), this.m_consecutiveContactStepsBuffer.data = this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer, this.m_internalAllocatedCapacity, t, i), this.m_positionBuffer.data = this.ReallocateBuffer4(this.m_positionBuffer, this.m_internalAllocatedCapacity, t, !1), this.m_velocityBuffer.data = this.ReallocateBuffer4(this.m_velocityBuffer, this.m_internalAllocatedCapacity, t, !1), this.m_forceBuffer = this.ReallocateBuffer5(this.m_forceBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_weightBuffer = this.ReallocateBuffer5(this.m_weightBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_staticPressureBuffer = this.ReallocateBuffer5(this.m_staticPressureBuffer, 0, this.m_internalAllocatedCapacity, t, !0), this.m_accumulationBuffer = this.ReallocateBuffer5(this.m_accumulationBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_accumulation2Buffer = this.ReallocateBuffer5(this.m_accumulation2Buffer, 0, this.m_internalAllocatedCapacity, t, !0), this.m_depthBuffer = this.ReallocateBuffer5(this.m_depthBuffer, 0, this.m_internalAllocatedCapacity, t, !0), this.m_colorBuffer.data = this.ReallocateBuffer4(this.m_colorBuffer, this.m_internalAllocatedCapacity, t, !0), this.m_groupBuffer = this.ReallocateBuffer5(this.m_groupBuffer, 0, this.m_internalAllocatedCapacity, t, !1), this.m_userDataBuffer.data = this.ReallocateBuffer4(this.m_userDataBuffer, this.m_internalAllocatedCapacity, t, !0), this.m_expirationTimeBuffer.data = this.ReallocateBuffer4(this.m_expirationTimeBuffer, this.m_internalAllocatedCapacity, t, !0), this.m_indexByExpirationTimeBuffer.data = this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer, this.m_internalAllocatedCapacity, t, !1), this.m_internalAllocatedCapacity = t
  56834. }
  56835. }, n.prototype.CreateParticleForGroup = function(t, i, n) {
  56836. var r = new yn;
  56837. r.flags = e(t.flags, 0), V.MulXV(i, n, r.position), P.AddVV(e(t.linearVelocity, P.ZERO), P.CrossSV(e(t.angularVelocity, 0), P.SubVV(r.position, e(t.position, P.ZERO), P.s_t0), P.s_t0), r.velocity), r.color.Copy(e(t.color, G.ZERO)), r.lifetime = e(t.lifetime, 0), r.userData = t.userData, this.CreateParticle(r)
  56838. }, n.prototype.CreateParticlesStrokeShapeForGroup = function(i, r, s) {
  56839. var o = n.CreateParticlesStrokeShapeForGroup_s_edge,
  56840. a = n.CreateParticlesStrokeShapeForGroup_s_d,
  56841. l = n.CreateParticlesStrokeShapeForGroup_s_p,
  56842. h = e(r.stride, 0);
  56843. 0 === h && (h = this.GetParticleStride());
  56844. for (var c = 0, u = i.GetChildCount(), _ = 0; _ < u; _++) {
  56845. var f = null;
  56846. i.GetType() === t.b2ShapeType.e_edgeShape ? f = i : (f = o, i.GetChildEdge(f, _));
  56847. for (var d = P.SubVV(f.m_vertex2, f.m_vertex1, a), p = d.Length(); c < p;) {
  56848. var m = P.AddVMulSV(f.m_vertex1, c / p, d, l);
  56849. this.CreateParticleForGroup(r, s, m), c += h
  56850. }
  56851. c -= p
  56852. }
  56853. }, n.prototype.CreateParticlesFillShapeForGroup = function(t, i, r) {
  56854. var s = n.CreateParticlesFillShapeForGroup_s_aabb,
  56855. o = n.CreateParticlesFillShapeForGroup_s_p,
  56856. a = e(i.stride, 0);
  56857. 0 === a && (a = this.GetParticleStride());
  56858. var l = V.IDENTITY,
  56859. h = s;
  56860. t.ComputeAABB(h, l, 0);
  56861. for (var c = Math.floor(h.lowerBound.y / a) * a; c < h.upperBound.y; c += a)
  56862. for (var u = Math.floor(h.lowerBound.x / a) * a; u < h.upperBound.x; u += a) {
  56863. var _ = o.Set(u, c);
  56864. t.TestPoint(l, _) && this.CreateParticleForGroup(i, r, _)
  56865. }
  56866. }, n.prototype.CreateParticlesWithShapeForGroup = function(e, i, n) {
  56867. switch (e.GetType()) {
  56868. case t.b2ShapeType.e_edgeShape:
  56869. case t.b2ShapeType.e_chainShape:
  56870. this.CreateParticlesStrokeShapeForGroup(e, i, n);
  56871. break;
  56872. case t.b2ShapeType.e_polygonShape:
  56873. case t.b2ShapeType.e_circleShape:
  56874. this.CreateParticlesFillShapeForGroup(e, i, n)
  56875. }
  56876. }, n.prototype.CreateParticlesWithShapesForGroup = function(t, e, i, r) {
  56877. var s = new n.CompositeShape(t, e);
  56878. this.CreateParticlesFillShapeForGroup(s, i, r)
  56879. }, n.prototype.CloneParticle = function(t, e) {
  56880. var i = new yn;
  56881. if (!this.m_flagsBuffer.data) throw new Error;
  56882. if (!this.m_positionBuffer.data) throw new Error;
  56883. if (!this.m_velocityBuffer.data) throw new Error;
  56884. i.flags = this.m_flagsBuffer.data[t], i.position.Copy(this.m_positionBuffer.data[t]), i.velocity.Copy(this.m_velocityBuffer.data[t]), this.m_colorBuffer.data && i.color.Copy(this.m_colorBuffer.data[t]), this.m_userDataBuffer.data && (i.userData = this.m_userDataBuffer.data[t]), i.group = e;
  56885. var n = this.CreateParticle(i);
  56886. if (this.m_handleIndexBuffer.data) {
  56887. var r = this.m_handleIndexBuffer.data[t];
  56888. r && r.SetIndex(n), this.m_handleIndexBuffer.data[n] = r, this.m_handleIndexBuffer.data[t] = null
  56889. }
  56890. return this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = this.m_lastBodyContactStepBuffer.data[t]), this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = this.m_bodyContactCountBuffer.data[t]), this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = this.m_consecutiveContactStepsBuffer.data[t]), this.m_hasForce && this.m_forceBuffer[n].Copy(this.m_forceBuffer[t]), this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = this.m_staticPressureBuffer[t]), this.m_depthBuffer && (this.m_depthBuffer[n] = this.m_depthBuffer[t]), this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[n] = this.m_expirationTimeBuffer.data[t]), n
  56891. }, n.prototype.DestroyParticlesInGroup = function(t, e) {
  56892. void 0 === e && (e = !1);
  56893. for (var i = t.m_firstIndex; i < t.m_lastIndex; i++) this.DestroyParticle(i, e)
  56894. }, n.prototype.DestroyParticleGroup = function(t) {
  56895. this.m_world.m_destructionListener && this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t), this.SetGroupFlags(t, 0);
  56896. for (var e = t.m_firstIndex; e < t.m_lastIndex; e++) this.m_groupBuffer[e] = null;
  56897. t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_groupList && (this.m_groupList = t.m_next), --this.m_groupCount
  56898. }, n.ParticleCanBeConnected = function(e, i) {
  56899. return 0 != (e & (t.b2ParticleFlag.b2_wallParticle | t.b2ParticleFlag.b2_springParticle | t.b2ParticleFlag.b2_elasticParticle)) || null !== i && 0 != (i.GetGroupFlags() & t.b2ParticleGroupFlag.b2_rigidParticleGroup)
  56900. }, n.prototype.UpdatePairsAndTriads = function(e, i, r) {
  56901. var s = n.UpdatePairsAndTriads_s_dab,
  56902. o = n.UpdatePairsAndTriads_s_dbc,
  56903. a = n.UpdatePairsAndTriads_s_dca;
  56904. if (!this.m_flagsBuffer.data) throw new Error;
  56905. if (!this.m_positionBuffer.data) throw new Error;
  56906. if (!this.m_velocityBuffer.data) throw new Error;
  56907. for (var l = this.m_positionBuffer.data, h = 0, c = e; c < i; c++) h |= this.m_flagsBuffer.data[c];
  56908. if (h & n.k_pairFlags)
  56909. for (var u = 0; u < this.m_contactBuffer.count; u++) {
  56910. var _ = this.m_contactBuffer.data[u],
  56911. f = _.indexA,
  56912. d = _.indexB,
  56913. p = this.m_flagsBuffer.data[f],
  56914. m = this.m_flagsBuffer.data[d],
  56915. y = this.m_groupBuffer[f],
  56916. v = this.m_groupBuffer[d];
  56917. if (f >= e && f < i && d >= e && d < i && !((p | m) & t.b2ParticleFlag.b2_zombieParticle) && (p | m) & n.k_pairFlags && (r.IsNecessary(f) || r.IsNecessary(d)) && n.ParticleCanBeConnected(p, y) && n.ParticleCanBeConnected(m, v) && r.ShouldCreatePair(f, d)) {
  56918. var x = this.m_pairBuffer.data[this.m_pairBuffer.Append()];
  56919. x.indexA = f, x.indexB = d, x.flags = _.flags, x.strength = g(y ? y.m_strength : 1, v ? v.m_strength : 1), x.distance = P.DistanceVV(l[f], l[d])
  56920. }
  56921. En(this.m_pairBuffer.data, 0, this.m_pairBuffer.count, n.ComparePairIndices), this.m_pairBuffer.Unique(n.MatchPairIndices)
  56922. }
  56923. if (h & n.k_triadFlags) {
  56924. var b = new Cn(i - e);
  56925. for (c = e; c < i; c++) {
  56926. var A = this.m_flagsBuffer.data[c],
  56927. C = this.m_groupBuffer[c];
  56928. A & t.b2ParticleFlag.b2_zombieParticle || !n.ParticleCanBeConnected(A, C) || b.AddGenerator(l[c], c, r.IsNecessary(c))
  56929. }
  56930. var T = this.GetParticleStride();
  56931. b.Generate(T / 2, 2 * T);
  56932. var S = this;
  56933. b.GetNodes((function(t, e, i) {
  56934. if (!S.m_flagsBuffer.data) throw new Error;
  56935. var h = S.m_flagsBuffer.data[t],
  56936. c = S.m_flagsBuffer.data[e],
  56937. u = S.m_flagsBuffer.data[i];
  56938. if ((h | c | u) & n.k_triadFlags && r.ShouldCreateTriad(t, e, i)) {
  56939. var _ = l[t],
  56940. f = l[e],
  56941. d = l[i],
  56942. p = P.SubVV(_, f, s),
  56943. m = P.SubVV(f, d, o),
  56944. y = P.SubVV(d, _, a),
  56945. v = 4 * S.m_squaredDiameter;
  56946. if (P.DotVV(p, p) > v || P.DotVV(m, m) > v || P.DotVV(y, y) > v) return;
  56947. var x = S.m_groupBuffer[t],
  56948. b = S.m_groupBuffer[e],
  56949. A = S.m_groupBuffer[i],
  56950. C = S.m_triadBuffer.data[S.m_triadBuffer.Append()];
  56951. C.indexA = t, C.indexB = e, C.indexC = i, C.flags = h | c | u, C.strength = g(g(x ? x.m_strength : 1, b ? b.m_strength : 1), A ? A.m_strength : 1);
  56952. var T = (_.x + f.x + d.x) / 3,
  56953. w = (_.y + f.y + d.y) / 3;
  56954. C.pa.x = _.x - T, C.pa.y = _.y - w, C.pb.x = f.x - T, C.pb.y = f.y - w, C.pc.x = d.x - T, C.pc.y = d.y - w, C.ka = -P.DotVV(y, p), C.kb = -P.DotVV(p, m), C.kc = -P.DotVV(m, y), C.s = P.CrossVV(_, f) + P.CrossVV(f, d) + P.CrossVV(d, _)
  56955. }
  56956. })), En(this.m_triadBuffer.data, 0, this.m_triadBuffer.count, n.CompareTriadIndices), this.m_triadBuffer.Unique(n.MatchTriadIndices)
  56957. }
  56958. }, n.prototype.UpdatePairsAndTriadsWithReactiveParticles = function() {
  56959. var e = new n.ReactiveFilter(this.m_flagsBuffer);
  56960. if (this.UpdatePairsAndTriads(0, this.m_count, e), !this.m_flagsBuffer.data) throw new Error;
  56961. for (var i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] &= ~t.b2ParticleFlag.b2_reactiveParticle;
  56962. this.m_allParticleFlags &= ~t.b2ParticleFlag.b2_reactiveParticle
  56963. }, n.ComparePairIndices = function(t, e) {
  56964. var i = t.indexA - e.indexA;
  56965. return 0 !== i ? i < 0 : t.indexB < e.indexB
  56966. }, n.MatchPairIndices = function(t, e) {
  56967. return t.indexA === e.indexA && t.indexB === e.indexB
  56968. }, n.CompareTriadIndices = function(t, e) {
  56969. var i = t.indexA - e.indexA;
  56970. if (0 !== i) return i < 0;
  56971. var n = t.indexB - e.indexB;
  56972. return 0 !== n ? n < 0 : t.indexC < e.indexC
  56973. }, n.MatchTriadIndices = function(t, e) {
  56974. return t.indexA === e.indexA && t.indexB === e.indexB && t.indexC === e.indexC
  56975. }, n.InitializeParticleLists = function(t, e) {
  56976. for (var i = t.GetBufferIndex(), n = t.GetParticleCount(), r = 0; r < n; r++) {
  56977. var s = e[r];
  56978. s.list = s, s.next = null, s.count = 1, s.index = r + i
  56979. }
  56980. }, n.prototype.MergeParticleListsInContact = function(t, e) {
  56981. for (var i = t.GetBufferIndex(), r = 0; r < this.m_contactBuffer.count; r++) {
  56982. var s = this.m_contactBuffer.data[r],
  56983. o = s.indexA,
  56984. a = s.indexB;
  56985. if (t.ContainsParticle(o) && t.ContainsParticle(a)) {
  56986. var l = e[o - i].list,
  56987. h = e[a - i].list;
  56988. if (l !== h) {
  56989. if (l.count < h.count) {
  56990. var c = l;
  56991. l = h, h = c
  56992. }
  56993. n.MergeParticleLists(l, h)
  56994. }
  56995. }
  56996. }
  56997. }, n.MergeParticleLists = function(t, e) {
  56998. for (var i = e;;) {
  56999. i.list = t;
  57000. var n = i.next;
  57001. if (!n) {
  57002. i.next = t.next;
  57003. break
  57004. }
  57005. i = n
  57006. }
  57007. t.next = e, t.count += e.count, e.count = 0
  57008. }, n.FindLongestParticleList = function(t, e) {
  57009. for (var i = t.GetParticleCount(), n = e[0], r = 0; r < i; r++) {
  57010. var s = e[r];
  57011. n.count < s.count && (n = s)
  57012. }
  57013. return n
  57014. }, n.prototype.MergeZombieParticleListNodes = function(e, i, r) {
  57015. if (!this.m_flagsBuffer.data) throw new Error;
  57016. for (var s = e.GetParticleCount(), o = 0; o < s; o++) {
  57017. var a = i[o];
  57018. a !== r && this.m_flagsBuffer.data[a.index] & t.b2ParticleFlag.b2_zombieParticle && n.MergeParticleListAndNode(r, a)
  57019. }
  57020. }, n.MergeParticleListAndNode = function(t, e) {
  57021. e.list = t, e.next = t.next, t.next = e, t.count++, e.count = 0
  57022. }, n.prototype.CreateParticleGroupsFromParticleList = function(e, i, n) {
  57023. if (!this.m_flagsBuffer.data) throw new Error;
  57024. var r = e.GetParticleCount(),
  57025. s = new xn;
  57026. s.groupFlags = e.GetGroupFlags(), s.userData = e.GetUserData();
  57027. for (var o = 0; o < r; o++) {
  57028. var a = i[o];
  57029. if (a.count && a !== n)
  57030. for (var l = this.CreateParticleGroup(s), h = a; h; h = h.next) {
  57031. var c = h.index,
  57032. u = this.CloneParticle(c, l);
  57033. this.m_flagsBuffer.data[c] |= t.b2ParticleFlag.b2_zombieParticle, h.index = u
  57034. }
  57035. }
  57036. }, n.prototype.UpdatePairsAndTriadsWithParticleList = function(t, e) {
  57037. for (var i = t.GetBufferIndex(), n = 0; n < this.m_pairBuffer.count; n++) {
  57038. var r = this.m_pairBuffer.data[n],
  57039. s = r.indexA,
  57040. o = r.indexB;
  57041. t.ContainsParticle(s) && (r.indexA = e[s - i].index), t.ContainsParticle(o) && (r.indexB = e[o - i].index)
  57042. }
  57043. for (n = 0; n < this.m_triadBuffer.count; n++) {
  57044. var a = this.m_triadBuffer.data[n],
  57045. l = (s = a.indexA, o = a.indexB, a.indexC);
  57046. t.ContainsParticle(s) && (a.indexA = e[s - i].index), t.ContainsParticle(o) && (a.indexB = e[o - i].index), t.ContainsParticle(l) && (a.indexC = e[l - i].index)
  57047. }
  57048. }, n.prototype.ComputeDepth = function() {
  57049. for (var e = [], n = 0, r = 0; r < this.m_contactBuffer.count; r++) {
  57050. var s = (v = this.m_contactBuffer.data[r]).indexA,
  57051. o = v.indexB,
  57052. a = this.m_groupBuffer[s],
  57053. l = this.m_groupBuffer[o];
  57054. a && a === l && a.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && (e[n++] = v)
  57055. }
  57056. for (var h = [], c = 0, u = this.m_groupList; u; u = u.GetNext())
  57057. if (u.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth) {
  57058. h[c++] = u, this.SetGroupFlags(u, u.m_groupFlags & ~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
  57059. for (var _ = u.m_firstIndex; _ < u.m_lastIndex; _++) this.m_accumulationBuffer[_] = 0
  57060. }
  57061. for (r = 0; r < n; r++) {
  57062. s = (v = e[r]).indexA, o = v.indexB;
  57063. var f = v.weight;
  57064. this.m_accumulationBuffer[s] += f, this.m_accumulationBuffer[o] += f
  57065. }
  57066. for (_ = 0; _ < c; _++)
  57067. for (var d = (u = h[_]).m_firstIndex; d < u.m_lastIndex; d++) {
  57068. f = this.m_accumulationBuffer[d];
  57069. this.m_depthBuffer[d] = f < .8 ? 0 : i
  57070. }
  57071. for (var p = S(this.m_count) >> 0, m = 0; m < p; m++) {
  57072. var y = !1;
  57073. for (r = 0; r < n; r++) {
  57074. s = (v = e[r]).indexA, o = v.indexB;
  57075. var v, g = 1 - v.weight,
  57076. x = this.m_depthBuffer[s],
  57077. b = this.m_depthBuffer[o],
  57078. A = b + g,
  57079. C = x + g;
  57080. x > A && (this.m_depthBuffer[s] = A, y = !0), b > C && (this.m_depthBuffer[o] = C, y = !0)
  57081. }
  57082. if (!y) break
  57083. }
  57084. for (_ = 0; _ < c; _++)
  57085. for (var T = (u = h[_]).m_firstIndex; T < u.m_lastIndex; T++) this.m_depthBuffer[T] < i ? this.m_depthBuffer[T] *= this.m_particleDiameter : this.m_depthBuffer[T] = 0
  57086. }, n.prototype.GetInsideBoundsEnumerator = function(t) {
  57087. var e = n.computeTag(this.m_inverseDiameter * t.lowerBound.x - 1, this.m_inverseDiameter * t.lowerBound.y - 1),
  57088. i = n.computeTag(this.m_inverseDiameter * t.upperBound.x + 1, this.m_inverseDiameter * t.upperBound.y + 1),
  57089. r = this.m_proxyBuffer.count,
  57090. s = Dn(this.m_proxyBuffer.data, 0, r, e, n.Proxy.CompareProxyTag),
  57091. o = Bn(this.m_proxyBuffer.data, 0, r, i, n.Proxy.CompareTagProxy);
  57092. return new n.InsideBoundsEnumerator(this, e, i, s, o)
  57093. }, n.prototype.UpdateAllParticleFlags = function() {
  57094. if (!this.m_flagsBuffer.data) throw new Error;
  57095. this.m_allParticleFlags = 0;
  57096. for (var t = 0; t < this.m_count; t++) this.m_allParticleFlags |= this.m_flagsBuffer.data[t];
  57097. this.m_needsUpdateAllParticleFlags = !1
  57098. }, n.prototype.UpdateAllGroupFlags = function() {
  57099. this.m_allGroupFlags = 0;
  57100. for (var t = this.m_groupList; t; t = t.GetNext()) this.m_allGroupFlags |= t.m_groupFlags;
  57101. this.m_needsUpdateAllGroupFlags = !1
  57102. }, n.prototype.AddContact = function(t, e, i) {
  57103. if (!this.m_flagsBuffer.data) throw new Error;
  57104. if (!this.m_positionBuffer.data) throw new Error;
  57105. var r = n.AddContact_s_d,
  57106. s = this.m_positionBuffer.data,
  57107. o = P.SubVV(s[e], s[t], r),
  57108. a = P.DotVV(o, o);
  57109. if (a < this.m_squaredDiameter) {
  57110. var l = T(a);
  57111. isFinite(l) || (l = 198177537e11);
  57112. var h = this.m_contactBuffer.data[this.m_contactBuffer.Append()];
  57113. h.indexA = t, h.indexB = e, h.flags = this.m_flagsBuffer.data[t] | this.m_flagsBuffer.data[e], h.weight = 1 - a * l * this.m_inverseDiameter, P.MulSV(l, o, h.normal)
  57114. }
  57115. }, n.prototype.FindContacts_Reference = function(t) {
  57116. var e = this.m_proxyBuffer.count;
  57117. this.m_contactBuffer.count = 0;
  57118. for (var i = 0, r = 0; i < e; i++) {
  57119. for (var s = n.computeRelativeTag(this.m_proxyBuffer.data[i].tag, 1, 0), o = i + 1; o < e && !(s < this.m_proxyBuffer.data[o].tag); o++) this.AddContact(this.m_proxyBuffer.data[i].index, this.m_proxyBuffer.data[o].index, this.m_contactBuffer);
  57120. for (var a = n.computeRelativeTag(this.m_proxyBuffer.data[i].tag, -1, 1); r < e && !(a <= this.m_proxyBuffer.data[r].tag); r++);
  57121. var l = n.computeRelativeTag(this.m_proxyBuffer.data[i].tag, 1, 1);
  57122. for (o = r; o < e && !(l < this.m_proxyBuffer.data[o].tag); o++) this.AddContact(this.m_proxyBuffer.data[i].index, this.m_proxyBuffer.data[o].index, this.m_contactBuffer)
  57123. }
  57124. }, n.prototype.FindContacts = function(t) {
  57125. this.FindContacts_Reference(t)
  57126. }, n.prototype.UpdateProxies_Reference = function(t) {
  57127. if (!this.m_positionBuffer.data) throw new Error;
  57128. for (var e = this.m_positionBuffer.data, i = this.m_inverseDiameter, r = 0; r < this.m_proxyBuffer.count; ++r) {
  57129. var s = this.m_proxyBuffer.data[r],
  57130. o = e[s.index];
  57131. s.tag = n.computeTag(i * o.x, i * o.y)
  57132. }
  57133. }, n.prototype.UpdateProxies = function(t) {
  57134. this.UpdateProxies_Reference(t)
  57135. }, n.prototype.SortProxies = function(t) {
  57136. wn(this.m_proxyBuffer.data, 0, this.m_proxyBuffer.count, n.Proxy.CompareProxyProxy)
  57137. }, n.prototype.FilterContacts = function(e) {
  57138. var i = this.GetParticleContactFilter();
  57139. if (null !== i) {
  57140. var n = this;
  57141. this.m_contactBuffer.RemoveIf((function(e) {
  57142. return 0 != (e.flags & t.b2ParticleFlag.b2_particleContactFilterParticle) && !i.ShouldCollideParticleParticle(n, e.indexA, e.indexB)
  57143. }))
  57144. }
  57145. }, n.prototype.NotifyContactListenerPreContact = function(t) {
  57146. if (null !== this.GetParticleContactListener()) throw t.Initialize(this.m_contactBuffer, this.m_flagsBuffer), new Error
  57147. }, n.prototype.NotifyContactListenerPostContact = function(t) {
  57148. var e = this.GetParticleContactListener();
  57149. if (null !== e) {
  57150. for (var i = 0; i < this.m_contactBuffer.count; ++i) {
  57151. var n = this.m_contactBuffer.data[i];
  57152. e.BeginContactParticleParticle(this, n)
  57153. }
  57154. throw new Error
  57155. }
  57156. }, n.b2ParticleContactIsZombie = function(e) {
  57157. return (e.flags & t.b2ParticleFlag.b2_zombieParticle) === t.b2ParticleFlag.b2_zombieParticle
  57158. }, n.prototype.UpdateContacts = function(t) {
  57159. this.UpdateProxies(this.m_proxyBuffer), this.SortProxies(this.m_proxyBuffer);
  57160. var e = new n.b2ParticlePairSet;
  57161. this.NotifyContactListenerPreContact(e), this.FindContacts(this.m_contactBuffer), this.FilterContacts(this.m_contactBuffer), this.NotifyContactListenerPostContact(e), t && this.m_contactBuffer.RemoveIf(n.b2ParticleContactIsZombie)
  57162. }, n.prototype.NotifyBodyContactListenerPreContact = function(t) {
  57163. if (null !== this.GetFixtureContactListener()) throw t.Initialize(this.m_bodyContactBuffer, this.m_flagsBuffer), new Error
  57164. }, n.prototype.NotifyBodyContactListenerPostContact = function(t) {
  57165. var e = this.GetFixtureContactListener();
  57166. if (null !== e) {
  57167. for (var i = 0; i < this.m_bodyContactBuffer.count; i++) {
  57168. var n = this.m_bodyContactBuffer.data[i];
  57169. e.BeginContactFixtureParticle(this, n)
  57170. }
  57171. throw new Error
  57172. }
  57173. }, n.prototype.UpdateBodyContacts = function() {
  57174. var t = n.UpdateBodyContacts_s_aabb,
  57175. e = new n.FixtureParticleSet;
  57176. if (this.NotifyBodyContactListenerPreContact(e), this.m_stuckThreshold > 0) {
  57177. if (!this.m_bodyContactCountBuffer.data) throw new Error;
  57178. if (!this.m_lastBodyContactStepBuffer.data) throw new Error;
  57179. if (!this.m_consecutiveContactStepsBuffer.data) throw new Error;
  57180. for (var i = this.GetParticleCount(), r = 0; r < i; r++) this.m_bodyContactCountBuffer.data[r] = 0, this.m_timestamp > this.m_lastBodyContactStepBuffer.data[r] + 1 && (this.m_consecutiveContactStepsBuffer.data[r] = 0)
  57181. }
  57182. this.m_bodyContactBuffer.SetCount(0), this.m_stuckParticleBuffer.SetCount(0);
  57183. var s = t;
  57184. this.ComputeAABB(s);
  57185. var o = new n.UpdateBodyContactsCallback(this, this.GetFixtureContactFilter());
  57186. this.m_world.QueryAABB(o, s), this.m_def.strictContactCheck && this.RemoveSpuriousBodyContacts(), this.NotifyBodyContactListenerPostContact(e)
  57187. }, n.prototype.Solve = function(e) {
  57188. var i = n.Solve_s_subStep;
  57189. if (0 !== this.m_count && (this.m_expirationTimeBuffer.data && this.SolveLifetimes(e), this.m_allParticleFlags & t.b2ParticleFlag.b2_zombieParticle && this.SolveZombie(), this.m_needsUpdateAllParticleFlags && this.UpdateAllParticleFlags(), this.m_needsUpdateAllGroupFlags && this.UpdateAllGroupFlags(), !this.m_paused))
  57190. for (this.m_iterationIndex = 0; this.m_iterationIndex < e.particleIterations; this.m_iterationIndex++) {
  57191. ++this.m_timestamp;
  57192. var r = i.Copy(e);
  57193. if (r.dt /= e.particleIterations, r.inv_dt *= e.particleIterations, this.UpdateContacts(!1), this.UpdateBodyContacts(), this.ComputeWeight(), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && this.ComputeDepth(), this.m_allParticleFlags & t.b2ParticleFlag.b2_reactiveParticle && this.UpdatePairsAndTriadsWithReactiveParticles(), this.m_hasForce && this.SolveForce(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_viscousParticle && this.SolveViscous(), this.m_allParticleFlags & t.b2ParticleFlag.b2_repulsiveParticle && this.SolveRepulsive(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_powderParticle && this.SolvePowder(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_tensileParticle && this.SolveTensile(r), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SolveSolid(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_colorMixingParticle && this.SolveColorMixing(), this.SolveGravity(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle && this.SolveStaticPressure(r), this.SolvePressure(r), this.SolveDamping(r), this.m_allParticleFlags & n.k_extraDampingFlags && this.SolveExtraDamping(), this.m_allParticleFlags & t.b2ParticleFlag.b2_elasticParticle && this.SolveElastic(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_springParticle && this.SolveSpring(r), this.LimitVelocity(r), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigidDamping(), this.m_allParticleFlags & t.b2ParticleFlag.b2_barrierParticle && this.SolveBarrier(r), this.SolveCollision(r), this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigid(r), this.m_allParticleFlags & t.b2ParticleFlag.b2_wallParticle && this.SolveWall(), !this.m_positionBuffer.data) throw new Error;
  57194. if (!this.m_velocityBuffer.data) throw new Error;
  57195. for (var s = 0; s < this.m_count; s++) this.m_positionBuffer.data[s].SelfMulAdd(r.dt, this.m_velocityBuffer.data[s])
  57196. }
  57197. }, n.prototype.SolveCollision = function(t) {
  57198. var e = n.SolveCollision_s_aabb;
  57199. if (!this.m_positionBuffer.data) throw new Error;
  57200. if (!this.m_velocityBuffer.data) throw new Error;
  57201. var r = this.m_positionBuffer.data,
  57202. s = this.m_velocityBuffer.data,
  57203. o = e;
  57204. o.lowerBound.x = +i, o.lowerBound.y = +i, o.upperBound.x = -i, o.upperBound.y = -i;
  57205. for (var a = 0; a < this.m_count; a++) {
  57206. var l = s[a],
  57207. h = r[a],
  57208. c = h.x + t.dt * l.x,
  57209. u = h.y + t.dt * l.y;
  57210. o.lowerBound.x = g(o.lowerBound.x, g(h.x, c)), o.lowerBound.y = g(o.lowerBound.y, g(h.y, u)), o.upperBound.x = x(o.upperBound.x, x(h.x, c)), o.upperBound.y = x(o.upperBound.y, x(h.y, u))
  57211. }
  57212. var _ = new n.SolveCollisionCallback(this, t);
  57213. this.m_world.QueryAABB(_, o)
  57214. }, n.prototype.LimitVelocity = function(t) {
  57215. if (!this.m_velocityBuffer.data) throw new Error;
  57216. for (var e = this.m_velocityBuffer.data, i = this.GetCriticalVelocitySquared(t), n = 0; n < this.m_count; n++) {
  57217. var r = e[n],
  57218. s = P.DotVV(r, r);
  57219. s > i && r.SelfMul(S(i / s))
  57220. }
  57221. }, n.prototype.SolveGravity = function(t) {
  57222. if (!this.m_velocityBuffer.data) throw new Error;
  57223. for (var e = n.SolveGravity_s_gravity, i = this.m_velocityBuffer.data, r = P.MulSV(t.dt * this.m_def.gravityScale, this.m_world.GetGravity(), e), s = 0; s < this.m_count; s++) i[s].SelfAdd(r)
  57224. }, n.prototype.SolveBarrier = function(e) {
  57225. var i = n.SolveBarrier_s_aabb,
  57226. r = n.SolveBarrier_s_va,
  57227. s = n.SolveBarrier_s_vb,
  57228. o = n.SolveBarrier_s_pba,
  57229. a = n.SolveBarrier_s_vba,
  57230. l = n.SolveBarrier_s_vc,
  57231. h = n.SolveBarrier_s_pca,
  57232. c = n.SolveBarrier_s_vca,
  57233. u = n.SolveBarrier_s_qba,
  57234. _ = n.SolveBarrier_s_qca,
  57235. f = n.SolveBarrier_s_dv,
  57236. d = n.SolveBarrier_s_f;
  57237. if (!this.m_flagsBuffer.data) throw new Error;
  57238. if (!this.m_positionBuffer.data) throw new Error;
  57239. if (!this.m_velocityBuffer.data) throw new Error;
  57240. for (var p = this.m_positionBuffer.data, m = this.m_velocityBuffer.data, y = 0; y < this.m_count; y++) {
  57241. 0 != (this.m_flagsBuffer.data[y] & n.k_barrierWallFlags) && m[y].SetZero()
  57242. }
  57243. for (var v = 2.5 * e.dt, g = this.GetParticleMass(), x = 0; x < this.m_pairBuffer.count; x++) {
  57244. var b = this.m_pairBuffer.data[x];
  57245. if (b.flags & t.b2ParticleFlag.b2_barrierParticle) {
  57246. var A = b.indexA,
  57247. C = b.indexB,
  57248. T = p[A],
  57249. w = p[C],
  57250. E = i;
  57251. P.MinV(T, w, E.lowerBound), P.MaxV(T, w, E.upperBound);
  57252. for (var M = this.m_groupBuffer[A], D = this.m_groupBuffer[C], B = this.GetLinearVelocity(M, A, T, r), I = this.GetLinearVelocity(D, C, w, s), R = P.SubVV(w, T, o), O = P.SubVV(I, B, a), L = this.GetInsideBoundsEnumerator(E), F = void 0;
  57253. (F = L.GetNext()) >= 0;) {
  57254. var N = p[F],
  57255. V = this.m_groupBuffer[F];
  57256. if (M !== V && D !== V) {
  57257. var k = this.GetLinearVelocity(V, F, N, l),
  57258. G = P.SubVV(N, T, h),
  57259. U = P.SubVV(k, B, c),
  57260. z = P.CrossVV(O, U),
  57261. j = P.CrossVV(R, U) - P.CrossVV(G, O),
  57262. W = P.CrossVV(R, G),
  57263. H = void 0,
  57264. X = void 0,
  57265. Y = u,
  57266. q = _;
  57267. if (0 === z) {
  57268. if (0 === j) continue;
  57269. if (!((X = -W / j) >= 0 && X < v)) continue;
  57270. if (P.AddVMulSV(R, X, O, Y), P.AddVMulSV(G, X, U, q), !((H = P.DotVV(Y, q) / P.DotVV(Y, Y)) >= 0 && H <= 1)) continue
  57271. } else {
  57272. var J = j * j - 4 * W * z;
  57273. if (J < 0) continue;
  57274. var Z = S(J),
  57275. K = (-j - Z) / (2 * z),
  57276. Q = (-j + Z) / (2 * z);
  57277. if (K > Q) {
  57278. var $ = K;
  57279. K = Q, Q = $
  57280. }
  57281. if (X = K, P.AddVMulSV(R, X, O, Y), P.AddVMulSV(G, X, U, q), H = P.DotVV(Y, q) / P.DotVV(Y, Y), !(X >= 0 && X < v && H >= 0 && H <= 1)) {
  57282. if (!((X = Q) >= 0 && X < v)) continue;
  57283. if (P.AddVMulSV(R, X, O, Y), P.AddVMulSV(G, X, U, q), !((H = P.DotVV(Y, q) / P.DotVV(Y, Y)) >= 0 && H <= 1)) continue
  57284. }
  57285. }
  57286. var tt = f;
  57287. tt.x = B.x + H * O.x - k.x, tt.y = B.y + H * O.y - k.y;
  57288. var et = P.MulSV(g, tt, d);
  57289. if (V && this.IsRigidGroup(V)) {
  57290. var it = V.GetMass(),
  57291. nt = V.GetInertia();
  57292. it > 0 && V.m_linearVelocity.SelfMulAdd(1 / it, et), nt > 0 && (V.m_angularVelocity += P.CrossVV(P.SubVV(N, V.GetCenter(), P.s_t0), et) / nt)
  57293. } else m[F].SelfAdd(tt);
  57294. this.ParticleApplyForce(F, et.SelfMul(-e.inv_dt))
  57295. }
  57296. }
  57297. }
  57298. }
  57299. }, n.prototype.SolveStaticPressure = function(e) {
  57300. if (!this.m_flagsBuffer.data) throw new Error;
  57301. this.m_staticPressureBuffer = this.RequestBuffer(this.m_staticPressureBuffer);
  57302. for (var i = this.GetCriticalPressure(e), n = this.m_def.staticPressureStrength * i, r = .25 * i, s = this.m_def.staticPressureRelaxation, o = 0; o < this.m_def.staticPressureIterations; o++) {
  57303. for (var a = 0; a < this.m_count; a++) this.m_accumulationBuffer[a] = 0;
  57304. for (var l = 0; l < this.m_contactBuffer.count; l++) {
  57305. var h = this.m_contactBuffer.data[l];
  57306. if (h.flags & t.b2ParticleFlag.b2_staticPressureParticle) {
  57307. var c = h.indexA,
  57308. u = h.indexB,
  57309. _ = h.weight;
  57310. this.m_accumulationBuffer[c] += _ * this.m_staticPressureBuffer[u], this.m_accumulationBuffer[u] += _ * this.m_staticPressureBuffer[c]
  57311. }
  57312. }
  57313. for (a = 0; a < this.m_count; a++) {
  57314. _ = this.m_weightBuffer[a];
  57315. if (this.m_flagsBuffer.data[a] & t.b2ParticleFlag.b2_staticPressureParticle) {
  57316. var f = (this.m_accumulationBuffer[a] + n * (_ - 1)) / (_ + s);
  57317. this.m_staticPressureBuffer[a] = b(f, 0, r)
  57318. } else this.m_staticPressureBuffer[a] = 0
  57319. }
  57320. }
  57321. }, n.prototype.ComputeWeight = function() {
  57322. for (var t = 0; t < this.m_count; t++) this.m_weightBuffer[t] = 0;
  57323. for (t = 0; t < this.m_bodyContactBuffer.count; t++) {
  57324. var e = (n = this.m_bodyContactBuffer.data[t]).index,
  57325. i = n.weight;
  57326. this.m_weightBuffer[e] += i
  57327. }
  57328. for (t = 0; t < this.m_contactBuffer.count; t++) {
  57329. e = (n = this.m_contactBuffer.data[t]).indexA;
  57330. var n, r = n.indexB;
  57331. i = n.weight;
  57332. this.m_weightBuffer[e] += i, this.m_weightBuffer[r] += i
  57333. }
  57334. }, n.prototype.SolvePressure = function(e) {
  57335. var i = n.SolvePressure_s_f;
  57336. if (!this.m_flagsBuffer.data) throw new Error;
  57337. if (!this.m_positionBuffer.data) throw new Error;
  57338. if (!this.m_velocityBuffer.data) throw new Error;
  57339. for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.GetCriticalPressure(e), a = this.m_def.pressureStrength * o, l = .25 * o, h = 0; h < this.m_count; h++) {
  57340. var c = this.m_weightBuffer[h],
  57341. u = a * x(0, c - 1);
  57342. this.m_accumulationBuffer[h] = g(u, l)
  57343. }
  57344. if (this.m_allParticleFlags & n.k_noPressureFlags)
  57345. for (h = 0; h < this.m_count; h++) this.m_flagsBuffer.data[h] & n.k_noPressureFlags && (this.m_accumulationBuffer[h] = 0);
  57346. if (this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle)
  57347. for (h = 0; h < this.m_count; h++) this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_staticPressureParticle && (this.m_accumulationBuffer[h] += this.m_staticPressureBuffer[h]);
  57348. for (var _ = e.dt / (this.m_def.density * this.m_particleDiameter), f = this.GetParticleInvMass(), d = 0; d < this.m_bodyContactBuffer.count; d++) {
  57349. var p = (C = this.m_bodyContactBuffer.data[d]).index,
  57350. m = C.body,
  57351. y = (c = C.weight, C.mass),
  57352. v = C.normal,
  57353. b = r[p],
  57354. A = (u = this.m_accumulationBuffer[p] + a * c, P.MulSV(_ * c * y * u, v, i));
  57355. s[p].SelfMulSub(f, A), m.ApplyLinearImpulse(A, b, !0)
  57356. }
  57357. for (d = 0; d < this.m_contactBuffer.count; d++) {
  57358. var C;
  57359. p = (C = this.m_contactBuffer.data[d]).indexA, m = C.indexB, c = C.weight, v = C.normal, u = this.m_accumulationBuffer[p] + this.m_accumulationBuffer[m], A = P.MulSV(_ * c * u, v, i);
  57360. s[p].SelfSub(A), s[m].SelfAdd(A)
  57361. }
  57362. }, n.prototype.SolveDamping = function(t) {
  57363. var e = n.SolveDamping_s_v,
  57364. i = n.SolveDamping_s_f;
  57365. if (!this.m_positionBuffer.data) throw new Error;
  57366. if (!this.m_velocityBuffer.data) throw new Error;
  57367. for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.dampingStrength, a = 1 / this.GetCriticalVelocity(t), l = this.GetParticleInvMass(), h = 0; h < this.m_bodyContactBuffer.count; h++) {
  57368. var c = (b = this.m_bodyContactBuffer.data[h]).index,
  57369. u = b.body,
  57370. _ = b.weight,
  57371. f = b.mass,
  57372. d = b.normal,
  57373. p = r[c],
  57374. m = P.SubVV(u.GetLinearVelocityFromWorldPoint(p, P.s_t0), s[c], e);
  57375. if ((A = P.DotVV(m, d)) < 0) {
  57376. var y = x(o * _, g(-a * A, .5)),
  57377. v = P.MulSV(y * f * A, d, i);
  57378. s[c].SelfMulAdd(l, v), u.ApplyLinearImpulse(v.SelfNeg(), p, !0)
  57379. }
  57380. }
  57381. for (h = 0; h < this.m_contactBuffer.count; h++) {
  57382. var b, A;
  57383. c = (b = this.m_contactBuffer.data[h]).indexA, u = b.indexB, _ = b.weight, d = b.normal, m = P.SubVV(s[u], s[c], e);
  57384. if ((A = P.DotVV(m, d)) < 0) {
  57385. y = x(o * _, g(-a * A, .5)), v = P.MulSV(y * A, d, i);
  57386. s[c].SelfAdd(v), s[u].SelfSub(v)
  57387. }
  57388. }
  57389. }, n.prototype.SolveRigidDamping = function() {
  57390. var t = n.SolveRigidDamping_s_t0,
  57391. e = n.SolveRigidDamping_s_t1,
  57392. i = n.SolveRigidDamping_s_p,
  57393. r = n.SolveRigidDamping_s_v,
  57394. s = [0],
  57395. o = [0],
  57396. a = [0],
  57397. l = [0],
  57398. h = [0],
  57399. c = [0];
  57400. if (!this.m_positionBuffer.data) throw new Error;
  57401. for (var u = this.m_positionBuffer.data, _ = this.m_def.dampingStrength, f = 0; f < this.m_bodyContactBuffer.count; f++) {
  57402. var d = (A = this.m_bodyContactBuffer.data[f]).index;
  57403. if ((C = this.m_groupBuffer[d]) && this.IsRigidGroup(C)) {
  57404. var p = A.body,
  57405. m = A.normal,
  57406. y = A.weight,
  57407. v = u[d],
  57408. x = P.SubVV(p.GetLinearVelocityFromWorldPoint(v, t), C.GetLinearVelocityFromWorldPoint(v, e), r);
  57409. if ((E = P.DotVV(x, m)) < 0) {
  57410. this.InitDampingParameterWithRigidGroupOrParticle(s, o, a, !0, C, d, v, m), this.InitDampingParameter(l, h, c, p.GetMass(), p.GetInertia() - p.GetMass() * p.GetLocalCenter().LengthSquared(), p.GetWorldCenter(), v, m);
  57411. var b = _ * g(y, 1) * this.ComputeDampingImpulse(s[0], o[0], a[0], l[0], h[0], c[0], E);
  57412. this.ApplyDamping(s[0], o[0], a[0], !0, C, d, b, m), p.ApplyLinearImpulse(P.MulSV(-b, m, P.s_t0), v, !0)
  57413. }
  57414. }
  57415. }
  57416. for (f = 0; f < this.m_contactBuffer.count; f++) {
  57417. d = (A = this.m_contactBuffer.data[f]).indexA, p = A.indexB, m = A.normal, y = A.weight;
  57418. var A, C = this.m_groupBuffer[d],
  57419. T = this.m_groupBuffer[p],
  57420. S = this.IsRigidGroup(C),
  57421. w = this.IsRigidGroup(T);
  57422. if (C !== T && (S || w)) {
  57423. var E;
  57424. v = P.MidVV(u[d], u[p], i), x = P.SubVV(this.GetLinearVelocity(T, p, v, t), this.GetLinearVelocity(C, d, v, e), r);
  57425. if ((E = P.DotVV(x, m)) < 0) {
  57426. this.InitDampingParameterWithRigidGroupOrParticle(s, o, a, S, C, d, v, m), this.InitDampingParameterWithRigidGroupOrParticle(l, h, c, w, T, p, v, m);
  57427. b = _ * y * this.ComputeDampingImpulse(s[0], o[0], a[0], l[0], h[0], c[0], E);
  57428. this.ApplyDamping(s[0], o[0], a[0], S, C, d, b, m), this.ApplyDamping(l[0], h[0], c[0], w, T, p, -b, m)
  57429. }
  57430. }
  57431. }
  57432. }, n.prototype.SolveExtraDamping = function() {
  57433. var t = n.SolveExtraDamping_s_v,
  57434. e = n.SolveExtraDamping_s_f;
  57435. if (!this.m_flagsBuffer.data) throw new Error;
  57436. if (!this.m_positionBuffer.data) throw new Error;
  57437. if (!this.m_velocityBuffer.data) throw new Error;
  57438. for (var i = this.m_velocityBuffer.data, r = this.m_positionBuffer.data, s = this.GetParticleInvMass(), o = 0; o < this.m_bodyContactBuffer.count; o++) {
  57439. var a = this.m_bodyContactBuffer.data[o],
  57440. l = a.index;
  57441. if (this.m_flagsBuffer.data[l] & n.k_extraDampingFlags) {
  57442. var h = a.body,
  57443. c = a.mass,
  57444. u = a.normal,
  57445. _ = r[l],
  57446. f = P.SubVV(h.GetLinearVelocityFromWorldPoint(_, P.s_t0), i[l], t),
  57447. d = P.DotVV(f, u);
  57448. if (d < 0) {
  57449. var p = P.MulSV(.5 * c * d, u, e);
  57450. i[l].SelfMulAdd(s, p), h.ApplyLinearImpulse(p.SelfNeg(), _, !0)
  57451. }
  57452. }
  57453. }
  57454. }, n.prototype.SolveWall = function() {
  57455. if (!this.m_flagsBuffer.data) throw new Error;
  57456. if (!this.m_velocityBuffer.data) throw new Error;
  57457. for (var e = this.m_velocityBuffer.data, i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] & t.b2ParticleFlag.b2_wallParticle && e[i].SetZero()
  57458. }, n.prototype.SolveRigid = function(e) {
  57459. var i = n.SolveRigid_s_position,
  57460. r = n.SolveRigid_s_rotation,
  57461. s = n.SolveRigid_s_transform,
  57462. o = n.SolveRigid_s_velocityTransform;
  57463. if (!this.m_positionBuffer.data) throw new Error;
  57464. if (!this.m_velocityBuffer.data) throw new Error;
  57465. for (var a = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, h = this.m_groupList; h; h = h.GetNext())
  57466. if (h.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup) {
  57467. h.UpdateStatistics();
  57468. var c = r;
  57469. c.SetAngle(e.dt * h.m_angularVelocity);
  57470. var u = P.AddVV(h.m_center, P.SubVV(P.MulSV(e.dt, h.m_linearVelocity, P.s_t0), N.MulRV(c, h.m_center, P.s_t1), P.s_t0), i),
  57471. _ = s;
  57472. _.SetPositionRotation(u, c), V.MulXX(_, h.m_transform, h.m_transform);
  57473. var f = o;
  57474. f.p.x = e.inv_dt * _.p.x, f.p.y = e.inv_dt * _.p.y, f.q.s = e.inv_dt * _.q.s, f.q.c = e.inv_dt * (_.q.c - 1);
  57475. for (var d = h.m_firstIndex; d < h.m_lastIndex; d++) V.MulXV(f, a[d], l[d])
  57476. }
  57477. }, n.prototype.SolveElastic = function(e) {
  57478. var i = n.SolveElastic_s_pa,
  57479. r = n.SolveElastic_s_pb,
  57480. s = n.SolveElastic_s_pc,
  57481. o = n.SolveElastic_s_r,
  57482. a = n.SolveElastic_s_t0;
  57483. if (!this.m_positionBuffer.data) throw new Error;
  57484. if (!this.m_velocityBuffer.data) throw new Error;
  57485. for (var l = this.m_positionBuffer.data, h = this.m_velocityBuffer.data, c = e.inv_dt * this.m_def.elasticStrength, u = 0; u < this.m_triadBuffer.count; u++) {
  57486. var _ = this.m_triadBuffer.data[u];
  57487. if (_.flags & t.b2ParticleFlag.b2_elasticParticle) {
  57488. var f = _.indexA,
  57489. d = _.indexB,
  57490. p = _.indexC,
  57491. m = _.pa,
  57492. y = _.pb,
  57493. v = _.pc,
  57494. g = i.Copy(l[f]),
  57495. x = r.Copy(l[d]),
  57496. b = s.Copy(l[p]),
  57497. A = h[f],
  57498. C = h[d],
  57499. S = h[p];
  57500. g.SelfMulAdd(e.dt, A), x.SelfMulAdd(e.dt, C), b.SelfMulAdd(e.dt, S);
  57501. var w = (g.x + x.x + b.x) / 3,
  57502. E = (g.y + x.y + b.y) / 3;
  57503. g.x -= w, g.y -= E, x.x -= w, x.y -= E, b.x -= w, b.y -= E;
  57504. var M = o;
  57505. M.s = P.CrossVV(m, g) + P.CrossVV(y, x) + P.CrossVV(v, b), M.c = P.DotVV(m, g) + P.DotVV(y, x) + P.DotVV(v, b);
  57506. var D = T(M.s * M.s + M.c * M.c);
  57507. isFinite(D) || (D = 198177537e11), M.s *= D, M.c *= D;
  57508. var B = c * _.strength;
  57509. N.MulRV(M, m, a), P.SubVV(a, g, a), P.MulSV(B, a, a), A.SelfAdd(a), N.MulRV(M, y, a), P.SubVV(a, x, a), P.MulSV(B, a, a), C.SelfAdd(a), N.MulRV(M, v, a), P.SubVV(a, b, a), P.MulSV(B, a, a), S.SelfAdd(a)
  57510. }
  57511. }
  57512. }, n.prototype.SolveSpring = function(e) {
  57513. var i = n.SolveSpring_s_pa,
  57514. r = n.SolveSpring_s_pb,
  57515. s = n.SolveSpring_s_d,
  57516. o = n.SolveSpring_s_f;
  57517. if (!this.m_positionBuffer.data) throw new Error;
  57518. if (!this.m_velocityBuffer.data) throw new Error;
  57519. for (var a = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, h = e.inv_dt * this.m_def.springStrength, c = 0; c < this.m_pairBuffer.count; c++) {
  57520. var u = this.m_pairBuffer.data[c];
  57521. if (u.flags & t.b2ParticleFlag.b2_springParticle) {
  57522. var _ = u.indexA,
  57523. f = u.indexB,
  57524. d = i.Copy(a[_]),
  57525. p = r.Copy(a[f]),
  57526. m = l[_],
  57527. y = l[f];
  57528. d.SelfMulAdd(e.dt, m), p.SelfMulAdd(e.dt, y);
  57529. var v = P.SubVV(p, d, s),
  57530. g = u.distance,
  57531. x = v.Length(),
  57532. b = h * u.strength,
  57533. A = P.MulSV(b * (g - x) / x, v, o);
  57534. m.SelfSub(A), y.SelfAdd(A)
  57535. }
  57536. }
  57537. }, n.prototype.SolveTensile = function(e) {
  57538. var i = n.SolveTensile_s_weightedNormal,
  57539. r = n.SolveTensile_s_s,
  57540. s = n.SolveTensile_s_f;
  57541. if (!this.m_velocityBuffer.data) throw new Error;
  57542. for (var o = this.m_velocityBuffer.data, a = 0; a < this.m_count; a++) this.m_accumulation2Buffer[a] = new P, this.m_accumulation2Buffer[a].SetZero();
  57543. for (var l = 0; l < this.m_contactBuffer.count; l++) {
  57544. if ((v = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_tensileParticle) {
  57545. var h = v.indexA,
  57546. c = v.indexB,
  57547. u = v.weight,
  57548. _ = v.normal,
  57549. f = P.MulSV((1 - u) * u, _, i);
  57550. this.m_accumulation2Buffer[h].SelfSub(f), this.m_accumulation2Buffer[c].SelfAdd(f)
  57551. }
  57552. }
  57553. var d = this.GetCriticalVelocity(e),
  57554. p = this.m_def.surfaceTensionPressureStrength * d,
  57555. m = this.m_def.surfaceTensionNormalStrength * d,
  57556. y = .5 * d;
  57557. for (l = 0; l < this.m_contactBuffer.count; l++) {
  57558. var v;
  57559. if ((v = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_tensileParticle) {
  57560. h = v.indexA, c = v.indexB, u = v.weight, _ = v.normal;
  57561. var x = this.m_weightBuffer[h] + this.m_weightBuffer[c],
  57562. b = P.SubVV(this.m_accumulation2Buffer[c], this.m_accumulation2Buffer[h], r),
  57563. A = g(p * (x - 2) + m * P.DotVV(b, _), y) * u,
  57564. C = P.MulSV(A, _, s);
  57565. o[h].SelfSub(C), o[c].SelfAdd(C)
  57566. }
  57567. }
  57568. }, n.prototype.SolveViscous = function() {
  57569. var e = n.SolveViscous_s_v,
  57570. i = n.SolveViscous_s_f;
  57571. if (!this.m_flagsBuffer.data) throw new Error;
  57572. if (!this.m_positionBuffer.data) throw new Error;
  57573. if (!this.m_velocityBuffer.data) throw new Error;
  57574. for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.viscousStrength, a = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) {
  57575. var h = (m = this.m_bodyContactBuffer.data[l]).index;
  57576. if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_viscousParticle) {
  57577. var c = m.body,
  57578. u = m.weight,
  57579. _ = m.mass,
  57580. f = r[h],
  57581. d = P.SubVV(c.GetLinearVelocityFromWorldPoint(f, P.s_t0), s[h], e),
  57582. p = P.MulSV(o * _ * u, d, i);
  57583. s[h].SelfMulAdd(a, p), c.ApplyLinearImpulse(p.SelfNeg(), f, !0)
  57584. }
  57585. }
  57586. for (l = 0; l < this.m_contactBuffer.count; l++) {
  57587. var m;
  57588. if ((m = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_viscousParticle) {
  57589. h = m.indexA, c = m.indexB, u = m.weight, d = P.SubVV(s[c], s[h], e), p = P.MulSV(o * u, d, i);
  57590. s[h].SelfAdd(p), s[c].SelfSub(p)
  57591. }
  57592. }
  57593. }, n.prototype.SolveRepulsive = function(e) {
  57594. var i = n.SolveRepulsive_s_f;
  57595. if (!this.m_velocityBuffer.data) throw new Error;
  57596. for (var r = this.m_velocityBuffer.data, s = this.m_def.repulsiveStrength * this.GetCriticalVelocity(e), o = 0; o < this.m_contactBuffer.count; o++) {
  57597. var a = this.m_contactBuffer.data[o];
  57598. if (a.flags & t.b2ParticleFlag.b2_repulsiveParticle) {
  57599. var l = a.indexA,
  57600. h = a.indexB;
  57601. if (this.m_groupBuffer[l] !== this.m_groupBuffer[h]) {
  57602. var c = a.weight,
  57603. u = a.normal,
  57604. _ = P.MulSV(s * c, u, i);
  57605. r[l].SelfSub(_), r[h].SelfAdd(_)
  57606. }
  57607. }
  57608. }
  57609. }, n.prototype.SolvePowder = function(e) {
  57610. var i = n.SolvePowder_s_f;
  57611. if (!this.m_flagsBuffer.data) throw new Error;
  57612. if (!this.m_positionBuffer.data) throw new Error;
  57613. if (!this.m_velocityBuffer.data) throw new Error;
  57614. for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, o = this.m_def.powderStrength * this.GetCriticalVelocity(e), a = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) {
  57615. var h = (p = this.m_bodyContactBuffer.data[l]).index;
  57616. if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_powderParticle)
  57617. if ((m = p.weight) > .25) {
  57618. var c = p.body,
  57619. u = p.mass,
  57620. _ = r[h],
  57621. f = p.normal,
  57622. d = P.MulSV(o * u * (m - .25), f, i);
  57623. s[h].SelfMulSub(a, d), c.ApplyLinearImpulse(d, _, !0)
  57624. }
  57625. }
  57626. for (l = 0; l < this.m_contactBuffer.count; l++) {
  57627. var p, m;
  57628. if ((p = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_powderParticle)
  57629. if ((m = p.weight) > .25) {
  57630. h = p.indexA, c = p.indexB, f = p.normal, d = P.MulSV(o * (m - .25), f, i);
  57631. s[h].SelfSub(d), s[c].SelfAdd(d)
  57632. }
  57633. }
  57634. }, n.prototype.SolveSolid = function(t) {
  57635. var e = n.SolveSolid_s_f;
  57636. if (!this.m_velocityBuffer.data) throw new Error;
  57637. var i = this.m_velocityBuffer.data;
  57638. this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer);
  57639. for (var r = t.inv_dt * this.m_def.ejectionStrength, s = 0; s < this.m_contactBuffer.count; s++) {
  57640. var o = this.m_contactBuffer.data[s],
  57641. a = o.indexA,
  57642. l = o.indexB;
  57643. if (this.m_groupBuffer[a] !== this.m_groupBuffer[l]) {
  57644. var h = o.weight,
  57645. c = o.normal,
  57646. u = this.m_depthBuffer[a] + this.m_depthBuffer[l],
  57647. _ = P.MulSV(r * u * h, c, e);
  57648. i[a].SelfSub(_), i[l].SelfAdd(_)
  57649. }
  57650. }
  57651. }, n.prototype.SolveForce = function(t) {
  57652. if (!this.m_velocityBuffer.data) throw new Error;
  57653. for (var e = this.m_velocityBuffer.data, i = t.dt * this.GetParticleInvMass(), n = 0; n < this.m_count; n++) e[n].SelfMulAdd(i, this.m_forceBuffer[n]);
  57654. this.m_hasForce = !1
  57655. }, n.prototype.SolveColorMixing = function() {
  57656. if (!this.m_flagsBuffer.data) throw new Error;
  57657. if (!this.m_colorBuffer.data) throw new Error;
  57658. var e = .5 * this.m_def.colorMixingStrength;
  57659. if (e)
  57660. for (var i = 0; i < this.m_contactBuffer.count; i++) {
  57661. var n = this.m_contactBuffer.data[i],
  57662. r = n.indexA,
  57663. s = n.indexB;
  57664. if (this.m_flagsBuffer.data[r] & this.m_flagsBuffer.data[s] & t.b2ParticleFlag.b2_colorMixingParticle) {
  57665. var o = this.m_colorBuffer.data[r],
  57666. a = this.m_colorBuffer.data[s];
  57667. G.MixColors(o, a, e)
  57668. }
  57669. }
  57670. }, n.prototype.SolveZombie = function() {
  57671. if (!this.m_flagsBuffer.data) throw new Error;
  57672. if (!this.m_positionBuffer.data) throw new Error;
  57673. if (!this.m_velocityBuffer.data) throw new Error;
  57674. for (var e = 0, i = [], n = 0; n < this.m_count; n++) i[n] = u;
  57675. var r = 0;
  57676. for (n = 0; n < this.m_count; n++) {
  57677. var s = this.m_flagsBuffer.data[n];
  57678. if (s & t.b2ParticleFlag.b2_zombieParticle) {
  57679. var o = this.m_world.m_destructionListener;
  57680. if (s & t.b2ParticleFlag.b2_destructionListenerParticle && o && o.SayGoodbyeParticle(this, n), this.m_handleIndexBuffer.data)(a = this.m_handleIndexBuffer.data[n]) && (a.SetIndex(u), this.m_handleIndexBuffer.data[n] = null);
  57681. i[n] = u
  57682. } else {
  57683. if (i[n] = e, n !== e) {
  57684. var a;
  57685. if (this.m_handleIndexBuffer.data)(a = this.m_handleIndexBuffer.data[n]) && a.SetIndex(e), this.m_handleIndexBuffer.data[e] = a;
  57686. this.m_flagsBuffer.data[e] = this.m_flagsBuffer.data[n], this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[e] = this.m_lastBodyContactStepBuffer.data[n]), this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[e] = this.m_bodyContactCountBuffer.data[n]), this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[e] = this.m_consecutiveContactStepsBuffer.data[n]), this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[n]), this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[n]), this.m_groupBuffer[e] = this.m_groupBuffer[n], this.m_hasForce && this.m_forceBuffer[e].Copy(this.m_forceBuffer[n]), this.m_staticPressureBuffer && (this.m_staticPressureBuffer[e] = this.m_staticPressureBuffer[n]), this.m_depthBuffer && (this.m_depthBuffer[e] = this.m_depthBuffer[n]), this.m_colorBuffer.data && this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[n]), this.m_userDataBuffer.data && (this.m_userDataBuffer.data[e] = this.m_userDataBuffer.data[n]), this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[e] = this.m_expirationTimeBuffer.data[n])
  57687. }
  57688. e++, r |= s
  57689. }
  57690. }
  57691. for (var l = function(t) {
  57692. return t.index < 0
  57693. }, h = function(t) {
  57694. return t.indexA < 0 || t.indexB < 0
  57695. }, c = function(t) {
  57696. return t.index < 0
  57697. }, _ = function(t) {
  57698. return t.indexA < 0 || t.indexB < 0
  57699. }, f = function(t) {
  57700. return t.indexA < 0 || t.indexB < 0 || t.indexC < 0
  57701. }, d = 0; d < this.m_proxyBuffer.count; d++) {
  57702. var p = this.m_proxyBuffer.data[d];
  57703. p.index = i[p.index]
  57704. }
  57705. this.m_proxyBuffer.RemoveIf(l);
  57706. for (d = 0; d < this.m_contactBuffer.count; d++) {
  57707. (m = this.m_contactBuffer.data[d]).indexA = i[m.indexA], m.indexB = i[m.indexB]
  57708. }
  57709. this.m_contactBuffer.RemoveIf(h);
  57710. for (d = 0; d < this.m_bodyContactBuffer.count; d++) {
  57711. var m;
  57712. (m = this.m_bodyContactBuffer.data[d]).index = i[m.index]
  57713. }
  57714. this.m_bodyContactBuffer.RemoveIf(c);
  57715. for (d = 0; d < this.m_pairBuffer.count; d++) {
  57716. var y = this.m_pairBuffer.data[d];
  57717. y.indexA = i[y.indexA], y.indexB = i[y.indexB]
  57718. }
  57719. this.m_pairBuffer.RemoveIf(_);
  57720. for (d = 0; d < this.m_triadBuffer.count; d++) {
  57721. var v = this.m_triadBuffer.data[d];
  57722. v.indexA = i[v.indexA], v.indexB = i[v.indexB], v.indexC = i[v.indexC]
  57723. }
  57724. if (this.m_triadBuffer.RemoveIf(f), this.m_indexByExpirationTimeBuffer.data)
  57725. for (var b = 0, A = 0; A < this.m_count; A++) {
  57726. var C = i[this.m_indexByExpirationTimeBuffer.data[A]];
  57727. C !== u && (this.m_indexByExpirationTimeBuffer.data[b++] = C)
  57728. }
  57729. for (var T = this.m_groupList; T; T = T.GetNext()) {
  57730. var S = e,
  57731. w = 0,
  57732. E = !1;
  57733. for (n = T.m_firstIndex; n < T.m_lastIndex; n++) {
  57734. var M = i[n];
  57735. M >= 0 ? (S = g(S, M), w = x(w, M + 1)) : E = !0
  57736. }
  57737. S < w ? (T.m_firstIndex = S, T.m_lastIndex = w, E && T.m_groupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SetGroupFlags(T, T.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth)) : (T.m_firstIndex = 0, T.m_lastIndex = 0, T.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty || this.SetGroupFlags(T, T.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed))
  57738. }
  57739. this.m_count = e, this.m_allParticleFlags = r, this.m_needsUpdateAllParticleFlags = !1;
  57740. for (T = this.m_groupList; T;) {
  57741. var D = T.GetNext();
  57742. T.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed && this.DestroyParticleGroup(T), T = D
  57743. }
  57744. }, n.prototype.SolveLifetimes = function(t) {
  57745. if (!this.m_expirationTimeBuffer.data) throw new Error;
  57746. if (!this.m_indexByExpirationTimeBuffer.data) throw new Error;
  57747. this.m_timeElapsed = this.LifetimeToExpirationTime(t.dt);
  57748. var e = this.GetQuantizedTimeElapsed(),
  57749. i = this.m_expirationTimeBuffer.data,
  57750. n = this.m_indexByExpirationTimeBuffer.data,
  57751. r = this.GetParticleCount();
  57752. if (this.m_expirationTimeBufferRequiresSorting) {
  57753. wn(n, 0, r, (function(t, e) {
  57754. var n = i[t],
  57755. r = i[e],
  57756. s = n <= 0;
  57757. return s === r <= 0 ? n > r : s
  57758. })), this.m_expirationTimeBufferRequiresSorting = !1
  57759. }
  57760. for (var s = r - 1; s >= 0; --s) {
  57761. var o = n[s],
  57762. a = i[o];
  57763. if (e < a || a <= 0) break;
  57764. this.DestroyParticle(o)
  57765. }
  57766. }, n.prototype.RotateBuffer = function(t, e, i) {
  57767. if (t !== e && e !== i) {
  57768. if (!this.m_flagsBuffer.data) throw new Error;
  57769. if (!this.m_positionBuffer.data) throw new Error;
  57770. if (!this.m_velocityBuffer.data) throw new Error;
  57771. if (In(this.m_flagsBuffer.data, t, e, i), this.m_lastBodyContactStepBuffer.data && In(this.m_lastBodyContactStepBuffer.data, t, e, i), this.m_bodyContactCountBuffer.data && In(this.m_bodyContactCountBuffer.data, t, e, i), this.m_consecutiveContactStepsBuffer.data && In(this.m_consecutiveContactStepsBuffer.data, t, e, i), In(this.m_positionBuffer.data, t, e, i), In(this.m_velocityBuffer.data, t, e, i), In(this.m_groupBuffer, t, e, i), this.m_hasForce && In(this.m_forceBuffer, t, e, i), this.m_staticPressureBuffer && In(this.m_staticPressureBuffer, t, e, i), this.m_depthBuffer && In(this.m_depthBuffer, t, e, i), this.m_colorBuffer.data && In(this.m_colorBuffer.data, t, e, i), this.m_userDataBuffer.data && In(this.m_userDataBuffer.data, t, e, i), this.m_handleIndexBuffer.data) {
  57772. In(this.m_handleIndexBuffer.data, t, e, i);
  57773. for (var n = t; n < i; ++n) {
  57774. var r = this.m_handleIndexBuffer.data[n];
  57775. r && r.SetIndex(f(r.GetIndex()))
  57776. }
  57777. }
  57778. if (this.m_expirationTimeBuffer.data) {
  57779. In(this.m_expirationTimeBuffer.data, t, e, i);
  57780. var s = this.GetParticleCount();
  57781. if (!this.m_indexByExpirationTimeBuffer.data) throw new Error;
  57782. var o = this.m_indexByExpirationTimeBuffer.data;
  57783. for (n = 0; n < s; ++n) o[n] = f(o[n])
  57784. }
  57785. for (var a = 0; a < this.m_proxyBuffer.count; a++) {
  57786. var l = this.m_proxyBuffer.data[a];
  57787. l.index = f(l.index)
  57788. }
  57789. for (a = 0; a < this.m_contactBuffer.count; a++) {
  57790. (h = this.m_contactBuffer.data[a]).indexA = f(h.indexA), h.indexB = f(h.indexB)
  57791. }
  57792. for (a = 0; a < this.m_bodyContactBuffer.count; a++) {
  57793. var h;
  57794. (h = this.m_bodyContactBuffer.data[a]).index = f(h.index)
  57795. }
  57796. for (a = 0; a < this.m_pairBuffer.count; a++) {
  57797. var c = this.m_pairBuffer.data[a];
  57798. c.indexA = f(c.indexA), c.indexB = f(c.indexB)
  57799. }
  57800. for (a = 0; a < this.m_triadBuffer.count; a++) {
  57801. var u = this.m_triadBuffer.data[a];
  57802. u.indexA = f(u.indexA), u.indexB = f(u.indexB), u.indexC = f(u.indexC)
  57803. }
  57804. for (var _ = this.m_groupList; _; _ = _.GetNext()) _.m_firstIndex = f(_.m_firstIndex), _.m_lastIndex = f(_.m_lastIndex - 1) + 1
  57805. }
  57806. function f(n) {
  57807. return n < t ? n : n < e ? n + i - e : n < i ? n + t - e : n
  57808. }
  57809. }, n.prototype.GetCriticalVelocity = function(t) {
  57810. return this.m_particleDiameter * t.inv_dt
  57811. }, n.prototype.GetCriticalVelocitySquared = function(t) {
  57812. var e = this.GetCriticalVelocity(t);
  57813. return e * e
  57814. }, n.prototype.GetCriticalPressure = function(t) {
  57815. return this.m_def.density * this.GetCriticalVelocitySquared(t)
  57816. }, n.prototype.GetParticleStride = function() {
  57817. return .75 * this.m_particleDiameter
  57818. }, n.prototype.GetParticleMass = function() {
  57819. var t = this.GetParticleStride();
  57820. return this.m_def.density * t * t
  57821. }, n.prototype.GetParticleInvMass = function() {
  57822. var t = this.m_inverseDiameter * (1 / .75);
  57823. return this.m_inverseDensity * t * t
  57824. }, n.prototype.GetFixtureContactFilter = function() {
  57825. return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null
  57826. }, n.prototype.GetParticleContactFilter = function() {
  57827. return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null
  57828. }, n.prototype.GetFixtureContactListener = function() {
  57829. return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null
  57830. }, n.prototype.GetParticleContactListener = function() {
  57831. return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null
  57832. }, n.prototype.SetUserOverridableBuffer = function(t, e, i) {
  57833. t.data = e, t.userSuppliedCapacity = i
  57834. }, n.prototype.SetGroupFlags = function(e, i) {
  57835. var n = e.m_groupFlags;
  57836. (n ^ i) & t.b2ParticleGroupFlag.b2_solidParticleGroup && (i |= t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth), n & ~i && (this.m_needsUpdateAllGroupFlags = !0), ~this.m_allGroupFlags & i && (i & t.b2ParticleGroupFlag.b2_solidParticleGroup && (this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer)), this.m_allGroupFlags |= i), e.m_groupFlags = i
  57837. }, n.BodyContactCompare = function(t, e) {
  57838. return t.index === e.index ? t.weight > e.weight : t.index < e.index
  57839. }, n.prototype.RemoveSpuriousBodyContacts = function() {
  57840. wn(this.m_bodyContactBuffer.data, 0, this.m_bodyContactBuffer.count, n.BodyContactCompare);
  57841. var t = n.RemoveSpuriousBodyContacts_s_n,
  57842. e = n.RemoveSpuriousBodyContacts_s_pos,
  57843. i = n.RemoveSpuriousBodyContacts_s_normal,
  57844. r = this,
  57845. s = -1,
  57846. o = 0;
  57847. this.m_bodyContactBuffer.count = Mn(this.m_bodyContactBuffer.data, (function(n) {
  57848. if (n.index !== s && (o = 0, s = n.index), o++ > 3) return !0;
  57849. var a = t.Copy(n.normal);
  57850. if (a.SelfMul(r.m_particleDiameter * (1 - n.weight)), !r.m_positionBuffer.data) throw new Error;
  57851. var h = P.AddVV(r.m_positionBuffer.data[n.index], a, e);
  57852. if (!n.fixture.TestPoint(h)) {
  57853. for (var c = n.fixture.GetShape().GetChildCount(), u = 0; u < c; u++) {
  57854. var _ = i;
  57855. if (n.fixture.ComputeDistance(h, _, u) < l) return !1
  57856. }
  57857. return !0
  57858. }
  57859. return !1
  57860. }), this.m_bodyContactBuffer.count)
  57861. }, n.prototype.DetectStuckParticle = function(t) {
  57862. if (!(this.m_stuckThreshold <= 0)) {
  57863. if (!this.m_bodyContactCountBuffer.data) throw new Error;
  57864. if (!this.m_consecutiveContactStepsBuffer.data) throw new Error;
  57865. if (!this.m_lastBodyContactStepBuffer.data) throw new Error;
  57866. ++this.m_bodyContactCountBuffer.data[t], 2 === this.m_bodyContactCountBuffer.data[t] && (++this.m_consecutiveContactStepsBuffer.data[t], this.m_consecutiveContactStepsBuffer.data[t] > this.m_stuckThreshold && (this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()] = t)), this.m_lastBodyContactStepBuffer.data[t] = this.m_timestamp
  57867. }
  57868. }, n.prototype.ValidateParticleIndex = function(t) {
  57869. return t >= 0 && t < this.GetParticleCount() && t !== u
  57870. }, n.prototype.GetQuantizedTimeElapsed = function() {
  57871. return Math.floor(this.m_timeElapsed / 4294967296)
  57872. }, n.prototype.LifetimeToExpirationTime = function(t) {
  57873. return this.m_timeElapsed + Math.floor(t / this.m_def.lifetimeGranularity * 4294967296)
  57874. }, n.prototype.ForceCanBeApplied = function(e) {
  57875. return !(e & t.b2ParticleFlag.b2_wallParticle)
  57876. }, n.prototype.PrepareForceBuffer = function() {
  57877. if (!this.m_hasForce) {
  57878. for (var t = 0; t < this.m_count; t++) this.m_forceBuffer[t].SetZero();
  57879. this.m_hasForce = !0
  57880. }
  57881. }, n.prototype.IsRigidGroup = function(e) {
  57882. return null !== e && 0 != (e.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup)
  57883. }, n.prototype.GetLinearVelocity = function(t, e, i, n) {
  57884. if (t && this.IsRigidGroup(t)) return t.GetLinearVelocityFromWorldPoint(i, n);
  57885. if (!this.m_velocityBuffer.data) throw new Error;
  57886. return n.Copy(this.m_velocityBuffer.data[e])
  57887. }, n.prototype.InitDampingParameter = function(t, e, i, n, r, s, o, a) {
  57888. t[0] = n > 0 ? 1 / n : 0, e[0] = r > 0 ? 1 / r : 0, i[0] = P.CrossVV(P.SubVV(o, s, P.s_t0), a)
  57889. }, n.prototype.InitDampingParameterWithRigidGroupOrParticle = function(e, i, n, r, s, o, a, l) {
  57890. if (s && r) this.InitDampingParameter(e, i, n, s.GetMass(), s.GetInertia(), s.GetCenter(), a, l);
  57891. else {
  57892. if (!this.m_flagsBuffer.data) throw new Error;
  57893. var h = this.m_flagsBuffer.data[o];
  57894. this.InitDampingParameter(e, i, n, h & t.b2ParticleFlag.b2_wallParticle ? 0 : this.GetParticleMass(), 0, a, a, l)
  57895. }
  57896. }, n.prototype.ComputeDampingImpulse = function(t, e, i, n, r, s, o) {
  57897. var a = t + e * i * i + n + r * s * s;
  57898. return a > 0 ? o / a : 0
  57899. }, n.prototype.ApplyDamping = function(t, e, i, n, r, s, o, a) {
  57900. if (r && n) r.m_linearVelocity.SelfMulAdd(o * t, a), r.m_angularVelocity += o * i * e;
  57901. else {
  57902. if (!this.m_velocityBuffer.data) throw new Error;
  57903. this.m_velocityBuffer.data[s].SelfMulAdd(o * t, a)
  57904. }
  57905. }, n.xTruncBits = 12, n.yTruncBits = 12, n.tagBits = 32, n.yOffset = 1 << n.yTruncBits - 1, n.yShift = n.tagBits - n.yTruncBits, n.xShift = n.tagBits - n.yTruncBits - n.xTruncBits, n.xScale = 1 << n.xShift, n.xOffset = n.xScale * (1 << n.xTruncBits - 1), n.yMask = (1 << n.yTruncBits) - 1 << n.yShift, n.xMask = ~n.yMask, n.DestroyParticlesInShape_s_aabb = new wt, n.CreateParticleGroup_s_transform = new V, n.ComputeCollisionEnergy_s_v = new P, n.QueryShapeAABB_s_aabb = new wt, n.QueryPointAABB_s_aabb = new wt, n.RayCast_s_aabb = new wt, n.RayCast_s_p = new P, n.RayCast_s_v = new P, n.RayCast_s_n = new P, n.RayCast_s_point = new P, n.k_pairFlags = t.b2ParticleFlag.b2_springParticle, n.k_triadFlags = t.b2ParticleFlag.b2_elasticParticle, n.k_noPressureFlags = t.b2ParticleFlag.b2_powderParticle | t.b2ParticleFlag.b2_tensileParticle, n.k_extraDampingFlags = t.b2ParticleFlag.b2_staticPressureParticle, n.k_barrierWallFlags = t.b2ParticleFlag.b2_barrierParticle | t.b2ParticleFlag.b2_wallParticle, n.CreateParticlesStrokeShapeForGroup_s_edge = new ii, n.CreateParticlesStrokeShapeForGroup_s_d = new P, n.CreateParticlesStrokeShapeForGroup_s_p = new P, n.CreateParticlesFillShapeForGroup_s_aabb = new wt, n.CreateParticlesFillShapeForGroup_s_p = new P, n.UpdatePairsAndTriads_s_dab = new P, n.UpdatePairsAndTriads_s_dbc = new P, n.UpdatePairsAndTriads_s_dca = new P, n.AddContact_s_d = new P, n.UpdateBodyContacts_s_aabb = new wt, n.Solve_s_subStep = new on, n.SolveCollision_s_aabb = new wt, n.SolveGravity_s_gravity = new P, n.SolveBarrier_s_aabb = new wt, n.SolveBarrier_s_va = new P, n.SolveBarrier_s_vb = new P, n.SolveBarrier_s_pba = new P, n.SolveBarrier_s_vba = new P, n.SolveBarrier_s_vc = new P, n.SolveBarrier_s_pca = new P, n.SolveBarrier_s_vca = new P, n.SolveBarrier_s_qba = new P, n.SolveBarrier_s_qca = new P, n.SolveBarrier_s_dv = new P, n.SolveBarrier_s_f = new P, n.SolvePressure_s_f = new P, n.SolveDamping_s_v = new P, n.SolveDamping_s_f = new P, n.SolveRigidDamping_s_t0 = new P, n.SolveRigidDamping_s_t1 = new P, n.SolveRigidDamping_s_p = new P, n.SolveRigidDamping_s_v = new P, n.SolveExtraDamping_s_v = new P, n.SolveExtraDamping_s_f = new P, n.SolveRigid_s_position = new P, n.SolveRigid_s_rotation = new N, n.SolveRigid_s_transform = new V, n.SolveRigid_s_velocityTransform = new V, n.SolveElastic_s_pa = new P, n.SolveElastic_s_pb = new P, n.SolveElastic_s_pc = new P, n.SolveElastic_s_r = new N, n.SolveElastic_s_t0 = new P, n.SolveSpring_s_pa = new P, n.SolveSpring_s_pb = new P, n.SolveSpring_s_d = new P, n.SolveSpring_s_f = new P, n.SolveTensile_s_weightedNormal = new P, n.SolveTensile_s_s = new P, n.SolveTensile_s_f = new P, n.SolveViscous_s_v = new P, n.SolveViscous_s_f = new P, n.SolveRepulsive_s_f = new P, n.SolvePowder_s_f = new P, n.SolveSolid_s_f = new P, n.RemoveSpuriousBodyContacts_s_n = new P, n.RemoveSpuriousBodyContacts_s_pos = new P, n.RemoveSpuriousBodyContacts_s_normal = new P, n
  57906. })(), (function(e) {
  57907. var n = (function() {
  57908. return function() {
  57909. this.data = null, this.userSuppliedCapacity = 0
  57910. }
  57911. })();
  57912. e.UserOverridableBuffer = n;
  57913. var r = (function() {
  57914. function t() {
  57915. this.index = u, this.tag = 0
  57916. }
  57917. return t.CompareProxyProxy = function(t, e) {
  57918. return t.tag < e.tag
  57919. }, t.CompareTagProxy = function(t, e) {
  57920. return t < e.tag
  57921. }, t.CompareProxyTag = function(t, e) {
  57922. return t.tag < e
  57923. }, t
  57924. })();
  57925. e.Proxy = r;
  57926. var s = (function() {
  57927. function t(t, i, n, r, s) {
  57928. this.m_system = t, this.m_xLower = (i & e.xMask) >>> 0, this.m_xUpper = (n & e.xMask) >>> 0, this.m_yLower = (i & e.yMask) >>> 0, this.m_yUpper = (n & e.yMask) >>> 0, this.m_first = r, this.m_last = s
  57929. }
  57930. return t.prototype.GetNext = function() {
  57931. for (; this.m_first < this.m_last;) {
  57932. var t = (this.m_system.m_proxyBuffer.data[this.m_first].tag & e.xMask) >>> 0;
  57933. if (t >= this.m_xLower && t <= this.m_xUpper) return this.m_system.m_proxyBuffer.data[this.m_first++].index;
  57934. this.m_first++
  57935. }
  57936. return u
  57937. }, t
  57938. })();
  57939. e.InsideBoundsEnumerator = s;
  57940. var o = (function() {
  57941. return function() {
  57942. this.next = null, this.count = 0, this.index = 0
  57943. }
  57944. })();
  57945. e.ParticleListNode = o;
  57946. var a = (function() {
  57947. function t() {}
  57948. return t.prototype.Allocate = function(t, e) {
  57949. return e
  57950. }, t.prototype.Clear = function() {}, t.prototype.GetCount = function() {
  57951. return 0
  57952. }, t.prototype.Invalidate = function(t) {}, t.prototype.GetValidBuffer = function() {
  57953. return []
  57954. }, t.prototype.GetBuffer = function() {
  57955. return []
  57956. }, t.prototype.SetCount = function(t) {}, t
  57957. })();
  57958. e.FixedSetAllocator = a;
  57959. var h = (function() {
  57960. return function(t, e) {
  57961. this.second = u, this.first = t, this.second = e
  57962. }
  57963. })();
  57964. e.FixtureParticle = h;
  57965. var c = (function(t) {
  57966. function e() {
  57967. return null !== t && t.apply(this, arguments) || this
  57968. }
  57969. return $e(e, t), e.prototype.Initialize = function(t, e) {}, e.prototype.Find = function(t) {
  57970. return u
  57971. }, e
  57972. })(e.FixedSetAllocator);
  57973. e.FixtureParticleSet = c;
  57974. var _ = (function() {
  57975. return function(t, e) {
  57976. this.first = u, this.second = u, this.first = t, this.second = e
  57977. }
  57978. })();
  57979. e.ParticlePair = _;
  57980. var f = (function(t) {
  57981. function e() {
  57982. return null !== t && t.apply(this, arguments) || this
  57983. }
  57984. return $e(e, t), e.prototype.Initialize = function(t, e) {}, e.prototype.Find = function(t) {
  57985. return u
  57986. }, e
  57987. })(e.FixedSetAllocator);
  57988. e.b2ParticlePairSet = f;
  57989. var d = (function() {
  57990. function t() {}
  57991. return t.prototype.IsNecessary = function(t) {
  57992. return !0
  57993. }, t.prototype.ShouldCreatePair = function(t, e) {
  57994. return !0
  57995. }, t.prototype.ShouldCreateTriad = function(t, e, i) {
  57996. return !0
  57997. }, t
  57998. })();
  57999. e.ConnectionFilter = d;
  58000. var p = (function(t) {
  58001. function e(e, i, n, r) {
  58002. var s = t.call(this) || this;
  58003. return s.m_callDestructionListener = !1, s.m_destroyed = 0, s.m_system = e, s.m_shape = i, s.m_xf = n, s.m_callDestructionListener = r, s.m_destroyed = 0, s
  58004. }
  58005. return $e(e, t), e.prototype.ReportFixture = function(t) {
  58006. return !1
  58007. }, e.prototype.ReportParticle = function(t, e) {
  58008. if (t !== this.m_system) return !1;
  58009. if (!this.m_system.m_positionBuffer.data) throw new Error;
  58010. return this.m_shape.TestPoint(this.m_xf, this.m_system.m_positionBuffer.data[e]) && (this.m_system.DestroyParticle(e, this.m_callDestructionListener), this.m_destroyed++), !0
  58011. }, e.prototype.Destroyed = function() {
  58012. return this.m_destroyed
  58013. }, e
  58014. })(en);
  58015. e.DestroyParticlesInShapeCallback = p;
  58016. var m = (function(t) {
  58017. function e(e) {
  58018. var i = t.call(this) || this;
  58019. return i.m_threshold = 0, i.m_threshold = e, i
  58020. }
  58021. return $e(e, t), e.prototype.ShouldCreatePair = function(t, e) {
  58022. return t < this.m_threshold && this.m_threshold <= e || e < this.m_threshold && this.m_threshold <= t
  58023. }, e.prototype.ShouldCreateTriad = function(t, e, i) {
  58024. return (t < this.m_threshold || e < this.m_threshold || i < this.m_threshold) && (this.m_threshold <= t || this.m_threshold <= e || this.m_threshold <= i)
  58025. }, e
  58026. })(e.ConnectionFilter);
  58027. e.JoinParticleGroupsFilter = m;
  58028. var y = (function(e) {
  58029. function n(i, n) {
  58030. void 0 === n && (n = i.length);
  58031. var r = e.call(this, t.b2ShapeType.e_unknown, 0) || this;
  58032. return r.m_shapeCount = 0, r.m_shapes = i, r.m_shapeCount = n, r
  58033. }
  58034. return $e(n, e), n.prototype.Clone = function() {
  58035. throw new Error
  58036. }, n.prototype.GetChildCount = function() {
  58037. return 1
  58038. }, n.prototype.TestPoint = function(t, e) {
  58039. for (var i = 0; i < this.m_shapeCount; i++)
  58040. if (this.m_shapes[i].TestPoint(t, e)) return !0;
  58041. return !1
  58042. }, n.prototype.ComputeDistance = function(t, e, i, n) {
  58043. return 0
  58044. }, n.prototype.RayCast = function(t, e, i, n) {
  58045. return !1
  58046. }, n.prototype.ComputeAABB = function(t, e, n) {
  58047. var r = new wt;
  58048. t.lowerBound.x = +i, t.lowerBound.y = +i, t.upperBound.x = -i, t.upperBound.y = -i;
  58049. for (var s = 0; s < this.m_shapeCount; s++)
  58050. for (var o = this.m_shapes[s].GetChildCount(), a = 0; a < o; a++) {
  58051. var l = r;
  58052. this.m_shapes[s].ComputeAABB(l, e, a), t.Combine1(l)
  58053. }
  58054. }, n.prototype.ComputeMass = function(t, e) {}, n.prototype.SetupDistanceProxy = function(t, e) {}, n.prototype.ComputeSubmergedArea = function(t, e, i, n) {
  58055. return 0
  58056. }, n.prototype.Dump = function(t) {}, n
  58057. })(Ke);
  58058. e.CompositeShape = y;
  58059. var v = (function(e) {
  58060. function i(t) {
  58061. var i = e.call(this) || this;
  58062. return i.m_flagsBuffer = t, i
  58063. }
  58064. return $e(i, e), i.prototype.IsNecessary = function(e) {
  58065. if (!this.m_flagsBuffer.data) throw new Error;
  58066. return 0 != (this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_reactiveParticle)
  58067. }, i
  58068. })(e.ConnectionFilter);
  58069. e.ReactiveFilter = v;
  58070. var g = (function(i) {
  58071. function n(t, e) {
  58072. var n = i.call(this, t) || this;
  58073. return n.m_contactFilter = e, n
  58074. }
  58075. return $e(n, i), n.prototype.ShouldCollideFixtureParticle = function(e, i, n) {
  58076. if (this.m_contactFilter && this.m_system.GetFlagsBuffer()[n] & t.b2ParticleFlag.b2_fixtureContactFilterParticle) return this.m_contactFilter.ShouldCollideFixtureParticle(e, this.m_system, n);
  58077. return !0
  58078. }, n.prototype.ReportFixtureAndParticle = function(i, n, r) {
  58079. var s = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_n,
  58080. o = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_rp;
  58081. if (!this.m_system.m_flagsBuffer.data) throw new Error;
  58082. if (!this.m_system.m_positionBuffer.data) throw new Error;
  58083. var a = this.m_system.m_positionBuffer.data[r],
  58084. l = s,
  58085. h = i.ComputeDistance(a, l, n);
  58086. if (h < this.m_system.m_particleDiameter && this.ShouldCollideFixtureParticle(i, this.m_system, r)) {
  58087. var c = i.GetBody(),
  58088. u = c.GetWorldCenter(),
  58089. _ = c.GetMass(),
  58090. f = c.GetInertia() - _ * c.GetLocalCenter().LengthSquared(),
  58091. d = _ > 0 ? 1 / _ : 0,
  58092. p = f > 0 ? 1 / f : 0,
  58093. m = this.m_system.m_flagsBuffer.data[r] & t.b2ParticleFlag.b2_wallParticle ? 0 : this.m_system.GetParticleInvMass(),
  58094. y = P.SubVV(a, u, o),
  58095. v = P.CrossVV(y, l),
  58096. g = m + d + p * v * v,
  58097. x = this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];
  58098. x.index = r, x.body = c, x.fixture = i, x.weight = 1 - h * this.m_system.m_inverseDiameter, x.normal.Copy(l.SelfNeg()), x.mass = g > 0 ? 1 / g : 0, this.m_system.DetectStuckParticle(r)
  58099. }
  58100. }, n.ReportFixtureAndParticle_s_n = new P, n.ReportFixtureAndParticle_s_rp = new P, n
  58101. })(On);
  58102. e.UpdateBodyContactsCallback = g;
  58103. var x = (function(i) {
  58104. function n(t, e) {
  58105. var n = i.call(this, t) || this;
  58106. return n.m_step = e, n
  58107. }
  58108. return $e(n, i), n.prototype.ReportFixtureAndParticle = function(i, n, r) {
  58109. var s = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p1,
  58110. o = e.SolveCollisionCallback.ReportFixtureAndParticle_s_output,
  58111. a = e.SolveCollisionCallback.ReportFixtureAndParticle_s_input,
  58112. h = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p,
  58113. c = e.SolveCollisionCallback.ReportFixtureAndParticle_s_v,
  58114. u = e.SolveCollisionCallback.ReportFixtureAndParticle_s_f,
  58115. _ = i.GetBody();
  58116. if (!this.m_system.m_positionBuffer.data) throw new Error;
  58117. if (!this.m_system.m_velocityBuffer.data) throw new Error;
  58118. var f = this.m_system.m_positionBuffer.data[r],
  58119. d = this.m_system.m_velocityBuffer.data[r],
  58120. p = o,
  58121. m = a;
  58122. if (0 === this.m_system.m_iterationIndex) {
  58123. var y = V.MulTXV(_.m_xf0, f, s);
  58124. i.GetShape().GetType() === t.b2ShapeType.e_circleShape && (y.SelfSub(_.GetLocalCenter()), N.MulRV(_.m_xf0.q, y, y), N.MulTRV(_.m_xf.q, y, y), y.SelfAdd(_.GetLocalCenter())), V.MulXV(_.m_xf, y, m.p1)
  58125. } else m.p1.Copy(f);
  58126. if (P.AddVMulSV(f, this.m_step.dt, d, m.p2), m.maxFraction = 1, i.RayCast(p, m, n)) {
  58127. var v = p.normal,
  58128. g = h;
  58129. g.x = (1 - p.fraction) * m.p1.x + p.fraction * m.p2.x + l * v.x, g.y = (1 - p.fraction) * m.p1.y + p.fraction * m.p2.y + l * v.y;
  58130. var x = c;
  58131. x.x = this.m_step.inv_dt * (g.x - f.x), x.y = this.m_step.inv_dt * (g.y - f.y), this.m_system.m_velocityBuffer.data[r].Copy(x);
  58132. var b = u;
  58133. b.x = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.x - x.x), b.y = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.y - x.y), this.m_system.ParticleApplyForce(r, b)
  58134. }
  58135. }, n.prototype.ReportParticle = function(t, e) {
  58136. return !1
  58137. }, n.ReportFixtureAndParticle_s_p1 = new P, n.ReportFixtureAndParticle_s_output = new St, n.ReportFixtureAndParticle_s_input = new Tt, n.ReportFixtureAndParticle_s_p = new P, n.ReportFixtureAndParticle_s_v = new P, n.ReportFixtureAndParticle_s_f = new P, n
  58138. })(On);
  58139. e.SolveCollisionCallback = x
  58140. })(t.b2ParticleSystem || (t.b2ParticleSystem = {}));
  58141. var Gn = (function() {
  58142. function e(t) {
  58143. this.m_newFixture = !1, this.m_locked = !1, this.m_clearForces = !0, this.m_contactManager = new rn, this.m_bodyList = null, this.m_jointList = null, this.m_particleSystemList = null, this.m_bodyCount = 0, this.m_jointCount = 0, this.m_gravity = new P, this.m_allowSleep = !0, this.m_destructionListener = null, this.m_debugDraw = null, this.m_inv_dt0 = 0, this.m_warmStarting = !0, this.m_continuousPhysics = !0, this.m_subStepping = !1, this.m_stepComplete = !0, this.m_profile = new sn, this.m_island = new mn, this.s_stack = [], this.m_controllerList = null, this.m_controllerCount = 0, this.m_gravity.Copy(t)
  58144. }
  58145. return e.prototype.SetDestructionListener = function(t) {
  58146. this.m_destructionListener = t
  58147. }, e.prototype.SetContactFilter = function(t) {
  58148. this.m_contactManager.m_contactFilter = t
  58149. }, e.prototype.SetContactListener = function(t) {
  58150. this.m_contactManager.m_contactListener = t
  58151. }, e.prototype.SetDebugDraw = function(t) {
  58152. this.m_debugDraw = t
  58153. }, e.prototype.CreateBody = function(t) {
  58154. if (void 0 === t && (t = {}), this.IsLocked()) throw new Error;
  58155. var e = new hi(t, this);
  58156. return e.m_prev = null, e.m_next = this.m_bodyList, this.m_bodyList && (this.m_bodyList.m_prev = e), this.m_bodyList = e, ++this.m_bodyCount, e
  58157. }, e.prototype.DestroyBody = function(t) {
  58158. if (this.IsLocked()) throw new Error;
  58159. for (var e = t.m_jointList; e;) {
  58160. var i = e;
  58161. e = e.next, this.m_destructionListener && this.m_destructionListener.SayGoodbyeJoint(i.joint), this.DestroyJoint(i.joint), t.m_jointList = e
  58162. }
  58163. t.m_jointList = null;
  58164. for (var n = t.m_controllerList; n;) {
  58165. var r = n;
  58166. n = n.nextController, r.controller.RemoveBody(t)
  58167. }
  58168. for (var s = t.m_contactList; s;) {
  58169. var o = s;
  58170. s = s.next, this.m_contactManager.Destroy(o.contact)
  58171. }
  58172. t.m_contactList = null;
  58173. for (var a = t.m_fixtureList; a;) {
  58174. var l = a;
  58175. a = a.m_next, this.m_destructionListener && this.m_destructionListener.SayGoodbyeFixture(l), l.DestroyProxies(), l.Destroy(), t.m_fixtureList = a, t.m_fixtureCount -= 1
  58176. }
  58177. t.m_fixtureList = null, t.m_fixtureCount = 0, t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_bodyList && (this.m_bodyList = t.m_next), --this.m_bodyCount
  58178. }, e._Joint_Create = function(e, i) {
  58179. switch (e.type) {
  58180. case t.b2JointType.e_distanceJoint:
  58181. return new pi(e);
  58182. case t.b2JointType.e_mouseJoint:
  58183. return new Si(e);
  58184. case t.b2JointType.e_prismaticJoint:
  58185. return new Ei(e);
  58186. case t.b2JointType.e_revoluteJoint:
  58187. return new Ii(e);
  58188. case t.b2JointType.e_pulleyJoint:
  58189. return new Di(e);
  58190. case t.b2JointType.e_gearJoint:
  58191. return new bi(e);
  58192. case t.b2JointType.e_wheelJoint:
  58193. return new Ni(e);
  58194. case t.b2JointType.e_weldJoint:
  58195. return new Li(e);
  58196. case t.b2JointType.e_frictionJoint:
  58197. return new gi(e);
  58198. case t.b2JointType.e_ropeJoint:
  58199. return new Ri(e);
  58200. case t.b2JointType.e_motorJoint:
  58201. return new Ci(e);
  58202. case t.b2JointType.e_areaJoint:
  58203. return new yi(e)
  58204. }
  58205. throw new Error
  58206. }, e._Joint_Destroy = function(t, e) {}, e.prototype.CreateJoint = function(t) {
  58207. if (this.IsLocked()) throw new Error;
  58208. var i = e._Joint_Create(t, null);
  58209. i.m_prev = null, i.m_next = this.m_jointList, this.m_jointList && (this.m_jointList.m_prev = i), this.m_jointList = i, ++this.m_jointCount, i.m_edgeA.prev = null, i.m_edgeA.next = i.m_bodyA.m_jointList, i.m_bodyA.m_jointList && (i.m_bodyA.m_jointList.prev = i.m_edgeA), i.m_bodyA.m_jointList = i.m_edgeA, i.m_edgeB.prev = null, i.m_edgeB.next = i.m_bodyB.m_jointList, i.m_bodyB.m_jointList && (i.m_bodyB.m_jointList.prev = i.m_edgeB), i.m_bodyB.m_jointList = i.m_edgeB;
  58210. var n = t.bodyA,
  58211. r = t.bodyB;
  58212. if (!t.collideConnected)
  58213. for (var s = r.GetContactList(); s;) s.other === n && s.contact.FlagForFiltering(), s = s.next;
  58214. return i
  58215. }, e.prototype.DestroyJoint = function(t) {
  58216. if (this.IsLocked()) throw new Error;
  58217. var i = t.m_collideConnected;
  58218. t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_jointList && (this.m_jointList = t.m_next);
  58219. var n = t.m_bodyA,
  58220. r = t.m_bodyB;
  58221. if (n.SetAwake(!0), r.SetAwake(!0), t.m_edgeA.prev && (t.m_edgeA.prev.next = t.m_edgeA.next), t.m_edgeA.next && (t.m_edgeA.next.prev = t.m_edgeA.prev), t.m_edgeA === n.m_jointList && (n.m_jointList = t.m_edgeA.next), t.m_edgeA.prev = null, t.m_edgeA.next = null, t.m_edgeB.prev && (t.m_edgeB.prev.next = t.m_edgeB.next), t.m_edgeB.next && (t.m_edgeB.next.prev = t.m_edgeB.prev), t.m_edgeB === r.m_jointList && (r.m_jointList = t.m_edgeB.next), t.m_edgeB.prev = null, t.m_edgeB.next = null, e._Joint_Destroy(t, null), --this.m_jointCount, !i)
  58222. for (var s = r.GetContactList(); s;) s.other === n && s.contact.FlagForFiltering(), s = s.next
  58223. }, e.prototype.CreateParticleSystem = function(e) {
  58224. if (this.IsLocked()) throw new Error;
  58225. var i = new t.b2ParticleSystem(e, this);
  58226. return i.m_prev = null, i.m_next = this.m_particleSystemList, this.m_particleSystemList && (this.m_particleSystemList.m_prev = i), this.m_particleSystemList = i, i
  58227. }, e.prototype.DestroyParticleSystem = function(t) {
  58228. if (this.IsLocked()) throw new Error;
  58229. t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), t === this.m_particleSystemList && (this.m_particleSystemList = t.m_next)
  58230. }, e.prototype.CalculateReasonableParticleIterations = function(t) {
  58231. if (null === this.m_particleSystemList) return 1;
  58232. return vn(this.m_gravity.Length(), (function(t) {
  58233. for (var e = i, n = t.GetParticleSystemList(); null !== n; n = n.m_next) e = g(e, n.GetRadius());
  58234. return e
  58235. })(this), t)
  58236. }, e.prototype.Step = function(t, i, n, r) {
  58237. void 0 === r && (r = this.CalculateReasonableParticleIterations(t));
  58238. var s = e.Step_s_stepTimer.Reset();
  58239. this.m_newFixture && (this.m_contactManager.FindNewContacts(), this.m_newFixture = !1), this.m_locked = !0;
  58240. var o = e.Step_s_step;
  58241. o.dt = t, o.velocityIterations = i, o.positionIterations = n, o.particleIterations = r, o.inv_dt = t > 0 ? 1 / t : 0, o.dtRatio = this.m_inv_dt0 * t, o.warmStarting = this.m_warmStarting;
  58242. var a = e.Step_s_timer.Reset();
  58243. if (this.m_contactManager.Collide(), this.m_profile.collide = a.GetMilliseconds(), this.m_stepComplete && o.dt > 0) {
  58244. for (var l = e.Step_s_timer.Reset(), h = this.m_particleSystemList; h; h = h.m_next) h.Solve(o);
  58245. this.Solve(o), this.m_profile.solve = l.GetMilliseconds()
  58246. }
  58247. if (this.m_continuousPhysics && o.dt > 0) {
  58248. var c = e.Step_s_timer.Reset();
  58249. this.SolveTOI(o), this.m_profile.solveTOI = c.GetMilliseconds()
  58250. }
  58251. o.dt > 0 && (this.m_inv_dt0 = o.inv_dt), this.m_clearForces && this.ClearForces(), this.m_locked = !1, this.m_profile.step = s.GetMilliseconds()
  58252. }, e.prototype.ClearForces = function() {
  58253. for (var t = this.m_bodyList; t; t = t.m_next) t.m_force.SetZero(), t.m_torque = 0
  58254. }, e.prototype.DrawParticleSystem = function(t) {
  58255. if (null !== this.m_debugDraw) {
  58256. var e = t.GetParticleCount();
  58257. if (e) {
  58258. var i = t.GetRadius(),
  58259. n = t.GetPositionBuffer();
  58260. if (t.m_colorBuffer.data) {
  58261. var r = t.GetColorBuffer();
  58262. this.m_debugDraw.DrawParticles(n, i, r, e)
  58263. } else this.m_debugDraw.DrawParticles(n, i, null, e)
  58264. }
  58265. }
  58266. }, e.prototype.DrawDebugData = function() {
  58267. if (null !== this.m_debugDraw) {
  58268. var i = this.m_debugDraw.GetFlags(),
  58269. n = e.DrawDebugData_s_color.SetRGB(0, 0, 0);
  58270. if (i & t.b2DrawFlags.e_shapeBit)
  58271. for (var r = this.m_bodyList; r; r = r.m_next) {
  58272. var s = r.m_xf;
  58273. this.m_debugDraw.PushTransform(s);
  58274. for (var o = r.GetFixtureList(); o; o = o.m_next) r.IsActive() ? r.GetType() === t.b2BodyType.b2_staticBody ? (n.SetRGB(.5, .9, .5), this.DrawShape(o, n)) : r.GetType() === t.b2BodyType.b2_kinematicBody ? (n.SetRGB(.5, .5, .9), this.DrawShape(o, n)) : r.IsAwake() ? (n.SetRGB(.9, .7, .7), this.DrawShape(o, n)) : (n.SetRGB(.6, .6, .6), this.DrawShape(o, n)) : (n.SetRGB(.5, .5, .3), this.DrawShape(o, n));
  58275. this.m_debugDraw.PopTransform(s)
  58276. }
  58277. if (i & t.b2DrawFlags.e_particleBit)
  58278. for (var a = this.m_particleSystemList; a; a = a.m_next) this.DrawParticleSystem(a);
  58279. if (i & t.b2DrawFlags.e_jointBit)
  58280. for (var l = this.m_jointList; l; l = l.m_next) this.DrawJoint(l);
  58281. if (i & t.b2DrawFlags.e_aabbBit) {
  58282. n.SetRGB(.9, .3, .9);
  58283. var h = e.DrawDebugData_s_vs;
  58284. for (r = this.m_bodyList; r; r = r.m_next)
  58285. if (r.IsActive())
  58286. for (o = r.GetFixtureList(); o; o = o.m_next)
  58287. for (var c = 0; c < o.m_proxyCount; ++c) {
  58288. var u = o.m_proxies[c].treeNode.aabb;
  58289. h[0].Set(u.lowerBound.x, u.lowerBound.y), h[1].Set(u.upperBound.x, u.lowerBound.y), h[2].Set(u.upperBound.x, u.upperBound.y), h[3].Set(u.lowerBound.x, u.upperBound.y), this.m_debugDraw.DrawPolygon(h, 4, n)
  58290. }
  58291. }
  58292. if (i & t.b2DrawFlags.e_centerOfMassBit)
  58293. for (r = this.m_bodyList; r; r = r.m_next) {
  58294. (s = e.DrawDebugData_s_xf).q.Copy(r.m_xf.q), s.p.Copy(r.GetWorldCenter()), this.m_debugDraw.DrawTransform(s)
  58295. }
  58296. if (i & t.b2DrawFlags.e_controllerBit)
  58297. for (var _ = this.m_controllerList; _; _ = _.m_next) _.Draw(this.m_debugDraw)
  58298. }
  58299. }, e.prototype.QueryAABB = function(t, e, i) {
  58300. if (this.m_contactManager.m_broadPhase.Query(e, (function(e) {
  58301. var n = e.userData.fixture;
  58302. return t ? t.ReportFixture(n) : !i || i(n)
  58303. })), t instanceof en)
  58304. for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryAABB(t, e)
  58305. }, e.prototype.QueryAllAABB = function(t, e) {
  58306. return void 0 === e && (e = []), this.QueryAABB(null, t, (function(t) {
  58307. return e.push(t), !0
  58308. })), e
  58309. }, e.prototype.QueryPointAABB = function(t, e, i) {
  58310. if (this.m_contactManager.m_broadPhase.QueryPoint(e, (function(e) {
  58311. var n = e.userData.fixture;
  58312. return t ? t.ReportFixture(n) : !i || i(n)
  58313. })), t instanceof en)
  58314. for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e)
  58315. }, e.prototype.QueryAllPointAABB = function(t, e) {
  58316. return void 0 === e && (e = []), this.QueryPointAABB(null, t, (function(t) {
  58317. return e.push(t), !0
  58318. })), e
  58319. }, e.prototype.QueryFixtureShape = function(t, i, n, r, s) {
  58320. var o = e.QueryFixtureShape_s_aabb;
  58321. if (i.ComputeAABB(o, r, n), this.m_contactManager.m_broadPhase.Query(o, (function(e) {
  58322. var o = e.userData,
  58323. a = o.fixture;
  58324. if (Pt(i, n, a.GetShape(), o.childIndex, r, a.GetBody().GetTransform())) {
  58325. if (t) return t.ReportFixture(a);
  58326. if (s) return s(a)
  58327. }
  58328. return !0
  58329. })), t instanceof en)
  58330. for (var a = this.m_particleSystemList; a; a = a.m_next) t.ShouldQueryParticleSystem(a) && a.QueryAABB(t, o)
  58331. }, e.prototype.QueryAllFixtureShape = function(t, e, i, n) {
  58332. return void 0 === n && (n = []), this.QueryFixtureShape(null, t, e, i, (function(t) {
  58333. return n.push(t), !0
  58334. })), n
  58335. }, e.prototype.QueryFixturePoint = function(t, e, i) {
  58336. if (this.m_contactManager.m_broadPhase.QueryPoint(e, (function(n) {
  58337. var r = n.userData.fixture;
  58338. if (r.TestPoint(e)) {
  58339. if (t) return t.ReportFixture(r);
  58340. if (i) return i(r)
  58341. }
  58342. return !0
  58343. })), t)
  58344. for (var n = this.m_particleSystemList; n; n = n.m_next) t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e)
  58345. }, e.prototype.QueryAllFixturePoint = function(t, e) {
  58346. return void 0 === e && (e = []), this.QueryFixturePoint(null, t, (function(t) {
  58347. return e.push(t), !0
  58348. })), e
  58349. }, e.prototype.RayCast = function(t, i, n, r) {
  58350. var s = e.RayCast_s_input;
  58351. if (s.maxFraction = 1, s.p1.Copy(i), s.p2.Copy(n), this.m_contactManager.m_broadPhase.RayCast(s, (function(s, o) {
  58352. var a = o.userData,
  58353. l = a.fixture,
  58354. h = a.childIndex,
  58355. c = e.RayCast_s_output;
  58356. if (l.RayCast(c, s, h)) {
  58357. var u = c.fraction,
  58358. _ = e.RayCast_s_point;
  58359. if (_.Set((1 - u) * i.x + u * n.x, (1 - u) * i.y + u * n.y), t) return t.ReportFixture(l, _, c.normal, u);
  58360. if (r) return r(l, _, c.normal, u)
  58361. }
  58362. return s.maxFraction
  58363. })), t)
  58364. for (var o = this.m_particleSystemList; o; o = o.m_next) t.ShouldQueryParticleSystem(o) && o.RayCast(t, i, n)
  58365. }, e.prototype.RayCastOne = function(t, e) {
  58366. var i = null,
  58367. n = 1;
  58368. return this.RayCast(null, t, e, (function(t, e, r, s) {
  58369. return s < n && (n = s, i = t), n
  58370. })), i
  58371. }, e.prototype.RayCastAll = function(t, e, i) {
  58372. return void 0 === i && (i = []), this.RayCast(null, t, e, (function(t, e, n, r) {
  58373. return i.push(t), 1
  58374. })), i
  58375. }, e.prototype.GetBodyList = function() {
  58376. return this.m_bodyList
  58377. }, e.prototype.GetJointList = function() {
  58378. return this.m_jointList
  58379. }, e.prototype.GetParticleSystemList = function() {
  58380. return this.m_particleSystemList
  58381. }, e.prototype.GetContactList = function() {
  58382. return this.m_contactManager.m_contactList
  58383. }, e.prototype.SetAllowSleeping = function(t) {
  58384. if (t !== this.m_allowSleep && (this.m_allowSleep = t, !this.m_allowSleep))
  58385. for (var e = this.m_bodyList; e; e = e.m_next) e.SetAwake(!0)
  58386. }, e.prototype.GetAllowSleeping = function() {
  58387. return this.m_allowSleep
  58388. }, e.prototype.SetWarmStarting = function(t) {
  58389. this.m_warmStarting = t
  58390. }, e.prototype.GetWarmStarting = function() {
  58391. return this.m_warmStarting
  58392. }, e.prototype.SetContinuousPhysics = function(t) {
  58393. this.m_continuousPhysics = t
  58394. }, e.prototype.GetContinuousPhysics = function() {
  58395. return this.m_continuousPhysics
  58396. }, e.prototype.SetSubStepping = function(t) {
  58397. this.m_subStepping = t
  58398. }, e.prototype.GetSubStepping = function() {
  58399. return this.m_subStepping
  58400. }, e.prototype.GetProxyCount = function() {
  58401. return this.m_contactManager.m_broadPhase.GetProxyCount()
  58402. }, e.prototype.GetBodyCount = function() {
  58403. return this.m_bodyCount
  58404. }, e.prototype.GetJointCount = function() {
  58405. return this.m_jointCount
  58406. }, e.prototype.GetContactCount = function() {
  58407. return this.m_contactManager.m_contactCount
  58408. }, e.prototype.GetTreeHeight = function() {
  58409. return this.m_contactManager.m_broadPhase.GetTreeHeight()
  58410. }, e.prototype.GetTreeBalance = function() {
  58411. return this.m_contactManager.m_broadPhase.GetTreeBalance()
  58412. }, e.prototype.GetTreeQuality = function() {
  58413. return this.m_contactManager.m_broadPhase.GetTreeQuality()
  58414. }, e.prototype.SetGravity = function(t, e) {
  58415. if (void 0 === e && (e = !0), !P.IsEqualToV(this.m_gravity, t) && (this.m_gravity.Copy(t), e))
  58416. for (var i = this.m_bodyList; i; i = i.m_next) i.SetAwake(!0)
  58417. }, e.prototype.GetGravity = function() {
  58418. return this.m_gravity
  58419. }, e.prototype.IsLocked = function() {
  58420. return this.m_locked
  58421. }, e.prototype.SetAutoClearForces = function(t) {
  58422. this.m_clearForces = t
  58423. }, e.prototype.GetAutoClearForces = function() {
  58424. return this.m_clearForces
  58425. }, e.prototype.ShiftOrigin = function(t) {
  58426. if (this.IsLocked()) throw new Error;
  58427. for (var e = this.m_bodyList; e; e = e.m_next) e.m_xf.p.SelfSub(t), e.m_sweep.c0.SelfSub(t), e.m_sweep.c.SelfSub(t);
  58428. for (var i = this.m_jointList; i; i = i.m_next) i.ShiftOrigin(t);
  58429. this.m_contactManager.m_broadPhase.ShiftOrigin(t)
  58430. }, e.prototype.GetContactManager = function() {
  58431. return this.m_contactManager
  58432. }, e.prototype.GetProfile = function() {
  58433. return this.m_profile
  58434. }, e.prototype.Dump = function(e) {
  58435. if (!this.m_locked) {
  58436. e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n", this.m_gravity.x, this.m_gravity.y), e("this.m_world.SetGravity(g);\n"), e("const bodies: b2Body[] = [];\n"), e("const joints: b2Joint[] = [];\n");
  58437. for (var i = 0, n = this.m_bodyList; n; n = n.m_next) n.m_islandIndex = i, n.Dump(e), ++i;
  58438. i = 0;
  58439. for (var r = this.m_jointList; r; r = r.m_next) r.m_index = i, ++i;
  58440. for (r = this.m_jointList; r; r = r.m_next) r.m_type !== t.b2JointType.e_gearJoint && (e("{\n"), r.Dump(e), e("}\n"));
  58441. for (r = this.m_jointList; r; r = r.m_next) r.m_type === t.b2JointType.e_gearJoint && (e("{\n"), r.Dump(e), e("}\n"))
  58442. }
  58443. }, e.prototype.DrawJoint = function(i) {
  58444. if (null !== this.m_debugDraw) {
  58445. var n = i.GetBodyA(),
  58446. r = i.GetBodyB(),
  58447. s = n.m_xf,
  58448. o = r.m_xf,
  58449. a = s.p,
  58450. l = o.p,
  58451. h = i.GetAnchorA(e.DrawJoint_s_p1),
  58452. c = i.GetAnchorB(e.DrawJoint_s_p2),
  58453. u = e.DrawJoint_s_color.SetRGB(.5, .8, .8);
  58454. switch (i.m_type) {
  58455. case t.b2JointType.e_distanceJoint:
  58456. this.m_debugDraw.DrawSegment(h, c, u);
  58457. break;
  58458. case t.b2JointType.e_pulleyJoint:
  58459. var _ = i,
  58460. f = _.GetGroundAnchorA(),
  58461. d = _.GetGroundAnchorB();
  58462. this.m_debugDraw.DrawSegment(f, h, u), this.m_debugDraw.DrawSegment(d, c, u), this.m_debugDraw.DrawSegment(f, d, u);
  58463. break;
  58464. case t.b2JointType.e_mouseJoint:
  58465. var p = e.DrawJoint_s_c;
  58466. p.Set(0, 1, 0), this.m_debugDraw.DrawPoint(h, 4, p), this.m_debugDraw.DrawPoint(c, 4, p), p.Set(.8, .8, .8), this.m_debugDraw.DrawSegment(h, c, p);
  58467. break;
  58468. default:
  58469. this.m_debugDraw.DrawSegment(a, h, u), this.m_debugDraw.DrawSegment(h, c, u), this.m_debugDraw.DrawSegment(l, c, u)
  58470. }
  58471. }
  58472. }, e.prototype.DrawShape = function(i, n) {
  58473. if (null !== this.m_debugDraw) {
  58474. var r = i.GetShape();
  58475. switch (r.m_type) {
  58476. case t.b2ShapeType.e_circleShape:
  58477. var s = r,
  58478. o = s.m_p,
  58479. a = s.m_radius,
  58480. l = P.UNITX;
  58481. this.m_debugDraw.DrawSolidCircle(o, a, l, n);
  58482. break;
  58483. case t.b2ShapeType.e_edgeShape:
  58484. var h = r,
  58485. c = h.m_vertex1,
  58486. u = h.m_vertex2;
  58487. this.m_debugDraw.DrawSegment(c, u, n);
  58488. break;
  58489. case t.b2ShapeType.e_chainShape:
  58490. var _ = r,
  58491. f = _.m_count,
  58492. d = _.m_vertices,
  58493. p = e.DrawShape_s_ghostColor.SetRGBA(.75 * n.r, .75 * n.g, .75 * n.b, n.a);
  58494. c = d[0];
  58495. if (this.m_debugDraw.DrawPoint(c, 4, n), _.m_hasPrevVertex) {
  58496. var m = _.m_prevVertex;
  58497. this.m_debugDraw.DrawSegment(m, c, p), this.m_debugDraw.DrawCircle(m, .1, p)
  58498. }
  58499. for (var y = 1; y < f; ++y) {
  58500. u = d[y];
  58501. this.m_debugDraw.DrawSegment(c, u, n), this.m_debugDraw.DrawPoint(u, 4, n), c = u
  58502. }
  58503. if (_.m_hasNextVertex) {
  58504. var v = _.m_nextVertex;
  58505. this.m_debugDraw.DrawSegment(v, c, p), this.m_debugDraw.DrawCircle(v, .1, p)
  58506. }
  58507. break;
  58508. case t.b2ShapeType.e_polygonShape:
  58509. var g = r,
  58510. x = g.m_count;
  58511. d = g.m_vertices;
  58512. this.m_debugDraw.DrawSolidPolygon(d, x, n)
  58513. }
  58514. }
  58515. }, e.prototype.Solve = function(e) {
  58516. for (var i = this.m_bodyList; i; i = i.m_next) i.m_xf0.Copy(i.m_xf);
  58517. for (var n = this.m_controllerList; n; n = n.m_next) n.Step(e);
  58518. this.m_profile.solveInit = 0, this.m_profile.solveVelocity = 0, this.m_profile.solvePosition = 0;
  58519. var r = this.m_island;
  58520. r.Initialize(this.m_bodyCount, this.m_contactManager.m_contactCount, this.m_jointCount, null, this.m_contactManager.m_contactListener);
  58521. for (i = this.m_bodyList; i; i = i.m_next) i.m_islandFlag = !1;
  58522. for (var s = this.m_contactManager.m_contactList; s; s = s.m_next) s.m_islandFlag = !1;
  58523. for (var o = this.m_jointList; o; o = o.m_next) o.m_islandFlag = !1;
  58524. for (var a = this.s_stack, l = this.m_bodyList; l; l = l.m_next)
  58525. if (!l.m_islandFlag && l.IsAwake() && l.IsActive() && l.GetType() !== t.b2BodyType.b2_staticBody) {
  58526. r.Clear();
  58527. var h = 0;
  58528. for (a[h++] = l, l.m_islandFlag = !0; h > 0;) {
  58529. if (!(i = a[--h])) throw new Error;
  58530. if (r.AddBody(i), i.m_awakeFlag = !0, i.GetType() !== t.b2BodyType.b2_staticBody) {
  58531. for (var c = i.m_contactList; c; c = c.next) {
  58532. var u = c.contact;
  58533. if (!u.m_islandFlag && (u.IsEnabled() && u.IsTouching())) {
  58534. var _ = u.m_fixtureA.m_isSensor,
  58535. f = u.m_fixtureB.m_isSensor;
  58536. if (!_ && !f) {
  58537. if (r.AddContact(u), u.m_islandFlag = !0, !(p = c.other)) throw new Error;
  58538. p.m_islandFlag || (a[h++] = p, p.m_islandFlag = !0)
  58539. }
  58540. }
  58541. }
  58542. for (var d = i.m_jointList; d; d = d.next) {
  58543. var p;
  58544. if (!d.joint.m_islandFlag)(p = d.other).IsActive() && (r.AddJoint(d.joint), d.joint.m_islandFlag = !0, p.m_islandFlag || (a[h++] = p, p.m_islandFlag = !0))
  58545. }
  58546. }
  58547. }
  58548. var m = new sn;
  58549. r.Solve(m, e, this.m_gravity, this.m_allowSleep), this.m_profile.solveInit += m.solveInit, this.m_profile.solveVelocity += m.solveVelocity, this.m_profile.solvePosition += m.solvePosition;
  58550. for (var y = 0; y < r.m_bodyCount; ++y) {
  58551. (i = r.m_bodies[y]).GetType() === t.b2BodyType.b2_staticBody && (i.m_islandFlag = !1)
  58552. }
  58553. }
  58554. for (y = 0; y < a.length && a[y]; ++y) a[y] = null;
  58555. var v = new z;
  58556. for (i = this.m_bodyList; i; i = i.m_next) i.m_islandFlag && i.GetType() !== t.b2BodyType.b2_staticBody && i.SynchronizeFixtures();
  58557. this.m_contactManager.FindNewContacts(), this.m_profile.broadphase = v.GetMilliseconds()
  58558. }, e.prototype.SolveTOI = function(i) {
  58559. var r = this.m_island;
  58560. if (r.Initialize(64, 32, 0, null, this.m_contactManager.m_contactListener), this.m_stepComplete) {
  58561. for (var s = this.m_bodyList; s; s = s.m_next) s.m_islandFlag = !1, s.m_sweep.alpha0 = 0;
  58562. for (var o = this.m_contactManager.m_contactList; o; o = o.m_next) o.m_toiFlag = !1, o.m_islandFlag = !1, o.m_toiCount = 0, o.m_toi = 1
  58563. }
  58564. for (;;) {
  58565. var a = null,
  58566. l = 1;
  58567. for (o = this.m_contactManager.m_contactList; o; o = o.m_next)
  58568. if (o.IsEnabled() && !(o.m_toiCount > 8)) {
  58569. var h = 1;
  58570. if (o.m_toiFlag) h = o.m_toi;
  58571. else {
  58572. var c = o.GetFixtureA(),
  58573. u = o.GetFixtureB();
  58574. if (c.IsSensor() || u.IsSensor()) continue;
  58575. var _ = c.GetBody(),
  58576. f = u.GetBody(),
  58577. d = _.m_type,
  58578. p = f.m_type,
  58579. m = _.IsAwake() && d !== t.b2BodyType.b2_staticBody,
  58580. y = f.IsAwake() && p !== t.b2BodyType.b2_staticBody;
  58581. if (!m && !y) continue;
  58582. var v = _.IsBullet() || d !== t.b2BodyType.b2_dynamicBody,
  58583. x = f.IsBullet() || p !== t.b2BodyType.b2_dynamicBody;
  58584. if (!v && !x) continue;
  58585. var b = _.m_sweep.alpha0;
  58586. _.m_sweep.alpha0 < f.m_sweep.alpha0 ? (b = f.m_sweep.alpha0, _.m_sweep.Advance(b)) : f.m_sweep.alpha0 < _.m_sweep.alpha0 && (b = _.m_sweep.alpha0, f.m_sweep.Advance(b));
  58587. var A = o.GetChildIndexA(),
  58588. C = o.GetChildIndexB(),
  58589. T = e.SolveTOI_s_toi_input;
  58590. T.proxyA.SetShape(c.GetShape(), A), T.proxyB.SetShape(u.GetShape(), C), T.sweepA.Copy(_.m_sweep), T.sweepB.Copy(f.m_sweep), T.tMax = 1;
  58591. var S = e.SolveTOI_s_toi_output;
  58592. re(S, T);
  58593. var w = S.t;
  58594. h = S.state === t.b2TOIOutputState.e_touching ? g(b + (1 - b) * w, 1) : 1, o.m_toi = h, o.m_toiFlag = !0
  58595. }
  58596. h < l && (a = o, l = h)
  58597. }
  58598. if (null === a || 1 - 10 * n < l) {
  58599. this.m_stepComplete = !0;
  58600. break
  58601. }
  58602. var E = a.GetFixtureA(),
  58603. M = a.GetFixtureB(),
  58604. D = E.GetBody(),
  58605. B = M.GetBody(),
  58606. I = e.SolveTOI_s_backup1.Copy(D.m_sweep),
  58607. P = e.SolveTOI_s_backup2.Copy(B.m_sweep);
  58608. if (D.Advance(l), B.Advance(l), a.Update(this.m_contactManager.m_contactListener), a.m_toiFlag = !1, ++a.m_toiCount, a.IsEnabled() && a.IsTouching()) {
  58609. D.SetAwake(!0), B.SetAwake(!0), r.Clear(), r.AddBody(D), r.AddBody(B), r.AddContact(a), D.m_islandFlag = !0, B.m_islandFlag = !0, a.m_islandFlag = !0;
  58610. for (var R = 0; R < 2; ++R) {
  58611. if ((U = 0 === R ? D : B).m_type === t.b2BodyType.b2_dynamicBody)
  58612. for (var O = U.m_contactList; O && r.m_bodyCount !== r.m_bodyCapacity && r.m_contactCount !== r.m_contactCapacity; O = O.next) {
  58613. var L = O.contact;
  58614. if (!L.m_islandFlag) {
  58615. var F = O.other;
  58616. if (F.m_type !== t.b2BodyType.b2_dynamicBody || U.IsBullet() || F.IsBullet()) {
  58617. var N = L.m_fixtureA.m_isSensor,
  58618. V = L.m_fixtureB.m_isSensor;
  58619. if (!N && !V) {
  58620. var k = e.SolveTOI_s_backup.Copy(F.m_sweep);
  58621. F.m_islandFlag || F.Advance(l), L.Update(this.m_contactManager.m_contactListener), L.IsEnabled() && L.IsTouching() ? (L.m_islandFlag = !0, r.AddContact(L), F.m_islandFlag || (F.m_islandFlag = !0, F.m_type !== t.b2BodyType.b2_staticBody && F.SetAwake(!0), r.AddBody(F))) : (F.m_sweep.Copy(k), F.SynchronizeTransform())
  58622. }
  58623. }
  58624. }
  58625. }
  58626. }
  58627. var G = e.SolveTOI_s_subStep;
  58628. G.dt = (1 - l) * i.dt, G.inv_dt = 1 / G.dt, G.dtRatio = 1, G.positionIterations = 20, G.velocityIterations = i.velocityIterations, G.particleIterations = i.particleIterations, G.warmStarting = !1, r.SolveTOI(G, D.m_islandIndex, B.m_islandIndex);
  58629. for (R = 0; R < r.m_bodyCount; ++R) {
  58630. var U;
  58631. if ((U = r.m_bodies[R]).m_islandFlag = !1, U.m_type === t.b2BodyType.b2_dynamicBody) {
  58632. U.SynchronizeFixtures();
  58633. for (O = U.m_contactList; O; O = O.next) O.contact.m_toiFlag = !1, O.contact.m_islandFlag = !1
  58634. }
  58635. }
  58636. if (this.m_contactManager.FindNewContacts(), this.m_subStepping) {
  58637. this.m_stepComplete = !1;
  58638. break
  58639. }
  58640. } else a.SetEnabled(!1), D.m_sweep.Copy(I), B.m_sweep.Copy(P), D.SynchronizeTransform(), B.SynchronizeTransform()
  58641. }
  58642. }, e.prototype.AddController = function(t) {
  58643. return t.m_next = this.m_controllerList, t.m_prev = null, this.m_controllerList && (this.m_controllerList.m_prev = t), this.m_controllerList = t, ++this.m_controllerCount, t
  58644. }, e.prototype.RemoveController = function(t) {
  58645. return t.m_prev && (t.m_prev.m_next = t.m_next), t.m_next && (t.m_next.m_prev = t.m_prev), this.m_controllerList === t && (this.m_controllerList = t.m_next), --this.m_controllerCount, t.m_prev = null, t.m_next = null, t
  58646. }, e.Step_s_step = new on, e.Step_s_stepTimer = new z, e.Step_s_timer = new z, e.DrawDebugData_s_color = new G(0, 0, 0), e.DrawDebugData_s_vs = P.MakeArray(4), e.DrawDebugData_s_xf = new V, e.QueryFixtureShape_s_aabb = new wt, e.RayCast_s_input = new Tt, e.RayCast_s_output = new St, e.RayCast_s_point = new P, e.DrawJoint_s_p1 = new P, e.DrawJoint_s_p2 = new P, e.DrawJoint_s_color = new G(.5, .8, .8), e.DrawJoint_s_c = new G, e.DrawShape_s_ghostColor = new G, e.SolveTOI_s_subStep = new on, e.SolveTOI_s_backup = new k, e.SolveTOI_s_backup1 = new k, e.SolveTOI_s_backup2 = new k, e.SolveTOI_s_toi_input = new Xt, e.SolveTOI_s_toi_output = new Yt, e
  58647. })(),
  58648. Un = (function() {
  58649. return function(t, e) {
  58650. this.prevBody = null, this.nextBody = null, this.prevController = null, this.nextController = null, this.controller = t, this.body = e
  58651. }
  58652. })(),
  58653. zn = (function() {
  58654. function t() {
  58655. this.m_bodyList = null, this.m_bodyCount = 0, this.m_prev = null, this.m_next = null
  58656. }
  58657. return t.prototype.GetNext = function() {
  58658. return this.m_next
  58659. }, t.prototype.GetPrev = function() {
  58660. return this.m_prev
  58661. }, t.prototype.GetBodyList = function() {
  58662. return this.m_bodyList
  58663. }, t.prototype.AddBody = function(t) {
  58664. var e = new Un(this, t);
  58665. e.nextBody = this.m_bodyList, e.prevBody = null, this.m_bodyList && (this.m_bodyList.prevBody = e), this.m_bodyList = e, ++this.m_bodyCount, e.nextController = t.m_controllerList, e.prevController = null, t.m_controllerList && (t.m_controllerList.prevController = e), t.m_controllerList = e, ++t.m_controllerCount
  58666. }, t.prototype.RemoveBody = function(t) {
  58667. if (this.m_bodyCount <= 0) throw new Error;
  58668. for (var e = this.m_bodyList; e && e.body !== t;) e = e.nextBody;
  58669. if (null === e) throw new Error;
  58670. e.prevBody && (e.prevBody.nextBody = e.nextBody), e.nextBody && (e.nextBody.prevBody = e.prevBody), this.m_bodyList === e && (this.m_bodyList = e.nextBody), --this.m_bodyCount, e.nextController && (e.nextController.prevController = e.prevController), e.prevController && (e.prevController.nextController = e.nextController), t.m_controllerList === e && (t.m_controllerList = e.nextController), --t.m_controllerCount
  58671. }, t.prototype.Clear = function() {
  58672. for (; this.m_bodyList;) this.RemoveBody(this.m_bodyList.body);
  58673. this.m_bodyCount = 0
  58674. }, t
  58675. })(),
  58676. jn = (function(t) {
  58677. function e() {
  58678. var e = null !== t && t.apply(this, arguments) || this;
  58679. return e.normal = new P(0, 1), e.offset = 0, e.density = 0, e.velocity = new P(0, 0), e.linearDrag = 0, e.angularDrag = 0, e.useDensity = !1, e.useWorldGravity = !0, e.gravity = new P(0, 0), e
  58680. }
  58681. return $e(e, t), e.prototype.Step = function(t) {
  58682. if (this.m_bodyList) {
  58683. this.useWorldGravity && this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity());
  58684. for (var e = this.m_bodyList; e; e = e.nextBody) {
  58685. var i = e.body;
  58686. if (i.IsAwake()) {
  58687. for (var r = new P, s = new P, o = 0, a = 0, l = i.GetFixtureList(); l; l = l.m_next) {
  58688. var h = new P,
  58689. c = l.GetShape().ComputeSubmergedArea(this.normal, this.offset, i.GetTransform(), h);
  58690. o += c, r.x += c * h.x, r.y += c * h.y;
  58691. var u = 0;
  58692. a += c * (u = this.useDensity ? l.GetDensity() : 1), s.x += c * h.x * u, s.y += c * h.y * u
  58693. }
  58694. if (r.x /= o, r.y /= o, s.x /= a, s.y /= a, !(o < n)) {
  58695. var _ = this.gravity.Clone().SelfNeg();
  58696. _.SelfMul(this.density * o), i.ApplyForce(_, s);
  58697. var f = i.GetLinearVelocityFromWorldPoint(r, new P);
  58698. f.SelfSub(this.velocity), f.SelfMul(-this.linearDrag * o), i.ApplyForce(f, r), i.ApplyTorque(-i.GetInertia() / i.GetMass() * o * i.GetAngularVelocity() * this.angularDrag)
  58699. }
  58700. }
  58701. }
  58702. }
  58703. }, e.prototype.Draw = function(t) {
  58704. var e = 100,
  58705. i = new P,
  58706. n = new P;
  58707. i.x = this.normal.x * this.offset + this.normal.y * e, i.y = this.normal.y * this.offset - this.normal.x * e, n.x = this.normal.x * this.offset - this.normal.y * e, n.y = this.normal.y * this.offset + this.normal.x * e;
  58708. var r = new G(0, 0, .8);
  58709. t.DrawSegment(i, n, r)
  58710. }, e
  58711. })(zn),
  58712. Wn = (function(t) {
  58713. function e() {
  58714. var e = null !== t && t.apply(this, arguments) || this;
  58715. return e.A = new P(0, 0), e
  58716. }
  58717. return $e(e, t), e.prototype.Step = function(t) {
  58718. for (var i = P.MulSV(t.dt, this.A, e.Step_s_dtA), n = this.m_bodyList; n; n = n.nextBody) {
  58719. var r = n.body;
  58720. r.IsAwake() && r.SetLinearVelocity(P.AddVV(r.GetLinearVelocity(), i, P.s_t0))
  58721. }
  58722. }, e.prototype.Draw = function(t) {}, e.Step_s_dtA = new P, e
  58723. })(zn),
  58724. Hn = (function(t) {
  58725. function e() {
  58726. var e = null !== t && t.apply(this, arguments) || this;
  58727. return e.F = new P(0, 0), e
  58728. }
  58729. return $e(e, t), e.prototype.Step = function(t) {
  58730. for (var e = this.m_bodyList; e; e = e.nextBody) {
  58731. var i = e.body;
  58732. i.IsAwake() && i.ApplyForce(this.F, i.GetWorldCenter())
  58733. }
  58734. }, e.prototype.Draw = function(t) {}, e
  58735. })(zn),
  58736. Xn = (function(t) {
  58737. function e() {
  58738. var e = null !== t && t.apply(this, arguments) || this;
  58739. return e.G = 1, e.invSqr = !0, e
  58740. }
  58741. return $e(e, t), e.prototype.Step = function(t) {
  58742. if (this.invSqr)
  58743. for (var i = this.m_bodyList; i; i = i.nextBody)
  58744. for (var r = (h = i.body).GetWorldCenter(), s = h.GetMass(), o = this.m_bodyList; o && o !== i; o = o.nextBody) {
  58745. var a = (c = o.body).GetWorldCenter(),
  58746. l = c.GetMass();
  58747. if (!((f = (u = a.x - r.x) * u + (_ = a.y - r.y) * _) < n))(d = e.Step_s_f.Set(u, _)).SelfMul(this.G / f / S(f) * s * l), h.IsAwake() && h.ApplyForce(d, r), c.IsAwake() && c.ApplyForce(d.SelfMul(-1), a)
  58748. } else
  58749. for (i = this.m_bodyList; i; i = i.nextBody) {
  58750. var h;
  58751. for (r = (h = i.body).GetWorldCenter(), s = h.GetMass(), o = this.m_bodyList; o && o !== i; o = o.nextBody) {
  58752. var c, u, _, f, d;
  58753. a = (c = o.body).GetWorldCenter(), l = c.GetMass();
  58754. if (!((f = (u = a.x - r.x) * u + (_ = a.y - r.y) * _) < n))(d = e.Step_s_f.Set(u, _)).SelfMul(this.G / f * s * l), h.IsAwake() && h.ApplyForce(d, r), c.IsAwake() && c.ApplyForce(d.SelfMul(-1), a)
  58755. }
  58756. }
  58757. }, e.prototype.Draw = function(t) {}, e.Step_s_f = new P, e
  58758. })(zn),
  58759. Yn = (function(t) {
  58760. function e() {
  58761. var e = null !== t && t.apply(this, arguments) || this;
  58762. return e.T = new L, e.maxTimestep = 0, e
  58763. }
  58764. return $e(e, t), e.prototype.Step = function(t) {
  58765. var i = t.dt;
  58766. if (!(i <= n)) {
  58767. i > this.maxTimestep && this.maxTimestep > 0 && (i = this.maxTimestep);
  58768. for (var r = this.m_bodyList; r; r = r.nextBody) {
  58769. var s = r.body;
  58770. if (s.IsAwake()) {
  58771. var o = s.GetWorldVector(L.MulMV(this.T, s.GetLocalVector(s.GetLinearVelocity(), P.s_t0), P.s_t1), e.Step_s_damping);
  58772. s.SetLinearVelocity(P.AddVV(s.GetLinearVelocity(), P.MulSV(i, o, P.s_t0), P.s_t1))
  58773. }
  58774. }
  58775. }
  58776. }, e.prototype.Draw = function(t) {}, e.prototype.SetAxisAligned = function(t, e) {
  58777. this.T.ex.x = -t, this.T.ex.y = 0, this.T.ey.x = 0, this.T.ey.y = -e, this.maxTimestep = t > 0 || e > 0 ? 1 / x(t, e) : 0
  58778. }, e.Step_s_damping = new P, e
  58779. })(zn),
  58780. qn = (function() {
  58781. return function() {
  58782. this.vertices = [], this.count = 0, this.masses = [], this.gravity = new P(0, 0), this.damping = .1, this.k2 = .9, this.k3 = .1
  58783. }
  58784. })(),
  58785. Jn = (function() {
  58786. function t() {
  58787. this.m_count = 0, this.m_ps = [], this.m_p0s = [], this.m_vs = [], this.m_ims = [], this.m_Ls = [], this.m_as = [], this.m_gravity = new P, this.m_damping = 0, this.m_k2 = 1, this.m_k3 = .1
  58788. }
  58789. return t.prototype.GetVertexCount = function() {
  58790. return this.m_count
  58791. }, t.prototype.GetVertices = function() {
  58792. return this.m_ps
  58793. }, t.prototype.Initialize = function(t) {
  58794. this.m_count = t.count, this.m_ps = P.MakeArray(this.m_count), this.m_p0s = P.MakeArray(this.m_count), this.m_vs = P.MakeArray(this.m_count), this.m_ims = p(this.m_count);
  58795. for (var e = 0; e < this.m_count; ++e) {
  58796. this.m_ps[e].Copy(t.vertices[e]), this.m_p0s[e].Copy(t.vertices[e]), this.m_vs[e].SetZero();
  58797. var i = t.masses[e];
  58798. this.m_ims[e] = i > 0 ? 1 / i : 0
  58799. }
  58800. var n = this.m_count - 1,
  58801. r = this.m_count - 2;
  58802. this.m_Ls = p(n), this.m_as = p(r);
  58803. for (e = 0; e < n; ++e) {
  58804. var s = this.m_ps[e],
  58805. o = this.m_ps[e + 1];
  58806. this.m_Ls[e] = P.DistanceVV(s, o)
  58807. }
  58808. for (e = 0; e < r; ++e) {
  58809. s = this.m_ps[e], o = this.m_ps[e + 1];
  58810. var a = this.m_ps[e + 2],
  58811. l = P.SubVV(o, s, P.s_t0),
  58812. h = P.SubVV(a, o, P.s_t1),
  58813. c = P.CrossVV(l, h),
  58814. u = P.DotVV(l, h);
  58815. this.m_as[e] = I(c, u)
  58816. }
  58817. this.m_gravity.Copy(t.gravity), this.m_damping = t.damping, this.m_k2 = t.k2, this.m_k3 = t.k3
  58818. }, t.prototype.Step = function(t, e) {
  58819. if (0 !== t) {
  58820. for (var i = Math.exp(-t * this.m_damping), n = 0; n < this.m_count; ++n) this.m_p0s[n].Copy(this.m_ps[n]), this.m_ims[n] > 0 && this.m_vs[n].SelfMulAdd(t, this.m_gravity), this.m_vs[n].SelfMul(i), this.m_ps[n].SelfMulAdd(t, this.m_vs[n]);
  58821. for (n = 0; n < e; ++n) this.SolveC2(), this.SolveC3(), this.SolveC2();
  58822. var r = 1 / t;
  58823. for (n = 0; n < this.m_count; ++n) P.MulSV(r, P.SubVV(this.m_ps[n], this.m_p0s[n], P.s_t0), this.m_vs[n])
  58824. }
  58825. }, t.prototype.SolveC2 = function() {
  58826. for (var e = this.m_count - 1, i = 0; i < e; ++i) {
  58827. var n = this.m_ps[i],
  58828. r = this.m_ps[i + 1],
  58829. s = P.SubVV(r, n, t.s_d),
  58830. o = s.Normalize(),
  58831. a = this.m_ims[i],
  58832. l = this.m_ims[i + 1];
  58833. if (a + l !== 0) {
  58834. var h = a / (a + l),
  58835. c = l / (a + l);
  58836. n.SelfMulSub(this.m_k2 * h * (this.m_Ls[i] - o), s), r.SelfMulAdd(this.m_k2 * c * (this.m_Ls[i] - o), s)
  58837. }
  58838. }
  58839. }, t.prototype.SetAngle = function(t) {
  58840. for (var e = this.m_count - 2, i = 0; i < e; ++i) this.m_as[i] = t
  58841. }, t.prototype.SolveC3 = function() {
  58842. for (var e = this.m_count - 2, i = 0; i < e; ++i) {
  58843. var n = this.m_ps[i],
  58844. r = this.m_ps[i + 1],
  58845. o = this.m_ps[i + 2],
  58846. a = this.m_ims[i],
  58847. l = this.m_ims[i + 1],
  58848. h = this.m_ims[i + 2],
  58849. c = P.SubVV(r, n, t.s_d1),
  58850. u = P.SubVV(o, r, t.s_d2),
  58851. _ = c.LengthSquared(),
  58852. f = u.LengthSquared();
  58853. if (_ * f != 0) {
  58854. var d = P.CrossVV(c, u),
  58855. p = P.DotVV(c, u),
  58856. m = I(d, p),
  58857. y = P.MulSV(-1 / _, c.SelfSkew(), t.s_Jd1),
  58858. v = P.MulSV(1 / f, u.SelfSkew(), t.s_Jd2),
  58859. g = P.NegV(y, t.s_J1),
  58860. x = P.SubVV(y, v, t.s_J2),
  58861. b = v,
  58862. A = a * P.DotVV(g, g) + l * P.DotVV(x, x) + h * P.DotVV(b, b);
  58863. if (0 !== A) {
  58864. A = 1 / A;
  58865. for (var C = m - this.m_as[i]; C > s;) C = (m -= 2 * s) - this.m_as[i];
  58866. for (; C < -s;) C = (m += 2 * s) - this.m_as[i];
  58867. var T = -this.m_k3 * A * C;
  58868. n.SelfMulAdd(a * T, g), r.SelfMulAdd(l * T, x), o.SelfMulAdd(h * T, b)
  58869. }
  58870. }
  58871. }
  58872. }, t.prototype.Draw = function(t) {
  58873. for (var e = new G(.4, .5, .7), i = 0; i < this.m_count - 1; ++i) t.DrawSegment(this.m_ps[i], this.m_ps[i + 1], e)
  58874. }, t.s_d = new P, t.s_d1 = new P, t.s_d2 = new P, t.s_Jd1 = new P, t.s_Jd2 = new P, t.s_J1 = new P, t.s_J2 = new P, t
  58875. })();
  58876. t.b2Assert = function(t) {
  58877. for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
  58878. if (!t) throw new(Error.bind.apply(Error, [void 0].concat(e)))
  58879. }, t.b2Maybe = e, t.b2_maxFloat = i, t.b2_epsilon = n, t.b2_epsilon_sq = r, t.b2_pi = s, t.b2_maxManifoldPoints = o, t.b2_maxPolygonVertices = a, t.b2_aabbExtension = .1, t.b2_aabbMultiplier = 2, t.b2_linearSlop = l, t.b2_angularSlop = h, t.b2_polygonRadius = c, t.b2_maxSubSteps = 8, t.b2_maxTOIContacts = 32, t.b2_velocityThreshold = 1, t.b2_maxLinearCorrection = .2, t.b2_maxAngularCorrection = .13962634015955555, t.b2_maxTranslation = 2, t.b2_maxTranslationSquared = 4, t.b2_maxRotation = 1.570796326795, t.b2_maxRotationSquared = 2.4674011002726646, t.b2_baumgarte = .2, t.b2_toiBaumgarte = .75, t.b2_invalidParticleIndex = u, t.b2_maxParticleIndex = 2147483647, t.b2_particleStride = .75, t.b2_minParticleWeight = 1, t.b2_maxParticlePressure = .25, t.b2_maxParticleForce = .5, t.b2_maxTriadDistance = 2, t.b2_maxTriadDistanceSquared = 4, t.b2_minParticleSystemBufferCapacity = 256, t.b2_barrierCollisionTime = 2.5, t.b2_timeToSleep = .5, t.b2_linearSleepTolerance = .01, t.b2_angularSleepTolerance = .03490658503988889, t.b2Alloc = function(t) {
  58880. return null
  58881. }, t.b2Free = function(t) {}, t.b2Log = function(t) {
  58882. for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i]
  58883. }, t.b2Version = _, t.b2_version = f, t.b2_branch = "master", t.b2_commit = "fbf51801d80fc389d43dc46524520e89043b6faf", t.b2ParseInt = function(t) {
  58884. return parseInt(t, 10)
  58885. }, t.b2ParseUInt = function(t) {
  58886. return Math.abs(parseInt(t, 10))
  58887. }, t.b2MakeArray = d, t.b2MakeNullArray = function(t) {
  58888. for (var e = [], i = 0; i < t; ++i) e.push(null);
  58889. return e
  58890. }, t.b2MakeNumberArray = p, t.b2_pi_over_180 = m, t.b2_180_over_pi = y, t.b2_two_pi = 6.28318530718, t.b2Abs = v, t.b2Min = g, t.b2Max = x, t.b2Clamp = b, t.b2Swap = function(t, e) {
  58891. var i = t[0];
  58892. t[0] = e[0], e[0] = i
  58893. }, t.b2IsValid = A, t.b2Sq = C, t.b2InvSqrt = T, t.b2Sqrt = S, t.b2Pow = w, t.b2DegToRad = function(t) {
  58894. return t * m
  58895. }, t.b2RadToDeg = function(t) {
  58896. return t * y
  58897. }, t.b2Cos = E, t.b2Sin = M, t.b2Acos = D, t.b2Asin = B, t.b2Atan2 = I, t.b2NextPowerOfTwo = function(t) {
  58898. return t |= t >> 1 & 2147483647, t |= t >> 2 & 1073741823, t |= t >> 4 & 268435455, t |= t >> 8 & 16777215, 1 + (t |= t >> 16 & 65535)
  58899. }, t.b2IsPowerOfTwo = function(t) {
  58900. return t > 0 && 0 == (t & t - 1)
  58901. }, t.b2Random = function() {
  58902. return 2 * Math.random() - 1
  58903. }, t.b2RandomRange = function(t, e) {
  58904. return (e - t) * Math.random() + t
  58905. }, t.b2Vec2 = P, t.b2Vec2_zero = R, t.b2Vec3 = O, t.b2Mat22 = L, t.b2Mat33 = F, t.b2Rot = N, t.b2Transform = V, t.b2Sweep = k, t.b2Color = G, t.b2Draw = U, t.b2Timer = z, t.b2Counter = j, t.b2GrowableStack = W, t.b2BlockAllocator = H, t.b2StackAllocator = X, t.b2ContactFeature = vt, t.b2ContactID = gt, t.b2ManifoldPoint = xt, t.b2Manifold = bt, t.b2WorldManifold = At, t.b2GetPointStates = function(e, i, n, r) {
  58906. var s;
  58907. for (s = 0; s < n.pointCount; ++s) {
  58908. var a = n.points[s].id.key;
  58909. e[s] = t.b2PointState.b2_removeState;
  58910. for (var l = 0, h = r.pointCount; l < h; ++l)
  58911. if (r.points[l].id.key === a) {
  58912. e[s] = t.b2PointState.b2_persistState;
  58913. break
  58914. }
  58915. }
  58916. for (; s < o; ++s) e[s] = t.b2PointState.b2_nullState;
  58917. for (s = 0; s < r.pointCount; ++s)
  58918. for (a = r.points[s].id.key, i[s] = t.b2PointState.b2_addState, l = 0, h = n.pointCount; l < h; ++l)
  58919. if (n.points[l].id.key === a) {
  58920. i[s] = t.b2PointState.b2_persistState;
  58921. break
  58922. }
  58923. for (; s < o; ++s) i[s] = t.b2PointState.b2_nullState
  58924. }, t.b2ClipVertex = Ct, t.b2RayCastInput = Tt, t.b2RayCastOutput = St, t.b2AABB = wt, t.b2TestOverlapAABB = Et, t.b2ClipSegmentToLine = Mt, t.b2TestOverlapShape = Pt, t.b2DistanceProxy = Y, t.b2SimplexCache = q, t.b2DistanceInput = J, t.b2DistanceOutput = Z, t.b2ShapeCastInput = K, t.b2ShapeCastOutput = Q, t.b2_gjk_reset = function() {
  58925. t.b2_gjkCalls = 0, t.b2_gjkIters = 0, t.b2_gjkMaxIters = 0
  58926. }, t.b2SimplexVertex = $, t.b2Simplex = tt, t.b2Distance = ht, t.b2ShapeCast = function(t, e) {
  58927. t.iterations = 0, t.lambda = 1, t.normal.SetZero(), t.point.SetZero();
  58928. var i = e.proxyA,
  58929. n = e.proxyB,
  58930. r = x(i.m_radius, c) + x(n.m_radius, c),
  58931. s = e.transformA,
  58932. o = e.transformB,
  58933. a = e.translationB,
  58934. h = ct.Set(0, 0),
  58935. u = 0,
  58936. _ = ut;
  58937. _.m_count = 0;
  58938. for (var f = _.m_vertices, d = i.GetSupport(N.MulTRV(s.q, P.NegV(a, P.s_t1), P.s_t0)), p = V.MulXV(s, i.GetVertex(d), _t), m = n.GetSupport(N.MulTRV(o.q, a, P.s_t0)), y = V.MulXV(o, n.GetVertex(m), ft), g = P.SubVV(p, y, dt), b = x(c, r - c), A = .5 * l, C = 0; C < 20 && v(g.Length() - b) > A;) {
  58939. t.iterations += 1, d = i.GetSupport(N.MulTRV(s.q, P.NegV(g, P.s_t1), P.s_t0)), p = V.MulXV(s, i.GetVertex(d), _t), m = n.GetSupport(N.MulTRV(o.q, g, P.s_t0)), y = V.MulXV(o, n.GetVertex(m), ft);
  58940. var T = P.SubVV(p, y, pt);
  58941. g.Normalize();
  58942. var S = P.DotVV(g, T),
  58943. w = P.DotVV(g, a);
  58944. if (S - b > u * w) {
  58945. if (w <= 0) return !1;
  58946. if ((u = (S - b) / w) > 1) return !1;
  58947. h.Copy(g).SelfNeg(), _.m_count = 0
  58948. }
  58949. var E = f[_.m_count];
  58950. switch (E.indexA = m, E.wA.Copy(y).SelfMulAdd(u, a), E.indexB = d, E.wB.Copy(p), E.w.Copy(E.wB).SelfSub(E.wA), E.a = 1, _.m_count += 1, _.m_count) {
  58951. case 1:
  58952. break;
  58953. case 2:
  58954. _.Solve2();
  58955. break;
  58956. case 3:
  58957. _.Solve3()
  58958. }
  58959. if (3 === _.m_count) return !1;
  58960. _.GetClosestPoint(g), ++C
  58961. }
  58962. var M = mt,
  58963. D = yt;
  58964. return _.GetWitnessPoints(M, D), g.LengthSquared() > 0 && (h.Copy(g).SelfNeg(), h.Normalize()), t.normal.Copy(h), t.lambda = u, t.iterations = C, !0
  58965. }, t.b2Pair = Ft, t.b2BroadPhase = Nt, t.b2PairLessThan = Vt, t.b2TreeNode = Ot, t.b2DynamicTree = Lt, t.b2_toi_reset = function() {
  58966. t.b2_toiTime = 0, t.b2_toiMaxTime = 0, t.b2_toiCalls = 0, t.b2_toiIters = 0, t.b2_toiMaxIters = 0, t.b2_toiRootIters = 0, t.b2_toiMaxRootIters = 0
  58967. }, t.b2TOIInput = Xt, t.b2TOIOutput = Yt, t.b2SeparationFunction = qt, t.b2TimeOfImpact = re, t.b2CollideCircles = ae, t.b2CollidePolygonAndCircle = ue, t.b2CollidePolygons = Le, t.b2CollideEdgeAndCircle = We, t.b2CollideEdgeAndPolygon = Je, t.b2MassData = Ze, t.b2Shape = Ke, t.b2CircleShape = ti, t.b2PolygonShape = ei, t.b2EdgeShape = ii, t.b2ChainShape = ni, t.b2Filter = ri, t.b2FixtureDef = si, t.b2FixtureProxy = oi, t.b2Fixture = ai, t.b2BodyDef = li, t.b2Body = hi, t.b2World = Gn, t.b2DestructionListener = Ki, t.b2ContactFilter = Qi, t.b2ContactImpulse = $i, t.b2ContactListener = tn, t.b2QueryCallback = en, t.b2RayCastCallback = nn, t.b2Island = mn, t.b2Profile = sn, t.b2TimeStep = on, t.b2Position = an, t.b2Velocity = ln, t.b2SolverData = hn, t.b2ContactManager = rn, t.b2MixFriction = Vi, t.b2MixRestitution = ki, t.b2ContactEdge = Gi, t.b2Contact = Ui, t.b2ContactRegister = Ji, t.b2ContactFactory = Zi, t.g_blockSolve = !1, t.b2VelocityConstraintPoint = cn, t.b2ContactVelocityConstraint = un, t.b2ContactPositionConstraint = _n, t.b2ContactSolverDef = fn, t.b2PositionSolverManifold = dn, t.b2ContactSolver = pn, t.b2CircleContact = zi, t.b2PolygonContact = ji, t.b2PolygonAndCircleContact = Wi, t.b2EdgeAndCircleContact = Hi, t.b2EdgeAndPolygonContact = Xi, t.b2ChainAndCircleContact = Yi, t.b2ChainAndPolygonContact = qi, t.b2Jacobian = ci, t.b2JointEdge = ui, t.b2JointDef = _i, t.b2Joint = fi, t.b2AreaJointDef = mi, t.b2AreaJoint = yi, t.b2DistanceJointDef = di, t.b2DistanceJoint = pi, t.b2FrictionJointDef = vi, t.b2FrictionJoint = gi, t.b2GearJointDef = xi, t.b2GearJoint = bi, t.b2MotorJointDef = Ai, t.b2MotorJoint = Ci, t.b2MouseJointDef = Ti, t.b2MouseJoint = Si, t.b2PrismaticJointDef = wi, t.b2PrismaticJoint = Ei, t.b2_minPulleyLength = 2, t.b2PulleyJointDef = Mi, t.b2PulleyJoint = Di, t.b2RevoluteJointDef = Bi, t.b2RevoluteJoint = Ii, t.b2RopeJointDef = Pi, t.b2RopeJoint = Ri, t.b2WeldJointDef = Oi, t.b2WeldJoint = Li, t.b2WheelJointDef = Fi, t.b2WheelJoint = Ni, t.b2ControllerEdge = Un, t.b2Controller = zn, t.b2BuoyancyController = jn, t.b2ConstantAccelController = Wn, t.b2ConstantForceController = Hn, t.b2GravityController = Xn, t.b2TensorDampingController = Yn, t.b2ParticleDef = yn, t.b2CalculateParticleIterations = vn, t.b2ParticleHandle = gn, t.b2ParticleGroupDef = xn, t.b2ParticleGroup = bn, t.b2GrowableBuffer = Rn, t.b2FixtureParticleQueryCallback = On, t.b2ParticleContact = Ln, t.b2ParticleBodyContact = Fn, t.b2ParticlePair = Nn, t.b2ParticleTriad = Vn, t.b2ParticleSystemDef = kn, t.b2RopeDef = qn, t.b2Rope = Jn, Object.defineProperty(t, "__esModule", {
  58968. value: !0
  58969. })
  58970. }))
  58971. }), {}],
  58972. 422: [(function(t, e, i) {
  58973. "use strict";
  58974. var n = "undefined" == typeof window ? global : window;
  58975. n.cc = n.cc || {}, n._cc = n._cc || {}, t("./predefine"), t("./polyfill/string"), t("./polyfill/misc"), t("./polyfill/array"), t("./polyfill/object"), t("./polyfill/array-buffer"), t("./polyfill/number"), t("./polyfill/typescript"), t("./cocos2d/core/predefine"), t("./cocos2d"), t("./extends"), e.exports = n.cc
  58976. }), {
  58977. "./cocos2d": 338,
  58978. "./cocos2d/core/predefine": 223,
  58979. "./extends": 399,
  58980. "./package": void 0,
  58981. "./polyfill/array": 424,
  58982. "./polyfill/array-buffer": 423,
  58983. "./polyfill/misc": 425,
  58984. "./polyfill/number": 426,
  58985. "./polyfill/object": 427,
  58986. "./polyfill/string": 428,
  58987. "./polyfill/typescript": 429,
  58988. "./predefine": 430
  58989. }],
  58990. 423: [(function(t, e, i) {
  58991. "use strict";
  58992. if (!ArrayBuffer.isView) {
  58993. var n = Object.getPrototypeOf(Int8Array);
  58994. ArrayBuffer.isView = "function" == typeof n ? function(t) {
  58995. return t instanceof n
  58996. } : function(t) {
  58997. if ("object" != typeof t) return !1;
  58998. var e = t.constructor;
  58999. return e === Float32Array || e === Uint8Array || e === Uint32Array || e === Int8Array
  59000. }
  59001. }
  59002. }), {}],
  59003. 424: [(function(t, e, i) {
  59004. "use strict";
  59005. Array.isArray || (Array.isArray = function(t) {
  59006. return "[object Array]" === Object.prototype.toString.call(t)
  59007. }), Array.prototype.find || (Array.prototype.find = function(t) {
  59008. for (var e = this.length, i = 0; i < e; i++) {
  59009. var n = this[i];
  59010. if (t.call(this, n, i, this)) return n
  59011. }
  59012. }), Array.prototype.includes || (Array.prototype.includes = function(t) {
  59013. return -1 !== this.indexOf(t)
  59014. })
  59015. }), {}],
  59016. 425: [(function(t, e, i) {
  59017. "use strict";
  59018. if (Math.sign || (Math.sign = function(t) {
  59019. return 0 === (t = +t) || isNaN(t) ? t : t > 0 ? 1 : -1
  59020. }), Math.log2 || (Math.log2 = function(t) {
  59021. return Math.log(t) * Math.LOG2E
  59022. }), Number.isInteger || (Number.isInteger = function(t) {
  59023. return "number" == typeof t && isFinite(t) && Math.floor(t) === t
  59024. }), !console.time) {
  59025. var n = window.performance || Date,
  59026. r = Object.create(null);
  59027. console.time = function(t) {
  59028. r[t] = n.now()
  59029. }, console.timeEnd = function(t) {
  59030. var e = r[t],
  59031. i = n.now() - e;
  59032. console.log(t + ": " + i + "ms")
  59033. }
  59034. }
  59035. }), {}],
  59036. 426: [(function(t, e, i) {
  59037. "use strict";
  59038. Number.parseFloat = Number.parseFloat || parseFloat, Number.parseInt = Number.parseInt || parseInt
  59039. }), {}],
  59040. 427: [(function(t, e, i) {
  59041. "use strict";
  59042. Object.assign || (Object.assign = function(t, e) {
  59043. return cc.js.mixin(t, e)
  59044. }), Object.getOwnPropertyDescriptors || (Object.getOwnPropertyDescriptors = function(t) {
  59045. var e = {},
  59046. i = Object.getOwnPropertyNames(t);
  59047. Object.getOwnPropertySymbols && (i = i.concat(Object.getOwnPropertySymbols(t)));
  59048. for (var n = 0; n < i.length; ++n) {
  59049. var r = i[n];
  59050. e[r] = Object.getOwnPropertyDescriptor(t, r)
  59051. }
  59052. return e
  59053. })
  59054. }), {}],
  59055. 428: [(function(t, e, i) {
  59056. "use strict";
  59057. String.prototype.startsWith || (String.prototype.startsWith = function(t, e) {
  59058. return e = e || 0, this.lastIndexOf(t, e) === e
  59059. }), String.prototype.endsWith || (String.prototype.endsWith = function(t, e) {
  59060. (void 0 === e || e > this.length) && (e = this.length), e -= t.length;
  59061. var i = this.indexOf(t, e);
  59062. return -1 !== i && i === e
  59063. }), String.prototype.trimLeft || (String.prototype.trimLeft = function() {
  59064. return this.replace(/^\s+/, "")
  59065. })
  59066. }), {}],
  59067. 429: [(function(t, e, i) {
  59068. "use strict";
  59069. var n = Object.setPrototypeOf || {
  59070. __proto__: []
  59071. }
  59072. instanceof Array && function(t, e) {
  59073. t.__proto__ = e
  59074. } || function(t, e) {
  59075. for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
  59076. };
  59077. window.__extends = function(t, e) {
  59078. function i() {
  59079. this.constructor = t
  59080. }
  59081. n(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i)
  59082. }, window.__assign = Object.assign || function(t) {
  59083. for (var e, i = 1, n = arguments.length; i < n; i++)
  59084. for (var r in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
  59085. return t
  59086. }, window.__rest = function(t, e) {
  59087. var i = {};
  59088. for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
  59089. if (null != t && "function" == typeof Object.getOwnPropertySymbols) {
  59090. var r = 0;
  59091. for (n = Object.getOwnPropertySymbols(t); r < n.length; r++) e.indexOf(n[r]) < 0 && (i[n[r]] = t[n[r]])
  59092. }
  59093. return i
  59094. }, window.__decorate = function(t, e, i, n) {
  59095. var r, s = arguments.length,
  59096. o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
  59097. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n);
  59098. else
  59099. for (var a = t.length - 1; a >= 0; a--)(r = t[a]) && (o = (s < 3 ? r(o) : s > 3 ? r(e, i, o) : r(e, i)) || o);
  59100. return s > 3 && o && Object.defineProperty(e, i, o), o
  59101. }, window.__param = function(t, e) {
  59102. return function(i, n) {
  59103. e(i, n, t)
  59104. }
  59105. }, window.__metadata = function(t, e) {
  59106. if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(t, e)
  59107. }, window.__awaiter = function(t, e, i, n) {
  59108. return new(i || (i = Promise))(function(r, s) {
  59109. function o(t) {
  59110. try {
  59111. l(n.next(t))
  59112. } catch (t) {
  59113. s(t)
  59114. }
  59115. }
  59116. function a(t) {
  59117. try {
  59118. l(n.throw(t))
  59119. } catch (t) {
  59120. s(t)
  59121. }
  59122. }
  59123. function l(t) {
  59124. t.done ? r(t.value) : new i(function(e) {
  59125. e(t.value)
  59126. }).then(o, a)
  59127. }
  59128. l((n = n.apply(t, e || [])).next())
  59129. })
  59130. }, window.__generator = function(t, e) {
  59131. var i, n, r, s, o = {
  59132. label: 0,
  59133. sent: function() {
  59134. if (1 & r[0]) throw r[1];
  59135. return r[1]
  59136. },
  59137. trys: [],
  59138. ops: []
  59139. };
  59140. return s = {
  59141. next: a(0),
  59142. throw: a(1),
  59143. return: a(2)
  59144. }, "function" == typeof Symbol && (s[Symbol.iterator] = function() {
  59145. return this
  59146. }), s;
  59147. function a(t) {
  59148. return function(e) {
  59149. return l([t, e])
  59150. }
  59151. }
  59152. function l(s) {
  59153. if (i) throw new TypeError("Generator is already executing.");
  59154. for (; o;) try {
  59155. if (i = 1, n && (r = 2 & s[0] ? n.return : s[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, s[1])).done) return r;
  59156. switch (n = 0, r && (s = [2 & s[0], r.value]), s[0]) {
  59157. case 0:
  59158. case 1:
  59159. r = s;
  59160. break;
  59161. case 4:
  59162. return o.label++, {
  59163. value: s[1],
  59164. done: !1
  59165. };
  59166. case 5:
  59167. o.label++, n = s[1], s = [0];
  59168. continue;
  59169. case 7:
  59170. s = o.ops.pop(), o.trys.pop();
  59171. continue;
  59172. default:
  59173. if (!(r = (r = o.trys).length > 0 && r[r.length - 1]) && (6 === s[0] || 2 === s[0])) {
  59174. o = 0;
  59175. continue
  59176. }
  59177. if (3 === s[0] && (!r || s[1] > r[0] && s[1] < r[3])) {
  59178. o.label = s[1];
  59179. break
  59180. }
  59181. if (6 === s[0] && o.label < r[1]) {
  59182. o.label = r[1], r = s;
  59183. break
  59184. }
  59185. if (r && o.label < r[2]) {
  59186. o.label = r[2], o.ops.push(s);
  59187. break
  59188. }
  59189. r[2] && o.ops.pop(), o.trys.pop();
  59190. continue
  59191. }
  59192. s = e.call(t, o)
  59193. } catch (t) {
  59194. s = [6, t], n = 0
  59195. } finally {
  59196. i = r = 0
  59197. }
  59198. if (5 & s[0]) throw s[1];
  59199. return {
  59200. value: s[0] ? s[1] : void 0,
  59201. done: !0
  59202. }
  59203. }
  59204. }, window.__exportStar = function(t, e) {
  59205. for (var i in t) e.hasOwnProperty(i) || (e[i] = t[i])
  59206. }, window.__values = function(t) {
  59207. var e = "function" == typeof Symbol && t[Symbol.iterator],
  59208. i = 0;
  59209. return e ? e.call(t) : {
  59210. next: function() {
  59211. return t && i >= t.length && (t = void 0), {
  59212. value: t && t[i++],
  59213. done: !t
  59214. }
  59215. }
  59216. }
  59217. }, window.__read = function(t, e) {
  59218. var i = "function" == typeof Symbol && t[Symbol.iterator];
  59219. if (!i) return t;
  59220. var n, r, s = i.call(t),
  59221. o = [];
  59222. try {
  59223. for (;
  59224. (void 0 === e || e-- > 0) && !(n = s.next()).done;) o.push(n.value)
  59225. } catch (t) {
  59226. r = {
  59227. error: t
  59228. }
  59229. } finally {
  59230. try {
  59231. n && !n.done && (i = s.return) && i.call(s)
  59232. } finally {
  59233. if (r) throw r.error
  59234. }
  59235. }
  59236. return o
  59237. }, window.__spread = function() {
  59238. for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(__read(arguments[e]));
  59239. return t
  59240. }, window.__await = function(t) {
  59241. return this instanceof __await ? (this.v = t, this) : new __await(t)
  59242. }, window.__asyncGenerator = function(t, e, i) {
  59243. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  59244. var n, r = i.apply(t, e || []),
  59245. s = [];
  59246. return n = {}, o("next"), o("throw"), o("return"), n[Symbol.asyncIterator] = function() {
  59247. return this
  59248. }, n;
  59249. function o(t) {
  59250. r[t] && (n[t] = function(e) {
  59251. return new Promise(function(i, n) {
  59252. s.push([t, e, i, n]) > 1 || a(t, e)
  59253. })
  59254. })
  59255. }
  59256. function a(t, e) {
  59257. try {
  59258. l(r[t](e))
  59259. } catch (t) {
  59260. u(s[0][3], t)
  59261. }
  59262. }
  59263. function l(t) {
  59264. t.value instanceof __await ? Promise.resolve(t.value.v).then(h, c) : u(s[0][2], t)
  59265. }
  59266. function h(t) {
  59267. a("next", t)
  59268. }
  59269. function c(t) {
  59270. a("throw", t)
  59271. }
  59272. function u(t, e) {
  59273. t(e), s.shift(), s.length && a(s[0][0], s[0][1])
  59274. }
  59275. }, window.__asyncDelegator = function(t) {
  59276. var e, i;
  59277. return e = {}, n("next"), n("throw", (function(t) {
  59278. throw t
  59279. })), n("return"), e[Symbol.iterator] = function() {
  59280. return this
  59281. }, e;
  59282. function n(n, r) {
  59283. e[n] = t[n] ? function(e) {
  59284. return (i = !i) ? {
  59285. value: __await(t[n](e)),
  59286. done: "return" === n
  59287. } : r ? r(e) : e
  59288. } : r
  59289. }
  59290. }, window.__asyncValues = function(t) {
  59291. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  59292. var e, i = t[Symbol.asyncIterator];
  59293. return i ? i.call(t) : (t = "function" == typeof __values ? __values(t) : t[Symbol.iterator](), e = {}, n("next"), n("throw"), n("return"), e[Symbol.asyncIterator] = function() {
  59294. return this
  59295. }, e);
  59296. function n(i) {
  59297. e[i] = t[i] && function(e) {
  59298. return new Promise(function(n, s) {
  59299. r(n, s, (e = t[i](e)).done, e.value)
  59300. })
  59301. }
  59302. }
  59303. function r(t, e, i, n) {
  59304. Promise.resolve(n).then((function(e) {
  59305. t({
  59306. value: e,
  59307. done: i
  59308. })
  59309. }), e)
  59310. }
  59311. }, window.__makeTemplateObject = function(t, e) {
  59312. return Object.defineProperty ? Object.defineProperty(t, "raw", {
  59313. value: e
  59314. }) : t.raw = e, t
  59315. }, window.__importStar = function(t) {
  59316. if (t && t.__esModule) return t;
  59317. var e = {};
  59318. if (null != t)
  59319. for (var i in t) Object.hasOwnProperty.call(t, i) && (e[i] = t[i]);
  59320. return e.default = t, e
  59321. }, window.__importDefault = function(t) {
  59322. return t && t.__esModule ? t : {
  59323. default: t
  59324. }
  59325. }
  59326. }), {}],
  59327. 430: [(function(t, e, i) {
  59328. "use strict";
  59329. var n = "undefined" == typeof window ? global : window;
  59330. function r(t, e) {
  59331. void 0 === n[t] && (n[t] = e)
  59332. }
  59333. function s(t, e) {
  59334. void 0 === n[t] && Object.defineProperty(n, t, {
  59335. get: function() {
  59336. var i = void 0;
  59337. return "CC_WECHATGAMESUB" === t ? i = "cc.sys.platform === cc.sys.WECHAT_GAME_SUB" : "CC_WECHATGAME" === t ? i = "cc.sys.platform === cc.sys.WECHAT_GAME" : "CC_QQPLAY" === t && (i = "cc.sys.platform === cc.sys.QQ_PLAY"), cc.warnID(1400, t, i), e
  59338. }
  59339. })
  59340. }
  59341. function o(t) {
  59342. return "object" == typeof n[t]
  59343. }
  59344. r("CC_BUILD", !1), n.CC_BUILD = !0, n.CC_DEV = !1, n.CC_DEBUG = !1, n.CC_JSB = !1, n.CC_NATIVERENDERER = !1, n.CC_SUPPORT_JIT = !0, r("CC_TEST", o("tap") || o("QUnit")), r("CC_EDITOR", o("Editor") && o("process") && "electron" in process.versions), r("CC_PREVIEW", !0), r("CC_RUNTIME", "function" == typeof loadRuntime), r("CC_JSB", o("jsb") && !0);
  59345. var a = !(!o("wx") || !wx.getSharedCanvas),
  59346. l = !(!o("wx") || !wx.getSystemInfoSync && !wx.getSharedCanvas),
  59347. h = o("bk");
  59348. s("CC_WECHATGAMESUB", a), s("CC_WECHATGAME", l), s("CC_QQPLAY", h);
  59349. n.CocosEngine = cc.ENGINE_VERSION = "2.2.2"
  59350. }), {}]
  59351. }, {}, [422]);